Commit graph

3411 commits

Author SHA1 Message Date
Bill Currie
34bcf7faab Do a pure/const/noreturn/format attribute pass.
I always wanted these, but as gcc now provides warnings for functions that
could do with such attributes, finding all the functions is much easier.
2018-10-09 12:42:21 +09:00
Bill Currie
05fd2d8cdd Start work on a unit test for defspace. 2018-09-09 22:37:09 +09:00
Bill Currie
3a4667318c Fix the qfcc test autodependencies. 2018-09-09 22:36:20 +09:00
Bill Currie
d1cb15664f Fix some spelling issues in a comment. 2018-09-09 22:34:24 +09:00
Bill Currie
71569b45c9 Pre-format diagnostic messages.
This will make it easier to hook diagnostics enabling unit tests.
2018-09-09 18:09:32 +09:00
Bill Currie
113e0d82ba Fix a signed comparison error.
Not sure how this fix got lost.
2018-09-09 16:48:19 +09:00
Bill Currie
aebd9288cd Force thread count to 1 when pthreads is unavailable.
Don't want the thread count being misreported.
2018-09-09 13:41:22 +09:00
Bill Currie
fa1514798b Print the number of threads used by qfvis. 2018-09-09 13:41:00 +09:00
Bill Currie
06ab36de3d Slight cleanup of winding allocation.
It seems gcc doesn't care if the & is present when calculating field
offsets, but it not being there bothered me very much and might as well use
our "standard" macro anyway.
2018-09-09 13:38:32 +09:00
Bill Currie
59e85b7d5e Fix a pile of dead assignments.
Some were actual bugs!
2018-09-08 22:23:57 +09:00
Bill Currie
59b04dbcca Make many qfo int fields unsigned.
I don't remember why I thought signed was a good idea, but unsigned does
make more sense for most fields.
2018-09-08 19:45:19 +09:00
Bill Currie
f75ff2d269 Fix some null argument issues. 2018-09-07 22:30:44 +09:00
Bill Currie
8f028b8a0d Fix some double frees. 2018-09-07 20:03:19 +09:00
Bill Currie
8fd5be0ee0 Fix a pile of sizeof goofs.
While scan-build wasn't what I was looking for, it has proven useful
anyway: many of the sizeof errors were just noise, but a few were actual
bugs (allocating too much or too little memory).
2018-09-07 20:00:57 +09:00
Bill Currie
b37b0180cb Actually do a test for triangle.r.
If the kahan triangle area method breaks, I did something wrong with qfcc's
handling of parentheses (ie, floating point math is not truly associative).
2018-08-23 20:52:32 +09:00
Bill Currie
1b9149ef31 Fix an argument passing error in test-harness.
It failed to pass the last argument to the ruamoko program being run.
2018-08-23 20:22:29 +09:00
Bill Currie
2fcda44ab0 Kill dag leaf nodes on assignment.
Fixes the failing swap test caused by a's original value being used (via t)
after being written.
2018-08-23 20:07:22 +09:00
Bill Currie
cb366dd825 Better flow dot dump "scripting".
Not sure I want to keep the statements in the live dump, but the system
is more flexible now.
2018-08-23 20:07:11 +09:00
Bill Currie
cdbdf3f0eb Make print_operand global. 2018-08-23 20:05:16 +09:00
Bill Currie
8b8b42bde2 Fix a typo in a comment. 2018-08-23 20:04:51 +09:00
Bill Currie
f250065003 Add tests for swapping vars and triangle area.
Triangle area was meant just to check Kahan's equation, but it found a
problem with swapping vars. swap.r currently fails.
2018-08-21 16:27:22 +09:00
Bill Currie
0f279cd3f0 Add a comment about fake statement numbers.
I had forgotten how they worked (not surprising after 6 years).
2018-08-21 15:57:51 +09:00
Bill Currie
1b84ea747c Dump statements during flow analysis. 2018-08-21 15:56:39 +09:00
Bill Currie
5ba13d759b Fix a FIXME.
Set of everything got added shortly after that FIXME was added, but I
forgot to fix it.
2018-08-21 15:56:03 +09:00
Bill Currie
fbdf560a7a Rename print_extra_live to print_flow_vars. 2018-08-21 15:55:11 +09:00
Bill Currie
5dbb7b6d4d Handle all modelgen commands.
Just in case someone ever adds models.qc to progs.src.
2018-08-20 00:11:02 +09:00
Bill Currie
027e76b4c9 Add a doc block to parse_cpp_line.
It took me too long to figure it out :P
2018-08-20 00:09:20 +09:00
Bill Currie
4f58429137 Fix an unhealthy pile of gcc 8 warnings.
While some of the warnings were merely annoying, some where actual bugs or
unearthed bugs in related code.
2018-08-20 00:05:00 +09:00
Bill Currie
81202d7b29 Add a shutdown builtin to qwaq. 2018-08-19 19:44:45 +09:00
Bill Currie
b795beb520 Add support for \? to qc strings.
And fix up the man page a bit.
2018-08-19 19:31:52 +09:00
Bill Currie
0de0eb2fc7 Fix a bunch of bit-rot. 2018-06-08 13:21:30 +09:00
Bill Currie
f522e58d53 Fix some blender warnings. 2018-06-08 12:45:57 +09:00
Bill Currie
2329fb1885 Fix some warnings and bitrot. 2016-10-25 00:10:30 +09:00
Bill Currie
932647bad3 Fix a segfault with switch on an undefined symbol.
Forgot to check if the test expression was not an error.
2016-01-10 13:41:49 +09:00
Bill Currie
bf40f0126e Convert vector expressions when passing parameters.
Calling a function with [vector stuff] caused an ICE.
2016-01-08 21:16:37 +09:00
Bill Currie
1061256c4f Add a missing expression type to dot_expr. 2016-01-08 21:15:47 +09:00
Bill Currie
431074d58f Update label destination when moving labels.
This fixes a segfault when optimizing the empty-body test. The label was
getting moved, but the statement block to which it pointed was not updated
and thus it pointed to dead data.
2016-01-07 21:24:29 +09:00
Bill Currie
d54ee6c8c3 Do not promote debug messages to warnings.
I think I copied the notice code for debug and forgot to edit the
promotion. Oops.
2016-01-07 20:08:07 +09:00
Bill Currie
6e65de251c Put qwaq's epoch back to 0.
4Gs causes a few problems at this stage. I really need to look into putting
long and double into qc.
2016-01-04 20:42:57 +09:00
Bill Currie
735fcf68d5 Clean up usage of va_copy.
AC_TYPE_VA_LIST is no longer necessary, and the code is easier to read.
2016-01-03 21:16:23 +09:00
Bill Currie
a54f3d9035 Shutdown some subsystems on exit.
This fixes the problem with X keyboard repeat not being restored.
2016-01-03 17:39:03 +09:00
Bill Currie
c71eccfb10 Remove MAX_THREADS.
This fixes a buffer overflow with more than 4 threads.
2015-08-14 10:57:51 +09:00
Bill Currie
2cd59c962c Rename qfcc's basename to file_basename.
Avoids naming conflicts with JohnnyonFlame's toolchain.
2014-01-31 12:22:11 +09:00
Bill Currie
3efb0c538f Separate file search from loading.
QFS_LoadFile (and its wrappers) now  take a file handle rather than a
path. This will make vpath usage a little cleaner to implement.
2014-01-28 16:22:05 +09:00
Bill Currie
6c0f271783 Fix some more automake warnings. 2013-11-24 13:26:12 +09:00
Bill Currie
f5501fbf24 Fix a pile of automake deprecation warnings.
s/INCLUDES/AM_CPPFLAGS/g

I <3 sed :)
2013-11-24 13:11:50 +09:00
Bill Currie
6996e7295a Add a getLine method to Script.
It returns the rest of the line (minus // style comments) as the token. I
needed it in another project but this is my central repository for
script.py.
2013-11-24 11:21:40 +09:00
Bill Currie
eeaf2bc43f Return None instead of False from parse_entity.
Don't remember how I found that one, but None makes much more sense.
2013-11-24 11:19:50 +09:00
Bill Currie
c88d1987a1 Add warnings for empty blocks in if/else/do.
Saw a discussion of such in #qc and that gcc implemented it. I realized it
would be pretty easy to detect and very useful (I've made such mistakes at
times).
2013-09-30 18:09:04 +09:00
Bill Currie
db460155e9 Fix multiple function calls in expressions. 2013-09-27 23:15:57 +09:00
Bill Currie
70d18ecfa1 Add a test for functions in binary expressions.
As expected, the binary_expr() cleanup broke multiple function calls in a
single expression.
2013-09-27 23:15:57 +09:00
Bill Currie
4bc40b3917 Rewrite binary_expr().
It is now in its own file and uses table lookups to check for valid type
and operator combinations, and also the resulting type of the expression.

This probably breaks multiple function calls in the one expression.
2013-09-27 23:15:57 +09:00
Bill Currie
ec98954dfc Remove the small struct optimization.
It might cause trouble for the binary_expr() cleanup.
2013-09-27 23:15:57 +09:00
Bill Currie
3295370328 Expose and use field_expr().
This may cause problems later on, but it is needed for the binary_expr()
cleanup.
2013-09-27 23:15:57 +09:00
Bill Currie
ca9693d9cd Expose convert_from_bool(). 2013-09-27 23:15:57 +09:00
Bill Currie
b66cbeeb57 Run fold_constants on comparison operands.
This is a bit of a workaround to ensure the operands have their types
setup correctly. Really, binary_expr needs to handle expression types
properly.

This fixes the bogus error for comparing the result of pointer subtraction
with an integer.
2013-09-27 23:15:57 +09:00
Bill Currie
c13f2c2c23 Fix the support for [s, v] for quaterions. 2013-09-27 23:15:57 +09:00
Bill Currie
7f50333b2c Add support for constant [] vector expressions. 2013-09-27 23:15:57 +09:00
Bill Currie
7a7a685105 Add support for actual vector expressions.
Currently, they can represent either vectors or quaternions, and the
quaternions can be in either [s, v] form or [w, x, y, z] form.

Many things will not actual work yet as the vector expression needs to be
converted into the appropriate form for assigning the elements to the
components of the "vector" type.
2013-09-27 23:15:57 +09:00
Bill Currie
2572811bf4 Add support for quaternion.w/x/y/z.
It's sometimes more useful to have direct access to each individual
component of the imaginary part of the quaternion, and then for
consistency, alias w and s.
2013-09-27 23:15:57 +09:00
Bill Currie
a6cdc8735a Start implementing vec = [x,y,z].
This is a nice feature found in fteqcc (also a bit of a challenge from
Spike). Getting bison to accept the new expression required rewriting the
state expression grammar, so this is mostly for the state expression. A
test to ensure the state expression doesn't break is included.
2013-09-27 23:15:56 +09:00
Bill Currie
35de42aeac Catch bogus comparison types.
This fixes an ICE when trying to compare a function with a float.
2013-09-27 23:15:56 +09:00
Bill Currie
03fb47d7ba Fix some sizeof goofs.
Yay for continually improving gcc warnings :)
2013-09-26 17:45:30 +09:00
Bill Currie
16d899ace5 Remove the string:string concatentation TODO item.
I think it may have been for compatibility with a certain qcc variant (no
idea which one, though). While the shift/reduce conflict is fixable using
"%prec IFX" on the const:string rule, the colon breaks test?"a":"b".
Putting parentheses around "a" allows such a construct, requiring them
breaks comatibility with C. I think this feature just isn't worth that.
2013-06-26 23:04:35 +09:00
Bill Currie
257597fd38 Update ifstring in TODO
It seems to be done, but...
2013-06-26 23:04:35 +09:00
Bill Currie
cef2136050 Implement "not" logic for while and do-while.
This goes towards complementing the "if not" logic extension. I need to
check if fteqcc supports "not" with "while" (the version I have access to
at the moment does not), and also whether it would be good  to support
"not" with "for", and if so, what form the syntax should take.
2013-06-26 23:04:35 +09:00
Bill Currie
45a09e195e Add more TODO items (strings stuff) 2013-06-26 23:04:35 +09:00
Bill Currie
6fa63f6c54 Implement the basics of fteqcc's -Fifstring.
It's -Cifstring in qfcc, but otherwise the intent is the same. More testing
and investigation into what fteqcc does is required.
2013-06-26 23:02:55 +09:00
Bill Currie
8d34d33055 Implement "if not (foo)" syntax.
It is syntactic sugar for if (!(foo)), but is useful for avoiding
inconsistencies between such things as if (string) and if (!string), even
though qcc can't parse if not (string). It also makes for easier to read
code when the logic in the condition is complex.
2013-06-26 23:02:55 +09:00
Bill Currie
77337e2402 Separate "" and nil.
It turns out this is required for compatibility with qcc (and C, really).
Once string to boolean conversions are sorted out completely (not that
simple as qcc is inconsistent with if (string) vs if (!string)), Qgets can
be implemented :)
2013-06-26 23:02:55 +09:00
Bill Currie
fd1ea9e00e Add an option to control the enum switch warning. 2013-06-26 09:29:37 +09:00
Bill Currie
29df4ac7ee Fix case label lookup.
It looks like I had forgotten that the compare function is supposed to
return true/false (unlike memcmp's sorting ability). Also, avoid the
pointers in the value struct as they can change without notice.

Using enums in switches now works nicely, including warnings for unused
enum values.
2013-06-26 09:29:31 +09:00
Bill Currie
8ac2c3a04d Check for unused enum values in switch statements.
Unfortunately, it turns out the value lookup is broken (including for
duplicate cases).
2013-06-26 09:25:45 +09:00
Bill Currie
35bc981402 Allow use of a jump table when switching on an enum. 2013-06-26 09:25:45 +09:00
Bill Currie
64f76bd762 Use the right value when getting a function's defref.
Either I had gotten confused while writing the code and mixed up line and
offset, or I had changed offset to line at one stage but missed a place.
This fixes the segfault when compiling chewed-alias.r and return-ivar.r
2013-06-24 09:16:55 +09:00
Bill Currie
125ef1f0ff Move the whole separator test/creation into a function.
This will make the next stage easier. (except that seems to be slower)
2013-03-19 20:39:01 +09:00
Bill Currie
f2452eb3c3 Rewrite the inner-loop of FindSeparators.
For the most part, it's just refactoring the code so the plane creation and
testing are in separate functions, but there is one important difference:
the plane test now checks only the two points on either side of the point
used to create the plane.

Because the portal winding is guaranteed to be convex and planar, if both
points are on the plane, all points are, and if neither point is behind the
plane, no points are.a

This shaved about 5 seconds off the level 4 run using 4 threads (~198s to
~193s) and about 12s from the single threaded run (~682s to ~670s (hmm,
gained some time in recent changes)).
2013-03-19 17:00:00 +09:00
Bill Currie
d7c1bc8d02 Correct a comment.
I had gotten confused between figuring out the windings and writing the
comments, I guess.
2013-03-19 16:23:47 +09:00
Bill Currie
8938870e46 Make the default output a little nicer. 2013-03-19 13:07:44 +09:00
Bill Currie
dff0b89a6c Detect the number of CPUs available.
Now qfvis will default to multi-threaded on multi-core machines.
2013-03-19 12:05:50 +09:00
Bill Currie
88e5adcec6 Make the base vis multi-threaded.
Now multi-threaded qfvis is on par with tyrutils vis (differences usually
<1s, sometimes more, sometimes less).
2013-03-19 11:42:09 +09:00
Bill Currie
32b6d15931 Use a sorted queue for portals.
qsort is used to sort the queue by nummightsee. At ~4ms for 20k portals, I
think it's affordable. Using a queue rather than scanning the portal list
each time loses the dynamic sorting when mightsee gets updated, but it
seemed to shave off 4s anyway (~207s to ~203s (maybe, yay random times)).

Another step towards threaded base-vis.
2013-03-18 21:14:12 +09:00
Bill Currie
7e40981dcd Move the LeafThread setup to its own generic function.
This is for threading base-vis.
2013-03-18 21:11:46 +09:00
Bill Currie
cb096c601d Use a per-portal rwlock for portal updates.
This should make qfvis scale a little better with cpu count.
2013-03-18 15:03:11 +09:00
Bill Currie
c824e668ed Rework some of the pthread stuff.
Init/uninit is now separate from portal vising.
The global lock has a better name and is now a rwlock.
Use a separate lock for the stats.
2013-03-18 14:26:52 +09:00
Bill Currie
134381f79b Reduce the locking in the portal completion code.
It doesn't seem to make much difference, but the less room for contention,
the better.
2013-03-18 13:45:19 +09:00
Bill Currie
ffb6d628bd Simplify the pthreads detection macros. 2013-03-18 13:31:35 +09:00
Bill Currie
1c20a49dba Use the recursive set allocator for mightsee.
This completely removes the lock used to protect the set allocation code
while keeping the use of the set api clean.
2013-03-18 13:30:50 +09:00
Bill Currie
a28ec8aa82 Revert "Allocate stack blocks and mightsee in one block."
This reverts commit 1ea79e8626.

Conflicts:
	tools/qfvis/include/vis.h
	tools/qfvis/source/flow.c

I've decided to do reentrant versions of the set allocators and I didn't
particularly like the invasiveness of allocating sets this way.
2013-03-18 12:47:59 +09:00
Bill Currie
ad247fa12d Rename some variables and remove some comments.
The old variable names were confusing ("target" winding comes from
"portal"?), and the comments were from when I really didn't understand
concepts like separating planes. While they weren't wrong, they were quite
inadequate and I want to write new ones.
2013-03-17 21:52:08 +09:00
Bill Currie
ccc432a7ea Give the fields of pstack_t clearer names.
And some comments.
2013-03-17 19:18:38 +09:00
Bill Currie
1ea79e8626 Allocate stack blocks and mightsee in one block.
This bypasses set_new, but completely removes the use of the global lock
from within RecursiveClusterFlow. This seems to give a small speedup: 203
seconds threaded.
2013-03-17 16:37:27 +09:00
Bill Currie
1d262f7dea Clean up FindSeparators a little bit.
This was testing an idea I had to remove the plane flips. It seems to have
been good for the initial plane orientation, but was a slight slowdown for
the pass-portal test. However, this makes the code a little easier to work
with for my idea on improving the algorithm itself.
2013-03-17 10:16:47 +09:00
Bill Currie
5dba419233 Cache stack blocks and working mightsee sets.
Since the stack structure in the thread data is a linked list, move the
stack blocks off the program stack and into malloced memory. More
importantly, when the stack block is allocated, the mightsee working set is
allocated too, and as neither are freed, this greatly reduces contention
for the lock. Also, because the memory is kept, single threaded time for
gmsp3v2 dropped from 695s to 670s. Threaded is now about 207s (down from
350).
2013-03-16 22:58:59 +09:00
Bill Currie
2ea143283c Rewrite mightsee_more to manipulate the sets directly.
While using set operators was clearer, it was rather expensive (about 25s
for gmsp3v2). qfvis now completes the map in about 695s (single threaded).
About 15s faster than tyr for the same conditions (1 thread, level 4).
2013-03-16 21:51:41 +09:00
Bill Currie
195bdcb92f Rework FindSeparators to make use of the winding direction.
This is the second part of the separator search optimization from tyrutils
vis. With this, qfvis is getting close to tyrutils vis when
running single threaded (qfvis is suffering some nasty thread contention
and thus can't get below about 350 seconds with 4 threads). 808s vs 707s.
2013-03-15 22:05:01 +09:00
Bill Currie
9b10304c2f Make CopyWinding const-correct. 2013-03-15 19:25:24 +09:00
Bill Currie
5a2ee06787 Reverse the winding for backside portals.
This is part 1 of another optimization from tyrutils vis. It seems that
just reversing the winding gives a tiny speedup.
2013-03-15 19:22:57 +09:00
Bill Currie
46d41ad9ac Split up separator finding and winding clipping.
Interesting, it makes very little (maybe faster) difference to find all the
separators for levels 3 and 4. This might be due to the higher levels using
most of the planes to fully clip source away. Anyway, it makes the code a
little clearer (one function, one task).
2013-03-15 16:00:39 +09:00
Bill Currie
f80ae52828 Make vis's ClipWinding const-correct. 2013-03-15 15:28:25 +09:00
Bill Currie
77c858060d Add a bunch more statistics.
Now I know why sphere culling was a loss: 78% of all tested target portals
were trimmed by ClipToSeparators (50% eventually clipped away entirely).
2013-03-14 19:43:46 +09:00
Bill Currie
97da7fe31d Document some fields. 2013-03-14 19:43:46 +09:00
Bill Currie
8032d1d4d1 Split out the mightsee intersection/subset tests.
Having the code in separate functions makes the flow in the main loop a
little easier to follow.
2013-03-14 19:43:46 +09:00
Bill Currie
eec87bd61b Remove thread from stack_t.
It really wasn't gaining anything and made reading the code a little
harder.
2013-03-14 19:43:46 +09:00
Bill Currie
057a5cc624 Make BasePortalVis another 17% faster.
I had forgotten to skip the refined tests when the sphere was entirely on
the relevant side of the plane. Now BasePortalVis for gmsp3v2 takes 11s on
my machine (it was 13 with the previous optimization and 15.9 before that).

Also, write some comments describing how BasePortalVis works.
2013-03-14 14:01:26 +09:00
Bill Currie
5d6df082f2 Move the vis stats vars into thread data.
This should make the stats more reliable when running multi-threaded
(chains is still random, but it seems there are set access issues).
2013-03-14 12:52:40 +09:00
Bill Currie
0cae04d71a Alter test_sphere to return -1, 0 or 1.
Representing the side of the plane on which the sphere lies is much more
useful as more complicated tests can be done using just the one call.
-1: the sphere is entirely on the back side of the plane
 0: the sphere is intersecting the plane
 1: the sphere is entirely on the front side of the plane
2013-03-14 09:05:26 +09:00
Bill Currie
b9d71218f6 Use sphere culling in the base vis.
Base vis was done first for testing. Optimized base vis is down to ~12.4s
from ~16s (29% faster?).
2013-03-13 21:32:18 +09:00
Bill Currie
fe55bb678e Set the default level to 4.
It was supposed to be 2, but for some reason I neglected to set it when I
set up the options parsing. However, level 4 is the standard for production
maps, and it happens to be faster than level 2 (at least for gmsp3v2.bsp)
2013-03-09 15:01:54 +09:00
Bill Currie
3232c22795 Implement mightsee updates from tyrutils.
It doesn't seem to make much difference, but I suspect that's my set code
not being optimal for the job.
2013-03-09 14:32:51 +09:00
Bill Currie
d1e65257b6 Implement the cached separators idea from tyrutils.
I think the reason I didn't think of that when I tried to improve qfvis's
performance many years ago is I just simply did not understand
ClipToSeparators. However, the difference caching the separators makes is
phenomenal. Before the change, single threaded qfvis would get stuck on one
particular portal for at least a day (I gave up waiting), but now even a
debug build will complete gmsp3v2.bsp in less than 12 minutes (4 threads on
my quad-core). And that's at level 2! Getting stuck for a day was at level
0.
2013-03-08 22:20:29 +09:00
Bill Currie
ca0b03687f Change the naming of ALLOC's free-list.
Rather than prefixing free_ to the supplied name, suffix _freelist to the
supplied name. The biggest advantage of this is it allows the free-list to
be a structure member. It also cleans up the name-space a little.
2013-03-08 22:16:31 +09:00
Bill Currie
dbdfdb6d28 Add support for PRT2 portal files.
These seem to be identical to PRT1-AM but with a different count order in
the header. Taken from tyrutils-0.5.
2013-03-07 18:51:32 +09:00
Bill Currie
0649fd7022 Correct some verbosity levels. 2013-03-07 18:51:23 +09:00
Bill Currie
4e87072d93 Fix a bunch of whitespace. 2013-03-07 14:31:00 +09:00
Bill Currie
4ccb4a4667 Make the test and vis set pointers const. 2013-03-07 14:28:15 +09:00
Bill Currie
281c5f185d Correct the "can see anything new" check.
I had the super-set and sub-set parameters backwards, but that's because I
had misinterpreted the old code.
2013-03-07 14:24:30 +09:00
Bill Currie
81e4d3072c Plug a bunch of memory leaks.
Not that they really matter, but it makes reading valgrind's output a
little easier.
2013-03-07 13:42:19 +09:00
Bill Currie
9b4beaf3f8 Use a set for portalsee.
This removes the hard coding of the size of portalsee, which looks to have
been too small for some maps.
2013-03-07 11:35:08 +09:00
Bill Currie
299ff8f575 Use set functions for qfvis.
While noticeably slower than the previous expanded set manipulation code,
this is much easier to read. I can worry about optimizing the set code when
I get qfvis behaving better.
2013-03-07 11:06:55 +09:00
Bill Currie
5950803462 Implement the sun lighting calculations.
The sun(s) won't work right now because the vectors aren't properly set up.
2013-03-07 09:11:23 +09:00
Bill Currie
4d4bcaf3a3 Make the Test functions const-correct. 2013-03-07 09:11:23 +09:00
Bill Currie
0e82b37001 Parse the sun information from the worldspawn entity. 2013-03-07 09:11:23 +09:00
Bill Currie
f1a18742f1 Cache the worldspawn entity.
It is an error (for now) if there is not exactly one worldspawn entity.
2013-03-07 09:11:23 +09:00
Bill Currie
4f0a1df3c1 Implement sky tracing.
Again, this is from Jardrup's light tool. Sun data is not yet parsed, nor
are any sun lighting calculations done.
2013-03-07 09:11:23 +09:00
Bill Currie
7cd1894a6d Add the solid-sky option from Jardrup's light tool.
However, actual sky tracing is not yet implemented.
2013-03-07 09:11:23 +09:00
Bill Currie
32127d3ec7 Kill a sprintf.
While 16 chars is enough for any 32-bit int, if int ever changes to 64
bit... (need 21). Just avoid the issue with good old va :)
2013-03-07 09:11:23 +09:00
Bill Currie
d2909cd4dd Clear the padding in the light data buffers.
Getting uninitialized memory in calloced space was interesting :P
2013-03-07 09:11:23 +09:00
Bill Currie
7c1d9d2b84 Make the angle and light hacks optional.
I'd forgotten that ED_ConvertToPlist mangled light into light_lev and
single component angle values into a vector. This fixes much of the
breakage in qflight (but not the light levels)
2013-03-07 09:11:23 +09:00
Bill Currie
26baa75a1b Remove a stray break.
Now qflight mostly works (its results are bogus, but at least it no longer
crashes or errors out)
2013-03-07 09:11:22 +09:00
Bill Currie
5fc8d1eb26 Split out the surface offset code.
This tidies up LightWorld a little.
2013-03-07 09:11:22 +09:00
Bill Currie
48809404b1 Use qfplist for light entities.
This removes a lot of redundant code from qflight (though it does become
dependent of libQFgamecode *shrug*). The nice thing is qflight now uses the
exact same code to load entities as does the server.
2013-03-07 09:11:22 +09:00
Bill Currie
9e6477fdf0 Remove the leading _ from entity fields for properties.
Dealing with the _ in the properties code is a bit messy, and having to use
it in the properties list file is a pain.
2013-03-07 09:11:22 +09:00
Bill Currie
5fbe50a5e2 Remove some dead code. 2013-03-07 09:11:22 +09:00
Bill Currie
b01986c3c5 Correct some white space. 2013-03-07 09:11:22 +09:00
Bill Currie
c9b1c445a8 Move the properties docs into properties.h 2013-03-07 09:11:22 +09:00
Bill Currie
5720392f37 Begin documenting qflight. 2013-03-07 09:11:22 +09:00
Bill Currie
cc92466725 Correct the calculation of halflife lighting.
The RBG values were taken from the wrong components of the array
(out-by-one).
2013-03-07 09:11:22 +09:00
Bill Currie
b025e7ba9a Make sure all source files in qflight have (C) headers. 2013-03-07 09:11:22 +09:00
Bill Currie
4d0a08a052 Cope with 0 sized textures.
The most likely cause is missing texture data. Found while working on the
uv_layers bug for Hectate.
2013-03-04 11:04:47 +09:00
Bill Currie
a6bc5e9d29 Use the correct method for finding the active uv layer.
Problem found by Hectate in #qc (thank you!).
2013-03-04 10:50:42 +09:00
Bill Currie
f6966f89ec Add DL_LIBS to the -x11 targets.
Something is funny with Ubuntu such that -ldl needs to be specifically
added even though QFutil's .la specifies it. I don't know if it's a libtool
issue or not, but this does work.

More will probably be necessary, but this was sufficient to get prover to
the point where qfcc segged building qwaq (0.7.2).
2013-02-14 09:54:36 +09:00
Bill Currie
4e7e7c3ab0 Rename Sys_FileTime to Sys_FileExists.
The function never did anything but check the readability of the file.
2013-02-07 15:43:26 +09:00
Bill Currie
9d418379bf Use the correct type when allocating flow node edges.
sizeof (struct) vs sizeof (struct *). Ouch.
2013-01-30 18:08:59 +09:00
Bill Currie
6a3c775270 Correct the emission of meta class ivars.
type_obj_class is no longer a class, so its ivars are not stored in
type_obj_class.t.class->ivars but rather type_obj_class.t.symtab.

This fixes the segfault Spirit and Randy were experiencing.

In passing, correct the unneeded emission of meta class ivars for non-root
classes. This should make for much smaller progs that use classes.
2013-01-30 18:06:48 +09:00
Bill Currie
dffe1598b8 Strip the executables.
While nq-sdl.exe was ok (~6.5MB vs ~4.2M), qw-client-sdl.exe was crazy:
~17MB vs ~7.4.
2013-01-23 22:09:54 +09:00
Bill Currie
b7d6ffa72e Build and package win64 binaries too.
As an added benefit, this tested the "one cross dir" design of my scripts
:)
2013-01-23 11:59:54 +09:00
Bill Currie
f68ae3ad5d Add support for 64bit windows via mxe (mingw).
Note that this support relies on the -multi branch (separate git repo on
github) util it gets merged.
2013-01-22 21:02:50 +09:00
Bill Currie
61bdb13c4c Remove obsolete mingw cross.sh script.
Now that mxe is here (and works nicely), this is no longer necessary
(doesn't work anyway).
2013-01-22 21:02:50 +09:00
Bill Currie
e27d7cbd2d Handle alloca "correctly".
Use AC_FUNC_ALLOCA and the #ifdef mess suggested by the autoconf docs
(hidden in qfalloca.h).
2013-01-22 21:02:50 +09:00
Bill Currie
f1aefc969d Fix some 64-bit mingw compile issues.
Just one more issue to fix (alloca), but with a hack, QF compiles (no clue
yet if it works: wine doesn't seem to be an option at this stage)
2013-01-22 21:02:49 +09:00
Bill Currie
0186ca993d Allow the uninitialized variable warning to be suppressed. 2013-01-18 16:28:08 +09:00
Bill Currie
eacc59c016 Build the field types array for enums, too.
However, every element is the same: type_default's type_def. This fixes the
segfault building qwaq introduced by the previous enum commit.
2013-01-17 22:01:31 +09:00
Bill Currie
46d2959908 Delay calling find_type for enums.
As find_type encodes the type too, calling find_type before the enumerators
have been created causes the type encoding to lose the enumerators.
2013-01-17 20:55:25 +09:00
Bill Currie
7a504f8983 Use float for enum defs in v6 progs.
The values are (or should be!) written as floats, so don't give any
debuggers hernias when displaying enums in v6 progs.
2013-01-17 20:53:22 +09:00
Bill Currie
00192ea1da Skip field immediates when generating progdefs.h
They break the very fragile algorithm :P.
2013-01-17 16:10:17 +09:00
Bill Currie
5b47c15611 Get the bmesh directly from the object mesh data.
Yay, no fussing with edit mode. Thanks to _FrnchFrgg_ in #blendercoders for
the tip.
2013-01-17 09:52:09 +09:00
Bill Currie
ca71034680 Make the field value editable. 2013-01-17 09:52:09 +09:00
Bill Currie
66ecf9eba0 Update the entity field list for blender 2.65a+
More api changes :/ However, the new version certainly seems more powerful.
2013-01-17 09:52:09 +09:00
Bill Currie
f25fbfe0bc Split out the text reflow code.
This makes EntityPanel's draw code a little cleaner.
2013-01-17 09:52:09 +09:00
Bill Currie
6838913e31 Fix view3d callback for blender 2.65a+.
Yay experimental APIs :P
2013-01-17 09:52:09 +09:00
Bill Currie
acd25fb7bb Update the release script for git versioning. 2013-01-11 10:47:49 +09:00
Bill Currie
9afeae0c47 Fix the mis-specified PKG_CONFIG_LIBDIR for mips.
D'oh, forgot usr :P
2013-01-10 21:13:19 +09:00
Bill Currie
89ae5cbf7c Remove the old hacks for qp-lex, too. 2013-01-10 19:42:34 +09:00
Bill Currie
737347b0f6 Remove the prototypes hack.
While configure isn't testing yet, we need recent bison and flex, so many
of the old hacks are no longer necessary.
2013-01-10 19:27:22 +09:00
Bill Currie
39ae720613 Fix an error in qfcc's man page.
--qccx-escapes doesn't take an arguement :P
2013-01-08 16:19:40 +09:00
Bill Currie
76a69d9a53 Implement fteqcc's "nosave" specifier.
Of course, it's "@nosave" for traditional progs, but that's only a define
away.
2013-01-07 14:35:34 +09:00
Bill Currie
955e3ee258 Initialize the type to be ev_func.
This fixes the returning of the wrong function symbol when resolving
overloaded functions and one of the functions takes no parameters.
2013-01-07 13:52:48 +09:00
Bill Currie
338bb9bba0 Look up the function symbol when resolving overloaded functions.
This fixes the bogus undefined symbol errors when resolving unambigous
overloaded functions.
2013-01-07 13:51:01 +09:00
Bill Currie
e0e69ac71a Fix some signed/unsigned comparison warnings.
It seems mingw's gcc treats pointer subtraction differently to how linux's
gcc does.
2013-01-05 17:52:48 +09:00
Bill Currie
34c0c82408 Add support for binary constants using the 0b prefix.
Just because :P (now that gcc support it, it seems worthwhile, I guess)
2013-01-04 19:32:04 +09:00
Bill Currie
b225879d16 Print all four sets with a legent for live vars.
Much more informative :)
2012-12-26 11:54:49 +09:00
Bill Currie
c5179c9e99 Add MOVEP's opc to the use set.
MOVEP's opc itself is always known and used, whether it's a constant
pointer or variable doesn't matter. This fixes the lost pointer calculation
for va_list.list[j] = object_from_plist (item);
2012-12-26 11:53:06 +09:00
Bill Currie
412fb4aacd Fix a static out of bounds error.
I really must compile with optimizations more often :P
2012-12-26 11:51:40 +09:00
Bill Currie
88c765e210 Add a test for returning @param into an array. 2012-12-26 11:49:39 +09:00
Bill Currie
386a729209 Remove dead nodes from dags.
Dead nodes are those that generate unused values (unassigned leaf nodes,
expressions or destinationless move(p) nodes). The revoval is done by the
flow analysis code (via the dags code) so that any pre and post removal
flow analysis and manipulation may be done (eg, available expressions).
2012-12-25 17:07:58 +09:00
Bill Currie
3baa73e60e Increase qwaq-x11's hunk space to 8MB.
1MB is too small for the few sounds my experimental game uses.
2012-12-25 15:47:00 +09:00
Bill Currie
1e3154ecd5 Do not always reset current_storage.
resetting current_storage in external_def_list's empty rule breaks the
block storage scopes (extern { ... } etc);
2012-12-25 13:43:52 +09:00
Bill Currie
e414117fe8 Move jump threading into the dead-code removal loop.
Dead code removal can give more opportunities to the useless branch removal
in the jump threading code.
2012-12-25 13:33:31 +09:00
Bill Currie
07187cae7c Remove useless conditional branches too.
"if x" jumping to the next statement is pretty useless.
2012-12-25 13:23:14 +09:00
Bill Currie
92fffb3c7e Check for a flow var for temp aliases. 2012-12-25 13:22:31 +09:00
Bill Currie
9d27764576 Use new_binary_expr to recreate the assignment.
assign_expr mangles the destination expression for dereferenced
assignments into something that is invalid as an lvalue, so simply use
new_binary_expr with the same opcode.
2012-12-24 20:12:56 +09:00
Bill Currie
0fc8aa54e1 Make expr->next edges constrained.
It turns out expression trees are (mostly?) valid DAGs, so all edges being
constrained works, though the graphs get a little tall (but easier to read).
2012-12-24 20:06:38 +09:00
Bill Currie
79519bc357 Avoid testing block expressions in truth assignments.
This fixes the infinite loop in if ((x = self.heat && x))

Really, I think I need to revisit the whole expression tree code. It's
proving to be rather fragile.
2012-12-24 20:01:16 +09:00
Bill Currie
60af059b6e Allow arbitrary expressions in a bool's block.
This generates correct code for "if ((x = y))": the assignment still
occurs.
2012-12-23 19:57:39 +09:00
Bill Currie
f6c4e06183 Reimplement assignment as truth value.
The source of the assignment is used as the value to test, and the
assignment itself is inserted into the boolean expressions's block. This
fixes the inernal error for "if ((x = 0))".
2012-12-23 19:53:31 +09:00
Bill Currie
a881fb5f5b Make float values obvious in expression dot dumps. 2012-12-23 19:34:25 +09:00
Bill Currie
f65ce22ddc Fold constants for the return value of test_expr.
More constantness preservation.
2012-12-23 19:32:32 +09:00
Bill Currie
22db05dc9c Alias value expressions by aliasing the value.
This keeps constant expressions constant, even through aliasing.
2012-12-23 19:31:09 +09:00
Bill Currie
b295524385 Add new_value_expr().
This simplifies creating a new expression for an arbitrary value object.
2012-12-23 19:29:50 +09:00
Bill Currie
42ba0c9d54 Add alias_value() function.
alias_value returns a new value where only the type is different, the
bit-pattern of the value itself is untouched.
2012-12-23 19:25:35 +09:00
Bill Currie
82ded2b638 Split the test for assignment and parenthesis.
This will make it easier to fix the internal error for "if (x = 0)".
2012-12-23 14:55:16 +09:00
Bill Currie
b9a0e2ce03 Catch the error for undefined++. 2012-12-23 14:47:29 +09:00
Bill Currie
a778d45ebf Drop non-function symbols returned from function_symbol.
In such situations, everything is a mess from earlier errors.
2012-12-23 14:25:09 +09:00
Bill Currie
aae0e21a5b Treat class instance access as a normal error.
Normally, it will happen only as a follow-on error, but I can think of a
way to force it without other errors, so treating it as an internal error
is a bit harsh.
2012-12-23 06:01:20 +09:00
Bill Currie
996b2734a4 Reset current_class in the top-level error rules.
This fixes a weird internal error after a parse error in an ivar
declaration.
2012-12-23 05:57:13 +09:00
Bill Currie
1c76ccc425 Always set current_symtab in class_init().
But reset current_symtab to its prior value when done. This fixes a
segfault caused by initializing the class system while parsing a struct
(eg, one of the members is of type id).
2012-12-22 20:06:14 +09:00
Bill Currie
ff4b232d92 Reset current_storage when resetting current_symtab.
This helps prevent an internal error caused by ealier errors.
2012-12-22 20:04:11 +09:00
Bill Currie
85387e02cf Avoid class segfaults caused by parse errors. 2012-12-22 19:35:19 +09:00
Bill Currie
681bd6f4b2 Don't try to emit code if there have been errors.
The expression tree can't really be trusted if there have been errors.
While warnings as errors are another matter, it's not worth sorting out.
2012-12-22 19:22:08 +09:00