Since we've already generated a bsp tree at this point, we may as well use our
knowledge about it's properties. If our line is completely on one side of the
decision node, we only need to recurse down one of the child nodes.
Signed-off-by: Tyrann <tyrann@disenchant.net>
We need to allow for floating-point imprecisions when testing a line against
collision with bsp surfaces. This fixes a problem where the simplified leak
line generated would appear to pass through solid surfaces in the bsp.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Set the vec_t type to "double" using the DOUBLEVEC_T preproccessor define. Fix
up hard-coded usages of float in various places throughout the code. Note that
texinfo_t is an on-disk structure, so that needs to stay as float and we work
around incompatibilities with the vector functions using a temporary vec3_t.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Make needlessly global functions/variables static.
Move some checking functions inside an #ifdef PARANOID section.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Now that we're compiling as C code, the memory returned by AllocMem no longer
needs to be explicitly cast when assigning to our typed pointers.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Now that all the C++isms have been removed, rename the .cpp source files to .c
and remove the special case makefile rules for compiling qbsp object files.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Replace three "const" declarations in qbsp.h with #defines to prevent multiple
definitions being compiled in when compiling as C code.
Signed-off-by: Tyrann <tyrann@disenchant.net>
There's a couple of usages outside of the AllocMem/FreeMem functions. Flag
these as something to look at later.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Nothing too exciting here, just replacing more C++ code with plain C. The
parser class is gone - we just use a global token now and call ParseToken to
update it.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Replace the WAD class with plain C code. Class WAD becomes wad_t and the
member functions are just normal functions taking a wad_t as an argument.
The iWad member was a bit strange. It was used in some member functions for
walking the wadlist array. I've elimanted that from the struct and made the
functions track that state themselves.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Replace the "File" class with basic stdio C functions. The LoadFile is kept
basically intact. All instances of File objects are replaced with FILE*. Calls
to member functions are replaced with inline C code. There is some redundancy
with the error checking, but this can probably be cleaned up a little bit by
using some of the SafeOpen, etc. functions from common/cmdlib.c.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Make some bare-minimum changes to get qbsp to build with gcc/g++ and
MinGW/Msys.
o Added makefile rules
o Work around windows specific calls to e.g. _getcwd
o Use noecho() / echo() calls around getch() in Linux
o Substitute stricmp -> strcasecmp (in Makefile for now)
o Fix non-portable (incorrect?) of inline
o Fix misuse of delete where delete [] is required...
Signed-off-by: Tyrann <tyrann@disenchant.net>
More source mangling; run indent over the source files to make it more
consistent with the rest of my utils code. Remove any trailing whitespace
while we're at it.
Signed-off-by: Tyrann <tyrann@disenchant.net>
Import QBSP sources from Greg Lewis' TreeQBSP version 1.62.
- http://www.yossman.net/~tree/
Thanks to Greg for allowing me to use his modified source code:
On Fri, Aug 25, 2006 at 04:28:24PM -0400, Tree wrote:
> I imagine you've already gone ahead with your plans, but feel free to do
> whatever you wish with the source for TreeQBSP; I have no interest in
> restricting anyone's access to it (and of course I was just modifying id's
> code anyway). I'm just glad to see that it was of some use to you. :)
>
> Greg
The files are unmodified from the originals, apart from lower-casing the
filenames and removing ASCII CR characters from end of lines.
Signed-off-by: Tyrann <tyrann@disenchant.net>