Commit Graph

622 Commits

Author SHA1 Message Date
Kevin Shanahan 2964d31016 light: fix truncated light values due to integer division
Since minlight is an integer, need to either cast to float or ensure
promotion by writing the 255 constants as 255.0f. Not all of these are
needed, but just be consistent across the code.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 18:25:00 +10:30
Kevin Shanahan b4387359a4 light: implement minlighting for bmodels
Collect the appropriate keys from the models at load time and pass them
into the minlighting function (if > world minlight).

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 18:22:25 +10:30
Kevin Shanahan e734671b03 light: remove unneeded faceoffset argument from {Single,Sky}LightFace
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 16:21:42 +10:30
Kevin Shanahan 44a0bd3660 light: pass minlight/colour values into FixMinlight
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 16:13:43 +10:30
Kevin Shanahan 34050c2bd9 light: replace faceoffset with modeloffset
Not much point worrying about the offset of each face when it's only
per-model. This sets us up for using other per-model info...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 15:47:30 +10:30
Kevin Shanahan 33b4ba2040 light: remove the never-used nolightface array
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 15:18:36 +10:30
Kevin Shanahan 7b36c6fd2f build: query git for version info and print consistently for each util
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 14:26:14 +10:30
Kevin Shanahan e94d2b5cdd qbsp: Rework CopyFacesToOutside as CopyBrushFaces
New version returns the list of copied faces. This was the last user of
the inside and outside globals outside of CSGFaces, so they now move onto
the local stack there.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 14:01:47 +10:30
Kevin Shanahan 83c0fd541a qbsp: Rename KeepInsideFaces as SaveInside Faces
The list onto which to save the faces is now passed in instead of
implicitly using the global outside list.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:48:23 +10:30
Kevin Shanahan 3d45b05040 qbsp: readability improvements for CSGFaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:38:37 +10:30
Kevin Shanahan 6f33083868 qbsp: get rid of global 'validfaces' plane->face map
Only used in two places and not a whole lot of calls, so just allocate the
map while it's needed and free it afterwards. There is no relationship
between the two users, so no need to share a common block of memory.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:13:37 +10:30
Kevin Shanahan b11e671254 qbsp: pass plane-to-face hash into BuildSurfaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 13:02:58 +10:30
Kevin Shanahan cd043e53f4 qbsp: rework SaveOutside as SaveFacesToPlaneList
We pass in the face list and the plane map to link the faces to. Update
the comments to make it clearer what the function actually does.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 12:47:43 +10:30
Kevin Shanahan c6895c28c8 qbsp: Rework ClipInside to take inside/outside lists as arguments
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 12:08:39 +10:30
Kevin Shanahan faeb3d6942 qbsp: rework CheckInside function as RemoveOutsideFaces
Pass the inside and outside lists in rather than implicitly manipulating
the global lists.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 11:27:53 +10:30
Kevin Shanahan ba6d8e18a8 qbsp: misc naming changes to csg4.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 10:35:57 +10:30
Kevin Shanahan 406acb62d1 qbsp: fix underwater hint brushes
At load time we defaulted to CONTENTS_EMPTY, but if part or all of the
brush lies underwater, then inherit the water contents type.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-07 07:25:29 +10:30
Kevin Shanahan 7fa24021c8 qbsp: move the hint split check to the correct place
Check that the hint face would actually get split before we discount the
candidate split plane...

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 22:44:41 +10:30
Kevin Shanahan 6b25dbd2cc qbsp: add hint brush support
Similar to the skip texture handling, add miptex flags, handle
appropriately in CSGFaces and SolidBSP, then remove the surfaces before
writing out the bsp.

Lightly tested, but seems to do all the right things.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 16:58:14 +10:30
Kevin Shanahan 151370b06a qbsp: Split FreeInside into FreeFaces and KeepInsideFaces
FreeInside was a strange name, since depending on the arguments we
actually wanted to keep the faces.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 16:25:12 +10:30
Kevin Shanahan b7d4127583 qbsp: delay creation of .pts and .por files until needed
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 14:47:06 +10:30
Kevin Shanahan 1e4d4225d6 qbsp: pull the .por and .pts file pointers into leakstate
That should be the last of the outside.c globals.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 14:14:42 +10:30
Kevin Shanahan 18cc6cc809 qbsp: get rid of globals v1 and v2 in outside.c
Used for working with leak lines - just pass them on the stack instead.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 13:43:47 +10:30
Kevin Shanahan 47f55c8186 qbsp: misc trivial stylistic changes to outside.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 13:30:07 +10:30
Kevin Shanahan a7e0ad3889 qbsp: trivial cleanups to WriteLeakNode
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 13:11:46 +10:30
Kevin Shanahan 2eb9c36e28 qbsp: use pointer to entity instead of index in leakstate
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 13:06:51 +10:30
Kevin Shanahan fb8852dddf qbsp: consolidate leak state into single struct
Now consolidate the leak state into a single leakstate_t struct. Rename
the leaks/numleaks/maxleaks members as portals/numportals/maxportals for
improved clarity. What was numportals previously is now numwritten.

Outleafs is now returned from the FillOutside_r function instead of
passing in a struct or int to be incremented by the function.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 12:51:36 +10:30
Kevin Shanahan 6b50c2e5ac qbsp: Separate finding leaks from outside filling
Finding leaks carries a lot more state which is not needed for the final
outside fill stage, so let's separate the two. Get rid of fillparms_t
since the only thing left was the fillmark.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 12:31:20 +10:30
Kevin Shanahan 0aa5cf42d0 qbsp: move backdraw counter into the bspleak struct
Only related to the leak files, not filling.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:56:44 +10:30
Kevin Shanahan 6cc26fe878 qbsp: numportals parm is more accurately maxleaks
It seems clearer now that the numportals parameter is actually used to
check that the number of leak portals we accumulate doesn't exceed the
allocated memory. Update the structs to reflect that.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:51:00 +10:30
Kevin Shanahan 7dbee11b78 qbsp: move leaknode into the bspleak struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:40:26 +10:30
Kevin Shanahan 2bc8a01a31 qbsp: free the leaks array after writing leak file
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:32:04 +10:30
Kevin Shanahan bd827266a8 qbsp: move pLeaks and numleaks into the bspleak struct
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 11:31:22 +10:30
Kevin Shanahan 54de345635 qbsp: encapsulate bspleak state in separate struct
Move the 'firstone' global into the bspleak state as a flag to indicate
whether the header has been written yet, since that's why the flag exists.
Move numportals and hit_occupied (renamed to "entity") in there as well to
keep leak related data all together.

MarkLeakTrail now directly increments bspleak->numportals so doesn't need
to return a value indicating what was written.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 10:58:25 +10:30
Kevin Shanahan 9f2691e3b6 qbsp: fix name of .por file in output
Was showing up as blah.prt.por because we had messed with the filename to
remove the prt file previously.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 10:22:31 +10:30
Kevin Shanahan 7e9b2dd43a qbsp: move number of .por portals written into fillstate
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 10:21:12 +10:30
Kevin Shanahan 744f542203 qbsp: fix handling of leak files
Previously, leak files would only be written for a leak in hull 2. This is
actually pretty bad because a small leak in hull 0 or 1 might not show up
in hull 2 and you would never get a leak file to chase it down.

Place a flag in the global mapdata to indicate whether we have written a
leak file or not so we only write for the first hull that leaks. Hullnum
is no longer needed as a parameter to RecursiveFillOutside, so remove
that from the fillparms struct.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 09:45:29 +10:30
Kevin Shanahan 4fea8f28b5 qbsp: place outside filling number into mapdata global
Remove the (file) global fillmark from outside.c and place into the global
mapadata. Pass the fillmark into RecursiveFillOutside as a read-only
parameter instead.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 09:39:15 +10:30
Kevin Shanahan 546aa817d8 qbsp: start pulling some of the global state for FillOutside onto the stack
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 08:51:03 +10:30
Kevin Shanahan 462792e03b qbsp: rename node member valid->fillmark
This is not a yes/no flag it's an integer mark to see if we have visited
the node within the same fill pass.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-06 08:45:47 +10:30
Kevin Shanahan d65dc77ac7 qbsp: lift the hullnum check out of MarkLeakTrail
Makes it kind of obvious now that there is a bug here - if we have a small
leak in hull 0 or 1 which is sealed in hull 2 (due to brush expansion), then
we won't get a leak trail!

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 16:01:25 +10:30
Kevin Shanahan 75ef5aa9d8 qbsp: trivial rename of local ent variables to entity
Somewhat self indulgent, but this reads easier to me now.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 15:34:52 +10:30
Kevin Shanahan 926cf8eb95 qbsp: return first face number from MakeFaceEdges and pass to ExportDrawNodes
Removes another global variable.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 15:17:40 +10:30
Kevin Shanahan 26c2789d7e qbsp: make planemap local to ExportNodePlanes{,_r}
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 15:11:31 +10:30
Kevin Shanahan 6dd0fbd085 qbsp: misc local variable naming changes for writebsp.c
Shouldn't be any functional changes to the code.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 14:54:04 +10:30
Kevin Shanahan fe89facbd0 qbsp: rename face->texturenum to texinfo
Since it is an index into the global texinfo, not miptex.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 14:34:02 +10:30
Kevin Shanahan 617764bbf0 qbsp: add note about skip support to changelog
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 14:18:13 +10:30
Kevin Shanahan d289742f1e trivial: remove not-very-helpful comment from surfaces.c
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 14:15:39 +10:30
Kevin Shanahan 7ca00ded1f qbsp: don't bother subdiving skip surfaces
Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 14:15:03 +10:30
Kevin Shanahan 1432d99049 qbsp: cleanup texinfo flags before writing bsp
The TEX_SKIP flag isn't needed and although it *shouldn't* upset any
engines, better to not write it out at all.

Well, even better to not write anything about the skip texture to the BSP
file, but need to re-organise things a bit more before that can happen.

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
2013-03-05 14:13:23 +10:30