Commit Graph

2150 Commits

Author SHA1 Message Date
Tyrann f089c31fce [PATCH] qbsp: More wad structure naming cleanups
Rename a couple more structure members to make their purposes clearer;
- wad_t::Wad -> wad_t::file             - it's a file handle
- wadlist_t::wadlist -> wadlist_t::wads - yes, we already know it's a list

Also, get rid of fileT from WADList_LoadLumpInfo.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-10-02 10:29:54 +09:30
Tyrann fbe06cdb51 [PATCH] qbsp: Swap wad_t and wadlist_t struct names
The wad_t struct is actually a list of wads, and the wadlist_t struct
represents the info for a single wad. This is kind of backwards, so reverse
the names. A few function renames went along with this to make things look
saner.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-10-02 10:00:12 +09:30
Tyrann bba30bcc2e [PATCH] qbsp: Remove unnecessary name field from wad_t
wad_t::name isn't required outside of some temporary usage in WAD_InitWadList
so doesn't really belong in the struct.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-10-02 09:30:27 +09:30
Tyrann c5b7fa7d2b [PATCH] qbsp: Account size of winding_t allocations
Memory stats are reported inaccurately because the memory allocated to
windings is not accounted correctly (when freed, in particular). Use the usual
technique of recording the allocated size in the same block of memory, just
before the portion returned to the caller.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-10-01 20:21:44 +09:30
Tyrann 47c83e7db7 [PATCH] qbsp: Don't overwrite wad list length
Fix a bug introduced in my class File -> stdio conversion. Don't use the len
variable to save the result of fread, since it's still needed as part of the
loop condition!

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-25 20:16:18 +09:30
Tyrann b9a0bf538e [PATCH] qbsp: Add support for QuArK map files
QuArK generates floating point values for the brush face plane points and also
has it's own way of defining texture placement. Read in all plane points as
floats (does no harm maps that use integers) and also parse the extra comment
at end of line which indicates that the special texturing rules apply to the
face (two variants).

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-17 21:36:01 +09:30
Tyrann 3feeec1778 [PATCH] qbsp: Factor out texture vector calculation
Move the QuakeEd style texture vector calculations out of the ParseBrush
function. This will keep things tidier when adding other the other types of
texture vector calculation.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-17 10:02:43 +09:30
Tyrann ad5e555e89 [PATCH] qbsp: Enable map file parser to return comment tokens
Change the boolean argument to parsetoken to a set of optional flags. Calls
that previously had crossline == false now pass PARSE_SAMELINE instead. Add
PARSE_COMMENT flag to parse the next token as a comment. If the token isn't a
comment, then return false.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 22:24:09 +09:30
Tyrann e660c87c32 [PATCH] qbsp: remove strange comment...
Perhaps just a remnant from some previous debugging work..?

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 19:52:36 +09:30
Tyrann 50f526d44c [PATCH] qbsp: Constify VectorXX functions
Specify const where applicable in the VectorXX functions. This fixes a
compiler warning introduced in the last patch.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 19:37:48 +09:30
Tyrann d6b1b4de87 [PATCH] qbsp: Utilise bsp tree properties in line intesection test
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>
2006-09-16 19:34:26 +09:30
Tyrann 45c5ec349b [PATCH] qbsp: Allow for FP imprecision in LineIntersect_r
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>
2006-09-16 19:34:21 +09:30
Tyrann bffce8c99b [PATCH] qbsp: refactor leak trail printing
Consolidate identical code from MarkLeakTrail and SimplifyLeakLine into a
separate function.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 19:34:17 +09:30
Tyrann bdbae95003 [PATCH] qbsp: Fix typo in leak file generation
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 19:34:13 +09:30
Tyrann 4464491807 [PATCH] qbsp: Use double-precision floating point
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>
2006-09-16 16:36:16 +09:30
Tyrann b550faf877 [PATCH] qbsp: Remove unnecessary cast of malloc return value
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 16:31:06 +09:30
Tyrann dc9b279203 [PATCH] qbsp: remove unused filename variable
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 16:31:02 +09:30
Tyrann 41d3de5180 [PATCH] qbsp: Don't forget to call Wad destructor
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 16:30:58 +09:30
Tyrann 90710dc8d8 [PATCH] qbsp: Fix cast of data pointer for LoadFile callers
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-16 16:20:56 +09:30
Tyrann 073959d654 [PATCH 15/15] qbsp: writebsp.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:46:03 +09:30
Tyrann b38a84b657 [PATCH 14/15] qbsp: util.c statics
Make needlessly global functions/variables static.
Move 'extern' declarations to qbsp.h.
Don't compile unused FreeAllMem function.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:46:02 +09:30
Tyrann 5afe45acda [PATCH 13/15] qbsp: tjunc.c static
Make needlessly global functions/variables static.
Remove unused function PrintFace.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:46:02 +09:30
Tyrann b6e104e2b4 [PATCH 12/15] qbsp: surfaces.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:46:01 +09:30
Tyrann c47243a1c1 [PATCH 11/15] qbsp: solidbsp.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:46:01 +09:30
Tyrann 4b9560a60c [PATCH 10/15] qbsp: qbsp.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:46:00 +09:30
Tyrann 0a230cc79d [PATCH 09/15] qbsp: portals.c statics
Make needlessly global functions/variables static.
Move some checking functions inside an #ifdef PARANOID section.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:59 +09:30
Tyrann a79e5c28b2 [PATCH 08/15] qbsp: parser.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:59 +09:30
Tyrann e89f25be80 [PATCH 07/15] qbsp: outside.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:58 +09:30
Tyrann 898f66d460 [PATCH 06/15] qbsp: merge.c statics
Make needlessly global functions/variables static.
Don't compile CheckColinear unless doing parnoid checks.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:58 +09:30
Tyrann 950b163181 [PATCH 05/15] qbsp: map.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:57 +09:30
Tyrann 525c3ec2fe [PATCH 04/15] qbsp: csg4.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:57 +09:30
Tyrann 5e29db5df0 [PATCH 03/15] qbsp: cmdlib.c statics
Make needlessly global functions/variables static.
Remove unused functions Q_getwd, DefaultPath and StripFilename.
Remove unused CRC functions.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:56 +09:30
Tyrann ed50a94fd6 [PATCH 02/15] qbsp: bspfile.c statics
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:55 +09:30
Tyrann 85b459931a [PATCH 01/15] qbsp: brush.c statics
Make needlessly global functions/variables static.
Remove the unused function PlaneTypeForNormal.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 22:45:55 +09:30
Tyrann dcb6fa7c9b [PATCH] qbsp: Remove unnecessary casts from AllocMem calls
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>
2006-09-10 20:29:00 +09:30
Tyrann 50e6c880cc [PATCH 9/9] qbsp: Compile as C code
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>
2006-09-10 17:38:34 +09:30
Tyrann 1c082ace11 [PATCH 8/9] qbsp: Remove stricmp/strcasecmp workaround
Patch the source files and remove the preprocessor workaround for
stricmp/strcasecmp substitution.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 17:38:34 +09:30
Tyrann 099e22f733 [PATCH 7/9] qbsp: Replace C++ consts with defines
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>
2006-09-10 17:38:33 +09:30
Tyrann 8ef5c8bc5d [PATCH 6/9] qbsp: Remove two C++ style casts
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 17:38:33 +09:30
Tyrann 2dfd647656 [PATCH 5/9] qbsp: Replace new/delete with malloc/free
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>
2006-09-10 17:38:32 +09:30
Tyrann 293efefa26 [PATCH 4/9] qbsp: Remove default arguments from {Alloc,Free}Mem
More C++ removal. Just pass the default arguments explicitly.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-10 17:38:32 +09:30
Tyrann 45c387c7eb [PATCH 3/9] qbsp: Replace parser class with plain C code
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>
2006-09-10 17:38:31 +09:30
Tyrann 0cae98f22f [PATCH 2/9] qbsp: Replace WAD class
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>
2006-09-10 17:38:30 +09:30
Tyrann 8bded2dfaf [PATCH 1/9] qbsp: Replace File class with basic stdio functions
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>
2006-09-10 17:38:30 +09:30
Tyrann 25f6148fc3 [PATCH] Make qbsp build
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>
2006-09-10 17:35:05 +09:30
Tyrann a2c8785d81 [PATCH 3/3] qbsp: run indent over the source files
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>
2006-09-05 20:57:33 +09:30
Tyrann 689790cbdb [PATCH 2/3] qbsp: consistently use newline at EOF
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-05 20:57:21 +09:30
Tyrann 950c8ab0de [PATCH 1/3] qbsp: add copyright notices and license info
Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-09-05 20:56:57 +09:30
Tyrann d0a0c3c15c [PATCH] Import QBSP sources
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>
2006-08-29 00:03:53 +09:30
Tyrann 2c2f3c8eb6 Import initial sources 2006-08-28 23:58:10 +09:30