mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-20 17:31:08 +00:00
Merge branch 'master' into iku
Conflicts: config.d/compression.m4
This commit is contained in:
commit
e07c6c9bc0
317 changed files with 11332 additions and 5841 deletions
19
.gitignore
vendored
19
.gitignore
vendored
|
@ -6,6 +6,7 @@
|
|||
*.a
|
||||
*.o
|
||||
*~
|
||||
__pycache__/
|
||||
autom4te.cache/
|
||||
.deps/
|
||||
.libs/
|
||||
|
@ -74,9 +75,11 @@ core
|
|||
/doc/man
|
||||
/doc/progs/vm-mem.eps
|
||||
/doc/progs/vm-mem.png
|
||||
/doc/progs/vm-mem.svg
|
||||
/doc/qtv/qwtv.eps
|
||||
/doc/qtv/qwtv.png
|
||||
/doc/quakeforge.dox
|
||||
/doc/qtv/qwtv.svg
|
||||
/doc/quakeforge.dox.conf
|
||||
/doc/texinfo
|
||||
/doc/stamp-*
|
||||
/doc/aclocal.m4
|
||||
|
@ -115,7 +118,9 @@ core
|
|||
# /libs/
|
||||
|
||||
# /libs/audio/
|
||||
/libs/audio/testsound
|
||||
|
||||
# /libs/audio/test/
|
||||
/libs/audio/test/testsound
|
||||
|
||||
# /libs/audio/cd/
|
||||
|
||||
|
@ -136,7 +141,11 @@ core
|
|||
# /libs/image/
|
||||
|
||||
# /libs/models/
|
||||
/libs/models/testclip
|
||||
|
||||
# /libs/models/test/
|
||||
/libs/models/test/testclip
|
||||
/libs/models/test/testcontents
|
||||
/libs/models/test/testportals
|
||||
|
||||
# /libs/models/alias/
|
||||
|
||||
|
@ -159,6 +168,10 @@ core
|
|||
|
||||
# /libs/util/
|
||||
|
||||
# /libs/util/test
|
||||
/libs/util/test/test-qfs
|
||||
/libs/util/test/test-quat
|
||||
|
||||
# /libs/video/
|
||||
|
||||
# /libs/video/renderer/
|
||||
|
|
117
INSTALL
117
INSTALL
|
@ -1,72 +1,99 @@
|
|||
This is our new development tree (we're back to "quakeforge"), where we're again in the process of merging Quake and QuakeWorld ... but this time, it's much better. :), and will eventually provide the 0.6 versions of QuakeForge.
|
||||
//This file is formatted for processing with doxygen.
|
||||
//unfortunatly, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page build-install Building and Installing QuakeForge
|
||||
|
||||
While almost always in working order, it's under heavy development so be prepared to encounter some issues (Wear your hard hat!). Please check the docs.
|
||||
This is our new development tree (we're back to "quakeforge"), where we're
|
||||
again in the process of merging Quake and QuakeWorld ... but this time,
|
||||
it's much better. :), and will eventually provide the 0.6 versions of
|
||||
QuakeForge.
|
||||
|
||||
UNIX users: because of the diversity of machines QuakeForge runs on, we do not provide UNIX binaries. You need to compile QuakeForge yourself, however QuakeForge is very easy to compile once you have the following packages installed:
|
||||
While almost always in working order, it's under heavy development so be
|
||||
prepared to encounter some issues (Wear your hard hat!). Please check the
|
||||
docs.
|
||||
|
||||
* GNU autoconf 2.50 or later
|
||||
* GNU automake 1.6 or later
|
||||
* GNU libtool 1.4 or later
|
||||
* GNU bison
|
||||
* GNU flex
|
||||
* GNU make (BSD make doesn't like some constructs used)
|
||||
* C compiler and preprocessor (gcc and cpp recommended)
|
||||
* libsamplerate
|
||||
\note UNIX users: because of the diversity of machines on which QuakeForge
|
||||
runs , we do not provide UNIX binaries. You need to compile QuakeForge
|
||||
yourself, however QuakeForge is very easy to compile once you have the
|
||||
necessary packages installed.
|
||||
|
||||
\section req-pack Required Packages
|
||||
The following packages are required to build QuakeForge:
|
||||
\li GNU autoconf 2.50 or later
|
||||
\li GNU automake 1.6 or later
|
||||
\li GNU libtool 1.4 or later
|
||||
\li GNU bison
|
||||
\li GNU flex
|
||||
\li GNU make (BSD make doesn't like some constructs used)
|
||||
\li C compiler and preprocessor (gcc and cpp recommended)
|
||||
\li libsamplerate
|
||||
|
||||
\section rec-pack Recommended Packages
|
||||
The following are recommended:
|
||||
* git (highly recommended for staying up to date with current changes)
|
||||
* zlib devel (highly recommended for compressed file and download support)
|
||||
* Ogg Vorbis libs (for compressed sound effects support)
|
||||
* X11 devel (for X11-based clients: software and OpenGL)
|
||||
* glide and mesa or other GL compatible lib
|
||||
* svgalib (for console-based clients: software and 3dfx)
|
||||
\li git (highly recommended for staying up to date with current changes)
|
||||
\li zlib devel (highly recommended for compressed file and download support)
|
||||
\li curl (for http download support (\ref qw_download_spec))
|
||||
\li Ogg Vorbis libs (for compressed sound effects support)
|
||||
\li X11 devel (for X11-based clients: software and OpenGL)
|
||||
\li glide and mesa or other GL compatible lib
|
||||
\li svgalib (for console-based clients: software and 3dfx)
|
||||
|
||||
Relevant packages (debian):
|
||||
* build-essential
|
||||
* autoconf
|
||||
* automake
|
||||
* libtool
|
||||
* flex
|
||||
* bison
|
||||
* git
|
||||
\section package-names Relevant Package Names
|
||||
The following is the list of relevant package names in debian.
|
||||
\li build-essential
|
||||
\li autoconf
|
||||
\li automake
|
||||
\li libtool
|
||||
\li flex
|
||||
\li bison
|
||||
\li git
|
||||
|
||||
* libasound2-dev
|
||||
* libjack-dev
|
||||
\li libasound2-dev
|
||||
\li libjack-dev
|
||||
|
||||
* libsamplerate0-dev
|
||||
\li libsamplerate0-dev
|
||||
|
||||
* libflac-dev
|
||||
* libogg-dev
|
||||
* libvorbis-dev
|
||||
* libpng12-dev
|
||||
* zlib1g-dev
|
||||
\li libflac-dev
|
||||
\li libogg-dev
|
||||
\li libvorbis-dev
|
||||
\li libpng12-dev
|
||||
\li zlib1g-dev
|
||||
|
||||
* libcurl4-openssl-dev (or libcurl4-gnutls-dev)
|
||||
* libncurses5-dev
|
||||
|
||||
* libsdl1.2-dev
|
||||
* libsvga1-dev
|
||||
* libxxf86dga-dev
|
||||
* libxxf86vm-dev
|
||||
\li libcurl4-openssl-dev (or libcurl4-gnutls-dev)
|
||||
\li libncurses5-dev
|
||||
|
||||
\li libsdl1.2-dev
|
||||
\li libsvga1-dev
|
||||
\li libxxf86dga-dev
|
||||
\li libxxf86vm-dev
|
||||
|
||||
\section building-and-installing Build and Install Procedure
|
||||
Basic process to build and install QuakeForge:
|
||||
\verbatim
|
||||
./bootstrap
|
||||
./configure
|
||||
make install
|
||||
\endverbatim
|
||||
|
||||
You may want to check `./configure --help` and select options.
|
||||
You may want to check <code>./configure --help</code> and select options.
|
||||
|
||||
To build and install only the quakeworld server:
|
||||
\verbatim
|
||||
./bootstrap
|
||||
./configure --without-clients --without-tools --with-servers=qw
|
||||
make install
|
||||
\endverbatim
|
||||
|
||||
To build documentation (doxygen, graphviz and mscgen are required), in an
|
||||
already configured source tree:
|
||||
\verbatim
|
||||
cd doc
|
||||
make doc
|
||||
\endverbatim
|
||||
|
||||
Then either point your webbrowser to doxygen/html/index.html, or copy/move
|
||||
doxygen/html to a webserver and point your browser to that. The
|
||||
documentation is currently grossly inadequate, but hopefully it is of some
|
||||
help.
|
||||
Then either point your webbrowser to <code>doxygen/html/index.html</code>, or
|
||||
copy/move <code>doxygen/html</code> to a webserver and point your browser
|
||||
to that. The documentation is currently grossly inadequate, but hopefully
|
||||
it is of some help.
|
||||
*/
|
||||
|
|
179
NEWS
179
NEWS
|
@ -2,64 +2,123 @@ NEWS for the QuakeForge project
|
|||
-------------------------------
|
||||
|
||||
Changes from 0.5.5
|
||||
o General enhancements
|
||||
* protocol 666 support from fitzquake (nq)
|
||||
* large map support from fitzquake
|
||||
* fullscreen mode is now compliant with modern window managers
|
||||
* wide screens supported. Use the vid_aspect cvar to specify the
|
||||
screen's aspect ratio (eg, 4:3, 16:9, 800:480 etc).
|
||||
* lighting tweaks
|
||||
* don't lose sound when switching workplaces in X
|
||||
* correct resampling of sound effects for 48kHz sound output (or any
|
||||
other rate, for that matter).
|
||||
* support up to 7.1 channel sound files. However, output is still
|
||||
limited to two channels.
|
||||
* "lagged dlights" in mvds fixed
|
||||
* flac sound file support
|
||||
* support multiple directories in fs_sharepath
|
||||
* new savegame format (property list)
|
||||
* map entities can use property lists
|
||||
* JACK audio output
|
||||
* http download support
|
||||
* CPQW support
|
||||
* gold-key/radiation-symbol bug in rock2 fixed
|
||||
* support for very big maps (eg marcher.bsp)
|
||||
* beams (lightning etc) can be any length
|
||||
* unlimited beams
|
||||
* unlimited loaded models
|
||||
* unlimited efrags
|
||||
* support for Japanese keyboards
|
||||
* particle improvements
|
||||
* nq can now release the CPU when it is not needed (cl_usleep 1)
|
||||
o Ruamoko (QuakeC)
|
||||
* plist access
|
||||
* entity parsing support
|
||||
* quake script parsing support
|
||||
* dynamic strings
|
||||
* mutable strings
|
||||
* progs can provide their own entity parsing function. A sample
|
||||
implementation is available.
|
||||
o qfcc
|
||||
* man page documentation
|
||||
* function overloading
|
||||
* allow entity.vector.x (etc) instead of entity.vector_x
|
||||
* many ObjectiveQuakeC fixes
|
||||
* optional constant-vector parameter space optimisation (slows down
|
||||
the code, though): can compile the version of frogbot that has
|
||||
waypoints for almost 300 maps.
|
||||
* rcall support
|
||||
* static local vars
|
||||
* more pointer support
|
||||
* better compatibility with qcc
|
||||
* preprocess progs.src
|
||||
* one-pass compilation of progs.src based code when using cpp
|
||||
* qccx escape codes supported. As there are conflicts with qfcc's
|
||||
escape codes, --qccx-escapes can be used to select qccx instead of
|
||||
qfcc.
|
||||
o Tools
|
||||
* filter for displaying item information from a map (itemslist.py)
|
||||
* wad tool improvements
|
||||
* qfbsp can extract the entities data from bsp files.
|
||||
o General enhancements
|
||||
* many limits removed
|
||||
o unlimited nails (client side)
|
||||
o unlimited visible entities
|
||||
o unlimited static entities
|
||||
o for BSP files, only limits dictated by the format remain
|
||||
* linux joystick improvements:
|
||||
o default device is /dev/input/js0
|
||||
o up to 18 buttons
|
||||
* developer cvar is now a bit field
|
||||
o 1 everything
|
||||
o 2 warnings
|
||||
o 4 video
|
||||
o 8 file system: not found
|
||||
o 16 file system: found
|
||||
o 32 file system: general
|
||||
o 64 networking
|
||||
o 128 ruamoko: objects
|
||||
o 256 ruamoko: messages
|
||||
o 512 sound
|
||||
o 1024 GL textures
|
||||
* ALSA sound support now works with PulseAudio by default
|
||||
* NQ now works on multi-homed hosts
|
||||
* OpenBSD networking fixes
|
||||
* loss of contact with the jack server is now detected. no more
|
||||
hanging on shutdown after jack flakes out.
|
||||
* fishey rendering fixed
|
||||
* crash gracefully when a map has too many entities (rather than
|
||||
silently dropping them: coag3 wasn't fun with missing ents)
|
||||
* players can jump off pretty much anything (controllable via
|
||||
sv_jump_any)
|
||||
* funny size sound buffers no longer a problem
|
||||
* RLE encoding for PCX output
|
||||
* plugins moved to ${libdir}/quakeforge/plugins
|
||||
* IPv6 support now working
|
||||
* rotating bsp model support
|
||||
* alsa 0.9 support dropped
|
||||
* transparent map entities
|
||||
* support map specified skyboxes
|
||||
* NQ's maximum velocity is now spherical rather than cubical
|
||||
* truncate long level names in NQ's HUD
|
||||
* protocol 666 support from fitzquake (nq)
|
||||
* large map support from fitzquake
|
||||
* fullscreen mode is now compliant with modern window managers
|
||||
* wide screens supported. Use the vid_aspect cvar to specify the
|
||||
screen's aspect ratio (eg, 4:3, 16:9, 800:480 etc).
|
||||
* lighting tweaks
|
||||
* don't lose sound when switching workplaces in X
|
||||
* correct resampling of sound effects for 48kHz sound output (or any
|
||||
other rate, for that matter).
|
||||
* support up to 7.1 channel sound files. However, output is still
|
||||
limited to two channels.
|
||||
* "lagged dlights" in mvds fixed
|
||||
* flac sound file support
|
||||
* support multiple directories in fs_sharepath
|
||||
* new savegame format (property list)
|
||||
* map entities can use property lists
|
||||
* JACK audio output
|
||||
* http download support
|
||||
* CPQW support
|
||||
* gold-key/radiation-symbol bug in rock2 fixed
|
||||
* support for very big maps (eg marcher.bsp)
|
||||
* beams (lightning etc) can be any length
|
||||
* unlimited beams
|
||||
* unlimited loaded models
|
||||
* unlimited efrags
|
||||
* support for Japanese keyboards
|
||||
* particle improvements
|
||||
* nq can now release the CPU when it is not needed (cl_usleep 1)
|
||||
o Ruamoko (QuakeC)
|
||||
* installed headers/libs now in ${prefix}/lib/qfcc
|
||||
* plist access
|
||||
* entity parsing support
|
||||
* quake script parsing support
|
||||
* dynamic strings
|
||||
* mutable strings
|
||||
* progs can provide their own entity parsing function. A sample
|
||||
implementation is available.
|
||||
o qfcc
|
||||
* major rewrite of parser and code generation
|
||||
o C style declarations fully supported (bit fields ignored)
|
||||
o dead code elimination
|
||||
o better constant folding
|
||||
o Objective-QC runtime data moved into far data to avoid taking
|
||||
precious near data defs.
|
||||
o missing return statements in non-void functions now detected
|
||||
with a suitable warning
|
||||
o pointers and arrays now use C syntax
|
||||
o "integer" now "int"
|
||||
* field aliasing: .SEL thinkMethod = think;
|
||||
* diagnostic variables
|
||||
__PRETTY_FUNCTION__ __FUNCTION__ __LINE__ and __FILE__
|
||||
* NIL renamed to nil
|
||||
* man page documentation
|
||||
* function overloading
|
||||
* allow entity.vector.x (etc) instead of entity.vector_x
|
||||
* many ObjectiveQuakeC fixes
|
||||
* optional constant-vector parameter space optimisation (slows down
|
||||
the code, though): can compile the version of frogbot that has
|
||||
waypoints for almost 300 maps.
|
||||
* rcall support
|
||||
* static local vars
|
||||
* more pointer support
|
||||
* better compatibility with qcc
|
||||
* preprocess progs.src
|
||||
* one-pass compilation of progs.src based code when using cpp
|
||||
* qccx escape codes supported. As there are conflicts with qfcc's
|
||||
escape codes, --qccx-escapes can be used to select qccx instead of
|
||||
qfcc.
|
||||
* explicit references to classes and categories via
|
||||
"@reference ClassName;" or "@reference ClassName(CategoryName);"
|
||||
o Tools
|
||||
* filter for displaying item information from a map (itemslist.py)
|
||||
* wad tool improvements
|
||||
* qfbsp can extract the entities data from bsp files.
|
||||
* qflmp: converts between lmp and pcx
|
||||
* io_mesh_qfmdl: blender mdl import/export script
|
||||
|
||||
Changes from 0.5.4
|
||||
o General enhancements
|
||||
|
@ -145,8 +204,8 @@ Changes from 0.5.4
|
|||
* new cvar from Grievre to control "fake" filtering and change the fake
|
||||
kick default
|
||||
* fix bug where certain looped sounds would cause a hang
|
||||
* 64 bit compile fixes
|
||||
* alias models are no longer black on maps with no lighting info
|
||||
* 64 bit compile fixes
|
||||
* alias models are no longer black on maps with no lighting info
|
||||
o qfcc enhancements.
|
||||
* conforms better to Objective-C sematics
|
||||
* "struct" support closer to that of C (ie, separate namespace)
|
||||
|
|
|
@ -308,6 +308,7 @@ rm $RPM_BUILD_ROOT/usr/bin/nq-fbdev
|
|||
rm $RPM_BUILD_ROOT/usr/bin/nq-sdl32
|
||||
rm $RPM_BUILD_ROOT/usr/bin/qw-client-fbdev
|
||||
rm $RPM_BUILD_ROOT/usr/bin/qw-client-sdl32
|
||||
rm $RPM_BUILD_ROOT/usr/bin/qfpc
|
||||
find $RPM_BUILD_ROOT/usr/lib -name 'libQFrenderer_sw32.*' -exec rm {} \;
|
||||
#FIXME until I feel like making packages
|
||||
rm $RPM_BUILD_ROOT/usr/bin/qtv
|
||||
|
@ -327,7 +328,6 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%attr(-,root,root) %{_prefix}/lib/libQFcd.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFconsole.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgamecode.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgamecode_builtins.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgib.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFimage.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFjs.so.*
|
||||
|
@ -335,11 +335,11 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%attr(-,root,root) %{_prefix}/lib/libQFruamoko.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFsound.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFutil.so.*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/cd_file.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/cd_linux.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/console_client.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/snd_output_disk.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/snd_render_default.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/cd_file.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/cd_linux.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/console_client.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/snd_output_disk.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/snd_render_default.so*
|
||||
%attr(-,root,root) %{fs_sharepath}/QF/menu.*
|
||||
|
||||
%files devel
|
||||
|
@ -349,8 +349,6 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%attr(-,root,root) %{_prefix}/lib/libQFconsole.so
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgamecode.*a
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgamecode.so
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgamecode_builtins.*a
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgamecode_builtins.so
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgib.*a
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFgib.so
|
||||
%attr(-,root,root) %{_prefix}/lib/libQFimage.*a
|
||||
|
@ -395,7 +393,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%attr(-,root,root) %{_prefix}/bin/nq-server
|
||||
%attr(-,root,root) %{_prefix}/bin/qw-master
|
||||
#%attr(-,root,root) %{_prefix}/bin/hw-master
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/console_server.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/console_server.so*
|
||||
|
||||
%if "%{HAVE_X11}"=="'yes'"
|
||||
%files glx
|
||||
|
@ -405,8 +403,8 @@ rm -rf $RPM_BUILD_ROOT
|
|||
|
||||
%if "%{HAVE_SDL}"=="'yes'"
|
||||
%files sdl-common
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/cd_sdl.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/snd_output_sdl.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/cd_sdl.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/snd_output_sdl.so*
|
||||
|
||||
%files sdl
|
||||
%attr(-,root,root) %{_prefix}/bin/qw-client-sdl
|
||||
|
@ -431,17 +429,17 @@ rm -rf $RPM_BUILD_ROOT
|
|||
|
||||
%if "%{HAVE_XMMS}"=="'yes'"
|
||||
%files xmms
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/cd_xmms.so
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/cd_xmms.so
|
||||
%endif
|
||||
|
||||
%if "%{HAVE_ALSA}"=="'yes'"
|
||||
%files alsa
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/snd_output_alsa.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/snd_output_alsa.so*
|
||||
%endif
|
||||
|
||||
%if "%{HAVE_OSS}"=="'yes'"
|
||||
%files oss
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/snd_output_oss.so*
|
||||
%attr(-,root,root) %{_prefix}/lib/quakeforge/plugins/snd_output_oss.so*
|
||||
%endif
|
||||
|
||||
%files -n qfcc
|
||||
|
@ -466,6 +464,7 @@ rm -rf $RPM_BUILD_ROOT
|
|||
%attr(-,root,root) %{_prefix}/bin/bsp2img
|
||||
%attr(-,root,root) %{_prefix}/bin/qfbsp
|
||||
%attr(-,root,root) %{_prefix}/bin/qflight
|
||||
%attr(-,root,root) %{_prefix}/bin/qflmp
|
||||
%attr(-,root,root) %{_prefix}/bin/qfmodelgen
|
||||
%attr(-,root,root) %{_prefix}/bin/qfvis
|
||||
%attr(-,root,root) %{_prefix}/bin/wad
|
||||
|
|
10
TODO
10
TODO
|
@ -14,28 +14,30 @@ X ~/.quakeforgerc should support all commands, not just set and setrom
|
|||
X software PCXs don't work in X11 at least if you're using 16/24/32 color
|
||||
X ogg support
|
||||
X server-side demos
|
||||
X Scitech MGL used in win32 is screwed - dump it and use SDL
|
||||
X kill MAX_STATIC_ENTITIES
|
||||
X stateful console (eg, rcon mode, chat mode, normal command mode...)
|
||||
M it seems possible to crash a QF server still - need to fix this!
|
||||
M merge nq and qw code bases
|
||||
M mingw cross compiling
|
||||
X Scitech MGL used in win32 is screwed - dump it and use SDL
|
||||
M software targets should mix color at 16/16 or 24/32 color
|
||||
I GL is still way too slow
|
||||
I Client side QuakeC.
|
||||
I menu rewrite
|
||||
I clean up TODO ;)
|
||||
o kill MAX_STATIC_ENTITIES
|
||||
o doublesize modes (eg, render in 320x240 but display in 640x480)
|
||||
o allow qf clients to download .lit files from qf servers.
|
||||
o better server control of certain cvars
|
||||
o triggers (f_respawn, f_death, f_took; cl_triggers)
|
||||
X stateful console (eg, rcon mode, chat mode, normal command mode...)
|
||||
o scripted hud
|
||||
o add a U_PHYSICAL field to entities. it should include a solid bit,
|
||||
a rotated bbox bit, and mins/maxs for the bbos
|
||||
o gui for serverlist
|
||||
o add favorates serverlist manipulation
|
||||
o add favorites serverlist manipulation
|
||||
o redo serverlist filtering for better flexability and/or easier use
|
||||
o add individual server ping/info request from console
|
||||
? dynamically allocate missing fields, particularly ones not needed by the
|
||||
progs.
|
||||
? more direct intra-team comms (eg, talk to offense or defense directly)
|
||||
? Draw_Pic and friends need a cleanup in GL at least
|
||||
? Draw_Pic and other tex draw functions should use local palettes
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
pkg-config/quakeforge.pc
|
||||
|
||||
doc/Makefile
|
||||
doc/quakeforge.dox
|
||||
doc/quakeforge.dox.conf
|
||||
doc/man/Makefile
|
||||
|
||||
debian/Makefile
|
||||
|
|
|
@ -298,6 +298,7 @@ SND_OUTPUT_DEFAULT=""
|
|||
if test -n "$CL_TARGETS"; then
|
||||
CD_TARGETS="libQFcd.la"
|
||||
SND_TARGETS="libQFsound.la"
|
||||
AUDIO_TARGETS="testsound\$(EXEEXT)"
|
||||
JOY_TARGETS="libQFjs.la"
|
||||
if test "`echo $SOUND_TYPES | grep ALSA`"; then
|
||||
SND_PLUGIN_TARGETS="$SND_PLUGIN_TARGETS snd_output_alsa.la"
|
||||
|
@ -364,6 +365,7 @@ else
|
|||
SND_PLUGIN_TARGETS=""
|
||||
SND_REND_TARGETS=""
|
||||
SND_TARGETS=""
|
||||
AUDIO_TARGETS=""
|
||||
unset SOUND_TYPES
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(SND_OUTPUT_DEFAULT, "$SND_OUTPUT_DEFAULT", [Define this to the default sound output driver.])
|
||||
|
@ -510,6 +512,7 @@ AC_SUBST(SND_REND_STATIC)
|
|||
AC_SUBST(SND_REND_STATIC_LIBS)
|
||||
AC_SUBST(SND_REND_TARGETS)
|
||||
AC_SUBST(SND_TARGETS)
|
||||
AC_SUBST(AUDIO_TARGETS)
|
||||
AC_SUBST(VID_MODEL_TARGETS)
|
||||
AC_SUBST(VID_REND_TARGETS)
|
||||
AC_SUBST(VID_REND_NOINST_TARGETS)
|
||||
|
@ -524,7 +527,7 @@ QF_DEPS(BSP2IMG,
|
|||
)
|
||||
QF_DEPS(QFBSP,
|
||||
[-I$(top_srcdir)/tools/qfbsp/include],
|
||||
[$(top_builddir)/libs/util/libQFutil.la],
|
||||
[$(top_builddir)/libs/util/libQFutil.la $(top_builddir)/libs/models/libQFmodels.la],
|
||||
[$(WIN32_LIBS)],
|
||||
)
|
||||
QF_DEPS(QFCC,
|
||||
|
|
|
@ -4,7 +4,7 @@ AC_ARG_ENABLE(flac,
|
|||
HAVE_FLAC=no
|
||||
if test "x$enable_flac" != "xno"; then
|
||||
if test "x$PKG_CONFIG" != "x"; then
|
||||
PKG_CHECK_MODULES([LIBFLAC], [flac], HAVE_FLAC=yes, HAVE_FLAC=no)
|
||||
PKG_CHECK_MODULES([FLAC], [flac], HAVE_FLAC=yes, HAVE_FLAC=no)
|
||||
else
|
||||
AM_PATH_LIBFLAC(HAVE_FLAC=yes, HAVE_FLAC=no)
|
||||
fi
|
||||
|
@ -61,12 +61,12 @@ 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, 1, [Define if you have zlib])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(Z_LIBS)
|
||||
AC_DEFINE(HAVE_ZLIB, 1, [Define if you have zlib])
|
||||
AM_CONDITIONAL(HAVE_ZLIB, test "$HAVE_ZLIB" = "yes")
|
||||
|
||||
AC_ARG_ENABLE(png,
|
||||
|
@ -80,12 +80,11 @@ if test "x$enable_png" != "xno"; then
|
|||
else
|
||||
AC_CHECK_LIB(png, png_set_read_fn, HAVE_PNG=yes, HAVE_PNG=no, [$LIBS])
|
||||
if test "x$HAVE_PNG" = "xyes"; then
|
||||
AC_CHECK_HEADER(png.h, HAVE_PNG=yes, HAVE_PNG=no)
|
||||
AC_CHECK_HEADER(png.h, HAVE_PNG=yes PNG_LIBS="-lpng", HAVE_PNG=no)
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(PNG_LIBS)
|
||||
if test "x$HAVE_PNG" = "xyes"; then
|
||||
PNG_LIBS="-lpng"
|
||||
AC_DEFINE(HAVE_PNG, 1, [Define if you have libpng])
|
||||
fi
|
||||
|
|
|
@ -10,10 +10,10 @@ AC_CHECK_HEADERS(
|
|||
alloca.h arpa/inet.h asm/io.h assert.h conio.h \
|
||||
ctype.h ddraw.h dinput.h direct.h dirent.h dlfcn.h dmedia/audio.h \
|
||||
dmedia/cdaudio.h dpmi.h dsound.h errno.h execinfo.h fcntl.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 process.h pthread.h pwd.h rpc/types.h setjmp.h signal.h \
|
||||
stdarg.h stdio.h stdlib.h string.h strings.h sys/asoundlib.h \
|
||||
ifaddrs.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 process.h pthread.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/uio.h termios.h \
|
||||
|
|
|
@ -5,8 +5,10 @@ dnl ==================================================================
|
|||
LIBCURL_CHECK_CONFIG([], [], [CURL=yes], [])
|
||||
|
||||
AC_ARG_WITH(ipv6,
|
||||
[ --with-ipv6=DIR enable IPv6 support. Optional argument specifies
|
||||
location of inet6 libraries.],
|
||||
AS_HELP_STRING([--with-ipv6=DIR],
|
||||
[Eenable IPv6 support.]
|
||||
[Optional argument specifies location of inet6 libraries.]),
|
||||
[
|
||||
if test "x$withval" = xno ; then
|
||||
NETTYPE_IPV6=no
|
||||
else
|
||||
|
@ -16,8 +18,8 @@ AC_ARG_WITH(ipv6,
|
|||
LIBS="$LIBS -L${withval}"
|
||||
fi
|
||||
fi
|
||||
,
|
||||
NETTYPE_IPV6=no
|
||||
],
|
||||
[NETTYPE_IPV6=no]
|
||||
)
|
||||
AM_CONDITIONAL(NETTYPE_IPV6, test "x$NETTYPE_IPV6" = "xyes")
|
||||
|
||||
|
@ -77,3 +79,16 @@ connect (0, NULL, 42);
|
|||
LIBS="$SAVELIBS"
|
||||
fi
|
||||
AC_SUBST(NET_LIBS)
|
||||
|
||||
AC_MSG_CHECKING([for getifaddrs])
|
||||
SAVELIBS="$LIBS"
|
||||
LIBS="$LIBS $NET_LIBS"
|
||||
AC_TRY_LINK([],
|
||||
[
|
||||
getifaddrs (0);
|
||||
],
|
||||
AC_DEFINE(HAVE_GETIFADDRS, 1, [Define this if you have getifaddrs()])
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
LIBS="$SAVELIBS"
|
||||
|
|
|
@ -113,7 +113,9 @@ fi
|
|||
AC_SUBST(SAMPLERATE_LIBS)
|
||||
dnl AM_CONDITIONAL(HAVE_SAMPLERATE, test "$HAVE_SAMPLERATE" = "yes")
|
||||
if test "x$HAVE_SAMPLERATE" = "xno"; then
|
||||
AC_MSG_ERROR(libsamplerate is required but was not found)
|
||||
AC_MSG_WARN([libsamplerate is required but was not found.]
|
||||
[Sound will be disabled.])
|
||||
enable_sound=no
|
||||
fi
|
||||
|
||||
SOUND_TYPES="$SOUND_TYPES DISK"
|
||||
|
|
6
debian/changelog
vendored
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
|||
quakeforge (0.6.0~git20110804-0) frozen unstable; urgency=low
|
||||
|
||||
* Small debian bugfixes and GIT snapshot
|
||||
|
||||
-- sergio <mailbox@sergio.spb.ru> Thu, 04 Aug 2011 03:24:32 +0400
|
||||
|
||||
quakeforge (0.6.0~git20101223-1) frozen unstable; urgency=low
|
||||
|
||||
* The "No, really" release.
|
||||
|
|
1
debian/quakeforge-common.install
vendored
1
debian/quakeforge-common.install
vendored
|
@ -3,7 +3,6 @@ usr/lib/libQFcd.so.*
|
|||
usr/lib/libQFconsole.so.*
|
||||
usr/lib/libQFruamoko.so.*
|
||||
usr/lib/libQFgamecode.so.*
|
||||
usr/lib/libQFgamecode_builtins.so.*
|
||||
usr/lib/libQFgib.so.*
|
||||
usr/lib/libQFimage.so.*
|
||||
usr/lib/libQFjs.so.*
|
||||
|
|
1
debian/quakeforge-common.postinst
vendored
1
debian/quakeforge-common.postinst
vendored
|
@ -1,7 +1,6 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
update-alternatives --install /usr/lib/quakeforge/plugins/snd_output_default.so quakeforge-audio-default /usr/lib/quakeforge/plugins/snd_output_disk.so 10
|
||||
update-alternatives --install /usr/lib/quakeforge/plugins/snd_output_default.so quakeforge-audio-default /usr/lib/quakeforge/plugins/snd_output_oss.so 20
|
||||
|
||||
#DEBHELPER#
|
||||
exit 0
|
||||
|
|
2
debian/quakeforge-dev.install
vendored
2
debian/quakeforge-dev.install
vendored
|
@ -6,8 +6,6 @@ usr/lib/libQFruamoko.*a
|
|||
usr/lib/libQFruamoko.so
|
||||
usr/lib/libQFgamecode.*a
|
||||
usr/lib/libQFgamecode.so
|
||||
usr/lib/libQFgamecode_builtins.*a
|
||||
usr/lib/libQFgamecode_builtins.so
|
||||
usr/lib/libQFgib.a
|
||||
usr/lib/libQFgib.so
|
||||
usr/lib/libQFimage.*a
|
||||
|
|
|
@ -1,36 +1,55 @@
|
|||
AUTOMAKE_OPTIONS= foreign
|
||||
|
||||
SUBDIRS= man
|
||||
|
||||
DOX= \
|
||||
bind.dox config.dox connect.dox cshifts.dox dirconf.dox faq.dox \
|
||||
filesystem.dox mapformat.dox property-list.dox qtv.dox quakeforge.dox \
|
||||
qw-cap-spec.dox qw-download-spec.dox sound.dox specifications.dox \
|
||||
surround-sound.dox timestamps.dox
|
||||
|
||||
GIB= \
|
||||
gib/GIB.lyx gib/break.gib gib/continue.gib gib/curly.gib gib/examples.sh \
|
||||
gib/for.gib gib/gib_head.eps gib/if-chain.gib gib/if-else.gib \
|
||||
gib/if-simple.gib gib/while.gib
|
||||
|
||||
PROGS= \
|
||||
progs/vm-exec.c progs/vm-mem.fig
|
||||
|
||||
EXTRA_DIST= qf.ico \
|
||||
\
|
||||
skybox.fig template.c template.h timestamps.txt \
|
||||
quakeforge.dox.in \
|
||||
skybox.fig template.c template.h \
|
||||
quakeforge.dox.conf.in \
|
||||
\
|
||||
faq.txt quakeforge.txt \
|
||||
${DOX} ${GIB} ${PROGS} \
|
||||
\
|
||||
config/glspeed-v1.cfg config/glspeed-v3.cfg config/swspeed.cfg \
|
||||
\
|
||||
config/gib/adjustvolume.gib config/gib/infobot.gib config/gib/ln.gib \
|
||||
config/gib/qfadmin.gib config/gib/sshot.gib config/gib/zoom.gib \
|
||||
\
|
||||
progs/vm-exec.c progs/vm-mem.fig \
|
||||
qtv/qwtv.fig
|
||||
|
||||
%.png: %.fig
|
||||
SUFFIXES=.eps .fig .png
|
||||
.fig.png:
|
||||
@mkdir -p `dirname $@`
|
||||
fig2dev -L png $< $@
|
||||
|
||||
%.eps: %.fig
|
||||
.fig.eps:
|
||||
@mkdir -p `dirname $@`
|
||||
fig2dev -L ps $< $@
|
||||
|
||||
.fig.svg:
|
||||
@mkdir -p `dirname $@`
|
||||
fig2dev -L svg $< $@
|
||||
|
||||
clean-local:
|
||||
-rm -fr doxygen
|
||||
|
||||
progs/vm-mem.png: progs/vm-mem.fig
|
||||
progs/vm-mem.svg: progs/vm-mem.fig
|
||||
progs/vm-mem.eps: progs/vm-mem.fig
|
||||
qtv/qwtv.png: qtv/qwtv.fig
|
||||
qtv/qwtv.svg: qtv/qwtv.fig
|
||||
qtv/qwtv.eps: qtv/qwtv.fig
|
||||
|
||||
doc: quakeforge.dox progs/vm-mem.png progs/vm-mem.eps qtv/qwtv.png qtv/qwtv.eps
|
||||
doxygen quakeforge.dox
|
||||
doc: quakeforge.dox.conf progs/vm-mem.svg progs/vm-mem.eps qtv/qwtv.svg qtv/qwtv.eps ${DOX}
|
||||
doxygen quakeforge.dox.conf
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page key_binding New Bind System
|
||||
|
178
doc/config.dox
Normal file
178
doc/config.dox
Normal file
|
@ -0,0 +1,178 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page run_config Runtime Configuration.
|
||||
|
||||
\li \subpage cmdline
|
||||
\li \subpage cvars
|
||||
\li \subpage filesystem
|
||||
\li \subpage dirconf
|
||||
\li \subpage sound
|
||||
\li \subpage tracklist
|
||||
\li \subpage key_binding
|
||||
\li \subpage cshift_cvars
|
||||
\li \subpage server_timestamps
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
\page cmdline Command Line
|
||||
The \QF servers (\c nq-server, \c qw-server, and \c qtv), and clients
|
||||
(\c nq-glx, \c nq-wgl, \c qw-client-glx, \c qw-client-wgl etc) all parse
|
||||
the program command line looking for console commands.
|
||||
|
||||
Console commands on the command line are marked with a \c + that follows
|
||||
whitespace. They continue until the next \c + or \c - that follows
|
||||
whitespace. This allows commands and arguments to contain \c + and \c - so
|
||||
long as the preceeding character is not whitespace, but also prevents
|
||||
command line switches (eg \c -nosound) from becoming part of the console
|
||||
command. Using careful quoting, it is even possible for a command or
|
||||
argument to beging with \c + or \c -.
|
||||
|
||||
The following command line will fail to set m_pitch because the -0.022
|
||||
will not be part of the console command. <code>usage: setrom \<cvar\>
|
||||
\<value\></code> will be displayed instead.
|
||||
\verbatim
|
||||
nq-glx +setrom m_pitch -0.022
|
||||
\endverbatim
|
||||
|
||||
The following command line will successfully set m_pitch to \c -0.022
|
||||
because \QF will see the \c " before the \c - and thus \c -0.022 will be
|
||||
part of the console command.
|
||||
\verbatim
|
||||
nq-glx +setrom m_pitch \"-0.022\"
|
||||
\endverbatim
|
||||
\note The above works in bash. Other shells may vary.
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
\page cvars Configuration variables
|
||||
|
||||
The core of \QF's configurabitly is the cvar.
|
||||
|
||||
\section cvar_value Cvar values.
|
||||
Depending on the engine's use of the cvar, the value will be treated as a
|
||||
string, a floating point value, an integer value or even a vector value.
|
||||
|
||||
If a space is needed in the value, the value must be "quoted".
|
||||
|
||||
\section cvar_type Cvar types.
|
||||
From the user's perspective, there are three types of cvar:
|
||||
\li plain cvar: the value can be displayed or set, but will not be
|
||||
automatically saved.
|
||||
\li archive cvar: like a plain cvar, the value can be displayed or set, but
|
||||
the cvar will be automatically saved to \c config.cfg by the engine on
|
||||
shutdown or gamedir change (quakeworld).
|
||||
\li read-only cvar: the value can be displayed but not changed in any way
|
||||
(value or flags). If the cvar also happens to be an archive cvar (the
|
||||
archive flag was set before the read-only flag), then the cvar will be
|
||||
saved to \c config.cfg.
|
||||
|
||||
\section cvar_cmds Cvar related commands.
|
||||
<code>\<cvar\> [value]</code><br>
|
||||
Display the current value of the specified cvar. If \c value is given, set
|
||||
the cvar to \c value. Does not create a new cvar.
|
||||
|
||||
<code>set \<cvar\> \<value\></code><br>
|
||||
Set the specified cvar to the specified value. If the cvar does not already
|
||||
exist, a new cvar will be created.
|
||||
|
||||
<code>seta \<cvar\> \<value\></code><br>
|
||||
Set the specified cvar to the specified value. If the cvar does not already
|
||||
exist, a new cvar will be created. Sets the cvar's archive flag so it will
|
||||
be automatically saved to \c config.cfg by the clients.
|
||||
|
||||
<code>setrom \<cvar\> \<value\></code><br>
|
||||
Set the specified cvar to the specified value. If the cvar does not already
|
||||
exist, a new cvar will be created. Sets the cvar's read-only flag so it can
|
||||
no longer be modified in any way (not even by \c reset or \c resetall).
|
||||
|
||||
<code>toggle \<cvar\></code><br>
|
||||
Treat the cvar as a boolean value, changing it from off to on, or on to
|
||||
off. Any non-zero integer value is considered to be on, while zero and
|
||||
any string that parses as zero (does not start with a non-zero number) will
|
||||
be treated as off. The new value will always be either one (1) or zero (0).
|
||||
\note values smaller than 1 will be treated as off.
|
||||
|
||||
<code>cvarlist [foo]</code><br>
|
||||
Print a list of all cvars known to the engine (engine created or user
|
||||
created). If the foo parameter is given (any value), then extra
|
||||
information (cvar description, flags) will also be printed.
|
||||
|
||||
<code>cycle \<cvar\> \<value list\></code><br>
|
||||
Cause the cvar to cycle through the list of values. Each time this command
|
||||
is executed, the cvar will change to the value immediately after the cvar's
|
||||
current value in the list, cycling back to the beginning when the current
|
||||
value is the last value in the list. If the current value is not in the
|
||||
list, the cvar will be set to the first value in the list.
|
||||
|
||||
<code>inc \<cvar\> [amount]</code><br>
|
||||
Add one (1) to the cvar's current numeric value. If the optional amount is
|
||||
given, add that value to the cvar's current numeric value. Using -1
|
||||
(<code>inc \<cvar\> -1</code>), this can be used as a \c dec command.
|
||||
|
||||
<code>reset \<cvar\></code><br>
|
||||
Reset the specified cvar to its default (engine specified) value.
|
||||
|
||||
<code>resetall</code><br>
|
||||
Reset all cvars to their default (engine specified values).
|
||||
|
||||
\section cvar_rom Read-only cvars
|
||||
Many cvars in \QF are read-only because changing them at runtime would
|
||||
either have little meaning or be difficult to implement. However, there
|
||||
<em>is</em> a way to change even a read-only cvars: using the \c set
|
||||
command, the cvar can be created with the desired value before the engine
|
||||
creates the cvar (and sets its read-only flag). There are exactly three
|
||||
places where the cvar can be created before the engine does:
|
||||
\li the command line (eg <code>nq-glx +set snd_rate 48000</code>)
|
||||
\li the global configuration file specified by the \c fs_globalcfg cvar.
|
||||
\li the user configuration file specified by the \c fs_usercfg cvar.
|
||||
|
||||
\c fs_globalcfg defaults to \c /etc/quakeforge.conf on Linux and other
|
||||
UNIX like systems, and <code>~/quakeforge.conf</code> on Windows (\QF will
|
||||
expand <code>~</code> to the value of the HOME environment variable if it
|
||||
is set, or WINDOWS if not).
|
||||
|
||||
\c fs_usercfg defaults to either <code>~/.quakeforgerc</code> or
|
||||
<code>~/.config/quakeforge/quakeforge.conf</code> on Linux and other UNIX
|
||||
like systems, and \c ~/quakeforgerc on Windows.
|
||||
|
||||
The global and user configuration files are normal quake scripts, but only
|
||||
\c set, \c seta, and \c setrom commands are executed.
|
||||
|
||||
It might seem strange to have the global and user configuration files
|
||||
specified by cvars, but \QF's startup sequence is quite intense:
|
||||
\li Execute any \c set commands given on the \ref cmdline. This way, \c
|
||||
fs_globalcfg can be set.
|
||||
\li Execute any \c set commands in the global configuration file. This way,
|
||||
\c fs_usercfg can be set.
|
||||
\li Re-execute any \c set commands given on the command line. Thus it is
|
||||
possible to override \c fs_usercfg if it is set by the global configuration
|
||||
file (unless \c setrom is used: BOFH).
|
||||
\li Execute any \c set commands in the user configuration file. Any cvars
|
||||
set in the user configuration file override those set in the global
|
||||
configuration file.
|
||||
\li Once again, re-execute any \c set commands given on the command line.
|
||||
Thus cvars set on the command line override those set in either the user
|
||||
configuration file or the global configuration file (or both).
|
||||
|
||||
During the above process, the only cvars created by the engine are \c
|
||||
fs_globalcfg (just before reading the global configuration file) and \c
|
||||
fs_usercfg (just before reading the user configuration file). Thus, it is
|
||||
possible to set <em>any</em> cvar in \QF.
|
||||
|
||||
The above means that:
|
||||
\li The \ref cmdline can be used to set any cvar in \QF.
|
||||
\li The global config file can be used to set any cvar but \c
|
||||
fs_globalcfg.
|
||||
\li The user config file can be used to set any cvar but \c fs_globalcfg
|
||||
or \c fs_usercfg.
|
||||
\li The user config file can be used to override settings made in the
|
||||
global config file, unless those settings have been made read-only by the
|
||||
global config file (by using \c setrom instead of \c set).
|
||||
\li The command line can be used to override settings made in either the
|
||||
user config file or the global config file. If \c setrom is used on the
|
||||
command line, even \c setrom in the config files can be overridden.
|
||||
|
||||
*/
|
|
@ -73,7 +73,8 @@
|
|||
domain qfadmin
|
||||
|
||||
global uservote cmds mapvote config
|
||||
global cvsheader = "$Id$"
|
||||
//global cvsheader = "$Id$"
|
||||
global qfadminversion = "1.17"
|
||||
|
||||
// QFAdmin console interface
|
||||
function qfadmin {
|
||||
|
@ -238,19 +239,20 @@ function qfadmin::doVersion {
|
|||
|
||||
// Return the current version
|
||||
function qfadmin::getVersion {
|
||||
local tmp tmp2
|
||||
// local tmp tmp2
|
||||
|
||||
tmp = $(split $cvsheader)
|
||||
// tmp = $(split $cvsheader)
|
||||
|
||||
if $(equal $tmp[6] "Exp") {
|
||||
tmp2 = "Beta"
|
||||
} else if $(equal $tmp[6] "Stab") {
|
||||
tmp2 = "Stable"
|
||||
} else if $(equal $tmp[6] "Rel") {
|
||||
tmp2 = "Release"
|
||||
}
|
||||
// if $(equal $tmp[6] "Exp") {
|
||||
// tmp2 = "Beta"
|
||||
// } else if $(equal $tmp[6] "Stab") {
|
||||
// tmp2 = "Stable"
|
||||
// } else if $(equal $tmp[6] "Rel") {
|
||||
// tmp2 = "Release"
|
||||
// }
|
||||
|
||||
return "QFAdmin v", $tmp[2], " (", $tmp[3], " ", $tmp2, ") by Harry Roberts"
|
||||
// return "QFAdmin v", $tmp[2], " (", $tmp[3], " ", $tmp2, ") by Harry Roberts"
|
||||
return "QFAdmin v", $qfadminversion, " by Harry Roberts"
|
||||
}
|
||||
|
||||
// Clear uservore & mapvote vars
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page connection_sequence QW Connection Sequence
|
||||
\msc
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page cshift_cvars cshift control
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunatly, have to wrap the docs in a C comment for doxygen
|
||||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page dirconf Directory Configuration
|
||||
|
||||
|
@ -15,12 +16,24 @@ Quake = {
|
|||
Inherit = QF;
|
||||
Path = "id1";
|
||||
GameCode = "progs.dat";
|
||||
HudType = "id";
|
||||
};
|
||||
QuakeWorld = {
|
||||
Inherit = (Quake);
|
||||
Path = "qw";
|
||||
SkinPath = "${path}/skins";
|
||||
GameCode = "qwprogs.dat";
|
||||
HudType = "id";
|
||||
};
|
||||
"Hipnotic" = {
|
||||
Inherit = (Quake);
|
||||
Path = "hipnotic";
|
||||
HudType = "hipnotic";
|
||||
};
|
||||
"Rogue" = {
|
||||
Inherit = (Quake);
|
||||
Path = "rogue";
|
||||
HudType = "rogue";
|
||||
};
|
||||
"qw:qw" = {
|
||||
Inherit = (QuakeWorld);
|
||||
|
@ -33,20 +46,12 @@ QuakeWorld = {
|
|||
Inherit = (Quake);
|
||||
Path = "$gamedir";
|
||||
};
|
||||
"hipnotic" = {
|
||||
Inherit = (Quake);
|
||||
Path = "hipnotic";
|
||||
};
|
||||
"hipnotic:*" = {
|
||||
Inherit = (hipnotic);
|
||||
Inherit = (Hipnotic);
|
||||
Path = "$gamedir";
|
||||
};
|
||||
"rogue" = {
|
||||
Inherit = (Quake);
|
||||
Path = "rogue";
|
||||
};
|
||||
"rogue:*" = {
|
||||
Inherit = (rogue);
|
||||
Inherit = (Rogue);
|
||||
Path = "$gamedir";
|
||||
};
|
||||
"abyss" = {
|
||||
|
@ -71,6 +76,9 @@ Supported attributes are:
|
|||
<dt><code>GameCode</code></dt>
|
||||
<dd>The name of the mod progs file. This is relative to the mod
|
||||
directory</dd>
|
||||
<dt><code>HudType</code></dt>
|
||||
<dd>The name of the hud style. Currently, "id", "hipnotic" and
|
||||
"rogue" are supported. Has no effect in quakeworld.</dd>
|
||||
<dt><code>SkinPath</code></dt>
|
||||
<dd>Directory to which downloaded skins will be saved. This is
|
||||
relative to the QuakeForge data directory, and thus the default
|
|
@ -5,6 +5,11 @@ body, table, div, p, dl {
|
|||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* Make code fragments in doc text stand out */
|
||||
code {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* @group Heading Levels */
|
||||
|
||||
h1 {
|
||||
|
@ -125,17 +130,17 @@ a.elRef {
|
|||
|
||||
a.code {
|
||||
color: #4444cc;
|
||||
/* font-weight: bold;*/
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.code:visited {
|
||||
color: #444488;
|
||||
/* font-weight: bold;*/
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
a.codeRef {
|
||||
color: #6666ff;
|
||||
/* font-weight: bold;*/
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* @end */
|
||||
|
@ -252,6 +257,12 @@ div.center img {
|
|||
background-color: #bec3d9;
|
||||
}
|
||||
|
||||
div.center iframe {
|
||||
border: 2px solid #737b9c;
|
||||
margin: 10px 2px;
|
||||
background-color: #bec3d9;
|
||||
}
|
||||
|
||||
address.footer {
|
||||
text-align: right;
|
||||
padding-right: 12px;
|
||||
|
@ -873,6 +884,8 @@ dl.bug
|
|||
.image
|
||||
{
|
||||
text-align: center;
|
||||
background: white;
|
||||
border: 2px solid #737b9c;
|
||||
}
|
||||
|
||||
.dotgraph
|
||||
|
|
71
doc/faq.dox
Normal file
71
doc/faq.dox
Normal file
|
@ -0,0 +1,71 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page faq Frequently Asked Questions
|
||||
|
||||
\li \ref gfx_wad
|
||||
\li \ref pak0_pak
|
||||
\li \ref git_compile_error
|
||||
\li \ref no_music
|
||||
\li \ref no_mp3
|
||||
\li \ref faq_cvar_rom
|
||||
|
||||
\section gfx_wad What does "W_LoadWadFile: unable to load gfx.wad" mean?
|
||||
The most common cause of this error is QuakeForge is unable to find
|
||||
pak0.pak. QuakeForge looks for pak0.pak in both the $fs_userpath/id1 and
|
||||
$fs_sharepath/id1 directories. In Windows, both fs_userpath and fs_sharepath
|
||||
default to "." (ie, the current directory: the same as id's quake clients). In
|
||||
Linux (and other UNIX like operating systems), fs_userpath defaults to
|
||||
~/.quakeforge and fs_sharepath defaults to $prefix/share/games/quakeforge
|
||||
(distribution packages might alter the exact path).
|
||||
|
||||
See \ref filesystem for more details.
|
||||
|
||||
\section pak0_pak Where can I get pak0.pak?
|
||||
See \ref game_data
|
||||
|
||||
\section game_data Why doesn't QuakeForge come with the game data?
|
||||
While QuakeForge itself (and the Quake source code in general) is Free
|
||||
Software, the game itself is not free. You need to either purchase it from <a
|
||||
href="http://www.idsoftware.com/store/index.php?view=quake">id Software</a> or
|
||||
you can use <a href="http://openquartz.sourceforge.net/">OpenQuartz</a>, a
|
||||
project developing GPL compatible game data for Quake.
|
||||
|
||||
\section git_compile_error Checking out git and running ./bootstrap creates a configure that syntax errors when I run it! What's wrong?
|
||||
Unlike downloading and compiling a release, when you checkout from git, you
|
||||
must have all the dependencies of QuakeForge already installed as when
|
||||
configure is being created autotools sources m4 files... If the files do not
|
||||
exist, you get the errors you have seen. Try installing packages which contain
|
||||
the libraries that caused the syntax error, including the -dev versions, then
|
||||
recreate configure using bootstrap and try again.
|
||||
|
||||
\section no_music Why doesn't \QF play the background music even though I have the CD in the drive?
|
||||
By default, \QF no longer uses the CD drive to play music. Instead, \QF now
|
||||
looks for a \ref tracklist to map Quake's cd tracks to sound files. If you
|
||||
wish to continue using the CD instead, you may set the \c cd_plugin cvar to
|
||||
the value appropriate for your system:
|
||||
<dl>
|
||||
<dt><code>file</code></dt> <dd>The default CD plugin. Uses sound files
|
||||
for the BGM.</dd>
|
||||
<dt><code>linux</code></dt> <dd>Use this plugin on a Linux system.</dd>
|
||||
<dt><code>sdl</code></dt> <dd>This plugin can be used on most
|
||||
systems.</dd>
|
||||
<!-- <dt><code>sgi</code></dt> <dd>Use this plugin on SGI systems.</dd>-->
|
||||
<dt><code>win</code></dt> <dd>Use this plugin on Windows
|
||||
systems.</dd>
|
||||
<dt><code>xmms</code></dt> <dd>The predecessor to the \c file plugin.
|
||||
Not always available, and expects xmms
|
||||
to be available (but not necessarily
|
||||
running) on the system. Useful if you
|
||||
absolutely must have MP3 support.</dd>
|
||||
</dl>
|
||||
|
||||
\section no_mp3 Why doesn't \QF support MP3s?
|
||||
Because they are not free. MP3 support is a patent minefield, and we really
|
||||
don't want to wind up with lawyers at ten paces, especially since we'd be
|
||||
unarmed with no armor, and they have rocket launchers and quad-damage.
|
||||
|
||||
\section faq_cvar_rom How do I set a read-only cvar (eg, snd_rate)?
|
||||
Read-only cvars can be set by creating them before the engine does. See
|
||||
\ref cvar_rom for details.
|
||||
*/
|
35
doc/faq.txt
35
doc/faq.txt
|
@ -1,35 +0,0 @@
|
|||
//unfortunatly, have to wrap the docs in a C comment for doxygen
|
||||
/**
|
||||
\page faq Frequently Asked Questions
|
||||
|
||||
\li \ref gfx_wad
|
||||
\li \ref pak0_pak
|
||||
\li \ref git_compile_error
|
||||
|
||||
\section gfx_wad What does "W_LoadWadFile: unable to load gfx.wad" mean?
|
||||
The most common cause of this error is QuakeForge is unable to find
|
||||
pak0.pak. QuakeForge looks for pak0.pak in both the $fs_userpath/id1 and
|
||||
$fs_sharepath/id1 directories. In Windows, both fs_userpath and fs_sharepath
|
||||
default to "." (ie, the current directory: the same as id's quake clients). In
|
||||
Linux (and other UNIX like operating systems), fs_userpath defaults to
|
||||
~/.quakeforge and fs_sharepath defaults to $prefix/share/games/quakeforge
|
||||
(distribution packages might alter the exact path).
|
||||
|
||||
\section pak0_pak Where can I get pak0.pak?
|
||||
See \ref game_data
|
||||
|
||||
\section game_data Why doesn't QuakeForge come with the game data?
|
||||
While QuakeForge itself (and the Quake source code in general) is Free
|
||||
Software, the game itself is not free. You need to either purchase it from <a
|
||||
href="http://www.idsoftware.com/store/index.php?view=quake">id Software</a> or
|
||||
you can use <a href="http://openquartz.sourceforge.net/">OpenQuartz</a>, a
|
||||
project developing GPL compatable game data for Quake.
|
||||
|
||||
\section git_compile_error Checking out git and running ./bootstrap creates a configure that syntax errors when I run it! What's wrong?
|
||||
Unlike downloading and compiling a release, when you checkout from git, you
|
||||
must have all the dependencies of quakeforge already installed as when
|
||||
configure is being created autotools sources m4 files... If the files do not
|
||||
exist, you get the errors you have seen. Try installing packages which contain
|
||||
the libraries that caused the syntax error, including the -dev versions, then
|
||||
recreate configure using bootstrap and try again.
|
||||
*/
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page filesystem QuakeForge Directory Trees
|
||||
|
||||
|
@ -40,13 +41,14 @@ when the trees are in the same place.
|
|||
|
||||
Once QuakeForge is running, \c fs_sharepath and \c fs_userpath cannot be
|
||||
altered. However, they may be altered by setting them in the system
|
||||
configuration file, the user configuration file, or on the command line.
|
||||
configuration file, the user configuration file, or on the command line
|
||||
(see \ref cvar_rom and \ref cmdline).
|
||||
|
||||
The internal layout of the shared and user data trees are, by default, the
|
||||
same as Quake (an \c id1 directory tree, plus other mod directories), but
|
||||
with the addition of a \c QF directory which holds QuakeForge specific data
|
||||
(such as the menus). The structure of the data trees and, more importantly,
|
||||
the relationship between the mod directories can be configured with the
|
||||
directory configurtion file (see \ref dirconf).
|
||||
directory configuration file (see \ref dirconf).
|
||||
|
||||
*/
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page mapformat Map (.map) File Format
|
||||
|
91
doc/property-list.dox
Normal file
91
doc/property-list.dox
Normal file
|
@ -0,0 +1,91 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page property-list Property List
|
||||
|
||||
\QF's property lists are based on those used in OpenStep.
|
||||
|
||||
\QF uses property lists for a wide variety of purposes. This includes saved
|
||||
game data, directory configuration and play-lists.
|
||||
|
||||
A property list is a text file that describes a single value. However, that
|
||||
value can be one of the following types:
|
||||
<dl>
|
||||
<dt>Dictionaries</dt> <dd>Lists of values that are each accociated
|
||||
with a key</dd>
|
||||
<dt>Arrays</dt> <dd>Lists of indexed values</dd>
|
||||
<dt>Strings</dt> <dd>Simple text strings.</dd>
|
||||
<dt>Binary data</dt> <dd>Random binary data</dd>
|
||||
</dl>
|
||||
Dictionary and Array values allow for arbitrarily complex data to be
|
||||
represented by a property list.
|
||||
|
||||
In addition, property lists also support comments, both single-line and
|
||||
multi-line. Single-line comments start with \c // and continue to the end
|
||||
of the line. Multi-line comments begin with
|
||||
<!-- crazy formatting to get C comments--><code>/</code><code>*</code> and
|
||||
end with <code>*</code><code>/</code>, and may span multiple lines, or be
|
||||
contained entirely within a single line, possibly with non-comment text
|
||||
following the comment.
|
||||
|
||||
\section pl-dictionaries Dictionaries.
|
||||
A dictionary is a list of values, each associated with a key. The order of
|
||||
key/value pairs in a dictionary is not preserved.
|
||||
|
||||
\code
|
||||
{
|
||||
key1 = value1;
|
||||
key2 = value2;
|
||||
// ...
|
||||
}
|
||||
\endcode
|
||||
|
||||
A dictionary may be empty or have any number of
|
||||
<code>key = value</code> pairs separated by \c ;. The final \c ;
|
||||
before the closing \c } is optional.
|
||||
|
||||
The key must be a string, but the value may be of any type, including
|
||||
dictionary or array.
|
||||
|
||||
\section Arrays
|
||||
An array is an ordered list of values. The order of the values in an array
|
||||
is preserved.
|
||||
|
||||
\code
|
||||
(
|
||||
value1,
|
||||
value2,
|
||||
// ...
|
||||
)
|
||||
\endcode
|
||||
|
||||
An array may be empty or have any number of values. Each value may be of
|
||||
any type, including dictionary or array.
|
||||
|
||||
\section pl-strings Strings
|
||||
\QF's property lists support three types of strings: unquoted, quoted and
|
||||
"long".
|
||||
|
||||
An unquoted string may contain most printable characters. This includes the
|
||||
digits \c 0 to \c 9, the letters \c a to \c z and \c A to \c Z, and the
|
||||
symbols \c !, \c #, \c $, \c %, \c &, \c *, \c +, \c -, \c ., \c /, \c :,
|
||||
\c ?, \c @, \c |, \c ~, \c _ and \c ^.
|
||||
\verbatim
|
||||
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
abcdefghijklmnopqrstuvwxyz!#$%&*+-./:?@|~_^
|
||||
\endverbatim
|
||||
|
||||
Quoted strings may contain whitespace, C escape sequences, and any
|
||||
printable character. The quote character is \c \".
|
||||
|
||||
Long strings use triple quotes (\c \"\"\") instead of \c \" as the quote
|
||||
character. This allows the use of unquoted \c \" characters in the string.
|
||||
And yes, these long strings were inspired by Python's long strings.
|
||||
|
||||
\section pl-binary Binary Data
|
||||
<!-- in the following paragraph, the \< and \> are just < and >. the \ is
|
||||
for doxygen -->
|
||||
Binary data is hex-encoded and contained within angle brackets (\c \< \c
|
||||
\>). There must be an even number of hex-digits. That is, while \c \<FF00\>
|
||||
is value, \c \<F00\> is not.
|
||||
*/
|
|
@ -1,8 +1,9 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page qtv_overview QF QTV overview/status.
|
||||
OVERVIEW:
|
||||
\image html qwtv.png
|
||||
\image html qwtv.svg
|
||||
\image latex qwtv.eps ""
|
||||
|
||||
The server is "reserved" for playing clients. Any spectators would be
|
|
@ -358,7 +358,7 @@ Single
|
|||
3 1 1.00 60.00 120.00
|
||||
10575 2850 10200 1800
|
||||
4 0 0 50 -1 0 12 0.0000 4 105 555 2475 4155 server\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 195 975 2475 3900 quakeword\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 195 975 2475 3900 quakeworld\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 165 435 6075 3900 qwtv\001
|
||||
4 0 0 50 -1 0 12 0.0000 4 150 495 6075 4155 proxy\001
|
||||
4 0 0 45 -1 0 16 0.0000 4 255 1485 1500 6000 Player clients\001
|
||||
|
|
16
doc/quakeforge.dox
Normal file
16
doc/quakeforge.dox
Normal file
|
@ -0,0 +1,16 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\mainpage QuakeForge
|
||||
|
||||
QuakeForge is a 3D graphics game engine based on
|
||||
<a href="http://www.idsoftware.com/">id Software's</a> legendary
|
||||
Quake and QuakeWorld game engine. Our purpose? To improve the state of the
|
||||
game by improving the engine and making it accessible to the largest number
|
||||
of players we can.
|
||||
|
||||
\li \subpage build-install
|
||||
\li \subpage faq
|
||||
\li \subpage run_config
|
||||
\li \subpage specs
|
||||
*/
|
|
@ -179,7 +179,7 @@ TAB_SIZE = 4
|
|||
# will result in a user-defined paragraph with heading "Side Effects:".
|
||||
# You can put \n's in the value part of an alias to insert newlines.
|
||||
|
||||
ALIASES =
|
||||
ALIASES = QF=QuakeForge
|
||||
|
||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
|
||||
# sources only. Doxygen will then generate output that is more tailored for C.
|
||||
|
@ -454,7 +454,7 @@ GENERATE_TESTLIST = NO
|
|||
# disable (NO) the bug list. This list is created by putting \bug
|
||||
# commands in the documentation.
|
||||
|
||||
GENERATE_BUGLIST = NO
|
||||
GENERATE_BUGLIST = YES
|
||||
|
||||
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
|
||||
# disable (NO) the deprecated list. This list is created by putting
|
||||
|
@ -587,19 +587,8 @@ INPUT += @TOPSRC@/nq
|
|||
INPUT += @TOPSRC@/qtv
|
||||
INPUT += @TOPSRC@/qw
|
||||
INPUT += @TOPSRC@/tools
|
||||
INPUT += @TOPSRC@/doc/bind.txt
|
||||
INPUT += @TOPSRC@/doc/connect.txt
|
||||
INPUT += @TOPSRC@/doc/cshifts.txt
|
||||
INPUT += @TOPSRC@/doc/dirconf.txt
|
||||
INPUT += @TOPSRC@/doc/faq.txt
|
||||
INPUT += @TOPSRC@/doc/filesystem.txt
|
||||
INPUT += @TOPSRC@/doc/mapformat.txt
|
||||
INPUT += @TOPSRC@/doc/qtv.txt
|
||||
INPUT += @TOPSRC@/doc/quakeforge.txt
|
||||
INPUT += @TOPSRC@/doc/qw-cap-spec.txt
|
||||
INPUT += @TOPSRC@/doc/qw-download-spec.txt
|
||||
INPUT += @TOPSRC@/doc/surround-sound.txt
|
||||
INPUT += @TOPSRC@/doc/timestamps.txt
|
||||
INPUT += @TOPSRC@/doc/
|
||||
INPUT += @TOPSRC@/INSTALL
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||
|
@ -616,7 +605,7 @@ INPUT_ENCODING = UTF-8
|
|||
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
|
||||
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
|
||||
|
||||
FILE_PATTERNS = *.c *.h
|
||||
FILE_PATTERNS = *.c *.h *.dox
|
||||
|
||||
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
|
||||
# should be searched for input files as well. Possible values are YES and NO.
|
||||
|
@ -640,6 +629,9 @@ EXCLUDE += @TOPSRC@/tools/Forge
|
|||
EXCLUDE += @TOPSRC@/include/QF/GL
|
||||
EXCLUDE += @TOPSRC@/include/block16.h
|
||||
EXCLUDE += @TOPSRC@/include/block8.h
|
||||
EXCLUDE += @TOPSRC@/doc/template.dox
|
||||
EXCLUDE += @TOPSRC@/doc/template.c
|
||||
EXCLUDE += @TOPSRC@/doc/template.h
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
||||
# directories that are symbolic links (a Unix filesystem feature) are excluded
|
||||
|
@ -1389,7 +1381,7 @@ DOT_NUM_THREADS = 0
|
|||
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
|
||||
# containing the font.
|
||||
|
||||
DOT_FONTNAME = FreeSans.ttf
|
||||
DOT_FONTNAME = Arial
|
||||
|
||||
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
|
||||
# The default size is 10pt.
|
||||
|
@ -1479,7 +1471,7 @@ DIRECTORY_GRAPH = NO
|
|||
# generated by dot. Possible values are png, jpg, or gif
|
||||
# If left blank png will be used.
|
||||
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_IMAGE_FORMAT = svg
|
||||
|
||||
# The tag DOT_PATH can be used to specify the path where the dot tool can be
|
||||
# found. If left blank, it is assumed the dot tool can be found in the path.
|
|
@ -1,20 +0,0 @@
|
|||
//unfortunatly, have to wrap the docs in a C comment for doxygen
|
||||
/**
|
||||
\mainpage QuakeForge
|
||||
|
||||
QuakeForge is a 3D graphics game engine based on
|
||||
<a href="http://www.idsoftware.com/">id Software's</a> legendary
|
||||
Quake and QuakeWorld game engine. Our purpose? To improve the state of the
|
||||
game by improving the engine and making it accessable to the largest number
|
||||
of players we can.
|
||||
|
||||
\li \subpage faq
|
||||
\li \subpage key_binding
|
||||
\li \subpage cshift_cvars
|
||||
\li \subpage filesystem
|
||||
\li \subpage dirconf
|
||||
\li \subpage qw_cap_spec
|
||||
\li \subpage qw_download_spec
|
||||
\li \subpage server_timestampes
|
||||
\li \subpage qtv_overview
|
||||
*/
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page qw_cap_spec QW Capabilities String
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page qw_download_spec QW Download Specification
|
||||
|
|
@ -2,24 +2,24 @@
|
|||
<!-- Navigation index tabs for HTML output -->
|
||||
<navindex>
|
||||
<tab type="mainpage" visible="yes" title=""/>
|
||||
<tab type="pages" visible="yes" title=""/>
|
||||
<tab type="modules" visible="yes" title=""/>
|
||||
<tab type="pages" visible="yes" title="" intro=""/>
|
||||
<tab type="modules" visible="yes" title="" intro=""/>
|
||||
<tab type="namespaces" visible="yes" title="">
|
||||
<tab type="namespaces" visible="no" title=""/>
|
||||
<tab type="namespacemembers" visible="yes" title=""/>
|
||||
<tab type="namespaces" visible="no" title="" intro=""/>
|
||||
<tab type="namespacemembers" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="classes" visible="yes" title="Classes & Structures">
|
||||
<tab type="classes" visible="no" title=""/>
|
||||
<tab type="hierarchy" visible="yes" title=""/>
|
||||
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title=""/>
|
||||
<tab type="classmembers" visible="yes" title="Class Ivars & Methods"/>
|
||||
<tab type="classes" visible="yes" title="Data Structures">
|
||||
<tab type="classes" visible="no" title="Structures" intro=""/>
|
||||
<tab type="hierarchy" visible="yes" title="Structure Tree" intro=""/>
|
||||
<tab type="classindex" visible="$ALPHABETICAL_INDEX" title="Index" intro=""/>
|
||||
<tab type="classmembers" visible="yes" title="Class Ivars & Methods" intro=""/>
|
||||
</tab>
|
||||
<tab type="files" visible="yes" title="">
|
||||
<tab type="files" visible="no" title=""/>
|
||||
<tab type="globals" visible="yes" title=""/>
|
||||
<tab type="files" visible="no" title="" intro=""/>
|
||||
<tab type="globals" visible="yes" title="" intro=""/>
|
||||
</tab>
|
||||
<tab type="dirs" visible="yes" title=""/>
|
||||
<tab type="examples" visible="yes" title=""/>
|
||||
<tab type="dirs" visible="yes" title="" intro=""/>
|
||||
<tab type="examples" visible="yes" title="" intro=""/>
|
||||
</navindex>
|
||||
|
||||
<!-- Layout definition for a class page -->
|
||||
|
@ -154,6 +154,7 @@
|
|||
<detaileddescription title=""/>
|
||||
<memberdef>
|
||||
<pagedocs/>
|
||||
<inlineclasses title=""/>
|
||||
<defines title=""/>
|
||||
<typedefs title=""/>
|
||||
<enums title=""/>
|
||||
|
|
85
doc/sound.dox
Normal file
85
doc/sound.dox
Normal file
|
@ -0,0 +1,85 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page sound \QF Sound System
|
||||
The \QF sound system is designed to work with many sound systems. The
|
||||
sound systems \QF supports are:
|
||||
<dl>
|
||||
<dt>Linux</dt> <dd>ALSA, OSS, SDL</dd>
|
||||
<dt>Other UNIX-like</dt> <dd>OSS, SDL</dd>
|
||||
<dt>Windows</dt> <dd>DirectX, Win32, SDL</dd>
|
||||
</dl>
|
||||
There are others (SUN, SGI, MME), but their status is unkown. SUN sound
|
||||
support will build (on OpenBSD), but whether it works is unknown.
|
||||
|
||||
In the above list, the first sound system listed for each OS is the
|
||||
default. To use one of the other supported drivers, set the \c snd_output
|
||||
cvar to the appropriate name as shown below (all systems are shown).
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>System</td><td>ALSA</td><td>OSS</td><td>DirectX</td>
|
||||
<td>Win32</td><td>SUN</td><td>SGI</td><td>MME</td><td>SDL</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Driver</td><td>alsa</td><td>oss</td><td>dx</td>
|
||||
<td>win</td><td>sun</td><td>sgi</td><td>mme</td><td>sdl</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
As \c snd_output is read-only, see \ref cvar_rom for how to set it.
|
||||
|
||||
In addition to the above, \QF also supports JACK audio. \QF's JACK support
|
||||
should work on any system that supports JACK. However, as JACK support
|
||||
uses a different architecture (JACK audio is "pull", \QF default audio is
|
||||
"push"), selecting JACK support uses a different cvar; Set \c snd_render
|
||||
to \c jack (the following table shows the name for both render systems).
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td>System</td><td>Default</td><td>JACK</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Render</td><td>default</td><td>jack</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
\section snd_comcc Common Cvars and Commands
|
||||
\c ambient_level<br>
|
||||
\c ambient_fade<br>
|
||||
\c precache<br>
|
||||
\c snd_swapchannelside<br>
|
||||
\c snd_volumesep<br>
|
||||
\c snd_phasesep<br>
|
||||
\c volume<br>
|
||||
|
||||
\c play<br>
|
||||
\c playcenter<br>
|
||||
\c playvol<br>
|
||||
\c snd_force_unblock<br>
|
||||
\c soundlist<br>
|
||||
|
||||
When \QF is built with MIDI support (using WildMidi):<br>
|
||||
\c wildmidi_config<br>
|
||||
\c wildmidi_volume<br>
|
||||
|
||||
\section snd_defcc QF Default Cvars and Commands
|
||||
\c snd_noextraupdate<br>
|
||||
\c snd_mixahead<br>
|
||||
\c nosound<br>
|
||||
|
||||
\c stopsound<br>
|
||||
\c soundinfo<br>
|
||||
|
||||
\c snd_stereo<br>
|
||||
\c snd_rate<br>
|
||||
\c snd_bits<br>
|
||||
|
||||
\c snd_device<br>
|
||||
|
||||
\c snd_oss_mmaped<br>
|
||||
|
||||
\section snd_jackcc JACK Cvars and Commands
|
||||
\c snd_jack_server<br>
|
||||
|
||||
*/
|
13
doc/specifications.dox
Normal file
13
doc/specifications.dox
Normal file
|
@ -0,0 +1,13 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page specs Various Specifications
|
||||
|
||||
|
||||
\li \subpage surround_sound_spec
|
||||
\li \subpage connection_sequence
|
||||
\li \subpage mapformat
|
||||
\li \subpage property-list
|
||||
\li \subpage qw_cap_spec
|
||||
\li \subpage qw_download_spec
|
||||
*/
|
|
@ -1,4 +1,5 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page surround_sound_spec Description of Surround-Sound Channels
|
||||
|
6
doc/template.dox
Normal file
6
doc/template.dox
Normal file
|
@ -0,0 +1,6 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page name Title
|
||||
text
|
||||
*/
|
|
@ -1,6 +1,7 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page server_timestampes Server Log Timestamps
|
||||
\page server_timestamps Server Log Timestamps
|
||||
|
||||
To enable time-stamped messages in the server, set the Cvar sv_timestamps to a
|
||||
value other than 0. When enabled, the string Cvar sv_timefmt is used to format
|
|
@ -1,14 +1,14 @@
|
|||
// sample track list
|
||||
{
|
||||
2 = "music/02.ogg";
|
||||
3 = "music/03.ogg";
|
||||
4 = "music/04.ogg";
|
||||
5 = "music/05.ogg";
|
||||
6 = "music/06.ogg";
|
||||
7 = "music/07.ogg";
|
||||
8 = "music/08.ogg";
|
||||
9 = "music/09.ogg";
|
||||
10 = "music/10.ogg";
|
||||
11 = "music/11.ogg";
|
||||
2 = "music/track02.cdda.ogg";
|
||||
3 = "music/track03.cdda.ogg";
|
||||
4 = "music/track04.cdda.ogg";
|
||||
5 = "music/track05.cdda.ogg";
|
||||
6 = "music/track06.cdda.ogg";
|
||||
7 = "music/track07.cdda.ogg";
|
||||
8 = "music/track08.cdda.ogg";
|
||||
9 = "music/track09.cdda.ogg";
|
||||
10 = "music/track10.cdda.ogg";
|
||||
11 = "music/track11.cdda.ogg";
|
||||
}
|
||||
|
||||
|
|
47
doc/tracklist.dox
Normal file
47
doc/tracklist.dox
Normal file
|
@ -0,0 +1,47 @@
|
|||
//unfortunately, have to wrap the docs in a C comment for doxygen
|
||||
// vim:tw=74:formatoptions-=l
|
||||
/**
|
||||
\page tracklist Tracklist config file
|
||||
|
||||
As \QF supports playing arbitrarily sized audio files, it seemed rather
|
||||
obvious that \QF should be able to use them as BGM in place of the CD
|
||||
drive. However, requiring specific names and locations for the files seemed
|
||||
overly onerous. Thus \QF looks for \c tracklist.cfg in the root of the game
|
||||
directory (eg. \c id1, same place as \c pak0.pak, \c config.cfg, etc).
|
||||
|
||||
Using the following \c tracklist.cfg:
|
||||
\verbinclude tracklist.cfg
|
||||
|
||||
and the following commands in the \c id1 directory:
|
||||
\verbatim
|
||||
mkdir music
|
||||
cd music
|
||||
cdparanoia -B 2-
|
||||
oggenc *.wav
|
||||
rm *.wav
|
||||
cd ..
|
||||
pak -vcf quake1-music.pak tracklist.cfg `find music -type f print`
|
||||
rm -rf music tracklist.cfg
|
||||
\endverbatim
|
||||
|
||||
a convenient pak file can be made of the Quake CD audio. Of course, the
|
||||
last two commands are optional if you prefer to have the files loose in the
|
||||
filesystem.
|
||||
|
||||
\section tl-format Tracklist format
|
||||
The tracklist config file is a \ref property-list consisting of a
|
||||
dictionary mapping the track numbers to the file to be played when that
|
||||
track is requested. The keys of the dictionary are the track number (the
|
||||
Quake CD has only tracks 2 to 11 as audio tracks) as a property list
|
||||
string, and the values are the file to play, also as a property list
|
||||
string.
|
||||
|
||||
However, if the value is an array of strings, that track will
|
||||
become a playlist, and each file specified in the array will be played in
|
||||
order, looping back to the first file in the list.
|
||||
|
||||
The files may be <code>.wav</code>, <code>.ogg</code> (Ogg Vorbis),
|
||||
<code>.mid</code> or <code>.midi</code> (MIDI), or <code>.flac</code>
|
||||
files. MP3 is <em>not</em> supported, and is not likely to ever be
|
||||
supported.
|
||||
*/
|
|
@ -525,12 +525,7 @@ main (int argc, const char **argv)
|
|||
|
||||
Sys_RegisterShutdown (SV_Shutdown);
|
||||
|
||||
Cvar_Init_Hash ();
|
||||
Cmd_Init_Hash ();
|
||||
Cvar_Init ();
|
||||
Sys_Init_Cvars ();
|
||||
Sys_Init ();
|
||||
Cmd_Init ();
|
||||
|
||||
Cmd_AddCommand ("quit", MST_Quit_f, "Shut down the master server");
|
||||
Cmd_AddCommand ("clear", SVL_Clear, "Clear the server list");
|
||||
|
|
|
@ -2,16 +2,16 @@
|
|||
AUTOMAKE_OPTIONS= foreign
|
||||
SUBDIRS = QF
|
||||
EXTRA_DIST = asm_i386.h alsa_funcs_list.h adivtab.h anorm_dots.h anorms.h \
|
||||
asm_draw.h block16.h block8.h buildnum.h compat.h context_sdl.h \
|
||||
asm_draw.h block16.h block8.h buildnum.h clview.h compat.h context_sdl.h \
|
||||
context_x11.h d_iface.h d_ifacea.h d_local.h dga_check.h exp.h fbset.h \
|
||||
garbage.h getopt.h gib_buffer.h gib_builtin.h gib_classes.h gib_execute.h gib_function.h \
|
||||
gib_handle.h gib_object.h gib_parse.h gib_process.h gib_regex.h gib_semantics.h \
|
||||
gib_thread.h gib_tree.h gib_vars.h gl_draw.h gl_warp_sin.h in_win.h \
|
||||
logos.h net_dgrm.h net_loop.h net_udp.h net_vcr.h net_wins.h netchan.h \
|
||||
netmain.h old_keys.h ops.h qstring.h quakeasm.h regex.h r_cvar.h \
|
||||
r_dynamic.h r_local.h r_screen.h r_shared.h rua_internal.h sbar.h \
|
||||
skin_stencil.h snd_render.h sv_console.h varrays.h vgamodes.h view.h \
|
||||
vregset.h winquake.h world.h \
|
||||
garbage.h getopt.h gib_buffer.h gib_builtin.h gib_classes.h gib_execute.h \
|
||||
gib_function.h gib_handle.h gib_object.h gib_parse.h gib_process.h \
|
||||
gib_regex.h gib_semantics.h gib_thread.h gib_tree.h gib_vars.h gl_draw.h \
|
||||
gl_warp_sin.h in_win.h logos.h net_dgrm.h net_loop.h net_udp.h net_vcr.h \
|
||||
net_wins.h netchan.h netmain.h old_keys.h ops.h qstring.h quakeasm.h \
|
||||
regex.h r_cvar.h r_dynamic.h r_local.h r_screen.h r_shared.h \
|
||||
rua_internal.h sbar.h skin_stencil.h snd_internal.h sv_console.h \
|
||||
varrays.h vgamodes.h vregset.h winquake.h world.h \
|
||||
\
|
||||
qw/bothdefs.h qw/msg_backbuf.h qw/msg_ucmd.h qw/pmove.h qw/protocol.h \
|
||||
\
|
||||
|
|
|
@ -9,7 +9,7 @@ nobase_pkginclude_HEADERS = \
|
|||
qargs.h qdefs.h qendian.h qfplist.h qtypes.h quakefs.h quakeio.h render.h \
|
||||
riff.h ruamoko.h screen.h script.h sizebuf.h skin.h sound.h spritegn.h \
|
||||
sys.h teamplay.h tga.h uint32.h va.h ver_check.h vid.h view.h wad.h \
|
||||
wadfile.h zone.h \
|
||||
wadfile.h winding.h zone.h \
|
||||
\
|
||||
GL/ati.h GL/defines.h GL/extensions.h GL/funcs.h GL/qf_explosions.h \
|
||||
GL/qf_funcs_list.h GL/qf_lightmap.h GL/qf_noisetextures.h \
|
||||
|
|
|
@ -38,42 +38,55 @@
|
|||
#include "QF/quakeio.h"
|
||||
|
||||
typedef struct cvar_s {
|
||||
const char *name;
|
||||
const char *string;
|
||||
const char *default_string;
|
||||
int flags;
|
||||
const char *name; ///< The name of the cvar.
|
||||
const char *string; ///< The current cvar value as a string.
|
||||
const char *default_string; ///< The default value of the cvar.
|
||||
int flags; ///< Cvar flags
|
||||
/** Callback for when the cvar value changes.
|
||||
|
||||
This allows for more flexibility in what happens when a cvar is
|
||||
nodifed than can be achieved with flags alone. While a similar could
|
||||
be done using commands, a cvar with a callback and CVAR_ARCHIVE set
|
||||
allows the setting to be saved automatically.
|
||||
|
||||
\param var This cvar.
|
||||
*/
|
||||
void (*callback)(struct cvar_s *var);
|
||||
const char *description; // for "help" command
|
||||
float value;
|
||||
int int_val;
|
||||
vec3_t vec;
|
||||
struct cvar_s *next;
|
||||
const char *description; ///< for "help" command
|
||||
float value; ///< The current cvar value as a float
|
||||
int int_val; ///< The current cvar value as an integer
|
||||
vec3_t vec; ///< The current cvar value as a vector
|
||||
struct cvar_s *next; ///< \internal Linked list of cvars.
|
||||
} cvar_t;
|
||||
|
||||
typedef struct cvar_alias_s {
|
||||
char *name;
|
||||
cvar_t *cvar;
|
||||
struct cvar_alias_s *next;
|
||||
char *name; ///< The name of the alias.
|
||||
cvar_t *cvar; ///< The cvar to which this alias refers
|
||||
struct cvar_alias_s *next; ///< \internal LInked list of aliases.
|
||||
} cvar_alias_t;
|
||||
|
||||
#define CVAR_NONE 0
|
||||
#define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc
|
||||
// used for system variables, not for player
|
||||
// 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_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_LATCH 2048 // will change only when C code next does
|
||||
// a Cvar_Get(), so it can't be changed
|
||||
|
||||
// Zoid| A good CVAR_ROM example is userpath. The code should read "cvar_t
|
||||
// *fs_userpath = CvarGet("fs_userpath", ".", CVAR_ROM); The user can
|
||||
// override that with +set fs_userpath <blah> since the command line +set gets
|
||||
// created _before_ the C code for fs_basepath setup is called. The code goes
|
||||
// "look, the user made fs_basepath already", uses the users value, but sets
|
||||
// CVAR_ROM as per the call.
|
||||
/** \name cvar_flags
|
||||
Zoid| A good CVAR_ROM example is userpath. The code should read "cvar_t
|
||||
*fs_userpath = CvarGet("fs_userpath", ".", CVAR_ROM); The user can
|
||||
override that with +set fs_userpath \<blah\> since the command line +set
|
||||
gets created _before_ the C code for fs_basepath setup is called. The
|
||||
code goes "look, the user made fs_basepath already", uses the users value,
|
||||
but sets CVAR_ROM as per the call.
|
||||
*/
|
||||
//@{
|
||||
#define CVAR_NONE 0 ///< normal cvar
|
||||
#define CVAR_ARCHIVE 1 ///< set to cause it to be saved to
|
||||
///< config.cfg
|
||||
#define CVAR_USERINFO 2 ///< sent to server on connect or change
|
||||
#define CVAR_SERVERINFO 4 ///< sent in response to front end requests
|
||||
#define CVAR_NOTIFY 32 ///< Will notify players when changed.
|
||||
///< (not implemented)
|
||||
#define CVAR_ROM 64 ///< display only, cannot be set
|
||||
#define CVAR_USER_CREATED 128 ///< created by a set command
|
||||
#define CVAR_LATCH 2048 ///< will change only when C code next does
|
||||
///< a Cvar_Get(), so it can't be changed
|
||||
///< (not implemented)
|
||||
//@}
|
||||
|
||||
|
||||
// Returns the Cvar if found, creates it with value if not. Description and
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#ifndef _DRAW_H
|
||||
#define _DRAW_H
|
||||
|
||||
/** \defgroup video Video Syb-sytem */
|
||||
/** \defgroup video Video Sub-sytem */
|
||||
|
||||
/** \defgroup video_renderer Renderer Sub-system
|
||||
\ingroup video
|
||||
|
|
|
@ -369,6 +369,8 @@ typedef enum {
|
|||
|
||||
typedef enum {
|
||||
IMT_CONSOLE,
|
||||
IMT_MOD,
|
||||
IMT_DEMO,
|
||||
IMT_0,
|
||||
IMT_1,
|
||||
IMT_2,
|
||||
|
@ -405,7 +407,9 @@ typedef struct {
|
|||
} kbutton_t;
|
||||
|
||||
extern keydest_t key_dest;
|
||||
extern imt_t game_target;
|
||||
extern imt_t key_game_target;
|
||||
extern knum_t key_togglemenu;
|
||||
extern knum_t key_toggleconsole;
|
||||
|
||||
extern struct keybind_s {
|
||||
char *str;
|
||||
|
@ -420,6 +424,7 @@ void Key_WriteBindings (QFile *f);
|
|||
void Key_ClearStates (void);
|
||||
const char *Key_GetBinding (imt_t imt, knum_t key);
|
||||
void Key_SetBinding (imt_t target, knum_t keynum, const char *binding);
|
||||
void Key_SetKeyDest(keydest_t kd);
|
||||
|
||||
|
||||
const char *Key_KeynumToString (knum_t keynum);
|
||||
|
|
|
@ -95,6 +95,12 @@ extern const vec_t * const quat_origin;
|
|||
(c)[1] = (a)[1] * (b); \
|
||||
(c)[2] = (a)[2] * (b); \
|
||||
} while (0)
|
||||
#define Vector3Scale(a,b,c) \
|
||||
do { \
|
||||
(c)[0] = (a)[0] * (b)[0]; \
|
||||
(c)[1] = (a)[1] * (b)[1]; \
|
||||
(c)[2] = (a)[2] * (b)[2]; \
|
||||
} while (0)
|
||||
#define VectorCompare(x, y) \
|
||||
(((x)[0] == (y)[0]) && ((x)[1] == (y)[1]) && ((x)[2] == (y)[2]))
|
||||
|
||||
|
@ -114,6 +120,9 @@ extern const vec_t * const quat_origin;
|
|||
(v)[2] = (v1)[2] * (1 - (b)) + (v2)[2] * (b); \
|
||||
} while (0)
|
||||
|
||||
//For printf etc
|
||||
#define VectorExpand(v) (v)[0], (v)[1], (v)[2]
|
||||
|
||||
#define QDotProduct(a,b) ((a)[0] * (b)[0] + (a)[1] * (b)[1] \
|
||||
+ (a)[2] * (b)[2] + (a)[3] * (b)[3])
|
||||
#define QuatSubtract(a,b,c) \
|
||||
|
@ -180,6 +189,13 @@ extern const vec_t * const quat_origin;
|
|||
|
||||
#define QuatIsZero(a) (!(a)[0] && !(a)[1] && !(a)[2] && !(a)[3])
|
||||
#define QuatZero(a) ((a)[3] = (a)[2] = (a)[1] = (a)[0] = 0);
|
||||
#define QuatSet(a,b,c,d,e) \
|
||||
do { \
|
||||
(e)[0] = a; \
|
||||
(e)[1] = b; \
|
||||
(e)[2] = c; \
|
||||
(e)[3] = d; \
|
||||
} while (0)
|
||||
|
||||
#define QuatBlend(v1,v2,b,v) \
|
||||
do { \
|
||||
|
@ -189,6 +205,9 @@ extern const vec_t * const quat_origin;
|
|||
(v)[3] = (v1)[3] * (1 - (b)) + (v2)[3] * (b); \
|
||||
} while (0)
|
||||
|
||||
//For printf etc
|
||||
#define QuatExpand(q) (q)[0], (q)[1], (q)[2], (q)[3]
|
||||
|
||||
/*
|
||||
* VectorDistance, the distance between two points.
|
||||
* Yes, this is the same as sqrt(VectorSubtract then DotProduct),
|
||||
|
@ -233,9 +252,10 @@ int GreatestCommonDivisor (int i1, int i2);
|
|||
|
||||
void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right,
|
||||
vec3_t up);
|
||||
void AngleQuat (const vec3_t angles, quat_t q);
|
||||
void VectorVectors (const vec3_t forward, vec3_t right, vec3_t up);
|
||||
int BoxOnPlaneSide (const vec3_t emins, const vec3_t emaxs,
|
||||
struct mplane_s *plane);
|
||||
struct plane_s *plane);
|
||||
float anglemod (float a);
|
||||
|
||||
void RotatePointAroundVector (vec3_t dst, const vec3_t axis,
|
||||
|
@ -244,6 +264,8 @@ void RotatePointAroundVector (vec3_t dst, const vec3_t axis,
|
|||
void QuatMult (const quat_t q1, const quat_t q2, quat_t out);
|
||||
void QuatInverse (const quat_t in, quat_t out);
|
||||
|
||||
void QuatToMatrix (const quat_t q, vec_t *m, int homogenous, int vertical);
|
||||
|
||||
#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \
|
||||
(((p)->type < 3)? \
|
||||
( \
|
||||
|
@ -272,7 +294,7 @@ void QuatInverse (const quat_t in, quat_t out);
|
|||
VectorNegate ((sp)->normal, (dp)->normal); \
|
||||
} while (0)
|
||||
|
||||
extern mplane_t * const frustum;
|
||||
extern plane_t * const frustum;
|
||||
extern inline qboolean R_CullBox (const vec3_t mins, const vec3_t maxs);
|
||||
extern inline qboolean R_CullSphere (const vec3_t origin, const float radius);
|
||||
extern inline float VectorNormalize (vec3_t v); // returns vector length
|
||||
|
|
|
@ -122,7 +122,7 @@ typedef struct glpoly_s {
|
|||
typedef struct msurface_s {
|
||||
int visframe; // should be drawn when node is crossed
|
||||
|
||||
mplane_t *plane;
|
||||
plane_t *plane;
|
||||
int flags;
|
||||
|
||||
int firstedge; // look up in model->surfedges[], negative numbers
|
||||
|
@ -162,7 +162,7 @@ typedef struct mnode_s {
|
|||
struct mnode_s *parent;
|
||||
|
||||
// node specific
|
||||
mplane_t *plane;
|
||||
plane_t *plane;
|
||||
struct mnode_s *children[2];
|
||||
|
||||
unsigned short firstsurface;
|
||||
|
@ -197,11 +197,12 @@ typedef struct mclipnode_s {
|
|||
|
||||
typedef struct hull_s {
|
||||
mclipnode_t *clipnodes;
|
||||
mplane_t *planes;
|
||||
plane_t *planes;
|
||||
int firstclipnode;
|
||||
int lastclipnode;
|
||||
vec3_t clip_mins;
|
||||
vec3_t clip_maxs;
|
||||
struct nodeleaf_s *nodeleafs;
|
||||
} hull_t;
|
||||
|
||||
// SPRITE MODELS ==============================================================
|
||||
|
@ -357,7 +358,7 @@ typedef struct model_s {
|
|||
dmodel_t *submodels;
|
||||
|
||||
int numplanes;
|
||||
mplane_t *planes;
|
||||
plane_t *planes;
|
||||
|
||||
int numleafs; // number of visible leafs, not counting 0
|
||||
mleaf_t *leafs;
|
||||
|
|
173
include/QF/msg.h
173
include/QF/msg.h
|
@ -58,22 +58,195 @@ typedef struct msg_s {
|
|||
char *badread_string;
|
||||
} qmsg_t;
|
||||
|
||||
/** Reset the message read status.
|
||||
|
||||
Clears the error flag and resets the read index to 0.
|
||||
|
||||
\param msg The message to be reset.
|
||||
*/
|
||||
void MSG_BeginReading (qmsg_t *msg);
|
||||
|
||||
/** Get the number of bytes that have been read from the message.
|
||||
|
||||
The result can also be used as the index to the next byte to be read.
|
||||
|
||||
\param msg The message to check.
|
||||
\return The number of bytes that have been read.
|
||||
*/
|
||||
int MSG_GetReadCount(qmsg_t *msg);
|
||||
|
||||
/** Read a single byte from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the byte will be read.
|
||||
\return The byte value (0 - 255), or -1 if already at the end of
|
||||
the message.
|
||||
*/
|
||||
int MSG_ReadByte (qmsg_t *msg);
|
||||
|
||||
/** Read a single little-endian unsigned short from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the short will be read.
|
||||
\return The short value (0 - 65535), or -1 if already at
|
||||
the end of the message.
|
||||
*/
|
||||
int MSG_ReadShort (qmsg_t *msg);
|
||||
|
||||
/** Read a single little-endian long from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the long will be read.
|
||||
\return The signed long value or -1 if already at the end of
|
||||
the message.
|
||||
\note -1 may be either an error or a value. Check qmsg_t::badread to
|
||||
differentiate the two cases (false for a value).
|
||||
\todo Fix?
|
||||
*/
|
||||
int MSG_ReadLong (qmsg_t *msg);
|
||||
|
||||
/** Read a single little-endian float from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the float will be read.
|
||||
\return The float value or -1 if already at the end of the
|
||||
message.
|
||||
\note -1 may be either an error or a value. Check qmsg_t::badread to
|
||||
differentiate the two cases (false for a value).
|
||||
\todo Fix?
|
||||
*/
|
||||
float MSG_ReadFloat (qmsg_t *msg);
|
||||
|
||||
/** Read a nul terminated string from the message.
|
||||
|
||||
Advances the read index to the first byte after the string.
|
||||
|
||||
The returned string is guaranteed to be valid. If the string in the
|
||||
message is not nul terminated, the string will be safely extracted,
|
||||
qmst_t::badread set to true, and the extracted string will be returned.
|
||||
|
||||
\param msg The message from which the string will be read.
|
||||
\return The string within the message, or "" if alread at the
|
||||
end of the message.
|
||||
\note "" may be either an error or a value. Check qmsg_t::badread to
|
||||
differentiate the two cases (false for a value).
|
||||
\todo Fix?
|
||||
*/
|
||||
const char *MSG_ReadString (qmsg_t *msg);
|
||||
|
||||
/** Read a block of bytes from the message.
|
||||
|
||||
Advances the read index to the first byte after the block.
|
||||
|
||||
If not all bytes could be read, qmsg_t::badread will be set to true.
|
||||
|
||||
\param msg The message from which the string will be read.
|
||||
\param buf Pointer to the buffer into which the bytes will be
|
||||
placed.
|
||||
\param len The number of bytes to read.
|
||||
\return The number of bytes read from the message.
|
||||
*/
|
||||
int MSG_ReadBytes (qmsg_t *msg, void *buf, int len);
|
||||
|
||||
/** Read a little-endian 16-bit fixed point (13.3) coordinate value from the
|
||||
message.
|
||||
|
||||
Advances the read index to the first byte after the block.
|
||||
|
||||
\param msg The message from which the coordinate will be read.
|
||||
\return The coordinate value converted to floating point.
|
||||
|
||||
\note -0.125 may be either an error or a value. Check qmsg_t::badread
|
||||
to differentiate the two cases (false for a value).
|
||||
\todo Fix?
|
||||
*/
|
||||
float MSG_ReadCoord (qmsg_t *msg);
|
||||
|
||||
/** Read three little-endian 16-bit fixed point (s12.3) coordinate values
|
||||
from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the coordinates will be read.
|
||||
\param coord The vector into which the three coordinates will be
|
||||
placed.
|
||||
|
||||
\note -0.125 may be either an error or a value. Check qmsg_t::badread
|
||||
to differentiate the two cases (false for a value).
|
||||
\todo Fix?
|
||||
*/
|
||||
void MSG_ReadCoordV (qmsg_t *msg, vec3_t coord);
|
||||
|
||||
/** Read an 8-bit encoded angle from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the angle will be read.
|
||||
\return The angle converted to the range -180 - 180.
|
||||
*/
|
||||
float MSG_ReadAngle (qmsg_t *msg);
|
||||
|
||||
/** Read interleaved little-endian 16-bit coordinate/8-bit angle vectors
|
||||
from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the angle will be read.
|
||||
\param coord The vector into which the converted coordinate vector
|
||||
will be placed.
|
||||
\param angles The vector into which the converted coordinate angles
|
||||
will be placed.
|
||||
\see MSG_ReadCoord
|
||||
\see MSG_ReadAngle
|
||||
*/
|
||||
void MSG_ReadCoordAngleV (qmsg_t *msg, vec3_t coord, vec3_t angles);
|
||||
|
||||
/** Read three 8-bit encoded angle values from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the angles will be read.
|
||||
\param angles The vector into which the three angles will be placed.
|
||||
|
||||
\note The angles will be converted to the range -180 - 180.
|
||||
*/
|
||||
void MSG_ReadAngleV (qmsg_t *msg, vec3_t angles);
|
||||
|
||||
/** Read a little-endian 16-bit encoded angle from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the angle will be read.
|
||||
\return The angle converted to the range -180 - 180.
|
||||
*/
|
||||
float MSG_ReadAngle16 (qmsg_t *msg);
|
||||
|
||||
/** Read three little-endian 16-bit encoded angle values from the message.
|
||||
|
||||
Advances the read index.
|
||||
|
||||
\param msg The message from which the angles will be read.
|
||||
\param angles The vector into which the three angles will be placed.
|
||||
|
||||
\note The angles will be converted to the range -180 - 180.
|
||||
*/
|
||||
void MSG_ReadAngle16V (qmsg_t *msg, vec3_t angles);
|
||||
|
||||
/** Read a single UTF-8 encoded value.
|
||||
|
||||
Advances the read index the the first byte after the value. However,
|
||||
the read index will not be advanced if any error is detected.
|
||||
|
||||
A successfull read will read between 1 and 6 bytes from the message.
|
||||
|
||||
\param msg The message from which the UTF-8 encoded value will be
|
||||
read.
|
||||
\return The 31-bit value, or -1 on error.
|
||||
*/
|
||||
int MSG_ReadUTF8 (qmsg_t *msg);
|
||||
|
||||
//@}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#define __QF_progs_h
|
||||
|
||||
/** \defgroup progs QuakeC Virtual Machine (VM)
|
||||
\image html vm-mem.png
|
||||
\image html vm-mem.svg
|
||||
\image latex vm-mem.eps "VM memory map"
|
||||
*/
|
||||
|
||||
|
@ -296,7 +296,7 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
|
|||
|
||||
/** \defgroup prda_globals Globals
|
||||
\ingroup progs_data_access
|
||||
Typed global access marcos. No checking is done against the QC type, but
|
||||
Typed global access macros. No checking is done against the QC type, but
|
||||
the appropriate C type will be used.
|
||||
*/
|
||||
//@{
|
||||
|
@ -486,7 +486,7 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
|
|||
|
||||
/** \defgroup prda_parameters Parameters
|
||||
\ingroup progs_data_access
|
||||
Typed parameter access marcos. No checking is done against the QC type, but
|
||||
Typed parameter access macros. No checking is done against the QC type, but
|
||||
the appropriate C type will be used.
|
||||
*/
|
||||
//@{
|
||||
|
@ -674,10 +674,14 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
|
|||
#define P_STRUCT(p,t,n) (*(t *)P_GPOINTER (p, n))
|
||||
//@}
|
||||
|
||||
/** \defgroup prda_return Return value
|
||||
/** \defgroup prda_return Return Values
|
||||
\ingroup progs_data_access
|
||||
Typed return value access marcos. No checking is done against the QC type,
|
||||
but the appropriate C type will be used.
|
||||
These macros are used to access the value returned by an interpreted VM
|
||||
function, and to return values from engine functions into progs space
|
||||
(that is, builtins).
|
||||
\warning No checking is performed against progs types; for example, if you
|
||||
ask for an \c int from a function that returned a \c float, you're asking
|
||||
for trouble.
|
||||
*/
|
||||
//@{
|
||||
|
||||
|
@ -690,7 +694,7 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
|
|||
*/
|
||||
#define R_var(p,t) ((p)->pr_return->t##_var)
|
||||
|
||||
/** Access the float return value.
|
||||
/** Access the VM function return value as a \c float
|
||||
|
||||
\par QC type:
|
||||
\c float
|
||||
|
@ -701,78 +705,78 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
|
|||
*/
|
||||
#define R_FLOAT(p) R_var (p, float)
|
||||
|
||||
/** Access the integer return value.
|
||||
/** Access the VM function return value as a \c ::pr_int_t (AKA int32_t)
|
||||
|
||||
\par QC type:
|
||||
\c integer
|
||||
\param p pointer to ::progs_t VM struct
|
||||
\return int lvalue
|
||||
\return ::pr_int_t lvalue
|
||||
|
||||
\hideinitializer
|
||||
*/
|
||||
#define R_INT(p) R_var (p, integer)
|
||||
|
||||
/** Access the unsigned integer return value.
|
||||
/** Access the VM function return value as a \c ::pr_uint_t (AKA uint32_t)
|
||||
|
||||
\par QC type:
|
||||
\c uinteger
|
||||
\param p pointer to ::progs_t VM struct
|
||||
\return unsigned int lvalue
|
||||
\return ::pr_int_t lvalue
|
||||
|
||||
\hideinitializer
|
||||
*/
|
||||
#define R_UINT(p) R_var (p, uinteger)
|
||||
|
||||
/** Access the vector return value.
|
||||
/** Access the VM function return value as a \c ::vec3_t vector.
|
||||
|
||||
\par QC type:
|
||||
\c vector
|
||||
\param p pointer to ::progs_t VM struct
|
||||
\return vec3_t lvalue
|
||||
\return ::vec3_t lvalue
|
||||
|
||||
\hideinitializer
|
||||
*/
|
||||
#define R_VECTOR(p) R_var (p, vector)
|
||||
|
||||
/** Access the quaternion return value.
|
||||
/** Access the VM function return value as a \c ::quat_t quaternion.
|
||||
|
||||
\par QC type:
|
||||
\c quaternion
|
||||
\param p pointer to ::progs_t VM struct
|
||||
\return quat_t lvalue
|
||||
\return ::quat_t lvalue
|
||||
|
||||
\hideinitializer
|
||||
*/
|
||||
#define R_QUAT(p) R_var (p, quat)
|
||||
|
||||
/** Access the string index return value.
|
||||
/** Access the VM function return value as a ::string_t (a VM string reference).
|
||||
|
||||
\par QC type:
|
||||
\c string
|
||||
\param p pointer to ::progs_t VM struct
|
||||
\return string_t lvalue
|
||||
\return ::string_t lvalue
|
||||
|
||||
\hideinitializer
|
||||
*/
|
||||
#define R_STRING(p) R_var (p, string)
|
||||
|
||||
/** Access the function return value.
|
||||
/** Access the VM function return value as a ::func_t (a VM function reference)
|
||||
|
||||
\par QC type:
|
||||
\c void()
|
||||
\param p pointer to ::progs_t VM struct
|
||||
\return func_t lvalue
|
||||
\return ::func_t lvalue
|
||||
|
||||
\hideinitializer
|
||||
*/
|
||||
#define R_FUNCTION(p) R_var (p, func)
|
||||
|
||||
/** Access the pointer return value.
|
||||
/** Access the VM function return value as a ::pointer_t (a VM "pointer")
|
||||
|
||||
\par QC type:
|
||||
\c void *
|
||||
\param p pointer to ::progs_t VM struct
|
||||
\return pointer_t lvalue
|
||||
\return ::pointer_t lvalue
|
||||
|
||||
\hideinitializer
|
||||
*/
|
||||
|
@ -839,7 +843,7 @@ void PR_Undefined (progs_t *pr, const char *type, const char *name) __attribute_
|
|||
|
||||
/** \defgroup prda_entity_fields Entity Fields
|
||||
\ingroup progs_data_access
|
||||
Typed entity field access marcos. No checking is done against the QC type,
|
||||
Typed entity field access macros. No checking is done against the QC type,
|
||||
but the appropriate C type will be used.
|
||||
*/
|
||||
//@{
|
||||
|
@ -1073,7 +1077,7 @@ int PR_RelocateBuiltins (progs_t *pr);
|
|||
Strings management functions.
|
||||
|
||||
All strings accessable by the VM are stored within the VM address space.
|
||||
These functions provide facilities to set permanent, dynamic and
|
||||
These functions provide facilities to set permanent, dynamic and
|
||||
temporary strings, as well as mutable strings using dstrings.
|
||||
|
||||
Permanent strings are either supplied by the progs (+ve string index) or
|
||||
|
@ -1153,8 +1157,7 @@ string_t PR_SetTempString(progs_t *pr, const char *s);
|
|||
\param a C string
|
||||
\param b C string
|
||||
\return string index of the progs string that represents the
|
||||
concatenation
|
||||
of strings a and b
|
||||
concatenation of strings a and b
|
||||
*/
|
||||
string_t PR_CatStrings (progs_t *pr, const char *a, const char *b);
|
||||
|
||||
|
@ -1171,7 +1174,7 @@ void PR_MakeTempString(progs_t *pr, string_t str);
|
|||
string_t PR_NewMutableString (progs_t *pr);
|
||||
|
||||
/** Make a dynamic progs string from the given C string. Will not create a
|
||||
duplicate permanent string (temporary, dynamic and mutable strings are
|
||||
duplicate permanent string (temporary, dynamic and mutable strings are
|
||||
not checked).
|
||||
\param pr pointer to ::progs_t VM struct
|
||||
\param s C string to be made into a permanent progs string
|
||||
|
@ -1262,14 +1265,75 @@ void PR_Sprintf (progs_t *pr, struct dstring_s *result, const char *name,
|
|||
*/
|
||||
//@{
|
||||
|
||||
/** Initialize the resource management fields.
|
||||
|
||||
\param pr The VM of which the resource fields will be initialized.
|
||||
*/
|
||||
void PR_Resources_Init (progs_t *pr);
|
||||
|
||||
/** Clear all resources before loading a new progs.
|
||||
|
||||
Calls the clear() callback of all registered resources.
|
||||
|
||||
\param pr The VM of which the resources will be cleared.
|
||||
*/
|
||||
void PR_Resources_Clear (progs_t *pr);
|
||||
|
||||
/** Register a resource with a VM.
|
||||
|
||||
\param pr The VM to which the resource will be associated.
|
||||
\param name The name of the resource. Used for retrieving the
|
||||
resource.
|
||||
\param data The resource data.
|
||||
callback.
|
||||
\param clear Callback for performing any necessary cleanup. Called
|
||||
by PR_Resources_Clear(). The parameters are the current
|
||||
VM (\p pr) and \p data.
|
||||
\note The name should be unique to the VM, but no checking is
|
||||
done. If the name is not unique, the previous registered
|
||||
resource will break. The name of the sub-system
|
||||
registering the resource is a suitable name, and will
|
||||
probably be unique.
|
||||
*/
|
||||
void PR_Resources_Register (progs_t *pr, const char *name, void *data,
|
||||
void (*clear)(progs_t *, void *));
|
||||
|
||||
/** Retrieve a resource registered with the VM.
|
||||
|
||||
\param pr The VM from which the resource will be retrieved.
|
||||
\param name The name of the resource.
|
||||
\return The resource, or NULL if \p name does not match any
|
||||
resource registered with the VM.
|
||||
*/
|
||||
void *PR_Resources_Find (progs_t *pr, const char *name);
|
||||
|
||||
/** \name Resource Map support
|
||||
|
||||
These macros can be used to create functions for mapping C resources
|
||||
to QuakeC integer handles.
|
||||
|
||||
Valid handles are always negative.
|
||||
|
||||
\note \p map is the resource map itself, not a pointer to the
|
||||
resource map.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/** Type delcaration for the resource map.
|
||||
|
||||
\param type The type of the resource. The size must be at least
|
||||
as large as \c sizeof(type *).
|
||||
*/
|
||||
#define PR_RESMAP(type) struct { type *_free; type **_map; unsigned _size; }
|
||||
|
||||
/** Allocate a new resource from the resource map.
|
||||
|
||||
\param type The type of the resource. Must match the \c type parameter
|
||||
used for PR_RESMAP.
|
||||
\param map The resource map.
|
||||
\return A pointer to the new resource, or null if no more could
|
||||
be allocated.
|
||||
*/
|
||||
#define PR_RESNEW(type,map) \
|
||||
type *t; \
|
||||
\
|
||||
|
@ -1293,11 +1357,27 @@ void *PR_Resources_Find (progs_t *pr, const char *name);
|
|||
memset (t, 0, sizeof (type)); \
|
||||
return t
|
||||
|
||||
/** Free a resource returning it to the resource map.
|
||||
|
||||
\param type The type of the resource. Must match the \c type parameter
|
||||
used for PR_RESMAP.
|
||||
\param map The resource map.
|
||||
\param t Pointer to the resource to be freed.
|
||||
*/
|
||||
#define PR_RESFREE(type,map,t) \
|
||||
memset (t, 0, sizeof (type)); \
|
||||
*(type **) t = map._free; \
|
||||
map._free = t
|
||||
|
||||
/** Free all resources in the resource map.
|
||||
|
||||
Any memory allocated to the resource must be freed before freeing the
|
||||
resource.
|
||||
|
||||
\param type The type of the resource. Must match the \c type parameter
|
||||
used for PR_RESMAP.
|
||||
\param map The resource map.
|
||||
*/
|
||||
#define PR_RESRESET(type,map) \
|
||||
unsigned i, j; \
|
||||
if (!map._size) \
|
||||
|
@ -1311,6 +1391,13 @@ void *PR_Resources_Find (progs_t *pr, const char *name);
|
|||
} \
|
||||
map._free = map._map[0];
|
||||
|
||||
/** Retrieve a resource from the resource map using a handle.
|
||||
|
||||
\param map The resource map.
|
||||
\param col The handle.
|
||||
\return A pointer to the resource, or NULL if the handle is
|
||||
invalid.
|
||||
*/
|
||||
#define PR_RESGET(map,col) \
|
||||
unsigned row = ~col / 1024; \
|
||||
col = ~col % 1024; \
|
||||
|
@ -1318,6 +1405,12 @@ void *PR_Resources_Find (progs_t *pr, const char *name);
|
|||
return 0; \
|
||||
return &map._map[row][col]
|
||||
|
||||
/** Convert a resource pointer to a handle.
|
||||
|
||||
\param map The resource map.
|
||||
\param ptr The resource pointer.
|
||||
\return The handle or 0 if the pointer is invalid.
|
||||
*/
|
||||
#define PR_RESINDEX(map,ptr) \
|
||||
unsigned i; \
|
||||
for (i = 0; i < map._size; i++) { \
|
||||
|
@ -1326,6 +1419,7 @@ void *PR_Resources_Find (progs_t *pr, const char *name);
|
|||
return ~(i * 1024 + d); \
|
||||
} \
|
||||
return 0
|
||||
//@}
|
||||
|
||||
//@}
|
||||
|
||||
|
@ -1397,9 +1491,9 @@ extern const char *pr_gametype;
|
|||
typedef struct strref_s strref_t;
|
||||
|
||||
typedef struct {
|
||||
pr_int_t s;
|
||||
bfunction_t *f;
|
||||
strref_t *tstr;
|
||||
pr_int_t s; ///< Return statement.
|
||||
bfunction_t *f; ///< Calling function.
|
||||
strref_t *tstr; ///< Linked list of temporary strings.
|
||||
} prstack_t;
|
||||
|
||||
struct obj_list_s;
|
||||
|
@ -1434,15 +1528,23 @@ struct progs_s {
|
|||
struct memzone_s *zone;
|
||||
int zone_size;
|
||||
|
||||
/// \name builtin functions
|
||||
//@{
|
||||
struct hashtab_s *builtin_hash;
|
||||
struct hashtab_s *builtin_num_hash;
|
||||
unsigned bi_next;
|
||||
unsigned (*bi_map) (progs_t *pr, unsigned binum);
|
||||
//@}
|
||||
|
||||
/// \name symbol management
|
||||
//@{
|
||||
struct hashtab_s *function_hash;
|
||||
struct hashtab_s *global_hash;
|
||||
struct hashtab_s *field_hash;
|
||||
//@}
|
||||
|
||||
/// \name load hooks
|
||||
//@{
|
||||
int num_load_funcs;
|
||||
int max_load_funcs;
|
||||
pr_load_func_t **load_funcs;
|
||||
|
@ -1453,7 +1555,10 @@ struct progs_s {
|
|||
int max_load_finish_funcs;
|
||||
pr_load_func_t **load_finish_funcs;
|
||||
//@}
|
||||
//@}
|
||||
|
||||
/// \name string management
|
||||
//@{
|
||||
struct dstring_mem_s *ds_mem;
|
||||
strref_t *free_string_refs;
|
||||
strref_t *static_strings;
|
||||
|
@ -1464,7 +1569,10 @@ struct progs_s {
|
|||
struct hashtab_s *strref_hash;
|
||||
int num_strings;
|
||||
strref_t *pr_xtstr;
|
||||
//@}
|
||||
|
||||
/// \name memory map
|
||||
//@{
|
||||
dfunction_t *pr_functions;
|
||||
bfunction_t *function_table;
|
||||
char *pr_strings;
|
||||
|
@ -1474,7 +1582,10 @@ struct progs_s {
|
|||
dstatement_t *pr_statements;
|
||||
pr_type_t *pr_globals;
|
||||
int globals_size;
|
||||
//@}
|
||||
|
||||
/// \name parameter block
|
||||
//@{
|
||||
pr_type_t *pr_return;
|
||||
pr_type_t *pr_params[MAX_PARMS];
|
||||
pr_type_t *pr_real_params[MAX_PARMS];
|
||||
|
@ -1482,11 +1593,14 @@ struct progs_s {
|
|||
pr_type_t *pr_saved_params;
|
||||
int pr_saved_argc;
|
||||
int pr_param_size; ///< covers both params and return
|
||||
//@}
|
||||
|
||||
int pr_edict_size; ///< in bytes
|
||||
int pr_edictareasize; ///< for bounds checking, starts at 0
|
||||
func_t edict_parse;
|
||||
|
||||
/// \name execution state
|
||||
//@{
|
||||
int pr_argc;
|
||||
|
||||
qboolean pr_trace;
|
||||
|
@ -1499,11 +1613,15 @@ struct progs_s {
|
|||
|
||||
int localstack[LOCALSTACK_SIZE];
|
||||
int localstack_used;
|
||||
//@}
|
||||
|
||||
/// \name resources
|
||||
//@{
|
||||
pr_resource_t *resources;
|
||||
struct hashtab_s *resource_hash;
|
||||
//@}
|
||||
|
||||
/// obj info
|
||||
/// \name obj info
|
||||
//@{
|
||||
int selector_index;
|
||||
int selector_index_max;
|
||||
|
@ -1519,7 +1637,7 @@ struct progs_s {
|
|||
struct obj_list_s *class_tree_list;
|
||||
//@}
|
||||
|
||||
/// debug info
|
||||
/// \name debug info
|
||||
//@{
|
||||
const char *debugfile;
|
||||
struct pr_debug_header_s *debug;
|
||||
|
@ -1532,6 +1650,8 @@ struct progs_s {
|
|||
pr_type_t wp_val;
|
||||
//@}
|
||||
|
||||
/// \name globals and fields needed by the VM
|
||||
//@{
|
||||
struct {
|
||||
float *time; ///< required for OP_STATE
|
||||
pr_int_t *self; ///< required for OP_STATE
|
||||
|
@ -1542,6 +1662,7 @@ struct progs_s {
|
|||
pr_int_t think; ///< required for OP_STATE
|
||||
pr_int_t this; ///< optional for entity<->object linking
|
||||
} fields;
|
||||
//@}
|
||||
};
|
||||
|
||||
/** \addtogroup progs_data_access
|
||||
|
|
|
@ -37,9 +37,11 @@
|
|||
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
extern int com_argc;
|
||||
extern const char **com_argv;
|
||||
extern const char *com_cmdline;
|
||||
extern int com_argc;
|
||||
extern const char **com_argv;
|
||||
extern const char *com_cmdline;
|
||||
extern struct cvar_s *fs_globalcfg;
|
||||
extern struct cvar_s *fs_usercfg;
|
||||
|
||||
int COM_CheckParm (const char *parm);
|
||||
void COM_AddParm (const char *parm);
|
||||
|
@ -47,6 +49,7 @@ void COM_AddParm (const char *parm);
|
|||
void COM_Init (void);
|
||||
void COM_Init_Cvars (void);
|
||||
void COM_InitArgv (int argc, const char **argv);
|
||||
void COM_ParseConfig (void);
|
||||
|
||||
//@}
|
||||
|
||||
|
|
|
@ -36,46 +36,17 @@
|
|||
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
/**
|
||||
There are four types of data that can be stored in a property list:
|
||||
/** The type of the property list item.
|
||||
|
||||
<dl>
|
||||
<dt>QFDictionary</dt> <dd>A list of values, each associated with a
|
||||
key (a C string).</dd>
|
||||
<dt>QFArray</dt> <dd>A list of indexed values</dd>
|
||||
<dt>QFString</dt> <dd>A string.</dd>
|
||||
<dt>QFBinary</dt> <dd>Random binary data.</dd>
|
||||
</dl>
|
||||
|
||||
In textual form, a dictionary looks like:
|
||||
\code
|
||||
{
|
||||
key = value;
|
||||
}
|
||||
\endcode
|
||||
An array looks like:
|
||||
\code
|
||||
(
|
||||
value1,
|
||||
value2
|
||||
)
|
||||
\endcode
|
||||
An unquoted string may contain only alphanumeric characters and/or the
|
||||
underscore character, <code>_</code>. Quoted strings may contain
|
||||
whitespace, C escape sequences, and so on. The quote character is
|
||||
<code>\"</code>. Optionally, Python style long strings
|
||||
(<code>\"\"\"...\"\"\"</code>) may be used, allowing for unquoted
|
||||
<code>"</code> quotes in the string.
|
||||
|
||||
<!-- in the following paragraph, the \< and \> are just < and >. the \ is
|
||||
for doxygen -->
|
||||
QFBinary data is hex-encoded and contained within angle brackets, \c \<
|
||||
\c \>. The length of the encoded data must be an even number, so while
|
||||
\c \<FF00\> is valid, \c \<F00\> isn't.
|
||||
|
||||
Property lists may contain C-style or BCPL-style comments.
|
||||
For further details, see \ref property-list.
|
||||
*/
|
||||
typedef enum {QFDictionary, QFArray, QFBinary, QFString} pltype_t;
|
||||
typedef enum {
|
||||
QFDictionary, ///< The property list item represents a dictionary.
|
||||
QFArray, ///< The property list item represents an array.
|
||||
QFBinary, ///< The property list item represents arbitrary binary
|
||||
///< data.
|
||||
QFString ///< The property list item represents a C string.
|
||||
} pltype_t;
|
||||
|
||||
/** Generic property list item.
|
||||
|
||||
|
|
|
@ -67,11 +67,18 @@ typedef enum {false, true} qboolean;
|
|||
#endif
|
||||
|
||||
// From mathlib...
|
||||
typedef float vec_t;
|
||||
typedef vec_t vec3_t[3];
|
||||
typedef float vec_t; ///< The basic vector component type
|
||||
typedef vec_t vec3_t[3]; ///< A 3D vector (used for Euler angles and motion vectors)
|
||||
typedef vec_t vec4_t[4];
|
||||
typedef vec_t quat_t[4];
|
||||
typedef vec_t quat_t[4]; ///< A quaternion.
|
||||
typedef vec_t vec5_t[5];
|
||||
typedef union {
|
||||
struct {
|
||||
vec_t s;
|
||||
vec3_t v;
|
||||
} sv;
|
||||
quat_t q;
|
||||
} Quat_t;
|
||||
typedef int fixed4_t;
|
||||
typedef int fixed8_t;
|
||||
typedef int fixed16_t;
|
||||
|
@ -82,12 +89,12 @@ typedef int fixed16_t;
|
|||
|
||||
// plane_t structure
|
||||
// !!! if this is changed, it must be changed in asm_i386.h too !!!
|
||||
typedef struct mplane_s {
|
||||
typedef struct plane_s {
|
||||
vec3_t normal;
|
||||
float dist;
|
||||
byte type; // for texture axis selection and fast side tests
|
||||
byte signbits; // signx + signy<<1 + signz<<1
|
||||
byte pad[2];
|
||||
} mplane_t;
|
||||
} plane_t;
|
||||
|
||||
#endif // __qtypes_h
|
||||
|
|
|
@ -57,6 +57,7 @@ typedef struct gamedir_s {
|
|||
const char *gamedir; ///< the actual game dir
|
||||
const char *path; ///< colon separated list of search paths
|
||||
const char *gamecode; ///< name of file to load for gamecode
|
||||
const char *hudtype; ///< name of the hud type
|
||||
struct {
|
||||
const char *def; ///< directory to which to write other files
|
||||
const char *skins; ///< directory to which to write skins
|
||||
|
@ -116,7 +117,7 @@ void QFS_Init (const char *game);
|
|||
Sets the fields in ::qfs_gamedir. Can be called at any time (and is, by
|
||||
the quakeworld clients and servers).
|
||||
|
||||
\param gamedir The directory to which to set the game directory.
|
||||
\param gamedir The directory to which the game directory will be set.
|
||||
*/
|
||||
void QFS_Gamedir (const char *gamedir);
|
||||
|
||||
|
@ -275,7 +276,7 @@ int QFS_NextFilename (struct dstring_s *filename, const char *prefix,
|
|||
|
||||
/** Extract the non-extension part of the file name from the path.
|
||||
|
||||
\param in The path from which to extract the name.
|
||||
\param in The path from which the name will be extracted.
|
||||
\return The extracted name.
|
||||
\note It is the caller's responsibility to free the extracted name.
|
||||
*/
|
||||
|
@ -304,13 +305,17 @@ void QFS_SetExtension (struct dstring_s *path, const char *extension);
|
|||
\param in The path from which to strip the extension.
|
||||
\param out The destination of the stripped path. May be the same
|
||||
as \a in.
|
||||
\note No size checking is done on \a out. It use the
|
||||
caller's responsibility to ensure out is large enough
|
||||
to hold the stripped path. However, the stripped path
|
||||
will never be longer than the original path.
|
||||
*/
|
||||
void QFS_StripExtension (const char *in, char *out);
|
||||
|
||||
/** Create a canonical path.
|
||||
|
||||
Convert all \\ to /, remove all . elements from the path and resolve
|
||||
all foo/..
|
||||
Convert all \c \\ to \c /, remove all \c . elements from the path and
|
||||
resolve all \c foo/.. pairs.
|
||||
|
||||
\param pth The path to make canonical
|
||||
\return The canonical path.
|
||||
|
@ -331,7 +336,9 @@ const char *QFS_SkipPath (const char *pathname);
|
|||
|
||||
\param in The path withing which to find the extention.
|
||||
\return Pointer to the beginning of the extention. This points
|
||||
inside \a in.
|
||||
inside \a in at all times. If the path has no extension,
|
||||
the returned pointer will point to the terminating nul
|
||||
of the path.
|
||||
*/
|
||||
const char *QFS_FileExtension (const char *in);
|
||||
|
||||
|
@ -374,6 +381,7 @@ void QFS_FilelistAdd (filelist_t *filelist, const char *fname,
|
|||
added to the list.
|
||||
\param ext The extension of the files to be added.
|
||||
\param strip If true, the extension of the files will be stripped.
|
||||
\bug can escape the quake file system
|
||||
*/
|
||||
void QFS_FilelistFill (filelist_t *list, const char *path, const char *ext,
|
||||
int strip);
|
||||
|
|
|
@ -45,6 +45,10 @@ typedef struct script_s {
|
|||
void (*error)(struct script_s *script, const char *msg);
|
||||
/// if set, multi line quoted tokens will be treated as errors
|
||||
int no_quote_lines;
|
||||
/// if set, characters in this string will always be lexed as single
|
||||
/// character tokens. If not set, defaults to "{}()':". Set to ""
|
||||
/// (empty string) to disable. Not set by default.
|
||||
const char *single;
|
||||
} script_t;
|
||||
|
||||
/** Return a new script_t object.
|
||||
|
|
|
@ -38,8 +38,7 @@
|
|||
#define RSSHOT_WIDTH 320
|
||||
#define RSSHOT_HEIGHT 200
|
||||
|
||||
typedef struct skin_s
|
||||
{
|
||||
typedef struct skin_s {
|
||||
char name[MAX_SKIN_LENGTH];
|
||||
qboolean failedload; // the name isn't a valid skin
|
||||
union {
|
||||
|
@ -56,6 +55,8 @@ extern skin_t skin_cache[MAX_CACHED_SKINS];
|
|||
extern int skin_textures;
|
||||
extern int skin_fb_textures;
|
||||
|
||||
extern int playercolor;
|
||||
|
||||
struct tex_s;
|
||||
struct tex_s *Skin_Cache (skin_t *skin);
|
||||
struct player_info_s;
|
||||
|
|
|
@ -86,6 +86,8 @@ void Sys_MaskPrintf (int mask, const char *fmt, ...) __attribute__((format(print
|
|||
#define SYS_NET (1|64)
|
||||
#define SYS_RUA_OBJ (1|128)
|
||||
#define SYS_RUA_MSG (1|256)
|
||||
#define SYS_SND (1|512)
|
||||
#define SYS_GLT (1|1024)
|
||||
|
||||
int Sys_CheckInput (int idle, int net_socket);
|
||||
const char *Sys_ConsoleInput (void);
|
||||
|
|
|
@ -20,34 +20,41 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef qfbsp_winding_h
|
||||
#define qfbsp_winding_h
|
||||
#ifndef __QF_winding_h
|
||||
#define __QF_winding_h
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
/** \defgroup qfbsp_winding Winding Manipulation
|
||||
\ingroup qfbsp
|
||||
/** \defgroup winding Winding Manipulation
|
||||
*/
|
||||
//@{
|
||||
|
||||
struct plane_s;
|
||||
|
||||
#define ON_EPSILON 0.05
|
||||
|
||||
typedef struct winding_s {
|
||||
int numpoints;
|
||||
vec3_t points[8]; // variable sized
|
||||
int numpoints; ///< The number of points in the winding
|
||||
vec3_t points[4]; ///< variable sized, never less than 3
|
||||
} winding_t;
|
||||
|
||||
/** Create a very large four-point winding with all point on the plane.
|
||||
|
||||
The winding will be a box with aligned with the axes of the plane.
|
||||
The winding will be a box with aligned with the axes of the plane. The
|
||||
order of yhe points is clockwise when viewed from the front side of
|
||||
the plane.
|
||||
|
||||
\param p The plane for which to create the winding.
|
||||
In terms of s and t, the axes of the plane will be such that t (up) is
|
||||
the projection of either the z-axis or the x-axis (whichever is
|
||||
"closer"), and s is to the right (n = s cross t).
|
||||
|
||||
\param p The plane on which to create the winding.
|
||||
\return The new winding.
|
||||
\note It is the caller's responsibiltiy to free the new winding.
|
||||
*/
|
||||
winding_t *BaseWindingForPlane (const struct plane_s *p);
|
||||
|
||||
/** Create a new, empty winding with.
|
||||
/** Create a new, empty winding with space for the specified number of points.
|
||||
|
||||
\param points The number of points for which to leave space.
|
||||
\return The new winding.
|
||||
|
@ -71,17 +78,31 @@ winding_t *CopyWinding (const winding_t *w);
|
|||
|
||||
/** Create a new winding with the reverse points of the given winding.
|
||||
|
||||
This is useful when a winding for the back side of a plane is required.
|
||||
|
||||
\param w The winding to copy.
|
||||
\return The new winding.
|
||||
\note It is the caller's responsibiltiy to free the new winding.
|
||||
*/
|
||||
winding_t *CopyWindingReverse (const winding_t *w);
|
||||
|
||||
/** Create a new "winding" that holds the unit vectors of the edges of the
|
||||
given winding.
|
||||
|
||||
\param w The winding to convert.
|
||||
\param unit If true, normalize the vectors.
|
||||
\return The "winding" holding the (unit) vectors.
|
||||
\note It is the caller's responsibiltiy to free the new winding.
|
||||
*/
|
||||
winding_t *WindingVectors (const winding_t *w, int unit);
|
||||
|
||||
/** Clip the winding to the plain.
|
||||
|
||||
The new winding will be the part of the input winding that is on the
|
||||
front side of the plane.
|
||||
|
||||
The direction of the winding is preserved.
|
||||
|
||||
\note It is the caller's responsibiltiy to free the new winding.
|
||||
|
||||
\note The input winding will be freed.
|
||||
|
@ -120,4 +141,4 @@ void DivideWinding (winding_t *in, struct plane_s *split,
|
|||
|
||||
//@}
|
||||
|
||||
#endif//qfbsp_winding_h
|
||||
#endif//__QF_winding_h
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
view.h
|
||||
clview.h
|
||||
|
||||
(description)
|
||||
|
||||
|
@ -27,8 +27,8 @@
|
|||
*/
|
||||
// view.h
|
||||
|
||||
#ifndef __view_h_
|
||||
#define __view_h_
|
||||
#ifndef __clview_h_
|
||||
#define __clview_h_
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
|
@ -53,4 +53,4 @@ void V_CalcBlend (void);
|
|||
|
||||
extern float v_blend[4];
|
||||
|
||||
#endif // __view_h_
|
||||
#endif // __clview_h_
|
|
@ -27,16 +27,103 @@
|
|||
*/
|
||||
|
||||
|
||||
/** \defgroup nq-dgrm NetQuake Datagram network driver.
|
||||
\ingroup nq-nd
|
||||
*/
|
||||
//@{
|
||||
|
||||
/** Initialize the Datagram net driver.
|
||||
|
||||
Also initializes the underlying lan drivers.
|
||||
|
||||
\return 0 if successful, otherwise -1.
|
||||
*/
|
||||
int Datagram_Init (void);
|
||||
|
||||
/** Control the listen status of the underlying lan drivers.
|
||||
|
||||
\param state True to enable, false to disable.
|
||||
*/
|
||||
void Datagram_Listen (qboolean state);
|
||||
|
||||
/** Search for hosts (servers) on the local network.
|
||||
|
||||
If \p xmit is true, broadcast a CCREQ_SERVER_INFO packet via all
|
||||
underlying lan drivers using their control ports.
|
||||
|
||||
Check for any CCREP_SERVER_INFO responses. Ignore all other packets.
|
||||
|
||||
\param xmit True to send the broadcast, falst to only listen.
|
||||
*/
|
||||
void Datagram_SearchForHosts (qboolean xmit);
|
||||
|
||||
/** Connect to the specified host.
|
||||
|
||||
\param host The host to which the connection will be made.
|
||||
\return A pointer to the socket representing the connection, or
|
||||
null if unsuccessful.
|
||||
*/
|
||||
qsocket_t *Datagram_Connect (const char *host);
|
||||
|
||||
/** Check for a new incoming connection.
|
||||
|
||||
\return A pointer to the socekt representing the new connection,
|
||||
or null if none found.
|
||||
*/
|
||||
qsocket_t *Datagram_CheckNewConnections (void);
|
||||
|
||||
/** Check for and process an incoming packet on the socket.
|
||||
|
||||
\param sock The socket to check.
|
||||
\return -1 if there is an error
|
||||
\return 0 if the packet is stale
|
||||
\return 1 if the packet is reliable
|
||||
\return 2 if the packet is unreliable
|
||||
*/
|
||||
int Datagram_GetMessage (qsocket_t *sock);
|
||||
|
||||
/** Send a reliable packet to the socket.
|
||||
|
||||
\param sock The socket to which the packet will be sent.
|
||||
\param data The packet to be sent.
|
||||
\return -1 If there is an error
|
||||
\return 1 if everything is ok.
|
||||
*/
|
||||
int Datagram_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
|
||||
/** Send an unreliable packet to the socket.
|
||||
|
||||
\param sock The socket to which the packet will be sent.
|
||||
\param data The packet to be sent.
|
||||
\return -1 If there is an error
|
||||
\return 1 if everything is ok.
|
||||
*/
|
||||
int Datagram_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data);
|
||||
|
||||
/** Check if a reliable message can be sent to the socket.
|
||||
|
||||
\param sock The socket to check.
|
||||
\return True if the packet can be sent.
|
||||
*/
|
||||
qboolean Datagram_CanSendMessage (qsocket_t *sock);
|
||||
|
||||
/** Check if an unreliable message can be sent to the socket.
|
||||
|
||||
Always true.
|
||||
|
||||
\param sock The socket to check.
|
||||
\return True if the packet can be sent.
|
||||
*/
|
||||
qboolean Datagram_CanSendUnreliableMessage (qsocket_t *sock);
|
||||
|
||||
/** Close the socket.
|
||||
|
||||
\param sock The socket to close.
|
||||
*/
|
||||
void Datagram_Close (qsocket_t *sock);
|
||||
|
||||
/** Shutdown the Datagram net driver.
|
||||
*/
|
||||
void Datagram_Shutdown (void);
|
||||
|
||||
//@}
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
#include "QF/qtypes.h"
|
||||
#include "netmain.h"
|
||||
|
||||
/** \defgroup nq-loop NetQuake loopback network driver.
|
||||
\ingroup nq-nd
|
||||
*/
|
||||
//@{
|
||||
|
||||
int Loop_Init (void);
|
||||
void Loop_Listen (qboolean state);
|
||||
void Loop_SearchForHosts (qboolean xmit);
|
||||
|
@ -45,4 +50,6 @@ qboolean Loop_CanSendUnreliableMessage (qsocket_t *sock);
|
|||
void Loop_Close (qsocket_t *sock);
|
||||
void Loop_Shutdown (void);
|
||||
|
||||
//@}
|
||||
|
||||
#endif//__net_loop_h
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
net_udp.h
|
||||
|
||||
@description@
|
||||
NetQuake UDP lan driver.
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -31,23 +31,169 @@
|
|||
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
int UDP_Init (void);
|
||||
/** \defgroup nq-udp NetQuake UDP lan driver.
|
||||
\ingroup nq-ld
|
||||
*/
|
||||
//@{
|
||||
|
||||
/** Initialize the UDP network interface.
|
||||
|
||||
Opens a single control socket.
|
||||
|
||||
\return The control socket or -1 on failure.
|
||||
*/
|
||||
|
||||
int UDP_Init (void);
|
||||
|
||||
/** Shutdown the UDP network interface.
|
||||
*/
|
||||
void UDP_Shutdown (void);
|
||||
|
||||
/** Open or close the accept socket.
|
||||
|
||||
Sets net_acceptsocket to the socket number or -1.
|
||||
The accept socket is stored in net_hostport.
|
||||
|
||||
\param state True to open the socket, false to close it.
|
||||
*/
|
||||
void UDP_Listen (qboolean state);
|
||||
int UDP_OpenSocket (int port);
|
||||
int UDP_CloseSocket (int socket);
|
||||
int UDP_Connect (int socket, struct qsockaddr *addr);
|
||||
int UDP_CheckNewConnections (void);
|
||||
int UDP_Read (int socket, byte *buf, int len, struct qsockaddr *addr);
|
||||
int UDP_Write (int socket, byte *buf, int len, struct qsockaddr *addr);
|
||||
int UDP_Broadcast (int socket, byte *buf, int len);
|
||||
const char *UDP_AddrToString (struct qsockaddr *addr);
|
||||
int UDP_StringToAddr (const char *string, struct qsockaddr *addr);
|
||||
int UDP_GetSocketAddr (int socket, struct qsockaddr *addr);
|
||||
int UDP_GetNameFromAddr (struct qsockaddr *addr, char *name);
|
||||
int UDP_GetAddrFromName (const char *name, struct qsockaddr *addr);
|
||||
int UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int UDP_GetSocketPort (struct qsockaddr *addr);
|
||||
int UDP_SetSocketPort (struct qsockaddr *addr, int port);
|
||||
|
||||
/** Open a single socket on the specified port.
|
||||
|
||||
If \p port is 0, then use the operating system default.
|
||||
|
||||
\param port The port on which to open the socket.
|
||||
\return The socket number or -1 on failure.
|
||||
*/
|
||||
int UDP_OpenSocket (int port);
|
||||
|
||||
/** Close a socket.
|
||||
|
||||
\param socket The socket to close.
|
||||
\return 0 for success, -1 for failure.
|
||||
*/
|
||||
int UDP_CloseSocket (int socket);
|
||||
|
||||
/** Does very little.
|
||||
|
||||
\param socket The socket on which to do very little.
|
||||
\param addr The address to which very little will be done.
|
||||
\return 0
|
||||
*/
|
||||
int UDP_Connect (int socket, netadr_t *addr);
|
||||
|
||||
/** Check for incoming packets on the accept socket.
|
||||
|
||||
Checks if any packets are available on net_acceptsocket.
|
||||
*/
|
||||
int UDP_CheckNewConnections (void);
|
||||
|
||||
/** Read a packet from the specified socket.
|
||||
|
||||
\param socket The socket from which the packet will be read.
|
||||
\param buf The buffer into which the packet will be read.
|
||||
\param len The maximum number of bytes to read.
|
||||
\param[out] addr The address from which the packet originated.
|
||||
\return The number of bytes read or -1 on error.
|
||||
*/
|
||||
int UDP_Read (int socket, byte *buf, int len, netadr_t *addr);
|
||||
|
||||
/** Send a packet via the specified socket to the specified address.
|
||||
|
||||
\param socket The socket via which the packet will be sent.
|
||||
\param buf The packet data to be sent.
|
||||
\param len The number of bytes in the packet.
|
||||
\param addr The addres to which the packet will be sent.
|
||||
\return The number of bytes sent or -1 on error.
|
||||
*/
|
||||
int UDP_Write (int socket, byte *buf, int len, netadr_t *addr);
|
||||
|
||||
/** Broadcast a packet via the specified socket.
|
||||
|
||||
\warning It is a fatal error to use more than one socket for
|
||||
broadcasting.
|
||||
|
||||
\param socket The socket via which the packet will be broadcast.
|
||||
\param buf The packet data to be sent.
|
||||
\param len The number of bytes in the packet.
|
||||
\return The number of bytes sent or -1 on error.
|
||||
*/
|
||||
int UDP_Broadcast (int socket, byte *buf, int len);
|
||||
|
||||
/** Convert an address to a string.
|
||||
|
||||
Include the port number in the string.
|
||||
|
||||
\warning The return value is a pointer to a static buffer. The returned
|
||||
string must be saved if mixing calls with different addresses.
|
||||
|
||||
\param addr The address to convert.
|
||||
\return The address in human readable form.
|
||||
*/
|
||||
const char *UDP_AddrToString (netadr_t *addr);
|
||||
|
||||
/** Retrieve the address to which the socket is bound.
|
||||
|
||||
\param socket The socket for which the address will be retrieved.
|
||||
\param[out] addr The address to which the socket is bound.
|
||||
\return 0
|
||||
*/
|
||||
int UDP_GetSocketAddr (int socket, netadr_t *addr);
|
||||
|
||||
/** Convert an address to a hostname.
|
||||
|
||||
\param[in] addr The address to covert.
|
||||
\param[out] name Output buffer for the hostname.
|
||||
|
||||
\bug No checking is done on the size of the buffer, and uses strcpy.
|
||||
*/
|
||||
int UDP_GetNameFromAddr (netadr_t *addr, char *name);
|
||||
|
||||
/** Convert a human readable address to a quake address.
|
||||
|
||||
Accepts both host names (full or partial) and numeric form.
|
||||
|
||||
The port address can be specified when using a numeric address.
|
||||
|
||||
Numeric addresses can be partial: unspecified portions are filled out
|
||||
using the network address of the socket.
|
||||
|
||||
\param name The human readable address to be converted.
|
||||
\param addr The resulting address of the conversion.
|
||||
\return 0 if the conversion is successful, otherwise -1.
|
||||
*/
|
||||
int UDP_GetAddrFromName (const char *name, netadr_t *addr);
|
||||
|
||||
/** Compare two network addresses.
|
||||
|
||||
Compare the port number too.
|
||||
|
||||
\param addr1 The first address to compare.
|
||||
\param addr2 The second address to compare.
|
||||
\return -2 if the family is different.
|
||||
\return -1 if the family is the same, but the address is
|
||||
different.
|
||||
\return 1 if the family and address are the same, but the port
|
||||
is different.
|
||||
\return 0 if everything is the same.
|
||||
*/
|
||||
int UDP_AddrCompare (netadr_t *addr1, netadr_t *addr2);
|
||||
|
||||
/** Get the port number from the socket address.
|
||||
|
||||
\param addr The socket address from which to retrieve the port number.
|
||||
\return The port number.
|
||||
*/
|
||||
int UDP_GetSocketPort (netadr_t *addr);
|
||||
|
||||
/** Set the port number of the socket address.
|
||||
|
||||
\param addr The socket address which to will have its port number set.
|
||||
\param port The port number to which the socket address will be set.
|
||||
\return 0
|
||||
*/
|
||||
int UDP_SetSocketPort (netadr_t *addr, int port);
|
||||
|
||||
//@}
|
||||
|
||||
#endif // __net_udp_h
|
||||
|
|
|
@ -27,6 +27,11 @@
|
|||
*/
|
||||
|
||||
|
||||
/** \defgroup nq-vcr NetQuake VCR network driver.
|
||||
\ingroup nq-nd
|
||||
*/
|
||||
//@{
|
||||
|
||||
#define VCR_OP_CONNECT 1
|
||||
#define VCR_OP_GETMESSAGE 2
|
||||
#define VCR_OP_SENDMESSAGE 3
|
||||
|
@ -43,3 +48,5 @@ int VCR_SendMessage (qsocket_t *sock, sizebuf_t *data);
|
|||
qboolean VCR_CanSendMessage (qsocket_t *sock);
|
||||
void VCR_Close (qsocket_t *sock);
|
||||
void VCR_Shutdown (void);
|
||||
|
||||
//@}
|
||||
|
|
|
@ -33,28 +33,32 @@
|
|||
|
||||
#include "QF/qtypes.h"
|
||||
|
||||
/** \defgroup nq-wins NetQuake Winsock lan driver.
|
||||
\ingroup nq-ld
|
||||
*/
|
||||
//@{
|
||||
|
||||
extern int winsock_initialized;
|
||||
extern WSADATA winsockdata;
|
||||
|
||||
struct qsockaddr;
|
||||
|
||||
int WINS_Init (void);
|
||||
void WINS_Shutdown (void);
|
||||
void WINS_Listen (qboolean state);
|
||||
int WINS_OpenSocket (int port);
|
||||
int WINS_CloseSocket (int socket);
|
||||
int WINS_Connect (int socket, struct qsockaddr *addr);
|
||||
int WINS_Connect (int socket, netadr_t *addr);
|
||||
int WINS_CheckNewConnections (void);
|
||||
int WINS_Read (int socket, byte *buf, int len, struct qsockaddr *addr);
|
||||
int WINS_Write (int socket, byte *buf, int len, struct qsockaddr *addr);
|
||||
int WINS_Read (int socket, byte *buf, int len, netadr_t *addr);
|
||||
int WINS_Write (int socket, byte *buf, int len, netadr_t *addr);
|
||||
int WINS_Broadcast (int socket, byte *buf, int len);
|
||||
const char *WINS_AddrToString (struct qsockaddr *addr);
|
||||
int WINS_StringToAddr (const char *string, struct qsockaddr *addr);
|
||||
int WINS_GetSocketAddr (int socket, struct qsockaddr *addr);
|
||||
int WINS_GetNameFromAddr (struct qsockaddr *addr, char *name);
|
||||
int WINS_GetAddrFromName (const char *name, struct qsockaddr *addr);
|
||||
int WINS_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int WINS_GetSocketPort (struct qsockaddr *addr);
|
||||
int WINS_SetSocketPort (struct qsockaddr *addr, int port);
|
||||
const char *WINS_AddrToString (netadr_t *addr);
|
||||
int WINS_GetSocketAddr (int socket, netadr_t *addr);
|
||||
int WINS_GetNameFromAddr (netadr_t *addr, char *name);
|
||||
int WINS_GetAddrFromName (const char *name, netadr_t *addr);
|
||||
int WINS_AddrCompare (netadr_t *addr1, netadr_t *addr2);
|
||||
int WINS_GetSocketPort (netadr_t *addr);
|
||||
int WINS_SetSocketPort (netadr_t *addr, int port);
|
||||
|
||||
//@}
|
||||
|
||||
#endif//__net_wins_h
|
||||
|
|
|
@ -34,128 +34,354 @@
|
|||
#include "QF/qdefs.h"
|
||||
#include "QF/sizebuf.h"
|
||||
|
||||
#define MAX_MSGLEN 1450 // max length of a reliable message
|
||||
#define MAX_DATAGRAM 1450 // max length of unreliable message
|
||||
/** \defgroup network Network support
|
||||
*/
|
||||
|
||||
/** \defgroup qw-net QuakeWorld network support.
|
||||
\ingroup network
|
||||
*/
|
||||
//{
|
||||
#define MAX_MSGLEN 1450 ///< max length of a reliable message
|
||||
#define MAX_DATAGRAM 1450 ///< max length of unreliable message
|
||||
|
||||
#define PORT_ANY -1
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#ifdef HAVE_IPV6
|
||||
byte ip[16];
|
||||
byte ip[16];
|
||||
#else
|
||||
byte ip[4];
|
||||
byte ip[4];
|
||||
#endif
|
||||
unsigned short port;
|
||||
unsigned short family; // used to be pad, before IPV6
|
||||
unsigned short family;
|
||||
} netadr_t;
|
||||
|
||||
extern int net_socket;
|
||||
extern netadr_t net_local_adr;
|
||||
extern netadr_t net_loopback_adr;
|
||||
extern netadr_t net_from; // address of who sent the packet
|
||||
extern struct msg_s *net_message;
|
||||
|
||||
extern struct cvar_s *hostname;
|
||||
extern struct cvar_s *qport;
|
||||
|
||||
extern int net_socket;
|
||||
|
||||
void NET_Init (int port);
|
||||
void NET_Init (int port);
|
||||
void NET_Shutdown (void);
|
||||
qboolean NET_GetPacket (void);
|
||||
void NET_SendPacket (int length, const void *data, netadr_t to);
|
||||
|
||||
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
|
||||
qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);
|
||||
const char *NET_AdrToString (netadr_t a);
|
||||
const char *NET_BaseAdrToString (netadr_t a);
|
||||
qboolean NET_StringToAdr (const char *s, netadr_t *a);
|
||||
qboolean NET_IsClientLegal(netadr_t *adr);
|
||||
|
||||
|
||||
int Net_Log_Init (const char **sound_precache);
|
||||
void Net_LogPrintf (const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
|
||||
void Log_Incoming_Packet (const byte *p, int len, int has_sequence);
|
||||
void Log_Outgoing_Packet (const byte *p, int len, int has_sequence);
|
||||
void Log_Incoming_Packet (const byte *p, int len, int has_sequence,
|
||||
int is_server);
|
||||
void Log_Outgoing_Packet (const byte *p, int len, int has_sequence,
|
||||
int is_server);
|
||||
void Net_LogStop (void);
|
||||
void Analyze_Client_Packet (const byte * data, int len, int has_sequence);
|
||||
void Analyze_Server_Packet (const byte * data, int len, int has_sequence);
|
||||
|
||||
extern struct cvar_s *net_packetlog;
|
||||
//@}
|
||||
|
||||
extern qboolean is_server;
|
||||
qboolean ServerPaused (void);
|
||||
/** \defgroup qw-udp QuakeWorld udp support.
|
||||
\ingroup qw-net
|
||||
*/
|
||||
//@{
|
||||
|
||||
//============================================================================
|
||||
/** Initialize the UDP network interface.
|
||||
|
||||
Opens a single socket to be used for all communications.
|
||||
|
||||
\param port The port to which the socket will be bound.
|
||||
*/
|
||||
void NET_Init (int port);
|
||||
|
||||
/** Shutdown the UDP network interface.
|
||||
*/
|
||||
void NET_Shutdown (void);
|
||||
|
||||
/** Read a single packet from the network into net_message.
|
||||
|
||||
\return True if successfully read, otherwise false.
|
||||
*/
|
||||
qboolean NET_GetPacket (void);
|
||||
|
||||
/** Send a data packet out to the network.
|
||||
|
||||
\param length The length of the data to be sent.
|
||||
\param data The data to be sent.
|
||||
\param to The address to which the data will be sent.
|
||||
*/
|
||||
void NET_SendPacket (int length, const void *data, netadr_t to);
|
||||
|
||||
/** Compare two network addresses.
|
||||
|
||||
Compare the port number too.
|
||||
|
||||
\param a The first address to compare.
|
||||
\param b The second address to compare.
|
||||
\return True of the addresses match, otherwise false.
|
||||
*/
|
||||
qboolean NET_CompareAdr (netadr_t a, netadr_t b);
|
||||
|
||||
/** Compare two network addresses.
|
||||
|
||||
Ignore the port number.
|
||||
|
||||
\param a The first address to compare.
|
||||
\param b The second address to compare.
|
||||
\return True of the addresses match, otherwise false.
|
||||
*/
|
||||
qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b);
|
||||
|
||||
/** Convert an address to a string.
|
||||
|
||||
Include the port number in the string.
|
||||
|
||||
\warning The return value is a pointer to a static buffer. The returned
|
||||
string must be saved if mixing calls with different addresses.
|
||||
|
||||
\param a The address to convert
|
||||
\return The address in human readable form.
|
||||
*/
|
||||
const char *NET_AdrToString (netadr_t a);
|
||||
|
||||
/** Convert an address to a string.
|
||||
|
||||
Do not include the port number in the string.
|
||||
|
||||
\warning The return value is a pointer to a static buffer. The returned
|
||||
string must be saved if mixing calls with different addresses.
|
||||
|
||||
\param a The address to convert
|
||||
\return The address in human readable form.
|
||||
*/
|
||||
const char *NET_BaseAdrToString (netadr_t a);
|
||||
|
||||
/** Convert a human readable address to a quake address.
|
||||
|
||||
Accepts both host names (full or partial) and numeric form.
|
||||
|
||||
If a port is specified, the port value in the address will be set to that
|
||||
value, otherwise it will be set to 0.
|
||||
|
||||
\param[in] s The human readable address to be converted.
|
||||
\param[out] a The resulting address of the conversion.
|
||||
\return True if the conversion is successful, otherwise false.
|
||||
*/
|
||||
qboolean NET_StringToAdr (const char *s, netadr_t *a);
|
||||
|
||||
//@}
|
||||
|
||||
/** \defgroup netchan Netchan
|
||||
\ingroup qw-net
|
||||
|
||||
<table>
|
||||
<tr><td colspan=2>Packet Header</td></tr>
|
||||
<tr><td>Bits</td> <td>Meaning</td></tr>
|
||||
<tr><td>31</td> <td>sequence</td></tr>
|
||||
<tr><td>1</td> <td>this message contains a reliable payload</td></tr>
|
||||
<tr><td>31</td> <td>acknowledge sequence</td></tr>
|
||||
<tr><td>1</td> <td>acknowledge receipt of even/odd message</td></tr>
|
||||
<tr><td>16</td> <td>qport</td></tr>
|
||||
</table>
|
||||
|
||||
The remote connection never knows if it missed a reliable message, the
|
||||
local side detects that it has been dropped by seeing a sequence
|
||||
acknowledge higher than the last reliable sequence, but without the
|
||||
correct even/odd bit for the reliable set.
|
||||
|
||||
If the sender notices that a reliable message has been dropped, it will
|
||||
be retransmitted. It will not be retransmitted again until a message
|
||||
after the retransmit has been acknowledged and the reliable still failed
|
||||
to get there.
|
||||
|
||||
If the sequence number and reliable payload bits are all 1 (32bit -1),
|
||||
the packet is an out-of-band packet and should be handled without a
|
||||
netcon.
|
||||
|
||||
The reliable message can be added to at any time by doing
|
||||
MSG_Write* (&netchan->message, data).
|
||||
|
||||
If the message buffer is overflowed, either by a single message, or by
|
||||
multiple frames worth piling up while the last reliable transmit goes
|
||||
unacknowledged, the netchan signals a fatal error.
|
||||
|
||||
Reliable messages are always placed first in a packet, then the unreliable
|
||||
message is included if there is sufficient room.
|
||||
|
||||
To the receiver, there is no distinction between the reliable and
|
||||
unreliable parts of the message, they are just processed out as a single
|
||||
larger message.
|
||||
|
||||
Illogical packet sequence numbers cause the packet to be dropped, but do
|
||||
not kill the connection. This, combined with the tight window of valid
|
||||
reliable acknowledgement numbers provides protection against malicious
|
||||
address spoofing.
|
||||
|
||||
The qport field is a workaround for bad address translating routers that
|
||||
sometimes remap the client's source port on a packet during gameplay.
|
||||
|
||||
If the base part of the net address matches and the qport matches, then
|
||||
the channel matches even if the IP port differs. The IP port should be
|
||||
updated to the new value before sending out any replies.
|
||||
*/
|
||||
//@{
|
||||
#define OLD_AVG 0.99 // total = oldtotal*OLD_AVG + new*(1-OLD_AVG)
|
||||
|
||||
#define MAX_LATENT 32
|
||||
|
||||
typedef enum {
|
||||
NC_QPORT_SEND = 0x01,
|
||||
NC_QPORT_READ = 0x02,
|
||||
} ncqport_e;
|
||||
|
||||
typedef struct netchan_s {
|
||||
qboolean fatal_error;
|
||||
qboolean fatal_error; ///< True if the message overflowed
|
||||
|
||||
float last_received; // for timeouts
|
||||
float last_received; ///< Time the last packet was received.
|
||||
|
||||
// the statistics are cleared at each client begin, because
|
||||
// the server connecting process gives a bogus picture of the data
|
||||
float frame_latency; // rolling average
|
||||
/// \name statistics
|
||||
/// the statistics are cleared at each client begin, because
|
||||
/// the server connection process gives a bogus picture of the data
|
||||
///@{
|
||||
float frame_latency; ///< rolling average
|
||||
float frame_rate;
|
||||
|
||||
int drop_count; // dropped packets, cleared each level
|
||||
int net_drop; //packets dropped before this one
|
||||
int good_count; // cleared each level
|
||||
int drop_count; ///< dropped packets, cleared each level
|
||||
int net_drop; ///< packets dropped before this one
|
||||
int good_count; ///< cleared each level
|
||||
///@}
|
||||
|
||||
netadr_t remote_address;
|
||||
int qport;
|
||||
int flags;
|
||||
ncqport_e flags;
|
||||
|
||||
// bandwidth estimator
|
||||
double cleartime; // if realtime > nc->cleartime, free to go
|
||||
double rate; // seconds / byte
|
||||
/// \name bandwidth estimator
|
||||
///@{
|
||||
double cleartime; ///< if realtime > nc->cleartime,
|
||||
///< free to go
|
||||
double rate; ///< seconds / byte
|
||||
///@}
|
||||
|
||||
// sequencing variables
|
||||
/// \name sequencing variables
|
||||
///@{
|
||||
int incoming_sequence;
|
||||
int incoming_acknowledged;
|
||||
int incoming_reliable_acknowledged; // single bit
|
||||
int incoming_reliable_acknowledged; ///< single bit
|
||||
|
||||
int incoming_reliable_sequence; // single bit, maintained local
|
||||
int incoming_reliable_sequence; ///< single bit, maintained local
|
||||
|
||||
int outgoing_sequence;
|
||||
int reliable_sequence; // single bit
|
||||
int last_reliable_sequence; // sequence number of last send
|
||||
int reliable_sequence; ///< single bit
|
||||
int last_reliable_sequence; ///< sequence number of last send
|
||||
///@}
|
||||
|
||||
// reliable staging and holding areas
|
||||
sizebuf_t message; // writing buffer to send to server
|
||||
/// \name reliable staging and holding areas
|
||||
///@{
|
||||
sizebuf_t message; ///< writing buffer to send to server
|
||||
byte message_buf[MAX_MSGLEN];
|
||||
|
||||
int reliable_length;
|
||||
byte reliable_buf[MAX_MSGLEN]; // unacked reliable message
|
||||
byte reliable_buf[MAX_MSGLEN]; ///< unacked reliable message
|
||||
///@}
|
||||
|
||||
// time and size data to calculate bandwidth
|
||||
/// \name time and size data to calculate bandwidth
|
||||
///@{
|
||||
int outgoing_size[MAX_LATENT];
|
||||
double outgoing_time[MAX_LATENT];
|
||||
///@}
|
||||
} netchan_t;
|
||||
|
||||
extern int net_nochoke; // don't choke packets
|
||||
extern int net_blocksend; // don't send packets (used by client for demos)
|
||||
/** Disable packet choking.
|
||||
*/
|
||||
extern int net_nochoke;
|
||||
|
||||
/** Disable packet sending.
|
||||
|
||||
Used by clients in demo playback mode.
|
||||
*/
|
||||
extern int net_blocksend;
|
||||
|
||||
/** Pointer to variable holding the current time in seconds.
|
||||
*/
|
||||
extern double *net_realtime;
|
||||
|
||||
/** Initialize the netchan system.
|
||||
|
||||
Currently only sets the qport cvar default to a random value.
|
||||
*/
|
||||
void Netchan_Init (void);
|
||||
|
||||
/** Initialize the netchan cvars.
|
||||
*/
|
||||
void Netchan_Init_Cvars (void);
|
||||
|
||||
/** Try to send an unreliable packet to a connection.
|
||||
|
||||
Handles transmission or retransmission of the reliable packet.
|
||||
|
||||
0 length will still generate a packet and deal with the reliable messages.
|
||||
|
||||
\param chan The netchan representing the connection.
|
||||
\param length The size of the unreliable packet.
|
||||
\param data The data of the unreliable packet.
|
||||
*/
|
||||
void Netchan_Transmit (netchan_t *chan, int length, byte *data);
|
||||
|
||||
/** Send an out-of-band packet.
|
||||
|
||||
\param adr The address to which the data will be sent.
|
||||
\param length The length of the data to be sent.
|
||||
\param data The data to be sent.
|
||||
*/
|
||||
void Netchan_OutOfBand (netadr_t adr, int length, byte *data);
|
||||
void Netchan_OutOfBandPrint (netadr_t adr, const char *format, ...) __attribute__((format(printf,2,3)));
|
||||
/** Send a formatted string as an out-of-band packet.
|
||||
|
||||
\param adr The address to which the data will be sent.
|
||||
\param format The printf style format string.
|
||||
*/
|
||||
void Netchan_OutOfBandPrint (netadr_t adr, const char *format, ...)
|
||||
__attribute__ ((format (printf,2,3)));
|
||||
|
||||
/** Process a packet for the specifiied connection.
|
||||
|
||||
Called when the current net_message is from remote_address.
|
||||
Modifies net_message so that it points to the packet payload.
|
||||
|
||||
\param chan The netchan representing the connection.
|
||||
*/
|
||||
qboolean Netchan_Process (netchan_t *chan);
|
||||
void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport, int flags);
|
||||
|
||||
#define NC_SEND_QPORT 0x01
|
||||
#define NC_READ_QPORT 0x02
|
||||
/** Initialize a new connection.
|
||||
|
||||
\param chan The netchan representing the connection.
|
||||
\param adr The address of the remote end of the connection.
|
||||
\param qport The qport associated with the connection.
|
||||
\param flags Control of the sending/reading of the qport on this
|
||||
connection.
|
||||
*/
|
||||
void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport, ncqport_e flags);
|
||||
|
||||
/** Check if a packet can be sent to the connection.
|
||||
|
||||
\param chan The netchan representing the connection.
|
||||
\return True if the connection isn't chocked.
|
||||
*/
|
||||
qboolean Netchan_CanPacket (netchan_t *chan);
|
||||
|
||||
/** Check if a reliable packet can be sent to the connection.
|
||||
|
||||
\param chan The netchan representing the connection.
|
||||
\return True if there is no outstanding reliable packet and the
|
||||
connection isn't chocked.
|
||||
*/
|
||||
qboolean Netchan_CanReliable (netchan_t *chan);
|
||||
|
||||
/** Send a packet.
|
||||
|
||||
Very raw. Just calls NET_SendPacket().
|
||||
\param length The length of the data to be sent.
|
||||
\param data The data to be sent.
|
||||
\param to The address to which the data will be sent.
|
||||
*/
|
||||
void Netchan_SendPacket (int length, const void *data, netadr_t to);
|
||||
|
||||
//@}
|
||||
|
||||
#endif // _NET_H
|
||||
|
|
|
@ -32,12 +32,22 @@
|
|||
#include "QF/quakeio.h"
|
||||
#include "QF/sizebuf.h"
|
||||
|
||||
struct qsockaddr
|
||||
{
|
||||
short qsa_family;
|
||||
unsigned char qsa_data[14];
|
||||
};
|
||||
/** \defgroup nq-net NetQuake network support.
|
||||
\ingroup network
|
||||
*/
|
||||
//@{
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//FIXME not yet ready for ipv6
|
||||
//#ifdef HAVE_IPV6
|
||||
// byte ip[16];
|
||||
//#else
|
||||
byte ip[4];
|
||||
//#endif
|
||||
unsigned short port;
|
||||
unsigned short family;
|
||||
} netadr_t;
|
||||
|
||||
#define NET_NAMELEN 64
|
||||
|
||||
|
@ -45,7 +55,9 @@ struct qsockaddr
|
|||
#define NET_HEADERSIZE (2 * sizeof(unsigned int))
|
||||
#define NET_DATAGRAMSIZE (MAX_DATAGRAM + NET_HEADERSIZE)
|
||||
|
||||
// NetHeader flags
|
||||
/** \name NetHeader flags
|
||||
*/
|
||||
//@{
|
||||
#define NETFLAG_LENGTH_MASK 0x0000ffff
|
||||
#define NETFLAG_DATA 0x00010000
|
||||
#define NETFLAG_ACK 0x00020000
|
||||
|
@ -53,120 +65,340 @@ struct qsockaddr
|
|||
#define NETFLAG_EOM 0x00080000
|
||||
#define NETFLAG_UNRELIABLE 0x00100000
|
||||
#define NETFLAG_CTL 0x80000000
|
||||
//@}
|
||||
|
||||
|
||||
#define NET_PROTOCOL_VERSION 3
|
||||
|
||||
// This is the network info/connection protocol. It is used to find Quake
|
||||
// servers, get info about them, and connect to them. Once connected, the
|
||||
// Quake game protocol (documented elsewhere) is used.
|
||||
//
|
||||
//
|
||||
// General notes:
|
||||
// game_name is currently always "QUAKE", but is there so this same protocol
|
||||
// can be used for future games as well; can you say Quake2?
|
||||
//
|
||||
// CCREQ_CONNECT
|
||||
// string game_name "QUAKE"
|
||||
// byte net_protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREQ_SERVER_INFO
|
||||
// string game_name "QUAKE"
|
||||
// byte net_protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREQ_PLAYER_INFO
|
||||
// byte player_number
|
||||
//
|
||||
// CCREQ_RULE_INFO
|
||||
// string rule
|
||||
//
|
||||
//
|
||||
//
|
||||
// CCREP_ACCEPT
|
||||
// long port
|
||||
//
|
||||
// CCREP_REJECT
|
||||
// string reason
|
||||
//
|
||||
// CCREP_SERVER_INFO
|
||||
// string server_address
|
||||
// string host_name
|
||||
// string level_name
|
||||
// byte current_players
|
||||
// byte max_players
|
||||
// byte protocol_version NET_PROTOCOL_VERSION
|
||||
//
|
||||
// CCREP_PLAYER_INFO
|
||||
// byte player_number
|
||||
// string name
|
||||
// long colors
|
||||
// long frags
|
||||
// long connect_time
|
||||
// string address
|
||||
//
|
||||
// CCREP_RULE_INFO
|
||||
// string rule
|
||||
// string value
|
||||
/** \name Connection Protocol
|
||||
|
||||
// note:
|
||||
// There are two address forms used above. The short form is just a
|
||||
// port number. The address that goes along with the port is defined as
|
||||
// "whatever address you receive this reponse from". This lets us use
|
||||
// the host OS to solve the problem of multiple host addresses (possibly
|
||||
// with no routing between them); the host will use the right address
|
||||
// when we reply to the inbound connection request. The long from is
|
||||
// a full address and port in a string. It is used for returning the
|
||||
// address of a server that is not running locally.
|
||||
This is the network info/connection protocol. It is used to find Quake
|
||||
servers, get info about them, and connect to them. Once connected, the
|
||||
Quake game protocol (documented elsewhere) is used.
|
||||
|
||||
General notes:
|
||||
|
||||
\note There are two address forms used. The short form is just a
|
||||
port number. The address that goes along with the port is defined as
|
||||
"whatever address you receive this reponse from". This lets us use
|
||||
the host OS to solve the problem of multiple host addresses (possibly
|
||||
with no routing between them); the host will use the right address
|
||||
when we reply to the inbound connection request. The long from is
|
||||
a full address and port in a string. It is used for returning the
|
||||
address of a server that is not running locally.
|
||||
*/
|
||||
//@{
|
||||
|
||||
/** Connect Request:
|
||||
\arg \b string \c game_name \em "QUAKE"
|
||||
\arg \b byte \c net_protocol_version \em NET_PROTOCOL_VERSION
|
||||
|
||||
\note \c game_name is currently always "QUAKE", but is there so this
|
||||
same protocol can be used for future games as well
|
||||
*/
|
||||
#define CCREQ_CONNECT 0x01
|
||||
|
||||
/** Connect Request:
|
||||
\arg \b string \c game_name \em "QUAKE"
|
||||
\arg \b byte \c net_protocol_version \em NET_PROTOCOL_VERSION
|
||||
|
||||
\note \c game_name is currently always "QUAKE", but is there so this
|
||||
same protocol can be used for future games as well
|
||||
*/
|
||||
#define CCREQ_SERVER_INFO 0x02
|
||||
|
||||
/** Connect Request:
|
||||
\arg \b byte \c player_number
|
||||
*/
|
||||
#define CCREQ_PLAYER_INFO 0x03
|
||||
|
||||
/** Connect Request:
|
||||
\arg \b string \c rule
|
||||
*/
|
||||
#define CCREQ_RULE_INFO 0x04
|
||||
|
||||
|
||||
/** Connect Reply:
|
||||
\arg \b long \c port The port which the client is to use for further
|
||||
communication.
|
||||
*/
|
||||
#define CCREP_ACCEPT 0x81
|
||||
|
||||
/** Connect Reply:
|
||||
\arg \b string \c reason
|
||||
*/
|
||||
#define CCREP_REJECT 0x82
|
||||
|
||||
/** Connect Reply:
|
||||
\arg \b string \c server_address
|
||||
\arg \b string \c host_name
|
||||
\arg \b string \c level_name
|
||||
\arg \b byte \c current_players
|
||||
\arg \b byte \c max_players
|
||||
\arg \b byte \c protocol_version \em NET_PROTOCOL_VERSION
|
||||
*/
|
||||
#define CCREP_SERVER_INFO 0x83
|
||||
|
||||
/** Connect Reply:
|
||||
\arg \b byte \c player_number
|
||||
\arg \b string \c name
|
||||
\arg \b long \c colors
|
||||
\arg \b long \c frags
|
||||
\arg \b long \c connect_time
|
||||
\arg \b string \c address
|
||||
*/
|
||||
#define CCREP_PLAYER_INFO 0x84
|
||||
|
||||
/** Connect Reply:
|
||||
\arg \b string \c rule
|
||||
\arg \b string \c value
|
||||
*/
|
||||
#define CCREP_RULE_INFO 0x85
|
||||
//@}
|
||||
|
||||
typedef struct qsocket_s
|
||||
{
|
||||
typedef struct qsocket_s {
|
||||
struct qsocket_s *next;
|
||||
double connecttime;
|
||||
double lastMessageTime;
|
||||
double lastSendTime;
|
||||
/// \name socket timing
|
||||
//@{
|
||||
double connecttime; ///< Time client connected.
|
||||
double lastMessageTime; ///< Time last message was received.
|
||||
double lastSendTime; ///< Time last message was sent.
|
||||
//@}
|
||||
|
||||
qboolean disconnected;
|
||||
qboolean canSend;
|
||||
/// \name socket status
|
||||
//@{
|
||||
qboolean disconnected; ///< Socket is not in use.
|
||||
qboolean canSend; ///< Socket can send a message.
|
||||
qboolean sendNext;
|
||||
//@}
|
||||
|
||||
int driver;
|
||||
int landriver;
|
||||
int socket;
|
||||
void *driverdata;
|
||||
/// \name socket drivers
|
||||
//@{
|
||||
int driver; ///< Net driver used by this socket.
|
||||
int landriver; ///< Lan driver used by this socket.
|
||||
int socket; ///< Lan driver socket handle.
|
||||
void *driverdata; ///< Net driver private data.
|
||||
//@}
|
||||
|
||||
/// \name message transmission
|
||||
//@{
|
||||
unsigned int ackSequence;
|
||||
unsigned int sendSequence;
|
||||
unsigned int unreliableSendSequence;
|
||||
int sendMessageLength;
|
||||
byte sendMessage [NET_MAXMESSAGE];
|
||||
byte sendMessage[NET_MAXMESSAGE];
|
||||
//@}
|
||||
|
||||
/// \name message reception
|
||||
//@{
|
||||
unsigned int receiveSequence;
|
||||
unsigned int unreliableReceiveSequence;
|
||||
int receiveMessageLength;
|
||||
byte receiveMessage [NET_MAXMESSAGE];
|
||||
|
||||
struct qsockaddr addr;
|
||||
char address[NET_NAMELEN];
|
||||
byte receiveMessage[NET_MAXMESSAGE];
|
||||
//@}
|
||||
|
||||
/// \name socket address
|
||||
//@{
|
||||
netadr_t addr;
|
||||
char address[NET_NAMELEN]; ///< Human readable form.
|
||||
//@}
|
||||
} qsocket_t;
|
||||
|
||||
/** \name socket management
|
||||
*/
|
||||
//@{
|
||||
extern qsocket_t *net_activeSockets;
|
||||
extern qsocket_t *net_freeSockets;
|
||||
extern int net_numsockets;
|
||||
//@}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
#define MAX_NET_DRIVERS 8
|
||||
|
||||
extern int DEFAULTnet_hostport;
|
||||
extern int net_hostport;
|
||||
|
||||
extern int net_driverlevel;
|
||||
|
||||
/** \name message statistics
|
||||
*/
|
||||
//@{
|
||||
extern int messagesSent;
|
||||
extern int messagesReceived;
|
||||
extern int unreliableMessagesSent;
|
||||
extern int unreliableMessagesReceived;
|
||||
//@}
|
||||
|
||||
/** Create and initialize a new qsocket.
|
||||
|
||||
Called by drivers when a new communications endpoint is required.
|
||||
The sequence and buffer fields will be filled in properly.
|
||||
|
||||
\return The qsocket representing the connection.
|
||||
*/
|
||||
qsocket_t *NET_NewQSocket (void);
|
||||
|
||||
/** Destroy a qsocket.
|
||||
|
||||
\param sock The qsocket representing the connection.
|
||||
*/
|
||||
void NET_FreeQSocket(qsocket_t *sock);
|
||||
|
||||
/** Cache the system time for the network sub-system.
|
||||
|
||||
\return The current time.
|
||||
*/
|
||||
double SetNetTime(void);
|
||||
|
||||
|
||||
#define HOSTCACHESIZE 8
|
||||
|
||||
typedef struct {
|
||||
char name[16];
|
||||
char map[16];
|
||||
char cname[32];
|
||||
int users;
|
||||
int maxusers;
|
||||
int driver;
|
||||
int ldriver;
|
||||
netadr_t addr;
|
||||
} hostcache_t;
|
||||
|
||||
extern int hostCacheCount;
|
||||
extern hostcache_t hostcache[HOSTCACHESIZE];
|
||||
|
||||
extern double net_time;
|
||||
extern struct msg_s *net_message;
|
||||
extern int net_activeconnections;
|
||||
|
||||
/** Initialize the networking sub-system.
|
||||
*/
|
||||
void NET_Init (void);
|
||||
|
||||
/** Shutdown the networking sub-system.
|
||||
*/
|
||||
void NET_Shutdown (void);
|
||||
|
||||
/** Check for new connections.
|
||||
|
||||
\return Pointer to the qsocket for the new connection if there
|
||||
is one, otherwise null.
|
||||
*/
|
||||
struct qsocket_s *NET_CheckNewConnections (void);
|
||||
|
||||
/** Connect to a host.
|
||||
|
||||
\param host The name of the host to which will be connected.
|
||||
\return Pointer to the qsocket representing the connection, or
|
||||
null if unable to connect.
|
||||
*/
|
||||
struct qsocket_s *NET_Connect (const char *host);
|
||||
|
||||
/** Check if a message can be sent to the connection.
|
||||
|
||||
\param sock The qsocket representing the connection.
|
||||
\return True if the message can be sent.
|
||||
*/
|
||||
qboolean NET_CanSendMessage (qsocket_t *sock);
|
||||
|
||||
/** Read a single message from the connection into net_message.
|
||||
|
||||
If there is a complete message, return it in net_message.
|
||||
|
||||
\param sock The qsocket representing the connection.
|
||||
\return 0 if no data is waiting.
|
||||
\return 1 if a message was received.
|
||||
\return -1 if the connection died.
|
||||
*/
|
||||
int NET_GetMessage (struct qsocket_s *sock);
|
||||
|
||||
/** Send a single reliable message to the connection.
|
||||
|
||||
Try to send a complete length+message unit over the reliable stream.
|
||||
|
||||
\param sock The qsocket representing the connection.
|
||||
\param data The message to send.
|
||||
\return 0 if the message connot be delivered reliably, but the
|
||||
connection is still considered valid
|
||||
\return 1 if the message was sent properly
|
||||
\return -1 if the connection died
|
||||
*/
|
||||
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||
|
||||
/** Send a single unreliable message to the connection.
|
||||
|
||||
\param sock The qsocket representing the connection.
|
||||
\param data The message to send.
|
||||
\return 1 if the message was sent properly
|
||||
\return -1 if the connection died
|
||||
*/
|
||||
int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||
|
||||
/** Send a reliable message to all attached clients.
|
||||
|
||||
\param data The message to send.
|
||||
\param blocktime The blocking timeout in seconds.
|
||||
\return The number of clients to which the message could not be
|
||||
sent before the timeout.
|
||||
*/
|
||||
int NET_SendToAll(sizebuf_t *data, double blocktime);
|
||||
|
||||
/** Close a connection.
|
||||
|
||||
If a dead connection is returned by a get or send function, this function
|
||||
should be called when it is convenient.
|
||||
|
||||
Server calls when a client is kicked off for a game related misbehavior
|
||||
like an illegal protocal conversation. Client calls when disconnecting
|
||||
from a server.
|
||||
|
||||
A netcon_t number will not be reused until this function is called for it
|
||||
|
||||
\param sock The qsocket representing the connection.
|
||||
*/
|
||||
void NET_Close (struct qsocket_s *sock);
|
||||
|
||||
/** Run any current poll procedures.
|
||||
*/
|
||||
void NET_Poll(void);
|
||||
|
||||
|
||||
typedef struct _PollProcedure {
|
||||
struct _PollProcedure *next;
|
||||
double nextTime;
|
||||
void (*procedure)(void *);
|
||||
void *arg;
|
||||
} PollProcedure;
|
||||
|
||||
/** Schedule a poll procedure to run.
|
||||
|
||||
The poll procedure will be called by NET_Poll() no earlier than
|
||||
"now"+timeOffset.
|
||||
|
||||
\param pp The poll procedure to shedule.
|
||||
\param timeOffset The time offset from "now" at which the procedure
|
||||
will be run.
|
||||
*/
|
||||
void SchedulePollProcedure(PollProcedure *pp, double timeOffset);
|
||||
|
||||
extern qboolean tcpipAvailable;
|
||||
extern char my_tcpip_address[NET_NAMELEN];
|
||||
|
||||
extern qboolean slistInProgress;
|
||||
extern qboolean slistSilent;
|
||||
extern qboolean slistLocal;
|
||||
|
||||
extern struct cvar_s *hostname;
|
||||
|
||||
extern QFile *vcrFile;
|
||||
|
||||
//@}
|
||||
|
||||
/** \defgroup nq-ld NetQuake lan drivers.
|
||||
\ingroup nq-net
|
||||
*/
|
||||
//@{
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
qboolean initialized;
|
||||
int controlSock;
|
||||
|
@ -175,27 +407,31 @@ typedef struct
|
|||
void (*Listen) (qboolean state);
|
||||
int (*OpenSocket) (int port);
|
||||
int (*CloseSocket) (int socket);
|
||||
int (*Connect) (int socket, struct qsockaddr *addr);
|
||||
int (*Connect) (int socket, netadr_t *addr);
|
||||
int (*CheckNewConnections) (void);
|
||||
int (*Read) (int socket, byte *buf, int len, struct qsockaddr *addr);
|
||||
int (*Write) (int socket, byte *buf, int len, struct qsockaddr *addr);
|
||||
int (*Read) (int socket, byte *buf, int len, netadr_t *addr);
|
||||
int (*Write) (int socket, byte *buf, int len, netadr_t *addr);
|
||||
int (*Broadcast) (int socket, byte *buf, int len);
|
||||
const char * (*AddrToString) (struct qsockaddr *addr);
|
||||
int (*StringToAddr) (const char *string, struct qsockaddr *addr);
|
||||
int (*GetSocketAddr) (int socket, struct qsockaddr *addr);
|
||||
int (*GetNameFromAddr) (struct qsockaddr *addr, char *name);
|
||||
int (*GetAddrFromName) (const char *name, struct qsockaddr *addr);
|
||||
int (*AddrCompare) (struct qsockaddr *addr1, struct qsockaddr *addr2);
|
||||
int (*GetSocketPort) (struct qsockaddr *addr);
|
||||
int (*SetSocketPort) (struct qsockaddr *addr, int port);
|
||||
const char * (*AddrToString) (netadr_t *addr);
|
||||
int (*GetSocketAddr) (int socket, netadr_t *addr);
|
||||
int (*GetNameFromAddr) (netadr_t *addr, char *name);
|
||||
int (*GetAddrFromName) (const char *name, netadr_t *addr);
|
||||
int (*AddrCompare) (netadr_t *addr1, netadr_t *addr2);
|
||||
int (*GetSocketPort) (netadr_t *addr);
|
||||
int (*SetSocketPort) (netadr_t *addr, int port);
|
||||
} net_landriver_t;
|
||||
|
||||
#define MAX_NET_DRIVERS 8
|
||||
extern int net_numlandrivers;
|
||||
extern net_landriver_t net_landrivers[MAX_NET_DRIVERS];
|
||||
|
||||
typedef struct
|
||||
{
|
||||
//@}
|
||||
|
||||
/** \defgroup nq-nd NetQuake network drivers.
|
||||
\ingroup nq-net
|
||||
*/
|
||||
//@{
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
qboolean initialized;
|
||||
int (*Init) (void);
|
||||
|
@ -216,129 +452,6 @@ typedef struct
|
|||
extern int net_numdrivers;
|
||||
extern net_driver_t net_drivers[MAX_NET_DRIVERS];
|
||||
|
||||
extern int DEFAULTnet_hostport;
|
||||
extern int net_hostport;
|
||||
|
||||
extern int net_driverlevel;
|
||||
extern char playername[];
|
||||
extern int playercolor;
|
||||
|
||||
extern int messagesSent;
|
||||
extern int messagesReceived;
|
||||
extern int unreliableMessagesSent;
|
||||
extern int unreliableMessagesReceived;
|
||||
|
||||
qsocket_t *NET_NewQSocket (void);
|
||||
void NET_FreeQSocket(qsocket_t *);
|
||||
double SetNetTime(void);
|
||||
|
||||
|
||||
#define HOSTCACHESIZE 8
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[16];
|
||||
char map[16];
|
||||
char cname[32];
|
||||
int users;
|
||||
int maxusers;
|
||||
int driver;
|
||||
int ldriver;
|
||||
struct qsockaddr addr;
|
||||
} hostcache_t;
|
||||
|
||||
extern int hostCacheCount;
|
||||
extern hostcache_t hostcache[HOSTCACHESIZE];
|
||||
|
||||
//============================================================================
|
||||
//
|
||||
// public network functions
|
||||
//
|
||||
//============================================================================
|
||||
|
||||
extern double net_time;
|
||||
extern struct msg_s *net_message;
|
||||
extern int net_activeconnections;
|
||||
|
||||
void NET_Init (void);
|
||||
void NET_Shutdown (void);
|
||||
|
||||
struct qsocket_s *NET_CheckNewConnections (void);
|
||||
// returns a new connection number if there is one pending, else -1
|
||||
|
||||
struct qsocket_s *NET_Connect (const char *host);
|
||||
// called by client to connect to a host. Returns -1 if not able to
|
||||
|
||||
qboolean NET_CanSendMessage (qsocket_t *sock);
|
||||
// Returns true or false if the given qsocket can currently accept a
|
||||
// message to be transmitted.
|
||||
|
||||
int NET_GetMessage (struct qsocket_s *sock);
|
||||
// returns data in net_message sizebuf
|
||||
// returns 0 if no data is waiting
|
||||
// returns 1 if a message was received
|
||||
// returns 2 if an unreliable message was received
|
||||
// returns -1 if the connection died
|
||||
|
||||
int NET_SendMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||
int NET_SendUnreliableMessage (struct qsocket_s *sock, sizebuf_t *data);
|
||||
// returns 0 if the message connot be delivered reliably, but the connection
|
||||
// is still considered valid
|
||||
// returns 1 if the message was sent properly
|
||||
// returns -1 if the connection died
|
||||
|
||||
int NET_SendToAll(sizebuf_t *data, double blocktime);
|
||||
// This is a reliable *blocking* send to all attached clients.
|
||||
|
||||
|
||||
void NET_Close (struct qsocket_s *sock);
|
||||
// if a dead connection is returned by a get or send function, this function
|
||||
// should be called when it is convenient
|
||||
|
||||
// Server calls when a client is kicked off for a game related misbehavior
|
||||
// like an illegal protocal conversation. Client calls when disconnecting
|
||||
// from a server.
|
||||
// A netcon_t number will not be reused until this function is called for it
|
||||
|
||||
void NET_Poll(void);
|
||||
|
||||
|
||||
typedef struct _PollProcedure
|
||||
{
|
||||
struct _PollProcedure *next;
|
||||
double nextTime;
|
||||
void (*procedure)(void *);
|
||||
void *arg;
|
||||
} PollProcedure;
|
||||
|
||||
void SchedulePollProcedure(PollProcedure *pp, double timeOffset);
|
||||
|
||||
extern qboolean serialAvailable;
|
||||
extern qboolean ipxAvailable;
|
||||
extern qboolean tcpipAvailable;
|
||||
extern char my_ipx_address[NET_NAMELEN];
|
||||
extern char my_tcpip_address[NET_NAMELEN];
|
||||
extern void (*GetComPortConfig) (int portNumber, int *port, int *irq, int *baud, qboolean *useModem);
|
||||
extern void (*SetComPortConfig) (int portNumber, int port, int irq, int baud, qboolean useModem);
|
||||
extern void (*GetModemConfig) (int portNumber, char *dialType, char *clear, char *init, char *hangup);
|
||||
extern void (*SetModemConfig) (int portNumber, const char *dialType, const char *clear, const char *init, const char *hangup);
|
||||
|
||||
extern qboolean slistInProgress;
|
||||
extern qboolean slistSilent;
|
||||
extern qboolean slistLocal;
|
||||
|
||||
void NET_Slist_f (void);
|
||||
|
||||
extern struct cvar_s *config_com_port;
|
||||
extern struct cvar_s *config_com_irq;
|
||||
extern struct cvar_s *config_com_baud;
|
||||
extern struct cvar_s *config_com_modem;
|
||||
extern struct cvar_s *config_modem_dialtype;
|
||||
extern struct cvar_s *config_modem_clear;
|
||||
extern struct cvar_s *config_modem_init;
|
||||
extern struct cvar_s *config_modem_hangup;
|
||||
extern struct cvar_s *hostname;
|
||||
|
||||
extern QFile *vcrFile;
|
||||
//@}
|
||||
|
||||
#endif // __net_h
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#define MAX_PHYSENTS (MAX_CLIENTS + MAX_PACKET_ENTITIES)
|
||||
typedef struct {
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
model_t *model; // only for bsp models
|
||||
vec3_t mins, maxs; // only for non-bsp models
|
||||
hull_t *hull; // hey, magic :)
|
||||
|
|
|
@ -307,11 +307,11 @@ typedef struct {
|
|||
unsigned int flags; // nolerp, etc
|
||||
vec3_t origin;
|
||||
vec3_t angles;
|
||||
int modelindex;
|
||||
int frame;
|
||||
int colormap;
|
||||
int skinnum;
|
||||
unsigned short modelindex;
|
||||
unsigned short frame;
|
||||
int effects;
|
||||
byte colormap;
|
||||
byte skinnum;
|
||||
|
||||
// QSG 2
|
||||
byte alpha;
|
||||
|
|
|
@ -128,7 +128,7 @@ void R_RenderWorld (void);
|
|||
|
||||
//=============================================================================
|
||||
|
||||
extern mplane_t screenedge[4];
|
||||
extern plane_t screenedge[4];
|
||||
|
||||
extern vec3_t r_origin;
|
||||
|
||||
|
@ -158,7 +158,7 @@ void R_DrawSprite (void);
|
|||
void R_RenderFace (msurface_t *fa, int clipflags);
|
||||
void R_RenderPoly (msurface_t *fa, int clipflags);
|
||||
void R_RenderBmodelFace (bedge_t *pedges, msurface_t *psurf);
|
||||
void R_TransformPlane (mplane_t *p, float *normal, float *dist);
|
||||
void R_TransformPlane (plane_t *p, float *normal, float *dist);
|
||||
void R_TransformFrustum (void);
|
||||
void R_SetSkyFrame (void);
|
||||
void R_DrawSurfaceBlock (void);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
snd_render.h
|
||||
snd_internal.h
|
||||
|
||||
Sound renderer plugin stuff
|
||||
|
||||
|
@ -29,8 +29,8 @@
|
|||
$Id$
|
||||
*/
|
||||
|
||||
#ifndef __snd_render_h
|
||||
#define __snd_render_h
|
||||
#ifndef __snd_internal_h
|
||||
#define __snd_internal_h
|
||||
|
||||
|
||||
/** \defgroup sound_render Sound rendering sub-system.
|
||||
|
@ -78,9 +78,15 @@ struct dma_s {
|
|||
int framepos; //!< position of dma cursor
|
||||
unsigned char *buffer; //!< destination for mixed sound
|
||||
/** Transfer mixed samples to the output.
|
||||
\param endtime sample end time (count = endtime - snd_paintedtime)
|
||||
\param paintbuffer The buffer of mixed samples to be transferred.
|
||||
\param count The number of sample to transfer.
|
||||
\param volume The gain for the samples.
|
||||
*/
|
||||
void (*xfer) (int endtime);
|
||||
void (*xfer) (portable_samplepair_t *paintbuffer, int count,
|
||||
float volume);
|
||||
/** Optional data for the xfer function.
|
||||
*/
|
||||
void *xfer_data;
|
||||
};
|
||||
|
||||
/** Describes the sound data.
|
||||
|
@ -571,4 +577,4 @@ sfxbuffer_t *SND_GetCache (long samples, int rate, int channels,
|
|||
sfxblock_t *block, cache_allocator_t allocator);
|
||||
//@}
|
||||
|
||||
#endif//__snd_render_h
|
||||
#endif//__snd_internal_h
|
|
@ -33,11 +33,11 @@
|
|||
#include "QF/mathlib.h"
|
||||
#include "QF/model.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
vec3_t normal;
|
||||
vec_t dist;
|
||||
} plane_t;
|
||||
typedef enum {
|
||||
tr_point,
|
||||
tr_box,
|
||||
tr_ellipsoid,
|
||||
} trace_e;
|
||||
|
||||
typedef struct trace_s {
|
||||
qboolean allsolid; // if true, plane is not valid
|
||||
|
@ -45,10 +45,11 @@ typedef struct trace_s {
|
|||
qboolean inopen, inwater;
|
||||
float fraction; // time completed, 1.0 = didn't hit anything
|
||||
vec3_t extents; // 1/2 size of traced box
|
||||
qboolean isbox; // box or point
|
||||
trace_e type; // type of trace to perform
|
||||
vec3_t endpos; // final position
|
||||
plane_t plane; // surface normal at impact
|
||||
struct edict_s *ent; // entity the surface is on
|
||||
unsigned contents; // contents of leafs touched by trace
|
||||
} trace_t;
|
||||
|
||||
|
||||
|
@ -71,7 +72,7 @@ extern areanode_t sv_areanodes[AREA_NODES];
|
|||
|
||||
void SV_FreeAllEdictLeafs (void);
|
||||
|
||||
void SV_InitHull (hull_t *hull, mclipnode_t *clipnodes, mplane_t *planes);
|
||||
void SV_InitHull (hull_t *hull, mclipnode_t *clipnodes, plane_t *planes);
|
||||
|
||||
void SV_ClearWorld (void);
|
||||
// called after the world model has been loaded, before linking any entities
|
||||
|
@ -117,5 +118,28 @@ hull_t *SV_HullForEntity (struct edict_s *ent, const vec3_t mins,
|
|||
const vec3_t maxs, vec3_t extents, vec3_t offset);
|
||||
void MOD_TraceLine (hull_t *hull, int num,
|
||||
const vec3_t start, const vec3_t end, trace_t *trace);
|
||||
int MOD_HullContents (hull_t *hull, int num, const vec3_t origin,
|
||||
trace_t *trace);
|
||||
|
||||
typedef struct clipport_s {
|
||||
int planenum;
|
||||
struct clipport_s *next[2]; ///< front, back
|
||||
struct clipleaf_s *leafs[2]; ///< front, back
|
||||
struct winding_s *winding;
|
||||
struct winding_s *edges; ///< unit vectors along edges
|
||||
} clipport_t;
|
||||
|
||||
typedef struct clipleaf_s {
|
||||
clipport_t *portals;
|
||||
int contents;
|
||||
int test_count;
|
||||
} clipleaf_t;
|
||||
|
||||
typedef struct nodeleaf_s {
|
||||
clipleaf_t *leafs[2]; ///< front, back. If null, node's child is a node
|
||||
} nodeleaf_t;
|
||||
|
||||
nodeleaf_t *MOD_BuildBrushes (hull_t *hull);
|
||||
void MOD_FreeBrushes (hull_t *hull);
|
||||
|
||||
#endif // __world_h
|
||||
|
|
|
@ -66,7 +66,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/va.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
/* Generic plugin structures */
|
||||
static general_data_t plugin_info_general_data;
|
||||
|
|
|
@ -89,7 +89,7 @@ I_CDAudio_CloseDoor (void)
|
|||
return; // no cd init'd
|
||||
|
||||
if (ioctl (cdfile, CDROMCLOSETRAY) == -1)
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromclosetray failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromclosetray failed\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -99,7 +99,7 @@ I_CDAudio_Eject (void)
|
|||
return; // no cd init'd
|
||||
|
||||
if (ioctl (cdfile, CDROMEJECT) == -1)
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromeject failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromeject failed\n");
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -110,12 +110,12 @@ I_CDAudio_GetAudioDiskInfo (void)
|
|||
cdValid = false;
|
||||
|
||||
if (ioctl (cdfile, CDROMREADTOCHDR, &tochdr) == -1) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtochdr failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromreadtochdr failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (tochdr.cdth_trk0 < 1) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: no music tracks\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: no music tracks\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ I_CDAudio_Pause (void)
|
|||
return;
|
||||
|
||||
if (ioctl (cdfile, CDROMPAUSE) == -1)
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdrompause failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdrompause failed\n");
|
||||
|
||||
wasPlaying = playing;
|
||||
playing = false;
|
||||
|
@ -151,7 +151,7 @@ I_CDAudio_Stop (void)
|
|||
return;
|
||||
|
||||
if (ioctl (cdfile, CDROMSTOP) == -1)
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromstop failed (%d)\n",
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromstop failed (%d)\n",
|
||||
errno);
|
||||
|
||||
wasPlaying = false;
|
||||
|
@ -189,7 +189,7 @@ I_CDAudio_Play (int track, qboolean looping)
|
|||
entry0.cdte_track = track;
|
||||
entry0.cdte_format = CDROM_MSF;
|
||||
if (ioctl (cdfile, CDROMREADTOCENTRY, &entry0) == -1) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtocentry failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromreadtocentry failed\n");
|
||||
return;
|
||||
}
|
||||
entry1.cdte_track = track + 1;
|
||||
|
@ -198,7 +198,7 @@ I_CDAudio_Play (int track, qboolean looping)
|
|||
entry1.cdte_track = CDROM_LEADOUT;
|
||||
}
|
||||
if (ioctl (cdfile, CDROMREADTOCENTRY, &entry1) == -1) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromreadtocentry failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromreadtocentry failed\n");
|
||||
return;
|
||||
}
|
||||
if (entry0.cdte_ctrl == CDROM_DATA_TRACK) {
|
||||
|
@ -220,14 +220,14 @@ I_CDAudio_Play (int track, qboolean looping)
|
|||
msf.cdmsf_sec1 = entry1.cdte_addr.msf.second;
|
||||
msf.cdmsf_frame1 = entry1.cdte_addr.msf.frame;
|
||||
|
||||
Sys_MaskPrintf (SYS_DEV, "%2d:%02d:%02d %2d:%02d:%02d\n",
|
||||
Sys_MaskPrintf (SYS_SND, "%2d:%02d:%02d %2d:%02d:%02d\n",
|
||||
msf.cdmsf_min0,
|
||||
msf.cdmsf_sec0,
|
||||
msf.cdmsf_frame0,
|
||||
msf.cdmsf_min1, msf.cdmsf_sec1, msf.cdmsf_frame1);
|
||||
|
||||
if (ioctl (cdfile, CDROMPLAYMSF, &msf) == -1) {
|
||||
Sys_MaskPrintf (SYS_DEV,
|
||||
Sys_MaskPrintf (SYS_SND,
|
||||
"CDAudio: ioctl cdromplaytrkind failed (%s)\n",
|
||||
strerror (errno));
|
||||
return;
|
||||
|
@ -254,7 +254,7 @@ I_CDAudio_Resume (void)
|
|||
return;
|
||||
|
||||
if (ioctl (cdfile, CDROMRESUME) == -1)
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromresume failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromresume failed\n");
|
||||
playing = true;
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ I_CDAudio_Update (void)
|
|||
lastchk = time (NULL) + 2; // two seconds between chks
|
||||
subchnl.cdsc_format = CDROM_MSF;
|
||||
if (ioctl (cdfile, CDROMSUBCHNL, &subchnl) == -1) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: ioctl cdromsubchnl failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: ioctl cdromsubchnl failed\n");
|
||||
playing = false;
|
||||
return;
|
||||
}
|
||||
|
@ -424,7 +424,7 @@ Mus_CDChange (cvar_t *mus_cdaudio)
|
|||
|
||||
cdfile = open (mus_cdaudio->string, O_RDONLY | O_NONBLOCK);
|
||||
if (cdfile == -1) {
|
||||
Sys_MaskPrintf (SYS_DEV,
|
||||
Sys_MaskPrintf (SYS_SND,
|
||||
"Mus_CDInit: open device \"%s\" failed (error %i)\n",
|
||||
mus_cdaudio->string, errno);
|
||||
return;
|
||||
|
|
|
@ -75,7 +75,7 @@ I_CDAudio_Eject (void)
|
|||
return;
|
||||
|
||||
if (SDL_CDEject (cd_id))
|
||||
Sys_MaskPrintf (SYS_DEV, "Unable to eject CD-ROM tray.\n");
|
||||
Sys_MaskPrintf (SYS_SND, "Unable to eject CD-ROM tray.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -87,7 +87,7 @@ I_CDAudio_Pause (void)
|
|||
return;
|
||||
|
||||
if (SDL_CDPause (cd_id))
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_Pause: Failed to pause track.\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_Pause: Failed to pause track.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -102,7 +102,7 @@ I_CDAudio_Stop (void)
|
|||
return;
|
||||
|
||||
if (SDL_CDStop (cd_id))
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_Stop: Failed to stop track.\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_Stop: Failed to stop track.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -135,7 +135,7 @@ I_CDAudio_Play (int track, qboolean looping)
|
|||
|
||||
if (SDL_CDPlay (cd_id, cd_id->track[track].offset,
|
||||
cd_id->track[track].length)) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_Play: Unable to play track: %d\n",
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_Play: Unable to play track: %d\n",
|
||||
track + 1);
|
||||
return;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ I_CDAudio_Resume (void)
|
|||
return;
|
||||
|
||||
if (SDL_CDResume (cd_id))
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_Resume: Failed tp resume track.\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_Resume: Failed tp resume track.\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -73,7 +73,7 @@ I_SGI_Eject (void)
|
|||
return; // no cd init'd
|
||||
|
||||
if (CDeject (cdp) == 0)
|
||||
Sys_MaskPrintf (SYS_DEV, "I_SGI_Eject: CDeject failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "I_SGI_Eject: CDeject failed\n");
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -85,7 +85,7 @@ I_SGI_GetState (void)
|
|||
return -1; // no cd init'd
|
||||
|
||||
if (CDgetstatus (cdp, &cds) == 0) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_GetStatus: CDgetstatus failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_GetStatus: CDgetstatus failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ I_SGI_MaxTrack (void)
|
|||
return -1; // no cd init'd
|
||||
|
||||
if (CDgetstatus (cdp, &cds) == 0) {
|
||||
Sys_MaskPrintf (SYS_DEV, "I_SGI_MaxTrack: CDgetstatus failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "I_SGI_MaxTrack: CDgetstatus failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ I_SGI_Pause (void)
|
|||
return;
|
||||
|
||||
if (CDtogglepause (cdp) == 0)
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno);
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_PAUSE: CDtogglepause failed (%d)\n", errno);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -133,7 +133,7 @@ I_SGI_Play (int track, qboolean looping)
|
|||
}
|
||||
|
||||
if (maxtrack < 0) {
|
||||
Sys_MaskPrintf (SYS_DEV,
|
||||
Sys_MaskPrintf (SYS_SND,
|
||||
"CDAudio_Play: Error getting maximum track number\n");
|
||||
return;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ I_SGI_Play (int track, qboolean looping)
|
|||
}
|
||||
|
||||
if (CDplaytrack (cdp, track, cdvolume == 0.0 ? 0 : 1) == 0) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_Play: CDplay failed (%d)\n", errno);
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_Play: CDplay failed (%d)\n", errno);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ I_SGI_Resume (void)
|
|||
return;
|
||||
|
||||
if (CDtogglepause (cdp) == 0)
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_Resume: CDtogglepause failed (%d)\n",
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_Resume: CDtogglepause failed (%d)\n",
|
||||
errno);
|
||||
}
|
||||
|
||||
|
@ -211,7 +211,7 @@ I_SGI_Stop (void)
|
|||
return;
|
||||
|
||||
if (CDstop (cdp) == 0)
|
||||
Sys_MaskPrintf (SYS_DEV, "I_SGI_Stop: CDStop failed (%d)\n", errno);
|
||||
Sys_MaskPrintf (SYS_SND, "I_SGI_Stop: CDStop failed (%d)\n", errno);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -77,7 +77,7 @@ I_CDAudio_CloseDoor (void)
|
|||
dwReturn =
|
||||
mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_CLOSED, (DWORD_PTR) NULL);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "MCI_SET_DOOR_CLOSED failed (%li)\n",
|
||||
Sys_MaskPrintf (SYS_SND, "MCI_SET_DOOR_CLOSED failed (%li)\n",
|
||||
dwReturn);
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ I_CDAudio_Eject (void)
|
|||
dwReturn = mciSendCommand (wDeviceID, MCI_SET, MCI_SET_DOOR_OPEN,
|
||||
(DWORD_PTR) NULL);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn);
|
||||
Sys_MaskPrintf (SYS_SND, "MCI_SET_DOOR_OPEN failed (%li)\n", dwReturn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,12 +107,12 @@ I_CDAudio_GetAudioDiskInfo (void)
|
|||
mciSendCommand (wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT,
|
||||
(DWORD_PTR) (LPVOID) & mciStatusParms);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV,
|
||||
Sys_MaskPrintf (SYS_SND,
|
||||
"CDAudio: drive ready test - get status failed\n");
|
||||
return -1;
|
||||
}
|
||||
if (!mciStatusParms.dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: drive not ready\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: drive not ready\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -121,11 +121,11 @@ I_CDAudio_GetAudioDiskInfo (void)
|
|||
mciSendCommand (wDeviceID, MCI_STATUS, MCI_STATUS_ITEM | MCI_WAIT,
|
||||
(DWORD_PTR) (LPVOID) & mciStatusParms);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: get tracks - status failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: get tracks - status failed\n");
|
||||
return -1;
|
||||
}
|
||||
if (mciStatusParms.dwReturn < 1) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: no music tracks\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: no music tracks\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -156,13 +156,13 @@ static I_CDAudio_MessageHandler (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
|||
break;
|
||||
|
||||
case MCI_NOTIFY_FAILURE:
|
||||
Sys_MaskPrintf (SYS_DEV, "MCI_NOTIFY_FAILURE\n");
|
||||
Sys_MaskPrintf (SYS_SND, "MCI_NOTIFY_FAILURE\n");
|
||||
I_CDAudio_Stop ();
|
||||
cdValid = false;
|
||||
break;
|
||||
|
||||
default:
|
||||
Sys_MaskPrintf (SYS_DEV, "Unexpected MM_MCINOTIFY type (%i)\n",
|
||||
Sys_MaskPrintf (SYS_SND, "Unexpected MM_MCINOTIFY type (%i)\n",
|
||||
wParam);
|
||||
return 1;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ I_CDAudio_Pause (void)
|
|||
mciSendCommand (wDeviceID, MCI_PAUSE, 0,
|
||||
(DWORD_PTR) (LPVOID) & mciGenericParms);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "MCI_PAUSE failed (%li)", dwReturn);
|
||||
Sys_MaskPrintf (SYS_SND, "MCI_PAUSE failed (%li)", dwReturn);
|
||||
}
|
||||
|
||||
wasPlaying = playing;
|
||||
|
@ -228,7 +228,7 @@ I_CDAudio_Play (int track, qboolean looping)
|
|||
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
|
||||
(DWORD_PTR) (LPVOID) & mciStatusParms);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "MCI_STATUS failed (%li)\n", dwReturn);
|
||||
Sys_MaskPrintf (SYS_SND, "MCI_STATUS failed (%li)\n", dwReturn);
|
||||
return;
|
||||
}
|
||||
if (mciStatusParms.dwReturn != MCI_CDA_TRACK_AUDIO) {
|
||||
|
@ -243,7 +243,7 @@ I_CDAudio_Play (int track, qboolean looping)
|
|||
MCI_STATUS_ITEM | MCI_TRACK | MCI_WAIT,
|
||||
(DWORD_PTR) (LPVOID) & mciStatusParms);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "MCI_STATUS failed (%li)\n", dwReturn);
|
||||
Sys_MaskPrintf (SYS_SND, "MCI_STATUS failed (%li)\n", dwReturn);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ I_CDAudio_Play (int track, qboolean looping)
|
|||
mciSendCommand (wDeviceID, MCI_PLAY, MCI_NOTIFY | MCI_FROM | MCI_TO,
|
||||
(DWORD_PTR) (LPVOID) & mciPlayParms);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -292,7 +292,7 @@ I_CDAudio_Resume (void)
|
|||
mciSendCommand (wDeviceID, MCI_PLAY, MCI_TO | MCI_NOTIFY,
|
||||
(DWORD_PTR) (LPVOID) & mciPlayParms);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio: MCI_PLAY failed (%li)\n", dwReturn);
|
||||
return;
|
||||
}
|
||||
playing = true;
|
||||
|
@ -305,7 +305,7 @@ I_CDAudio_Shutdown (void)
|
|||
return;
|
||||
I_CDAudio_Stop ();
|
||||
if (mciSendCommand (wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD_PTR) NULL))
|
||||
Sys_MaskPrintf (SYS_DEV, "CDAudio_Shutdown: MCI_CLOSE failed\n");
|
||||
Sys_MaskPrintf (SYS_SND, "CDAudio_Shutdown: MCI_CLOSE failed\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -320,7 +320,7 @@ I_CDAudio_Stop (void)
|
|||
|
||||
dwReturn = mciSendCommand (wDeviceID, MCI_STOP, 0, (DWORD_PTR) NULL);
|
||||
if (dwReturn) {
|
||||
Sys_MaskPrintf (SYS_DEV, "MCI_STOP failed (%li)", dwReturn);
|
||||
Sys_MaskPrintf (SYS_SND, "MCI_STOP failed (%li)", dwReturn);
|
||||
}
|
||||
|
||||
wasPlaying = false;
|
||||
|
|
|
@ -152,7 +152,7 @@ I_XMMS_Running (void)
|
|||
break;
|
||||
case -1: // ICH!
|
||||
// inform user
|
||||
Sys_MaskPrintf (SYS_DEV, "XMMSAudio: error, can't fork!?\n");
|
||||
Sys_MaskPrintf (SYS_SND, "XMMSAudio: error, can't fork!?\n");
|
||||
break;
|
||||
default: // Parent
|
||||
// don't need now :/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
AUTOMAKE_OPTIONS= foreign
|
||||
|
||||
AM_CFLAGS= @PREFER_PIC@ @VORBIS_CFLAGS@ @OGG_CFLAGS@
|
||||
AM_CFLAGS= @PREFER_PIC@ @VORBIS_CFLAGS@ @OGG_CFLAGS@ @SAMPLERATE_CFLAGS@
|
||||
INCLUDES= -I$(top_srcdir)/include
|
||||
plugin_ldflags= @plugin_ldflags@ -avoid-version -module -rpath $(plugindir)
|
||||
plugin_libadd= @plugin_libadd@
|
||||
|
@ -39,12 +39,12 @@ snd_common=snd_channels.c snd_mem.c snd_mix.c snd_resample.c snd_sfx.c
|
|||
|
||||
snd_render_default_la_LDFLAGS= $(plugin_ldflags)
|
||||
snd_render_default_la_SOURCES= snd_dma.c $(snd_common) $(format_src)
|
||||
snd_render_default_la_LIBADD= $(SAMPLERATE_LIBS) $(VORBISFILE_LIBS) $(VORBIS_LIBS) $(LIBFLAC_LIBS) $(OGG_LIBS) $(WM_LIBS) $(top_builddir)/libs/util/libQFutil.la $(top_builddir)/libs/models/libQFmodels.la
|
||||
snd_render_default_la_LIBADD= $(SAMPLERATE_LIBS) $(VORBISFILE_LIBS) $(VORBIS_LIBS) $(FLAC_LIBS) $(OGG_LIBS) $(WM_LIBS) $(top_builddir)/libs/util/libQFutil.la $(top_builddir)/libs/models/libQFmodels.la
|
||||
snd_render_default_la_DEPENDENCIES=
|
||||
EXTRA_snd_render_default_la_SOURCES= $(extra_format_src)
|
||||
|
||||
snd_render_jack_la_LDFLAGS= $(plugin_ldflags)
|
||||
snd_render_jack_la_SOURCES= snd_jack.c $(snd_common) $(format_src)
|
||||
snd_render_jack_la_LIBADD= $(SAMPLERATE_LIBS) $(VORBISFILE_LIBS) $(VORBIS_LIBS) $(LIBFLAC_LIBS) $(OGG_LIBS) $(WM_LIBS) $(JACK_LIBS) $(top_builddir)/libs/util/libQFutil.la $(top_builddir)/libs/models/libQFmodels.la
|
||||
snd_render_jack_la_LIBADD= $(SAMPLERATE_LIBS) $(VORBISFILE_LIBS) $(VORBIS_LIBS) $(FLAC_LIBS) $(OGG_LIBS) $(WM_LIBS) $(JACK_LIBS) $(top_builddir)/libs/util/libQFutil.la $(top_builddir)/libs/models/libQFmodels.la
|
||||
snd_render_jack_la_DEPENDENCIES=
|
||||
EXTRA_snd_render_jack_la_SOURCES= $(extra_format_src)
|
||||
|
|
|
@ -64,7 +64,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#ifdef LEGACY_FLAC
|
||||
#define FLAC__StreamDecoder FLAC__SeekableStreamDecoder
|
||||
|
|
|
@ -45,7 +45,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/sys.h"
|
||||
#include "QF/quakefs.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#define FRAMES 1024
|
||||
#define CHANNELS 2
|
||||
|
|
|
@ -50,7 +50,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/quakefs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
static channel_t *free_channels;
|
||||
channel_t snd_channels[MAX_CHANNELS];
|
||||
|
|
|
@ -53,7 +53,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/va.h"
|
||||
#include "QF/quakefs.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
static qboolean snd_initialized = false;
|
||||
static int snd_blocked = 0;
|
||||
|
@ -73,26 +73,25 @@ static general_data_t plugin_info_general_data;
|
|||
static snd_output_funcs_t *snd_output_funcs;
|
||||
|
||||
static void
|
||||
s_xfer_paint_buffer (int endtime)
|
||||
s_xfer_paint_buffer (portable_samplepair_t *paintbuffer, int count,
|
||||
float volume)
|
||||
{
|
||||
int count, out_idx, out_max, step, val;
|
||||
float snd_vol;
|
||||
int out_idx, out_max, step, val;
|
||||
float *p;
|
||||
|
||||
p = (float *) snd_paintbuffer;
|
||||
count = (endtime - snd_paintedtime) * snd_shm->channels;
|
||||
p = (float *) paintbuffer;
|
||||
count *= snd_shm->channels;
|
||||
out_max = (snd_shm->frames * snd_shm->channels) - 1;
|
||||
out_idx = snd_paintedtime * snd_shm->channels;
|
||||
while (out_idx > out_max)
|
||||
out_idx -= out_max + 1;
|
||||
step = 3 - snd_shm->channels;
|
||||
snd_vol = snd_volume->value;
|
||||
|
||||
if (snd_shm->samplebits == 16) {
|
||||
short *out = (short *) snd_shm->buffer;
|
||||
|
||||
while (count--) {
|
||||
val = (*p * snd_vol) * 0x8000;
|
||||
val = (*p * volume) * 0x8000;
|
||||
p += step;
|
||||
if (val > 0x7fff)
|
||||
val = 0x7fff;
|
||||
|
@ -106,7 +105,7 @@ s_xfer_paint_buffer (int endtime)
|
|||
unsigned char *out = (unsigned char *) snd_shm->buffer;
|
||||
|
||||
while (count--) {
|
||||
val = (*p * snd_vol) * 128;
|
||||
val = (*p * volume) * 128;
|
||||
p += step;
|
||||
if (val > 0x7f)
|
||||
val = 0x7f;
|
||||
|
@ -289,7 +288,8 @@ s_startup (void)
|
|||
sound_started = 0;
|
||||
return;
|
||||
}
|
||||
snd_shm->xfer = s_xfer_paint_buffer;
|
||||
if (!snd_shm->xfer)
|
||||
snd_shm->xfer = s_xfer_paint_buffer;
|
||||
|
||||
sound_started = 1;
|
||||
}
|
||||
|
|
|
@ -48,11 +48,13 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
static int sound_started = 0;
|
||||
static int snd_blocked = 0;
|
||||
static int snd_shutdown = 0;
|
||||
static int snd_alive = 0;
|
||||
static double snd_alive_time = 0;
|
||||
static jack_client_t *jack_handle;
|
||||
static jack_port_t *jack_out[2];
|
||||
static dma_t _snd_shm;
|
||||
|
@ -78,12 +80,38 @@ s_start_sound (int entnum, int entchannel, sfx_t *sfx, const vec3_t origin,
|
|||
SND_StartSound (entnum, entchannel, sfx, origin, fvol, attenuation);
|
||||
}
|
||||
|
||||
static void
|
||||
s_finish_channels (void)
|
||||
{
|
||||
int i;
|
||||
channel_t *ch;
|
||||
|
||||
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||
ch = &snd_channels[i];
|
||||
ch->done = ch->stop = 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
s_update (const vec3_t origin, const vec3_t forward, const vec3_t right,
|
||||
const vec3_t up)
|
||||
{
|
||||
double now = Sys_DoubleTime ();
|
||||
|
||||
if (!sound_started)
|
||||
return;
|
||||
if (snd_alive) {
|
||||
snd_alive = 0;
|
||||
snd_alive_time = now;
|
||||
} else {
|
||||
if (!snd_shutdown) {
|
||||
if (now - snd_alive_time > 1.0) {
|
||||
Sys_Printf ("jackd client thread seems to have died\n");
|
||||
s_finish_channels ();
|
||||
snd_shutdown = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (snd_shutdown) {
|
||||
if (snd_shutdown == 1) {
|
||||
snd_shutdown++;
|
||||
|
@ -120,8 +148,10 @@ s_jack_activate (void)
|
|||
}
|
||||
ports = jack_get_ports (jack_handle, 0, 0,
|
||||
JackPortIsPhysical | JackPortIsInput);
|
||||
//for (i = 0; ports[i]; i++)
|
||||
// Sys_Printf ("%s\n", ports[i]);
|
||||
if (developer->int_val & SYS_SND) {
|
||||
for (i = 0; ports[i]; i++)
|
||||
Sys_Printf ("%s\n", ports[i]);
|
||||
}
|
||||
for (i = 0; i < 2; i++)
|
||||
jack_connect (jack_handle, jack_port_name (jack_out[i]), ports[i]);
|
||||
free (ports);
|
||||
|
@ -228,13 +258,10 @@ s_channel_stop (channel_t *chan)
|
|||
}
|
||||
|
||||
static void
|
||||
snd_jack_xfer (int endtime)
|
||||
snd_jack_xfer (portable_samplepair_t *paintbuffer, int count, float volume)
|
||||
{
|
||||
int i;
|
||||
int count;
|
||||
float snd_vol = snd_volume->value;
|
||||
|
||||
count = endtime - snd_paintedtime;
|
||||
if (snd_blocked) {
|
||||
for (i = 0; i < count; i++) {
|
||||
*output[0]++ = 0;
|
||||
|
@ -244,8 +271,8 @@ snd_jack_xfer (int endtime)
|
|||
}
|
||||
for (i = 0; i < count; i++) {
|
||||
/* max is +/- 1.0. need to implement clamping. */
|
||||
*output[0]++ = snd_vol * snd_paintbuffer[i].left;
|
||||
*output[1]++ = snd_vol * snd_paintbuffer[i].right;
|
||||
*output[0]++ = volume * snd_paintbuffer[i].left;
|
||||
*output[1]++ = volume * snd_paintbuffer[i].right;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +281,7 @@ snd_jack_process (jack_nframes_t nframes, void *arg)
|
|||
{
|
||||
int i;
|
||||
|
||||
snd_alive = 1;
|
||||
for (i = 0; i < 2; i++)
|
||||
output[i] = (float *) jack_port_get_buffer (jack_out[i], nframes);
|
||||
SND_PaintChannels (snd_paintedtime + nframes);
|
||||
|
@ -263,13 +291,21 @@ snd_jack_process (jack_nframes_t nframes, void *arg)
|
|||
static void
|
||||
snd_jack_shutdown (void *arg)
|
||||
{
|
||||
int i;
|
||||
channel_t *ch;
|
||||
snd_shutdown = 1;
|
||||
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||
ch = &snd_channels[i];
|
||||
ch->done = ch->stop = 1;
|
||||
}
|
||||
s_finish_channels ();
|
||||
}
|
||||
|
||||
static void
|
||||
snd_jack_error (const char *desc)
|
||||
{
|
||||
fprintf (stderr, "snd_jack: %s\n", desc);
|
||||
}
|
||||
|
||||
static int
|
||||
snd_jack_xrun (void *arg)
|
||||
{
|
||||
fprintf (stderr, "snd_jack: xrun\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -291,12 +327,15 @@ s_init (void)
|
|||
SND_SFX_Init ();
|
||||
SND_Channels_Init ();
|
||||
|
||||
jack_set_error_function (snd_jack_error);
|
||||
if ((jack_handle = jack_client_open ("QuakeForge",
|
||||
JackServerName | JackNoStartServer, 0,
|
||||
snd_jack_server->string)) == 0) {
|
||||
Sys_Printf ("Could not connect to JACK\n");
|
||||
return;
|
||||
}
|
||||
if (jack_set_xrun_callback (jack_handle, snd_jack_xrun, 0))
|
||||
Sys_Printf ("Could not set xrun callback\n");
|
||||
jack_set_process_callback (jack_handle, snd_jack_process, 0);
|
||||
jack_on_shutdown (jack_handle, snd_jack_shutdown, 0);
|
||||
for (i = 0; i < 2; i++)
|
||||
|
|
|
@ -38,7 +38,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MALLOC_H
|
||||
#if defined(_WIN32) && defined(HAVE_MALLOC_H)
|
||||
#include <malloc.h>
|
||||
#endif
|
||||
|
||||
|
@ -50,7 +50,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/quakefs.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#define SAMPLE_GAP 4
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/sys.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#define VOLSCALE 512.0 // so mixing is less likely to overflow
|
||||
// note: must be >= 255 due to the channel
|
||||
|
@ -174,7 +174,8 @@ SND_PaintChannels (unsigned endtime)
|
|||
}
|
||||
|
||||
// transfer out according to DMA format
|
||||
snd_shm->xfer (end);
|
||||
snd_shm->xfer (snd_paintbuffer, end - snd_paintedtime,
|
||||
snd_volume->value);
|
||||
|
||||
memmove (snd_paintbuffer, snd_paintbuffer + end - snd_paintedtime,
|
||||
max_overpaint * sizeof (snd_paintbuffer[0]));
|
||||
|
|
|
@ -48,7 +48,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/quakefs.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
typedef struct {
|
||||
float *data;
|
||||
|
|
|
@ -49,7 +49,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/sys.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#define MAX_SFX 512
|
||||
static sfx_t snd_sfx[MAX_SFX];
|
||||
|
|
|
@ -49,7 +49,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/sound.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#define FRAMES 1024
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/quakefs.h"
|
||||
#include "QF/riff.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#define FRAMES 1024
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
static int snd_inited;
|
||||
static int snd_blocked = 0;
|
||||
|
@ -119,6 +119,82 @@ round_buffer_size (snd_pcm_uframes_t sz)
|
|||
return sz;
|
||||
}
|
||||
|
||||
static inline int
|
||||
clamp_16 (int val)
|
||||
{
|
||||
if (val > 0x7fff)
|
||||
val = 0x7fff;
|
||||
else if (val < -0x8000)
|
||||
val = -0x8000;
|
||||
return val;
|
||||
}
|
||||
|
||||
static inline int
|
||||
clamp_8 (int val)
|
||||
{
|
||||
if (val > 0x7f)
|
||||
val = 0x7f;
|
||||
else if (val < -0x80)
|
||||
val = -0x80;
|
||||
return val;
|
||||
}
|
||||
|
||||
static void
|
||||
SNDDMA_ni_xfer (portable_samplepair_t *paintbuffer, int count, float volume)
|
||||
{
|
||||
const snd_pcm_channel_area_t *areas;
|
||||
int out_idx, out_max;
|
||||
float *p;
|
||||
|
||||
areas = sn.xfer_data;
|
||||
|
||||
p = (float *) paintbuffer;
|
||||
out_max = sn.frames - 1;
|
||||
out_idx = *plugin_info_snd_output_data.paintedtime;
|
||||
while (out_idx > out_max)
|
||||
out_idx -= out_max + 1;
|
||||
|
||||
if (sn.samplebits == 16) {
|
||||
short *out_0 = (short *) areas[0].addr;
|
||||
short *out_1 = (short *) areas[1].addr;
|
||||
|
||||
if (sn.channels == 2) {
|
||||
while (count--) {
|
||||
out_0[out_idx] = clamp_16 ((*p++ * volume) * 0x8000);
|
||||
out_1[out_idx] = clamp_16 ((*p++ * volume) * 0x8000);
|
||||
if (out_idx++ > out_max)
|
||||
out_idx = 0;
|
||||
}
|
||||
} else {
|
||||
while (count--) {
|
||||
out_0[out_idx] = clamp_16 ((*p++ * volume) * 0x8000);
|
||||
p++; // skip right channel
|
||||
if (out_idx++ > out_max)
|
||||
out_idx = 0;
|
||||
}
|
||||
}
|
||||
} else if (sn.samplebits == 8) {
|
||||
byte *out_0 = (byte *) areas[0].addr;
|
||||
byte *out_1 = (byte *) areas[1].addr;
|
||||
|
||||
if (sn.channels == 2) {
|
||||
while (count--) {
|
||||
out_0[out_idx] = clamp_8 ((*p++ * volume) * 0x80);
|
||||
out_1[out_idx] = clamp_8 ((*p++ * volume) * 0x80);
|
||||
if (out_idx++ > out_max)
|
||||
out_idx = 0;
|
||||
}
|
||||
} else {
|
||||
while (count--) {
|
||||
out_0[out_idx] = clamp_8 ((*p++ * volume) * 0x8000);
|
||||
p++; // skip right channel
|
||||
if (out_idx++ > out_max)
|
||||
out_idx = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static volatile dma_t *
|
||||
SNDDMA_Init (void)
|
||||
{
|
||||
|
@ -151,14 +227,13 @@ SNDDMA_Init (void)
|
|||
stereo = snd_stereo->int_val;
|
||||
if (!pcmname)
|
||||
pcmname = "default";
|
||||
|
||||
retry_open:
|
||||
err = qfsnd_pcm_open (&pcm, pcmname, SND_PCM_STREAM_PLAYBACK,
|
||||
SND_PCM_NONBLOCK);
|
||||
if (0 > err) {
|
||||
Sys_Printf ("Error: audio open error: %s\n", qfsnd_strerror (err));
|
||||
return 0;
|
||||
}
|
||||
Sys_Printf ("Using PCM %s.\n", pcmname);
|
||||
|
||||
err = qfsnd_pcm_hw_params_any (pcm, hw);
|
||||
if (0 > err) {
|
||||
|
@ -170,11 +245,26 @@ SNDDMA_Init (void)
|
|||
err = qfsnd_pcm_hw_params_set_access (pcm, hw,
|
||||
SND_PCM_ACCESS_MMAP_INTERLEAVED);
|
||||
if (0 > err) {
|
||||
Sys_Printf ("ALSA: Failure to set noninterleaved PCM access. %s\n"
|
||||
"Note: Interleaved is not supported\n",
|
||||
qfsnd_strerror (err));
|
||||
goto error;
|
||||
Sys_MaskPrintf (SYS_SND, "ALSA: Failure to set interleaved PCM "
|
||||
"access. %s\n", qfsnd_strerror (err));
|
||||
err = qfsnd_pcm_hw_params_set_access (pcm, hw,
|
||||
SND_PCM_ACCESS_MMAP_NONINTERLEAVED);
|
||||
if (0 > err) {
|
||||
Sys_MaskPrintf (SYS_SND, "ALSA: Failure to set noninterleaved PCM "
|
||||
"access. %s\n", qfsnd_strerror (err));
|
||||
// "default" did not work, so retry with "plughw". However do not
|
||||
// second guess the user, even if the user specified "default".
|
||||
if (!snd_device->string[0] && !strcmp (pcmname, "default")) {
|
||||
pcmname = "plughw";
|
||||
goto retry_open;
|
||||
}
|
||||
Sys_Printf ("ALSA: could not set mmap access\n");
|
||||
goto error;
|
||||
}
|
||||
sn.xfer = SNDDMA_ni_xfer;
|
||||
}
|
||||
Sys_Printf ("Using PCM %s.\n", pcmname);
|
||||
|
||||
|
||||
switch (bps) {
|
||||
case -1:
|
||||
|
@ -237,32 +327,36 @@ SNDDMA_Init (void)
|
|||
|
||||
switch (rate) {
|
||||
case 0:
|
||||
rate = 44100;
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 <= err) {
|
||||
frag_size = 32 * bps;
|
||||
} else {
|
||||
rate = 22050;
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 <= err) {
|
||||
frag_size = 16 * bps;
|
||||
} else {
|
||||
rate = 11025;
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw, &rate,
|
||||
0);
|
||||
{
|
||||
int rates[] = {
|
||||
48000,
|
||||
44100,
|
||||
22050,
|
||||
11025,
|
||||
0
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; rates[i]; i++) {
|
||||
rate = rates[i];
|
||||
Sys_MaskPrintf (SYS_SND, "ALSA: trying %dHz\n", rate);
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw,
|
||||
&rate, 0);
|
||||
if (0 <= err) {
|
||||
frag_size = 8 * bps;
|
||||
} else {
|
||||
Sys_Printf ("ALSA: no usable rates. %s\n",
|
||||
qfsnd_strerror (err));
|
||||
goto error;
|
||||
frag_size = 8 * bps * (rate / 11025);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
if (!rates[i]) {
|
||||
Sys_Printf ("ALSA: no usable rates. %s\n",
|
||||
qfsnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
} break;
|
||||
case 11025:
|
||||
case 22050:
|
||||
case 44100:
|
||||
case 48000:
|
||||
default:
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 > err) {
|
||||
|
@ -367,7 +461,8 @@ SNDDMA_GetDMAPos (void)
|
|||
qfsnd_pcm_avail_update (pcm);
|
||||
qfsnd_pcm_mmap_begin (pcm, &areas, &offset, &nframes);
|
||||
sn.framepos = offset;
|
||||
sn.buffer = areas->addr; //XXX FIXME there's an area per channel
|
||||
sn.buffer = areas->addr;
|
||||
sn.xfer_data = (void *) areas;
|
||||
return sn.framepos;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
static int snd_inited;
|
||||
static QFile *snd_file;
|
||||
|
@ -68,30 +68,29 @@ static snd_output_data_t plugin_info_snd_output_data;
|
|||
static snd_output_funcs_t plugin_info_snd_output_funcs;
|
||||
|
||||
|
||||
/* FIXME
|
||||
static volatile dma_t *
|
||||
SNDDMA_Init (void)
|
||||
{
|
||||
memset ((dma_t *) sn, 0, sizeof (sn));
|
||||
memset ((dma_t *) &sn, 0, sizeof (sn));
|
||||
sn.channels = 2;
|
||||
sn.submission_chunk = 1; // don't mix less than this #
|
||||
sn.samplepos = 0; // in mono samples
|
||||
sn.framepos = 0;
|
||||
sn.samplebits = 16;
|
||||
sn.samples = 16384; // mono samples in buffer
|
||||
sn.frames = 16384;
|
||||
sn.speed = 44100;
|
||||
sn.buffer = malloc (sn.samples * sn.channels * sn.samplebits / 8);
|
||||
sn.buffer = malloc (sn.frames * sn.channels * sn.samplebits / 8);
|
||||
if (!sn.buffer) {
|
||||
Sys_Printf ("SNDDMA_Init: memory allocation failure\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Sys_Printf ("%5d stereo\n", sn.channels - 1);
|
||||
Sys_Printf ("%5d samples\n", sn.samples);
|
||||
Sys_Printf ("%5d samplepos\n", sn.samplepos);
|
||||
Sys_Printf ("%5d channels\n", sn.channels - 1);
|
||||
Sys_Printf ("%5d samples\n", sn.frames);
|
||||
Sys_Printf ("%5d samplepos\n", sn.framepos);
|
||||
Sys_Printf ("%5d samplebits\n", sn.samplebits);
|
||||
Sys_Printf ("%5d submission_chunk\n", sn.submission_chunk);
|
||||
Sys_Printf ("%5d speed\n", sn.speed);
|
||||
Sys_Printf ("0x%x dma buffer\n", (int) sn.buffer);
|
||||
Sys_Printf ("0x%lx dma buffer\n", (long) sn.buffer);
|
||||
|
||||
if (!(snd_file = Qopen ("qf.raw", "wb")))
|
||||
return 0;
|
||||
|
@ -99,7 +98,11 @@ SNDDMA_Init (void)
|
|||
snd_inited = 1;
|
||||
return &sn;
|
||||
}
|
||||
*/
|
||||
|
||||
static void
|
||||
SNDDMA_Init_Cvars (void)
|
||||
{
|
||||
}
|
||||
|
||||
static int
|
||||
SNDDMA_GetDMAPos (void)
|
||||
|
@ -172,8 +175,10 @@ PLUGIN_INFO(snd_output, disk)
|
|||
plugin_info_funcs.input = NULL;
|
||||
plugin_info_funcs.snd_output = &plugin_info_snd_output_funcs;
|
||||
|
||||
// plugin_info_general_funcs.p_Init = SNDDMA_Init; // FIXME
|
||||
plugin_info_general_funcs.p_Shutdown = SNDDMA_Shutdown;
|
||||
plugin_info_general_funcs.p_Init = SNDDMA_Init_Cvars;
|
||||
plugin_info_general_funcs.p_Shutdown = NULL;
|
||||
plugin_info_snd_output_funcs.pS_O_Init = SNDDMA_Init;
|
||||
plugin_info_snd_output_funcs.pS_O_Shutdown = SNDDMA_Shutdown;
|
||||
plugin_info_snd_output_funcs.pS_O_GetDMAPos = SNDDMA_GetDMAPos;
|
||||
plugin_info_snd_output_funcs.pS_O_Submit = SNDDMA_Submit;
|
||||
plugin_info_snd_output_funcs.pS_O_BlockSound = SNDDMA_BlockSound;
|
||||
|
|
|
@ -40,7 +40,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#define iDirectSoundCreate(a,b,c) pDirectSoundCreate(a,b,c)
|
||||
|
||||
|
@ -406,8 +406,9 @@ SNDDMA_GetDMAPos (void)
|
|||
s /= sn.channels;
|
||||
|
||||
s %= sn.frames;
|
||||
sn.framepos = s;
|
||||
|
||||
return s;
|
||||
return sn.framepos;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -72,7 +72,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
#ifndef MAP_FAILED
|
||||
# define MAP_FAILED ((void *) -1)
|
||||
|
|
|
@ -49,7 +49,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
static dma_t sn;
|
||||
static int snd_inited;
|
||||
|
|
|
@ -42,7 +42,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/qtypes.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
static int snd_inited = 0;
|
||||
static ALconfig alc;
|
||||
|
|
|
@ -36,6 +36,12 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#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 <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
@ -53,13 +59,13 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/qtypes.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
static int audio_fd;
|
||||
static int snd_inited;
|
||||
static int snd_blocked = 0;
|
||||
|
||||
static int wbufp;
|
||||
static unsigned int wbufp;
|
||||
static audio_info_t info;
|
||||
|
||||
#define BUFFER_SIZE 8192
|
||||
|
@ -141,8 +147,8 @@ SNDDMA_Init (void)
|
|||
sn.channels = 2;
|
||||
}
|
||||
|
||||
sn.samples = sizeof (dma_buffer) / (sn.samplebits / 8);
|
||||
sn.samplepos = 0;
|
||||
sn.frames = sizeof (dma_buffer) / (sn.samplebits / 8);
|
||||
sn.framepos = 0;
|
||||
sn.submission_chunk = 1;
|
||||
sn.buffer = (unsigned char *) dma_buffer;
|
||||
|
||||
|
@ -165,9 +171,10 @@ SNDDMA_GetDMAPos (void)
|
|||
return (0);
|
||||
}
|
||||
|
||||
return ((info.play.samples * sn.channels) % sn.samples);
|
||||
sn.framepos = ((info.play.samples * sn.channels) % sn.frames);
|
||||
return sn.framepos;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
SNDDMA_GetSamples (void)
|
||||
{
|
||||
|
@ -184,7 +191,7 @@ SNDDMA_GetSamples (void)
|
|||
|
||||
return info.play.samples;
|
||||
}
|
||||
|
||||
#endif
|
||||
static void
|
||||
SNDDMA_Shutdown (void)
|
||||
{
|
||||
|
@ -219,7 +226,7 @@ SNDDMA_Submit (void)
|
|||
if (!bytes)
|
||||
return;
|
||||
|
||||
if (bytes > sizeof (writebuf)) {
|
||||
if (bytes > (int) sizeof (writebuf)) {
|
||||
bytes = sizeof (writebuf);
|
||||
stop = wbufp + bytes / bsize;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
|||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "snd_render.h"
|
||||
#include "snd_internal.h"
|
||||
|
||||
// 64K is > 1 second at 16-bit, 22050 Hz
|
||||
#define WAV_BUFFERS 64
|
||||
|
@ -298,8 +298,9 @@ SNDDMA_GetDMAPos (void)
|
|||
s /= sn.channels;
|
||||
|
||||
s %= sn.frames;
|
||||
sn.framepos = s;
|
||||
|
||||
return s;
|
||||
return sn.framepos;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -316,7 +317,7 @@ SNDDMA_Submit (void)
|
|||
// find which sound blocks have completed
|
||||
while (1) {
|
||||
if (snd_completed == snd_sent) {
|
||||
Sys_MaskPrintf (SYS_DEV, "Sound overrun\n");
|
||||
Sys_MaskPrintf (SYS_SND, "Sound overrun\n");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue