Commit Graph

3685 Commits

Author SHA1 Message Date
Bill Currie a8542c2d48 Correct the spelling of QFK_HIRAGANA_KATAKANA.
'twas QFK_HIRAGANA_kATAKANA. Took a while to spot it :P
2013-01-13 18:54:23 +09:00
Bill Currie e8450f6c97 Add builtins to handle menu next/prev/enter. 2013-01-13 18:53:21 +09:00
Bill Currie e3b8157469 Create a new imt_menu imt.
It seems to work nicely as F10 no longer tries to quit while the menu is
displayed.
2013-01-13 18:19:00 +09:00
Bill Currie b18305351e Rename game_target to key_target.
Much better name :P
2013-01-13 18:14:16 +09:00
Bill Currie b1ddae927b Add a command to clear specific IMTs.
in_clear <imt>... where each argument to in_clear is an imt identifier. If
any identifiers are incorrect, the incorrect ones will be displayed and no
tables will be cleared. All or nothing.
2013-01-13 18:05:41 +09:00
Bill Currie 0c81364da8 Fix scr_copyeverything in gl and glsl.
Now the gl renderers unconditionally set it to 1. This is required because
the screen is cleared every frame.
2013-01-13 17:23:00 +09:00
Bill Currie 4a95f89760 Correct the handling of r_viewsize and lineadj.
r_viewsize is meant to be clamped to 100, but not limit linadj.
2013-01-13 16:53:22 +09:00
Bill Currie 86b95629cf Complete the move of some vars into vid_render_data.
scr_fullupdate and scr_copyeverything were missed. Possibly others too, but
this is enough for the moment.
2013-01-13 16:46:41 +09:00
Bill Currie 9c812f39ce Apply some wart remover.
hungarian notation... *twitch*
2013-01-13 16:07:11 +09:00
Bill Currie ed8b289315 Make sdl's VID_SetPalette only queue a palette change.
It seems that SDL_SetColors causes a page flip, so VID_SetPalette only
queue a palette change (by checking for the need to change and storing the
requested palete) and VID_Update now checks for a queued palette change and
updates SDL's palette if required. This fixes the flickering console in sw
-sdl introduced by the cshift/centerprint change.
2013-01-13 14:55:15 +09:00
Bill Currie 82a6861233 Move the call to VID_Update out of the if blocks.
This makes it obvious that VID_Update is unconditionally called when
SCR_UpdateScreen is called.
2013-01-13 14:43:19 +09:00
Bill Currie 5bbb76194f Use stdlib.h instead of alloca.h.
While the manpage does say alloca.h, that's not very portable, it seems.
stdlib.h seems to be better (at least for mingw, anyway)
2013-01-10 21:54:37 +09:00
Bill Currie 6b97967a68 Use g instead of e for the fp values.
Need to up the precision by one due to the difference between g and e, but
much prettier. Might need to rename that function :P I wish I'd thought to
check if g would work, but thanks to divVerent for the suggestion.
2013-01-08 20:15:24 +09:00
Bill Currie b096a0242e Write fp values to saved games with enough precision.
That is, enough precision to uniquely identify the fp values. No drifts!
2013-01-08 18:50:44 +09:00
Bill Currie d6bb5bec86 Use the already calculated string length.
No point doing it twice.
2013-01-08 18:10:27 +09:00
Bill Currie 9155338404 Add support for int and quaternion values in saved games. 2013-01-08 18:09:22 +09:00
Bill Currie 3e2a40684c Use dstring in PR_UglyValueString().
I should have done this a long time ago:P. This removes the really silly
255 char limit from strings in saved games (and thus fixes books in ITS).
2013-01-08 17:20:58 +09:00
Bill Currie a4714ac9b5 Correctly parse octal escapes for plist strings.
It seems the code expected octal escapes to always start with 0. This is
not the case. Also, octal escapes are limited to 3 digits (and hex to 2).

This fixes the garbled bold text in ITS.
2013-01-08 16:54:23 +09:00
Bill Currie febb615580 Create a test for octal chars in plist strings.
Both reading and writing.
2013-01-08 16:32:57 +09:00
Bill Currie 751417ffb2 Rename R_RecursiveWorldNode to R_VisitWorldNodes.
Finally, the name reflects its actual purpose.
2013-01-07 19:59:49 +09:00
Bill Currie a852eeb711 Remove the recursive versions of R_RecursiveWorldNode.
They seem to not be needed any more.
2013-01-07 19:57:21 +09:00
Bill Currie 9758302023 Fix sw and sw32's R_RecursiveWorldNode node stack.
I guess I had forgotten to make the node stack dynamically allocated for
these renderers. Now ITS works in all four renderers.
2013-01-07 19:51:36 +09:00
Bill Currie 43702580f5 Clear the texture element chain after drawing.
It was properly cleared after drawing water chains and sky chains, but I
had missed normal surfaces. It took the use of the same texture for both
normal surfaces and water surfaces to trigger the bug. Thanks go to Simon
'Sock' O'Callaghan and his In The Shadows mod.
2013-01-06 20:05:59 +09:00
Bill Currie 49d07ce452 Implement MH's version of Sys_DoubleTime for windows.
From http://forums.inside3d.com/viewtopic.php?p=36239
2013-01-05 17:52:54 +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 7206756952 Produce a vidmode list for developer output.
vidmode is starting to show its age. Modern X doesn't need a config file,
and when one is not available, the list of available resolutions is quite
strange. Time to look into randr support.
2013-01-01 15:13:27 +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 a4d95f3f53 Move Mod_FindClipDepth and recurse_clip_tree into clip_hull.c.
Since the hull depth needs to be set for the hull to be useful, it makes
sense to move the code into the same place that allocates new hulls (to me,
anyway).
2012-12-29 16:25:47 +09:00
Bill Currie 3b63c31b5d Use pr_return for the null pointer check.
The params come after the return slot :P. Getting a null pointer exception
for movep from .return wasn't very funny.
2012-12-26 11:47:53 +09:00
Bill Currie 1fdc32bb39 Check for null VM pointer accesses.
Currently only four words of "null pointer protection" are available, but
it's a start.
2012-12-22 14:24:11 +09:00
Bill Currie 6eb6b6c0ba Change pointer_t to unsigned and clean up the mess.
It doesn't make sense to have negative pointers. The size of the commit is
from enabling gcc's -Wtype-limits warning and cleaning up that mess too.
2012-12-21 21:53:13 +09:00
Bill Currie 84a68b139e Rename set_iter_t's value to element.
Correct terminology and all :)
2012-12-21 14:09:00 +09:00
Bill Currie 427d52511c Fix an uninitialized variable warning.
It's a false positive, but best to be safe.
2012-12-19 17:13:32 +09:00
Bill Currie 7b38b0b339 Make S_Init safe to use with a null viewentity.
Current work in qwaq doesn't need 3d spacialization, so it wants to pass
null for the viewentity pointer.
2012-12-17 15:07:49 +09:00
Bill Currie e17d8ac9db Add ruamoko wrappers for the set api.
This includes both normal functions and a Set class (and SetIterator
class). Most of the methods are implemented as builtins.
2012-12-16 13:48:36 +09:00
Bill Currie 3a9fe196b6 Get the return param right for messages to nil.
R_INT(pr) = R_(INT)(pr); is not exactly what I had intended :P
2012-12-16 13:39:59 +09:00
Bill Currie f631f514e9 Fix the obj_error family of functions.
It seems they were written before quaternion support was added and were not
updated to take into account the variable size of parameters. Now at least
Object's -error: works.
2012-12-16 13:19:31 +09:00
Bill Currie 11b991cf9d Print the error message before the state dump.
Normally, the order doesn't matter, but when tracing code, it becomes very
difficult to tell where the trace ends and the dump begins. Printing the
message first puts the message between the trace and the dump: much easier
:)
2012-12-16 12:27:15 +09:00
Bill Currie 101ca22b5a Fix a couple of warnings found by the mxe gcc.
Finally, a recent gcc for our mingw builds :)
2012-12-14 17:07:53 +09:00
Bill Currie 3e38c4aa48 Merge branch 'qfcc-cse'
qfcc now does local common subexpression elimination. It seems to work, but
is optional (default off): use -O to enable. Also, uninitialized variable
detection is finally back :)

The progs engine now has very basic valgrind-like functionality for
checking pointer accesses. Enable with pr_boundscheck 2
2012-12-13 20:17:28 +09:00
Bill Currie 95c249e8b9 Scale the glsl crosshairs to match gl. 2012-12-12 22:34:49 +09:00
Bill Currie 2ce65d931e Use exact texture coords for 2d pics in glsl.
Moving the texture coordinates in 1/4 pixel made a mess of the 2d pics
(very noticable on the round crosshair).
2012-12-12 22:34:43 +09:00
Bill Currie cb259823af Scale the glsl crosshairs to match gl. 2012-12-12 21:37:55 +09:00
Bill Currie f71affdfba Use exact texture coords for 2d pics in glsl.
Moving the texture coordinates in 1/4 pixel made a mess of the 2d pics
(very noticable on the round crosshair).
2012-12-12 21:34:37 +09:00
Bill Currie a372efee5c Add a new crosshair.
Now all 4 slots of the crosshair table are used :)

Also, fix the offset for pic based crosshairs in glsl, and use just one
func for them.
2012-12-12 19:36:50 +09:00
Bill Currie 814f902e88 Add a new crosshair.
Now all 4 slots of the crosshair table are used :)

Also, fix the offset for pic based crosshairs in glsl, and use just one
func for them.
2012-12-12 19:36:18 +09:00
Bill Currie 6473951daa Make the set notation more correct.
The empty set is now {}, the set of everything is now {...} and the rest
now have {} around the members.
2012-12-09 22:17:55 +09:00
Bill Currie 061e2be5d4 Re-write the set testing code.
Getting everything right with an enum proved to be too difficult if not
impossible. Also use better tests for equivalence and intersection.

Many more tests have been added. All pass :)
2012-12-09 13:52:48 +09:00
Bill Currie 94e804d786 Make some more set_test fixes.
Two inverted sets can never be disjoint.
2012-12-07 22:25:36 +09:00
Bill Currie 56956fc370 Rewrite the intersection tests.
The early bailout proved to be difficult to get right, so don't bother.
2012-12-07 22:16:51 +09:00
Bill Currie 98c9e4f8c0 White space. 2012-12-07 22:16:22 +09:00
Bill Currie f3328a61c7 More tests and update a comment. 2012-12-07 22:16:07 +09:00
Bill Currie b053edee17 Fix the handling of size in set_expand.
It was correct for set_add, but not for other ops :/ (out by 1)
2012-12-07 20:44:09 +09:00
Bill Currie 770a40cef0 Add a bunch more tests.
Even found some bugs :)
2012-12-07 20:43:11 +09:00
Bill Currie 39920a4ea7 Fix the type when converting set of everything to string. 2012-12-07 19:35:37 +09:00
Bill Currie c76231ca30 Add some very basic tests for sets.
They test creation, empty, everything and inversion. Already found a bug
(typo: "everythign" :P)
2012-12-07 19:34:34 +09:00
Bill Currie e0c92b6089 Rename set_iter_t's member to value.
Makes more sense now that the membership of the value depends on the
inversion of the set.
2012-12-06 21:11:38 +09:00
Bill Currie eb8fd55677 Move set.c into libQFutil.
Also move the ALLOC/FREE macros from qfcc.h to QF/alloc.h (needed to for
set.c).

Both modules are more generally useful than just for qfcc (eg, set
builtins for ruamoko).
2012-12-06 20:52:53 +09:00
Bill Currie 34e3ac1468 Fix jumpb's operand types.
Aliasing the jump table to an integer broke statement_get_targetlist with
the new alias def handling, and was really wrong anyway. I probably did
that due to being fed up with things and wanting to get qfcc working again
rather than spending time getting jumpb right.
2012-12-05 22:20:55 +09:00
Bill Currie a12eb940f1 Remove the hard-coded bsp maximum depths.
The depth limits in the gl and glsl renderers and in the trace code really
bothered me, but then the fix hit me: at load-time, recurse the trees
normally and record the depth in the appropriate place. The node stacks can
then be allocated as necessary (I chose to add a paranoia buffer of 2, but
I expect the maximum depth will rarely be used).
2012-11-28 21:29:03 +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 4b503c7f72 Store the requested size in the block.
This necessitated disabling the id2 padding, but it's only commented out
incase there's more growth. Now the (compiler) error in -addObjectNoRetain
is caught ealier.
2012-11-19 21:50:42 +09:00
Bill Currie 8ee98e1ef5 Rename memblock_s's size to block_size.
In order to improve the pointer checking, I plan on adding a size field to
represent the requested size.
2012-11-19 21:35:27 +09:00
Bill Currie 49ad301d3d Add improved memory checking to progs.
With pr_boundscheck >= 2, pointer access will be checked against allocated
blocks (qfvalgrind?:). Currently extremely basic, but it seems to work.
2012-11-19 20:03:21 +09:00
Bill Currie d0c37bbc51 Change the int<->float conversion opcode string.
Using "=" was rather confusing, so changing it to "<CONV>" seems to be a
good idea. As the string is used only for selecting opcodes at compile
time, only qfcc is affected.
2012-11-16 14:47:54 +09:00
Bill Currie b8b626ee81 Change the int<->float conversion opcode string.
Using "=" was rather confusing, so changing it to "<CONV>" seems to be a
good idea. As the string is used only for selecting opcodes at compile
time, only qfcc is affected.
2012-11-16 14:45:11 +09:00
Bill Currie d5c831b6da Add a little test case for accessing types.
Using ruamoko to access ruamoko type encodings is actually quite pleasant
:)
2012-11-15 13:40:11 +09:00
Bill Currie 6b46cde7c8 Move retainCount out of Object.
Going by "standard" Objective-C, retainCount really doesn't belong in
Object itself. The way GNUStep does it is to stash retainCount in memory
just below the object by allocating extra bytes for the count and returning
a pointer just beyond those extra bytes. Now Ruamoko does the same. This
fixes the inconsistencies in structure layouts for Protocol and class
structs between qfcc generated (internal) structs and user visible structs.
2012-11-08 20:24:25 +09:00
Bill Currie 1f9735d0cb Correct the dump format for conj.q. 2012-10-27 11:45:10 +09:00
Bill Currie ec42bde527 Make hash tables more const correct.
And clean up the resulting mess :/
2012-10-27 11:44:31 +09:00
Ozkan Sezer 6e04fd5ff6 signed int viddef_t members
The attached patch (against quakeforge git) changes the [con]width,
[con]height, and most importantly the rowbytes members of viddef_t
from unsigned to signed int, like in q2.  This allows for a properly
negative vid.rowbytes which may be needed in, e.g. a DIB sections
windows driver if needed.  Along with it, I changed a few places
where unsigned int is used along with comparisons against the relevant
vid.* members.
One thing I am not 100% sure is the signedness requirements of
d_zrowbytes and d_zwidth: q2 has them as unsigned but I am not sure
whether that is because they are needed as unsigned or it was just an
oversight of the id developers. They do look like they should be OK
as signed int to me, though: comments?

==
Note from Bill Currie: I had to do some extra changes as many
signed/unsigned comparisons were somehow missed.
2012-10-21 09:00:50 +09:00
Bill Currie eccc1b5b51 Put the over-size range back to its original value.
This fixes the horribly different results between optimized and unoptimized
qfbsp (there is still a difference of 1 brushface). Unfortunately, it also
severely limits the maximum size of a map.
2012-09-18 09:25:10 +09:00
Bill Currie 709da6e7d7 Rotate the skybox -90 degrees on the z axis (gl)
Now gl and glsl match again, and quake's skies are now "correct" (assuming
fitzquake is the standard).
2012-09-13 08:36:28 +09:00
Bill Currie 14f089d08e Correct the orientation of the skybox (for glsl).
It turns out the expected orientation of the sky cube is exactly that of
Blender's default cube looked at from the front view (num-1) and the front
face being the nearest face. This put's Marcher's sun nicely in the view
when exiting the cave.
2012-09-12 19:06:07 +09:00
Bill Currie 536ee48a97 Some minor skybox improvements suggested by mh.
Rearrange the sky_suffix and sky_coords arrays and remove the sky_target
array such that the faces can be loaded using
GL_TEXTURE_CUBE_MAP_POSITIVE_X + i (apparently certain drivers break if
the faces aren't loaded in the correct order).

Also, the nomalization of the direction vector in the fragment isn't
necessary.
2012-09-12 15:20:35 +09:00
Bill Currie 433d9d138b Hook up the pointfile loader in glsl.
I was always wondering what that was for (never bothered looking at the
command registration, I guess :P).
2012-09-12 09:54:24 +09:00
Bill Currie 45c48a6215 Fix bsp2 loading.
Just some problems with the handling of extended bsp29 files. I'm not
quite happy with the code, but it will do for now.
2012-09-08 09:41:00 +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 beb0b9e0fc Fix a segfault when no interfaces are available. 2012-09-08 09:37:48 +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 69fb78278f Remove the redundant endian conversions from bsp loading.
It's obvious that it's been a very long time since anybody's tried playing
QF on a big-endian machine: double converting data isn't good :/
2012-09-07 15:45:59 +09:00
Bill Currie 6ba6959205 Allow any NxN or 2NxN sky texture for glsl.
Maps that specify a skybox often use a fake sky texture, sometimes 16x16.
Having a hardcoded requiredment of 256x128 is a tad inappropriate.
2012-09-05 14:02:44 +09:00
Bill Currie d6a1daaf30 Force a refdef update when nearclip or farclip change. 2012-08-29 09:55:17 +09:00
Bill Currie abc81cee85 Avoid building unneeded libs.
Having better dependency info in build_control.m4 would be nice, but this
works well enough for now.
2012-08-20 14:12:20 +09:00
Bill Currie 9bfcdad35a Fix some type-size safety issues.
Expecting int to be 32 bits is a little dangerous, and the function
versions of swap/noswap should be unsigned rather than signed.
2012-08-19 13:37:06 +09:00
Bill Currie 0bd613b73d Disable vorbisfile's static callbacks.
Since we use callbacks anyway, they're not needed, and this fixes the
warnings/errors when using ps3toolchain.
2012-08-19 08:05:50 +09:00
Bill Currie bf41851bd9 Check for ioctl availability.
This gets networking compiling. Now the build gets all the way to qfcc,
where it dies with waidpid/execvp errors :P
2012-08-18 22:02:02 +09:00
Bill Currie 575693e4a0 A bunch of networking compile fixes.
This isn't everything needed to get networking compiling, but it's pretty
close.
2012-08-18 21:49:30 +09:00
Bill Currie 78f7604efc Evil hack to handle duplicated sdl key syms. 2012-08-18 21:44:51 +09:00
Bill Currie 9250eb83bf Yet more char index issues.
Should be getting near the end of these as qfcc tries to link in my hacked
up tree :)
2012-08-18 21:42:49 +09:00
Bill Currie 7f805c2527 Use pkg-config for zlib.
Helps cope with zlib being in weird places (eg, ps3toolchain)
2012-08-18 21:41:33 +09:00
Bill Currie 3b047a3cc1 Check for getuid and cope when it's not there.
The ps3toolchain doesn't have getuid or getpwent. Nor does it have
timeGetTime, so use Sys_DoubleTime instead.
2012-08-18 21:37:54 +09:00
Bill Currie 6200d35109 Don't include SDL_byteorder.h
We don't need it and it's not always available.
2012-08-18 21:35:24 +09:00
Bill Currie 6f484ee757 Add support and tests for 3x3 matrices. 2012-08-18 16:29:57 +09:00
Bill Currie cc35209f86 Yet more char index issues :P 2012-08-18 12:20:08 +09:00