Commit Graph

2001 Commits

Author SHA1 Message Date
Kevin Shanahan d9e73cf194 qbsp: constify arguments to FaceSide()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 16:03:41 +10:30
Kevin Shanahan da3aa26ee5 qbsp: flag when a surface/node is a detail separator
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 15:57:47 +10:30
Kevin Shanahan 32b94e4843 qbsp: more local variable renaming in solidbsp.c
No more surfaces called 'p' (not sure why I ever used that).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 15:42:49 +10:30
Kevin Shanahan 5abd0e369c qbsp: separate the bsp split plane selection into two passes
All non-detail surfaces are considered and used before any detail
surfaces.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 14:29:44 +10:30
Kevin Shanahan 5275c24393 qbsp: clearer local variable names for Choose{,Mid}PlaneFromList
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 14:03:25 +10:30
Kevin Shanahan 996042482b qbsp: rename FreeBrushsetBrushes -> FreeBrushes
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 13:57:34 +10:30
Kevin Shanahan 146986e74a qbsp: propogate contents flags into faces during csg stage
This will allow us to properly order the bsp nodes/leafs containing detail
brushes.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 11:08:12 +10:30
Kevin Shanahan 66feee616f qbsp: maintain proper precendence ordering of brushes
Need to be a little more careful to order brushes correctly when adding
detail to the worldspawn. CSGFaces assumes that the brushes are ordered
such that earlier brushes have chunks carved out of them by any later
brushes that intersect them.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-22 10:43:05 +10:30
Kevin Shanahan 1b3a8b049f qbsp: only set planenum for face allocations of one element
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 15:10:33 +10:30
Kevin Shanahan e922d6a395 qbsp: trivial change to detail brush stat output
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 14:17:31 +10:30
Kevin Shanahan 341fe08630 qbsp: add contents flag field for brushes and flag detail brushes
During conversion from map brushes to bsp brushes, set the brush detail
flag for later use in CSGFaces().

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 14:15:25 +10:30
Kevin Shanahan d77f2a35c1 qbsp: tidy up output for Brush_LoadEntity
Pull the progress output up into the caller (not ideal) to deal with the
fact we are making extra calls to load the detail entities for the
worldspawn.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 14:13:46 +10:30
Kevin Shanahan bbcb4263d2 qbsp: don't write detail entity key/values to bsp
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 11:32:15 +10:30
Kevin Shanahan 6894518485 qbsp: don't allocate bmodel space for detail entities
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 11:31:22 +10:30
Kevin Shanahan 6bc1df862a qbsp: don't assign model keys for func_detail entities
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-21 11:30:27 +10:30
Kevin Shanahan 2f016cbb09 qbsp: treat func_detail entities as additional brushes for worldspawn
The first step towards supporting detail brushes for Quake 1. This gives
us a way to add detail brushes to a map within the existing mapping tools. A
mapper can simply add a definition for a "func_detail" entity to their
editor and create func_detail entities.

Of course, currently they will behave exactly like world brushes. Future
patches will start to treat them differently.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 16:41:51 +10:30
Kevin Shanahan 918333cfe9 qbsp: Enable loading brushes from one entity into another
Make Brush_LoadEntity() take a source and destination entity arguments. In
order for this to work, intialisation is done before calling and then the
BSP brushes generated from the source entity's map brushes are added to
whatever is already in the destination entity.

Reasons for doing this will become obvious with the following patch! :)

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 16:38:43 +10:30
Kevin Shanahan a5ac09fbd1 qbsp: fix missing declaration of CONTENTS_CLIP from previous patch
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 16:22:22 +10:30
Kevin Shanahan e1c52985a2 qbsp: move brush contents logic up into Brush_LoadEntity
Now LoadBrush doesn't need to know about entities anymore.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 15:53:21 +10:30
Kevin Shanahan 3989b1b28d qbsp: factor out logic for deciding brush contents by texture name
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 15:40:28 +10:30
Kevin Shanahan edbd84c5ae qbsp: hoist FixRotateOrigin up into Brush_LoadEntity
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 15:19:01 +10:30
Kevin Shanahan bb9b11921a qbsp: Lift bsp model rotate origin up one level into LoadBrush
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 15:11:27 +10:30
Kevin Shanahan 54acacb2c2 qbsp: make ValueForKey return empty string if key not found
Less error prone as it's usually followed by a strn?cmp or something.
Callers that were relying on null checks updated.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-20 14:39:38 +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 53e61c28ca qbsp: pass hullnum into ExportClipNodes()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 10:33:28 +10:30
Kevin Shanahan 27252d9104 qbsp: pass hullnum into PortalizeWorld()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 10:32:55 +10:30
Kevin Shanahan e943a14944 qbsp: pass hullnum down into FillOutSide()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 10:27:13 +10:30
Kevin Shanahan ef4e53b735 qbsp: pass hullnum into Brush_LoadEntity()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-18 09:51:33 +10:30
Kevin Shanahan 9e4f207d3e qbsp: trivial argument rename for FreeBrushsetBrushes in header
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:37:34 +10:30
Kevin Shanahan cfde5514dd qbsp: remove comment about regenerating dplane_t->type
The on disk format is set at this stage.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:36:13 +10:30
Kevin Shanahan d152382691 qbsp: constify FindPlane plane argument
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:35:22 +10:30
Kevin Shanahan 04c8c73ef6 qbsp: make Plane{,Inv}Equal take two planes as arguments
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:34:47 +10:30
Kevin Shanahan 47dc7108eb qbsp: a few more local variable renames
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 21:28:32 +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 d1839943c9 qbsp: make parser state non-global
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 15:21:48 +10:30
Kevin Shanahan bbe203629a qbsp: switch to using time() instead of ftime()
We don't need very precise time - only used for telling the user how long
the compile took, so use the most portable API. Fixes compilation on
OpenBSD/FreeBSD.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 11:25:47 +10:30
Kevin Shanahan fda99aac20 qbsp: change LoadFile spec so we don't need to cast when calling
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-17 11:03:09 +10:30
Kevin Shanahan 31a9bf78c7 qbsp: normalize quaked style texture rotation between 0 and 359
Probably not hugely important, but might save a few sin/cos
calculations...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-16 18:22:46 +10:30
Kevin Shanahan a9dd2de5ec qbsp: skip only the face, not brush for degenerate normals
The previous code would possibly leak faces with weird effects if we
iterate over the face data e.g. 0 -> map.numfaces.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 18:23:15 +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 6e39de60c9 qbsp: minor cleanups in FindTexinfo()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 15:28:07 +10:30
Kevin Shanahan d17622ab48 qbsp: constify argument to FindMiptex()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 15:11:02 +10:30
Kevin Shanahan e3752dc02d qbsp: remove unneccessary cast from LoadMapFile()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 14:09:18 +10:30
Kevin Shanahan 963b14ab3a qbsp: add mapdata struct members to track numbers of items used
Future work will break the assumption that the number of used items will
be equal to the maximum number of items, so separate the two numbers.
Replace use of maxblah with numblah as appropriate.

This makes the reverse order loading or brushes, etc. look even more
painful, so will look at whether we can change that now. As far as I know
no editors do clever things that would make the map compile "better" in a
different order - it's just that it might break some previously working
maps if they were an edge case that different ordering makes the precision
flip in a non-favourable direction.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 14:04:18 +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 9639e5037f qbsp: compile fixes for FreeAllMem
Not enabled, but may as well keep it up to date in case we want to start
using it. Might be useful as a simple check that we aren't leaking memory
somewhere.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 10:58:22 +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 af2cae7ae2 qbsp: move allocation of bspmodel struct outside ParseEntity()
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-02-15 10:00:53 +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