Commit Graph

38 Commits

Author SHA1 Message Date
Kevin Shanahan 456565d17f qbsp: add the -2psb command line option to output RMQ style BSP2
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-10-03 11:09:25 +09:30
Kevin Shanahan 50b78f3d61 qbsp, common: support both DP and RMQ variants of the BSP2 format
Turns out there are two types of "BSP2" format - one that I think was
created by MH and implemented in the RMQ project (this is the one I
implemented previously) and one by LordHavoc which exteneded the
coordinate limits beyond 32k, implemented in Darkplaces.  The
Darkplaces version of BSP2 will get the name BSP2 and the RMQ version,
which is more limited, will get the name BSP2rmq.

qbsp will only create the BSP29 or BSP2 formats, but will cope with a
BSP2rmq format file for an -onlyents compile.  The rest of the tools
can use any of the three formats.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-09-28 11:48:37 +09:30
Kevin Shanahan 5facda6ff9 common: constify vec3_origin
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-20 13:30:05 +09:30
Kevin Shanahan 9c3613e47f qbsp: duplicate the MemSizes array for the two BSP formats
Kind of taking a step backwards here to where we were, but make the
MemSizes array dynamically changable so that we can switch out and
allocate BSP2 sized elements when we want to write a file in that format.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-19 14:36:40 +09:30
Kevin Shanahan 2d65515d0f qbsp: add bsp2 data types to bspfile.h
In preparation for bsp2 support, add the data types for bsp2 structures
to bspfile.h and rename the bsp29 structures to properly differentiate them.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-19 10:25:17 +09:30
Kevin Shanahan 32973e6779 qbsp: re-format the memsize global array
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-19 10:13:11 +09:30
Kevin Shanahan ca02e17b60 qbsp: minor cleanups to CheckFace
Print the length of the degenerate edge if one is detected,
Rename a few variables, etc.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-08-16 13:03:45 +09:30
Kevin Shanahan 51bed53570 qbsp: remove remaining enum errors
Remove the enum Error() function and global error strings as well.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 20:15:09 +09:30
Kevin Shanahan ea5e46f9df qbsp: replace error enums in surfaces.c, solidbsp.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 19:16:53 +09:30
Kevin Shanahan b9fa895988 qbsp: replace enum errors in portals.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:47:36 +09:30
Kevin Shanahan 15da0d818a qbsp: replace enum errors in parser.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:40:13 +09:30
Kevin Shanahan 0e586916b1 qbsp: replace error enums in outside.c, merge.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:32:52 +09:30
Kevin Shanahan c01397ed5b qbsp: replace enum errors in file.c and wad.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:23:24 +09:30
Kevin Shanahan 02e81df39b qbsp: replace error enums in csg4.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:20:02 +09:30
Kevin Shanahan 58b33cc3d4 qbsp: remplace error enums in bspfile.c
Overlapped with outside.c and portals.c for some of the file errors.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 18:15:38 +09:30
Kevin Shanahan 7203d3407b qbsp: replace enum errors in brush.c
One shared message in surfaces.c replaced as well.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 17:59:36 +09:30
Kevin Shanahan d5adbcd8ca qbsp: replace enum errors in qbsp.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 17:39:56 +09:30
Kevin Shanahan 30caae09e5 qbsp: re-factor ParseBrush into smaller pieces
Factor out some of the processing involved with parsing a brush.  When
checking for duplicate planes, use the same "PlaneEqual" functions as
used in brush.c.

Replace the enum style errors with the new Error_ function for all of
map.c so the error string is at the call site.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-04-22 17:33:16 +09:30
Kevin Shanahan 98ccc06ede qbsp: support Valve's version 220 map format
https://developer.valvesoftware.com/wiki/MAP_file_format

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-01 08:24:00 +10:30
Kevin Shanahan 15ab7386ff qbsp: implement the clustermap for PRT2 files
Now that I've done this I realise there could be a more compact
representation by just specifying the number of leafs per cluster, since
leaves are sequentially numbered... but this format is okay as well. And
easy to parse, etc.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-24 12:35:44 +10:30
Kevin Shanahan 746a210f2a qbsp: remove hullnum global and pass to CreateSingleHull()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 11:01:11 +10:30
Kevin Shanahan b8ffeca2c0 qbsp: encapsulate mapbrush => brush conversion data on stack
Still have the limitations of MAX_FACES, etc. but in practice it's
probably not going to be an issue.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 20:09:04 +10:30
Kevin Shanahan 44a22eaa38 qbsp: move global plane and miptex data into mapdata struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 17:04:03 +10:30
Kevin Shanahan 0ff1446df3 qbsp: load map brushes/faces into memory in order
Instead of doing awkward gymnastics to try and load the brushes and faces
into memory in reverse order for compatibility with the original qbsp,
just load them in map file order.

Simplifies iteration over the data, particularly if I want to load less
items than the pre-parse found.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 18:15:39 +10:30
Kevin Shanahan 40034e28d0 qbsp: rename mapdata array members to remove rg prefix
It does make them somewhat less greppable, but makes the variable naming
style more consistent with the rest of the quake utilities.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 11:13:48 +10:30
Kevin Shanahan 4750c67749 qbsp: rename count members of mapdata_t
The count members are actually where we store how much memory has been
allocated for each type of item in the mapdata struct, so rename these to
indicate these are the maximum counts.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 10:55:30 +10:30
Kevin Shanahan 9a50342353 qbsp: similar to map.iBrushes, get rid of map.iFaces
* ParseEntity/ParseBrush now take a mapface_t argument, endface
* mapbrush_t now defines a pointer to first face and count of faces
* entity->iFaces no longer needed

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-14 21:51:11 +10:30
Kevin Shanahan 02eec4fc68 qbsp: tidy up texinfo setup functions
Tidy up the functions that calculate the texinfo data for either QuakeEd
or QuArK texture coordinates.

* Remove cleverness in SetTexinfo_QuArK where checking style1 or style2
  just expand the loop for both cases for increased clarity.
* Pass the face plane into SetTexinfo_QuakeEd so it doesn't need to rely
  on map.iFaces.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-14 16:22:52 +10:30
Kevin Shanahan f163b35932 qbsp: get rid of map.iEntities
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-14 15:17:31 +10:30
Kevin Shanahan cb59bfdc63 qbsp: trivial constification of a few strings/args
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-11 20:05:30 +10:30
Kevin Shanahan d691ff951a qbsp: get rid of pCurEnt
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-10 17:58:52 +10:30
Tyrann fba05c351a [PATCH] qbsp: Increase MAX_BSP_CLIPNODES
Offsets pointing to clipnodes were originally used as signed short (16-bit)
numbers, so that negative numbers could represent the various content types of
leaf nodes. However, only a small number of these types are required, so we
now make use of the rest of the clipnode range.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2007-08-23 20:48:02 +09:30
Tyrann d09b5657f2 [PATCH] qbsp: Fix reporting of peak winding memory use
The number reported for peak memory usage by winding_t structs was not
accurate, due to just using the sizeof(winding_t) for accounting. Track the
_bytes_ used by each type in a separate array. This is pretty much redundant
for everything except windings, but it's the simplest way to implement it for
now.

Also tidied up the verbose memory output a bit - the total column is pretty
useless, so just don't print it. Re-align the other columns and special case
the "Total" line, as only the "Peak Bytes" value is really interesting.

Signed-off-by: Tyrann <tyrann@disenchant.net>
2006-10-02 17:56:34 +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 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 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 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