Compare commits

...

150 commits

Author SHA1 Message Date
Bill Currie
9a9367ae08 update for modern auto tools 2002-10-26 04:27:10 +00:00
Bill Currie
630b1e7a4f fix sw alias model skin loading 2001-12-01 23:31:48 +00:00
Bill Currie
6be99353a1 backport the locs reading fix 2001-11-27 21:25:54 +00:00
Timothy C. McGrath
86f6ce2265 Fixed compiling newtree with alsa 0.9 so it doesn't die with -Werror enabled
Just enough to get it compiling again, I don't actually use this - if someone
actually is using this seriously and this makes it stop working I'll see what
I can do about the depreciated warnings I'm seeing when the clients are lding.

Tim McGrath
(Misty-chan)
2001-11-24 01:17:43 +00:00
Anton E. Gavrilov
36b83eae86 Fix the bug with potential memory overwrite in Info_SetValueForStarKey 2001-11-11 15:03:33 +00:00
Bill Currie
7fa170c325 make make changelog work out-of-tree 2001-10-31 22:59:41 +00:00
Bill Currie
1e1ee75773 fix a seg due to not-yet-initialized sv_highchars cvar 2001-10-20 21:31:21 +00:00
Bill Currie
1afaefd9dc hardware gamma support. I don't know how well it works (hard to tell on my
test box), but it doesn't crash :)
2001-10-20 20:59:55 +00:00
Bill Currie
0fad122bc3 final fixes to get -wgl working. 2001-10-20 19:50:03 +00:00
Bill Currie
412959acba whitespace 2001-10-20 18:52:57 +00:00
Bill Currie
0bca15c502 don't try to add contrast to the blend if we don't yet know what contrast is 2001-10-20 18:51:15 +00:00
Bill Currie
aed7b1c08d backport the svc_updatefrags flood fix 2001-10-19 16:43:15 +00:00
Bill Currie
f15ca83c60 mingw cross compile fixes 2001-10-19 06:46:32 +00:00
Bill Currie
326dc35b41 oops, that didn't work so well for 1.5 2001-10-17 23:22:04 +00:00
Bill Currie
02005a95a4 don't bother linking against an empty lib (some lds seg) 2001-10-17 23:17:57 +00:00
Bill Currie
55229ae4e2 fixes for automake 1.5 2001-10-17 23:06:49 +00:00
Bill Currie
0de1421e61 remove some duplicate header tests 2001-10-16 16:24:34 +00:00
Bill Currie
ae066e93a7 make people's lives easier 2001-10-16 16:18:59 +00:00
Bill Currie
294e8b5dea cross compilation fixes 2001-10-16 16:16:52 +00:00
Bill Currie
2f5e58be2d explicitly link against the correct cl_sys_*.c 2001-08-21 02:30:45 +00:00
Bill Currie
ba5f9ae9a9 protect sys/type.h 2001-08-20 22:38:19 +00:00
Bill Currie
b7727dc730 d'oh, missed this one (QF/) 2001-08-20 22:27:00 +00:00
Thad Ward
808e3ace87 remove some unneccessary cruft 2001-08-20 22:22:16 +00:00
Bill Currie
548ff2f227 bail when Sys_MakeCodeWriteable winds up empty 2001-08-20 22:12:40 +00:00
Bill Currie
1ed975edd5 backport 0.5's sys stuff. much saner linking. 2001-08-20 22:08:54 +00:00
Bill Currie
4fa410afef more compile fixes 2001-08-19 22:35:44 +00:00
Bill Currie
c577657e8e /me makes a not to pay closer attention to ifndef vs ifdef 2001-08-19 22:13:03 +00:00
Bill Currie
7dccb4388d compile fixes for newer sdl 2001-08-19 22:08:31 +00:00
Bill Currie
76bee6c8ab sdl and sgl build now too :) 2001-08-15 19:39:07 +00:00
Bill Currie
305fc0c371 misc fixes to get -wgl to cross compile 2001-08-15 18:07:55 +00:00
Bill Currie
d74f867b06 oops, must have had gl disable for that test :/ 2001-08-15 17:07:07 +00:00
Bill Currie
363aca5b84 backport the mesh improvements from 0.5 2001-08-15 16:25:23 +00:00
Bill Currie
f4dc013a3d back port the info key fix from 0.5. This should take care of the team
kicking.
2001-08-12 03:45:37 +00:00
Bill Currie
6714119351 apply Bruce Momjian's update to his sound/focus patch. Thankyou. 2001-07-12 16:39:49 +00:00
Bill Currie
c4fe80e9c3 check for _snprintf and _vsnprintf 2001-07-08 16:31:27 +00:00
Bill Currie
11f65cc599 double d'oh 2001-07-06 00:19:52 +00:00
Bill Currie
0fbfd46be0 I decided to apply Bruce's sound/focus patch as is after all. 2001-07-05 19:22:28 +00:00
Bill Currie
6c04ad09f8 forgot the imput mask patch 2001-07-05 19:18:20 +00:00
Bill Currie
a823912075 Apply most of Bruce Momjian's BSD/OS 4.2 patches. I didn't include his sound
stoping code because I don't like the way it was done, I'll work on
implementing a better version next.

        * Use of poll() is not standard.  I replaced it with usleep(),
which I think is more portable.  I know linux supports usleep() and all
BSD's.  Another option would be to use select(), which is much more
widely supported than poll().

        * Modified in_x11.c to stop sound and turn on keyboard repeat
when the Quake window loses focus.  It turns them back on/off when the
window gains focus.  I often play quake and leave the window to do
something else, and the lack of repeat and quake sounds were annoying.

        * Fix the -nomouse option so it still allows keyboard actions.
The current code skips keyboard setup when -nomouse is used.

        * Fix so config.cfg option "confirm_quit" works under X11.
2001-07-05 19:07:02 +00:00
Anton E. Gavrilov
f3f427bf4b In CL_Record_f(): Fix the QW bug with wrong player entertime being recorded to demos. 2001-07-04 01:25:41 +00:00
Bill Currie
4c7c5880fe do that the right way. /I/ feel better now :P 2001-06-12 02:28:44 +00:00
Adam Olsen
11de1a1fde disable fbdev by default 2001-06-12 00:03:16 +00:00
Adam Olsen
afc4f250c8 add #include <unistd.h> 2001-06-12 00:02:48 +00:00
Bill Currie
b2a74984e9 add an "extern cvar_t *fs_basegame" 2001-06-11 23:53:56 +00:00
Joseph Carter
609feb779c Idiotproof the can't find gfx.wad message in newtree too 2001-06-10 12:54:06 +00:00
Joseph Carter
4c9a189f90 Add idiot-proof comment that the cross-compile warnings are bogus 2001-06-08 23:10:11 +00:00
Joseph Carter
883b7ecf80 newstyle dies! 2001-06-06 14:29:58 +00:00
Bill Currie
f3c2c4e868 fix for CustomTF menu truncation 2001-06-03 01:28:11 +00:00
Bill Currie
1362736e55 try three :/ 2001-05-30 22:59:00 +00:00
Bill Currie
5a889df497 true64 attempt two 2001-05-30 22:45:36 +00:00
Bill Currie
cf16e6c5d7 compile fixes for true64 2001-05-30 22:22:58 +00:00
Bill Currie
e0b00dfda0 so THAT'S what snd_mme is for (alpha true64). don't know if this compiles,
but don't want it getting lost again.
2001-05-29 22:38:40 +00:00
Bill Currie
e20541700c not all compilers do the right thing with "extern inline" so fix it the easy
way
2001-05-29 20:29:39 +00:00
Bill Currie
86270446e9 snd_initialized is needed outside of snd_* 2001-05-29 20:16:03 +00:00
Bill Currie
e72ebb6c63 send a nop packet to make sure *list packets get acked. should prevent
"player overflowed" messages.
2001-05-29 03:45:52 +00:00
Bill Currie
bc6ff9fc19 it seems autoconf 2.50 doesn't like nested AC_CHECK_FUNC calls 2001-05-26 04:08:32 +00:00
Jeff Teunissen
8f66467568 Misc. cleanups to configure; shaving off some of the excess fat. 2001-05-23 08:12:30 +00:00
Jeff Teunissen
df184072f1 Eliminate the use of stricmp() 2001-05-23 08:08:49 +00:00
Joseph Carter
3cde1a0608 NEWS doesn't apply to newtree 2001-05-22 15:02:38 +00:00
Thad Ward
7a0ba8ca2e port Mercury's Userinfo validation over from cougar. 2001-05-22 14:23:19 +00:00
Thad Ward
759729b5a8 Prevent an infinite loop in a fairly rare case, where the infostring is too
full to accept a new name when there is a duplicate name.
2001-05-22 12:55:36 +00:00
Adam Olsen
920de43af9 - remove align flags from gcc command line
- only use usleep if HAVE_USLEEP is defined
2001-05-22 05:39:16 +00:00
Adam Olsen
5369e82456 ditto as from other commit. 2001-05-22 05:25:20 +00:00
Bill Currie
eb974c6dcb sadly, that just does not work 2001-05-21 06:01:03 +00:00
Bill Currie
a90f8132a7 make the rw selection do the right thing elsewhere 2001-05-21 01:13:44 +00:00
Bill Currie
d90d3d0de3 change "%x" (int)(pointer_expr) to "%p" (pointer_expr) 2001-05-16 21:11:50 +00:00
Bill Currie
f3e7e4d1bc fix device openning mode. defaults to write only, but read/write can be
selected using -sndrw
2001-05-16 18:57:54 +00:00
Adam Olsen
d97095fe87 Apply usleep patch, so we don't busy-wait so much. cl_maxfps will
now release your CPU :)
2001-05-16 08:59:10 +00:00
Bill Currie
3fc2675cb8 fix key_dest handling on startup 2001-05-15 05:35:42 +00:00
Bill Currie
88c3955b4f bump the default memsize up to 16M 2001-05-15 05:35:09 +00:00
Adam Olsen
9de78a5d83 two minor fixes from when I tried gcc 3.0. includes a trigraphs fix. 2001-05-15 02:06:02 +00:00
Adam Olsen
d1f33ed6a6 backport my sdl audio fixes 2001-05-14 22:53:17 +00:00
Jeff Teunissen
978d90f9f7 Make up/down arrows skip over brightness and contrast's positions when
they don't exist.
2001-05-14 18:08:32 +00:00
Bill Currie
a7c23e13a9 handle X11 key repeat properly 2001-05-13 22:29:41 +00:00
Bill Currie
dd134f9c4f updated for 0.3.1 2001-05-13 22:29:13 +00:00
Jeff Teunissen
765a22a033 Remove the rest of the calls to GL_CheckBrightness() 2001-05-13 19:22:31 +00:00
Jeff Teunissen
8a4cc8a526 Restore gamma properly in X11 targets, regardless of the value of
vid_system_gamma
2001-05-13 09:07:57 +00:00
Jeff Teunissen
1a9db8c2eb Make gamma work for GL. Man, that was stupid. :) 2001-05-13 09:06:51 +00:00
Jeff Teunissen
2e88971a08 Make the menu get initialized after video; otherwise, the menu will never
pick up brightness and contrast. :)
2001-05-13 08:26:45 +00:00
Jeff Teunissen
540d13b588 Deal with brightness and contrast not existing in software targets, but do
it at runtime.
2001-05-13 07:48:05 +00:00
Bill Currie
9d23ea9db0 who the hell used 0 for CVAR_NONE? 2001-05-13 05:15:36 +00:00
Jeff Teunissen
272abade38 Backport Cvar callbacks to newtree. Software gamma still doesn't work in
GL, and I still don't know exactly why.
2001-05-13 05:10:02 +00:00
Jeff Teunissen
75089e506e Configure updates, also rev for 0.3.1 2001-05-13 05:08:49 +00:00
Jeff Teunissen
bfc25fa462 Gamma cleanups. Software gamma still doesn't work in GL. 2001-05-12 06:53:53 +00:00
Bill Currie
72d8bd6af7 put in some debug info about precache overflows 2001-05-12 03:24:29 +00:00
Thad Ward
6162fd8017 got win32 building again. not sure (yet) if it works as advertised.
will fully test later.
2001-05-02 22:53:10 +00:00
Bill Currie
8327d1edac clean up V_CheckGamma a bit 2001-04-23 18:44:56 +00:00
Bill Currie
2d5f4b86fb sw gamma now seems to work 2001-04-23 18:39:14 +00:00
Bill Currie
6a75c4e00d vid_gamma now seems to work :) 2001-04-23 04:16:17 +00:00
Bill Currie
bd06625c55 backport the gamma code from the quakeforge tree in preparation for 0.3.1
Doesn't work yet because VID_UpdateGamma needs to be called at the
appropriate time and cvar callbacks are not implemented in newtree.
2001-04-23 03:52:20 +00:00
Anton E. Gavrilov
b9caa4273c LordHavoc forgot to #include "mathlib.h" 2001-04-22 05:18:03 +00:00
Adam Olsen
bf6afa6ad4 Thought I would have commited this by now... 2001-04-20 13:29:55 +00:00
Adam Olsen
5b46db8796 No harm in backporting a few fixes :) 2001-04-20 13:17:48 +00:00
Brian Koropoff
75ecbe3032 This change adds a new type of client connection state (cs_prespawned) to make sure
the client sends the prespawn, spawn, and begin commands in the correct order.
This stops several interesting cheats in TF as well as the posibility of avoiding the map
checksum.
2001-04-19 23:50:31 +00:00
Bill Currie
06b06abc74 must not call snd_pcm_mmap_forward with a count of 0
this fixes the alsa assert at slower rates
2001-04-13 08:07:56 +00:00
Anton E. Gavrilov
54076d1a07 Fix a typo 2001-04-08 00:06:32 +00:00
Dabb
0e3d9f385a Tiny fix, sizeof(*move) -> sizeof(usercmd_t) 2001-04-06 13:02:35 +00:00
Bill Currie
74a61f22f7 make gdb screens infinitely high so it doesn't stop output and wait 2001-03-27 04:01:32 +00:00
Chris Ison
ad37b9cedd fixing LordHavocs untested code 2001-03-16 13:48:24 +00:00
Forest Hale
a8df60c554 cleaned up d_8to24table (build as bytes to avoid endian-issues and make it more readable) and d_15to8table building (faster and MUCH more readable) 2001-03-16 13:05:57 +00:00
Forest Hale
05545350e7 readability cleanup of vector comparisons to 0, now all such comparisons use VectorIsNull, and a little more whitespace cleanup in cl_pred.c 2001-03-16 12:27:11 +00:00
Forest Hale
f922262b61 changed spaces to tabs in dabb's code 2001-03-16 12:10:59 +00:00
Bill Currie
5c63c96340 fix a silly bug in --with-user-cfg 2001-03-09 21:48:36 +00:00
Jeff Teunissen
6f1587ff7f Userinfo culling in the server. The server now only sends userinfo stuff
that's useful to the client or the players. This should solve the problem
with QW clients' tiny setinfo buffers once and for all. Note, you can
still use setinfo to set your user info, but if it's not in the
"need-to-know" list, the server won't send it back to you. I will probably
make this optional with a server Cvar if there are problems.
2001-03-09 08:25:39 +00:00
Jeff Teunissen
49d7b35d43 New server Cvar: sv_extensions. When set to zero, it disables the extended
challenge, causing QF clients to not detect a QuakeForge server. This
makes the client not add the QF-specific info strings, in turn making it
not overflow original QW clients' limited setinfo space. This also
probably makes certain proxies work with QF servers again. It /also/ has
the side effect of disabling compressed downloads. If you want compressed
downloads, you need sv_extensions on.

Also, remove the "stdver" setinfo in the client -- it's handled by
*qsg_version if there's a QF server on the other end, so it was just
wasted space.
2001-03-09 04:50:14 +00:00
Bill Currie
24841130a7 change egcs to kgcc for the broken distro 2001-03-08 21:03:39 +00:00
Bill Currie
8cca7c7dd9 strings.h/string.h compile fixes 2001-03-08 19:50:50 +00:00
Bill Currie
b68b6a4dd3 fix a compile bug 2001-03-07 04:01:23 +00:00
Dabb
b4dfcb0906 I don't think we want to do prediction when DISCONNECTED ... 2001-03-05 18:10:52 +00:00
Dabb
89dd78e5fe Merged duplicate client/server functions (placed into PMOVETST.C).
Client now uses WORLDA.S (renamed func)
2001-03-05 11:53:02 +00:00
Dabb
a033a03624 Merged duplicate client/server functions (placed into PMOVETST.C).
pmtrace_t replaced by trace_t with ent->entnum change
pmplane_t replaced by plane_t
2001-03-05 11:52:19 +00:00
Dabb
f15c42184d Merged duplicate client/server functions (placed into PMOVETST.C).
PM/SV_HullPointContents > HullPointContents
Client now uses WORLDA.S (renamed func)
2001-03-05 11:51:17 +00:00
Dabb
e703935e9b Merged duplicate client/server functions (placed into PMOVETST.C).
PM/SV_RecursiveHullCheck -> HullCheck
PM/SV_InitBoxHull -> InitBoxHull
PM/SV_HullForBox -> HullForBox
PM/SV_HullPointContents > HullPointContents
Client now uses WORLDA.S (renamed func)

pmtrace_t replaced by trace_t with ent->entnum change

pmplane_t replaced by plane_t
2001-03-05 11:49:59 +00:00
Dabb
bb39a9252b Checks against MAX_PHYSENT overflow. 2001-03-05 11:48:52 +00:00
Dabb
c2cf684118 Hullcheck client/server duplicate merge.
mtrace_t replaced by trace_t with ent->entnum change
pmplane_t replaced by plane_t
Might even break something!
2001-03-05 11:48:20 +00:00
Jeff Teunissen
4ae1fda2e1 include snafu in null input driver. 2001-02-26 18:43:29 +00:00
Ragnvald Maartmann-Moe IV
fcd38297d9 Comment update. Move along, nothing to see here. 2001-02-24 08:24:14 +00:00
Bill Currie
c32a59b343 add the contents of the config dir 2001-02-24 03:44:33 +00:00
Ragnvald Maartmann-Moe IV
6d9846e2ce Outdated. Gone. 2001-02-23 22:28:19 +00:00
Ragnvald Maartmann-Moe IV
2bb966d1f7 Remove support for unreleased ALSA 0.6, replace with current 0.9 support.
(thanks to Abramo Bagnara)
2001-02-23 22:24:26 +00:00
Timothy C. McGrath
5cda3dc3cb swspeed.cfg is speed cfg for software clients (-x11 -svga) however it is
not well tested, and needs someone to bash it over the head a few times.
If you routinely use the software clients, please find out what in this
file works for you, and let me know.

Misty
2001-02-22 20:38:54 +00:00
Timothy C. McGrath
63f6f3e9cd My glspeed.cfg this time for newtree. This file will not be updated as
often, as newtree is (generally) a non moving target. However, bug
reports will cause modifications to this file as I get them.

Let me know of any problems,
Misty
2001-02-22 19:26:51 +00:00
Bill Currie
4f7561fd92 fix broken ipv6 address field 2001-02-22 19:00:34 +00:00
Bill Currie
32c6b2be38 add reporting of compression support 2001-02-22 06:03:44 +00:00
Dabb
19c37bbcb3 Some optimizations, use memset instead of for loop with *bl++=0.
Uses almost 1% less CPU for me :-)
2001-02-20 16:52:24 +00:00
Dabb
ea7e76fab7 Added cl_nostatpred. When 1, static, nonmoving players are NOT predicted.
Saving up some CPU time when lot of snipers and sitting duck campers
around. Experimental, try it out.
2001-02-19 15:57:36 +00:00
Bill Currie
2cac0ae365 This should fix the skins problem windows users have been experiencing. I must
have accidently killed the correct version in either my cvar audit or the skin
re-vamp. Thanks, Invigor, for your help in finding this.
2001-02-19 02:51:33 +00:00
Bill Currie
942732d3b9 the mingw files were feeling neglected 2001-02-18 05:01:24 +00:00
Ragnvald Maartmann-Moe IV
c41b730fb8 Fix for compiling without zlib. 2001-02-17 22:00:26 +00:00
Dabb
cabd99e201 Oooops :-) 2001-02-17 12:42:06 +00:00
Dabb
6356c8e596 Default to 16bit colors. 2001-02-17 12:24:39 +00:00
Bill Currie
fdc8bedd2e fix a silly bounding box error 2001-02-17 04:59:13 +00:00
Bill Currie
20b9411bcc disable transparent pixels in the conback. They will still currently be black,
but at least they won't flicker on some drivers.
2001-02-16 22:07:40 +00:00
Dabb
2bb4a60a69 Cleaning up code and adding little more error reporting. Also, now cleans
leftovers when funcs fails bit better.
2001-02-16 14:28:01 +00:00
Bill Currie
c3208b87e7 correct a docco goof on the allskins command 2001-02-16 01:48:49 +00:00
Ragnvald Maartmann-Moe IV
d3e280a088 Fix for wandering point on polyblended cones. Should now always point directly at viewers eye, rather than perpendicular to the view plane...
(thanks Taniwha)
2001-02-16 00:09:49 +00:00
Dabb
d81eb19c1f Check for null buffers from directsound. (forgot to commit, hm..) 2001-02-15 18:25:09 +00:00
Bill Currie
01baf4a868 turns out it might not be gamespy after all, and I didn't particularly like
this as a solution anyway, so I've enabled the command packet channel by
default. I'm leaving it in, because it's a nice to be able to close it
completely under other circumstance.
2001-02-15 18:03:59 +00:00
Jeff Teunissen
e1638eba85 (Finally!) commit the property list parser. 2001-02-15 17:18:45 +00:00
Ragnvald Maartmann-Moe IV
e5cd5030ae Oops. Flattening polyblends is only a help in very limited circumstances. ;) 2001-02-15 09:42:43 +00:00
Ragnvald Maartmann-Moe IV
8d68ffe9f0 Fix long standing issue with conical nature of polyblend dlights being obtrusive. 2001-02-15 07:15:10 +00:00
Bill Currie
ac94390460 got the logic of the if mixed up 2001-02-14 22:26:57 +00:00
Bill Currie
de22be39ba break gamespy instead of gamespy breaking us. disable command packets by
default. If somebody wants gamespy to do its evil, they can say so explicitly.
2001-02-14 22:25:22 +00:00
Bill Currie
ca06d3994d ALWAYS print commands coming from external sources (eg GameSpy (ewww)) 2001-02-14 21:50:55 +00:00
Jeff Teunissen
30a0105e82 Move the DGA check for XDGA_MAJOR_VERSION inside the actual HAVE_DGA
check. :)
2001-02-14 16:47:50 +00:00
Bill Currie
8dead3b82d don't try to execute a "" file 2001-02-14 16:45:58 +00:00
Bill Currie
a76c7779a7 remove a bogus prototype 2001-02-14 05:12:14 +00:00
Zephaniah E. Hull
192eba3898 Compiles now, works too. 2001-02-14 02:49:37 +00:00
Jeff Teunissen
96722e9137 Yeah yeah, I messed it up again. 2001-02-14 02:39:43 +00:00
Jeff Teunissen
cedd063a6a Okay, so I fscked up the video mode restoration. Sue me. It's fixed now. 2001-02-14 02:36:27 +00:00
143 changed files with 4369 additions and 3677 deletions

View file

@ -13,9 +13,8 @@ EXTRA_DIST= README.WIN newtree.dsw ChangeLog \
NOCONV_DIST= $(distdir)/include/win32/resources/icon1.ico NOCONV_DIST= $(distdir)/include/win32/resources/icon1.ico
changelog:: changelog::
-touch ChangeLog ( cd $(top_srcdir); \
-tools/cvs2cl/cvs2cl.pl -b --utc tools/cvs2cl/cvs2cl.pl --stdout -b --utc ) > ChangeLog
-rm -f ChangeLog.bak
dist-zip: distdir dist-zip: distdir
-chmod -R a+r $(distdir) -chmod -R a+r $(distdir)

204
NEWS
View file

@ -1,204 +0,0 @@
NEWS for the QuakeForge project
-------------------------------
QuakeForge 0.2
08 Mar 2000 - Massive news updates
The engine is actually working and working well for perhaps the
first time since we branched off stable. A long overdue news
update is in order. These things have been added to GL targets:
Skyboxes
Put a a Quake2 skybox in mydir/gfx/env and -game mydir,
set r_skyname to the base name of the sky (for the one
released on the MegaTF website, use r_skyname night for
example), load a map with a sky in it, and set r_sky 1.
You must reload a map for a new r_skyname to take effect.
The software renderer WILL support this hopefully soon.
Volumetric fog
For testing only. As implemented now it uses the stencil
buffer (very slow for most of us) and borrows the water
brush since we don't have a fog brush yet. raptor suggests
r_volfog 0.0009 and r_wateralpha 0.3 to test. You'll need
watervis'd maps.
Water Ripples
We reported earlier that setting r_waterripple to 1 made a
wave effect. Actually, if you want a wave effect you can
see, you'd better set it at least to 5. Looks good with
the volfog settings mentioned above. raptor plans to put
r_waterripple into the software renderer.
Rodents with wheels
If you've got one, you'll be pleased to hear that -x11 and
-glx now support them the same way -svga does. You need to
have ZAxisMapping set in your XF86Config properly.
26 Jan 2000 - Waterwarp bug fixed
The waterwarp bug has been fixed, set r_waterwarp 1 to use it.
QuakeForge 0.1.0
22 Jan 2000 - cl_sbar and cl_hudswap in uquake
The cvars cl_sbar and cl_hudswap noe work in uquake just like they
do in qw-client. In uquake, cl_sbar defaults to 1 to satisfy the
least-surprise principle. Set it to 0 if you want a qw-client like
HUD.
22 Jan 2000 - changes to command line option -game [REMOVED!]
You may now specify multiple game directories with -game. If for
example you wanted to use the original registered game with MegaTF
on a new style binary you would use -game id1,megatf. It does work
with traditional style binaries and you may specify as many dirs as
you like seperated by commas.
One caveat: Most mods were designed to be the only one in use, it
may be a Bad Thing to mix certain mods with other mods.
NOTE: This feature has been removed because it can seriously cause
confusion to a game mod. The proper way to override part of
a game is to use different fs_basepath and fs_sharepath.
19 Jan 2000 - changes to cvar r_fog
Fog color is once again white. The r_fog cvar is now a control for
the fog density rather than a simple toggle control. Eric Windisch
recommends setting r_fog to .0005 if you're going to use it.
19 Jan 2000 - removed cvar r_mirroralpha
This was a cheap hack which affected one texture on one map of the
entire game. It also wasn't working right, so it's been removed.
19 Jan 2000 - time cheats revisited
The final word in detecting time/speed cheating is here at long
last! Still catches an occasional person who is "not cheating", but
as it turns out when it does catch such a person they technically
are cheating.
This seems to be caused by dodgy cmos clocks used in many machines
on the market. If the server occasionally claims you seem to be
cheating, try installing some sort of ntp program to synchronize
your clock periodically against a time server. If this does not
seem to fix the problem, we'd like to know about it.
18 Jan 2000 - cvar show_fps
show_fps 1 now works in uquake as well as qw-client. No more need
to use timedemo to check performance! Much more accurate in showing
where performance is good and where it isn't.
16 Jan 2000 - new ./configure option: --enable-newstyle
Use this option when you run ./configure if you wish to use a few
QuakeForge defaults which are a bit different than Id Software used,
but do not change the gameplay.
Currenly all this does is use "base" instead of "id1" for the
default place to look for your game data.
11 Jan 2000 - New cvar: r_waterripple
When set to 1 this will create a small wave effect under the GL
renderer.
09 Jan 2000 - Preliminary IPv6 support
Support exists in QuakeForge for the use of IPv6. It's not ready
for prime time yet. Still, it deserves mention.
09 Jan 2000 - gl_ztrick default changed
Since this seems not to work more places than it does at this point,
the default for the cvar gl_ztrick has been changed from 1 to 0 in
the glx target. This value is saved to your config so if it works
for you just set it to 1.
08 Jan 2000 - Mouse wheel support
Preliminary support for the wheels found on some mice has been added
to the Linux SVGALib target. To use it bind MHWHEELDOWN and
MHWHEELUP to whatever you want to use the wheel for.
07 Jan 2000 - Options menu changes
A few things were added to the options menu in some targets such as
an option for fullscreen and whether or not to use the mouse.
06 Jan 2000 - Output cleanups
The use of CR and LF in names is a "feature" Id Software clearly
didn't intend. General mailing list consensus is that unlike other
unintended features (rocket jumps for example), this "feature" has
no real legitimate use. qw-server now replaces CR's and LF's with
underscores.
You will no longer see [e1] or similar crap sent to stdout. These
characters are now translated to the nearest ASCII characters,
resulting in much nicer-looking output.
06 Jan 2000 - PackFile/Findfile messages to stdout removed
The PackFile and FindFile messages previously sent to stdout no
longer are. If you wish to see them again for some reason, set the
developer cvar to 1.
05 Jan 2000 - Preliminary time cheat detection code
Preliminary code to detect clients attempting various time related
cheats has been added. Some issues persist.
05 Jan 2000 - GL fullbright texture support [REMOVED]
The GL renderer now supports fullbright textures, though this causes
a noticable impact on performance. Use the new cmdline option
-noglow to disable it if this bugs you.
NOTE: This was removed for now because it didn't work quite right
and -noglow did not in fact actually disable it properly.
02 Jan 2000 - registered game check removed
The check for a copy of the registered pak files has largely been
removed since it no longer makes a whole lot of sense with all the
talk of free complete TC's (total conversions).
A very simple check for pop.txt (found only in the registered pak
files) remains to set the cvar registered to 1 if necessary,
allowing the start map to know whether or not to allow you through
the gates leading to episodes 2-4.
02 Jan 2000 - crosshairs
qw-client's crosshair 2 is now supported in uquake.
A new (for now) GL-renderer-only experimental crosshair 3 has been
added. It's obeys the crosshaircolor cvar. No timeframe on porting
it to the software renderers yet, but it will happen eventually.
02 Jan 2000 - Removed cvar
gl_reporttjunctions did nothing at all, removed.
01 Jan 2000 - Changed cvar
In uquake, the chasecam cvar is now cl_chasecam just like it is in
qw-client.
01 Jan 2000 - Preliminary volumetric fog
QuakeForge now has preliminary support for volumetric fog. The cvar
r_fog can be set to 1 to try it out.
30 Dec 1999 - CVS tree changes
We now use autoheader and autoconf. If you checkout/update your
tree from CVS you're going to need to run ./bootstrap now to
perform all the necessary black voodoo needed to allow you to run
./configure as normal. This should not be necessary for releases,
only for the CVS tree and CVS snapshots.
29 Dec 1999 - Known bug in sound init fixed
A bug which caused QF to segfault if sound could not be initialized
has been fixed. If sound can not be initialized, you will now
simply not hear any.
29 Dec 1999 - Autoconf support
QuakeForge now uses autoconf! Run ./configure --help and have a
look at the options available in case something isn't detected or
you wish to enable or disable certain compile-time options.
25 Dec 1999 - Keyboard bindings now support keypad keys
The numeric keypad keys found on many keyboards may now be bound to
functions. The names for these keys are (in PC style layout):
KP_NUMLCK KP_DIVIDE KP_MULTIPLY KP_MINUS
KP_HOME KP_UPARROW KP_PGUP
KP_LEFTARROW KP_5 KP_RIGHTARROW KP_PLUS
KP_END KP_DOWNARROW KP_PGDN
KP_INS KP_DEL KP_ENTER

View file

@ -1,125 +0,0 @@
/*
Compiler/Machine-Specific Configuration
*/
#ifndef __config_h_
#define __config_h_
@TOP@
/* "Proper" package name */
#undef PROGRAM
/* Define this to the QuakeWorld standard version you support */
#undef QW_VERSION
/* Define this to the QSG standard version you support */
#undef QSG_VERSION
/* Define if you want to use QF-style defaults instead of Id-style */
#undef NEWSTYLE
/* Define this to the location of the global config file */
#undef FS_GLOBALCFG
/* Define this to the location of the user config file */
#undef FS_USERCFG
/* Define this to the shared game directory root */
#undef FS_SHAREPATH
/* Define this to the unshared game directory root */
#undef FS_USERPATH
/* Define this to the base game for the engine to load */
#undef BASEGAME
/* Define this to the base directory for the client to download skins to */
#undef SKINBASE
/* Define this to use experimental code */
#undef _EXPERIMENTAL_
/* Define this if you want to use Intel assembly optimizations */
#undef USE_INTEL_ASM
/* Define this if you have a Linux-style CD-ROM API */
#undef USE_LINUX_CD
/* Define this if you have a BSD-style CD-ROM API */
#undef USE_BSD_CD
/* Define if you have the XFree86 DGA extension */
#undef HAVE_DGA
/* Define if you have the XFree86 VIDMODE extension */
#undef HAVE_VIDMODE
/* Define this if you have GLX */
#undef HAVE_GLX
/* Define this if you have Glide */
#undef HAVE_GLIDE
/* Define this if you have GL_COLOR_INDEX8_EXT in GL/gl.h */
#undef HAVE_GL_COLOR_INDEX8_EXT
/* Define this if you want IPv6 support */
#undef HAVE_IPV6
/* Define this if C symbols are prefixed with an underscore */
#undef HAVE_SYM_PREFIX_UNDERSCORE
/* Define this if your system has socklen_t */
#undef HAVE_SOCKLEN_T
/* Define this if your system has size_t */
#undef HAVE_SIZE_T
/* Define this if you have ss_len member in struct sockaddr_storage (BSD) */
#undef HAVE_SS_LEN
/* Define this if you have sin6_len member in struct sockaddr_in6 (BSD) */
#undef HAVE_SIN6_LEN
/* Define this if you have sa_len member in struct sockaddr (BSD) */
#undef HAVE_SA_LEN
/* Define if you have the dlopen function. */
#undef HAVE_DLOPEN
/* Define if you have zlib */
#undef HAVE_ZLIB
/* Define if you have pthread support. */
#undef HAVE_LIBPTHREAD
/* Define this to something sane if you don't have stricmp */
#undef stricmp
/* If your version of OpenGL uses APIENTRY, define GLAPIENTRY to be APIENTRY */
#undef GLAPIENTRY
/* Define this to something sane if you don't have stricmp */
#undef stricmp
/* Define this if fnmatch is prototyped in fnmatch.h */
#undef HAVE_FNMATCH_PROTO
/* Define this to something appropriate for declaring 0 length arrays */
#undef ZERO_LENGTH_ARRAY
/* Define this if you want to have packet logging */
#undef PACKET_LOGGING
/* Define this if you have fnmatch.h */
#undef HAVE_FNMATCH_H
/* Define this if you have FB_AUX_VGA_PLANES_VGA4 */
#undef HAVE_FB_AUX_VGA_PLANES_VGA4
/* Define this if you have FB_AUX_VGA_PLANES_VGA4 */
#undef HAVE_FB_AUX_VGA_PLANES_CFB4
/* Define this if you have FB_AUX_VGA_PLANES_VGA4 */
#undef HAVE_FB_AUX_VGA_PLANES_CFB8
@BOTTOM@
#endif // __config_h_

View file

@ -1,2 +1,4 @@
#!/bin/sh #!/bin/sh
aclocal && autoheader && automake --add-missing && autoconf aclocal && autoheader && automake --add-missing && autoconf
echo "If you see a couple warnings about cross-compiling above, don't worry"

View file

@ -10,18 +10,17 @@ AC_VALIDATE_CACHED_SYSTEM_TUPLE(
exit 1 exit 1
) )
dnl This is the only place where the package version appears dnl This is the only place where the package version appears
AM_INIT_AUTOMAKE(quakeforge, 0.3.0) AM_INIT_AUTOMAKE(quakeforge, 0.3.1)
dnl Define the proper name and extra version numbers for package dnl Define the proper name and extra version numbers for package
PROGRAM=QuakeForge PROGRAM=QuakeForge
QW_VERSION=2.40 QW_VERSION=2.40
QSG_VERSION=2.0 QSG_VERSION=2.0
AC_DEFINE_UNQUOTED(PROGRAM, "$PROGRAM") AC_DEFINE_UNQUOTED(PROGRAM, "$PROGRAM", ["Proper" package name])
AC_DEFINE_UNQUOTED(QW_VERSION, "$QW_VERSION") AC_DEFINE_UNQUOTED(QW_VERSION, "$QW_VERSION", [Define this to the QuakeWorld standard version you support])
AC_DEFINE_UNQUOTED(QSG_VERSION, "$QSG_VERSION") AC_DEFINE_UNQUOTED(QSG_VERSION, "$QSG_VERSION", [Define this to the QSG standard version you support in QuakeWorld])
AC_SUBST(PROGRAM) AC_SUBST(PROGRAM)
AC_SUBST(QW_VERSION) AC_SUBST(QW_VERSION)
@ -32,6 +31,9 @@ AC_SUBST(ISODATE)
AC_LANG_C AC_LANG_C
if test ${AR-unset} = unset; then
AR="ar"
fi
endian="" endian=""
case "$host_os" in case "$host_os" in
mingw32*) mingw32*)
@ -39,11 +41,14 @@ case "$host_os" in
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include/win32" CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include/win32"
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include/win32/resources" CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include/win32/resources"
if test $host != $build; then if test $host != $build; then
CC=$host_cpu-$host_os-gcc CC="$host_cpu-$host_os-gcc"
AR="$host_cpu-$host_os-ar"
RANLIB="$host_cpu-$host_os-ranlib"
endian="little" endian="little"
fi fi
;; ;;
esac esac
AC_SUBST(AR)
dnl ================================================================== dnl ==================================================================
dnl Checks for programs. dnl Checks for programs.
@ -57,25 +62,11 @@ AC_PROG_RANLIB
AM_PROG_LEX AM_PROG_LEX
AC_PROG_YACC AC_PROG_YACC
AC_CHECK_LIB(l, main, LEXLIB="-ll", AC_CHECK_LIB(fl, main, LEXLIB="-lfl")) AC_CHECK_LIB(l, main, LEXLIB="-ll",
AC_CHECK_LIB(fl, main, LEXLIB="-lfl")
)
AC_SUBST(LEXLIB) AC_SUBST(LEXLIB)
set $CC
if test "$1" = gcc; then
shift
args="$*"
AC_MSG_CHECKING(for fubared gcc)
if test `gcc --version` = 2.96; then
AC_MSG_RESULT(yes. you poor sod. Hope you have egcs)
CC="egcs $args"
set $CPP
shift
CPP="egcs $*"
else
AC_MSG_RESULT(no. good)
fi
fi
dnl ================================================================== dnl ==================================================================
dnl Checks for system services dnl Checks for system services
dnl ================================================================== dnl ==================================================================
@ -84,7 +75,6 @@ AC_SYS_LONG_FILE_NAMES
AC_EXEEXT AC_EXEEXT
AC_OBJEXT AC_OBJEXT
dnl ================================================================== dnl ==================================================================
dnl Checks for header files. dnl Checks for header files.
dnl ================================================================== dnl ==================================================================
@ -95,21 +85,23 @@ AC_HEADER_MAJOR
AC_HEADER_SYS_WAIT AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS( AC_CHECK_HEADERS(
arpa/inet.h asm/io.h assert.h conio.h ctype.h ddraw.h dinput.h \ arpa/inet.h asm/io.h assert.h conio.h ctype.h ddraw.h dinput.h \
direct.h dirent.h dlfcn.h dmedia/audio.h dmedia/cdaudio.h dpmi.h \ direct.h dirent.h dlfcn.h dpmi.h \
dsound.h errno.h fcntl.h fnmatch.h ggi/ggi.h glide/sst1vid.h io.h \ dsound.h errno.h fcntl.h glide/sst1vid.h io.h \
libc.h limits.h linux/cdrom.h linux/joystick.h linux/soundcard.h \ libc.h limits.h linux/cdrom.h linux/joystick.h linux/soundcard.h \
machine/soundcard.h malloc.h math.h mgraph.h _mingw.h netdb.h \ machine/soundcard.h malloc.h math.h mgraph.h mme/mmsystem.h \
netinet/in.h pwd.h setjmp.h signal.h stdarg.h stdio.h stdlib.h \ mme/mme_public.h _mingw.h netdb.h \
string.h strings.h sys/asoundlib.h sys/audioio.h sys/filio.h \ netinet/in.h pwd.h rpc/types.h setjmp.h signal.h stdarg.h stdio.h \
stdlib.h string.h strings.h sys/asoundlib.h sys/audioio.h sys/filio.h \
sys/ioctl.h sys/io.h sys/ipc.h sys/mman.h sys/param.h sys/poll.h \ sys/ioctl.h sys/io.h sys/ipc.h sys/mman.h sys/param.h sys/poll.h \
sys/shm.h sys/signal.h sys/socket.h sys/soundcard.h sys/stat.h \ sys/shm.h sys/signal.h sys/socket.h sys/soundcard.h sys/stat.h \
sys/time.h sys/types.h sys/wait.h time.h unistd.h vga.h \ sys/time.h sys/types.h sys/wait.h time.h unistd.h \
vgakeyboard.h vgamouse.h windows.h winsock.h zlib.h vgakeyboard.h vgamouse.h windows.h winsock.h zlib.h
) )
if test "x$mingw" = xyes; then if test "x$mingw" = xyes; then
AC_MSG_CHECKING(for fnmatch.h) AC_MSG_CHECKING(for fnmatch.h)
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_FNMATCH_H) AC_DEFINE(HAVE_FNMATCH_H, 1, [Define this if you have fnmatch.h])
else else
AC_CHECK_HEADERS(fnmatch.h) AC_CHECK_HEADERS(fnmatch.h)
fi fi
@ -128,8 +120,8 @@ AC_STRUCT_TM
if test "x$cross_compiling" = xyes; then if test "x$cross_compiling" = xyes; then
AC_MSG_CHECKING(whether byte ordering is bigendian) AC_MSG_CHECKING(whether byte ordering is bigendian)
AC_ARG_WITH(endian, AC_ARG_WITH(endian,
[ --with-endian=TYPE set endian of target system for [ --with-endian=TYPE set endian of target system for
cross-compiling. TYPE = little or big.], cross-compiling. TYPE = little or big.],
endian="$withval", endian="$withval",
) )
case "x$endian" in case "x$endian" in
@ -153,11 +145,13 @@ else
AC_C_BIGENDIAN AC_C_BIGENDIAN
fi fi
AC_CHECK_FUNCS(usleep)
AC_MSG_CHECKING(that fnmatch is in fnmatch.h) AC_MSG_CHECKING(that fnmatch is in fnmatch.h)
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include "fnmatch.h"], [#include "fnmatch.h"],
[int (*foo)() = fnmatch;], [int (*foo)() = fnmatch;],
AC_DEFINE(HAVE_FNMATCH_PROTO) AC_DEFINE(HAVE_FNMATCH_PROTO, 1, [Define this if fnmatch is prototyped in fnmatch.h])
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -166,7 +160,7 @@ AC_MSG_CHECKING(for socklen_t in sys/types.h)
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include <sys/types.h>], [#include <sys/types.h>],
[ socklen_t x = 0;], [ socklen_t x = 0;],
AC_DEFINE(HAVE_SOCKLEN_T) AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define this if your system has socklen_t])
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
dnl FreeBSD 4.0 has it in sys/socket.h dnl FreeBSD 4.0 has it in sys/socket.h
@ -175,7 +169,7 @@ AC_TRY_COMPILE(
[#include <sys/types.h> [#include <sys/types.h>
#include <sys/socket.h>], #include <sys/socket.h>],
[ socklen_t x = 0;], [ socklen_t x = 0;],
AC_DEFINE(HAVE_SOCKLEN_T) AC_MSG_RESULT(yes), AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define this if your system has socklen_t]) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
) )
@ -185,7 +179,7 @@ AC_TRY_LINK(
[asm(".long _bar"); [asm(".long _bar");
int bar;], int bar;],
[], [],
AC_DEFINE(HAVE_SYM_PREFIX_UNDERSCORE) AC_MSG_RESULT(yes), AC_DEFINE(HAVE_SYM_PREFIX_UNDERSCORE, 1, [Define this if C symbols are prefixed with an underscore]) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -193,7 +187,7 @@ AC_MSG_CHECKING(for size_t in sys/types.h)
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include <sys/types.h>], [#include <sys/types.h>],
[ size_t x = 0;], [ size_t x = 0;],
AC_DEFINE(HAVE_SIZE_T) AC_MSG_RESULT(yes), AC_DEFINE(HAVE_SIZE_T, 1, [Define this if your system has size_t]) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -203,7 +197,7 @@ AC_TRY_COMPILE(
[#include <sys/types.h> [#include <sys/types.h>
#include <sys/socket.h>], #include <sys/socket.h>],
[ void f(void) { struct sockaddr_storage ss; ss.ss_len=0; }], [ void f(void) { struct sockaddr_storage ss; ss.ss_len=0; }],
AC_DEFINE(HAVE_SS_LEN) AC_MSG_RESULT(yes), AC_DEFINE(HAVE_SS_LEN, 1, [Define this if you have ss_len member in struct sockaddr_storage (BSD)]) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -212,7 +206,7 @@ AC_TRY_COMPILE(
[#include <sys/types.h> [#include <sys/types.h>
#include <netinet/in.h>], #include <netinet/in.h>],
[ void f(void) { struct sockaddr_in6 s6; s6.sin6_len=0; }], [ void f(void) { struct sockaddr_in6 s6; s6.sin6_len=0; }],
AC_DEFINE(HAVE_SIN6_LEN) AC_MSG_RESULT(yes), AC_DEFINE(HAVE_SIN6_LEN, 1, [Define this if you have sin6_len member in struct sockaddr_in6 (BSD)]) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -221,7 +215,7 @@ AC_TRY_COMPILE(
[#include <sys/types.h> [#include <sys/types.h>
#include <netinet/in.h>], #include <netinet/in.h>],
[ void f(void) { struct sockaddr sa; sa.sa_len=0; }], [ void f(void) { struct sockaddr sa; sa.sa_len=0; }],
AC_DEFINE(HAVE_SA_LEN) AC_MSG_RESULT(yes), AC_DEFINE(HAVE_SA_LEN, 1, [Define this if you have sa_len member in struct sockaddr (BSD)]) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -229,12 +223,12 @@ AC_MSG_CHECKING(for zero length array syntax)
AC_TRY_COMPILE( AC_TRY_COMPILE(
[], [],
[struct { int foo; int bar[0]; } foo;], [struct { int foo; int bar[0]; } foo;],
AC_DEFINE(ZERO_LENGTH_ARRAY,0) AC_MSG_RESULT([0]), AC_DEFINE(ZERO_LENGTH_ARRAY,0,[zero lenth arrays]) AC_MSG_RESULT([0]),
AC_TRY_COMPILE( AC_TRY_COMPILE(
[], [],
[struct { int foo; int bar[]; } foo;], [struct { int foo; int bar[]; } foo;],
AC_DEFINE(ZERO_LENGTH_ARRAY,) AC_MSG_RESULT([]), AC_DEFINE(ZERO_LENGTH_ARRAY,) AC_MSG_RESULT([]),
AC_DEFINE(ZERO_LENGTH_ARRAY,1) AC_MSG_RESULT([1] sorry about the waste) AC_DEFINE(ZERO_LENGTH_ARRAY,1,[zero lenth arrays]) AC_MSG_RESULT([1] sorry about the waste)
) )
) )
@ -248,34 +242,47 @@ AC_FUNC_MMAP
AC_TYPE_SIGNAL AC_TYPE_SIGNAL
AC_FUNC_VPRINTF AC_FUNC_VPRINTF
AC_CHECK_FUNCS( AC_CHECK_FUNCS(
gethostname gethostbyname connect gettimeofday getwd mkdir \ access _access \
ftime _ftime fcntl stat putenv select socket strerror strstr \ connect dlopen fcntl ftime getaddrinfo gethostname gethostbyname \
snprintf _snprintf vsnprintf _vsnprintf strsep dlopen getaddrinfo \ getnameinfo gettimeofday mkdir _mkdir select socket stat strerror \
getnameinfo strstr snprintf vsnprintf _snprintf _vsnprintf mprotect
)
dnl Checks for stricmp/strcasecmp
#AC_CHECK_FUNC(strcasecmp,,
# AC_CHECK_FUNC(stricmp,
# AC_DEFINE(strcasecmp, stricmp),
# AC_MSG_ERROR([Neither stricmp nor strcasecmp found])
# )
#)
AC_CHECK_FUNC(strcasecmp, strcasecmp=yes, strcasecmp=no)
if test $strcasecmp = no; then
AC_CHECK_FUNC(stricmp,
AC_DEFINE(strcasecmp, stricmp, [Define strcasecmp as stricmp if you have one but not the other]),
AC_MSG_ERROR([Neither stricmp nor strcasecmp found])
)
fi
dnl Checks for working -lm
AC_CHECK_LIB(m, pow,,
AC_MSG_ERROR([math library (-lm) appears broken])
) )
DL_LIBS="" DL_LIBS=""
if test "x$ac_cv_func_dlopen" != "xyes"; then if test "x$ac_cv_func_dlopen" != "xyes"; then
AC_CHECK_LIB(dl, dlopen, AC_CHECK_LIB(dl, dlopen,
AC_DEFINE(HAVE_DLOPEN) DL_LIBS="-ldl" AC_DEFINE(HAVE_DLOPEN, 1, [Define if you have the dlopen function.]) DL_LIBS="-ldl"
) )
fi fi
AC_SUBST(DL_LIBS) AC_SUBST(DL_LIBS)
dnl Checks for stricmp/strcasecmp
AC_CHECK_FUNC(stricmp,,
AC_CHECK_FUNC(strcasecmp, AC_DEFINE(stricmp,strcasecmp)))
dnl Check for vsnprintf dnl Check for vsnprintf
if test "x$ac_cv_func_vsnprintf" = "xno" -a \ if test "x$ac_cv_func_vsnprintf" = "xno" -a \
"x$ac_cv_func__vsnprintf" = "xno"; then "x$ac_cv_func__vsnprintf" = "xno"; then
dnl libdb may have this dnl libdb may have this
AC_CHECK_LIB(db,vsnprintf) AC_CHECK_LIB(db, vsnprintf)
fi fi
dnl Checks for working -lm
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
AC_ARG_ENABLE(zlib, AC_ARG_ENABLE(zlib,
[ --disable-zlib disable zlib support], [ --disable-zlib disable zlib support],
) )
@ -290,7 +297,7 @@ if test "x$enable_zlib" != "xno"; then
AC_CHECK_HEADER(zlib.h, HAVE_ZLIB=yes, HAVE_ZLIB=no) AC_CHECK_HEADER(zlib.h, HAVE_ZLIB=yes, HAVE_ZLIB=no)
if test "x$HAVE_ZLIB" = "xyes"; then if test "x$HAVE_ZLIB" = "xyes"; then
Z_LIBS="-lz" Z_LIBS="-lz"
AC_DEFINE(HAVE_ZLIB) AC_DEFINE(HAVE_ZLIB, 1, [Define if you have zlib])
fi fi
fi fi
fi fi
@ -303,7 +310,7 @@ AC_ARG_WITH(ipv6,
if test "x$withval" = xno ; then if test "x$withval" = xno ; then
NETTYPE_IPV6=no NETTYPE_IPV6=no
else else
AC_DEFINE(HAVE_IPV6) AC_DEFINE(HAVE_IPV6, 1, [Define this if you want IPv6 support])
NETTYPE_IPV6=yes NETTYPE_IPV6=yes
if test "x$withval" != xyes ; then if test "x$withval" != xyes ; then
LIBS="$LIBS -L${withval}" LIBS="$LIBS -L${withval}"
@ -389,7 +396,7 @@ AC_SUBST(GGI_LIBS)
dnl Checks for Linux FBDev support dnl Checks for Linux FBDev support
AC_ARG_WITH(fbdev, AC_ARG_WITH(fbdev,
[ --with-fbdev use Linux framebuffer device], [ --with-fbdev use Linux framebuffer device],
HAVE_FBDEV=$withval, HAVE_FBDEV=auto) HAVE_FBDEV=$withval, HAVE_FBDEV=no)
if test "x$HAVE_FBDEV" != xno; then if test "x$HAVE_FBDEV" != xno; then
dnl We should still be able to compile it even if dnl We should still be able to compile it even if
dnl there is no fbdev support in the running kernel dnl there is no fbdev support in the running kernel
@ -401,7 +408,7 @@ if test "x$HAVE_FBDEV" = xyes; then
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include "linux/fb.h"], [#include "linux/fb.h"],
[int foo = FB_AUX_VGA_PLANES_VGA4;], [int foo = FB_AUX_VGA_PLANES_VGA4;],
AC_DEFINE(HAVE_FB_AUX_VGA_PLANES_VGA4) AC_DEFINE(HAVE_FB_AUX_VGA_PLANES_VGA4, 1, [Define this if you have FB_AUX_VGA_PLANES_VGA4])
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -409,7 +416,7 @@ if test "x$HAVE_FBDEV" = xyes; then
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include "linux/fb.h"], [#include "linux/fb.h"],
[int foo = FB_AUX_VGA_PLANES_CFB4;], [int foo = FB_AUX_VGA_PLANES_CFB4;],
AC_DEFINE(HAVE_FB_AUX_VGA_PLANES_CFB4) AC_DEFINE(HAVE_FB_AUX_VGA_PLANES_CFB4, 1, [Define this if you have HAVE_FB_AUX_VGA_PLANES_CFB4])
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -417,7 +424,7 @@ if test "x$HAVE_FBDEV" = xyes; then
AC_TRY_COMPILE( AC_TRY_COMPILE(
[#include "linux/fb.h"], [#include "linux/fb.h"],
[int foo = FB_AUX_VGA_PLANES_CFB8;], [int foo = FB_AUX_VGA_PLANES_CFB8;],
AC_DEFINE(HAVE_FB_AUX_VGA_PLANES_CFB8) AC_DEFINE(HAVE_FB_AUX_VGA_PLANES_CFB8, 1, [Define this if you have HAVE_FB_AUX_VGA_PLANES_CFB8])
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -454,16 +461,18 @@ AC_SUBST(SVGA_CFLAGS)
AC_SUBST(SVGA_LIBS) AC_SUBST(SVGA_LIBS)
dnl Checks for X11 and XShm dnl Checks for X11 and XShm
AC_PATH_XTRA if test "x$mingw" != xyes; then
if test "x$no_x" = x; then AC_PATH_XTRA
HAVE_X=yes if test "x$no_x" = x; then
AC_CHECK_LIB(Xext, XShmQueryExtension, HAVE_X=yes
X_SHM_LIB=-lXext, AC_CHECK_LIB(Xext, XShmQueryExtension,
HAVE_X=no, X_SHM_LIB=-lXext,
[ $X_LIBS -lX11 $X_EXTRA_LIBS ] HAVE_X=no,
) [ $X_LIBS -lX11 $X_EXTRA_LIBS ]
)
fi
AC_SUBST(X_SHM_LIB)
fi fi
AC_SUBST(X_SHM_LIB)
dnl Check for XFree86-VidMode support dnl Check for XFree86-VidMode support
AC_ARG_ENABLE(vidmode, AC_ARG_ENABLE(vidmode,
@ -475,7 +484,7 @@ if test "x$HAVE_VIDMODE" != xno; then
AC_CHECK_HEADER(X11/extensions/xf86vmode.h, AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
dnl Make sure the library works dnl Make sure the library works
AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchToMode, AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchToMode,
AC_DEFINE(HAVE_VIDMODE) AC_DEFINE(HAVE_VIDMODEi, 1, [Define if you have the XFree86 VIDMODE extension])
VIDMODE_LIBS="-lXxf86vm",, VIDMODE_LIBS="-lXxf86vm",,
[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS] [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]
) )
@ -494,7 +503,7 @@ if test "x$HAVE_DGA" != xno; then
AC_CHECK_HEADER(X11/extensions/xf86dga.h, AC_CHECK_HEADER(X11/extensions/xf86dga.h,
dnl Make sure the library works dnl Make sure the library works
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryVersion, AC_CHECK_LIB(Xxf86dga, XF86DGAQueryVersion,
AC_DEFINE(HAVE_DGA) AC_DEFINE(HAVE_DGA, 1, [Define if you have the XFree86 DGA extension])
DGA_LIBS="-lXxf86dga",, DGA_LIBS="-lXxf86dga",,
[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS] [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]
) )
@ -520,7 +529,7 @@ if test "x$HAS_GLIDE" != xno; then
if test "x$HAS_GLIDE" != xyes; then if test "x$HAS_GLIDE" != xyes; then
HAS_GLIDE=no HAS_GLIDE=no
else else
AC_DEFINE(HAVE_GLIDE) AC_DEFINE(HAVE_GLIDE, 1, [Define if you have the glide stuff])
fi fi
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
fi fi
@ -566,26 +575,33 @@ if test "x$HAVE_GLX" != xno; then
AC_MSG_CHECKING(for GL_COLOR_INDEX8_EXT in GL/gl.h) AC_MSG_CHECKING(for GL_COLOR_INDEX8_EXT in GL/gl.h)
AC_TRY_COMPILE([#include "GL/gl.h"], AC_TRY_COMPILE([#include "GL/gl.h"],
[ int x = (int) GL_COLOR_INDEX8_EXT;], [ int x = (int) GL_COLOR_INDEX8_EXT;],
AC_DEFINE(HAVE_GL_COLOR_INDEX8_EXT) AC_MSG_RESULT(yes), AC_DEFINE(HAVE_GL_COLOR_INDEX8_EXT, 1, [Define if you have HAVE_GL_COLOR_INDEX8_EXT]) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
AC_CHECK_HEADERS(GL/glext.h, HAVE_GL_GLEXT_H=yes) AC_CHECK_HEADERS(GL/glext.h, HAVE_GL_GLEXT_H=yes)
fi fi
CPPFLAGS="$save_CPPFLAGS" CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lGL or -lMesaGL works dnl Make sure -lGL or -lMesaGL or -lopengl32 works
if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then
if test "x$HAVE_GLX" = xyes; then if test "x$HAVE_GLX" = xyes; then
HAVE_GLX=no HAVE_GLX=no
AC_CHECK_LIB(GL, glColor4f, AC_CHECK_LIB(GL, glColor4f,
HAVE_GLX=yes HAVE_GLX=yes
OGL_NAME=GL,, OGL_NAME=GL,,
[ -L$glx_libraries ] [ -L$glx_libraries -lX11 $X_EXTRA_LIBS ]
) )
if test "x$HAVE_GLX" != xyes; then if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(MesaGL, glColor4f, AC_CHECK_LIB(MesaGL, glColor4f,
HAVE_GLX=yes HAVE_GLX=yes
OGL_NAME=MesaGL,, OGL_NAME=MesaGL,,
[ -L$glx_libraries -lX11 $X_EXTRA_LIBS ]
)
fi
if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(opengl32, glColor4f,
HAVE_GLX=yes
OGL_NAME=opengl32,,
[ -L$glx_libraries ] [ -L$glx_libraries ]
) )
fi fi
@ -611,6 +627,20 @@ else
[ $X_LIBS ] [ $X_LIBS ]
) )
fi fi
if test "x$HAVE_GLX" != xyes; then
LIBS_save="$LIBS"
LIBS="$LIBS -lopengl32"
AC_MSG_CHECKING(for glColor4f in -lopengl32)
AC_TRY_LINK(
[#include <GL/gl.h>],
[glColor4f(0,0,0,0);],
HAVE_GLX=yes
OGL_NAME=opengl32
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
LIBS="$LIBS_save"
fi
fi fi
fi fi
@ -618,7 +648,7 @@ if test "x$HAVE_GLX" = xyes; then
test "x$GLX_CFLAGS" != x && GLX_CFLAGS="-I$GLX_CFLAGS" test "x$GLX_CFLAGS" != x && GLX_CFLAGS="-I$GLX_CFLAGS"
test "x$glx_libraries" != x && GLX_LIBS="-L$glx_libraries" test "x$glx_libraries" != x && GLX_LIBS="-L$glx_libraries"
GLX_LIBS="$GLX_LIBS -l$OGL_NAME" GLX_LIBS="$GLX_LIBS -l$OGL_NAME"
AC_DEFINE(HAVE_GLX) AC_DEFINE(HAVE_GLX, 1, [Define if you have GL/X11 stuff])
else else
GLX_CFLAGS="" GLX_CFLAGS=""
GLX_LIBS="" GLX_LIBS=""
@ -626,14 +656,20 @@ fi
AC_SUBST(GLX_CFLAGS) AC_SUBST(GLX_CFLAGS)
AC_SUBST(GLX_LIBS) AC_SUBST(GLX_LIBS)
dnl SDL/SDL-GL checks AC_ARG_ENABLE(sdl,
AM_PATH_SDL(1.0.1, HAVE_SDL=yes, HAVE_SDL=no) [ --disable-sdl disable checking for SDL],
)
if test "x$HAVE_SDL" != xno; then if test "x$enable_sdl" != xno; then
AM_CHECK_SGL(1.1.1, HAVE_SGL=yes, HAVE_SGL=no) dnl SDL/SDL-GL checks
AM_PATH_SDL(1.0.1, HAVE_SDL=yes, HAVE_SDL=no)
if test "x$HAVE_SDL" != xno; then
AM_CHECK_SGL(1.1.1, HAVE_SGL=yes, HAVE_SGL=no)
fi
AC_SUBST(HAVE_SDL)
AC_SUBST(HAVE_SGL)
fi fi
AC_SUBST(HAVE_SDL)
AC_SUBST(HAVE_SGL)
# 3Dfx stuff.. # 3Dfx stuff..
@ -702,7 +738,7 @@ case "${host}" in
AC_ARG_ENABLE(asmopt, AC_ARG_ENABLE(asmopt,
[ --disable-asmopt disable assembler optimization], [ --disable-asmopt disable assembler optimization],
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_DEFINE(USE_INTEL_ASM) AC_DEFINE(USE_INTEL_ASM, 1, [Define this if you want to use Intel assembly optimizations])
ASM_ARCH=yes ASM_ARCH=yes
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
) )
@ -718,7 +754,7 @@ dnl ==================================================================
AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes) AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes)
AC_ARG_ENABLE(alsa, AC_ARG_ENABLE(alsa,
[ --disable-alsa disable alsa support], [ --disable-alsa disable alsa support],
) )
SNDTYPE="" SNDTYPE=""
@ -752,12 +788,12 @@ QF_maGiC_VALUE
[ [
#include <sys/asoundlib.h> #include <sys/asoundlib.h>
#if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR) #if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR)
#if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR>=6) #if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR>=9)
QF_maGiC_VALUE QF_maGiC_VALUE
#endif #endif
#endif #endif
], ],
SNDTYPE="ALSA_0_6" SNDTYPE="ALSA_0_9"
SOUND_LIBS="-lasound" SOUND_LIBS="-lasound"
) )
) )
@ -828,7 +864,7 @@ fi
dnl Win32 dnl Win32
if test -z "$SNDTYPE" -a "x$ac_cv_header_windows_h" = "xyes" -a \ if test -z "$SNDTYPE" -a "x$ac_cv_header_windows_h" = "xyes" -a \
"x$ac_cv_header_mmsystem_h" = "xyes"; then "x$ac_cv_header_dsound_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[ AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <windows.h> #include <windows.h>
#include <mmsystem.h> #include <mmsystem.h>
@ -850,14 +886,14 @@ AC_SUBST(SOUND_LIBS)
AC_SUBST(SOUND_CFLAGS) AC_SUBST(SOUND_CFLAGS)
AM_CONDITIONAL(SNDTYPE_ALSA_0_5, test "$SNDTYPE" = "ALSA_0_5") AM_CONDITIONAL(SNDTYPE_ALSA_0_5, test "$SNDTYPE" = "ALSA_0_5")
AM_CONDITIONAL(SNDTYPE_ALSA_0_6, test "$SNDTYPE" = "ALSA_0_6") AM_CONDITIONAL(SNDTYPE_ALSA_0_9, test "$SNDTYPE" = "ALSA_0_9")
AM_CONDITIONAL(SNDTYPE_MME, test "$SNDTYPE" = "MME") AM_CONDITIONAL(SNDTYPE_MME, test "$SNDTYPE" = "MME")
AM_CONDITIONAL(SNDTYPE_OSS, test "$SNDTYPE" = "OSS") AM_CONDITIONAL(SNDTYPE_OSS, test "$SNDTYPE" = "OSS")
AM_CONDITIONAL(SNDTYPE_SDL, test "$SNDTYPE" = "SDL") AM_CONDITIONAL(SNDTYPE_SDL, test "$SNDTYPE" = "SDL")
AM_CONDITIONAL(SNDTYPE_SGI, test "$SNDTYPE" = "SGI") AM_CONDITIONAL(SNDTYPE_SGI, test "$SNDTYPE" = "SGI")
AM_CONDITIONAL(SNDTYPE_SUN, test "$SNDTYPE" = "SUN") AM_CONDITIONAL(SNDTYPE_SUN, test "$SNDTYPE" = "SUN")
AM_CONDITIONAL(SNDTYPE_WIN32, test "$SNDTYPE" = "WIN32") AM_CONDITIONAL(SNDTYPE_WIN32, test "$SNDTYPE" = "WIN32")
AM_CONDITIONAL(SNDTYPE_NULL, test "$SNDTYPE" != "ALSA_0_5" -a "$SNDTYPE" != "ALSA_0_6" -a "$SNDTYPE" != "MME" -a "$SNDTYPE" != "OSS" -a "$SNDTYPE" != "SDL" -a "$SNDTYPE" != "SGI" -a "$SNDTYPE" != "SUN" -a "$SNDTYPE" != "WIN32") AM_CONDITIONAL(SNDTYPE_NULL, test "$SNDTYPE" != "ALSA_0_5" -a "$SNDTYPE" != "ALSA_0_9" -a "$SNDTYPE" != "MME" -a "$SNDTYPE" != "OSS" -a "$SNDTYPE" != "SDL" -a "$SNDTYPE" != "SGI" -a "$SNDTYPE" != "SUN" -a "$SNDTYPE" != "WIN32")
dnl Tests for joystick support dnl Tests for joystick support
AC_MSG_CHECKING(for joystick support) AC_MSG_CHECKING(for joystick support)
@ -932,11 +968,11 @@ QF_maGiC_VALUE
CD_LIBS="-lcdaudio -lmediad -lds" CD_LIBS="-lcdaudio -lmediad -lds"
) )
fi fi
if test -z "$CDTYPE"; then if test -z "$CDTYPE"; then
AC_EGREP_CPP([QF_maGIC_VALUE], AC_EGREP_CPP([QF_maGiC_VALUE],
[ [
#include <windows.h> #include <windows.h>
#include <mmsystem.h>
#if defined(MCI_SET_DOOR_OPEN) #if defined(MCI_SET_DOOR_OPEN)
QF_maGiC_VALUE QF_maGiC_VALUE
#endif #endif
@ -962,15 +998,16 @@ dnl ==================================================================
if test "x$ac_cv_func_connect" != "xyes"; then if test "x$ac_cv_func_connect" != "xyes"; then
AC_CHECK_LIB(socket, connect, AC_CHECK_LIB(socket, connect,
NET_LIBS="$NET_LIBS -lsocket" NET_LIBS="$NET_LIBS -lsocket"
ac_cv_func_connect=yes ac_cv_func_connect=yes
) )
fi fi
if test "x$ac_cv_func_gethostbyname" != "xyes"; then if test "x$ac_cv_func_gethostbyname" != "xyes"; then
AC_CHECK_LIB(nsl, gethostbyname, AC_CHECK_LIB(nsl, gethostbyname,
NET_LIBS="$NET_LIBS -lnsl" NET_LIBS="$NET_LIBS -lnsl"
ac_cv_func_gethostbyname=yes ac_cv_func_gethostbyname=yes
) )
fi fi
AC_MSG_CHECKING([for connect in -lwsock32]) AC_MSG_CHECKING([for connect in -lwsock32])
@ -979,7 +1016,7 @@ LIBS="$LIBS -lwsock32"
AC_TRY_LINK([ AC_TRY_LINK([
#include <winsock.h> #include <winsock.h>
],[ ],[
connect(0, NULL, 42); connect (0, NULL, 42);
], ],
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm" NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
ac_cv_func_connect=yes ac_cv_func_connect=yes
@ -997,22 +1034,6 @@ if test "x$ac_cv_func_connect" = "xyes" -a "x$ac_cv_func_gethostbyname" = "xyes"
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
if test "x$ac_cv_func_connect" != "xyes"; then
AC_MSG_CHECKING([for connect in -lwsock32])
SAVELIBS="$LIBS"
LIBS="$LIBS -lwsock32"
AC_TRY_LINK([
#include <winsock.h>
],[
connect(0, NULL, 42);
],
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
LIBS="$SAVELIBS"
fi
AC_SUBST(NET_LIBS) AC_SUBST(NET_LIBS)
@ -1024,37 +1045,17 @@ dnl Set $prefix and $exec_prefix to $ac_default_prefix if they are not set
test "x$prefix" = xNONE && prefix=$ac_default_prefix test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
AC_ARG_WITH(newstyle, if test "x$SYSTYPE" = xWIN32; then
[ --with-newstyle compile with default search directories changed. default_globalconf="~/${PACKAGE}.conf"
id1 and qw become base, and rather than looking in default_userconf="~/${PACKAGE}rc"
. QuakeForge will look in ~/.quakeforge/ and default_sharepath="."
\$datadir/games/quakeforge], default_userpath="."
newstyle=$withval, newstyle=auto else
) default_globalconf="/etc/${PACKAGE}.conf"
AC_MSG_CHECKING([configuration style])
if test "x$newstyle" = xyes -o "x$newstyle" = "x"; then
AC_MSG_RESULT([new style])
AC_DEFINE(NEWSTYLE)
AC_DEFINE(BASEGAME, "base")
AC_DEFINE(SKINBASE, "base")
default_globalconf="/etc/$PACKAGE.conf"
default_userconf="~/.${PACKAGE}rc" default_userconf="~/.${PACKAGE}rc"
eval foo="$datadir" eval foo="$datadir"
default_sharepath="$foo/games/$PACKAGE" default_sharepath="$foo/games/$PACKAGE"
default_userpath="~/.$PACKAGE" default_userpath="~/.$PACKAGE"
else
AC_MSG_RESULT([old style (id Software defaults)])
AC_DEFINE(BASEGAME, "id1")
AC_DEFINE(SKINBASE, "qw")
if test "x$SYSTYPE" = xWIN32; then
default_globalconf="%WINDIR%/$PACKAGE.conf"
default_userconf=""
else
default_globalconf="/etc/$PACKAGE.conf"
default_userconf=""
fi
default_sharepath="."
default_userpath="."
fi fi
AC_ARG_WITH(global-cfg, AC_ARG_WITH(global-cfg,
@ -1066,18 +1067,18 @@ if test "x$globalconf" = "xauto" || test "x$globalconf" = "xyes" || \
test "x$globalconf" = "xno"; then dnl yes/no sanity checks test "x$globalconf" = "xno"; then dnl yes/no sanity checks
globalconf="$default_globalconf" globalconf="$default_globalconf"
fi fi
AC_DEFINE_UNQUOTED(FS_GLOBALCFG, "$globalconf") AC_DEFINE_UNQUOTED(FS_GLOBALCFG, "$globalconf", [Define this to the location of the global config file])
AC_ARG_WITH(user-cfg, AC_ARG_WITH(user-cfg,
[ --with-user-cfg=FILE If set will change the name and location of the [ --with-user-cfg=FILE If set will change the name and location of the
global config file used by QuakeForge. Defaults to (read-only) user config file. Defaults to
/etc/quakeforge.conf.], ~/.quakeforgerc],
globalconf="$withval", userconf="auto") userconf="$withval", userconf="auto")
if test "x$userconf" = "xauto" || test "x$userconf" = "xyes" || \ if test "x$userconf" = "xauto" || test "x$userconf" = "xyes" || \
test "x$userconf" = "xno"; then dnl yes/no sanity checks test "x$userconf" = "xno"; then dnl yes/no sanity checks
userconf="$default_userconf" userconf="$default_userconf"
fi fi
AC_DEFINE_UNQUOTED(FS_USERCFG, "$userconf") AC_DEFINE_UNQUOTED(FS_USERCFG, "$userconf", [Define this to the location of the user config file])
AC_ARG_WITH(sharepath, AC_ARG_WITH(sharepath,
[ --with-sharepath=DIR Use DIR for shared game data, defaults to [ --with-sharepath=DIR Use DIR for shared game data, defaults to
@ -1088,7 +1089,7 @@ if test "x$sharepath" = "xauto" -o "x$sharepath" = "xyes" -o "x$sharepath" = "x"
elif test "x$sharepath" = xno; then elif test "x$sharepath" = xno; then
sharepath="." sharepath="."
fi fi
AC_DEFINE_UNQUOTED(FS_SHAREPATH, "$sharepath") AC_DEFINE_UNQUOTED(FS_SHAREPATH, "$sharepath", [Define this to the shared game directory root])
AC_ARG_WITH(userpath, AC_ARG_WITH(userpath,
[ --with-userpath=DIR Use DIR for unshared game data, defaults to [ --with-userpath=DIR Use DIR for unshared game data, defaults to
@ -1099,7 +1100,7 @@ if test "x$userpath" = "xauto" -o "x$userpath" = "xyes" -o "x$userpath" = "x"; t
elif test "x$userpath" = xno; then elif test "x$userpath" = xno; then
userpath="." userpath="."
fi fi
AC_DEFINE_UNQUOTED(FS_USERPATH, "$userpath") AC_DEFINE_UNQUOTED(FS_USERPATH, "$userpath", [Define this to the unshared game directory root])
dnl CFLAGS for release and devel versions dnl CFLAGS for release and devel versions
CFLAGS="" CFLAGS=""
@ -1107,6 +1108,7 @@ AC_ARG_ENABLE(debug,
[ --enable-debug compile with debugging (for development)], [ --enable-debug compile with debugging (for development)],
debug=$enable_debug debug=$enable_debug
) )
AC_MSG_CHECKING(for debugging) AC_MSG_CHECKING(for debugging)
if test "x$debug" = xyes; then if test "x$debug" = xyes; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
@ -1126,6 +1128,7 @@ AC_ARG_ENABLE(optimize,
optimize=$disable_optimize, optimize=$disable_optimize,
optimize=yes optimize=yes
) )
AC_ARG_WITH(amd, AC_ARG_WITH(amd,
[ --with-amd Optimize for AMD processors instead of Intel], [ --with-amd Optimize for AMD processors instead of Intel],
HAVE_AMD="yes", HAVE_AMD="yes",
@ -1136,14 +1139,14 @@ if test "x$optimize" = xyes; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
BUILD_TYPE="$BUILD_TYPE Optimize" BUILD_TYPE="$BUILD_TYPE Optimize"
if test "x$GCC" = xyes; then if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations" CFLAGS="$CFLAGS -O3 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations"
AC_MSG_CHECKING(for special compiler settings) AC_MSG_CHECKING(for special compiler settings)
case "${host_cpu}" in case "${host_cpu}" in
i?86) i?86)
if test "x$HAVE_AMD" = "xyes"; then if test "x$HAVE_AMD" = "xyes"; then
MORE_CFLAGS="-march=k6 -malign-loops=2 -malign-jumps=2 -malign-functions=2" MORE_CFLAGS="-march=k6"
else else
MORE_CFLAGS="-march=${host_cpu} -malign-loops=2 -malign-jumps=2 -malign-functions=2" MORE_CFLAGS="-march=${host_cpu}"
fi fi
;; ;;
*) *)
@ -1167,7 +1170,7 @@ fi
AC_MSG_CHECKING(for packet logging) AC_MSG_CHECKING(for packet logging)
if test "x$packetlog" = xyes; then if test "x$packetlog" = xyes; then
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(PACKET_LOGGING) AC_DEFINE(PACKET_LOGGING, 1, [Define this if you want packet logging])
else else
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
@ -1189,6 +1192,21 @@ if test "x$profile" = xyes; then
fi fi
fi fi
dnl Some GCCs can't deal with our current code -- we're working on it, but
dnl this fixes it up for now
if test "x$GCC" = xyes; then
AC_MSG_CHECKING(whether -fno-strict-aliasing works)
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fno-strict-aliasing"
AC_TRY_COMPILE(
[],
[],
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
CFLAGS="$saved_CFLAGS"
)
fi
check_pipe=no check_pipe=no
if test "x$GCC" = xyes; then if test "x$GCC" = xyes; then
dnl Check for -pipe vs -save-temps. dnl Check for -pipe vs -save-temps.
@ -1202,18 +1220,13 @@ if test "x$check_pipe" = xyes; then
AC_MSG_CHECKING(whether -pipe works) AC_MSG_CHECKING(whether -pipe works)
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -pipe" CFLAGS="$CFLAGS -pipe"
pipe_ok=no
AC_TRY_COMPILE( AC_TRY_COMPILE(
[], [],
[], [],
pipe_ok=yes
AC_MSG_RESULT(yes), AC_MSG_RESULT(yes),
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
CFLAGS="$save_CFLAGS"
) )
CFLAGS="$save_CFLAGS"
if test "x$pipe_ok" = xyes; then
CFLAGS="$CFLAGS -pipe"
fi
fi fi
dnl QuakeForge uses lots of BCPL-style (//) comments, which can cause problems dnl QuakeForge uses lots of BCPL-style (//) comments, which can cause problems
@ -1242,12 +1255,23 @@ if test "x$GCC" != xyes; then
esac esac
fi fi
dnl We want warnings, lots of warnings... dnl We want warnings, lots of warnings...except when this is a release
if test "x$GCC" = xyes; then if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -Wall -Werror" CFLAGS="$CFLAGS -Wall"
# CFLAGS="$CFLAGS -Wall -pedantic" if test -d $srcdir/CVS; then
CFLAGS="$CFLAGS -Werror"
fi
fi fi
AS="$CC"
ASFLAGS="\$(DEFS) \$(DEFAULT_INCLUDES) \$(INCLUDES)"
CCASFLAGS="$ASFLAGS"
CCAS="$AS"
AC_SUBST(AS)
AC_SUBST(ASFLAGS)
AC_SUBST(CCAS)
AC_SUBST(CCASFLAGS)
dnl ================================================================== dnl ==================================================================
dnl Make sure we link against a working zlib dnl Make sure we link against a working zlib
dnl ================================================================== dnl ==================================================================
@ -1304,6 +1328,7 @@ if test "$clients" = "all"; then
ENABLE_SDL=yes ENABLE_SDL=yes
ENABLE_SGL=yes ENABLE_SGL=yes
ENABLE_SVGA=yes ENABLE_SVGA=yes
ENABLE_WGL=yes
ENABLE_X11=yes ENABLE_X11=yes
else else
ENABLE_3DFX=no ENABLE_3DFX=no
@ -1314,6 +1339,7 @@ else
ENABLE_SDL=no ENABLE_SDL=no
ENABLE_SGL=no ENABLE_SGL=no
ENABLE_SVGA=no ENABLE_SVGA=no
ENABLE_WGL=no
ENABLE_X11=no ENABLE_X11=no
IFS="," IFS=","
for client in $clients; do for client in $clients; do
@ -1342,6 +1368,9 @@ else
svga) svga)
ENABLE_SVGA=yes ENABLE_SVGA=yes
;; ;;
wgl)
ENABLE_WGL=yes
;;
x11) x11)
ENABLE_X11=yes ENABLE_X11=yes
;; ;;
@ -1393,6 +1422,12 @@ if test "x$HAVE_SVGA" = xyes -a "x$ENABLE_SVGA" = xyes; then
TARGETS="$TARGETS qf-client-svga\$(EXEEXT)" TARGETS="$TARGETS qf-client-svga\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS SVGAlib" CL_TARGETS="$CL_TARGETS SVGAlib"
fi fi
if test "x$mingw" = xyes; then
if test "x$ENABLE_WGL" = xyes; then
TARGETS="$TARGETS qf-client-wgl\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS WGL"
fi
fi
if test "x$HAVE_X" = xyes -a "x$ENABLE_X11" = xyes; then if test "x$HAVE_X" = xyes -a "x$ENABLE_X11" = xyes; then
TARGETS="$TARGETS qf-client-x11\$(EXEEXT)" TARGETS="$TARGETS qf-client-x11\$(EXEEXT)"
CL_TARGETS="$CL_TARGETS X11" CL_TARGETS="$CL_TARGETS X11"
@ -1426,6 +1461,7 @@ AC_MSG_RESULT([
Client support:$CL_TARGETS Client support:$CL_TARGETS
Sound system: $SNDTYPE Sound system: $SNDTYPE
IPv6 networking: $NETTYPE_IPV6 IPv6 networking: $NETTYPE_IPV6
Compression support: $HAVE_ZLIB
Shared game data directory: $sharepath Shared game data directory: $sharepath
Per-user game data directory: $userpath Per-user game data directory: $userpath

View file

@ -2,4 +2,4 @@
AUTOMAKE_OPTIONS= foreign AUTOMAKE_OPTIONS= foreign
SUBDIRS = man texinfo SUBDIRS = man texinfo
EXTRA_DIST = readme.txt template.h EXTRA_DIST = readme.txt template.h config/glspeed.cfg config/swspeed.cfg

87
doc/config/glspeed.cfg Normal file
View file

@ -0,0 +1,87 @@
// Draw the weapon model. Turn off to gain 2 fps
r_drawviewmodel "1"
// smooth dynamic lights. Older cards set to 0 for a speedup.
gl_dlight_smooth "0"
// smooth lighting on models ~2 fps increase on my system set to 0, however
// others with newer cards (I have a voodoo 1) report setting it to 1 gives
// them a .1 fps speed *increase.* Fiddle with it in game to find out what
// works best for you.
gl_smooth "0"
// dimensions of displayed textures. 0 is normal, 1 is blurry, 2 isn't worth it
// 1 is pretty good for a decent speed up - you can still tell what you're
// looking at
gl_picmip "1"
// Set to 0 to turn off colinear vertexes upon level load. You'll be able to
// see through junctions of some objects and walls - will give you ~1 fps
// if you turn it off.
gl_keeptjunctions "0"
// How blurry is the player model? 2 makes them still identifyable, but speeds
// it up enough to be noticable. 4 is highest setting, 0 is default.
gl_playermip "2"
// Turn off most dynamic lighting. An enourmous speed increase if you can bear
// it
r_dynamic "0"
// If not, turn this on as well and it'll speed it up slightly as you'll be
// using a type of lighting easier on the GL card.
// NOTE: Setting r_dynamic to 0 and this to 1 will cause it to light
// many things anyway. Yes, it's schitzo.
gl_dlight_polyblend "0"
// turn these two on to turn on fullbrights for all models - mostly useful
// in MegaTF/2k to see the proximity mines in dark places! If you don't play
// those, or stay out of dark places which go beep, turn them off to gain 2 fps.
gl_fb_bmodels "0"
gl_fb_models "0"
// Rocket trails, smoke etc. Turn off to gain a LOT of fps in battles, as well
// as make it a hell of a lot easier to see your enemy.
r_particles "0"
// Toggles lavaball and rocket fireballs, - 0 gives a bit of a speed up.
gl_fires "0"
// Speed at which the console background spins. Leave it off unless you like
// your console background to spin :P
gl_conspin "0"
// Alpha value for the console background.
gl_conalpha "0.6"
// Slide the console or stretch it.
gl_constretch "0"
// Lighting mode, 0 glquake style, 1 new style. Setting 0 is 1 fps faster.
gl_lightmode "0"
// Sets the division value for the sky brushes. Higher is faster, however
// Setting it this high is a bit rediculous. Real fast compared to default
// of 128 though - assuming you have sky ON.
gl_subdivide_size "128"
// Set to 1 by default. Fixes status bar flicker on some buggy hardware.
// Normally sane people set it to 0... Because it's a speed hit if it's on.
gl_triplebuffer "0"
// Set to 0 *default* to draw sky before anything else, 1 to draw it last, >1
// to not do it at all. I have it at 3 because I've been assured there will
// eventually be a setting 2.
gl_sky_clip "3"
// The next four options can be set to 1 by the SERVER, so if it doesn't
// work, check that the server admin hasn't set them to 1 himself.
// Set to 0 to turn off quad/suit/pent screen filling color. 2 fps increase.
cl_cshift_powerup "0"
// Set to 0 to turn off 'bonus' flash, and item pickup flash. 2 fps increase.
cl_cshift_bonus "0"
// Set to 0 to turn off pain screen filling color. 2 fps increase.
cl_cshift_damage "0"
// Set to 0 to turn off water/lava screen filling color. 2 fps increase...
// However, it can be used to cheat in megatf/mega2k with flash grens/mines.
// Smart server admins would force this to 1 for quakeforge servers running
// megatf/2k. Older quakeworld servers couldn't disable gl_polyblend anyway.
cl_cshift_content "1"
// client's maximum fps allowed. 72 is the highest it can be set to
cl_maxfps "72"
// Set to 0 to go faster, 1 is older mode and slower
// Or not. Some people say 0 is slower and 1 is faster.
// *shrugs* Pick your favorite I guess.
cl_sbar "0"
// If you set this to 120 your status bar will disappear completely and
// your fps will improve slightly. But I like my status bar.
viewsize 100
// Don't show gibs. Should improve speed slightly if you're experiencing lots
// of gibs in battle :)
cl_gibfilter 1
// Don't show dead bodies. Should improve speed slightly if... well, a lot
// of people are dying. Note in TF/Megatf/2k this is BAD TO USE, spies
// can feign and you won't be able to see them at *all*
cl_deadbodyfilter 0

49
doc/config/swspeed.cfg Normal file
View file

@ -0,0 +1,49 @@
// Draw the weapon model. Turn off to gain 2 fps
r_drawviewmodel "1"
// Rocket trails, smoke etc. Turn off to gain a LOT of fps in battles, as well
// as make it a hell of a lot easier to see your enemy.
r_particles "0"
// The next four options can be set to 1 by the SERVER, so if it doesn't
// work, check that the server admin hasn't set them to 1 himself.
// Set to 0 to turn off quad/suit/pent screen filling color.
cl_cshift_powerup "0"
// Set to 0 to turn off 'bonus' flash, and item pickup flash.
cl_cshift_bonus "0"
// Set to 0 to turn off pain screen filling color.
cl_cshift_damage "0"
// Set to 0 to turn off water/lava screen filling color.
// However, it can be used to cheat in megatf/mega2k with flash grens/mines.
// Smart server admins would force this to 1 for quakeforge servers running
// megatf/2k. Older quakeworld servers couldn't disable gl_polyblend anyway.
cl_cshift_content "1"
// client's maximum fps allowed. 72 is the highest it can be set to
cl_maxfps "72"
// Set to 0 to go faster, 1 is older mode and slower
// Or not. Some people say 0 is slower and 1 is faster.
// *shrugs* Pick your favorite I guess.
cl_sbar "0"
// If you set this to 120 your status bar will disappear completely and
// your fps will improve slightly. Setting it lower, minimum is 30, will
// improve your fps.
viewsize 100
// Don't show gibs. Should improve speed slightly if you're experiencing lots
// of gibs in battle :)
cl_gibfilter 1
// Don't show dead bodies. Should improve speed slightly if... well, a lot
// of people are dying. Note in TF/Megatf/2k this is BAD TO USE, spies
// can feign and you won't be able to see them at *all*
cl_deadbodyfilter 0
// detail level, 0 is highest 3 is lowest
d_mipcap 1
// detail level of objects, 0 is highest 3 is lowest
d_mipscale 1
// subdivide sky polys - not sure if turning this off helps or not. Experiment
gl_sky_divide 1
// division value for the sky brushes. - not sure if playing with this helps.
gl_subdivide_size 128
// set how many edges are visible. Reduce from default to increase speed on
// big maps at the cost of how much you can see
r_maxedges 2000
// set how many surfaces are visible. Reduce from default to increase speed on
// big maps at the cost of how much you can see
r_maxsurfs 1000

1
include/.gitignore vendored
View file

@ -4,4 +4,5 @@ Makefile
config.h.in config.h.in
stamp-h.in stamp-h.in
stamp-h stamp-h
stamp-h1
config.h config.h

View file

@ -17,6 +17,7 @@ EXTRA_DIST = adivtab.h anorm_dots.h anorms.h asm_draw.h asm_i386.h block16.h \
winquake.h world.h zone.h \ winquake.h world.h zone.h \
\ \
win32/fnmatch.h win32/version.h win32/version.h.in \ win32/fnmatch.h win32/version.h win32/version.h.in \
win32/mingw/config.h \
win32/resources/icon1.ico win32/resources/resource.h \ win32/resources/icon1.ico win32/resources/resource.h \
win32/resources/quakeforge.rc win32/bc/borland.c win32/bc/config.h \ win32/resources/quakeforge.rc win32/bc/borland.c win32/bc/config.h \
win32/vc/config.h win32/vc/dirent.h win32/vc/config.h win32/vc/dirent.h

View file

@ -285,7 +285,7 @@ typedef struct
char levelname[40]; // for display on solo scoreboard char levelname[40]; // for display on solo scoreboard
int playernum; int playernum;
int stdver; float stdver; // QSG version
// refresh related state // refresh related state
struct model_s *worldmodel; // cl_entitites[0].model struct model_s *worldmodel; // cl_entitites[0].model

View file

@ -36,32 +36,36 @@
#include "qtypes.h" #include "qtypes.h"
void GetEvent( void );
extern Display *x_disp; extern Display *x_disp;
extern int x_screen; extern Visual *x_vis;
extern Window x_root; extern Window x_root;
extern XVisualInfo *x_visinfo;
extern Visual *x_vis;
extern Window x_win; extern Window x_win;
extern qboolean doShm; extern XVisualInfo *x_visinfo;
extern double x_gamma;
extern int x_screen;
extern int x_shmeventtype; extern int x_shmeventtype;
extern qboolean doShm;
extern qboolean oktodraw; extern qboolean oktodraw;
extern struct cvar_s *vid_fullscreen; extern struct cvar_s *vid_fullscreen;
qboolean x11_add_event (int event, void (*event_handler)(XEvent *)); void GetEvent (void);
qboolean x11_del_event (int event, void (*event_handler)(XEvent *));
void x11_process_event (void); double X11_GetGamma (void);
void x11_process_events (void); qboolean X11_AddEvent (int event, void (*event_handler)(XEvent *));
void x11_open_display (void); qboolean X11_RemoveEvent (int event, void (*event_handler)(XEvent *));
void x11_close_display (void); qboolean X11_SetGamma (double);
void x11_create_null_cursor (void); void X11_CloseDisplay (void);
void x11_set_vidmode (int, int); void X11_CreateNullCursor (void);
void x11_restore_vidmode (void); void X11_CreateWindow (int, int);
void x11_create_window (int, int); void X11_ForceViewPort (void);
void x11_grab_keyboard (void); void X11_GrabKeyboard (void);
void x11_set_caption (char *); void X11_Init_Cvars (void);
void x11_force_view_port (void); void X11_OpenDisplay (void);
void x11_Init_Cvars (void); void X11_ProcessEvent (void);
void X11_ProcessEvents (void);
void X11_RestoreGamma (void);
void X11_RestoreVidMode (void);
void X11_SetCaption (char *);
void X11_SetVidMode (int, int);
#endif // __context_x11_h_ #endif // __context_x11_h_

View file

@ -26,17 +26,17 @@
$Id$ $Id$
*/ */
#ifndef _CVAR_H #ifndef __cvar_h_
#define _CVAR_H #define __cvar_h_
#include "qtypes.h" #include "qtypes.h"
#include "quakeio.h" #include "quakeio.h"
typedef struct cvar_s typedef struct cvar_s {
{
char *name; char *name;
char *string; char *string;
int flags; int flags;
void (*callback)(struct cvar_s *var);
char *description; // for "help" command char *description; // for "help" command
float value; float value;
int int_val; int int_val;
@ -44,8 +44,7 @@ typedef struct cvar_s
struct cvar_s *next; struct cvar_s *next;
} cvar_t; } cvar_t;
typedef struct cvar_alias_s typedef struct cvar_alias_s {
{
char *name; char *name;
cvar_t *cvar; cvar_t *cvar;
struct cvar_alias_s *next; struct cvar_alias_s *next;
@ -57,19 +56,11 @@ typedef struct cvar_alias_s
// specific configurations // specific configurations
#define CVAR_USERINFO 2 // sent to server on connect or change #define CVAR_USERINFO 2 // sent to server on connect or change
#define CVAR_SERVERINFO 4 // sent in response to front end requests #define CVAR_SERVERINFO 4 // sent in response to front end requests
#define CVAR_SYSTEMINFO 8 // these cvars will be duplicated on all clients
#define CVAR_INIT 16 // don't allow change from console at all,
// but can be set from the command line
#define CVAR_NOTIFY 32 // Will notify players when changed. #define CVAR_NOTIFY 32 // Will notify players when changed.
#define CVAR_ROM 64 // display only, cannot be set by user at all #define CVAR_ROM 64 // display only, cannot be set by user at all
#define CVAR_USER_CREATED 128 // created by a set command #define CVAR_USER_CREATED 128 // created by a set command
#define CVAR_HEAP 256 // allocated off the heap, safe to free
#define CVAR_CHEAT 512 // can not be changed if cheats are disabled
#define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued
#define CVAR_LATCH 2048 // will only change when C code next does #define CVAR_LATCH 2048 // will only change when C code next does
// a Cvar_Get(), so it can't be changed // a Cvar_Get(), so it can't be changed
#define CVAR_TEMP 4096 // can be set even when cheats are
// disabled, but is not archived
// Zoid| A good CVAR_ROM example is userpath. The code should read "cvar_t // Zoid| A good CVAR_ROM example is userpath. The code should read "cvar_t
// *fs_userpath = CvarGet("fs_userpath", ".", CVAR_ROM); The user can // *fs_userpath = CvarGet("fs_userpath", ".", CVAR_ROM); The user can
@ -81,7 +72,8 @@ typedef struct cvar_alias_s
// Returns the Cvar if found, creates it with value if not. Description and // Returns the Cvar if found, creates it with value if not. Description and
// flags are always updated. // flags are always updated.
cvar_t *Cvar_Get (char *name, char *value, int cvarflags, char *description); cvar_t *Cvar_Get (char *name, char *value, int cvarflags,
void (*callback)(cvar_t*), char *description);
cvar_t *Cvar_FindAlias (char *alias_name); cvar_t *Cvar_FindAlias (char *alias_name);
@ -120,9 +112,9 @@ void Cvar_WriteVariables (QFile *f);
cvar_t *Cvar_FindVar (char *var_name); cvar_t *Cvar_FindVar (char *var_name);
void Cvar_Init_Hash (void); void Cvar_Init_Hash (void);
void Cvar_Init(); void Cvar_Init (void);
void Cvar_Shutdown(); void Cvar_Shutdown (void);
extern cvar_t *cvar_vars; extern cvar_t *cvar_vars;

View file

@ -50,7 +50,7 @@ void Draw_FadeScreen (void);
void Draw_String8 (int x, int y, char *str); void Draw_String8 (int x, int y, char *str);
void Draw_AltString8 (int x, int y, char *str); void Draw_AltString8 (int x, int y, char *str);
qpic_t *Draw_PicFromWad (char *name); qpic_t *Draw_PicFromWad (char *name);
qpic_t *Draw_CachePic (char *path); qpic_t *Draw_CachePic (char *path, qboolean alpha);
void Draw_Crosshair(void); void Draw_Crosshair(void);
#endif // _DRAW_H #endif // _DRAW_H

View file

@ -240,11 +240,10 @@ void GL_Set2D (void);
// //
// gl_rmain.c // gl_rmain.c
// //
void GL_CheckBrightness (unsigned char *pal);
//qboolean R_CullBox (vec3_t mins, vec3_t maxs); //qboolean R_CullBox (vec3_t mins, vec3_t maxs);
void R_RotateForEntity (entity_t *e); void R_RotateForEntity (entity_t *e);
extern inline qboolean R_CullBox (vec3_t mins, vec3_t maxs) static inline qboolean R_CullBox (vec3_t mins, vec3_t maxs)
{ {
int i; int i;
@ -280,11 +279,6 @@ void R_StoreEfrags (efrag_t **ppefrag);
extern qboolean lighthalf; extern qboolean lighthalf;
extern unsigned char lighthalf_v[3]; extern unsigned char lighthalf_v[3];
//
// gl_mesh.c
//
void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr);
// //
// gl_rsurf.c // gl_rsurf.c
// //

View file

@ -26,8 +26,8 @@
$Id$ $Id$
*/ */
#ifndef _INFO_H #ifndef __info_h_
#define _INFO_H #define __info_h_
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
@ -35,15 +35,19 @@
#include <stdlib.h> // for size_t. sys/types.h SHOULD be used, but can't :(bc) #include <stdlib.h> // for size_t. sys/types.h SHOULD be used, but can't :(bc)
#include "qtypes.h"
#define MAX_INFO_STRING 512 #define MAX_INFO_STRING 512
#define MAX_SERVERINFO_STRING 512 #define MAX_SERVERINFO_STRING 512
#define MAX_LOCALINFO_STRING 32768 #define MAX_LOCALINFO_STRING 32768
char *Info_ValueForKey (char *s, char *key); qboolean Info_FilterForKey (const char *key);
void Info_Print (char *s);
void Info_RemoveKey (char *s, char *key); void Info_RemoveKey (char *s, char *key);
void Info_RemovePrefixedKeys (char *start, char prefix); void Info_RemovePrefixedKeys (char *start, char prefix);
void Info_SetValueForKey (char *s, char *key, char *value, size_t maxsize); void Info_SetValueForKey (char *s, char *key, char *value, size_t maxsize, int flags);
void Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize); void Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize, int flags);
void Info_Print (char *s); char *Info_ValueForKey (char *s, char *key);
qboolean Info_Validate (char *s);
#endif // _INFO_H #endif // __info_h_

View file

@ -48,6 +48,9 @@ extern int nanmask;
#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];} #define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];} #define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
// LordHavoc: makes code more readable
#define VectorIsNull(a) ((a)[0] == 0 && (a)[1] == 0 && (a)[2] == 0)
/* /*
* VectorDistance, the distance between two points. * VectorDistance, the distance between two points.
* Yes, this is the same as sqrt(VectorSubtract then DotProduct), * Yes, this is the same as sqrt(VectorSubtract then DotProduct),

View file

@ -37,7 +37,11 @@
typedef struct typedef struct
{ {
#ifdef HAVE_IPV6
byte ip[16];
#else
byte ip[4]; byte ip[4];
#endif
unsigned short port; unsigned short port;
unsigned short family; // used to be pad, before IPV6 unsigned short family; // used to be pad, before IPV6
} netadr_t; } netadr_t;
@ -122,6 +126,7 @@ void Netchan_OutOfBand (netadr_t adr, int length, byte *data);
void Netchan_OutOfBandPrint (netadr_t adr, char *format, ...) __attribute__((format(printf,2,3))); void Netchan_OutOfBandPrint (netadr_t adr, char *format, ...) __attribute__((format(printf,2,3)));
qboolean Netchan_Process (netchan_t *chan); qboolean Netchan_Process (netchan_t *chan);
void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport); void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport);
void Netchan_AckPacket (netchan_t *chan);
qboolean Netchan_CanPacket (netchan_t *chan); qboolean Netchan_CanPacket (netchan_t *chan);
qboolean Netchan_CanReliable (netchan_t *chan); qboolean Netchan_CanReliable (netchan_t *chan);

View file

@ -32,6 +32,7 @@
#include "protocol.h" #include "protocol.h"
#include "mathlib.h" #include "mathlib.h"
#include "model.h" #include "model.h"
#include "progs.h"
#define STOP_EPSILON 0.1 #define STOP_EPSILON 0.1
@ -39,19 +40,24 @@ typedef struct
{ {
vec3_t normal; vec3_t normal;
float dist; float dist;
} pmplane_t; } plane_t;
typedef struct typedef struct
{ {
qboolean allsolid; // if true, plane is not valid qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater; qboolean inopen, inwater;
float fraction; // time completed, 1.0 = didn't hit anything float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact plane_t plane; // surface normal at impact
int ent; // entity the surface is on
} pmtrace_t;
// Dabb: only difference between server and client
// int ent; // vs servers edict_t *ent;
int entnum;
edict_t *ent; // entity the surface is on
} trace_t;
#define MAX_PHYSENTS 32 #define MAX_PHYSENTS 32
typedef struct typedef struct
@ -62,7 +68,6 @@ typedef struct
int info; // for client or server to identify int info; // for client or server to identify
} physent_t; } physent_t;
typedef struct typedef struct
{ {
int sequence; // just for debugging prints int sequence; // just for debugging prints
@ -113,10 +118,10 @@ void PlayerMove (void);
void Pmove_Init (void); void Pmove_Init (void);
void Pmove_Init_Cvars (void); void Pmove_Init_Cvars (void);
int PM_HullPointContents (hull_t *hull, int num, vec3_t p); int HullPointContents (hull_t *hull, int num, vec3_t p);
int PM_PointContents (vec3_t point); int PM_PointContents (vec3_t point);
qboolean PM_TestPlayerPosition (vec3_t point); qboolean PM_TestPlayerPosition (vec3_t point);
pmtrace_t PM_PlayerMove (vec3_t start, vec3_t stop); trace_t PM_PlayerMove (vec3_t start, vec3_t stop);
#endif // _PMOVE_H #endif // _PMOVE_H

102
include/qfplist.h Normal file
View file

@ -0,0 +1,102 @@
/*
qfplist.h
Property list management types and prototypes
Copyright (C) 2000 Jeff Teunissen <deek@dusknet.dhs.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifndef __qfplist_h_
#define __qfplist_h_
#include "qtypes.h"
// Ugly defines for fast checking and conversion from char to number
#define inrange(ch,min,max) ((ch) >= (min) && (ch) <= (max))
#define char2num(ch) \
inrange(ch, '0', '9') ? (ch - 0x30) \
: (inrange(ch, 'a', 'f') ? (ch - 0x57) : (ch - 0x37))
// Maximum number of items in an array
#define MAX_ARRAY_INDEX 128
typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t; // possible types
struct plitem_s {
struct plitem_s *next; // Pointer to next item
pltype_t type; // Type
union shared { // Type-dependant data
struct dict_s *dict;
struct array_s *array;
void *binary;
char *string;
} data;
};
/*
Dictionaries
*/
struct dict_s {
int numkeys; // Number of items in dictionary
struct dictkey_s *keys;
};
struct dictkey_s {
struct dictkey_s *next;
struct plitem_s *key;
struct plitem_s *value;
};
/*
Arrays
*/
struct array_s {
int numvals; // Number of items in array
struct plitem_s *values[MAX_ARRAY_INDEX+1]; // Array data
};
// now that we've defined the structs, define their types so we can use them
typedef struct plitem_s plitem_t;
typedef struct dict_s dict_t;
typedef struct dictkey_s dictkey_t;
typedef struct array_s array_t;
typedef struct pldata_s { // Unparsed property list string
const char *ptr;
unsigned int end;
unsigned int pos;
unsigned int line;
char *error;
} pldata_t;
static plitem_t *PL_GetPropertyList (const char *);
/*
Internal prototypes
static plist_t *PL_ParsePropertyList (pldata_t *);
static qboolean PL_SkipSpace (pldata_t *);
static char *PL_ParseQuotedString (pldata_t *);
static char *PL_ParseUnquotedString (pldata_t *);
*/
#endif // __qfplist_h_

View file

@ -42,6 +42,7 @@
extern cvar_t *fs_userpath; extern cvar_t *fs_userpath;
extern cvar_t *fs_sharepath; extern cvar_t *fs_sharepath;
extern cvar_t *fs_skinbase; extern cvar_t *fs_skinbase;
extern cvar_t *fs_basegame;
extern int com_filesize; extern int com_filesize;
struct cache_user_s; struct cache_user_s;

View file

@ -120,7 +120,8 @@ typedef enum
cs_zombie, // client has been disconnected, but don't reuse cs_zombie, // client has been disconnected, but don't reuse
// connection for a couple seconds // connection for a couple seconds
cs_connected, // has been assigned to a client_t, but not in game yet cs_connected, // has been assigned to a client_t, but not in game yet
cs_spawned // client is fully in game cs_prespawned, // has sent both prespawn and spawn commands
cs_spawned // client is fully in game (issued begin command)
} sv_client_state_t; } sv_client_state_t;
typedef struct typedef struct
@ -214,7 +215,7 @@ typedef struct client_s
netchan_t netchan; netchan_t netchan;
int msecs, msec_cheating; int msecs, msec_cheating;
double last_check; double last_check;
int stdver; float stdver; // QSG standards version
} client_t; } client_t;
// a client can leave the server in one of four ways: // a client can leave the server in one of four ways:
@ -369,6 +370,8 @@ typedef enum
//============================================================================ //============================================================================
// FIXME: declare exported variables in their own relevant .h // FIXME: declare exported variables in their own relevant .h
extern struct cvar_s *sv_highchars;
extern cvar_t *sv_mintic, *sv_maxtic; extern cvar_t *sv_mintic, *sv_maxtic;
extern cvar_t *sv_maxspeed; extern cvar_t *sv_maxspeed;

View file

@ -26,49 +26,30 @@
$Id$ $Id$
*/ */
#ifndef _SYS_H #ifndef __sys_h
#define _SYS_H #define __sys_h
#include <stdarg.h>
#include "gcc_attr.h" #include "gcc_attr.h"
// extern struct cvar_s *sys_nostdout;
// file IO
//
// returns the file size extern const char sys_char_map[256];
// return -1 if file is not present
// the file should be in BINARY mode for stupid OSs that care
int Sys_FileOpenRead (char *path, int *hndl);
int Sys_FileOpenWrite (char *path); int Sys_FileTime (const char *path);
void Sys_FileClose (int handle); void Sys_mkdir (const char *path);
void Sys_FileSeek (int handle, int position);
int Sys_FileRead (int handle, void *dest, int count);
int Sys_FileWrite (int handle, void *data, int count);
int Sys_FileTime (char *path);
void Sys_mkdir (char *path);
// typedef void (*sys_printf_t) (const char *fmt, va_list args);
// memory protection
//
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length);
// void Sys_SetPrintf (sys_printf_t func);
// system IO
//
void Sys_DebugLog(char *file, char *fmt, ...) __attribute__((format(printf,2,3)));
void Sys_Error (char *error, ...) __attribute__((format(printf,1,2)));
// an error will cause the entire program to exit
void Sys_Printf (char *fmt, ...) __attribute__((format(printf,1,2)));
// send text to the console
void Sys_Printf (const char *fmt, ...) __attribute__((format(printf,1,2)));
void Sys_Error (const char *error, ...) __attribute__((format(printf,1,2), noreturn));
void Sys_Quit (void); void Sys_Quit (void);
double Sys_DoubleTime (void); double Sys_DoubleTime (void);
char *Sys_ConsoleInput (void); const char *Sys_ConsoleInput (void);
void Sys_Sleep (void); void Sys_Sleep (void);
// called to yield for a little bit so as // called to yield for a little bit so as
@ -78,11 +59,19 @@ void Sys_LowFPPrecision (void);
void Sys_HighFPPrecision (void); void Sys_HighFPPrecision (void);
void Sys_SetFPCW (void); void Sys_SetFPCW (void);
void Sys_Printf (char *fmt, ...) __attribute__((format(printf,1,2)));
// send text to the console // send text to the console
void Sys_Init (void); void Sys_Init (void);
void Sys_Init_Cvars (void); void Sys_Init_Cvars (void);
#endif // _SYS_H //
// memory protection
//
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length);
//
// system IO
//
void Sys_DebugLog(const char *file, const char *fmt, ...) __attribute__((format(printf,2,3)));
#endif // __sys_h

View file

@ -33,29 +33,36 @@
#include "qtypes.h" #include "qtypes.h"
#ifndef __GNUC__ #ifndef __GNUC__
# if defined (__BORLANDC__) || defined (_MSC_VER) # if defined (__DECC) && defined (__ALPHA)
# if (defined(__BORLANDC__) && (__BORLANDC__ < 0x550)) // uses __unaligned
# pragma option -a1
# else
# pragma pack(push, tgainclude)
# pragma pack(1)
# endif
# else # else
# error do some data packing magic here (#pragma pack?) # define __unaligned
# if defined (__BORLANDC__) || defined (_MSC_VER)
# if (defined(__BORLANDC__) && (__BORLANDC__ < 0x550))
# pragma option -a1
# else
# pragma pack(push, tgainclude)
# pragma pack(1)
# endif
# else
# error do some data packing magic here (#pragma pack?)
# endif
# endif # endif
#else
# define __unaligned
#endif #endif
typedef struct _TargaHeader { typedef struct _TargaHeader {
unsigned char id_length __attribute__((packed)); unsigned char id_length __attribute__((packed));
unsigned char colormap_type __attribute__((packed)); unsigned char colormap_type __attribute__((packed));
unsigned char image_type __attribute__((packed)); unsigned char image_type __attribute__((packed));
unsigned short colormap_index __attribute__((packed)); __unaligned unsigned short colormap_index __attribute__((packed));
unsigned short colormap_length __attribute__((packed)); __unaligned unsigned short colormap_length __attribute__((packed));
unsigned char colormap_size __attribute__((packed)); unsigned char colormap_size __attribute__((packed));
unsigned short x_origin __attribute__((packed)); __unaligned unsigned short x_origin __attribute__((packed));
unsigned short y_origin __attribute__((packed)); __unaligned unsigned short y_origin __attribute__((packed));
unsigned short width __attribute__((packed)); __unaligned unsigned short width __attribute__((packed));
unsigned short height __attribute__((packed)); __unaligned unsigned short height __attribute__((packed));
unsigned char pixel_size __attribute__((packed)); unsigned char pixel_size __attribute__((packed));
unsigned char attributes __attribute__((packed)); unsigned char attributes __attribute__((packed));
} TargaHeader; } TargaHeader;

View file

@ -65,6 +65,7 @@ extern unsigned short d_8to16table[256];
extern unsigned int d_8to24table[256]; extern unsigned int d_8to24table[256];
extern int scr_width, scr_height; extern int scr_width, scr_height;
extern qboolean DDActive; extern qboolean DDActive;
extern byte gammatable[256];
// called at startup and after any gamma correction // called at startup and after any gamma correction
void VID_SetPalette (unsigned char *palette); void VID_SetPalette (unsigned char *palette);
@ -90,9 +91,6 @@ void VID_Update (vrect_t *rects);
// or not // or not
// int VID_SetMode (int modenum, unsigned char *palette); // int VID_SetMode (int modenum, unsigned char *palette);
// called only on Win32, when pause happens, so the mouse can be released
void VID_HandlePause (qboolean pause);
void VID_LockBuffer (void); void VID_LockBuffer (void);
void VID_UnlockBuffer (void); void VID_UnlockBuffer (void);
@ -108,4 +106,11 @@ void VID_GetWindowSize (int def_w, int def_h);
int VID_ForceUnlockedAndReturnState (void); int VID_ForceUnlockedAndReturnState (void);
void VID_ForceLockState (int lk); void VID_ForceLockState (int lk);
void VID_InitGamma (unsigned char *);
double VID_GetGamma (void);
qboolean VID_SetGamma (double);
void VID_UpdateGamma (struct cvar_s *);
extern struct cvar_s *vid_gamma;
#endif // __vid_h_ #endif // __vid_h_

View file

@ -65,23 +65,6 @@
/* Version string */ /* Version string */
#include "version.h" #include "version.h"
/* Define if you want to use QF-style defaults instead of Id-style */
#undef NEWSTYLE
/* Define this to the subdirectory name of the default game */
#ifdef NEWSTYLE
# define BASEGAME "base"
#else
# define BASEGAME "id1"
#endif
/* Define this to the base directory for the client to download skins to */
#ifdef NEWSTYLE
# define SKINBASE "base"
#else
# define SKINBASE "qw"
#endif
/* Define if you have the XFree86 DGA extension */ /* Define if you have the XFree86 DGA extension */
#undef HAVE_DGA #undef HAVE_DGA

View file

@ -68,23 +68,6 @@
/* Version string */ /* Version string */
#include "version.h" #include "version.h"
/* Define if you want to use QF-style defaults instead of Id-style */
#undef NEWSTYLE
/* Define this to the subdirectory name of the default game */
#ifdef NEWSTYLE
# define BASEGAME "base"
#else
# define BASEGAME "id1"
#endif
/* Define this to the base directory for the client to download skins to */
#ifdef NEWSTYLE
# define SKINBASE "base"
#else
# define SKINBASE "qw"
#endif
/* Define if you have the XFree86 DGA extension */ /* Define if you have the XFree86 DGA extension */
#undef HAVE_DGA #undef HAVE_DGA

View file

@ -75,23 +75,6 @@
/* Version string */ /* Version string */
#include "..\version.h" #include "..\version.h"
/* Define if you want to use QF-style defaults instead of Id-style */
#undef NEWSTYLE
/* Define this to the subdirectory name of the default game */
#ifdef NEWSTYLE
# define BASEGAME "base"
#else
# define BASEGAME "id1"
#endif
/* Define this to the base directory for the client to download skins to */
#ifdef NEWSTYLE
# define SKINBASE "base"
#else
# define SKINBASE "qw"
#endif
/* Define if you have the XFree86 DGA extension */ /* Define if you have the XFree86 DGA extension */
#undef HAVE_DGA #undef HAVE_DGA

View file

@ -30,7 +30,7 @@
/* Version strings */ /* Version strings */
#define PACKAGE "quakeforge" #define PACKAGE "quakeforge"
#define PROGRAM "QuakeForge" #define PROGRAM "QuakeForge"
#define VERSION "0.3.0" #define VERSION "0.3.1"
#define QW_VERSION "2.40" #define QW_VERSION "2.40"
#define QSG_VERSION "2.0" #define QSG_VERSION "2.0"

View file

@ -35,14 +35,27 @@
# pragma warning( disable : 4229 ) /* mgraph gets this */ # pragma warning( disable : 4229 ) /* mgraph gets this */
#endif #endif
#define byte __hide_byte
#define LPCWAVEFORMATEX __hide_LPCWAVEFORMATEX_
#include <windows.h> #include <windows.h>
#include <ddraw.h> #undef LPCWAVEFORMATEX
#ifdef WINNT
#undef WINNT
#include <dsound.h> #include <dsound.h>
#include <ddraw.h>
#define WINNT
#else
#include <dsound.h>
#include <ddraw.h>
#endif
#ifdef HAVE_MGRAPH_H #ifdef HAVE_MGRAPH_H
# include <mgraph.h> # include <mgraph.h>
#endif #endif
#undef byte
#include "qtypes.h" #include "qtypes.h"
#ifndef WM_MOUSEWHEEL #ifndef WM_MOUSEWHEEL

View file

@ -33,23 +33,7 @@
#include "mathlib.h" #include "mathlib.h"
#include "model.h" #include "model.h"
#include "progs.h" #include "progs.h"
#include "pmove.h"
typedef struct
{
vec3_t normal;
float dist;
} plane_t;
typedef struct
{
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater;
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
plane_t plane; // surface normal at impact
edict_t *ent; // entity the surface is on
} trace_t;
#define MOVE_NORMAL 0 #define MOVE_NORMAL 0
#define MOVE_NOMONSTERS 1 #define MOVE_NOMONSTERS 1

View file

@ -1 +1,2 @@
set args -nosound -nocdaudio +setrom _windowed_mouse 0 +set gl_sky_clip 1 +set show_fps 1 set args -nosound -nocdaudio +setrom _windowed_mouse 0 +set gl_sky_clip 1 +set show_fps 1
set height 0

View file

@ -31,8 +31,8 @@ AUTOMAKE_OPTIONS= foreign
# #
# Stuff that is common to both client and server # Stuff that is common to both client and server
# #
INCLUDES= -I$(top_srcdir)/include $(GGI_CFLAGS) $(MGL_CFLAGS) $(SDL_CFLAGS) $(SVGA_CFLAGS) $(X_CFLAGS) $(GLX_CFLAGS) $(TDFXGL_CFLAGS) INCLUDES= -I$(top_srcdir)/include $(GGI_CFLAGS) $(MGL_CFLAGS) $(SVGA_CFLAGS) $(X_CFLAGS) $(GLX_CFLAGS) $(TDFXGL_CFLAGS)
AR=@AR@
bin_PROGRAMS = @TARGETS@ bin_PROGRAMS = @TARGETS@
EXTRA_PROGRAMS= qf-server \ EXTRA_PROGRAMS= qf-server \
@ -48,11 +48,12 @@ endif
if ASM_ARCH if ASM_ARCH
math_ASM = math.S sys_x86.S math_ASM = math.S sys_x86.S
world_ASM= worlda.S
endif endif
common_SOURCES= buildnum.c checksum.c cmd.c com.c crc.c cvar.c hash.c \ common_sources= buildnum.c checksum.c cmd.c com.c crc.c cvar.c hash.c \
info.c link.c mathlib.c mdfour.c model.c model_brush.c \ info.c link.c mathlib.c mdfour.c model.c model_brush.c \
msg.c pmove.c pmovetst.c qargs.c qendian.c quakefs.c quakeio.c \ msg.c pmove.c pmovetst.c qargs.c qendian.c quakefs.c quakeio.c \
sizebuf.c va.c zone.c $(math_ASM) $(packetlogger) sizebuf.c sys.c va.c zone.c $(math_ASM) $(packetlogger) $(world_ASM)
# #
# ... Network type # ... Network type
@ -70,22 +71,18 @@ EXTRA_libqfnet_a_SOURCES= net_chan.c net_com.c net_udp.c net_udp6.c
# ... System type # ... System type
# #
if SYSTYPE_WIN32 if SYSTYPE_WIN32
libqfsys_sv_a_SOURCES= fnmatch.c dirent.c sv_sys_win.c sys_win.c libqfsys_sv_a_SOURCES= fnmatch.c dirent.c sv_sys_win.c
else else
libqfsys_sv_a_SOURCES= sv_sys_unix.c sys_unix.c libqfsys_sv_a_SOURCES= sv_sys_unix.c
endif endif
EXTRA_libqfsys_sv_a_SOURCES= fnmatch.c dirent.c sv_sys_unix.c sv_sys_win.c sys_unix.c sys_win.c EXTRA_libqfsys_sv_a_SOURCES= fnmatch.c dirent.c sv_sys_unix.c sv_sys_win.c sys.c sys.c
if ASM_ARCH server_sources= pr_edict.c pr_exec.c pr_offs.c sv_ccmds.c sv_cvar.c \
world_ASM= worlda.S
endif
server_SOURCES= pr_edict.c pr_exec.c pr_offs.c sv_ccmds.c sv_cvar.c \
sv_ents.c sv_init.c sv_main.c sv_misc.c sv_model.c \ sv_ents.c sv_init.c sv_main.c sv_misc.c sv_model.c \
sv_move.c sv_nchan.c sv_phys.c sv_pr_cmds.c sv_progs.c sv_send.c \ sv_move.c sv_nchan.c sv_phys.c sv_pr_cmds.c sv_progs.c sv_send.c \
sv_user.c ver_check.c world.c $(world_ASM) sv_user.c ver_check.c world.c
qf_server_SOURCES= $(common_SOURCES) $(server_SOURCES) qf_server_SOURCES= $(common_sources) $(server_sources)
qf_server_LDADD= -L. -lqfnet -lqfsys_sv $(NET_LIBS) $(Z_LIBS) $(DL_LIBS) qf_server_LDADD= -L. -lqfnet -lqfsys_sv $(NET_LIBS) $(Z_LIBS) $(DL_LIBS)
qf_server_DEPENDENCIES= libqfnet.a libqfsys_sv.a qf_server_DEPENDENCIES= libqfnet.a libqfsys_sv.a
@ -95,44 +92,51 @@ qf_server_DEPENDENCIES= libqfnet.a libqfsys_sv.a
# ... System type # ... System type
# #
if SYSTYPE_WIN32 if SYSTYPE_WIN32
libqfsys_cl_a_SOURCES= cl_sys_win.c fnmatch.c dirent.c sys_win.c libqfsys_cl_a_SOURCES= fnmatch.c dirent.c
else else
libqfsys_cl_a_SOURCES= cl_sys_unix.c sys_unix.c libqfsys_cl_a_SOURCES=
endif endif
EXTRA_libqfsys_cl_a_SOURCES= cl_sys_sdl.c cl_sys_unix.c cl_sys_win.c sys_win.c sys_unix.c fnmatch.c dirent.c EXTRA_libqfsys_cl_a_SOURCES= cl_sys_sdl.c cl_sys_unix.c cl_sys_win.c sys.c sys.c fnmatch.c dirent.c
# #
# ... Digital audio # ... Digital audio
# #
if SNDTYPE_ALSA_0_5 if SNDTYPE_ALSA_0_5
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c
endif else
if SNDTYPE_ALSA_0_6 if SNDTYPE_ALSA_0_9
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_6.c libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_9.c
endif else
if SNDTYPE_MME if SNDTYPE_MME
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_mme.c libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_mme.c
endif else
if SNDTYPE_OSS if SNDTYPE_OSS
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_oss.c libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_oss.c
endif else
if SNDTYPE_SDL if SNDTYPE_SDL
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sdl.c libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sdl.c
endif libqfsnd_a_INCLUDES= $(SDL_CFLAGS)
else
if SNDTYPE_SGI if SNDTYPE_SGI
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sgi.c libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sgi.c
endif else
if SNDTYPE_SUN if SNDTYPE_SUN
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sun.c libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sun.c
endif else
if SNDTYPE_WIN32 if SNDTYPE_WIN32
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_win.c libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_win.c
endif else
if SNDTYPE_NULL
libqfsnd_a_SOURCES= snd_null.c libqfsnd_a_SOURCES= snd_null.c
endif endif
endif
endif
endif
endif
endif
endif
endif
EXTRA_libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c \ EXTRA_libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c \
snd_alsa_0_6.c snd_oss.c snd_sdl.c snd_sgi.c \ snd_alsa_0_9.c snd_oss.c snd_sdl.c snd_sgi.c \
snd_sun.c snd_win.c snd_null.c snd_sun.c snd_win.c snd_null.c
# #
@ -140,19 +144,22 @@ EXTRA_libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c \
# #
if CDTYPE_LINUX if CDTYPE_LINUX
libqfcd_a_SOURCES= cd_linux.c libqfcd_a_SOURCES= cd_linux.c
endif else
if CDTYPE_SDL if CDTYPE_SDL
libqfcd_a_SOURCES= cd_sdl.c libqfcd_a_SOURCES= cd_sdl.c
endif libqfcd_a_INCLUDES=$(SDL_CFLAGS)
else
if CDTYPE_SGI if CDTYPE_SGI
libqfcd_a_SOURCES= cd_sgi.c libqfcd_a_SOURCES= cd_sgi.c
endif else
if CDTYPE_WIN32 if CDTYPE_WIN32
libqfcd_a_SOURCES= cd_win.c libqfcd_a_SOURCES= cd_win.c
endif else
if CDTYPE_NULL
libqfcd_a_SOURCES= cd_null.c libqfcd_a_SOURCES= cd_null.c
endif endif
endif
endif
endif
EXTRA_libqfcd_a_SOURCES= cd_dos.c cd_linux.c cd_sdl.c cd_sgi.c cd_win.c cd_null.c EXTRA_libqfcd_a_SOURCES= cd_dos.c cd_linux.c cd_sdl.c cd_sgi.c cd_win.c cd_null.c
# #
@ -160,13 +167,13 @@ EXTRA_libqfcd_a_SOURCES= cd_dos.c cd_linux.c cd_sdl.c cd_sgi.c cd_win.c cd_null.
# #
if JOYTYPE_LINUX if JOYTYPE_LINUX
libqfjs_a_SOURCES= joy_linux.c libqfjs_a_SOURCES= joy_linux.c
endif else
if JOYTYPE_WIN32 if JOYTYPE_WIN32
libqfjs_a_SOURCES= joy_win.c libqfjs_a_SOURCES= joy_win.c
endif else
if JOYTYPE_NULL
libqfjs_a_SOURCES= joy_null.c libqfjs_a_SOURCES= joy_null.c
endif endif
endif
libqfjs_a_CFLAGS= $(JOY_CFLAGS) libqfjs_a_CFLAGS= $(JOY_CFLAGS)
EXTRA_libqfjs_a_SOURCES= joy_linux.c joy_win.c joy_null.c EXTRA_libqfjs_a_SOURCES= joy_linux.c joy_win.c joy_null.c
@ -176,7 +183,7 @@ if ASM_ARCH
client_ASM= snd_mixa.S cl_math.S client_ASM= snd_mixa.S cl_math.S
endif endif
client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \ client_sources= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \
cl_main.c cl_misc.c cl_parse.c cl_pred.c cl_slist.c cl_tent.c \ cl_main.c cl_misc.c cl_parse.c cl_pred.c cl_slist.c cl_tent.c \
console.c keys.c locs.c menu.c model_alias.c model_sprite.c nonintel.c \ console.c keys.c locs.c menu.c model_alias.c model_sprite.c nonintel.c \
pcx.c r_view.c sbar.c skin.c teamplay.c tga.c wad.c vid.c $(client_ASM) pcx.c r_view.c sbar.c skin.c teamplay.c tga.c wad.c vid.c $(client_ASM)
@ -192,7 +199,7 @@ soft_ASM= d_draw.S d_draw16.S d_parta.S d_polysa.S d_scana.S d_spr8.S \
surf16.S surf8.S surf16.S surf8.S
endif endif
soft_SOURCES= d_edge.c d_fill.c d_init.c d_modech.c \ soft_sources= d_edge.c d_fill.c d_init.c d_modech.c \
d_part.c d_polyse.c d_scan.c d_sky.c d_sprite.c d_surf.c \ d_part.c d_polyse.c d_scan.c d_sky.c d_sprite.c d_surf.c \
d_vars.c d_zpoint.c draw.c r_aclip.c r_alias.c r_bsp.c \ d_vars.c d_zpoint.c draw.c r_aclip.c r_alias.c r_bsp.c \
r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c \ r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c \
@ -204,7 +211,7 @@ soft_SOURCES= d_edge.c d_fill.c d_init.c d_modech.c \
# ... Linux FBDev # ... Linux FBDev
# #
YFLAGS = -d YFLAGS = -d
fbdev_SOURCES= fbset.c fbset_modes_y.y fbset_modes_l.l vid_fbdev.c in_fbdev.c fbdev_sources= fbset.c fbset_modes_y.y fbset_modes_l.l vid_fbdev.c in_fbdev.c cl_sys_unix.c
YACCLEX_CLEANFILES= fbset_modes_y.c fbset_modes_y.h fbset_modes_y.tab.h fbset_modes_l.c YACCLEX_CLEANFILES= fbset_modes_y.c fbset_modes_y.h fbset_modes_y.tab.h fbset_modes_l.c
EXTRA_qf_client_fbdev_SOURCES=fbset_modes_y.h EXTRA_qf_client_fbdev_SOURCES=fbset_modes_y.h
@ -213,52 +220,52 @@ fbset_modes_y.o: fbset_modes_y.c
fbset_modes_l.o: fbset_modes_l.c fbset_modes_l.o: fbset_modes_l.c
$(CC) $(INCLUDES) $(CFLAGS) -Wno-error -c fbset_modes_l.c $(CC) $(INCLUDES) $(CFLAGS) -Wno-error -c fbset_modes_l.c
qf_client_fbdev_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES) $(fbdev_SOURCES) qf_client_fbdev_SOURCES= $(common_sources) $(client_sources) $(soft_sources) $(fbdev_sources)
qf_client_fbdev_LDADD= $(CLIENT_LIBS) qf_client_fbdev_LDADD= $(CLIENT_LIBS)
qf_client_fbdev_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_fbdev_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# ... GGI # ... GGI
# #
ggi_SOURCES= vid_ggi.c in_ggi.c ggi_sources= vid_ggi.c in_ggi.c cl_sys_unix.c
qf_client_ggi_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES) $(ggi_SOURCES) qf_client_ggi_SOURCES= $(common_sources) $(client_sources) $(soft_sources) $(ggi_sources)
qf_client_ggi_LDADD= $(GGI_LIBS) $(CLIENT_LIBS) qf_client_ggi_LDADD= $(GGI_LIBS) $(CLIENT_LIBS)
qf_client_ggi_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_ggi_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# ... SciTech MGL # ... SciTech MGL
# #
mgl_SOURCES= vid_mgl.c in_win.c mgl_sources= vid_mgl.c in_win.c cl_sys_win.c
qf_client_mgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES) $(mgl_SOURCES) qf_client_mgl_SOURCES= $(common_sources) $(client_sources) $(soft_sources) $(mgl_sources)
qf_client_mgl_LDADD= $(MGL_LIBS) $(CLIENT_LIBS) qf_client_mgl_LDADD= $(MGL_LIBS) $(CLIENT_LIBS)
qf_client_mgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_mgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# ... Sam Lantinga's Simple DirectMedia Layer, version 1.0 and higher # ... Sam Lantinga's Simple DirectMedia Layer, version 1.0 and higher
# #
sdl_SOURCES= vid_sdl.c in_sdl.c sdl_sources= vid_sdl.c in_sdl.c cl_sys_sdl.c
qf_client_sdl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES) $(sdl_SOURCES) qf_client_sdl_SOURCES= $(common_sources) $(client_sources) $(soft_sources) $(sdl_sources)
qf_client_sdl_LDADD= $(SDL_LIBS) $(CLIENT_LIBS) qf_client_sdl_LDADD= $(SDL_LIBS) $(CLIENT_LIBS)
qf_client_sdl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_sdl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# ... Linux SVGAlib # ... Linux SVGAlib
# #
svga_SOURCES= d_copy.S vid_svgalib.c in_svgalib.c svga_sources= d_copy.S vid_svgalib.c in_svgalib.c cl_sys_unix.c
qf_client_svga_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES) $(svga_SOURCES) qf_client_svga_SOURCES= $(common_sources) $(client_sources) $(soft_sources) $(svga_sources)
qf_client_svga_LDADD= $(SVGA_LIBS) $(CLIENT_LIBS) qf_client_svga_LDADD= $(SVGA_LIBS) $(CLIENT_LIBS)
qf_client_svga_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_svga_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# ... X11 # ... X11
# #
x11_SOURCES= vid_x11.c in_x11.c context_x11.c dga_check.c x11_sources= vid_x11.c in_x11.c context_x11.c dga_check.c cl_sys_unix.c
qf_client_x11_SOURCES= $(common_SOURCES) $(client_SOURCES) $(soft_SOURCES) $(x11_SOURCES) qf_client_x11_SOURCES= $(common_sources) $(client_sources) $(soft_sources) $(x11_sources)
qf_client_x11_LDADD= $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) $(X_SHM_LIB) $(CLIENT_LIBS) qf_client_x11_LDADD= $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) $(X_SHM_LIB) $(CLIENT_LIBS)
qf_client_x11_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_x11_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
@ -268,7 +275,7 @@ qf_client_x11_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs
# #
# ... Common stuff # ... Common stuff
# #
ogl_SOURCES= fractalnoise.c gl_draw.c gl_dyn_fires.c gl_dyn_part.c \ ogl_sources= fractalnoise.c gl_draw.c gl_dyn_fires.c gl_dyn_part.c \
gl_dyn_textures.c gl_mesh.c gl_ngraph.c r_efrag.c \ gl_dyn_textures.c gl_mesh.c gl_ngraph.c r_efrag.c \
gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_screen.c \ gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_screen.c \
gl_skin.c gl_sky.c gl_sky_clip.c gl_view.c gl_warp.c \ gl_skin.c gl_sky.c gl_sky_clip.c gl_view.c gl_warp.c \
@ -278,47 +285,83 @@ ogl_SOURCES= fractalnoise.c gl_draw.c gl_dyn_fires.c gl_dyn_part.c \
# #
# ... 3Dfx Voodoo 1 and 2 SVGAlib-based console GL # ... 3Dfx Voodoo 1 and 2 SVGAlib-based console GL
# #
tdfx_SOURCES= vid_3dfxsvga.c vid_common_gl.c in_svgalib.c tdfx_sources= vid_3dfxsvga.c vid_common_gl.c in_svgalib.c cl_sys_unix.c
qf_client_3dfx_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) $(tdfx_SOURCES) qf_client_3dfx_SOURCES= $(common_sources) $(client_sources) $(ogl_sources) $(tdfx_sources)
qf_client_3dfx_LDADD= $(TDFXGL_LIBS) $(SVGA_LIBS) $(CLIENT_LIBS) $(DL_LIBS) qf_client_3dfx_LDADD= $(TDFXGL_LIBS) $(SVGA_LIBS) $(CLIENT_LIBS) $(DL_LIBS)
qf_client_3dfx_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_3dfx_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# ... OpenGL in X Window # ... OpenGL in X Window
# #
glx_SOURCES= vid_glx.c vid_common_gl.c in_x11.c context_x11.c dga_check.c glx_sources= vid_glx.c vid_common_gl.c in_x11.c context_x11.c dga_check.c cl_sys_unix.c
qf_client_glx_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) $(glx_SOURCES) qf_client_glx_SOURCES= $(common_sources) $(client_sources) $(ogl_sources) $(glx_sources)
qf_client_glx_LDADD= $(GLX_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) $(CLIENT_LIBS) $(DL_LIBS) qf_client_glx_LDADD= $(GLX_LIBS) $(X_PRE_LIBS) $(VIDMODE_LIBS) $(DGA_LIBS) $(X_LIBS) -lX11 $(X_EXTRA_LIBS) $(CLIENT_LIBS) $(DL_LIBS)
qf_client_glx_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_glx_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# ... Sam Lantinga's Simple DirectMedia Layer, version 1.1 and higher, in GL mode # ... Sam Lantinga's Simple DirectMedia Layer, version 1.1 and higher, in GL mode
# #
sgl_SOURCES= vid_sgl.c vid_common_gl.c in_sdl.c sgl_sources= vid_sgl.c vid_common_gl.c in_sdl.c cl_sys_sdl.c
qf_client_sgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) $(sgl_SOURCES) qf_client_sgl_SOURCES= $(common_sources) $(client_sources) $(ogl_sources) $(sgl_sources)
qf_client_sgl_LDADD= $(SDL_LIBS) $(X_LIBS) $(GLX_LIBS) $(CLIENT_LIBS) $(DL_LIBS) qf_client_sgl_LDADD= $(SDL_LIBS) $(X_LIBS) $(GLX_LIBS) $(CLIENT_LIBS) $(DL_LIBS)
qf_client_sgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_sgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# SGI/Microsoft WGL (Windows OpenGL) # SGI/Microsoft WGL (Windows OpenGL)
# #
wgl_SOURCES= vid_wgl.c wgl_sources= vid_wgl.c vid_common_gl.c in_win.c cl_sys_win.c
qf_client_wgl_SOURCES= $(common_SOURCES) $(client_SOURCES) $(ogl_SOURCES) $(wgl_SOURCES) qf_client_wgl_SOURCES= $(common_sources) $(client_sources) $(ogl_sources) $(wgl_sources)
qf_client_wgl_LDADD= $(CLIENT_LIBS) qf_client_wgl_LDADD= $(CLIENT_LIBS) $(GLX_LIBS) -lgdi32 -lwinmm
qf_client_wgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a qf_client_wgl_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
# #
# Stuff that doesn't get linked into an executable NEEDS to be mentioned here, # Stuff that doesn't get linked into an executable NEEDS to be mentioned here,
# or it won't be distributed with 'make dist' # or it won't be distributed with 'make dist'
# #
EXTRA_DIST= makefile.win \ EXTRA_DIST= makefile.mgw makefile.win \
qf-server.mak qw_server.dsp \ qf-server.mak qw_server.dsp \
qf-client-sdl.mak qf-client-win.mak qw_client.dsp \ qf-client-sdl.mak qf-client-win.mak qw_client.dsp \
qf-client-sgl.mak qf-client-wgl.mak qf-client-win.mak qf-client-sgl.mak qf-client-wgl.mak qf-client-win.mak
# Kill the temp files, hopefully. # Kill the temp files, hopefully.
CLEANFILES = *.i *.s $(YACCLEX_CLEANFILES) CLEANFILES = *.i *.s $(YACCLEX_CLEANFILES)
cl_sys_sdl.o: cl_sys_sdl.c
@echo '$(COMPILE) $(SDL_CFLAGS) -c $<'; \
$(COMPILE) $(SDL_CFLAGS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
in_sdl.o: in_sdl.c
@echo '$(COMPILE) $(SDL_CFLAGS) -c $<'; \
$(COMPILE) $(SDL_CFLAGS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
vid_sdl.o: vid_sdl.c
@echo '$(COMPILE) $(SDL_CFLAGS) -c $<'; \
$(COMPILE) $(SDL_CFLAGS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp
vid_sgl.o: vid_sgl.c
@echo '$(COMPILE) $(SDL_CFLAGS) -c $<'; \
$(COMPILE) $(SDL_CFLAGS) -Wp,-MD,.deps/$(*F).pp -c $<
@-cp .deps/$(*F).pp .deps/$(*F).P; \
tr ' ' '\012' < .deps/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*F).P; \
rm .deps/$(*F).pp

View file

@ -63,7 +63,7 @@ CDAudio_Eject (void)
dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN, dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN,
(DWORD) NULL); (DWORD) NULL);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_SET_DOOR_OPEN failed (%i)\n", dwReturn); Con_DPrintf ("MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn);
} }
} }
@ -76,7 +76,7 @@ CDAudio_CloseDoor (void)
dwReturn = dwReturn =
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD) NULL); mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD) NULL);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_SET_DOOR_CLOSED failed (%i)\n", dwReturn); Con_DPrintf ("MCI_SET_DOOR_CLOSED failed (%li)\n", dwReturn);
} }
} }
@ -153,7 +153,7 @@ CDAudio_Play (byte track, qboolean looping)
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
(DWORD) (LPVOID) & mciStatusParms); (DWORD) (LPVOID) & mciStatusParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_STATUS failed (%i)\n", dwReturn); Con_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
return; return;
} }
if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) { if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) {
@ -168,7 +168,7 @@ CDAudio_Play (byte track, qboolean looping)
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT, MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
(DWORD) (LPVOID) & mciStatusParms); (DWORD) (LPVOID) & mciStatusParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_STATUS failed (%i)\n", dwReturn); Con_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
return; return;
} }
@ -185,7 +185,7 @@ CDAudio_Play (byte track, qboolean looping)
mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO, mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO,
(DWORD) (LPVOID) & mciPlayParms); (DWORD) (LPVOID) & mciPlayParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); Con_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
return; return;
} }
@ -211,7 +211,7 @@ CDAudio_Stop (void)
dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD) NULL); dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD) NULL);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_STOP failed (%i)", dwReturn); Con_DPrintf ("MCI_STOP failed (%li)", dwReturn);
} }
wasPlaying = false; wasPlaying = false;
@ -236,7 +236,7 @@ CDAudio_Pause (void)
mciSendCommand (wDeviceID, MCI_PAUSE, 0, mciSendCommand (wDeviceID, MCI_PAUSE, 0,
(DWORD) (LPVOID) & mciGenericParms); (DWORD) (LPVOID) & mciGenericParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("MCI_PAUSE failed (%i)", dwReturn); Con_DPrintf ("MCI_PAUSE failed (%li)", dwReturn);
} }
wasPlaying = playing; wasPlaying = playing;
@ -266,7 +266,7 @@ CDAudio_Resume (void)
mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY, mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY,
(DWORD) (LPVOID) & mciPlayParms); (DWORD) (LPVOID) & mciPlayParms);
if (dwReturn) { if (dwReturn) {
Con_DPrintf ("CDAudio: MCI_PLAY failed (%i)\n", dwReturn); Con_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
return; return;
} }
playing = true; playing = true;
@ -456,7 +456,7 @@ CDAudio_Init (void)
mciSendCommand (0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE, mciSendCommand (0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE,
(DWORD) (LPVOID) & mciOpenParms); (DWORD) (LPVOID) & mciOpenParms);
if (dwReturn) { if (dwReturn) {
Con_Printf ("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn); Con_Printf ("CDAudio_Init: MCI_OPEN failed (%li)\n", dwReturn);
return -1; return -1;
} }
wDeviceID = mciOpenParms.wDeviceID; wDeviceID = mciOpenParms.wDeviceID;
@ -467,7 +467,7 @@ CDAudio_Init (void)
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT, mciSendCommand (wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT,
(DWORD) (LPVOID) & mciSetParms); (DWORD) (LPVOID) & mciSetParms);
if (dwReturn) { if (dwReturn) {
Con_Printf ("MCI_SET_TIME_FORMAT failed (%i)\n", dwReturn); Con_Printf ("MCI_SET_TIME_FORMAT failed (%li)\n", dwReturn);
mciSendCommand (wDeviceID, MCI_CLOSE, 0, (DWORD) NULL); mciSendCommand (wDeviceID, MCI_CLOSE, 0, (DWORD) NULL);
return -1; return -1;
} }

View file

@ -159,7 +159,7 @@ Cam_Lock (int playernum)
Sbar_Changed (); Sbar_Changed ();
} }
pmtrace_t trace_t
Cam_DoTrace (vec3_t vec1, vec3_t vec2) Cam_DoTrace (vec3_t vec1, vec3_t vec2)
{ {
#if 0 #if 0
@ -180,7 +180,7 @@ Cam_TryFlyby (player_state_t * self, player_state_t * player, vec3_t vec,
qboolean checkvis) qboolean checkvis)
{ {
vec3_t v; vec3_t v;
pmtrace_t trace; trace_t trace;
float len; float len;
vectoangles (vec, v); vectoangles (vec, v);
@ -213,7 +213,7 @@ Cam_TryFlyby (player_state_t * self, player_state_t * player, vec3_t vec,
static qboolean static qboolean
Cam_IsVisible (player_state_t * player, vec3_t vec) Cam_IsVisible (player_state_t * player, vec3_t vec)
{ {
pmtrace_t trace; trace_t trace;
vec3_t v; vec3_t v;
float d; float d;
@ -603,9 +603,9 @@ Cam_Reset (void)
void void
CL_Cam_Init_Cvars (void) CL_Cam_Init_Cvars (void)
{ {
cl_hightrack = Cvar_Get ("cl_hightrack", "0", CVAR_NONE, "view the player with the highest frags while in spectator mode."); cl_hightrack = Cvar_Get ("cl_hightrack", "0", CVAR_NONE, NULL, "view the player with the highest frags while in spectator mode.");
cl_chasecam = Cvar_Get ("cl_chasecam", "0", CVAR_NONE, "get first person view of the person you are tracking in spectator mode"); cl_chasecam = Cvar_Get ("cl_chasecam", "0", CVAR_NONE, NULL, "get first person view of the person you are tracking in spectator mode");
cl_camera_maxpitch = cl_camera_maxpitch =
Cvar_Get ("cl_camera_maxpitch", "10", CVAR_NONE, "highest camera pitch in spectator mode"); Cvar_Get ("cl_camera_maxpitch", "10", CVAR_NONE, NULL, "highest camera pitch in spectator mode");
cl_camera_maxyaw = Cvar_Get ("cl_camera_maxyaw", "30", CVAR_NONE, "highest camera yaw in spectator mode"); cl_camera_maxyaw = Cvar_Get ("cl_camera_maxyaw", "30", CVAR_NONE, NULL, "highest camera yaw in spectator mode");
} }

View file

@ -29,8 +29,15 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "client.h" #include "client.h"
#include "compat.h"
#include "cvar.h" #include "cvar.h"
#include "msg.h" #include "msg.h"
#include "va.h" #include "va.h"
@ -40,7 +47,9 @@ Cvar_Info (cvar_t *var)
{ {
if (var->flags & CVAR_USERINFO) { if (var->flags & CVAR_USERINFO) {
Info_SetValueForKey (cls.userinfo, var->name, var->string, Info_SetValueForKey (cls.userinfo, var->name, var->string,
MAX_INFO_STRING); MAX_INFO_STRING,
((!strequal(var->name, "name"))
|(strequal(var->name,"team") << 1)));
if (cls.state >= ca_connected) { if (cls.state >= ca_connected) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
MSG_WriteString (&cls.netchan.message, MSG_WriteString (&cls.netchan.message,

View file

@ -48,6 +48,7 @@
#include "va.h" #include "va.h"
void CL_FinishTimeDemo (void); void CL_FinishTimeDemo (void);
int demotime_cached;
/* /*
DEMO CODE DEMO CODE
@ -74,6 +75,7 @@ CL_StopPlayback (void)
cls.demofile = NULL; cls.demofile = NULL;
cls.state = ca_disconnected; cls.state = ca_disconnected;
cls.demoplayback = 0; cls.demoplayback = 0;
demotime_cached = 0;
if (cls.timedemo) if (cls.timedemo)
CL_FinishTimeDemo (); CL_FinishTimeDemo ();
@ -166,7 +168,6 @@ CL_GetDemoMessage (void)
float demotime; float demotime;
byte c; byte c;
usercmd_t *pcmd; usercmd_t *pcmd;
static int demotime_cached;
static float cached_demotime; static float cached_demotime;
// read the time from the packet // read the time from the packet
@ -618,7 +619,7 @@ CL_Record_f (void)
MSG_WriteByte (&buf, svc_updateentertime); MSG_WriteByte (&buf, svc_updateentertime);
MSG_WriteByte (&buf, i); MSG_WriteByte (&buf, i);
MSG_WriteFloat (&buf, player->entertime); MSG_WriteFloat (&buf, realtime - player->entertime);
MSG_WriteByte (&buf, svc_updateuserinfo); MSG_WriteByte (&buf, svc_updateuserinfo);
MSG_WriteByte (&buf, i); MSG_WriteByte (&buf, i);

View file

@ -47,6 +47,7 @@
#include "msg.h" #include "msg.h"
#include "pmove.h" #include "pmove.h"
#include "r_dynamic.h" #include "r_dynamic.h"
#include "sys.h"
#include "view.h" #include "view.h"
extern cvar_t *cl_predict_players; extern cvar_t *cl_predict_players;
@ -963,6 +964,9 @@ CL_SetSolidEntities (void)
continue; continue;
if (cl.model_precache[state->modelindex]->hulls[1].firstclipnode if (cl.model_precache[state->modelindex]->hulls[1].firstclipnode
|| cl.model_precache[state->modelindex]->clipbox) { || cl.model_precache[state->modelindex]->clipbox) {
if(pmove.numphysent>MAX_PHYSENTS) Sys_Error("Physents overflowed\n");
pmove.physents[pmove.numphysent].model = pmove.physents[pmove.numphysent].model =
cl.model_precache[state->modelindex]; cl.model_precache[state->modelindex];
VectorCopy (state->origin, pmove.physents[pmove.numphysent].origin); VectorCopy (state->origin, pmove.physents[pmove.numphysent].origin);
@ -1106,6 +1110,6 @@ CL_EmitEntities (void)
void void
CL_Ents_Init (void) CL_Ents_Init (void)
{ {
r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, NULL,
"color of rocket and lava ball fires"); "color of rocket and lava ball fires");
} }

View file

@ -731,7 +731,7 @@ CL_Input_Init (void)
void void
CL_Input_Init_Cvars (void) CL_Input_Init_Cvars (void)
{ {
cl_nodelta = Cvar_Get ("cl_nodelta", "0", CVAR_NONE, "disable player delta compression." cl_nodelta = Cvar_Get ("cl_nodelta", "0", CVAR_NONE, NULL, "disable player delta compression."
"set to 1 if you have a poor ISP and get a lot of U_REMOVE warnings."); "set to 1 if you have a poor ISP and get a lot of U_REMOVE warnings.");
} }

View file

@ -41,6 +41,10 @@
# include <strings.h> # include <strings.h>
#endif #endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <sys/types.h> #include <sys/types.h>
@ -51,6 +55,9 @@
#ifdef HAVE_WINSOCK_H #ifdef HAVE_WINSOCK_H
# include <winsock.h> # include <winsock.h>
#endif #endif
#ifdef HAVE_RPC_TYPES_H
# include <rpc/types.h>
#endif
#include <setjmp.h> #include <setjmp.h>
@ -111,6 +118,7 @@ cvar_t *rcon_password;
cvar_t *rcon_address; cvar_t *rcon_address;
cvar_t *cl_writecfg; cvar_t *cl_writecfg;
cvar_t *cl_allow_cmd_pkt;
cvar_t *cl_timeout; cvar_t *cl_timeout;
@ -121,10 +129,10 @@ cvar_t *cl_sbar_separator;
cvar_t *cl_hudswap; cvar_t *cl_hudswap;
cvar_t *cl_maxfps; cvar_t *cl_maxfps;
cvar_t *cl_cshift_bonus; cvar_t *cl_cshift_bonus;
cvar_t *cl_cshift_contents; cvar_t *cl_cshift_contents;
cvar_t *cl_cshift_damage; cvar_t *cl_cshift_damage;
cvar_t *cl_cshift_powerup; cvar_t *cl_cshift_powerup;
cvar_t *lookspring; cvar_t *lookspring;
cvar_t *lookstrafe; cvar_t *lookstrafe;
@ -443,6 +451,21 @@ CL_ClearState (void)
cl.free_efrags[i].entnext = NULL; cl.free_efrags[i].entnext = NULL;
} }
/*
CL_StopCshifts
Cleans the Cshifts, so your screen doesn't stay red after a timedemo :)
*/
void
CL_StopCshifts (void)
{
int i;
for (i = 0; i < NUM_CSHIFTS; i++)
cl.cshifts[i].percent = 0;
for (i = 0; i < MAX_CL_STATS; i++)
cl.stats[i] = 0;
}
/* /*
CL_Disconnect CL_Disconnect
@ -461,6 +484,9 @@ CL_Disconnect (void)
// stop sounds (especially looping!) // stop sounds (especially looping!)
S_StopAllSounds (true); S_StopAllSounds (true);
// Clean the Cshifts
CL_StopCshifts ();
// if running a local server, shut it down // if running a local server, shut it down
if (cls.demoplayback) if (cls.demoplayback)
CL_StopPlayback (); CL_StopPlayback ();
@ -575,22 +601,22 @@ CL_FullServerinfo_f (void)
if ((p = Info_ValueForKey (cl.serverinfo, "*qf_version")) && *p) { if ((p = Info_ValueForKey (cl.serverinfo, "*qf_version")) && *p) {
if (server_version == NULL) if (server_version == NULL)
Con_Printf ("QuakeForge Version %s Server\n", p); Con_Printf ("QuakeForge v%s server\n", p);
server_version = strdup (p); server_version = strdup (p);
} else if ((p = Info_ValueForKey (cl.serverinfo, "*version")) && *p) { } else if ((p = Info_ValueForKey (cl.serverinfo, "*version")) && *p) {
if (server_version == NULL) if (server_version == NULL)
Con_Printf ("Version %s Server\n", p); Con_Printf ("QuakeWorld v%s server\n", p);
server_version = strdup (p); server_version = strdup (p);
} }
if ((p = Info_ValueForKey (cl.serverinfo, "*qsg_version")) && *p) { if ((p = Info_ValueForKey (cl.serverinfo, "*qsg_version")) && *p) {
if ((cl.stdver = atoi (p))) if ((cl.stdver = atof (p)))
Con_Printf ("QSG Standard version %i\n", cl.stdver); Con_Printf ("Server supports QSG v%s protocol\n", p);
else else
Con_Printf ("Invalid standards version: %s", p); Con_Printf ("Invalid QSG Protocol number: %s\n", p);
} }
if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) { if ((p = Info_ValueForKey (cl.serverinfo, "skybox")) && *p) {
if (stricmp (p, "none") == 0) { if (strcaseequal (p, "none")) {
allowskybox = false; allowskybox = false;
} else { } else {
allowskybox = true; allowskybox = true;
@ -625,11 +651,11 @@ CL_AddQFInfoKeys (void)
#ifdef HAVE_ZLIB #ifdef HAVE_ZLIB
strncat (cap, "z", sizeof (cap) - strlen (cap) - 1); strncat (cap, "z", sizeof (cap) - strlen (cap) - 1);
#endif #endif
Info_SetValueForStarKey (cls.userinfo, "*cap", cap, MAX_INFO_STRING); Info_SetValueForStarKey (cls.userinfo, "*cap", cap, MAX_INFO_STRING, 0);
Info_SetValueForStarKey (cls.userinfo, "*qf_version", VERSION, Info_SetValueForStarKey (cls.userinfo, "*qf_version", VERSION,
MAX_INFO_STRING); MAX_INFO_STRING, 0);
Info_SetValueForStarKey (cls.userinfo, "*qsg_version", QSG_VERSION, Info_SetValueForStarKey (cls.userinfo, "*qsg_version", QSG_VERSION,
MAX_INFO_STRING); MAX_INFO_STRING, 0);
Con_Printf ("QuakeForge server detected\n"); Con_Printf ("QuakeForge server detected\n");
} }
@ -688,10 +714,12 @@ CL_FullInfo_f (void)
if (*s) if (*s)
s++; s++;
if (!stricmp (key, pmodel_name) || !stricmp (key, emodel_name)) if (strcaseequal (key, pmodel_name) || strcaseequal (key, emodel_name))
continue; continue;
Info_SetValueForKey (cls.userinfo, key, value, MAX_INFO_STRING); Info_SetValueForKey (cls.userinfo, key, value, MAX_INFO_STRING,
(!strequal (key, "name"))
| (strequal (key, "team") << 1));
} }
} }
@ -711,11 +739,13 @@ CL_SetInfo_f (void)
Con_Printf ("usage: setinfo [ <key> <value> ]\n"); Con_Printf ("usage: setinfo [ <key> <value> ]\n");
return; return;
} }
if (!stricmp (Cmd_Argv (1), pmodel_name) if (strcaseequal (Cmd_Argv (1), pmodel_name)
|| !strcmp (Cmd_Argv (1), emodel_name)) return; || strcaseequal (Cmd_Argv (1), emodel_name))
return;
Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2), Info_SetValueForKey (cls.userinfo, Cmd_Argv (1), Cmd_Argv (2),
MAX_INFO_STRING); MAX_INFO_STRING, (!strequal (Cmd_Argv (1), "name"))
| (strequal (Cmd_Argv (2), "team") << 1));
if (cls.state >= ca_connected) if (cls.state >= ca_connected)
Cmd_ForwardToServer (); Cmd_ForwardToServer ();
} }
@ -881,8 +911,9 @@ CL_ConnectionlessPacket (void)
Con_Printf ("client command\n"); Con_Printf ("client command\n");
if ((*(unsigned int *) net_from.ip != *(unsigned int *) net_local_adr.ip if (!cl_allow_cmd_pkt->int_val
&& *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK))) { || ((*(unsigned int *) net_from.ip != *(unsigned int *) net_local_adr.ip
&& *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK)))) {
Con_Printf ("Command packet from remote host. Ignored.\n"); Con_Printf ("Command packet from remote host. Ignored.\n");
return; return;
} }
@ -919,6 +950,7 @@ CL_ConnectionlessPacket (void)
return; return;
} }
Con_Printf ("%s\n", cmdtext);
Cbuf_AddText (cmdtext); Cbuf_AddText (cmdtext);
allowremotecmd = false; allowremotecmd = false;
return; return;
@ -1114,16 +1146,14 @@ CL_Init (void)
cls.state = ca_disconnected; cls.state = ca_disconnected;
Info_SetValueForKey (cls.userinfo, "name", "unnamed", MAX_INFO_STRING); Info_SetValueForKey (cls.userinfo, "name", "unnamed", MAX_INFO_STRING, 0);
Info_SetValueForKey (cls.userinfo, "topcolor", "0", MAX_INFO_STRING); Info_SetValueForKey (cls.userinfo, "topcolor", "0", MAX_INFO_STRING, 0);
Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", MAX_INFO_STRING); Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", MAX_INFO_STRING, 0);
Info_SetValueForKey (cls.userinfo, "rate", "2500", MAX_INFO_STRING); Info_SetValueForKey (cls.userinfo, "rate", "2500", MAX_INFO_STRING, 0);
Info_SetValueForKey (cls.userinfo, "msg", "1", MAX_INFO_STRING); Info_SetValueForKey (cls.userinfo, "msg", "1", MAX_INFO_STRING, 0);
// snprintf (st, sizeof(st), "%s-%04d", QW_VERSION, build_number()); // snprintf (st, sizeof(st), "%s-%04d", QW_VERSION, build_number());
snprintf (st, sizeof (st), "%s", QW_VERSION); snprintf (st, sizeof (st), "%s", QW_VERSION);
Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING); Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING, 0);
Info_SetValueForStarKey (cls.userinfo, "stdver", QSG_VERSION,
MAX_INFO_STRING);
#ifdef PACKET_LOGGING #ifdef PACKET_LOGGING
Net_Log_Init(); Net_Log_Init();
#endif #endif
@ -1197,103 +1227,105 @@ CL_Init_Cvars (void)
{ {
// LordHavoc: some people like it asking on quit, others don't... // LordHavoc: some people like it asking on quit, others don't...
confirm_quit = confirm_quit =
Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, "confirm quit command"); Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, NULL, "confirm quit command");
show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE, cl_allow_cmd_pkt = Cvar_Get ("cl_allow_cmd_pkt", "1", CVAR_NONE, NULL,
"enables packets from the likes of gamespy");
show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE, NULL,
"display realtime frames per second"); "display realtime frames per second");
// Misty: I like to be able to see the time when I play // Misty: I like to be able to see the time when I play
show_time = Cvar_Get ("show_time", "0", CVAR_NONE, show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL,
"display the current time"); "display the current time");
host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE, host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE, NULL,
"display host processing times"); "display host processing times");
developer = Cvar_Get ("developer", "0", CVAR_NONE, developer = Cvar_Get ("developer", "0", CVAR_NONE, NULL,
"show info interesting to developers"); "show info interesting to developers");
cl_demospeed = Cvar_Get ("cl_demospeed", "1.0", CVAR_NONE, cl_demospeed = Cvar_Get ("cl_demospeed", "1.0", CVAR_NONE, NULL,
"adjust demo playback speed. 1.0 = normal, < 1 slow-mo, > 1 timelaps"); "adjust demo playback speed. 1.0 = normal, < 1 slow-mo, > 1 timelaps");
// Misty: Turn on or off screen filling colors for powerups among other things. // Misty: Turn on or off screen filling colors for powerups among other things.
cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, NULL,
"Show bonus flash on item pickup"); "Show bonus flash on item pickup");
cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE, cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE, NULL,
"Shift view colors for contents (water, slime, etc)"); "Shift view colors for contents (water, slime, etc)");
cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE, cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE, NULL,
"Shift view colors on damage"); "Shift view colors on damage");
cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE, cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE, NULL,
"Shift view colors for powerups"); "Shift view colors for powerups");
cl_autoexec = Cvar_Get ("cl_autoexec", "0", CVAR_ROM, cl_autoexec = Cvar_Get ("cl_autoexec", "0", CVAR_ROM, NULL,
"exec autoexec.cfg on gamedir change"); "exec autoexec.cfg on gamedir change");
cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE, cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE, NULL,
"inform when execing a command"); "inform when execing a command");
cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL,
"swim/fly up/down speed"); "swim/fly up/down speed");
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL,
"forward speed"); "forward speed");
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
"backward speed"); "backward speed");
cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, "strafe speed"); cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, NULL, "strafe speed");
cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL,
"move `run' speed multiplier"); "move `run' speed multiplier");
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, "turning speed"); cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL, "turning speed");
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL,
"look up/down speed"); "look up/down speed");
cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE, cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE, NULL,
"turn `run' speed multiplier"); "turn `run' speed multiplier");
cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL,
"show network packets. 0=off, 1=basic, 2=verbose"); "show network packets. 0=off, 1=basic, 2=verbose");
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, "status bar mode"); cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL, "status bar mode");
cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, NULL,
"turns on status bar separator"); "turns on status bar separator");
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
"new HUD on left side?"); "new HUD on left side?");
cl_maxfps = Cvar_Get ("cl_maxfps", "0", CVAR_ARCHIVE, cl_maxfps = Cvar_Get ("cl_maxfps", "0", CVAR_ARCHIVE, NULL,
"maximum frames rendered in one second. 0 == 32"); "maximum frames rendered in one second. 0 == 32");
cl_timeout = Cvar_Get ("cl_timeout", "60", CVAR_ARCHIVE, cl_timeout = Cvar_Get ("cl_timeout", "60", CVAR_ARCHIVE, NULL,
"server connection timeout (since last packet received)"); "server connection timeout (since last packet received)");
lookspring = Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, lookspring = Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL,
"Snap view to center when moving and no mlook/klook"); "Snap view to center when moving and no mlook/klook");
lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, NULL,
"when mlook/klook on player will strafe"); "when mlook/klook on player will strafe");
sensitivity = Cvar_Get ("sensitivity", "3", CVAR_ARCHIVE, sensitivity = Cvar_Get ("sensitivity", "3", CVAR_ARCHIVE, NULL,
"mouse sensitivity multiplier"); "mouse sensitivity multiplier");
cl_freelook = Cvar_Get ("freelook", "0", CVAR_ARCHIVE, "force +mlook"); cl_freelook = Cvar_Get ("freelook", "0", CVAR_ARCHIVE, NULL, "force +mlook");
m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, NULL,
"mouse pitch (up/down) multipier"); "mouse pitch (up/down) multipier");
m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_NONE, m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_NONE, NULL,
"mouse yaw (left/right) multiplier"); "mouse yaw (left/right) multiplier");
m_forward = Cvar_Get ("m_forward", "1", CVAR_NONE, m_forward = Cvar_Get ("m_forward", "1", CVAR_NONE, NULL,
"mouse forward/back speed"); "mouse forward/back speed");
m_side = Cvar_Get ("m_side", "0.8", CVAR_NONE, "mouse strafe speed"); m_side = Cvar_Get ("m_side", "0.8", CVAR_NONE, NULL, "mouse strafe speed");
rcon_password = Cvar_Get ("rcon_password", "", CVAR_NONE, rcon_password = Cvar_Get ("rcon_password", "", CVAR_NONE, NULL,
"remote control password"); "remote control password");
rcon_address = Cvar_Get ("rcon_address", "", CVAR_NONE, rcon_address = Cvar_Get ("rcon_address", "", CVAR_NONE, NULL,
"server IP address when client not connected - for sending rcon commands"); "server IP address when client not connected - for sending rcon commands");
cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, "write config files?"); cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, NULL, "write config files?");
cl_predict_players2 = Cvar_Get ("cl_predict_players2", "1", CVAR_NONE, cl_predict_players2 = Cvar_Get ("cl_predict_players2", "1", CVAR_NONE, NULL,
"If this and cl_predict_players is 0, no player prediction is done"); "If this and cl_predict_players is 0, no player prediction is done");
cl_predict_players = Cvar_Get ("cl_predict_players", "1", CVAR_NONE, cl_predict_players = Cvar_Get ("cl_predict_players", "1", CVAR_NONE, NULL,
"If this and cl_predict_players2 is 0, no player prediction is done"); "If this and cl_predict_players2 is 0, no player prediction is done");
cl_solid_players = Cvar_Get ("cl_solid_players", "1", CVAR_NONE, cl_solid_players = Cvar_Get ("cl_solid_players", "1", CVAR_NONE, NULL,
"Are players solid? If off, you can walk through them with difficulty"); "Are players solid? If off, you can walk through them with difficulty");
localid = Cvar_Get ("localid", "", CVAR_NONE, localid = Cvar_Get ("localid", "", CVAR_NONE, NULL,
"FIXME: This has something to do with client authentication. No Description"); "FIXME: This has something to do with client authentication. No Description");
// //
// info mirrors // info mirrors
// //
name = Cvar_Get ("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO, name = Cvar_Get ("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
"Player name"); "Player name");
password = Cvar_Get ("password", "", CVAR_USERINFO, "Server password"); password = Cvar_Get ("password", "", CVAR_USERINFO, NULL, "Server password");
spectator = Cvar_Get ("spectator", "", CVAR_USERINFO, spectator = Cvar_Get ("spectator", "", CVAR_USERINFO, NULL,
"Set to 1 before connecting to become a spectator"); "Set to 1 before connecting to become a spectator");
team = Cvar_Get ("team", "", CVAR_ARCHIVE | CVAR_USERINFO, team = Cvar_Get ("team", "", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
"Team player is on."); "Team player is on.");
rate = Cvar_Get ("rate", "2500", CVAR_ARCHIVE | CVAR_USERINFO, rate = Cvar_Get ("rate", "2500", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
"Amount of bytes per second server will send/download to you"); "Amount of bytes per second server will send/download to you");
msg = Cvar_Get ("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, "Determines the type of messages reported 0 is maximum, 4 is none"); msg = Cvar_Get ("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Determines the type of messages reported 0 is maximum, 4 is none");
noaim = Cvar_Get ("noaim", "0", CVAR_ARCHIVE | CVAR_USERINFO, noaim = Cvar_Get ("noaim", "0", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
"Auto aim off switch. Set to 1 to turn off."); "Auto aim off switch. Set to 1 to turn off.");
} }
@ -1384,13 +1416,15 @@ Host_WriteConfiguration (void)
/* /*
Host_SimulationTime Host_SimulationTime
This determines if enough time has passed to run a simulation frame This determines if enough time has passed to run a simulation frame, or
returns the amount of time that has to be waited
*/ */
static inline qboolean static inline float
Host_SimulationTime (float time) Host_SimulationTime (float time)
{ {
float fps; float fps;
float timescale = 1.0; float timescale = 1.0;
float timedifference;
if (cls.demoplayback) { if (cls.demoplayback) {
timescale = max (0, cl_demospeed->value); timescale = max (0, cl_demospeed->value);
@ -1406,9 +1440,11 @@ Host_SimulationTime (float time)
else else
fps = bound (30, rate->value / 80.0, 72); fps = bound (30, rate->value / 80.0, 72);
if (!cls.timedemo && ((realtime - oldrealtime) < (timescale / fps))) timedifference = (timescale / fps) - (realtime - oldrealtime);
return false; // framerate is too high
return true; if (!cls.timedemo && (timedifference > 0))
return timedifference; // framerate is too high
return 0;
} }
/* /*
@ -1424,13 +1460,19 @@ Host_Frame (float time)
static double time2 = 0; static double time2 = 0;
static double time3 = 0; static double time3 = 0;
int pass1, pass2, pass3; int pass1, pass2, pass3;
float sleeptime;
if (setjmp (host_abort)) // something bad happened, or the server disconnected if (setjmp (host_abort)) // something bad happened, or the server disconnected
return; return;
// decide the simulation time // decide the simulation time
if (!Host_SimulationTime (time)) if ((sleeptime = Host_SimulationTime (time)) != 0) {
#ifdef HAVE_USLEEP
if (sleeptime > 0.01) // minimum sleep time
usleep((unsigned long)((sleeptime - 0.001) * 1000000));
#endif
return; // framerate is too high return; // framerate is too high
}
host_frametime = realtime - oldrealtime; host_frametime = realtime - oldrealtime;
oldrealtime = realtime; oldrealtime = realtime;
@ -1455,20 +1497,21 @@ Host_Frame (float time)
// resend a connection request if necessary // resend a connection request if necessary
if (cls.state == ca_disconnected) { if (cls.state == ca_disconnected) {
CL_CheckForResend (); CL_CheckForResend ();
} else } else {
CL_SendCmd (); CL_SendCmd ();
// Set up prediction for other players // Set up prediction for other players
CL_SetUpPlayerPrediction (false); CL_SetUpPlayerPrediction (false);
// do client side motion prediction // do client side motion prediction
CL_PredictMove (); CL_PredictMove ();
// Set up prediction for other players // Set up prediction for other players
CL_SetUpPlayerPrediction (true); CL_SetUpPlayerPrediction (true);
// build a refresh entity list // build a refresh entity list
CL_EmitEntities (); CL_EmitEntities ();
}
// update video // update video
if (host_speeds->int_val) if (host_speeds->int_val)
@ -1558,7 +1601,7 @@ Host_Init (void)
// only reads from within the quake file system, and changing that is // only reads from within the quake file system, and changing that is
// probably Not A Good Thing (tm). // probably Not A Good Thing (tm).
fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG, fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG,
CVAR_ROM, "global configuration file"); CVAR_ROM, NULL, "global configuration file");
Cmd_Exec_File (fs_globalcfg->string); Cmd_Exec_File (fs_globalcfg->string);
Cbuf_Execute_Sets (); Cbuf_Execute_Sets ();
@ -1567,7 +1610,7 @@ Host_Init (void)
Cbuf_Execute_Sets (); Cbuf_Execute_Sets ();
fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG, fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG,
CVAR_ROM, "user configuration file"); CVAR_ROM, NULL, "user configuration file");
Cmd_Exec_File (fs_usercfg->string); Cmd_Exec_File (fs_usercfg->string);
Cbuf_Execute_Sets (); Cbuf_Execute_Sets ();
@ -1606,7 +1649,6 @@ Host_Init (void)
W_LoadWadFile ("gfx.wad"); W_LoadWadFile ("gfx.wad");
Key_Init (); Key_Init ();
Con_Init (); Con_Init ();
M_Init ();
Mod_Init (); Mod_Init ();
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n"); // Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
@ -1624,6 +1666,7 @@ Host_Init (void)
CDAudio_Init (); CDAudio_Init ();
VID_Init (host_basepal); VID_Init (host_basepal);
IN_Init (); IN_Init ();
M_Init ();
Draw_Init (); Draw_Init ();
SCR_Init (); SCR_Init ();
R_Init (); R_Init ();
@ -1648,6 +1691,7 @@ Host_Init (void)
Skin_Init (); Skin_Init ();
CL_Init (); CL_Init ();
IN_Init (); IN_Init ();
M_Init ();
#endif #endif
// Reparse the command line for + commands. // Reparse the command line for + commands.

View file

@ -273,6 +273,8 @@ Model_NextDownload (void)
return; // started a download return; // started a download
} }
Netchan_AckPacket (&cls.netchan);
for (i = 1; i < MAX_MODELS; i++) { for (i = 1; i < MAX_MODELS; i++) {
if (!cl.model_name[i][0]) if (!cl.model_name[i][0])
break; break;
@ -334,6 +336,8 @@ Sound_NextDownload (void)
return; // started a download return; // started a download
} }
Netchan_AckPacket (&cls.netchan);
for (i = 1; i < MAX_SOUNDS; i++) { for (i = 1; i < MAX_SOUNDS; i++) {
if (!cl.sound_name[i][0]) if (!cl.sound_name[i][0])
break; break;
@ -629,7 +633,7 @@ CL_ParseServerData (void)
// game directory // game directory
str = MSG_ReadString (); str = MSG_ReadString ();
if (stricmp (gamedirfile, str)) { if (strcasecmp (gamedirfile, str)) {
// save current config // save current config
Host_WriteConfiguration (); Host_WriteConfiguration ();
cflag = true; cflag = true;
@ -1030,7 +1034,8 @@ CL_SetInfo (void)
Con_DPrintf ("SETINFO %s: %s=%s\n", player->name, key, value); Con_DPrintf ("SETINFO %s: %s=%s\n", player->name, key, value);
Info_SetValueForKey (player->userinfo, key, value, MAX_INFO_STRING); Info_SetValueForKey (player->userinfo, key, value, MAX_INFO_STRING,
(!strequal (key, "name"))| (strequal (key, "team") << 1));
CL_ProcessUserInfo (slot, player); CL_ProcessUserInfo (slot, player);
} }
@ -1051,7 +1056,8 @@ CL_ServerInfo (void)
Con_DPrintf ("SERVERINFO: %s=%s\n", key, value); Con_DPrintf ("SERVERINFO: %s=%s\n", key, value);
Info_SetValueForKey (cl.serverinfo, key, value, MAX_SERVERINFO_STRING); Info_SetValueForKey (cl.serverinfo, key, value, MAX_SERVERINFO_STRING,
(!strequal (key, "name"))| (strequal (key, "team") << 1));
} }
/* /*

View file

@ -38,10 +38,13 @@
#include "commdef.h" #include "commdef.h"
#include "console.h" #include "console.h"
#include "cvar.h" #include "cvar.h"
#include "keys.h"
#include "mathlib.h"
#include "pmove.h" #include "pmove.h"
cvar_t *cl_nopred; cvar_t *cl_nopred;
cvar_t *cl_pushlatency; cvar_t *cl_pushlatency;
cvar_t *cl_nostatpred;
extern frame_t *view_frame; extern frame_t *view_frame;
@ -52,6 +55,15 @@ void
CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u, CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
qboolean spectator) qboolean spectator)
{ {
// Dabb: if there is no movement to start with, don't predict...
if(cl_nostatpred->int_val && VectorIsNull(from->velocity)) {
VectorCopy (from->origin, to->origin);
VectorCopy (u->angles, to->viewangles);
VectorCopy (from->velocity, to->velocity);
return;
}
// split up very long moves // split up very long moves
if (u->msec > 50) { if (u->msec > 50) {
player_state_t temp; player_state_t temp;
@ -111,7 +123,8 @@ CL_PredictMove (void)
if (cl.paused) if (cl.paused)
return; return;
cl.onground = 0; // assume on ground unless prediction says different // assume on ground unless prediction says different
cl.onground = 0;
cl.time = realtime - cls.latency - cl_pushlatency->value * 0.001; cl.time = realtime - cls.latency - cl_pushlatency->value * 0.001;
if (cl.time > realtime) if (cl.time > realtime)
@ -133,10 +146,11 @@ CL_PredictMove (void)
from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK]; from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
// we can now render a frame // we can now render a frame
if (cls.state == ca_onserver) { // first update is the final signon if (cls.state == ca_onserver) {
// stage // first update is the final signon stage
VID_SetCaption (cls.servername); VID_SetCaption (cls.servername);
cls.state = ca_active; cls.state = ca_active;
key_dest = key_game;
} }
if (cl_nopred->int_val) { if (cl_nopred->int_val) {
@ -144,6 +158,16 @@ CL_PredictMove (void)
VectorCopy (from->playerstate[cl.playernum].origin, cl.simorg); VectorCopy (from->playerstate[cl.playernum].origin, cl.simorg);
return; return;
} }
// Dabb: if there is no movement to start with, don't predict...
if(cl_nostatpred->int_val
&& VectorIsNull(from->playerstate[cl.playernum].velocity)) {
VectorCopy (from->playerstate[cl.playernum].velocity, cl.simvel);
VectorCopy (from->playerstate[cl.playernum].origin, cl.simorg);
return;
}
// predict forward until cl.time <= to->senttime // predict forward until cl.time <= to->senttime
oldphysent = pmove.numphysent; oldphysent = pmove.numphysent;
CL_SetSolidPlayers (cl.playernum); CL_SetSolidPlayers (cl.playernum);
@ -153,8 +177,8 @@ CL_PredictMove (void)
for (i = 1; i < UPDATE_BACKUP - 1 && cls.netchan.incoming_sequence + i < for (i = 1; i < UPDATE_BACKUP - 1 && cls.netchan.incoming_sequence + i <
cls.netchan.outgoing_sequence; i++) { cls.netchan.outgoing_sequence; i++) {
to = &cl.frames[(cls.netchan.incoming_sequence + i) & UPDATE_MASK]; to = &cl.frames[(cls.netchan.incoming_sequence + i) & UPDATE_MASK];
CL_PredictUsercmd (&from->playerstate[cl.playernum] CL_PredictUsercmd (&from->playerstate[cl.playernum],
, &to->playerstate[cl.playernum], &to->cmd, &to->playerstate[cl.playernum], &to->cmd,
cl.spectator); cl.spectator);
cl.onground = onground; cl.onground = onground;
if (to->senttime >= cl.time) if (to->senttime >= cl.time)
@ -171,21 +195,13 @@ CL_PredictMove (void)
// now interpolate some fraction of the final frame // now interpolate some fraction of the final frame
if (to->senttime == from->senttime) if (to->senttime == from->senttime)
f = 0; f = 0;
else { else
f = (cl.time - from->senttime) / (to->senttime - from->senttime); f = bound(0, (cl.time - from->senttime) / (to->senttime - from->senttime), 1);
if (f < 0)
f = 0;
if (f > 1)
f = 1;
}
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
if (fabs if (fabs(from->playerstate[cl.playernum].origin[i] -
(from->playerstate[cl.playernum].origin[i] - to->playerstate[cl.playernum].origin[i]) > 128) {
to->playerstate[cl.playernum].origin[i]) > 128) { // teleported, // teleported, so don't lerp
// so don't
// lerp
VectorCopy (to->playerstate[cl.playernum].velocity, cl.simvel); VectorCopy (to->playerstate[cl.playernum].velocity, cl.simvel);
VectorCopy (to->playerstate[cl.playernum].origin, cl.simorg); VectorCopy (to->playerstate[cl.playernum].origin, cl.simorg);
return; return;
@ -209,6 +225,7 @@ void
CL_Prediction_Init_Cvars (void) CL_Prediction_Init_Cvars (void)
{ {
/* I'm not totally sure what cl_pushlatency is for. Or if it is SUPPOSED TO BE SETTABLE. */ /* I'm not totally sure what cl_pushlatency is for. Or if it is SUPPOSED TO BE SETTABLE. */
cl_pushlatency = Cvar_Get ("pushlatency", "-999", CVAR_NONE, "How much prediction should the client make"); cl_pushlatency = Cvar_Get ("pushlatency", "-999", CVAR_NONE, NULL, "How much prediction should the client make");
cl_nopred = Cvar_Get ("cl_nopred", "0", CVAR_NONE, "Set to turn off client prediction"); cl_nopred = Cvar_Get ("cl_nopred", "0", CVAR_NONE, NULL, "Set to turn off client prediction");
cl_nostatpred = Cvar_Get ("cl_nostatpred", "0", CVAR_NONE, NULL, "Set to turn off static player prediction");
} }

View file

@ -26,20 +26,21 @@
$Id$ $Id$
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <io.h> #ifdef HAVE_IO_H
#include <conio.h> # include <io.h>
#endif
#ifdef HAVE_CONIO_H
# include <conio.h>
#endif
#ifndef _WIN32 #ifndef _WIN32
# include <unistd.h> # include <unistd.h>
@ -53,113 +54,54 @@
# include <sys/mman.h> # include <sys/mman.h>
#endif #endif
#include <SDL.H> #include <SDL.h>
#include <SDL_main.H> #include <SDL_main.h>
#include "cvar.h"
#include "sys.h" #include "sys.h"
#include "qargs.h" #include "qargs.h"
#include "qargs.h" #include "qargs.h"
#include "client.h" #include "client.h"
#include "compat.h"
#include "host.h" #include "host.h"
qboolean is_server = false; qboolean is_server = false;
char *svs_info; char *svs_info;
int starttime; int starttime;
int noconinput;
#ifdef _WIN32 #ifdef _WIN32
# include "winquake.h" # include "winquake.h"
// fixme: minimized is not currently supported under // FIXME: minimized is not currently supported under
// SDL // SDL
qboolean Minimized = false; qboolean Minimized = false;
void MaskExceptions (void); void MaskExceptions (void);
#endif #endif
void
Sys_DebugLog (char *file, char *fmt, ...)
{
int fd;
static char data[1024]; // why static ?
va_list argptr;
va_start (argptr, fmt);
vsnprintf (data, sizeof (data), fmt, argptr);
va_end (argptr);
fd = open (file, O_WRONLY | O_CREAT | O_APPEND, 0666);
write (fd, data, strlen (data));
close (fd);
};
/* /*
FILE IO Sys_Init_Cvars
*/
int Quake calls this so the system can register variables before host_hunklevel
Sys_FileTime (char *path) is marked
{
QFile *f;
int t, retval;
f = Qopen (path, "rb");
if (f) {
Qclose (f);
retval = 1;
} else {
retval = -1;
}
return retval;
}
/*
SYSTEM IO
*/
/*
Sys_MakeCodeWriteable
*/ */
void void
Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) Sys_Init_Cvars (void)
{ {
sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, NULL,
#ifdef _WIN32 "set to disable std out");
DWORD flOldProtect; if (COM_CheckParm ("-nostdout"))
Cvar_Set (sys_nostdout, "1");
// copy on write or just read-write?
if (!VirtualProtect
((LPVOID) startaddr, length, PAGE_READWRITE,
&flOldProtect)) Sys_Error ("Protection change failed\n");
#else
int r;
unsigned long addr;
int psize = getpagesize ();
addr = (startaddr & ~(psize - 1)) - psize;
// fprintf(stderr, "writable code %lx(%lx)-%lx, length=%lx\n", startaddr,
// addr, startaddr+length, length);
r = mprotect ((char *) addr, length + startaddr - addr + psize, 7);
if (r < 0)
Sys_Error ("Protection change failed\n");
#endif
} }
/*
Sys_Init
*/
void void
Sys_Init (void) Sys_Init (void)
{ {
#ifdef WIN32 #ifdef WIN32
OSVERSIONINFO vinfo; OSVERSIONINFO vinfo;
#endif #endif
#ifdef USE_INTEL_ASM #ifdef USE_INTEL_ASM
#ifdef _WIN32 #ifdef _WIN32
MaskExceptions (); MaskExceptions ();
@ -185,9 +127,22 @@ Sys_Init (void)
#endif #endif
} }
/*
Sys_Quit
*/
void void
Sys_Error (char *error, ...) Sys_Quit (void)
{
Host_Shutdown ();
exit (0);
}
/*
Sys_Error
*/
void
Sys_Error (const char *error, ...)
{ {
va_list argptr; va_list argptr;
char text[1024]; char text[1024];
@ -208,43 +163,56 @@ Sys_Error (char *error, ...)
exit (1); exit (1);
} }
void
Sys_Quit (void)
{
Host_Shutdown ();
exit (0);
}
char *
void
Sys_DebugLog (const char *file, const char *fmt, ...)
{
int fd;
static char data[1024]; // why static ?
va_list argptr;
va_start (argptr, fmt);
vsnprintf (data, sizeof (data), fmt, argptr);
va_end (argptr);
fd = open (file, O_WRONLY | O_CREAT | O_APPEND, 0666);
write (fd, data, strlen (data));
close (fd);
};
/*
Sys_ConsoleInput
Checks for a complete line of text typed in at the console, then forwards
it to the host command processor
*/
const char *
Sys_ConsoleInput (void) Sys_ConsoleInput (void)
{ {
return NULL; return NULL;
} }
void void
Sys_Sleep (void) Sys_Sleep (void)
{ {
} }
void #ifndef SDL_main
Sys_Init_Cvars (void) # define SDL_main main
{ #endif
sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, "Set to disable std out");
if (COM_CheckParm ("-nostdout"))
Cvar_Set (sys_nostdout, "1");
}
C_LINKAGE int /*
main
*/
int
SDL_main (int c, char **v) SDL_main (int c, char **v)
{ {
double time, oldtime, newtime; double time, oldtime, newtime;
int j; int j;
static char cwd[1024];
int t;
#ifndef WIN32 #ifndef WIN32
signal (SIGFPE, SIG_IGN); signal (SIGFPE, SIG_IGN);
#endif #endif
@ -255,7 +223,7 @@ SDL_main (int c, char **v)
host_parms.argc = com_argc; host_parms.argc = com_argc;
host_parms.argv = com_argv; host_parms.argv = com_argv;
host_parms.memsize = 8 * 1024 * 1024; host_parms.memsize = 16 * 1024 * 1024; // 16MB default heap
j = COM_CheckParm ("-mem"); j = COM_CheckParm ("-mem");
if (j) if (j)
@ -266,6 +234,7 @@ SDL_main (int c, char **v)
printf ("Can't allocate memory for zone.\n"); printf ("Can't allocate memory for zone.\n");
return 1; return 1;
} }
#ifndef WIN32 #ifndef WIN32
noconinput = COM_CheckParm ("-noconinput"); noconinput = COM_CheckParm ("-noconinput");
if (!noconinput) if (!noconinput)
@ -276,17 +245,16 @@ SDL_main (int c, char **v)
oldtime = Sys_DoubleTime (); oldtime = Sys_DoubleTime ();
while (1) { while (1) {
// find time spent rendering last frame // find time spent rendering last frame
newtime = Sys_DoubleTime (); newtime = Sys_DoubleTime ();
time = newtime - oldtime; time = newtime - oldtime;
Host_Frame (time); Host_Frame (time);
oldtime = newtime; oldtime = newtime;
} }
} }
/* fixme: evil stub for directsound crap */ void
IN_Accumulate (void) IN_Accumulate (void)
{ {
} }

View file

@ -45,39 +45,28 @@
#include <sys/mman.h> #include <sys/mman.h>
#include "cvar.h" #include "cvar.h"
#include "host.h"
#include "qargs.h" #include "qargs.h"
#include "sys.h" #include "sys.h"
#include "host.h"
#include "net.h"
int noconinput = 0; int noconinput = 0;
qboolean is_server = false; qboolean is_server = false;
char *svs_info; char *svs_info;
#ifdef PACKET_LOGGING
void Net_LogStop (void);
#endif
// ======================================================================= /*
// General routines Sys_Init_Cvars
// =======================================================================
void
Sys_Quit (void)
{
Host_Shutdown ();
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
#ifdef PACKET_LOGGING
Net_LogStop();
#endif
exit (0);
}
Quake calls this so the system can register variables before host_hunklevel
is marked
*/
void void
Sys_Init_Cvars (void) Sys_Init_Cvars (void)
{ {
sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, "set to disable std out"); sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, NULL,
"set to disable std out");
if (COM_CheckParm ("-nostdout")) if (COM_CheckParm ("-nostdout"))
Cvar_Set (sys_nostdout, "1"); Cvar_Set (sys_nostdout, "1");
} }
@ -90,8 +79,25 @@ Sys_Init (void)
#endif #endif
} }
/*
Sys_Quit
*/
void void
Sys_Error (char *error, ...) Sys_Quit (void)
{
Host_Shutdown ();
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~O_NONBLOCK);
//Net_LogStop();
exit (0);
}
/*
Sys_Error
*/
void
Sys_Error (const char *error, ...)
{ {
va_list argptr; va_list argptr;
char string[1024]; char string[1024];
@ -106,7 +112,6 @@ Sys_Error (char *error, ...)
Host_Shutdown (); Host_Shutdown ();
exit (1); exit (1);
} }
void void
@ -122,7 +127,7 @@ Sys_Warn (char *warning, ...)
} }
void void
Sys_DebugLog (char *file, char *fmt, ...) Sys_DebugLog (const char *file, const char *fmt, ...)
{ {
va_list argptr; va_list argptr;
static char data[1024]; // why static ? static char data[1024]; // why static ?
@ -131,20 +136,28 @@ Sys_DebugLog (char *file, char *fmt, ...)
va_start (argptr, fmt); va_start (argptr, fmt);
vsnprintf (data, sizeof (data), fmt, argptr); vsnprintf (data, sizeof (data), fmt, argptr);
va_end (argptr); va_end (argptr);
// fd = open(file, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, 0666); // fd = open(file, O_WRONLY | O_BINARY | O_CREAT | O_APPEND, 0666);
fd = open (file, O_WRONLY | O_CREAT | O_APPEND, 0666); fd = open (file, O_WRONLY | O_CREAT | O_APPEND, 0666);
write (fd, data, strlen (data)); write (fd, data, strlen (data));
close (fd); close (fd);
} }
void void
floating_point_exception_handler (int whatever) floating_point_exception_handler (int whatever)
{ {
// Sys_Warn("floating point exception\n"); // Sys_Warn("floating point exception\n");
signal (SIGFPE, floating_point_exception_handler); signal (SIGFPE, floating_point_exception_handler);
} }
char *
/*
Sys_ConsoleInput
Checks for a complete line of text typed in at the console, then forwards
it to the host command processor
*/
const char *
Sys_ConsoleInput (void) Sys_ConsoleInput (void)
{ {
#if 0 #if 0
@ -163,12 +176,14 @@ Sys_ConsoleInput (void)
return NULL; return NULL;
} }
#ifndef USE_INTEL_ASM #ifndef USE_INTEL_ASM
void void
Sys_HighFPPrecision (void) Sys_HighFPPrecision (void)
{ {
} }
void void
Sys_LowFPPrecision (void) Sys_LowFPPrecision (void)
{ {
@ -177,15 +192,18 @@ Sys_LowFPPrecision (void)
int skipframes; int skipframes;
/*
main
*/
int int
main (int c, char **v) main (int c, char *v[])
{ {
double time, oldtime, newtime; double time, oldtime, newtime;
int j; int j;
// static char cwd[1024]; // static char cwd[1024];
// signal(SIGFPE, floating_point_exception_handler); // signal(SIGFPE, floating_point_exception_handler);
signal (SIGFPE, SIG_IGN); signal (SIGFPE, SIG_IGN);
memset (&host_parms, 0, sizeof (host_parms)); memset (&host_parms, 0, sizeof (host_parms));
@ -194,12 +212,13 @@ main (int c, char **v)
host_parms.argc = com_argc; host_parms.argc = com_argc;
host_parms.argv = com_argv; host_parms.argv = com_argv;
host_parms.memsize = 8 * 1024 * 1024; // 8MB default heap host_parms.memsize = 16 * 1024 * 1024; // 16MB default heap
j = COM_CheckParm ("-mem"); j = COM_CheckParm ("-mem");
if (j) if (j)
host_parms.memsize = (int) (atof (com_argv[j + 1]) * 1024 * 1024); host_parms.memsize = (int) (atof (com_argv[j + 1]) * 1024 * 1024);
host_parms.membase = malloc (host_parms.memsize); host_parms.membase = malloc (host_parms.memsize);
if (!host_parms.membase) { if (!host_parms.membase) {
printf ("Can't allocate memory for zone.\n"); printf ("Can't allocate memory for zone.\n");
return 1; return 1;
@ -221,27 +240,3 @@ main (int c, char **v)
oldtime = newtime; oldtime = newtime;
} }
} }
/*
Sys_MakeCodeWriteable
*/
void
Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
{
int r;
unsigned long addr;
int psize = getpagesize ();
addr = (startaddr & ~(psize - 1)) - psize;
// fprintf(stderr, "writable code %lx(%lx)-%lx, length=%lx\n", startaddr,
// addr, startaddr+length, length);
r = mprotect ((char *) addr, length + startaddr - addr + psize, 7);
if (r < 0)
Sys_Error ("Protection change failed\n");
}

View file

@ -38,16 +38,20 @@
#include <conio.h> #include <conio.h>
#include <windows.h> #include <windows.h>
#include "client.h"
#include "console.h" #include "console.h"
#include "host.h" #include "cvar.h"
#include "qargs.h" #include "qargs.h"
#include "resource.h"
#include "screen.h" #include "screen.h"
#include "sound.h" #include "sound.h"
#include "sys.h" #include "sys.h"
#include "vid.h" #include "vid.h"
#include "client.h"
#include "compat.h"
#include "host.h"
#include "net.h"
#include "resource.h"
qboolean is_server = false; qboolean is_server = false;
char *svs_info; char *svs_info;
@ -78,92 +82,18 @@ void MaskExceptions (void);
void Sys_PopFPCW (void); void Sys_PopFPCW (void);
void Sys_PushFPCW_SetHigh (void); void Sys_PushFPCW_SetHigh (void);
void
Sys_DebugLog (char *file, char *fmt, ...)
{
va_list argptr;
static char data[1024];
int fd;
va_start (argptr, fmt);
vsnprintf (data, sizeof (data), fmt, argptr);
va_end (argptr);
fd = open (file, O_WRONLY | O_CREAT | O_APPEND, 0666);
write (fd, data, strlen (data));
close (fd);
};
/* /*
FILE IO Sys_Init_Cvars
Quake calls this so the system can register variables before host_hunklevel
is marked
*/ */
/*
wfilelength
*/
int
wfilelength (QFile *f)
{
int pos;
int end;
pos = Qtell (f);
Qseek (f, 0, SEEK_END);
end = Qtell (f);
Qseek (f, pos, SEEK_SET);
return end;
}
int
Sys_FileTime (char *path)
{
QFile *f;
int t, retval;
t = VID_ForceUnlockedAndReturnState ();
f = Qopen (path, "rb");
if (f) {
Qclose (f);
retval = 1;
} else {
retval = -1;
}
VID_ForceLockState (t);
return retval;
}
/*
SYSTEM IO
*/
/*
Sys_MakeCodeWriteable
*/
void
Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
{
DWORD flOldProtect;
//@@@ copy on write or just read-write?
if (!VirtualProtect
((LPVOID) startaddr, length, PAGE_READWRITE,
&flOldProtect)) Sys_Error ("Protection change failed\n");
}
/*
Sys_Init
*/
void void
Sys_Init_Cvars (void) Sys_Init_Cvars (void)
{ {
sys_nostdout = Cvar_Get ("sys_nostdout", "1", CVAR_NONE, "unset to enable std out - windows does NOT support this"); sys_nostdout = Cvar_Get ("sys_nostdout", "1", CVAR_NONE, NULL,
"unset to enable std out - windows does NOT support this");
} }
void void
@ -213,9 +143,32 @@ Sys_Init (void)
WinNT = false; WinNT = false;
} }
/*
Sys_Quit
*/
void void
Sys_Error (char *error, ...) Sys_Quit (void)
{
VID_ForceUnlockedAndReturnState ();
Host_Shutdown ();
if (tevent)
CloseHandle (tevent);
if (qwclsemaphore)
CloseHandle (qwclsemaphore);
//Net_LogStop();
exit (0);
}
/*
Sys_Error
*/
void
Sys_Error (const char *error, ...)
{ {
va_list argptr; va_list argptr;
char text[1024]; // , text2[1024]; char text[1024]; // , text2[1024];
@ -236,28 +189,42 @@ Sys_Error (char *error, ...)
} }
void void
Sys_Quit (void) Sys_DebugLog (const char *file, const char *fmt, ...)
{ {
VID_ForceUnlockedAndReturnState (); va_list argptr;
static char data[1024];
int fd;
Host_Shutdown (); va_start (argptr, fmt);
vsnprintf (data, sizeof (data), fmt, argptr);
va_end (argptr);
fd = open (file, O_WRONLY | O_CREAT | O_APPEND, 0666);
write (fd, data, strlen (data));
close (fd);
};
if (tevent)
CloseHandle (tevent);
if (qwclsemaphore) int
CloseHandle (qwclsemaphore); wfilelength (QFile *f)
{
int pos;
int end;
#ifdef PACKET_LOGGING pos = Qtell (f);
Net_LogStop(); Qseek (f, 0, SEEK_END);
#endif end = Qtell (f);
Qseek (f, pos, SEEK_SET);
exit (0); return end;
} }
/*
Sys_ConsoleInput
Checks for a complete line of text typed in at the console, then forwards
char * it to the host command processor
*/
const char *
Sys_ConsoleInput (void) Sys_ConsoleInput (void)
{ {
static char text[256]; static char text[256];
@ -362,7 +329,6 @@ Sys_ConsoleInput (void)
} }
} }
} }
return NULL; return NULL;
} }
@ -371,6 +337,13 @@ Sys_Sleep (void)
{ {
} }
void
SleepUntilInput (int time)
{
MsgWaitForMultipleObjects (1, &tevent, FALSE, time, QS_ALLINPUT);
}
void void
IN_SendKeyEvents (void) IN_SendKeyEvents (void)
@ -389,37 +362,20 @@ IN_SendKeyEvents (void)
} }
/*
WINDOWS CRAP
*/
/*
WinMain
*/
void
SleepUntilInput (int time)
{
MsgWaitForMultipleObjects (1, &tevent, FALSE, time, QS_ALLINPUT);
}
/*
WinMain
*/
HINSTANCE global_hInstance; HINSTANCE global_hInstance;
int global_nCmdShow; int global_nCmdShow;
char *argv[MAX_NUM_ARGVS]; char *argv[MAX_NUM_ARGVS];
static char *empty_string = ""; static char *empty_string = "";
/*
main
*/
int WINAPI int WINAPI
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow) int nCmdShow)
{ {
// MSG msg; // MSG msg;
double time, oldtime, newtime; double time, oldtime, newtime;
MEMORYSTATUS lpBuffer; MEMORYSTATUS lpBuffer;
static char cwd[1024]; static char cwd[1024];
@ -462,7 +418,6 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
*lpCmdLine = 0; *lpCmdLine = 0;
lpCmdLine++; lpCmdLine++;
} }
} }
} }
@ -523,10 +478,10 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
if (!tevent) if (!tevent)
Sys_Error ("Couldn't create event"); Sys_Error ("Couldn't create event");
// because sound is off until we become active // because sound is off until we become active
S_BlockSound (); //XXX S_BlockSound ();
Sys_Printf ("Host_Init\n"); //Sys_Printf ("Host_Init\n");
Host_Init (); Host_Init ();
oldtime = Sys_DoubleTime (); oldtime = Sys_DoubleTime ();

View file

@ -306,6 +306,8 @@ Cmd_Exec_File (char *path)
int len; int len;
QFile *file; QFile *file;
if (!path || !*path)
return;
if ((file = Qopen (path, "r")) != NULL) { if ((file = Qopen (path, "r")) != NULL) {
len = COM_filelength (file); len = COM_filelength (file);
f = (char *) Hunk_TempAlloc (len + 1); f = (char *) Hunk_TempAlloc (len + 1);

View file

@ -113,5 +113,5 @@ COM_Init (void)
void void
COM_Init_Cvars (void) COM_Init_Cvars (void)
{ {
registered = Cvar_Get ("registered", "0", CVAR_NONE, "Is the game the registered version. 1 yes 0 no"); registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL, "Is the game the registered version. 1 yes 0 no");
} }

View file

@ -266,7 +266,7 @@ Con_Init (void)
void void
Con_Init_Cvars (void) Con_Init_Cvars (void)
{ {
con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, "How long in seconds messages are displayed on screen"); con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL, "How long in seconds messages are displayed on screen");
} }

View file

@ -54,13 +54,11 @@
#include <X11/extensions/XShm.h> #include <X11/extensions/XShm.h>
#include <errno.h> #include <errno.h>
#include <limits.h> #include <limits.h>
#include <sys/poll.h>
#ifdef HAVE_VIDMODE #ifdef HAVE_VIDMODE
# include <X11/extensions/xf86vmode.h> # include <X11/extensions/xf86vmode.h>
#endif #endif
#include "commdef.h"
#include "console.h" #include "console.h"
#include "context_x11.h" #include "context_x11.h"
#include "cvar.h" #include "cvar.h"
@ -73,50 +71,51 @@
#include "vid.h" #include "vid.h"
static void (*event_handlers[LASTEvent]) (XEvent *); static void (*event_handlers[LASTEvent]) (XEvent *);
qboolean oktodraw = false; qboolean oktodraw = false;
int x_shmeventtype; int x_shmeventtype;
static int x_disp_ref_count = 0; static int x_disp_ref_count = 0;
Display *x_disp = NULL; Display *x_disp = NULL;
int x_screen; int x_screen;
Window x_root = None; Window x_root = None;
XVisualInfo *x_visinfo; XVisualInfo *x_visinfo;
Visual *x_vis; Visual *x_vis;
Window x_win; Window x_win;
Cursor nullcursor = None; Cursor nullcursor = None;
static Atom aWMDelete = 0; static Atom aWMDelete = 0;
#define X_MASK (VisibilityChangeMask | StructureNotifyMask | ExposureMask) #define X_MASK (VisibilityChangeMask | StructureNotifyMask | ExposureMask)
#ifdef HAVE_VIDMODE #ifdef HAVE_VIDMODE
static XF86VidModeModeInfo **vidmodes; static XF86VidModeModeInfo **vidmodes;
static int nummodes; static int nummodes;
static int original_mode = 0;
static int screen_width; static double x_gamma;
static int screen_height; static qboolean vidmode_avail = false;
static int original_mode;
#endif #endif
static qboolean vidmode_avail = false;
static qboolean vidmode_active = false; static qboolean vidmode_active = false;
cvar_t *vid_fullscreen; cvar_t *vid_fullscreen;
qboolean vid_fullscreen_active; cvar_t *vid_system_gamma;
qboolean vid_fullscreen_active;
extern qboolean vid_gamma_avail;
static int xss_timeout; static int xss_timeout;
static int xss_interval; static int xss_interval;
static int xss_blanking; static int xss_blanking;
static int xss_exposures; static int xss_exposures;
qboolean qboolean
x11_add_event (int event, void (*event_handler) (XEvent *)) X11_AddEvent (int event, void (*event_handler) (XEvent *))
{ {
if (event >= LASTEvent) { if (event >= LASTEvent) {
printf ("event: %d, LASTEvent: %d\n", event, LASTEvent); printf ("event: %d, LASTEvent: %d\n", event, LASTEvent);
return false; return false;
} }
if (event_handlers[event] != NULL)
if (event_handlers[event])
return false; return false;
event_handlers[event] = event_handler; event_handlers[event] = event_handler;
@ -124,10 +123,11 @@ x11_add_event (int event, void (*event_handler) (XEvent *))
} }
qboolean qboolean
x11_del_event (int event, void (*event_handler) (XEvent *)) X11_RemoveEvent (int event, void (*event_handler) (XEvent *))
{ {
if (event >= LASTEvent) if (event >= LASTEvent)
return false; return false;
if (event_handlers[event] != event_handler) if (event_handlers[event] != event_handler)
return false; return false;
@ -136,7 +136,7 @@ x11_del_event (int event, void (*event_handler) (XEvent *))
} }
void void
x11_process_event (void) X11_ProcessEvent (void)
{ {
XEvent x_event; XEvent x_event;
@ -152,11 +152,11 @@ x11_process_event (void)
} }
void void
x11_process_events (void) X11_ProcessEvents (void)
{ {
/* Get events from X server. */ /* Get events from X server. */
while (XPending (x_disp)) { while (XPending (x_disp)) {
x11_process_event (); X11_ProcessEvent ();
} }
} }
@ -176,12 +176,12 @@ TragicDeath (int sig)
} }
void void
x11_open_display (void) X11_OpenDisplay (void)
{ {
if (!x_disp) { if (!x_disp) {
x_disp = XOpenDisplay (NULL); x_disp = XOpenDisplay (NULL);
if (!x_disp) { if (!x_disp) {
Sys_Error ("x11_open_display: Could not open display [%s]\n", Sys_Error ("X11_OpenDisplay: Could not open display [%s]\n",
XDisplayName (NULL)); XDisplayName (NULL));
} }
@ -196,7 +196,7 @@ x11_open_display (void)
signal (SIGTRAP, TragicDeath); signal (SIGTRAP, TragicDeath);
signal (SIGIOT, TragicDeath); signal (SIGIOT, TragicDeath);
signal (SIGBUS, TragicDeath); signal (SIGBUS, TragicDeath);
/* signal(SIGFPE, TragicDeath); */ // signal(SIGFPE, TragicDeath);
signal (SIGSEGV, TragicDeath); signal (SIGSEGV, TragicDeath);
signal (SIGTERM, TragicDeath); signal (SIGTERM, TragicDeath);
@ -210,7 +210,7 @@ x11_open_display (void)
} }
void void
x11_close_display (void) X11_CloseDisplay (void)
{ {
if (nullcursor != None) { if (nullcursor != None) {
XFreeCursor (x_disp, nullcursor); XFreeCursor (x_disp, nullcursor);
@ -224,17 +224,17 @@ x11_close_display (void)
} }
/* /*
x11_create_null_cursor X11_CreateNullCursor
Create an empty cursor Create an empty cursor (in other words, make it disappear)
*/ */
void void
x11_create_null_cursor (void) X11_CreateNullCursor (void)
{ {
Pixmap cursormask; Pixmap cursormask;
XGCValues xgc; XGCValues xgc;
GC gc; GC gc;
XColor dummycolour; XColor dummycolour;
if (nullcursor != None) if (nullcursor != None)
return; return;
@ -257,7 +257,7 @@ x11_create_null_cursor (void)
} }
void void
x11_set_vidmode (int width, int height) X11_SetVidMode (int width, int height)
{ {
const char *str = getenv ("MESA_GLX_FX"); const char *str = getenv ("MESA_GLX_FX");
@ -271,18 +271,23 @@ x11_set_vidmode (int width, int height)
#ifdef HAVE_VIDMODE #ifdef HAVE_VIDMODE
vidmode_avail = VID_CheckVMode (x_disp, NULL, NULL); vidmode_avail = VID_CheckVMode (x_disp, NULL, NULL);
if (vidmode_avail) {
vid_gamma_avail = ((x_gamma = X11_GetGamma ()) > 0);
}
if (vid_fullscreen->int_val && vidmode_avail) { if (vid_fullscreen->int_val && vidmode_avail) {
int i; int i, dotclock;
int best_mode = 0; int best_mode = 0;
qboolean found_mode = false; qboolean found_mode = false;
XF86VidModeModeLine orig_data;
XF86VidModeGetAllModeLines (x_disp, x_screen, &nummodes, &vidmodes); XF86VidModeGetAllModeLines (x_disp, x_screen, &nummodes, &vidmodes);
XF86VidModeGetViewPort (x_disp, x_screen, &screen_width, &screen_height); XF86VidModeGetModeLine (x_disp, x_screen, &dotclock, &orig_data);
for (i = 0; i < nummodes; i++) { for (i = 0; i < nummodes; i++) {
if ((vidmodes[i]->hdisplay == screen_width) && if ((vidmodes[i]->hdisplay == orig_data.hdisplay) &&
(vidmodes[i]->vdisplay == screen_height)) { (vidmodes[i]->vdisplay == orig_data.vdisplay)) {
original_mode = i; original_mode = i;
break; break;
} }
@ -302,25 +307,27 @@ x11_set_vidmode (int width, int height)
XSetScreenSaver (x_disp, 0, xss_interval, xss_blanking, xss_exposures); XSetScreenSaver (x_disp, 0, xss_interval, xss_blanking, xss_exposures);
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]); XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]);
x11_force_view_port (); X11_ForceViewPort ();
vidmode_active = true; vidmode_active = true;
} else { } else {
Con_Printf ("VID: Mode %dx%d can't go fullscreen.\n", vid.width, vid.height); Con_Printf ("VID: Mode %dx%d can't go fullscreen.\n", vid.width, vid.height);
vidmode_avail = vidmode_active = false; vid_gamma_avail = vidmode_avail = vidmode_active = false;
} }
} }
#endif #endif
} }
void void
x11_Init_Cvars (void) X11_Init_Cvars (void)
{ {
vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ROM, vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ROM, NULL,
"Toggles fullscreen game mode"); "Toggles fullscreen game mode");
vid_system_gamma = Cvar_Get ("vid_system_gamma", "0", CVAR_ARCHIVE, NULL,
"Use system gamma control if available");
} }
void void
x11_create_window (int width, int height) X11_CreateWindow (int width, int height)
{ {
XSetWindowAttributes attr; XSetWindowAttributes attr;
XClassHint *ClassHint; XClassHint *ClassHint;
@ -357,7 +364,7 @@ x11_create_window (int width, int height)
XFree (SizeHints); XFree (SizeHints);
} }
// Set window title // Set window title
x11_set_caption (va ("%s %s", PROGRAM, VERSION)); X11_SetCaption (va ("%s %s", PROGRAM, VERSION));
// Set icon name // Set icon name
XSetIconName (x_disp, x_win, PROGRAM); XSetIconName (x_disp, x_win, PROGRAM);
@ -380,7 +387,7 @@ x11_create_window (int width, int height)
XMoveWindow (x_disp, x_win, 0, 0); XMoveWindow (x_disp, x_win, 0, 0);
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0, XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0,
vid.width + 2, vid.height + 2); vid.width + 2, vid.height + 2);
x11_force_view_port (); X11_ForceViewPort ();
} }
XMapWindow (x_disp, x_win); XMapWindow (x_disp, x_win);
@ -391,13 +398,14 @@ x11_create_window (int width, int height)
} }
void void
x11_restore_vidmode (void) X11_RestoreVidMode (void)
{ {
XSetScreenSaver (x_disp, xss_timeout, xss_interval, xss_blanking, XSetScreenSaver (x_disp, xss_timeout, xss_interval, xss_blanking,
xss_exposures); xss_exposures);
#ifdef HAVE_VIDMODE #ifdef HAVE_VIDMODE
if (vidmode_active) { if (vidmode_active) {
X11_RestoreGamma ();
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[original_mode]); XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[original_mode]);
XFree (vidmodes); XFree (vidmodes);
} }
@ -405,7 +413,7 @@ x11_restore_vidmode (void)
} }
void void
x11_grab_keyboard (void) X11_GrabKeyboard (void)
{ {
#ifdef HAVE_VIDMODE #ifdef HAVE_VIDMODE
if (vidmode_active && vid_fullscreen->int_val) { if (vidmode_active && vid_fullscreen->int_val) {
@ -416,14 +424,14 @@ x11_grab_keyboard (void)
} }
void void
x11_set_caption (char *text) X11_SetCaption (char *text)
{ {
if (x_disp && x_win && text) if (x_disp && x_win && text)
XStoreName (x_disp, x_win, text); XStoreName (x_disp, x_win, text);
} }
void void
x11_force_view_port (void) X11_ForceViewPort (void)
{ {
#ifdef HAVE_VIDMODE #ifdef HAVE_VIDMODE
int x, y; int x, y;
@ -431,9 +439,58 @@ x11_force_view_port (void)
if (vidmode_active && vid_fullscreen->int_val) { if (vidmode_active && vid_fullscreen->int_val) {
do { do {
XF86VidModeSetViewPort (x_disp, x_screen, 0, 0); XF86VidModeSetViewPort (x_disp, x_screen, 0, 0);
poll (0, 0, 50); usleep (50);
XF86VidModeGetViewPort (x_disp, x_screen, &x, &y); XF86VidModeGetViewPort (x_disp, x_screen, &x, &y);
} while (x || y); } while (x || y);
} }
#endif #endif
} }
double
X11_GetGamma (void)
{
#ifdef HAVE_VIDMODE
# ifdef X_XF86VidModeGetGamma
XF86VidModeGamma xgamma;
if (vidmode_avail && vid_system_gamma->int_val) {
if (XF86VidModeGetGamma (x_disp, x_screen, &xgamma)) {
return ((xgamma.red + xgamma.green + xgamma.blue) / 3);
}
}
# endif
#endif
return -1.0;
}
qboolean
X11_SetGamma (double gamma)
{
#ifdef HAVE_VIDMODE
# ifdef X_XF86VidModeSetGamma
XF86VidModeGamma xgamma;
if (vid_gamma_avail && vid_system_gamma->int_val) {
xgamma.red = xgamma.green = xgamma.blue = (float) gamma;
if (XF86VidModeSetGamma (x_disp, x_screen, &xgamma))
return true;
}
# endif
#endif
return false;
}
void
X11_RestoreGamma (void)
{
#ifdef HAVE_VIDMODE
# ifdef X_XF86VidModeSetGamma
XF86VidModeGamma xgamma;
if (vid_gamma_avail) {
xgamma.red = xgamma.green = xgamma.blue = (float) x_gamma;
XF86VidModeSetGamma (x_disp, x_screen, &xgamma);
}
# endif
#endif
}

View file

@ -4,7 +4,6 @@
dynamic variable tracking dynamic variable tracking
Copyright (C) 1996-1997 Id Software, Inc. Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors Please see the file "AUTHORS" for a list of contributors
@ -184,6 +183,8 @@ void Cvar_Info (cvar_t *var);
void void
Cvar_Set (cvar_t *var, char *value) Cvar_Set (cvar_t *var, char *value)
{ {
int changed;
if (!var) if (!var)
return; return;
@ -192,6 +193,7 @@ Cvar_Set (cvar_t *var, char *value)
return; return;
} }
changed = !strequal (var->string, value);
free (var->string); // free the old value string free (var->string); // free the old value string
var->string = strdup (value); var->string = strdup (value);
@ -200,6 +202,9 @@ Cvar_Set (cvar_t *var, char *value)
sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]); sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]);
Cvar_Info (var); Cvar_Info (var);
if (changed && var->callback)
var->callback (var);
} }
@ -211,9 +216,12 @@ Cvar_Set (cvar_t *var, char *value)
void void
Cvar_SetROM (cvar_t *var, char *value) Cvar_SetROM (cvar_t *var, char *value)
{ {
int changed;
if (!var) if (!var)
return; return;
changed = !strequal (var->string, value);
free (var->string); // free the old value string free (var->string); // free the old value string
var->string = strdup (value); var->string = strdup (value);
@ -222,6 +230,9 @@ Cvar_SetROM (cvar_t *var, char *value)
sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]); sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]);
Cvar_Info (var); Cvar_Info (var);
if (changed && var->callback)
var->callback (var);
} }
/* /*
@ -310,7 +321,7 @@ Cvar_Set_f (void)
Cvar_Set (var, value); Cvar_Set (var, value);
} }
} else { } else {
var = Cvar_Get (var_name, value, CVAR_USER_CREATED, var = Cvar_Get (var_name, value, CVAR_USER_CREATED, NULL,
"User-created cvar"); "User-created cvar");
} }
} }
@ -341,7 +352,7 @@ Cvar_Setrom_f (void)
Cvar_SetFlags (var, var->flags | CVAR_ROM); Cvar_SetFlags (var, var->flags | CVAR_ROM);
} }
} else { } else {
var = Cvar_Get (var_name, value, CVAR_USER_CREATED | CVAR_ROM, var = Cvar_Get (var_name, value, CVAR_USER_CREATED | CVAR_ROM, NULL,
"User-created READ-ONLY Cvar"); "User-created READ-ONLY Cvar");
} }
} }
@ -454,7 +465,8 @@ Cvar_Init_Hash (void)
void void
Cvar_Init (void) Cvar_Init (void)
{ {
developer = Cvar_Get ("developer", "0", 0, "set to enable extra debugging information"); developer = Cvar_Get ("developer", "0", CVAR_NONE, NULL,
"set to enable extra debugging information");
Cmd_AddCommand ("set", Cvar_Set_f, "Set the selected variable, useful on the command line (+set variablename setting)"); Cmd_AddCommand ("set", Cvar_Set_f, "Set the selected variable, useful on the command line (+set variablename setting)");
Cmd_AddCommand ("setrom", Cvar_Setrom_f, "Set the selected variable and make it read only, useful on the command line.\n" Cmd_AddCommand ("setrom", Cvar_Setrom_f, "Set the selected variable and make it read only, useful on the command line.\n"
@ -491,17 +503,16 @@ Cvar_Shutdown (void)
cvar_t * cvar_t *
Cvar_Get (char *name, char *string, int cvarflags, char *description) Cvar_Get (char *name, char *string, int cvarflags, void (*callback)(cvar_t*), char *description)
{ {
cvar_t *var; cvar_t *var;
if (Cmd_Exists (name)) { if (Cmd_Exists (name)) {
Con_Printf ("Cvar_Get: %s is a command\n", name); Con_Printf ("Cvar_Get: %s is a command\n", name);
return NULL; return NULL;
} }
var = Cvar_FindVar (name);
if (!var) { if (!(var = Cvar_FindVar (name))) {
cvar_t **v; cvar_t **v;
var = (cvar_t *) calloc (1, sizeof (cvar_t)); var = (cvar_t *) calloc (1, sizeof (cvar_t));
@ -509,6 +520,7 @@ Cvar_Get (char *name, char *string, int cvarflags, char *description)
var->name = strdup (name); var->name = strdup (name);
var->string = strdup (string); var->string = strdup (string);
var->flags = cvarflags; var->flags = cvarflags;
var->callback = callback;
var->description = description; var->description = description;
var->value = atof (var->string); var->value = atof (var->string);
var->int_val = atoi (var->string); var->int_val = atoi (var->string);
@ -525,10 +537,14 @@ Cvar_Get (char *name, char *string, int cvarflags, char *description)
// Cvar does exist, so we update the flags and return. // Cvar does exist, so we update the flags and return.
var->flags &= ~CVAR_USER_CREATED; var->flags &= ~CVAR_USER_CREATED;
var->flags |= cvarflags; var->flags |= cvarflags;
var->callback = callback;
var->description = description; var->description = description;
} }
Cvar_Info (var); Cvar_Info (var);
if (var->callback)
var->callback (var);
return var; return var;
} }

View file

@ -69,9 +69,9 @@ D_Init (void)
void void
D_Init_Cvars (void) D_Init_Cvars (void)
{ {
d_subdiv16 = Cvar_Get ("d_subdiv16", "1", CVAR_NONE, "Set to enable extreme perspective correction"); d_subdiv16 = Cvar_Get ("d_subdiv16", "1", CVAR_NONE, NULL, "Set to enable extreme perspective correction");
d_mipcap = Cvar_Get ("d_mipcap", "0", CVAR_NONE, "Detail level. 0 is highest, 3 is lowest."); d_mipcap = Cvar_Get ("d_mipcap", "0", CVAR_NONE, NULL, "Detail level. 0 is highest, 3 is lowest.");
d_mipscale = Cvar_Get ("d_mipscale", "1", CVAR_NONE, "Detail level of objects. 0 is highest, 3 is lowest."); d_mipscale = Cvar_Get ("d_mipscale", "1", CVAR_NONE, NULL, "Detail level of objects. 0 is highest, 3 is lowest.");
} }
/* /*

View file

@ -39,10 +39,6 @@
#ifdef HAVE_DGA #ifdef HAVE_DGA
# include <X11/extensions/xf86dga.h> # include <X11/extensions/xf86dga.h>
# include <X11/extensions/xf86dgastr.h> # include <X11/extensions/xf86dgastr.h>
#endif
#ifdef HAVE_VIDMODE
# include <X11/extensions/xf86vmode.h>
# include <X11/extensions/xf86vmstr.h>
# ifndef XDGA_MAJOR_VERSION # ifndef XDGA_MAJOR_VERSION
# ifdef XF86DGA_MAJOR_VERSION # ifdef XF86DGA_MAJOR_VERSION
# define XDGA_MAJOR_VERSION XF86DGA_MAJOR_VERSION # define XDGA_MAJOR_VERSION XF86DGA_MAJOR_VERSION
@ -51,6 +47,10 @@
# endif # endif
# endif # endif
#endif #endif
#ifdef HAVE_VIDMODE
# include <X11/extensions/xf86vmode.h>
# include <X11/extensions/xf86vmstr.h>
#endif
#include "console.h" #include "console.h"
#include "dga_check.h" #include "dga_check.h"

View file

@ -93,7 +93,7 @@ Draw_ClearCache (void)
Draw_CachePic Draw_CachePic
*/ */
qpic_t * qpic_t *
Draw_CachePic (char *path) Draw_CachePic (char *path, qboolean alpha)
{ {
cachepic_t *pic; cachepic_t *pic;
int i; int i;
@ -140,30 +140,30 @@ Draw_TextBox (int x, int y, int width, int lines)
// draw left side // draw left side
cx = x; cx = x;
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tl.lmp"); p = Draw_CachePic ("gfx/box_tl.lmp", true);
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
p = Draw_CachePic ("gfx/box_ml.lmp"); p = Draw_CachePic ("gfx/box_ml.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_bl.lmp"); p = Draw_CachePic ("gfx/box_bl.lmp", true);
Draw_Pic (cx, cy + 8, p); Draw_Pic (cx, cy + 8, p);
// draw middle // draw middle
cx += 8; cx += 8;
while (width > 0) { while (width > 0) {
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tm.lmp"); p = Draw_CachePic ("gfx/box_tm.lmp", true);
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
p = Draw_CachePic ("gfx/box_mm.lmp"); p = Draw_CachePic ("gfx/box_mm.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
if (n == 1) if (n == 1)
p = Draw_CachePic ("gfx/box_mm2.lmp"); p = Draw_CachePic ("gfx/box_mm2.lmp", true);
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_bm.lmp"); p = Draw_CachePic ("gfx/box_bm.lmp", true);
Draw_Pic (cx, cy + 8, p); Draw_Pic (cx, cy + 8, p);
width -= 2; width -= 2;
cx += 16; cx += 16;
@ -171,14 +171,14 @@ Draw_TextBox (int x, int y, int width, int lines)
// draw right side // draw right side
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tr.lmp"); p = Draw_CachePic ("gfx/box_tr.lmp", true);
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
p = Draw_CachePic ("gfx/box_mr.lmp"); p = Draw_CachePic ("gfx/box_mr.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_br.lmp"); p = Draw_CachePic ("gfx/box_br.lmp", true);
Draw_Pic (cx, cy + 8, p); Draw_Pic (cx, cy + 8, p);
} }
@ -198,7 +198,7 @@ Draw_Init (void)
r_rectdesc.rowbytes = draw_backtile->width; r_rectdesc.rowbytes = draw_backtile->width;
cl_verstring = cl_verstring =
Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, "Client version string"); Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, NULL, "Client version string");
} }
void void
@ -565,7 +565,7 @@ Draw_ConsoleBackground (int lines)
int f, fstep; int f, fstep;
qpic_t *conback; qpic_t *conback;
conback = Draw_CachePic ("gfx/conback.lmp"); conback = Draw_CachePic ("gfx/conback.lmp", false);
// draw the pic // draw the pic
if (r_pixbytes == 1) { if (r_pixbytes == 1) {

View file

@ -47,7 +47,7 @@
#include "screen.h" #include "screen.h"
#include "sys.h" #include "sys.h"
static int GL_LoadPicTexture (qpic_t *pic); static int GL_LoadPicTexture (qpic_t *pic, qboolean alpha);
extern byte *host_basepal; extern byte *host_basepal;
extern unsigned char d_15to8table[65536]; extern unsigned char d_15to8table[65536];
@ -136,7 +136,7 @@ Draw_PicFromWad (char *name)
p = W_GetLumpName (name); p = W_GetLumpName (name);
gl = (glpic_t *) p->data; gl = (glpic_t *) p->data;
gl->texnum = GL_LoadPicTexture (p); gl->texnum = GL_LoadPicTexture (p, true);
gl->sl = 0; gl->sl = 0;
gl->sh = 1; gl->sh = 1;
gl->tl = 0; gl->tl = 0;
@ -159,7 +159,7 @@ Draw_ClearCache (void)
Draw_CachePic Draw_CachePic
*/ */
qpic_t * qpic_t *
Draw_CachePic (char *path) Draw_CachePic (char *path, qboolean alpha)
{ {
cachepic_t *pic; cachepic_t *pic;
int i; int i;
@ -194,7 +194,7 @@ Draw_CachePic (char *path)
// Now feed it to the GL stuff and get a texture number.. // Now feed it to the GL stuff and get a texture number..
gl = (glpic_t *) pic->pic.data; gl = (glpic_t *) pic->pic.data;
gl->texnum = GL_LoadPicTexture (dat); gl->texnum = GL_LoadPicTexture (dat, alpha);
// Alignment stuff.. // Alignment stuff..
gl->sl = 0; gl->sl = 0;
@ -254,7 +254,7 @@ Draw_TextureMode_f (void)
} }
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (!stricmp (modes[i].name, Cmd_Argv (1))) if (strcaseequal (modes[i].name, Cmd_Argv (1)))
break; break;
} }
if (i == 6) { if (i == 6) {
@ -287,30 +287,30 @@ Draw_TextBox (int x, int y, int width, int lines)
// draw left side // draw left side
cx = x; cx = x;
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tl.lmp"); p = Draw_CachePic ("gfx/box_tl.lmp", true);
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
p = Draw_CachePic ("gfx/box_ml.lmp"); p = Draw_CachePic ("gfx/box_ml.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_bl.lmp"); p = Draw_CachePic ("gfx/box_bl.lmp", true);
Draw_Pic (cx, cy + 8, p); Draw_Pic (cx, cy + 8, p);
// draw middle // draw middle
cx += 8; cx += 8;
while (width > 0) { while (width > 0) {
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tm.lmp"); p = Draw_CachePic ("gfx/box_tm.lmp", true);
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
p = Draw_CachePic ("gfx/box_mm.lmp"); p = Draw_CachePic ("gfx/box_mm.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
if (n == 1) if (n == 1)
p = Draw_CachePic ("gfx/box_mm2.lmp"); p = Draw_CachePic ("gfx/box_mm2.lmp", true);
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_bm.lmp"); p = Draw_CachePic ("gfx/box_bm.lmp", true);
Draw_Pic (cx, cy + 8, p); Draw_Pic (cx, cy + 8, p);
width -= 2; width -= 2;
cx += 16; cx += 16;
@ -318,14 +318,14 @@ Draw_TextBox (int x, int y, int width, int lines)
// draw right side // draw right side
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tr.lmp"); p = Draw_CachePic ("gfx/box_tr.lmp", true);
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
p = Draw_CachePic ("gfx/box_mr.lmp"); p = Draw_CachePic ("gfx/box_mr.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
Draw_Pic (cx, cy, p); Draw_Pic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_br.lmp"); p = Draw_CachePic ("gfx/box_br.lmp", true);
Draw_Pic (cx, cy + 8, p); Draw_Pic (cx, cy + 8, p);
} }
@ -393,24 +393,24 @@ Draw_Init (void)
void void
Draw_Init_Cvars (void) Draw_Init_Cvars (void)
{ {
gl_lightmode = Cvar_Get ("gl_lightmode", "1", CVAR_ARCHIVE, gl_lightmode = Cvar_Get ("gl_lightmode", "1", CVAR_ARCHIVE, NULL,
"Lighting mode (0 = GLQuake style, 1 = new style)"); "Lighting mode (0 = GLQuake style, 1 = new style)");
gl_max_size = Cvar_Get ("gl_max_size", "1024", CVAR_NONE, "Texture dimension"); gl_max_size = Cvar_Get ("gl_max_size", "1024", CVAR_NONE, NULL, "Texture dimension");
gl_picmip = Cvar_Get ("gl_picmip", "0", CVAR_NONE, "Dimensions of displayed textures. 0 is normal, 1 is half, 2 is 1/4"); gl_picmip = Cvar_Get ("gl_picmip", "0", CVAR_NONE, NULL, "Dimensions of displayed textures. 0 is normal, 1 is half, 2 is 1/4");
gl_colorlights = Cvar_Get ("gl_colorlights", "1", CVAR_ROM, gl_colorlights = Cvar_Get ("gl_colorlights", "1", CVAR_ROM, NULL,
"Whether to use RGB lightmaps or not"); "Whether to use RGB lightmaps or not");
gl_constretch = Cvar_Get ("gl_constretch", "0", CVAR_ARCHIVE, gl_constretch = Cvar_Get ("gl_constretch", "0", CVAR_ARCHIVE, NULL,
"whether slide the console or stretch it"); "whether slide the console or stretch it");
gl_conalpha = Cvar_Get ("gl_conalpha", "0.6", CVAR_ARCHIVE, gl_conalpha = Cvar_Get ("gl_conalpha", "0.6", CVAR_ARCHIVE, NULL,
"alpha value for the console background"); "alpha value for the console background");
gl_conspin = Cvar_Get ("gl_conspin", "0", CVAR_ARCHIVE, gl_conspin = Cvar_Get ("gl_conspin", "0", CVAR_ARCHIVE, NULL,
"speed at which the console spins"); "speed at which the console spins");
cl_verstring = Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, cl_verstring = Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, NULL,
"Client version string"); "Client version string");
} }
@ -658,7 +658,7 @@ Draw_ConsoleBackground (int lines)
float alpha; float alpha;
// This can be a CachePic now, just like in software // This can be a CachePic now, just like in software
conback = Draw_CachePic ("gfx/conback.lmp"); conback = Draw_CachePic ("gfx/conback.lmp", false);
gl = (glpic_t *) conback->data; gl = (glpic_t *) conback->data;
// spin the console? - effect described in a QER tutorial // spin the console? - effect described in a QER tutorial
@ -1229,8 +1229,8 @@ GL_LoadTexture (char *identifier, int width, int height, byte * data,
GL_LoadPicTexture GL_LoadPicTexture
*/ */
static int static int
GL_LoadPicTexture (qpic_t *pic) GL_LoadPicTexture (qpic_t *pic, qboolean alpha)
{ {
return GL_LoadTexture ("", pic->width, pic->height, pic->data, false, true, return GL_LoadTexture ("", pic->width, pic->height, pic->data, false, alpha,
1); 1);
} }

View file

@ -39,38 +39,96 @@
#include <stdio.h> #include <stdio.h>
#include "console.h" #include "console.h"
#include "cvar.h"
#include "mdfour.h" #include "mdfour.h"
#include "model.h" #include "model.h"
#include "quakefs.h" #include "quakefs.h"
#include "sys.h"
#include "compat.h"
/* /*
ALIAS MODEL DISPLAY LIST GENERATION ALIAS MODEL DISPLAY LIST GENERATION
*/ */
extern cvar_t *gl_mesh_cache;
model_t *aliasmodel; model_t *aliasmodel;
aliashdr_t *paliashdr; aliashdr_t *paliashdr;
qboolean used[8192]; qboolean *used;
int used_size;
// the command list holds counts and s/t values that are valid for // the command list holds counts and s/t values that are valid for
// every frame // every frame
int commands[8192]; int *commands;
int numcommands; int numcommands;
int commands_size;
// all frames will have their vertexes rearranged and expanded // all frames will have their vertexes rearranged and expanded
// so they are in the order expected by the command list // so they are in the order expected by the command list
int vertexorder[8192]; int *vertexorder;
int numorder; int numorder;
int vertexorder_size;
int allverts, alltris; int allverts, alltris;
int stripverts[128]; int *stripverts;
int striptris[128]; int *striptris;
int stripcount; int stripcount;
int strip_size;
void
alloc_used (int size)
{
if (size <= used_size)
return;
size = (size + 1023) & ~1023;
used = realloc (used, size * sizeof (used[0]));
if (!used)
Sys_Error ("gl_mesh: out of memory");
used_size = size;
}
void
add_command (int cmd)
{
if (numcommands + 1 > commands_size) {
commands_size += 1024;
commands = realloc (commands, commands_size * sizeof (commands[0]));
if (!commands)
Sys_Error ("gl_mesh: out of memory");
}
commands[numcommands++] = cmd;
}
void
add_vertex (int vert)
{
if (numorder + 1 > vertexorder_size) {
vertexorder_size += 1024;
vertexorder = realloc (vertexorder, vertexorder_size * sizeof (vertexorder[0]));
if (!vertexorder)
Sys_Error ("gl_mesh: out of memory");
}
vertexorder[numorder++] = vert;
}
void
add_strip (int vert, int tri)
{
if (stripcount + 1 > strip_size) {
strip_size += 1024;
stripverts = realloc (stripverts, strip_size * sizeof (stripverts[0]));
striptris = realloc (striptris, strip_size * sizeof (striptris[0]));
if (!stripverts || !striptris)
Sys_Error ("gl_mesh: out of memory");
}
stripverts[stripcount] = vert;
striptris[stripcount] = tri;
stripcount++;
}
/*
StripLength
*/
int int
StripLength (int starttri, int startv) StripLength (int starttri, int startv)
{ {
@ -83,12 +141,10 @@ StripLength (int starttri, int startv)
last = &triangles[starttri]; last = &triangles[starttri];
stripverts[0] = last->vertindex[(startv) % 3]; stripcount = 0;
stripverts[1] = last->vertindex[(startv + 1) % 3]; add_strip (last->vertindex[(startv) % 3], starttri);
stripverts[2] = last->vertindex[(startv + 2) % 3]; add_strip (last->vertindex[(startv + 1) % 3], starttri);
add_strip (last->vertindex[(startv + 2) % 3], starttri);
striptris[0] = starttri;
stripcount = 1;
m1 = last->vertindex[(startv + 2) % 3]; m1 = last->vertindex[(startv + 2) % 3];
m2 = last->vertindex[(startv + 1) % 3]; m2 = last->vertindex[(startv + 1) % 3];
@ -117,9 +173,7 @@ nexttri:
else else
m1 = check->vertindex[(k + 2) % 3]; m1 = check->vertindex[(k + 2) % 3];
stripverts[stripcount + 2] = check->vertindex[(k + 2) % 3]; add_strip (check->vertindex[(k + 2) % 3], j);
striptris[stripcount] = j;
stripcount++;
used[j] = 2; used[j] = 2;
goto nexttri; goto nexttri;
@ -132,12 +186,9 @@ done:
if (used[j] == 2) if (used[j] == 2)
used[j] = 0; used[j] = 0;
return stripcount; return stripcount - 2;
} }
/*
FanLength
*/
int int
FanLength (int starttri, int startv) FanLength (int starttri, int startv)
{ {
@ -150,12 +201,10 @@ FanLength (int starttri, int startv)
last = &triangles[starttri]; last = &triangles[starttri];
stripverts[0] = last->vertindex[(startv) % 3]; stripcount = 0;
stripverts[1] = last->vertindex[(startv + 1) % 3]; add_strip (last->vertindex[(startv) % 3], starttri);
stripverts[2] = last->vertindex[(startv + 2) % 3]; add_strip (last->vertindex[(startv + 1) % 3], starttri);
add_strip (last->vertindex[(startv + 2) % 3], starttri);
striptris[0] = starttri;
stripcount = 1;
m1 = last->vertindex[(startv + 0) % 3]; m1 = last->vertindex[(startv + 0) % 3];
m2 = last->vertindex[(startv + 2) % 3]; m2 = last->vertindex[(startv + 2) % 3];
@ -182,9 +231,7 @@ FanLength (int starttri, int startv)
// the new edge // the new edge
m2 = check->vertindex[(k + 2) % 3]; m2 = check->vertindex[(k + 2) % 3];
stripverts[stripcount + 2] = m2; add_strip (m2, j);
striptris[stripcount] = j;
stripcount++;
used[j] = 2; used[j] = 2;
goto nexttri; goto nexttri;
@ -197,7 +244,7 @@ FanLength (int starttri, int startv)
if (used[j] == 2) if (used[j] == 2)
used[j] = 0; used[j] = 0;
return stripcount; return stripcount - 2;
} }
@ -214,16 +261,17 @@ BuildTris (void)
int startv; int startv;
float s, t; float s, t;
int len, bestlen, besttype = 0; int len, bestlen, besttype = 0;
int bestverts[1024]; int *bestverts = 0;
int besttris[1024]; int *besttris = 0;
int type; int type;
//
// build tristrips // build tristrips
//
numorder = 0; numorder = 0;
numcommands = 0; numcommands = 0;
memset (used, 0, sizeof (used)); stripcount = 0;
alloc_used (pheader->mdl.numtris);
memset (used, 0, used_size * sizeof (used[0]));
for (i = 0; i < pheader->mdl.numtris; i++) { for (i = 0; i < pheader->mdl.numtris; i++) {
// pick an unused triangle and start the trifan // pick an unused triangle and start the trifan
if (used[i]) if (used[i])
@ -241,27 +289,31 @@ BuildTris (void)
if (len > bestlen) { if (len > bestlen) {
besttype = type; besttype = type;
bestlen = len; bestlen = len;
for (j = 0; j < bestlen + 2; j++) if (bestverts)
bestverts[j] = stripverts[j]; free (bestverts);
for (j = 0; j < bestlen; j++) if (besttris)
besttris[j] = striptris[j]; free (besttris);
bestverts = stripverts;
besttris = striptris;
stripverts = striptris = 0;
strip_size = 0;
} }
} }
} }
// mark the tris on the best strip as used // mark the tris on the best strip as used
for (j = 0; j < bestlen; j++) for (j = 0; j < bestlen; j++)
used[besttris[j]] = 1; used[besttris[j + 2]] = 1;
if (besttype == 1) if (besttype == 1)
commands[numcommands++] = (bestlen + 2); add_command (bestlen + 2);
else else
commands[numcommands++] = -(bestlen + 2); add_command (-(bestlen + 2));
for (j = 0; j < bestlen + 2; j++) { for (j = 0; j < bestlen + 2; j++) {
// emit a vertex into the reorder buffer // emit a vertex into the reorder buffer
k = bestverts[j]; k = bestverts[j];
vertexorder[numorder++] = k; add_vertex (k);
// emit s/t coords into the commands stream // emit s/t coords into the commands stream
s = stverts[k].s; s = stverts[k].s;
@ -271,24 +323,25 @@ BuildTris (void)
s = (s + 0.5) / pheader->mdl.skinwidth; s = (s + 0.5) / pheader->mdl.skinwidth;
t = (t + 0.5) / pheader->mdl.skinheight; t = (t + 0.5) / pheader->mdl.skinheight;
*(float *) &commands[numcommands++] = s; add_command (*(int*)&s);
*(float *) &commands[numcommands++] = t; add_command (*(int*)&t);
} }
} }
commands[numcommands++] = 0; // end of list marker add_command (0); // end of list marker
Con_DPrintf ("%3i tri %3i vert %3i cmd\n", pheader->mdl.numtris, numorder, Con_DPrintf ("%3i tri %3i vert %3i cmd\n", pheader->mdl.numtris, numorder,
numcommands); numcommands);
allverts += numorder; allverts += numorder;
alltris += pheader->mdl.numtris; alltris += pheader->mdl.numtris;
if (bestverts)
free (bestverts);
if (besttris)
free (besttris);
} }
/*
GL_MakeAliasModelDisplayLists
*/
void void
GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s) GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s)
{ {
@ -300,106 +353,142 @@ GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr, void *_m, int _s)
unsigned char model_digest[MDFOUR_DIGEST_BYTES]; unsigned char model_digest[MDFOUR_DIGEST_BYTES];
unsigned char mesh_digest[MDFOUR_DIGEST_BYTES]; unsigned char mesh_digest[MDFOUR_DIGEST_BYTES];
qboolean remesh = true; qboolean remesh = true;
qboolean do_cache = false;
aliasmodel = m; aliasmodel = m;
paliashdr = hdr; // (aliashdr_t *)Mod_Extradata (m); paliashdr = hdr; // (aliashdr_t *)Mod_Extradata (m);
mdfour (model_digest, (unsigned char*)_m, _s); if (gl_mesh_cache->int_val
&& gl_mesh_cache->int_val <= paliashdr->mdl.numtris) {
do_cache = true;
// mdfour (model_digest, (unsigned char *) _m, _s);
// look for a cached version
//
strcpy (cache, "glquake/");
COM_StripExtension (m->name + strlen ("progs/"),
cache + strlen ("glquake/"));
strncat (cache, ".ms2", sizeof (cache) - strlen (cache));
COM_FOpenFile (cache, &f); // look for a cached version
if (f) { strcpy (cache, "glquake/");
unsigned char d1[MDFOUR_DIGEST_BYTES]; COM_StripExtension (m->name + strlen ("progs/"),
unsigned char d2[MDFOUR_DIGEST_BYTES]; cache + strlen ("glquake/"));
struct mdfour md; strncat (cache, ".qfms", sizeof (cache) - strlen (cache));
int c[8192];
int nc;
int vo[8192];
int no;
memset (d1, 0, sizeof (d1)); COM_FOpenFile (cache, &f);
memset (d2, 0, sizeof (d2)); if (f) {
Qread (f, &nc, 4); unsigned char d1[MDFOUR_DIGEST_BYTES];
Qread (f, &no, 4); unsigned char d2[MDFOUR_DIGEST_BYTES];
if (nc <= 8192 && no <= 8192) { struct mdfour md;
Qread (f, &c, nc * sizeof (c[0])); int *c = 0;
Qread (f, &vo, no * sizeof (vo[0])); int nc = 0;
Qread (f, d1, MDFOUR_DIGEST_BYTES); int *vo = 0;
Qread (f, d2, MDFOUR_DIGEST_BYTES); int no = 0;
Qclose (f); int len;
int vers;
mdfour_begin (&md); memset (d1, 0, sizeof (d1));
mdfour_update (&md, (unsigned char*)&nc, 4); memset (d2, 0, sizeof (d2));
mdfour_update (&md, (unsigned char*)&no, 4);
mdfour_update (&md, (unsigned char*)&c, nc * sizeof (c[0]));
mdfour_update (&md, (unsigned char*)&vo, no * sizeof (vo[0]));
mdfour_update (&md, d1, MDFOUR_DIGEST_BYTES);
mdfour_result (&md, mesh_digest);
if (memcmp (d2, mesh_digest, MDFOUR_DIGEST_BYTES) == 0 && memcmp (d1, model_digest, MDFOUR_DIGEST_BYTES) == 0) { Qread (f, &vers, sizeof (int));
remesh = false; Qread (f, &len, sizeof (int));
numcommands = nc; Qread (f, &nc, sizeof (int));
numorder = no; Qread (f, &no, sizeof (int));
memcpy (commands, c, numcommands * sizeof (c[0]));
memcpy (vertexorder, vo, numorder * sizeof (vo[0])); if (vers == 1 && (nc + no) == len) {
c = malloc (((nc + 1023) & ~1023) * sizeof (c[0]));
vo = malloc (((no + 1023) & ~1023) * sizeof (vo[0]));
if (!c || !vo)
Sys_Error ("gl_mesh.c: out of memory");
Qread (f, c, nc * sizeof (c[0]));
Qread (f, vo, no * sizeof (vo[0]));
Qread (f, d1, MDFOUR_DIGEST_BYTES);
Qread (f, d2, MDFOUR_DIGEST_BYTES);
Qclose (f);
mdfour_begin (&md);
mdfour_update (&md, (unsigned char *) &vers, sizeof(int));
mdfour_update (&md, (unsigned char *) &len, sizeof(int));
mdfour_update (&md, (unsigned char *) &nc, sizeof(int));
mdfour_update (&md, (unsigned char *) &no, sizeof(int));
mdfour_update (&md, (unsigned char *) c, nc * sizeof (c[0]));
mdfour_update (&md, (unsigned char *) vo, no * sizeof (vo[0]));
mdfour_update (&md, d1, MDFOUR_DIGEST_BYTES);
mdfour_result (&md, mesh_digest);
if (memcmp (d2, mesh_digest, MDFOUR_DIGEST_BYTES) == 0
&& memcmp (d1, model_digest, MDFOUR_DIGEST_BYTES) == 0) {
remesh = false;
numcommands = nc;
numorder = no;
if (numcommands > commands_size) {
if (commands)
free (commands);
commands_size = (numcommands + 1023) & ~1023;
commands = c;
} else {
memcpy (commands, c, numcommands * sizeof (c[0]));
free(c);
}
if (numorder > vertexorder_size) {
if (vertexorder)
free (vertexorder);
vertexorder_size = (numorder + 1023) & ~1023;
vertexorder = vo;
} else {
memcpy (vertexorder, vo, numorder * sizeof (vo[0]));
free (vo);
}
}
} }
} }
} }
if (remesh) { if (remesh) {
//
// build it from scratch // build it from scratch
// Con_DPrintf ("meshing %s...\n", m->name);
Con_Printf ("meshing %s...\n", m->name);
BuildTris (); // trifans or lists BuildTris (); // trifans or lists
// if (do_cache) {
// save out the cached version // save out the cached version
// snprintf (fullpath, sizeof (fullpath), "%s/%s", com_gamedir, cache);
snprintf (fullpath, sizeof (fullpath), "%s/%s", com_gamedir, cache); f = Qopen (fullpath, "wbz9");
f = Qopen (fullpath, "wbz9"); if (!f) {
if (!f) { COM_CreatePath (fullpath);
COM_CreatePath (fullpath); f = Qopen (fullpath, "wb");
f = Qopen (fullpath, "wb"); }
}
if (f) { if (f) {
struct mdfour md; struct mdfour md;
int vers = 1;
int len = numcommands + numorder;
mdfour_begin (&md); mdfour_begin (&md);
mdfour_update (&md, (unsigned char*)&numcommands, 4); mdfour_update (&md, (unsigned char *) &vers, sizeof (int));
mdfour_update (&md, (unsigned char*)&numorder, 4); mdfour_update (&md, (unsigned char *) &len, sizeof (int));
mdfour_update (&md, (unsigned char*)&commands, numcommands * sizeof (commands[0])); mdfour_update (&md, (unsigned char *) &numcommands, sizeof (int));
mdfour_update (&md, (unsigned char*)&vertexorder, mdfour_update (&md, (unsigned char *) &numorder, sizeof (int));
numorder * sizeof (vertexorder[0])); mdfour_update (&md, (unsigned char *) commands,
mdfour_update (&md, model_digest, MDFOUR_DIGEST_BYTES); numcommands * sizeof (commands[0]));
mdfour_result (&md, mesh_digest); mdfour_update (&md, (unsigned char *) vertexorder,
numorder * sizeof (vertexorder[0]));
mdfour_update (&md, model_digest, MDFOUR_DIGEST_BYTES);
mdfour_result (&md, mesh_digest);
Qwrite (f, &numcommands, 4); Qwrite (f, &vers, sizeof (int));
Qwrite (f, &numorder, 4); Qwrite (f, &len, sizeof (int));
Qwrite (f, &commands, numcommands * sizeof (commands[0])); Qwrite (f, &numcommands, sizeof (int));
Qwrite (f, &vertexorder, numorder * sizeof (vertexorder[0])); Qwrite (f, &numorder, sizeof (int));
Qwrite (f, model_digest, MDFOUR_DIGEST_BYTES); Qwrite (f, commands, numcommands * sizeof (commands[0]));
Qwrite (f, mesh_digest, MDFOUR_DIGEST_BYTES); Qwrite (f, vertexorder, numorder * sizeof (vertexorder[0]));
Qclose (f); Qwrite (f, model_digest, MDFOUR_DIGEST_BYTES);
Qwrite (f, mesh_digest, MDFOUR_DIGEST_BYTES);
Qclose (f);
}
} }
} }
// save the data out // save the data out
paliashdr->poseverts = numorder; paliashdr->poseverts = numorder;
cmds = Hunk_Alloc (numcommands * 4); cmds = Hunk_Alloc (numcommands * sizeof (int));
paliashdr->commands = (byte *) cmds - (byte *) paliashdr; paliashdr->commands = (byte *) cmds - (byte *) paliashdr;
memcpy (cmds, commands, numcommands * 4); memcpy (cmds, commands, numcommands * sizeof (int));
verts = Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts verts = Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts

View file

@ -254,7 +254,7 @@ Mod_LoadAliasFrame (void *pin, maliasframedesc_t *frame)
for (i = 0; i < 3; i++) { // byte values, don't worry about endianness for (i = 0; i < 3; i++) { // byte values, don't worry about endianness
frame->bboxmin.v[i] = pdaliasframe->bboxmin.v[i]; frame->bboxmin.v[i] = pdaliasframe->bboxmin.v[i];
frame->bboxmin.v[i] = pdaliasframe->bboxmax.v[i]; frame->bboxmax.v[i] = pdaliasframe->bboxmax.v[i];
} }
pinframe = (trivertx_t *) (pdaliasframe + 1); pinframe = (trivertx_t *) (pdaliasframe + 1);
@ -288,7 +288,7 @@ Mod_LoadAliasGroup (void *pin, maliasframedesc_t *frame)
for (i = 0; i < 3; i++) { for (i = 0; i < 3; i++) {
// these are byte values, so we don't have to worry about endianness // these are byte values, so we don't have to worry about endianness
frame->bboxmin.v[i] = pingroup->bboxmin.v[i]; frame->bboxmin.v[i] = pingroup->bboxmin.v[i];
frame->bboxmin.v[i] = pingroup->bboxmax.v[i]; frame->bboxmax.v[i] = pingroup->bboxmax.v[i];
} }
pin_intervals = (daliasinterval_t *) (pingroup + 1); pin_intervals = (daliasinterval_t *) (pingroup + 1);

View file

@ -132,8 +132,11 @@ R_RenderDlight (dlight_t *light)
else else
glColor3fv (light->color); glColor3fv (light->color);
VectorSubtract (r_origin, light->origin, v);
VectorNormalize (v);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
v[i] = light->origin[i] - vpn[i] * rad; v[i] = light->origin[i] + v[i] * rad;
glVertex3fv (v); glVertex3fv (v);
glColor3f (0, 0, 0); glColor3f (0, 0, 0);

View file

@ -134,7 +134,6 @@ cvar_t *brighten;
extern cvar_t *scr_fov; extern cvar_t *scr_fov;
extern byte gammatable[256];
extern qboolean lighthalf; extern qboolean lighthalf;
// LordHavoc: place for gl_rmain setup code // LordHavoc: place for gl_rmain setup code
@ -143,50 +142,6 @@ glrmain_init (void)
{ {
} }
/*
GL_CheckBrightness
This is something like the brightness cvar, except it hacks the palette
directly instead of brightening the screen afterward.
*/
void
GL_CheckBrightness (unsigned char *pal)
{
int i, inf;
float brightness;
brighten = Cvar_Get ("brighten", "1", CVAR_NONE,
"Palette hack equivalent to brightness");
if ((i = COM_CheckParm ("-brighten"))) {
brightness = atof (com_argv[i + 1]);
} else {
brightness = brighten->value;
}
brightness = bound (1, brightness, 5);
Cvar_SetValue (brighten, brightness);
Cvar_SetFlags (brighten, brighten->flags | CVAR_ROM);
// Build gamma table
if (brightness == 1.0) { // screw the math
for (i = 0; i < 256; i++) {
gammatable[i] = i;
}
} else {
for (i = 0; i < 256; i++) { // brighten up the palette
inf = (i * brightness);
inf = bound (0, inf, 255);
gammatable[i] = inf;
}
}
// correct the palette
for (i = 0; i < 768; i++) {
pal[i] = gammatable[pal[i]];
}
}
/* /*
R_CullBox R_CullBox

View file

@ -203,38 +203,38 @@ R_Init (void)
void void
R_Init_Cvars (void) R_Init_Cvars (void)
{ {
r_norefresh = Cvar_Get ("r_norefresh", "0", CVAR_NONE, "Set to 1 to disable display refresh"); r_norefresh = Cvar_Get ("r_norefresh", "0", CVAR_NONE, NULL, "Set to 1 to disable display refresh");
r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, "Toggles drawing of entities (almost everything but the world)"); r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, NULL, "Toggles drawing of entities (almost everything but the world)");
r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, "Toggles drawing of view models (your weapons)"); r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, NULL, "Toggles drawing of view models (your weapons)");
r_shadows = Cvar_Get ("r_shadows", "0", CVAR_ARCHIVE, "Set to 1 to enable shadows for entities"); r_shadows = Cvar_Get ("r_shadows", "0", CVAR_ARCHIVE, NULL, "Set to 1 to enable shadows for entities");
r_wateralpha = Cvar_Get ("r_wateralpha", "1", CVAR_NONE, "Determine opacity of liquids. 1 = solid, 0 = transparent, otherwise translucent."); r_wateralpha = Cvar_Get ("r_wateralpha", "1", CVAR_NONE, NULL, "Determine opacity of liquids. 1 = solid, 0 = transparent, otherwise translucent.");
/* FIXME what does r_waterripple use for units? */ /* FIXME what does r_waterripple use for units? */
r_waterripple = Cvar_Get ("r_waterripple", "0", CVAR_NONE, "Set to make liquids ripple, a good setting is 5"); r_waterripple = Cvar_Get ("r_waterripple", "0", CVAR_NONE, NULL, "Set to make liquids ripple, a good setting is 5");
r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, "Set to 0 to disable lightmap changes"); r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, NULL, "Set to 0 to disable lightmap changes");
r_novis = Cvar_Get ("r_novis", "0", CVAR_NONE, "Set to 1 to enable runtime visibility checking (SLOW)"); r_novis = Cvar_Get ("r_novis", "0", CVAR_NONE, NULL, "Set to 1 to enable runtime visibility checking (SLOW)");
r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, "Display drawing time and statistics of what is being viewed"); r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, NULL, "Display drawing time and statistics of what is being viewed");
r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_ARCHIVE, "Graph network stats"); r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_ARCHIVE, NULL, "Graph network stats");
r_netgraph_alpha = Cvar_Get ("r_netgraph_alpha", "0.5", CVAR_ARCHIVE, "Net graph translucency"); r_netgraph_alpha = Cvar_Get ("r_netgraph_alpha", "0.5", CVAR_ARCHIVE, NULL, "Net graph translucency");
r_netgraph_box = Cvar_Get ("r_netgraph_box", "1", CVAR_ARCHIVE, "Draw box around net graph"); r_netgraph_box = Cvar_Get ("r_netgraph_box", "1", CVAR_ARCHIVE, NULL, "Draw box around net graph");
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, "whether or not to draw particles"); r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, NULL, "whether or not to draw particles");
r_skyname = Cvar_Get ("r_skyname", "none", CVAR_NONE, "name of the current skybox"); r_skyname = Cvar_Get ("r_skyname", "none", CVAR_NONE, NULL, "name of the current skybox");
gl_affinemodels = Cvar_Get ("gl_affinemodels", "0", CVAR_ARCHIVE, "Makes texture rendering quality better if set to 1"); gl_affinemodels = Cvar_Get ("gl_affinemodels", "0", CVAR_ARCHIVE, NULL, "Makes texture rendering quality better if set to 1");
gl_clear = Cvar_Get ("gl_clear", "0", CVAR_NONE, "Set to 1 to make background black. Useful for removing HOM effect"); gl_clear = Cvar_Get ("gl_clear", "0", CVAR_NONE, NULL, "Set to 1 to make background black. Useful for removing HOM effect");
gl_dlight_lightmap = Cvar_Get ("gl_dlight_lightmap", "1", CVAR_ARCHIVE, "Set to 1 for high quality dynamic lighting."); gl_dlight_lightmap = Cvar_Get ("gl_dlight_lightmap", "1", CVAR_ARCHIVE, NULL, "Set to 1 for high quality dynamic lighting.");
gl_dlight_polyblend = Cvar_Get ("gl_dlight_polyblend", "0", CVAR_ARCHIVE, "Set to 1 to use a dynamic light effect faster on GL"); gl_dlight_polyblend = Cvar_Get ("gl_dlight_polyblend", "0", CVAR_ARCHIVE, NULL, "Set to 1 to use a dynamic light effect faster on GL");
gl_dlight_smooth = Cvar_Get ("gl_dlight_smooth", "1", CVAR_ARCHIVE, "Smooth dynamic vertex lighting"); gl_dlight_smooth = Cvar_Get ("gl_dlight_smooth", "1", CVAR_ARCHIVE, NULL, "Smooth dynamic vertex lighting");
gl_fb_bmodels = Cvar_Get ("gl_fb_bmodels", "1", CVAR_ARCHIVE, "Toggles fullbright color support for bmodels"); gl_fb_bmodels = Cvar_Get ("gl_fb_bmodels", "1", CVAR_ARCHIVE, NULL, "Toggles fullbright color support for bmodels");
gl_fb_models = Cvar_Get ("gl_fb_models", "1", CVAR_ARCHIVE, "Toggles fullbright color support for models"); gl_fb_models = Cvar_Get ("gl_fb_models", "1", CVAR_ARCHIVE, NULL, "Toggles fullbright color support for models");
gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, "Toggles lavaball and rocket fireballs"); gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, NULL, "Toggles lavaball and rocket fireballs");
gl_keeptjunctions = Cvar_Get ("gl_keeptjunctions", "1", CVAR_ARCHIVE, "Set to 0 to turn off colinear vertexes upon level load"); gl_keeptjunctions = Cvar_Get ("gl_keeptjunctions", "1", CVAR_ARCHIVE, NULL, "Set to 0 to turn off colinear vertexes upon level load");
gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, "Toggles model animation interpolation"); gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, NULL, "Toggles model animation interpolation");
gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, "Use multitexture when available"); gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available");
gl_nocolors = Cvar_Get ("gl_nocolors", "0", CVAR_NONE, "Set to 1, turns off all player colors"); gl_nocolors = Cvar_Get ("gl_nocolors", "0", CVAR_NONE, NULL, "Set to 1, turns off all player colors");
gl_playermip = Cvar_Get ("gl_playermip", "0", CVAR_NONE, "Detail of player skins. 0 best, 4 worst."); gl_playermip = Cvar_Get ("gl_playermip", "0", CVAR_NONE, NULL, "Detail of player skins. 0 best, 4 worst.");
gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_ARCHIVE, "controls whether sky is drawn first (0) or later (1)"); gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_ARCHIVE, NULL, "controls whether sky is drawn first (0) or later (1)");
gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, "subdivide sky polys"); gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, NULL, "subdivide sky polys");
gl_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_ARCHIVE, "controls whether the skydome is single or double pass"); gl_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_ARCHIVE, NULL, "controls whether the skydome is single or double pass");
} }
/* /*

View file

@ -235,29 +235,19 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
// set to full bright if no light data // set to full bright if no light data
if (!cl.worldmodel->lightdata) { if (!cl.worldmodel->lightdata) {
bl = blocklights; memset (&blocklights[0], 255, size * 3 * sizeof (unsigned int));
for (i = 0; i < size; i++) {
*bl++ = 255 << 8;
*bl++ = 255 << 8;
*bl++ = 255 << 8;
}
goto store; goto store;
} }
// clear to no light // clear to no light
bl = blocklights;
for (i = 0; i < size; i++) { memset (&blocklights[0], 0, size * 3 * sizeof (unsigned int));
*bl++ = 0;
*bl++ = 0;
*bl++ = 0;
}
bl = blocklights;
// add all the lightmaps // add all the lightmaps
if (lightmap) { if (lightmap) {
for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255; maps++) { for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255; maps++) {
scale = d_lightstylevalue[surf->styles[maps]]; scale = d_lightstylevalue[surf->styles[maps]];
surf->cached_light[maps] = scale; // 8.8 fraction surf->cached_light[maps] = scale; // 8.8 fraction
bl = blocklights; bl=blocklights;
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
*bl++ += *lightmap++ * scale; *bl++ += *lightmap++ * scale;
*bl++ += *lightmap++ * scale; *bl++ += *lightmap++ * scale;

View file

@ -384,21 +384,21 @@ SCR_SizeDown_f (void)
void void
SCR_Init_Cvars (void) SCR_Init_Cvars (void)
{ {
scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, "Your point of view in degrees. Smaller than 90 zooms in."); scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, NULL, "Your point of view in degrees. Smaller than 90 zooms in.");
scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, "Set the screen size 30 minimum, 120 maximum"); scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, NULL, "Set the screen size 30 minimum, 120 maximum");
scr_conspeed = Cvar_Get ("scr_conspeed", "300", CVAR_NONE, "How quickly console scrolls up or down"); scr_conspeed = Cvar_Get ("scr_conspeed", "300", CVAR_NONE, NULL, "How quickly console scrolls up or down");
scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, "fraction of the screen the console covers when down"); scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, NULL, "fraction of the screen the console covers when down");
scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, "Show RAM icon if game is running low on memory"); scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, NULL, "Show RAM icon if game is running low on memory");
scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, "Show a turtle icon if your fps is slower than 10"); scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, NULL, "Show a turtle icon if your fps is slower than 10");
scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, "Toggles display of pause graphic"); scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, NULL, "Toggles display of pause graphic");
scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, "How long in seconds screen hints are displayed"); scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, NULL, "How long in seconds screen hints are displayed");
scr_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, "How fast the text is displayed at the end of the single player episodes"); scr_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, NULL, "How fast the text is displayed at the end of the single player episodes");
gl_triplebuffer = Cvar_Get ("gl_triplebuffer", "1", CVAR_ARCHIVE, "Set to 1 by default. Fixes status bar flicker on some hardware"); gl_triplebuffer = Cvar_Get ("gl_triplebuffer", "1", CVAR_ARCHIVE, NULL, "Set to 1 by default. Fixes status bar flicker on some hardware");
crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, "Color of the new crosshair"); crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, NULL, "Color of the new crosshair");
crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, "Crosshair type. 0 off, 1 old without color, 2 new with colors"); crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, NULL, "Crosshair type. 0 off, 1 old without color, 2 new with colors");
cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the X-axis."); cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the X-axis.");
cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the Y-axis."); cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the Y-axis.");
} }
void void
@ -563,7 +563,7 @@ SCR_DrawPause (void)
if (!cl.paused) if (!cl.paused)
return; return;
pic = Draw_CachePic ("gfx/pause.lmp"); pic = Draw_CachePic ("gfx/pause.lmp", true);
Draw_Pic ((vid.width - pic->width) / 2, Draw_Pic ((vid.width - pic->width) / 2,
(vid.height - 48 - pic->height) / 2, pic); (vid.height - 48 - pic->height) / 2, pic);
} }

View file

@ -29,6 +29,12 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include "glquake.h" #include "glquake.h"
#include "host.h" #include "host.h"

View file

@ -65,7 +65,7 @@ R_LoadSkys (char *skyname)
QFile *f; QFile *f;
char name[64]; char name[64];
if (stricmp (skyname, "none") == 0) { if (strcaseequal (skyname, "none")) {
skyloaded = false; skyloaded = false;
return; return;
} }

View file

@ -46,7 +46,6 @@
extern byte *host_basepal; extern byte *host_basepal;
extern double host_frametime; extern double host_frametime;
extern int onground; extern int onground;
extern byte gammatable[256];
extern cvar_t *cl_cshift_powerup; extern cvar_t *cl_cshift_powerup;
extern cvar_t *contrast; extern cvar_t *contrast;
@ -88,7 +87,8 @@ V_CalcBlend (void)
a = 1.0 - a3; a = 1.0 - a3;
} }
if ((a2 = 1 - bound (0.0, contrast->value, 1.0)) < 0.999) { // add contrast if ((a2 = 1 - bound (0.0, contrast->value, 1.0)) < 0.999) {
// add contrast
r += (128 - r) * a2; r += (128 - r) * a2;
g += (128 - g) * a2; g += (128 - g) * a2;
b += (128 - b) * a2; b += (128 - b) * a2;
@ -201,20 +201,3 @@ V_UpdatePalette (void)
V_CalcBlend (); V_CalcBlend ();
} }
/*
BuildGammaTable
In software mode, this function gets the palette ready for changing...in
in GL, it does very little as you can see.
*/
void
BuildGammaTable (float b, float c)
{
int i;
for (i = 0; i < 256; i++)
gammatable[i] = i;
return;
}

View file

@ -29,6 +29,9 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <termios.h> #include <termios.h>
#include <fcntl.h> #include <fcntl.h>

View file

@ -413,8 +413,8 @@ IN_Init_Cvars (void)
{ {
JOY_Init_Cvars (); JOY_Init_Cvars ();
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "Have Quake grab the mouse from X when you play"); _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "Have Quake grab the mouse from X when you play");
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Mouse input filtering"); m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL, "Mouse input filtering");
} }

View file

@ -30,6 +30,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include "protocol.h"
void void
IN_Init (void) IN_Init (void)
{ {

View file

@ -362,8 +362,8 @@ IN_Init_Cvars (void)
{ {
JOY_Init_Cvars (); JOY_Init_Cvars ();
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "If set to 1, quake will grab the mouse in X"); _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "If set to 1, quake will grab the mouse in X");
// m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Toggle mouse input filtering"); // m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL, "Toggle mouse input filtering");
} }
void void

View file

@ -133,7 +133,7 @@ void
IN_Init_Cvars (void) IN_Init_Cvars (void)
{ {
JOY_Init_Cvars (); JOY_Init_Cvars ();
m_filter = Cvar_Get ("m_filter", "0", 0, "Toggle mouse input filtering."); m_filter = Cvar_Get ("m_filter", "0", CVAR_NONE, NULL, "Toggle mouse input filtering.");
} }
static void static void

View file

@ -31,6 +31,9 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#ifdef __MINGW32__
# define INITGUID
#endif
#include "winquake.h" #include "winquake.h"
#include <dinput.h> #include <dinput.h>
@ -424,7 +427,7 @@ void
IN_Init_Cvars (void) IN_Init_Cvars (void)
{ {
// mouse variables // mouse variables
m_filter = Cvar_Get ("m_filter", "0", CVAR_NONE, "Toggle mouse input filtering."); m_filter = Cvar_Get ("m_filter", "0", CVAR_NONE, NULL, "Toggle mouse input filtering.");
JOY_Init_Cvars(); JOY_Init_Cvars();
} }

View file

@ -67,6 +67,7 @@
#include "joystick.h" #include "joystick.h"
#include "keys.h" #include "keys.h"
#include "qargs.h" #include "qargs.h"
#include "sound.h"
#include "sys.h" #include "sys.h"
#include "view.h" #include "view.h"
@ -86,9 +87,13 @@ static float mouse_x, mouse_y;
static float old_mouse_x, old_mouse_y; static float old_mouse_x, old_mouse_y;
static int p_mouse_x, p_mouse_y; static int p_mouse_x, p_mouse_y;
static float save_volume, save_bgmvolume;
int saved_volume = 0;
#define KEY_MASK (KeyPressMask | KeyReleaseMask) #define KEY_MASK (KeyPressMask | KeyReleaseMask)
#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask) #define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
#define INPUT_MASK (KEY_MASK | MOUSE_MASK) #define FOCUS_MASK (FocusChangeMask)
#define INPUT_MASK (KEY_MASK | MOUSE_MASK | FOCUS_MASK)
static int static int
XLateKey (XKeyEvent * ev, qboolean modified) XLateKey (XKeyEvent * ev, qboolean modified)
@ -343,6 +348,34 @@ event_button (XEvent * event)
} }
} }
static void
event_focusout (XEvent * event)
{
/* it is possible to receive multiple out of focus events, so only
* handle the first one.
*/
if (saved_volume == 0)
{
XAutoRepeatOn (x_disp);
save_volume = volume->value;
save_bgmvolume = bgmvolume->value;
volume->value = 0;
bgmvolume->value = 0;
saved_volume = 1;
}
}
static void
event_focusin (XEvent * event)
{
if (saved_volume == 1)
{
XAutoRepeatOff (x_disp);
volume->value = save_volume;
bgmvolume->value = save_bgmvolume;
saved_volume = 0;
}
}
static void static void
center_pointer (void) center_pointer (void)
@ -426,7 +459,7 @@ void
IN_SendKeyEvents (void) IN_SendKeyEvents (void)
{ {
/* Get events from X server. */ /* Get events from X server. */
x11_process_events (); X11_ProcessEvents ();
} }
@ -487,7 +520,7 @@ IN_Shutdown (void)
XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), 0); XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), 0);
#endif #endif
} }
x11_close_display (); X11_CloseDisplay ();
} }
void void
@ -505,7 +538,7 @@ IN_Init (void)
if (!x_win) if (!x_win)
Sys_Error ("IN: No window!!\n"); Sys_Error ("IN: No window!!\n");
x11_open_display (); // call to increment the reference X11_OpenDisplay (); // call to increment the reference
// counter // counter
{ {
@ -522,26 +555,26 @@ IN_Init (void)
JOY_Init (); JOY_Init ();
XAutoRepeatOff (x_disp); X11_AddEvent (KeyPress, &event_key);
X11_AddEvent (KeyRelease, &event_key);
X11_AddEvent (FocusIn, &event_focusin);
X11_AddEvent (FocusOut, &event_focusout);
if (COM_CheckParm ("-nomouse")) if (!COM_CheckParm ("-nomouse")) {
return; dga_avail = VID_CheckDGA (x_disp, NULL, NULL, NULL);
if (vid_fullscreen->int_val) {
Cvar_Set (_windowed_mouse, "1");
_windowed_mouse->flags |= CVAR_ROM;
}
dga_avail = VID_CheckDGA (x_disp, NULL, NULL, NULL); X11_AddEvent (ButtonPress, &event_button);
if (vid_fullscreen->int_val) { X11_AddEvent (ButtonRelease, &event_button);
Cvar_Set (_windowed_mouse, "1"); X11_AddEvent (MotionNotify, &event_motion);
_windowed_mouse->flags |= CVAR_ROM;
mouse_x = mouse_y = 0.0;
mouse_avail = 1;
} }
mouse_x = mouse_y = 0.0;
mouse_avail = 1;
x11_add_event (KeyPress, &event_key);
x11_add_event (KeyRelease, &event_key);
x11_add_event (ButtonPress, &event_button);
x11_add_event (ButtonRelease, &event_button);
x11_add_event (MotionNotify, &event_motion);
Cmd_AddCommand ("force_centerview", Force_CenterView_f, "Force view of player to center"); Cmd_AddCommand ("force_centerview", Force_CenterView_f, "Force view of player to center");
} }
@ -549,9 +582,9 @@ void
IN_Init_Cvars (void) IN_Init_Cvars (void)
{ {
JOY_Init_Cvars (); JOY_Init_Cvars ();
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "With this set to 1, quake will grab the mouse from X"); _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "With this set to 1, quake will grab the mouse from X");
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Toggle mouse input filtering."); m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL, "Toggle mouse input filtering.");
in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, "DGA Input support"); in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, NULL, "DGA Input support");
in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE, in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE, NULL,
"DGA Mouse accelleration multiplier"); "DGA Mouse accelleration multiplier");
} }

View file

@ -39,6 +39,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "compat.h"
#include "console.h" #include "console.h"
#include "info.h" #include "info.h"
@ -46,13 +47,48 @@
INFO STRINGS INFO STRINGS
*/ */
const static char *client_info_filters[] = { // Info keys needed by client
"name",
"topcolor",
"bottomcolor",
"rate",
"msg",
"skin",
"team",
"noaim",
"pmodel",
"emodel",
"spectator",
"*spectator",
"*ver",
NULL
};
/*
Info_FilterForKey
Searches for key in the "client-needed" info string list
*/
qboolean
Info_FilterForKey (const char *key)
{
const char **s;
for (s = client_info_filters; *s; s++) {
if (strequal (*s, key)) {
return true;
}
}
return false;
}
/* /*
Info_ValueForKey Info_ValueForKey
Searches the string for the given Searches the string for the given
key and returns the associated value, or an empty string. key and returns the associated value, or an empty string.
*/ */
char * char *
Info_ValueForKey (char *s, char *key) Info_ValueForKey (char *s, char *key)
{ {
char pkey[512]; char pkey[512];
@ -127,7 +163,7 @@ Info_RemoveKey (char *s, char *key)
} }
*o = 0; *o = 0;
if (!strcmp (key, pkey)) { if (strequal (key, pkey)) {
strcpy (start, s); // remove this part strcpy (start, s); // remove this part
return; return;
} }
@ -168,7 +204,7 @@ Info_RemovePrefixedKeys (char *start, char prefix)
} }
*o = 0; *o = 0;
if (pkey[0] == prefix) { if ((pkey[0] == prefix) || (!(Info_FilterForKey (pkey)))) {
Info_RemoveKey (start, pkey); Info_RemoveKey (start, pkey);
s = start; s = start;
} }
@ -176,15 +212,14 @@ Info_RemovePrefixedKeys (char *start, char prefix)
if (!*s) if (!*s)
return; return;
} }
} }
void void
Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize) Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize, int flags)
{ {
char newstr[1024], *v; char newstr[1024], *v;
int c, is_name, is_team; int c;
if (strstr (key, "\\") || strstr (value, "\\")) { if (strstr (key, "\\") || strstr (value, "\\")) {
Con_Printf ("Can't use keys or values with a \\\n"); Con_Printf ("Can't use keys or values with a \\\n");
@ -205,7 +240,7 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize)
// key exists, make sure we have enough room for new value, if we // key exists, make sure we have enough room for new value, if we
// don't, // don't,
// don't change it! // don't change it!
if (strlen (value) - strlen (v) + strlen (s) > maxsize) { if (strlen (value) - strlen (v) + strlen (s) >= maxsize) {
Con_Printf ("Info string length exceeded\n"); Con_Printf ("Info string length exceeded\n");
return; return;
} }
@ -216,24 +251,22 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize)
snprintf (newstr, sizeof (newstr), "\\%s\\%s", key, value); snprintf (newstr, sizeof (newstr), "\\%s\\%s", key, value);
if ((int) (strlen (newstr) + strlen (s)) > maxsize) { if ((int) (strlen (newstr) + strlen (s)) >= maxsize) {
Con_Printf ("Info string length exceeded\n"); Con_Printf ("Info string length exceeded\n");
return; return;
} }
// only copy ascii values // only copy ascii values
s += strlen (s); s += strlen (s);
v = newstr; v = newstr;
is_name = stricmp (key, "name") == 0;
is_team = stricmp (key, "team") == 0;
while (*v) { while (*v) {
c = (unsigned char) *v++; c = (unsigned char) *v++;
// client only allows highbits on name // client only allows highbits on name
if (!is_name) { if (flags & 1) {
c &= 127; c &= 127;
if (c < 32 || c > 127) if (c < 32 || c > 127)
continue; continue;
// auto lowercase team // auto lowercase team
if (is_team) if (flags & 2)
c = tolower (c); c = tolower (c);
} }
if (c > 13) if (c > 13)
@ -243,14 +276,14 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize)
} }
void void
Info_SetValueForKey (char *s, char *key, char *value, size_t maxsize) Info_SetValueForKey (char *s, char *key, char *value, size_t maxsize, int flags)
{ {
if (key[0] == '*') { if (key[0] == '*') {
Con_Printf ("Can't set * keys\n"); Con_Printf ("Can't set * keys\n");
return; return;
} }
Info_SetValueForStarKey (s, key, value, maxsize); Info_SetValueForStarKey (s, key, value, maxsize, flags);
} }
void void
@ -292,3 +325,20 @@ Info_Print (char *s)
Con_Printf ("%s\n", value); Con_Printf ("%s\n", value);
} }
} }
qboolean
Info_Validate (char *s)
{
int count;
char *p;
if (!s || *s == '\0')
return false;
for (p = s, count = 0; *p != '\0'; p++)
if (*p == '\\')
count++;
return (!(count % 2));
}

View file

@ -198,19 +198,19 @@ JOY_Init_Cvars (void)
int i; int i;
joy_device = joy_device =
Cvar_Get ("joy_device", "/dev/js0", CVAR_NONE | CVAR_ROM, Cvar_Get ("joy_device", "/dev/js0", CVAR_NONE | CVAR_ROM, NULL,
"Joystick device"); "Joystick device");
joy_enable = joy_enable =
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
"Joystick enable flag"); "Joystick enable flag");
joy_sensitivity = joy_sensitivity =
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
"Joystick sensitivity"); "Joystick sensitivity");
for (i = 0; i < JOY_MAX_AXES; i++) { for (i = 0; i < JOY_MAX_AXES; i++) {
joy_axes[i].axis = Cvar_Get (joy_axes[i].var.name, joy_axes[i].axis = Cvar_Get (joy_axes[i].var.name,
joy_axes[i].var.string, joy_axes[i].var.string,
CVAR_ARCHIVE, "Set joystick axes"); CVAR_ARCHIVE, NULL, "Set joystick axes");
} }
} }

View file

@ -63,13 +63,13 @@ void
JOY_Init_Cvars (void) JOY_Init_Cvars (void)
{ {
joy_device = joy_device =
Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, NULL,
"Joystick device"); "Joystick device");
joy_enable = joy_enable =
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
"Joystick enable flag"); "Joystick enable flag");
joy_sensitivity = joy_sensitivity =
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
"Joystick sensitivity"); "Joystick sensitivity");
} }

View file

@ -32,9 +32,6 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#ifdef __MINGW32__
# define INITGUID
#endif
#define byte __byte #define byte __byte
#include <dinput.h> #include <dinput.h>
@ -554,54 +551,54 @@ void
JOY_Init_Cvars(void) JOY_Init_Cvars(void)
{ {
joy_device = joy_device =
Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, NULL,
"Joystick device"); "Joystick device");
joy_enable = joy_enable =
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
"Joystick enable flag"); "Joystick enable flag");
joy_sensitivity = joy_sensitivity =
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
"Joystick sensitivity"); "Joystick sensitivity");
// joystick variables // joystick variables
in_joystick = in_joystick =
Cvar_Get ("joystick", "0", CVAR_ARCHIVE, "FIXME: No Description"); Cvar_Get ("joystick", "0", CVAR_ARCHIVE, NULL, "FIXME: No Description");
joy_name = joy_name =
Cvar_Get ("joyname", "joystick", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyname", "joystick", CVAR_NONE, NULL, "FIXME: No Description");
joy_advanced = joy_advanced =
Cvar_Get ("joyadvanced", "0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyadvanced", "0", CVAR_NONE, NULL, "FIXME: No Description");
joy_advaxisx = joy_advaxisx =
Cvar_Get ("joyadvaxisx", "0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyadvaxisx", "0", CVAR_NONE, NULL, "FIXME: No Description");
joy_advaxisy = joy_advaxisy =
Cvar_Get ("joyadvaxisy", "0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyadvaxisy", "0", CVAR_NONE, NULL, "FIXME: No Description");
joy_advaxisz = joy_advaxisz =
Cvar_Get ("joyadvaxisz", "0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyadvaxisz", "0", CVAR_NONE, NULL, "FIXME: No Description");
joy_advaxisr = joy_advaxisr =
Cvar_Get ("joyadvaxisr", "0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyadvaxisr", "0", CVAR_NONE, NULL, "FIXME: No Description");
joy_advaxisu = joy_advaxisu =
Cvar_Get ("joyadvaxisu", "0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyadvaxisu", "0", CVAR_NONE, NULL, "FIXME: No Description");
joy_advaxisv = joy_advaxisv =
Cvar_Get ("joyadvaxisv", "0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyadvaxisv", "0", CVAR_NONE, NULL, "FIXME: No Description");
joy_forwardthreshold = joy_forwardthreshold =
Cvar_Get ("joyforwardthreshold", "0.15", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyforwardthreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description");
joy_sidethreshold = joy_sidethreshold =
Cvar_Get ("joysidethreshold", "0.15", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joysidethreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description");
joy_pitchthreshold = joy_pitchthreshold =
Cvar_Get ("joypitchthreshold", "0.15", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joypitchthreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description");
joy_yawthreshold = Cvar_Get ("joyyawthreshold", "0.15", CVAR_NONE, "FIXME: No Description"); joy_yawthreshold = Cvar_Get ("joyyawthreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description");
joy_forwardsensitivity = joy_forwardsensitivity =
Cvar_Get ("joyforwardsensitivity", "-1.0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyforwardsensitivity", "-1.0", CVAR_NONE, NULL, "FIXME: No Description");
joy_sidesensitivity = joy_sidesensitivity =
Cvar_Get ("joysidesensitivity", "-1.0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joysidesensitivity", "-1.0", CVAR_NONE, NULL, "FIXME: No Description");
joy_pitchsensitivity = joy_pitchsensitivity =
Cvar_Get ("joypitchsensitivity", "1.0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joypitchsensitivity", "1.0", CVAR_NONE, NULL, "FIXME: No Description");
joy_yawsensitivity = joy_yawsensitivity =
Cvar_Get ("joyyawsensitivity", "-1.0", CVAR_NONE, "FIXME: No Description"); Cvar_Get ("joyyawsensitivity", "-1.0", CVAR_NONE, NULL, "FIXME: No Description");
joy_wwhack1 = Cvar_Get ("joywwhack1", "0.0", CVAR_NONE, "FIXME: No Description"); joy_wwhack1 = Cvar_Get ("joywwhack1", "0.0", CVAR_NONE, NULL, "FIXME: No Description");
joy_wwhack2 = Cvar_Get ("joywwhack2", "0.0", CVAR_NONE, "FIXME: No Description"); joy_wwhack2 = Cvar_Get ("joywwhack2", "0.0", CVAR_NONE, NULL, "FIXME: No Description");
joy_debug = Cvar_Get ("joy_debug", "0.0", CVAR_NONE, "FIXME: No Description"); joy_debug = Cvar_Get ("joy_debug", "0.0", CVAR_NONE, NULL, "FIXME: No Description");
return; return;
} }

View file

@ -67,7 +67,7 @@ int key_lastpress;
int edit_line = 0; int edit_line = 0;
int history_line = 0; int history_line = 0;
keydest_t key_dest; keydest_t key_dest = key_console;
char *keybindings[256]; char *keybindings[256];
qboolean consolekeys[256]; // if true, can't be rebound while in qboolean consolekeys[256]; // if true, can't be rebound while in
@ -747,7 +747,7 @@ Key_Init (void)
void void
Key_Init_Cvars (void) Key_Init_Cvars (void)
{ {
cl_chatmode = Cvar_Get ("cl_chatmode", "2", 0, cl_chatmode = Cvar_Get ("cl_chatmode", "2", CVAR_NONE, NULL,
"Controls when console text will be treated as a chat message: 0 - never, 1 - always, 2 - smart"); "Controls when console text will be treated as a chat message: 0 - never, 1 - always, 2 - smart");
} }

View file

@ -141,8 +141,10 @@ locs_load (char *filename)
t2[0] = '\0'; t2[0] = '\0';
// handle dos format lines (COM_FOpenFile is binary only) // handle dos format lines (COM_FOpenFile is binary only)
// and unix is effectively binary only anyway // and unix is effectively binary only anyway
if (t2 > t1 && t2[-1] == '\r') while (t2 > t1 && t2[-1] == '\r') {
t2[-1] = '\0'; t2[-1] = '\0';
t2--;
}
} }
locs_add (loc, t1); locs_add (loc, t1);
} }

View file

@ -54,14 +54,15 @@ qf_server_PROGRAM = qfserver.exe
# #
#!if ASM_ARCH #!if ASM_ARCH
#math_ASM = math.S sys_x86.S math_ASM = math.S sys_x86.S
world_ASM = worlda.S
#!endif #!endif
common_SOURCES= buildnum.c checksum.c cmd.c com.c crc.c cvar.c info.c link.c \ common_SOURCES= buildnum.c checksum.c cmd.c com.c crc.c cvar.c info.c link.c \
locs.c mathlib.c mdfour.c model.c model_brush.c msg.c \ locs.c mathlib.c mdfour.c model.c model_brush.c msg.c \
net_chan.c net_com.c net_udp.c pmove.c pmovetst.c qargs.c \ net_chan.c net_com.c net_udp.c pmove.c pmovetst.c qargs.c \
qendian.c quakefs.c quakeio.c sizebuf.c va.c zone.c hash.c \ qendian.c quakefs.c quakeio.c sizebuf.c va.c zone.c hash.c \
$(math_ASM) $(math_ASM) $(world_ASM)
sound_SOURCES= snd_dma.c snd_mem.c snd_mix.c sound_SOURCES= snd_dma.c snd_mem.c snd_mix.c
@ -76,7 +77,7 @@ WIN32_OTHER = cd_win.c joy_win.c in_win.c
# Client itself # Client itself
# #
#if ASM_ARCH #if ASM_ARCH
#client_ASM= snd_mixa.S cl_math.S client_ASM= snd_mixa.S cl_math.S
#endif #endif
client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \ client_SOURCES= cl_cam.c cl_cmd.c cl_cvar.c cl_demo.c cl_ents.c cl_input.c \
@ -117,16 +118,12 @@ soft_SOURCES= sw_skin.c d_edge.c d_fill.c d_init.c d_modech.c \
# #
# #
#if ASM_ARCH
#world_ASM = worlda.S
#endif
server_SYS = fnmatch.c dirent.c sv_sys_win.c sys_win.c server_SYS = fnmatch.c dirent.c sv_sys_win.c sys_win.c
server_SOURCES= sv_pr_cmds.c pr_edict.c pr_exec.c pr_offs.c sv_ccmds.c sv_cvar.c \ server_SOURCES= sv_pr_cmds.c pr_edict.c pr_exec.c pr_offs.c sv_ccmds.c sv_cvar.c \
sv_ents.c sv_init.c sv_main.c sv_misc.c sv_model.c \ sv_ents.c sv_init.c sv_main.c sv_misc.c sv_model.c \
sv_move.c sv_nchan.c sv_phys.c sv_send.c sv_user.c \ sv_move.c sv_nchan.c sv_phys.c sv_send.c sv_user.c \
ver_check.c world.c sv_progs.c $(world_ASM) ver_check.c world.c sv_progs.c
# Microsoft Opengl Win32 # Microsoft Opengl Win32
@ -169,9 +166,8 @@ qf_server_SOURCES = $(common_SOURCES) $(server_SOURCES) $(server_SYS)
# #
# #
DEFS = -DHAVE_CONFIG_H=1 -D_WINDOWS=1 -DWINDOWS=1 -D_WIN32=1 -DWIN32=1 -DHAVE_FNMATCH_H=1 DEFS = -DHAVE_CONFIG_H=1 -D_WINDOWS=1 -DWINDOWS=1 -D_WIN32=1 -DWIN32=1 -DHAVE_FNMATCH_H=1 -DUSE_INTEL_ASM=1
#-DHAVE_MGRAPH_H=1
#-DUSE_INTEL_ASM=1
# For Pentium Pro and higher # For Pentium Pro and higher
#MACHINEDEPOPTS = -mpentiumpro -march=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2 #MACHINEDEPOPTS = -mpentiumpro -march=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2
@ -197,6 +193,8 @@ qf_server_LIBS = $(common_libs)
QFINCLUDES = -I$(QFROOT)\include\win32\mingw -I$(QFROOT)\include\win32 -I$(QFROOT)\include -L. -I$(QFROOT)\include\win32\resources QFINCLUDES = -I$(QFROOT)\include\win32\mingw -I$(QFROOT)\include\win32 -I$(QFROOT)\include -L. -I$(QFROOT)\include\win32\resources
OTHERINCLUDES = -I$(DIRECTXSDK)\includes -I$(ZLIB) OTHERINCLUDES = -I$(DIRECTXSDK)\includes -I$(ZLIB)
#-ID:\scitech\include
CFLAGS = -I$(SDLSDK)\include $(QFINCLUDES) $(OTHERINCLUDES) $(COPTS) $(DEFS) CFLAGS = -I$(SDLSDK)\include $(QFINCLUDES) $(OTHERINCLUDES) $(COPTS) $(DEFS)
qf_client_wgl_OBJECTS = $(qf_client_wgl_SOURCES:.c=.o) qf_client_wgl_OBJECTS = $(qf_client_wgl_SOURCES:.c=.o)
@ -230,8 +228,9 @@ qf-server: $(qf_server_OBJECTS)
clean: clean:
rm -f $(PROGRAM) $(OBJECTS) rm -f $(PROGRAM) $(OBJECTS)
# compile is not supported yet, probs with MGLFX # compile is not supported yet, probs with MGLFX -Xlinker --verbose
#qf-client-win: $(qf_client_win_OBJECTS) #qf-client-win: $(qf_client_win_OBJECTS)
# gcc -Xlinker --verbose $(CFLAGS) -ID:\scitech\includes -o $(qf_client_win_PROGRAM) $(qf_client_win_OBJECTS) $(qf_client_win_LIBS) -mwindows # gcc $(CFLAGS) -o $(qf_client_win_PROGRAM) $(qf_client_win_OBJECTS) $(qf_client_win_LIBS) -mwindows
# strip --strip-all $(qf_client_win_PROGRAM) # strip --strip-all $(qf_client_win_PROGRAM)

View file

@ -142,6 +142,9 @@ int m_return_state;
qboolean m_return_onerror; qboolean m_return_onerror;
char m_return_reason[32]; char m_return_reason[32];
cvar_t *brightness;
cvar_t *contrast;
#define StartingGame (m_multiplayer_cursor == 1) #define StartingGame (m_multiplayer_cursor == 1)
#define JoiningGame (m_multiplayer_cursor == 0) #define JoiningGame (m_multiplayer_cursor == 0)
#define SerialConfig (m_net_cursor == 0) #define SerialConfig (m_net_cursor == 0)
@ -151,6 +154,8 @@ char m_return_reason[32];
void M_ConfigureNetSubsystem (void); void M_ConfigureNetSubsystem (void);
extern cvar_t *confirm_quit;
//============================================================================= //=============================================================================
/* Support Routines */ /* Support Routines */
@ -245,30 +250,30 @@ M_DrawTextBox (int x, int y, int width, int lines)
// draw left side // draw left side
cx = x; cx = x;
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tl.lmp"); p = Draw_CachePic ("gfx/box_tl.lmp", true);
M_DrawTransPic (cx, cy, p); M_DrawTransPic (cx, cy, p);
p = Draw_CachePic ("gfx/box_ml.lmp"); p = Draw_CachePic ("gfx/box_ml.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
M_DrawTransPic (cx, cy, p); M_DrawTransPic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_bl.lmp"); p = Draw_CachePic ("gfx/box_bl.lmp", true);
M_DrawTransPic (cx, cy + 8, p); M_DrawTransPic (cx, cy + 8, p);
// draw middle // draw middle
cx += 8; cx += 8;
while (width > 0) { while (width > 0) {
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tm.lmp"); p = Draw_CachePic ("gfx/box_tm.lmp", true);
M_DrawTransPic (cx, cy, p); M_DrawTransPic (cx, cy, p);
p = Draw_CachePic ("gfx/box_mm.lmp"); p = Draw_CachePic ("gfx/box_mm.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
if (n == 1) if (n == 1)
p = Draw_CachePic ("gfx/box_mm2.lmp"); p = Draw_CachePic ("gfx/box_mm2.lmp", true);
M_DrawTransPic (cx, cy, p); M_DrawTransPic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_bm.lmp"); p = Draw_CachePic ("gfx/box_bm.lmp", true);
M_DrawTransPic (cx, cy + 8, p); M_DrawTransPic (cx, cy + 8, p);
width -= 2; width -= 2;
cx += 16; cx += 16;
@ -276,14 +281,14 @@ M_DrawTextBox (int x, int y, int width, int lines)
// draw right side // draw right side
cy = y; cy = y;
p = Draw_CachePic ("gfx/box_tr.lmp"); p = Draw_CachePic ("gfx/box_tr.lmp", true);
M_DrawTransPic (cx, cy, p); M_DrawTransPic (cx, cy, p);
p = Draw_CachePic ("gfx/box_mr.lmp"); p = Draw_CachePic ("gfx/box_mr.lmp", true);
for (n = 0; n < lines; n++) { for (n = 0; n < lines; n++) {
cy += 8; cy += 8;
M_DrawTransPic (cx, cy, p); M_DrawTransPic (cx, cy, p);
} }
p = Draw_CachePic ("gfx/box_br.lmp"); p = Draw_CachePic ("gfx/box_br.lmp", true);
M_DrawTransPic (cx, cy + 8, p); M_DrawTransPic (cx, cy + 8, p);
} }
@ -345,15 +350,15 @@ M_Main_Draw (void)
int f; int f;
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp")); M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
p = Draw_CachePic ("gfx/ttl_main.lmp"); p = Draw_CachePic ("gfx/ttl_main.lmp", true);
M_DrawPic ((320 - p->width) / 2, 4, p); M_DrawPic ((320 - p->width) / 2, 4, p);
M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp")); M_DrawTransPic (72, 32, Draw_CachePic ("gfx/mainmenu.lmp", true));
f = (int) (realtime * 10) % 6; f = (int) (realtime * 10) % 6;
M_DrawTransPic (54, 32 + m_main_cursor * 20, M_DrawTransPic (54, 32 + m_main_cursor * 20,
Draw_CachePic (va ("gfx/menudot%i.lmp", f + 1))); Draw_CachePic (va ("gfx/menudot%i.lmp", f + 1), true));
} }
@ -438,23 +443,21 @@ M_AdjustSliders (int dir)
bound (30, scr_viewsize->int_val + (dir * 10), 120)); bound (30, scr_viewsize->int_val + (dir * 10), 120));
break; break;
case 4: // Brightness case 4: // Brightness
Cvar_SetValue (brightness, if (brightness)
bound (1, brightness->value + (dir * 0.25), 5)); Cvar_SetValue (brightness, bound (1, brightness->value + (dir * 0.25), 5));
break; break;
case 5: // Contrast case 5: // Contrast
Cvar_SetValue (contrast, if (contrast)
bound (0.0, contrast->value + (dir * 0.05), 1)); Cvar_SetValue (contrast, bound (0.0, contrast->value + (dir * 0.05), 1));
break; break;
case 6: // mouse speed case 6: // mouse speed
Cvar_SetValue (sensitivity, Cvar_SetValue (sensitivity, bound (1, sensitivity->value + dir, 25));
bound (1, sensitivity->value + dir, 25));
break; break;
case 7: // music volume case 7: // music volume
#ifdef _WIN32 #ifdef _WIN32
Cvar_SetValue (bgmvolume, bound (0, bgmvolume->value + dir, 1)); Cvar_SetValue (bgmvolume, bound (0, bgmvolume->value + dir, 1));
#else #else
Cvar_SetValue (bgmvolume, Cvar_SetValue (bgmvolume, bound (0, bgmvolume->value + (dir * 0.1), 1));
bound (0, bgmvolume->value + (dir * 0.1), 1));
#endif #endif
break; break;
case 8: // sfx volume case 8: // sfx volume
@ -532,8 +535,8 @@ M_Options_Draw (void)
float r; float r;
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp")); M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
p = Draw_CachePic ("gfx/p_option.lmp"); p = Draw_CachePic ("gfx/p_option.lmp", true);
M_DrawPic ((320 - p->width) / 2, 4, p); M_DrawPic ((320 - p->width) / 2, 4, p);
M_Print (16, 32, " Customize controls"); M_Print (16, 32, " Customize controls");
@ -544,13 +547,17 @@ M_Options_Draw (void)
r = (scr_viewsize->int_val - 30) / (120.0 - 30.0); r = (scr_viewsize->int_val - 30) / (120.0 - 30.0);
M_DrawSlider (220, 56, r); M_DrawSlider (220, 56, r);
M_Print (16, 64, " Brightness"); if (brightness) {
r = (brightness->value - 1) / 4; M_Print (16, 64, " Brightness");
M_DrawSlider (220, 64, r); r = (brightness->value - 1) / 4;
M_DrawSlider (220, 64, r);
}
M_Print (16, 72, " Contrast"); if (contrast) {
r = contrast->value; M_Print (16, 72, " Contrast");
M_DrawSlider (220, 72, r); r = contrast->value;
M_DrawSlider (220, 72, r);
}
M_Print (16, 80, " Mouse Speed"); M_Print (16, 80, " Mouse Speed");
r = (sensitivity->value - 1) / 24; r = (sensitivity->value - 1) / 24;
@ -585,18 +592,12 @@ M_Options_Draw (void)
if (vid_menudrawfn) if (vid_menudrawfn)
M_Print (16, 152, " Video Options"); M_Print (16, 152, " Video Options");
#ifdef _WIN32 if (_windowed_mouse) {
//FIXMEif (modestate == MS_WINDOWED) { M_Print (16, 160, " Use Mouse");
#endif M_DrawCheckbox (220, 160, _windowed_mouse->int_val);
if (_windowed_mouse) { }
M_Print (16, 160, " Use Mouse");
M_DrawCheckbox (220, 160, _windowed_mouse->int_val);
}
#ifdef _WIN32
//FIXME}
#endif
// cursor // cursor
M_DrawCharacter (200, 32 + options_cursor * 8, M_DrawCharacter (200, 32 + options_cursor * 8,
12 + ((int) (realtime * 4) & 1)); 12 + ((int) (realtime * 4) & 1));
} }
@ -645,11 +646,19 @@ M_Options_Key (int k)
#endif #endif
if (options_cursor == 15 && !(vid_menudrawfn)) if (options_cursor == 15 && !(vid_menudrawfn))
options_cursor--; options_cursor--;
if ((options_cursor == 5) && !(contrast))
options_cursor--;
if ((options_cursor == 4) && !(brightness))
options_cursor--;
break; break;
case K_DOWNARROW: case K_DOWNARROW:
S_LocalSound ("misc/menu1.wav"); S_LocalSound ("misc/menu1.wav");
options_cursor++; options_cursor++;
if ((options_cursor == 4) && !(brightness))
options_cursor++;
if ((options_cursor == 5) && !(contrast))
options_cursor++;
if (options_cursor == 15 && !(vid_menudrawfn)) if (options_cursor == 15 && !(vid_menudrawfn))
options_cursor++; options_cursor++;
#ifdef _WIN32 #ifdef _WIN32
@ -762,7 +771,7 @@ M_Keys_Draw (void)
int x, y; int x, y;
qpic_t *p; qpic_t *p;
p = Draw_CachePic ("gfx/ttl_cstm.lmp"); p = Draw_CachePic ("gfx/ttl_cstm.lmp", true);
M_DrawPic ((320 - p->width) / 2, 4, p); M_DrawPic ((320 - p->width) / 2, 4, p);
if (bind_grab) if (bind_grab)
@ -906,7 +915,7 @@ M_Menu_Help_f (void)
void void
M_Help_Draw (void) M_Help_Draw (void)
{ {
M_DrawPic (0, 0, Draw_CachePic (va ("gfx/help%i.lmp", help_page))); M_DrawPic (0, 0, Draw_CachePic (va ("gfx/help%i.lmp", help_page), true));
} }
@ -990,6 +999,10 @@ M_Menu_Quit_f (void)
{ {
if (m_state == m_quit) if (m_state == m_quit)
return; return;
if (!confirm_quit->int_val) {
CL_Disconnect ();
Sys_Quit ();
}
wasInMenus = (key_dest == key_menu); wasInMenus = (key_dest == key_menu);
key_dest = key_menu; key_dest = key_menu;
m_quit_prevstate = m_state; m_quit_prevstate = m_state;
@ -1039,11 +1052,11 @@ M_SinglePlayer_Draw (void)
{ {
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp")); M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
// M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") ); // M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true) );
p = Draw_CachePic ("gfx/ttl_sgl.lmp"); p = Draw_CachePic ("gfx/ttl_sgl.lmp", true);
M_DrawPic ((320 - p->width) / 2, 4, p); M_DrawPic ((320 - p->width) / 2, 4, p);
// M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp") ); // M_DrawTransPic (72, 32, Draw_CachePic ("gfx/sp_menu.lmp", true) );
M_DrawTextBox (60, 10 * 8, 23, 4); M_DrawTextBox (60, 10 * 8, 23, 4);
M_PrintWhite (88, 12 * 8, "This client is for"); M_PrintWhite (88, 12 * 8, "This client is for");
@ -1092,8 +1105,8 @@ M_MultiPlayer_Draw (void)
int f; int f;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp")); M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
p = Draw_CachePic ("gfx/p_multi.lmp"); p = Draw_CachePic ("gfx/p_multi.lmp", true);
M_DrawPic ((320 - p->width) / 2, 4, p); M_DrawPic ((320 - p->width) / 2, 4, p);
if (!slist) { if (!slist) {
@ -1187,7 +1200,7 @@ M_MultiPlayer_Draw (void)
M_PrintWhite (STAT_X + 10, STAT_Y + 24, "Updating..."); M_PrintWhite (STAT_X + 10, STAT_Y + 24, "Updating...");
f = (int)(realtime * 10) % 6; f = (int)(realtime * 10) % 6;
M_PrintWhite(STAT_X+118,STAT_Y+48,"uakeforge!"); M_PrintWhite(STAT_X+118,STAT_Y+48,"uakeforge!");
M_DrawTransPic(STAT_X+105,STAT_Y+38,Draw_CachePic(va("gfx/menudot%i.lmp",f+1))); M_DrawTransPic(STAT_X+105,STAT_Y+38,Draw_CachePic(va("gfx/menudot%i.lmp",f+1), true));
} }
M_DrawCharacter (MENU_X + 8, (m_multip_cursor - m_multip_mins + 1) * 8 + MENU_Y, 12 + ((int) (realtime * 4) & 1)); M_DrawCharacter (MENU_X + 8, (m_multip_cursor - m_multip_mins + 1) * 8 + MENU_Y, 12 + ((int) (realtime * 4) & 1));
@ -1378,8 +1391,8 @@ M_SEdit_Draw (void)
{ {
qpic_t *p; qpic_t *p;
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp")); M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
p = Draw_CachePic ("gfx/p_multi.lmp"); p = Draw_CachePic ("gfx/p_multi.lmp", true);
M_DrawPic ((320 - p->width) / 2, 4, p); M_DrawPic ((320 - p->width) / 2, 4, p);
M_DrawTextBox (SERV_X, SERV_Y, 23, 1); M_DrawTextBox (SERV_X, SERV_Y, 23, 1);
@ -1536,6 +1549,9 @@ M_Quit_Draw (void)
void void
M_Init (void) M_Init (void)
{ {
brightness = Cvar_FindVar ("brightness");
contrast = Cvar_FindVar ("contrast");
Cmd_AddCommand ("togglemenu", M_ToggleMenu_f, "Toggle the menu"); Cmd_AddCommand ("togglemenu", M_ToggleMenu_f, "Toggle the menu");
Cmd_AddCommand ("menu_main", M_Menu_Main_f, "Show main menu"); Cmd_AddCommand ("menu_main", M_Menu_Main_f, "Show main menu");

View file

@ -57,6 +57,7 @@ model_t mod_known[MAX_MOD_KNOWN];
int mod_numknown; int mod_numknown;
cvar_t *gl_subdivide_size; cvar_t *gl_subdivide_size;
cvar_t *gl_mesh_cache;
extern byte mod_novis[MAX_MAP_LEAFS / 8]; extern byte mod_novis[MAX_MAP_LEAFS / 8];
@ -75,7 +76,10 @@ void
Mod_Init_Cvars (void) Mod_Init_Cvars (void)
{ {
gl_subdivide_size = gl_subdivide_size =
Cvar_Get ("gl_subdivide_size", "128", CVAR_ARCHIVE, "Sets the division value for the sky brushes."); Cvar_Get ("gl_subdivide_size", "128", CVAR_ARCHIVE, NULL, "Sets the division value for the sky brushes.");
gl_mesh_cache = Cvar_Get ("gl_mesh_cache", "256", CVAR_ARCHIVE, NULL,
"minimum triangle count in a model for its mesh"
" to be cached. 0 to disable caching");
} }
/* /*

View file

@ -109,7 +109,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer)
Info_SetValueForKey (cls.userinfo, Info_SetValueForKey (cls.userinfo,
!strcmp (loadmodel->name, !strcmp (loadmodel->name,
"progs/player.mdl") ? pmodel_name : "progs/player.mdl") ? pmodel_name :
emodel_name, st, MAX_INFO_STRING); emodel_name, st, MAX_INFO_STRING, 0);
if (cls.state >= ca_connected) { if (cls.state >= ca_connected) {
MSG_WriteByte (&cls.netchan.message, clc_stringcmd); MSG_WriteByte (&cls.netchan.message, clc_stringcmd);

View file

@ -372,7 +372,7 @@ MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move)
{ {
int bits; int bits;
memcpy (move, from, sizeof (*move)); memcpy (move, from, sizeof (usercmd_t));
bits = MSG_ReadByte (); bits = MSG_ReadByte ();

View file

@ -129,9 +129,9 @@ Netchan_Init (void)
void void
Netchan_Init_Cvars (void) Netchan_Init_Cvars (void)
{ {
showpackets = Cvar_Get ("showpackets", "0", CVAR_NONE, "Show all network packets"); showpackets = Cvar_Get ("showpackets", "0", CVAR_NONE, NULL, "Show all network packets");
showdrop = Cvar_Get ("showdrop", "0", CVAR_NONE, "Toggle the display of how many packets you are dropping"); showdrop = Cvar_Get ("showdrop", "0", CVAR_NONE, NULL, "Toggle the display of how many packets you are dropping");
qport = Cvar_Get ("qport", "0", CVAR_NONE, "The internal port number for the game networking code." qport = Cvar_Get ("qport", "0", CVAR_NONE, NULL, "The internal port number for the game networking code."
"Useful for clients who use multiple connections through one IP address (NAT/IP-MASQ) because default port is random."); "Useful for clients who use multiple connections through one IP address (NAT/IP-MASQ) because default port is random.");
} }
@ -448,3 +448,14 @@ Netchan_Process (netchan_t *chan)
return true; return true;
} }
/*
Netchan_AckPacket
Send a nop packet so that any unacked reliable packets get acked.
*/
void
Netchan_AckPacket (netchan_t *chan)
{
Netchan_Transmit (chan, 1, (byte*)"\001");
}

View file

@ -961,7 +961,7 @@ int
Net_Log_Init (void) Net_Log_Init (void)
{ {
netlogger = netlogger =
Cvar_Get ("net_logger", "1", CVAR_NONE, "Packet logging/parsing"); Cvar_Get ("net_logger", "1", CVAR_NONE, NULL, "Packet logging/parsing");
// 0 = no logging // 0 = no logging
// 1 = hex dump only // 1 = hex dump only
@ -970,7 +970,7 @@ Net_Log_Init (void)
// 4 = parse/hexdump, skip movement/empty messages // 4 = parse/hexdump, skip movement/empty messages
netloglevel = netloglevel =
Cvar_Get ("net_loglevel", "2", CVAR_NONE, "Packet logging/parsing"); Cvar_Get ("net_loglevel", "2", CVAR_NONE, NULL, "Packet logging/parsing");
Net_LogStart ("qfpacket.log"); Net_LogStart ("qfpacket.log");
return 0; return 0;

View file

@ -415,11 +415,8 @@ void
NET_Init (int port) NET_Init (int port)
{ {
#ifdef _WIN32 #ifdef _WIN32
WORD wVersionRequested;
int r; int r;
wVersionRequested = MAKEWORD (1, 1);
r = WSAStartup (MAKEWORD (1, 1), &winsockdata); r = WSAStartup (MAKEWORD (1, 1), &winsockdata);
if (r) if (r)
Sys_Error ("Winsock initialization failed."); Sys_Error ("Winsock initialization failed.");

View file

@ -54,19 +54,19 @@ vec3_t forward, right, up;
vec3_t player_mins = { -16, -16, -24 }; vec3_t player_mins = { -16, -16, -24 };
vec3_t player_maxs = { 16, 16, 32 }; vec3_t player_maxs = { 16, 16, 32 };
void PM_InitBoxHull (void); extern void InitBoxHull (void);
void PM_CategorizePosition (void); void PM_CategorizePosition (void);
void void
Pmove_Init (void) Pmove_Init (void)
{ {
PM_InitBoxHull (); InitBoxHull ();
} }
void void
Pmove_Init_Cvars (void) Pmove_Init_Cvars (void)
{ {
no_pogo_stick = Cvar_Get ("no_pogo_stick", "0", CVAR_SERVERINFO, no_pogo_stick = Cvar_Get ("no_pogo_stick", "0", CVAR_SERVERINFO, NULL,
"disable the ability to pogo stick"); "disable the ability to pogo stick");
} }
@ -126,7 +126,7 @@ PM_FlyMove (void)
vec3_t planes[MAX_CLIP_PLANES]; vec3_t planes[MAX_CLIP_PLANES];
vec3_t primal_velocity, original_velocity; vec3_t primal_velocity, original_velocity;
int i, j; int i, j;
pmtrace_t trace; trace_t trace;
vec3_t end; vec3_t end;
float time_left; float time_left;
int blocked; int blocked;
@ -161,7 +161,7 @@ PM_FlyMove (void)
break; // moved the entire distance break; // moved the entire distance
// save entity for contact // save entity for contact
pmove.touchindex[pmove.numtouch] = trace.ent; pmove.touchindex[pmove.numtouch] = trace.entnum;
pmove.numtouch++; pmove.numtouch++;
if (trace.plane.normal[2] > 0.7) { if (trace.plane.normal[2] > 0.7) {
@ -237,7 +237,7 @@ void
PM_FlymodeMove (void) PM_FlymodeMove (void)
{ {
vec3_t start, dest, pmvel, pmtmp; vec3_t start, dest, pmvel, pmtmp;
pmtrace_t trace; trace_t trace;
float pmspeed; float pmspeed;
pmvel[0] = pmvel[0] =
@ -280,12 +280,12 @@ void
PM_GroundMove (void) PM_GroundMove (void)
{ {
vec3_t start, dest; vec3_t start, dest;
pmtrace_t trace; trace_t trace;
vec3_t original, originalvel, down, up, downvel; vec3_t original, originalvel, down, up, downvel;
float downdist, updist; float downdist, updist;
pmove.velocity[2] = 0; pmove.velocity[2] = 0;
if (!pmove.velocity[0] && !pmove.velocity[1] && !pmove.velocity[2]) if (VectorIsNull(pmove.velocity))
return; return;
// first try just moving to the destination // first try just moving to the destination
@ -367,7 +367,7 @@ PM_Friction (void)
float friction; float friction;
float drop; float drop;
vec3_t start, stop; vec3_t start, stop;
pmtrace_t trace; trace_t trace;
if (pmove.waterjumptime) if (pmove.waterjumptime)
return; return;
@ -482,7 +482,7 @@ PM_WaterMove (void)
float wishspeed; float wishspeed;
vec3_t wishdir; vec3_t wishdir;
vec3_t start, dest; vec3_t start, dest;
pmtrace_t trace; trace_t trace;
// //
// user intentions // user intentions
@ -607,7 +607,7 @@ PM_CategorizePosition (void)
{ {
vec3_t point; vec3_t point;
int cont; int cont;
pmtrace_t tr; trace_t tr;
// if the player hull point one unit down is solid, the player // if the player hull point one unit down is solid, the player
// is on ground // is on ground
@ -623,15 +623,16 @@ PM_CategorizePosition (void)
if (tr.plane.normal[2] < 0.7) if (tr.plane.normal[2] < 0.7)
onground = -1; // too steep onground = -1; // too steep
else else
onground = tr.ent; onground = tr.entnum;
if (onground != -1) { if (onground != -1) {
pmove.waterjumptime = 0; pmove.waterjumptime = 0;
if (!tr.startsolid && !tr.allsolid) if (!tr.startsolid && !tr.allsolid)
VectorCopy (tr.endpos, pmove.origin); VectorCopy (tr.endpos, pmove.origin);
} }
// standing on an entity other than the world // standing on an entity other than the world
if (tr.ent > 0) {
pmove.touchindex[pmove.numtouch] = tr.ent; if (tr.entnum > 0) {
pmove.touchindex[pmove.numtouch] = tr.entnum;
pmove.numtouch++; pmove.numtouch++;
} }
} }

View file

@ -49,14 +49,16 @@ static mplane_t box_planes[6];
extern vec3_t player_mins; extern vec3_t player_mins;
extern vec3_t player_maxs; extern vec3_t player_maxs;
int HullPointContents (hull_t *hull, int num, vec3_t p);
/* /*
PM_InitBoxHull InitBoxHull
Set up the planes and clipnodes so that the six floats of a bounding box Set up the planes and clipnodes so that the six floats of a bounding box
can just be stored out and get a proper hull_t structure. can just be stored out and get a proper hull_t structure.
*/ */
void void
PM_InitBoxHull (void) InitBoxHull (void)
{ {
int i; int i;
int side; int side;
@ -85,13 +87,13 @@ PM_InitBoxHull (void)
/* /*
PM_HullForBox HullForBox
To keep everything totally uniform, bounding boxes are turned into small To keep everything totally uniform, bounding boxes are turned into small
BSP trees instead of being compared directly. BSP trees instead of being compared directly.
*/ */
hull_t * hull_t *
PM_HullForBox (vec3_t mins, vec3_t maxs) HullForBox (vec3_t mins, vec3_t maxs)
{ {
box_planes[0].dist = maxs[0]; box_planes[0].dist = maxs[0];
box_planes[1].dist = mins[0]; box_planes[1].dist = mins[0];
@ -104,11 +106,12 @@ PM_HullForBox (vec3_t mins, vec3_t maxs)
} }
#ifndef USE_INTEL_ASM
/* /*
PM_HullPointContents HullPointContents
*/ */
int int
PM_HullPointContents (hull_t *hull, int num, vec3_t p) HullPointContents (hull_t *hull, int num, vec3_t p)
{ {
float d; float d;
dclipnode_t *node; dclipnode_t *node;
@ -116,7 +119,7 @@ PM_HullPointContents (hull_t *hull, int num, vec3_t p)
while (num >= 0) { while (num >= 0) {
if (num < hull->firstclipnode || num > hull->lastclipnode) if (num < hull->firstclipnode || num > hull->lastclipnode)
Sys_Error ("PM_HullPointContents: bad node number"); Sys_Error ("HullPointContents: bad node number");
node = hull->clipnodes + num; node = hull->clipnodes + num;
plane = hull->planes + node->planenum; plane = hull->planes + node->planenum;
@ -133,6 +136,7 @@ PM_HullPointContents (hull_t *hull, int num, vec3_t p)
return num; return num;
} }
#endif // !USE_INTEL_ASM
/* /*
PM_PointContents PM_PointContents
@ -140,34 +144,12 @@ PM_HullPointContents (hull_t *hull, int num, vec3_t p)
int int
PM_PointContents (vec3_t p) PM_PointContents (vec3_t p)
{ {
float d;
dclipnode_t *node;
mplane_t *plane;
hull_t *hull; hull_t *hull;
int num; int num;
hull = &pmove.physents[0].model->hulls[0]; hull = &pmove.physents[0].model->hulls[0];
num = hull->firstclipnode; num = hull->firstclipnode;
while (num >= 0) { return (HullPointContents (hull, num, p));
if (num < hull->firstclipnode || num > hull->lastclipnode)
Sys_Error ("PM_HullPointContents: bad node number");
node = hull->clipnodes + num;
plane = hull->planes + node->planenum;
if (plane->type < 3)
d = p[plane->type] - plane->dist;
else
d = DotProduct (plane->normal, p) - plane->dist;
if (d < 0)
num = node->children[1];
else
num = node->children[0];
}
return num;
} }
/* /*
@ -178,11 +160,11 @@ PM_PointContents (vec3_t p)
#define DIST_EPSILON (0.03125) #define DIST_EPSILON (0.03125)
/* /*
PM_RecursiveHullCheck RecursiveHullCheck
*/ */
qboolean qboolean
PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1, RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
vec3_t p2, pmtrace_t *trace) vec3_t p2, trace_t *trace)
{ {
dclipnode_t *node; dclipnode_t *node;
mplane_t *plane; mplane_t *plane;
@ -209,7 +191,7 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
// LordHavoc: this can be eliminated by validating in the loader... but // LordHavoc: this can be eliminated by validating in the loader... but
// Mercury told me not to bother // Mercury told me not to bother
if (num < hull->firstclipnode || num > hull->lastclipnode) if (num < hull->firstclipnode || num > hull->lastclipnode)
Sys_Error ("PM_RecursiveHullCheck: bad node number"); Sys_Error ("RecursiveHullCheck: bad node number");
// find the point distances // find the point distances
node = hull->clipnodes + num; node = hull->clipnodes + num;
@ -245,22 +227,22 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
mid[i] = p1[i] + frac * (p2[i] - p1[i]); mid[i] = p1[i] + frac * (p2[i] - p1[i]);
// move up to the node // move up to the node
if (!PM_RecursiveHullCheck (hull, node->children[side], if (!RecursiveHullCheck (hull, node->children[side],
p1f, midf, p1, mid, trace)) p1f, midf, p1, mid, trace))
return false; return false;
#ifdef PARANOID #ifdef PARANOID
if (PM_HullPointContents (pm_hullmodel, mid, node->children[side]) == if (HullPointContents (pm_hullmodel, mid, node->children[side]) ==
CONTENTS_SOLID) { CONTENTS_SOLID) {
Con_Printf ("mid PointInHullSolid\n"); Con_Printf ("mid PointInHullSolid\n");
return false; return false;
} }
#endif #endif
if (PM_HullPointContents (hull, node->children[side ^ 1], if (HullPointContents (hull, node->children[side ^ 1],
mid) != CONTENTS_SOLID) { mid) != CONTENTS_SOLID) {
// go past the node // go past the node
return PM_RecursiveHullCheck (hull, node->children[side ^ 1], midf, p2f, return RecursiveHullCheck (hull, node->children[side ^ 1], midf, p2f,
mid, p2, trace); mid, p2, trace);
} }
@ -281,7 +263,7 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
trace->plane.dist = -plane->dist; trace->plane.dist = -plane->dist;
} }
while (PM_HullPointContents (hull, hull->firstclipnode, while (HullPointContents (hull, hull->firstclipnode,
mid) == CONTENTS_SOLID) { mid) == CONTENTS_SOLID) {
// shouldn't really happen, but does occasionally // shouldn't really happen, but does occasionally
frac -= 0.1; frac -= 0.1;
@ -324,12 +306,12 @@ PM_TestPlayerPosition (vec3_t pos)
else { else {
VectorSubtract (pe->mins, player_maxs, mins); VectorSubtract (pe->mins, player_maxs, mins);
VectorSubtract (pe->maxs, player_mins, maxs); VectorSubtract (pe->maxs, player_mins, maxs);
hull = PM_HullForBox (mins, maxs); hull = HullForBox (mins, maxs);
} }
VectorSubtract (pos, pe->origin, test); VectorSubtract (pos, pe->origin, test);
if (PM_HullPointContents (hull, hull->firstclipnode, test) == if (HullPointContents (hull, hull->firstclipnode, test) ==
CONTENTS_SOLID) return false; CONTENTS_SOLID) return false;
} }
@ -339,10 +321,10 @@ PM_TestPlayerPosition (vec3_t pos)
/* /*
PM_PlayerMove PM_PlayerMove
*/ */
pmtrace_t trace_t
PM_PlayerMove (vec3_t start, vec3_t end) PM_PlayerMove (vec3_t start, vec3_t end)
{ {
pmtrace_t trace, total; trace_t trace, total;
vec3_t offset; vec3_t offset;
vec3_t start_l, end_l; vec3_t start_l, end_l;
hull_t *hull; hull_t *hull;
@ -351,10 +333,10 @@ PM_PlayerMove (vec3_t start, vec3_t end)
vec3_t mins, maxs; vec3_t mins, maxs;
// fill in a default trace // fill in a default trace
memset (&total, 0, sizeof (pmtrace_t)); memset (&total, 0, sizeof (trace_t));
total.fraction = 1; total.fraction = 1;
total.ent = -1; total.entnum = -1;
VectorCopy (end, total.endpos); VectorCopy (end, total.endpos);
for (i = 0; i < pmove.numphysent; i++) { for (i = 0; i < pmove.numphysent; i++) {
@ -365,7 +347,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
else { else {
VectorSubtract (pe->mins, player_maxs, mins); VectorSubtract (pe->mins, player_maxs, mins);
VectorSubtract (pe->maxs, player_mins, maxs); VectorSubtract (pe->maxs, player_mins, maxs);
hull = PM_HullForBox (mins, maxs); hull = HullForBox (mins, maxs);
} }
// PM_HullForEntity (ent, mins, maxs, offset); // PM_HullForEntity (ent, mins, maxs, offset);
@ -375,7 +357,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
VectorSubtract (end, offset, end_l); VectorSubtract (end, offset, end_l);
// fill in a default trace // fill in a default trace
memset (&trace, 0, sizeof (pmtrace_t)); memset (&trace, 0, sizeof (trace_t));
trace.fraction = 1; trace.fraction = 1;
trace.allsolid = true; trace.allsolid = true;
@ -383,7 +365,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
VectorCopy (end, trace.endpos); VectorCopy (end, trace.endpos);
// trace a line through the apropriate clipping hull // trace a line through the apropriate clipping hull
PM_RecursiveHullCheck (hull, hull->firstclipnode, 0, 1, start_l, end_l, RecursiveHullCheck (hull, hull->firstclipnode, 0, 1, start_l, end_l,
&trace); &trace);
if (trace.allsolid) if (trace.allsolid)
@ -396,7 +378,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
// fix trace up by the offset // fix trace up by the offset
VectorAdd (trace.endpos, offset, trace.endpos); VectorAdd (trace.endpos, offset, trace.endpos);
total = trace; total = trace;
total.ent = i; total.entnum = i;
} }
} }

View file

@ -1114,7 +1114,7 @@ void
PR_Init_Cvars (void) PR_Init_Cvars (void)
{ {
pr_boundscheck = pr_boundscheck =
Cvar_Get ("pr_boundscheck", "1", CVAR_NONE, Cvar_Get ("pr_boundscheck", "1", CVAR_NONE, NULL,
"Server progs bounds checking"); "Server progs bounds checking");
} }

View file

@ -442,8 +442,7 @@ PR_ExecuteProgram (progs_t *pr, func_t fnum)
OPC->_float = !OPA->_float; OPC->_float = !OPA->_float;
break; break;
case OP_NOT_V: case OP_NOT_V:
OPC->_float = !OPA->vector[0] && !OPA->vector[1] OPC->_float = VectorIsNull(OPA->vector);
&& !OPA->vector[2];
break; break;
case OP_NOT_S: case OP_NOT_S:
OPC->_float = !OPA->string || !*PR_GetString (pr, OPA->string); OPC->_float = !OPA->string || !*PR_GetString (pr, OPA->string);

445
source/qfplist.c Normal file
View file

@ -0,0 +1,445 @@
/*
qfplist.c
Property list management
Copyright (C) 2000 Jeff Teunissen <deek@dusknet.dhs.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "qfplist.h"
#include "qtypes.h"
static plitem_t *PL_ParsePropertyListItem (pldata_t *);
static qboolean PL_SkipSpace (pldata_t *);
static char *PL_ParseQuotedString (pldata_t *);
static char *PL_ParseUnquotedString (pldata_t *);
static qboolean
PL_SkipSpace (pldata_t *pl)
{
while (pl->pos < pl->end) {
char c = pl->ptr[pl->pos];
if (!isspace (c)) {
if (c == '/' && pl->pos < pl->end - 1) { // check for comments
if (pl->ptr[pl->pos + 1] == '/') {
pl->pos += 2;
while (pl->pos < pl->end) {
c = pl->ptr[pl->pos];
if (c == '\n')
break;
pl->pos++;
}
if (pl->pos >= pl->end) {
pl->error = "Reached end of string in comment";
return false;
}
} else if (pl->ptr[pl->pos + 1] == '*') { // "/*" comments
pl->pos += 2;
while (pl->pos < pl->end) {
c = pl->ptr[pl->pos];
if (c == '\n') {
pl->line++;
} else if (c == '*' && pl->pos < pl->end - 1
&& pl->ptr[pl->pos+1] == '/') {
pl->pos++;
break;
}
pl->pos++;
}
if (pl->pos >= pl->end) {
pl->error = "Reached end of string in comment";
return false;
}
} else {
return true;
}
} else {
return true;
}
}
if (c == '\n') {
pl->line++;
}
pl->pos++;
}
pl->error = "Reached end of string";
return false;
}
static char *
PL_ParseQuotedString (pldata_t *pl)
{
unsigned int start = ++pl->pos;
unsigned int escaped = 0;
unsigned int shrink = 0;
qboolean hex = false;
char *str;
while (pl->pos < pl->end) {
char c = pl->ptr[pl->pos];
if (escaped) {
if (escaped == 1 && c == '0') {
escaped++;
hex = false;
} else if (escaped > 1) {
if (escaped == 2 && c == 'x') {
hex = true;
shrink++;
escaped++;
} else if (hex && isxdigit (c)) {
shrink++;
escaped++;
} else if (c >= '0' && c <= '7') {
shrink++;
escaped++;
} else {
pl->pos--;
escaped = 0;
}
} else {
escaped = 0;
}
} else {
if (c == '\\') {
escaped = 1;
shrink++;
} else if (c == '"') {
break;
}
}
if (c == '\n') {
pl->line++;
}
pl->pos++;
}
if (pl->pos >= pl->end) {
pl->error = "Reached end of string while parsing quoted string";
return NULL;
}
if (pl->pos - start - shrink == 0) {
str = "";
} else {
char chars[pl->pos - start - shrink];
unsigned int j;
unsigned int k;
escaped = 0;
hex = false;
for (j = start, k = 0; j < pl->pos; j++) {
char c = pl->ptr[j];
if (escaped) {
if (escaped == 1 && c == '0') {
chars[k] = 0;
hex = false;
escaped++;
} else if (escaped > 1) {
if (escaped == 2 && c == 'x') {
hex = true;
escaped++;
} else if (hex && isxdigit (c)) {
chars[k] <<= 4;
chars[k] |= char2num (c);
escaped++;
} else if (inrange (c, '0', '7')) {
chars[k] <<= 3;
chars[k] |= (c - '0');
escaped++;
} else {
escaped = 0;
j--;
k++;
}
} else {
escaped = 0;
switch (c) {
case 'a':
chars[k] = '\a';
break;
case 'b':
chars[k] = '\b';
break;
case 't':
chars[k] = '\t';
break;
case 'r':
chars[k] = '\r';
break;
case 'n':
chars[k] = '\n';
break;
case 'v':
chars[k] = '\v';
break;
case 'f':
chars[k] = '\f';
break;
default:
chars[k] = c;
break;
}
k++;
}
} else {
chars[k] = c;
if (c == '\\') {
escaped = 1;
} else {
k++;
}
}
}
str = strncat (calloc ((pl->pos - start - shrink) + 1, 1), chars, pl->pos - start - shrink);
}
pl->pos++;
return str;
}
static char *
PL_ParseUnquotedString (pldata_t *pl)
{
unsigned int start = pl->pos;
char *str;
while (pl->pos < pl->end) {
if (!isalnum (pl->ptr[pl->pos]))
break;
pl->pos++;
}
str = strncat (calloc ((pl->pos - start) + 1, 1), &pl->ptr[start], pl->pos - start);
return str;
}
static plitem_t *
PL_ParsePropertyListItem (pldata_t *pl)
{
plitem_t *item = NULL;
if (!PL_SkipSpace (pl))
return NULL;
switch (pl->ptr[pl->pos]) {
case '{': {
dict_t *dict = calloc (1, sizeof (dict_t));
pl->pos++;
while (PL_SkipSpace (pl) && pl->ptr[pl->pos] != '}') {
plitem_t *key;
plitem_t *value;
if (!(key = PL_ParsePropertyListItem (pl)))
return NULL;
if (!(PL_SkipSpace (pl))) {
free (key);
return NULL;
}
if (pl->ptr[pl->pos] != '=') {
pl->error = "Unexpected character (wanted '=')";
free (key);
return NULL;
}
pl->pos++;
// If there is no value, lose the key
if (!(value = PL_ParsePropertyListItem (pl))) {
free (key);
return NULL;
}
if (!(PL_SkipSpace (pl))) {
free (key);
free (value);
return NULL;
}
if (pl->ptr[pl->pos] == ';') {
pl->pos++;
} else if (pl->ptr[pl->pos] != '}') {
pl->error = "Unexpected character (wanted ';' or '}')";
free (key);
free (value);
return NULL;
}
// Add the key/value pair to the dict
if (!(dict->keys)) { // No keys, add one
dictkey_t *k = calloc (1, sizeof (dictkey_t));
if (!k) {
free (key);
free (value);
return NULL;
}
k->key = key;
k->value = value;
dict->keys = k;
} else {
dictkey_t *k;
for (k = dict->keys; k; k = k->next) { // add to end
if (k->next == NULL) {
dictkey_t *k2 = calloc (1, sizeof (dictkey_t));
if (!k2) {
free (key);
free (value);
return NULL;
}
k2->key = key;
k2->value = value;
k = k2;
break;
}
}
}
dict->numkeys++;
}
if (pl->pos >= pl->end) { // Catch the error
pl->error = "Unexpected end of string when parsing dictionary";
free (dict);
return NULL;
}
pl->pos++;
item = calloc (1, sizeof (plitem_t));
item->type = QFDictionary;
item->data.dict = dict;
return item;
}
case '(': {
array_t *a = calloc (1, sizeof (array_t));
pl->pos++;
while (PL_SkipSpace (pl) && pl->ptr[pl->pos] != ')') {
plitem_t *value;
if (!(value = PL_ParsePropertyListItem (pl)))
return NULL;
if (!(PL_SkipSpace (pl))) {
free (value);
return NULL;
}
if (pl->ptr[pl->pos] == ',') {
pl->pos++;
} else if (pl->ptr[pl->pos] != ')') {
pl->error = "Unexpected character (wanted ',' or ')')";
free (value);
return NULL;
}
if (a->numvals == MAX_ARRAY_INDEX) {
pl->error = "Unexpected character (too many items in array)";
free (value);
return NULL;
}
a->values[a->numvals++] = value;
}
pl->pos++;
item = calloc (1, sizeof (plitem_t));
item->type = QFArray;
item->data.array = a;
return item;
}
case '<':
pl->error = "Unexpected character in string (binary data unsupported)";
return NULL;
case '"': {
char *str = PL_ParseQuotedString (pl);
if (!str) {
return NULL;
} else {
item = calloc (1, sizeof (plitem_t));
item->type = QFString;
item->data.string = str;
return item;
}
}
default: {
char *str = PL_ParseUnquotedString (pl);
if (!str) {
return NULL;
} else {
item = calloc (1, sizeof (plitem_t));
item->type = QFString;
item->data.string = str;
return item;
}
}
} // switch
}
static plitem_t *
PL_GetPropertyList (const char *string)
{
pldata_t *pl = calloc (1, sizeof (pldata_t));
pl->ptr = string;
pl->pos = 0;
pl->end = strlen (string);
pl->error = NULL;
pl->line = 1;
return PL_ParsePropertyListItem (pl);
}

View file

@ -1026,7 +1026,7 @@ COM_Gamedir_f (void)
if (is_server) { if (is_server) {
Info_SetValueForStarKey (svs_info, "*gamedir", dir, Info_SetValueForStarKey (svs_info, "*gamedir", dir,
MAX_SERVERINFO_STRING); MAX_SERVERINFO_STRING, 0);
} }
} }
@ -1078,19 +1078,14 @@ COM_Filesystem_Init (void)
void void
COM_Filesystem_Init_Cvars (void) COM_Filesystem_Init_Cvars (void)
{ {
fs_sharepath = Cvar_Get ("fs_sharepath", FS_SHAREPATH, CVAR_ROM, fs_sharepath = Cvar_Get ("fs_sharepath", FS_SHAREPATH, CVAR_ROM, NULL,
"location of shared (read only) game directories"); "location of shared (read only) game directories");
fs_userpath = Cvar_Get ("fs_userpath", FS_USERPATH, CVAR_ROM, fs_userpath = Cvar_Get ("fs_userpath", FS_USERPATH, CVAR_ROM, NULL,
"location of your game directories"); "location of your game directories");
fs_basegame = Cvar_Get ("fs_basegame", BASEGAME, CVAR_ROM, fs_basegame = Cvar_Get ("fs_basegame", "id1", CVAR_ROM, NULL,
"game to use by default"); "game to use by default");
#ifdef NEWSTYLE fs_skinbase= Cvar_Get ("fs_skinbase", "qw", CVAR_ROM, NULL,
fs_skinbase= Cvar_Get ("fs_skinbase", fs_basegame->string, CVAR_ROM,
"location of skins dir for downloads"); "location of skins dir for downloads");
#else
fs_skinbase= Cvar_Get ("fs_skinbase", SKINBASE, CVAR_ROM,
"location of skins dir for downloads");
#endif
} }
/* /*

View file

@ -1443,6 +1443,10 @@ SOURCE=.\va.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\vid.c
# End Source File
# Begin Source File
SOURCE=.\vid_mgl.c SOURCE=.\vid_mgl.c
!IF "$(CFG)" == "qw_client - Win32 Release" !IF "$(CFG)" == "qw_client - Win32 Release"

View file

@ -267,31 +267,31 @@ R_Init_Cvars (void)
{ {
D_Init_Cvars (); D_Init_Cvars ();
r_draworder = Cvar_Get ("r_draworder", "0", CVAR_NONE, "Toggles drawing order"); r_draworder = Cvar_Get ("r_draworder", "0", CVAR_NONE, NULL, "Toggles drawing order");
r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, "Toggles the displaying of drawing time and" r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, NULL, "Toggles the displaying of drawing time and"
"statistics of what is currently being viewed"); "statistics of what is currently being viewed");
r_timegraph = Cvar_Get ("r_timegraph", "0", CVAR_NONE, "Toggle the display of a performance graph"); r_timegraph = Cvar_Get ("r_timegraph", "0", CVAR_NONE, NULL, "Toggle the display of a performance graph");
r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_NONE, "Toggle the display of a graph showing network performance"); r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_NONE, NULL, "Toggle the display of a graph showing network performance");
r_zgraph = Cvar_Get ("r_zgraph", "0", CVAR_NONE, "Toggle the graph that reports the changes of z-axis position"); r_zgraph = Cvar_Get ("r_zgraph", "0", CVAR_NONE, NULL, "Toggle the graph that reports the changes of z-axis position");
r_graphheight = Cvar_Get ("r_graphheight", "15", CVAR_NONE, "Set the number of lines displayed in the various graphs"); r_graphheight = Cvar_Get ("r_graphheight", "15", CVAR_NONE, NULL, "Set the number of lines displayed in the various graphs");
r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, "Toggles the drawing of textures"); r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, NULL, "Toggles the drawing of textures");
r_ambient = Cvar_Get ("r_ambient", "0", CVAR_NONE, "Determines the ambient lighting for a level"); r_ambient = Cvar_Get ("r_ambient", "0", CVAR_NONE, NULL, "Determines the ambient lighting for a level");
r_clearcolor = Cvar_Get ("r_clearcolor", "2", CVAR_NONE, "This sets the color for areas outside of the current map"); r_clearcolor = Cvar_Get ("r_clearcolor", "2", CVAR_NONE, NULL, "This sets the color for areas outside of the current map");
r_waterwarp = Cvar_Get ("r_waterwarp", "1", CVAR_NONE, "Toggles whether surfaces are warped in a liquid."); r_waterwarp = Cvar_Get ("r_waterwarp", "1", CVAR_NONE, NULL, "Toggles whether surfaces are warped in a liquid.");
r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, "Toggles the drawing of entities."); r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, NULL, "Toggles the drawing of entities.");
r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, "Toggles the drawing of your weapon"); r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, NULL, "Toggles the drawing of your weapon");
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, "Toggles drawing of particles."); r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, NULL, "Toggles drawing of particles.");
r_aliasstats = Cvar_Get ("r_polymodelstats", "0", CVAR_NONE, "Toggles the displays of number of polygon models current being viewed"); r_aliasstats = Cvar_Get ("r_polymodelstats", "0", CVAR_NONE, NULL, "Toggles the displays of number of polygon models current being viewed");
r_dspeeds = Cvar_Get ("r_dspeeds", "0", CVAR_NONE, "Toggles the display of drawing speed information"); r_dspeeds = Cvar_Get ("r_dspeeds", "0", CVAR_NONE, NULL, "Toggles the display of drawing speed information");
r_reportsurfout = Cvar_Get ("r_reportsurfout", "0", CVAR_NONE, "Toggle the display of how many surfaces where not displayed"); r_reportsurfout = Cvar_Get ("r_reportsurfout", "0", CVAR_NONE, NULL, "Toggle the display of how many surfaces where not displayed");
r_maxsurfs = Cvar_Get ("r_maxsurfs", "0", CVAR_NONE, "Sets the maximum number of surfaces"); r_maxsurfs = Cvar_Get ("r_maxsurfs", "0", CVAR_NONE, NULL, "Sets the maximum number of surfaces");
r_numsurfs = Cvar_Get ("r_numsurfs", "0", CVAR_NONE, "Toggles the displaying of number of surfaces currently being viewed"); r_numsurfs = Cvar_Get ("r_numsurfs", "0", CVAR_NONE, NULL, "Toggles the displaying of number of surfaces currently being viewed");
r_reportedgeout = Cvar_Get ("r_reportedgeout", "0", CVAR_NONE, "Toggle the display of how many edges where not displayed"); r_reportedgeout = Cvar_Get ("r_reportedgeout", "0", CVAR_NONE, NULL, "Toggle the display of how many edges where not displayed");
r_maxedges = Cvar_Get ("r_maxedges", "0", CVAR_NONE, "Sets the maximum number of surfaces"); r_maxedges = Cvar_Get ("r_maxedges", "0", CVAR_NONE, NULL, "Sets the maximum number of surfaces");
r_numedges = Cvar_Get ("r_numedges", "0", CVAR_NONE, "Toggles the displaying of number of edges currently being viewed"); r_numedges = Cvar_Get ("r_numedges", "0", CVAR_NONE, NULL, "Toggles the displaying of number of edges currently being viewed");
r_aliastransbase = Cvar_Get ("r_aliastransbase", "200", CVAR_NONE, "Determines how much of an alias model is clipped away and how much is viewable"); r_aliastransbase = Cvar_Get ("r_aliastransbase", "200", CVAR_NONE, NULL, "Determines how much of an alias model is clipped away and how much is viewable");
r_aliastransadj = Cvar_Get ("r_aliastransadj", "100", CVAR_NONE, "Determines how much of an alias model is clipped away and how much is viewable."); r_aliastransadj = Cvar_Get ("r_aliastransadj", "100", CVAR_NONE, NULL, "Determines how much of an alias model is clipped away and how much is viewable.");
gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, NULL,
"subdivide sky polys"); "subdivide sky polys");
} }

View file

@ -80,7 +80,7 @@ extern int in_forward, in_forward2, in_back;
frame_t *view_frame; frame_t *view_frame;
player_state_t *view_message; player_state_t *view_message;
void BuildGammaTable (float, float); void BuildGammaTable (float, float);
/* /*
V_CalcRoll V_CalcRoll
@ -260,10 +260,8 @@ cshift_t cshift_water = { {130, 80, 50}, 128 };
cshift_t cshift_slime = { {0, 25, 5}, 150 }; cshift_t cshift_slime = { {0, 25, 5}, 150 };
cshift_t cshift_lava = { {255, 80, 0}, 150 }; cshift_t cshift_lava = { {255, 80, 0}, 150 };
cvar_t *brightness; extern byte gammatable[256]; // palette is sent through this
cvar_t *contrast; extern cvar_t *vid_gamma;
byte gammatable[256]; // palette is sent through this
/* /*
V_CheckGamma V_CheckGamma
@ -271,15 +269,15 @@ byte gammatable[256]; // palette is sent through this
qboolean qboolean
V_CheckGamma (void) V_CheckGamma (void)
{ {
static float oldbrightness; static float oldgamma;
static float oldcontrast;
if ((brightness->value == oldbrightness) && contrast->value == oldcontrast) if (vid_gamma) { // might get called before vid_gamma gets set
return false; if (oldgamma == vid_gamma->value)
oldbrightness = brightness->value; return false;
oldcontrast = contrast->value;
oldgamma = vid_gamma->value;
}
BuildGammaTable (brightness->value, contrast->value);
vid.recalc_refdef = 1; // force a surface cache flush vid.recalc_refdef = 1; // force a surface cache flush
return true; return true;
@ -735,36 +733,48 @@ V_Init (void)
Cmd_AddCommand ("bf", V_BonusFlash_f, "Background flash, used when you pick up an item"); Cmd_AddCommand ("bf", V_BonusFlash_f, "Background flash, used when you pick up an item");
Cmd_AddCommand ("centerview", V_StartPitchDrift, "Centers the player's view ahead after +lookup or +lookdown \n" Cmd_AddCommand ("centerview", V_StartPitchDrift, "Centers the player's view ahead after +lookup or +lookdown \n"
"Will not work while mlook is active or freelook is 1."); "Will not work while mlook is active or freelook is 1.");
BuildGammaTable (1.0, 1.0); // no gamma yet
} }
void void
V_Init_Cvars (void) V_Init_Cvars (void)
{ {
v_centermove = Cvar_Get ("v_centermove", "0.15", CVAR_NONE, "How far the player must move forward before the view re-centers"); v_centermove = Cvar_Get ("v_centermove", "0.15", CVAR_NONE, NULL,
v_centerspeed = Cvar_Get ("v_centerspeed", "500", CVAR_NONE, "How quickly you return to a center view after a lookup or lookdown"); "How far the player must move forward before the view re-centers");
v_centerspeed = Cvar_Get ("v_centerspeed", "500", CVAR_NONE, NULL,
"How quickly you return to a center view after a lookup or lookdown");
v_iyaw_cycle = Cvar_Get ("v_iyaw_cycle", "2", CVAR_NONE, "How far you tilt right and left when v_idlescale is enabled"); v_iyaw_cycle = Cvar_Get ("v_iyaw_cycle", "2", CVAR_NONE, NULL,
v_iroll_cycle = Cvar_Get ("v_iroll_cycle", "0.5", CVAR_NONE, "How quickly you tilt right and left when v_idlescale is enabled"); "How far you tilt right and left when v_idlescale is enabled");
v_ipitch_cycle = Cvar_Get ("v_ipitch_cycle", "1", CVAR_NONE, "How quickly you lean forwards and backwards when v_idlescale is enabled"); v_iroll_cycle = Cvar_Get ("v_iroll_cycle", "0.5", CVAR_NONE, NULL,
v_iyaw_level = Cvar_Get ("v_iyaw_level", "0.3", CVAR_NONE, "How far you tilt right and left when v_idlescale is enabled"); "How quickly you tilt right and left when v_idlescale is enabled");
v_iroll_level = Cvar_Get ("v_iroll_level", "0.1", CVAR_NONE, "How far you tilt right and left when v_idlescale is enabled"); v_ipitch_cycle = Cvar_Get ("v_ipitch_cycle", "1", CVAR_NONE, NULL,
v_ipitch_level = Cvar_Get ("v_ipitch_level", "0.3", CVAR_NONE, "How far you lean forwards and backwards when v_idlescale is enabled"); "How quickly you lean forwards and backwards when v_idlescale is enabled");
v_iyaw_level = Cvar_Get ("v_iyaw_level", "0.3", CVAR_NONE, NULL,
"How far you tilt right and left when v_idlescale is enabled");
v_iroll_level = Cvar_Get ("v_iroll_level", "0.1", CVAR_NONE, NULL,
"How far you tilt right and left when v_idlescale is enabled");
v_ipitch_level = Cvar_Get ("v_ipitch_level", "0.3", CVAR_NONE, NULL,
"How far you lean forwards and backwards when v_idlescale is enabled");
v_idlescale = Cvar_Get ("v_idlescale", "0", CVAR_NONE, "Toggles whether the view remains idle"); v_idlescale = Cvar_Get ("v_idlescale", "0", CVAR_NONE, NULL,
"Toggles whether the view remains idle");
cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, "How quickly you straighten out after strafing"); cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, NULL,
cl_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, "How much your screen tilts when strafing"); "How quickly you straighten out after strafing");
cl_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, NULL,
"How much your screen tilts when strafing");
cl_bob = Cvar_Get ("cl_bob", "0.02", CVAR_NONE, "How much your weapon moves up and down when walking"); cl_bob = Cvar_Get ("cl_bob", "0.02", CVAR_NONE, NULL,
cl_bobcycle = Cvar_Get ("cl_bobcycle", "0.6", CVAR_NONE, "How quickly your weapon moves up and down when walking"); "How much your weapon moves up and down when walking");
cl_bobup = Cvar_Get ("cl_bobup", "0.5", CVAR_NONE, "How long your weapon stays up before cycling when walking"); cl_bobcycle = Cvar_Get ("cl_bobcycle", "0.6", CVAR_NONE, NULL,
"How quickly your weapon moves up and down when walking");
cl_bobup = Cvar_Get ("cl_bobup", "0.5", CVAR_NONE, NULL,
"How long your weapon stays up before cycling when walking");
v_kicktime = Cvar_Get ("v_kicktime", "0.5", CVAR_NONE, "How long the kick from an attack lasts"); v_kicktime = Cvar_Get ("v_kicktime", "0.5", CVAR_NONE, NULL,
v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, "How much you lean when hit"); "How long the kick from an attack lasts");
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, "How much you look up when hit"); v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, NULL,
"How much you lean when hit");
brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, "Brightness level"); v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL,
contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, "Contrast level"); "How much you look up when hit");
} }

View file

@ -891,7 +891,7 @@ Sbar_TeamOverlay (void)
scr_copyeverything = 1; scr_copyeverything = 1;
scr_fullupdate = 0; scr_fullupdate = 0;
pic = Draw_CachePic ("gfx/ranking.lmp"); pic = Draw_CachePic ("gfx/ranking.lmp", true);
Draw_Pic (160 - pic->width / 2, 0, pic); Draw_Pic (160 - pic->width / 2, 0, pic);
y = 24; y = 24;
@ -992,7 +992,7 @@ Sbar_DeathmatchOverlay (int start)
scr_fullupdate = 0; scr_fullupdate = 0;
if (!start) { if (!start) {
pic = Draw_CachePic ("gfx/ranking.lmp"); pic = Draw_CachePic ("gfx/ranking.lmp", true);
Draw_Pic (160 - pic->width / 2, 0, pic); Draw_Pic (160 - pic->width / 2, 0, pic);
} }
// scores // scores
@ -1278,6 +1278,6 @@ Sbar_FinaleOverlay (void)
scr_copyeverything = 1; scr_copyeverything = 1;
pic = Draw_CachePic ("gfx/finale.lmp"); pic = Draw_CachePic ("gfx/finale.lmp", true);
Draw_Pic ((vid.width - pic->width) / 2, 16, pic); Draw_Pic ((vid.width - pic->width) / 2, 16, pic);
} }

View file

@ -402,20 +402,20 @@ SCR_SizeDown_f (void)
void void
SCR_Init_Cvars (void) SCR_Init_Cvars (void)
{ {
scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, "field of view. 90 is normal, smaller numbers zoom"); scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, NULL, "field of view. 90 is normal, smaller numbers zoom");
scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, "Set the screen size 30 minimum, 120 maximum"); scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, NULL, "Set the screen size 30 minimum, 120 maximum");
scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, "fraction of the screen the console covers when down"); scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, NULL, "fraction of the screen the console covers when down");
scr_conspeed = Cvar_Get ("scr_conspeed", "300", CVAR_NONE, "How quickly in the console screen scrolls up and down"); scr_conspeed = Cvar_Get ("scr_conspeed", "300", CVAR_NONE, NULL, "How quickly in the console screen scrolls up and down");
scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, "Show ram icon when low on ram in game"); scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, NULL, "Show ram icon when low on ram in game");
scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, "Show turtle icon when fps is lower than 10"); scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, NULL, "Show turtle icon when fps is lower than 10");
scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, "Show paused graphic when paused"); scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, NULL, "Show paused graphic when paused");
scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, "How long in seconds the screen hints are displayed on the screen"); scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, NULL, "How long in seconds the screen hints are displayed on the screen");
scr_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, "How fast the text is displayed at the end of the single player episodes"); scr_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, NULL, "How fast the text is displayed at the end of the single player episodes");
crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, "Crosshair 2's color"); crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, NULL, "Crosshair 2's color");
crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, "Crosshair type. 0 off, 1 old, 2 new with color"); crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, NULL, "Crosshair type. 0 off, 1 old, 2 new with color");
cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the X-axis"); cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the X-axis");
cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the Y-axis"); cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the Y-axis");
} }
void void
@ -578,7 +578,7 @@ SCR_DrawPause (void)
if (!cl.paused) if (!cl.paused)
return; return;
pic = Draw_CachePic ("gfx/pause.lmp"); pic = Draw_CachePic ("gfx/pause.lmp", true);
Draw_Pic ((vid.width - pic->width) / 2, Draw_Pic ((vid.width - pic->width) / 2,
(vid.height - 48 - pic->height) / 2, pic); (vid.height - 48 - pic->height) / 2, pic);
} }

View file

@ -131,7 +131,7 @@ Skin_Cache (skin_t *skin)
if (cls.downloadtype == dl_skin) if (cls.downloadtype == dl_skin)
return NULL; // use base until downloaded return NULL; // use base until downloaded
if (noskins->int_val) // JACK: So NOSKINS > 1 will show if (noskins->int_val == 1) // JACK: So NOSKINS > 1 will show
// skins, but // skins, but
return NULL; // not download new ones. return NULL; // not download new ones.
@ -210,6 +210,8 @@ Skin_NextDownload (void)
return; // started a download return; // started a download
} }
Netchan_AckPacket (&cls.netchan);
cls.downloadtype = dl_none; cls.downloadtype = dl_none;
// now load them in for real // now load them in for real
@ -303,7 +305,7 @@ void
Skin_Init (void) Skin_Init (void)
{ {
Cmd_AddCommand ("skins", Skin_Skins_f, "Download all skins that are currently in use"); Cmd_AddCommand ("skins", Skin_Skins_f, "Download all skins that are currently in use");
Cmd_AddCommand ("allskins", Skin_AllSkins_f, "Download all skins that are currently in use"); Cmd_AddCommand ("allskins", Skin_AllSkins_f, "Force all player skins to one skin");
Cmd_AddCommand ("color", CL_Color_f, "The pant and shirt color (color shirt pants) Note that if only shirt color is given, pants will match"); Cmd_AddCommand ("color", CL_Color_f, "The pant and shirt color (color shirt pants) Note that if only shirt color is given, pants will match");
Skin_Init_Translation (); Skin_Init_Translation ();
} }
@ -311,14 +313,14 @@ Skin_Init (void)
void void
Skin_Init_Cvars (void) Skin_Init_Cvars (void)
{ {
baseskin = Cvar_Get ("baseskin", "base", CVAR_NONE, baseskin = Cvar_Get ("baseskin", "base", CVAR_NONE, NULL,
"default base skin name"); "default base skin name");
noskins = Cvar_Get ("noskins", "0", CVAR_NONE, noskins = Cvar_Get ("noskins", "0", CVAR_NONE, NULL,
"set to 1 to not download new skins"); "set to 1 to not download new skins");
skin = Cvar_Get ("skin", "", CVAR_ARCHIVE | CVAR_USERINFO, "Players skin"); skin = Cvar_Get ("skin", "", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Players skin");
topcolor = Cvar_Get ("topcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, topcolor = Cvar_Get ("topcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
"Players color on top"); "Players color on top");
bottomcolor = Cvar_Get ("bottomcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, bottomcolor = Cvar_Get ("bottomcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
"Players color on bottom"); "Players color on bottom");
} }

View file

@ -33,6 +33,12 @@
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
# include <unistd.h> # include <unistd.h>
#endif #endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View file

@ -1,354 +0,0 @@
/*
snd_alsa_0_6.c
(description)
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <sys/asoundlib.h>
#include "console.h"
#include "qargs.h"
#include "sound.h"
#include "va.h"
static int snd_inited;
static snd_pcm_t *pcm_handle;
static snd_pcm_hw_info_t hwinfo;
static snd_pcm_hw_params_t hwparams;
static snd_pcm_sw_params_t swparams;
static const snd_pcm_channel_area_t *mmap_running_areas;
static int card = -1, dev = -1;
int
check_card (int card)
{
snd_ctl_t *handle;
int rc;
if ((rc = snd_ctl_open (&handle, va ("hw:%d", card))) < 0) {
Con_Printf ("Error: control open (%i): %s\n", card, snd_strerror (rc));
return rc;
}
if (dev == -1) {
while (1) {
if ((rc = snd_ctl_pcm_next_device (handle, &dev)) < 0) {
Con_Printf ("Error: next device: %s\n", snd_strerror (rc));
return rc;
}
if (dev < 0)
break;
if ((rc = snd_pcm_open (&pcm_handle, va ("hw:%d,%d", card, dev),
SND_PCM_STREAM_PLAYBACK,
SND_PCM_NONBLOCK)) == 0) {
goto exit;
}
}
} else {
if ((rc = snd_pcm_open (&pcm_handle, va ("hw:%d,%d", card, dev),
SND_PCM_STREAM_PLAYBACK,
SND_PCM_NONBLOCK)) == 0) {
goto exit;
}
Con_Printf ("Error: snd_pcm_open %d: %s\n", dev, snd_strerror (rc));
goto exit;
}
rc = 1;
exit:
snd_ctl_close(handle);
return rc;
}
qboolean
SNDDMA_Init (void)
{
int rc = 0, i;
char *err_msg = "";
int rate = -1, format = -1, stereo = -1, frag_size;
if ((i = COM_CheckParm ("-sndcard")) != 0) {
card = atoi (com_argv[i + 1]);
}
if ((i = COM_CheckParm ("-snddev")) != 0) {
dev = atoi (com_argv[i + 1]);
}
if ((i = COM_CheckParm ("-sndbits")) != 0) {
i = atoi (com_argv[i + 1]);
if (i == 16) {
format = SND_PCM_FMTBIT_S16_LE;
} else if (i == 8) {
format = SND_PCM_FMTBIT_U8;
} else {
Con_Printf ("Error: invalid sample bits: %d\n", i);
return 0;
}
}
if ((i = COM_CheckParm ("-sndspeed")) != 0) {
rate = atoi (com_argv[i + 1]);
if (rate != 44100 && rate != 22050 && rate != 11025) {
Con_Printf ("Error: invalid sample rate: %d\n", rate);
return 0;
}
}
if ((i = COM_CheckParm ("-sndmono")) != 0) {
stereo = 0;
}
if (card == -1) {
if (snd_card_next(&card) < 0 || card < 0) {
Con_Printf ("No sound cards detected\n");
return 0;
}
while (card >= 0) {
rc = check_card (card);
if (rc < 0)
return 0;
if (!rc)
goto dev_openned;
}
} else {
if (dev == -1) {
rc = check_card (card);
if (rc < 0)
return 0;
if (!rc)
goto dev_openned;
} else {
if ((rc = snd_pcm_open (&pcm_handle, va ("hw:%d,%d", card, dev),
SND_PCM_STREAM_PLAYBACK,
SND_PCM_NONBLOCK)) == 0) {
Con_Printf ("Error: audio open error: %s\n", snd_strerror (rc));
return 0;
}
goto dev_openned;
}
}
Con_Printf ("Error: audio open error: %s\n", snd_strerror (rc));
return 0;
dev_openned:
Con_Printf ("Using card %d, device %d.\n", card, dev);
memset (&hwinfo, 0, sizeof (hwinfo));
snd_pcm_hw_info_any (&hwinfo);
hwinfo.access_mask = SND_PCM_ACCBIT_MMAP_INTERLEAVED;
err_msg = "snd_pcm_hw_info";
if ((rc = snd_pcm_hw_info (pcm_handle, &hwinfo)) < 0)
goto error;
Con_Printf ("%08x %08x\n", hwinfo.access_mask, hwinfo.format_mask);
rate = 44100;
frag_size = 4;
#if 0 // XXX
if ((rate == -1 || rate == 44100) && hwinfo.rates & SND_PCM_RATE_44100) {
rate = 44100;
frag_size = 256; /* assuming stereo 8 bit */
} else if ((rate == -1 || rate == 22050)
&& hwinfo.rates & SND_PCM_RATE_22050) {
rate = 22050;
frag_size = 128; /* assuming stereo 8 bit */
} else if ((rate == -1 || rate == 11025)
&& hwinfo.rates & SND_PCM_RATE_11025) {
rate = 11025;
frag_size = 64; /* assuming stereo 8 bit */
} else {
Con_Printf ("ALSA: desired rates not supported\n");
goto error_2;
}
#endif
if ((format == -1 || format == SND_PCM_FMTBIT_S16_LE)
&& hwinfo.format_mask & SND_PCM_FORMAT_S16_LE) {
format = SND_PCM_FORMAT_S16_LE;
} else if ((format == -1 || format == SND_PCM_FORMAT_U8)
&& hwinfo.format_mask & SND_PCM_FORMAT_U8) {
format = SND_PCM_FORMAT_U8;
} else {
Con_Printf ("ALSA: desired formats not supported\n");
goto error_2;
}
// XXX can't support non-interleaved stereo
if (stereo && (hwinfo.access_mask & SND_PCM_ACCBIT_MMAP_INTERLEAVED)
&& hwinfo.channels_max >= 2) {
stereo = 1;
} else {
stereo = 0;
}
memset (&hwparams, 0, sizeof (hwparams));
// XXX can't support non-interleaved stereo
hwparams.access = stereo ? SND_PCM_ACCESS_MMAP_INTERLEAVED
: SND_PCM_ACCESS_MMAP_NONINTERLEAVED;
hwparams.format = format;
hwparams.rate = rate;
hwparams.channels = stereo + 1;
hwparams.fragment_size = 32;
hwparams.fragments = 512;
err_msg = "snd_pcm_hw_params";
if ((rc = snd_pcm_hw_params (pcm_handle, &hwparams)) < 0) {
Con_Printf("failed: %08x\n", hwparams.fail_mask);
goto error;
}
memset (&swparams, 0, sizeof (swparams));
swparams.start_mode = SND_PCM_START_EXPLICIT;
swparams.xrun_mode = SND_PCM_XRUN_FRAGMENT;
swparams.xfer_min = 1;
swparams.xfer_align = 1;
err_msg = "snd_pcm_sw_params";
if ((rc = snd_pcm_sw_params (pcm_handle, &swparams)) < 0) {
Con_Printf("failed: %08x\n", swparams.fail_mask);
goto error;
}
err_msg = "audio prepare";
if ((rc = snd_pcm_prepare (pcm_handle)) < 0)
goto error;
mmap_running_areas = snd_pcm_mmap_areas (pcm_handle);
shm = &sn;
memset ((dma_t *) shm, 0, sizeof (*shm));
shm->splitbuffer = 0;
shm->channels = hwparams.channels;
shm->submission_chunk = frag_size; // don't mix less than this #
shm->samplepos = 0; // in mono samples
shm->samplebits = hwparams.format == SND_PCM_FORMAT_S16_LE ? 16 : 8;
shm->samples = hwparams.fragment_size * hwparams.fragments
* shm->channels; // mono samples in buffer
shm->speed = hwparams.rate;
shm->buffer = (unsigned char *) mmap_running_areas->addr;
Con_Printf ("%5d stereo\n", shm->channels - 1);
Con_Printf ("%5d samples\n", shm->samples);
Con_Printf ("%5d samplepos\n", shm->samplepos);
Con_Printf ("%5d samplebits\n", shm->samplebits);
Con_Printf ("%5d submission_chunk\n", shm->submission_chunk);
Con_Printf ("%5d speed\n", shm->speed);
Con_Printf ("0x%x dma buffer\n", (int) shm->buffer);
Con_Printf ("%5d total_channels\n", total_channels);
snd_inited = 1;
return 1;
error:
Con_Printf ("Error: %s: %s\n", err_msg, snd_strerror (rc));
error_2:
snd_pcm_close (pcm_handle);
return 0;
}
static inline int
get_hw_ptr ()
{
size_t app_ptr;
ssize_t delay;
int hw_ptr;
if (snd_pcm_state (pcm_handle) != SND_PCM_STATE_RUNNING)
return 0;
app_ptr = snd_pcm_mmap_offset (pcm_handle);
snd_pcm_delay (pcm_handle, &delay);
hw_ptr = app_ptr - delay;
return hw_ptr;
}
int
SNDDMA_GetDMAPos (void)
{
int hw_ptr;
if (!snd_inited)
return 0;
hw_ptr = get_hw_ptr ();
hw_ptr *= shm->channels;
shm->samplepos = hw_ptr;
return shm->samplepos;
}
void
SNDDMA_Shutdown (void)
{
if (snd_inited) {
snd_pcm_close (pcm_handle);
snd_inited = 0;
}
}
/*
SNDDMA_Submit
Send sound to device if buffer isn't really the dma buffer
*/
void
SNDDMA_Submit (void)
{
int count = paintedtime - soundtime;
int avail;
int missed;
int state;
int hw_ptr;
int offset;
state = snd_pcm_state (pcm_handle);
switch (state) {
case SND_PCM_STATE_XRUN:
//snd_pcm_reset (pcm_handle);
snd_pcm_prepare (pcm_handle);
//break;
case SND_PCM_STATE_PREPARED:
snd_pcm_mmap_forward (pcm_handle, count);
snd_pcm_start (pcm_handle);
//break;
case SND_PCM_STATE_RUNNING:
hw_ptr = get_hw_ptr ();
missed = hw_ptr - shm->samplepos / shm->channels;
count -= missed;
offset = snd_pcm_mmap_offset (pcm_handle);
if (offset > hw_ptr)
count -= (offset - hw_ptr);
else
count -= (hwparams.fragments - hw_ptr + offset);
if (count < 0) {
snd_pcm_rewind (pcm_handle, -count);
} else if (count > 0) {
avail = snd_pcm_avail_update (pcm_handle);
if (avail > 0 && count > avail) {
snd_pcm_mmap_forward (pcm_handle, avail);
count -= avail;
}
snd_pcm_mmap_forward (pcm_handle, count);
}
break;
default:
printf("snd_alsa: nexpected state: %d\n", state);
break;
}
}

279
source/snd_alsa_0_9.c Normal file
View file

@ -0,0 +1,279 @@
/*
snd_alsa_0_9.c
Support for ALSA 0.9 sound driver (cvs development version)
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <alsa/asoundlib.h>
#include "qtypes.h"
#include "sound.h"
#include "qargs.h"
#include "console.h"
static int snd_inited;
static snd_pcm_t *pcm;
static char *pcmname = NULL;
size_t buffer_size;
qboolean
SNDDMA_Init(void)
{
int err,i;
int rate=-1,bps=-1,stereo=-1,frag_size;
snd_pcm_hw_params_t *hw;
snd_pcm_sw_params_t *sw;
snd_pcm_hw_params_alloca(&hw);
snd_pcm_sw_params_alloca(&sw);
if ((i=COM_CheckParm("-sndpcm"))!=0) {
pcmname=com_argv[i+1];
}
if ((i=COM_CheckParm("-sndbits")) != 0) {
bps = atoi(com_argv[i+1]);
if (bps != 16 && bps != 8) {
Con_Printf("Error: invalid sample bits: %d\n", i);
return 0;
}
}
if ((i=COM_CheckParm("-sndspeed")) != 0) {
rate = atoi(com_argv[i+1]);
if (rate!=44100 && rate!=22050 && rate!=11025) {
Con_Printf("Error: invalid sample rate: %d\n", rate);
return 0;
}
}
if ((i=COM_CheckParm("-sndmono")) != 0) {
stereo=0;
}
if ((i=COM_CheckParm("-sndstereo")) != 0) {
stereo=1;
}
if (!pcmname)
pcmname = "plug:0,0";
if ((err=snd_pcm_open(&pcm, pcmname,
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK))<0) {
Con_Printf("Error: audio open error: %s\n", snd_strerror(err));
return 0;
}
Con_Printf("Using PCM %s.\n", pcmname);
snd_pcm_hw_params_any(pcm, hw);
switch (rate) {
case -1:
if (snd_pcm_hw_params_set_rate_near(pcm, hw, 44100, 0) >= 0) {
frag_size = 256; /* assuming stereo 8 bit */
rate = 44100;
} else if (snd_pcm_hw_params_set_rate_near(pcm, hw, 22050, 0) >= 0) {
frag_size = 128; /* assuming stereo 8 bit */
rate = 22050;
} else if (snd_pcm_hw_params_set_rate_near(pcm, hw, 11025, 0) >= 0) {
frag_size = 64; /* assuming stereo 8 bit */
rate = 11025;
} else {
Con_Printf("ALSA: no useable rates\n");
goto error;
}
break;
case 11025:
case 22050:
case 44100:
if (snd_pcm_hw_params_set_rate_near(pcm, hw, rate, 0) >= 0) {
frag_size = 64 * rate / 11025; /* assuming stereo 8 bit */
break;
}
/* Fall through */
default:
Con_Printf("ALSA: desired rate not supported\n");
goto error;
}
switch (bps) {
case -1:
if (snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_S16_LE) >= 0) {
bps = 16;
} else if (snd_pcm_hw_params_set_format(pcm, hw, SND_PCM_FORMAT_U8) >= 0) {
bps = 8;
} else {
Con_Printf("ALSA: no useable formats\n");
goto error;
}
break;
case 8:
case 16:
if (snd_pcm_hw_params_set_format(pcm, hw,
bps == 8 ? SND_PCM_FORMAT_U8 :
SND_PCM_FORMAT_S16) >= 0) {
break;
}
/* Fall through */
default:
Con_Printf("ALSA: desired format not supported\n");
goto error;
}
if (snd_pcm_hw_params_set_access(pcm, hw,
SND_PCM_ACCESS_MMAP_INTERLEAVED) < 0) {
Con_Printf("ALSA: interleaved is not supported\n");
goto error;
}
switch (stereo) {
case -1:
if (snd_pcm_hw_params_set_channels(pcm, hw, 2) >= 0) {
stereo = 1;
} else if (snd_pcm_hw_params_set_channels(pcm, hw, 1) >= 0) {
stereo = 0;
} else {
Con_Printf("ALSA: no useable channels\n");
goto error;
}
break;
case 0:
case 1:
if (snd_pcm_hw_params_set_channels(pcm, hw, stereo ? 2 : 1) >= 0)
break;
/* Fall through */
default:
Con_Printf("ALSA: desired channels not supported\n");
goto error;
}
snd_pcm_hw_params_set_period_size_near(pcm, hw, frag_size, 0);
err = snd_pcm_hw_params(pcm, hw);
if (err < 0) {
Con_Printf("ALSA: unable to install hw params\n");
goto error;
}
snd_pcm_sw_params_current(pcm, sw);
snd_pcm_sw_params_set_start_mode(pcm, sw, SND_PCM_START_EXPLICIT);
snd_pcm_sw_params_set_xrun_mode(pcm, sw, SND_PCM_XRUN_NONE);
err = snd_pcm_sw_params(pcm, sw);
if (err < 0) {
Con_Printf("ALSA: unable to install sw params\n");
goto error;
}
shm=&sn;
memset((dma_t*)shm,0,sizeof(*shm));
shm->splitbuffer = 0;
shm->channels=stereo+1;
shm->submission_chunk = snd_pcm_hw_params_get_period_size (hw, 0); // don't mix less than this #
shm->samplepos=0; // in mono samples
shm->samplebits=bps;
buffer_size = snd_pcm_hw_params_get_buffer_size(hw);
shm->samples=buffer_size*shm->channels; // mono samples in buffer
shm->speed=rate;
SNDDMA_GetDMAPos ();//XXX sets shm->buffer
Con_Printf("%5d stereo\n", shm->channels - 1);
Con_Printf("%5d samples\n", shm->samples);
Con_Printf("%5d samplepos\n", shm->samplepos);
Con_Printf("%5d samplebits\n", shm->samplebits);
Con_Printf("%5d submission_chunk\n", shm->submission_chunk);
Con_Printf("%5d speed\n", shm->speed);
Con_Printf("0x%x dma buffer\n", (int)shm->buffer);
Con_Printf("%5d total_channels\n", total_channels);
snd_inited=1;
return 1;
error:
snd_pcm_close(pcm);
return 0;
}
int
SNDDMA_GetDMAPos(void)
{
snd_pcm_uframes_t offset;
snd_pcm_uframes_t nframes = shm->samples/shm->channels;
const snd_pcm_channel_area_t *areas;
if (!snd_inited)
return 0;
snd_pcm_mmap_begin (pcm, &areas, &offset, &nframes);
offset *= shm->channels;
nframes *= shm->channels;
shm->samplepos = offset;
shm->buffer = areas->addr;//XXX FIXME there's an area per channel
return shm->samplepos;
}
void
SNDDMA_Shutdown(void)
{
if (snd_inited) {
snd_pcm_close(pcm);
snd_inited = 0;
}
}
/*
SNDDMA_Submit
Send sound to device if buffer isn't really the dma buffer
*/
void
SNDDMA_Submit(void)
{
snd_pcm_uframes_t offset;
snd_pcm_uframes_t nframes;
const snd_pcm_channel_area_t *areas;
int state;
int count = paintedtime - soundtime;
nframes = count / shm->channels;
snd_pcm_mmap_begin (pcm, &areas, &offset, &nframes);
state = snd_pcm_state (pcm);
switch (state) {
case SND_PCM_STATE_PREPARED:
snd_pcm_mmap_commit (pcm, offset, nframes);
snd_pcm_start (pcm);
break;
case SND_PCM_STATE_RUNNING:
snd_pcm_mmap_commit (pcm, offset, nframes);
break;
default:
break;
}
}

Some files were not shown because too many files have changed in this diff Show more