Commit graph

34 commits

Author SHA1 Message Date
Bill Currie
41de8c9187 [util] Cast swapped signed shorts in bspfile
This fixes a bug when loading bsp29 files that resulted in leaf nodes
having bogus bounding boxes if any coordinates were negative (and thus
dynamic lights, and probably all sorts of other things) being broken.
And it took me only 9 years to notice :P
2021-07-22 14:25:51 +09:00
Bill Currie
9d6954efb7 Fixup extended bsp when loading the file.
It turns out the tools need the node conversions too, so doing it in
bspfile seems to be best as it is used by everything that reads a bsp file.
2012-12-30 13:29:24 +09:00
Bill Currie
7a86ea2d41 Do not use the bsp2 header when byteswapping the header.
The bsp2 header is not necessarily correct (or even present), but the bsp29
header is: it was setup via set_bsp32_write. This fixes the bsp corruption
when vising a map (and, I expect, any problems with qfbsp on a big-endian
machine).
2012-12-29 20:57:55 +09:00
Bill Currie
67b796f851 Fix a silly error in bsp extents checking.
Found while hunting for rhinodemons.
2012-11-23 14:38:15 +09:00
Bill Currie
fe9fb41f93 Correct some very suspicious looking code.
While accessing short foo[2][4]; as foo[0][0..7] should work in theory, who
knows what gcc does with it when optimizing. I don't know if this will fix
johnnyonflame's bsp loading problem, but no point in having rhinodemonic
code hanging around.
2012-11-23 14:35:34 +09:00
Bill Currie
cfb856b9cf Fix byteswapping of a node's firstface/numfaces.
I'd forgotten to fix this.
2012-09-08 09:38:22 +09:00
Bill Currie
0ce32a793e Return the correct size for set_bsp*_write().
Need to subtract the size of the bsp_t/bsp29_t struct. Now old and new
qfbsp produce identical bsps (so long as they're both unoptimized, or
(probably) both optimized).
2012-09-07 20:42:04 +09:00
Bill Currie
2d30cddc66 Implement bsp2/bsp29 writing.
It's ugly, inefficient, and untested, but it should work.
2012-09-07 18:27:20 +09:00
Bill Currie
3df85a6abe Fix reading bsp29 files. 2012-09-07 17:37:46 +09:00
Bill Currie
a37c5465e1 First step for BSP2 support. DOES NOT WORK!
All of the nastiness is hidden in bspfile.c (including the old bsp29
specific data types). However, the conversions between bsp29 and bsp2 are
implemented but not yet hooked up properly. This commit just gets the data
structures in place and the obvious changes necessary to the rest of the
engine to get it to compile, plus a few obvious "make it work" changes.
2012-09-07 16:09:24 +09:00
Bill Currie
23a38738fc Massive whitespace cleanup.
Lots of trailing whitespace and otherwise blank lines.
2012-05-22 08:23:22 +09:00
Bill Currie
bc1b483525 Nuke the rcsid stuff.
It's pretty useless in git.
2012-04-22 10:56:32 +09:00
Bill Currie
de04e1b602 Lots of win32 (mingw cross) build fixes.
HTTP (curl) support is missing, but everything else builds.
2010-12-23 11:40:16 +09:00
Bill Currie
ef7958d680 Lots of const correctness. 2010-10-13 20:52:08 +09:00
Bill Currie
cd159e1cc1 Use LoadBSPMem to load brush models.
Now that Mod_LoadBrushModel uses bspfile.[ch], the engine uses the same
code as the tools to work with bsp files.
2010-10-13 20:52:05 +09:00
Bill Currie
db898655d1 make LoadBSPFile own the memory for the bsp data 2010-10-13 20:52:05 +09:00
Bill Currie
719ca15516 make LoadBSPMem work in-place
LoadBSPMem now modifies the passed in buffer rathern than allocating new
memory. One step closer to cleaning up brush model loading.
2010-10-13 20:52:05 +09:00
Bill Currie
56fb4d9a22 allow safe bsp freeing
any memory the bsp thinks it does not own will not be freed
2010-10-13 20:52:05 +09:00
Bill Currie
1d86e71404 make WriteBSPFile take a const bsp_t *
This means that the supplied bsp can now be reused, as it should be.
2010-10-13 20:52:05 +09:00
Bill Currie
f4042c5b91 Make the bsp disk data structures type size independent.
However, this assumes float is always 32 bits.

Also use size_t for the *size fields in bsp_t and clean up the mess.
2010-10-13 20:52:05 +09:00
Bill Currie
99c0954b47 the big dso visibility patch :). Sure, we have to have unique names for static builds, but with controlled visibitly we should get faster program loads (although this isn't C++, so it's not as bad) and complex plugins are cleaner. 2007-03-10 12:00:59 +00:00
Bill Currie
3fb03fc2be hah, should have been using __attribute__((used)) all that time (rather
than __attribute__((unused))). fixes the missing console in -x11
2005-08-04 15:27:09 +00:00
Bill Currie
0a0f8d0cfa make a LoadBSPMem function so bsp files can be read from already loaded
images
2003-08-11 22:40:46 +00:00
Bill Currie
761a7546dd re-arrange things so __attribute__ and __builtin_expect are properly
autoconfiscated so rcsid will continue to work with gcc 3.3
2003-01-15 15:31:36 +00:00
Bill Currie
a5ead00f8e small bit of cleanup 2002-11-08 17:13:23 +00:00
Bill Currie
ca4b3acd6c big protototype cleanup. Now, except for a few cases, all non-static
prototypes are in headers files.
2002-11-05 19:12:51 +00:00
Bill Currie
dd5cac488c fix a few memory access bugs 2002-09-20 22:44:29 +00:00
Bill Currie
0cd34d155f qfbsp now mostly works. only known issue is multiple texture wads don't
load properly and possibly a "reached occupant" issue (dunno if it's the
map or qfbsp)
2002-09-19 20:39:33 +00:00
Bill Currie
e8d74f3a26 round off the offsets/sizes again 2002-09-19 15:28:16 +00:00
Bill Currie
24a9b48127 rewrite bspfile.[ch] so they work off an object rather than global data.
The direct filesystem access is also removed. Fix up qfvis and qflight to
compile with the new bspfile. qfvis seems to work, qflight probably doesn't
2002-09-19 05:35:17 +00:00
Bill Currie
599fea0edb redo bspfile to use dynamic allocation for the arrays to avoid buffer
overflows. also fix up the verbosity levels in qfvis.c
2002-09-18 06:07:38 +00:00
Bill Currie
b8829faac4 bspfile.c:
start rewriting for saner code starting with making the private
	functions static
cmdlib.[ch]:
	win32 compile fixes (remove redundant function)
2002-09-13 15:07:48 +00:00
Bill Currie
ec47e08e1c go back to using QFile, quakeio.h and quakefs.h 2002-08-27 07:16:28 +00:00
Ragnvald Maartmann-Moe IV
cfedb80d1d Rest of support for qflight/qfvis. bspfile.c and quakefs.c will need cleaning up, compare to previous cvs versions... 2002-08-25 23:10:57 +00:00