mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-04-23 23:11:14 +00:00
Compare commits
150 commits
Author | SHA1 | Date | |
---|---|---|---|
|
9a9367ae08 | ||
|
630b1e7a4f | ||
|
6be99353a1 | ||
|
86f6ce2265 | ||
|
36b83eae86 | ||
|
7fa170c325 | ||
|
1e1ee75773 | ||
|
1afaefd9dc | ||
|
0fad122bc3 | ||
|
412959acba | ||
|
0bca15c502 | ||
|
aed7b1c08d | ||
|
f15ca83c60 | ||
|
326dc35b41 | ||
|
02005a95a4 | ||
|
55229ae4e2 | ||
|
0de1421e61 | ||
|
ae066e93a7 | ||
|
294e8b5dea | ||
|
2f5e58be2d | ||
|
ba5f9ae9a9 | ||
|
b7727dc730 | ||
|
808e3ace87 | ||
|
548ff2f227 | ||
|
1ed975edd5 | ||
|
4fa410afef | ||
|
c577657e8e | ||
|
7dccb4388d | ||
|
76bee6c8ab | ||
|
305fc0c371 | ||
|
d74f867b06 | ||
|
363aca5b84 | ||
|
f4dc013a3d | ||
|
6714119351 | ||
|
c4fe80e9c3 | ||
|
11f65cc599 | ||
|
0fbfd46be0 | ||
|
6c04ad09f8 | ||
|
a823912075 | ||
|
f3f427bf4b | ||
|
4c7c5880fe | ||
|
11de1a1fde | ||
|
afc4f250c8 | ||
|
b2a74984e9 | ||
|
609feb779c | ||
|
4c9a189f90 | ||
|
883b7ecf80 | ||
|
f3c2c4e868 | ||
|
1362736e55 | ||
|
5a889df497 | ||
|
cf16e6c5d7 | ||
|
e0b00dfda0 | ||
|
e20541700c | ||
|
86270446e9 | ||
|
e72ebb6c63 | ||
|
bc6ff9fc19 | ||
|
8f66467568 | ||
|
df184072f1 | ||
|
3cde1a0608 | ||
|
7a0ba8ca2e | ||
|
759729b5a8 | ||
|
920de43af9 | ||
|
5369e82456 | ||
|
eb974c6dcb | ||
|
a90f8132a7 | ||
|
d90d3d0de3 | ||
|
f3e7e4d1bc | ||
|
d97095fe87 | ||
|
3fc2675cb8 | ||
|
88c3955b4f | ||
|
9de78a5d83 | ||
|
d1f33ed6a6 | ||
|
978d90f9f7 | ||
|
a7c23e13a9 | ||
|
dd134f9c4f | ||
|
765a22a033 | ||
|
8a4cc8a526 | ||
|
1a9db8c2eb | ||
|
2e88971a08 | ||
|
540d13b588 | ||
|
9d23ea9db0 | ||
|
272abade38 | ||
|
75089e506e | ||
|
bfc25fa462 | ||
|
72d8bd6af7 | ||
|
6162fd8017 | ||
|
8327d1edac | ||
|
2d5f4b86fb | ||
|
6a75c4e00d | ||
|
bd06625c55 | ||
|
b9caa4273c | ||
|
bf6afa6ad4 | ||
|
5b46db8796 | ||
|
75ecbe3032 | ||
|
06b06abc74 | ||
|
54076d1a07 | ||
|
0e3d9f385a | ||
|
74a61f22f7 | ||
|
ad37b9cedd | ||
|
a8df60c554 | ||
|
05545350e7 | ||
|
f922262b61 | ||
|
5c63c96340 | ||
|
6f1587ff7f | ||
|
49d7b35d43 | ||
|
24841130a7 | ||
|
8cca7c7dd9 | ||
|
b68b6a4dd3 | ||
|
b4dfcb0906 | ||
|
89dd78e5fe | ||
|
a033a03624 | ||
|
f15c42184d | ||
|
e703935e9b | ||
|
bb39a9252b | ||
|
c2cf684118 | ||
|
4ae1fda2e1 | ||
|
fcd38297d9 | ||
|
c32a59b343 | ||
|
6d9846e2ce | ||
|
2bb966d1f7 | ||
|
5cda3dc3cb | ||
|
63f6f3e9cd | ||
|
4f7561fd92 | ||
|
32c6b2be38 | ||
|
19c37bbcb3 | ||
|
ea7e76fab7 | ||
|
2cac0ae365 | ||
|
942732d3b9 | ||
|
c41b730fb8 | ||
|
cabd99e201 | ||
|
6356c8e596 | ||
|
fdc8bedd2e | ||
|
20b9411bcc | ||
|
2bb4a60a69 | ||
|
c3208b87e7 | ||
|
d3e280a088 | ||
|
d81eb19c1f | ||
|
01baf4a868 | ||
|
e1638eba85 | ||
|
e5cd5030ae | ||
|
8d68ffe9f0 | ||
|
ac94390460 | ||
|
de22be39ba | ||
|
ca06d3994d | ||
|
30a0105e82 | ||
|
8dead3b82d | ||
|
a76c7779a7 | ||
|
192eba3898 | ||
|
96722e9137 | ||
|
cedd063a6a |
143 changed files with 4369 additions and 3677 deletions
|
@ -13,9 +13,8 @@ EXTRA_DIST= README.WIN newtree.dsw ChangeLog \
|
|||
NOCONV_DIST= $(distdir)/include/win32/resources/icon1.ico
|
||||
|
||||
changelog::
|
||||
-touch ChangeLog
|
||||
-tools/cvs2cl/cvs2cl.pl -b --utc
|
||||
-rm -f ChangeLog.bak
|
||||
( cd $(top_srcdir); \
|
||||
tools/cvs2cl/cvs2cl.pl --stdout -b --utc ) > ChangeLog
|
||||
|
||||
dist-zip: distdir
|
||||
-chmod -R a+r $(distdir)
|
||||
|
|
204
NEWS
204
NEWS
|
@ -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
|
||||
|
125
acconfig.h
125
acconfig.h
|
@ -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_
|
|
@ -1,2 +1,4 @@
|
|||
#!/bin/sh
|
||||
aclocal && autoheader && automake --add-missing && autoconf
|
||||
echo "If you see a couple warnings about cross-compiling above, don't worry"
|
||||
|
||||
|
|
362
configure.in
362
configure.in
|
@ -10,18 +10,17 @@ AC_VALIDATE_CACHED_SYSTEM_TUPLE(
|
|||
exit 1
|
||||
)
|
||||
|
||||
|
||||
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
|
||||
PROGRAM=QuakeForge
|
||||
QW_VERSION=2.40
|
||||
QSG_VERSION=2.0
|
||||
|
||||
AC_DEFINE_UNQUOTED(PROGRAM, "$PROGRAM")
|
||||
AC_DEFINE_UNQUOTED(QW_VERSION, "$QW_VERSION")
|
||||
AC_DEFINE_UNQUOTED(QSG_VERSION, "$QSG_VERSION")
|
||||
AC_DEFINE_UNQUOTED(PROGRAM, "$PROGRAM", ["Proper" package name])
|
||||
AC_DEFINE_UNQUOTED(QW_VERSION, "$QW_VERSION", [Define this to the QuakeWorld standard version you support])
|
||||
AC_DEFINE_UNQUOTED(QSG_VERSION, "$QSG_VERSION", [Define this to the QSG standard version you support in QuakeWorld])
|
||||
|
||||
AC_SUBST(PROGRAM)
|
||||
AC_SUBST(QW_VERSION)
|
||||
|
@ -32,6 +31,9 @@ AC_SUBST(ISODATE)
|
|||
|
||||
AC_LANG_C
|
||||
|
||||
if test ${AR-unset} = unset; then
|
||||
AR="ar"
|
||||
fi
|
||||
endian=""
|
||||
case "$host_os" in
|
||||
mingw32*)
|
||||
|
@ -39,11 +41,14 @@ case "$host_os" in
|
|||
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include/win32"
|
||||
CPPFLAGS="$CPPFLAGS -I\$(top_srcdir)/include/win32/resources"
|
||||
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"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(AR)
|
||||
|
||||
dnl ==================================================================
|
||||
dnl Checks for programs.
|
||||
|
@ -57,25 +62,11 @@ AC_PROG_RANLIB
|
|||
AM_PROG_LEX
|
||||
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)
|
||||
|
||||
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 Checks for system services
|
||||
dnl ==================================================================
|
||||
|
@ -84,7 +75,6 @@ AC_SYS_LONG_FILE_NAMES
|
|||
AC_EXEEXT
|
||||
AC_OBJEXT
|
||||
|
||||
|
||||
dnl ==================================================================
|
||||
dnl Checks for header files.
|
||||
dnl ==================================================================
|
||||
|
@ -95,21 +85,23 @@ AC_HEADER_MAJOR
|
|||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS(
|
||||
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 \
|
||||
dsound.h errno.h fcntl.h fnmatch.h ggi/ggi.h glide/sst1vid.h io.h \
|
||||
direct.h dirent.h dlfcn.h dpmi.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 \
|
||||
machine/soundcard.h malloc.h math.h mgraph.h _mingw.h netdb.h \
|
||||
netinet/in.h pwd.h setjmp.h signal.h stdarg.h stdio.h stdlib.h \
|
||||
string.h strings.h sys/asoundlib.h sys/audioio.h sys/filio.h \
|
||||
machine/soundcard.h malloc.h math.h mgraph.h mme/mmsystem.h \
|
||||
mme/mme_public.h _mingw.h netdb.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/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
|
||||
)
|
||||
|
||||
if test "x$mingw" = xyes; then
|
||||
AC_MSG_CHECKING(for fnmatch.h)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_FNMATCH_H)
|
||||
AC_DEFINE(HAVE_FNMATCH_H, 1, [Define this if you have fnmatch.h])
|
||||
else
|
||||
AC_CHECK_HEADERS(fnmatch.h)
|
||||
fi
|
||||
|
@ -128,8 +120,8 @@ AC_STRUCT_TM
|
|||
if test "x$cross_compiling" = xyes; then
|
||||
AC_MSG_CHECKING(whether byte ordering is bigendian)
|
||||
AC_ARG_WITH(endian,
|
||||
[ --with-endian=TYPE set endian of target system for
|
||||
cross-compiling. TYPE = little or big.],
|
||||
[ --with-endian=TYPE set endian of target system for
|
||||
cross-compiling. TYPE = little or big.],
|
||||
endian="$withval",
|
||||
)
|
||||
case "x$endian" in
|
||||
|
@ -153,11 +145,13 @@ else
|
|||
AC_C_BIGENDIAN
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(usleep)
|
||||
|
||||
AC_MSG_CHECKING(that fnmatch is in fnmatch.h)
|
||||
AC_TRY_COMPILE(
|
||||
[#include "fnmatch.h"],
|
||||
[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(no)
|
||||
)
|
||||
|
@ -166,7 +160,7 @@ AC_MSG_CHECKING(for socklen_t in sys/types.h)
|
|||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[ 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(no)
|
||||
dnl FreeBSD 4.0 has it in sys/socket.h
|
||||
|
@ -175,7 +169,7 @@ AC_TRY_COMPILE(
|
|||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[ 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)
|
||||
)
|
||||
)
|
||||
|
@ -185,7 +179,7 @@ AC_TRY_LINK(
|
|||
[asm(".long _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)
|
||||
)
|
||||
|
||||
|
@ -193,7 +187,7 @@ AC_MSG_CHECKING(for size_t in sys/types.h)
|
|||
AC_TRY_COMPILE(
|
||||
[#include <sys/types.h>],
|
||||
[ 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)
|
||||
)
|
||||
|
||||
|
@ -203,7 +197,7 @@ AC_TRY_COMPILE(
|
|||
[#include <sys/types.h>
|
||||
#include <sys/socket.h>],
|
||||
[ 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)
|
||||
)
|
||||
|
||||
|
@ -212,7 +206,7 @@ AC_TRY_COMPILE(
|
|||
[#include <sys/types.h>
|
||||
#include <netinet/in.h>],
|
||||
[ 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)
|
||||
)
|
||||
|
||||
|
@ -221,7 +215,7 @@ AC_TRY_COMPILE(
|
|||
[#include <sys/types.h>
|
||||
#include <netinet/in.h>],
|
||||
[ 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)
|
||||
)
|
||||
|
||||
|
@ -229,12 +223,12 @@ AC_MSG_CHECKING(for zero length array syntax)
|
|||
AC_TRY_COMPILE(
|
||||
[],
|
||||
[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(
|
||||
[],
|
||||
[struct { int foo; int bar[]; } foo;],
|
||||
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_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(
|
||||
gethostname gethostbyname connect gettimeofday getwd mkdir \
|
||||
ftime _ftime fcntl stat putenv select socket strerror strstr \
|
||||
snprintf _snprintf vsnprintf _vsnprintf strsep dlopen getaddrinfo \
|
||||
getnameinfo
|
||||
access _access \
|
||||
connect dlopen fcntl ftime getaddrinfo gethostname gethostbyname \
|
||||
getnameinfo gettimeofday mkdir _mkdir select socket stat strerror \
|
||||
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=""
|
||||
if test "x$ac_cv_func_dlopen" != "xyes"; then
|
||||
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
|
||||
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
|
||||
if test "x$ac_cv_func_vsnprintf" = "xno" -a \
|
||||
"x$ac_cv_func__vsnprintf" = "xno"; then
|
||||
dnl libdb may have this
|
||||
AC_CHECK_LIB(db,vsnprintf)
|
||||
AC_CHECK_LIB(db, vsnprintf)
|
||||
fi
|
||||
|
||||
dnl Checks for working -lm
|
||||
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
|
||||
|
||||
AC_ARG_ENABLE(zlib,
|
||||
[ --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)
|
||||
if test "x$HAVE_ZLIB" = "xyes"; then
|
||||
Z_LIBS="-lz"
|
||||
AC_DEFINE(HAVE_ZLIB)
|
||||
AC_DEFINE(HAVE_ZLIB, 1, [Define if you have zlib])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -303,7 +310,7 @@ AC_ARG_WITH(ipv6,
|
|||
if test "x$withval" = xno ; then
|
||||
NETTYPE_IPV6=no
|
||||
else
|
||||
AC_DEFINE(HAVE_IPV6)
|
||||
AC_DEFINE(HAVE_IPV6, 1, [Define this if you want IPv6 support])
|
||||
NETTYPE_IPV6=yes
|
||||
if test "x$withval" != xyes ; then
|
||||
LIBS="$LIBS -L${withval}"
|
||||
|
@ -389,7 +396,7 @@ AC_SUBST(GGI_LIBS)
|
|||
dnl Checks for Linux FBDev support
|
||||
AC_ARG_WITH(fbdev,
|
||||
[ --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
|
||||
dnl We should still be able to compile it even if
|
||||
dnl there is no fbdev support in the running kernel
|
||||
|
@ -401,7 +408,7 @@ if test "x$HAVE_FBDEV" = xyes; then
|
|||
AC_TRY_COMPILE(
|
||||
[#include "linux/fb.h"],
|
||||
[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(no)
|
||||
)
|
||||
|
@ -409,7 +416,7 @@ if test "x$HAVE_FBDEV" = xyes; then
|
|||
AC_TRY_COMPILE(
|
||||
[#include "linux/fb.h"],
|
||||
[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(no)
|
||||
)
|
||||
|
@ -417,7 +424,7 @@ if test "x$HAVE_FBDEV" = xyes; then
|
|||
AC_TRY_COMPILE(
|
||||
[#include "linux/fb.h"],
|
||||
[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(no)
|
||||
)
|
||||
|
@ -454,16 +461,18 @@ AC_SUBST(SVGA_CFLAGS)
|
|||
AC_SUBST(SVGA_LIBS)
|
||||
|
||||
dnl Checks for X11 and XShm
|
||||
AC_PATH_XTRA
|
||||
if test "x$no_x" = x; then
|
||||
HAVE_X=yes
|
||||
AC_CHECK_LIB(Xext, XShmQueryExtension,
|
||||
X_SHM_LIB=-lXext,
|
||||
HAVE_X=no,
|
||||
[ $X_LIBS -lX11 $X_EXTRA_LIBS ]
|
||||
)
|
||||
if test "x$mingw" != xyes; then
|
||||
AC_PATH_XTRA
|
||||
if test "x$no_x" = x; then
|
||||
HAVE_X=yes
|
||||
AC_CHECK_LIB(Xext, XShmQueryExtension,
|
||||
X_SHM_LIB=-lXext,
|
||||
HAVE_X=no,
|
||||
[ $X_LIBS -lX11 $X_EXTRA_LIBS ]
|
||||
)
|
||||
fi
|
||||
AC_SUBST(X_SHM_LIB)
|
||||
fi
|
||||
AC_SUBST(X_SHM_LIB)
|
||||
|
||||
dnl Check for XFree86-VidMode support
|
||||
AC_ARG_ENABLE(vidmode,
|
||||
|
@ -475,7 +484,7 @@ if test "x$HAVE_VIDMODE" != xno; then
|
|||
AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
|
||||
dnl Make sure the library works
|
||||
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",,
|
||||
[$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,
|
||||
dnl Make sure the library works
|
||||
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",,
|
||||
[$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
|
||||
HAS_GLIDE=no
|
||||
else
|
||||
AC_DEFINE(HAVE_GLIDE)
|
||||
AC_DEFINE(HAVE_GLIDE, 1, [Define if you have the glide stuff])
|
||||
fi
|
||||
CPPFLAGS="$save_CPPFLAGS"
|
||||
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_TRY_COMPILE([#include "GL/gl.h"],
|
||||
[ 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_CHECK_HEADERS(GL/glext.h, HAVE_GL_GLEXT_H=yes)
|
||||
fi
|
||||
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$HAVE_GLX" = xyes; then
|
||||
HAVE_GLX=no
|
||||
AC_CHECK_LIB(GL, glColor4f,
|
||||
HAVE_GLX=yes
|
||||
OGL_NAME=GL,,
|
||||
[ -L$glx_libraries ]
|
||||
[ -L$glx_libraries -lX11 $X_EXTRA_LIBS ]
|
||||
)
|
||||
if test "x$HAVE_GLX" != xyes; then
|
||||
AC_CHECK_LIB(MesaGL, glColor4f,
|
||||
HAVE_GLX=yes
|
||||
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 ]
|
||||
)
|
||||
fi
|
||||
|
@ -611,6 +627,20 @@ else
|
|||
[ $X_LIBS ]
|
||||
)
|
||||
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
|
||||
|
||||
|
@ -618,7 +648,7 @@ if test "x$HAVE_GLX" = xyes; then
|
|||
test "x$GLX_CFLAGS" != x && GLX_CFLAGS="-I$GLX_CFLAGS"
|
||||
test "x$glx_libraries" != x && GLX_LIBS="-L$glx_libraries"
|
||||
GLX_LIBS="$GLX_LIBS -l$OGL_NAME"
|
||||
AC_DEFINE(HAVE_GLX)
|
||||
AC_DEFINE(HAVE_GLX, 1, [Define if you have GL/X11 stuff])
|
||||
else
|
||||
GLX_CFLAGS=""
|
||||
GLX_LIBS=""
|
||||
|
@ -626,14 +656,20 @@ fi
|
|||
AC_SUBST(GLX_CFLAGS)
|
||||
AC_SUBST(GLX_LIBS)
|
||||
|
||||
dnl SDL/SDL-GL checks
|
||||
AM_PATH_SDL(1.0.1, HAVE_SDL=yes, HAVE_SDL=no)
|
||||
AC_ARG_ENABLE(sdl,
|
||||
[ --disable-sdl disable checking for SDL],
|
||||
)
|
||||
|
||||
if test "x$HAVE_SDL" != xno; then
|
||||
AM_CHECK_SGL(1.1.1, HAVE_SGL=yes, HAVE_SGL=no)
|
||||
if test "x$enable_sdl" != xno; then
|
||||
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
|
||||
AC_SUBST(HAVE_SDL)
|
||||
AC_SUBST(HAVE_SGL)
|
||||
|
||||
# 3Dfx stuff..
|
||||
|
||||
|
@ -702,7 +738,7 @@ case "${host}" in
|
|||
AC_ARG_ENABLE(asmopt,
|
||||
[ --disable-asmopt disable assembler optimization],
|
||||
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
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
@ -718,7 +754,7 @@ dnl ==================================================================
|
|||
AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes)
|
||||
|
||||
AC_ARG_ENABLE(alsa,
|
||||
[ --disable-alsa disable alsa support],
|
||||
[ --disable-alsa disable alsa support],
|
||||
)
|
||||
|
||||
SNDTYPE=""
|
||||
|
@ -752,12 +788,12 @@ QF_maGiC_VALUE
|
|||
[
|
||||
#include <sys/asoundlib.h>
|
||||
#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
|
||||
#endif
|
||||
#endif
|
||||
],
|
||||
SNDTYPE="ALSA_0_6"
|
||||
SNDTYPE="ALSA_0_9"
|
||||
SOUND_LIBS="-lasound"
|
||||
)
|
||||
)
|
||||
|
@ -828,7 +864,7 @@ fi
|
|||
|
||||
dnl Win32
|
||||
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],[
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
|
@ -850,14 +886,14 @@ AC_SUBST(SOUND_LIBS)
|
|||
AC_SUBST(SOUND_CFLAGS)
|
||||
|
||||
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_OSS, test "$SNDTYPE" = "OSS")
|
||||
AM_CONDITIONAL(SNDTYPE_SDL, test "$SNDTYPE" = "SDL")
|
||||
AM_CONDITIONAL(SNDTYPE_SGI, test "$SNDTYPE" = "SGI")
|
||||
AM_CONDITIONAL(SNDTYPE_SUN, test "$SNDTYPE" = "SUN")
|
||||
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
|
||||
AC_MSG_CHECKING(for joystick support)
|
||||
|
@ -932,11 +968,11 @@ QF_maGiC_VALUE
|
|||
CD_LIBS="-lcdaudio -lmediad -lds"
|
||||
)
|
||||
fi
|
||||
|
||||
if test -z "$CDTYPE"; then
|
||||
AC_EGREP_CPP([QF_maGIC_VALUE],
|
||||
AC_EGREP_CPP([QF_maGiC_VALUE],
|
||||
[
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h>
|
||||
#if defined(MCI_SET_DOOR_OPEN)
|
||||
QF_maGiC_VALUE
|
||||
#endif
|
||||
|
@ -962,15 +998,16 @@ dnl ==================================================================
|
|||
|
||||
if test "x$ac_cv_func_connect" != "xyes"; then
|
||||
AC_CHECK_LIB(socket, connect,
|
||||
NET_LIBS="$NET_LIBS -lsocket"
|
||||
ac_cv_func_connect=yes
|
||||
)
|
||||
NET_LIBS="$NET_LIBS -lsocket"
|
||||
ac_cv_func_connect=yes
|
||||
)
|
||||
fi
|
||||
|
||||
if test "x$ac_cv_func_gethostbyname" != "xyes"; then
|
||||
AC_CHECK_LIB(nsl, gethostbyname,
|
||||
NET_LIBS="$NET_LIBS -lnsl"
|
||||
ac_cv_func_gethostbyname=yes
|
||||
)
|
||||
NET_LIBS="$NET_LIBS -lnsl"
|
||||
ac_cv_func_gethostbyname=yes
|
||||
)
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for connect in -lwsock32])
|
||||
|
@ -979,7 +1016,7 @@ LIBS="$LIBS -lwsock32"
|
|||
AC_TRY_LINK([
|
||||
#include <winsock.h>
|
||||
],[
|
||||
connect(0, NULL, 42);
|
||||
connect (0, NULL, 42);
|
||||
],
|
||||
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
|
||||
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
|
||||
AC_MSG_RESULT(no)
|
||||
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)
|
||||
|
||||
|
||||
|
@ -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$exec_prefix" = xNONE && exec_prefix='${prefix}'
|
||||
|
||||
AC_ARG_WITH(newstyle,
|
||||
[ --with-newstyle compile with default search directories changed.
|
||||
id1 and qw become base, and rather than looking in
|
||||
. QuakeForge will look in ~/.quakeforge/ and
|
||||
\$datadir/games/quakeforge],
|
||||
newstyle=$withval, newstyle=auto
|
||||
)
|
||||
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"
|
||||
if test "x$SYSTYPE" = xWIN32; then
|
||||
default_globalconf="~/${PACKAGE}.conf"
|
||||
default_userconf="~/${PACKAGE}rc"
|
||||
default_sharepath="."
|
||||
default_userpath="."
|
||||
else
|
||||
default_globalconf="/etc/${PACKAGE}.conf"
|
||||
default_userconf="~/.${PACKAGE}rc"
|
||||
eval foo="$datadir"
|
||||
default_sharepath="$foo/games/$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
|
||||
|
||||
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
|
||||
globalconf="$default_globalconf"
|
||||
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,
|
||||
[ --with-user-cfg=FILE If set will change the name and location of the
|
||||
global config file used by QuakeForge. Defaults to
|
||||
/etc/quakeforge.conf.],
|
||||
globalconf="$withval", userconf="auto")
|
||||
(read-only) user config file. Defaults to
|
||||
~/.quakeforgerc],
|
||||
userconf="$withval", userconf="auto")
|
||||
if test "x$userconf" = "xauto" || test "x$userconf" = "xyes" || \
|
||||
test "x$userconf" = "xno"; then dnl yes/no sanity checks
|
||||
userconf="$default_userconf"
|
||||
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,
|
||||
[ --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
|
||||
sharepath="."
|
||||
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,
|
||||
[ --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
|
||||
userpath="."
|
||||
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
|
||||
CFLAGS=""
|
||||
|
@ -1107,6 +1108,7 @@ AC_ARG_ENABLE(debug,
|
|||
[ --enable-debug compile with debugging (for development)],
|
||||
debug=$enable_debug
|
||||
)
|
||||
|
||||
AC_MSG_CHECKING(for debugging)
|
||||
if test "x$debug" = xyes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
|
@ -1126,6 +1128,7 @@ AC_ARG_ENABLE(optimize,
|
|||
optimize=$disable_optimize,
|
||||
optimize=yes
|
||||
)
|
||||
|
||||
AC_ARG_WITH(amd,
|
||||
[ --with-amd Optimize for AMD processors instead of Intel],
|
||||
HAVE_AMD="yes",
|
||||
|
@ -1136,14 +1139,14 @@ if test "x$optimize" = xyes; then
|
|||
AC_MSG_RESULT(yes)
|
||||
BUILD_TYPE="$BUILD_TYPE Optimize"
|
||||
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)
|
||||
case "${host_cpu}" in
|
||||
i?86)
|
||||
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
|
||||
MORE_CFLAGS="-march=${host_cpu} -malign-loops=2 -malign-jumps=2 -malign-functions=2"
|
||||
MORE_CFLAGS="-march=${host_cpu}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
|
@ -1167,7 +1170,7 @@ fi
|
|||
AC_MSG_CHECKING(for packet logging)
|
||||
if test "x$packetlog" = xyes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(PACKET_LOGGING)
|
||||
AC_DEFINE(PACKET_LOGGING, 1, [Define this if you want packet logging])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
@ -1189,6 +1192,21 @@ if test "x$profile" = xyes; then
|
|||
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
|
||||
if test "x$GCC" = xyes; then
|
||||
dnl Check for -pipe vs -save-temps.
|
||||
|
@ -1202,18 +1220,13 @@ if test "x$check_pipe" = xyes; then
|
|||
AC_MSG_CHECKING(whether -pipe works)
|
||||
save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
pipe_ok=no
|
||||
AC_TRY_COMPILE(
|
||||
[],
|
||||
[],
|
||||
pipe_ok=yes
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no)
|
||||
CFLAGS="$save_CFLAGS"
|
||||
)
|
||||
CFLAGS="$save_CFLAGS"
|
||||
if test "x$pipe_ok" = xyes; then
|
||||
CFLAGS="$CFLAGS -pipe"
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl QuakeForge uses lots of BCPL-style (//) comments, which can cause problems
|
||||
|
@ -1242,12 +1255,23 @@ if test "x$GCC" != xyes; then
|
|||
esac
|
||||
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
|
||||
CFLAGS="$CFLAGS -Wall -Werror"
|
||||
# CFLAGS="$CFLAGS -Wall -pedantic"
|
||||
CFLAGS="$CFLAGS -Wall"
|
||||
if test -d $srcdir/CVS; then
|
||||
CFLAGS="$CFLAGS -Werror"
|
||||
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 Make sure we link against a working zlib
|
||||
dnl ==================================================================
|
||||
|
@ -1304,6 +1328,7 @@ if test "$clients" = "all"; then
|
|||
ENABLE_SDL=yes
|
||||
ENABLE_SGL=yes
|
||||
ENABLE_SVGA=yes
|
||||
ENABLE_WGL=yes
|
||||
ENABLE_X11=yes
|
||||
else
|
||||
ENABLE_3DFX=no
|
||||
|
@ -1314,6 +1339,7 @@ else
|
|||
ENABLE_SDL=no
|
||||
ENABLE_SGL=no
|
||||
ENABLE_SVGA=no
|
||||
ENABLE_WGL=no
|
||||
ENABLE_X11=no
|
||||
IFS=","
|
||||
for client in $clients; do
|
||||
|
@ -1342,6 +1368,9 @@ else
|
|||
svga)
|
||||
ENABLE_SVGA=yes
|
||||
;;
|
||||
wgl)
|
||||
ENABLE_WGL=yes
|
||||
;;
|
||||
x11)
|
||||
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)"
|
||||
CL_TARGETS="$CL_TARGETS SVGAlib"
|
||||
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
|
||||
TARGETS="$TARGETS qf-client-x11\$(EXEEXT)"
|
||||
CL_TARGETS="$CL_TARGETS X11"
|
||||
|
@ -1426,6 +1461,7 @@ AC_MSG_RESULT([
|
|||
Client support:$CL_TARGETS
|
||||
Sound system: $SNDTYPE
|
||||
IPv6 networking: $NETTYPE_IPV6
|
||||
Compression support: $HAVE_ZLIB
|
||||
|
||||
Shared game data directory: $sharepath
|
||||
Per-user game data directory: $userpath
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
AUTOMAKE_OPTIONS= foreign
|
||||
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
87
doc/config/glspeed.cfg
Normal 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
49
doc/config/swspeed.cfg
Normal 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
1
include/.gitignore
vendored
|
@ -4,4 +4,5 @@ Makefile
|
|||
config.h.in
|
||||
stamp-h.in
|
||||
stamp-h
|
||||
stamp-h1
|
||||
config.h
|
||||
|
|
|
@ -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 \
|
||||
\
|
||||
win32/fnmatch.h win32/version.h win32/version.h.in \
|
||||
win32/mingw/config.h \
|
||||
win32/resources/icon1.ico win32/resources/resource.h \
|
||||
win32/resources/quakeforge.rc win32/bc/borland.c win32/bc/config.h \
|
||||
win32/vc/config.h win32/vc/dirent.h
|
||||
|
|
|
@ -285,7 +285,7 @@ typedef struct
|
|||
|
||||
char levelname[40]; // for display on solo scoreboard
|
||||
int playernum;
|
||||
int stdver;
|
||||
float stdver; // QSG version
|
||||
|
||||
// refresh related state
|
||||
struct model_s *worldmodel; // cl_entitites[0].model
|
||||
|
|
|
@ -36,32 +36,36 @@
|
|||
|
||||
#include "qtypes.h"
|
||||
|
||||
void GetEvent( void );
|
||||
|
||||
extern Display *x_disp;
|
||||
extern int x_screen;
|
||||
extern Window x_root;
|
||||
extern XVisualInfo *x_visinfo;
|
||||
extern Visual *x_vis;
|
||||
extern Visual *x_vis;
|
||||
extern Window x_root;
|
||||
extern Window x_win;
|
||||
extern qboolean doShm;
|
||||
extern XVisualInfo *x_visinfo;
|
||||
extern double x_gamma;
|
||||
extern int x_screen;
|
||||
extern int x_shmeventtype;
|
||||
extern qboolean doShm;
|
||||
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 *));
|
||||
qboolean x11_del_event (int event, void (*event_handler)(XEvent *));
|
||||
void x11_process_event (void);
|
||||
void x11_process_events (void);
|
||||
void x11_open_display (void);
|
||||
void x11_close_display (void);
|
||||
void x11_create_null_cursor (void);
|
||||
void x11_set_vidmode (int, int);
|
||||
void x11_restore_vidmode (void);
|
||||
void x11_create_window (int, int);
|
||||
void x11_grab_keyboard (void);
|
||||
void x11_set_caption (char *);
|
||||
void x11_force_view_port (void);
|
||||
void x11_Init_Cvars (void);
|
||||
void GetEvent (void);
|
||||
|
||||
double X11_GetGamma (void);
|
||||
qboolean X11_AddEvent (int event, void (*event_handler)(XEvent *));
|
||||
qboolean X11_RemoveEvent (int event, void (*event_handler)(XEvent *));
|
||||
qboolean X11_SetGamma (double);
|
||||
void X11_CloseDisplay (void);
|
||||
void X11_CreateNullCursor (void);
|
||||
void X11_CreateWindow (int, int);
|
||||
void X11_ForceViewPort (void);
|
||||
void X11_GrabKeyboard (void);
|
||||
void X11_Init_Cvars (void);
|
||||
void X11_OpenDisplay (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_
|
||||
|
|
|
@ -26,17 +26,17 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef _CVAR_H
|
||||
#define _CVAR_H
|
||||
#ifndef __cvar_h_
|
||||
#define __cvar_h_
|
||||
|
||||
#include "qtypes.h"
|
||||
#include "quakeio.h"
|
||||
|
||||
typedef struct cvar_s
|
||||
{
|
||||
typedef struct cvar_s {
|
||||
char *name;
|
||||
char *string;
|
||||
int flags;
|
||||
void (*callback)(struct cvar_s *var);
|
||||
char *description; // for "help" command
|
||||
float value;
|
||||
int int_val;
|
||||
|
@ -44,8 +44,7 @@ typedef struct cvar_s
|
|||
struct cvar_s *next;
|
||||
} cvar_t;
|
||||
|
||||
typedef struct cvar_alias_s
|
||||
{
|
||||
typedef struct cvar_alias_s {
|
||||
char *name;
|
||||
cvar_t *cvar;
|
||||
struct cvar_alias_s *next;
|
||||
|
@ -57,19 +56,11 @@ typedef struct cvar_alias_s
|
|||
// specific configurations
|
||||
#define CVAR_USERINFO 2 // sent to server on connect or change
|
||||
#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_ROM 64 // display only, cannot be set by user at all
|
||||
#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
|
||||
// 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
|
||||
// *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
|
||||
// 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);
|
||||
|
||||
|
@ -120,9 +112,9 @@ void Cvar_WriteVariables (QFile *f);
|
|||
cvar_t *Cvar_FindVar (char *var_name);
|
||||
|
||||
void Cvar_Init_Hash (void);
|
||||
void Cvar_Init();
|
||||
void Cvar_Init (void);
|
||||
|
||||
void Cvar_Shutdown();
|
||||
void Cvar_Shutdown (void);
|
||||
|
||||
extern cvar_t *cvar_vars;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ void Draw_FadeScreen (void);
|
|||
void Draw_String8 (int x, int y, char *str);
|
||||
void Draw_AltString8 (int x, int y, char *str);
|
||||
qpic_t *Draw_PicFromWad (char *name);
|
||||
qpic_t *Draw_CachePic (char *path);
|
||||
qpic_t *Draw_CachePic (char *path, qboolean alpha);
|
||||
void Draw_Crosshair(void);
|
||||
|
||||
#endif // _DRAW_H
|
||||
|
|
|
@ -240,11 +240,10 @@ void GL_Set2D (void);
|
|||
//
|
||||
// gl_rmain.c
|
||||
//
|
||||
void GL_CheckBrightness (unsigned char *pal);
|
||||
//qboolean R_CullBox (vec3_t mins, vec3_t maxs);
|
||||
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;
|
||||
|
||||
|
@ -280,11 +279,6 @@ void R_StoreEfrags (efrag_t **ppefrag);
|
|||
extern qboolean lighthalf;
|
||||
extern unsigned char lighthalf_v[3];
|
||||
|
||||
//
|
||||
// gl_mesh.c
|
||||
//
|
||||
void GL_MakeAliasModelDisplayLists (model_t *m, aliashdr_t *hdr);
|
||||
|
||||
//
|
||||
// gl_rsurf.c
|
||||
//
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef _INFO_H
|
||||
#define _INFO_H
|
||||
#ifndef __info_h_
|
||||
#define __info_h_
|
||||
|
||||
#ifdef HAVE_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 "qtypes.h"
|
||||
|
||||
#define MAX_INFO_STRING 512
|
||||
#define MAX_SERVERINFO_STRING 512
|
||||
#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_RemovePrefixedKeys (char *start, char prefix);
|
||||
void Info_SetValueForKey (char *s, char *key, char *value, size_t maxsize);
|
||||
void Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize);
|
||||
void Info_Print (char *s);
|
||||
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, int flags);
|
||||
char *Info_ValueForKey (char *s, char *key);
|
||||
qboolean Info_Validate (char *s);
|
||||
|
||||
#endif // _INFO_H
|
||||
#endif // __info_h_
|
||||
|
|
|
@ -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 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.
|
||||
* Yes, this is the same as sqrt(VectorSubtract then DotProduct),
|
||||
|
|
|
@ -37,7 +37,11 @@
|
|||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef HAVE_IPV6
|
||||
byte ip[16];
|
||||
#else
|
||||
byte ip[4];
|
||||
#endif
|
||||
unsigned short port;
|
||||
unsigned short family; // used to be pad, before IPV6
|
||||
} 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)));
|
||||
qboolean Netchan_Process (netchan_t *chan);
|
||||
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_CanReliable (netchan_t *chan);
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "protocol.h"
|
||||
#include "mathlib.h"
|
||||
#include "model.h"
|
||||
#include "progs.h"
|
||||
|
||||
#define STOP_EPSILON 0.1
|
||||
|
||||
|
@ -39,19 +40,24 @@ typedef struct
|
|||
{
|
||||
vec3_t normal;
|
||||
float dist;
|
||||
} pmplane_t;
|
||||
} 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 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
|
||||
pmplane_t plane; // surface normal at impact
|
||||
int ent; // entity the surface is on
|
||||
} pmtrace_t;
|
||||
plane_t plane; // surface normal at impact
|
||||
|
||||
// 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
|
||||
typedef struct
|
||||
|
@ -62,7 +68,6 @@ typedef struct
|
|||
int info; // for client or server to identify
|
||||
} physent_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sequence; // just for debugging prints
|
||||
|
@ -113,10 +118,10 @@ void PlayerMove (void);
|
|||
void Pmove_Init (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);
|
||||
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
|
||||
|
|
102
include/qfplist.h
Normal file
102
include/qfplist.h
Normal 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_
|
|
@ -42,6 +42,7 @@
|
|||
extern cvar_t *fs_userpath;
|
||||
extern cvar_t *fs_sharepath;
|
||||
extern cvar_t *fs_skinbase;
|
||||
extern cvar_t *fs_basegame;
|
||||
|
||||
extern int com_filesize;
|
||||
struct cache_user_s;
|
||||
|
|
|
@ -120,7 +120,8 @@ typedef enum
|
|||
cs_zombie, // client has been disconnected, but don't reuse
|
||||
// connection for a couple seconds
|
||||
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;
|
||||
|
||||
typedef struct
|
||||
|
@ -214,7 +215,7 @@ typedef struct client_s
|
|||
netchan_t netchan;
|
||||
int msecs, msec_cheating;
|
||||
double last_check;
|
||||
int stdver;
|
||||
float stdver; // QSG standards version
|
||||
} client_t;
|
||||
|
||||
// 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
|
||||
|
||||
extern struct cvar_s *sv_highchars;
|
||||
|
||||
extern cvar_t *sv_mintic, *sv_maxtic;
|
||||
extern cvar_t *sv_maxspeed;
|
||||
|
||||
|
|
|
@ -26,49 +26,30 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef _SYS_H
|
||||
#define _SYS_H
|
||||
#ifndef __sys_h
|
||||
#define __sys_h
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "gcc_attr.h"
|
||||
|
||||
//
|
||||
// file IO
|
||||
//
|
||||
extern struct cvar_s *sys_nostdout;
|
||||
|
||||
// returns the file size
|
||||
// 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);
|
||||
extern const char sys_char_map[256];
|
||||
|
||||
int Sys_FileOpenWrite (char *path);
|
||||
void Sys_FileClose (int handle);
|
||||
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);
|
||||
int Sys_FileTime (const char *path);
|
||||
void Sys_mkdir (const char *path);
|
||||
|
||||
//
|
||||
// memory protection
|
||||
//
|
||||
void Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length);
|
||||
typedef void (*sys_printf_t) (const char *fmt, va_list args);
|
||||
|
||||
//
|
||||
// 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_SetPrintf (sys_printf_t func);
|
||||
|
||||
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);
|
||||
|
||||
double Sys_DoubleTime (void);
|
||||
|
||||
char *Sys_ConsoleInput (void);
|
||||
const char *Sys_ConsoleInput (void);
|
||||
|
||||
void Sys_Sleep (void);
|
||||
// called to yield for a little bit so as
|
||||
|
@ -78,11 +59,19 @@ void Sys_LowFPPrecision (void);
|
|||
void Sys_HighFPPrecision (void);
|
||||
void Sys_SetFPCW (void);
|
||||
|
||||
void Sys_Printf (char *fmt, ...) __attribute__((format(printf,1,2)));
|
||||
// send text to the console
|
||||
|
||||
void Sys_Init (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
|
||||
|
|
|
@ -33,29 +33,36 @@
|
|||
#include "qtypes.h"
|
||||
|
||||
#ifndef __GNUC__
|
||||
# if defined (__BORLANDC__) || defined (_MSC_VER)
|
||||
# if (defined(__BORLANDC__) && (__BORLANDC__ < 0x550))
|
||||
# pragma option -a1
|
||||
# else
|
||||
# pragma pack(push, tgainclude)
|
||||
# pragma pack(1)
|
||||
# endif
|
||||
# if defined (__DECC) && defined (__ALPHA)
|
||||
// uses __unaligned
|
||||
# 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
|
||||
#else
|
||||
# define __unaligned
|
||||
#endif
|
||||
|
||||
typedef struct _TargaHeader {
|
||||
unsigned char id_length __attribute__((packed));
|
||||
unsigned char colormap_type __attribute__((packed));
|
||||
unsigned char image_type __attribute__((packed));
|
||||
unsigned short colormap_index __attribute__((packed));
|
||||
unsigned short colormap_length __attribute__((packed));
|
||||
__unaligned unsigned short colormap_index __attribute__((packed));
|
||||
__unaligned unsigned short colormap_length __attribute__((packed));
|
||||
unsigned char colormap_size __attribute__((packed));
|
||||
unsigned short x_origin __attribute__((packed));
|
||||
unsigned short y_origin __attribute__((packed));
|
||||
unsigned short width __attribute__((packed));
|
||||
unsigned short height __attribute__((packed));
|
||||
__unaligned unsigned short x_origin __attribute__((packed));
|
||||
__unaligned unsigned short y_origin __attribute__((packed));
|
||||
__unaligned unsigned short width __attribute__((packed));
|
||||
__unaligned unsigned short height __attribute__((packed));
|
||||
unsigned char pixel_size __attribute__((packed));
|
||||
unsigned char attributes __attribute__((packed));
|
||||
} TargaHeader;
|
||||
|
|
|
@ -65,6 +65,7 @@ extern unsigned short d_8to16table[256];
|
|||
extern unsigned int d_8to24table[256];
|
||||
extern int scr_width, scr_height;
|
||||
extern qboolean DDActive;
|
||||
extern byte gammatable[256];
|
||||
|
||||
// called at startup and after any gamma correction
|
||||
void VID_SetPalette (unsigned char *palette);
|
||||
|
@ -90,9 +91,6 @@ void VID_Update (vrect_t *rects);
|
|||
// or not
|
||||
// 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_UnlockBuffer (void);
|
||||
|
||||
|
@ -108,4 +106,11 @@ void VID_GetWindowSize (int def_w, int def_h);
|
|||
int VID_ForceUnlockedAndReturnState (void);
|
||||
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_
|
||||
|
|
|
@ -65,23 +65,6 @@
|
|||
/* Version string */
|
||||
#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 */
|
||||
#undef HAVE_DGA
|
||||
|
||||
|
|
|
@ -68,23 +68,6 @@
|
|||
/* Version string */
|
||||
#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 */
|
||||
#undef HAVE_DGA
|
||||
|
||||
|
|
|
@ -75,23 +75,6 @@
|
|||
/* Version string */
|
||||
#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 */
|
||||
#undef HAVE_DGA
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
/* Version strings */
|
||||
#define PACKAGE "quakeforge"
|
||||
#define PROGRAM "QuakeForge"
|
||||
#define VERSION "0.3.0"
|
||||
#define VERSION "0.3.1"
|
||||
#define QW_VERSION "2.40"
|
||||
#define QSG_VERSION "2.0"
|
||||
|
||||
|
|
|
@ -35,14 +35,27 @@
|
|||
# pragma warning( disable : 4229 ) /* mgraph gets this */
|
||||
#endif
|
||||
|
||||
#define byte __hide_byte
|
||||
|
||||
#define LPCWAVEFORMATEX __hide_LPCWAVEFORMATEX_
|
||||
#include <windows.h>
|
||||
#include <ddraw.h>
|
||||
#undef LPCWAVEFORMATEX
|
||||
#ifdef WINNT
|
||||
#undef WINNT
|
||||
#include <dsound.h>
|
||||
#include <ddraw.h>
|
||||
#define WINNT
|
||||
#else
|
||||
#include <dsound.h>
|
||||
#include <ddraw.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MGRAPH_H
|
||||
# include <mgraph.h>
|
||||
#endif
|
||||
|
||||
#undef byte
|
||||
|
||||
#include "qtypes.h"
|
||||
|
||||
#ifndef WM_MOUSEWHEEL
|
||||
|
|
|
@ -33,23 +33,7 @@
|
|||
#include "mathlib.h"
|
||||
#include "model.h"
|
||||
#include "progs.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;
|
||||
#include "pmove.h"
|
||||
|
||||
#define MOVE_NORMAL 0
|
||||
#define MOVE_NOMONSTERS 1
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
set args -nosound -nocdaudio +setrom _windowed_mouse 0 +set gl_sky_clip 1 +set show_fps 1
|
||||
set height 0
|
||||
|
|
|
@ -31,8 +31,8 @@ AUTOMAKE_OPTIONS= foreign
|
|||
#
|
||||
# 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@
|
||||
|
||||
EXTRA_PROGRAMS= qf-server \
|
||||
|
@ -48,11 +48,12 @@ endif
|
|||
|
||||
if ASM_ARCH
|
||||
math_ASM = math.S sys_x86.S
|
||||
world_ASM= worlda.S
|
||||
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 \
|
||||
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
|
||||
|
@ -70,22 +71,18 @@ EXTRA_libqfnet_a_SOURCES= net_chan.c net_com.c net_udp.c net_udp6.c
|
|||
# ... System type
|
||||
#
|
||||
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
|
||||
libqfsys_sv_a_SOURCES= sv_sys_unix.c sys_unix.c
|
||||
libqfsys_sv_a_SOURCES= sv_sys_unix.c
|
||||
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
|
||||
world_ASM= worlda.S
|
||||
endif
|
||||
|
||||
server_SOURCES= pr_edict.c pr_exec.c pr_offs.c sv_ccmds.c sv_cvar.c \
|
||||
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_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_DEPENDENCIES= libqfnet.a libqfsys_sv.a
|
||||
|
||||
|
@ -95,44 +92,51 @@ qf_server_DEPENDENCIES= libqfnet.a libqfsys_sv.a
|
|||
# ... System type
|
||||
#
|
||||
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
|
||||
libqfsys_cl_a_SOURCES= cl_sys_unix.c sys_unix.c
|
||||
libqfsys_cl_a_SOURCES=
|
||||
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
|
||||
#
|
||||
if SNDTYPE_ALSA_0_5
|
||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_5.c
|
||||
endif
|
||||
if SNDTYPE_ALSA_0_6
|
||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_6.c
|
||||
endif
|
||||
else
|
||||
if SNDTYPE_ALSA_0_9
|
||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_alsa_0_9.c
|
||||
else
|
||||
if SNDTYPE_MME
|
||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_mme.c
|
||||
endif
|
||||
else
|
||||
if SNDTYPE_OSS
|
||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_oss.c
|
||||
endif
|
||||
else
|
||||
if SNDTYPE_SDL
|
||||
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
|
||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sgi.c
|
||||
endif
|
||||
else
|
||||
if SNDTYPE_SUN
|
||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_sun.c
|
||||
endif
|
||||
else
|
||||
if SNDTYPE_WIN32
|
||||
libqfsnd_a_SOURCES= snd_dma.c snd_mem.c snd_mix.c snd_win.c
|
||||
endif
|
||||
if SNDTYPE_NULL
|
||||
else
|
||||
libqfsnd_a_SOURCES= snd_null.c
|
||||
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 \
|
||||
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
|
||||
|
||||
#
|
||||
|
@ -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
|
||||
libqfcd_a_SOURCES= cd_linux.c
|
||||
endif
|
||||
else
|
||||
if CDTYPE_SDL
|
||||
libqfcd_a_SOURCES= cd_sdl.c
|
||||
endif
|
||||
libqfcd_a_INCLUDES=$(SDL_CFLAGS)
|
||||
else
|
||||
if CDTYPE_SGI
|
||||
libqfcd_a_SOURCES= cd_sgi.c
|
||||
endif
|
||||
else
|
||||
if CDTYPE_WIN32
|
||||
libqfcd_a_SOURCES= cd_win.c
|
||||
endif
|
||||
if CDTYPE_NULL
|
||||
else
|
||||
libqfcd_a_SOURCES= cd_null.c
|
||||
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
|
||||
|
||||
#
|
||||
|
@ -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
|
||||
libqfjs_a_SOURCES= joy_linux.c
|
||||
endif
|
||||
else
|
||||
if JOYTYPE_WIN32
|
||||
libqfjs_a_SOURCES= joy_win.c
|
||||
endif
|
||||
if JOYTYPE_NULL
|
||||
else
|
||||
libqfjs_a_SOURCES= joy_null.c
|
||||
endif
|
||||
endif
|
||||
libqfjs_a_CFLAGS= $(JOY_CFLAGS)
|
||||
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
|
||||
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 \
|
||||
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)
|
||||
|
@ -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
|
||||
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_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 \
|
||||
|
@ -204,7 +211,7 @@ soft_SOURCES= d_edge.c d_fill.c d_init.c d_modech.c \
|
|||
# ... Linux FBDev
|
||||
#
|
||||
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
|
||||
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
|
||||
$(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_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
|
||||
|
||||
#
|
||||
# ... 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_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
|
||||
|
||||
#
|
||||
# ... 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_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
|
||||
|
||||
#
|
||||
# ... 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_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
|
||||
|
||||
#
|
||||
# ... 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_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
|
||||
|
||||
#
|
||||
# ... 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_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
|
||||
#
|
||||
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_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 \
|
||||
|
@ -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
|
||||
#
|
||||
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_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
|
||||
|
||||
#
|
||||
# ... 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_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
|
||||
#
|
||||
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_DEPENDENCIES=libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a
|
||||
|
||||
#
|
||||
# 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_LDADD= $(CLIENT_LIBS)
|
||||
qf_client_wgl_SOURCES= $(common_sources) $(client_sources) $(ogl_sources) $(wgl_sources)
|
||||
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
|
||||
|
||||
#
|
||||
# Stuff that doesn't get linked into an executable NEEDS to be mentioned here,
|
||||
# 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-client-sdl.mak qf-client-win.mak qw_client.dsp \
|
||||
qf-client-sgl.mak qf-client-wgl.mak qf-client-win.mak
|
||||
|
||||
# Kill the temp files, hopefully.
|
||||
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
|
||||
|
|
|
@ -63,7 +63,7 @@ CDAudio_Eject (void)
|
|||
dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN,
|
||||
(DWORD) NULL);
|
||||
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 =
|
||||
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD) NULL);
|
||||
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,
|
||||
(DWORD) (LPVOID) & mciStatusParms);
|
||||
if (dwReturn) {
|
||||
Con_DPrintf ("MCI_STATUS failed (%i)\n", dwReturn);
|
||||
Con_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
|
||||
return;
|
||||
}
|
||||
if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) {
|
||||
|
@ -168,7 +168,7 @@ CDAudio_Play (byte track, qboolean looping)
|
|||
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
|
||||
(DWORD) (LPVOID) & mciStatusParms);
|
||||
if (dwReturn) {
|
||||
Con_DPrintf ("MCI_STATUS failed (%i)\n", dwReturn);
|
||||
Con_DPrintf ("MCI_STATUS failed (%li)\n", dwReturn);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ CDAudio_Play (byte track, qboolean looping)
|
|||
mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO,
|
||||
(DWORD) (LPVOID) & mciPlayParms);
|
||||
if (dwReturn) {
|
||||
Con_DPrintf ("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
|
||||
Con_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ CDAudio_Stop (void)
|
|||
|
||||
dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD) NULL);
|
||||
if (dwReturn) {
|
||||
Con_DPrintf ("MCI_STOP failed (%i)", dwReturn);
|
||||
Con_DPrintf ("MCI_STOP failed (%li)", dwReturn);
|
||||
}
|
||||
|
||||
wasPlaying = false;
|
||||
|
@ -236,7 +236,7 @@ CDAudio_Pause (void)
|
|||
mciSendCommand (wDeviceID, MCI_PAUSE, 0,
|
||||
(DWORD) (LPVOID) & mciGenericParms);
|
||||
if (dwReturn) {
|
||||
Con_DPrintf ("MCI_PAUSE failed (%i)", dwReturn);
|
||||
Con_DPrintf ("MCI_PAUSE failed (%li)", dwReturn);
|
||||
}
|
||||
|
||||
wasPlaying = playing;
|
||||
|
@ -266,7 +266,7 @@ CDAudio_Resume (void)
|
|||
mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY,
|
||||
(DWORD) (LPVOID) & mciPlayParms);
|
||||
if (dwReturn) {
|
||||
Con_DPrintf ("CDAudio: MCI_PLAY failed (%i)\n", dwReturn);
|
||||
Con_DPrintf ("CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
|
||||
return;
|
||||
}
|
||||
playing = true;
|
||||
|
@ -456,7 +456,7 @@ CDAudio_Init (void)
|
|||
mciSendCommand (0, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_SHAREABLE,
|
||||
(DWORD) (LPVOID) & mciOpenParms);
|
||||
if (dwReturn) {
|
||||
Con_Printf ("CDAudio_Init: MCI_OPEN failed (%i)\n", dwReturn);
|
||||
Con_Printf ("CDAudio_Init: MCI_OPEN failed (%li)\n", dwReturn);
|
||||
return -1;
|
||||
}
|
||||
wDeviceID = mciOpenParms.wDeviceID;
|
||||
|
@ -467,7 +467,7 @@ CDAudio_Init (void)
|
|||
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_TIME_FORMAT,
|
||||
(DWORD) (LPVOID) & mciSetParms);
|
||||
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);
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ Cam_Lock (int playernum)
|
|||
Sbar_Changed ();
|
||||
}
|
||||
|
||||
pmtrace_t
|
||||
trace_t
|
||||
Cam_DoTrace (vec3_t vec1, vec3_t vec2)
|
||||
{
|
||||
#if 0
|
||||
|
@ -180,7 +180,7 @@ Cam_TryFlyby (player_state_t * self, player_state_t * player, vec3_t vec,
|
|||
qboolean checkvis)
|
||||
{
|
||||
vec3_t v;
|
||||
pmtrace_t trace;
|
||||
trace_t trace;
|
||||
float len;
|
||||
|
||||
vectoangles (vec, v);
|
||||
|
@ -213,7 +213,7 @@ Cam_TryFlyby (player_state_t * self, player_state_t * player, vec3_t vec,
|
|||
static qboolean
|
||||
Cam_IsVisible (player_state_t * player, vec3_t vec)
|
||||
{
|
||||
pmtrace_t trace;
|
||||
trace_t trace;
|
||||
vec3_t v;
|
||||
float d;
|
||||
|
||||
|
@ -603,9 +603,9 @@ Cam_Reset (void)
|
|||
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_chasecam = Cvar_Get ("cl_chasecam", "0", CVAR_NONE, "get first person view of the person you are tracking 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, NULL, "get first person view of the person you are tracking in spectator mode");
|
||||
cl_camera_maxpitch =
|
||||
Cvar_Get ("cl_camera_maxpitch", "10", CVAR_NONE, "highest camera pitch in spectator mode");
|
||||
cl_camera_maxyaw = Cvar_Get ("cl_camera_maxyaw", "30", CVAR_NONE, "highest camera yaw 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, NULL, "highest camera yaw in spectator mode");
|
||||
}
|
||||
|
|
|
@ -29,8 +29,15 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
#include "cvar.h"
|
||||
#include "msg.h"
|
||||
#include "va.h"
|
||||
|
@ -40,7 +47,9 @@ Cvar_Info (cvar_t *var)
|
|||
{
|
||||
if (var->flags & CVAR_USERINFO) {
|
||||
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) {
|
||||
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
||||
MSG_WriteString (&cls.netchan.message,
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "va.h"
|
||||
|
||||
void CL_FinishTimeDemo (void);
|
||||
int demotime_cached;
|
||||
|
||||
/*
|
||||
DEMO CODE
|
||||
|
@ -74,6 +75,7 @@ CL_StopPlayback (void)
|
|||
cls.demofile = NULL;
|
||||
cls.state = ca_disconnected;
|
||||
cls.demoplayback = 0;
|
||||
demotime_cached = 0;
|
||||
|
||||
if (cls.timedemo)
|
||||
CL_FinishTimeDemo ();
|
||||
|
@ -166,7 +168,6 @@ CL_GetDemoMessage (void)
|
|||
float demotime;
|
||||
byte c;
|
||||
usercmd_t *pcmd;
|
||||
static int demotime_cached;
|
||||
static float cached_demotime;
|
||||
|
||||
// read the time from the packet
|
||||
|
@ -618,7 +619,7 @@ CL_Record_f (void)
|
|||
|
||||
MSG_WriteByte (&buf, svc_updateentertime);
|
||||
MSG_WriteByte (&buf, i);
|
||||
MSG_WriteFloat (&buf, player->entertime);
|
||||
MSG_WriteFloat (&buf, realtime - player->entertime);
|
||||
|
||||
MSG_WriteByte (&buf, svc_updateuserinfo);
|
||||
MSG_WriteByte (&buf, i);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "msg.h"
|
||||
#include "pmove.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "sys.h"
|
||||
#include "view.h"
|
||||
|
||||
extern cvar_t *cl_predict_players;
|
||||
|
@ -963,6 +964,9 @@ CL_SetSolidEntities (void)
|
|||
continue;
|
||||
if (cl.model_precache[state->modelindex]->hulls[1].firstclipnode
|
||||
|| cl.model_precache[state->modelindex]->clipbox) {
|
||||
|
||||
if(pmove.numphysent>MAX_PHYSENTS) Sys_Error("Physents overflowed\n");
|
||||
|
||||
pmove.physents[pmove.numphysent].model =
|
||||
cl.model_precache[state->modelindex];
|
||||
VectorCopy (state->origin, pmove.physents[pmove.numphysent].origin);
|
||||
|
@ -1106,6 +1110,6 @@ CL_EmitEntities (void)
|
|||
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");
|
||||
}
|
||||
|
|
|
@ -731,7 +731,7 @@ CL_Input_Init (void)
|
|||
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.");
|
||||
}
|
||||
|
||||
|
|
224
source/cl_main.c
224
source/cl_main.c
|
@ -41,6 +41,10 @@
|
|||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
|
@ -51,6 +55,9 @@
|
|||
#ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
#endif
|
||||
#ifdef HAVE_RPC_TYPES_H
|
||||
# include <rpc/types.h>
|
||||
#endif
|
||||
|
||||
#include <setjmp.h>
|
||||
|
||||
|
@ -111,6 +118,7 @@ cvar_t *rcon_password;
|
|||
cvar_t *rcon_address;
|
||||
|
||||
cvar_t *cl_writecfg;
|
||||
cvar_t *cl_allow_cmd_pkt;
|
||||
|
||||
cvar_t *cl_timeout;
|
||||
|
||||
|
@ -121,10 +129,10 @@ cvar_t *cl_sbar_separator;
|
|||
cvar_t *cl_hudswap;
|
||||
cvar_t *cl_maxfps;
|
||||
|
||||
cvar_t *cl_cshift_bonus;
|
||||
cvar_t *cl_cshift_contents;
|
||||
cvar_t *cl_cshift_damage;
|
||||
cvar_t *cl_cshift_powerup;
|
||||
cvar_t *cl_cshift_bonus;
|
||||
cvar_t *cl_cshift_contents;
|
||||
cvar_t *cl_cshift_damage;
|
||||
cvar_t *cl_cshift_powerup;
|
||||
|
||||
cvar_t *lookspring;
|
||||
cvar_t *lookstrafe;
|
||||
|
@ -443,6 +451,21 @@ CL_ClearState (void)
|
|||
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
|
||||
|
||||
|
@ -461,6 +484,9 @@ CL_Disconnect (void)
|
|||
// stop sounds (especially looping!)
|
||||
S_StopAllSounds (true);
|
||||
|
||||
// Clean the Cshifts
|
||||
CL_StopCshifts ();
|
||||
|
||||
// if running a local server, shut it down
|
||||
if (cls.demoplayback)
|
||||
CL_StopPlayback ();
|
||||
|
@ -575,22 +601,22 @@ CL_FullServerinfo_f (void)
|
|||
|
||||
if ((p = Info_ValueForKey (cl.serverinfo, "*qf_version")) && *p) {
|
||||
if (server_version == NULL)
|
||||
Con_Printf ("QuakeForge Version %s Server\n", p);
|
||||
Con_Printf ("QuakeForge v%s server\n", p);
|
||||
server_version = strdup (p);
|
||||
} else if ((p = Info_ValueForKey (cl.serverinfo, "*version")) && *p) {
|
||||
if (server_version == NULL)
|
||||
Con_Printf ("Version %s Server\n", p);
|
||||
Con_Printf ("QuakeWorld v%s server\n", p);
|
||||
server_version = strdup (p);
|
||||
}
|
||||
|
||||
if ((p = Info_ValueForKey (cl.serverinfo, "*qsg_version")) && *p) {
|
||||
if ((cl.stdver = atoi (p)))
|
||||
Con_Printf ("QSG Standard version %i\n", cl.stdver);
|
||||
if ((cl.stdver = atof (p)))
|
||||
Con_Printf ("Server supports QSG v%s protocol\n", p);
|
||||
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 (stricmp (p, "none") == 0) {
|
||||
if (strcaseequal (p, "none")) {
|
||||
allowskybox = false;
|
||||
} else {
|
||||
allowskybox = true;
|
||||
|
@ -625,11 +651,11 @@ CL_AddQFInfoKeys (void)
|
|||
#ifdef HAVE_ZLIB
|
||||
strncat (cap, "z", sizeof (cap) - strlen (cap) - 1);
|
||||
#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,
|
||||
MAX_INFO_STRING);
|
||||
MAX_INFO_STRING, 0);
|
||||
Info_SetValueForStarKey (cls.userinfo, "*qsg_version", QSG_VERSION,
|
||||
MAX_INFO_STRING);
|
||||
MAX_INFO_STRING, 0);
|
||||
Con_Printf ("QuakeForge server detected\n");
|
||||
}
|
||||
|
||||
|
@ -688,10 +714,12 @@ CL_FullInfo_f (void)
|
|||
if (*s)
|
||||
s++;
|
||||
|
||||
if (!stricmp (key, pmodel_name) || !stricmp (key, emodel_name))
|
||||
if (strcaseequal (key, pmodel_name) || strcaseequal (key, emodel_name))
|
||||
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");
|
||||
return;
|
||||
}
|
||||
if (!stricmp (Cmd_Argv (1), pmodel_name)
|
||||
|| !strcmp (Cmd_Argv (1), emodel_name)) return;
|
||||
if (strcaseequal (Cmd_Argv (1), pmodel_name)
|
||||
|| strcaseequal (Cmd_Argv (1), emodel_name))
|
||||
return;
|
||||
|
||||
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)
|
||||
Cmd_ForwardToServer ();
|
||||
}
|
||||
|
@ -881,8 +911,9 @@ CL_ConnectionlessPacket (void)
|
|||
|
||||
Con_Printf ("client command\n");
|
||||
|
||||
if ((*(unsigned int *) net_from.ip != *(unsigned int *) net_local_adr.ip
|
||||
&& *(unsigned int *) net_from.ip != htonl (INADDR_LOOPBACK))) {
|
||||
if (!cl_allow_cmd_pkt->int_val
|
||||
|| ((*(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");
|
||||
return;
|
||||
}
|
||||
|
@ -919,6 +950,7 @@ CL_ConnectionlessPacket (void)
|
|||
return;
|
||||
}
|
||||
|
||||
Con_Printf ("%s\n", cmdtext);
|
||||
Cbuf_AddText (cmdtext);
|
||||
allowremotecmd = false;
|
||||
return;
|
||||
|
@ -1114,16 +1146,14 @@ CL_Init (void)
|
|||
|
||||
cls.state = ca_disconnected;
|
||||
|
||||
Info_SetValueForKey (cls.userinfo, "name", "unnamed", MAX_INFO_STRING);
|
||||
Info_SetValueForKey (cls.userinfo, "topcolor", "0", MAX_INFO_STRING);
|
||||
Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", MAX_INFO_STRING);
|
||||
Info_SetValueForKey (cls.userinfo, "rate", "2500", MAX_INFO_STRING);
|
||||
Info_SetValueForKey (cls.userinfo, "msg", "1", MAX_INFO_STRING);
|
||||
Info_SetValueForKey (cls.userinfo, "name", "unnamed", MAX_INFO_STRING, 0);
|
||||
Info_SetValueForKey (cls.userinfo, "topcolor", "0", MAX_INFO_STRING, 0);
|
||||
Info_SetValueForKey (cls.userinfo, "bottomcolor", "0", MAX_INFO_STRING, 0);
|
||||
Info_SetValueForKey (cls.userinfo, "rate", "2500", MAX_INFO_STRING, 0);
|
||||
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", QW_VERSION);
|
||||
Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING);
|
||||
Info_SetValueForStarKey (cls.userinfo, "stdver", QSG_VERSION,
|
||||
MAX_INFO_STRING);
|
||||
Info_SetValueForStarKey (cls.userinfo, "*ver", st, MAX_INFO_STRING, 0);
|
||||
#ifdef PACKET_LOGGING
|
||||
Net_Log_Init();
|
||||
#endif
|
||||
|
@ -1197,103 +1227,105 @@ CL_Init_Cvars (void)
|
|||
{
|
||||
// LordHavoc: some people like it asking on quit, others don't...
|
||||
confirm_quit =
|
||||
Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, "confirm quit command");
|
||||
show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE,
|
||||
Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, NULL, "confirm quit command");
|
||||
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");
|
||||
// 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");
|
||||
host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE,
|
||||
host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE, NULL,
|
||||
"display host processing times");
|
||||
developer = Cvar_Get ("developer", "0", CVAR_NONE,
|
||||
developer = Cvar_Get ("developer", "0", CVAR_NONE, NULL,
|
||||
"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");
|
||||
// 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");
|
||||
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)");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE,
|
||||
cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE, NULL,
|
||||
"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");
|
||||
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE,
|
||||
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
"forward speed");
|
||||
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE,
|
||||
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
"backward speed");
|
||||
cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, "strafe speed");
|
||||
cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE,
|
||||
cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, NULL, "strafe speed");
|
||||
cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL,
|
||||
"move `run' speed multiplier");
|
||||
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, "turning speed");
|
||||
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE,
|
||||
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL, "turning speed");
|
||||
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL,
|
||||
"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");
|
||||
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");
|
||||
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, "status bar mode");
|
||||
cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE,
|
||||
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL, "status bar mode");
|
||||
cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, NULL,
|
||||
"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?");
|
||||
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");
|
||||
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)");
|
||||
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");
|
||||
lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE,
|
||||
lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, NULL,
|
||||
"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");
|
||||
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");
|
||||
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");
|
||||
m_forward = Cvar_Get ("m_forward", "1", CVAR_NONE,
|
||||
m_forward = Cvar_Get ("m_forward", "1", CVAR_NONE, NULL,
|
||||
"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");
|
||||
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");
|
||||
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
|
||||
localid = Cvar_Get ("localid", "", CVAR_NONE,
|
||||
localid = Cvar_Get ("localid", "", CVAR_NONE, NULL,
|
||||
"FIXME: This has something to do with client authentication. No Description");
|
||||
|
||||
//
|
||||
// info mirrors
|
||||
//
|
||||
name = Cvar_Get ("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO,
|
||||
name = Cvar_Get ("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
|
||||
"Player name");
|
||||
password = Cvar_Get ("password", "", CVAR_USERINFO, "Server password");
|
||||
spectator = Cvar_Get ("spectator", "", CVAR_USERINFO,
|
||||
password = Cvar_Get ("password", "", CVAR_USERINFO, NULL, "Server password");
|
||||
spectator = Cvar_Get ("spectator", "", CVAR_USERINFO, NULL,
|
||||
"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.");
|
||||
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");
|
||||
msg = Cvar_Get ("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, "Determines the type of messages reported 0 is maximum, 4 is none");
|
||||
noaim = Cvar_Get ("noaim", "0", CVAR_ARCHIVE | CVAR_USERINFO,
|
||||
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, NULL,
|
||||
"Auto aim off switch. Set to 1 to turn off.");
|
||||
}
|
||||
|
||||
|
@ -1384,13 +1416,15 @@ Host_WriteConfiguration (void)
|
|||
/*
|
||||
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)
|
||||
{
|
||||
float fps;
|
||||
float timescale = 1.0;
|
||||
float timedifference;
|
||||
|
||||
if (cls.demoplayback) {
|
||||
timescale = max (0, cl_demospeed->value);
|
||||
|
@ -1406,9 +1440,11 @@ Host_SimulationTime (float time)
|
|||
else
|
||||
fps = bound (30, rate->value / 80.0, 72);
|
||||
|
||||
if (!cls.timedemo && ((realtime - oldrealtime) < (timescale / fps)))
|
||||
return false; // framerate is too high
|
||||
return true;
|
||||
timedifference = (timescale / fps) - (realtime - oldrealtime);
|
||||
|
||||
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 time3 = 0;
|
||||
int pass1, pass2, pass3;
|
||||
float sleeptime;
|
||||
|
||||
if (setjmp (host_abort)) // something bad happened, or the server disconnected
|
||||
return;
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
host_frametime = realtime - oldrealtime;
|
||||
oldrealtime = realtime;
|
||||
|
@ -1455,20 +1497,21 @@ Host_Frame (float time)
|
|||
// resend a connection request if necessary
|
||||
if (cls.state == ca_disconnected) {
|
||||
CL_CheckForResend ();
|
||||
} else
|
||||
} else {
|
||||
CL_SendCmd ();
|
||||
|
||||
// Set up prediction for other players
|
||||
CL_SetUpPlayerPrediction (false);
|
||||
CL_SetUpPlayerPrediction (false);
|
||||
|
||||
// do client side motion prediction
|
||||
CL_PredictMove ();
|
||||
CL_PredictMove ();
|
||||
|
||||
// Set up prediction for other players
|
||||
CL_SetUpPlayerPrediction (true);
|
||||
CL_SetUpPlayerPrediction (true);
|
||||
|
||||
// build a refresh entity list
|
||||
CL_EmitEntities ();
|
||||
CL_EmitEntities ();
|
||||
}
|
||||
|
||||
// update video
|
||||
if (host_speeds->int_val)
|
||||
|
@ -1558,7 +1601,7 @@ Host_Init (void)
|
|||
// only reads from within the quake file system, and changing that is
|
||||
// probably Not A Good Thing (tm).
|
||||
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);
|
||||
Cbuf_Execute_Sets ();
|
||||
|
||||
|
@ -1567,7 +1610,7 @@ Host_Init (void)
|
|||
Cbuf_Execute_Sets ();
|
||||
|
||||
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);
|
||||
Cbuf_Execute_Sets ();
|
||||
|
||||
|
@ -1606,7 +1649,6 @@ Host_Init (void)
|
|||
W_LoadWadFile ("gfx.wad");
|
||||
Key_Init ();
|
||||
Con_Init ();
|
||||
M_Init ();
|
||||
Mod_Init ();
|
||||
|
||||
// Con_Printf ("Exe: "__TIME__" "__DATE__"\n");
|
||||
|
@ -1624,6 +1666,7 @@ Host_Init (void)
|
|||
CDAudio_Init ();
|
||||
VID_Init (host_basepal);
|
||||
IN_Init ();
|
||||
M_Init ();
|
||||
Draw_Init ();
|
||||
SCR_Init ();
|
||||
R_Init ();
|
||||
|
@ -1648,6 +1691,7 @@ Host_Init (void)
|
|||
Skin_Init ();
|
||||
CL_Init ();
|
||||
IN_Init ();
|
||||
M_Init ();
|
||||
#endif
|
||||
|
||||
// Reparse the command line for + commands.
|
||||
|
|
|
@ -273,6 +273,8 @@ Model_NextDownload (void)
|
|||
return; // started a download
|
||||
}
|
||||
|
||||
Netchan_AckPacket (&cls.netchan);
|
||||
|
||||
for (i = 1; i < MAX_MODELS; i++) {
|
||||
if (!cl.model_name[i][0])
|
||||
break;
|
||||
|
@ -334,6 +336,8 @@ Sound_NextDownload (void)
|
|||
return; // started a download
|
||||
}
|
||||
|
||||
Netchan_AckPacket (&cls.netchan);
|
||||
|
||||
for (i = 1; i < MAX_SOUNDS; i++) {
|
||||
if (!cl.sound_name[i][0])
|
||||
break;
|
||||
|
@ -629,7 +633,7 @@ CL_ParseServerData (void)
|
|||
// game directory
|
||||
str = MSG_ReadString ();
|
||||
|
||||
if (stricmp (gamedirfile, str)) {
|
||||
if (strcasecmp (gamedirfile, str)) {
|
||||
// save current config
|
||||
Host_WriteConfiguration ();
|
||||
cflag = true;
|
||||
|
@ -1030,7 +1034,8 @@ CL_SetInfo (void)
|
|||
|
||||
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);
|
||||
}
|
||||
|
@ -1051,7 +1056,8 @@ CL_ServerInfo (void)
|
|||
|
||||
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));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,10 +38,13 @@
|
|||
#include "commdef.h"
|
||||
#include "console.h"
|
||||
#include "cvar.h"
|
||||
#include "keys.h"
|
||||
#include "mathlib.h"
|
||||
#include "pmove.h"
|
||||
|
||||
cvar_t *cl_nopred;
|
||||
cvar_t *cl_pushlatency;
|
||||
cvar_t *cl_nostatpred;
|
||||
|
||||
extern frame_t *view_frame;
|
||||
|
||||
|
@ -52,6 +55,15 @@ void
|
|||
CL_PredictUsercmd (player_state_t * from, player_state_t * to, usercmd_t *u,
|
||||
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
|
||||
if (u->msec > 50) {
|
||||
player_state_t temp;
|
||||
|
@ -111,7 +123,8 @@ CL_PredictMove (void)
|
|||
if (cl.paused)
|
||||
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;
|
||||
if (cl.time > realtime)
|
||||
|
@ -133,10 +146,11 @@ CL_PredictMove (void)
|
|||
from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
||||
|
||||
// we can now render a frame
|
||||
if (cls.state == ca_onserver) { // first update is the final signon
|
||||
// stage
|
||||
if (cls.state == ca_onserver) {
|
||||
// first update is the final signon stage
|
||||
VID_SetCaption (cls.servername);
|
||||
cls.state = ca_active;
|
||||
key_dest = key_game;
|
||||
}
|
||||
|
||||
if (cl_nopred->int_val) {
|
||||
|
@ -144,6 +158,16 @@ CL_PredictMove (void)
|
|||
VectorCopy (from->playerstate[cl.playernum].origin, cl.simorg);
|
||||
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
|
||||
oldphysent = pmove.numphysent;
|
||||
CL_SetSolidPlayers (cl.playernum);
|
||||
|
@ -153,8 +177,8 @@ CL_PredictMove (void)
|
|||
for (i = 1; i < UPDATE_BACKUP - 1 && cls.netchan.incoming_sequence + i <
|
||||
cls.netchan.outgoing_sequence; i++) {
|
||||
to = &cl.frames[(cls.netchan.incoming_sequence + i) & UPDATE_MASK];
|
||||
CL_PredictUsercmd (&from->playerstate[cl.playernum]
|
||||
, &to->playerstate[cl.playernum], &to->cmd,
|
||||
CL_PredictUsercmd (&from->playerstate[cl.playernum],
|
||||
&to->playerstate[cl.playernum], &to->cmd,
|
||||
cl.spectator);
|
||||
cl.onground = onground;
|
||||
if (to->senttime >= cl.time)
|
||||
|
@ -171,21 +195,13 @@ CL_PredictMove (void)
|
|||
// now interpolate some fraction of the final frame
|
||||
if (to->senttime == from->senttime)
|
||||
f = 0;
|
||||
else {
|
||||
f = (cl.time - from->senttime) / (to->senttime - from->senttime);
|
||||
|
||||
if (f < 0)
|
||||
f = 0;
|
||||
if (f > 1)
|
||||
f = 1;
|
||||
}
|
||||
else
|
||||
f = bound(0, (cl.time - from->senttime) / (to->senttime - from->senttime), 1);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
if (fabs
|
||||
(from->playerstate[cl.playernum].origin[i] -
|
||||
to->playerstate[cl.playernum].origin[i]) > 128) { // teleported,
|
||||
// so don't
|
||||
// lerp
|
||||
if (fabs(from->playerstate[cl.playernum].origin[i] -
|
||||
to->playerstate[cl.playernum].origin[i]) > 128) {
|
||||
// teleported, so don't lerp
|
||||
VectorCopy (to->playerstate[cl.playernum].velocity, cl.simvel);
|
||||
VectorCopy (to->playerstate[cl.playernum].origin, cl.simorg);
|
||||
return;
|
||||
|
@ -209,6 +225,7 @@ void
|
|||
CL_Prediction_Init_Cvars (void)
|
||||
{
|
||||
/* 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_nopred = Cvar_Get ("cl_nopred", "0", CVAR_NONE, "Set to turn off client prediction");
|
||||
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, NULL, "Set to turn off client prediction");
|
||||
cl_nostatpred = Cvar_Get ("cl_nostatpred", "0", CVAR_NONE, NULL, "Set to turn off static player prediction");
|
||||
}
|
||||
|
|
|
@ -26,20 +26,21 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <io.h>
|
||||
#include <conio.h>
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_CONIO_H
|
||||
# include <conio.h>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
|
@ -53,113 +54,54 @@
|
|||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include <SDL.H>
|
||||
#include <SDL_main.H>
|
||||
#include <SDL.h>
|
||||
#include <SDL_main.h>
|
||||
|
||||
#include "cvar.h"
|
||||
#include "sys.h"
|
||||
#include "qargs.h"
|
||||
#include "qargs.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
|
||||
qboolean is_server = false;
|
||||
char *svs_info;
|
||||
|
||||
int starttime;
|
||||
int noconinput;
|
||||
|
||||
#ifdef _WIN32
|
||||
# include "winquake.h"
|
||||
// fixme: minimized is not currently supported under
|
||||
// FIXME: minimized is not currently supported under
|
||||
// SDL
|
||||
qboolean Minimized = false;
|
||||
void MaskExceptions (void);
|
||||
#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
|
||||
Sys_FileTime (char *path)
|
||||
{
|
||||
QFile *f;
|
||||
int t, retval;
|
||||
|
||||
f = Qopen (path, "rb");
|
||||
|
||||
if (f) {
|
||||
Qclose (f);
|
||||
retval = 1;
|
||||
} else {
|
||||
retval = -1;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SYSTEM IO
|
||||
*/
|
||||
|
||||
/*
|
||||
Sys_MakeCodeWriteable
|
||||
Quake calls this so the system can register variables before host_hunklevel
|
||||
is marked
|
||||
*/
|
||||
void
|
||||
Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length)
|
||||
Sys_Init_Cvars (void)
|
||||
{
|
||||
|
||||
#ifdef _WIN32
|
||||
DWORD flOldProtect;
|
||||
|
||||
// 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_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, NULL,
|
||||
"set to disable std out");
|
||||
if (COM_CheckParm ("-nostdout"))
|
||||
Cvar_Set (sys_nostdout, "1");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Sys_Init
|
||||
*/
|
||||
void
|
||||
Sys_Init (void)
|
||||
{
|
||||
|
||||
#ifdef WIN32
|
||||
OSVERSIONINFO vinfo;
|
||||
#endif
|
||||
|
||||
#ifdef USE_INTEL_ASM
|
||||
#ifdef _WIN32
|
||||
MaskExceptions ();
|
||||
|
@ -185,9 +127,22 @@ Sys_Init (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Sys_Quit
|
||||
*/
|
||||
void
|
||||
Sys_Error (char *error, ...)
|
||||
Sys_Quit (void)
|
||||
{
|
||||
Host_Shutdown ();
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Sys_Error
|
||||
*/
|
||||
void
|
||||
Sys_Error (const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char text[1024];
|
||||
|
@ -208,43 +163,56 @@ Sys_Error (char *error, ...)
|
|||
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)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Sys_Sleep (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Sys_Init_Cvars (void)
|
||||
{
|
||||
sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, "Set to disable std out");
|
||||
if (COM_CheckParm ("-nostdout"))
|
||||
Cvar_Set (sys_nostdout, "1");
|
||||
}
|
||||
#ifndef SDL_main
|
||||
# define SDL_main main
|
||||
#endif
|
||||
|
||||
C_LINKAGE int
|
||||
/*
|
||||
main
|
||||
*/
|
||||
int
|
||||
SDL_main (int c, char **v)
|
||||
{
|
||||
|
||||
double time, oldtime, newtime;
|
||||
int j;
|
||||
|
||||
static char cwd[1024];
|
||||
int t;
|
||||
|
||||
#ifndef WIN32
|
||||
signal (SIGFPE, SIG_IGN);
|
||||
#endif
|
||||
|
@ -255,7 +223,7 @@ SDL_main (int c, char **v)
|
|||
host_parms.argc = com_argc;
|
||||
host_parms.argv = com_argv;
|
||||
|
||||
host_parms.memsize = 8 * 1024 * 1024;
|
||||
host_parms.memsize = 16 * 1024 * 1024; // 16MB default heap
|
||||
|
||||
j = COM_CheckParm ("-mem");
|
||||
if (j)
|
||||
|
@ -266,6 +234,7 @@ SDL_main (int c, char **v)
|
|||
printf ("Can't allocate memory for zone.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
noconinput = COM_CheckParm ("-noconinput");
|
||||
if (!noconinput)
|
||||
|
@ -276,17 +245,16 @@ SDL_main (int c, char **v)
|
|||
|
||||
oldtime = Sys_DoubleTime ();
|
||||
while (1) {
|
||||
// find time spent rendering last frame
|
||||
// find time spent rendering last frame
|
||||
newtime = Sys_DoubleTime ();
|
||||
time = newtime - oldtime;
|
||||
|
||||
Host_Frame (time);
|
||||
oldtime = newtime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* fixme: evil stub for directsound crap */
|
||||
void
|
||||
IN_Accumulate (void)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -45,39 +45,28 @@
|
|||
#include <sys/mman.h>
|
||||
|
||||
#include "cvar.h"
|
||||
#include "host.h"
|
||||
#include "qargs.h"
|
||||
#include "sys.h"
|
||||
|
||||
#include "host.h"
|
||||
#include "net.h"
|
||||
|
||||
int noconinput = 0;
|
||||
qboolean is_server = false;
|
||||
char *svs_info;
|
||||
|
||||
#ifdef PACKET_LOGGING
|
||||
void Net_LogStop (void);
|
||||
#endif
|
||||
|
||||
// =======================================================================
|
||||
// General routines
|
||||
// =======================================================================
|
||||
|
||||
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);
|
||||
}
|
||||
/*
|
||||
Sys_Init_Cvars
|
||||
|
||||
Quake calls this so the system can register variables before host_hunklevel
|
||||
is marked
|
||||
*/
|
||||
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"))
|
||||
Cvar_Set (sys_nostdout, "1");
|
||||
}
|
||||
|
@ -90,8 +79,25 @@ Sys_Init (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Quit
|
||||
*/
|
||||
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;
|
||||
char string[1024];
|
||||
|
@ -106,7 +112,6 @@ Sys_Error (char *error, ...)
|
|||
|
||||
Host_Shutdown ();
|
||||
exit (1);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -122,7 +127,7 @@ Sys_Warn (char *warning, ...)
|
|||
}
|
||||
|
||||
void
|
||||
Sys_DebugLog (char *file, char *fmt, ...)
|
||||
Sys_DebugLog (const char *file, const char *fmt, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
static char data[1024]; // why static ?
|
||||
|
@ -131,20 +136,28 @@ Sys_DebugLog (char *file, char *fmt, ...)
|
|||
va_start (argptr, fmt);
|
||||
vsnprintf (data, sizeof (data), fmt, 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);
|
||||
write (fd, data, strlen (data));
|
||||
close (fd);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
floating_point_exception_handler (int whatever)
|
||||
{
|
||||
// Sys_Warn("floating point exception\n");
|
||||
// Sys_Warn("floating point exception\n");
|
||||
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)
|
||||
{
|
||||
#if 0
|
||||
|
@ -163,12 +176,14 @@ Sys_ConsoleInput (void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
void
|
||||
Sys_HighFPPrecision (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Sys_LowFPPrecision (void)
|
||||
{
|
||||
|
@ -177,15 +192,18 @@ Sys_LowFPPrecision (void)
|
|||
|
||||
int skipframes;
|
||||
|
||||
/*
|
||||
main
|
||||
*/
|
||||
int
|
||||
main (int c, char **v)
|
||||
main (int c, char *v[])
|
||||
{
|
||||
double time, oldtime, newtime;
|
||||
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);
|
||||
|
||||
memset (&host_parms, 0, sizeof (host_parms));
|
||||
|
@ -194,12 +212,13 @@ main (int c, char **v)
|
|||
host_parms.argc = com_argc;
|
||||
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");
|
||||
if (j)
|
||||
host_parms.memsize = (int) (atof (com_argv[j + 1]) * 1024 * 1024);
|
||||
host_parms.membase = malloc (host_parms.memsize);
|
||||
|
||||
if (!host_parms.membase) {
|
||||
printf ("Can't allocate memory for zone.\n");
|
||||
return 1;
|
||||
|
@ -221,27 +240,3 @@ main (int c, char **v)
|
|||
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");
|
||||
|
||||
}
|
||||
|
|
|
@ -38,16 +38,20 @@
|
|||
#include <conio.h>
|
||||
#include <windows.h>
|
||||
|
||||
#include "client.h"
|
||||
#include "console.h"
|
||||
#include "host.h"
|
||||
#include "cvar.h"
|
||||
#include "qargs.h"
|
||||
#include "resource.h"
|
||||
#include "screen.h"
|
||||
#include "sound.h"
|
||||
#include "sys.h"
|
||||
#include "vid.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
#include "net.h"
|
||||
#include "resource.h"
|
||||
|
||||
qboolean is_server = false;
|
||||
char *svs_info;
|
||||
|
||||
|
@ -78,92 +82,18 @@ void MaskExceptions (void);
|
|||
void Sys_PopFPCW (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
|
||||
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
|
||||
|
@ -213,9 +143,32 @@ Sys_Init (void)
|
|||
WinNT = false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Sys_Quit
|
||||
*/
|
||||
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;
|
||||
char text[1024]; // , text2[1024];
|
||||
|
@ -236,28 +189,42 @@ Sys_Error (char *error, ...)
|
|||
}
|
||||
|
||||
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)
|
||||
CloseHandle (qwclsemaphore);
|
||||
int
|
||||
wfilelength (QFile *f)
|
||||
{
|
||||
int pos;
|
||||
int end;
|
||||
|
||||
#ifdef PACKET_LOGGING
|
||||
Net_LogStop();
|
||||
#endif
|
||||
pos = Qtell (f);
|
||||
Qseek (f, 0, SEEK_END);
|
||||
end = Qtell (f);
|
||||
Qseek (f, pos, SEEK_SET);
|
||||
|
||||
exit (0);
|
||||
return end;
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_ConsoleInput
|
||||
|
||||
|
||||
char *
|
||||
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)
|
||||
{
|
||||
static char text[256];
|
||||
|
@ -362,7 +329,6 @@ Sys_ConsoleInput (void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -371,6 +337,13 @@ Sys_Sleep (void)
|
|||
{
|
||||
}
|
||||
|
||||
void
|
||||
SleepUntilInput (int time)
|
||||
{
|
||||
|
||||
MsgWaitForMultipleObjects (1, &tevent, FALSE, time, QS_ALLINPUT);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
int global_nCmdShow;
|
||||
char *argv[MAX_NUM_ARGVS];
|
||||
static char *empty_string = "";
|
||||
|
||||
|
||||
/*
|
||||
main
|
||||
*/
|
||||
int WINAPI
|
||||
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
// MSG msg;
|
||||
// MSG msg;
|
||||
double time, oldtime, newtime;
|
||||
MEMORYSTATUS lpBuffer;
|
||||
static char cwd[1024];
|
||||
|
@ -462,7 +418,6 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
*lpCmdLine = 0;
|
||||
lpCmdLine++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -523,10 +478,10 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
if (!tevent)
|
||||
Sys_Error ("Couldn't create event");
|
||||
|
||||
// because sound is off until we become active
|
||||
S_BlockSound ();
|
||||
// because sound is off until we become active
|
||||
//XXX S_BlockSound ();
|
||||
|
||||
Sys_Printf ("Host_Init\n");
|
||||
//Sys_Printf ("Host_Init\n");
|
||||
Host_Init ();
|
||||
|
||||
oldtime = Sys_DoubleTime ();
|
||||
|
|
|
@ -306,6 +306,8 @@ Cmd_Exec_File (char *path)
|
|||
int len;
|
||||
QFile *file;
|
||||
|
||||
if (!path || !*path)
|
||||
return;
|
||||
if ((file = Qopen (path, "r")) != NULL) {
|
||||
len = COM_filelength (file);
|
||||
f = (char *) Hunk_TempAlloc (len + 1);
|
||||
|
|
|
@ -113,5 +113,5 @@ COM_Init (void)
|
|||
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");
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ Con_Init (void)
|
|||
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");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -54,13 +54,11 @@
|
|||
#include <X11/extensions/XShm.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <sys/poll.h>
|
||||
|
||||
#ifdef HAVE_VIDMODE
|
||||
# include <X11/extensions/xf86vmode.h>
|
||||
#endif
|
||||
|
||||
#include "commdef.h"
|
||||
#include "console.h"
|
||||
#include "context_x11.h"
|
||||
#include "cvar.h"
|
||||
|
@ -73,50 +71,51 @@
|
|||
#include "vid.h"
|
||||
|
||||
static void (*event_handlers[LASTEvent]) (XEvent *);
|
||||
qboolean oktodraw = false;
|
||||
int x_shmeventtype;
|
||||
qboolean oktodraw = false;
|
||||
int x_shmeventtype;
|
||||
|
||||
static int x_disp_ref_count = 0;
|
||||
static int x_disp_ref_count = 0;
|
||||
|
||||
Display *x_disp = NULL;
|
||||
int x_screen;
|
||||
Window x_root = None;
|
||||
Display *x_disp = NULL;
|
||||
int x_screen;
|
||||
Window x_root = None;
|
||||
XVisualInfo *x_visinfo;
|
||||
Visual *x_vis;
|
||||
Window x_win;
|
||||
Cursor nullcursor = None;
|
||||
Visual *x_vis;
|
||||
Window x_win;
|
||||
Cursor nullcursor = None;
|
||||
static Atom aWMDelete = 0;
|
||||
|
||||
#define X_MASK (VisibilityChangeMask | StructureNotifyMask | ExposureMask)
|
||||
|
||||
#ifdef HAVE_VIDMODE
|
||||
static XF86VidModeModeInfo **vidmodes;
|
||||
static int nummodes;
|
||||
|
||||
static int screen_width;
|
||||
static int screen_height;
|
||||
static int original_mode;
|
||||
static int nummodes;
|
||||
static int original_mode = 0;
|
||||
static double x_gamma;
|
||||
static qboolean vidmode_avail = false;
|
||||
#endif
|
||||
|
||||
static qboolean vidmode_avail = false;
|
||||
static qboolean vidmode_active = false;
|
||||
|
||||
cvar_t *vid_fullscreen;
|
||||
qboolean vid_fullscreen_active;
|
||||
cvar_t *vid_fullscreen;
|
||||
cvar_t *vid_system_gamma;
|
||||
qboolean vid_fullscreen_active;
|
||||
extern qboolean vid_gamma_avail;
|
||||
|
||||
static int xss_timeout;
|
||||
static int xss_interval;
|
||||
static int xss_blanking;
|
||||
static int xss_exposures;
|
||||
static int xss_timeout;
|
||||
static int xss_interval;
|
||||
static int xss_blanking;
|
||||
static int xss_exposures;
|
||||
|
||||
qboolean
|
||||
x11_add_event (int event, void (*event_handler) (XEvent *))
|
||||
X11_AddEvent (int event, void (*event_handler) (XEvent *))
|
||||
{
|
||||
if (event >= LASTEvent) {
|
||||
printf ("event: %d, LASTEvent: %d\n", event, LASTEvent);
|
||||
return false;
|
||||
}
|
||||
if (event_handlers[event] != NULL)
|
||||
|
||||
if (event_handlers[event])
|
||||
return false;
|
||||
|
||||
event_handlers[event] = event_handler;
|
||||
|
@ -124,10 +123,11 @@ x11_add_event (int event, void (*event_handler) (XEvent *))
|
|||
}
|
||||
|
||||
qboolean
|
||||
x11_del_event (int event, void (*event_handler) (XEvent *))
|
||||
X11_RemoveEvent (int event, void (*event_handler) (XEvent *))
|
||||
{
|
||||
if (event >= LASTEvent)
|
||||
return false;
|
||||
|
||||
if (event_handlers[event] != event_handler)
|
||||
return false;
|
||||
|
||||
|
@ -136,7 +136,7 @@ x11_del_event (int event, void (*event_handler) (XEvent *))
|
|||
}
|
||||
|
||||
void
|
||||
x11_process_event (void)
|
||||
X11_ProcessEvent (void)
|
||||
{
|
||||
XEvent x_event;
|
||||
|
||||
|
@ -152,11 +152,11 @@ x11_process_event (void)
|
|||
}
|
||||
|
||||
void
|
||||
x11_process_events (void)
|
||||
X11_ProcessEvents (void)
|
||||
{
|
||||
/* Get events from X server. */
|
||||
while (XPending (x_disp)) {
|
||||
x11_process_event ();
|
||||
X11_ProcessEvent ();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -176,12 +176,12 @@ TragicDeath (int sig)
|
|||
}
|
||||
|
||||
void
|
||||
x11_open_display (void)
|
||||
X11_OpenDisplay (void)
|
||||
{
|
||||
if (!x_disp) {
|
||||
x_disp = XOpenDisplay (NULL);
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ x11_open_display (void)
|
|||
signal (SIGTRAP, TragicDeath);
|
||||
signal (SIGIOT, TragicDeath);
|
||||
signal (SIGBUS, TragicDeath);
|
||||
/* signal(SIGFPE, TragicDeath); */
|
||||
// signal(SIGFPE, TragicDeath);
|
||||
signal (SIGSEGV, TragicDeath);
|
||||
signal (SIGTERM, TragicDeath);
|
||||
|
||||
|
@ -210,7 +210,7 @@ x11_open_display (void)
|
|||
}
|
||||
|
||||
void
|
||||
x11_close_display (void)
|
||||
X11_CloseDisplay (void)
|
||||
{
|
||||
if (nullcursor != None) {
|
||||
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
|
||||
x11_create_null_cursor (void)
|
||||
X11_CreateNullCursor (void)
|
||||
{
|
||||
Pixmap cursormask;
|
||||
XGCValues xgc;
|
||||
GC gc;
|
||||
XColor dummycolour;
|
||||
Pixmap cursormask;
|
||||
XGCValues xgc;
|
||||
GC gc;
|
||||
XColor dummycolour;
|
||||
|
||||
if (nullcursor != None)
|
||||
return;
|
||||
|
@ -257,7 +257,7 @@ x11_create_null_cursor (void)
|
|||
}
|
||||
|
||||
void
|
||||
x11_set_vidmode (int width, int height)
|
||||
X11_SetVidMode (int width, int height)
|
||||
{
|
||||
const char *str = getenv ("MESA_GLX_FX");
|
||||
|
||||
|
@ -271,18 +271,23 @@ x11_set_vidmode (int width, int height)
|
|||
#ifdef HAVE_VIDMODE
|
||||
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) {
|
||||
|
||||
int i;
|
||||
int best_mode = 0;
|
||||
qboolean found_mode = false;
|
||||
int i, dotclock;
|
||||
int best_mode = 0;
|
||||
qboolean found_mode = false;
|
||||
XF86VidModeModeLine orig_data;
|
||||
|
||||
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++) {
|
||||
if ((vidmodes[i]->hdisplay == screen_width) &&
|
||||
(vidmodes[i]->vdisplay == screen_height)) {
|
||||
if ((vidmodes[i]->hdisplay == orig_data.hdisplay) &&
|
||||
(vidmodes[i]->vdisplay == orig_data.vdisplay)) {
|
||||
original_mode = i;
|
||||
break;
|
||||
}
|
||||
|
@ -302,25 +307,27 @@ x11_set_vidmode (int width, int height)
|
|||
|
||||
XSetScreenSaver (x_disp, 0, xss_interval, xss_blanking, xss_exposures);
|
||||
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[best_mode]);
|
||||
x11_force_view_port ();
|
||||
X11_ForceViewPort ();
|
||||
vidmode_active = true;
|
||||
} else {
|
||||
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
|
||||
}
|
||||
|
||||
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");
|
||||
vid_system_gamma = Cvar_Get ("vid_system_gamma", "0", CVAR_ARCHIVE, NULL,
|
||||
"Use system gamma control if available");
|
||||
}
|
||||
|
||||
void
|
||||
x11_create_window (int width, int height)
|
||||
X11_CreateWindow (int width, int height)
|
||||
{
|
||||
XSetWindowAttributes attr;
|
||||
XClassHint *ClassHint;
|
||||
|
@ -357,7 +364,7 @@ x11_create_window (int width, int height)
|
|||
XFree (SizeHints);
|
||||
}
|
||||
// Set window title
|
||||
x11_set_caption (va ("%s %s", PROGRAM, VERSION));
|
||||
X11_SetCaption (va ("%s %s", PROGRAM, VERSION));
|
||||
|
||||
// Set icon name
|
||||
XSetIconName (x_disp, x_win, PROGRAM);
|
||||
|
@ -380,7 +387,7 @@ x11_create_window (int width, int height)
|
|||
XMoveWindow (x_disp, x_win, 0, 0);
|
||||
XWarpPointer (x_disp, None, x_win, 0, 0, 0, 0,
|
||||
vid.width + 2, vid.height + 2);
|
||||
x11_force_view_port ();
|
||||
X11_ForceViewPort ();
|
||||
}
|
||||
|
||||
XMapWindow (x_disp, x_win);
|
||||
|
@ -391,13 +398,14 @@ x11_create_window (int width, int height)
|
|||
}
|
||||
|
||||
void
|
||||
x11_restore_vidmode (void)
|
||||
X11_RestoreVidMode (void)
|
||||
{
|
||||
XSetScreenSaver (x_disp, xss_timeout, xss_interval, xss_blanking,
|
||||
xss_exposures);
|
||||
|
||||
#ifdef HAVE_VIDMODE
|
||||
if (vidmode_active) {
|
||||
X11_RestoreGamma ();
|
||||
XF86VidModeSwitchToMode (x_disp, x_screen, vidmodes[original_mode]);
|
||||
XFree (vidmodes);
|
||||
}
|
||||
|
@ -405,7 +413,7 @@ x11_restore_vidmode (void)
|
|||
}
|
||||
|
||||
void
|
||||
x11_grab_keyboard (void)
|
||||
X11_GrabKeyboard (void)
|
||||
{
|
||||
#ifdef HAVE_VIDMODE
|
||||
if (vidmode_active && vid_fullscreen->int_val) {
|
||||
|
@ -416,14 +424,14 @@ x11_grab_keyboard (void)
|
|||
}
|
||||
|
||||
void
|
||||
x11_set_caption (char *text)
|
||||
X11_SetCaption (char *text)
|
||||
{
|
||||
if (x_disp && x_win && text)
|
||||
XStoreName (x_disp, x_win, text);
|
||||
}
|
||||
|
||||
void
|
||||
x11_force_view_port (void)
|
||||
X11_ForceViewPort (void)
|
||||
{
|
||||
#ifdef HAVE_VIDMODE
|
||||
int x, y;
|
||||
|
@ -431,9 +439,58 @@ x11_force_view_port (void)
|
|||
if (vidmode_active && vid_fullscreen->int_val) {
|
||||
do {
|
||||
XF86VidModeSetViewPort (x_disp, x_screen, 0, 0);
|
||||
poll (0, 0, 50);
|
||||
usleep (50);
|
||||
XF86VidModeGetViewPort (x_disp, x_screen, &x, &y);
|
||||
} while (x || y);
|
||||
}
|
||||
#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
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
dynamic variable tracking
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 1999,2000 Nelson Rush.
|
||||
Copyright (C) 1999,2000 contributors of the QuakeForge project
|
||||
Please see the file "AUTHORS" for a list of contributors
|
||||
|
||||
|
@ -184,6 +183,8 @@ void Cvar_Info (cvar_t *var);
|
|||
void
|
||||
Cvar_Set (cvar_t *var, char *value)
|
||||
{
|
||||
int changed;
|
||||
|
||||
if (!var)
|
||||
return;
|
||||
|
||||
|
@ -192,6 +193,7 @@ Cvar_Set (cvar_t *var, char *value)
|
|||
return;
|
||||
}
|
||||
|
||||
changed = !strequal (var->string, value);
|
||||
free (var->string); // free the old value string
|
||||
|
||||
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]);
|
||||
|
||||
Cvar_Info (var);
|
||||
|
||||
if (changed && var->callback)
|
||||
var->callback (var);
|
||||
}
|
||||
|
||||
|
||||
|
@ -211,9 +216,12 @@ Cvar_Set (cvar_t *var, char *value)
|
|||
void
|
||||
Cvar_SetROM (cvar_t *var, char *value)
|
||||
{
|
||||
int changed;
|
||||
|
||||
if (!var)
|
||||
return;
|
||||
|
||||
changed = !strequal (var->string, value);
|
||||
free (var->string); // free the old value string
|
||||
|
||||
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]);
|
||||
|
||||
Cvar_Info (var);
|
||||
|
||||
if (changed && var->callback)
|
||||
var->callback (var);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -310,7 +321,7 @@ Cvar_Set_f (void)
|
|||
Cvar_Set (var, value);
|
||||
}
|
||||
} else {
|
||||
var = Cvar_Get (var_name, value, CVAR_USER_CREATED,
|
||||
var = Cvar_Get (var_name, value, CVAR_USER_CREATED, NULL,
|
||||
"User-created cvar");
|
||||
}
|
||||
}
|
||||
|
@ -341,7 +352,7 @@ Cvar_Setrom_f (void)
|
|||
Cvar_SetFlags (var, var->flags | CVAR_ROM);
|
||||
}
|
||||
} 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");
|
||||
}
|
||||
}
|
||||
|
@ -454,7 +465,8 @@ Cvar_Init_Hash (void)
|
|||
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 ("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_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;
|
||||
|
||||
if (Cmd_Exists (name)) {
|
||||
Con_Printf ("Cvar_Get: %s is a command\n", name);
|
||||
return NULL;
|
||||
}
|
||||
var = Cvar_FindVar (name);
|
||||
if (!var) {
|
||||
|
||||
if (!(var = Cvar_FindVar (name))) {
|
||||
cvar_t **v;
|
||||
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->string = strdup (string);
|
||||
var->flags = cvarflags;
|
||||
var->callback = callback;
|
||||
var->description = description;
|
||||
var->value = atof (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.
|
||||
var->flags &= ~CVAR_USER_CREATED;
|
||||
var->flags |= cvarflags;
|
||||
var->callback = callback;
|
||||
var->description = description;
|
||||
}
|
||||
Cvar_Info (var);
|
||||
|
||||
if (var->callback)
|
||||
var->callback (var);
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,9 +69,9 @@ D_Init (void)
|
|||
void
|
||||
D_Init_Cvars (void)
|
||||
{
|
||||
d_subdiv16 = Cvar_Get ("d_subdiv16", "1", CVAR_NONE, "Set to enable extreme perspective correction");
|
||||
d_mipcap = Cvar_Get ("d_mipcap", "0", CVAR_NONE, "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_subdiv16 = Cvar_Get ("d_subdiv16", "1", CVAR_NONE, NULL, "Set to enable extreme perspective correction");
|
||||
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, NULL, "Detail level of objects. 0 is highest, 3 is lowest.");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -39,10 +39,6 @@
|
|||
#ifdef HAVE_DGA
|
||||
# include <X11/extensions/xf86dga.h>
|
||||
# include <X11/extensions/xf86dgastr.h>
|
||||
#endif
|
||||
#ifdef HAVE_VIDMODE
|
||||
# include <X11/extensions/xf86vmode.h>
|
||||
# include <X11/extensions/xf86vmstr.h>
|
||||
# ifndef XDGA_MAJOR_VERSION
|
||||
# ifdef XF86DGA_MAJOR_VERSION
|
||||
# define XDGA_MAJOR_VERSION XF86DGA_MAJOR_VERSION
|
||||
|
@ -51,6 +47,10 @@
|
|||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#ifdef HAVE_VIDMODE
|
||||
# include <X11/extensions/xf86vmode.h>
|
||||
# include <X11/extensions/xf86vmstr.h>
|
||||
#endif
|
||||
|
||||
#include "console.h"
|
||||
#include "dga_check.h"
|
||||
|
|
|
@ -93,7 +93,7 @@ Draw_ClearCache (void)
|
|||
Draw_CachePic
|
||||
*/
|
||||
qpic_t *
|
||||
Draw_CachePic (char *path)
|
||||
Draw_CachePic (char *path, qboolean alpha)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
|
@ -140,30 +140,30 @@ Draw_TextBox (int x, int y, int width, int lines)
|
|||
// draw left side
|
||||
cx = x;
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tl.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tl.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
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 middle
|
||||
cx += 8;
|
||||
while (width > 0) {
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tm.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tm.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
if (n == 1)
|
||||
p = Draw_CachePic ("gfx/box_mm2.lmp");
|
||||
p = Draw_CachePic ("gfx/box_mm2.lmp", true);
|
||||
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);
|
||||
width -= 2;
|
||||
cx += 16;
|
||||
|
@ -171,14 +171,14 @@ Draw_TextBox (int x, int y, int width, int lines)
|
|||
|
||||
// draw right side
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tr.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tr.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ Draw_Init (void)
|
|||
r_rectdesc.rowbytes = draw_backtile->width;
|
||||
|
||||
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
|
||||
|
@ -565,7 +565,7 @@ Draw_ConsoleBackground (int lines)
|
|||
int f, fstep;
|
||||
qpic_t *conback;
|
||||
|
||||
conback = Draw_CachePic ("gfx/conback.lmp");
|
||||
conback = Draw_CachePic ("gfx/conback.lmp", false);
|
||||
|
||||
// draw the pic
|
||||
if (r_pixbytes == 1) {
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include "screen.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 unsigned char d_15to8table[65536];
|
||||
|
@ -136,7 +136,7 @@ Draw_PicFromWad (char *name)
|
|||
p = W_GetLumpName (name);
|
||||
gl = (glpic_t *) p->data;
|
||||
|
||||
gl->texnum = GL_LoadPicTexture (p);
|
||||
gl->texnum = GL_LoadPicTexture (p, true);
|
||||
gl->sl = 0;
|
||||
gl->sh = 1;
|
||||
gl->tl = 0;
|
||||
|
@ -159,7 +159,7 @@ Draw_ClearCache (void)
|
|||
Draw_CachePic
|
||||
*/
|
||||
qpic_t *
|
||||
Draw_CachePic (char *path)
|
||||
Draw_CachePic (char *path, qboolean alpha)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
|
@ -194,7 +194,7 @@ Draw_CachePic (char *path)
|
|||
|
||||
// Now feed it to the GL stuff and get a texture number..
|
||||
gl = (glpic_t *) pic->pic.data;
|
||||
gl->texnum = GL_LoadPicTexture (dat);
|
||||
gl->texnum = GL_LoadPicTexture (dat, alpha);
|
||||
|
||||
// Alignment stuff..
|
||||
gl->sl = 0;
|
||||
|
@ -254,7 +254,7 @@ Draw_TextureMode_f (void)
|
|||
}
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (!stricmp (modes[i].name, Cmd_Argv (1)))
|
||||
if (strcaseequal (modes[i].name, Cmd_Argv (1)))
|
||||
break;
|
||||
}
|
||||
if (i == 6) {
|
||||
|
@ -287,30 +287,30 @@ Draw_TextBox (int x, int y, int width, int lines)
|
|||
// draw left side
|
||||
cx = x;
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tl.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tl.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
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 middle
|
||||
cx += 8;
|
||||
while (width > 0) {
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tm.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tm.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
if (n == 1)
|
||||
p = Draw_CachePic ("gfx/box_mm2.lmp");
|
||||
p = Draw_CachePic ("gfx/box_mm2.lmp", true);
|
||||
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);
|
||||
width -= 2;
|
||||
cx += 16;
|
||||
|
@ -318,14 +318,14 @@ Draw_TextBox (int x, int y, int width, int lines)
|
|||
|
||||
// draw right side
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tr.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tr.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -393,24 +393,24 @@ Draw_Init (void)
|
|||
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)");
|
||||
|
||||
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");
|
||||
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
|
||||
cl_verstring = Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE,
|
||||
cl_verstring = Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, NULL,
|
||||
"Client version string");
|
||||
}
|
||||
|
||||
|
@ -658,7 +658,7 @@ Draw_ConsoleBackground (int lines)
|
|||
float alpha;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
|
337
source/gl_mesh.c
337
source/gl_mesh.c
|
@ -39,38 +39,96 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "console.h"
|
||||
#include "cvar.h"
|
||||
#include "mdfour.h"
|
||||
#include "model.h"
|
||||
#include "quakefs.h"
|
||||
#include "sys.h"
|
||||
|
||||
#include "compat.h"
|
||||
|
||||
/*
|
||||
ALIAS MODEL DISPLAY LIST GENERATION
|
||||
*/
|
||||
|
||||
extern cvar_t *gl_mesh_cache;
|
||||
|
||||
model_t *aliasmodel;
|
||||
aliashdr_t *paliashdr;
|
||||
|
||||
qboolean used[8192];
|
||||
qboolean *used;
|
||||
int used_size;
|
||||
|
||||
// the command list holds counts and s/t values that are valid for
|
||||
// every frame
|
||||
int commands[8192];
|
||||
int *commands;
|
||||
int numcommands;
|
||||
int commands_size;
|
||||
|
||||
// all frames will have their vertexes rearranged and expanded
|
||||
// so they are in the order expected by the command list
|
||||
int vertexorder[8192];
|
||||
int *vertexorder;
|
||||
int numorder;
|
||||
int vertexorder_size;
|
||||
|
||||
int allverts, alltris;
|
||||
|
||||
int stripverts[128];
|
||||
int striptris[128];
|
||||
int *stripverts;
|
||||
int *striptris;
|
||||
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
|
||||
StripLength (int starttri, int startv)
|
||||
{
|
||||
|
@ -83,12 +141,10 @@ StripLength (int starttri, int startv)
|
|||
|
||||
last = &triangles[starttri];
|
||||
|
||||
stripverts[0] = last->vertindex[(startv) % 3];
|
||||
stripverts[1] = last->vertindex[(startv + 1) % 3];
|
||||
stripverts[2] = last->vertindex[(startv + 2) % 3];
|
||||
|
||||
striptris[0] = starttri;
|
||||
stripcount = 1;
|
||||
stripcount = 0;
|
||||
add_strip (last->vertindex[(startv) % 3], starttri);
|
||||
add_strip (last->vertindex[(startv + 1) % 3], starttri);
|
||||
add_strip (last->vertindex[(startv + 2) % 3], starttri);
|
||||
|
||||
m1 = last->vertindex[(startv + 2) % 3];
|
||||
m2 = last->vertindex[(startv + 1) % 3];
|
||||
|
@ -117,9 +173,7 @@ nexttri:
|
|||
else
|
||||
m1 = check->vertindex[(k + 2) % 3];
|
||||
|
||||
stripverts[stripcount + 2] = check->vertindex[(k + 2) % 3];
|
||||
striptris[stripcount] = j;
|
||||
stripcount++;
|
||||
add_strip (check->vertindex[(k + 2) % 3], j);
|
||||
|
||||
used[j] = 2;
|
||||
goto nexttri;
|
||||
|
@ -132,12 +186,9 @@ done:
|
|||
if (used[j] == 2)
|
||||
used[j] = 0;
|
||||
|
||||
return stripcount;
|
||||
return stripcount - 2;
|
||||
}
|
||||
|
||||
/*
|
||||
FanLength
|
||||
*/
|
||||
int
|
||||
FanLength (int starttri, int startv)
|
||||
{
|
||||
|
@ -150,12 +201,10 @@ FanLength (int starttri, int startv)
|
|||
|
||||
last = &triangles[starttri];
|
||||
|
||||
stripverts[0] = last->vertindex[(startv) % 3];
|
||||
stripverts[1] = last->vertindex[(startv + 1) % 3];
|
||||
stripverts[2] = last->vertindex[(startv + 2) % 3];
|
||||
|
||||
striptris[0] = starttri;
|
||||
stripcount = 1;
|
||||
stripcount = 0;
|
||||
add_strip (last->vertindex[(startv) % 3], starttri);
|
||||
add_strip (last->vertindex[(startv + 1) % 3], starttri);
|
||||
add_strip (last->vertindex[(startv + 2) % 3], starttri);
|
||||
|
||||
m1 = last->vertindex[(startv + 0) % 3];
|
||||
m2 = last->vertindex[(startv + 2) % 3];
|
||||
|
@ -182,9 +231,7 @@ FanLength (int starttri, int startv)
|
|||
// the new edge
|
||||
m2 = check->vertindex[(k + 2) % 3];
|
||||
|
||||
stripverts[stripcount + 2] = m2;
|
||||
striptris[stripcount] = j;
|
||||
stripcount++;
|
||||
add_strip (m2, j);
|
||||
|
||||
used[j] = 2;
|
||||
goto nexttri;
|
||||
|
@ -197,7 +244,7 @@ FanLength (int starttri, int startv)
|
|||
if (used[j] == 2)
|
||||
used[j] = 0;
|
||||
|
||||
return stripcount;
|
||||
return stripcount - 2;
|
||||
}
|
||||
|
||||
|
||||
|
@ -214,16 +261,17 @@ BuildTris (void)
|
|||
int startv;
|
||||
float s, t;
|
||||
int len, bestlen, besttype = 0;
|
||||
int bestverts[1024];
|
||||
int besttris[1024];
|
||||
int *bestverts = 0;
|
||||
int *besttris = 0;
|
||||
int type;
|
||||
|
||||
//
|
||||
// build tristrips
|
||||
//
|
||||
numorder = 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++) {
|
||||
// pick an unused triangle and start the trifan
|
||||
if (used[i])
|
||||
|
@ -241,27 +289,31 @@ BuildTris (void)
|
|||
if (len > bestlen) {
|
||||
besttype = type;
|
||||
bestlen = len;
|
||||
for (j = 0; j < bestlen + 2; j++)
|
||||
bestverts[j] = stripverts[j];
|
||||
for (j = 0; j < bestlen; j++)
|
||||
besttris[j] = striptris[j];
|
||||
if (bestverts)
|
||||
free (bestverts);
|
||||
if (besttris)
|
||||
free (besttris);
|
||||
bestverts = stripverts;
|
||||
besttris = striptris;
|
||||
stripverts = striptris = 0;
|
||||
strip_size = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// mark the tris on the best strip as used
|
||||
for (j = 0; j < bestlen; j++)
|
||||
used[besttris[j]] = 1;
|
||||
used[besttris[j + 2]] = 1;
|
||||
|
||||
if (besttype == 1)
|
||||
commands[numcommands++] = (bestlen + 2);
|
||||
add_command (bestlen + 2);
|
||||
else
|
||||
commands[numcommands++] = -(bestlen + 2);
|
||||
add_command (-(bestlen + 2));
|
||||
|
||||
for (j = 0; j < bestlen + 2; j++) {
|
||||
// emit a vertex into the reorder buffer
|
||||
k = bestverts[j];
|
||||
vertexorder[numorder++] = k;
|
||||
add_vertex (k);
|
||||
|
||||
// emit s/t coords into the commands stream
|
||||
s = stverts[k].s;
|
||||
|
@ -271,24 +323,25 @@ BuildTris (void)
|
|||
s = (s + 0.5) / pheader->mdl.skinwidth;
|
||||
t = (t + 0.5) / pheader->mdl.skinheight;
|
||||
|
||||
*(float *) &commands[numcommands++] = s;
|
||||
*(float *) &commands[numcommands++] = t;
|
||||
add_command (*(int*)&s);
|
||||
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,
|
||||
numcommands);
|
||||
|
||||
allverts += numorder;
|
||||
alltris += pheader->mdl.numtris;
|
||||
|
||||
if (bestverts)
|
||||
free (bestverts);
|
||||
if (besttris)
|
||||
free (besttris);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
GL_MakeAliasModelDisplayLists
|
||||
*/
|
||||
void
|
||||
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 mesh_digest[MDFOUR_DIGEST_BYTES];
|
||||
qboolean remesh = true;
|
||||
qboolean do_cache = false;
|
||||
|
||||
aliasmodel = 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;
|
||||
|
||||
//
|
||||
// look for a cached version
|
||||
//
|
||||
strcpy (cache, "glquake/");
|
||||
COM_StripExtension (m->name + strlen ("progs/"),
|
||||
cache + strlen ("glquake/"));
|
||||
strncat (cache, ".ms2", sizeof (cache) - strlen (cache));
|
||||
mdfour (model_digest, (unsigned char *) _m, _s);
|
||||
|
||||
COM_FOpenFile (cache, &f);
|
||||
if (f) {
|
||||
unsigned char d1[MDFOUR_DIGEST_BYTES];
|
||||
unsigned char d2[MDFOUR_DIGEST_BYTES];
|
||||
struct mdfour md;
|
||||
int c[8192];
|
||||
int nc;
|
||||
int vo[8192];
|
||||
int no;
|
||||
// look for a cached version
|
||||
strcpy (cache, "glquake/");
|
||||
COM_StripExtension (m->name + strlen ("progs/"),
|
||||
cache + strlen ("glquake/"));
|
||||
strncat (cache, ".qfms", sizeof (cache) - strlen (cache));
|
||||
|
||||
memset (d1, 0, sizeof (d1));
|
||||
memset (d2, 0, sizeof (d2));
|
||||
Qread (f, &nc, 4);
|
||||
Qread (f, &no, 4);
|
||||
if (nc <= 8192 && no <= 8192) {
|
||||
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);
|
||||
COM_FOpenFile (cache, &f);
|
||||
if (f) {
|
||||
unsigned char d1[MDFOUR_DIGEST_BYTES];
|
||||
unsigned char d2[MDFOUR_DIGEST_BYTES];
|
||||
struct mdfour md;
|
||||
int *c = 0;
|
||||
int nc = 0;
|
||||
int *vo = 0;
|
||||
int no = 0;
|
||||
int len;
|
||||
int vers;
|
||||
|
||||
mdfour_begin (&md);
|
||||
mdfour_update (&md, (unsigned char*)&nc, 4);
|
||||
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);
|
||||
memset (d1, 0, sizeof (d1));
|
||||
memset (d2, 0, sizeof (d2));
|
||||
|
||||
if (memcmp (d2, mesh_digest, MDFOUR_DIGEST_BYTES) == 0 && memcmp (d1, model_digest, MDFOUR_DIGEST_BYTES) == 0) {
|
||||
remesh = false;
|
||||
numcommands = nc;
|
||||
numorder = no;
|
||||
memcpy (commands, c, numcommands * sizeof (c[0]));
|
||||
memcpy (vertexorder, vo, numorder * sizeof (vo[0]));
|
||||
Qread (f, &vers, sizeof (int));
|
||||
Qread (f, &len, sizeof (int));
|
||||
Qread (f, &nc, sizeof (int));
|
||||
Qread (f, &no, sizeof (int));
|
||||
|
||||
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) {
|
||||
//
|
||||
// build it from scratch
|
||||
//
|
||||
Con_Printf ("meshing %s...\n", m->name);
|
||||
Con_DPrintf ("meshing %s...\n", m->name);
|
||||
|
||||
BuildTris (); // trifans or lists
|
||||
|
||||
//
|
||||
// save out the cached version
|
||||
//
|
||||
snprintf (fullpath, sizeof (fullpath), "%s/%s", com_gamedir, cache);
|
||||
f = Qopen (fullpath, "wbz9");
|
||||
if (!f) {
|
||||
COM_CreatePath (fullpath);
|
||||
f = Qopen (fullpath, "wb");
|
||||
}
|
||||
if (do_cache) {
|
||||
// save out the cached version
|
||||
snprintf (fullpath, sizeof (fullpath), "%s/%s", com_gamedir, cache);
|
||||
f = Qopen (fullpath, "wbz9");
|
||||
if (!f) {
|
||||
COM_CreatePath (fullpath);
|
||||
f = Qopen (fullpath, "wb");
|
||||
}
|
||||
|
||||
if (f) {
|
||||
struct mdfour md;
|
||||
if (f) {
|
||||
struct mdfour md;
|
||||
int vers = 1;
|
||||
int len = numcommands + numorder;
|
||||
|
||||
mdfour_begin (&md);
|
||||
mdfour_update (&md, (unsigned char*)&numcommands, 4);
|
||||
mdfour_update (&md, (unsigned char*)&numorder, 4);
|
||||
mdfour_update (&md, (unsigned char*)&commands, numcommands * sizeof (commands[0]));
|
||||
mdfour_update (&md, (unsigned char*)&vertexorder,
|
||||
numorder * sizeof (vertexorder[0]));
|
||||
mdfour_update (&md, model_digest, MDFOUR_DIGEST_BYTES);
|
||||
mdfour_result (&md, mesh_digest);
|
||||
mdfour_begin (&md);
|
||||
mdfour_update (&md, (unsigned char *) &vers, sizeof (int));
|
||||
mdfour_update (&md, (unsigned char *) &len, sizeof (int));
|
||||
mdfour_update (&md, (unsigned char *) &numcommands, sizeof (int));
|
||||
mdfour_update (&md, (unsigned char *) &numorder, sizeof (int));
|
||||
mdfour_update (&md, (unsigned char *) commands,
|
||||
numcommands * sizeof (commands[0]));
|
||||
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, &numorder, 4);
|
||||
Qwrite (f, &commands, numcommands * sizeof (commands[0]));
|
||||
Qwrite (f, &vertexorder, numorder * sizeof (vertexorder[0]));
|
||||
Qwrite (f, model_digest, MDFOUR_DIGEST_BYTES);
|
||||
Qwrite (f, mesh_digest, MDFOUR_DIGEST_BYTES);
|
||||
Qclose (f);
|
||||
Qwrite (f, &vers, sizeof (int));
|
||||
Qwrite (f, &len, sizeof (int));
|
||||
Qwrite (f, &numcommands, sizeof (int));
|
||||
Qwrite (f, &numorder, sizeof (int));
|
||||
Qwrite (f, commands, numcommands * sizeof (commands[0]));
|
||||
Qwrite (f, vertexorder, numorder * sizeof (vertexorder[0]));
|
||||
Qwrite (f, model_digest, MDFOUR_DIGEST_BYTES);
|
||||
Qwrite (f, mesh_digest, MDFOUR_DIGEST_BYTES);
|
||||
Qclose (f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// save the data out
|
||||
|
||||
paliashdr->poseverts = numorder;
|
||||
|
||||
cmds = Hunk_Alloc (numcommands * 4);
|
||||
cmds = Hunk_Alloc (numcommands * sizeof (int));
|
||||
paliashdr->commands = (byte *) cmds - (byte *) paliashdr;
|
||||
memcpy (cmds, commands, numcommands * 4);
|
||||
memcpy (cmds, commands, numcommands * sizeof (int));
|
||||
|
||||
verts = Hunk_Alloc (paliashdr->numposes * paliashdr->poseverts
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ Mod_LoadAliasFrame (void *pin, maliasframedesc_t *frame)
|
|||
|
||||
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->bboxmax.v[i];
|
||||
frame->bboxmax.v[i] = pdaliasframe->bboxmax.v[i];
|
||||
}
|
||||
|
||||
pinframe = (trivertx_t *) (pdaliasframe + 1);
|
||||
|
@ -288,7 +288,7 @@ Mod_LoadAliasGroup (void *pin, maliasframedesc_t *frame)
|
|||
for (i = 0; i < 3; i++) {
|
||||
// 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->bboxmax.v[i];
|
||||
frame->bboxmax.v[i] = pingroup->bboxmax.v[i];
|
||||
}
|
||||
|
||||
pin_intervals = (daliasinterval_t *) (pingroup + 1);
|
||||
|
|
|
@ -132,8 +132,11 @@ R_RenderDlight (dlight_t *light)
|
|||
else
|
||||
glColor3fv (light->color);
|
||||
|
||||
VectorSubtract (r_origin, light->origin, v);
|
||||
VectorNormalize (v);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
v[i] = light->origin[i] - vpn[i] * rad;
|
||||
v[i] = light->origin[i] + v[i] * rad;
|
||||
|
||||
glVertex3fv (v);
|
||||
glColor3f (0, 0, 0);
|
||||
|
|
|
@ -134,7 +134,6 @@ cvar_t *brighten;
|
|||
|
||||
extern cvar_t *scr_fov;
|
||||
|
||||
extern byte gammatable[256];
|
||||
extern qboolean lighthalf;
|
||||
|
||||
// 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
|
||||
|
||||
|
|
|
@ -203,38 +203,38 @@ R_Init (void)
|
|||
void
|
||||
R_Init_Cvars (void)
|
||||
{
|
||||
r_norefresh = Cvar_Get ("r_norefresh", "0", CVAR_NONE, "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_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, "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_wateralpha = Cvar_Get ("r_wateralpha", "1", CVAR_NONE, "Determine opacity of liquids. 1 = solid, 0 = transparent, otherwise translucent.");
|
||||
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, NULL, "Toggles drawing of entities (almost everything but the world)");
|
||||
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, NULL, "Set to 1 to enable shadows for entities");
|
||||
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? */
|
||||
r_waterripple = Cvar_Get ("r_waterripple", "0", CVAR_NONE, "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_novis = Cvar_Get ("r_novis", "0", CVAR_NONE, "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_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_ARCHIVE, "Graph network stats");
|
||||
r_netgraph_alpha = Cvar_Get ("r_netgraph_alpha", "0.5", CVAR_ARCHIVE, "Net graph translucency");
|
||||
r_netgraph_box = Cvar_Get ("r_netgraph_box", "1", CVAR_ARCHIVE, "Draw box around net graph");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, "whether or not to draw particles");
|
||||
r_skyname = Cvar_Get ("r_skyname", "none", CVAR_NONE, "name of the current skybox");
|
||||
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, NULL, "Set to 0 to disable lightmap changes");
|
||||
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, NULL, "Display drawing time and statistics of what is being viewed");
|
||||
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, NULL, "Net graph translucency");
|
||||
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, NULL, "whether or not to draw particles");
|
||||
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_clear = Cvar_Get ("gl_clear", "0", CVAR_NONE, "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_polyblend = Cvar_Get ("gl_dlight_polyblend", "0", CVAR_ARCHIVE, "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_fb_bmodels = Cvar_Get ("gl_fb_bmodels", "1", CVAR_ARCHIVE, "Toggles fullbright color support for bmodels");
|
||||
gl_fb_models = Cvar_Get ("gl_fb_models", "1", CVAR_ARCHIVE, "Toggles fullbright color support for models");
|
||||
gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, "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_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, "Toggles model animation interpolation");
|
||||
gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, "Use multitexture when available");
|
||||
gl_nocolors = Cvar_Get ("gl_nocolors", "0", CVAR_NONE, "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_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_ARCHIVE, "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_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_ARCHIVE, "controls whether the skydome is single or double pass");
|
||||
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, NULL, "Set to 1 to make background black. Useful for removing HOM effect");
|
||||
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, NULL, "Set to 1 to use a dynamic light effect faster on GL");
|
||||
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, NULL, "Toggles fullbright color support for bmodels");
|
||||
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, NULL, "Toggles lavaball and rocket fireballs");
|
||||
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, NULL, "Toggles model animation interpolation");
|
||||
gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available");
|
||||
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, NULL, "Detail of player skins. 0 best, 4 worst.");
|
||||
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, NULL, "subdivide sky polys");
|
||||
gl_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_ARCHIVE, NULL, "controls whether the skydome is single or double pass");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -235,29 +235,19 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
|
|||
|
||||
// set to full bright if no light data
|
||||
if (!cl.worldmodel->lightdata) {
|
||||
bl = blocklights;
|
||||
for (i = 0; i < size; i++) {
|
||||
*bl++ = 255 << 8;
|
||||
*bl++ = 255 << 8;
|
||||
*bl++ = 255 << 8;
|
||||
}
|
||||
memset (&blocklights[0], 255, size * 3 * sizeof (unsigned int));
|
||||
goto store;
|
||||
}
|
||||
// clear to no light
|
||||
bl = blocklights;
|
||||
for (i = 0; i < size; i++) {
|
||||
*bl++ = 0;
|
||||
*bl++ = 0;
|
||||
*bl++ = 0;
|
||||
}
|
||||
bl = blocklights;
|
||||
|
||||
memset (&blocklights[0], 0, size * 3 * sizeof (unsigned int));
|
||||
|
||||
// add all the lightmaps
|
||||
if (lightmap) {
|
||||
for (maps = 0; maps < MAXLIGHTMAPS && surf->styles[maps] != 255; maps++) {
|
||||
scale = d_lightstylevalue[surf->styles[maps]];
|
||||
surf->cached_light[maps] = scale; // 8.8 fraction
|
||||
bl = blocklights;
|
||||
bl=blocklights;
|
||||
for (i = 0; i < size; i++) {
|
||||
*bl++ += *lightmap++ * scale;
|
||||
*bl++ += *lightmap++ * scale;
|
||||
|
|
|
@ -384,21 +384,21 @@ SCR_SizeDown_f (void)
|
|||
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_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, "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_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, "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_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, "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_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, "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");
|
||||
gl_triplebuffer = Cvar_Get ("gl_triplebuffer", "1", CVAR_ARCHIVE, "Set to 1 by default. Fixes status bar flicker on some hardware");
|
||||
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, NULL, "Set the screen size 30 minimum, 120 maximum");
|
||||
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, NULL, "fraction of the screen the console covers when down");
|
||||
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, NULL, "Show a turtle icon if your fps is slower than 10");
|
||||
scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, NULL, "Toggles display of pause graphic");
|
||||
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, NULL, "How fast the text is displayed at the end of the single player episodes");
|
||||
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");
|
||||
crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, "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_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the Y-axis.");
|
||||
crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, NULL, "Color of the new crosshair");
|
||||
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, NULL, "Sets the position of the crosshair on the X-axis.");
|
||||
cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the Y-axis.");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -563,7 +563,7 @@ SCR_DrawPause (void)
|
|||
if (!cl.paused)
|
||||
return;
|
||||
|
||||
pic = Draw_CachePic ("gfx/pause.lmp");
|
||||
pic = Draw_CachePic ("gfx/pause.lmp", true);
|
||||
Draw_Pic ((vid.width - pic->width) / 2,
|
||||
(vid.height - 48 - pic->height) / 2, pic);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "glquake.h"
|
||||
#include "host.h"
|
||||
|
|
|
@ -65,7 +65,7 @@ R_LoadSkys (char *skyname)
|
|||
QFile *f;
|
||||
char name[64];
|
||||
|
||||
if (stricmp (skyname, "none") == 0) {
|
||||
if (strcaseequal (skyname, "none")) {
|
||||
skyloaded = false;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
extern byte *host_basepal;
|
||||
extern double host_frametime;
|
||||
extern int onground;
|
||||
extern byte gammatable[256];
|
||||
|
||||
extern cvar_t *cl_cshift_powerup;
|
||||
extern cvar_t *contrast;
|
||||
|
@ -88,7 +87,8 @@ V_CalcBlend (void)
|
|||
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;
|
||||
g += (128 - g) * a2;
|
||||
b += (128 - b) * a2;
|
||||
|
@ -201,20 +201,3 @@ V_UpdatePalette (void)
|
|||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <termios.h>
|
||||
#include <fcntl.h>
|
||||
|
|
|
@ -413,8 +413,8 @@ IN_Init_Cvars (void)
|
|||
{
|
||||
JOY_Init_Cvars ();
|
||||
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "Have Quake grab the mouse from X when you play");
|
||||
m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Mouse input filtering");
|
||||
_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, NULL, "Mouse input filtering");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "protocol.h"
|
||||
|
||||
void
|
||||
IN_Init (void)
|
||||
{
|
||||
|
|
|
@ -362,8 +362,8 @@ IN_Init_Cvars (void)
|
|||
{
|
||||
JOY_Init_Cvars ();
|
||||
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "If set to 1, quake will grab the mouse in X");
|
||||
// m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Toggle mouse input filtering");
|
||||
_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, NULL, "Toggle mouse input filtering");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -133,7 +133,7 @@ void
|
|||
IN_Init_Cvars (void)
|
||||
{
|
||||
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
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef __MINGW32__
|
||||
# define INITGUID
|
||||
#endif
|
||||
|
||||
#include "winquake.h"
|
||||
#include <dinput.h>
|
||||
|
@ -424,7 +427,7 @@ void
|
|||
IN_Init_Cvars (void)
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "joystick.h"
|
||||
#include "keys.h"
|
||||
#include "qargs.h"
|
||||
#include "sound.h"
|
||||
#include "sys.h"
|
||||
#include "view.h"
|
||||
|
||||
|
@ -86,9 +87,13 @@ static float mouse_x, mouse_y;
|
|||
static float old_mouse_x, old_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 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
|
||||
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
|
||||
center_pointer (void)
|
||||
|
@ -426,7 +459,7 @@ void
|
|||
IN_SendKeyEvents (void)
|
||||
{
|
||||
/* Get events from X server. */
|
||||
x11_process_events ();
|
||||
X11_ProcessEvents ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -487,7 +520,7 @@ IN_Shutdown (void)
|
|||
XF86DGADirectVideo (x_disp, DefaultScreen (x_disp), 0);
|
||||
#endif
|
||||
}
|
||||
x11_close_display ();
|
||||
X11_CloseDisplay ();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -505,7 +538,7 @@ IN_Init (void)
|
|||
if (!x_win)
|
||||
Sys_Error ("IN: No window!!\n");
|
||||
|
||||
x11_open_display (); // call to increment the reference
|
||||
X11_OpenDisplay (); // call to increment the reference
|
||||
// counter
|
||||
|
||||
{
|
||||
|
@ -522,26 +555,26 @@ IN_Init (void)
|
|||
|
||||
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"))
|
||||
return;
|
||||
if (!COM_CheckParm ("-nomouse")) {
|
||||
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);
|
||||
if (vid_fullscreen->int_val) {
|
||||
Cvar_Set (_windowed_mouse, "1");
|
||||
_windowed_mouse->flags |= CVAR_ROM;
|
||||
X11_AddEvent (ButtonPress, &event_button);
|
||||
X11_AddEvent (ButtonRelease, &event_button);
|
||||
X11_AddEvent (MotionNotify, &event_motion);
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -549,9 +582,9 @@ void
|
|||
IN_Init_Cvars (void)
|
||||
{
|
||||
JOY_Init_Cvars ();
|
||||
_windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "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.");
|
||||
in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, "DGA Input support");
|
||||
in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE,
|
||||
_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, NULL, "Toggle mouse input filtering.");
|
||||
in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, NULL, "DGA Input support");
|
||||
in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE, NULL,
|
||||
"DGA Mouse accelleration multiplier");
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "compat.h"
|
||||
#include "console.h"
|
||||
#include "info.h"
|
||||
|
||||
|
@ -46,13 +47,48 @@
|
|||
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
|
||||
|
||||
Searches the string for the given
|
||||
key and returns the associated value, or an empty string.
|
||||
*/
|
||||
char *
|
||||
char *
|
||||
Info_ValueForKey (char *s, char *key)
|
||||
{
|
||||
char pkey[512];
|
||||
|
@ -127,7 +163,7 @@ Info_RemoveKey (char *s, char *key)
|
|||
}
|
||||
*o = 0;
|
||||
|
||||
if (!strcmp (key, pkey)) {
|
||||
if (strequal (key, pkey)) {
|
||||
strcpy (start, s); // remove this part
|
||||
return;
|
||||
}
|
||||
|
@ -168,7 +204,7 @@ Info_RemovePrefixedKeys (char *start, char prefix)
|
|||
}
|
||||
*o = 0;
|
||||
|
||||
if (pkey[0] == prefix) {
|
||||
if ((pkey[0] == prefix) || (!(Info_FilterForKey (pkey)))) {
|
||||
Info_RemoveKey (start, pkey);
|
||||
s = start;
|
||||
}
|
||||
|
@ -176,15 +212,14 @@ Info_RemovePrefixedKeys (char *start, char prefix)
|
|||
if (!*s)
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
int c, is_name, is_team;
|
||||
int c;
|
||||
|
||||
if (strstr (key, "\\") || strstr (value, "\\")) {
|
||||
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
|
||||
// don't,
|
||||
// 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");
|
||||
return;
|
||||
}
|
||||
|
@ -216,24 +251,22 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize)
|
|||
|
||||
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");
|
||||
return;
|
||||
}
|
||||
// only copy ascii values
|
||||
s += strlen (s);
|
||||
v = newstr;
|
||||
is_name = stricmp (key, "name") == 0;
|
||||
is_team = stricmp (key, "team") == 0;
|
||||
while (*v) {
|
||||
c = (unsigned char) *v++;
|
||||
// client only allows highbits on name
|
||||
if (!is_name) {
|
||||
if (flags & 1) {
|
||||
c &= 127;
|
||||
if (c < 32 || c > 127)
|
||||
continue;
|
||||
// auto lowercase team
|
||||
if (is_team)
|
||||
if (flags & 2)
|
||||
c = tolower (c);
|
||||
}
|
||||
if (c > 13)
|
||||
|
@ -243,14 +276,14 @@ Info_SetValueForStarKey (char *s, char *key, char *value, size_t maxsize)
|
|||
}
|
||||
|
||||
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] == '*') {
|
||||
Con_Printf ("Can't set * keys\n");
|
||||
return;
|
||||
}
|
||||
|
||||
Info_SetValueForStarKey (s, key, value, maxsize);
|
||||
Info_SetValueForStarKey (s, key, value, maxsize, flags);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -292,3 +325,20 @@ Info_Print (char *s)
|
|||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -198,19 +198,19 @@ JOY_Init_Cvars (void)
|
|||
int i;
|
||||
|
||||
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");
|
||||
joy_enable =
|
||||
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE,
|
||||
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
|
||||
"Joystick enable flag");
|
||||
joy_sensitivity =
|
||||
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE,
|
||||
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
|
||||
"Joystick sensitivity");
|
||||
|
||||
for (i = 0; i < JOY_MAX_AXES; i++) {
|
||||
joy_axes[i].axis = Cvar_Get (joy_axes[i].var.name,
|
||||
joy_axes[i].var.string,
|
||||
CVAR_ARCHIVE, "Set joystick axes");
|
||||
CVAR_ARCHIVE, NULL, "Set joystick axes");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,13 +63,13 @@ void
|
|||
JOY_Init_Cvars (void)
|
||||
{
|
||||
joy_device =
|
||||
Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM,
|
||||
Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, NULL,
|
||||
"Joystick device");
|
||||
joy_enable =
|
||||
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE,
|
||||
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
|
||||
"Joystick enable flag");
|
||||
joy_sensitivity =
|
||||
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE,
|
||||
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
|
||||
"Joystick sensitivity");
|
||||
}
|
||||
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef __MINGW32__
|
||||
# define INITGUID
|
||||
#endif
|
||||
|
||||
#define byte __byte
|
||||
#include <dinput.h>
|
||||
|
@ -554,54 +551,54 @@ void
|
|||
JOY_Init_Cvars(void)
|
||||
{
|
||||
joy_device =
|
||||
Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM,
|
||||
Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, NULL,
|
||||
"Joystick device");
|
||||
joy_enable =
|
||||
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE,
|
||||
Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
|
||||
"Joystick enable flag");
|
||||
joy_sensitivity =
|
||||
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE,
|
||||
Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL,
|
||||
"Joystick sensitivity");
|
||||
|
||||
// joystick variables
|
||||
|
||||
in_joystick =
|
||||
Cvar_Get ("joystick", "0", CVAR_ARCHIVE, "FIXME: No Description");
|
||||
Cvar_Get ("joystick", "0", CVAR_ARCHIVE, NULL, "FIXME: No Description");
|
||||
joy_name =
|
||||
Cvar_Get ("joyname", "joystick", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joyname", "joystick", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
joy_advanced =
|
||||
Cvar_Get ("joyadvanced", "0", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joyadvanced", "0", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
joy_advaxisx =
|
||||
Cvar_Get ("joyadvaxisx", "0", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joyadvaxisx", "0", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
joy_advaxisy =
|
||||
Cvar_Get ("joyadvaxisy", "0", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joyadvaxisy", "0", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
joy_advaxisz =
|
||||
Cvar_Get ("joyadvaxisz", "0", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joyadvaxisz", "0", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
joy_advaxisr =
|
||||
Cvar_Get ("joyadvaxisr", "0", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joyadvaxisr", "0", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
joy_advaxisu =
|
||||
Cvar_Get ("joyadvaxisu", "0", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joyadvaxisu", "0", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
joy_advaxisv =
|
||||
Cvar_Get ("joyadvaxisv", "0", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joyadvaxisv", "0", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
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 =
|
||||
Cvar_Get ("joysidethreshold", "0.15", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joysidethreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
joy_pitchthreshold =
|
||||
Cvar_Get ("joypitchthreshold", "0.15", CVAR_NONE, "FIXME: No Description");
|
||||
joy_yawthreshold = Cvar_Get ("joyyawthreshold", "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, NULL, "FIXME: No Description");
|
||||
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 =
|
||||
Cvar_Get ("joysidesensitivity", "-1.0", CVAR_NONE, "FIXME: No Description");
|
||||
Cvar_Get ("joysidesensitivity", "-1.0", CVAR_NONE, NULL, "FIXME: No Description");
|
||||
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 =
|
||||
Cvar_Get ("joyyawsensitivity", "-1.0", CVAR_NONE, "FIXME: No Description");
|
||||
joy_wwhack1 = Cvar_Get ("joywwhack1", "0.0", CVAR_NONE, "FIXME: No Description");
|
||||
joy_wwhack2 = Cvar_Get ("joywwhack2", "0.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, NULL, "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;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ int key_lastpress;
|
|||
int edit_line = 0;
|
||||
int history_line = 0;
|
||||
|
||||
keydest_t key_dest;
|
||||
keydest_t key_dest = key_console;
|
||||
|
||||
char *keybindings[256];
|
||||
qboolean consolekeys[256]; // if true, can't be rebound while in
|
||||
|
@ -747,7 +747,7 @@ Key_Init (void)
|
|||
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");
|
||||
}
|
||||
|
||||
|
|
|
@ -141,8 +141,10 @@ locs_load (char *filename)
|
|||
t2[0] = '\0';
|
||||
// handle dos format lines (COM_FOpenFile is binary only)
|
||||
// and unix is effectively binary only anyway
|
||||
if (t2 > t1 && t2[-1] == '\r')
|
||||
while (t2 > t1 && t2[-1] == '\r') {
|
||||
t2[-1] = '\0';
|
||||
t2--;
|
||||
}
|
||||
}
|
||||
locs_add (loc, t1);
|
||||
}
|
||||
|
|
|
@ -54,14 +54,15 @@ qf_server_PROGRAM = qfserver.exe
|
|||
#
|
||||
|
||||
#!if ASM_ARCH
|
||||
#math_ASM = math.S sys_x86.S
|
||||
math_ASM = math.S sys_x86.S
|
||||
world_ASM = worlda.S
|
||||
#!endif
|
||||
|
||||
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 \
|
||||
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 \
|
||||
$(math_ASM)
|
||||
$(math_ASM) $(world_ASM)
|
||||
|
||||
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
|
||||
#
|
||||
#if ASM_ARCH
|
||||
#client_ASM= snd_mixa.S cl_math.S
|
||||
client_ASM= snd_mixa.S cl_math.S
|
||||
#endif
|
||||
|
||||
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_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_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
|
||||
|
||||
|
@ -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
|
||||
|
||||
#-DUSE_INTEL_ASM=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
|
||||
|
||||
# For Pentium Pro and higher
|
||||
#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
|
||||
OTHERINCLUDES = -I$(DIRECTXSDK)\includes -I$(ZLIB)
|
||||
|
||||
#-ID:\scitech\include
|
||||
|
||||
CFLAGS = -I$(SDLSDK)\include $(QFINCLUDES) $(OTHERINCLUDES) $(COPTS) $(DEFS)
|
||||
|
||||
qf_client_wgl_OBJECTS = $(qf_client_wgl_SOURCES:.c=.o)
|
||||
|
@ -230,8 +228,9 @@ qf-server: $(qf_server_OBJECTS)
|
|||
clean:
|
||||
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)
|
||||
# gcc -Xlinker --verbose $(CFLAGS) -ID:\scitech\includes -o $(qf_client_win_PROGRAM) $(qf_client_win_OBJECTS) $(qf_client_win_LIBS) -mwindows
|
||||
# strip --strip-all $(qf_client_win_PROGRAM)
|
||||
# gcc $(CFLAGS) -o $(qf_client_win_PROGRAM) $(qf_client_win_OBJECTS) $(qf_client_win_LIBS) -mwindows
|
||||
# strip --strip-all $(qf_client_win_PROGRAM)
|
||||
|
||||
|
||||
|
|
120
source/menu.c
120
source/menu.c
|
@ -142,6 +142,9 @@ int m_return_state;
|
|||
qboolean m_return_onerror;
|
||||
char m_return_reason[32];
|
||||
|
||||
cvar_t *brightness;
|
||||
cvar_t *contrast;
|
||||
|
||||
#define StartingGame (m_multiplayer_cursor == 1)
|
||||
#define JoiningGame (m_multiplayer_cursor == 0)
|
||||
#define SerialConfig (m_net_cursor == 0)
|
||||
|
@ -151,6 +154,8 @@ char m_return_reason[32];
|
|||
|
||||
void M_ConfigureNetSubsystem (void);
|
||||
|
||||
extern cvar_t *confirm_quit;
|
||||
|
||||
//=============================================================================
|
||||
/* Support Routines */
|
||||
|
||||
|
@ -245,30 +250,30 @@ M_DrawTextBox (int x, int y, int width, int lines)
|
|||
// draw left side
|
||||
cx = x;
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tl.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tl.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
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);
|
||||
|
||||
// draw middle
|
||||
cx += 8;
|
||||
while (width > 0) {
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tm.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tm.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
if (n == 1)
|
||||
p = Draw_CachePic ("gfx/box_mm2.lmp");
|
||||
p = Draw_CachePic ("gfx/box_mm2.lmp", true);
|
||||
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);
|
||||
width -= 2;
|
||||
cx += 16;
|
||||
|
@ -276,14 +281,14 @@ M_DrawTextBox (int x, int y, int width, int lines)
|
|||
|
||||
// draw right side
|
||||
cy = y;
|
||||
p = Draw_CachePic ("gfx/box_tr.lmp");
|
||||
p = Draw_CachePic ("gfx/box_tr.lmp", true);
|
||||
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++) {
|
||||
cy += 8;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -345,15 +350,15 @@ M_Main_Draw (void)
|
|||
int f;
|
||||
qpic_t *p;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp"));
|
||||
p = Draw_CachePic ("gfx/ttl_main.lmp");
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
|
||||
p = Draw_CachePic ("gfx/ttl_main.lmp", true);
|
||||
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;
|
||||
|
||||
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));
|
||||
break;
|
||||
case 4: // Brightness
|
||||
Cvar_SetValue (brightness,
|
||||
bound (1, brightness->value + (dir * 0.25), 5));
|
||||
if (brightness)
|
||||
Cvar_SetValue (brightness, bound (1, brightness->value + (dir * 0.25), 5));
|
||||
break;
|
||||
case 5: // Contrast
|
||||
Cvar_SetValue (contrast,
|
||||
bound (0.0, contrast->value + (dir * 0.05), 1));
|
||||
if (contrast)
|
||||
Cvar_SetValue (contrast, bound (0.0, contrast->value + (dir * 0.05), 1));
|
||||
break;
|
||||
case 6: // mouse speed
|
||||
Cvar_SetValue (sensitivity,
|
||||
bound (1, sensitivity->value + dir, 25));
|
||||
Cvar_SetValue (sensitivity, bound (1, sensitivity->value + dir, 25));
|
||||
break;
|
||||
case 7: // music volume
|
||||
#ifdef _WIN32
|
||||
Cvar_SetValue (bgmvolume, bound (0, bgmvolume->value + dir, 1));
|
||||
#else
|
||||
Cvar_SetValue (bgmvolume,
|
||||
bound (0, bgmvolume->value + (dir * 0.1), 1));
|
||||
Cvar_SetValue (bgmvolume, bound (0, bgmvolume->value + (dir * 0.1), 1));
|
||||
#endif
|
||||
break;
|
||||
case 8: // sfx volume
|
||||
|
@ -532,8 +535,8 @@ M_Options_Draw (void)
|
|||
float r;
|
||||
qpic_t *p;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp"));
|
||||
p = Draw_CachePic ("gfx/p_option.lmp");
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
|
||||
p = Draw_CachePic ("gfx/p_option.lmp", true);
|
||||
M_DrawPic ((320 - p->width) / 2, 4, p);
|
||||
|
||||
M_Print (16, 32, " Customize controls");
|
||||
|
@ -544,13 +547,17 @@ M_Options_Draw (void)
|
|||
r = (scr_viewsize->int_val - 30) / (120.0 - 30.0);
|
||||
M_DrawSlider (220, 56, r);
|
||||
|
||||
M_Print (16, 64, " Brightness");
|
||||
r = (brightness->value - 1) / 4;
|
||||
M_DrawSlider (220, 64, r);
|
||||
if (brightness) {
|
||||
M_Print (16, 64, " Brightness");
|
||||
r = (brightness->value - 1) / 4;
|
||||
M_DrawSlider (220, 64, r);
|
||||
}
|
||||
|
||||
M_Print (16, 72, " Contrast");
|
||||
r = contrast->value;
|
||||
M_DrawSlider (220, 72, r);
|
||||
if (contrast) {
|
||||
M_Print (16, 72, " Contrast");
|
||||
r = contrast->value;
|
||||
M_DrawSlider (220, 72, r);
|
||||
}
|
||||
|
||||
M_Print (16, 80, " Mouse Speed");
|
||||
r = (sensitivity->value - 1) / 24;
|
||||
|
@ -585,18 +592,12 @@ M_Options_Draw (void)
|
|||
if (vid_menudrawfn)
|
||||
M_Print (16, 152, " Video Options");
|
||||
|
||||
#ifdef _WIN32
|
||||
//FIXMEif (modestate == MS_WINDOWED) {
|
||||
#endif
|
||||
if (_windowed_mouse) {
|
||||
M_Print (16, 160, " Use Mouse");
|
||||
M_DrawCheckbox (220, 160, _windowed_mouse->int_val);
|
||||
}
|
||||
#ifdef _WIN32
|
||||
//FIXME}
|
||||
#endif
|
||||
if (_windowed_mouse) {
|
||||
M_Print (16, 160, " Use Mouse");
|
||||
M_DrawCheckbox (220, 160, _windowed_mouse->int_val);
|
||||
}
|
||||
|
||||
// cursor
|
||||
// cursor
|
||||
M_DrawCharacter (200, 32 + options_cursor * 8,
|
||||
12 + ((int) (realtime * 4) & 1));
|
||||
}
|
||||
|
@ -645,11 +646,19 @@ M_Options_Key (int k)
|
|||
#endif
|
||||
if (options_cursor == 15 && !(vid_menudrawfn))
|
||||
options_cursor--;
|
||||
if ((options_cursor == 5) && !(contrast))
|
||||
options_cursor--;
|
||||
if ((options_cursor == 4) && !(brightness))
|
||||
options_cursor--;
|
||||
break;
|
||||
|
||||
case K_DOWNARROW:
|
||||
S_LocalSound ("misc/menu1.wav");
|
||||
options_cursor++;
|
||||
if ((options_cursor == 4) && !(brightness))
|
||||
options_cursor++;
|
||||
if ((options_cursor == 5) && !(contrast))
|
||||
options_cursor++;
|
||||
if (options_cursor == 15 && !(vid_menudrawfn))
|
||||
options_cursor++;
|
||||
#ifdef _WIN32
|
||||
|
@ -762,7 +771,7 @@ M_Keys_Draw (void)
|
|||
int x, y;
|
||||
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);
|
||||
|
||||
if (bind_grab)
|
||||
|
@ -906,7 +915,7 @@ M_Menu_Help_f (void)
|
|||
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)
|
||||
return;
|
||||
if (!confirm_quit->int_val) {
|
||||
CL_Disconnect ();
|
||||
Sys_Quit ();
|
||||
}
|
||||
wasInMenus = (key_dest == key_menu);
|
||||
key_dest = key_menu;
|
||||
m_quit_prevstate = m_state;
|
||||
|
@ -1039,11 +1052,11 @@ M_SinglePlayer_Draw (void)
|
|||
{
|
||||
qpic_t *p;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp"));
|
||||
// M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp") );
|
||||
p = Draw_CachePic ("gfx/ttl_sgl.lmp");
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
|
||||
// M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true) );
|
||||
p = Draw_CachePic ("gfx/ttl_sgl.lmp", true);
|
||||
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_PrintWhite (88, 12 * 8, "This client is for");
|
||||
|
@ -1092,8 +1105,8 @@ M_MultiPlayer_Draw (void)
|
|||
|
||||
int f;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp"));
|
||||
p = Draw_CachePic ("gfx/p_multi.lmp");
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
|
||||
p = Draw_CachePic ("gfx/p_multi.lmp", true);
|
||||
M_DrawPic ((320 - p->width) / 2, 4, p);
|
||||
|
||||
if (!slist) {
|
||||
|
@ -1187,7 +1200,7 @@ M_MultiPlayer_Draw (void)
|
|||
M_PrintWhite (STAT_X + 10, STAT_Y + 24, "Updating...");
|
||||
f = (int)(realtime * 10) % 6;
|
||||
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));
|
||||
|
@ -1378,8 +1391,8 @@ M_SEdit_Draw (void)
|
|||
{
|
||||
qpic_t *p;
|
||||
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp"));
|
||||
p = Draw_CachePic ("gfx/p_multi.lmp");
|
||||
M_DrawTransPic (16, 4, Draw_CachePic ("gfx/qplaque.lmp", true));
|
||||
p = Draw_CachePic ("gfx/p_multi.lmp", true);
|
||||
M_DrawPic ((320 - p->width) / 2, 4, p);
|
||||
|
||||
M_DrawTextBox (SERV_X, SERV_Y, 23, 1);
|
||||
|
@ -1536,6 +1549,9 @@ M_Quit_Draw (void)
|
|||
void
|
||||
M_Init (void)
|
||||
{
|
||||
brightness = Cvar_FindVar ("brightness");
|
||||
contrast = Cvar_FindVar ("contrast");
|
||||
|
||||
Cmd_AddCommand ("togglemenu", M_ToggleMenu_f, "Toggle the menu");
|
||||
|
||||
Cmd_AddCommand ("menu_main", M_Menu_Main_f, "Show main menu");
|
||||
|
|
|
@ -57,6 +57,7 @@ model_t mod_known[MAX_MOD_KNOWN];
|
|||
int mod_numknown;
|
||||
|
||||
cvar_t *gl_subdivide_size;
|
||||
cvar_t *gl_mesh_cache;
|
||||
|
||||
extern byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||
|
||||
|
@ -75,7 +76,10 @@ void
|
|||
Mod_Init_Cvars (void)
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -109,7 +109,7 @@ Mod_LoadAliasModel (model_t *mod, void *buffer)
|
|||
Info_SetValueForKey (cls.userinfo,
|
||||
!strcmp (loadmodel->name,
|
||||
"progs/player.mdl") ? pmodel_name :
|
||||
emodel_name, st, MAX_INFO_STRING);
|
||||
emodel_name, st, MAX_INFO_STRING, 0);
|
||||
|
||||
if (cls.state >= ca_connected) {
|
||||
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
||||
|
|
|
@ -372,7 +372,7 @@ MSG_ReadDeltaUsercmd (usercmd_t *from, usercmd_t *move)
|
|||
{
|
||||
int bits;
|
||||
|
||||
memcpy (move, from, sizeof (*move));
|
||||
memcpy (move, from, sizeof (usercmd_t));
|
||||
|
||||
bits = MSG_ReadByte ();
|
||||
|
||||
|
|
|
@ -129,9 +129,9 @@ Netchan_Init (void)
|
|||
void
|
||||
Netchan_Init_Cvars (void)
|
||||
{
|
||||
showpackets = Cvar_Get ("showpackets", "0", CVAR_NONE, "Show all network packets");
|
||||
showdrop = Cvar_Get ("showdrop", "0", CVAR_NONE, "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."
|
||||
showpackets = Cvar_Get ("showpackets", "0", CVAR_NONE, NULL, "Show all network packets");
|
||||
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, 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.");
|
||||
}
|
||||
|
||||
|
@ -448,3 +448,14 @@ Netchan_Process (netchan_t *chan)
|
|||
|
||||
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");
|
||||
}
|
||||
|
|
|
@ -961,7 +961,7 @@ int
|
|||
Net_Log_Init (void)
|
||||
{
|
||||
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
|
||||
// 1 = hex dump only
|
||||
|
@ -970,7 +970,7 @@ Net_Log_Init (void)
|
|||
// 4 = parse/hexdump, skip movement/empty messages
|
||||
|
||||
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");
|
||||
return 0;
|
||||
|
|
|
@ -415,11 +415,8 @@ void
|
|||
NET_Init (int port)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
WORD wVersionRequested;
|
||||
int r;
|
||||
|
||||
wVersionRequested = MAKEWORD (1, 1);
|
||||
|
||||
r = WSAStartup (MAKEWORD (1, 1), &winsockdata);
|
||||
if (r)
|
||||
Sys_Error ("Winsock initialization failed.");
|
||||
|
|
|
@ -54,19 +54,19 @@ vec3_t forward, right, up;
|
|||
vec3_t player_mins = { -16, -16, -24 };
|
||||
vec3_t player_maxs = { 16, 16, 32 };
|
||||
|
||||
void PM_InitBoxHull (void);
|
||||
extern void InitBoxHull (void);
|
||||
void PM_CategorizePosition (void);
|
||||
|
||||
void
|
||||
Pmove_Init (void)
|
||||
{
|
||||
PM_InitBoxHull ();
|
||||
InitBoxHull ();
|
||||
}
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ PM_FlyMove (void)
|
|||
vec3_t planes[MAX_CLIP_PLANES];
|
||||
vec3_t primal_velocity, original_velocity;
|
||||
int i, j;
|
||||
pmtrace_t trace;
|
||||
trace_t trace;
|
||||
vec3_t end;
|
||||
float time_left;
|
||||
int blocked;
|
||||
|
@ -161,7 +161,7 @@ PM_FlyMove (void)
|
|||
break; // moved the entire distance
|
||||
|
||||
// save entity for contact
|
||||
pmove.touchindex[pmove.numtouch] = trace.ent;
|
||||
pmove.touchindex[pmove.numtouch] = trace.entnum;
|
||||
pmove.numtouch++;
|
||||
|
||||
if (trace.plane.normal[2] > 0.7) {
|
||||
|
@ -237,7 +237,7 @@ void
|
|||
PM_FlymodeMove (void)
|
||||
{
|
||||
vec3_t start, dest, pmvel, pmtmp;
|
||||
pmtrace_t trace;
|
||||
trace_t trace;
|
||||
float pmspeed;
|
||||
|
||||
pmvel[0] =
|
||||
|
@ -280,12 +280,12 @@ void
|
|||
PM_GroundMove (void)
|
||||
{
|
||||
vec3_t start, dest;
|
||||
pmtrace_t trace;
|
||||
trace_t trace;
|
||||
vec3_t original, originalvel, down, up, downvel;
|
||||
float downdist, updist;
|
||||
|
||||
pmove.velocity[2] = 0;
|
||||
if (!pmove.velocity[0] && !pmove.velocity[1] && !pmove.velocity[2])
|
||||
if (VectorIsNull(pmove.velocity))
|
||||
return;
|
||||
|
||||
// first try just moving to the destination
|
||||
|
@ -367,7 +367,7 @@ PM_Friction (void)
|
|||
float friction;
|
||||
float drop;
|
||||
vec3_t start, stop;
|
||||
pmtrace_t trace;
|
||||
trace_t trace;
|
||||
|
||||
if (pmove.waterjumptime)
|
||||
return;
|
||||
|
@ -482,7 +482,7 @@ PM_WaterMove (void)
|
|||
float wishspeed;
|
||||
vec3_t wishdir;
|
||||
vec3_t start, dest;
|
||||
pmtrace_t trace;
|
||||
trace_t trace;
|
||||
|
||||
//
|
||||
// user intentions
|
||||
|
@ -607,7 +607,7 @@ PM_CategorizePosition (void)
|
|||
{
|
||||
vec3_t point;
|
||||
int cont;
|
||||
pmtrace_t tr;
|
||||
trace_t tr;
|
||||
|
||||
// if the player hull point one unit down is solid, the player
|
||||
// is on ground
|
||||
|
@ -623,15 +623,16 @@ PM_CategorizePosition (void)
|
|||
if (tr.plane.normal[2] < 0.7)
|
||||
onground = -1; // too steep
|
||||
else
|
||||
onground = tr.ent;
|
||||
onground = tr.entnum;
|
||||
if (onground != -1) {
|
||||
pmove.waterjumptime = 0;
|
||||
if (!tr.startsolid && !tr.allsolid)
|
||||
VectorCopy (tr.endpos, pmove.origin);
|
||||
}
|
||||
// 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++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,14 +49,16 @@ static mplane_t box_planes[6];
|
|||
extern vec3_t player_mins;
|
||||
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
|
||||
can just be stored out and get a proper hull_t structure.
|
||||
*/
|
||||
void
|
||||
PM_InitBoxHull (void)
|
||||
InitBoxHull (void)
|
||||
{
|
||||
int i;
|
||||
int side;
|
||||
|
@ -85,13 +87,13 @@ PM_InitBoxHull (void)
|
|||
|
||||
|
||||
/*
|
||||
PM_HullForBox
|
||||
HullForBox
|
||||
|
||||
To keep everything totally uniform, bounding boxes are turned into small
|
||||
BSP trees instead of being compared directly.
|
||||
*/
|
||||
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[1].dist = mins[0];
|
||||
|
@ -104,11 +106,12 @@ PM_HullForBox (vec3_t mins, vec3_t maxs)
|
|||
}
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
/*
|
||||
PM_HullPointContents
|
||||
HullPointContents
|
||||
*/
|
||||
int
|
||||
PM_HullPointContents (hull_t *hull, int num, vec3_t p)
|
||||
HullPointContents (hull_t *hull, int num, vec3_t p)
|
||||
{
|
||||
float d;
|
||||
dclipnode_t *node;
|
||||
|
@ -116,7 +119,7 @@ PM_HullPointContents (hull_t *hull, int num, vec3_t p)
|
|||
|
||||
while (num >= 0) {
|
||||
if (num < hull->firstclipnode || num > hull->lastclipnode)
|
||||
Sys_Error ("PM_HullPointContents: bad node number");
|
||||
Sys_Error ("HullPointContents: bad node number");
|
||||
|
||||
node = hull->clipnodes + num;
|
||||
plane = hull->planes + node->planenum;
|
||||
|
@ -133,6 +136,7 @@ PM_HullPointContents (hull_t *hull, int num, vec3_t p)
|
|||
|
||||
return num;
|
||||
}
|
||||
#endif // !USE_INTEL_ASM
|
||||
|
||||
/*
|
||||
PM_PointContents
|
||||
|
@ -140,34 +144,12 @@ PM_HullPointContents (hull_t *hull, int num, vec3_t p)
|
|||
int
|
||||
PM_PointContents (vec3_t p)
|
||||
{
|
||||
float d;
|
||||
dclipnode_t *node;
|
||||
mplane_t *plane;
|
||||
hull_t *hull;
|
||||
int num;
|
||||
|
||||
int num;
|
||||
hull = &pmove.physents[0].model->hulls[0];
|
||||
|
||||
num = hull->firstclipnode;
|
||||
|
||||
while (num >= 0) {
|
||||
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;
|
||||
return (HullPointContents (hull, num, p));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -178,11 +160,11 @@ PM_PointContents (vec3_t p)
|
|||
#define DIST_EPSILON (0.03125)
|
||||
|
||||
/*
|
||||
PM_RecursiveHullCheck
|
||||
RecursiveHullCheck
|
||||
*/
|
||||
qboolean
|
||||
PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
|
||||
vec3_t p2, pmtrace_t *trace)
|
||||
RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
|
||||
vec3_t p2, trace_t *trace)
|
||||
{
|
||||
dclipnode_t *node;
|
||||
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
|
||||
// Mercury told me not to bother
|
||||
if (num < hull->firstclipnode || num > hull->lastclipnode)
|
||||
Sys_Error ("PM_RecursiveHullCheck: bad node number");
|
||||
Sys_Error ("RecursiveHullCheck: bad node number");
|
||||
|
||||
// find the point distances
|
||||
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]);
|
||||
|
||||
// move up to the node
|
||||
if (!PM_RecursiveHullCheck (hull, node->children[side],
|
||||
if (!RecursiveHullCheck (hull, node->children[side],
|
||||
p1f, midf, p1, mid, trace))
|
||||
return false;
|
||||
|
||||
#ifdef PARANOID
|
||||
if (PM_HullPointContents (pm_hullmodel, mid, node->children[side]) ==
|
||||
if (HullPointContents (pm_hullmodel, mid, node->children[side]) ==
|
||||
CONTENTS_SOLID) {
|
||||
Con_Printf ("mid PointInHullSolid\n");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (PM_HullPointContents (hull, node->children[side ^ 1],
|
||||
if (HullPointContents (hull, node->children[side ^ 1],
|
||||
mid) != CONTENTS_SOLID) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
@ -281,7 +263,7 @@ PM_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
|
|||
trace->plane.dist = -plane->dist;
|
||||
}
|
||||
|
||||
while (PM_HullPointContents (hull, hull->firstclipnode,
|
||||
while (HullPointContents (hull, hull->firstclipnode,
|
||||
mid) == CONTENTS_SOLID) {
|
||||
// shouldn't really happen, but does occasionally
|
||||
frac -= 0.1;
|
||||
|
@ -324,12 +306,12 @@ PM_TestPlayerPosition (vec3_t pos)
|
|||
else {
|
||||
VectorSubtract (pe->mins, player_maxs, mins);
|
||||
VectorSubtract (pe->maxs, player_mins, maxs);
|
||||
hull = PM_HullForBox (mins, maxs);
|
||||
hull = HullForBox (mins, maxs);
|
||||
}
|
||||
|
||||
VectorSubtract (pos, pe->origin, test);
|
||||
|
||||
if (PM_HullPointContents (hull, hull->firstclipnode, test) ==
|
||||
if (HullPointContents (hull, hull->firstclipnode, test) ==
|
||||
CONTENTS_SOLID) return false;
|
||||
}
|
||||
|
||||
|
@ -339,10 +321,10 @@ PM_TestPlayerPosition (vec3_t pos)
|
|||
/*
|
||||
PM_PlayerMove
|
||||
*/
|
||||
pmtrace_t
|
||||
trace_t
|
||||
PM_PlayerMove (vec3_t start, vec3_t end)
|
||||
{
|
||||
pmtrace_t trace, total;
|
||||
trace_t trace, total;
|
||||
vec3_t offset;
|
||||
vec3_t start_l, end_l;
|
||||
hull_t *hull;
|
||||
|
@ -351,10 +333,10 @@ PM_PlayerMove (vec3_t start, vec3_t end)
|
|||
vec3_t mins, maxs;
|
||||
|
||||
// fill in a default trace
|
||||
memset (&total, 0, sizeof (pmtrace_t));
|
||||
memset (&total, 0, sizeof (trace_t));
|
||||
|
||||
total.fraction = 1;
|
||||
total.ent = -1;
|
||||
total.entnum = -1;
|
||||
VectorCopy (end, total.endpos);
|
||||
|
||||
for (i = 0; i < pmove.numphysent; i++) {
|
||||
|
@ -365,7 +347,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
|
|||
else {
|
||||
VectorSubtract (pe->mins, player_maxs, mins);
|
||||
VectorSubtract (pe->maxs, player_mins, maxs);
|
||||
hull = PM_HullForBox (mins, maxs);
|
||||
hull = HullForBox (mins, maxs);
|
||||
}
|
||||
|
||||
// PM_HullForEntity (ent, mins, maxs, offset);
|
||||
|
@ -375,7 +357,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
|
|||
VectorSubtract (end, offset, end_l);
|
||||
|
||||
// fill in a default trace
|
||||
memset (&trace, 0, sizeof (pmtrace_t));
|
||||
memset (&trace, 0, sizeof (trace_t));
|
||||
|
||||
trace.fraction = 1;
|
||||
trace.allsolid = true;
|
||||
|
@ -383,7 +365,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
|
|||
VectorCopy (end, trace.endpos);
|
||||
|
||||
// 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);
|
||||
|
||||
if (trace.allsolid)
|
||||
|
@ -396,7 +378,7 @@ PM_PlayerMove (vec3_t start, vec3_t end)
|
|||
// fix trace up by the offset
|
||||
VectorAdd (trace.endpos, offset, trace.endpos);
|
||||
total = trace;
|
||||
total.ent = i;
|
||||
total.entnum = i;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1114,7 +1114,7 @@ void
|
|||
PR_Init_Cvars (void)
|
||||
{
|
||||
pr_boundscheck =
|
||||
Cvar_Get ("pr_boundscheck", "1", CVAR_NONE,
|
||||
Cvar_Get ("pr_boundscheck", "1", CVAR_NONE, NULL,
|
||||
"Server progs bounds checking");
|
||||
}
|
||||
|
||||
|
|
|
@ -442,8 +442,7 @@ PR_ExecuteProgram (progs_t *pr, func_t fnum)
|
|||
OPC->_float = !OPA->_float;
|
||||
break;
|
||||
case OP_NOT_V:
|
||||
OPC->_float = !OPA->vector[0] && !OPA->vector[1]
|
||||
&& !OPA->vector[2];
|
||||
OPC->_float = VectorIsNull(OPA->vector);
|
||||
break;
|
||||
case OP_NOT_S:
|
||||
OPC->_float = !OPA->string || !*PR_GetString (pr, OPA->string);
|
||||
|
|
445
source/qfplist.c
Normal file
445
source/qfplist.c
Normal 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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1026,7 +1026,7 @@ COM_Gamedir_f (void)
|
|||
|
||||
if (is_server) {
|
||||
Info_SetValueForStarKey (svs_info, "*gamedir", dir,
|
||||
MAX_SERVERINFO_STRING);
|
||||
MAX_SERVERINFO_STRING, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1078,19 +1078,14 @@ COM_Filesystem_Init (void)
|
|||
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");
|
||||
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");
|
||||
fs_basegame = Cvar_Get ("fs_basegame", BASEGAME, CVAR_ROM,
|
||||
fs_basegame = Cvar_Get ("fs_basegame", "id1", CVAR_ROM, NULL,
|
||||
"game to use by default");
|
||||
#ifdef NEWSTYLE
|
||||
fs_skinbase= Cvar_Get ("fs_skinbase", fs_basegame->string, CVAR_ROM,
|
||||
fs_skinbase= Cvar_Get ("fs_skinbase", "qw", CVAR_ROM, NULL,
|
||||
"location of skins dir for downloads");
|
||||
#else
|
||||
fs_skinbase= Cvar_Get ("fs_skinbase", SKINBASE, CVAR_ROM,
|
||||
"location of skins dir for downloads");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1443,6 +1443,10 @@ SOURCE=.\va.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vid.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\vid_mgl.c
|
||||
|
||||
!IF "$(CFG)" == "qw_client - Win32 Release"
|
||||
|
|
|
@ -267,31 +267,31 @@ R_Init_Cvars (void)
|
|||
{
|
||||
D_Init_Cvars ();
|
||||
|
||||
r_draworder = Cvar_Get ("r_draworder", "0", CVAR_NONE, "Toggles drawing order");
|
||||
r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, "Toggles the displaying of drawing time and"
|
||||
r_draworder = Cvar_Get ("r_draworder", "0", CVAR_NONE, NULL, "Toggles drawing order");
|
||||
r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, NULL, "Toggles the displaying of drawing time and"
|
||||
"statistics of what is currently being viewed");
|
||||
r_timegraph = Cvar_Get ("r_timegraph", "0", CVAR_NONE, "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_zgraph = Cvar_Get ("r_zgraph", "0", CVAR_NONE, "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_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, "Toggles the drawing of textures");
|
||||
r_ambient = Cvar_Get ("r_ambient", "0", CVAR_NONE, "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_waterwarp = Cvar_Get ("r_waterwarp", "1", CVAR_NONE, "Toggles whether surfaces are warped in a liquid.");
|
||||
r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, "Toggles the drawing of entities.");
|
||||
r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, "Toggles the drawing of your weapon");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, "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_dspeeds = Cvar_Get ("r_dspeeds", "0", CVAR_NONE, "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_maxsurfs = Cvar_Get ("r_maxsurfs", "0", CVAR_NONE, "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_reportedgeout = Cvar_Get ("r_reportedgeout", "0", CVAR_NONE, "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_numedges = Cvar_Get ("r_numedges", "0", CVAR_NONE, "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_aliastransadj = Cvar_Get ("r_aliastransadj", "100", CVAR_NONE, "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,
|
||||
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, NULL, "Toggle the display of a graph showing network performance");
|
||||
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, NULL, "Set the number of lines displayed in the various graphs");
|
||||
r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, NULL, "Toggles the drawing of textures");
|
||||
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, NULL, "This sets the color for areas outside of the current map");
|
||||
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, NULL, "Toggles the drawing of entities.");
|
||||
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, NULL, "Toggles drawing of particles.");
|
||||
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, NULL, "Toggles the display of drawing speed information");
|
||||
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, NULL, "Sets the maximum number of surfaces");
|
||||
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, NULL, "Toggle the display of how many edges where not displayed");
|
||||
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, NULL, "Toggles the displaying of number of edges currently being viewed");
|
||||
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, 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, NULL,
|
||||
"subdivide sky polys");
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ extern int in_forward, in_forward2, in_back;
|
|||
frame_t *view_frame;
|
||||
player_state_t *view_message;
|
||||
|
||||
void BuildGammaTable (float, float);
|
||||
void BuildGammaTable (float, float);
|
||||
|
||||
/*
|
||||
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_lava = { {255, 80, 0}, 150 };
|
||||
|
||||
cvar_t *brightness;
|
||||
cvar_t *contrast;
|
||||
|
||||
byte gammatable[256]; // palette is sent through this
|
||||
extern byte gammatable[256]; // palette is sent through this
|
||||
extern cvar_t *vid_gamma;
|
||||
|
||||
/*
|
||||
V_CheckGamma
|
||||
|
@ -271,15 +269,15 @@ byte gammatable[256]; // palette is sent through this
|
|||
qboolean
|
||||
V_CheckGamma (void)
|
||||
{
|
||||
static float oldbrightness;
|
||||
static float oldcontrast;
|
||||
static float oldgamma;
|
||||
|
||||
if ((brightness->value == oldbrightness) && contrast->value == oldcontrast)
|
||||
return false;
|
||||
oldbrightness = brightness->value;
|
||||
oldcontrast = contrast->value;
|
||||
if (vid_gamma) { // might get called before vid_gamma gets set
|
||||
if (oldgamma == vid_gamma->value)
|
||||
return false;
|
||||
|
||||
oldgamma = vid_gamma->value;
|
||||
}
|
||||
|
||||
BuildGammaTable (brightness->value, contrast->value);
|
||||
vid.recalc_refdef = 1; // force a surface cache flush
|
||||
|
||||
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 ("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.");
|
||||
|
||||
BuildGammaTable (1.0, 1.0); // no gamma yet
|
||||
}
|
||||
|
||||
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_centerspeed = Cvar_Get ("v_centerspeed", "500", CVAR_NONE, "How quickly you return to a center view after a lookup or lookdown");
|
||||
v_centermove = Cvar_Get ("v_centermove", "0.15", CVAR_NONE, NULL,
|
||||
"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_iroll_cycle = Cvar_Get ("v_iroll_cycle", "0.5", CVAR_NONE, "How quickly 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_iyaw_level = Cvar_Get ("v_iyaw_level", "0.3", CVAR_NONE, "How far 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_level = Cvar_Get ("v_ipitch_level", "0.3", CVAR_NONE, "How far you lean forwards and backwards when v_idlescale is enabled");
|
||||
v_iyaw_cycle = Cvar_Get ("v_iyaw_cycle", "2", CVAR_NONE, NULL,
|
||||
"How far you tilt right and left when v_idlescale is enabled");
|
||||
v_iroll_cycle = Cvar_Get ("v_iroll_cycle", "0.5", CVAR_NONE, NULL,
|
||||
"How quickly you tilt right and left when v_idlescale is enabled");
|
||||
v_ipitch_cycle = Cvar_Get ("v_ipitch_cycle", "1", CVAR_NONE, NULL,
|
||||
"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_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, "How much your screen tilts when strafing");
|
||||
cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, NULL,
|
||||
"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_bobcycle = Cvar_Get ("cl_bobcycle", "0.6", CVAR_NONE, "How quickly 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_bob = Cvar_Get ("cl_bob", "0.02", CVAR_NONE, NULL,
|
||||
"How much your weapon moves up and down 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_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, "How much you lean when hit");
|
||||
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, "How much you look up when hit");
|
||||
|
||||
brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, "Brightness level");
|
||||
contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, "Contrast level");
|
||||
v_kicktime = Cvar_Get ("v_kicktime", "0.5", CVAR_NONE, NULL,
|
||||
"How long the kick from an attack lasts");
|
||||
v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, NULL,
|
||||
"How much you lean when hit");
|
||||
v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL,
|
||||
"How much you look up when hit");
|
||||
}
|
||||
|
|
|
@ -891,7 +891,7 @@ Sbar_TeamOverlay (void)
|
|||
scr_copyeverything = 1;
|
||||
scr_fullupdate = 0;
|
||||
|
||||
pic = Draw_CachePic ("gfx/ranking.lmp");
|
||||
pic = Draw_CachePic ("gfx/ranking.lmp", true);
|
||||
Draw_Pic (160 - pic->width / 2, 0, pic);
|
||||
|
||||
y = 24;
|
||||
|
@ -992,7 +992,7 @@ Sbar_DeathmatchOverlay (int start)
|
|||
scr_fullupdate = 0;
|
||||
|
||||
if (!start) {
|
||||
pic = Draw_CachePic ("gfx/ranking.lmp");
|
||||
pic = Draw_CachePic ("gfx/ranking.lmp", true);
|
||||
Draw_Pic (160 - pic->width / 2, 0, pic);
|
||||
}
|
||||
// scores
|
||||
|
@ -1278,6 +1278,6 @@ Sbar_FinaleOverlay (void)
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -402,20 +402,20 @@ SCR_SizeDown_f (void)
|
|||
void
|
||||
SCR_Init_Cvars (void)
|
||||
{
|
||||
scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, "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_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, "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_showram = Cvar_Get ("showram", "1", CVAR_NONE, "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_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, "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_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, "How fast the text is displayed at the end of the single player episodes");
|
||||
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, NULL, "Set the screen size 30 minimum, 120 maximum");
|
||||
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, NULL, "How quickly in the console screen scrolls up and down");
|
||||
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, NULL, "Show turtle icon when fps is lower than 10");
|
||||
scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, NULL, "Show paused graphic when paused");
|
||||
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, 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");
|
||||
crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, "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_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the Y-axis");
|
||||
crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, NULL, "Crosshair 2's 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, NULL, "Sets the position of the crosshair on the X-axis");
|
||||
cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the Y-axis");
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -578,7 +578,7 @@ SCR_DrawPause (void)
|
|||
if (!cl.paused)
|
||||
return;
|
||||
|
||||
pic = Draw_CachePic ("gfx/pause.lmp");
|
||||
pic = Draw_CachePic ("gfx/pause.lmp", true);
|
||||
Draw_Pic ((vid.width - pic->width) / 2,
|
||||
(vid.height - 48 - pic->height) / 2, pic);
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ Skin_Cache (skin_t *skin)
|
|||
if (cls.downloadtype == dl_skin)
|
||||
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
|
||||
return NULL; // not download new ones.
|
||||
|
||||
|
@ -210,6 +210,8 @@ Skin_NextDownload (void)
|
|||
return; // started a download
|
||||
}
|
||||
|
||||
Netchan_AckPacket (&cls.netchan);
|
||||
|
||||
cls.downloadtype = dl_none;
|
||||
|
||||
// now load them in for real
|
||||
|
@ -303,7 +305,7 @@ void
|
|||
Skin_Init (void)
|
||||
{
|
||||
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");
|
||||
Skin_Init_Translation ();
|
||||
}
|
||||
|
@ -311,14 +313,14 @@ Skin_Init (void)
|
|||
void
|
||||
Skin_Init_Cvars (void)
|
||||
{
|
||||
baseskin = Cvar_Get ("baseskin", "base", CVAR_NONE,
|
||||
baseskin = Cvar_Get ("baseskin", "base", CVAR_NONE, NULL,
|
||||
"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");
|
||||
skin = Cvar_Get ("skin", "", CVAR_ARCHIVE | CVAR_USERINFO, "Players skin");
|
||||
topcolor = Cvar_Get ("topcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO,
|
||||
skin = Cvar_Get ("skin", "", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Players skin");
|
||||
topcolor = Cvar_Get ("topcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, NULL,
|
||||
"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");
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -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
279
source/snd_alsa_0_9.c
Normal 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
Loading…
Reference in a new issue