Shane Spies 5 years ago
parent
commit
676f3dcf2c
100 changed files with 24148 additions and 0 deletions
  1. BIN
      Compiler/Automatic Update Core.dll
  2. BIN
      Compiler/Batch Compiler Core.dll
  3. BIN
      Compiler/Batch Compiler.exe
  4. 163 0
      Compiler/Readme.txt
  5. 74 0
      Compiler/Specifications/Backup.bci
  6. 296 0
      Compiler/Specifications/Batch.bci
  7. 155 0
      Compiler/Specifications/HLFix.bci
  8. 174 0
      Compiler/Specifications/Half-Life.bci
  9. 130 0
      Compiler/Specifications/Mapster.bci
  10. 148 0
      Compiler/Specifications/Opt_EntData.bci
  11. 51 0
      Compiler/Specifications/Quake Tools Legacy.bcs
  12. 409 0
      Compiler/Specifications/Quake Tools.bci
  13. 171 0
      Compiler/Specifications/RESGen.bci
  14. 155 0
      Compiler/Specifications/Source Batch.bci
  15. 61 0
      Compiler/Specifications/Source GLView.bci
  16. 147 0
      Compiler/Specifications/Source Texture Utility.bcs
  17. 52 0
      Compiler/Specifications/Source Tools Advanced.bcs
  18. 46 0
      Compiler/Specifications/Source Tools Normal.bcs
  19. 686 0
      Compiler/Specifications/Source Tools.bci
  20. 130 0
      Compiler/Specifications/Steam.bci
  21. 17 0
      Compiler/Specifications/Templates.bci
  22. 83 0
      Compiler/Specifications/Zoners Tools Advanced.bcs
  23. 67 0
      Compiler/Specifications/Zoners Tools Legacy.bcs
  24. 64 0
      Compiler/Specifications/Zoners Tools Normal.bcs
  25. 1027 0
      Compiler/Specifications/Zoners Tools P Series.bci
  26. 894 0
      Compiler/Specifications/Zoners Tools.bci
  27. 18 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/example-batch-file.bat
  28. 72 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/shlt.fgd
  29. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/hlbsp.exe
  30. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/hlcsg.exe
  31. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/hlrad.exe
  32. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/hlvis.exe
  33. 101 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/lights.rad
  34. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/ripent.exe
  35. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/hlbsp.exe
  36. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/hlcsg.exe
  37. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/hlrad.exe
  38. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/hlvis.exe
  39. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/ripent.exe
  40. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlbsp.exe
  41. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlcsg.exe
  42. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlfix.exe
  43. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlrad.exe
  44. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlvis.exe
  45. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/ripent.exe
  46. 9 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/thecompilator(GoldSource).bat
  47. 4 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/wad.txt
  48. BIN
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/zhlt.wad
  49. 54 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/Terms of Use.txt
  50. 49 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/TimeCounter.h
  51. 649 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/anorms.h
  52. 158 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/blockmem.cpp
  53. 20 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/blockmem.h
  54. 149 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/boundingbox.h
  55. 1696 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/bspfile.cpp
  56. 422 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/bspfile.h
  57. 578 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/cmdlib.cpp
  58. 170 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/cmdlib.h
  59. 228 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/filelib.cpp
  60. 22 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/filelib.h
  61. 0 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/files.cpp
  62. 40 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/hlassert.h
  63. 684 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/log.cpp
  64. 104 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/log.h
  65. 9 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/mathlib.cpp
  66. 278 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/mathlib.h
  67. 17 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/mathtypes.h
  68. 109 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/messages.cpp
  69. 96 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/messages.h
  70. 61 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/resourcelock.cpp
  71. 11 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/resourcelock.h
  72. 362 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/scriplib.cpp
  73. 26 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/scriplib.h
  74. 682 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/threads.cpp
  75. 49 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/threads.h
  76. 58 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/win32fix.h
  77. 1103 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/winding.cpp
  78. 82 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/winding.h
  79. 5 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/copy_executables_here.bat
  80. 278 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/bsp5.h
  81. 624 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/hlbsp.mak
  82. 721 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/hlbsp.vcproj
  83. 177 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/hlbsp.vcproj.SILENCERSPC.Administrator.user
  84. 48 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/make.inc
  85. 259 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/merge.cpp
  86. 553 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/outside.cpp
  87. 325 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/portals.cpp
  88. 1533 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/qbsp.cpp
  89. 1164 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/solidbsp.cpp
  90. 309 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/surfaces.cpp
  91. 558 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/tjunc.cpp
  92. 351 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/writebsp.cpp
  93. 458 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/autowad.cpp
  94. 1131 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/brush.cpp
  95. 361 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/brushunion.cpp
  96. 312 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/csg.h
  97. 688 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/hlcsg.mak
  98. 746 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/hlcsg.vcproj
  99. 177 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/hlcsg.vcproj.SILENCERSPC.Administrator.user
  100. 0 0
      Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/hullfile.cpp

BIN
Compiler/Automatic Update Core.dll


BIN
Compiler/Batch Compiler Core.dll


BIN
Compiler/Batch Compiler.exe


+ 163 - 0
Compiler/Readme.txt

@@ -0,0 +1,163 @@
+=========================================
+=========================================
+ Batch Compiler BY: RYAN "NEMESIS" GREGG
+=========================================
+=========================================
+
+===========================
+Program/Author Information:
+===========================
+
+---- General Program Information ----
+Date                     : April 22nd 2005
+Author                   : Ryan "NEMESIS" Gregg
+Title                    : Batch Compiler
+Build                    : 3.1.2
+Email address            : [email protected]
+Home page /  Website     : http://nemesis.thewavelength.net/
+
+---- Program Construction Information ----
+Written In               : C# .NET
+
+=============
+Requirements:
+=============
+
+  OS
+  - Windows XP
+  - Windows 2000
+  - Windows ME
+  - Windows 98
+  - Windows NT
+  - Windows Server 2003
+
+  CPU
+  - 90 MHz Intel Pentium Class Processor or Equivalent
+
+  RAM
+  - 32 MB of RAM (96 MB recommended.)
+
+====
+FAQ:
+====
+
+Q.
+  When I launch Batch Compiler I get the following error message:
+  "The application failed to initialize properly (0xc0000135). Click ok
+  to terminate the application."
+
+A.
+  Batch Compiler is written in C# .NET and such as requires the .NET
+  runtimes to run. See the following link for more information:
+  http://www.microsoft.com/downloads/details.aspx?FamilyId=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=en
+
+
+Q.
+
+  When I launch Batch Compiler I get the following error message:
+  "A required .DLL file, MSCOREE.DLL, was not found."
+
+A.
+  Batch Compiler is written in C# .NET and such as requires the .NET
+  runtimes to run. See the following link for more information:
+  http://www.microsoft.com/downloads/details.aspx?FamilyId=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=en
+
+
+Q.
+  When I open an old preset file I get the following error message:
+  "Error: The data at the root level is invalid. Line 1, position 1."
+
+A.
+  Batch Compiler v3.X.X is not backwards compatible with Batch Compiler
+  v2.X.X. This means that old preset files will not work and you will
+  have to recreate them.
+
+
+Q.
+  How can I convert a preset I've saved using one specification file to
+  a preset of another specification file?
+
+A.
+  This can be accomplished by importing the preset. To do this:
+
+    1. From the 'Specifications' menu select the specification file you
+       would like to convert the preset to.
+    2. From the 'File' menu select 'Import Preset'.
+    3. Browse to and open the preset you would like to convert from.
+
+==================
+Program Changelog:
+==================
+
+  v3.1.2
+  - Changed compile shortcut to Ctrl-R to avoid conflicts.
+  - Added context menu shell execution options for the target file.
+
+  v3.1.1
+  - Improved Option Form path browsing.
+  - Fixed NotePad detection for automatic setup.
+
+  v3.1.0
+  - Added new Variable element to specifications.
+  - Added Command List Batches to toggleable stage list.
+  - Added "Shared With" line to option tool tip text.
+  - Upgraded to Automatic Update library.
+  - Fixed "Remember File" bug.
+  - Updated Nem's Tools link.
+  - Other small changes.
+
+  v3.0.0
+  - Rewrote application in C#.
+  - Enhanced and standardized specification format.
+  - Added web based specification auto update control.
+  - Added support for several tools through specifications.
+
+==============================
+Program Copyright-Permissions:
+==============================
+
+LICENSE 
+
+Terms and Conditions for Copying, Distributing, and Modifying 
+
+Items other than copying, distributing, and modifying the Content
+with which this license was distributed (such as using, etc.) are
+outside the scope of this license. 
+
+1. You may copy and distribute exact replicas of Batch Compiler as you receive
+   it, in any medium, provided that you conspicuously and appropriately
+   publish on each copy an appropriate copyright notice and disclaimer
+   of warranty; keep intact all the notices that refer to this License
+   and to the absence of any warranty; and give any other recipients of
+   Batch Compiler a copy of this License along with Batch Compiler. You may at your
+   option charge a fee for the media and/or handling involved in creating
+   a unique copy of the Batch Compiler for use offline, you may at your option offer
+   instructional support for the Batch Compiler in exchange for a fee, or you may at
+   your option offer warranty in exchange for a fee. You may not charge a
+   fee for Batch Compiler itself. You may not charge a fee for the sole service
+   of providing access to and/or use of Batch Compiler via a network (e.g. the Internet),
+   whether it be via the world wide web, FTP, or any other method. 
+
+2. You may not modify your copy or copies of Batch Compiler or any portion of it.
+
+3. You are not required to accept this License, since you have not signed it.
+   However, nothing else grants you permission to copy, distribute or modify Batch Compiler.
+   These actions are prohibited by law if you do not accept this License. Therefore,
+   by copying or distributing Batch Compiler you indicate your acceptance of this License to do
+   so, and all its terms and conditions for copying, distributing and modifying Batch Compiler. 
+
+NO WARRANTY 
+
+4. BECAUSE BATCH COMPILER IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+   FOR BATCH COMPILER, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED
+   IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE BATCH COMPILER "AS IS" WITHOUT
+   WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+   THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
+   ENTIRE RISK OF USE OF THE BATCH COMPILER IS WITH YOU. SHOULD BATCH COMPILER PROVE FAULTY, INACCURATE, OR
+   OTHERWISE UNACCEPTABLE YOU ASSUME THE COST OF ALL NECESSARY REPAIR OR CORRECTION. 
+
+5. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY
+   COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MIRROR AND/OR REDISTRIBUTE BATCH COMPILER AS
+   PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
+   INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE BATCH COMPILER,
+   EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 

+ 74 - 0
Compiler/Specifications/Backup.bci

@@ -0,0 +1,74 @@
+// Specification: Backup
+// Written by: Ryan Gregg
+// Version: 2.0
+// Created: August 4, 2004
+// Last updated: August 4, 2004
+
+Batch
+{
+  Name		"Backup"
+  Priority	"1"
+  Links		"Backup,http://collective.valve-erc.com/index.php?go=mapbackup"
+  Stages	"Backup"
+  Filter	"Supported Files|*.map;*.rmf;*.bsp|MAP Files (*.map)|*.map|RMF Files (*.rmf)|*.rmf|BSP Files (*.bsp)|*.bsp"
+  Template	"@echo off\n"_
+  		"\"${StagePath=Backup}\" ${StageParam=Backup} \"${FilePath}\\${FileName}\"\n"
+}
+
+//
+// Backup
+//
+Stage
+{
+  Name		"Backup"
+  Type		"Program"
+  Filter	"MAPBACKUP (mapbackup.exe)|mapbackup.exe"
+
+  CheckBox
+  {
+    Name	"Sub-Directory Save"
+    Param	"-dir"
+    Hint	"\tPlace backups of all files inside \filename\.\n\n"_
+    		"\tBy default, an incremental backup will be created of your mapfile (mapname0000.map, mapname0001.map, etc) in the same directory everytime you compile. This switch will override that behaviour and create a sub-directory using the map file name."
+  }
+
+  TextBox
+  {
+    Name	"Maximum Backup Files"
+    Param	"-max"
+    Type	"Integer"
+    Default	"64"
+    Min		"0"
+    Max		"64"
+    Hint	"\tSpecify a maximum number of backup files to create.\n\n"_
+    		"\tOnce the maximum number of backups is reached (defined by -max), the program starts overwriting at 1 and counts up again."
+  }
+
+  TextBox
+  {
+    Name	"Extension"
+    Param	"-ext"
+    Type	"String"
+    Hint	"\tForce a specific extension for all backup files."
+  }
+
+  FolderBox
+  {
+    Name	"Backup Path"
+    Param	"-out"
+    Hint	"\tForce a specific backup directory path (negates -ext and -dir)."
+  }
+
+  Space
+  {
+    Size	"6"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+}

+ 296 - 0
Compiler/Specifications/Batch.bci

@@ -0,0 +1,296 @@
+// Specification: Batch
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: August 4, 2004
+// Last updated: October 17, 2004
+
+// Updated by: Ryan Gregg
+// Date: October 17, 2004
+// Added Batch Batch.
+
+// Updated by: Ryan Gregg
+// Date: September 5, 2004
+// Thanks to: Matt 'Bluefang' Turnbull
+// Added Delete .INC After Compile
+// Moved Delete .ERR After Compile
+// Fixed Delete .ENT.BAK After Compile
+
+// Updated by: Ryan Gregg
+// Date: August 9, 2004
+// Thanks to: Anders Jenbo
+// Added Delete .ENT.BAK After Compile
+
+Variable
+{
+  Name		"Output"
+  Type		"Folder"
+  Optional	"False"
+  Hint		"File output directory."
+}
+
+Batch
+{
+  Name		"Batch"
+  Priority	"1"
+  Stages	"Batch"
+  Template	"@echo off\n"_
+  		"${StageCmd=Batch}\n"
+}
+
+//
+// Batch
+//
+Stage
+{
+  Name		"Batch"
+  Title		"Batch Operations"
+  Type		"CommandList"
+
+  //
+  // Recommended File Deletions
+  //
+
+  LabelBox
+  {
+    Name	"Recommended File Deletions:"
+    Bold	"True"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .WIC After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.wic\" goto nodelwic\n"_
+    		"del \"${FilePath}\\${FileName}.wic\"\n"_
+    		"echo ${FilePath}\\${FileName}.wic deleted.\n"_
+    		":nodelwic"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .LIN After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.lin\" goto nodellin\n"_
+    		"del \"${FilePath}\\${FileName}.lin\"\n"_
+    		"echo ${FilePath}\\${FileName}.lin deleted.\n"_
+    		":nodellin"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .P0 After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.p0\" goto nodelp0\n"_
+    		"del \"${FilePath}\\${FileName}.p0\"\n"_
+    		"echo ${FilePath}\\${FileName}.p0 deleted.\n"_
+    		":nodelp0"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .P1 After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.p1\" goto nodelp1\n"_
+    		"del \"${FilePath}\\${FileName}.p1\"\n"_
+    		"echo ${FilePath}\\${FileName}.p1 deleted.\n"_
+    		":nodelp1"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .P2 After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.p2\" goto nodelp2\n"_
+    		"del \"${FilePath}\\${FileName}.p2\"\n"_
+    		"echo ${FilePath}\\${FileName}.p2 deleted.\n"_
+    		":nodelp2"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .P3 After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.p3\" goto nodelp3\n"_
+    		"del \"${FilePath}\\${FileName}.p3\"\n"_
+    		"echo ${FilePath}\\${FileName}.p3 deleted.\n"_
+    		":nodelp3"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .PRT After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.prt\" goto nodelprt\n"_
+    		"del \"${FilePath}\\${FileName}.prt\"\n"_
+    		"echo ${FilePath}\\${FileName}.prt deleted.\n"_
+    		":nodelprt"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .ERR After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.err\" goto nodelerr\n"_
+    		"del \"${FilePath}\\${FileName}.err\"\n"_
+    		"echo ${FilePath}\\${FileName}.err deleted.\n"_
+    		":nodelerr"
+    Hint	"Note: If you delete this file you won't be able to view the compiler's error file."
+  }
+
+  CheckBox
+  {
+    Name	"Delete .ENT.BAK After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.ent.bak\" goto nodelentbac\n"_
+    		"del \"${FilePath}\\${FileName}.ent.bak\"\n"_
+    		"echo ${FilePath}\\${FileName}.ent.bak deleted.\n"_
+    		":nodelentbac"
+  }
+
+  Space
+  {
+    Size	"1"
+  }
+
+  //
+  // Recommended File Functions
+  //
+
+  LabelBox
+  {
+    Name	"Recommended File Functions:"
+    Bold	"True"
+  }
+
+  CheckBox
+  {
+    Name	"Copy .BSP After Compile"
+    Bold	"True"
+    Param	"if not exist \"${FilePath}\\${FileName}.bsp\" goto nocopybsp\n"_
+    		"copy \"${FilePath}\\${FileName}.bsp\" \"${Output}\"\n"_
+    		"echo ${FileName}.bsp copied to ${Output}.\n"_
+    		":nocopybsp"
+    Hint	"Copy your .BSP file to your map destination folder."
+  }
+
+  CheckBox
+  {
+    Name	"Copy .RES After Compile"
+    Bold	"True"
+    Param	"if not exist \"${FilePath}\\${FileName}.res\" goto nocopyres\n"_
+    		"copy \"${FilePath}\\${FileName}.res\" \"${Output}\"\n"_
+    		"echo ${FileName}.res copied to ${Output}.\n"_
+    		":nocopyres"
+    Hint	"Copy your .RES file to your map destination folder."
+  }
+
+  CheckBox
+  {
+    Name	"Copy .PTS After Compile"
+    Bold	"True"
+    Param	"if not exist \"${FilePath}\\${FileName}.pts\" goto nocopypts\n"_
+    		"copy \"${FilePath}\\${FileName}.pts\" \"${Output}\"\n"_
+    		"echo ${FileName}.pts copied to ${Output}.\n"_
+    		":nocopypts"
+    Hint	"Copy your .PTS file to your map destination folder."
+  }
+
+  Space
+  {
+    Size	"7"
+  }
+
+  //
+  // Unrecommended File Deletions
+  //
+
+  LabelBox
+  {
+    Name	"Unrecommended File Deletions:"
+    Bold	"True"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .LOG After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.log\" goto nodellog\n"_
+    		"del \"${FilePath}\\${FileName}.log\"\n"_
+    		"echo ${FilePath}\\${FileName}.log deleted.\n"_
+    		":nodellog"
+    Hint	"Note: If you delete this file you won't be able to view the compiler's log file."
+  }
+
+  CheckBox
+  {
+    Name	"Delete .PTS After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.pts\" goto nodelpts\n"_
+    		"del \"${FilePath}\\${FileName}.pts\"\n"_
+    		"echo ${FilePath}\\${FileName}.pts deleted.\n"_
+    		":nodelpts"
+    Hint	"Note: If you delete this file without copying it you won't be able to view the compiler's pts file."
+  }
+
+  CheckBox
+  {
+    Name	"Delete .MAP After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.map\" goto nodelmap\n"_
+    		"del \"${FilePath}\\${FileName}.map\"\n"_
+    		"echo ${FilePath}\\${FileName}.map deleted.\n"_
+    		":nodelmap"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .MAX After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.max\" goto nodelmax\n"_
+    		"del \"${FilePath}\\${FileName}.max\"\n"_
+    		"echo ${FilePath}\\${FileName}.max deleted.\n"_
+    		":nodelmax"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .RMF After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.rmf\" goto nodelrmf\n"_
+    		"del \"${FilePath}\\${FileName}.rmf\"\n"_
+    		"echo ${FilePath}\\${FileName}.rmf deleted.\n"_
+    		":nodelrmf"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .RMX After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.rmx\" goto nodelrmx\n"_
+    		"del \"${FilePath}\\${FileName}.rmx\"\n"_
+    		"echo ${FilePath}\\${FileName}.rmx deleted.\n"_
+    		":nodelrmx"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .BSP After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.bsp\" goto nodelbsp\n"_
+    		"del \"${FilePath}\\${FileName}.bsp\"\n"_
+    		"echo ${FilePath}\\${FileName}.bsp deleted.\n"_
+    		":nodelbsp"
+    Hint	"Note: If you delete this file without copying it you won't be able to play your bsp file."
+  }
+
+  CheckBox
+  {
+    Name	"Delete .RES After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.res\" goto nodelres\n"_
+    		"del \"${FilePath}\\${FileName}.res\"\n"_
+    		"echo ${FilePath}\\${FileName}.res deleted.\n"_
+    		":nodelres"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .ENT After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.ent\" goto nodelent\n"_
+    		"del \"${FilePath}\\${FileName}.ent\"\n"_
+    		"echo ${FilePath}\\${FileName}.ent deleted.\n"_
+    		":nodelent"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .INC After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.inc\" goto nodelinc\n"_
+    		"del \"${FilePath}\\${FileName}.inc\"\n"_
+    		"echo ${FilePath}\\${FileName}.inc deleted.\n"_
+    		":nodelinc"
+  }
+}

File diff suppressed because it is too large
+ 155 - 0
Compiler/Specifications/HLFix.bci


+ 174 - 0
Compiler/Specifications/Half-Life.bci

@@ -0,0 +1,174 @@
+// Specification: Half-Life
+// Written by: Ryan Gregg
+// Version: 1.1.1.0
+// Created: August 4, 2004
+// Last updated: August 4, 2004
+
+Batch
+{
+  Name		"HL"
+  Priority	"1"
+  Links		"Valve,http://www.valvesoftware.com/"
+  Stages	"HL"
+  Filter	"BSP Files (*.bsp)|*.bsp"
+  ShellExecute	"True"
+  Template	"\"${StagePath=hl}\" ${StageParam=hl}"
+}
+
+//
+// HL
+//
+Stage
+{
+  Name		"HL"
+  Title		"Half-Life"
+  Type		"Program"
+  Filter	"Half-Life (hl.exe)|hl.exe|Counter-Strike (cstrike.exe)|cstrike.exe"
+
+  CheckBox
+  {
+    Name	"Run Map"
+    Param	"+map ${FileName}"
+    Checked	"True"
+    Bold	"True"
+    Hint	"\tThe map to start Half-Life with."
+  }
+
+  CheckBox
+  {
+    Name	"Enable Console"
+    Param	"-console"
+    Bold	"True"
+    Hint	"\tStart Half-Life with console enabled."
+  }
+
+  CheckBox
+  {
+    Name	"To Console"
+    Param	"-toconsole"
+    Hint	"\tLoad Half-Life straight to console screen."
+  }
+
+  CheckBox
+  {
+    Name	"Developer"
+    Param	"-dev"
+    Hint	"\tStart Half-Life in developer mode (cheats)."
+  }
+
+  CheckBox
+  {
+    Name	"Safe Mode"
+    Param	"-safe"
+    Hint	"\tStart Half-Life in safe mode (no acceleration)."
+  }
+
+  CheckBox
+  {
+    Name	"Numeric Ping"
+    Param	"-numericping"
+    Hint	"\tDisplay server listing with ping times instead of Green dots."
+  }
+
+  CheckBox
+  {
+    Name	"Minimum Memory"
+    Param	"-minmemory"
+    Hint	"\tStart Half-Life with minimum memory."
+  }
+
+  CheckBox
+  {
+    Name	"No Intro"
+    Param	"-nointro"
+    Hint	"\tSkip starting intro."
+  }
+
+  CheckBox
+  {
+    Name	"No Joystick"
+    Param	"-nojoy"
+    Hint	"\tDisable joystick initialization (saves a bit of memory)."
+  }
+
+  Space
+  {
+    Size	"1"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+
+  CheckBox
+  {
+    Name	"No IP"
+    Param	"-noip"
+    Hint	"\tDon't let Half-Life try to connect to the internet."
+  }
+
+  CheckBox
+  {
+    Name	"No IPX"
+    Param	"-noipx"
+    Hint	"\tDisable IPX (recommended if you do not use IPX communication)."
+  }
+
+  TextBox
+  {
+    Name	"MOD"
+    Param	"-game"
+    Bold	"True"
+    Type	"String"
+    Default	"cstrike"
+    Hint	"\tThe MOD to start Half-Life in."
+  }
+
+  TextBox
+  {
+    Name	"Heap Size"
+    Param	"-heapsize"
+    Type	"Integer"
+    Default	"65536"
+    Min		"16384"
+    Hint	"\tThe amount of memory to allocate for Half-Life."
+  }
+
+  TextBox
+  {
+    Name	"Particles"
+    Param	"-particles"
+    Type	"Integer"
+    Default	"65536"
+    Min		"1"
+    Hint	"\tThe number of particles to search for leaks with."
+  }
+
+  ComboBox
+  {
+    Name	"Render Mode"
+    Default	"Direct 3D"
+    Options	"Direct 3D,-d3d|Software,-soft|Open GL,-gl"
+    Hint	"\tStart Half-Life in the following rendermode."
+  }
+
+  ComboBox
+  {
+    Name	"Colors"
+    Default	"32bit"
+    Options	"32bit,-32bpp|16bit,-32bpp"
+    Hint	"\tStart Half-Life in 32 or 16 bit colors."
+  }
+
+  ComboBox
+  {
+    Name	"Startup State"
+    Default	"Fullscreen"
+    Options	"Fullscreen,-full|Windowed,-win"
+    Hint	"\tStart Half-Life with the following window state."
+  }
+}

File diff suppressed because it is too large
+ 130 - 0
Compiler/Specifications/Mapster.bci


+ 148 - 0
Compiler/Specifications/Opt_EntData.bci

@@ -0,0 +1,148 @@
+// Specification: Opt_EntData 0.7b
+// Written by: Anders Jenbo
+// Version: 0.7b
+// Created: August 8, 2004
+// Last updated: September 5, 2004
+
+// Updated by: Ryan Gregg
+// Date: September 5, 2004
+// Thanks to: Matt 'Bluefang' Turnbull
+// Added Texture Data option.
+// Changed Settings filter to setting_*.db.
+
+// Updated by: Ryan Gregg
+// Date: August 10, 2004
+// Fixed Opt_EntData's command line.
+
+// Updated by: Ryan Gregg
+// Date: August 9, 2004
+// Changed the switch for Keep Properties from -nolghts to -nostrip.
+// Renamed No Linemod option to No Line Mod.
+// Added No Log option.
+// Repositioned Additional Parameters to its standard position.
+// Spell checked all hints and improved their wording and punctuation.
+// Updated Opt_EntData link.
+
+Include		"Templates.bci"
+
+Batch
+{
+  Name		"Opt_EntData"
+  Priority	"1"
+  Links		"Opt_EntData,http://www.chatbear.com/board.plm?a=viewthread&t=52%2c1080647136%2c18491&id=634830&b=590&v=flatold&s=0"
+  Stages	"Opt_EntData"
+  Filter	"Entity Files (*.ent)|*.ent"
+  Template	"@echo off\n"_
+  		"\"${StagePath=Opt_EntData}\" \"${FilePath}\\${FileName}\" ${StageParam=Opt_EntData}\n"_
+  		"${LogViewerRun}\n"
+}
+
+//
+// Opt_EntData
+//
+Stage
+{
+  Name		"Opt_EntData"
+  Title		"Optimize Entity Data"
+  Type		"Program"
+  Filter	"Opt_EntData (opt_entdata.exe)|opt_entdata.exe"
+
+
+  CheckBox
+  {
+    Name	"No Line Mod"
+    Checked	"True"
+    Param	"-nolinemod"
+    Hint	"\tThis is an option for those having problems with other programs that may need access to a map's entdata.\n\n"_
+		"\tIt also makes debugging scripted events difficult so it is recommended only for release versions of a map.\n\n"_
+		"\tRunning Opt_EntData twice on the same ENT file with out this option will delete all entity data except for the worldspawn (first line) and can prevent RESGen from running properly."
+  }
+
+  CheckBox
+  {
+    Name	"Run RipEnt"
+    Checked	"True"
+    Param	"-ripent"
+    Hint	"\tOpt_EntData requires Ripent to import and export entity data to and from the BSP.\n\n"_
+		"\tThis option should always be checked unless you know what you are doing."
+  }
+
+  CheckBox
+  {
+    Name	"Simplify"
+    Param	"-simplify"
+    Hint	"\tSimplify takes names of entities and replaces them with a (in theory) shorter one.\n\n"_
+		"\tIt makes debugging scripted events difficult so it is recommended only for release versions of a map.\n\n"_
+		"\tWhen (if ever) asked for a log file from opt_entdata (or screen output) then -verbose is a recommended option to use.\n\n"_
+		"\tSometimes simplify may overwrite a name it shouldn't.  Consider, for example, an entity named spawnflags or something similar. Now let us assume simplify picks that up as a name and replaces it with a name of abc. Messy eh?"
+  }
+
+  CheckBox
+  {
+    Name	"Keep Misc"
+    Param	"-nomiscents"
+    Hint	"\tThis option prevents opt_entdata from removing the info_null, info_texlights and info_compile_parameters from the BSP.\n\n"_
+		"\tIf you seem to be getting errors around the \"Removing misc ents..\" message then try using this option."
+  }
+
+  CheckBox
+  {
+    Name	"Keep Lights"
+    Param	"-nolights"
+    Hint	"\tThis disables the removal of lights and (most) optimizations made on them.\n\n"_
+		"\tThis option has a MAJOR impact on the effectiveness of opt_entdata. Use with caution."
+  }
+
+  CheckBox
+  {
+    Name	"Keep Properties"
+    Param	"-nostrip"
+    Hint	"\tThis option is frequently the cause of in game problems concerning entities.\n\n"_
+		"\tThis option has a MAJOR impact on the effectiveness of opt_entdata. Use with caution."
+  }
+
+  CheckBox
+  {
+    Name	"No Log"
+    Param	"-nolog"
+    Hint	"\tDon't use the compile LOG files.\n\n"_
+    		"\tThis option disables the use of the LOG files which are normally written to whenever opt_entdata runs. Regardless of -nolog's presence, logging will be disabled if opt_entdata can't locate your map's LOG file."
+  }
+
+  CheckBox
+  {
+    Name	"Verbose"
+    Param	"-verbose"
+    Hint	"\tThe verbose option enables extra output information while the program is running.\n\n"_
+		"\tIf you observe strange problems verbose mode may show you where they occur.\n\n"_
+		"\tWhen (if ever) asked for a log file from opt_entdata (or screen output) then -verbose is a recommended option to use."
+  }
+
+  TextBox
+  {
+    Name	"Texture Data"
+    Param	"-texdata"
+    Type	"Integer"
+    Default	"4096"
+    Min		"2048"
+    Hint	"\tAlter maximum texture memory limit (in kb).\n\n"_
+    		"\tHalflife was built with a 2Mb texture limit, as was Opposing Force. The ZHLT default limit is 4Mb. Even 4Mb can be a bit much, when combined with model textures, skies, hud graphics, and more. This is especially true of people with older cards (Voodoo 1 and 2's, etc)."
+  }
+
+  FileBox
+  {
+    Name	"Settings"
+    Param	"-settings"
+    FullPath	"False"
+    Filter	"Setting File (setting_*.db)|setting_*.db"
+    Hint	"\tYou only need specify this if you don't want to use the setting_default."
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+}

+ 51 - 0
Compiler/Specifications/Quake Tools Legacy.bcs

@@ -0,0 +1,51 @@
+// Specification: Quake Tools Legacy
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: August 4, 2004
+// Last updated: September 13, 2004
+
+// Updated by: Ryan Gregg
+// Date: September 13, 2004
+// Improved game execution.
+
+Include		"Quake Tools.bci"
+Include		"Batch.bci"
+Include		"Half-Life.bci"
+Include		"Steam.bci"
+Include		"Templates.bci"
+
+Batch
+{
+  Name		"Quake Tools Legacy"
+  Priority	"3"
+  Links		"Steam,http://www.steampowered.com/|"_
+  		"Valve,http://www.valvesoftware.com/"
+  Filter	"Supported Files|*.map;*.bsp|MAP Files (*.map)|*.map|BSP Files (*.bsp)|*.bsp"
+  Stages	"CSG|BSP|VIS|RAD|Shared|Batch|HL|Steam"
+  LogFile	"${FilePath}\\${FileName}.log"
+  Template	"@echo off\n"_
+
+		"${Splash}"_
+
+  		"\"${StagePath=CSG}\" ${StageParam=CSG} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+
+  		"${StageCmd=Batch}\n"_
+  		"\"${StagePath=hl}\" ${StageParam=hl}\n"_
+  		"\"${StagePath=Steam}\" ${StageParam=Steam}\n"_
+		"goto succeeded\n"_
+
+		":failed\n"_
+  		"echo.\n"_
+		"echo There was a problem compiling your map, check your ${FileName}.log file for errors.\n"_
+		":succeeded\n"_
+  		"echo.\n"_
+
+  		"${LogViewerRun}\n"
+}

+ 409 - 0
Compiler/Specifications/Quake Tools.bci

@@ -0,0 +1,409 @@
+// Specification: Quake Tools
+// Written by: Ryan Gregg
+// Version: 2.8
+// Created: August 4, 2004
+// Last updated: August 4, 2004
+
+Include		"Templates.bci"
+
+Batch
+{
+  Name		"Quake Tools"
+  Priority	"2"
+  Filter	"Map Files (*.map)|*.map"
+  Stages	"CSG|BSP|VIS|RAD|Shared"
+  Template	"@echo off\n"_
+  		"\"${StagePath=CSG}\" ${StageParam=CSG} \"${FilePath}\\${FileName}\"\n"_
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} \"${FilePath}\\${FileName}\"\n"_
+  		"${LogViewerRun}\n"
+}
+
+Batch
+{
+  Name		"CSG"
+  Priority	"1"
+  Stages	"CSG|Shared"
+  Filter	"Map Files (*.map)|*.map"
+  Template	"@echo off\n"_
+  		"\"${StagePath=CSG}\" ${StageParam=CSG} \"${FilePath}\\${FileName}\"\n"_
+  		"${LogViewerRun}\n"
+}
+
+Batch
+{
+  Name		"BSP"
+  Priority	"1"
+  Stages	"BSP|Shared"
+  Filter	"Map Files (*.map)|*.map"
+  Template	"@echo off\n"_
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+  		"${LogViewerRun}\n"
+}
+
+Batch
+{
+  Name		"VIS"
+  Priority	"1"
+  Stages	"VIS|Shared"
+  Filter	"Map Files (*.map)|*.map"
+  Template	"@echo off\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+  		"${LogViewerRun}\n"
+}
+
+Batch
+{
+  Name		"RAD"
+  Priority	"1"
+  Stages	"RAD|Shared"
+  Filter	"Map Files (*.map)|*.map"
+  Template	"@echo off\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} \"${FilePath}\\${FileName}\"\n"_
+  		"${LogViewerRun}\n"
+}
+
+//
+// CSG
+//
+Stage
+{
+  Name		"CSG"
+  Title		"Constructive Solid Geometry"
+  Type		"Program"
+  Filter	"QCSG (qcsg.exe)|qcsg.exe"
+
+  CheckBox
+  {
+    Name	"No WAD Textures"
+    Param	"-nowadtextures"
+    Bold	"True"
+    Hint	"Include all used textures into bsp."_
+    		"This option is obsolete by -wadinclude and is only left in to retain some backwards compatibility."
+  }
+
+  CheckBox
+  {
+    Name	"Entities Only"
+    Param	"-onlyents"
+    Hint	"Do an entity update from .map to .bsp."_
+    		"This option will take the entities from the .map file and update them into the bsp file. For the most part, entities can only be edited. Adding or removing any can reorder the other entities which frequently break brush based entities, especially triggers."
+  }
+
+  CheckBox
+  {
+    Name	"GL View"
+    Param	"-glview"
+    Hint	"Create <mapname>.gl file."_
+    		"Creates a <mapname>.gl file, which contains the number of planes, the number of points in each plane, the points used to define each plane, and the total light on that plane."
+  }
+
+  Space
+  {
+    Size	"7"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"Add additional parameters here as you would a command line."
+  }
+}
+
+//
+// BSP
+//
+Stage
+{
+  Name		"BSP"
+  Title		"Binary Space Partition"
+  Type		"Program"
+  Filter	"QBSP (qbps2.exe)|qbsp2.exe"
+
+  CheckBox
+  {
+    Name	"Leak Only"
+    Param	"-leakonly"
+    Hint	"Run BSP only enough to check for leaks."_
+    		"If you already know a map has a leak, this is a good option to just save some time in hlbsp and just generate the pts file."
+  }
+
+  CheckBox
+  {
+    Name	"Not T-Junction"
+    Param	"-notjunc"
+    Hint	"Don't break edges on t-junctions (not for final runs)."_
+    		"This is a development/debugging option that should not be set in normal use."
+  }
+
+  TextBox
+  {
+    Name	"Subdivide"
+    Param	"-subdivide"
+    Type	"Single"
+    Default	"240.0"
+    Min		"64.0"
+    Max		"240.0"
+    Hint	"Sets the face subdivide size."_
+    		"Faces in Half-life are subdivided by this value (in units). The default and maximum are both 240, and it should never need to be set lower (as it just increases r_speeds)."
+  }
+  
+  Space
+  {
+    Size	"7"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"Add additional parameters here as you would a command line."
+  }
+}
+
+//
+// VIS
+//
+Stage
+{
+  Name		"VIS"
+  Title		"Visibility Index Set"
+  Type		"Program"
+  Filter	"VIS (vis.exe)|vis.exe"
+
+  CheckBox
+  {
+    Name	"Fast"
+    Param	"-fast"
+    Bold	"true"
+    Hint	"Fast vis."_
+    		"A fast vis is handy for running around in a developed map without dropping polygons. However, r_speeds will usually be pretty bad, as well as epoly counts. The map can still be lit with hlrad, however its quality and compile time will both suffer as a result. Maps should regularly be compiled without fast vis, as fast vis can mask a sudden increase in normal vis compile time."
+  }
+
+  Space
+  {
+    Size	"9"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"Add additional parameters here as you would a command line."
+  }
+}
+
+//
+// RAD
+//
+Stage
+{
+  Name		"RAD"
+  Title		"Radiosity"
+  Type		"Program"
+  Filter	"QRAD (qrad.exe)|qrad.exe"
+
+  CheckBox
+  {
+    Name	"Extra"
+    Param	"-extra"
+    Bold	"True"
+    Hint	"Turns on 9 point oversampling for lighting, making it look much better."
+  }
+
+  CheckBox
+  {
+    Name	"No Texture Scale"
+    Param	"-notexscale"
+    Hint	"Do not scale radiosity patches with texture scale."_
+    		"By default, hlrad will take the texture scale and apply it to the chopping grid which is projected onto it. This option turns that off, and almost always increases the number of patches in a map as most maps have many walls scaled up to 2 and 3."
+  }
+
+  CheckBox
+  {
+    Name	"Dump Light Patches"
+    Param	"-dump"
+    Hint	"Dumps light patches to a file for hlrad debugging info This is a developer option for zhlt, to dump out the patch data generated by the chopping/subdividing and make sure it looks alright."
+  }
+
+  CheckBox
+  {
+    Name	"Incremental"
+    Param	"-inc"
+    Hint	"Use or create an incremental transfer list file."_
+    		"This is a handy option for tweaking lighting, especially on slow or lower memory machines. BuildVisLeafs, MakeScales, and SwapTransfers can be skipped entirely on subsequent runs of hlrad. Note that geometry must not change, but lighting can."
+  }
+
+  Space
+  {
+    Size	"6"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"Add additional parameters here as you would a command line."
+  }
+
+  TextBox
+  {
+    Name	"Bounce"
+    Param	"-bounce"
+    Bold	"True"
+    Type	"Integer"
+    Default	"1"
+    Min		"0"
+    Hint	"Set number of radiosity bounces."_
+    		"This option sets the number of times light bounces in the radiosity pass. By the time the code gets to this point, all the data is precomputed, and extra bounces are very fast. It will make the shadows less harsh using more bounces, but can help light up dark areas much more naturally."
+  }
+
+  TextBox
+  {
+    Name	"Smooth"
+    Param	"-smooth"
+    Bold	"True"
+    Type	"Single"
+    Default	"50.0"
+    Min		"0.0"
+    Max		"180.0"
+    Hint	"Set smoothing threshold for blending (in degrees)."_
+    		"By default hlrad uses Phong shading on all faces. If the angle between two edges is less than this value, it will be shaded with the Phong smoothing code, otherwise it won't."
+  }
+
+  TextBox
+  {
+    Name	"Chop"
+    Param	"-chop"
+    Type	"Single"
+    Default	"64.0"
+    Min		"1.0"
+    Hint	"Set radiosity patch size for normal textures."_
+    		"Each face in the world has a grid projected onto it, and chopped up into a rather coarse set of sample points. These points are patches, and are what hlrad uses to do the bounced lighting calculations. A higher chop sacrifices quality for both speed and memory consumption of hlrad. A lower chop increases the quality at the expense of speed and memory usage."
+  }
+
+  TextBox
+  {
+    Name	"Coring"
+    Param	"-coring"
+    Type	"Single"
+    Default	"1.0"
+    Min		"0.0"
+    Hint	"Set lighting threshold before blackness on switchable light surfaces."_
+    		"This value controls how much light it takes before a surface will be lit with a non-black value."
+  }
+
+  TextBox
+  {
+    Name	"Max Light"
+    Param	"-maxlight"
+    Type	"Single"
+    Default	"2.0"
+    Min		"0.0"
+    Max		"2.0"
+    Hint	"Overexpose textures."_
+    		"Allows for the overexposure of textures for more realistic lighting. Less than 2 produces duller lighting, but the textures don't \"blow out\" as much."
+  }
+
+  TextBox
+  {
+    Name	"Scale"
+    Param	"-scale"
+    Type	"Single"
+    Default	"1.0"
+    Min		"0.0"
+    Hint	"Set global light scaling value."_
+    		"This option scales the final light values right after the direct lighting layer is added to the radiosity bounced lighting layer. Low values make the world darker, higher values make it brighter."
+  }
+
+  TextBox
+  {
+    Name	"Gamma"
+    Param	"-gamma"
+    Type	"Single"
+    Default	"0.5"
+    Min		"0.0"
+    Hint	"Set global gamma value."_
+    		"This option also occurs after the direct and radiosity layers are added together, and a global gamma correction is calculated and applied to the lighting before it is finalized."
+  }
+
+  TextBox
+  {
+    Name	"Sky"
+    Param	"-sky"
+    Type	"Single"
+    Default	"1.0"
+    Min		"0.0"
+    Hint	"Set ambient sunlight contribution in the shade outside."_
+    		"Many faces have line of sight to sky, but fall in the shadow of some other object. This option affects how much of the normal sky lighting is put into the shadows. A setting of '1' (the default) will result in a full hemisphere of the sky contributing about 1/4 of the direct component. Set to '0' for direct lighting only. Set to a value greater than '1' for a more diffuse (cloudy, overcast) sky appearance."
+  }
+
+  Space
+  {
+    Size	"3"
+  }
+
+  ComboBox
+  {
+    Name	"Messages"
+    Default	"Normal"
+    Options	"Terse,-terse|Normal,|Verbose,-verbose"
+    Hint	"Set the message mode to run QRAD in."_
+    		"Terse runs with the minimum amount of information output during compiling, normal runs without any special messages and verbose runs with the maximum amount of information output during compiling. Many of the tools have 'minor warnings' and informative messages which are displayed when verbose mode is set."
+  }
+
+  ColorBox
+  {
+    Name	"Ambient Light"
+    Param	"-ambient"
+    Type	"Single"
+    Default	"0 0 0"
+    Hint	"Set ambient world light."_
+    		"This option sets a minimum light value to every face so that nothing comes out pitch black."
+  }
+
+  FileBox
+  {
+    Name	"Lights File"
+    Param	"-lights"
+    FullPath	"True"
+    Bold	"true"
+    Filter	"Radiosity Files (*.rad)|*.rad|Text Files (*.txt)|*.txt"
+    Hint	"Manually specify a lights.rad file to use."_
+    		"The .rad file will be used in addition to the defaults of lights.rad and mapname.rad."
+  }
+}
+
+Stage
+{
+  Name		"Shared"
+  Title		"Shared Parameters"
+  Type		"ParameterList"
+
+  CheckBox
+  {
+    Name	"Verbose"
+    Param	"-v"
+    Stages	"CSG|BSP|VIS|RAD"
+    Hint	"Compile with verbose messages."_
+    		"Many of the tools have 'minor warnings' and informative messages which are displayed when verbose mode is set."
+  }
+
+  TextBox
+  {
+    Name	"Threads"
+    Param	"-threads"
+    Stages	"CSG|BSP|VIS|RAD"
+    Type	"Integer"
+    Default	"1"
+    Min		"1"
+    Hint	"Manually specify the number of threads to run."_
+    		"This option is generally only necessary on the non-windows versions of the tools, where there is not a standard way to detect the number of processors in the system and auto-set the value. It can be manually set on windows machines, primarily if you wish to use fewer threads than processors."
+  }
+}

+ 171 - 0
Compiler/Specifications/RESGen.bci

@@ -0,0 +1,171 @@
+// Specification: RESGen
+// Written by: Ryan Gregg
+// Version: 2.0b3
+// Created: August 4, 2004
+// Last updated: August 4, 2004
+
+Batch
+{
+  Name		"RESGen"
+  Priority	"1"
+  Links		"RESGen,http://www.unitedadmins.com/resgen.php"
+  Stages	"RESGen"
+  Filter	"BSP Files (*.bsp)|*.bsp"
+  Template	"@echo off\n"_
+  		"\"${StagePath=RESGen}\" -k ${StageParam=RESGen} -f \"${FilePath}\\${FileName}\"\n"
+}
+
+//
+// RESGen
+//
+Stage
+{
+  Name		"RESGen"
+  Title		"Resource Generator"
+  Type		"Program"
+  Filter	"RESGen (RESGen.exe)|RESGen.exe"
+
+  CheckBox
+  {
+    Name	"Minimal Output"
+    Param	"-v"
+    Hint	"\tMakes RESGen only give minimal output.\n\n"_
+    		"\tIt's recommended you use this if you want to create res files as fast as possible. RESGen will still report any error."
+  }
+
+  CheckBox
+  {
+    Name	"No Status Line"
+    Param	"-s"
+    Hint	"\tRESGen will not display it's status line.\n\n"_
+    		"\tThis might considerably speed up res file generation, especially on smaller maps."
+  }
+
+  CheckBox
+  {
+    Name	"No Folder Info"
+    Param	"-i"
+    Hint	"\tRESGen will only report the base folder it's searching, but not the subfolders. Useful with -r option."
+  }
+
+  CheckBox
+  {
+    Name	"No Resource Info"
+    Param	"-j"
+    Hint	"\tResources found while building the resource list will not be displayed. Useful with -e option."
+  }
+
+  CheckBox
+  {
+    Name	"No Lowercase"
+    Param	"-l"
+    Hint	"\tTurns off converting all res file entries to lowercase.\n\n"_
+    		"\tRESGen converts all res file entries to lowercase since this is the default for Half-Life files. It has to do this because a lot of resource files in maps don't have the proper case that matches the actual resources. Only use this option if you know what you are doing."
+  }
+
+  CheckBox
+  {
+    Name	"Overwrite .RES Files"
+    Param	"-o"
+    Checked	"True"
+    Hint	"\tIf a res file already exists it will be overwritten."
+  }
+
+  CheckBox
+  {
+    Name	"Don't Check .PAK"
+    Param	"-p"
+    Hint	"\tPrevents RESGen from using the contents of any pakfile for resource verification.\n\n"_
+    		"\tThus, any resource that is available, but in a pakfile is excluded from the res file. This option is only useful when the -e option is also used. Please note that if a map comes with it's own pakfile, using this option will generate a res file that is incomplete."
+  }
+
+  Space
+  {
+    Size	"3"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+
+  FolderBox
+  {
+    Name	"Folder"
+    Param	"-d"
+    Hint	"\tSpecify a folder that will be searched for bsp files."
+  }
+
+  FolderBox
+  {
+    Name	"Recursive Folder"
+    Param	"-r"
+    Hint	"\tSpecify a folder that will be searched for bsp files.  The folder's sub folders will also be searched."
+  }
+
+  FolderBox
+  {
+    Name	"MOD Folder"
+    Param	"-e"
+    Hint	"\tMakes RESGen verify that all resources in the res file actually exist.\n\n"_
+    		"\tResources that can't be found will be excluded from the res file. RESGen expects modpath to point to a valid mod directory structure. If the modpath isn't the valve folder, RESGen will try to find the valve folder too, so a complete resource list can be established."
+  }
+
+  FileBox
+  {
+    Name	"RFA File"
+    Param	"-a"
+    FullPath	"True"
+    Filter	"RFA Files (*.rfa)|*.rfa|Text Files (*.txt)|*.txt"
+    Hint	"\tThe contents of the rfa file will be added to the end of the res file.\n\n"_
+    		"\tThis is useful when adding custom resources, like the StatsMe sound pack. The .rfa file extension is optional."
+  }
+
+  Space
+  {
+    Size	"7"
+  }
+
+  FileBox
+  {
+    Name	"Exclude .BSP"
+    Param	"-x"
+    FullPath	"True"
+    Filter	"BSP Files (*.bsp)|*.bsp"
+    Hint	"\tExclude this map from res file generation.\n\n"_
+    		"\tOnly works on maps found with -d or -r options. The .bsp file extension is optional."
+  }
+
+  FileBox
+  {
+    Name	"Exclude .BSP"
+    Param	"-x"
+    FullPath	"True"
+    Filter	"BSP Files (*.bsp)|*.bsp"
+    Hint	"\tExclude this map from res file generation.\n\n"_
+    		"\tOnly works on maps found with -d or -r options. The .bsp file extension is optional."
+  }
+
+  FileBox
+  {
+    Name	"Exclude .BSP"
+    Param	"-x"
+    FullPath	"True"
+    Filter	"BSP Files (*.bsp)|*.bsp"
+    Hint	"\tExclude this map from res file generation.\n\n"_
+    		"\tOnly works on maps found with -d or -r options. The .bsp file extension is optional."
+  }
+
+  FileBox
+  {
+    Name	"Exclude .BSP"
+    Param	"-x"
+    FullPath	"True"
+    Filter	"BSP Files (*.bsp)|*.bsp"
+    Hint	"\tExclude this map from res file generation.\n\n"_
+    		"\tOnly works on maps found with -d or -r options. The .bsp file extension is optional."
+  }
+}

+ 155 - 0
Compiler/Specifications/Source Batch.bci

@@ -0,0 +1,155 @@
+// Specification: Source Batch
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: November 5, 2004
+// Last updated: December 1, 2004
+
+// Updated by: Ryan Gregg
+// Date: December 1, 2004
+// Added Batch Batch.
+// Added Ouput variable.
+
+Variable
+{
+  Name		"Output"
+  Type		"Folder"
+  Optional	"False"
+  Hint		"File output directory."
+}
+
+Batch
+{
+  Name		"Batch"
+  Priority	"1"
+  Stages	"Batch"
+  Template	"@echo off\n"_
+  		"${StageCmd=Batch}\n"
+}
+
+//
+// Batch
+//
+Stage
+{
+  Name		"Batch"
+  Title		"Batch Operations"
+  Type		"CommandList"
+
+  //
+  // Recommended File Deletions
+  //
+
+  LabelBox
+  {
+    Name	"Recommended File Deletions:"
+    Bold	"True"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .PRT After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.prt\" goto nodelprt\n"_
+    		"del \"${FilePath}\\${FileName}.prt\"\n"_
+    		"echo ${FilePath}\\${FileName}.prt deleted.\n"_
+    		":nodelprt"
+  }
+
+  Space
+  {
+    Size	"9"
+  }
+
+  //
+  // Recommended File Functions
+  //
+
+  LabelBox
+  {
+    Name	"Recommended File Functions:"
+    Bold	"True"
+  }
+
+  CheckBox
+  {
+    Name	"Copy .BSP After Compile"
+    Bold	"True"
+    Param	"if not exist \"${FilePath}\\${FileName}.bsp\" goto nocopybsp\n"_
+    		"copy \"${FilePath}\\${FileName}.bsp\" \"${Output}\"\n"_
+    		"echo ${FileName}.bsp copied to ${Output}.\n"_
+    		":nocopybsp"
+    Hint	"\tCopy your .BSP file to your map destination folder."
+  }
+
+  CheckBox
+  {
+    Name	"Copy .LIN After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.lin\" goto nocopylin\n"_
+    		"copy \"${FilePath}\\${FileName}.lin\" \"${Output}\"\n"_
+    		"echo ${FileName}.lin copied to ${Output}.\n"_
+    		":nocopylin"
+    Hint	"\tCopy your .LIN file to your map destination folder."
+  }
+
+  Space
+  {
+    Size	"8"
+  }
+
+  //
+  // Unrecommended File Deletions
+  //
+
+  LabelBox
+  {
+    Name	"Unrecommended File Deletions:"
+    Bold	"True"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .BSP After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.bsp\" goto nodelbsp\n"_
+    		"del \"${FilePath}\\${FileName}.bsp\"\n"_
+    		"echo ${FilePath}\\${FileName}.bsp deleted.\n"_
+    		":nodelbsp"
+    Hint	"\tNote: If you delete this file without copying it you won't be able to play your bsp file."
+  }
+
+  CheckBox
+  {
+    Name	"Delete .GL After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.gl\" goto nodelgl\n"_
+    		"del \"${FilePath}\\${FileName}.gl\"\n"_
+    		"echo ${FilePath}\\${FileName}.gl deleted.\n"_
+    		":nodelgl"
+  }
+
+  CheckBox
+  {
+    Name	"Delete .LIN After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.lin\" goto nodellin\n"_
+    		"del \"${FilePath}\\${FileName}.lin\"\n"_
+    		"echo ${FilePath}\\${FileName}.lin deleted.\n"_
+    		":nodellin"
+    Hint	"\tNote: If you delete this file without copying it you won't be able to view the compiler's lin file."
+  }
+
+  CheckBox
+  {
+    Name	"Delete .LOG After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.log\" goto nodellog\n"_
+    		"del \"${FilePath}\\${FileName}.log\"\n"_
+    		"echo ${FilePath}\\${FileName}.log deleted.\n"_
+    		":nodellog"
+    Hint	"\tNote: If you delete this file you won't be able to view the compiler's log file."
+  }
+
+  CheckBox
+  {
+    Name	"Delete .VMF After Compile"
+    Param	"if not exist \"${FilePath}\\${FileName}.vmf\" goto nodelvmf\n"_
+    		"del \"${FilePath}\\${FileName}.vmf\"\n"_
+    		"echo ${FilePath}\\${FileName}.vmf deleted.\n"_
+    		":nodelvmf"
+  }
+}

+ 61 - 0
Compiler/Specifications/Source GLView.bci

@@ -0,0 +1,61 @@
+// Specification: GLView
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: December 3, 2004
+// Last updated: N/A
+
+
+Batch
+{
+  Name		"GLView"
+  Priority	"1"
+  Links		"Source SDK,http://www.valve-erc.com/srcsdk/"
+  Stages	"GLView"
+  Filter	"GL Files (*.gl)|*.gl"
+  ShellExecute	"True"
+  Template	"\"${StagePath=GLView}\" ${StageParam=GLView} \"${FilePath}\\${FileName}.gl\""
+}
+
+//
+// GLView
+//
+Stage
+{
+  Name		"GLView"
+  Title		"GLView"
+  Type		"Program"
+  Filter	"GLView (glview.exe)|glview.exe"
+
+  CheckBox
+  {
+    Name	"Portal"
+    Param	"-portal"
+    Hint	"\tRead portal file."
+  }
+
+  CheckBox
+  {
+    Name	"Portal Highlight"
+    Param	"-portalhighlight"
+    Hint	"\tHighlight portals."
+  }
+  CheckBox
+  {
+    Name	"Displacement"
+    Param	"-disp"
+    Hint	"\t???"
+  }
+
+  Space
+  {
+    Size	"7"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+}

+ 147 - 0
Compiler/Specifications/Source Texture Utility.bcs

@@ -0,0 +1,147 @@
+// Specification: VTex
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: April 7, 2004
+// Last updated: N/A
+
+Include		"Templates.bci"
+
+Variable
+{
+  Name		"ValveProject"
+  Type		"Folder"
+  Optional	"True"
+  Hint		"The directory your gameinfo.txt is located in."
+}
+
+Batch
+{
+  Name		"VTex"
+  Priority	"1"
+  Links		"Source SDK,http://www.valve-erc.com/srcsdk/"
+  Filter	"TGA Files (*.tga)|*.tga"
+  Stages	"VTex"
+  Template	"@echo off\n"_
+  		"set VPROJECT=${ValveProject}\n"_
+
+		"${Splash}"_
+
+  		"\"${StagePath=VTex}\" -nopause ${StageParam=VTex} \"${FileName}.${FileExt}\"\n"
+}
+
+//
+// VTex
+//
+Stage
+{
+  Name		"VTex"
+  Title		"VTex"
+  Type		"Program"
+  Filter	"VTex (vtex.exe)|vtex.exe"
+
+  CheckBox
+  {
+    Name	"Make Directory"
+    Bold	"True"
+    Param	"-mkdir"
+    Hint	"\tMake the destination directory if it does not exist.\n\n"_
+		"\tFor example, if you had a .tga in your .../sourcesdk_content/hl2/materialsrc/sample/sample_material.tga folder, -mkdir would create a new directory called \"sample\" in your .../Half-Life 2/hl2/materials directory, if it didn't already exist, and then place the compiled .vtf file in that new location. If the directory already exists, the -mkdir parameter is ignored."
+  }
+
+  CheckBox
+  {
+    Name	"Quiet"
+    Param	"-quiet"
+    Hint	"\tDon't display any console output."
+  }
+
+  TextBox
+  {
+    Name	"VMT Parameter"
+    Param	"-vmtparam"
+    Size	"2"
+    Type	"String"
+    Quote	"False"
+    Hint	"\tAdd additional material parameters to the created .vmt file.\n\n"_
+		"\tIf a .vmt already exists in the same location, any new parameters will not be added. For example, to make a material translucent, you would type the following: \"$translucent 1\" (without quotes).\n"
+  }
+
+  TextBox
+  {
+    Name	"VMT Parameter"
+    Param	"-vmtparam"
+    Size	"2"
+    Type	"String"
+    Quote	"False"
+    Hint	"\tAdd additional material parameters to the created .vmt file.\n\n"_
+		"\tIf a .vmt already exists in the same location, any new parameters will not be added. For example, to make a material translucent, you would type the following: \"$translucent 1\" (without quotes).\n"
+  }
+
+  TextBox
+  {
+    Name	"VMT Parameter"
+    Param	"-vmtparam"
+    Size	"2"
+    Type	"String"
+    Quote	"False"
+    Hint	"\tAdd additional material parameters to the created .vmt file.\n\n"_
+		"\tIf a .vmt already exists in the same location, any new parameters will not be added. For example, to make a material translucent, you would type the following: \"$translucent 1\" (without quotes).\n"
+  }
+
+  TextBox
+  {
+    Name	"VMT Parameter"
+    Param	"-vmtparam"
+    Size	"2"
+    Type	"String"
+    Quote	"False"
+    Hint	"\tAdd additional material parameters to the created .vmt file.\n\n"_
+		"\tIf a .vmt already exists in the same location, any new parameters will not be added. For example, to make a material translucent, you would type the following: \"$translucent 1\" (without quotes).\n"
+  }
+
+  TextBox
+  {
+    Name	"VMT Parameter"
+    Param	"-vmtparam"
+    Size	"2"
+    Type	"String"
+    Quote	"False"
+    Hint	"\tAdd additional material parameters to the created .vmt file.\n\n"_
+		"\tIf a .vmt already exists in the same location, any new parameters will not be added. For example, to make a material translucent, you would type the following: \"$translucent 1\" (without quotes).\n"
+  }
+
+  TextBox
+  {
+    Name	"Custom Shader"
+    Param	"-shader"
+    Size	"2"
+    Type	"String"
+    Hint	"\tHave VTex create a .vmt for the new material with the shader specified.\n\n"_
+		"\tNot to be used with the Standard Shader option."
+  }
+
+  ComboBox
+  {
+    Name	"Standard Shader"
+    Param	"-shader"
+    Size	"2"
+    Default	"Lightmapped Generic"
+    Options	"Lightmapped Generic,LightmappedGeneric|Unlit Generic,UnlitGeneric|Vertex Lit Generic,VertexlitGeneric"
+    Hint	"\tHave VTex create a .vmt for the new material with the shader specified.\n\n"_
+		"\tNot to be used with the Custom Shader option."
+  }
+
+  Space
+  {
+    Size	"1"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Quote	"False"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+}

+ 52 - 0
Compiler/Specifications/Source Tools Advanced.bcs

@@ -0,0 +1,52 @@
+// Specification: Source Tools Advanced
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: December 3, 2004
+// Last updated: N/A
+
+Include		"Source Tools.bci"
+Include		"Source Batch.bci"
+Include		"Source GLView.bci"
+Include		"Steam.bci"
+Include		"Templates.bci"
+
+Batch
+{
+  Name		"Source Tools Normal"
+  Priority	"3"
+  Links		"Source SDK,http://www.valve-erc.com/srcsdk/|"_
+  		"Steam,http://www.steampowered.com/|"_
+  		"Valve,http://www.valvesoftware.com/"
+  Filter	"Supported Files|*.vmf;*.bsp;*.gl|VMF Files (*.vmf)|*.vmf|BSP Files (*.bsp)|*.bsp|GL Files (*.gl)|*.gl"
+  Stages	"BSP|VIS|RAD|Shared|ZIP|Batch|GLView|Steam"
+  LogFile	"${FilePath}\\${FileName}.log"
+  Template	"@echo off\n"_
+  		"set VPROJECT=${ValveProject}\n"_
+		"cd ${BinRoot}\n"_
+
+		"${Splash}"_
+
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=ZIP}\" ${StageParam=ZIP}\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+
+
+  		"\"${StagePath=GLView}\" ${StageParam=GLView} \"${FilePath}\\${FileName}.gl\"\n"_
+
+  		"${StageCmd=Batch}\n"_
+  		"\"${StagePath=Steam}\" ${StageParam=Steam}\n"_
+		"goto succeeded\n"_
+
+		":failed\n"_
+  		"echo.\n"_
+		"echo There was a problem compiling your map, check your ${FileName}.log file for errors.\n"_
+		":succeeded\n"_
+  		"echo.\n"_
+
+  		"${LogViewerRun}\n"
+}

+ 46 - 0
Compiler/Specifications/Source Tools Normal.bcs

@@ -0,0 +1,46 @@
+// Specification: Source Tools Normal
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: November 5, 2004
+// Last updated: N/A
+
+Include		"Source Tools.bci"
+Include		"Source Batch.bci"
+Include		"Steam.bci"
+Include		"Templates.bci"
+
+Batch
+{
+  Name		"Source Tools Normal"
+  Priority	"3"
+  Links		"Source SDK,http://www.valve-erc.com/srcsdk/|"_
+  		"Steam,http://www.steampowered.com/|"_
+  		"Valve,http://www.valvesoftware.com/"
+  Filter	"Supported Files|*.vmf;*.bsp|VMF Files (*.vmf)|*.vmf|BSP Files (*.bsp)|*.bsp"
+  Stages	"BSP|VIS|RAD|Shared|Batch|Steam"
+  LogFile	"${FilePath}\\${FileName}.log"
+  Template	"@echo off\n"_
+  		"set VPROJECT=${ValveProject}\n"_
+		"cd ${BinRoot}\n"_
+
+		"${Splash}"_
+
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+
+  		"${StageCmd=Batch}\n"_
+  		"\"${StagePath=Steam}\" ${StageParam=Steam}\n"_
+		"goto succeeded\n"_
+
+		":failed\n"_
+  		"echo.\n"_
+		"echo There was a problem compiling your map, check your ${FileName}.log file for errors.\n"_
+		":succeeded\n"_
+  		"echo.\n"_
+
+  		"${LogViewerRun}\n"
+}

+ 686 - 0
Compiler/Specifications/Source Tools.bci

@@ -0,0 +1,686 @@
+// Specification: Source Tools
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: November 5, 2004
+// Last updated: Febuary 23, 2005
+
+// Updated by: Ryan Gregg
+// Date: Febuary 23, 2005
+// Updated all tools to refelect changes to the SDK.
+
+// Updated by: Ryan Gregg
+// Date: December 1, 2004
+// Added BinRoot and ValveProject variables.
+
+Include		"Templates.bci"
+
+Variable
+{
+  Name		"BinRoot"
+  Type		"Folder"
+  Optional	"True"
+  Hint		"SDK bin directory.\n...\\Steam\\SteamApps\\<User Name>\\sourcesdk\\bin\\"
+}
+
+Variable
+{
+  Name		"ValveProject"
+  Type		"Folder"
+  Optional	"True"
+  Hint		"The directory your gameinfo.txt is located in."
+}
+
+Batch
+{
+  Name		"Source Tools"
+  Priority	"2"
+  Links		"Source SDK,http://www.valve-erc.com/srcsdk/"
+  Filter	"Supported Files|*.vmf;*.bsp|VMF Files (*.vmf)|*.vmf|BSP Files (*.bsp)|*.bsp"
+  Stages	"BSP|VIS|RAD|Shared|ZIP"
+  Template	"@echo off\n"_
+  		"set VPROJECT=${ValveProject}\n"_
+		"cd ${BinRoot}\n"_
+
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=ZIP}\" ${StageParam=ZIP}\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+
+		"goto succeeded\n"_
+
+		":failed\n"_
+  		"echo.\n"_
+		"echo There was a problem compiling your map, check your ${FileName}.log file for errors.\n"_
+		":succeeded\n"_
+  		"echo.\n"_
+
+  		"${LogViewerRun}\n"
+}
+
+Batch
+{
+  Name		"BSP"
+  Priority	"1"
+  Stages	"BSP|Shared"
+  Filter	"VMF Files (*.vmf)|*.vmf"
+  Template	"@echo off\n"_
+  		"set VPROJECT=${ValveProject}\n"_
+		"cd ${BinRoot}\n"_
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+  		"${LogViewerRun}\n"
+}
+
+Batch
+{
+  Name		"VIS"
+  Priority	"1"
+  Stages	"VIS|Shared"
+  Filter	"VMF Files (*.vmf)|*.vmf"
+  Template	"@echo off\n"_
+  		"set VPROJECT=${ValveProject}\n"_
+		"cd ${BinRoot}\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+  		"${LogViewerRun}\n"
+}
+
+Batch
+{
+  Name		"RAD"
+  Priority	"1"
+  Stages	"RAD|Shared"
+  Filter	"VMF Files (*.vmf)|*.vmf"
+  Template	"@echo off\n"_
+  		"set VPROJECT=${ValveProject}\n"_
+		"cd ${BinRoot}\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} \"${FilePath}\\${FileName}\"\n"_
+  		"${LogViewerRun}\n"
+}
+
+Batch
+{
+  Name		"ZIP"
+  Priority	"1"
+  Stages	"ZIP"
+  Filter	"VMF Files (*.vmf)|*.vmf"
+  Template	"@echo off\n"_
+  		"set VPROJECT=${ValveProject}\n"_
+		"cd ${BinRoot}\n"_
+  		"\"${StagePath=ZIP}\" ${StageParam=ZIP}\n"
+}
+
+//
+// BSP
+//
+Stage
+{
+  Name		"BSP"
+  Title		"Binary Space Partition"
+  Type		"Program"
+  Filter	"VBSP (vbsp.exe)|vbsp.exe"
+
+  CheckBox
+  {
+    Name	"Bump All"
+    Param	"-bumpall"
+    Hint	"\tForce all surfaces to be bump mapped."
+  }
+
+  CheckBox
+  {
+    Name	"Dump Collide"
+    Param	"-dumpcollide"
+    Hint	"\tWrite files with collision info."
+  }
+
+  CheckBox
+  {
+    Name	"Dump Static Props"
+    Param	"-dumpstaticprop"
+    Hint	"\tDump static props to staticprop*.txt."
+  }
+
+  CheckBox
+  {
+    Name	"Full Detail"
+    Param	"-fulldetail"
+    Hint	"\tMark all detail geometry as normal geometry (so all detail geometry will affect visibility)."
+  }
+
+  CheckBox
+  {
+    Name	"GLView"
+    Bold	"True"
+    Param	"-glview"
+    Hint	"\tWrites .gl files in the current directory that can be viewed with glview.exe. If you use -tmpout, it will write the files into the \\tmp folder."
+  }
+
+  CheckBox
+  {
+    Name	"Keep Stale Zip"
+    Param	"-keepstalezip"
+    Hint	"\tKeep the BSP's zip files intact but regenerate everything else."
+  }
+
+  CheckBox
+  {
+    Name	"Leak Test"
+    Param	"-leaktest"
+    Hint	"\tStop processing the map if a leak is detected. Whether or not this flag is set, a leak file will be written out at <vmf filename>.lin, and it can be imported into Hammer."
+  }
+
+  CheckBox
+  {
+    Name	"Light If Missing"
+    Param	"-lightifmissing"
+    Hint	"\tForce lightmaps to be generated for all surfaces even if they don't need lightmaps."
+  }
+
+
+  CheckBox
+  {
+    Name	"No Detail"
+    Param	"-nodetail"
+    Bold	"True"
+    Hint	"\tGet rid of all detail geometry. The geometry left over is what affects visibility."
+  }
+
+  CheckBox
+  {
+    Name	"No Linux Data"
+    Param	"-nolinuxdata"
+    Hint	"\tBy default, BSP writes physics data for linux servers. This parameter disables writing linux physics data into the map."
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Quote	"False"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+
+  CheckBox
+  {
+    Name	"No Water"
+    Param	"-nowater"
+    Bold	"True"
+    Hint	"\tGet rid of water brushes."
+  }
+
+  CheckBox
+  {
+    Name	"No CSG"
+    Param	"-nocsg"
+    Hint	"\tDon't chop out intersecting brush areas."
+  }
+
+  /*CheckBox
+  {
+    Name	"No Linux Data"
+    Param	"-nolinuxdata"
+    Hint	"\tForce it to not write physics data for linux multiplayer servers, even if there are multiplayer entities in the map."
+  }*/
+
+  CheckBox
+  {
+    Name	"No Merge"
+    Param	"-nomerge"
+    Hint	"\tDon't merge together chopped faces on nodes."
+  }
+
+  CheckBox
+  {
+    Name	"No Merge Water"
+    Param	"-nomergewater"
+    Hint	"\tDon't merge together chopped faces on water."
+  }
+
+  CheckBox
+  {
+    Name	"No Opt"
+    Param	"-noopt"
+    Hint	"\tBy default, vbsp removes the 'outer shell' of the map, which are all the faces you can't see because you can never get outside the map. -noopt disables this behaviour."
+  }
+
+  CheckBox
+  {
+    Name	"No Prune"
+    Param	"-noprune"
+    Hint	"\tDon't prune neighboring solid nodes."
+  }
+
+  CheckBox
+  {
+    Name	"No Share"
+    Param	"-noshare"
+    Hint	"\tEmit unique face edges instead of sharing them."
+  }
+
+  CheckBox
+  {
+    Name	"No Subdivide"
+    Param	"-nosubdiv"
+    Hint	"\tDon't subdivide faces for lightmapping."
+  }
+
+  CheckBox
+  {
+    Name	"No T-Junction"
+    Param	"-notjunc"
+    Hint	"\tDon't fixup t-junctions."
+  }
+
+  CheckBox
+  {
+    Name	"No Weld"
+    Param	"-noweld"
+    Hint	"\tDon't join face vertices together."
+  }
+
+  Space
+  {
+    Size	"1"
+  }
+
+  CheckBox
+  {
+    Name	"Snap Axial"
+    Param	"-snapaxial"
+    Hint	"\tSnap axial planes to integer coordinates."
+  }
+
+  CheckBox
+  {
+    Name	"Only Entites"
+    Param	"-onlyents"
+    Bold	"True"
+    Hint	"\tThis option causes vbsp only import the entities from the .vmf file. -onlyents won't reimport brush models."
+  }
+
+  CheckBox
+  {
+    Name	"Only Props"
+    Param	"-onlyprops"
+    Bold	"True"
+    Hint	"\tOnly update the static props and detail props."
+  }
+
+  CheckBox
+  {
+    Name	"Verbose Entities"
+    Param	"-verboseentities"
+    Hint	"\tIf -verbose is on, this disables verbose output for submodels."
+  }
+
+  TextBox
+  {
+    Name	"Block"
+    Param	"-Block"
+    Type	"String"
+    Quote	"False"
+    Default	"0.0 0.0"
+    Hint	"\tControl the grid size mins that vbsp chops the level on."
+  }
+
+  TextBox
+  {
+    Name	"Blocks"
+    Param	"-Blocks"
+    Type	"String"
+    Quote	"False"
+    Default	"0.0 0.0 0.0 0.0"
+    Hint	"\tEnter the mins and maxs for the grid size vbsp uses."
+  }
+
+  TextBox
+  {
+    Name	"Luxel Scale"
+    Param	"-luxelscale"
+    Type	"Single"
+    Default	"1.0"
+    Min		"0.0"
+    Max		"100.0"
+    Hint	"\tScale all lightmaps by this amount."
+  }
+
+  TextBox
+  {
+    Name	"Micro"
+    Param	"-micro"
+    Type	"Single"
+    Default	"1.0"
+    Min		"0.0"
+    Hint	"\tvbsp will warn when brushes are output with a volume less than this number."
+  }
+}
+
+//
+// VIS
+//
+Stage
+{
+  Name		"VIS"
+  Title		"Visibility Index Set"
+  Type		"Program"
+  Filter	"VVIS (vvis.exe)|vvis.exe"
+
+  CheckBox
+  {
+    Name	"No Sort"
+    param	"-nosort"
+    Hint	"\tDon't sort portals (sorting is an optimization)."
+  }
+
+  TextBox
+  {
+    Name	"Radius Override"
+    param	"-radius_override"
+    Type	"Single"
+    Default	"0.0"
+    Min		"0.0"
+    Hint	"\tForce a VIS radius."
+  }
+
+  ComboBox
+  {
+    Name	"VIS Type"
+    Bold	"True"
+    Default	"Normal"
+    Options	"Fast,-fast|Normal,"
+    Hint	"\tRun as fast or normal.\n\n"_
+		"\tFast VIS only does a first quick pass on VIS calculations."
+  }
+
+  Space
+  {
+    Size	"7"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Quote	"False"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+}
+
+//
+// RAD
+//
+Stage
+{
+  Name		"RAD"
+  Title		"Radiosity"
+  Type		"Program"
+  Filter	"VRAD (vrad.exe)|vrad.exe"
+
+  CheckBox
+  {
+    Name	"Center Samples"
+    param	"-centersamples"
+    Hint	"\tMove sample centers."
+  }
+
+  CheckBox
+  {
+    Name	"Direct Lightmap"
+    param	"-dlightmap"
+    Hint	"\tForce direct lighting into different lightmap than radiosity."
+  }
+
+  CheckBox
+  {
+    Name	"Debug Extra"
+    param	"-debugextra"
+    Hint	"\tPlaces debugging data in lightmaps to visualize supersampling."
+  }
+
+  CheckBox
+  {
+    Name	"Dump"
+    param	"-dump"
+    Hint	"\tWrite debugging .txt files."
+  }
+
+  CheckBox
+  {
+    Name	"Dump Normals"
+    param	"-dumpnormals"
+    Hint	"\tWrite normals to debug files."
+  }
+
+  CheckBox
+  {
+    Name	"Log Hash"
+    param	"-loghash "
+    Hint	"\tLog the sample hash table to samplehash.txt."
+  }
+
+  CheckBox
+  {
+    Name	"No Detail Light"
+    param	"-nodetaillight"
+    Hint	"\tDon't light detail props."
+  }
+
+  CheckBox
+  {
+    Name	"No Extra"
+    param	"-noextra"
+    Bold	"true"
+    Hint	"\tDisable supersampling."
+  }
+
+  CheckBox
+  {
+    Name	"Only Detail"
+    param	"-onlydetail"
+    Hint	"\tOnly light detail props and per-leaf lighting."
+  }
+
+  /*CheckBox
+  {
+    Name	"Red Error"
+    param	"-rederror"
+    Hint	"\tShow errors in red."
+  }*/
+
+  CheckBox
+  {
+    Name	"Stop On Exit"
+    param	"-stoponexit"
+    Hint	"\tWait for a keypress on exit."
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Quote	"False"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+
+  TextBox
+  {
+    Name	"Bounce"
+    Param	"-bounce"
+    Bold	"True"
+    Type	"Integer"
+    Default	"100"
+    Min		"0"
+    Hint	"\tSet max number of bounces."
+  }
+
+  TextBox
+  {
+    Name	"Luxel Density"
+    Param	"-luxeldensity"
+    Type	"Single"
+    Default	"1.0"
+    Min		"0.0"
+    Max		"1.0"
+    Hint	"\tRescale all luxels by the specified amount."
+  }
+
+  TextBox
+  {
+    Name	"Max Disp Sample Size"
+    Param	"-maxdispsamplesize"
+    Type	"Single"
+    Default	"512.0"
+    Min		"0.0"
+    Hint	"\tSet max displacement sample size."
+  }
+
+  TextBox
+  {
+    Name	"Smooth"
+    Param	"-smooth"
+    Type	"Single"
+    Default	"45.0"
+    Min		"0.0"
+    Max		"360.0"
+    Hint	"\tSet the threshold for smoothing groups, in degrees."
+  }
+
+  ComboBox
+  {
+    Name	"RAD Type"
+    Bold	"True"
+    Default	"Normal"
+    Options	"Fast,-fast|Normal,"
+    Hint	"\tRun as fast or normal.\n\n"_
+		"\tFast RAD does quick and dirty lighting calculations."
+  }
+
+  FileBox
+  {
+    Name	"Lights File"
+    Param	"-lights"
+    FullPath	"True"
+    Bold	"True"
+    Filter	"Radiosity Files (*.rad)|*.rad|Text Files (*.txt)|*.txt"
+    Hint	"\tLoad a lights file in addition to lights.rad and the level lights file."
+  }
+}
+
+//
+// ZIP
+//
+Stage
+{
+  Name		"ZIP"
+  Title		"BSP ZIP"
+  Type		"Program"
+  Filter	"BSPZIP (bspzip.exe)|bspzip.exe"
+
+  ComboBox
+  {
+    Name	"Operation"
+    Checked	"True"
+    Default	"Add"
+    Options	"Add,-addlist \"${FilePath}\\${FileName}.bsp\" \"${FilePath}\\${FileName}.lst\" \"${FilePath}\\${FileName}.bsp\"|Extract,-extract \"${FilePath}\\${FileName}.bsp\" \"${FilePath}\\${FileName}.zip\"|List,-dir \"${FilePath}\\${FileName}.bsp\""
+    Hint	"\tAdd files to, extract files from or list the files in the BSP's embedded ZIP file.\n\n"_
+    		"\tWhen adding files a <filename>.lst file must exist in your input file's folder.  This file contains pairs in the format ZIP path Local path separated by new line characters.  For example, to add the material walls/stonewall our <filename>.lst file would contain:\n\n"_
+		"\tmaterials/walls/stonewall.vmt\n"_
+		"\tC:\\materials\\walls\\stonewall.vmt\n"_
+		"\tmaterials/walls/stonewall.vtf\n"_
+		"\tC:\\materials\\walls\\stonewall.vtf"
+  }
+
+  Space
+  {
+    Size	"9"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Quote	"False"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+}
+
+//
+// Shared
+//
+Stage
+{
+  Name		"Shared"
+  Title		"Shared Parameters"
+  Type		"ParameterList"
+
+  CheckBox
+  {
+    Name	"No VConfig"
+    param	"-novconfig"
+    Stages	"BSP|VIS|RAD"
+    Hint	"\tDon't bring up graphical UI on VPROJECT errors."
+  }
+
+  CheckBox
+  {
+    Name	"MPI"
+    param	"-mpi"
+    Stages	"VIS|RAD"
+    Hint	"\tUse VMPI to distribute computations."
+  }
+
+  CheckBox
+  {
+    Name	"Verbose"
+    param	"-verbose"
+    Stages	"BSP|VIS|RAD"
+    Hint	"\tCompile with verbose messages."
+  }
+
+  TextBox
+  {
+    Name	"MPI Password"
+    Param	"-mpi_pw"
+    Stages	"VIS|RAD"
+    Type	"String"
+    Hint	"\tUse a password to choose a specific set of VMPI workers."
+  }
+
+  TextBox
+  {
+    Name	"Threads"
+    Param	"-threads"
+    Stages	"BSP|VIS|RAD"
+    Type	"Integer"
+    Default	"1"
+    Min		"1"
+    Hint	"\tControl the number of threads vbsp uses (defaults to the # of processors on your machine)."
+  }
+
+  ComboBox
+  {
+    Name	"Priority"
+    Stages	"BSP|VIS|RAD"
+    Default	"Normal"
+    Options	"Low,-low|Normal,"
+    Hint	"\tRun program an altered priority level.\n\n"_
+    		"\tSetting the priority of the compile tools to -low is very handy, as you can multitask and do other things without really feeling the drain of the compile programs on the system, provided there is enough memory for the tools and the other programs you use."
+  }
+
+  FolderBox
+  {
+    Name	"Game"
+    Param	"-game"
+    Stages	"BSP|VIS|RAD"
+    Bold	"True"
+    Hint	"\tOverride the VPROJECT environment variable.\n\n"_
+    		"\tShould point to the folder your gameinfo.txt is located in."
+  }
+}

+ 130 - 0
Compiler/Specifications/Steam.bci

@@ -0,0 +1,130 @@
+// Specification: Steam
+// Written by: Ryan Gregg
+// Version: 1.1.1.1
+// Created: August 4, 2004
+// Last updated: November 19, 2004
+
+// Updated by: Ryan Gregg
+// Date: November 19, 2004
+// Added Half-Life 2 and Half-Life: Source to Game ComboBox.
+
+// Updated by: Ryan Gregg
+// Date: October 15, 2004
+// Added Counter-Strke: Source to Game ComboBox.
+
+// Updated by: Ryan Gregg
+// Date: September 23, 2004
+// Improved options hints.
+
+// Updated by: Ryan Gregg
+// Date: September 7, 2004
+// Changed default MOD from nsp to ns.
+
+// Updated by: Ryan Gregg
+// Date: August 9, 2004
+// Thanks to: Anders Jenbo
+// Corected Startup State.
+// Removed Colors.
+
+
+Batch
+{
+  Name		"Steam"
+  Priority	"1"
+  Links		"Steam,http://www.steampowered.com/|"_
+  		"Valve,http://www.valvesoftware.com/"
+  Stages	"Steam"
+  Filter	"BSP Files (*.bsp)|*.bsp"
+  ShellExecute	"True"
+  Template	"\"${StagePath=Steam}\" ${StageParam=Steam}"
+}
+
+//
+// Steam
+//
+Stage
+{
+  Name		"Steam"
+  Title		"Steam"
+  Type		"Program"
+  Filter	"Steam (steam.exe)|steam.exe"
+
+  CheckBox
+  {
+    Name	"Developer"
+    Param	"-dev"
+    Hint	"\tStart Steam in developer mode (cheats)."
+  }
+
+  CheckBox
+  {
+    Name	"Run Map"
+    Param	"+map ${FileName}"
+    Bold	"True"
+    Checked	"True"
+    Hint	"\tStart Steam with the map you selected as the input file."
+  }
+
+  TextBox
+  {
+    Name	"MOD"
+    Param	"-game"
+    Bold	"True"
+    Type	"String"
+    Index	"1"
+    Hint	"\tThe MOD to start Steam in.\n\n"_
+		"\tTo launch a third party MOD you must first select Half-Life as you Game, next you must enter the name of the third party MOD you wish to launch here.  For example the value \"ns\" would be for the third party MOD Natural Selection, \"ts\" would be for the third party MOD The Specialists."
+  }
+
+  TextBox
+  {
+    Name	"Particles"
+    Param	"-particles"
+    Type	"Integer"
+    Default	"65536"
+    Min		"1"
+    Hint	"\tThe number of particles to search for leaks with."
+  }
+
+  ComboBox
+  {
+    Name	"Game"
+    Param	"-applaunch"
+    Bold	"True"
+    Checked	"True"
+    Index	"0"		// Index of 0 means this will always be the first parameter.
+    Default	"Half-Life"
+    Options	"Condition Zero,80|Condition Zero Deleted Scenes,100|Counter-Strike,10|Counter-Strike: Source,240|Day of Defeat,30|Deathmatch Classic,40|Dedicated Server,5|Half-Life,70|Half-Life 2,220|Half-Life 2 Deathmatch,320|Half-Life: Source,280|Opposing Force,50|Ricochet,60|Team Fortress Classic,20"
+    Hint	"\tStart Steam with the selected game.\n\n"_
+		"\tTo launch an official game or MOD you would use this option."
+  }
+
+  ComboBox
+  {
+    Name	"Render Mode"
+    Default	"Direct 3D"
+    Options	"Direct 3D,-d3d|Open GL,-gl|Software,-soft"
+    Hint	"\tStart Half-Life in the selected rendermode."
+  }
+
+  ComboBox
+  {
+    Name	"Startup State"
+    Default	"Fullscreen"
+    Options	"Fullscreen,-full|Window,-window"
+    Hint	"\tStart Half-Life with the selected window state."
+  }
+
+  Space
+  {
+    Size	"3"
+  }
+
+  TextBox
+  {
+    Name	"Additional Parameters"
+    Type	"String"
+    Size	"3"
+    Hint	"\tAdd additional parameters here as you would a command line."
+  }
+}

+ 17 - 0
Compiler/Specifications/Templates.bci

@@ -0,0 +1,17 @@
+// Written by: Ryan Gregg
+// Created: December 5, 2004
+
+Once
+
+Define		"Splash"	"echo ###################################################\n"_
+				"echo #                 Batch  Compiler                 #\n"_
+				"echo ###################################################\n"_
+				"echo ###################################################\n"_
+				"echo #  Please report bugs to: [email protected]  #\n"_
+				"echo ###################################################\n"_
+				"echo.\n"_
+				"echo Written At: ${Date} ${Time}\n"_
+				"echo BC Version: ${Version}\n"_
+				"echo.\n"
+
+Define		"LogViewerRun"	"if exist \"${FilePath}\\${FileName}.log\" \"${LogViewerPath}\" \"${FilePath}\\${FileName}.log\""

+ 83 - 0
Compiler/Specifications/Zoners Tools Advanced.bcs

@@ -0,0 +1,83 @@
+// Specification: Zoners Tools Advanced
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: August 4, 2004
+// Last updated: Febuary 25, 2005
+
+// Updated by: Ryan Gregg
+// Date: Febuary 25, 2005
+// Updated ZHLT link.
+
+// Updated by: Ryan Gregg
+// Date: September 13, 2004
+// Improved game execution.
+
+// Updated by: Ryan Gregg
+// Date: August 10, 2004
+// Fixed Opt_EntData's command line.
+
+// Updated by: Ryan Gregg
+// Date: August 9, 2004
+// Added Opt_EntData stage.
+
+Include		"HLFix.bci"
+Include		"Backup.bci"
+Include		"Zoners Tools P Series.bci"
+Include		"Opt_EntData.bci"
+Include		"RESGen.bci"
+Include		"Batch.bci"
+Include		"Half-Life.bci"
+Include		"Steam.bci"
+Include		"Templates.bci"
+
+Batch
+{
+  Name		"Zoners Tools Advanced"
+  Priority	"3"
+  Links		"HLFix,http://extension.ws/hlfix/|"_
+  		"Backup,http://collective.valve-erc.com/index.php?go=mapbackup|"_
+  		"Zoners Tools,http://www.zhlt.info/|"_
+  		"Opt_EntData,http://www.chatbear.com/board.plm?a=viewthread&t=52%2c1080647136%2c18491&id=634830&b=590&v=flatold&s=0|"_
+  		"RESGen,http://www.unitedadmins.com/resgen.php|"_
+  		"Steam,http://www.steampowered.com/|"_
+  		"Valve,http://www.valvesoftware.com/"
+  Filter	"Supported Files|*.map;*.rmf;*.bsp|MAP Files (*.map)|*.map|RMF Files (*.rmf)|*.rmf|BSP Files (*.bsp)|*.bsp"
+  Stages	"HLFix|Backup|CSG|BSP|VIS|RAD|RAD2|RipEnt|Shared|Opt_EntData|RESGen|Batch|HL|Steam"
+  LogFile	"${FilePath}\\${FileName}.log"
+  Template	"@echo off\n"_
+  		"set WADROOT=${WADRoot}\n"_
+
+		"${Splash}"_
+
+  		"\"${StagePath=HLFix}\" ${StageParam=HLFix} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=Backup}\" ${StageParam=Backup} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=CSG}\" ${StageParam=CSG} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} ${StageParam=RAD2} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RipEnt}\" ${StageParam=RipEnt} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=Opt_EntData}\" \"${FilePath}\\${FileName}\" ${StageParam=Opt_EntData}\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RESGen}\" -k ${StageParam=RESGen} -f \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+
+  		"${StageCmd=Batch}\n"_
+  		"\"${StagePath=hl}\" ${StageParam=hl}\n"_
+  		"\"${StagePath=Steam}\" ${StageParam=Steam}\n"_
+		"goto succeeded\n"_
+
+		":failed\n"_
+  		"echo.\n"_
+		"echo There was a problem compiling your map, check your ${FileName}.log file for errors.\n"_
+		":succeeded\n"_
+  		"echo.\n"_
+
+  		"${LogViewerRun}\n"
+}

+ 67 - 0
Compiler/Specifications/Zoners Tools Legacy.bcs

@@ -0,0 +1,67 @@
+// Specification: Zoners Tools Legacy
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: August 4, 2004
+// Last updated: September 13, 2004
+
+// Updated by: Ryan Gregg
+// Date: September 13, 2004
+// Improved game execution.
+
+// Updated by: Ryan Gregg
+// Date: August 6, 2004
+// Added Zoners Tools Link.
+// Added Mapster Link.
+// Added Mapster Support.
+
+Include		"Zoners Tools.bci"
+Include		"Mapster.bci"
+Include		"Batch.bci"
+Include		"Half-Life.bci"
+Include		"Steam.bci"
+Include		"Templates.bci"
+
+Batch
+{
+  Name		"Zoners Tools Legacy"
+  Priority	"3"
+  Links		"Zoners Tools,http://dev.valve-erc.com/index.php?go=zhlt|"_
+  		"Mapster,http://countermap.counter-strike.net/Mapster/|"_
+  		"Steam,http://www.steampowered.com/|"_
+  		"Valve,http://www.valvesoftware.com/"
+  Filter	"Supported Files|*.map;*.bsp|MAP Files (*.map)|*.map|BSP Files (*.bsp)|*.bsp"
+  Stages	"CSG|BSP|VIS|NetVIS|Mapster|RAD|RipEnt|Shared|Batch|HL|Steam"
+  LogFile	"${FilePath}\\${FileName}.log"
+  Template	"@echo off\n"_
+  		"set WADROOT=${WADRoot}\n"_
+
+		"${Splash}"_
+
+  		"\"${StagePath=CSG}\" ${StageParam=CSG} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=NetVIS}\" ${StageParam=NetVIS} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=Mapster}\" ${StageParam=Mapster} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RipEnt}\" ${StageParam=RipEnt} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+
+  		"${StageCmd=Batch}\n"_
+  		"\"${StagePath=hl}\" ${StageParam=hl}\n"_
+  		"\"${StagePath=Steam}\" ${StageParam=Steam}\n"_
+		"goto succeeded\n"_
+
+		":failed\n"_
+  		"echo.\n"_
+		"echo There was a problem compiling your map, check your ${FileName}.log file for errors.\n"_
+		":succeeded\n"_
+  		"echo.\n"_
+
+  		"${LogViewerRun}\n"
+}

+ 64 - 0
Compiler/Specifications/Zoners Tools Normal.bcs

@@ -0,0 +1,64 @@
+// Specification: Zoners Tools Normal
+// Written by: Ryan Gregg
+// Version: N/A
+// Created: August 4, 2004
+// Last updated: September 13, 2005
+
+// Updated by: Ryan Gregg
+// Date: Febuary 25, 2005
+// Updated ZHLT link.
+
+// Updated by: Ryan Gregg
+// Date: September 13, 2004
+// Improved game execution.
+
+// Updated by: Ryan Gregg
+// Date: August 9, 2004
+// Thanks to: Anders Jenbo
+// Removed .RMF file from input file filter.
+
+Include		"Zoners Tools P Series.bci"
+Include		"Batch.bci"
+Include		"Half-Life.bci"
+Include		"Steam.bci"
+Include		"Templates.bci"
+
+Batch
+{
+  Name		"Zoners Tools Normal"
+  Priority	"3"
+  Links		"Zoners Tools,http://www.zhlt.info/|"_
+  		"Steam,http://www.steampowered.com/|"_
+  		"Valve,http://www.valvesoftware.com/"
+  Filter	"Supported Files|*.map;*.bsp|MAP Files (*.map)|*.map|BSP Files (*.bsp)|*.bsp"
+  Stages	"CSG|BSP|VIS|RAD|RAD2|RipEnt|Shared|Batch|HL|Steam"
+  LogFile	"${FilePath}\\${FileName}.log"
+  Template	"@echo off\n"_
+  		"set WADROOT=${WADRoot}\n"_
+
+		"${Splash}"_
+
+  		"\"${StagePath=CSG}\" ${StageParam=CSG} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=BSP}\" ${StageParam=BSP} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=VIS}\" ${StageParam=VIS} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RAD}\" ${StageParam=RAD} ${StageParam=RAD2} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+  		"\"${StagePath=RipEnt}\" ${StageParam=RipEnt} \"${FilePath}\\${FileName}\"\n"_
+		"if ERRORLEVEL 1 goto failed\n"_
+
+  		"${StageCmd=Batch}\n"_
+  		"\"${StagePath=hl}\" ${StageParam=hl}\n"_
+  		"\"${StagePath=Steam}\" ${StageParam=Steam}\n"_
+		"goto succeeded\n"_
+
+		":failed\n"_
+  		"echo.\n"_
+		"echo There was a problem compiling your map, check your ${FileName}.log file for errors.\n"_
+		":succeeded\n"_
+  		"echo.\n"_
+
+  		"${LogViewerRun}\n"
+}

File diff suppressed because it is too large
+ 1027 - 0
Compiler/Specifications/Zoners Tools P Series.bci


File diff suppressed because it is too large
+ 894 - 0
Compiler/Specifications/Zoners Tools.bci


+ 18 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/example-batch-file.bat

@@ -0,0 +1,18 @@
+@echo OFF
+
+SET MAP_PATH="D:\Programs\Hammer\maps\hl\mymap.map"
+SET TOOLS_PATH="D:\Programs\SHLT\SHLT 3.7 Binaries and Resources\x86 (32 bit) SSE2"
+
+SET CSG_PARAMS=-wadautodetect -cliptype precise
+SET BSP_PARAMS=
+SET VIS_PARAMS=-full
+SET RAD_PARAMS=-bounce 1 -extra -sparse -dscale 1
+SET ALL_PARAMS=-estimate -threads 2 -chart -low
+
+%TOOLS_PATH%\HLCSG.exe %MAP_PATH% %ALL_PARAMS% %CSG_PARAMS%
+%TOOLS_PATH%\HLBSP.exe %MAP_PATH% %ALL_PARAMS% %BSP_PARAMS%
+%TOOLS_PATH%\HLVIS.exe %MAP_PATH% %ALL_PARAMS% %VIS_PARAMS%
+%TOOLS_PATH%\HLRAD.exe %MAP_PATH% %ALL_PARAMS% %RAD_PARAMS%
+
+@echo End of compiler.bat.
+@pause>nul

+ 72 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/shlt.fgd

@@ -0,0 +1,72 @@
+// phlt_copy_brush information, from the official release thread,
+// ( http://www.svencoop.com/forums/showthread.php?t=36733 ) :
+// Added a new point entity, phlt_copy_brush, which allows to change
+// its classname to any you want upon map compilation, e.g. func_wall,
+// and then take the model/appearance of an existing unique brush entity
+// by targetname. With this, you can, for example, make many clones of
+// some prefab you are using a lot, without furtherly approaching map
+// limits. Any additional keyvalues added with SmartEdit disabled will
+// be kept, allowing for perfect copies which are indistinguishable from
+// the original in appearance and function. It is adviced, that the entity
+// which's appearance you are copying over possesses an origin brush. If
+// you want to rotate the copy, have the new classname be func_rotating.
+// Func_walls are blind for angles. Furthermore, note that some entities
+// will cause massive errors when having an origin brush, e.g. func_water.
+// For such cases, look at the offset of the original entity to where
+// the copy is supposed to be, and offset the phlt_copy_brush entity that
+// much from the origin of the coordinate system (0, 0, 0). Also, note
+// that the copies will look exactly as the original, including its
+// lighting and decals placed on it, no matter whether from map start or
+// while the map is running (bullet holes, sprays, blood, etc.), and that
+// the copies cannot emit texturelights.
+@PointClass size(-4 -4 -4, 4 4 4) color(96 240 16) = phlt_copy_brush : "Copies models from other entities"
+[
+	spawnflags(flags) =
+	[
+		1 : "Bit #1 (1)" : 0
+		2 : "Bit #2 (2)" : 0
+		4 : "Bit #3 (4)" : 0
+		8 : "Bit #4 (8)" : 0
+		16 : "Bit #5 (16)" : 0
+		32 : "Bit #6 (32)" : 0
+		64 : "Bit #7 (64)" : 0
+		128 : "Bit #8 (128)" : 0
+		256 : "Bit #9 (256)" : 0
+		512 : "Bit #10 (512)" : 0
+		1024 : "Bit #11 (1024)" : 0
+		2048 : "Bit #12 (2048)" : 0
+		4096 : "Bit #13 (4096)" : 0
+		8192 : "Bit #14 (8192)" : 0
+		16384 : "Bit #15 (16384)" : 0
+		32768 : "Bit #16 (32768)" : 0
+		65536 : "Bit #17 (65536)" : 0
+		131072 : "Bit #18 (131072)" : 0
+		262144 : "Bit #19 (262144)" : 0
+		524288 : "Bit #20 (524288)" : 0
+		1048576 : "Bit #21 (1048576)" : 0
+		2097152 : "Bit #22 (2097152)" : 0
+		4194304 : "Bit #23 (4194304)" : 0
+		8388608 : "Bit #24 (8388608)" : 0
+	]
+	phlt_cpm_target(string) : "PHLT Copy Target"
+	phlt_cpm_class(string) : "PHLT New Classname" : "func_rotating"
+	targetname(target_source) : "Name"
+	target(target_destination) : "Target"
+	angles(string) : "Pitch Yaw Roll (X Z Y)" : "0 0 0"
+]
+
+// shlt_entity_wildcard information, from the official release thread,
+// ( http://www.svencoop.com/forums/showthread.php?t=36733 ) :
+// This entity, upon compile, emits "wildcard_amount" - 1 info_targets,
+// and morphs this shlt_entity_wildcard into a trigger_auto, which
+// killtargets the emitted info_targets "delay" seconds after map start
+// and also removes itself.
+// The purpose of this is to prevent a crash from too many entities in
+// the middle of the map. Instead, the server would crash on map load,
+// and prevent frustration among players from a crash in the middle of play.
+@PointClass size(-24 -24 -24, 24 24 24) color(32 96 255) = shlt_entity_wildcard : "Edicts-Wildcard"
+[
+	killtarget(string) : "Wildcard name" : "shlt_wildcards"
+	wildcard_amount(integer) : "Wildcard size (Entities) (>=1)" : 50
+	delay(string) : "Delay before removal (>=0.5)" : "1.0"
+]

BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/hlbsp.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/hlcsg.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/hlrad.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/hlvis.exe


+ 101 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/lights.rad

@@ -0,0 +1,101 @@
+//lights.rad
+//Add any custom "Texture light" Values into the end of this file
+//Example - 
+//custcompscn		255 255 255 1000
+//This would make the texture "mycustomcomputerscreen" have a yellow light, and emit 1000 brightness
+//Texture light bright values also tend to be less powerful then there point light sisters, so keep this in mind
+//when you are complieing your map
+
++0~tnnl_lgt5	255 255 255 1
+gravsh_flr		0 0 255 75
++0~fifts_lght06	255 255 255 100
++0fun_hypjump	255	255	0 32
++0~generic78b	0 202 35 500
+fun_gradred		255 0 0 500
+gravsh_wall		0 0 255 100
++0generic_109	64 64 255 100
+sv_porta		0 0 255 75
+SCROLL_hyperspa	255 255 255 5
+fun_nerv		255 255 255 40
+fun_meccreditsn	255 255 255 200
+fun_meccreditra	255 255 255 200
+fun_credgray	255 255 255 200
+gp_credit_grey	255 255 255 200
+!howater		255 255 255 200
+gp_hospitalsig2	255 255 255 200
+pkf_sign8a		255 255 255 100
+fap-machine10	255 255 255 200
+fap-machine07	255 255 255 100
+fap-machine11	255 255 255 200
+gp_meck_credits   255 255 255 1000
+gp_skyscrwindow	255 255 255 100
+gp_teakwon		255 255 255 3000
+~spotblue		164 164 255 1000
+~trn_lt1		255 255 255 1000
+freezer_meat		255 255 255 200
+exit1			255 255 255 200
+~light4a		255 255 255 5000
+sv_hosign2		255 255 255 700
+sv_hotel		255 255 255 450
+gp_windowlight		255 255 255 60
+gp_711sign		255 255 255 450
+gp_whitelight		255 255 255 6000
++0~WHITE		255 255 255 6000
++0~GENERIC65 		255 255 255 750
++0~GENERIC85		110 140 235 1000 
++0~GENERIC86		255 230 125 1000
++0~GENERIC86B		60 220 170 1000
++0~GENERIC86R		128 0 0 6000
+GENERIC87A		100  255 100 1000
+GENERIC88A		255 100 100 1000
+GENERIC89A		40 40 130 1000
+GENERIC90A		200 255 200 1000
+GENERIC105		255 100 100 1000
+GENERIC106		120 120 100 1000
+GENERIC107		180 50 180 1000
+GEN_VEND1		50 180 50 1000
+EMERGLIGHT		255 200 100 50000
++0~FIFTS_LGHT01 	160 170 220 4000
++0~FIFTIES_LGT2 	160 170 220 5000
++0~FIFTS_LGHT4		160 170 220 4000
++0~LIGHT1		40 60 150 3000
++0~LIGHT3A		180 180 230 10000
++0~LIGHT4A		200 190 130 11000
++0~LIGHT5A		80 150 200 10000
++0~LIGHT6A		150 5 5 25000
++0~TNNL_LGT1		240 230 100 1000
++0~TNNL_LGT2		190 255 255 12000
++0~TNNL_LGT3		150 150 210 17000
++0~TNNL_LGT4		170 90 40 10000
++0LAB1_W6D		165 230 255 4000
++0LAB1_W6		150 160 210 8800
++0LAB1_W7		245 240 210 4000
+SKKYLITE		165 230 255 1000
++0~DRKMTLS1		205 0 0 6000
++0~DRKMTLGT1		200 200 180 6000
++0~DRKMTLS2		150 120 20 30000
++0~DRKMTLS2C		255 200 100 50000
++0DRKMTL_SCRN		60 80 255 10000
+~LAB_CRT9A		225 150 150 100
+~LAB_CRT9B		100 100 255 100
+~LAB_CRT9C		100 200 150 100
+~LIGHT3A		190 20 20 3000
+~LIGHT3B		155 155 235 2000
+~LIGHT3C		220 210 150 2500
+~LIGHT3E		90 190 140 6000
+C1A3C_MAP		100 100 255 100
+FIFTIES_MON1B		100 100 180 30
++0~LAB_CRT8		50 50 255 100
+ELEV2_CIEL		255 200 100 800
+YELLOW			255 200 100 2000
+RED			255 0 0 1000
+C14_LIGHT_BIG00		160 170 220 567
+SUBWAY_LIGHTS		160 170 220 8000
+grate_light_ury		160 170 220 8888
+quaintLight1bar		160 170 220 8888
+C14_LIGHT_null		160 170 220 200
+comp_lights2		255 200 100 200
+light_newblue		123 123 255 2222
+C3A2_LIGHT		255 255 128 4567
+hera_light1		0 128 255 2000
+LITEPANEL1		160 170 220 4000

BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x64 (64 bit)/ripent.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/hlbsp.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/hlcsg.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/hlrad.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/hlvis.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) No SSE/ripent.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlbsp.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlcsg.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlfix.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlrad.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/hlvis.exe


BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/ripent.exe


+ 9 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/thecompilator(GoldSource).bat

@@ -0,0 +1,9 @@
+hlfix.exe "I:\Hammah\zm_arena\arena1.rmf" -w "I:\Hammah\Valve Hammer Editor\SHLT-3.9\SHLT 3.9 Binaries and Resources\x86 (32 bit) SSE2\wad.txt"
+
+hlcsg.exe "I:\Hammah\zm_arena\arena1.map" -wadinclude "I:\Hammah\q3evil6.wad" -wadinclude "I:\Hammah\graphtallica6.wad" -wadinclude "I:\Hammah\graphtallica8.wad" -wadinclude "I:\Hammah\zhlt.wad" -cliptype Simple -texdata 8192 -lightdata 6144 -low -chart 
+
+hlbsp.exe "I:\Hammah\zm_arena\arena1.map" -maxnodesize 512.0 -subdivide 240.0 -texdata 8192 -lightdata 6144 -low -chart 
+
+hlvis.exe "I:\Hammah\zm_arena\arena1.map" -full -texdata 8192 -lightdata 6144 -low -chart 
+
+hlrad.exe "I:\Hammah\zm_arena\arena1.map" -extra -texdata 8192 -lightdata 6144 -low -chart 

+ 4 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/x86 (32 bit) SSE2/wad.txt

@@ -0,0 +1,4 @@
+I:\Hammah\q3evil6.wad
+I:\Hammah\graphtallica6.wad
+I:\Hammah\graphtallica8.wad
+I:\Hammah\zhlt.wad

BIN
Compiler/Tools/SHLT-3.9/SHLT 3.9 Binaries and Resources/zhlt.wad


+ 54 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/Terms of Use.txt

@@ -0,0 +1,54 @@
+Super Half Life Tools (SHLT)
+Version 3.9
+Read me File
+10/04/2009
+
+----------
+
+About This Document: 
+
+This document contains last-minute information about SHLT, including questions you may have concerning the tools or your computer. If you have a question, check to see if it is addressed here first: you may save yourself an email to me at a latter date.
+
+----------
+
+I.	GENERAL TECHNICAL ISSUES
+II.	LICENCE
+III.	CONTACTING ME
+
+----------
+
+I. GENERAL TECHNICAL ISSUES
+
+To get the code to run you should have a copy of VS 2005 Final (Pro). The code has not been tested in the betas and the freeware issue of VS 2005 (C++) has no support to compile 64bit.
+
+There are allot of "warnings" when you do compile, but these should be ignored - as fixing them causes compile errors, such as hull holes, and invisible walls - along with bad lighting, and slower compiles.
+
+The code should work with a *nix complier that has support for Microsoft secure memory commands.
+
+----------
+
+II. LICENCE
+
+0) This code is protected by the GPL, a link to the GPL can be found at the end of this page.
+
+1) In addition to the GPL, the Valve SDK 2.3 EULA overrides any rights you may have obtained in the GPL, when needed.
+
+2) The iD Quake 2 Licence overrides portions of both the Valve EULA, and the GPL where needed, please contact iD for information on this subject.
+
+Copy of the GPL
+http://www.gnu.org/copyleft/gpl.html
+
+Valve SDK EULA
+http://valvesoftware.com/business.html
+
+Quake II Source EULA
+http://www.idsoftware.com/business/technology/techlicense.php#The%20Quake%20II%20Engine
+
+----------
+
+III. CONTACTING ME
+
+I can be contacted via
+
+Email
[email protected]

+ 49 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/TimeCounter.h

@@ -0,0 +1,49 @@
+#ifndef TIMECOUNTER_H__
+#define TIMECOUNTER_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#include "cmdlib.h"
+
+class TimeCounter
+{
+public:
+    void start()
+    {
+        start = I_FloatTime();
+    }
+
+    void stop()
+    {
+        double stop = I_FloatTime();
+        accum += stop - start;
+    }
+
+    double getTotal() const
+    {
+        return accum;
+    }
+
+    void reset()
+    {
+        memset(this, 0, sizeof(*this));
+    }
+
+// Construction
+public:
+    TimeCounter()
+    {
+        reset();
+    }
+    // Default Destructor ok
+    // Default Copy Constructor ok
+    // Default Copy Operator ok
+
+protected:
+    double start;
+    double accum;
+};
+
+#endif//TIMECOUNTER_H__

+ 649 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/anorms.h

@@ -0,0 +1,649 @@
+
+{
+-0.525731, 0.000000, 0.850651}
+
+,
+{
+-0.442863, 0.238856, 0.864188}
+
+,
+{
+-0.295242, 0.000000, 0.955423}
+
+,
+{
+-0.309017, 0.500000, 0.809017}
+
+,
+{
+-0.162460, 0.262866, 0.951056}
+
+,
+{
+0.000000, 0.000000, 1.000000}
+
+,
+{
+0.000000, 0.850651, 0.525731}
+
+,
+{
+-0.147621, 0.716567, 0.681718}
+
+,
+{
+0.147621, 0.716567, 0.681718}
+
+,
+{
+0.000000, 0.525731, 0.850651}
+
+,
+{
+0.309017, 0.500000, 0.809017}
+
+,
+{
+0.525731, 0.000000, 0.850651}
+
+,
+{
+0.295242, 0.000000, 0.955423}
+
+,
+{
+0.442863, 0.238856, 0.864188}
+
+,
+{
+0.162460, 0.262866, 0.951056}
+
+,
+{
+-0.681718, 0.147621, 0.716567}
+
+,
+{
+-0.809017, 0.309017, 0.500000}
+
+,
+{
+-0.587785, 0.425325, 0.688191}
+
+,
+{
+-0.850651, 0.525731, 0.000000}
+
+,
+{
+-0.864188, 0.442863, 0.238856}
+
+,
+{
+-0.716567, 0.681718, 0.147621}
+
+,
+{
+-0.688191, 0.587785, 0.425325}
+
+,
+{
+-0.500000, 0.809017, 0.309017}
+
+,
+{
+-0.238856, 0.864188, 0.442863}
+
+,
+{
+-0.425325, 0.688191, 0.587785}
+
+,
+{
+-0.716567, 0.681718, -0.147621}
+
+,
+{
+-0.500000, 0.809017, -0.309017}
+
+,
+{
+-0.525731, 0.850651, 0.000000}
+
+,
+{
+0.000000, 0.850651, -0.525731}
+
+,
+{
+-0.238856, 0.864188, -0.442863}
+
+,
+{
+0.000000, 0.955423, -0.295242}
+
+,
+{
+-0.262866, 0.951056, -0.162460}
+
+,
+{
+0.000000, 1.000000, 0.000000}
+
+,
+{
+0.000000, 0.955423, 0.295242}
+
+,
+{
+-0.262866, 0.951056, 0.162460}
+
+,
+{
+0.238856, 0.864188, 0.442863}
+
+,
+{
+0.262866, 0.951056, 0.162460}
+
+,
+{
+0.500000, 0.809017, 0.309017}
+
+,
+{
+0.238856, 0.864188, -0.442863}
+
+,
+{
+0.262866, 0.951056, -0.162460}
+
+,
+{
+0.500000, 0.809017, -0.309017}
+
+,
+{
+0.850651, 0.525731, 0.000000}
+
+,
+{
+0.716567, 0.681718, 0.147621}
+
+,
+{
+0.716567, 0.681718, -0.147621}
+
+,
+{
+0.525731, 0.850651, 0.000000}
+
+,
+{
+0.425325, 0.688191, 0.587785}
+
+,
+{
+0.864188, 0.442863, 0.238856}
+
+,
+{
+0.688191, 0.587785, 0.425325}
+
+,
+{
+0.809017, 0.309017, 0.500000}
+
+,
+{
+0.681718, 0.147621, 0.716567}
+
+,
+{
+0.587785, 0.425325, 0.688191}
+
+,
+{
+0.955423, 0.295242, 0.000000}
+
+,
+{
+1.000000, 0.000000, 0.000000}
+
+,
+{
+0.951056, 0.162460, 0.262866}
+
+,
+{
+0.850651, -0.525731, 0.000000}
+
+,
+{
+0.955423, -0.295242, 0.000000}
+
+,
+{
+0.864188, -0.442863, 0.238856}
+
+,
+{
+0.951056, -0.162460, 0.262866}
+
+,
+{
+0.809017, -0.309017, 0.500000}
+
+,
+{
+0.681718, -0.147621, 0.716567}
+
+,
+{
+0.850651, 0.000000, 0.525731}
+
+,
+{
+0.864188, 0.442863, -0.238856}
+
+,
+{
+0.809017, 0.309017, -0.500000}
+
+,
+{
+0.951056, 0.162460, -0.262866}
+
+,
+{
+0.525731, 0.000000, -0.850651}
+
+,
+{
+0.681718, 0.147621, -0.716567}
+
+,
+{
+0.681718, -0.147621, -0.716567}
+
+,
+{
+0.850651, 0.000000, -0.525731}
+
+,
+{
+0.809017, -0.309017, -0.500000}
+
+,
+{
+0.864188, -0.442863, -0.238856}
+
+,
+{
+0.951056, -0.162460, -0.262866}
+
+,
+{
+0.147621, 0.716567, -0.681718}
+
+,
+{
+0.309017, 0.500000, -0.809017}
+
+,
+{
+0.425325, 0.688191, -0.587785}
+
+,
+{
+0.442863, 0.238856, -0.864188}
+
+,
+{
+0.587785, 0.425325, -0.688191}
+
+,
+{
+0.688191, 0.587785, -0.425325}
+
+,
+{
+-0.147621, 0.716567, -0.681718}
+
+,
+{
+-0.309017, 0.500000, -0.809017}
+
+,
+{
+0.000000, 0.525731, -0.850651}
+
+,
+{
+-0.525731, 0.000000, -0.850651}
+
+,
+{
+-0.442863, 0.238856, -0.864188}
+
+,
+{
+-0.295242, 0.000000, -0.955423}
+
+,
+{
+-0.162460, 0.262866, -0.951056}
+
+,
+{
+0.000000, 0.000000, -1.000000}
+
+,
+{
+0.295242, 0.000000, -0.955423}
+
+,
+{
+0.162460, 0.262866, -0.951056}
+
+,
+{
+-0.442863, -0.238856, -0.864188}
+
+,
+{
+-0.309017, -0.500000, -0.809017}
+
+,
+{
+-0.162460, -0.262866, -0.951056}
+
+,
+{
+0.000000, -0.850651, -0.525731}
+
+,
+{
+-0.147621, -0.716567, -0.681718}
+
+,
+{
+0.147621, -0.716567, -0.681718}
+
+,
+{
+0.000000, -0.525731, -0.850651}
+
+,
+{
+0.309017, -0.500000, -0.809017}
+
+,
+{
+0.442863, -0.238856, -0.864188}
+
+,
+{
+0.162460, -0.262866, -0.951056}
+
+,
+{
+0.238856, -0.864188, -0.442863}
+
+,
+{
+0.500000, -0.809017, -0.309017}
+
+,
+{
+0.425325, -0.688191, -0.587785}
+
+,
+{
+0.716567, -0.681718, -0.147621}
+
+,
+{
+0.688191, -0.587785, -0.425325}
+
+,
+{
+0.587785, -0.425325, -0.688191}
+
+,
+{
+0.000000, -0.955423, -0.295242}
+
+,
+{
+0.000000, -1.000000, 0.000000}
+
+,
+{
+0.262866, -0.951056, -0.162460}
+
+,
+{
+0.000000, -0.850651, 0.525731}
+
+,
+{
+0.000000, -0.955423, 0.295242}
+
+,
+{
+0.238856, -0.864188, 0.442863}
+
+,
+{
+0.262866, -0.951056, 0.162460}
+
+,
+{
+0.500000, -0.809017, 0.309017}
+
+,
+{
+0.716567, -0.681718, 0.147621}
+
+,
+{
+0.525731, -0.850651, 0.000000}
+
+,
+{
+-0.238856, -0.864188, -0.442863}
+
+,
+{
+-0.500000, -0.809017, -0.309017}
+
+,
+{
+-0.262866, -0.951056, -0.162460}
+
+,
+{
+-0.850651, -0.525731, 0.000000}
+
+,
+{
+-0.716567, -0.681718, -0.147621}
+
+,
+{
+-0.716567, -0.681718, 0.147621}
+
+,
+{
+-0.525731, -0.850651, 0.000000}
+
+,
+{
+-0.500000, -0.809017, 0.309017}
+
+,
+{
+-0.238856, -0.864188, 0.442863}
+
+,
+{
+-0.262866, -0.951056, 0.162460}
+
+,
+{
+-0.864188, -0.442863, 0.238856}
+
+,
+{
+-0.809017, -0.309017, 0.500000}
+
+,
+{
+-0.688191, -0.587785, 0.425325}
+
+,
+{
+-0.681718, -0.147621, 0.716567}
+
+,
+{
+-0.442863, -0.238856, 0.864188}
+
+,
+{
+-0.587785, -0.425325, 0.688191}
+
+,
+{
+-0.309017, -0.500000, 0.809017}
+
+,
+{
+-0.147621, -0.716567, 0.681718}
+
+,
+{
+-0.425325, -0.688191, 0.587785}
+
+,
+{
+-0.162460, -0.262866, 0.951056}
+
+,
+{
+0.442863, -0.238856, 0.864188}
+
+,
+{
+0.162460, -0.262866, 0.951056}
+
+,
+{
+0.309017, -0.500000, 0.809017}
+
+,
+{
+0.147621, -0.716567, 0.681718}
+
+,
+{
+0.000000, -0.525731, 0.850651}
+
+,
+{
+0.425325, -0.688191, 0.587785}
+
+,
+{
+0.587785, -0.425325, 0.688191}
+
+,
+{
+0.688191, -0.587785, 0.425325}
+
+,
+{
+-0.955423, 0.295242, 0.000000}
+
+,
+{
+-0.951056, 0.162460, 0.262866}
+
+,
+{
+-1.000000, 0.000000, 0.000000}
+
+,
+{
+-0.850651, 0.000000, 0.525731}
+
+,
+{
+-0.955423, -0.295242, 0.000000}
+
+,
+{
+-0.951056, -0.162460, 0.262866}
+
+,
+{
+-0.864188, 0.442863, -0.238856}
+
+,
+{
+-0.951056, 0.162460, -0.262866}
+
+,
+{
+-0.809017, 0.309017, -0.500000}
+
+,
+{
+-0.864188, -0.442863, -0.238856}
+
+,
+{
+-0.951056, -0.162460, -0.262866}
+
+,
+{
+-0.809017, -0.309017, -0.500000}
+
+,
+{
+-0.681718, 0.147621, -0.716567}
+
+,
+{
+-0.681718, -0.147621, -0.716567}
+
+,
+{
+-0.850651, 0.000000, -0.525731}
+
+,
+{
+-0.688191, 0.587785, -0.425325}
+
+,
+{
+-0.587785, 0.425325, -0.688191}
+
+,
+{
+-0.425325, 0.688191, -0.587785}
+
+,
+{
+-0.425325, -0.688191, -0.587785}
+
+,
+{
+-0.587785, -0.425325, -0.688191}
+
+,
+{
+-0.688191, -0.587785, -0.425325}
+
+,

+ 158 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/blockmem.cpp

@@ -0,0 +1,158 @@
+
+/// ********* WIN32 **********
+
+#ifdef SYSTEM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <malloc.h>
+#include "cmdlib.h"
+#include "messages.h"
+#include "log.h"
+#include "hlassert.h"
+#include "blockmem.h"
+
+// =====================================================================================
+//  AllocBlock
+// =====================================================================================
+void*           AllocBlock(const unsigned long size)
+{
+    void*           pointer;
+    HANDLE          h;
+
+    if (!size)
+    {
+        Warning("Attempting to allocate 0 bytes");
+    }
+
+    h = GlobalAlloc(GMEM_FIXED | GMEM_ZEROINIT, size);
+
+    if (h)
+    {
+        pointer = GlobalLock(h);
+    }
+    else
+    {
+        return NULL;
+    }
+
+    return pointer;
+}
+
+// =====================================================================================
+//  FreeBlock
+// =====================================================================================
+bool            FreeBlock(void* pointer)
+{
+    HANDLE          h;
+
+    if (!pointer)
+    {
+        Warning("Freeing a null pointer");
+    }
+
+    h = GlobalHandle(pointer);
+
+    if (h)
+    {
+        GlobalUnlock(h);
+        GlobalFree(h);
+        return true;
+    }
+    else
+    {
+        Warning("Could not translate pointer into handle");
+        return false;
+    }
+}
+
+#ifdef CHECK_HEAP
+// =====================================================================================
+//  HeapCheck
+// =====================================================================================
+void            HeapCheck()
+{
+    if (_heapchk() != _HEAPOK)
+        hlassert(false);
+}
+#endif
+
+// =====================================================================================
+//  AllocBlock
+// =====================================================================================
+// HeapAlloc/HeapFree is thread safe by default
+void*           Alloc(const unsigned long size)
+{
+    HeapCheck();
+    return calloc(1, size);
+}
+
+// =====================================================================================
+//  AllocBlock
+// =====================================================================================
+bool            Free(void* pointer)
+{
+    HeapCheck();
+    free(pointer);
+    return true;
+}
+
+#endif /// ********* WIN32 **********
+
+
+
+
+/// ********* POSIX **********
+
+#ifdef SYSTEM_POSIX
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#ifdef STDC_HEADERS
+#include <stdlib.h>
+#endif
+#include "cmdlib.h"
+#include "messages.h"
+#include "log.h"
+
+// =====================================================================================
+//  AllocBlock
+// =====================================================================================
+void*           AllocBlock(const unsigned long size)
+{
+    if (!size)
+    {
+        Warning("Attempting to allocate 0 bytes");
+    }
+    return calloc(1, size);
+}
+
+// =====================================================================================
+//  FreeBlock
+// =====================================================================================
+bool            FreeBlock(void* pointer)
+{
+    if (!pointer)
+    {
+        Warning("Freeing a null pointer");
+    }
+    free(pointer);
+    return true;
+}
+
+// =====================================================================================
+//  Alloc
+// =====================================================================================
+void*           Alloc(const unsigned long size)
+{
+    return AllocBlock(size);
+}
+
+// =====================================================================================
+//  Free
+// =====================================================================================
+bool            Free(void* pointer)
+{
+    return FreeBlock(pointer);
+}
+
+#endif /// ********* POSIX **********

+ 20 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/blockmem.h

@@ -0,0 +1,20 @@
+#ifndef BLOCKMEM_H__
+#define BLOCKMEM_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+extern void*    AllocBlock(unsigned long size);
+extern bool     FreeBlock(void* pointer);
+
+extern void*    Alloc(unsigned long size);
+extern bool     Free(void* pointer);
+
+#if defined(CHECK_HEAP)
+extern void     HeapCheck();
+#else
+#define HeapCheck()
+#endif
+
+#endif // BLOCKMEM_H__

+ 149 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/boundingbox.h

@@ -0,0 +1,149 @@
+// Copyright (C) 2000  Sean Cavanaugh
+// This file is licensed under the terms of the Lesser GNU Public License
+// (see LPGL.txt, or http://www.gnu.org/copyleft/lesser.txt)
+
+// AJM:
+#ifdef SYSTEM_WIN32
+#pragma warning(disable:4305) // truncation from 'const double' to 'float'
+#endif
+
+#ifndef BOUNDINGBOX_H__
+#define BOUNDINGBOX_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+class BoundingBox
+{
+public:
+    typedef enum
+    {
+        eDisjoint,      // neither boxes touch
+        eUnion,         // this box intersects with the other box
+        eSubset,        // this box is inside the other box
+        eSuperset       // this box is completly envelops the other box
+    } eBoundingState;
+
+    // Tests if other box is completely outside of this box
+    bool testDisjoint(const BoundingBox& other) const
+    {
+        if ((m_Mins[0] > other.m_Maxs[0]) ||
+            (m_Mins[1] > other.m_Maxs[1]) ||
+            (m_Mins[2] > other.m_Maxs[2]) ||
+            (m_Maxs[0] < other.m_Mins[0]) ||
+            (m_Maxs[1] < other.m_Mins[1]) ||
+            (m_Maxs[2] < other.m_Mins[2]))
+        {
+            return true;
+        }
+        return false;
+    }
+    // returns true if this box is completely inside other box
+    bool testSubset(const BoundingBox& other) const
+    {
+        if (
+                (m_Mins[0] >= other.m_Mins[0]) &&
+                (m_Maxs[0] <= other.m_Maxs[0]) &&
+                (m_Mins[1] >= other.m_Mins[1]) &&
+                (m_Maxs[1] <= other.m_Maxs[1]) &&
+                (m_Mins[2] >= other.m_Mins[2]) &&
+                (m_Maxs[2] <= other.m_Maxs[2])
+           )
+        {
+            return true;
+        }
+        return false;
+    }
+    // returns true if this box contains the other box completely
+    bool testSuperset(const BoundingBox& other) const
+    {
+        return other.testSubset(*this);
+    }
+    // returns true if this box partially intersects the other box
+    bool testUnion(const BoundingBox& other) const
+    {
+        BoundingBox tmpBox;
+        tmpBox.m_Mins[0] = max(m_Mins[0], other.m_Mins[0]);
+        tmpBox.m_Mins[1] = max(m_Mins[1], other.m_Mins[1]);
+        tmpBox.m_Mins[2] = max(m_Mins[2], other.m_Mins[2]);
+        tmpBox.m_Maxs[0] = min(m_Maxs[0], other.m_Maxs[0]);
+        tmpBox.m_Maxs[1] = min(m_Maxs[1], other.m_Maxs[1]);
+        tmpBox.m_Maxs[2] = min(m_Maxs[2], other.m_Maxs[2]);
+
+        if ((tmpBox.m_Mins[0] > tmpBox.m_Maxs[0]) ||
+            (tmpBox.m_Mins[1] > tmpBox.m_Maxs[1]) ||
+            (tmpBox.m_Mins[2] > tmpBox.m_Maxs[2]))
+        {
+            return false;
+        }   
+        return true;
+    }
+    eBoundingState test(const BoundingBox& other) const
+    {
+        eBoundingState rval;
+        if (testDisjoint(other))
+        {
+            rval = eDisjoint;
+        }
+        else if (testSubset(other))
+        {
+            rval = eSubset;
+        }
+        else if (testSuperset(other))
+        {
+            rval = eSuperset;
+        }
+        else
+        {
+            rval = eUnion;
+        }
+        return rval;
+    }
+
+    void set(const vec3_t mins, const vec3_t maxs)
+    {
+        VectorCopy(mins, m_Mins);
+        VectorCopy(maxs, m_Maxs);
+    }
+    void reset()
+    {
+        VectorFill(m_Mins,  999999999.999);
+        VectorFill(m_Maxs, -999999999.999);
+    }
+    void add(const vec3_t point)
+    {
+        m_Mins[0] = min(m_Mins[0], point[0]);
+        m_Maxs[0] = max(m_Maxs[0], point[0]);
+        m_Mins[1] = min(m_Mins[1], point[1]);
+        m_Maxs[1] = max(m_Maxs[1], point[1]);
+        m_Mins[2] = min(m_Mins[2], point[2]);
+        m_Maxs[2] = max(m_Maxs[2], point[2]);
+    }
+    void add(const BoundingBox& other)
+    {
+        add(other.m_Mins);
+        add(other.m_Maxs);
+    }
+
+public:
+    // BoundingBox(const BoundingBox& other) // Default copy constructor ok
+    // BoundingBox& operator=(const BoundingBox& other); // Default copy operator ok
+    BoundingBox()
+    {
+        reset();
+    }
+    BoundingBox(const vec3_t& mins, const vec3_t& maxs)
+    {
+        VectorCopy(mins, m_Mins);
+        VectorCopy(maxs, m_Maxs);
+    }
+    ~BoundingBox() {}
+
+public:
+    // Bounding box
+    vec3_t m_Mins;
+    vec3_t m_Maxs;
+};
+
+#endif//BOUNDINGBOX_H__

File diff suppressed because it is too large
+ 1696 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/bspfile.cpp


+ 422 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/bspfile.h

@@ -0,0 +1,422 @@
+#ifndef BSPFILE_H__
+#define BSPFILE_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+// upper design bounds
+#define MAX_MAP_HULLS            4
+// hard limit
+
+#define MAX_MAP_MODELS         512		//400	//PROTECTOR
+// variable, but 400 brush entities is very stressful on the engine and network code as it is.
+// note that 512 is the absolute limit - maps won't load if that many models are precached.
+// models include unqiue *.mdl- and *.spr-files appearing in the map as well as one model for
+// each unique brush entity. For the *.mdl and *.spr-files, there are exceptions, though.
+// E.g., player models and HUD sprites & targas don't fall under the limit.
+
+#define MAX_MAP_BRUSHES			131072	//32768 //SILENCER
+// arbitrary, but large numbers of brushes generally require more lightmap's than the compiler can handle
+
+#define MAX_ENGINE_ENTITIES   523264		//1024	//SILENCER
+#define MAX_MAP_ENTITIES      1046528		//2048	//SILENCER
+// variable, since the -num_edcits # parameter has been added
+// in actuallity it is too much, as temporary entities in the game plus static map entities can overflow
+
+#define MAX_MAP_ENTSTRING   16384*1024	//(512*1024) //SILENCER
+// abitrary, 512Kb of string data should be plenty even with TFC FGD's
+// SILENCER: You can NEVER have enough of this,
+// especially not in Sven Co-op, with all those squadmakers and game_text entities
+
+// SILENCER: The following two are hard limits. Tried doing more, but just as said in that
+// mail from ages ago, some faces just don't show up and ocassionally, the game crashes.
+// Note: The integrated plane optimization by XP-Cagey takes action before the limit check.
+#define MAX_MAP_PLANES      32767 //32768 //SILENCER: Considering the high chance of shorts being used for this
+#define MAX_INTERNAL_MAP_PLANES 256*1024
+// (from email): I have been building a rather complicated map, and using your latest 
+// tools (1.61) it seemed to compile fine.  However, in game, the engine was dropping
+// a lot of faces from almost every FUNC_WALL, and also caused a strange texture 
+// phenomenon in software mode (see attached screen shot).  When I compiled with v1.41,
+// I noticed that it hit the MAX_MAP_PLANES limit of 32k.  After deleting some brushes
+// I was able to bring the map under the limit, and all of the previous errors went away.
+
+#define MAX_MAP_NODES        32767
+// hard limit (negative short's are used as contents values)
+#define MAX_MAP_CLIPNODES    65535 //32767 //SILENCER
+// hard limit (negative short's are used as contents values)
+// SILENCER: If you go over the clipnodes limit, some brushes
+// in your map won't be solid, so you can fall outside world.
+// Sending a warning to the mapper if he exceeds the limit,
+// but not stopping the compiler later, so he can see how far he is
+// over the limit.
+
+#define MAX_MAP_LEAFS         32767	//8192
+// Old: ( 8192 is hard limit - halflife depends on it to setup pvs bits correctly )
+// SILENCER: This is not a straight hard limit (anymore (?))
+// At least it is true that I made a testmap with ca. 16000
+// leafs and it did not crash or show weird problems at any point.
+// Added a warning being thrown at the user when he exceeds 8192, though.
+
+#define MAX_MAP_VERTS        65535
+#define MAX_MAP_FACES        65535
+#define MAX_MAP_MARKSURFACES 65535
+// hard limit (data structures store them as unsigned shorts)
+
+#define MAX_MAP_TEXTURES       512
+// hard limit (halflife limitation)
+
+#define MAX_MAP_TEXINFO      32767
+// hard limit (face.texinfo is signed short)
+
+#define MAX_MAP_EDGES       524287	//256000	//SILENCER
+#define MAX_MAP_SURFEDGES	1048575	//512000	//SILENCER
+// (not so(?)) arbitrary
+
+#define DEFAULT_MAX_MAP_MIPTEX      0x2000000	//0x400000	//PROTECTOR//SILENCER
+// 4Mb of textures is enough especially considering the number of people playing the game
+// still with voodoo 1 and 2 class cards with limited local memory.
+//PROTECTOR: blahblahblah voodoo foo. welcome to the 21st century, buy yourself a graphics card with 1024mb ram for 100$.
+//SILENCER: We don't have to overdo it THAT much. It still is just Goldsource. Lowered to 32 MB.
+
+#define DEFAULT_MAX_MAP_LIGHTDATA	0x2000000	//0x600000 (6 MB) //SILENCER: New is 32 MB
+// arbitrary
+
+#define MAX_MAP_VISIBILITY  0x1000000	//0x200000	//SILENCER
+// arbitrary
+
+// these are for entity key:value pairs
+#define MAX_KEY                 64	//32	//SILENCER
+#define ZHLT3_MAX_VALUE             4096
+// quote from yahn: 'probably can raise these values if needed'
+
+// texture size limit
+#define MAX_TEXTURE_SIZE   (256 * 256 * sizeof(short) * 3) / 2
+// this is arbitrary, and needs space for the largest realistic texture plus
+// room for its mipmaps. This value is primarily used to catch damaged or
+// invalid textures in a wad file
+
+//=============================================================================
+
+#define BSPVERSION  30
+#define TOOLVERSION 2
+
+
+//
+// BSP File Structures
+//
+
+
+typedef struct
+{
+    int             fileofs, filelen;
+}
+lump_t;
+
+#define LUMP_ENTITIES      0
+#define LUMP_PLANES        1
+#define LUMP_TEXTURES      2
+#define LUMP_VERTEXES      3
+#define LUMP_VISIBILITY    4
+#define LUMP_NODES         5
+#define LUMP_TEXINFO       6
+#define LUMP_FACES         7
+#define LUMP_LIGHTING      8
+#define LUMP_CLIPNODES     9
+#define LUMP_LEAFS        10
+#define LUMP_MARKSURFACES 11
+#define LUMP_EDGES        12
+#define LUMP_SURFEDGES    13
+#define LUMP_MODELS       14
+#define HEADER_LUMPS      15
+
+//#define LUMP_MISCPAD      -1
+//#define LUMP_ZEROPAD      -2
+
+typedef struct
+{
+    float           mins[3], maxs[3];
+    float           origin[3];
+    int             headnode[MAX_MAP_HULLS];
+    int             visleafs;                              // not including the solid leaf 0
+    int             firstface, numfaces;
+}
+dmodel_t;
+
+typedef struct
+{
+    int             version;
+    lump_t          lumps[HEADER_LUMPS];
+}
+dheader_t;
+
+typedef struct
+{
+    int             nummiptex;
+    int             dataofs[4];                            // [nummiptex]
+}
+dmiptexlump_t;
+
+#define MIPLEVELS   4
+typedef struct miptex_s
+{
+    char            name[16];
+    unsigned        width, height;
+    unsigned        offsets[MIPLEVELS];                    // four mip maps stored
+}
+miptex_t;
+
+typedef struct
+{
+    float           point[3];
+}
+dvertex_t;
+
+typedef struct
+{
+    float           normal[3];
+    float           dist;
+    planetypes      type;                                  // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
+}
+dplane_t;
+
+typedef enum
+{
+    CONTENTS_EMPTY = -1,
+    CONTENTS_SOLID = -2,
+    CONTENTS_WATER = -3,
+    CONTENTS_SLIME = -4,
+    CONTENTS_LAVA = -5,
+    CONTENTS_SKY = -6,
+    CONTENTS_ORIGIN = -7,                                  // removed at csg time
+    CONTENTS_CLIP = -8,                                    // changed to contents_solid
+
+    CONTENTS_CURRENT_0 = -9,
+    CONTENTS_CURRENT_90 = -10,
+    CONTENTS_CURRENT_180 = -11,
+    CONTENTS_CURRENT_270 = -12,
+    CONTENTS_CURRENT_UP = -13,
+    CONTENTS_CURRENT_DOWN = -14,
+
+    CONTENTS_TRANSLUCENT = -15,
+    CONTENTS_HINT = -16,     // Filters down to CONTENTS_EMPTY by bsp, ENGINE SHOULD NEVER SEE THIS
+
+#ifdef ZHLT_NULLTEX
+    CONTENTS_NULL = -17,     // AJM  // removed in csg and bsp, VIS or RAD shouldnt have to deal with this, only clip planes!
+#endif
+
+#ifdef ZHLT_DETAIL   // AJM
+    CONTENTS_DETAIL = -18,  
+#endif
+}
+contents_t;
+
+// !!! if this is changed, it must be changed in asm_i386.h too !!!
+typedef struct
+{
+    int             planenum;
+    short           children[2];                           // negative numbers are -(leafs+1), not nodes
+    short           mins[3];                               // for sphere culling
+    short           maxs[3];
+    unsigned short  firstface;
+    unsigned short  numfaces;                              // counting both sides
+}
+dnode_t;
+
+typedef struct
+{
+    int             planenum;
+    short           children[2];                           // negative numbers are contents
+}
+dclipnode_t;
+
+typedef struct texinfo_s
+{
+    float           vecs[2][4];                            // [s/t][xyz offset]
+    int             miptex;
+    int             flags;
+}
+texinfo_t;
+
+#define TEX_SPECIAL     1                                  // sky or slime or null, no lightmap or 256 subdivision
+
+// note that edge 0 is never used, because negative edge nums are used for
+// counterclockwise use of the edge in a face
+typedef struct
+{
+    unsigned short  v[2];                                  // vertex numbers
+}
+dedge_t;
+
+#define MAXLIGHTMAPS    4
+typedef struct
+{
+    unsigned short	planenum;
+    short           side;
+
+    int             firstedge;                             // we must support > 64k edges
+    short           numedges;
+    short           texinfo;
+
+    // lighting info
+    byte            styles[MAXLIGHTMAPS];
+    int             lightofs;                              // start of [numstyles*surfsize] samples
+}
+dface_t;
+
+#define AMBIENT_WATER   0
+#define AMBIENT_SKY     1
+#define AMBIENT_SLIME   2
+#define AMBIENT_LAVA    3
+
+#define NUM_AMBIENTS            4                  // automatic ambient sounds
+
+// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
+// all other leafs need visibility info
+typedef struct
+{
+    int             contents;
+    int             visofs;                                // -1 = no visibility info
+
+    short           mins[3];                               // for frustum culling
+    short           maxs[3];
+
+    unsigned short  firstmarksurface;
+    unsigned short  nummarksurfaces;
+
+    byte            ambient_level[NUM_AMBIENTS];
+}
+dleaf_t;
+
+//============================================================================
+
+#define ANGLE_UP    -1
+#define ANGLE_DOWN  -2
+
+//
+// BSP File Data
+//
+
+extern int      g_nummodels;
+extern dmodel_t g_dmodels[MAX_MAP_MODELS];
+extern int      g_dmodels_checksum;
+
+extern int      g_visdatasize;
+extern byte     g_dvisdata[MAX_MAP_VISIBILITY];
+extern int      g_dvisdata_checksum;
+
+extern int      g_lightdatasize;
+extern byte*    g_dlightdata;
+extern int      g_dlightdata_checksum;
+
+extern int      g_texdatasize;
+extern byte*    g_dtexdata;                                  // (dmiptexlump_t)
+extern int      g_dtexdata_checksum;
+
+extern int      g_entdatasize;
+extern char     g_dentdata[MAX_MAP_ENTSTRING];
+extern int      g_dentdata_checksum;
+
+extern int      g_numleafs;
+extern dleaf_t  g_dleafs[MAX_MAP_LEAFS];
+extern int      g_dleafs_checksum;
+
+extern int      g_numplanes;
+extern dplane_t g_dplanes[MAX_INTERNAL_MAP_PLANES];
+extern int      g_dplanes_checksum;
+
+extern int      g_numvertexes;
+extern dvertex_t g_dvertexes[MAX_MAP_VERTS];
+extern int      g_dvertexes_checksum;
+
+extern int      g_numnodes;
+extern dnode_t  g_dnodes[MAX_MAP_NODES];
+extern int      g_dnodes_checksum;
+
+extern int      g_numtexinfo;
+extern texinfo_t g_texinfo[MAX_MAP_TEXINFO];
+extern int      g_texinfo_checksum;
+
+extern int      g_numfaces;
+extern dface_t  g_dfaces[MAX_MAP_FACES];
+extern int      g_dfaces_checksum;
+
+extern int      g_numclipnodes;
+extern dclipnode_t g_dclipnodes[MAX_MAP_CLIPNODES];
+extern int      g_dclipnodes_checksum;
+
+extern int      g_numedges;
+extern dedge_t  g_dedges[MAX_MAP_EDGES];
+extern int      g_dedges_checksum;
+
+extern int      g_nummarksurfaces;
+extern unsigned short g_dmarksurfaces[MAX_MAP_MARKSURFACES];
+extern int      g_dmarksurfaces_checksum;
+
+extern int      g_numsurfedges;
+extern int      g_dsurfedges[MAX_MAP_SURFEDGES];
+extern int      g_dsurfedges_checksum;
+
+extern void     DecompressVis(const byte* src, byte* const dest, const unsigned int dest_length);
+extern int      CompressVis(const byte* const src, const unsigned int src_length, byte* dest, unsigned int dest_length);
+
+extern void     LoadBSPImage(dheader_t* header);
+extern void     LoadBSPFile(const char* const filename);
+extern void     WriteBSPFile(const char* const filename);
+extern void     PrintBSPFileSizes();
+
+//
+// Entity Related Stuff
+//
+
+typedef struct epair_s
+{
+    struct epair_s* next;
+    char*           key;
+    char*           value;
+}
+epair_t;
+
+typedef struct
+{
+    vec3_t          origin;
+    int             firstbrush;
+    int             numbrushes;
+    epair_t*        epairs;
+}
+entity_t;
+
+extern int      g_numentities;
+extern entity_t g_entities[MAX_MAP_ENTITIES];
+
+extern void            ParseEntities(int * lNumAddress, int * lListAddress);
+extern void            UnparseEntities();
+
+extern void            strins(char* srcDestStr, const int maxNewLen, const char* insStr, const int insAtPos, const bool overwrite, const char fillGap);
+extern void            MarkEntityAsRedundant(entity_t* ent);
+extern entity_t*       AddEntity(const char* const classname, int neworigin[3]);
+extern void            RemoveKeyValue(entity_t* ent, const char* const key);
+extern void            SetKeyValue(entity_t* ent, const char* const key, const char* const value);
+extern const char*     ValueForKey(const entity_t* const ent, const char* const key);
+extern int             IntForKey(const entity_t* const ent, const char* const key);
+extern vec_t           FloatForKey(const entity_t* const ent, const char* const key);
+extern bool            BoolForKey(const entity_t* const ent, const char* const key);
+extern void            GetVectorForKey(const entity_t* const ent, const char* const key, vec3_t vec);
+extern void            GetIntVectorForKey(const entity_t* const ent, const char* const key, int vec[3]);
+
+extern entity_t* FindTargetEntity(const char* const target);
+extern epair_t* ParseEpair();
+extern entity_t* EntityForModel(int modnum);
+
+//
+// Texture Related Stuff
+//
+
+extern int      g_max_map_miptex;
+extern int		g_max_map_lightdata;
+extern void     dtexdata_init();
+extern void CDECL dtexdata_free();
+
+extern char*    GetTextureByNumber(int texturenumber);
+
+#endif //BSPFILE_H__

+ 578 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/cmdlib.cpp

@@ -0,0 +1,578 @@
+#ifdef SYSTEM_WIN32
+#pragma warning(disable:4996)
+#endif
+
+#ifdef SYSTEM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
+#include "cmdlib.h"
+#include "messages.h"
+#include "hlassert.h"
+#include "blockmem.h"
+#include "log.h"
+
+#ifdef SYSTEM_POSIX
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#endif
+
+#define PATHSEPARATOR(c) ((c) == '\\' || (c) == '/')
+
+/*
+ * ================
+ * I_FloatTime
+ * ================
+ */
+
+double          I_FloatTime()
+{
+#ifdef SYSTEM_WIN32
+    FILETIME        ftime;
+    double rval;
+
+    GetSystemTimeAsFileTime(&ftime);
+
+    rval = ftime.dwLowDateTime;
+    rval += ((__int64)ftime.dwHighDateTime) << 32;
+
+    return (rval / 10000000.0);
+#endif
+
+#ifdef SYSTEM_POSIX
+    struct timeval  tp;
+    struct timezone tzp;
+    static int      secbase;
+
+    gettimeofday(&tp, &tzp);
+
+    if (!secbase)
+    {
+        secbase = tp.tv_sec;
+        return tp.tv_usec / 1000000.0;
+    }
+
+    return (tp.tv_sec - secbase) + tp.tv_usec / 1000000.0;
+#endif
+}
+
+#ifdef SYSTEM_POSIX
+char*           strupr(char* string)
+{
+    int             i;
+    int             len = strlen(string);
+
+    for (i = 0; i < len; i++)
+    {
+        string[i] = toupper(string[i]);
+    }
+    return string;
+}
+
+char*           strlwr(char* string)
+{
+    int             i;
+    int             len = strlen(string);
+
+    for (i = 0; i < len; i++)
+    {
+        string[i] = tolower(string[i]);
+    }
+    return string;
+}
+#endif
+
+// Case Insensitive substring matching
+const char*     stristr(const char* const string, const char* const substring)
+{
+    char*           string_copy;
+    char*           substring_copy;
+    const char*     match;
+
+    string_copy = _strdup(string);
+    _strlwr(string_copy);
+
+    substring_copy = _strdup(substring);
+    _strlwr(substring_copy);
+
+    match = strstr(string_copy, substring_copy);
+    if (match)
+    {
+        match = (string + (match - string_copy));
+    }
+
+    free(string_copy);
+    free(substring_copy);
+    return match;
+}
+
+/*--------------------------------------------------------------------
+// New implementation of FlipSlashes, DefaultExtension, StripFilename, 
+// StripExtension, ExtractFilePath, ExtractFile, ExtractFileBase, etc.
+----------------------------------------------------------------------*/
+#ifdef ZHLT_NEW_FILE_FUNCTIONS
+
+//Since all of these functions operate around either the extension 
+//or the directory path, centralize getting both numbers here so we
+//can just reference them everywhere else.  Use strrchr to give a
+//speed boost while we're at it.
+inline void getFilePositions(char* path, int* extension_position, int* directory_position)
+{
+	char* ptr = strrchr(path,'.');
+	if(ptr == 0)
+	{ *extension_position = -1; }
+	else
+	{ *extension_position = ptr - path; }
+
+	ptr = max(strrchr(path,'/'),strrchr(path,'\\'));
+	if(ptr == 0)
+	{ *directory_position = -1; }
+	else
+	{ 
+		*directory_position = ptr - path;
+		if(*directory_position > *extension_position)
+		{ *extension_position = -1; }
+		
+		//cover the case where we were passed a directory - get 2nd-to-last slash
+		if(*directory_position == strlen(path) - 1)
+		{
+			do
+			{
+				--(*directory_position);
+			}
+			while(*directory_position > -1 && path[*directory_position] != '/' && path[*directory_position] != '\\');
+		}
+	}
+}
+
+char* FlipSlashes(char* string)
+{
+	char* ptr = string;
+	if(SYSTEM_SLASH_CHAR == '\\')
+	{
+		while(ptr = strchr(ptr,'/'))
+		{ *ptr = SYSTEM_SLASH_CHAR; }
+	}
+	else
+	{
+		while(ptr = strchr(ptr,'\\'))
+		{ *ptr = SYSTEM_SLASH_CHAR; }
+	}
+	return string;
+}
+
+void DefaultExtension(char* path, const char* extension)
+{
+	int extension_pos, directory_pos;
+	getFilePositions(path,&extension_pos,&directory_pos);
+	if(extension_pos == -1)
+	{ strcat(path,extension); }
+}
+
+void StripFilename(char* path)
+{
+	int extension_pos, directory_pos;
+	getFilePositions(path,&extension_pos,&directory_pos);
+	if(directory_pos == -1)
+	{ path[0] = 0; }
+	else
+	{ path[directory_pos] = 0; }
+}
+
+void StripExtension(char* path)
+{
+	int extension_pos, directory_pos;
+	getFilePositions(path,&extension_pos,&directory_pos);
+	if(extension_pos != -1)
+	{ path[extension_pos] = 0; }
+}
+
+void ExtractFilePath(char* const path, char* dest)
+{
+	int extension_pos, directory_pos;
+	getFilePositions(path,&extension_pos,&directory_pos);
+	if(directory_pos != -1)
+	{
+	    memcpy(dest,path,directory_pos+1); //include directory slash
+	    dest[directory_pos+1] = 0;
+	}
+	else
+	{ dest[0] = 0; }
+}
+
+void ExtractFile(char* const path, char* dest)
+{
+	int extension_pos, directory_pos;
+	getFilePositions(path,&extension_pos,&directory_pos);
+
+	int length = (int)strlen(path);
+
+	if(directory_pos == -1)	{ directory_pos = 0; }
+	else { length -= directory_pos + 1; }
+
+    memcpy(dest,path+directory_pos+1,length); //exclude directory slash
+    dest[length] = 0;
+}
+
+void ExtractFileBase(char* const path, char* dest)
+{
+	int extension_pos, directory_pos;
+	getFilePositions(path,&extension_pos,&directory_pos);
+	int length = extension_pos == -1 ? (int)strlen(path) : extension_pos;
+
+	if(directory_pos == -1)	{ directory_pos = 0; }
+	else { length -= directory_pos + 1; }
+
+    memcpy(dest,path+directory_pos+1,length); //exclude directory slash
+    dest[length] = 0;
+}
+
+void ExtractFileExtension(char* const path, char* dest)
+{
+	int extension_pos, directory_pos;
+	getFilePositions(path,&extension_pos,&directory_pos);
+	if(extension_pos != -1)
+	{
+		int length = (int)strlen(path) - extension_pos;
+	    memcpy(dest,path+extension_pos,length); //include extension '.'
+	    dest[length] = 0;
+	}
+	else
+	{ dest[0] = 0; }
+}
+//-------------------------------------------------------------------
+#else //old cmdlib functions
+
+char*           FlipSlashes(char* string)
+{
+    while (*string)
+    {
+        if (PATHSEPARATOR(*string))
+        {
+            *string = SYSTEM_SLASH_CHAR;
+        }
+        string++;
+    }
+    return string;
+}
+
+void            DefaultExtension(char* path, const char* extension)
+{
+    char*           src;
+
+    //
+    // if path doesn't have a .EXT, append extension
+    // (extension should include the .)
+    //
+    src = path + strlen(path) - 1;
+
+    while (!PATHSEPARATOR(*src) && src != path)
+    {
+        if (*src == '.')
+            return;                                        // it has an extension
+        src--;
+    }
+
+    strcat(path, extension);
+}
+
+void            StripFilename(char* path)
+{
+    int             length;
+
+    length = strlen(path) - 1;
+    while (length > 0 && !PATHSEPARATOR(path[length]))
+        length--;
+    path[length] = 0;
+}
+
+void            StripExtension(char* path)
+{
+    int             length;
+
+    length = strlen(path) - 1;
+    while (length > 0 && path[length] != '.')
+    {
+        length--;
+        if (PATHSEPARATOR(path[length]))
+            return;                                        // no extension
+    }
+    if (length)
+        path[length] = 0;
+}
+
+/*
+ * ====================
+ * Extract file parts
+ * ====================
+ */
+void            ExtractFilePath(const char* const path, char* dest)
+{
+    hlassert (path != dest);
+
+    const char*           src;
+
+    src = path + strlen(path) - 1;
+
+    //
+    // back up until a \ or the start
+    //
+    while (src != path && !PATHSEPARATOR(*(src - 1)))
+        src--;
+
+    memcpy(dest, path, src - path);
+    dest[src - path] = 0;
+}
+
+void            ExtractFile(const char* const path, char* dest)
+{
+    hlassert (path != dest);
+
+    const char*           src;
+
+    src = path + strlen(path) - 1;
+
+    while (src != path && !PATHSEPARATOR(*(src - 1)))
+        src--;
+
+    while (*src)
+    {
+        *dest++ = *src++;
+    }
+    *dest = 0;
+}
+
+void            ExtractFileBase(const char* const path, char* dest)
+{
+    hlassert (path != dest);
+
+    const char*           src;
+
+    src = path + strlen(path) - 1;
+
+    //
+    // back up until a \ or the start
+    //
+    while (src != path && !PATHSEPARATOR(*(src - 1)))
+        src--;
+
+    while (*src && *src != '.')
+    {
+        *dest++ = *src++;
+    }
+    *dest = 0;
+}
+
+void            ExtractFileExtension(const char* const path, char* dest)
+{
+    hlassert (path != dest);
+
+    const char*           src;
+
+    src = path + strlen(path) - 1;
+
+    //
+    // back up until a . or the start
+    //
+    while (src != path && *(src - 1) != '.')
+        src--;
+    if (src == path)
+    {
+        *dest = 0;                                         // no extension
+        return;
+    }
+
+    strcpy_s(dest, src);
+}
+
+#endif
+
+/*
+ * ============================================================================
+ * 
+ * BYTE ORDER FUNCTIONS
+ * 
+ * ============================================================================
+ */
+
+#ifdef WORDS_BIGENDIAN
+
+short           LittleShort(const short l)
+{
+    byte            b1, b2;
+
+    b1 = l & 255;
+    b2 = (l >> 8) & 255;
+
+    return (b1 << 8) + b2;
+}
+
+short           BigShort(const short l)
+{
+    return l;
+}
+
+int             LittleLong(const int l)
+{
+    byte            b1, b2, b3, b4;
+
+    b1 = l & 255;
+    b2 = (l >> 8) & 255;
+    b3 = (l >> 16) & 255;
+    b4 = (l >> 24) & 255;
+
+    return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4;
+}
+
+int             BigLong(const int l)
+{
+    return l;
+}
+
+float           LittleFloat(const float l)
+{
+    union
+    {
+        byte            b[4];
+        float           f;
+    }
+    in             , out;
+
+    in.f = l;
+    out.b[0] = in.b[3];
+    out.b[1] = in.b[2];
+    out.b[2] = in.b[1];
+    out.b[3] = in.b[0];
+
+    return out.f;
+}
+
+float           BigFloat(const float l)
+{
+    return l;
+}
+
+#else // Little endian (Intel, etc)
+
+short           BigShort(const short l)
+{
+    byte            b1, b2;
+
+    b1 = (byte) (l & 255);
+    b2 = (byte) ((l >> 8) & 255);
+
+    return (short)((b1 << 8) + b2);
+}
+
+short           LittleShort(const short l)
+{
+    return l;
+}
+
+int             BigLong(const int l)
+{
+    byte            b1, b2, b3, b4;
+
+    b1 = (byte) (l & 255);
+    b2 = (byte) ((l >> 8) & 255);
+    b3 = (byte) ((l >> 16) & 255);
+    b4 = (byte) ((l >> 24) & 255);
+
+    return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4;
+}
+
+int             LittleLong(const int l)
+{
+    return l;
+}
+
+float           BigFloat(const float l)
+{
+    union
+    {
+        byte            b[4];
+        float           f;
+    }
+    in             , out;
+
+    in.f = l;
+    out.b[0] = in.b[3];
+    out.b[1] = in.b[2];
+    out.b[2] = in.b[1];
+    out.b[3] = in.b[0];
+
+    return out.f;
+}
+
+float           LittleFloat(const float l)
+{
+    return l;
+}
+
+#endif
+
+//=============================================================================
+
+bool CDECL      safe_snprintf(char* const dest, const size_t count, const char* const args, ...)
+{
+    size_t          amt;
+    va_list         argptr;
+
+    hlassert(count > 0);
+
+    va_start(argptr, args);
+    amt = vsnprintf(dest, count, args, argptr);
+    va_end(argptr);
+
+    // truncated (bad!, snprintf doesn't null terminate the string when this happens)
+    if (amt == count)
+    {
+        dest[count - 1] = 0;
+        return false;
+    }
+
+    return true;
+}
+
+bool            safe_strncpy(char* const dest, const char* const src, const size_t count)
+{
+    return safe_snprintf(dest, count, "%s", src);
+}
+
+bool            safe_strncat(char* const dest, const char* const src, const size_t count)
+{
+    if (count)
+    {
+        strncat(dest, src, count);
+
+        dest[count - 1] = 0;                               // Ensure it is null terminated
+        return true;
+    }
+    else
+    {
+        Warning("safe_strncat passed empty count");
+        return false;
+    }
+}
+
+bool            TerminatedString(const char* buffer, const int size)
+{
+    int             x;
+
+    for (x = 0; x < size; x++, buffer++)
+    {
+        if ((*buffer) == 0)
+        {
+            return true;
+        }
+    }
+    return false;
+}

+ 170 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/cmdlib.h

@@ -0,0 +1,170 @@
+#ifndef CMDLIB_H__
+#define CMDLIB_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#ifdef __MINGW32__
+#include <io.h>
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+// AJM: gnu compiler fix
+#ifdef __GNUC__
+#define _alloca __builtin_alloca
+#define alloca __builtin_alloca
+#endif
+
+#include "win32fix.h"
+#include "mathtypes.h"
+
+#ifdef _DEBUG
+#define ZHLT_VERSIONSTRING "v3.9"
+#else
+#define ZHLT_VERSIONSTRING "3.9"
+#endif
+
+// SILENCER -->
+#if !defined(_WIN64)
+
+#if _M_IX86_FP == 0
+#define HACK_VERSIONSTRING "x86 (32b) SSE OFF"
+#endif
+
+#if _M_IX86_FP == 1
+#define HACK_VERSIONSTRING "x86 (32b) SSE1 ON"
+#endif
+
+#if _M_IX86_FP == 2
+#define HACK_VERSIONSTRING "x86 (32b) SSE2 ON"
+#endif
+
+#else
+#define HACK_VERSIONSTRING "x64 (64b)        "
+#endif
+// <-- SILENCER
+
+
+//=====================================================================
+// AJM: Different features of the tools can be undefined here
+//      these are not officially beta tested, but seem to work okay
+
+// ZHLT_* features are spread across more than one tool. Hence, changing
+//      one of these settings probably means recompiling the whole set
+#define ZHLT_INFO_COMPILE_PARAMETERS        // ALL TOOLS
+#define ZHLT_NULLTEX                        // HLCSG, HLBSP
+#define ZHLT_TEXLIGHT                       // HLCSG, HLRAD - triggerable texlights by LRC
+#define ZHLT_GENERAL                        // ALL TOOLS - general changes
+#define ZHLT_NEW_FILE_FUNCTIONS				// ALL TOOLS - file path/extension extraction functions
+//#define ZHLT_DETAIL                         // HLCSG, HLBSP - detail brushes    
+//#define ZHLT_PROGRESSFILE                   // ALL TOOLS - estimate progress reporting to -progressfile
+//#define ZHLT_NSBOB
+
+#define ZHLT_VectorMA_FIX //--vluzacn
+
+#define ZHLT_PLANETYPE_FIX // Very Important !! --vluzacn
+
+#define COMMON_HULLU // winding optimisations by hullu
+
+// tool specific settings below only mean a recompile of the tool affected
+#define HLCSG_CLIPECONOMY
+#define HLCSG_WADCFG
+#define HLCSG_AUTOWAD
+
+#define HLCSG_PRECISIONCLIP
+#define HLCSG_FASTFIND
+#ifdef ZHLT_NULLTEX
+	#define HLCSG_NULLIFY_INVISIBLE //requires null textures as prerequisite
+#endif
+
+#define HLCSG_SORTBRUSH_FIX
+
+//#define HLBSP_THREADS // estimate for hlbsp
+
+#define HLVIS_MAXDIST
+
+#define HLRAD_INFO_TEXLIGHTS
+#define HLRAD_WHOME // encompases all of Adam Foster's changes
+#define HLRAD_HULLU // semi-opaque brush based entities and effects by hullu
+#define HLRAD_FASTMATH // optimized mathutil.cpp by KGP
+
+//=====================================================================
+
+#ifdef SYSTEM_WIN32
+#pragma warning(disable:4127 4115 4244 4786 4305 4800)
+#endif
+
+
+#ifdef STDC_HEADERS
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <ctype.h>
+#include <time.h>
+#include <stdarg.h>
+#include <limits.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef ZHLT_NETVIS
+#include "c2cpp.h"
+#endif
+
+#ifdef SYSTEM_WIN32
+#define SYSTEM_SLASH_CHAR  '\\'
+#define SYSTEM_SLASH_STR   "\\"
+#endif
+#ifdef SYSTEM_POSIX
+#define SYSTEM_SLASH_CHAR  '/'
+#define SYSTEM_SLASH_STR   "/"
+#endif
+
+// the dec offsetof macro doesn't work very well...
+#define myoffsetof(type,identifier) ((size_t)&((type*)0)->identifier)
+#define sizeofElement(type,identifier) (sizeof((type*)0)->identifier)
+
+#ifdef SYSTEM_POSIX
+extern char*    strupr(char* string);
+extern char*    strlwr(char* string);
+#endif
+extern const char* stristr(const char* const string, const char* const substring);
+extern bool CDECL safe_snprintf(char* const dest, const size_t count, const char* const args, ...);
+extern bool     safe_strncpy(char* const dest, const char* const src, const size_t count);
+extern bool     safe_strncat(char* const dest, const char* const src, const size_t count);
+extern bool     TerminatedString(const char* buffer, const int size);
+
+extern char*    FlipSlashes(char* string);
+
+extern double   I_FloatTime();
+
+extern int      CheckParm(char* check);
+
+extern void     DefaultExtension(char* path, const char* extension);
+extern void     DefaultPath(char* path, char* basepath);
+extern void     StripFilename(char* path);
+extern void     StripExtension(char* path);
+
+extern void     ExtractFile(const char* const path, char* dest);
+extern void     ExtractFilePath(const char* const path, char* dest);
+extern void     ExtractFileBase(const char* const path, char* dest);
+extern void     ExtractFileExtension(const char* const path, char* dest);
+
+extern short    BigShort(short l);
+extern short    LittleShort(short l);
+extern int      BigLong(int l);
+extern int      LittleLong(int l);
+extern float    BigFloat(float l);
+extern float    LittleFloat(float l);
+
+#endif //CMDLIB_H__

+ 228 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/filelib.cpp

@@ -0,0 +1,228 @@
+#ifdef SYSTEM_WIN32
+#pragma warning(disable:4996)
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef SYSTEM_WIN32
+#include <sys/stat.h>
+#include <io.h>
+#include <fcntl.h>
+#endif
+
+#ifdef SYSTEM_POSIX
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#endif
+
+#include "cmdlib.h"
+#include "messages.h"
+#include "log.h"
+#include "mathtypes.h"
+#include "mathlib.h"
+#include "blockmem.h"
+
+/*
+ * ==============
+ * getfiletime        
+ * ==============
+ */
+
+time_t          getfiletime(const char* const filename)
+{
+    time_t          filetime = 0;
+    struct stat     filestat;
+
+    if (stat(filename, &filestat) == 0)
+        filetime = max(filestat.st_mtime, filestat.st_ctime);
+
+    return filetime;
+}
+
+/*
+ * ==============      
+ * getfilesize
+ * ==============
+ */
+long            getfilesize(const char* const filename)
+{
+    long            size = 0;
+    struct stat     filestat;
+
+    if (stat(filename, &filestat) == 0)
+        size = filestat.st_size;
+
+    return size;
+}
+
+/*
+ * ==============
+ * getfiledata
+ * ==============
+ */
+long            getfiledata(const char* const filename, char* buffer, const int buffersize)
+{
+    long            size = 0;
+    int             handle;
+    time_t            start, end;
+
+    time(&start);
+
+    if ((handle = (int)fopen(filename, O_RDONLY)) != -1)
+    {
+        int             bytesread;
+
+        Log("%-20s Restoring [%-13s - ", "BuildVisMatrix:", filename);
+        while ((bytesread = _read(handle, buffer, min(32 * 1024, buffersize - size))) > 0)
+        {
+            size += bytesread;
+            buffer += bytesread;
+        }
+        _close(handle);
+        time(&end);
+        Log("%10.3fMB] (%d)\n", size / (1024.0 * 1024.0), end - start);
+    }
+
+    if (buffersize != size)
+    {
+        Warning("Invalid file [%s] found.  File will be rebuilt!\n", filename);
+        _unlink(filename);
+    }
+
+    return size;
+}
+
+/*
+ * ================
+ * filelength
+ * ================
+ */
+int             q_filelength(FILE* f)
+{
+    int             pos;
+    int             end;
+
+    pos = ftell(f);
+    fseek(f, 0, SEEK_END);
+    end = ftell(f);
+    fseek(f, pos, SEEK_SET);
+
+    return end;
+}
+
+/*
+ * ================
+ * exists
+ * ================
+ */
+bool            q_exists(const char* const filename)
+{
+    FILE*           f;
+
+    f = fopen(filename, "rb");
+
+    if (!f)
+    {
+        IfDebug(Developer(DEVELOPER_LEVEL_SPAM, "Checking for existance of file %s (failed)\n", filename));
+        return false;
+    }
+    else
+    {
+        fclose(f);
+        IfDebug(Developer(DEVELOPER_LEVEL_SPAM, "Checking for existance of file %s (success)\n", filename));
+        return true;
+    }
+}
+
+
+
+
+FILE*           SafeOpenWrite(const char* const filename)
+{
+    FILE*           f;
+
+    f = fopen(filename, "wb");
+
+    if (!f)
+        Error("Error opening %s: %s", filename, strerror(errno));
+
+    return f;
+}
+
+FILE*           SafeOpenRead(const char* const filename)
+{
+    FILE*           f;
+
+    f = fopen(filename, "rb");
+
+    if (!f)
+        Error("Error opening %s: %s", filename, strerror(errno));
+
+    return f;
+}
+
+void            SafeRead(FILE* f, void* buffer, int count)
+{
+	if (fread(buffer, 1, count, f) != (size_t) count) {
+		Log("\n");
+        Error("File read failure.\n");
+	}
+}
+
+void            SafeWrite(FILE* f, const void* const buffer, int count)
+{
+	if (fwrite(buffer, 1, count, f) != (size_t) count) {
+		Log("\n");
+		Error("File write failure.\n"
+		      "       Maybe you exceeded a critical map limit? (E.g.: Leafs)\n"
+		      "       Check above. (Some objects, as a result of exceeding a\n"
+		      "       limit, may be negative bogus)\n");
+	}
+}
+
+/*
+ * ==============
+ * LoadFile
+ * ==============
+ */
+int             LoadFile(const char* const filename, char** bufferptr)
+{
+    FILE*           f;
+    int             length;
+    char*           buffer;
+
+    f = SafeOpenRead(filename);
+    length = q_filelength(f);
+    buffer = (char*)Alloc(length + 1);
+    SafeRead(f, buffer, length);
+    fclose(f);
+
+    *bufferptr = buffer;
+    return length;
+}
+
+/*
+ * ==============
+ * SaveFile
+ * ==============
+ */
+void            SaveFile(const char* const filename, const void* const buffer, int count)
+{
+    FILE*           f;
+
+    f = SafeOpenWrite(filename);
+    SafeWrite(f, buffer, count);
+    fclose(f);
+}
+

+ 22 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/filelib.h

@@ -0,0 +1,22 @@
+#ifndef FILELIB_H__
+#define FILELIB_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+extern time_t   getfiletime(const char* const filename);
+extern long     getfilesize(const char* const filename);
+extern long     getfiledata(const char* const filename, char* buffer, const int buffersize);
+extern bool     q_exists(const char* const filename);
+extern int      q_filelength(FILE* f);
+
+extern FILE*    SafeOpenWrite(const char* const filename);
+extern FILE*    SafeOpenRead(const char* const filename);
+extern void     SafeRead(FILE* f, void* buffer, int count);
+extern void     SafeWrite(FILE* f, const void* const buffer, int count);
+
+extern int      LoadFile(const char* const filename, char** bufferptr);
+extern void     SaveFile(const char* const filename, const void* const buffer, int count);
+
+#endif //**/ FILELIB_H__

+ 0 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/files.cpp


+ 40 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/hlassert.h

@@ -0,0 +1,40 @@
+#ifndef HLASSERT_H__
+#define HLASSERT_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#ifdef SYSTEM_WIN32
+#ifdef _DEBUG
+
+#include "log.h"
+
+#define assume(exp, message) {if (!(exp)) {Log("\n***** ERROR *****\nAssume '%s' failed\n at %s:%d\n %s\n\n", #exp, __FILE__, __LINE__, message);  __asm{int 3} }}
+#define hlassert(exp) assume(exp, "")
+
+#else // _DEBUG
+
+#define assume(exp, message) {if (!(exp)) {Error("\nAssume '%s' failed\n at %s:%d\n %s\n\n", #exp, __FILE__, __LINE__, message);}}
+#define hlassert(exp)
+
+#endif // _DEBUG
+#endif // SYSTEM_WIN32
+
+#ifdef SYSTEM_POSIX
+#ifdef _DEBUG
+
+#include "log.h"
+
+#define assume(exp, message) {if (!(exp)) {Log("\n***** ERROR *****\nAssume '%s' failed\n at %s:%d\n %s\n\n", #exp, __FILE__, __LINE__, message);  exit(-1); }}
+#define hlassert(exp) assume(exp, "")
+
+#else // _DEBUG
+
+#define assume(exp, message) {if (!(exp)) {Error("\nAssume '%s' failed\n\n", #exp, __FILE__, __LINE__, message);}}
+#define hlassert(exp)
+
+#endif // _DEBUG
+#endif // SYSTEM_POSIX
+
+#endif // SYSTEM_POSIX HLASSERT_H__

+ 684 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/log.cpp

@@ -0,0 +1,684 @@
+#ifdef SYSTEM_WIN32
+#pragma warning(disable:4996)
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef ZHLT_NETVIS
+#ifdef SYSTEM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+#endif
+
+#ifdef STDC_HEADERS
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef ZHLT_NETVIS
+#include "../netvis/c2cpp.h"
+#endif
+
+#include "cmdlib.h"
+#include "messages.h"
+#include "hlassert.h"
+#include "log.h"
+#include "filelib.h"
+#include <windows.h>
+
+char*           g_Program = "Uninitialized variable ::g_Program";
+char            g_Mapname[_MAX_PATH] = "Uninitialized variable ::g_Mapname";
+
+developer_level_t g_developer = DEFAULT_DEVELOPER;
+bool            g_verbose = DEFAULT_VERBOSE;
+bool            g_log = DEFAULT_LOG;
+
+unsigned long   g_clientid = 0;
+unsigned long   g_nextclientid = 0;
+
+static FILE*    CompileLog = NULL;
+static bool     fatal = false;
+
+bool g_noConColors = false;
+
+////////
+
+void            ResetTmpFiles()
+{
+    if (g_log)
+    {
+        char            filename[_MAX_PATH];
+
+        safe_snprintf(filename, _MAX_PATH, "%s.bsp", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.inc", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.p0", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.p1", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.p2", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.p3", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.prt", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.pts", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.lin", g_Mapname);
+        _unlink(filename);
+
+        safe_snprintf(filename, _MAX_PATH, "%s.wic", g_Mapname);
+        _unlink(filename);
+    }
+}
+
+void            ResetLog()
+{
+    if (g_log)
+    {
+        char            logfilename[_MAX_PATH];
+
+        safe_snprintf(logfilename, _MAX_PATH, "%s.log", g_Mapname);
+        _unlink(logfilename);
+    }
+}
+
+void            ResetErrorLog()
+{
+    if (g_log)
+    {
+        char            logfilename[_MAX_PATH];
+
+        safe_snprintf(logfilename, _MAX_PATH, "%s.err", g_Mapname);
+        _unlink(logfilename);
+    }
+}
+
+void            CheckForErrorLog()
+{
+    if (g_log)
+    {
+        char            logfilename[_MAX_PATH];
+
+        safe_snprintf(logfilename, _MAX_PATH, "%s.err", g_Mapname);
+        if (q_exists(logfilename))
+        {
+            Log(">> There was a problem compiling the map.\n"
+                ">> Check the file %s.log for the cause.\n",
+                 g_Mapname);
+            exit(1);
+        }
+    }
+}
+
+///////
+
+void            LogError(const char* const message)
+{
+    if (g_log && CompileLog)
+    {
+        char            logfilename[_MAX_PATH];
+        FILE*           ErrorLog = NULL;
+
+        safe_snprintf(logfilename, _MAX_PATH, "%s.err", g_Mapname);
+        ErrorLog = fopen(logfilename, "a");
+
+        if (ErrorLog)
+        {
+            fprintf(ErrorLog, "%s: %s\n", g_Program, message);
+            fflush(ErrorLog);
+            fclose(ErrorLog);
+            ErrorLog = NULL;
+        }
+        else
+        {
+            fprintf(stderr, "ERROR: Could not open error logfile %s", logfilename);
+            fflush(stderr);
+        }
+    }
+}
+
+void CDECL      OpenLog(const int clientid)
+{
+    if (g_log)
+    {
+        char            logfilename[_MAX_PATH];
+
+#ifdef ZHLT_NETVIS
+    #ifdef SYSTEM_WIN32
+        if (clientid)
+        {
+            char            computername[MAX_COMPUTERNAME_LENGTH + 1];
+            unsigned long   size = sizeof(computername);
+
+            if (!GetComputerName(computername, &size))
+            {
+                safe_strncpy(computername, "unknown", sizeof(computername));
+            }
+            safe_snprintf(logfilename, _MAX_PATH, "%s-%s-%d.log", g_Mapname, computername, clientid);
+        }
+        else
+    #endif
+    #ifdef SYSTEM_POSIX
+        if (clientid)
+        {
+            char            computername[_MAX_PATH];
+            unsigned long   size = sizeof(computername);
+
+            if (gethostname(computername, size))
+            {
+                safe_strncpy(computername, "unknown", sizeof(computername));
+            }
+            safe_snprintf(logfilename, _MAX_PATH, "%s-%s-%d.log", g_Mapname, computername, clientid);
+        }
+    #endif
+#endif
+        {
+            safe_snprintf(logfilename, _MAX_PATH, "%s.log", g_Mapname);
+        }
+        CompileLog = fopen(logfilename, "a");
+
+        if (!CompileLog)
+        {
+            fprintf(stderr, "ERROR: Could not open logfile %s", logfilename);
+            fflush(stderr);
+        }
+    }
+}
+
+void CDECL      CloseLog()
+{
+    if (g_log && CompileLog)
+    {
+        LogEnd();
+        fflush(CompileLog);
+        fclose(CompileLog);
+        CompileLog = NULL;
+    }
+}
+
+//
+//  Every function up to this point should check g_log, the functions below should not
+//
+
+#ifdef SYSTEM_WIN32
+// AJM: fprintf/flush wasnt printing newline chars correctly (prefixed with \r) under win32
+//      due to the fact that those streams are in byte mode, so this function prefixes 
+//      all \n with \r automatically.
+//      NOTE: system load may be more with this method, but there isnt that much logging going
+//      on compared to the time taken to compile the map, so its negligable.
+void            Safe_WriteLog(const char* const message)
+{
+    const char* c;
+    
+    if (!CompileLog)
+        return;
+
+    c = &message[0];
+
+    while (1)
+    {
+        if (!*c)
+            return; // end of string
+
+        if (*c == '\n')
+            fputc('\r', CompileLog);
+
+        fputc(*c, CompileLog);
+
+        c++;
+    }
+}
+#endif
+
+void            WriteLog(const char* const message)
+{
+
+#ifndef SYSTEM_WIN32
+    if (CompileLog)
+    {
+        fprintf(CompileLog, message);
+        fflush(CompileLog);
+    }
+#else
+    Safe_WriteLog(message);
+#endif
+
+    fprintf(stdout, message);
+    fflush(stdout);
+}
+
+// =====================================================================================
+//  CheckFatal 
+// =====================================================================================
+void            CheckFatal()
+{
+    if (fatal)
+    {
+        hlassert(false);
+        exit(1);
+    }
+}
+
+#define MAX_ERROR   2048
+#define MAX_WARNING 2048
+#define MAX_MESSAGE 2048
+
+// =====================================================================================
+//  Error
+//      for formatted error messages, fatals out
+// =====================================================================================
+void CDECL      Error(const char* const error, ...)
+{
+    char            message[MAX_ERROR];
+    char            message2[MAX_ERROR];
+    va_list         argptr;
+    
+ /*#if defined( SYSTEM_WIN32 ) && !defined( __MINGW32__ ) && !defined( __BORLANDC__ )
+    {
+        char* wantint3 = getenv("WANTINT3");
+		if (wantint3)
+		{
+			if (atoi(wantint3))
+			{
+				__asm
+				{
+					int 3;
+				}
+			}
+		}
+    }
+#endif*/
+
+    va_start(argptr, error);
+    _vsnprintf_s(message, MAX_ERROR, error, argptr);
+    va_end(argptr);
+
+    safe_snprintf(message2, MAX_MESSAGE, "Error: %s\n", message);
+
+	ConColor(CONCOLOR_RED, CONCOLOR_BGDEF_BLACK); //SILENCER
+    WriteLog(message2);
+	ConColor(CONCOLOR_TXTDEF_WHITE, CONCOLOR_BGDEF_BLACK); //SILENCER
+
+    LogError(message2);
+
+    fatal = 1;
+    CheckFatal();
+}
+
+// =====================================================================================
+//  Fatal
+//      For formatted 'fatal' warning messages
+//      automatically appends an extra newline to the message
+//      This function sets a flag that the compile should abort before completing
+// =====================================================================================
+void CDECL      Fatal(assume_msgs msgid, const char* const warning, ...)
+{
+    char            message[MAX_WARNING];
+    char            message2[MAX_WARNING];
+
+    va_list         argptr;
+
+    va_start(argptr, warning);
+    _vsnprintf_s(message, MAX_WARNING, warning, argptr);
+    va_end(argptr);
+
+    safe_snprintf(message2, MAX_MESSAGE, "Error: %s\n", message);
+
+	ConColor(CONCOLOR_RED, CONCOLOR_BGDEF_BLACK); //SILENCER
+    WriteLog(message2);
+	ConColor(CONCOLOR_TXTDEF_WHITE, CONCOLOR_BGDEF_BLACK); //SILENCER
+
+    LogError(message2);
+
+    {
+        char            message[MAX_MESSAGE];
+        const MessageTable_t* msg = GetAssume(msgid);
+
+        safe_snprintf(message, MAX_MESSAGE, "%s\nDescription: %s\nHowto Fix: %s\n", msg->title, msg->text, msg->howto);
+        PrintOnce(message);
+    }
+
+    fatal = 1;
+}
+
+// =====================================================================================
+//  PrintOnce
+//      This function is only callable one time. Further calls will be ignored
+// =====================================================================================
+void CDECL      PrintOnce(const char* const warning, ...)
+{
+    char            message[MAX_WARNING];
+    char            message2[MAX_WARNING];
+    va_list         argptr;
+    static int      count = 0;
+
+    if (count > 0) // make sure it only gets called once
+    {
+        return;
+    }
+    count++;
+
+    va_start(argptr, warning);
+    _vsnprintf_s(message, MAX_WARNING, warning, argptr);
+    va_end(argptr);
+
+    safe_snprintf(message2, MAX_MESSAGE, "Error: %s\n", message);
+    WriteLog(message2);
+    LogError(message2);
+}
+
+// =====================================================================================
+//  Warning
+//      For formatted warning messages
+//      automatically appends an extra newline to the message
+// =====================================================================================
+void CDECL      Warning(const char* const warning, ...)
+{
+    char            message[MAX_WARNING];
+    char            message2[MAX_WARNING];
+
+    va_list         argptr;
+
+    va_start(argptr, warning);
+    _vsnprintf_s(message, MAX_WARNING, warning, argptr);
+    va_end(argptr);
+
+    safe_snprintf(message2, MAX_MESSAGE, "Warning: %s\n", message);
+	ConColor(CONCOLOR_YELLOW, CONCOLOR_BGDEF_BLACK); //SILENCER
+    WriteLog(message2);
+	ConColor(CONCOLOR_TXTDEF_WHITE, CONCOLOR_BGDEF_BLACK); //SILENCER
+}
+
+// =====================================================================================
+//  Verbose
+//      Same as log but only prints when in verbose mode
+// =====================================================================================
+void CDECL      Verbose(const char* const warning, ...)
+{
+    if (g_verbose)
+    {
+        char            message[MAX_MESSAGE];
+
+        va_list         argptr;
+
+        va_start(argptr, warning);
+        _vsnprintf_s(message, MAX_MESSAGE, warning, argptr);
+        va_end(argptr);
+
+        WriteLog(message);
+    }
+}
+
+// =====================================================================================
+//  Developer
+//      Same as log but only prints when in developer mode
+// =====================================================================================
+void CDECL      Developer(developer_level_t level, const char* const warning, ...)
+{
+    if (level <= g_developer)
+    {
+        char            message[MAX_MESSAGE];
+
+        va_list         argptr;
+
+        va_start(argptr, warning);
+        _vsnprintf_s(message, MAX_MESSAGE, warning, argptr);
+        va_end(argptr);
+
+        WriteLog(message);
+    }
+}
+
+// =====================================================================================
+//  DisplayDeveloperLevel
+// =====================================================================================
+static void     DisplayDeveloperLevel()
+{
+    char            message[MAX_MESSAGE];
+
+    safe_strncpy(message, "Developer messages enabled : [", MAX_MESSAGE);
+    if (g_developer >= DEVELOPER_LEVEL_MEGASPAM)
+    {
+        safe_strncat(message, "MegaSpam ", MAX_MESSAGE);
+    }
+    if (g_developer >= DEVELOPER_LEVEL_SPAM)
+    {
+        safe_strncat(message, "Spam ", MAX_MESSAGE);
+    }
+    if (g_developer >= DEVELOPER_LEVEL_FLUFF)
+    {
+        safe_strncat(message, "Fluff ", MAX_MESSAGE);
+    }
+    if (g_developer >= DEVELOPER_LEVEL_MESSAGE)
+    {
+        safe_strncat(message, "Message ", MAX_MESSAGE);
+    }
+    if (g_developer >= DEVELOPER_LEVEL_WARNING)
+    {
+        safe_strncat(message, "Warning ", MAX_MESSAGE);
+    }
+    if (g_developer >= DEVELOPER_LEVEL_ERROR)
+    {
+        safe_strncat(message, "Error", MAX_MESSAGE);
+    }
+    if (g_developer)
+    {
+        safe_strncat(message, "]\n", MAX_MESSAGE);
+        Log(message);
+    }
+}
+
+// =====================================================================================
+//  Log
+//      For formatted log output messages
+// =====================================================================================
+void CDECL      Log(const char* const warning, ...)
+{
+    char            message[MAX_MESSAGE];
+
+    va_list         argptr;
+
+    va_start(argptr, warning);
+    _vsnprintf_s(message, MAX_MESSAGE, warning, argptr);
+    va_end(argptr);
+
+    WriteLog(message);
+}
+
+// =====================================================================================
+//  LogArgs
+// =====================================================================================
+static void     LogArgs(int argc, char** argv)
+{
+    int             i;
+    Log("Command line: ");
+    for (i = 0; i < argc; i++) {
+        if (strchr(argv[i], ' ')) {
+            Log("\"%s\"", argv[i]);
+        } else {
+            Log("%s ", argv[i]);
+        }
+    }
+    Log("\n");
+}
+
+// =====================================================================================
+//  Banner
+// =====================================================================================
+void            Banner()
+{
+	// SILENCER -->
+	// Made this whole section a lot better, as in, more dynamic
+	// Message block - keep line lengths the same or the code below will screw up
+	char message_block[] =
+		" Super Half-Life Compilation Tools -- Custom Build.      \n"
+		" Based on code modifications by Sean 'Zoner' Cavanaugh.  \n"
+		" Based on Valve's version, modified with permission.     \n"
+		" Further development done by Silencer and Protector.     \n"
+		" Submit detailed bug reports to [email protected].       ";
+	
+	int linelength = 0;
+	int lines = 1;
+	bool gotlength = false;
+	const int msgblen = (int)strlen(message_block);
+	for(int i = 0; i < msgblen; i++) {
+		if(message_block[i] != '\n') {
+			if(!gotlength) {
+				linelength++;
+			}
+		} else {
+			lines++;
+			gotlength = true;
+		}
+	}
+	
+	ConColor(CONCOLOR_BGDEF_BLACK, CONCOLOR_TXTDEF_WHITE);
+    Log("         %s " ZHLT_VERSIONSTRING " " HACK_VERSIONSTRING " (%s)           ", g_Program, __DATE__);
+	ConColor(CONCOLOR_TXTDEF_WHITE, CONCOLOR_BGDEF_BLACK);
+	Log("\n");
+	
+	for(int i = 0; i < lines; i++) {
+		ConColor(CONCOLOR_BGDEF_BLACK, CONCOLOR_TXTDEF_WHITE);
+		Log("  ");
+		ConColor(CONCOLOR_TXTDEF_WHITE, CONCOLOR_BGDEF_BLACK);
+		char line[128];
+		int j = 0;
+		while(j < linelength && j < 127) {
+			line[j] = message_block[(i * (linelength + 1)) + j];
+			j++;
+		}
+		line[j] = '\0';
+		Log(line);
+		ConColor(CONCOLOR_BGDEF_BLACK, CONCOLOR_TXTDEF_WHITE);
+		Log("  ");
+		ConColor(CONCOLOR_TXTDEF_WHITE, CONCOLOR_BGDEF_BLACK);
+		Log("\n");
+	}
+	// <-- SILENCER
+}
+
+// =====================================================================================
+//  LogStart
+// =====================================================================================
+void            LogStart(int argc, char** argv)
+{
+    Banner();
+	ConColor(CONCOLOR_BGDEF_BLACK, CONCOLOR_TXTDEF_WHITE); //SILENCER
+    Log("                  -----  BEGIN  %s -----                  ", g_Program);
+	ConColor(CONCOLOR_TXTDEF_WHITE, CONCOLOR_BGDEF_BLACK); //SILENCER
+	Log("\n\n");
+    LogArgs(argc, argv);
+    DisplayDeveloperLevel();
+}
+
+// =====================================================================================
+//  LogEnd
+// =====================================================================================
+void            LogEnd()
+{
+    Log("\n-----   END   %s -----\n\n\n\n", g_Program);
+}
+
+// =====================================================================================
+//  hlassume
+// =====================================================================================
+
+void hlassume(bool exp, assume_msgs msgid) // Removed option to append info messages again, because it slowed down tools
+{
+    if (!exp)
+	{
+		/*//SILENCER: Commenting this feature out// SILENCER -->
+		char* check;
+		char appendmsgdefault[2048] = "Info: No additional information given.";
+
+		va_list p_args;
+
+		va_start(p_args, msgid);
+
+		if((check = va_arg(p_args, char*)) != NULL) {
+			safe_snprintf(appendmsg, 2047, "Info: %s", check);
+		}
+
+		va_end(p_args);
+		// <-- SILENCER*/
+
+		char            message[MAX_MESSAGE];
+		const MessageTable_t* msg = GetAssume(msgid);
+
+		safe_snprintf(message, MAX_MESSAGE, "%s\nDescription: %s\nHowto Fix: %s\n", msg->title, msg->text, msg->howto);
+		Error(message);
+    }
+}
+
+// =====================================================================================
+//  seconds_to_hhmm
+// =====================================================================================
+static void seconds_to_hhmm(unsigned int elapsed_time, unsigned& days, unsigned& hours, unsigned& minutes, unsigned& seconds)
+{
+    seconds = elapsed_time % 60;
+    elapsed_time /= 60;
+
+    minutes = elapsed_time % 60;
+    elapsed_time /= 60;
+
+    hours = elapsed_time % 24;
+    elapsed_time /= 24;
+
+    days = elapsed_time;
+}
+
+// =====================================================================================
+//  LogTimeElapsed
+// =====================================================================================
+void LogTimeElapsed(float elapsed_time)
+{
+    unsigned days = 0;
+    unsigned hours = 0;
+    unsigned minutes = 0;
+    unsigned seconds = 0;
+
+    seconds_to_hhmm(elapsed_time, days, hours, minutes, seconds);
+
+    if (days)
+    {
+        Log("%.2f seconds elapsed [%ud %uh %um %us]\n", elapsed_time, days, hours, minutes, seconds);
+    }
+    else if (hours)
+    {
+        Log("%.2f seconds elapsed [%uh %um %us]\n", elapsed_time, hours, minutes, seconds);
+    }
+    else if (minutes)
+    {
+        Log("%.2f seconds elapsed [%um %us]\n", elapsed_time, minutes, seconds);
+    }
+    else
+    {
+        Log("%.2f seconds elapsed\n", elapsed_time);
+    }
+}
+
+// SILENCER -->
+void ConColor(const short c_text_color, const short c_background_color) {
+	if(!g_noConColors) {
+		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), (16 * c_background_color) + c_text_color);
+	}
+}
+// <-- SILENCER

+ 104 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/log.h

@@ -0,0 +1,104 @@
+#ifndef LOG_H__
+#define LOG_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#include "mathtypes.h"
+#include "messages.h"
+
+typedef enum
+{
+    DEVELOPER_LEVEL_ALWAYS,
+    DEVELOPER_LEVEL_ERROR,
+    DEVELOPER_LEVEL_WARNING,
+    DEVELOPER_LEVEL_MESSAGE,
+    DEVELOPER_LEVEL_FLUFF,
+    DEVELOPER_LEVEL_SPAM,
+    DEVELOPER_LEVEL_MEGASPAM
+}
+developer_level_t;
+
+//
+// log.c globals
+//
+
+extern char*    g_Program;
+extern char     g_Mapname[_MAX_PATH];
+
+#define DEFAULT_DEVELOPER   DEVELOPER_LEVEL_ALWAYS
+#define DEFAULT_VERBOSE     false
+#define DEFAULT_LOG         true
+
+extern developer_level_t g_developer;
+extern bool          g_verbose;
+extern bool          g_log;
+extern unsigned long g_clientid;                           // Client id of this program
+extern unsigned long g_nextclientid;                       // Client id of next client to spawn from this server
+
+//
+// log.c Functions
+//
+
+extern void     ResetTmpFiles();
+extern void     ResetLog();
+extern void     ResetErrorLog();
+extern void     CheckForErrorLog();
+
+extern void CDECL OpenLog(int clientid);
+extern void CDECL CloseLog();
+extern void     WriteLog(const char* const message);
+
+extern void     CheckFatal();
+
+extern void CDECL Developer(developer_level_t level, const char* const message, ...);
+
+#ifdef _DEBUG
+#define IfDebug(x) (x)
+#else
+#define IfDebug(x)
+#endif
+
+extern void CDECL Verbose(const char* const message, ...);
+extern void CDECL Log(const char* const message, ...);
+extern void CDECL Error(const char* const error, ...);
+extern void CDECL Fatal(assume_msgs msgid, const char* const error, ...);
+extern void CDECL Warning(const char* const warning, ...);
+
+extern void CDECL PrintOnce(const char* const message, ...);
+
+extern void     LogStart(const int argc, char** argv);
+extern void     LogEnd();
+extern void     Banner();
+
+extern void     LogTimeElapsed(float elapsed_time);
+
+// SILENCER -->
+// Note: When compile tools are run through a batch-file, some colors will
+// be different from Windows defaults; since you'd usually only run through
+// a batch file, these colors shall be used here:
+#define CONCOLOR_BGDEF_BLACK    0x0
+#define CONCOLOR_DBLUE          0x1
+#define CONCOLOR_DGREEN         0x2
+#define CONCOLOR_BLUEGREEN      0x3
+#define CONCOLOR_DRED           0x4
+#define CONCOLOR_DMAGENTA       0x5
+#define CONCOLOR_DYELLOW        0x6
+#define CONCOLOR_LGREY          0x7
+#define CONCOLOR_LGREEN         0x8
+#define CONCOLOR_BLUE           0x9
+#define CONCOLOR_GREEN          0xA
+#define CONCOLOR_CYAN           0xB
+#define CONCOLOR_RED            0xC
+#define CONCOLOR_MAGENTA        0xD
+#define CONCOLOR_YELLOW         0xE
+#define CONCOLOR_TXTDEF_WHITE   0xF
+extern bool g_noConColors; // Windows' console text coloring
+extern void ConColor(const short c_text_color, const short c_background_color);
+// <-- SILENCER
+
+// Should be in hlassert.h, but well so what
+extern void     hlassume(bool exp, assume_msgs msgid);
+
+#endif // Should be in hlassert.h, but well so what LOG_H__

+ 9 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/mathlib.cpp

@@ -0,0 +1,9 @@
+#include "cmdlib.h"
+#include "messages.h"
+#include "log.h"
+#include "hlassert.h"
+#include "mathtypes.h"
+#include "mathlib.h"
+#include "win32fix.h"
+
+const vec3_t    vec3_origin = { 0, 0, 0 };

+ 278 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/mathlib.h

@@ -0,0 +1,278 @@
+//amckern - 64bit - double to vec_t
+#pragma warning(disable:4244)
+
+#ifndef MATHLIB_H__
+#define MATHLIB_H__
+#include "cmdlib.h" //--vluzacn
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef STDC_HEADERS
+#include <math.h>
+#include <float.h>
+#endif
+
+#include <algorithm>
+
+#if !defined(max) 
+#define max(a,b)            (((a) > (b)) ? (a) : (b))
+#endif
+
+#if !defined(min)
+#define min(a,b)            (((a) < (b)) ? (a) : (b))
+#endif
+
+#define	Q_PI	3.14159265358979323846
+
+extern const vec3_t vec3_origin;
+
+//SILENCER
+
+//0.00001
+#define NORMAL_EPSILON   0.00001
+
+//0.01
+#define ON_EPSILON       0.01
+
+//0.001
+#define EQUAL_EPSILON    0.001
+
+
+//
+// Vector Math
+//
+
+
+#define DotProduct(x,y) ( (x)[0] * (y)[0] + (x)[1] * (y)[1]  +  (x)[2] * (y)[2])
+#define CrossProduct(a, b, dest) \
+{ \
+    (dest)[0] = (a)[1] * (b)[2] - (a)[2] * (b)[1]; \
+    (dest)[1] = (a)[2] * (b)[0] - (a)[0] * (b)[2]; \
+    (dest)[2] = (a)[0] * (b)[1] - (a)[1] * (b)[0]; \
+}
+
+#define VectorMidpoint(a,b,c)    { (c)[0]=((a)[0]+(b)[0])/2; (c)[1]=((a)[1]+(b)[1])/2; (c)[2]=((a)[2]+(b)[2])/2; }
+
+#define VectorFill(a,b)          { (a)[0]=(b); (a)[1]=(b); (a)[2]=(b);}
+#define VectorAvg(a)             ( ( (a)[0] + (a)[1] + (a)[2] ) / 3 )
+
+#define VectorSubtract(a,b,c)    { (c)[0]=(a)[0]-(b)[0]; (c)[1]=(a)[1]-(b)[1]; (c)[2]=(a)[2]-(b)[2]; }
+#define VectorAdd(a,b,c)         { (c)[0]=(a)[0]+(b)[0]; (c)[1]=(a)[1]+(b)[1]; (c)[2]=(a)[2]+(b)[2]; }
+#define VectorMultiply(a,b,c)    { (c)[0]=(a)[0]*(b)[0]; (c)[1]=(a)[1]*(b)[1]; (c)[2]=(a)[2]*(b)[2]; }
+#define VectorDivide(a,b,c)      { (c)[0]=(a)[0]/(b)[0]; (c)[1]=(a)[1]/(b)[1]; (c)[2]=(a)[2]/(b)[2]; }
+
+#define VectorSubtractVec(a,b,c) { (c)[0]=(a)[0]-(b); (c)[1]=(a)[1]-(b); (c)[2]=(a)[2]-(b); }
+#define VectorAddVec(a,b,c)      { (c)[0]=(a)[0]+(b); (c)[1]=(a)[1]+(b); (c)[2]=(a)[2]+(b); }
+#define VecSubtractVector(a,b,c) { (c)[0]=(a)-(b)[0]; (c)[1]=(a)-(b)[1]; (c)[2]=(a)-(b)[2]; }
+#define VecAddVector(a,b,c)      { (c)[0]=(a)+(b)[0]; (c)[1]=(a)[(b)[1]; (c)[2]=(a)+(b)[2]; }
+
+#define VectorMultiplyVec(a,b,c) { (c)[0]=(a)[0]*(b);(c)[1]=(a)[1]*(b);(c)[2]=(a)[2]*(b); }
+#define VectorDivideVec(a,b,c)   { (c)[0]=(a)[0]/(b);(c)[1]=(a)[1]/(b);(c)[2]=(a)[2]/(b); }
+
+#define VectorScale(a,b,c)       { (c)[0]=(a)[0]*(b);(c)[1]=(a)[1]*(b);(c)[2]=(a)[2]*(b); }
+
+#define VectorCopy(a,b) { (b)[0]=(a)[0]; (b)[1]=(a)[1]; (b)[2]=(a)[2]; }
+#define VectorClear(a)  { (a)[0] = (a)[1] = (a)[2] = 0.0; }
+
+#define VectorMaximum(a) ( max( (a)[0], max( (a)[1], (a)[2] ) ) )
+#define VectorMinimum(a) ( min( (a)[0], min( (a)[1], (a)[2] ) ) )
+
+#define VectorInverse(a) \
+{ \
+    (a)[0] = -((a)[0]); \
+    (a)[1] = -((a)[1]); \
+    (a)[2] = -((a)[2]); \
+}
+#define VectorRound(a) floor((a) + 0.5)
+#ifdef ZHLT_VectorMA_FIX
+#define VectorMA(a, scale, b, dest) \
+{ \
+    (dest)[0] = (a)[0] + (scale) * (b)[0]; \
+    (dest)[1] = (a)[1] + (scale) * (b)[1]; \
+    (dest)[2] = (a)[2] + (scale) * (b)[2]; \
+}
+#else
+#define VectorMA(a, scale, b, dest) \
+{ \
+    (dest)[0] = (a)[0] + scale * (b)[0]; \
+    (dest)[1] = (a)[1] + scale * (b)[1]; \
+    (dest)[2] = (a)[2] + scale * (b)[2]; \
+}
+#endif
+#define VectorLength(a)  sqrt((double) ((double)((a)[0] * (a)[0]) + (double)( (a)[1] * (a)[1]) + (double)( (a)[2] * (a)[2])) )
+#define VectorCompareMinimum(a,b,c) { (c)[0] = min((a)[0], (b)[0]); (c)[1] = min((a)[1], (b)[1]); (c)[2] = min((a)[2], (b)[2]); }
+#define VectorCompareMaximum(a,b,c) { (c)[0] = max((a)[0], (b)[0]); (c)[1] = max((a)[1], (b)[1]); (c)[2] = max((a)[2], (b)[2]); }
+
+inline vec_t   VectorNormalize(vec3_t v)
+{
+    double          length;
+
+    length = DotProduct(v, v);
+    length = sqrt(length);
+    if (length < NORMAL_EPSILON)
+    {
+        VectorClear(v);
+        return 0.0;
+    }
+
+    v[0] /= length;
+    v[1] /= length;
+    v[2] /= length;
+
+    return length;
+}
+
+inline bool     VectorCompare(const vec3_t v1, const vec3_t v2)
+{
+    int             i;
+
+    for (i = 0; i < 3; i++)
+    {
+        if (fabs(v1[i] - v2[i]) > EQUAL_EPSILON)
+        {
+            return false;
+        }
+    }
+    return true;
+}
+
+
+//
+// Portable bit rotation
+//
+
+
+#ifdef SYSTEM_POSIX
+#undef rotl
+#undef rotr
+
+inline unsigned int rotl(unsigned value, unsigned int amt)
+{
+    unsigned        t1, t2;
+
+    t1 = value >> ((sizeof(unsigned) * CHAR_BIT) - amt);
+
+    t2 = value << amt;
+    return (t1 | t2);
+}
+
+inline unsigned int rotr(unsigned value, unsigned int amt)
+{
+    unsigned        t1, t2;
+
+    t1 = value << ((sizeof(unsigned) * CHAR_BIT) - amt);
+
+    t2 = value >> amt;
+    return (t1 | t2);
+}
+#endif
+
+
+//
+// Misc
+//
+
+
+inline bool    isPointFinite(const vec_t* p)
+{
+    if (finite(p[0]) && finite(p[1]) && finite(p[2]))
+    {
+        return true;
+    }
+    return false;
+}
+
+
+//
+// Planetype Math
+//
+
+
+typedef enum
+{
+    plane_x = 0,
+    plane_y,
+    plane_z,
+    plane_anyx,
+    plane_anyy,
+    plane_anyz
+}
+planetypes;
+
+#define last_axial plane_z
+
+#ifdef ZHLT_PLANETYPE_FIX
+inline planetypes PlaneTypeForNormal(vec3_t normal)
+{
+    vec_t           ax, ay, az;
+
+    ax = fabs(normal[0]);
+    ay = fabs(normal[1]);
+    az = fabs(normal[2]);
+    if (ax >= 1.0 - NORMAL_EPSILON && ay <= NORMAL_EPSILON && az <= NORMAL_EPSILON)
+    {
+        return plane_x;
+    }
+
+    if (ay >= 1.0 - NORMAL_EPSILON && az <= NORMAL_EPSILON && ax <= NORMAL_EPSILON)
+    {
+        return plane_y;
+    }
+
+    if (az >= 1.0 - NORMAL_EPSILON && ax <= NORMAL_EPSILON && ay <= NORMAL_EPSILON)
+    {
+        return plane_z;
+    }
+
+    if ((ax >= ay) && (ax >= az))
+    {
+        return plane_anyx;
+    }
+    if ((ay >= ax) && (ay >= az))
+    {
+        return plane_anyy;
+    }
+    return plane_anyz;
+}
+#else
+inline planetypes PlaneTypeForNormal(vec3_t normal)
+{
+    vec_t           ax, ay, az;
+
+    ax = fabs(normal[0]);
+    if (ax == 1.0)
+    {
+        return plane_x;
+    }
+
+    ay = fabs(normal[1]);
+    if (ay == 1.0)
+    {
+        return plane_y;
+    }
+
+    az = fabs(normal[2]);
+    if (az == 1.0)
+    {
+        return plane_z;
+    }
+
+    if ((ax > ay) && (ax > az))
+    {
+        return plane_anyx;
+    }
+    if ((ay > ax) && (ay > az))
+    {
+        return plane_anyy;
+    }
+    return plane_anyz;
+}
+#endif
+
+#endif //MATHLIB_H__

+ 17 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/mathtypes.h

@@ -0,0 +1,17 @@
+#ifndef MATHTYPES_H__
+#define MATHTYPES_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+typedef unsigned char byte;
+
+#ifdef DOUBLEVEC_T
+typedef double vec_t;
+#else
+typedef float vec_t;
+#endif
+typedef vec_t   vec3_t[3];                                 // x,y,z
+
+#endif //MATHTYPES_H__

+ 109 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/messages.cpp

@@ -0,0 +1,109 @@
+#include "messages.h"
+
+// AJM: because these are repeated, they use up redundant memory. 
+//  consequently ive made them into const strings which each occurance can point to.
+
+// Common descriptions
+const char* const internallimit = "The compiler tool hit an internal limit.";
+const char* const internalerror = "The compiler tool had an internal error.";
+const char* const maperror      = "The map has a problem which must be fixed.";
+
+// Common explanations
+#define contact contactmerl //"contact [email protected] immidiately"
+const char* const selfexplanitory = "self explanitory";
+const char* const reference       = "Check the files http://www.zhlt.info/common-mapping-problems.html\n           and http://www.slackiller.com/tommy14/errors.htm for a detailed\n           explanation of this problem.";
+const char* const simplify        = "The map is too complex for the game engine/compile tools to handle.  Simplify";
+const char* const contactmerl     = "contact [email protected] concerning this issue.";
+
+static const MessageTable_t assumes[assume_last] = {
+    {"invalid assume message", "This message should never be printed.", contact},
+
+    // generic
+    {"Memory allocation failure", "The program failed to allocate a block of memory.",
+     "Likely causes are (in order of likeliness) : the partition holding the swapfile is full; swapfile size is smaller than required; memory fragmentation; heap corruption"},
+    {"NULL Pointer", internalerror, contact},
+    {"Bad Thread Workcount", internalerror, contact},
+
+    // qcsg
+    {"Missing '[' in texturedef (U)", maperror, reference},
+    {"plane with no normal", maperror, reference},
+    {"brush with coplanar faces", maperror, reference},
+    {"brush outside world", maperror, reference},
+    {"mixed face contents", maperror, reference},
+    {"Brush type not allowed in world", maperror, reference},
+    {"Brush type not allowed in entity", maperror, reference},
+    {"No visible brushes", "All brushes are CLIP or ORIGIN (at least one must be normal/visible)", selfexplanitory},
+    {"Entity with ONLY an ORIGIN brush", "All entities need at least one visible brush to function properly.  CLIP, HINT, ORIGIN, do not count as visible brushes.", selfexplanitory},
+    {"Could not find WAD file", "The compile tools could not locate a wad file that the map was referencing.", "Make sure the wads listed in the level editor actually all exist."},
+    {"Exceeded MAX_TRIANGLES", internallimit, contact},
+    {"Exceeded MAX_SWITCHED_LIGHTS", "The maximum number of switchable light entities has been reached", selfexplanitory},
+    {"Exceeded MAX_TEXFILES", internallimit, contact},
+
+    // qbsp
+    {"LEAK in the map", maperror, reference},
+    {"Exceeded MAX_LEAF_FACES", "This error is almost always caused by an invalid brush, by having huge rooms, or scaling a texture down to extremely small values (between -1 and 1)",
+     "Find the invalid brush.  Any imported prefabs, carved brushes, or vertex manipulated brushes should be suspect"},
+    {"Exceeded MAX_WEDGES", internallimit, contact},
+    {"Exceeded MAX_WVERTS", internallimit, contact},
+    {"Exceeded MAX_SUPERFACEEDGES", internallimit, contact},
+    {"Empty Solid Entity", "A solid entity in the map (func_wall for example) has no brushes.",  "If using Worldcraft, do a check for problems and fix any occurences of 'Empty solid'"},
+
+    // vis
+    {"Leaf portal saw into leaf", maperror, reference},
+    {"Exceeded MAX_PORTALS_ON_LEAF", maperror, reference},
+    {"Invalid client/server state", internalerror, contact},
+
+    // qrad
+    {"Exceeded MAX_TEXLIGHTS", "The maximum number of texture lights in use by a single map has been reached",
+     "Use fewer texture lights."},
+    {"Exceeded MAX_PATCHES", maperror, reference},
+    {"Transfer < 0", internalerror, contact},
+    {"Bad Surface Extents", maperror, reference},
+    {"Malformed face normal", "The texture alignment of a visible face is unusable", "If using Worldcraft, do a check for problems and fix any occurences of 'Texture axis perpindicular to face'"},
+    {"No Lights!", "lighting of map halted (I assume you do not want a pitch black map!)", "Put some lights in the map."},
+    {"Bad Light Type", internalerror, contact},
+    {"Exceeded MAX_SINGLEMAP", internallimit, contact},
+
+    // common
+    {"Unable to create thread", internalerror, contact},
+    {"Exceeded MAX_MAP_PLANES", "The maximum number of plane definitions has been reached",
+     "The map has grown too complex"},
+    {"Exceeded MAX_MAP_TEXTURES", "The maximum number of textures for a map has been reached", selfexplanitory},
+
+    {"Exceeded MAX_MAP_MIPTEX", "Texture memory usage on the map has exceeded the limit",
+     "Merge similar textures, remove unused textures from the map"},
+    {"Exceeded MAX_MAP_TEXINFO", internallimit, contact},
+    {"Exceeded MAX_MAP_SIDES", internallimit, contact},
+    {"Exceeded MAX_MAP_BRUSHES", "The maximum number of brushes for a map has been reached", selfexplanitory},
+    {"Exceeded MAX_MAP_ENTITIES", "The maximum number of entities for the compile tools has been reached", selfexplanitory},
+    {"Exceeded MAX_ENGINE_ENTITIES", "The maximum number of entities for the half-life engine has been reached", selfexplanitory},
+
+    {"Exceeded MAX_MAP_MODELS", "The maximum number of brush based entities has been reached",
+     "Remove unnecessary brush entities, consolidate similar entities into a single entity"},
+    {"Exceeded MAX_MAP_VERTS", internallimit, contact},
+    {"Exceeded MAX_MAP_EDGES", internallimit, contact},
+
+    {"Exceeded MAX_MAP_CLIPNODES", maperror, reference},
+    {"Exceeded MAX_MAP_MARKSURFACES", internallimit, contact},
+    {"Exceeded MAX_MAP_FACES", "The maximum number of faces for a map has been reached", "This error is typically caused by having a large face with a small texture scale on it, or overly complex maps."},
+    {"Exceeded MAX_MAP_SURFEDGES", internallimit, contact},
+    {"Exceeded MAX_MAP_NODES", "The maximum number of nodes for a map has been reached", simplify},
+    {"CompressVis Overflow", internalerror, contact},
+    {"DecompressVis Overflow", internalerror, contact},
+    {"Execution Cancelled", "Tool execution was cancelled either by the user or due to a fatal compile setting", selfexplanitory},
+    {"Internal Error", internalerror, contact},
+	//KGP added
+	{"Exceeded MAX_MAP_LIGHTING","You have run out of light data memory" ,"Use the -lightdata <#> command line option to increase your maximum light memory.  The default is 16384 (KB)."},
+    {"Exceeded MAX_INTERNAL_MAP_PLANES", "The maximum number of plane definitions has been reached", "The map has grown too complex"}
+}; 
+
+const MessageTable_t* GetAssume(assume_msgs id)
+{
+    if (!(id > assume_first) && (id < assume_last))
+    {
+        id = assume_first;
+    }
+    return &assumes[id];
+}
+
+

+ 96 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/messages.h

@@ -0,0 +1,96 @@
+#ifndef MESSAGES_H__
+#define MESSAGES_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+typedef struct
+{
+    const char*     title;
+    const char*     text;
+    const char*     howto;
+}
+MessageTable_t;
+
+typedef enum
+{
+    assume_first = 0,
+
+    // generic
+    assume_NoMemory,
+    assume_ValidPointer,
+    assume_BadWorkcount,
+
+    // qcsg
+    assume_MISSING_BRACKET_IN_TEXTUREDEF,
+    assume_PLANE_WITH_NO_NORMAL,
+    assume_BRUSH_WITH_COPLANAR_FACES,
+    assume_BRUSH_OUTSIDE_WORLD,
+    assume_MIXED_FACE_CONTENTS,
+    assume_BRUSH_NOT_ALLOWED_IN_WORLD,
+    assume_BRUSH_NOT_ALLOWED_IN_ENTITY,
+    assume_NO_VISIBILE_BRUSHES,
+    assume_ONLY_ORIGIN,
+    assume_COULD_NOT_FIND_WAD,
+    assume_MAX_TRIANGLES,
+    assume_MAX_SWITCHED_LIGHTS,
+    assume_MAX_TEXFILES,
+
+    // qbsp
+    assume_LEAK,
+    assume_MAX_LEAF_FACES,
+    assume_MAX_WEDGES,
+    assume_MAX_WVERTS,
+    assume_MAX_SUPERFACEEDGES,
+    assume_EmptySolid,
+
+    // vis
+    assume_LEAF_PORTAL_SAW_INTO_LEAF,
+    assume_MAX_PORTALS_ON_LEAF,
+    assume_VALID_NETVIS_STATE,
+
+    // qrad
+    assume_MAX_TEXLIGHTS,
+    assume_MAX_PATCHES,
+    assume_TransferError,
+    assume_BadSurfaceExtents,
+    assume_MalformedTextureFace,
+    assume_NoLights,
+    assume_BadLightType,
+    assume_MAX_SINGLEMAP,
+
+    // common
+    assume_THREAD_ERROR,
+    assume_MAX_MAP_PLANES,
+    assume_MAX_MAP_TEXTURES,
+    assume_MAX_MAP_MIPTEX,
+    assume_MAX_MAP_TEXINFO,
+    assume_MAX_MAP_SIDES,
+    assume_MAX_MAP_BRUSHES,
+    assume_MAX_MAP_ENTITIES,
+    assume_MAX_ENGINE_ENTITIES,
+    assume_MAX_MAP_MODELS,
+    assume_MAX_MAP_VERTS,
+    assume_MAX_MAP_EDGES,
+    assume_MAX_MAP_CLIPNODES,
+    assume_MAX_MAP_MARKSURFACES,
+    assume_MAX_MAP_FACES,
+    assume_MAX_MAP_SURFEDGES,
+    assume_MAX_MAP_NODES,
+    assume_COMPRESSVIS_OVERFLOW,
+    assume_DECOMPRESSVIS_OVERFLOW,
+    // AJM: added in
+    assume_TOOL_CANCEL,
+    assume_GENERIC,
+	// KGP: added
+	assume_MAX_MAP_LIGHTING,
+	assume_MAX_INTERNAL_MAP_PLANES,
+
+    assume_last
+}
+assume_msgs;
+
+extern const MessageTable_t* GetAssume(assume_msgs id);
+
+#endif // commonc MESSAGES_H__

+ 61 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/resourcelock.cpp

@@ -0,0 +1,61 @@
+#ifdef SYSTEM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#endif
+
+#include "cmdlib.h"
+#include "messages.h"
+#include "log.h"
+#include "blockmem.h"
+
+#include "resourcelock.h"
+
+#ifdef SYSTEM_WIN32
+
+typedef struct
+{
+    HANDLE          Mutex;
+}
+ResourceLock_t;
+
+void*           CreateResourceLock(int LockNumber)
+{
+    char            lockname[_MAX_PATH];
+    char            mapname[_MAX_PATH];
+    ResourceLock_t* lock = (ResourceLock_t*)Alloc(sizeof(ResourceLock_t));
+
+    ExtractFile(g_Mapname, mapname);
+    safe_snprintf(lockname, _MAX_PATH, "%d%s", LockNumber, mapname);
+
+    lock->Mutex = CreateMutex(NULL, FALSE, lockname);
+
+    if (lock->Mutex == NULL)
+    {
+        LPVOID          lpMsgBuf;
+
+        Log("lock->Mutex is NULL! [%s]", lockname);
+        FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                      FORMAT_MESSAGE_FROM_SYSTEM |
+                      FORMAT_MESSAGE_IGNORE_INSERTS,
+                      NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) & lpMsgBuf, 0, NULL);
+        Error((LPCTSTR)lpMsgBuf);
+    }
+
+    WaitForSingleObject(lock->Mutex, INFINITE);
+
+    return lock;
+}
+
+void            ReleaseResourceLock(void** lock)
+{
+    ResourceLock_t* lockTmp = (ResourceLock_t*)*lock;
+
+    if (!ReleaseMutex(lockTmp->Mutex))
+    {
+        Error("Failed to release mutex");
+    }
+    Free(lockTmp);
+    *lock = NULL;
+}
+
+#endif

+ 11 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/resourcelock.h

@@ -0,0 +1,11 @@
+#ifndef RESOURCELOCK_H__
+#define RESOURCELOCK_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+extern void*    CreateResourceLock(int LockNumber);
+extern void     ReleaseResourceLock(void** lock);
+
+#endif // RESOURCE_LOCK_H__

+ 362 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/scriplib.cpp

@@ -0,0 +1,362 @@
+#include "cmdlib.h"
+#include "filelib.h"
+#include "messages.h"
+#include "log.h"
+#include "scriplib.h"
+
+char            g_token[MAXTOKEN];
+char            g_TXcommand;
+
+typedef struct
+{
+    char            filename[_MAX_PATH];
+    char*           buffer;
+    char*           script_p;
+    char*           end_p;
+    int             line;
+}
+script_t;
+
+
+#define	MAX_INCLUDES	8
+
+
+static script_t s_scriptstack[MAX_INCLUDES];
+script_t*       s_script;
+int             s_scriptline;
+bool            s_endofscript;
+bool            s_tokenready;                                // only true if UnGetToken was just called
+
+
+//  AddScriptToStack
+//  LoadScriptFile
+//  ParseFromMemory
+//  UnGetToken
+//  EndOfScript
+//  GetToken
+//  TokenAvailable
+
+// =====================================================================================
+//  AddScriptToStack
+// =====================================================================================
+static void     AddScriptToStack(const char* const filename)
+{
+    int             size;
+
+    s_script++;
+
+    if (s_script == &s_scriptstack[MAX_INCLUDES])
+        Error("s_script file exceeded MAX_INCLUDES");
+
+    strcpy_s(s_script->filename, filename);
+
+    size = LoadFile(s_script->filename, (char**)&s_script->buffer);
+
+    Log("Entering %s\n", s_script->filename);
+
+    s_script->line = 1;
+    s_script->script_p = s_script->buffer;
+    s_script->end_p = s_script->buffer + size;
+}
+
+// =====================================================================================
+//  LoadScriptFile
+// =====================================================================================
+void            LoadScriptFile(const char* const filename)
+{
+    s_script = s_scriptstack;
+    AddScriptToStack(filename);
+
+    s_endofscript = false;
+    s_tokenready = false;
+}
+
+// =====================================================================================
+//  ParseFromMemory
+// =====================================================================================
+void            ParseFromMemory(char* buffer, const int size)
+{
+    s_script = s_scriptstack;
+    s_script++;
+
+    if (s_script == &s_scriptstack[MAX_INCLUDES])
+        Error("s_script file exceeded MAX_INCLUDES");
+
+    strcpy_s(s_script->filename, "memory buffer");
+
+    s_script->buffer = buffer;
+    s_script->line = 1;
+    s_script->script_p = s_script->buffer;
+    s_script->end_p = s_script->buffer + size;
+
+    s_endofscript = false;
+    s_tokenready = false;
+}
+
+// =====================================================================================
+//  UnGetToken
+/*
+ * Signals that the current g_token was not used, and should be reported
+ * for the next GetToken.  Note that
+ * 
+ * GetToken (true);
+ * UnGetToken ();
+ * GetToken (false);
+ * 
+ * could cross a line boundary.
+ */
+// =====================================================================================
+void            UnGetToken()
+{
+    s_tokenready = true;
+}
+
+// =====================================================================================
+//  EndOfScript
+// =====================================================================================
+bool            EndOfScript(const bool crossline)
+{
+    if (!crossline)
+        Error("Line %i is incomplete (did you place a \" inside an entity string?) \n", s_scriptline);
+
+    if (!strcmp(s_script->filename, "memory buffer"))
+    {
+        s_endofscript = true;
+        return false;
+    }
+
+    free(s_script->buffer);
+
+    if (s_script == s_scriptstack + 1)
+    {
+        s_endofscript = true;
+        return false;
+    }
+
+    s_script--;
+    s_scriptline = s_script->line;
+
+    Log("returning to %s\n", s_script->filename);
+
+    return GetToken(crossline);
+}
+
+// =====================================================================================
+//  GetToken
+// =====================================================================================
+bool            GetToken(const bool crossline)
+{
+    char           *token_p;
+
+    if (s_tokenready)                                        // is a g_token allready waiting?
+    {
+        s_tokenready = false;
+        return true;
+    }
+
+    if (s_script->script_p >= s_script->end_p)
+        return EndOfScript(crossline);
+
+    // skip space
+skipspace:
+    while (*s_script->script_p <= 32)
+    {
+        if (s_script->script_p >= s_script->end_p)
+            return EndOfScript(crossline);
+
+        if (*s_script->script_p++ == '\n')
+        {
+            if (!crossline)
+                Error("Line %i is incomplete (did you place a \" inside an entity string?) \n", s_scriptline);
+            s_scriptline = s_script->line++;
+        }
+    }
+
+    if (s_script->script_p >= s_script->end_p)
+        return EndOfScript(crossline);
+
+    // comment fields
+    if (*s_script->script_p == ';' || *s_script->script_p == '#' || // semicolon and # is comment field
+        (*s_script->script_p == '/' && *((s_script->script_p) + 1) == '/')) // also make // a comment field
+    {
+        if (!crossline)
+            Error("Line %i is incomplete (did you place a \" inside an entity string?) \n", s_scriptline);
+
+        //ets+++
+        if (*s_script->script_p == '/')
+            s_script->script_p++;
+        if (s_script->script_p[1] == 'T' && s_script->script_p[2] == 'X')
+            g_TXcommand = s_script->script_p[3];             // AR: "//TX#"-style comment
+
+        //ets---
+        while (*s_script->script_p++ != '\n')
+        {
+            if (s_script->script_p >= s_script->end_p)
+                return EndOfScript(crossline);
+        }
+        //ets+++
+        s_scriptline = s_script->line++;                       // AR: this line was missing
+        //ets---
+        goto skipspace;
+    }
+
+    // copy g_token
+    token_p = g_token;
+
+    if (*s_script->script_p == '"')
+    {
+        // quoted token
+        s_script->script_p++;
+        while (*s_script->script_p != '"')
+        {
+            *token_p++ = *s_script->script_p++;
+
+            if (s_script->script_p == s_script->end_p)
+                break;
+
+            if (token_p == &g_token[MAXTOKEN])
+                Error("Token too large on line %i\n", s_scriptline);
+        }
+        s_script->script_p++;
+    }
+    else
+    {
+        // regular token
+        while (*s_script->script_p > 32 && *s_script->script_p != ';')
+        {
+            *token_p++ = *s_script->script_p++;
+
+            if (s_script->script_p == s_script->end_p)
+                break;
+
+            if (token_p == &g_token[MAXTOKEN])
+                Error("Token too large on line %i\n", s_scriptline);
+        }
+    }
+
+    *token_p = 0;
+
+    if (!strcmp(g_token, "$include"))
+    {
+        GetToken(false);
+        AddScriptToStack(g_token);
+        return GetToken(crossline);
+    }
+
+    return true;
+}
+
+#if 0
+// AJM: THIS IS REDUNDANT
+// =====================================================================================
+//  ParseWadToken
+//      basically the same as gettoken, except it isnt limited by MAXTOKEN and is
+//      specificaly designed to parse out the wadpaths from the wad keyvalue and dump
+//      them into the wadpaths list
+//      this was implemented as a hack workaround for Token Too Large errors caused by
+//      having long wadpaths or lots of wads in the map editor.
+extern void        PushWadPath(const char* const path, bool inuse);
+// =====================================================================================
+void            ParseWadToken(const bool crossline)
+{
+    // code somewhat copied from GetToken()
+    int             i, j;
+    char*           token_p;
+    char            temp[_MAX_PATH];
+
+    if (s_script->script_p >= s_script->end_p)
+        return;
+
+    // skip space
+    while (*s_script->script_p <= 32)
+    {
+        if (s_script->script_p >= s_script->end_p)
+            return;
+
+        if (*s_script->script_p++ == '\n')
+        {
+            if (!crossline)
+                Error("Line %i is incomplete (did you place a \" inside an entity string?) \n", s_scriptline);
+            s_scriptline = s_script->line++;
+        }
+    }
+
+    // EXPECT A QUOTE
+    if (*s_script->script_p++ != '"')
+        Error("Line %i: Expected a wadpaths definition, got '%s'\n", s_scriptline, *--s_script->script_p);
+
+    // load wadpaths manually
+    bool    endoftoken = false;
+    for (i = 0; !endoftoken; i++)
+    {
+        // get the path
+        for (j = 0; ; j++)
+        {
+            token_p = ++s_script->script_p;
+            
+            // assert max path length
+            if (j > _MAX_PATH)
+                Error("Line %i: Wadpath definition %i is too long (%s)\n", s_scriptline, temp);
+
+            if (*token_p == '\n')
+                Error("Line %i: Expected a wadpaths definition, got linebreak\n", s_scriptline);
+
+            if (*token_p == '"')            // end of wadpath definition
+            {
+                if (i == 0 && j == 0)       // no wadpaths!
+                {
+                    Warning("No wadpaths specified.\n");
+                    return;
+                }
+
+                endoftoken = true;
+                break;
+            }
+
+            if (*token_p == ';')            // end of this wadpath
+                break;
+
+            temp[j] = *token_p;
+            temp[j + 1] = 0;
+        }
+
+        // push it into the list
+        PushWadPath(temp, true);
+        temp[0] = 0;
+    }
+
+    for (; *s_script->script_p != '\n'; s_script->script_p++)
+    {
+    }
+}
+#endif
+
+// =====================================================================================
+//  TokenAvailable
+//      returns true if there is another token on the line
+// =====================================================================================
+bool            TokenAvailable()
+{
+    char           *search_p;
+
+    search_p = s_script->script_p;
+
+    if (search_p >= s_script->end_p)
+        return false;
+
+    while (*search_p <= 32)
+    {
+        if (*search_p == '\n')
+            return false;
+
+        search_p++;
+
+        if (search_p == s_script->end_p)
+            return false;
+    }
+
+    if (*search_p == ';')
+        return false;
+
+    return true;
+}

+ 26 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/scriplib.h

@@ -0,0 +1,26 @@
+#ifndef SCRIPLIB_H__
+#define SCRIPLIB_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#include "cmdlib.h"
+
+#define	MAXTOKEN 4096
+
+extern char     g_token[MAXTOKEN];
+extern char     g_TXcommand;                               // global for Quark maps texture alignment hack
+
+extern void     LoadScriptFile(const char* const filename);
+extern void     ParseFromMemory(char* buffer, int size);
+
+extern bool     GetToken(bool crossline);
+extern void     UnGetToken();
+extern bool     TokenAvailable();
+
+#define MAX_WAD_PATHS   42
+extern char         g_szWadPaths[MAX_WAD_PATHS][_MAX_PATH];
+extern int          g_iNumWadPaths;
+
+#endif //**/ SCRIPLIB_H__

+ 682 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/threads.cpp

@@ -0,0 +1,682 @@
+#ifdef SYSTEM_WIN32
+#pragma warning(push)
+#pragma warning(disable:4100)                             // unreferenced formal parameter
+#endif
+
+#ifdef SYSTEM_WIN32
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#include <malloc.h>
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "cmdlib.h"
+#include "messages.h"
+#include "log.h"
+#include "threads.h"
+#include "blockmem.h"
+
+#ifdef SYSTEM_POSIX
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#include <pthread.h>
+#endif
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+#endif
+#endif
+
+#include "hlassert.h"
+
+q_threadpriority g_threadpriority = DEFAULT_THREAD_PRIORITY;
+
+#define THREADTIMES_SIZE 100
+#define THREADTIMES_SIZEf (float)(THREADTIMES_SIZE)
+
+static int      dispatch = 0;
+static int      workcount = 0;
+static int      oldf = 0;
+static bool     pacifier = false;
+static bool     threaded = false;
+static double   threadstart = 0;
+static double   threadtimes[THREADTIMES_SIZE];
+
+int             GetThreadWork()
+{
+    int             r, f, i;
+    double          ct, finish, finish2, finish3;
+
+    ThreadLock();
+
+    if (dispatch == 0)
+    {
+        oldf = 0;
+    }
+
+    if (dispatch > workcount)
+    {
+        Developer(DEVELOPER_LEVEL_ERROR, "dispatch > workcount!!!\n");
+        ThreadUnlock();
+        return -1;
+    }
+    if (dispatch == workcount)
+    {
+        Developer(DEVELOPER_LEVEL_MESSAGE, "dispatch == workcount, work is complete\n");
+        ThreadUnlock();
+        return -1;
+    }
+    if (dispatch < 0)
+    {
+        Developer(DEVELOPER_LEVEL_ERROR, "negative dispatch!!!\n");
+        ThreadUnlock();
+        return -1;
+    }
+
+    f = THREADTIMES_SIZE * dispatch / workcount;
+    if (pacifier)
+    {
+        printf("\r%6d /%6d", dispatch, workcount);
+#ifdef ZHLT_PROGRESSFILE // AJM
+        if (g_progressfile)
+        {
+            
+
+        }
+#endif
+
+        if (f != oldf)
+        {
+            ct = I_FloatTime();
+            /* Fill in current time for threadtimes record */
+            for (i = oldf; i <= f; i++)
+            {
+                if (threadtimes[i] < 1)
+                {
+                    threadtimes[i] = ct;
+                }
+            }
+            oldf = f;
+
+            if (f > 10)
+            {
+                finish = (ct - threadtimes[0]) * (THREADTIMES_SIZEf - f) / f;
+                finish2 = 10.0 * (ct - threadtimes[f - 10]) * (THREADTIMES_SIZEf - f) / THREADTIMES_SIZEf;
+                finish3 = THREADTIMES_SIZEf * (ct - threadtimes[f - 1]) * (THREADTIMES_SIZEf - f) / THREADTIMES_SIZEf;
+
+                if (finish > 1.0)
+                {
+                    printf("  (%d%%: est. time to completion %ld/%ld/%ld secs)   ", f, (long)(finish), (long)(finish2),
+                           (long)(finish3));
+#ifdef ZHLT_PROGRESSFILE // AJM
+                    if (g_progressfile)
+                    {
+
+
+                    }
+#endif
+                }
+                else
+                {
+                    printf("  (%d%%: est. time to completion <1 sec)   ", f);
+
+#ifdef ZHLT_PROGRESSFILE // AJM
+                    if (g_progressfile)
+                    {
+
+
+                    }
+#endif
+                }
+            }
+        }
+    }
+    else
+    {
+        if (f != oldf)
+        {
+            oldf = f;
+            switch (f)
+            {
+            case 10:
+            case 20:
+            case 30:
+            case 40:
+            case 50:
+            case 60:
+            case 70:
+            case 80:
+            case 90:
+            case 100:
+/*
+            case 5:
+            case 15:
+            case 25:
+            case 35:
+            case 45:
+            case 55:
+            case 65:
+            case 75:
+            case 85:
+            case 95:
+*/
+                printf("%d%%...", f);
+            default:
+                break;
+            }
+        }
+    }
+
+    r = dispatch;
+    dispatch++;
+
+    ThreadUnlock();
+    return r;
+}
+
+q_threadfunction workfunction;
+
+static void     ThreadWorkerFunction(int unused)
+{
+    int             work;
+
+    while ((work = GetThreadWork()) != -1)
+    {
+        workfunction(work);
+    }
+}
+
+#ifdef SYSTEM_WIN32
+#pragma warning(pop)
+#endif
+
+void            RunThreadsOnIndividual(int workcnt, bool showpacifier, q_threadfunction func)
+{
+    workfunction = func;
+    RunThreadsOn(workcnt, showpacifier, ThreadWorkerFunction);
+}
+
+#ifndef SINGLE_THREADED
+
+/*====================
+| Begin SYSTEM_WIN32
+=*/
+#ifdef SYSTEM_WIN32
+
+#define	USED
+#include <windows.h>
+
+int             g_numthreads = DEFAULT_NUMTHREADS;
+static CRITICAL_SECTION crit;
+static int      enter;
+
+void            ThreadSetPriority(q_threadpriority type)
+{
+    int             val;
+
+    g_threadpriority = type;
+
+    switch (g_threadpriority)
+    {
+    case eThreadPriorityLow:
+        val = IDLE_PRIORITY_CLASS;
+        break;
+
+    case eThreadPriorityHigh:
+        val = HIGH_PRIORITY_CLASS;
+        break;
+
+    case eThreadPriorityNormal:
+    default:
+        val = NORMAL_PRIORITY_CLASS;
+        break;
+    }
+
+    SetPriorityClass(GetCurrentProcess(), val);
+}
+
+#if 0
+static void     AdjustPriority(HANDLE hThread)
+{
+    int             val;
+
+    switch (g_threadpriority)
+    {
+    case eThreadPriorityLow:
+        val = THREAD_PRIORITY_HIGHEST;
+        break;
+
+    case eThreadPriorityHigh:
+        val = THREAD_PRIORITY_LOWEST;
+        break;
+
+    case eThreadPriorityNormal:
+    default:
+        val = THREAD_PRIORITY_NORMAL;
+        break;
+    }
+    SetThreadPriority(hThread, val);
+}
+#endif
+
+void            ThreadSetDefault()
+{
+    SYSTEM_INFO     info;
+
+    if (g_numthreads == -1)                                // not set manually
+    {
+        GetSystemInfo(&info);
+        g_numthreads = info.dwNumberOfProcessors;
+        if (g_numthreads < 1 || g_numthreads > 32)
+        {
+            g_numthreads = 1;
+        }
+    }
+}
+
+void            ThreadLock()
+{
+    if (!threaded)
+    {
+        return;
+    }
+    EnterCriticalSection(&crit);
+    if (enter)
+    {
+        Warning("Recursive ThreadLock\n");
+    }
+    enter++;
+}
+
+void            ThreadUnlock()
+{
+    if (!threaded)
+    {
+        return;
+    }
+    if (!enter)
+    {
+        Error("ThreadUnlock without lock\n");
+    }
+    enter--;
+    LeaveCriticalSection(&crit);
+}
+
+q_threadfunction q_entry;
+
+static DWORD WINAPI ThreadEntryStub(LPVOID pParam)
+{
+    q_entry((int)pParam);
+    return 0;
+}
+
+void            threads_InitCrit()
+{
+    InitializeCriticalSection(&crit);
+    threaded = true;
+}
+
+void            threads_UninitCrit()
+{
+    DeleteCriticalSection(&crit);
+}
+
+void            RunThreadsOn(int workcnt, bool showpacifier, q_threadfunction func)
+{
+    DWORD           threadid[MAX_THREADS];
+    HANDLE          threadhandle[MAX_THREADS];
+    int             i;
+    double          start, end;
+
+    threadstart = I_FloatTime();
+    start = threadstart;
+    for (i = 0; i < THREADTIMES_SIZE; i++)
+    {
+        threadtimes[i] = 0;
+    }
+    dispatch = 0;
+    workcount = workcnt;
+    oldf = -1;
+    pacifier = showpacifier;
+    threaded = true;
+    q_entry = func;
+
+    if (workcount < dispatch)
+    {
+        Developer(DEVELOPER_LEVEL_ERROR, "RunThreadsOn: Workcount(%i) < dispatch(%i)\n", workcount, dispatch);
+    }
+    hlassume(workcount >= dispatch, assume_BadWorkcount);
+
+    //
+    // Create all the threads (suspended)
+    //
+    threads_InitCrit();
+    for (i = 0; i < g_numthreads; i++)
+    {
+        HANDLE          hThread = CreateThread(NULL,
+                                               0,
+                                               (LPTHREAD_START_ROUTINE) ThreadEntryStub,
+                                               (LPVOID) i,
+                                               CREATE_SUSPENDED,
+                                               &threadid[i]);
+
+        if (hThread != NULL)
+        {
+            threadhandle[i] = hThread;
+        }
+        else
+        {
+            LPVOID          lpMsgBuf;
+
+            FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                          FORMAT_MESSAGE_FROM_SYSTEM |
+                          FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),       // Default language
+                          (LPTSTR) & lpMsgBuf, 0, NULL);
+            // Process any inserts in lpMsgBuf.
+            // ...
+            // Display the string.
+            Developer(DEVELOPER_LEVEL_ERROR, "CreateThread #%d [%08X] failed : %s\n", i, threadhandle[i], lpMsgBuf);
+            Fatal(assume_THREAD_ERROR, "Unable to create thread #%d", i);
+            // Free the buffer.
+            LocalFree(lpMsgBuf);
+        }
+    }
+    CheckFatal();
+
+    // Start all the threads
+    for (i = 0; i < g_numthreads; i++)
+    {
+        if (ResumeThread(threadhandle[i]) == 0xFFFFFFFF)
+        {
+            LPVOID          lpMsgBuf;
+
+            FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+                          FORMAT_MESSAGE_FROM_SYSTEM |
+                          FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),       // Default language
+                          (LPTSTR) & lpMsgBuf, 0, NULL);
+            // Process any inserts in lpMsgBuf.
+            // ...
+            // Display the string.
+            Developer(DEVELOPER_LEVEL_ERROR, "ResumeThread #%d [%08X] failed : %s\n", i, threadhandle[i], lpMsgBuf);
+            Fatal(assume_THREAD_ERROR, "Unable to start thread #%d", i);
+            // Free the buffer.
+            LocalFree(lpMsgBuf);
+        }
+    }
+    CheckFatal();
+
+    // Wait for threads to complete
+    for (i = 0; i < g_numthreads; i++)
+    {
+        Developer(DEVELOPER_LEVEL_MESSAGE, "WaitForSingleObject on thread #%d [%08X]\n", i, threadhandle[i]);
+        WaitForSingleObject(threadhandle[i], INFINITE);
+    }
+    threads_UninitCrit();
+
+    q_entry = NULL;
+    threaded = false;
+    end = I_FloatTime();
+    if (pacifier)
+    {
+        printf("\r%60s\r", "");
+    }
+    Log(" (%.2f seconds)\n", end - start);
+}
+
+#endif
+
+/*=
+| End SYSTEM_WIN32
+=====================*/
+
+/*====================
+| Begin SYSTEM_POSIX
+=*/
+#ifdef SYSTEM_POSIX
+
+#define	USED
+
+int             g_numthreads = DEFAULT_NUMTHREADS;
+
+void            ThreadSetPriority(q_threadpriority type)
+{
+    int             val;
+
+    g_threadpriority = type;
+
+    // Currently in Linux land users are incapable of raising the priority level of their processes
+    // Unless you are root -high is useless . . . 
+    switch (g_threadpriority)
+    {
+    case eThreadPriorityLow:
+        val = PRIO_MAX;
+        break;
+
+    case eThreadPriorityHigh:
+        val = PRIO_MIN;
+        break;
+
+    case eThreadPriorityNormal:
+    default:
+        val = 0;
+        break;
+    }
+    setpriority(PRIO_PROCESS, 0, val);
+}
+
+void            ThreadSetDefault()
+{
+    if (g_numthreads == -1)
+    {
+        g_numthreads = 1;
+    }
+}
+
+typedef void*    pthread_addr_t;
+pthread_mutex_t* my_mutex;
+
+void            ThreadLock()
+{
+    if (my_mutex)
+    {
+        pthread_mutex_lock(my_mutex);
+    }
+}
+
+void            ThreadUnlock()
+{
+    if (my_mutex)
+    {
+        pthread_mutex_unlock(my_mutex);
+    }
+}
+
+q_threadfunction q_entry;
+
+static void*    CDECL ThreadEntryStub(void* pParam)
+{
+    q_entry((int)pParam);
+    return NULL;
+}
+
+void            threads_InitCrit()
+{
+    pthread_mutexattr_t mattrib;
+
+    if (!my_mutex)
+    {
+        my_mutex = (pthread_mutex_t*)Alloc(sizeof(*my_mutex));
+        if (pthread_mutexattr_init(&mattrib) == -1)
+        {
+            Error("pthread_mutex_attr_init failed");
+        }
+        if (pthread_mutex_init(my_mutex, &mattrib) == -1)
+        {
+            Error("pthread_mutex_init failed");
+        }
+    }
+}
+
+void            threads_UninitCrit()
+{
+    Free(my_mutex);
+    my_mutex = NULL;
+}
+
+/*
+ * =============
+ * RunThreadsOn
+ * =============
+ */
+void            RunThreadsOn(int workcnt, bool showpacifier, q_threadfunction func)
+{
+    int             i;
+    pthread_t       work_threads[MAX_THREADS];
+    pthread_addr_t  status;
+    pthread_attr_t  attrib;
+    double          start, end;
+
+    threadstart = I_FloatTime();
+    start = threadstart;
+    for (i = 0; i < THREADTIMES_SIZE; i++)
+    {
+        threadtimes[i] = 0;
+    }
+
+    dispatch = 0;
+    workcount = workcnt;
+    oldf = -1;
+    pacifier = showpacifier;
+    threaded = true;
+    q_entry = func;
+
+    if (pacifier)
+    {
+        setbuf(stdout, NULL);
+    }
+
+    threads_InitCrit();
+
+    if (pthread_attr_init(&attrib) == -1)
+    {
+        Error("pthread_attr_init failed");
+    }
+#ifdef _POSIX_THREAD_ATTR_STACKSIZE
+    if (pthread_attr_setstacksize(&attrib, 0x400000) == -1)
+    {
+        Error("pthread_attr_setstacksize failed");
+    }
+#endif
+
+    for (i = 0; i < g_numthreads; i++)
+    {
+        if (pthread_create(&work_threads[i], &attrib, ThreadEntryStub, (void*)i) == -1)
+        {
+            Error("pthread_create failed");
+        }
+    }
+
+    for (i = 0; i < g_numthreads; i++)
+    {
+        if (pthread_join(work_threads[i], &status) == -1)
+        {
+            Error("pthread_join failed");
+        }
+    }
+
+    threads_UninitCrit();
+
+    q_entry = NULL;
+    threaded = false;
+
+    end = I_FloatTime();
+    if (pacifier)
+    {
+        printf("\r%60s\r", "");
+    }
+
+    Log(" (%.2f seconds)\n", end - start);
+}
+
+#endif /*SYSTEM_POSIX */
+
+/*=
+| End SYSTEM_POSIX
+=====================*/
+
+#endif /*SINGLE_THREADED */
+
+/*====================
+| Begin SINGLE_THREADED
+=*/
+#ifdef SINGLE_THREADED
+
+int             g_numthreads = 1;
+
+void            ThreadSetPriority(q_threadpriority type)
+{
+}
+
+void            threads_InitCrit()
+{
+}
+
+void            threads_UninitCrit()
+{
+}
+
+void            ThreadSetDefault()
+{
+    g_numthreads = 1;
+}
+
+void            ThreadLock()
+{
+}
+
+void            ThreadUnlock()
+{
+}
+
+void            RunThreadsOn(int workcnt, bool showpacifier, q_threadfunction func)
+{
+    int             i;
+    double          start, end;
+
+    dispatch = 0;
+    workcount = workcnt;
+    oldf = -1;
+    pacifier = showpacifier;
+    threadstart = I_FloatTime();
+    start = threadstart;
+    for (i = 0; i < THREADTIMES_SIZE; i++)
+    {
+        threadtimes[i] = 0.0;
+    }
+
+    if (pacifier)
+    {
+        setbuf(stdout, NULL);
+    }
+    func(0);
+
+    end = I_FloatTime();
+
+    if (pacifier)
+    {
+        printf("\r%60s\r", "");
+    }
+
+    Log(" (%.2f seconds)\n", end - start);
+}
+
+#endif
+
+/*=
+| End SINGLE_THREADED
+=====================*/

+ 49 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/threads.h

@@ -0,0 +1,49 @@
+#ifndef THREADS_H__
+#define THREADS_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#define	MAX_THREADS	64
+
+typedef enum
+{
+    eThreadPriorityLow = -1,
+    eThreadPriorityNormal,
+    eThreadPriorityHigh
+}
+q_threadpriority;
+
+typedef void    (*q_threadfunction) (int);
+
+#ifdef SYSTEM_WIN32
+#define DEFAULT_NUMTHREADS -1
+#endif
+#ifdef SYSTEM_POSIX
+#define DEFAULT_NUMTHREADS 1
+#endif
+
+#define DEFAULT_THREAD_PRIORITY eThreadPriorityNormal
+
+extern int      g_numthreads;
+extern q_threadpriority g_threadpriority;
+
+extern void     ThreadSetPriority(q_threadpriority type);
+extern void     ThreadSetDefault();
+extern int      GetThreadWork();
+extern void     ThreadLock();
+extern void     ThreadUnlock();
+
+extern void     RunThreadsOnIndividual(int workcnt, bool showpacifier, q_threadfunction);
+extern void     RunThreadsOn(int workcnt, bool showpacifier, q_threadfunction);
+
+#ifdef ZHLT_NETVIS
+extern void     threads_InitCrit();
+extern void     threads_UninitCrit();
+#endif
+
+#define NamedRunThreadsOn(n,p,f) { Log("%s\n", #f ":"); RunThreadsOn(n,p,f); }
+#define NamedRunThreadsOnIndividual(n,p,f) { Log("%s\n", #f ":"); RunThreadsOnIndividual(n,p,f); }
+
+#endif //**/ THREADS_H__

+ 58 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/win32fix.h

@@ -0,0 +1,58 @@
+#ifndef WIN32FIX_H__
+#define WIN32FIX_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#include <malloc.h>
+
+/////////////////////////////
+#ifdef SYSTEM_WIN32
+
+#define alloca      _alloca
+
+#define strncasecmp _strnicmp
+#define strcasecmp  _stricmp
+
+#if !defined(_MSC_VER) || defined(__MINGW32__)
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#endif
+
+#define finite    _finite
+
+#define rotl      _rotl
+#define rotr      _rotr
+
+#undef STDCALL
+#undef FASTCALL
+#undef CDECL
+
+#define STDCALL     __stdcall
+#define FASTCALL    __fastcall
+#define CDECL       __cdecl
+
+#define INLINE      __inline
+
+#endif
+/////////////////////////////
+
+/////////////////////////////
+#ifdef SYSTEM_POSIX
+#define _MAX_PATH  4096
+#define _MAX_DRIVE 4096
+#define _MAX_DIR   4096
+#define _MAX_FNAME 4096
+#define _MAX_EXT   4096
+
+#define STDCALL
+#define FASTCALL
+#define CDECL
+
+#define INLINE inline
+
+#endif
+/////////////////////////////
+
+#endif ///////////////////////////// WIN32FIX_H__

File diff suppressed because it is too large
+ 1103 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/winding.cpp


+ 82 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/common/winding.h

@@ -0,0 +1,82 @@
+#ifndef WINDING_H__
+#define WINDING_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#include "basictypes.h"
+#include "mathtypes.h"
+#include "win32fix.h"
+#include "mathlib.h"
+#include "bspfile.h"
+#include "boundingbox.h"
+
+#define MAX_POINTS_ON_WINDING 128
+// TODO: FIX THIS STUPID SHIT (MAX_POINTS_ON_WINDING)
+
+#define BASE_WINDING_DISTANCE 9000
+
+#define	SIDE_FRONT		0
+#define	SIDE_ON			2
+#define	SIDE_BACK		1
+#define	SIDE_CROSS		-2
+
+class Winding
+{
+public:
+    // General Functions
+    void            Print() const;
+    void            getPlane(dplane_t& plane) const;
+    void            getPlane(vec3_t& normal, vec_t& dist) const;
+    vec_t           getArea() const;
+    void            getBounds(BoundingBox& bounds) const;
+    void            getBounds(vec3_t& mins, vec3_t& maxs) const;
+    void            getCenter(vec3_t& center) const;
+    Winding*        Copy() const;
+    void            Check() const;  // Developer check for validity
+    bool            Valid() const;  // Runtime/user/normal check for validity
+    void            addPoint(const vec3_t newpoint);
+    void            insertPoint(const vec3_t newpoint, const unsigned int offset);
+
+    // Specialized Functions
+    void            RemoveColinearPoints();
+    bool            Clip(const dplane_t& split, bool keepon); // For hlbsp
+    void            Clip(const dplane_t& split, Winding** front, Winding** back);
+    void            Clip(const vec3_t normal, const vec_t dist, Winding** front, Winding** back);
+    bool            Chop(const vec3_t normal, const vec_t dist);
+    void            Divide(const dplane_t& split, Winding** front, Winding** back);
+    int             WindingOnPlaneSide(const vec3_t normal, const vec_t dist);
+	void			CopyPoints(vec3_t *points, int &numpoints);
+
+	void			initFromPoints(vec3_t *points, UINT32 numpoints);
+	void			Reset(void);	// Resets the structure
+
+protected:
+    void            resize(UINT32 newsize);
+
+public:
+    // Construction
+	Winding();										// Do nothing :)
+	Winding(vec3_t *points, UINT32 numpoints);		// Create from raw points
+    Winding(const dface_t& face);
+    Winding(const dplane_t& face);
+    Winding(const vec3_t normal, const vec_t dist);
+    Winding(UINT32 points);
+    Winding(const Winding& other);
+    virtual ~Winding();
+    Winding& operator=(const Winding& other);
+
+    // Misc
+private:
+    void initFromPlane(const vec3_t normal, const vec_t dist);
+
+public:
+    // Data
+    UINT32  m_NumPoints;
+    vec3_t* m_Points;
+protected:
+    UINT32  m_MaxPoints;
+};
+
+#endif

+ 5 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/copy_executables_here.bat

@@ -0,0 +1,5 @@
+copy hlbsp\Release\hlbsp.exe hlbsp.exe
+copy hlvis\Release\hlvis.exe hlvis.exe
+copy hlrad\Release\hlrad.exe hlrad.exe
+copy hlcsg\Release\hlcsg.exe hlcsg.exe
+copy ripent\Release\ripent.exe ripent.exe

+ 278 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/bsp5.h

@@ -0,0 +1,278 @@
+#ifndef HLBSP_H__
+#define HLBSP_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#include "cmdlib.h"
+#include "messages.h"
+#include "win32fix.h"
+#include "log.h"
+#include "hlassert.h"
+#include "mathlib.h"
+#include "bspfile.h"
+#include "blockmem.h"
+#include "filelib.h"
+#include "threads.h"
+#include "winding.h"
+
+#define ENTITIES_VOID "entities.void"
+#define ENTITIES_VOID_EXT ".void"
+
+#define	BOGUS_RANGE	18000
+
+// the exact bounding box of the brushes is expanded some for the headnode
+// volume.  is this still needed?
+#define	SIDESPACE	24
+
+//============================================================================
+
+#define MIN_SUBDIVIDE_SIZE      64
+
+#ifdef ZHLT_GENERAL
+#define MAX_SUBDIVIDE_SIZE      512
+#else
+#define MAX_SUBDIVIDE_SIZE      240
+#endif
+
+#define DEFAULT_SUBDIVIDE_SIZE  240
+
+#define MIN_MAXNODE_SIZE        64
+#define MAX_MAXNODE_SIZE        8192
+#define DEFAULT_MAXNODE_SIZE    1024
+
+#define DEFAULT_NOFILL          false
+#define DEFAULT_NOTJUNC         false
+#define DEFAULT_NOCLIP          false
+#define DEFAULT_NOOPT			false
+#define DEFAULT_LEAKONLY        false
+#define DEFAULT_WATERVIS        false
+#define DEFAULT_CHART           false
+#define DEFAULT_INFO            true
+
+#ifdef ZHLT_NULLTEX // AJM
+#define DEFAULT_NULLTEX             true
+#endif
+
+#ifdef ZHLT_PROGRESSFILE // AJM
+#define DEFAULT_PROGRESSFILE NULL // progress file is only used if g_progressfile is non-null
+#endif
+
+#ifdef SYSTEM_WIN32
+#define DEFAULT_ESTIMATE        false
+#endif
+
+#ifdef SYSTEM_POSIX
+#define DEFAULT_ESTIMATE        true
+#endif
+
+#ifdef ZHLT_DETAIL // AJM
+#define DEFAULT_DETAIL      true
+#endif
+
+#define	MAXEDGES			48                 // 32
+#define	MAXPOINTS			28                 // don't let a base face get past this
+                                                                              // because it can be split more later
+#define MAXNODESIZE     1024                               // Valve default is 1024
+
+typedef enum
+{
+    face_normal = 0,
+    face_hint,
+    face_skip,
+#ifdef ZHLT_NULLTEX // AJM
+    face_null,
+#endif
+#ifdef ZHLT_DETAIL // AJM
+    face_detail
+#endif
+	//face_blocklight
+}
+facestyle_e;
+
+typedef struct face_s                                      // This structure is layed out so 'pts' is on a quad-word boundary (and the pointers are as well)
+{
+    struct face_s*  next;
+    int             planenum;
+    int             texturenum;
+    int             contents;                              // contents in front of face
+
+    struct face_s*  original;                              // face on node
+    int             outputnumber;                          // only valid for original faces after write surfaces
+    int             numpoints;
+    facestyle_e     facestyle;
+
+    // vector quad word aligned
+    vec3_t          pts[MAXEDGES];                         // FIXME: change to use winding_t
+
+}
+face_t;
+
+typedef struct surface_s
+{
+    struct surface_s* next;
+    int             planenum;
+    vec3_t          mins, maxs;
+    struct node_s*  onnode;                                // true if surface has already been used
+    // as a splitting node
+    face_t*         faces;                                 // links to all the faces on either side of the surf
+}
+surface_t;
+
+typedef struct
+{
+    vec3_t          mins, maxs;
+    surface_t*      surfaces;
+}
+surfchain_t;
+
+//
+// there is a node_t structure for every node and leaf in the bsp tree
+//
+#define	PLANENUM_LEAF		-1
+
+typedef struct node_s
+{
+    surface_t*      surfaces;
+
+    vec3_t          mins, maxs;                            // bounding volume of portals;
+
+    // information for decision nodes
+    int             planenum;                              // -1 = leaf node
+    struct node_s*  children[2];                           // only valid for decision nodes
+    face_t*         faces;                                 // decision nodes only, list for both sides
+
+    // information for leafs
+    int             contents;                              // leaf nodes (0 for decision nodes)
+    face_t**        markfaces;                             // leaf nodes only, point to node faces
+    struct portal_s* portals;
+    int             visleafnum;                            // -1 = solid
+    int             valid;                                 // for flood filling
+    int             occupied;                              // light number in leaf for outside filling
+}
+node_t;
+
+#define	NUM_HULLS		4
+
+//=============================================================================
+// solidbsp.c
+extern void     SubdivideFace(face_t* f, face_t** prevptr);
+extern node_t*  SolidBSP(const surfchain_t* const surfhead, bool report_progress);
+
+//=============================================================================
+// merge.c
+extern void     MergePlaneFaces(surface_t* plane);
+extern void     MergeAll(surface_t* surfhead);
+
+//=============================================================================
+// surfaces.c
+extern void     MakeFaceEdges();
+extern int      GetEdge(const vec3_t p1, const vec3_t p2, face_t* f);
+
+//=============================================================================
+// portals.c
+typedef struct portal_s
+{
+    dplane_t        plane;
+    node_t*         onnode;                                // NULL = outside box
+    node_t*         nodes[2];                              // [0] = front side of plane
+    struct portal_s* next[2];
+    Winding*        winding;
+}
+portal_t;
+
+extern node_t   g_outside_node;                            // portals outside the world face this
+
+extern void     AddPortalToNodes(portal_t* p, node_t* front, node_t* back);
+extern void     RemovePortalFromNode(portal_t* portal, node_t* l);
+extern void     MakeHeadnodePortals(node_t* node, const vec3_t mins, const vec3_t maxs);
+
+extern void     FreePortals(node_t* node);
+extern void     WritePortalfile(node_t* headnode);
+
+//=============================================================================
+// tjunc.c
+void            tjunc(node_t* headnode);
+
+//=============================================================================
+// writebsp.c
+extern void     WriteClipNodes(node_t* headnode);
+extern void     WriteDrawNodes(node_t* headnode);
+
+extern void     BeginBSPFile();
+extern void     FinishBSPFile();
+
+//=============================================================================
+// outside.c
+extern node_t*  FillOutside(node_t* node, bool leakfile, unsigned hullnum);
+extern void     LoadAllowableOutsideList(const char* const filename);
+extern void     FreeAllowableOutsideList();
+
+//=============================================================================
+// misc functions
+extern void     GetParamsFromEnt(entity_t* mapent);
+
+extern face_t*  AllocFace();
+extern void     FreeFace(face_t* f);
+
+extern struct portal_s* AllocPortal();
+extern void     FreePortal(struct portal_s* p);
+
+extern surface_t* AllocSurface();
+extern void     FreeSurface(surface_t* s);
+
+extern node_t*  AllocNode();
+
+extern bool     CheckFaceForHint(const face_t* const f);
+extern bool     CheckFaceForSkip(const face_t* const f);
+#ifdef ZHLT_NULLTEX// AJM
+extern bool     CheckFaceForNull(const face_t* const f);
+#endif
+
+
+// =====================================================================================
+//Cpt_Andrew - UTSky Check
+// =====================================================================================
+extern bool     CheckFaceForEnv_Sky(const face_t* const f);
+// =====================================================================================
+
+
+#ifdef ZHLT_DETAIL // AJM
+extern bool     CheckFaceForDetail(const face_t* const f);
+#endif
+
+//=============================================================================
+// cull.c
+extern void     CullStuff();
+
+//=============================================================================
+// qbsp.c
+extern bool     g_nofill;
+extern bool     g_notjunc;
+extern bool     g_watervis;
+extern bool     g_chart;
+extern bool     g_estimate;
+extern int      g_maxnode_size;
+extern int      g_subdivide_size;
+extern int      g_hullnum;
+extern bool     g_bLeakOnly;
+extern bool     g_bLeaked;
+extern char     g_portfilename[_MAX_PATH];
+extern char     g_pointfilename[_MAX_PATH];
+extern char     g_linefilename[_MAX_PATH];
+extern char     g_bspfilename[_MAX_PATH];
+
+
+#ifdef ZHLT_DETAIL // AJM
+extern bool g_bDetailBrushes;
+#endif
+
+#ifdef ZHLT_NULLTEX // AJM
+extern bool     g_bUseNullTex;
+#endif
+
+extern face_t*  NewFaceFromFace(const face_t* const in);
+extern void     SplitFace(face_t* in, const dplane_t* const split, face_t** front, face_t** back);
+
+#endif // qbsp.c====================================================================== HLBSP_H__

+ 624 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/hlbsp.mak

@@ -0,0 +1,624 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on hlbsp.dsp
+!IF "$(CFG)" == ""
+CFG=hlbsp - Win32 Super_Debug
+!MESSAGE No configuration specified. Defaulting to hlbsp - Win32 Super_Debug.
+!ENDIF 
+
+!IF "$(CFG)" != "hlbsp - Win32 Release" && "$(CFG)" != "hlbsp - Win32 Debug" && "$(CFG)" != "hlbsp - Win32 Release w Symbols" && "$(CFG)" != "hlbsp - Win32 Super_Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "hlbsp.mak" CFG="hlbsp - Win32 Super_Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "hlbsp - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "hlbsp - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "hlbsp - Win32 Release w Symbols" (based on "Win32 (x86) Console Application")
+!MESSAGE "hlbsp - Win32 Super_Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE 
+NULL=nul
+!ENDIF 
+
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "hlbsp - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+ALL : "$(OUTDIR)\hlbsp.exe" "$(OUTDIR)\hlbsp.bsc"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\blockmem.obj"
+	-@erase "$(INTDIR)\blockmem.sbr"
+	-@erase "$(INTDIR)\bspfile.obj"
+	-@erase "$(INTDIR)\bspfile.sbr"
+	-@erase "$(INTDIR)\cmdlib.obj"
+	-@erase "$(INTDIR)\cmdlib.sbr"
+	-@erase "$(INTDIR)\filelib.obj"
+	-@erase "$(INTDIR)\filelib.sbr"
+	-@erase "$(INTDIR)\log.obj"
+	-@erase "$(INTDIR)\log.sbr"
+	-@erase "$(INTDIR)\mathlib.obj"
+	-@erase "$(INTDIR)\mathlib.sbr"
+	-@erase "$(INTDIR)\merge.obj"
+	-@erase "$(INTDIR)\merge.sbr"
+	-@erase "$(INTDIR)\messages.obj"
+	-@erase "$(INTDIR)\messages.sbr"
+	-@erase "$(INTDIR)\outside.obj"
+	-@erase "$(INTDIR)\outside.sbr"
+	-@erase "$(INTDIR)\portals.obj"
+	-@erase "$(INTDIR)\portals.sbr"
+	-@erase "$(INTDIR)\qbsp.obj"
+	-@erase "$(INTDIR)\qbsp.sbr"
+	-@erase "$(INTDIR)\scriplib.obj"
+	-@erase "$(INTDIR)\scriplib.sbr"
+	-@erase "$(INTDIR)\solidbsp.obj"
+	-@erase "$(INTDIR)\solidbsp.sbr"
+	-@erase "$(INTDIR)\surfaces.obj"
+	-@erase "$(INTDIR)\surfaces.sbr"
+	-@erase "$(INTDIR)\threads.obj"
+	-@erase "$(INTDIR)\threads.sbr"
+	-@erase "$(INTDIR)\tjunc.obj"
+	-@erase "$(INTDIR)\tjunc.sbr"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\winding.obj"
+	-@erase "$(INTDIR)\winding.sbr"
+	-@erase "$(INTDIR)\writebsp.obj"
+	-@erase "$(INTDIR)\writebsp.sbr"
+	-@erase "$(OUTDIR)\hlbsp.bsc"
+	-@erase "$(OUTDIR)\hlbsp.exe"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\common" /I "..\template" /D "NDEBUG" /D "DOUBLEVEC_T" /D "WIN32" /D "_CONSOLE" /D "SYSTEM_WIN32" /D "STDC_HEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\hlbsp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\hlbsp.bsc" 
+BSC32_SBRS= \
+	"$(INTDIR)\blockmem.sbr" \
+	"$(INTDIR)\bspfile.sbr" \
+	"$(INTDIR)\cmdlib.sbr" \
+	"$(INTDIR)\filelib.sbr" \
+	"$(INTDIR)\log.sbr" \
+	"$(INTDIR)\mathlib.sbr" \
+	"$(INTDIR)\messages.sbr" \
+	"$(INTDIR)\scriplib.sbr" \
+	"$(INTDIR)\threads.sbr" \
+	"$(INTDIR)\writebsp.sbr" \
+	"$(INTDIR)\merge.sbr" \
+	"$(INTDIR)\outside.sbr" \
+	"$(INTDIR)\portals.sbr" \
+	"$(INTDIR)\qbsp.sbr" \
+	"$(INTDIR)\solidbsp.sbr" \
+	"$(INTDIR)\surfaces.sbr" \
+	"$(INTDIR)\tjunc.sbr" \
+	"$(INTDIR)\winding.sbr"
+
+"$(OUTDIR)\hlbsp.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+LINK32_FLAGS=binmode.obj /nologo /stack:0x400000,0x100000 /subsystem:console /incremental:no /pdb:"$(OUTDIR)\hlbsp.pdb" /machine:I386 /out:"$(OUTDIR)\hlbsp.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\blockmem.obj" \
+	"$(INTDIR)\bspfile.obj" \
+	"$(INTDIR)\cmdlib.obj" \
+	"$(INTDIR)\filelib.obj" \
+	"$(INTDIR)\log.obj" \
+	"$(INTDIR)\mathlib.obj" \
+	"$(INTDIR)\messages.obj" \
+	"$(INTDIR)\scriplib.obj" \
+	"$(INTDIR)\threads.obj" \
+	"$(INTDIR)\writebsp.obj" \
+	"$(INTDIR)\merge.obj" \
+	"$(INTDIR)\outside.obj" \
+	"$(INTDIR)\portals.obj" \
+	"$(INTDIR)\qbsp.obj" \
+	"$(INTDIR)\solidbsp.obj" \
+	"$(INTDIR)\surfaces.obj" \
+	"$(INTDIR)\tjunc.obj" \
+	"$(INTDIR)\winding.obj"
+
+"$(OUTDIR)\hlbsp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "hlbsp - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+ALL : "$(OUTDIR)\hlbsp.exe" "$(OUTDIR)\hlbsp.bsc"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\blockmem.obj"
+	-@erase "$(INTDIR)\blockmem.sbr"
+	-@erase "$(INTDIR)\bspfile.obj"
+	-@erase "$(INTDIR)\bspfile.sbr"
+	-@erase "$(INTDIR)\cmdlib.obj"
+	-@erase "$(INTDIR)\cmdlib.sbr"
+	-@erase "$(INTDIR)\filelib.obj"
+	-@erase "$(INTDIR)\filelib.sbr"
+	-@erase "$(INTDIR)\log.obj"
+	-@erase "$(INTDIR)\log.sbr"
+	-@erase "$(INTDIR)\mathlib.obj"
+	-@erase "$(INTDIR)\mathlib.sbr"
+	-@erase "$(INTDIR)\merge.obj"
+	-@erase "$(INTDIR)\merge.sbr"
+	-@erase "$(INTDIR)\messages.obj"
+	-@erase "$(INTDIR)\messages.sbr"
+	-@erase "$(INTDIR)\outside.obj"
+	-@erase "$(INTDIR)\outside.sbr"
+	-@erase "$(INTDIR)\portals.obj"
+	-@erase "$(INTDIR)\portals.sbr"
+	-@erase "$(INTDIR)\qbsp.obj"
+	-@erase "$(INTDIR)\qbsp.sbr"
+	-@erase "$(INTDIR)\scriplib.obj"
+	-@erase "$(INTDIR)\scriplib.sbr"
+	-@erase "$(INTDIR)\solidbsp.obj"
+	-@erase "$(INTDIR)\solidbsp.sbr"
+	-@erase "$(INTDIR)\surfaces.obj"
+	-@erase "$(INTDIR)\surfaces.sbr"
+	-@erase "$(INTDIR)\threads.obj"
+	-@erase "$(INTDIR)\threads.sbr"
+	-@erase "$(INTDIR)\tjunc.obj"
+	-@erase "$(INTDIR)\tjunc.sbr"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\vc60.pdb"
+	-@erase "$(INTDIR)\winding.obj"
+	-@erase "$(INTDIR)\winding.sbr"
+	-@erase "$(INTDIR)\writebsp.obj"
+	-@erase "$(INTDIR)\writebsp.sbr"
+	-@erase "$(OUTDIR)\hlbsp.bsc"
+	-@erase "$(OUTDIR)\hlbsp.exe"
+	-@erase "$(OUTDIR)\hlbsp.map"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MD /W3 /Gm /GX /Zi /Od /I "..\common" /I "..\template" /D "DOUBLEVEC_T" /D "_DEBUG" /D "STDC_HEADERS" /D "WIN32" /D "_CONSOLE" /D "SYSTEM_WIN32" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\hlbsp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\hlbsp.bsc" 
+BSC32_SBRS= \
+	"$(INTDIR)\blockmem.sbr" \
+	"$(INTDIR)\bspfile.sbr" \
+	"$(INTDIR)\cmdlib.sbr" \
+	"$(INTDIR)\filelib.sbr" \
+	"$(INTDIR)\log.sbr" \
+	"$(INTDIR)\mathlib.sbr" \
+	"$(INTDIR)\messages.sbr" \
+	"$(INTDIR)\scriplib.sbr" \
+	"$(INTDIR)\threads.sbr" \
+	"$(INTDIR)\writebsp.sbr" \
+	"$(INTDIR)\merge.sbr" \
+	"$(INTDIR)\outside.sbr" \
+	"$(INTDIR)\portals.sbr" \
+	"$(INTDIR)\qbsp.sbr" \
+	"$(INTDIR)\solidbsp.sbr" \
+	"$(INTDIR)\surfaces.sbr" \
+	"$(INTDIR)\tjunc.sbr" \
+	"$(INTDIR)\winding.sbr"
+
+"$(OUTDIR)\hlbsp.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+LINK32_FLAGS=binmode.obj /nologo /stack:0x1000000,0x100000 /subsystem:console /profile /map:"$(INTDIR)\hlbsp.map" /debug /machine:I386 /out:"$(OUTDIR)\hlbsp.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\blockmem.obj" \
+	"$(INTDIR)\bspfile.obj" \
+	"$(INTDIR)\cmdlib.obj" \
+	"$(INTDIR)\filelib.obj" \
+	"$(INTDIR)\log.obj" \
+	"$(INTDIR)\mathlib.obj" \
+	"$(INTDIR)\messages.obj" \
+	"$(INTDIR)\scriplib.obj" \
+	"$(INTDIR)\threads.obj" \
+	"$(INTDIR)\writebsp.obj" \
+	"$(INTDIR)\merge.obj" \
+	"$(INTDIR)\outside.obj" \
+	"$(INTDIR)\portals.obj" \
+	"$(INTDIR)\qbsp.obj" \
+	"$(INTDIR)\solidbsp.obj" \
+	"$(INTDIR)\surfaces.obj" \
+	"$(INTDIR)\tjunc.obj" \
+	"$(INTDIR)\winding.obj"
+
+"$(OUTDIR)\hlbsp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "hlbsp - Win32 Release w Symbols"
+
+OUTDIR=.\Release_w_Symbols
+INTDIR=.\Release_w_Symbols
+# Begin Custom Macros
+OutDir=.\Release_w_Symbols
+# End Custom Macros
+
+ALL : "$(OUTDIR)\hlbsp.exe" "$(OUTDIR)\hlbsp.bsc"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\blockmem.obj"
+	-@erase "$(INTDIR)\blockmem.sbr"
+	-@erase "$(INTDIR)\bspfile.obj"
+	-@erase "$(INTDIR)\bspfile.sbr"
+	-@erase "$(INTDIR)\cmdlib.obj"
+	-@erase "$(INTDIR)\cmdlib.sbr"
+	-@erase "$(INTDIR)\filelib.obj"
+	-@erase "$(INTDIR)\filelib.sbr"
+	-@erase "$(INTDIR)\log.obj"
+	-@erase "$(INTDIR)\log.sbr"
+	-@erase "$(INTDIR)\mathlib.obj"
+	-@erase "$(INTDIR)\mathlib.sbr"
+	-@erase "$(INTDIR)\merge.obj"
+	-@erase "$(INTDIR)\merge.sbr"
+	-@erase "$(INTDIR)\messages.obj"
+	-@erase "$(INTDIR)\messages.sbr"
+	-@erase "$(INTDIR)\outside.obj"
+	-@erase "$(INTDIR)\outside.sbr"
+	-@erase "$(INTDIR)\portals.obj"
+	-@erase "$(INTDIR)\portals.sbr"
+	-@erase "$(INTDIR)\qbsp.obj"
+	-@erase "$(INTDIR)\qbsp.sbr"
+	-@erase "$(INTDIR)\scriplib.obj"
+	-@erase "$(INTDIR)\scriplib.sbr"
+	-@erase "$(INTDIR)\solidbsp.obj"
+	-@erase "$(INTDIR)\solidbsp.sbr"
+	-@erase "$(INTDIR)\surfaces.obj"
+	-@erase "$(INTDIR)\surfaces.sbr"
+	-@erase "$(INTDIR)\threads.obj"
+	-@erase "$(INTDIR)\threads.sbr"
+	-@erase "$(INTDIR)\tjunc.obj"
+	-@erase "$(INTDIR)\tjunc.sbr"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\vc60.pdb"
+	-@erase "$(INTDIR)\winding.obj"
+	-@erase "$(INTDIR)\winding.sbr"
+	-@erase "$(INTDIR)\writebsp.obj"
+	-@erase "$(INTDIR)\writebsp.sbr"
+	-@erase "$(OUTDIR)\hlbsp.bsc"
+	-@erase "$(OUTDIR)\hlbsp.exe"
+	-@erase "$(OUTDIR)\hlbsp.map"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MD /W3 /GX /Zi /O2 /I "..\common" /I "..\template" /D "NDEBUG" /D "DOUBLEVEC_T" /D "WIN32" /D "_CONSOLE" /D "SYSTEM_WIN32" /D "STDC_HEADERS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\hlbsp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\hlbsp.bsc" 
+BSC32_SBRS= \
+	"$(INTDIR)\blockmem.sbr" \
+	"$(INTDIR)\bspfile.sbr" \
+	"$(INTDIR)\cmdlib.sbr" \
+	"$(INTDIR)\filelib.sbr" \
+	"$(INTDIR)\log.sbr" \
+	"$(INTDIR)\mathlib.sbr" \
+	"$(INTDIR)\messages.sbr" \
+	"$(INTDIR)\scriplib.sbr" \
+	"$(INTDIR)\threads.sbr" \
+	"$(INTDIR)\writebsp.sbr" \
+	"$(INTDIR)\merge.sbr" \
+	"$(INTDIR)\outside.sbr" \
+	"$(INTDIR)\portals.sbr" \
+	"$(INTDIR)\qbsp.sbr" \
+	"$(INTDIR)\solidbsp.sbr" \
+	"$(INTDIR)\surfaces.sbr" \
+	"$(INTDIR)\tjunc.sbr" \
+	"$(INTDIR)\winding.sbr"
+
+"$(OUTDIR)\hlbsp.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+LINK32_FLAGS=binmode.obj /nologo /stack:0x400000,0x100000 /subsystem:console /pdb:none /map:"$(INTDIR)\hlbsp.map" /debug /machine:I386 /out:"$(OUTDIR)\hlbsp.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\blockmem.obj" \
+	"$(INTDIR)\bspfile.obj" \
+	"$(INTDIR)\cmdlib.obj" \
+	"$(INTDIR)\filelib.obj" \
+	"$(INTDIR)\log.obj" \
+	"$(INTDIR)\mathlib.obj" \
+	"$(INTDIR)\messages.obj" \
+	"$(INTDIR)\scriplib.obj" \
+	"$(INTDIR)\threads.obj" \
+	"$(INTDIR)\writebsp.obj" \
+	"$(INTDIR)\merge.obj" \
+	"$(INTDIR)\outside.obj" \
+	"$(INTDIR)\portals.obj" \
+	"$(INTDIR)\qbsp.obj" \
+	"$(INTDIR)\solidbsp.obj" \
+	"$(INTDIR)\surfaces.obj" \
+	"$(INTDIR)\tjunc.obj" \
+	"$(INTDIR)\winding.obj"
+
+"$(OUTDIR)\hlbsp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "hlbsp - Win32 Super_Debug"
+
+OUTDIR=.\Super_Debug
+INTDIR=.\Super_Debug
+# Begin Custom Macros
+OutDir=.\Super_Debug
+# End Custom Macros
+
+ALL : "$(OUTDIR)\hlbsp.exe" "$(OUTDIR)\hlbsp.bsc"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\blockmem.obj"
+	-@erase "$(INTDIR)\blockmem.sbr"
+	-@erase "$(INTDIR)\bspfile.obj"
+	-@erase "$(INTDIR)\bspfile.sbr"
+	-@erase "$(INTDIR)\cmdlib.obj"
+	-@erase "$(INTDIR)\cmdlib.sbr"
+	-@erase "$(INTDIR)\filelib.obj"
+	-@erase "$(INTDIR)\filelib.sbr"
+	-@erase "$(INTDIR)\log.obj"
+	-@erase "$(INTDIR)\log.sbr"
+	-@erase "$(INTDIR)\mathlib.obj"
+	-@erase "$(INTDIR)\mathlib.sbr"
+	-@erase "$(INTDIR)\merge.obj"
+	-@erase "$(INTDIR)\merge.sbr"
+	-@erase "$(INTDIR)\messages.obj"
+	-@erase "$(INTDIR)\messages.sbr"
+	-@erase "$(INTDIR)\outside.obj"
+	-@erase "$(INTDIR)\outside.sbr"
+	-@erase "$(INTDIR)\portals.obj"
+	-@erase "$(INTDIR)\portals.sbr"
+	-@erase "$(INTDIR)\qbsp.obj"
+	-@erase "$(INTDIR)\qbsp.sbr"
+	-@erase "$(INTDIR)\scriplib.obj"
+	-@erase "$(INTDIR)\scriplib.sbr"
+	-@erase "$(INTDIR)\solidbsp.obj"
+	-@erase "$(INTDIR)\solidbsp.sbr"
+	-@erase "$(INTDIR)\surfaces.obj"
+	-@erase "$(INTDIR)\surfaces.sbr"
+	-@erase "$(INTDIR)\threads.obj"
+	-@erase "$(INTDIR)\threads.sbr"
+	-@erase "$(INTDIR)\tjunc.obj"
+	-@erase "$(INTDIR)\tjunc.sbr"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\vc60.pdb"
+	-@erase "$(INTDIR)\winding.obj"
+	-@erase "$(INTDIR)\winding.sbr"
+	-@erase "$(INTDIR)\writebsp.obj"
+	-@erase "$(INTDIR)\writebsp.sbr"
+	-@erase "$(OUTDIR)\hlbsp.bsc"
+	-@erase "$(OUTDIR)\hlbsp.exe"
+	-@erase "$(OUTDIR)\hlbsp.map"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\common" /I "..\template" /D "DOUBLEVEC_T" /D "_DEBUG" /D "STDC_HEADERS" /D "WIN32" /D "_CONSOLE" /D "SYSTEM_WIN32" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\hlbsp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\hlbsp.bsc" 
+BSC32_SBRS= \
+	"$(INTDIR)\blockmem.sbr" \
+	"$(INTDIR)\bspfile.sbr" \
+	"$(INTDIR)\cmdlib.sbr" \
+	"$(INTDIR)\filelib.sbr" \
+	"$(INTDIR)\log.sbr" \
+	"$(INTDIR)\mathlib.sbr" \
+	"$(INTDIR)\messages.sbr" \
+	"$(INTDIR)\scriplib.sbr" \
+	"$(INTDIR)\threads.sbr" \
+	"$(INTDIR)\writebsp.sbr" \
+	"$(INTDIR)\merge.sbr" \
+	"$(INTDIR)\outside.sbr" \
+	"$(INTDIR)\portals.sbr" \
+	"$(INTDIR)\qbsp.sbr" \
+	"$(INTDIR)\solidbsp.sbr" \
+	"$(INTDIR)\surfaces.sbr" \
+	"$(INTDIR)\tjunc.sbr" \
+	"$(INTDIR)\winding.sbr"
+
+"$(OUTDIR)\hlbsp.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+LINK32_FLAGS=binmode.obj /nologo /stack:0x1000000,0x100000 /subsystem:console /profile /map:"$(INTDIR)\hlbsp.map" /debug /machine:I386 /out:"$(OUTDIR)\hlbsp.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\blockmem.obj" \
+	"$(INTDIR)\bspfile.obj" \
+	"$(INTDIR)\cmdlib.obj" \
+	"$(INTDIR)\filelib.obj" \
+	"$(INTDIR)\log.obj" \
+	"$(INTDIR)\mathlib.obj" \
+	"$(INTDIR)\messages.obj" \
+	"$(INTDIR)\scriplib.obj" \
+	"$(INTDIR)\threads.obj" \
+	"$(INTDIR)\writebsp.obj" \
+	"$(INTDIR)\merge.obj" \
+	"$(INTDIR)\outside.obj" \
+	"$(INTDIR)\portals.obj" \
+	"$(INTDIR)\qbsp.obj" \
+	"$(INTDIR)\solidbsp.obj" \
+	"$(INTDIR)\surfaces.obj" \
+	"$(INTDIR)\tjunc.obj" \
+	"$(INTDIR)\winding.obj"
+
+"$(OUTDIR)\hlbsp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("hlbsp.dep")
+!INCLUDE "hlbsp.dep"
+!ELSE 
+!MESSAGE Warning: cannot find "hlbsp.dep"
+!ENDIF 
+!ENDIF 
+
+
+!IF "$(CFG)" == "hlbsp - Win32 Release" || "$(CFG)" == "hlbsp - Win32 Debug" || "$(CFG)" == "hlbsp - Win32 Release w Symbols" || "$(CFG)" == "hlbsp - Win32 Super_Debug"
+SOURCE=..\common\blockmem.cpp
+
+"$(INTDIR)\blockmem.obj"	"$(INTDIR)\blockmem.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\bspfile.cpp
+
+"$(INTDIR)\bspfile.obj"	"$(INTDIR)\bspfile.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\cmdlib.cpp
+
+"$(INTDIR)\cmdlib.obj"	"$(INTDIR)\cmdlib.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\filelib.cpp
+
+"$(INTDIR)\filelib.obj"	"$(INTDIR)\filelib.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\log.cpp
+
+"$(INTDIR)\log.obj"	"$(INTDIR)\log.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\mathlib.cpp
+
+"$(INTDIR)\mathlib.obj"	"$(INTDIR)\mathlib.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\messages.cpp
+
+"$(INTDIR)\messages.obj"	"$(INTDIR)\messages.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\scriplib.cpp
+
+"$(INTDIR)\scriplib.obj"	"$(INTDIR)\scriplib.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\threads.cpp
+
+"$(INTDIR)\threads.obj"	"$(INTDIR)\threads.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\writebsp.cpp
+
+"$(INTDIR)\writebsp.obj"	"$(INTDIR)\writebsp.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\merge.cpp
+
+"$(INTDIR)\merge.obj"	"$(INTDIR)\merge.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\outside.cpp
+
+"$(INTDIR)\outside.obj"	"$(INTDIR)\outside.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\portals.cpp
+
+"$(INTDIR)\portals.obj"	"$(INTDIR)\portals.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\qbsp.cpp
+
+"$(INTDIR)\qbsp.obj"	"$(INTDIR)\qbsp.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\solidbsp.cpp
+
+"$(INTDIR)\solidbsp.obj"	"$(INTDIR)\solidbsp.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\surfaces.cpp
+
+"$(INTDIR)\surfaces.obj"	"$(INTDIR)\surfaces.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\tjunc.cpp
+
+"$(INTDIR)\tjunc.obj"	"$(INTDIR)\tjunc.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=..\common\winding.cpp
+
+"$(INTDIR)\winding.obj"	"$(INTDIR)\winding.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+
+!ENDIF 
+

+ 721 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/hlbsp.vcproj

@@ -0,0 +1,721 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="hlbsp"
+	ProjectGUID="{367AE0F7-CD4D-44E0-A2E2-34B9C6A3E51A}"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory=".\Debug"
+			IntermediateDirectory=".\Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\Debug/hlbsp.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\common,..\template"
+				PreprocessorDefinitions="DOUBLEVEC_T,_DEBUG,STDC_HEADERS,WIN32,_CONSOLE,SYSTEM_WIN32"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Debug/hlbsp.pch"
+				AssemblerListingLocation=".\Debug/"
+				ObjectFile=".\Debug/"
+				ProgramDataBaseFileName=".\Debug/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Debug/hlbsp.exe"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/hlbsp.pdb"
+				GenerateMapFile="true"
+				MapFileName=".\Debug/hlbsp.map"
+				SubSystem="1"
+				StackReserveSize="16777216"
+				StackCommitSize="1048576"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/hlbsp.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\common,..\template"
+				PreprocessorDefinitions="DOUBLEVEC_T,_DEBUG,STDC_HEADERS,WIN32,_CONSOLE,SYSTEM_WIN32"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Debug/hlbsp.pch"
+				AssemblerListingLocation=".\Debug/"
+				ObjectFile=".\Debug/"
+				ProgramDataBaseFileName=".\Debug/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Debug/hlbsp.exe"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/hlbsp.pdb"
+				GenerateMapFile="true"
+				MapFileName=".\Debug/hlbsp.map"
+				SubSystem="1"
+				StackReserveSize="16777216"
+				StackCommitSize="1048576"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory=".\Release"
+			IntermediateDirectory=".\Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			UseOfATL="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\Release/hlbsp.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="false"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				WholeProgramOptimization="true"
+				AdditionalIncludeDirectories="..\common,..\template"
+				PreprocessorDefinitions="NDEBUG,DOUBLEVEC_T,WIN32,_CONSOLE,SYSTEM_WIN32,STDC_HEADERS"
+				StringPooling="true"
+				ExceptionHandling="1"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="false"
+				EnableEnhancedInstructionSet="2"
+				FloatingPointModel="0"
+				RuntimeTypeInfo="false"
+				OpenMP="false"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Release/hlbsp.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Release/hlbsp.exe"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ProgramDatabaseFile=".\Release/hlbsp.pdb"
+				SubSystem="1"
+				StackReserveSize="4194304"
+				StackCommitSize="1048576"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="0"
+				LinkTimeCodeGeneration="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			UseOfATL="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/hlbsp.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="false"
+				Optimization="3"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				WholeProgramOptimization="true"
+				AdditionalIncludeDirectories="..\common,..\template"
+				PreprocessorDefinitions="NDEBUG,DOUBLEVEC_T,WIN32,_CONSOLE,SYSTEM_WIN32,STDC_HEADERS"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				EnableEnhancedInstructionSet="0"
+				FloatingPointModel="0"
+				RuntimeTypeInfo="false"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Release/hlbsp.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				Detect64BitPortabilityProblems="false"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Release/hlbsp.exe"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ProgramDatabaseFile=".\Release/hlbsp.pdb"
+				SubSystem="1"
+				StackReserveSize="4194304"
+				StackCommitSize="1048576"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release x64|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\Release/hlbsp.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="/machine:x64"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="D:\Programs\MSPlatformSDKServer2003\Include\atl;..\common;..\template"
+				PreprocessorDefinitions="NDEBUG,DOUBLEVEC_T,WIN32,_CONSOLE,SYSTEM_WIN32,STDC_HEADERS"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				EnableEnhancedInstructionSet="2"
+				FloatingPointModel="0"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Release/hlbsp.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				Detect64BitPortabilityProblems="false"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/machine:x64"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Release/hlbsp.exe"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ProgramDatabaseFile=".\Release/hlbsp.pdb"
+				SubSystem="1"
+				StackReserveSize="4194304"
+				StackCommitSize="1048576"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release x64|x64"
+			ConfigurationType="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+			>
+			<File
+				RelativePath=".\merge.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\outside.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\portals.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\qbsp.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\solidbsp.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\surfaces.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\tjunc.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\common\winding.cpp"
+				>
+			</File>
+			<Filter
+				Name="common"
+				>
+				<File
+					RelativePath="..\common\blockmem.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\bspfile.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\cmdlib.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\filelib.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\log.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\mathlib.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\messages.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\scriplib.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\threads.cpp"
+					>
+				</File>
+				<File
+					RelativePath=".\writebsp.cpp"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;fi;fd"
+			>
+			<File
+				RelativePath="..\common\blockmem.h"
+				>
+			</File>
+			<File
+				RelativePath=".\bsp5.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\bspfile.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\cmdlib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\filelib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\hlassert.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\log.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\mathlib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\mathtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\messages.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\scriplib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\threads.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\win32fix.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

+ 177 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/hlbsp.vcproj.SILENCERSPC.Administrator.user

@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+	ProjectType="Visual C++"
+	Version="9.00"
+	ShowAllFiles="false"
+	>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release x64|Win32"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release x64|x64"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+	</Configurations>
+</VisualStudioUserFile>

+ 48 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/make.inc

@@ -0,0 +1,48 @@
+HLBSP_DEFINES+=-D DOUBLEVEC_T
+HLBSP:=$(OUTDIR)/hlbsp$(EXEEXT)
+HLBSP_SRCDIR:=hlbsp
+HLBSP_OUTDIR:=$(HLBSP_SRCDIR)/$(OUTDIR)
+
+
+HLBSP_INPUT := \
+$(HLBSP_SRCDIR)/merge.cpp \
+$(HLBSP_SRCDIR)/outside.cpp \
+$(HLBSP_SRCDIR)/portals.cpp \
+$(HLBSP_SRCDIR)/qbsp.cpp \
+$(HLBSP_SRCDIR)/solidbsp.cpp \
+$(HLBSP_SRCDIR)/surfaces.cpp \
+$(HLBSP_SRCDIR)/tjunc.cpp \
+$(HLBSP_SRCDIR)/writebsp.cpp \
+$(COMMON_SRCDIR)/blockmem.cpp \
+$(COMMON_SRCDIR)/bspfile.cpp \
+$(COMMON_SRCDIR)/cmdlib.cpp \
+$(COMMON_SRCDIR)/filelib.cpp \
+$(COMMON_SRCDIR)/log.cpp \
+$(COMMON_SRCDIR)/mathlib.cpp \
+$(COMMON_SRCDIR)/messages.cpp \
+$(COMMON_SRCDIR)/scriplib.cpp \
+$(COMMON_SRCDIR)/threads.cpp \
+$(COMMON_SRCDIR)/winding.cpp \
+
+
+HLBSP_OUTPUT := \
+$(HLBSP_OUTDIR)/merge$(OBJEXT) \
+$(HLBSP_OUTDIR)/outside$(OBJEXT) \
+$(HLBSP_OUTDIR)/portals$(OBJEXT) \
+$(HLBSP_OUTDIR)/qbsp$(OBJEXT) \
+$(HLBSP_OUTDIR)/solidbsp$(OBJEXT) \
+$(HLBSP_OUTDIR)/surfaces$(OBJEXT) \
+$(HLBSP_OUTDIR)/tjunc$(OBJEXT) \
+$(HLBSP_OUTDIR)/writebsp$(OBJEXT) \
+$(HLBSP_OUTDIR)/blockmem$(OBJEXT) \
+$(HLBSP_OUTDIR)/bspfile$(OBJEXT) \
+$(HLBSP_OUTDIR)/cmdlib$(OBJEXT) \
+$(HLBSP_OUTDIR)/filelib$(OBJEXT) \
+$(HLBSP_OUTDIR)/log$(OBJEXT) \
+$(HLBSP_OUTDIR)/mathlib$(OBJEXT) \
+$(HLBSP_OUTDIR)/messages$(OBJEXT) \
+$(HLBSP_OUTDIR)/scriplib$(OBJEXT) \
+$(HLBSP_OUTDIR)/threads$(OBJEXT) \
+$(HLBSP_OUTDIR)/winding$(OBJEXT) \
+
+

+ 259 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/merge.cpp

@@ -0,0 +1,259 @@
+#include "bsp5.h"
+
+//  TryMerge
+//  MergeFaceToList
+//  FreeMergeListScraps
+//  MergePlaneFaces
+//  MergeAll
+
+#define CONTINUOUS_EPSILON	ON_EPSILON
+
+// =====================================================================================
+//  TryMerge
+//      If two polygons share a common edge and the edges that meet at the
+//      common points are both inside the other polygons, merge them
+//      Returns NULL if the faces couldn't be merged, or the new face.
+//      The originals will NOT be freed.
+// =====================================================================================
+static face_t*  TryMerge(face_t* f1, face_t* f2)
+{
+    vec_t*          p1;
+    vec_t*          p2;
+    vec_t*          p3;
+    vec_t*          p4;
+    vec_t*          back;
+    face_t*         newf;
+    int             i;
+    int             j;
+    int             k;
+    int             l;
+    vec3_t          normal;
+    vec3_t          delta;
+    vec3_t          planenormal;
+    vec_t           dot;
+    dplane_t*       plane;
+    bool            keep1;
+    bool            keep2;
+
+    if (f1->numpoints == -1 || f2->numpoints == -1)
+    {
+        return NULL;
+    }    
+    if (f1->texturenum != f2->texturenum)
+    {
+        return NULL;
+    }
+    if (f1->contents != f2->contents)
+    {
+        return NULL;
+    }
+
+    //
+    // find a common edge
+    //      
+    p1 = p2 = NULL;                                        // shut up the compiler
+    j = 0;
+
+    for (i = 0; i < f1->numpoints; i++)
+    {
+        p1 = f1->pts[i];
+        p2 = f1->pts[(i + 1) % f1->numpoints];
+        for (j = 0; j < f2->numpoints; j++)
+        {
+            p3 = f2->pts[j];
+            p4 = f2->pts[(j + 1) % f2->numpoints];
+            for (k = 0; k < 3; k++)
+            {
+                if (fabs(p1[k] - p4[k]) > EQUAL_EPSILON)
+                {
+                    break;
+                }
+                if (fabs(p2[k] - p3[k]) > EQUAL_EPSILON)
+                {
+                    break;
+                }
+            }
+            if (k == 3)
+            {
+                break;
+            }
+        }
+        if (j < f2->numpoints)
+        {
+            break;
+        }
+    }
+
+    if (i == f1->numpoints)
+    {
+        return NULL;                                       // no matching edges
+    }
+
+    //
+    // check slope of connected lines
+    // if the slopes are colinear, the point can be removed
+    //
+    plane = &g_dplanes[f1->planenum];
+    VectorCopy(plane->normal, planenormal);
+
+    back = f1->pts[(i + f1->numpoints - 1) % f1->numpoints];
+    VectorSubtract(p1, back, delta);
+    CrossProduct(planenormal, delta, normal);
+    VectorNormalize(normal);
+
+    back = f2->pts[(j + 2) % f2->numpoints];
+    VectorSubtract(back, p1, delta);
+    dot = DotProduct(delta, normal);
+    if (dot > CONTINUOUS_EPSILON)
+    {
+        return NULL;                                       // not a convex polygon
+    }
+    keep1 = dot < -CONTINUOUS_EPSILON;
+
+    back = f1->pts[(i + 2) % f1->numpoints];
+    VectorSubtract(back, p2, delta);
+    CrossProduct(planenormal, delta, normal);
+    VectorNormalize(normal);
+
+    back = f2->pts[(j + f2->numpoints - 1) % f2->numpoints];
+    VectorSubtract(back, p2, delta);
+    dot = DotProduct(delta, normal);
+    if (dot > CONTINUOUS_EPSILON)
+    {
+        return NULL;                                       // not a convex polygon
+    }
+    keep2 = dot < -CONTINUOUS_EPSILON;
+
+    //
+    // build the new polygon
+    //
+    if (f1->numpoints + f2->numpoints > MAXEDGES)
+    {
+        //              Error ("TryMerge: too many edges!");
+        return NULL;
+    }
+
+    newf = NewFaceFromFace(f1);
+
+    // copy first polygon
+    for (k = (i + 1) % f1->numpoints; k != i; k = (k + 1) % f1->numpoints)
+    {
+        if (k == (i + 1) % f1->numpoints && !keep2)
+        {
+            continue;
+        }
+
+        VectorCopy(f1->pts[k], newf->pts[newf->numpoints]);
+        newf->numpoints++;
+    }
+
+    // copy second polygon
+    for (l = (j + 1) % f2->numpoints; l != j; l = (l + 1) % f2->numpoints)
+    {
+        if (l == (j + 1) % f2->numpoints && !keep1)
+        {
+            continue;
+        }
+        VectorCopy(f2->pts[l], newf->pts[newf->numpoints]);
+        newf->numpoints++;
+    }
+
+    return newf;
+}
+
+// =====================================================================================
+//  MergeFaceToList
+// =====================================================================================
+static face_t*  MergeFaceToList(face_t* face, face_t* list)
+{
+    face_t*         newf;
+    face_t*         f;
+
+    for (f = list; f; f = f->next)
+    {
+        //CheckColinear (f);            
+        newf = TryMerge(face, f);
+        if (!newf)
+        {
+            continue;
+        }
+        FreeFace(face);
+        f->numpoints = -1;                                 // merged out
+        return MergeFaceToList(newf, list);
+    }
+
+    // didn't merge, so add at start
+    face->next = list;
+    return face;
+}
+
+// =====================================================================================
+//  FreeMergeListScraps
+// =====================================================================================
+static face_t*  FreeMergeListScraps(face_t* merged)
+{
+    face_t*         head;
+    face_t*         next;
+
+    head = NULL;
+    for (; merged; merged = next)
+    {
+        next = merged->next;
+        if (merged->numpoints == -1)
+        {
+            FreeFace(merged);
+        }
+        else
+        {
+            merged->next = head;
+            head = merged;
+        }
+    }
+
+    return head;
+}
+
+// =====================================================================================
+//  MergePlaneFaces
+// =====================================================================================
+void            MergePlaneFaces(surface_t* plane)
+{
+    face_t*         f1;
+    face_t*         next;
+    face_t*         merged;
+
+    merged = NULL;
+
+    for (f1 = plane->faces; f1; f1 = next)
+    {
+        next = f1->next;
+        merged = MergeFaceToList(f1, merged);
+    }
+
+    // chain all of the non-empty faces to the plane
+    plane->faces = FreeMergeListScraps(merged);
+}
+
+// =====================================================================================
+//  MergeAll
+// =====================================================================================
+void            MergeAll(surface_t* surfhead)
+{
+    surface_t*      surf;
+    int             mergefaces;
+    face_t*         f;
+
+    Verbose("---- MergeAll ----\n");
+
+    mergefaces = 0;
+    for (surf = surfhead; surf; surf = surf->next)
+    {
+        MergePlaneFaces(surf);
+        for (f = surf->faces; f; f = f->next)
+        {
+            mergefaces++;
+        }
+    }
+
+    Verbose("%i mergefaces\n", mergefaces);
+}

+ 553 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/outside.cpp

@@ -0,0 +1,553 @@
+#ifdef SYSTEM_WIN32
+#pragma warning(disable:4267 4996) // 'size_t' to 'unsigned int', possible loss of data
+#endif
+
+#include "bsp5.h"
+
+//  PointInLeaf
+//  PlaceOccupant
+//  MarkLeakTrail
+//  RecursiveFillOutside
+//  ClearOutFaces_r
+//  isClassnameAllowableOutside
+//  FreeAllowableOutsideList
+//  LoadAllowableOutsideList
+//  FillOutside
+
+static int      outleafs;
+static int      valid;
+static int      c_falsenodes;
+static int      c_free_faces;
+static int      c_keep_faces;
+
+// =====================================================================================
+//  PointInLeaf
+// =====================================================================================
+static node_t*  PointInLeaf(node_t* node, const vec3_t point)
+{
+    vec_t           d;
+
+    if (node->contents)
+    {
+        //Log("PointInLeaf::node->contents == %i\n", node->contents);
+        return node;
+    }
+
+    d = DotProduct(g_dplanes[node->planenum].normal, point) - g_dplanes[node->planenum].dist;
+
+    if (d > 0)
+        return PointInLeaf(node->children[0], point);
+
+    return PointInLeaf(node->children[1], point);
+}
+
+// =====================================================================================
+//  PlaceOccupant
+// =====================================================================================
+static bool     PlaceOccupant(const int num, const vec3_t point, node_t* headnode)
+{
+    node_t*         n;
+
+    n = PointInLeaf(headnode, point);
+    if (n->contents == CONTENTS_SOLID)
+    {
+        return false;
+    }
+    //Log("PlaceOccupant::n->contents == %i\n", n->contents);
+
+    n->occupied = num;
+    return true;
+}
+
+// =====================================================================================
+//  MarkLeakTrail
+// =====================================================================================
+static portal_t* prevleaknode;
+static FILE*    pointfile;
+static FILE*    linefile;
+
+static void     MarkLeakTrail(portal_t* n2)
+{
+    int             i;
+    vec3_t          p1, p2, dir;
+    float           len;
+    portal_t*       n1;
+
+    n1 = prevleaknode;
+    prevleaknode = n2;
+
+    if (!n1)
+    {
+        return;
+    }
+
+    n2->winding->getCenter(p1);
+    n1->winding->getCenter(p2);
+
+    // Linefile
+    fprintf(linefile, "%f %f %f - %f %f %f\n", p1[0], p1[1], p1[2], p2[0], p2[1], p2[2]);
+
+    // Pointfile
+    fprintf(pointfile, "%f %f %f\n", p1[0], p1[1], p1[2]);
+
+    VectorSubtract(p2, p1, dir);
+    len = VectorLength(dir);
+    VectorNormalize(dir);
+
+    while (len > 2)
+    {
+        fprintf(pointfile, "%f %f %f\n", p1[0], p1[1], p1[2]);
+        for (i = 0; i < 3; i++)
+            p1[i] += dir[i] * 2;
+        len -= 2;
+    }
+}
+
+// =====================================================================================
+//  RecursiveFillOutside
+//      Returns true if an occupied leaf is reached
+//      If fill is false, just check, don't fill 
+// =====================================================================================
+static int      hit_occupied;
+static int      backdraw;
+static bool     RecursiveFillOutside(node_t* l, const bool fill)
+{
+    portal_t*       p;
+    int             s;
+
+    if ((l->contents == CONTENTS_SOLID) || (l->contents == CONTENTS_SKY) 
+#ifdef ZHLT_DETAIL
+        || (l->contents == CONTENTS_DETAIL)
+#endif
+        )
+	{
+        /*if (l->contents != CONTENTS_SOLID)
+            Log("RecursiveFillOutside::l->contents == %i \n", l->contents);*/
+
+        return false;
+    }
+
+    if (l->valid == valid)
+    {
+        return false;
+    }
+
+    if (l->occupied)
+    {
+        hit_occupied = l->occupied;
+        backdraw = 1000;
+        return true;
+    }
+
+    l->valid = valid;
+
+    // fill it and it's neighbors
+    if (fill)
+    {
+        l->contents = CONTENTS_SOLID;
+        l->planenum = -1;
+    }
+    outleafs++;
+
+    for (p = l->portals; p;)
+    {
+        s = (p->nodes[0] == l);
+
+        if (RecursiveFillOutside(p->nodes[s], fill))
+        {                                                  // leaked, so stop filling
+            if (backdraw-- > 0)
+            {
+                MarkLeakTrail(p);
+            }
+            return true;
+        }
+        p = p->next[!s];
+    }
+
+    return false;
+}
+
+// =====================================================================================
+//  ClearOutFaces_r
+//      Removes unused nodes
+// =====================================================================================
+static node_t*  ClearOutFaces_r(node_t* node)
+{
+    face_t*         f;
+    face_t*         fnext;
+    face_t**        fp;
+    portal_t*       p;
+
+    // mark the node and all it's faces, so they
+    // can be removed if no children use them
+
+    node->valid = 0;                                       // will be set if any children touch it
+    for (f = node->faces; f; f = f->next)
+    {
+        f->outputnumber = -1;
+    }
+
+    // go down the children
+    if (node->planenum != -1)
+    {
+        //
+        // decision node
+        //
+        node->children[0] = ClearOutFaces_r(node->children[0]);
+        node->children[1] = ClearOutFaces_r(node->children[1]);
+
+        // free any faces not in open child leafs
+        f = node->faces;
+        node->faces = NULL;
+
+        for (; f; f = fnext)
+        {
+            fnext = f->next;
+            if (f->outputnumber == -1)
+            {                                              // never referenced, so free it
+                c_free_faces++;
+                FreeFace(f);
+            }
+            else
+            {
+                c_keep_faces++;
+                f->next = node->faces;
+                node->faces = f;
+            }
+        }
+
+        if (!node->valid)
+        {
+            // this node does not touch any interior leafs
+
+            // if both children are solid, just make this node solid
+            if (node->children[0]->contents == CONTENTS_SOLID && node->children[1]->contents == CONTENTS_SOLID)
+            {
+                node->contents = CONTENTS_SOLID;
+                node->planenum = -1;
+                return node;
+            }
+
+            // if one child is solid, shortcut down the other side
+            if (node->children[0]->contents == CONTENTS_SOLID)
+            {
+                return node->children[1];
+            }
+            if (node->children[1]->contents == CONTENTS_SOLID)
+            {
+                return node->children[0];
+            }
+
+            c_falsenodes++;
+        }
+        return node;
+    }
+
+    //
+    // leaf node
+    //
+    if (node->contents != CONTENTS_SOLID)
+    {
+        // this node is still inside
+
+        // mark all the nodes used as portals
+        for (p = node->portals; p;)
+        {
+            if (p->onnode)
+            {
+                p->onnode->valid = 1;
+            }
+            if (p->nodes[0] == node)                       // only write out from first leaf
+            {
+                p = p->next[0];
+            }
+            else
+            {
+                p = p->next[1];
+            }
+        }
+
+        // mark all of the faces to be drawn
+        for (fp = node->markfaces; *fp; fp++)
+        {
+            (*fp)->outputnumber = 0;
+        }
+
+        return node;
+    }
+
+    // this was a filled in node, so free the markfaces
+    if (node->planenum != -1)
+    {
+        free(node->markfaces);
+    }
+
+    return node;
+}
+
+// =====================================================================================
+//  isClassnameAllowableOutside
+// =====================================================================================
+#define  MAX_ALLOWABLE_OUTSIDE_GROWTH_SIZE 64
+
+unsigned        g_nAllowableOutside = 0;
+unsigned        g_maxAllowableOutside = 0;
+char**          g_strAllowableOutsideList;
+
+bool            isClassnameAllowableOutside(const char* const classname)
+{
+    if (g_strAllowableOutsideList)
+    {
+        unsigned        x;
+        char**          list = g_strAllowableOutsideList;
+
+        for (x = 0; x < g_nAllowableOutside; x++, list++)
+        {
+            if (list)
+            {
+                if (!strcasecmp(classname, *list))
+                {
+                    return true;
+                }
+            }
+        }
+    }
+
+    return false;
+}
+
+// =====================================================================================
+//  FreeAllowableOutsideList
+// =====================================================================================
+void            FreeAllowableOutsideList()
+{
+    if (g_strAllowableOutsideList)
+    {
+        free(g_strAllowableOutsideList);
+        g_strAllowableOutsideList = NULL;
+    }
+}
+
+// =====================================================================================
+//  LoadAllowableOutsideList
+// =====================================================================================
+void            LoadAllowableOutsideList(const char* const filename)
+{
+    char*           fname;
+    int             i, x, y;
+    char*           pData;
+    char*           pszData;
+
+    if (!filename)
+    {
+        return;
+    }
+    else
+    {
+        unsigned        len = strlen(filename) + 5;
+
+        fname = (char*)Alloc(len);
+        safe_snprintf(fname, len, "%s", filename);
+    }
+
+    if (q_exists(fname))
+    {
+        if ((i = LoadFile(fname, &pData)))
+        {
+            Log("Reading allowable void entities from file '%s'\n", fname);
+            g_nAllowableOutside = 0;
+            for (pszData = pData, y = 0, x = 0; x < i; x++)
+            {
+                if ((pData[x] == '\n') || (pData[x] == '\r'))
+                {
+                    pData[x] = 0;
+                    if (strlen(pszData))
+                    {
+                        if (g_nAllowableOutside == g_maxAllowableOutside)
+                        {
+                            g_maxAllowableOutside += MAX_ALLOWABLE_OUTSIDE_GROWTH_SIZE;
+                            g_strAllowableOutsideList =
+
+                                (char**)realloc(g_strAllowableOutsideList, sizeof(char*) * g_maxAllowableOutside);
+                        }
+
+                        g_strAllowableOutsideList[y++] = pszData;
+                        g_nAllowableOutside++;
+
+                        Verbose("Adding entity '%s' to the allowable void list\n", pszData);
+                    }
+                    pszData = pData + x + 1;
+                }
+            }
+        }
+    }
+}
+
+// =====================================================================================
+//  FillOutside
+// =====================================================================================
+node_t*         FillOutside(node_t* node, const bool leakfile, const unsigned hullnum)
+{
+    int             s;
+    int             i;
+    bool            inside;
+    bool            ret;
+    vec3_t          origin;
+    const char*     cl;
+
+    Verbose("----- FillOutside ----\n");
+
+    if (g_nofill)
+    {
+        Log("skipped\n");
+        return node;
+    }
+
+    //
+    // place markers for all entities so
+    // we know if we leak inside
+    //
+    inside = false;
+    for (i = 1; i < g_numentities; i++)
+    {
+        GetVectorForKey(&g_entities[i], "origin", origin);
+        cl = ValueForKey(&g_entities[i], "classname");
+        if (!isClassnameAllowableOutside(cl))
+        {
+            if (!VectorCompare(origin, vec3_origin))
+            {
+                origin[2] += 1;                            // so objects on floor are ok
+
+                // nudge playerstart around if needed so clipping hulls allways
+                // have a vlaid point
+                if (!strcmp(cl, "info_player_start"))
+                {
+                    int             x, y;
+
+                    for (x = -16; x <= 16; x += 16)
+                    {
+                        for (y = -16; y <= 16; y += 16)
+                        {
+                            origin[0] += x;
+                            origin[1] += y;
+                            if (PlaceOccupant(i, origin, node))
+                            {
+                                inside = true;
+                                goto gotit;
+                            }
+                            origin[0] -= x;
+                            origin[1] -= y;
+                        }
+                    }
+                  gotit:;
+                }
+                else
+                {
+                    if (PlaceOccupant(i, origin, node))
+                        inside = true;
+                }
+            }
+        }
+    }
+
+    if (!inside)
+    {
+        Warning("No entities exist in hull %i, no filling performed for this hull", hullnum);
+        return node;
+    }
+
+	if(!g_outside_node.portals)
+	{
+		Warning("No outside node portal found in hull %i, no filling performed for this hull",hullnum);
+		return node;
+	}
+
+    s = !(g_outside_node.portals->nodes[1] == &g_outside_node);
+
+    // first check to see if an occupied leaf is hit
+    outleafs = 0;
+    valid++;
+
+    prevleaknode = NULL;
+
+    if (leakfile)
+    {
+        pointfile = fopen(g_pointfilename, "w");
+        if (!pointfile)
+        {
+            Error("Couldn't open pointfile %s\n", g_pointfilename);
+        }
+
+        linefile = fopen(g_linefilename, "w");
+        if (!linefile)
+        {
+            Error("Couldn't open linefile %s\n", g_linefilename);
+        }
+    }
+
+    ret = RecursiveFillOutside(g_outside_node.portals->nodes[s], false);
+
+    if (leakfile)
+    {
+        fclose(pointfile);
+        fclose(linefile);
+    }
+
+    if (ret)
+    {
+        GetVectorForKey(&g_entities[hit_occupied], "origin", origin);
+
+
+        {
+            Warning("=== LEAK in hull %i ===\nEntity %s @ (%4.0f,%4.0f,%4.0f)",
+                 hullnum, ValueForKey(&g_entities[hit_occupied], "classname"), origin[0], origin[1], origin[2]);
+            PrintOnce(
+                "\n  A LEAK is a hole in the map, where the inside of it is exposed to the\n"
+                "(unwanted) outside region.  The entity listed in the error is just a helpful\n"
+                "indication of where the beginning of the leak pointfile starts, so the\n"
+                "beginning of the line can be quickly found and traced to until reaching the\n"
+                "outside. Unless this entity is accidentally on the outside of the map, it\n"
+                "probably should not be deleted.  Some complex rotating objects entities need\n"
+                "their origins outside the map.  To deal with these, just enclose the origin\n"
+                "brush with a solid world brush\n");
+        }
+
+        if (!g_bLeaked)
+        {
+            // First leak spits this out
+            Log("Leak pointfile generated\n\n");
+        }
+
+        if (g_bLeakOnly)
+        {
+            Error("Stopped by leak.");
+        }
+
+        g_bLeaked = true;
+            
+        return node;
+    }
+
+    // now go back and fill things in
+    valid++;
+    RecursiveFillOutside(g_outside_node.portals->nodes[s], true);
+
+    // remove faces and nodes from filled in leafs  
+    c_falsenodes = 0;
+    c_free_faces = 0;
+    c_keep_faces = 0;
+    node = ClearOutFaces_r(node);
+
+    Verbose("%5i outleafs\n", outleafs);
+    Verbose("%5i freed faces\n", c_free_faces);
+    Verbose("%5i keep faces\n", c_keep_faces);
+    Verbose("%5i falsenodes\n", c_falsenodes);
+
+    // save portal file for vis tracing
+    if ((hullnum == 0) && leakfile)
+    {
+        WritePortalfile(node);
+    }
+
+    return node;
+}

+ 325 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/portals.cpp

@@ -0,0 +1,325 @@
+#ifdef SYSTEM_WIN32
+#pragma warning(disable:4996)
+#endif
+
+#pragma warning(disable:4018) // '<' : signed/unsigned mismatch
+
+#include "bsp5.h"
+
+node_t          g_outside_node;                            // portals outside the world face this
+
+//=============================================================================
+
+/*
+ * =============
+ * AddPortalToNodes
+ * =============
+ */
+void            AddPortalToNodes(portal_t* p, node_t* front, node_t* back)
+{
+    if (p->nodes[0] || p->nodes[1])
+    {
+        Error("AddPortalToNode: allready included");
+    }
+
+    p->nodes[0] = front;
+    p->next[0] = front->portals;
+    front->portals = p;
+
+    p->nodes[1] = back;
+    p->next[1] = back->portals;
+    back->portals = p;
+}
+
+/*
+ * =============
+ * RemovePortalFromNode
+ * =============
+ */
+void            RemovePortalFromNode(portal_t* portal, node_t* l)
+{
+    portal_t**      pp;
+    portal_t*       t;
+
+    // remove reference to the current portal
+    pp = &l->portals;
+    while (1)
+    {
+        t = *pp;
+        if (!t)
+        {
+            Error("RemovePortalFromNode: portal not in leaf");
+        }
+
+        if (t == portal)
+        {
+            break;
+        }
+
+        if (t->nodes[0] == l)
+        {
+            pp = &t->next[0];
+        }
+        else if (t->nodes[1] == l)
+        {
+            pp = &t->next[1];
+        }
+        else
+        {
+            Error("RemovePortalFromNode: portal not bounding leaf");
+        }
+    }
+
+    if (portal->nodes[0] == l)
+    {
+        *pp = portal->next[0];
+        portal->nodes[0] = NULL;
+    }
+    else if (portal->nodes[1] == l)
+    {
+        *pp = portal->next[1];
+        portal->nodes[1] = NULL;
+    }
+}
+
+//============================================================================
+
+/*
+ * ================
+ * MakeHeadnodePortals
+ * 
+ * The created portals will face the global g_outside_node
+ * ================
+ */
+void            MakeHeadnodePortals(node_t* node, const vec3_t mins, const vec3_t maxs)
+{
+    vec3_t          bounds[2];
+    int             i, j, n;
+    portal_t*       p;
+    portal_t*       portals[6];
+    dplane_t        bplanes[6];
+    dplane_t*       pl;
+
+    // pad with some space so there will never be null volume leafs
+    for (i = 0; i < 3; i++)
+    {
+        bounds[0][i] = mins[i] - SIDESPACE;
+        bounds[1][i] = maxs[i] + SIDESPACE;
+    }
+
+    g_outside_node.contents = CONTENTS_SOLID;
+    g_outside_node.portals = NULL;
+
+    for (i = 0; i < 3; i++)
+    {
+        for (j = 0; j < 2; j++)
+        {
+            n = j * 3 + i;
+
+            p = AllocPortal();
+            portals[n] = p;
+
+            pl = &bplanes[n];
+            memset(pl, 0, sizeof(*pl));
+            if (j)
+            {
+                pl->normal[i] = -1;
+                pl->dist = -bounds[j][i];
+            }
+            else
+            {
+                pl->normal[i] = 1;
+                pl->dist = bounds[j][i];
+            }
+            p->plane = *pl;
+            p->winding = new Winding(*pl);
+            AddPortalToNodes(p, node, &g_outside_node);
+        }
+    }
+
+    // clip the basewindings by all the other planes
+    for (i = 0; i < 6; i++)
+    {
+        for (j = 0; j < 6; j++)
+        {
+            if (j == i)
+            {
+                continue;
+            }
+            portals[i]->winding->Clip(bplanes[j], true);
+        }
+    }
+}
+
+/*
+ * ==============================================================================
+ * 
+ * PORTAL FILE GENERATION
+ * 
+ * ==============================================================================
+ */
+
+static FILE*    pf;
+static int      num_visleafs;                              // leafs the player can be in
+static int      num_visportals;
+
+static void     WritePortalFile_r(const node_t* const node)
+{
+    int             i;
+    portal_t*       p;
+    Winding*        w;
+    dplane_t        plane2;
+
+    if (!node->contents)
+    {
+        WritePortalFile_r(node->children[0]);
+        WritePortalFile_r(node->children[1]);
+        return;
+    }
+
+    if (node->contents == CONTENTS_SOLID)
+    {
+        return;
+    }
+
+    for (p = node->portals; p;)
+    {
+        w = p->winding;
+        if (w && p->nodes[0] == node)
+        {
+            if (p->nodes[0]->contents == p->nodes[1]->contents)
+            {
+                // write out to the file
+
+                // sometimes planes get turned around when they are very near
+                // the changeover point between different axis.  interpret the
+                // plane the same way vis will, and flip the side orders if needed
+                w->getPlane(plane2);
+                if (DotProduct(p->plane.normal, plane2.normal) < 1.0 - ON_EPSILON)
+                {                                          // backwards...
+                    fprintf(pf, "%u %i %i ", w->m_NumPoints, p->nodes[1]->visleafnum, p->nodes[0]->visleafnum);
+                }
+                else
+                {
+                    fprintf(pf, "%u %i %i ", w->m_NumPoints, p->nodes[0]->visleafnum, p->nodes[1]->visleafnum);
+                }
+
+                for (i = 0; i < w->m_NumPoints; i++)
+                {
+                    fprintf(pf, "(%f %f %f) ", w->m_Points[i][0], w->m_Points[i][1], w->m_Points[i][2]);
+                }
+                fprintf(pf, "\n");
+            }
+        }
+
+        if (p->nodes[0] == node)
+        {
+            p = p->next[0];
+        }
+        else
+        {
+            p = p->next[1];
+        }
+    }
+
+}
+
+/*
+ * ================
+ * NumberLeafs_r
+ * ================
+ */
+static void     NumberLeafs_r(node_t* node)
+{
+    portal_t*       p;
+
+    if (!node->contents)
+    {                                                      // decision node
+        node->visleafnum = -99;
+        NumberLeafs_r(node->children[0]);
+        NumberLeafs_r(node->children[1]);
+        return;
+    }
+
+    if (node->contents == CONTENTS_SOLID)
+    {                                                      // solid block, viewpoint never inside
+        node->visleafnum = -1;
+        return;
+    }
+
+    node->visleafnum = num_visleafs++;
+
+    for (p = node->portals; p;)
+    {
+        if (p->nodes[0] == node)                           // only write out from first leaf
+        {
+            if (p->nodes[0]->contents == p->nodes[1]->contents)
+            {
+                num_visportals++;
+            }
+            p = p->next[0];
+        }
+        else
+        {
+            p = p->next[1];
+        }
+    }
+}
+
+/*
+ * ================
+ * WritePortalfile
+ * ================
+ */
+void            WritePortalfile(node_t* headnode)
+{
+    // set the visleafnum field in every leaf and count the total number of portals
+    num_visleafs = 0;
+    num_visportals = 0;
+    NumberLeafs_r(headnode);
+
+    // write the file
+    pf = fopen(g_portfilename, "w");
+    if (!pf)
+    {
+        Error("Error writing portal file %s", g_portfilename);
+    }
+
+    fprintf(pf, "%i\n", num_visleafs);
+    fprintf(pf, "%i\n", num_visportals);
+
+    WritePortalFile_r(headnode);
+    fclose(pf);
+    Log("BSP generation successful, writing portal file '%s'\n", g_portfilename);
+}
+
+//===================================================
+
+void            FreePortals(node_t* node)
+{
+    portal_t*       p;
+    portal_t*       nextp;
+
+    if (node->planenum != -1)
+    {
+        FreePortals(node->children[0]);
+        FreePortals(node->children[1]);
+        return;
+    }
+
+    for (p = node->portals; p; p = nextp)
+    {
+        if (p->nodes[0] == node)
+        {
+            nextp = p->next[0];
+        }
+        else
+        {
+            nextp = p->next[1];
+        }
+        RemovePortalFromNode(p, p->nodes[0]);
+        RemovePortalFromNode(p, p->nodes[1]);
+        delete p->winding;
+        FreePortal(p);
+    }
+}

File diff suppressed because it is too large
+ 1533 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/qbsp.cpp


File diff suppressed because it is too large
+ 1164 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/solidbsp.cpp


+ 309 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/surfaces.cpp

@@ -0,0 +1,309 @@
+#include "bsp5.h"
+
+//  SubdivideFace
+
+//  InitHash
+//  HashVec
+
+//  GetVertex
+//  GetEdge
+//  MakeFaceEdges
+
+static int      subdivides;
+
+/* a surface has all of the faces that could be drawn on a given plane
+   the outside filling stage can remove some of them so a better bsp can be generated */
+
+// =====================================================================================
+//  SubdivideFace
+//      If the face is >256 in either texture direction, carve a valid sized
+//      piece off and insert the remainder in the next link
+// =====================================================================================
+void            SubdivideFace(face_t* f, face_t** prevptr)
+{
+    vec_t           mins, maxs;
+    vec_t           v;
+    int             axis;
+    int             i;
+    dplane_t        plane;
+    face_t*         front;
+    face_t*         back;
+    face_t*         next;
+    texinfo_t*      tex;
+    vec3_t          temp;
+
+    // special (non-surface cached) faces don't need subdivision
+
+    tex = &g_texinfo[f->texturenum];
+
+    if (tex->flags & TEX_SPECIAL) 
+    {
+        return;
+    }
+
+    if (f->facestyle == face_hint)
+    {
+        return;
+    }
+    if (f->facestyle == face_skip)
+    {
+        return;
+    }
+
+#ifdef ZHLT_NULLTEX    // AJM
+    if (f->facestyle == face_null)
+        return; // ideally these should have their tex_special flag set, so its here jic
+#endif
+
+	//SILENCER: Not yet implemented - just altered copypasta here
+	/*if (f->facestyle == face_blocklight)
+		return;*/
+
+    for (axis = 0; axis < 2; axis++)
+    {
+        while (1)
+        {
+            mins = 999999;
+            maxs = -999999;
+
+            for (i = 0; i < f->numpoints; i++)
+            {
+                v = DotProduct(f->pts[i], tex->vecs[axis]);
+                if (v < mins)
+                {
+                    mins = v;
+                }
+                if (v > maxs)
+                {
+                    maxs = v;
+                }
+            }
+
+            if ((maxs - mins) <= g_subdivide_size)
+            {
+                break;
+            }
+                
+            // split it
+            subdivides++;
+
+            VectorCopy(tex->vecs[axis], temp);
+            v = VectorNormalize(temp);
+
+            VectorCopy(temp, plane.normal);
+            plane.dist = (mins + g_subdivide_size - 16) / v;
+            next = f->next;
+            SplitFace(f, &plane, &front, &back);
+            if (!front || !back)
+            {
+                Developer(DEVELOPER_LEVEL_SPAM, "SubdivideFace: didn't split the %d-sided polygon @(%.0f,%.0f,%.0f)",
+                        f->numpoints, f->pts[0][0], f->pts[0][1], f->pts[0][2]);
+                break;
+            }
+            *prevptr = back;
+            back->next = front;
+            front->next = next;
+            f = back;
+        }
+    }
+}
+
+//===========================================================================
+
+typedef struct hashvert_s
+{
+    struct hashvert_s* next;
+    vec3_t          point;
+    int             num;
+    int             numplanes;                             // for corner determination
+    int             planenums[2];
+    int             numedges;
+}
+hashvert_t;
+
+// #define      POINT_EPSILON   0.01
+#define POINT_EPSILON	ON_EPSILON
+
+static hashvert_t hvertex[MAX_MAP_VERTS];
+static hashvert_t* hvert_p;
+
+static face_t*  edgefaces[MAX_MAP_EDGES][2];
+static int      firstmodeledge = 1;
+static int      firstmodelface;
+
+//============================================================================
+
+#define	NUM_HASH	4096
+
+static hashvert_t* hashverts[NUM_HASH];
+
+static vec3_t   hash_min;
+static vec3_t   hash_scale;
+
+// =====================================================================================
+//  InitHash
+// =====================================================================================
+static void     InitHash()
+{
+    vec3_t          size;
+    vec_t           volume;
+    vec_t           scale;
+    int             newsize[2];
+    int             i;
+
+    memset(hashverts, 0, sizeof(hashverts));
+
+    for (i = 0; i < 3; i++)
+    {
+        hash_min[i] = -8000;
+        size[i] = 16000;
+    }
+
+    volume = size[0] * size[1];
+
+    scale = sqrt(volume / NUM_HASH);
+
+    newsize[0] = size[0] / scale;
+    newsize[1] = size[1] / scale;
+
+    hash_scale[0] = newsize[0] / size[0];
+    hash_scale[1] = newsize[1] / size[1];
+    hash_scale[2] = newsize[1];
+
+    hvert_p = hvertex;
+}
+
+// =====================================================================================
+//  HashVec
+// =====================================================================================
+static unsigned HashVec(const vec3_t vec)
+{
+    unsigned        h;
+
+    h = hash_scale[0] * (vec[0] - hash_min[0]) * hash_scale[2] + hash_scale[1] * (vec[1] - hash_min[1]);
+    if (h >= NUM_HASH)
+    {
+        return NUM_HASH - 1;
+    }
+    return h;
+}
+
+// =====================================================================================
+//  GetVertex
+// =====================================================================================
+static int      GetVertex(const vec3_t in, const int planenum)
+{
+    int             h;
+    int             i;
+    hashvert_t*     hv;
+    vec3_t          vert;
+
+    for (i = 0; i < 3; i++)
+    {
+        if (fabs(in[i] - VectorRound(in[i])) < 0.001)
+        {
+            vert[i] = VectorRound(in[i]);
+        }
+        else
+        {
+            vert[i] = in[i];
+        }
+    }
+
+    h = HashVec(vert);
+
+    for (hv = hashverts[h]; hv; hv = hv->next)
+    {
+        if (fabs(hv->point[0] - vert[0]) < POINT_EPSILON
+            && fabs(hv->point[1] - vert[1]) < POINT_EPSILON && fabs(hv->point[2] - vert[2]) < POINT_EPSILON)
+        {
+            hv->numedges++;
+            if (hv->numplanes == 3)
+            {
+                return hv->num;                            // allready known to be a corner
+            }
+            for (i = 0; i < hv->numplanes; i++)
+            {
+                if (hv->planenums[i] == planenum)
+                {
+                    return hv->num;                        // allready know this plane
+                }
+            }
+            if (hv->numplanes != 2)
+            {
+                hv->planenums[hv->numplanes] = planenum;
+            }
+            hv->numplanes++;
+            return hv->num;
+        }
+    }
+
+    hv = hvert_p;
+    hv->numedges = 1;
+    hv->numplanes = 1;
+    hv->planenums[0] = planenum;
+    hv->next = hashverts[h];
+    hashverts[h] = hv;
+    VectorCopy(vert, hv->point);
+    hv->num = g_numvertexes;
+    hlassume(hv->num != MAX_MAP_VERTS, assume_MAX_MAP_VERTS);
+    hvert_p++;
+
+    // emit a vertex
+    hlassume(g_numvertexes < MAX_MAP_VERTS, assume_MAX_MAP_VERTS);
+
+    g_dvertexes[g_numvertexes].point[0] = vert[0];
+    g_dvertexes[g_numvertexes].point[1] = vert[1];
+    g_dvertexes[g_numvertexes].point[2] = vert[2];
+    g_numvertexes++;
+
+    return hv->num;
+}
+
+//===========================================================================
+
+// =====================================================================================
+//  GetEdge
+//      Don't allow four way edges
+// =====================================================================================
+int             GetEdge(const vec3_t p1, const vec3_t p2, face_t* f)
+{
+    int             v1;
+    int             v2;
+    dedge_t*        edge;
+    int             i;
+
+    hlassert(f->contents);
+
+    v1 = GetVertex(p1, f->planenum);
+    v2 = GetVertex(p2, f->planenum);
+    for (i = firstmodeledge; i < g_numedges; i++)
+    {
+        edge = &g_dedges[i];
+        if (v1 == edge->v[1] && v2 == edge->v[0] && !edgefaces[i][1] && edgefaces[i][0]->contents == f->contents)
+        {
+            edgefaces[i][1] = f;
+            return -i;
+        }
+    }
+
+    // emit an edge
+    hlassume(g_numedges < MAX_MAP_EDGES, assume_MAX_MAP_EDGES);
+    edge = &g_dedges[g_numedges];
+    g_numedges++;
+    edge->v[0] = v1;
+    edge->v[1] = v2;
+    edgefaces[i][0] = f;
+
+    return i;
+}
+
+// =====================================================================================
+//  MakeFaceEdges
+// =====================================================================================
+void            MakeFaceEdges()
+{
+    InitHash();
+    firstmodeledge = g_numedges;
+    firstmodelface = g_numfaces;
+}

+ 558 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/tjunc.cpp

@@ -0,0 +1,558 @@
+#include "bsp5.h"
+
+typedef struct wvert_s
+{
+    vec_t           t;
+    struct wvert_s* prev;
+    struct wvert_s* next;
+}
+wvert_t;
+
+typedef struct wedge_s
+{
+    struct wedge_s* next;
+    vec3_t          dir;
+    vec3_t          origin;
+    wvert_t         head;
+}
+wedge_t;
+
+static int      numwedges;
+static int      numwverts;
+static int      tjuncs;
+static int      tjuncfaces;
+
+#define MAX_WVERTS   0x40000
+#define MAX_WEDGES   0x20000
+
+static wvert_t  wverts[MAX_WVERTS];
+static wedge_t  wedges[MAX_WEDGES];
+
+//============================================================================
+
+#define	NUM_HASH	1024
+
+wedge_t*        wedge_hash[NUM_HASH];
+
+static vec3_t   hash_min;
+static vec3_t   hash_scale;
+
+static void     InitHash(const vec3_t mins, const vec3_t maxs)
+{
+    vec3_t          size;
+    vec_t           volume;
+    vec_t           scale;
+    int             newsize[2];
+
+    VectorCopy(mins, hash_min);
+    VectorSubtract(maxs, mins, size);
+    memset(wedge_hash, 0, sizeof(wedge_hash));
+
+    volume = size[0] * size[1];
+
+    scale = sqrt(volume / NUM_HASH);
+
+    newsize[0] = size[0] / scale;
+    newsize[1] = size[1] / scale;
+
+    hash_scale[0] = newsize[0] / size[0];
+    hash_scale[1] = newsize[1] / size[1];
+    hash_scale[2] = newsize[1];
+}
+
+static unsigned HashVec(const vec3_t vec)
+{
+    unsigned        h;
+
+    h = hash_scale[0] * (vec[0] - hash_min[0]) * hash_scale[2] + hash_scale[1] * (vec[1] - hash_min[1]);
+    if (h >= NUM_HASH)
+    {
+        return NUM_HASH - 1;
+    }
+    return h;
+}
+
+//============================================================================
+
+static bool     CanonicalVector(vec3_t vec)
+{
+    if (VectorNormalize(vec))
+    {
+        if (vec[0] > NORMAL_EPSILON )
+        {
+            return true;
+        }
+        else if (vec[0] < -NORMAL_EPSILON )
+        {
+            VectorSubtract(vec3_origin, vec, vec);
+            return true;
+        }
+        else
+        {
+            vec[0] = 0;
+        }
+    
+        if (vec[1] > NORMAL_EPSILON )
+        {
+            return true;
+        }
+        else if (vec[1] < -NORMAL_EPSILON )
+        {
+            VectorSubtract(vec3_origin, vec, vec);
+            return true;
+        }
+        else
+        {
+            vec[1] = 0;
+        }
+
+        if (vec[2] > NORMAL_EPSILON )
+        {
+            return true;
+        }
+        else if (vec[2] < -NORMAL_EPSILON )
+        {
+            VectorSubtract(vec3_origin, vec, vec);
+            return true;
+        }
+        else
+        {
+            vec[2] = 0;
+        }
+//        hlassert(false);
+        return false;
+    }
+//    hlassert(false);
+    return false;
+}
+
+static wedge_t *FindEdge(const vec3_t p1, const vec3_t p2, vec_t* t1, vec_t* t2)
+{
+    vec3_t          origin;
+    vec3_t          dir;
+    wedge_t*        w;
+    vec_t           temp;
+    int             h;
+
+    VectorSubtract(p2, p1, dir);
+    if (!CanonicalVector(dir))
+    {
+#if _DEBUG
+        Warning("CanonicalVector: degenerate @ (%4.3f %4.3f %4.3f )\n", p1[0], p1[1], p1[2]);
+#endif
+    }
+
+    *t1 = DotProduct(p1, dir);
+    *t2 = DotProduct(p2, dir);
+
+    VectorMA(p1, -*t1, dir, origin);
+
+    if (*t1 > *t2)
+    {
+        temp = *t1;
+        *t1 = *t2;
+        *t2 = temp;
+    }
+
+    h = HashVec(origin);
+
+    for (w = wedge_hash[h]; w; w = w->next)
+    {
+        temp = w->origin[0] - origin[0];
+        if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON)
+        {
+            continue;
+        }
+        temp = w->origin[1] - origin[1];
+        if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON)
+        {
+            continue;
+        }
+        temp = w->origin[2] - origin[2];
+        if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON)
+        {
+            continue;
+        }
+
+        temp = w->dir[0] - dir[0];
+        if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON)
+        {
+            continue;
+        }
+        temp = w->dir[1] - dir[1];
+        if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON)
+        {
+            continue;
+        }
+        temp = w->dir[2] - dir[2];
+        if (temp < -EQUAL_EPSILON || temp > EQUAL_EPSILON)
+        {
+            continue;
+        }
+
+        return w;
+    }
+
+    hlassume(numwedges < MAX_WEDGES, assume_MAX_WEDGES);
+    w = &wedges[numwedges];
+    numwedges++;
+
+    w->next = wedge_hash[h];
+    wedge_hash[h] = w;
+
+    VectorCopy(origin, w->origin);
+    VectorCopy(dir, w->dir);
+    w->head.next = w->head.prev = &w->head;
+    w->head.t = 99999;
+    return w;
+}
+
+/*
+ * ===============
+ * AddVert
+ * 
+ * ===============
+ */
+#define T_EPSILON	ON_EPSILON
+
+static void     AddVert(const wedge_t* const w, const vec_t t)
+{
+    wvert_t*        v;
+    wvert_t*        newv;
+
+    v = w->head.next;
+    do
+    {
+        if (fabs(v->t - t) < T_EPSILON)
+        {
+            return;
+        }
+        if (v->t > t)
+        {
+            break;
+        }
+        v = v->next;
+    }
+    while (1);
+
+    // insert a new wvert before v
+    hlassume(numwverts < MAX_WVERTS, assume_MAX_WVERTS);
+
+    newv = &wverts[numwverts];
+    numwverts++;
+
+    newv->t = t;
+    newv->next = v;
+    newv->prev = v->prev;
+    v->prev->next = newv;
+    v->prev = newv;
+}
+
+/*
+ * ===============
+ * AddEdge
+ * ===============
+ */
+static void     AddEdge(const vec3_t p1, const vec3_t p2)
+{
+    wedge_t*        w;
+    vec_t           t1;
+    vec_t           t2;
+
+    w = FindEdge(p1, p2, &t1, &t2);
+    AddVert(w, t1);
+    AddVert(w, t2);
+}
+
+/*
+ * ===============
+ * AddFaceEdges
+ * 
+ * ===============
+ */
+static void     AddFaceEdges(const face_t* const f)
+{
+    int             i, j;
+
+    for (i = 0; i < f->numpoints; i++)
+    {
+        j = (i + 1) % f->numpoints;
+        AddEdge(f->pts[i], f->pts[j]);
+    }
+}
+
+//============================================================================
+
+static byte     superfacebuf[1024 * 16];
+static face_t*  superface = (face_t*)superfacebuf;
+static int      MAX_SUPERFACEEDGES = (sizeof(superfacebuf) - sizeof(face_t) + sizeof(superface->pts)) / sizeof(vec3_t);
+static face_t*  newlist;
+
+static void     SplitFaceForTjunc(face_t* f, face_t* original)
+{
+    int             i;
+    face_t*         newface;
+    face_t*         chain;
+    vec3_t          dir, test;
+    vec_t           v;
+    int             firstcorner, lastcorner;
+
+#ifdef _DEBUG
+    static int      counter = 0;
+
+    Log("SplitFaceForTjunc %d\n", counter++);
+#endif
+
+    chain = NULL;
+    do
+    {
+        hlassume(f->original == NULL, assume_ValidPointer);     // "SplitFaceForTjunc: f->original"
+
+        if (f->numpoints <= MAXPOINTS)
+        {                                                  // the face is now small enough without more cutting
+            // so copy it back to the original
+            *original = *f;
+            original->original = chain;
+            original->next = newlist;
+            newlist = original;
+            return;
+        }
+
+        tjuncfaces++;
+
+restart:
+        // find the last corner 
+        VectorSubtract(f->pts[f->numpoints - 1], f->pts[0], dir);
+        VectorNormalize(dir);
+        for (lastcorner = f->numpoints - 1; lastcorner > 0; lastcorner--)
+        {
+            VectorSubtract(f->pts[lastcorner - 1], f->pts[lastcorner], test);
+            VectorNormalize(test);
+            v = DotProduct(test, dir);
+            if (v < 1.0 - ON_EPSILON || v > 1.0 + ON_EPSILON)
+            {
+                break;
+            }
+        }
+
+        // find the first corner        
+        VectorSubtract(f->pts[1], f->pts[0], dir);
+        VectorNormalize(dir);
+        for (firstcorner = 1; firstcorner < f->numpoints - 1; firstcorner++)
+        {
+            VectorSubtract(f->pts[firstcorner + 1], f->pts[firstcorner], test);
+            VectorNormalize(test);
+            v = DotProduct(test, dir);
+            if (v < 1.0 - ON_EPSILON || v > 1.0 + ON_EPSILON)
+            {
+                break;
+            }
+        }
+
+        if (firstcorner + 2 >= MAXPOINTS)
+        {
+            // rotate the point winding
+            VectorCopy(f->pts[0], test);
+            for (i = 1; i < f->numpoints; i++)
+            {
+                VectorCopy(f->pts[i], f->pts[i - 1]);
+            }
+            VectorCopy(test, f->pts[f->numpoints - 1]);
+            goto restart;
+        }
+
+        // cut off as big a piece as possible, less than MAXPOINTS, and not
+        // past lastcorner
+
+        newface = NewFaceFromFace(f);
+
+        hlassume(f->original == NULL, assume_ValidPointer);     // "SplitFaceForTjunc: f->original"
+
+        newface->original = chain;
+        chain = newface;
+        newface->next = newlist;
+        newlist = newface;
+        if (f->numpoints - firstcorner <= MAXPOINTS)
+        {
+            newface->numpoints = firstcorner + 2;
+        }
+        else if (lastcorner + 2 < MAXPOINTS && f->numpoints - lastcorner <= MAXPOINTS)
+        {
+            newface->numpoints = lastcorner + 2;
+        }
+        else
+        {
+            newface->numpoints = MAXPOINTS;
+        }
+
+        for (i = 0; i < newface->numpoints; i++)
+        {
+            VectorCopy(f->pts[i], newface->pts[i]);
+        }
+
+        for (i = newface->numpoints - 1; i < f->numpoints; i++)
+        {
+            VectorCopy(f->pts[i], f->pts[i - (newface->numpoints - 2)]);
+        }
+        f->numpoints -= (newface->numpoints - 2);
+    }
+    while (1);
+
+}
+
+/*
+ * ===============
+ * FixFaceEdges
+ * 
+ * ===============
+ */
+static void     FixFaceEdges(face_t* f)
+{
+    int             i;
+    int             j;
+    int             k;
+    wedge_t*        w;
+    wvert_t*        v;
+    vec_t           t1;
+    vec_t           t2;
+
+    *superface = *f;
+
+restart:
+    for (i = 0; i < superface->numpoints; i++)
+    {
+        j = (i + 1) % superface->numpoints;
+
+        w = FindEdge(superface->pts[i], superface->pts[j], &t1, &t2);
+
+        for (v = w->head.next; v->t < t1 + T_EPSILON; v = v->next)
+        {
+        }
+
+        if (v->t < t2 - T_EPSILON)
+        {
+            tjuncs++;
+            // insert a new vertex here
+            for (k = superface->numpoints; k > j; k--)
+            {
+                VectorCopy(superface->pts[k - 1], superface->pts[k]);
+            }
+            VectorMA(w->origin, v->t, w->dir, superface->pts[j]);
+            superface->numpoints++;
+            hlassume(superface->numpoints < MAX_SUPERFACEEDGES, assume_MAX_SUPERFACEEDGES);
+            goto restart;
+        }
+    }
+
+    if (superface->numpoints <= MAXPOINTS)
+    {
+        *f = *superface;
+        f->next = newlist;
+        newlist = f;
+        return;
+    }
+
+    // the face needs to be split into multiple faces because of too many edges
+
+    SplitFaceForTjunc(superface, f);
+
+}
+
+//============================================================================
+
+static void     tjunc_find_r(node_t* node)
+{
+    face_t*         f;
+
+    if (node->planenum == PLANENUM_LEAF)
+    {
+        return;
+    }
+
+    for (f = node->faces; f; f = f->next)
+    {
+        AddFaceEdges(f);
+    }
+
+    tjunc_find_r(node->children[0]);
+    tjunc_find_r(node->children[1]);
+}
+
+static void     tjunc_fix_r(node_t* node)
+{
+    face_t*         f;
+    face_t*         next;
+
+    if (node->planenum == PLANENUM_LEAF)
+    {
+        return;
+    }
+
+    newlist = NULL;
+
+    for (f = node->faces; f; f = next)
+    {
+        next = f->next;
+        FixFaceEdges(f);
+    }
+
+    node->faces = newlist;
+
+    tjunc_fix_r(node->children[0]);
+    tjunc_fix_r(node->children[1]);
+}
+
+/*
+ * ===========
+ * tjunc
+ * 
+ * ===========
+ */
+void            tjunc(node_t* headnode)
+{
+    vec3_t          maxs, mins;
+    int             i;
+
+    Verbose("---- tjunc ----\n");
+
+    if (g_notjunc)
+    {
+        return;
+    }
+
+    //
+    // identify all points on common edges
+    //
+
+    // origin points won't allways be inside the map, so extend the hash area 
+    for (i = 0; i < 3; i++)
+    {
+        if (fabs(headnode->maxs[i]) > fabs(headnode->mins[i]))
+        {
+            maxs[i] = fabs(headnode->maxs[i]);
+        }
+        else
+        {
+            maxs[i] = fabs(headnode->mins[i]);
+        }
+    }
+    VectorSubtract(vec3_origin, maxs, mins);
+
+    InitHash(mins, maxs);
+
+    numwedges = numwverts = 0;
+
+    tjunc_find_r(headnode);
+
+    Verbose("%i world edges  %i edge points\n", numwedges, numwverts);
+
+    //
+    // add extra vertexes on edges where needed
+    //
+    tjuncs = tjuncfaces = 0;
+
+    tjunc_fix_r(headnode);
+
+    Verbose("%i edges added by tjunctions\n", tjuncs);
+    Verbose("%i faces added by tjunctions\n", tjuncfaces);
+}

+ 351 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlbsp/writebsp.cpp

@@ -0,0 +1,351 @@
+#include "bsp5.h"
+
+//  WriteClipNodes_r
+//  WriteClipNodes
+//  WriteDrawLeaf
+//  WriteFace
+//  WriteDrawNodes_r
+//  FreeDrawNodes_r
+//  WriteDrawNodes
+//  BeginBSPFile
+//  FinishBSPFile
+
+#include <map>
+
+typedef std::map<int,int> PlaneMap;
+static PlaneMap gPlaneMap;
+static int gNumMappedPlanes;
+static dplane_t gMappedPlanes[MAX_MAP_PLANES];
+extern bool g_noopt;
+
+// =====================================================================================
+//  WritePlane
+//  hook for plane optimization
+// =====================================================================================
+static int WritePlane(int planenum)
+{
+	planenum = planenum & (~1);
+
+	if(g_noopt)
+	{
+		return planenum;
+	}
+
+	PlaneMap::iterator item = gPlaneMap.find(planenum);
+	if(item != gPlaneMap.end())
+	{
+		return item->second;
+	}
+	//add plane to BSP
+	hlassume(gNumMappedPlanes < MAX_MAP_PLANES, assume_MAX_MAP_PLANES);
+	gMappedPlanes[gNumMappedPlanes] = g_dplanes[planenum];
+	gPlaneMap.insert(PlaneMap::value_type(planenum,gNumMappedPlanes));
+
+	return gNumMappedPlanes++;
+}
+
+// =====================================================================================
+//  WriteClipNodes_r
+// =====================================================================================
+static int      WriteClipNodes_r(node_t* node)
+{
+    int             i, c;
+    dclipnode_t*    cn;
+    int             num;
+
+    if (node->planenum == -1)
+    {
+        num = node->contents;
+        free(node->markfaces);
+        free(node);
+        return num;
+    }
+
+	hlassume(g_numclipnodes < MAX_MAP_CLIPNODES, assume_MAX_MAP_CLIPNODES);
+
+	// emit a clipnode
+    c = g_numclipnodes;
+    cn = &g_dclipnodes[g_numclipnodes];
+    g_numclipnodes++;
+    if (node->planenum & 1)
+    {
+        Error("WriteClipNodes_r: odd planenum");
+    }
+    
+#ifdef ZHLT_PLANETYPE_FIX //debug
+	{
+		dplane_t *plane = &g_dplanes[node->planenum];
+		if (plane->normal[(plane->type)%3] < 0)
+			if (plane->type < 3)
+				Warning ("WriteClipNodes_r: negative plane");
+			else
+				Developer (DEVELOPER_LEVEL_MESSAGE, "Warning: WriteClipNodes_r: negative plane\n");
+	}
+#endif
+    
+    cn->planenum = WritePlane(node->planenum);
+    for (i = 0; i < 2; i++)
+    {
+        cn->children[i] = WriteClipNodes_r(node->children[i]);
+    }
+
+    free(node);
+    return c;
+}
+
+// =====================================================================================
+//  WriteClipNodes
+//      Called after the clipping hull is completed.  Generates a disk format
+//      representation and frees the original memory.
+// =====================================================================================
+void            WriteClipNodes(node_t* nodes)
+{
+    WriteClipNodes_r(nodes);
+}
+
+// =====================================================================================
+//  WriteDrawLeaf
+// =====================================================================================
+static void     WriteDrawLeaf(const node_t* const node)
+{
+    face_t**        fp;
+    face_t*         f;
+    dleaf_t*        leaf_p;
+
+    // emit a leaf
+    leaf_p = &g_dleafs[g_numleafs];
+    g_numleafs++;
+
+    leaf_p->contents = node->contents;
+
+    //
+    // write bounding box info
+    //
+    VectorCopy(node->mins, leaf_p->mins);
+    VectorCopy(node->maxs, leaf_p->maxs);
+
+    leaf_p->visofs = -1;                                   // no vis info yet
+
+    //
+    // write the marksurfaces
+    //
+    leaf_p->firstmarksurface = g_nummarksurfaces;
+
+    hlassume(node->markfaces != NULL, assume_EmptySolid);
+
+    for (fp = node->markfaces; *fp; fp++)
+    {
+        // emit a marksurface
+        f = *fp;
+        do
+        {
+            g_dmarksurfaces[g_nummarksurfaces] = f->outputnumber;
+            hlassume(g_nummarksurfaces < MAX_MAP_MARKSURFACES, assume_MAX_MAP_MARKSURFACES);
+            g_nummarksurfaces++;
+            f = f->original;                               // grab tjunction split faces
+        }
+        while (f);
+    }
+    free(node->markfaces);
+
+    leaf_p->nummarksurfaces = g_nummarksurfaces - leaf_p->firstmarksurface;
+}
+
+// =====================================================================================
+//  WriteFace
+// =====================================================================================
+static void     WriteFace(face_t* f)
+{
+    dface_t*        df;
+    int             i;
+    int             e;
+
+    if (    CheckFaceForHint(f)
+        ||  CheckFaceForSkip(f)
+#ifdef ZHLT_NULLTEX
+        ||  CheckFaceForNull(f)  // AJM
+#endif
+
+// =====================================================================================
+//Cpt_Andrew - Env_Sky Check
+// =====================================================================================
+       ||  CheckFaceForEnv_Sky(f)
+// =====================================================================================
+
+       )
+    {
+        return;
+    }
+
+    f->outputnumber = g_numfaces;
+
+    df = &g_dfaces[g_numfaces];
+    hlassume(g_numfaces < MAX_MAP_FACES, assume_MAX_MAP_FACES);
+    g_numfaces++;
+
+	df->planenum = WritePlane(f->planenum);
+	df->side = f->planenum & 1;
+    df->firstedge = g_numsurfedges;
+    df->numedges = f->numpoints;
+    df->texinfo = f->texturenum;
+    for (i = 0; i < f->numpoints; i++)
+    {
+        e = GetEdge(f->pts[i], f->pts[(i + 1) % f->numpoints], f);
+        hlassume(g_numsurfedges < MAX_MAP_SURFEDGES, assume_MAX_MAP_SURFEDGES);
+        g_dsurfedges[g_numsurfedges] = e;
+        g_numsurfedges++;
+    }
+}
+
+// =====================================================================================
+//  WriteDrawNodes_r
+// =====================================================================================
+static void     WriteDrawNodes_r(const node_t* const node)
+{
+    dnode_t*        n;
+    int             i;
+    face_t*         f;
+
+    // emit a node
+    hlassume(g_numnodes < MAX_MAP_NODES, assume_MAX_MAP_NODES);
+    n = &g_dnodes[g_numnodes];
+    g_numnodes++;
+
+    VectorCopy(node->mins, n->mins);
+    VectorCopy(node->maxs, n->maxs);
+
+    if (node->planenum & 1)
+    {
+        Error("WriteDrawNodes_r: odd planenum");
+    }
+    n->planenum = WritePlane(node->planenum);
+    n->firstface = g_numfaces;
+
+    for (f = node->faces; f; f = f->next)
+    {
+        WriteFace(f);
+    }
+
+    n->numfaces = g_numfaces - n->firstface;
+
+    //
+    // recursively output the other nodes
+    //
+    for (i = 0; i < 2; i++)
+    {
+        if (node->children[i]->planenum == -1)
+        {
+            if (node->children[i]->contents == CONTENTS_SOLID)
+            {
+                n->children[i] = -1;
+            }
+            else
+            {
+                n->children[i] = -(g_numleafs + 1);
+                WriteDrawLeaf(node->children[i]);
+            }
+        }
+        else
+        {
+            n->children[i] = g_numnodes;
+            WriteDrawNodes_r(node->children[i]);
+        }
+    }
+}
+
+// =====================================================================================
+//  FreeDrawNodes_r
+// =====================================================================================
+static void     FreeDrawNodes_r(node_t* node)
+{
+    int             i;
+    face_t*         f;
+    face_t*         next;
+
+    for (i = 0; i < 2; i++)
+    {
+        if (node->children[i]->planenum != -1)
+        {
+            FreeDrawNodes_r(node->children[i]);
+        }
+    }
+
+    //
+    // free the faces on the node
+    //
+    for (f = node->faces; f; f = next)
+    {
+        next = f->next;
+        FreeFace(f);
+    }
+
+    free(node);
+}
+
+// =====================================================================================
+//  WriteDrawNodes
+//      Called after a drawing hull is completed
+//      Frees all nodes and faces
+// =====================================================================================
+void            WriteDrawNodes(node_t* headnode)
+{
+    if (headnode->contents < 0)
+    {
+        WriteDrawLeaf(headnode);
+    }
+    else
+    {
+        WriteDrawNodes_r(headnode);
+        FreeDrawNodes_r(headnode);
+    }
+}
+
+
+// =====================================================================================
+//  BeginBSPFile
+// =====================================================================================
+void            BeginBSPFile()
+{
+    // these values may actually be initialized
+    // if the file existed when loaded, so clear them explicitly
+	gNumMappedPlanes = 0;
+	gPlaneMap.clear();
+    g_nummodels = 0;
+    g_numfaces = 0;
+    g_numnodes = 0;
+    g_numclipnodes = 0;
+    g_numvertexes = 0;
+    g_nummarksurfaces = 0;
+    g_numsurfedges = 0;
+
+    // edge 0 is not used, because 0 can't be negated
+    g_numedges = 1;
+
+    // leaf 0 is common solid with no faces
+    g_numleafs = 1;
+    g_dleafs[0].contents = CONTENTS_SOLID;
+}
+
+// =====================================================================================
+//  FinishBSPFile
+// =====================================================================================
+void            FinishBSPFile()
+{
+    Verbose("--- FinishBSPFile ---\n");
+
+	if(!g_noopt)
+	{
+		for(int counter = 0; counter < gNumMappedPlanes; counter++)
+		{
+			g_dplanes[counter] = gMappedPlanes[counter];
+		}
+		g_numplanes = gNumMappedPlanes;
+	}
+
+	if (g_chart)
+    {
+        PrintBSPFileSizes();
+    }
+
+    WriteBSPFile(g_bspfilename);
+}

+ 458 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/autowad.cpp

@@ -0,0 +1,458 @@
+// AJM: Added this file in
+#include "csg.h"
+#include "cmdlib.h"
+
+#ifdef SYSTEM_WIN32
+#pragma warning(disable:4996)
+#endif
+
+#ifdef HLCSG_AUTOWAD
+
+#define MAX_AUTOWAD_TEXNAME 32  // 32 char limit in array size in brush_texture_t struct
+
+int g_numUsedTextures = 0;
+
+typedef struct autowad_texname_s         // non-dupicate list of textures used in map
+{
+    char        name[MAX_AUTOWAD_TEXNAME];
+    autowad_texname_s*  next;
+} autowad_texname_t;
+
+autowad_texname_t* g_autowad_texname;
+
+// =====================================================================================
+//  Extract File stuff (ExtractFile | ExtractFilePath | ExtractFileBase)
+//
+// With VS 2005 - and the 64 bit build, i had to pull 3 classes over from
+// cmdlib.cpp even with the proper includes to get rid of the lnk2001 error
+//
+// amckern - [email protected]
+// =====================================================================================
+
+#define PATHSEPARATOR(c) ((c) == '\\' || (c) == '/')
+
+void            ExtractFileBase(const char* const path, char* dest)
+{
+    hlassert (path != dest);
+
+    const char*           src;
+
+    src = path + strlen(path) - 1;
+
+    //
+    // back up until a \ or the start
+    //
+    while (src != path && !PATHSEPARATOR(*(src - 1)))
+        src--;
+
+    while (*src && *src != '.')
+    {
+        *dest++ = *src++;
+    }
+    *dest = 0;
+}
+
+void            ExtractFilePath(const char* const path, char* dest)
+{
+    hlassert (path != dest);
+
+    const char*           src;
+
+    src = path + strlen(path) - 1;
+
+    //
+    // back up until a \ or the start
+    //
+    while (src != path && !PATHSEPARATOR(*(src - 1)))
+        src--;
+
+    memcpy(dest, path, src - path);
+    dest[src - path] = 0;
+}
+
+void            ExtractFile(const char* const path, char* dest)
+{
+    hlassert (path != dest);
+
+    const char*           src;
+
+    src = path + strlen(path) - 1;
+
+    while (src != path && !PATHSEPARATOR(*(src - 1)))
+        src--;
+
+    while (*src)
+    {
+        *dest++ = *src++;
+    }
+    *dest = 0;
+}
+
+// =====================================================================================
+//  autowad_PushName
+//      adds passed texname as an entry to autowad_wadnames list, without duplicates
+// =====================================================================================
+void        autowad_PushName(const char* const texname)
+{
+    autowad_texname_t*  tex;
+
+    if (!g_autowad_texname)
+    {
+        // first texture, make an entry
+        tex = (autowad_texname_t*)malloc(sizeof(autowad_texname_t));
+        tex->next = NULL;
+        strcpy_s(tex->name, texname);
+
+        g_autowad_texname = tex;
+        g_numUsedTextures++;
+
+#ifdef _DEBUG
+        Log("[dbg] Used texture: %i[%s]\n", g_numUsedTextures, texname);
+#endif
+        return;
+    }
+    
+    // otherwise, see if texname isnt already in the list
+    for (tex = g_autowad_texname; ;tex = tex->next)
+    {
+        if (!strcmp(tex->name, texname))
+            return; // dont bother adding it again
+
+        if (!tex->next)
+            break;  // end of list
+    }
+
+    // unique texname
+    g_numUsedTextures++;
+    autowad_texname_t*  last;
+    last = tex;
+    tex = (autowad_texname_t*)malloc(sizeof(autowad_texname_t));
+    strcpy_s(tex->name, texname);
+    tex->next = NULL;
+    last->next = tex;
+
+#ifdef _DEBUG
+    Log("[dbg] Used texture: %i[%s]\n", g_numUsedTextures, texname);
+#endif
+}
+
+// =====================================================================================
+//  autowad_PurgeName
+// =====================================================================================
+void        autowad_PurgeName(const char* const texname)
+{
+    autowad_texname_t*  prev;
+    autowad_texname_t*  current;
+
+    if (!g_autowad_texname)
+        return;
+
+    current = g_autowad_texname;
+    prev = NULL;
+    for (; ;)
+    {
+        if (!strcmp(current->name, texname))
+        {
+            if (!prev)      // start of the list
+            {   
+                g_autowad_texname = current->next;
+            }
+            else            // middle of list
+            {
+                prev->next = current->next;
+            }
+
+            free(current);
+            return;
+        }
+
+        if (!current->next)
+        {
+            //Log(" AUTOWAD: Purge Tex: texname '%s' does not exist\n", texname);
+            return; // end of list
+        }
+
+        // move along
+        prev = current;
+        current = current->next;
+    }
+}
+
+// =====================================================================================
+//  autowad_PopName
+//      removes a name from the autowad list, puts it in memory and retuns pointer (which 
+//      shoudl be destructed by the calling function later)
+// =====================================================================================
+char*      autowad_PopName()
+{
+    // todo: code
+    return NULL;
+}
+
+// =====================================================================================
+//  autowad_cleanup
+//      frees memory used by autowad procedure
+// =====================================================================================
+void        autowad_cleanup()
+{
+    if (g_autowad_texname != NULL)
+    {
+        autowad_texname_t*  current;
+        autowad_texname_t*  next;
+
+        for (current = g_autowad_texname; ; current = next)
+        {
+            if (!current)
+                break;
+
+            //Log("[aw] removing tex %s\n", current->name);
+            next = current->next;
+            free(current);
+        }
+    }
+}
+
+// =====================================================================================
+//  autowad_IsUsedTexture
+//      is this texture in the autowad list?
+// =====================================================================================
+bool        autowad_IsUsedTexture(const char* const texname)
+{
+    autowad_texname_t*  current;
+
+    if (!g_autowad_texname)
+        return false;  
+
+    for (current = g_autowad_texname; ; current = current->next)
+    {
+        //Log("atw: IUT: Comparing: '%s' with '%s'\n", current->name, texname);
+        if (!strcmp(current->name, texname))
+            return true;
+
+        if (!current->next)
+            return false; // reached end of list
+    }
+
+    return false;
+}
+
+// =====================================================================================
+//  GetUsedTextures
+// =====================================================================================
+void        GetUsedTextures()
+{
+    int             i;
+    side_t*         bs;
+
+    for (i = 0; i < g_numbrushsides; i++)
+    {
+        bs = &g_brushsides[i];
+        autowad_PushName(bs->td.name);
+    }
+}
+
+// =====================================================================================
+//  autowad_UpdateUsedWads
+// =====================================================================================
+
+// yes, these should be in a header/common lib, but i cant be bothered
+
+#define MAXWADNAME 16
+
+typedef struct
+{
+    char            identification[4];                     // should be WAD2/WAD3
+    int             numlumps;
+    int             infotableofs;
+} wadinfo_t;
+
+typedef struct
+{
+    int             filepos;
+    int             disksize;
+    int             size;                                  // uncompressed
+    char            type;
+    char            compression;
+    char            pad1, pad2;
+    char            name[MAXWADNAME];                      // must be null terminated
+
+    int             iTexFile;                              // index of the wad this texture is located in
+
+} lumpinfo_t;
+
+static void     CleanupName(const char* const in, char* out)
+{
+    int             i;
+
+    for (i = 0; i < MAXWADNAME; i++)
+    {
+        if (!in[i])
+        {
+            break;
+        }
+
+        out[i] = toupper(in[i]);
+    }
+
+    for (; i < MAXWADNAME; i++)
+    {
+        out[i] = 0;
+    }
+}
+
+void        autowad_UpdateUsedWads()
+{
+    // see which wadfiles are needed
+    // code for this wad loop somewhat copied from below
+    wadinfo_t       thiswad;
+    lumpinfo_t*     thislump = NULL;
+    wadpath_t*      currentwad;
+    char*           pszWadFile;
+    FILE*           texfile;
+    const char*     pszWadroot = getenv("WADROOT");
+    int             i, j;
+    int             nTexLumps = 0;
+
+#ifdef _DEBUG
+    Log("[dbg] Starting wad dependency check\n");
+#endif
+
+    // open each wadpath and sort though its contents
+    for (i = 0; i < g_iNumWadPaths; i++)
+    {
+        currentwad = g_pWadPaths[i];
+        pszWadFile = currentwad->path;
+        currentwad->usedbymap = false;  // guilty until proven innocent
+
+#ifdef _DEBUG
+        Log(" Parsing wad: '%s'\n", pszWadFile);
+#endif
+
+        texfile = fopen(pszWadFile, "rb");
+
+        #ifdef SYSTEM_WIN32
+        if (!texfile)
+        {
+            // cant find it, maybe this wad file has a hard code drive
+            if (pszWadFile[1] == ':')
+            {
+                pszWadFile += 2;                           // skip past the drive
+                texfile = fopen(pszWadFile, "rb");
+            }
+        }
+        #endif
+
+        char            szTmp[_MAX_PATH];
+        if (!texfile && pszWadroot)
+        {
+            char            szFile[_MAX_PATH];
+            char            szSubdir[_MAX_PATH];
+
+            ExtractFile(pszWadFile, szFile);
+        
+            ExtractFilePath(pszWadFile, szTmp);
+            ExtractFile(szTmp, szSubdir);
+
+            // szSubdir will have a trailing separator
+            safe_snprintf(szTmp, _MAX_PATH, "%s" SYSTEM_SLASH_STR "%s%s", pszWadroot, szSubdir, szFile);
+            texfile = fopen(szTmp, "rb");
+        
+            #ifdef SYSTEM_POSIX
+            if (!texfile)
+            {
+                // cant find it, Convert to lower case and try again
+                strlwr(szTmp);
+                texfile = fopen(szTmp, "rb");
+            }
+            #endif
+        }
+
+        if (!texfile) // still cant find it, skip this one
+		{
+			if(pszWadroot)
+			{
+				Warning("Wad file '%s' not found, also tried '%s'",pszWadFile,szTmp);
+			}
+			else
+			{
+				Warning("Wad file '%s' not found",pszWadFile);
+			}
+            continue;
+		}
+
+        // look and see if we're supposed to include the textures from this WAD in the bsp.
+        {
+            WadInclude_i    it;
+            bool            including = false;
+            for (it = g_WadInclude.begin(); it != g_WadInclude.end(); it++)
+            {
+                if (stristr(pszWadFile, it->c_str()))
+                {
+                    #ifdef _DEBUG
+                    Log("  - including wad\n");
+                    #endif
+                    including = true;
+                    currentwad->usedbymap = true;
+                    break;
+                }
+            }
+            if (including)
+            {
+                //fclose(texfile);
+                //continue;
+            }
+        }
+
+        // read in this wadfiles information
+        SafeRead(texfile, &thiswad, sizeof(thiswad));
+
+        // make sure its a valid format
+        if (strncmp(thiswad.identification, "WAD2", 4) && strncmp(thiswad.identification, "WAD3", 4))
+        {
+            fclose(texfile);
+            continue;
+        }
+
+        thiswad.numlumps        = LittleLong(thiswad.numlumps);
+        thiswad.infotableofs    = LittleLong(thiswad.infotableofs);
+
+        // read in lump
+        if (fseek(texfile, thiswad.infotableofs, SEEK_SET))
+        {
+            fclose(texfile);
+            continue;   // had trouble reading, skip this wad
+        }
+
+        // memalloc for this lump
+        thislump = (lumpinfo_t*)realloc(thislump, (nTexLumps + thiswad.numlumps) * sizeof(lumpinfo_t));
+        // BUGBUG: is this destructed?
+
+        // for each texlump
+        for (j = 0; j < thiswad.numlumps; j++, nTexLumps++)
+        {
+            SafeRead(texfile, &thislump[nTexLumps], (sizeof(lumpinfo_t) - sizeof(int)) );  // iTexFile is NOT read from file
+
+            CleanupName(thislump[nTexLumps].name, thislump[nTexLumps].name);
+        
+            if (autowad_IsUsedTexture(thislump[nTexLumps].name))
+            {
+                currentwad->usedbymap = true;
+                currentwad->usedtextures++;
+                #ifdef _DEBUG
+                Log("    - Used wadfile: [%s]\n", thislump[nTexLumps].name);
+                #endif
+                autowad_PurgeName(thislump[nTexLumps].name);
+            }
+        }
+
+        fclose(texfile);
+    }
+
+#ifdef _DEBUG
+    Log("[dbg] End wad dependency check\n\n");
+#endif
+    return;
+}
+
+
+#endif // HLCSG_AUTOWAD

File diff suppressed because it is too large
+ 1131 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/brush.cpp


+ 361 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/brushunion.cpp

@@ -0,0 +1,361 @@
+#include "csg.h"
+
+vec_t           g_BrushUnionThreshold = DEFAULT_BRUSH_UNION_THRESHOLD;
+
+static Winding* NewWindingFromPlane(const brushhull_t* const hull, const int planenum)
+{
+    Winding*        winding;
+    Winding*        front;
+    Winding*        back;
+    bface_t*        face;
+    plane_t*        plane;
+
+    plane = &g_mapplanes[planenum];
+    winding = new Winding(plane->normal, plane->dist);
+
+    for (face = hull->faces; face; face = face->next)
+    {
+        plane = &g_mapplanes[face->planenum];
+        winding->Clip(plane->normal, plane->dist, &front, &back);
+        delete winding;
+
+        if (front)
+        {
+            delete front;
+        }
+        if (back)
+        {
+            winding = back;
+        }
+        else
+        {
+            Developer(DEVELOPER_LEVEL_ERROR, "NewFaceFromPlane returning NULL");
+            return NULL;
+        }
+    }
+
+    return winding;
+}
+
+static void     AddFaceToList(bface_t** head, bface_t* newface)
+{
+    hlassert(newface);
+    hlassert(newface->w);
+    if (!*head)
+    {
+        *head = newface;
+        return;
+    }
+    else
+    {
+        bface_t*        node = *head;
+
+        while (node->next)
+        {
+            node = node->next;
+        }
+        node->next = newface;
+        newface->next = NULL;
+    }
+}
+
+static int      NumberOfHullFaces(const brushhull_t* const hull)
+{
+    int             x;
+    bface_t*        face;
+
+    if (!hull->faces)
+    {
+        return 0;
+    }
+
+    for (x = 0, face = hull->faces; face; face = face->next, x++)
+    {                                                  // counter
+    }
+
+    return x;
+}
+
+// Returns false if union of brushes is obviously zero
+static void     AddPlaneToUnion(brushhull_t* hull, const int planenum)
+{
+    bool            need_new_face = false;
+
+    bface_t*        new_face_list;
+
+    bface_t*        face;
+    bface_t*        next;
+
+    plane_t*        split;
+    Winding*        front;
+    Winding*        back;
+
+    new_face_list = NULL;
+
+    next = NULL;
+
+    hlassert(hull);
+
+    if (!hull->faces)
+    {
+        return;
+    }
+    hlassert(hull->faces->w);
+
+    for (face = hull->faces; face; face = next)
+    {
+        hlassert(face->w);
+        next = face->next;
+
+        // Duplicate plane, ignore
+        if (face->planenum == planenum)
+        {
+            AddFaceToList(&new_face_list, CopyFace(face));
+            continue;
+        }
+
+        split = &g_mapplanes[planenum];
+        face->w->Clip(split->normal, split->dist, &front, &back);
+
+        if (front)
+        {
+            delete front;
+            need_new_face = true;
+
+            if (back)
+            {                                              // Intersected the face
+                delete face->w;
+                face->w = back;
+                AddFaceToList(&new_face_list, CopyFace(face));
+            }
+        }
+        else
+        {
+            // Completely missed it, back is identical to face->w so it is destroyed
+            if (back)
+            {
+                delete back;
+                AddFaceToList(&new_face_list, CopyFace(face));
+            }
+        }
+        hlassert(face->w);
+    }
+
+    FreeFaceList(hull->faces);
+    hull->faces = new_face_list;
+
+    if (need_new_face && (NumberOfHullFaces(hull) > 2))
+    {
+        Winding*        new_winding = NewWindingFromPlane(hull, planenum);
+
+        if (new_winding)
+        {
+            bface_t*        new_face = (bface_t*)Alloc(sizeof(bface_t));
+
+            new_face->planenum = planenum;
+            new_face->w = new_winding;
+
+            new_face->next = hull->faces;
+            hull->faces = new_face;
+        }
+    }
+}
+
+static vec_t    CalculateSolidVolume(const brushhull_t* const hull)
+{
+    // calculate polyhedron origin
+    // subdivide face winding into triangles
+
+    // for each face
+    // calculate volume of triangle of face to origin
+    // add subidivided volume chunk to total
+
+    int             x = 0;
+    vec_t           volume = 0.0;
+    vec_t           inverse;
+    vec3_t          midpoint = { 0.0, 0.0, 0.0 };
+
+    bface_t*        face;
+
+    for (face = hull->faces; face; face = face->next, x++)
+    {
+        vec3_t          facemid;
+
+        face->w->getCenter(facemid);
+        VectorAdd(midpoint, facemid, midpoint);
+        Developer(DEVELOPER_LEVEL_MESSAGE, "Midpoint for face %d is %f %f %f\n", x, facemid[0], facemid[1], facemid[2]);
+    }
+
+    inverse = 1.0 / x;
+
+    VectorScale(midpoint, inverse, midpoint);
+
+    Developer(DEVELOPER_LEVEL_MESSAGE, "Midpoint for hull is %f %f %f\n", midpoint[0], midpoint[1], midpoint[2]);
+
+    for (face = hull->faces; face; face = face->next, x++)
+    {
+        plane_t*        plane = &g_mapplanes[face->planenum];
+        vec_t           area = face->w->getArea();
+        vec_t           dist = DotProduct(plane->normal, midpoint);
+
+        dist -= plane->dist;
+        dist = fabs(dist);
+
+        volume += area * dist / 3.0;
+    }
+
+    Developer(DEVELOPER_LEVEL_MESSAGE, "Volume for brush is %f\n", volume);
+
+    return volume;
+}
+
+static void     DumpHullWindings(const brushhull_t* const hull)
+{
+    int             x = 0;
+    bface_t*        face;
+
+    for (face = hull->faces; face; face = face->next)
+    {
+        Developer(DEVELOPER_LEVEL_MEGASPAM, "Winding %d\n", x++);
+        face->w->Print();
+        Developer(DEVELOPER_LEVEL_MEGASPAM, "\n");
+    }
+}
+
+static bool     isInvalidHull(const brushhull_t* const hull)
+{
+    int             x = 0;
+    bface_t*        face;
+
+    vec3_t          mins = { 99999.0, 99999.0, 99999.0 };
+    vec3_t          maxs = { -99999.0, -99999.0, -99999.0 };
+
+    for (face = hull->faces; face; face = face->next)
+    {
+        unsigned int    y;
+        Winding*        winding = face->w;
+
+        for (y = 0; y < winding->m_NumPoints; y++)
+        {
+            VectorCompareMinimum(mins, winding->m_Points[y], mins);
+            VectorCompareMaximum(maxs, winding->m_Points[y], maxs);
+        }
+    }
+
+    for (x = 0; x < 3; x++)
+    {
+        if ((mins[x] < (-BOGUS_RANGE / 2)) || (maxs[x] > (BOGUS_RANGE / 2)))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+void            CalculateBrushUnions(const int brushnum)
+{
+    int             bn, hull;
+    brush_t*        b1;
+    brush_t*        b2;
+    brushhull_t*    bh1;
+    brushhull_t*    bh2;
+    entity_t*       e;
+
+    b1 = &g_mapbrushes[brushnum];
+    e = &g_entities[b1->entitynum];
+
+    for (hull = 0; hull < 1 /* NUM_HULLS */ ; hull++)
+    {
+        bh1 = &b1->hulls[hull];
+        if (!bh1->faces)                                   // Skip it if it is not in this hull
+        {
+            continue;
+        }
+
+        for (bn = brushnum + 1; bn < e->numbrushes; bn++)
+        {                                                  // Only compare if b2 > b1, tests are communitive
+            b2 = &g_mapbrushes[e->firstbrush + bn];
+            bh2 = &b2->hulls[hull];
+
+            if (!bh2->faces)                               // Skip it if it is not in this hull
+            {
+                continue;
+            }
+            if (b1->contents != b2->contents)
+            {
+                continue;                                  // different contents, ignore
+            }
+
+            Developer(DEVELOPER_LEVEL_SPAM, "Processing hull %d brush %d and brush %d\n", hull, brushnum, bn);
+
+            {
+                brushhull_t     union_hull;
+                bface_t*        face;
+
+                union_hull.bounds = bh1->bounds;
+
+                union_hull.faces = CopyFaceList(bh1->faces);
+
+                for (face = bh2->faces; face; face = face->next)
+                {
+                    AddPlaneToUnion(&union_hull, face->planenum);
+                }
+
+                // union was clipped away (no intersection)
+                if (!union_hull.faces)
+                {
+                    continue;
+                }
+
+                if (g_developer >= DEVELOPER_LEVEL_MESSAGE)
+                {
+                    Log("\nUnion windings\n");
+                    DumpHullWindings(&union_hull);
+
+                    Log("\nBrush %d windings\n", brushnum);
+                    DumpHullWindings(bh1);
+
+                    Log("\nBrush %d windings\n", bn);
+                    DumpHullWindings(bh2);
+                }
+
+
+                {
+                    vec_t           volume_brush_1;
+                    vec_t           volume_brush_2;
+                    vec_t           volume_brush_union;
+                    vec_t           volume_ratio_1;
+                    vec_t           volume_ratio_2;
+
+                    if (isInvalidHull(&union_hull))
+                    {
+                        FreeFaceList(union_hull.faces);
+                        continue;
+                    }
+
+                    volume_brush_union = CalculateSolidVolume(&union_hull);
+                    volume_brush_1 = CalculateSolidVolume(bh1);
+                    volume_brush_2 = CalculateSolidVolume(bh2);
+
+                    volume_ratio_1 = volume_brush_union / volume_brush_1;
+                    volume_ratio_2 = volume_brush_union / volume_brush_2;
+
+                    if ((volume_ratio_1 > g_BrushUnionThreshold) || (g_developer >= DEVELOPER_LEVEL_MESSAGE))
+                    {
+                        volume_ratio_1 *= 100.0;
+                        Warning("Entity %d : Brush %d intersects with brush %d by %2.3f percent", b1->entitynum,
+                                brushnum, bn, volume_ratio_1);
+                    }
+                    if ((volume_ratio_2 > g_BrushUnionThreshold) || (g_developer >= DEVELOPER_LEVEL_MESSAGE))
+                    {
+                        volume_ratio_2 *= 100.0;
+                        Warning("Entity %d : Brush %d intersects with brush %d by %2.3f percent", b1->entitynum, bn,
+                                brushnum, volume_ratio_2);
+                    }
+                }
+
+                FreeFaceList(union_hull.faces);
+            }
+        }
+    }
+}

+ 312 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/csg.h

@@ -0,0 +1,312 @@
+#ifndef HLCSG_H__
+#define HLCSG_H__
+
+#if _MSC_VER >= 1000
+#pragma once
+#endif
+
+#include <deque>
+#include <string>
+#include <map>
+
+#include "cmdlib.h"
+#include "messages.h"
+#include "win32fix.h"
+#include "log.h"
+#include "hlassert.h"
+#include "mathlib.h"
+#include "scriplib.h"
+#include "winding.h"
+#include "threads.h"
+#include "bspfile.h"
+#include "blockmem.h"
+#include "filelib.h"
+#include "boundingbox.h"
+// AJM: added in
+#include "wadpath.h"
+
+#ifndef DOUBLEVEC_T
+#error you must add -dDOUBLEVEC_T to the project!
+#endif
+
+#define DEFAULT_BRUSH_UNION_THRESHOLD 0.0f
+#define DEFAULT_TINY_THRESHOLD        0.5
+#define DEFAULT_NOCLIP      false
+#define DEFAULT_ONLYENTS    false
+#define DEFAULT_WADTEXTURES true
+#define DEFAULT_SKYCLIP     true
+#define DEFAULT_CHART       false
+#define DEFAULT_INFO        true
+
+#ifdef HLCSG_PRECISIONCLIP // KGP
+#define FLOOR_Z 0.5
+#define DEFAULT_CLIPTYPE clip_legacy
+#endif
+
+#ifdef ZHLT_NULLTEX // AJM
+#define DEFAULT_NULLTEX     true
+#endif
+
+#ifdef HLCSG_CLIPECONOMY // AJM
+#define DEFAULT_CLIPNAZI    true
+#endif
+
+#ifdef HLCSG_AUTOWAD //  AJM
+#define DEFAULT_WADAUTODETECT false
+#endif
+
+#ifdef ZHLT_DETAIL // AJM
+#define DEFAULT_DETAIL      true
+#endif
+
+#ifdef ZHLT_PROGRESSFILE // AJM
+#define DEFAULT_PROGRESSFILE NULL // progress file is only used if g_progressfile is non-null
+#endif
+
+// AJM: added in
+#define UNLESS(a)  if (!(a))
+
+#ifdef SYSTEM_WIN32
+#define DEFAULT_ESTIMATE    false
+#endif
+
+#ifdef SYSTEM_POSIX
+#define DEFAULT_ESTIMATE    true
+#endif
+
+#define BOGUS_RANGE    8192
+
+typedef struct
+{
+    vec3_t          normal;
+    vec3_t          origin;
+    vec_t           dist;
+    planetypes      type;
+} plane_t;
+
+
+
+typedef struct
+{
+    vec3_t          UAxis;
+    vec3_t          VAxis;
+    vec_t           shift[2];
+    vec_t           rotate;
+    vec_t           scale[2];
+} valve_vects;
+
+typedef struct
+{
+    float           vects[2][4];
+} quark_vects;
+
+typedef union
+{
+    valve_vects     valve;
+    quark_vects     quark;
+}
+vects_union;
+
+extern int      g_nMapFileVersion;                         // map file version * 100 (ie 201), zero for pre-Worldcraft 2.0.1 maps
+
+typedef struct
+{
+    char            txcommand;
+    vects_union     vects;
+    char            name[32];
+} brush_texture_t;
+
+typedef struct side_s
+{
+    brush_texture_t td;
+    vec_t           planepts[3][3];
+} side_t;
+
+typedef struct bface_s
+{
+    struct bface_s* next;
+    int             planenum;
+    plane_t*        plane;
+    Winding*        w;
+    int             texinfo;
+    bool            used;                                  // just for face counting
+    int             contents;
+    int             backcontents;
+    BoundingBox     bounds;
+} bface_t;
+
+// NUM_HULLS should be no larger than MAX_MAP_HULLS
+#define NUM_HULLS 4
+
+typedef struct
+{
+    BoundingBox     bounds;
+    bface_t*        faces;
+} brushhull_t;
+
+typedef struct brush_s
+{
+    int             entitynum;
+    int             brushnum;
+
+    int             firstside;
+    int             numsides;
+
+#ifdef HLCSG_CLIPECONOMY // AJM
+    unsigned int    noclip; // !!!FIXME: this should be a flag bitfield so we can use it for other stuff (ie. is this a detail brush...)
+#endif
+
+    int             contents;
+    brushhull_t     hulls[NUM_HULLS];
+} brush_t;
+
+
+//=============================================================================
+// map.c
+
+extern int      g_nummapbrushes;
+extern brush_t  g_mapbrushes[MAX_MAP_BRUSHES];
+
+#define MAX_MAP_SIDES   (MAX_MAP_BRUSHES*6)
+
+extern int      g_numbrushsides;
+extern side_t   g_brushsides[MAX_MAP_SIDES];
+
+extern void     TextureAxisFromPlane(const plane_t* const pln, vec3_t xv, vec3_t yv);
+extern void     LoadMapFile(const char* const filename);
+
+//=============================================================================
+// textures.c
+
+typedef std::deque< std::string >::iterator WadInclude_i;
+extern std::deque< std::string > g_WadInclude;  // List of substrings to wadinclude
+
+extern void     WriteMiptex();
+extern int      TexinfoForBrushTexture(const plane_t* const plane, brush_texture_t* bt, const vec3_t origin);
+
+//=============================================================================
+// brush.c
+
+extern brush_t* Brush_LoadEntity(entity_t* ent, int hullnum);
+extern contents_t CheckBrushContents(const brush_t* const b);
+
+extern void     CreateBrush(int brushnum);
+
+//=============================================================================
+// csg.c
+
+extern bool     g_chart;
+extern bool     g_onlyents;
+extern bool     g_noclip;
+extern bool     g_wadtextures;
+extern bool     g_skyclip;
+extern bool     g_estimate;         
+extern const char* g_hullfile;        
+
+#ifdef ZHLT_NULLTEX // AJM:
+extern bool     g_bUseNullTex; 
+#endif
+
+#ifdef ZHLT_DETAIL // AJM
+extern bool g_bDetailBrushes;
+#endif
+
+#ifdef HLCSG_CLIPECONOMY // AJM:
+extern bool     g_bClipNazi; 
+#endif
+
+#ifdef HLCSG_PRECISIONCLIP // KGP
+#define EnumPrint(a) #a
+typedef enum{clip_smallest,clip_normalized,clip_simple,clip_precise,clip_legacy} cliptype;
+extern cliptype g_cliptype;
+extern const char*	GetClipTypeString(cliptype);
+#define TEX_BEVEL 32768
+#endif
+
+#ifdef ZHLT_PROGRESSFILE // AJM
+extern char*    g_progressfile ;
+#endif
+
+extern vec_t    g_tiny_threshold;
+extern vec_t    g_BrushUnionThreshold;
+
+extern plane_t  g_mapplanes[MAX_INTERNAL_MAP_PLANES];
+extern int      g_nummapplanes;
+
+extern bface_t* NewFaceFromFace(const bface_t* const in);
+extern bface_t* CopyFace(const bface_t* const f);
+
+extern void     FreeFace(bface_t* f);
+
+extern bface_t* CopyFaceList(bface_t* f);
+extern void     FreeFaceList(bface_t* f);
+
+extern void     GetParamsFromEnt(entity_t* mapent);
+
+//=============================================================================
+// wadinclude.c
+// passed 'filename' is extensionless, the function cats ".wic" at runtime
+
+extern void     LoadWadincludeFile(const char* const filename);
+extern void     SaveWadincludeFile(const char* const filename);
+extern void     HandleWadinclude();
+
+//=============================================================================
+// brushunion.c
+void            CalculateBrushUnions(int brushnum);
+ 
+//============================================================================
+// hullfile.cpp
+extern vec3_t   g_hull_size[NUM_HULLS][2];
+extern void     LoadHullfile(const char* filename);
+
+#ifdef HLCSG_WADCFG // AJM: 
+//============================================================================
+// wadcfg.cpp
+
+extern void     LoadWadConfigFile();
+extern void     ProcessWadConfiguration();
+extern bool     g_bWadConfigsLoaded;
+extern void     WadCfg_cleanup();
+
+#define MAX_WAD_CFG_NAME 32
+extern char     wadconfigname[MAX_WAD_CFG_NAME];
+
+//JK: needed in wadcfg.cpp for *nix..
+#ifndef SYSTEM_WIN32
+extern char *g_apppath;
+#endif
+
+//JK: 
+extern char *g_wadcfgfile;
+
+#endif // HLCSG_WADCFG
+
+#ifdef HLCSG_AUTOWAD
+//============================================================================
+// autowad.cpp      AJM
+
+extern bool     g_bWadAutoDetect; 
+extern int      g_numUsedTextures;
+
+extern void     GetUsedTextures();
+extern bool     autowad_IsUsedTexture(const char* const texname);
+//extern bool     autowad_IsUsedWad(const char* const path);
+//extern void     autowad_PurgeName(const char* const texname);
+extern void     autowad_cleanup();
+extern void     autowad_UpdateUsedWads();
+
+#endif // HLCSG_AUTOWAD
+
+//=============================================================================
+// properties.cpp
+
+#ifdef HLCSG_NULLIFY_INVISIBLE // KGP
+#include <string>
+#include <set>
+extern void properties_initialize(const char* filename);
+extern std::set<std::string> g_invisible_items;
+#endif
+
+//============================================================================
+#endif//HLCSG_H__

+ 688 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/hlcsg.mak

@@ -0,0 +1,688 @@
+# Microsoft Developer Studio Generated NMAKE File, Based on hlcsg.dsp
+!IF "$(CFG)" == ""
+CFG=hlcsg - Win32 Super_Debug
+!MESSAGE No configuration specified. Defaulting to hlcsg - Win32 Super_Debug.
+!ENDIF 
+
+!IF "$(CFG)" != "hlcsg - Win32 Release" && "$(CFG)" != "hlcsg - Win32 Debug" && "$(CFG)" != "hlcsg - Win32 Release w Symbols" && "$(CFG)" != "hlcsg - Win32 Super_Debug"
+!MESSAGE Invalid configuration "$(CFG)" specified.
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "hlcsg.mak" CFG="hlcsg - Win32 Super_Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "hlcsg - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "hlcsg - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE "hlcsg - Win32 Release w Symbols" (based on "Win32 (x86) Console Application")
+!MESSAGE "hlcsg - Win32 Super_Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+!ERROR An invalid configuration is specified.
+!ENDIF 
+
+!IF "$(OS)" == "Windows_NT"
+NULL=
+!ELSE 
+NULL=nul
+!ENDIF 
+
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "hlcsg - Win32 Release"
+
+OUTDIR=.\Release
+INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\Release
+# End Custom Macros
+
+ALL : "$(OUTDIR)\hlcsg.exe" "$(OUTDIR)\hlcsg.bsc"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\autowad.obj"
+	-@erase "$(INTDIR)\autowad.sbr"
+	-@erase "$(INTDIR)\blockmem.obj"
+	-@erase "$(INTDIR)\blockmem.sbr"
+	-@erase "$(INTDIR)\brush.obj"
+	-@erase "$(INTDIR)\brush.sbr"
+	-@erase "$(INTDIR)\brushunion.obj"
+	-@erase "$(INTDIR)\brushunion.sbr"
+	-@erase "$(INTDIR)\bspfile.obj"
+	-@erase "$(INTDIR)\bspfile.sbr"
+	-@erase "$(INTDIR)\cmdlib.obj"
+	-@erase "$(INTDIR)\cmdlib.sbr"
+	-@erase "$(INTDIR)\filelib.obj"
+	-@erase "$(INTDIR)\filelib.sbr"
+	-@erase "$(INTDIR)\files.obj"
+	-@erase "$(INTDIR)\files.sbr"
+	-@erase "$(INTDIR)\hullfile.obj"
+	-@erase "$(INTDIR)\hullfile.sbr"
+	-@erase "$(INTDIR)\log.obj"
+	-@erase "$(INTDIR)\log.sbr"
+	-@erase "$(INTDIR)\map.obj"
+	-@erase "$(INTDIR)\map.sbr"
+	-@erase "$(INTDIR)\mathlib.obj"
+	-@erase "$(INTDIR)\mathlib.sbr"
+	-@erase "$(INTDIR)\messages.obj"
+	-@erase "$(INTDIR)\messages.sbr"
+	-@erase "$(INTDIR)\qcsg.obj"
+	-@erase "$(INTDIR)\qcsg.sbr"
+	-@erase "$(INTDIR)\scriplib.obj"
+	-@erase "$(INTDIR)\scriplib.sbr"
+	-@erase "$(INTDIR)\textures.obj"
+	-@erase "$(INTDIR)\textures.sbr"
+	-@erase "$(INTDIR)\threads.obj"
+	-@erase "$(INTDIR)\threads.sbr"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\wadcfg.obj"
+	-@erase "$(INTDIR)\wadcfg.sbr"
+	-@erase "$(INTDIR)\wadinclude.obj"
+	-@erase "$(INTDIR)\wadinclude.sbr"
+	-@erase "$(INTDIR)\wadpath.obj"
+	-@erase "$(INTDIR)\wadpath.sbr"
+	-@erase "$(INTDIR)\winding.obj"
+	-@erase "$(INTDIR)\winding.sbr"
+	-@erase "$(OUTDIR)\hlcsg.bsc"
+	-@erase "$(OUTDIR)\hlcsg.exe"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MD /W3 /GX /O2 /I "..\common" /I "..\template" /D "NDEBUG" /D "HLCSG" /D "_MBCS" /D "DOUBLEVEC_T" /D "STDC_HEADERS" /D "WIN32" /D "_CONSOLE" /D "SYSTEM_WIN32" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\hlcsg.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\hlcsg.bsc" 
+BSC32_SBRS= \
+	"$(INTDIR)\blockmem.sbr" \
+	"$(INTDIR)\bspfile.sbr" \
+	"$(INTDIR)\cmdlib.sbr" \
+	"$(INTDIR)\filelib.sbr" \
+	"$(INTDIR)\files.sbr" \
+	"$(INTDIR)\log.sbr" \
+	"$(INTDIR)\mathlib.sbr" \
+	"$(INTDIR)\messages.sbr" \
+	"$(INTDIR)\scriplib.sbr" \
+	"$(INTDIR)\threads.sbr" \
+	"$(INTDIR)\winding.sbr" \
+	"$(INTDIR)\autowad.sbr" \
+	"$(INTDIR)\brush.sbr" \
+	"$(INTDIR)\brushunion.sbr" \
+	"$(INTDIR)\hullfile.sbr" \
+	"$(INTDIR)\map.sbr" \
+	"$(INTDIR)\qcsg.sbr" \
+	"$(INTDIR)\textures.sbr" \
+	"$(INTDIR)\wadcfg.sbr" \
+	"$(INTDIR)\wadinclude.sbr" \
+	"$(INTDIR)\wadpath.sbr"
+
+"$(OUTDIR)\hlcsg.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+LINK32_FLAGS=binmode.obj /nologo /stack:0x400000,0x100000 /subsystem:console /incremental:no /pdb:"$(OUTDIR)\hlcsg.pdb" /machine:I386 /out:"$(OUTDIR)\hlcsg.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\blockmem.obj" \
+	"$(INTDIR)\bspfile.obj" \
+	"$(INTDIR)\cmdlib.obj" \
+	"$(INTDIR)\filelib.obj" \
+	"$(INTDIR)\files.obj" \
+	"$(INTDIR)\log.obj" \
+	"$(INTDIR)\mathlib.obj" \
+	"$(INTDIR)\messages.obj" \
+	"$(INTDIR)\scriplib.obj" \
+	"$(INTDIR)\threads.obj" \
+	"$(INTDIR)\winding.obj" \
+	"$(INTDIR)\autowad.obj" \
+	"$(INTDIR)\brush.obj" \
+	"$(INTDIR)\brushunion.obj" \
+	"$(INTDIR)\hullfile.obj" \
+	"$(INTDIR)\map.obj" \
+	"$(INTDIR)\qcsg.obj" \
+	"$(INTDIR)\textures.obj" \
+	"$(INTDIR)\wadcfg.obj" \
+	"$(INTDIR)\wadinclude.obj" \
+	"$(INTDIR)\wadpath.obj"
+
+"$(OUTDIR)\hlcsg.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "hlcsg - Win32 Debug"
+
+OUTDIR=.\Debug
+INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\Debug
+# End Custom Macros
+
+ALL : "$(OUTDIR)\hlcsg.exe" "$(OUTDIR)\hlcsg.bsc"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\autowad.obj"
+	-@erase "$(INTDIR)\autowad.sbr"
+	-@erase "$(INTDIR)\blockmem.obj"
+	-@erase "$(INTDIR)\blockmem.sbr"
+	-@erase "$(INTDIR)\brush.obj"
+	-@erase "$(INTDIR)\brush.sbr"
+	-@erase "$(INTDIR)\brushunion.obj"
+	-@erase "$(INTDIR)\brushunion.sbr"
+	-@erase "$(INTDIR)\bspfile.obj"
+	-@erase "$(INTDIR)\bspfile.sbr"
+	-@erase "$(INTDIR)\cmdlib.obj"
+	-@erase "$(INTDIR)\cmdlib.sbr"
+	-@erase "$(INTDIR)\filelib.obj"
+	-@erase "$(INTDIR)\filelib.sbr"
+	-@erase "$(INTDIR)\files.obj"
+	-@erase "$(INTDIR)\files.sbr"
+	-@erase "$(INTDIR)\hullfile.obj"
+	-@erase "$(INTDIR)\hullfile.sbr"
+	-@erase "$(INTDIR)\log.obj"
+	-@erase "$(INTDIR)\log.sbr"
+	-@erase "$(INTDIR)\map.obj"
+	-@erase "$(INTDIR)\map.sbr"
+	-@erase "$(INTDIR)\mathlib.obj"
+	-@erase "$(INTDIR)\mathlib.sbr"
+	-@erase "$(INTDIR)\messages.obj"
+	-@erase "$(INTDIR)\messages.sbr"
+	-@erase "$(INTDIR)\qcsg.obj"
+	-@erase "$(INTDIR)\qcsg.sbr"
+	-@erase "$(INTDIR)\scriplib.obj"
+	-@erase "$(INTDIR)\scriplib.sbr"
+	-@erase "$(INTDIR)\textures.obj"
+	-@erase "$(INTDIR)\textures.sbr"
+	-@erase "$(INTDIR)\threads.obj"
+	-@erase "$(INTDIR)\threads.sbr"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\vc60.pdb"
+	-@erase "$(INTDIR)\wadcfg.obj"
+	-@erase "$(INTDIR)\wadcfg.sbr"
+	-@erase "$(INTDIR)\wadinclude.obj"
+	-@erase "$(INTDIR)\wadinclude.sbr"
+	-@erase "$(INTDIR)\wadpath.obj"
+	-@erase "$(INTDIR)\wadpath.sbr"
+	-@erase "$(INTDIR)\winding.obj"
+	-@erase "$(INTDIR)\winding.sbr"
+	-@erase "$(OUTDIR)\hlcsg.bsc"
+	-@erase "$(OUTDIR)\hlcsg.exe"
+	-@erase "$(OUTDIR)\hlcsg.map"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MD /W3 /Gm /GX /Zi /Od /I "..\template" /I "..\common" /D "_DEBUG" /D "_MBCS" /D "DOUBLEVEC_T" /D "STDC_HEADERS" /D "WIN32" /D "_CONSOLE" /D "SYSTEM_WIN32" /D "HLCSG" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\hlcsg.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\hlcsg.bsc" 
+BSC32_SBRS= \
+	"$(INTDIR)\blockmem.sbr" \
+	"$(INTDIR)\bspfile.sbr" \
+	"$(INTDIR)\cmdlib.sbr" \
+	"$(INTDIR)\filelib.sbr" \
+	"$(INTDIR)\files.sbr" \
+	"$(INTDIR)\log.sbr" \
+	"$(INTDIR)\mathlib.sbr" \
+	"$(INTDIR)\messages.sbr" \
+	"$(INTDIR)\scriplib.sbr" \
+	"$(INTDIR)\threads.sbr" \
+	"$(INTDIR)\winding.sbr" \
+	"$(INTDIR)\autowad.sbr" \
+	"$(INTDIR)\brush.sbr" \
+	"$(INTDIR)\brushunion.sbr" \
+	"$(INTDIR)\hullfile.sbr" \
+	"$(INTDIR)\map.sbr" \
+	"$(INTDIR)\qcsg.sbr" \
+	"$(INTDIR)\textures.sbr" \
+	"$(INTDIR)\wadcfg.sbr" \
+	"$(INTDIR)\wadinclude.sbr" \
+	"$(INTDIR)\wadpath.sbr"
+
+"$(OUTDIR)\hlcsg.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+LINK32_FLAGS=binmode.obj /nologo /stack:0x1000000,0x100000 /subsystem:console /profile /map:"$(INTDIR)\hlcsg.map" /debug /machine:I386 /out:"$(OUTDIR)\hlcsg.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\blockmem.obj" \
+	"$(INTDIR)\bspfile.obj" \
+	"$(INTDIR)\cmdlib.obj" \
+	"$(INTDIR)\filelib.obj" \
+	"$(INTDIR)\files.obj" \
+	"$(INTDIR)\log.obj" \
+	"$(INTDIR)\mathlib.obj" \
+	"$(INTDIR)\messages.obj" \
+	"$(INTDIR)\scriplib.obj" \
+	"$(INTDIR)\threads.obj" \
+	"$(INTDIR)\winding.obj" \
+	"$(INTDIR)\autowad.obj" \
+	"$(INTDIR)\brush.obj" \
+	"$(INTDIR)\brushunion.obj" \
+	"$(INTDIR)\hullfile.obj" \
+	"$(INTDIR)\map.obj" \
+	"$(INTDIR)\qcsg.obj" \
+	"$(INTDIR)\textures.obj" \
+	"$(INTDIR)\wadcfg.obj" \
+	"$(INTDIR)\wadinclude.obj" \
+	"$(INTDIR)\wadpath.obj"
+
+"$(OUTDIR)\hlcsg.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "hlcsg - Win32 Release w Symbols"
+
+OUTDIR=.\Release_w_Symbols
+INTDIR=.\Release_w_Symbols
+# Begin Custom Macros
+OutDir=.\Release_w_Symbols
+# End Custom Macros
+
+ALL : "$(OUTDIR)\hlcsg.exe" "$(OUTDIR)\hlcsg.bsc"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\autowad.obj"
+	-@erase "$(INTDIR)\autowad.sbr"
+	-@erase "$(INTDIR)\blockmem.obj"
+	-@erase "$(INTDIR)\blockmem.sbr"
+	-@erase "$(INTDIR)\brush.obj"
+	-@erase "$(INTDIR)\brush.sbr"
+	-@erase "$(INTDIR)\brushunion.obj"
+	-@erase "$(INTDIR)\brushunion.sbr"
+	-@erase "$(INTDIR)\bspfile.obj"
+	-@erase "$(INTDIR)\bspfile.sbr"
+	-@erase "$(INTDIR)\cmdlib.obj"
+	-@erase "$(INTDIR)\cmdlib.sbr"
+	-@erase "$(INTDIR)\filelib.obj"
+	-@erase "$(INTDIR)\filelib.sbr"
+	-@erase "$(INTDIR)\files.obj"
+	-@erase "$(INTDIR)\files.sbr"
+	-@erase "$(INTDIR)\hullfile.obj"
+	-@erase "$(INTDIR)\hullfile.sbr"
+	-@erase "$(INTDIR)\log.obj"
+	-@erase "$(INTDIR)\log.sbr"
+	-@erase "$(INTDIR)\map.obj"
+	-@erase "$(INTDIR)\map.sbr"
+	-@erase "$(INTDIR)\mathlib.obj"
+	-@erase "$(INTDIR)\mathlib.sbr"
+	-@erase "$(INTDIR)\messages.obj"
+	-@erase "$(INTDIR)\messages.sbr"
+	-@erase "$(INTDIR)\qcsg.obj"
+	-@erase "$(INTDIR)\qcsg.sbr"
+	-@erase "$(INTDIR)\scriplib.obj"
+	-@erase "$(INTDIR)\scriplib.sbr"
+	-@erase "$(INTDIR)\textures.obj"
+	-@erase "$(INTDIR)\textures.sbr"
+	-@erase "$(INTDIR)\threads.obj"
+	-@erase "$(INTDIR)\threads.sbr"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\vc60.pdb"
+	-@erase "$(INTDIR)\wadcfg.obj"
+	-@erase "$(INTDIR)\wadcfg.sbr"
+	-@erase "$(INTDIR)\wadinclude.obj"
+	-@erase "$(INTDIR)\wadinclude.sbr"
+	-@erase "$(INTDIR)\wadpath.obj"
+	-@erase "$(INTDIR)\wadpath.sbr"
+	-@erase "$(INTDIR)\winding.obj"
+	-@erase "$(INTDIR)\winding.sbr"
+	-@erase "$(OUTDIR)\hlcsg.bsc"
+	-@erase "$(OUTDIR)\hlcsg.exe"
+	-@erase "$(OUTDIR)\hlcsg.map"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MD /W3 /GX /Zi /O2 /I "..\common" /I "..\template" /D "NDEBUG" /D "_MBCS" /D "DOUBLEVEC_T" /D "STDC_HEADERS" /D "WIN32" /D "_CONSOLE" /D "SYSTEM_WIN32" /D "HLCSG" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\hlcsg.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\hlcsg.bsc" 
+BSC32_SBRS= \
+	"$(INTDIR)\blockmem.sbr" \
+	"$(INTDIR)\bspfile.sbr" \
+	"$(INTDIR)\cmdlib.sbr" \
+	"$(INTDIR)\filelib.sbr" \
+	"$(INTDIR)\files.sbr" \
+	"$(INTDIR)\log.sbr" \
+	"$(INTDIR)\mathlib.sbr" \
+	"$(INTDIR)\messages.sbr" \
+	"$(INTDIR)\scriplib.sbr" \
+	"$(INTDIR)\threads.sbr" \
+	"$(INTDIR)\winding.sbr" \
+	"$(INTDIR)\autowad.sbr" \
+	"$(INTDIR)\brush.sbr" \
+	"$(INTDIR)\brushunion.sbr" \
+	"$(INTDIR)\hullfile.sbr" \
+	"$(INTDIR)\map.sbr" \
+	"$(INTDIR)\qcsg.sbr" \
+	"$(INTDIR)\textures.sbr" \
+	"$(INTDIR)\wadcfg.sbr" \
+	"$(INTDIR)\wadinclude.sbr" \
+	"$(INTDIR)\wadpath.sbr"
+
+"$(OUTDIR)\hlcsg.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+LINK32_FLAGS=binmode.obj /nologo /stack:0x400000,0x100000 /subsystem:console /pdb:none /map:"$(INTDIR)\hlcsg.map" /debug /machine:I386 /out:"$(OUTDIR)\hlcsg.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\blockmem.obj" \
+	"$(INTDIR)\bspfile.obj" \
+	"$(INTDIR)\cmdlib.obj" \
+	"$(INTDIR)\filelib.obj" \
+	"$(INTDIR)\files.obj" \
+	"$(INTDIR)\log.obj" \
+	"$(INTDIR)\mathlib.obj" \
+	"$(INTDIR)\messages.obj" \
+	"$(INTDIR)\scriplib.obj" \
+	"$(INTDIR)\threads.obj" \
+	"$(INTDIR)\winding.obj" \
+	"$(INTDIR)\autowad.obj" \
+	"$(INTDIR)\brush.obj" \
+	"$(INTDIR)\brushunion.obj" \
+	"$(INTDIR)\hullfile.obj" \
+	"$(INTDIR)\map.obj" \
+	"$(INTDIR)\qcsg.obj" \
+	"$(INTDIR)\textures.obj" \
+	"$(INTDIR)\wadcfg.obj" \
+	"$(INTDIR)\wadinclude.obj" \
+	"$(INTDIR)\wadpath.obj"
+
+"$(OUTDIR)\hlcsg.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ELSEIF  "$(CFG)" == "hlcsg - Win32 Super_Debug"
+
+OUTDIR=.\Super_Debug
+INTDIR=.\Super_Debug
+# Begin Custom Macros
+OutDir=.\Super_Debug
+# End Custom Macros
+
+ALL : "$(OUTDIR)\hlcsg.exe" "$(OUTDIR)\hlcsg.bsc"
+
+
+CLEAN :
+	-@erase "$(INTDIR)\autowad.obj"
+	-@erase "$(INTDIR)\autowad.sbr"
+	-@erase "$(INTDIR)\blockmem.obj"
+	-@erase "$(INTDIR)\blockmem.sbr"
+	-@erase "$(INTDIR)\brush.obj"
+	-@erase "$(INTDIR)\brush.sbr"
+	-@erase "$(INTDIR)\brushunion.obj"
+	-@erase "$(INTDIR)\brushunion.sbr"
+	-@erase "$(INTDIR)\bspfile.obj"
+	-@erase "$(INTDIR)\bspfile.sbr"
+	-@erase "$(INTDIR)\cmdlib.obj"
+	-@erase "$(INTDIR)\cmdlib.sbr"
+	-@erase "$(INTDIR)\filelib.obj"
+	-@erase "$(INTDIR)\filelib.sbr"
+	-@erase "$(INTDIR)\files.obj"
+	-@erase "$(INTDIR)\files.sbr"
+	-@erase "$(INTDIR)\hullfile.obj"
+	-@erase "$(INTDIR)\hullfile.sbr"
+	-@erase "$(INTDIR)\log.obj"
+	-@erase "$(INTDIR)\log.sbr"
+	-@erase "$(INTDIR)\map.obj"
+	-@erase "$(INTDIR)\map.sbr"
+	-@erase "$(INTDIR)\mathlib.obj"
+	-@erase "$(INTDIR)\mathlib.sbr"
+	-@erase "$(INTDIR)\messages.obj"
+	-@erase "$(INTDIR)\messages.sbr"
+	-@erase "$(INTDIR)\qcsg.obj"
+	-@erase "$(INTDIR)\qcsg.sbr"
+	-@erase "$(INTDIR)\scriplib.obj"
+	-@erase "$(INTDIR)\scriplib.sbr"
+	-@erase "$(INTDIR)\textures.obj"
+	-@erase "$(INTDIR)\textures.sbr"
+	-@erase "$(INTDIR)\threads.obj"
+	-@erase "$(INTDIR)\threads.sbr"
+	-@erase "$(INTDIR)\vc60.idb"
+	-@erase "$(INTDIR)\vc60.pdb"
+	-@erase "$(INTDIR)\wadcfg.obj"
+	-@erase "$(INTDIR)\wadcfg.sbr"
+	-@erase "$(INTDIR)\wadinclude.obj"
+	-@erase "$(INTDIR)\wadinclude.sbr"
+	-@erase "$(INTDIR)\wadpath.obj"
+	-@erase "$(INTDIR)\wadpath.sbr"
+	-@erase "$(INTDIR)\winding.obj"
+	-@erase "$(INTDIR)\winding.sbr"
+	-@erase "$(OUTDIR)\hlcsg.bsc"
+	-@erase "$(OUTDIR)\hlcsg.exe"
+	-@erase "$(OUTDIR)\hlcsg.map"
+
+"$(OUTDIR)" :
+    if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
+
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\common" /I "..\template" /D "_DEBUG" /D "HLCSG" /D "_MBCS" /D "DOUBLEVEC_T" /D "STDC_HEADERS" /D "WIN32" /D "_CONSOLE" /D "SYSTEM_WIN32" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\hlcsg.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c 
+BSC32=bscmake.exe
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\hlcsg.bsc" 
+BSC32_SBRS= \
+	"$(INTDIR)\blockmem.sbr" \
+	"$(INTDIR)\bspfile.sbr" \
+	"$(INTDIR)\cmdlib.sbr" \
+	"$(INTDIR)\filelib.sbr" \
+	"$(INTDIR)\files.sbr" \
+	"$(INTDIR)\log.sbr" \
+	"$(INTDIR)\mathlib.sbr" \
+	"$(INTDIR)\messages.sbr" \
+	"$(INTDIR)\scriplib.sbr" \
+	"$(INTDIR)\threads.sbr" \
+	"$(INTDIR)\winding.sbr" \
+	"$(INTDIR)\autowad.sbr" \
+	"$(INTDIR)\brush.sbr" \
+	"$(INTDIR)\brushunion.sbr" \
+	"$(INTDIR)\hullfile.sbr" \
+	"$(INTDIR)\map.sbr" \
+	"$(INTDIR)\qcsg.sbr" \
+	"$(INTDIR)\textures.sbr" \
+	"$(INTDIR)\wadcfg.sbr" \
+	"$(INTDIR)\wadinclude.sbr" \
+	"$(INTDIR)\wadpath.sbr"
+
+"$(OUTDIR)\hlcsg.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
+    $(BSC32) @<<
+  $(BSC32_FLAGS) $(BSC32_SBRS)
+<<
+
+LINK32=link.exe
+LINK32_FLAGS=binmode.obj /nologo /stack:0x1000000,0x100000 /subsystem:console /profile /map:"$(INTDIR)\hlcsg.map" /debug /machine:I386 /out:"$(OUTDIR)\hlcsg.exe" 
+LINK32_OBJS= \
+	"$(INTDIR)\blockmem.obj" \
+	"$(INTDIR)\bspfile.obj" \
+	"$(INTDIR)\cmdlib.obj" \
+	"$(INTDIR)\filelib.obj" \
+	"$(INTDIR)\files.obj" \
+	"$(INTDIR)\log.obj" \
+	"$(INTDIR)\mathlib.obj" \
+	"$(INTDIR)\messages.obj" \
+	"$(INTDIR)\scriplib.obj" \
+	"$(INTDIR)\threads.obj" \
+	"$(INTDIR)\winding.obj" \
+	"$(INTDIR)\autowad.obj" \
+	"$(INTDIR)\brush.obj" \
+	"$(INTDIR)\brushunion.obj" \
+	"$(INTDIR)\hullfile.obj" \
+	"$(INTDIR)\map.obj" \
+	"$(INTDIR)\qcsg.obj" \
+	"$(INTDIR)\textures.obj" \
+	"$(INTDIR)\wadcfg.obj" \
+	"$(INTDIR)\wadinclude.obj" \
+	"$(INTDIR)\wadpath.obj"
+
+"$(OUTDIR)\hlcsg.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+    $(LINK32) @<<
+  $(LINK32_FLAGS) $(LINK32_OBJS)
+<<
+
+!ENDIF 
+
+.c{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.obj::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.c{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cpp{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+.cxx{$(INTDIR)}.sbr::
+   $(CPP) @<<
+   $(CPP_PROJ) $< 
+<<
+
+
+!IF "$(NO_EXTERNAL_DEPS)" != "1"
+!IF EXISTS("hlcsg.dep")
+!INCLUDE "hlcsg.dep"
+!ELSE 
+!MESSAGE Warning: cannot find "hlcsg.dep"
+!ENDIF 
+!ENDIF 
+
+
+!IF "$(CFG)" == "hlcsg - Win32 Release" || "$(CFG)" == "hlcsg - Win32 Debug" || "$(CFG)" == "hlcsg - Win32 Release w Symbols" || "$(CFG)" == "hlcsg - Win32 Super_Debug"
+SOURCE=..\common\blockmem.cpp
+
+"$(INTDIR)\blockmem.obj"	"$(INTDIR)\blockmem.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\bspfile.cpp
+
+"$(INTDIR)\bspfile.obj"	"$(INTDIR)\bspfile.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\cmdlib.cpp
+
+"$(INTDIR)\cmdlib.obj"	"$(INTDIR)\cmdlib.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\filelib.cpp
+
+"$(INTDIR)\filelib.obj"	"$(INTDIR)\filelib.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\files.cpp
+
+"$(INTDIR)\files.obj"	"$(INTDIR)\files.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\log.cpp
+
+"$(INTDIR)\log.obj"	"$(INTDIR)\log.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\mathlib.cpp
+
+"$(INTDIR)\mathlib.obj"	"$(INTDIR)\mathlib.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\messages.cpp
+
+"$(INTDIR)\messages.obj"	"$(INTDIR)\messages.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\scriplib.cpp
+
+"$(INTDIR)\scriplib.obj"	"$(INTDIR)\scriplib.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\threads.cpp
+
+"$(INTDIR)\threads.obj"	"$(INTDIR)\threads.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=..\common\winding.cpp
+
+"$(INTDIR)\winding.obj"	"$(INTDIR)\winding.sbr" : $(SOURCE) "$(INTDIR)"
+	$(CPP) $(CPP_PROJ) $(SOURCE)
+
+
+SOURCE=.\autowad.cpp
+
+"$(INTDIR)\autowad.obj"	"$(INTDIR)\autowad.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\brush.cpp
+
+"$(INTDIR)\brush.obj"	"$(INTDIR)\brush.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\brushunion.cpp
+
+"$(INTDIR)\brushunion.obj"	"$(INTDIR)\brushunion.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\hullfile.cpp
+
+"$(INTDIR)\hullfile.obj"	"$(INTDIR)\hullfile.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\map.cpp
+
+"$(INTDIR)\map.obj"	"$(INTDIR)\map.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\qcsg.cpp
+
+"$(INTDIR)\qcsg.obj"	"$(INTDIR)\qcsg.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\textures.cpp
+
+"$(INTDIR)\textures.obj"	"$(INTDIR)\textures.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\wadcfg.cpp
+
+"$(INTDIR)\wadcfg.obj"	"$(INTDIR)\wadcfg.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\wadinclude.cpp
+
+"$(INTDIR)\wadinclude.obj"	"$(INTDIR)\wadinclude.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+SOURCE=.\wadpath.cpp
+
+"$(INTDIR)\wadpath.obj"	"$(INTDIR)\wadpath.sbr" : $(SOURCE) "$(INTDIR)"
+
+
+
+!ENDIF 
+

+ 746 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/hlcsg.vcproj

@@ -0,0 +1,746 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="hlcsg"
+	ProjectGUID="{6A4E6C36-5342-46CF-BB1C-A4FF993AEA3F}"
+	RootNamespace="hlcsg"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory=".\Release"
+			IntermediateDirectory=".\Release"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			UseOfATL="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\Release/hlcsg.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="false"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				WholeProgramOptimization="true"
+				AdditionalIncludeDirectories="D:\Programs\MSPlatformSDKServer2003\Include\atl;..\common;..\template"
+				PreprocessorDefinitions="NDEBUG,HLCSG,DOUBLEVEC_T,STDC_HEADERS,WIN32,_CONSOLE,SYSTEM_WIN32"
+				StringPooling="true"
+				ExceptionHandling="1"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="false"
+				EnableEnhancedInstructionSet="2"
+				FloatingPointModel="0"
+				RuntimeTypeInfo="false"
+				OpenMP="false"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Release/hlcsg.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Release/hlcsg.exe"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ProgramDatabaseFile=".\Release/hlcsg.pdb"
+				SubSystem="1"
+				StackReserveSize="4194304"
+				StackCommitSize="1048576"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="0"
+				LinkTimeCodeGeneration="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			UseOfATL="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="0"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Release/hlcsg.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UseUnicodeResponseFiles="false"
+				Optimization="3"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				WholeProgramOptimization="true"
+				AdditionalIncludeDirectories="D:\Programs\MSPlatformSDKServer2003\Include\atl;..\common;..\template"
+				PreprocessorDefinitions="NDEBUG,HLCSG,DOUBLEVEC_T,STDC_HEADERS,WIN32,_CONSOLE,SYSTEM_WIN32"
+				StringPooling="true"
+				RuntimeLibrary="0"
+				BufferSecurityCheck="false"
+				EnableFunctionLevelLinking="true"
+				EnableEnhancedInstructionSet="0"
+				FloatingPointModel="0"
+				RuntimeTypeInfo="false"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Release/hlcsg.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				Detect64BitPortabilityProblems="false"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Release/hlcsg.exe"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ProgramDatabaseFile=".\Release/hlcsg.pdb"
+				SubSystem="1"
+				StackReserveSize="4194304"
+				StackCommitSize="1048576"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory=".\Debug"
+			IntermediateDirectory=".\Debug"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\Debug/hlcsg.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\template,..\common"
+				PreprocessorDefinitions="_DEBUG,DOUBLEVEC_T,STDC_HEADERS,WIN32,_CONSOLE,SYSTEM_WIN32,HLCSG"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Debug/hlcsg.pch"
+				AssemblerListingLocation=".\Debug/"
+				ObjectFile=".\Debug/"
+				ProgramDataBaseFileName=".\Debug/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Debug/hlcsg.exe"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/hlcsg.pdb"
+				GenerateMapFile="true"
+				MapFileName=".\Debug/hlcsg.map"
+				SubSystem="1"
+				StackReserveSize="16777216"
+				StackCommitSize="1048576"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+				TypeLibraryName=".\Debug/hlcsg.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\template,..\common"
+				PreprocessorDefinitions="_DEBUG,DOUBLEVEC_T,STDC_HEADERS,WIN32,_CONSOLE,SYSTEM_WIN32,HLCSG"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Debug/hlcsg.pch"
+				AssemblerListingLocation=".\Debug/"
+				ObjectFile=".\Debug/"
+				ProgramDataBaseFileName=".\Debug/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_DEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Debug/hlcsg.exe"
+				LinkIncremental="2"
+				SuppressStartupBanner="true"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=".\Debug/hlcsg.pdb"
+				GenerateMapFile="true"
+				MapFileName=".\Debug/hlcsg.map"
+				SubSystem="1"
+				StackReserveSize="16777216"
+				StackCommitSize="1048576"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release x64|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TypeLibraryName=".\Release/hlcsg.tlb"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				InlineFunctionExpansion="2"
+				EnableIntrinsicFunctions="true"
+				FavorSizeOrSpeed="1"
+				AdditionalIncludeDirectories="D:\Programs\MSPlatformSDKServer2003\Include\atl;..\common;..\template"
+				PreprocessorDefinitions="NDEBUG,HLCSG,DOUBLEVEC_T,STDC_HEADERS,WIN32,_CONSOLE,SYSTEM_WIN32"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				EnableEnhancedInstructionSet="2"
+				UsePrecompiledHeader="0"
+				PrecompiledHeaderFile=".\Release/hlcsg.pch"
+				AssemblerListingLocation=".\Release/"
+				ObjectFile=".\Release/"
+				ProgramDataBaseFileName=".\Release/"
+				BrowseInformation="1"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				Detect64BitPortabilityProblems="false"
+				CompileAs="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="NDEBUG"
+				Culture="1033"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalOptions="/MACHINE:I386"
+				AdditionalDependencies="binmode.obj"
+				OutputFile=".\Release/hlcsg.exe"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				ProgramDatabaseFile=".\Release/hlcsg.pdb"
+				SubSystem="1"
+				StackReserveSize="4194304"
+				StackCommitSize="1048576"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				OptimizeForWindows98="2"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release x64|x64"
+			ConfigurationType="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
+			>
+			<File
+				RelativePath=".\autowad.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\brush.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\brushunion.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\hullfile.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\map.cpp"
+				>
+			</File>
+			<File
+				RelativePath="properties.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\qcsg.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\textures.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\wadcfg.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\wadinclude.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\wadpath.cpp"
+				>
+			</File>
+			<Filter
+				Name="common"
+				>
+				<File
+					RelativePath="..\common\blockmem.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\bspfile.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\cmdlib.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\filelib.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\files.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\log.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\mathlib.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\messages.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\threads.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\common\winding.cpp"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;fi;fd"
+			>
+			<File
+				RelativePath="..\common\blockmem.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\boundingbox.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\bspfile.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\cmdlib.h"
+				>
+			</File>
+			<File
+				RelativePath=".\csg.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\filelib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\hlassert.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\log.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\mathlib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\mathtypes.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\messages.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\scriplib.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\common\scriplib.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\threads.h"
+				>
+			</File>
+			<File
+				RelativePath=".\wadpath.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\win32fix.h"
+				>
+			</File>
+			<File
+				RelativePath="..\common\winding.h"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

+ 177 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/hlcsg.vcproj.SILENCERSPC.Administrator.user

@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+	ProjectType="Visual C++"
+	Version="9.00"
+	ShowAllFiles="false"
+	>
+	<Configurations>
+		<Configuration
+			Name="Release|Win32"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|Win32"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release x64|Win32"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release x64|x64"
+			>
+			<DebugSettings
+				Command="$(TargetPath)"
+				WorkingDirectory=""
+				CommandArguments=""
+				Attach="false"
+				DebuggerType="3"
+				Remote="1"
+				RemoteMachine="SILENCERSPC"
+				RemoteCommand=""
+				HttpUrl=""
+				PDBPath=""
+				SQLDebugging=""
+				Environment=""
+				EnvironmentMerge="true"
+				DebuggerFlavor=""
+				MPIRunCommand=""
+				MPIRunArguments=""
+				MPIRunWorkingDirectory=""
+				ApplicationCommand=""
+				ApplicationArguments=""
+				ShimCommand=""
+				MPIAcceptMode=""
+				MPIAcceptFilter=""
+			/>
+		</Configuration>
+	</Configurations>
+</VisualStudioUserFile>

+ 0 - 0
Compiler/Tools/SHLT-3.9/SHLT 3.9 Sourcecode/SHLT/hlcsg/hullfile.cpp


Some files were not shown because too many files changed in this diff