diff --git a/Makefile b/Makefile
index 826bf23..fc3bcda 100644
--- a/Makefile
+++ b/Makefile
@@ -21,11 +21,11 @@ else
COMPILE_ARCH=$(shell uname -m | sed -e s/i.86/x86/)
endif
-BUILD_CLIENT =0
-BUILD_CLIENT_SMP =0
-BUILD_SERVER =0
-BUILD_GAME_SO =0
-BUILD_GAME_QVM =1
+BUILD_CLIENT = 0
+BUILD_CLIENT_SMP = 0
+BUILD_SERVER = 0
+BUILD_GAME_SO = 0
+BUILD_GAME_QVM = 1
#############################################################################
#
@@ -115,10 +115,6 @@ ifndef USE_LOCAL_HEADERS
USE_LOCAL_HEADERS=1
endif
-ifndef BUILD_MASTER_SERVER
-BUILD_MASTER_SERVER=0
-endif
-
#############################################################################
BD=$(BUILD_DIR)/debug-$(PLATFORM)-$(ARCH)
@@ -137,7 +133,6 @@ JPDIR=$(MOUNT_DIR)/jpeg-6
TOOLSDIR=$(MOUNT_DIR)/tools
SDLHDIR=$(MOUNT_DIR)/SDL12
LIBSDIR=$(MOUNT_DIR)/libs
-MASTERDIR=$(MOUNT_DIR)/master
# extract version info
VERSION=$(shell grep "\#define VERSION_NUMBER" $(CMDIR)/q_shared.h | \
@@ -712,17 +707,13 @@ endif
ifneq ($(BUILD_GAME_SO),0)
TARGETS += \
- $(B)/base/cgame$(ARCH).$(SHLIBEXT) \
- $(B)/base/game$(ARCH).$(SHLIBEXT) \
- $(B)/base/ui$(ARCH).$(SHLIBEXT)
+ $(B)/base/game$(ARCH).$(SHLIBEXT)
endif
ifneq ($(BUILD_GAME_QVM),0)
ifneq ($(CROSS_COMPILING),1)
TARGETS += \
- $(B)/base/vm/cgame.qvm \
- $(B)/base/vm/game.qvm \
- $(B)/base/vm/ui.qvm
+ $(B)/base/vm/game.qvm
endif
endif
@@ -796,15 +787,9 @@ all: debug release
debug:
@$(MAKE) targets B=$(BD) CFLAGS="$(CFLAGS) $(DEBUG_CFLAGS)"
-ifeq ($(BUILD_MASTER_SERVER),1)
- $(MAKE) -C $(MASTERDIR) debug
-endif
release:
@$(MAKE) targets B=$(BR) CFLAGS="$(CFLAGS) $(RELEASE_CFLAGS)"
-ifeq ($(BUILD_MASTER_SERVER),1)
- $(MAKE) -C $(MASTERDIR) release
-endif
# Create the build directories and tools, print out
# an informational message, then start building
@@ -886,6 +871,7 @@ Q3OBJ = \
\
$(B)/client/cmd.o \
$(B)/client/common.o \
+ $(B)/client/crypto.o \
$(B)/client/cvar.o \
$(B)/client/files.o \
$(B)/client/md4.o \
@@ -1089,6 +1075,7 @@ Q3DOBJ = \
$(B)/ded/cm_trace.o \
$(B)/ded/cmd.o \
$(B)/ded/common.o \
+ $(B)/ded/crypto.o \
$(B)/ded/cvar.o \
$(B)/ded/files.o \
$(B)/ded/md4.o \
@@ -1364,7 +1351,6 @@ $(B)/base/qcommon/%.asm: $(CMDIR)/%.c
#############################################################################
clean: clean-debug clean-release
- @$(MAKE) -C $(MASTERDIR) clean
clean2:
@echo "CLEAN $(B)"
diff --git a/make-macosx-ub.sh b/make-macosx-ub.sh
deleted file mode 100644
index 7767373..0000000
--- a/make-macosx-ub.sh
+++ /dev/null
@@ -1,95 +0,0 @@
-#!/bin/sh
-APPBUNDLE=Tremulous.app
-BINARY=Tremulous.ub
-PKGINFO=APPLTREM
-ICNS=src/unix/MacSupport/Tremulous.icns
-DESTDIR=build/release-darwin-ub
-BASEDIR=base
-Q3_VERSION=`grep "\#define Q3_VERSION" src/qcommon/q_shared.h | \
- sed -e 's/.*".* \([^ ]*\)"/\1/'`;
-
-BIN_OBJ="
- build/release-darwin-ppc/tremulous.ppc
- build/release-darwin-x86/tremulous.x86
-"
-BASE_OBJ="
- build/release-darwin-ppc/$BASEDIR/cgameppc.dylib
- build/release-darwin-x86/$BASEDIR/cgamex86.dylib
- build/release-darwin-ppc/$BASEDIR/uippc.dylib
- build/release-darwin-x86/$BASEDIR/uix86.dylib
- build/release-darwin-ppc/$BASEDIR/gameppc.dylib
- build/release-darwin-x86/$BASEDIR/gamex86.dylib
-"
-if [ ! -f Makefile ]; then
- echo "This script must be run from the Tremulous build directory";
-fi
-
-if [ ! -d /Developer/SDKs/MacOSX10.2.8.sdk ]; then
- echo "
-/Developer/SDKs/MacOSX10.2.8.sdk/ is missing, this doesn't install by default
-with newer XCode releases, but the installers is included"
- exit 1;
-fi
-
-if [ ! -d /Developer/SDKs/MacOSX10.4u.sdk ]; then
- echo "
-/Developer/SDKs/MacOSX10.4u.sdk/ is missing. You must install XCode 2.2 or
-newer in order to build Universal Binaries"
- exit 1;
-fi
-
-(BUILD_MACOSX_UB=ppc make && BUILD_MACOSX_UB=x86 make) || exit 1;
-
-echo "Creating .app bundle $DESTDIR/$APPBUNDLE"
-if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR ]; then
- mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR || exit 1;
-fi
-if [ ! -d $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR ]; then
- mkdir -p $DESTDIR/$APPBUNDLE/Contents/MacOS/$MPACKDIR || exit 1;
-fi
-if [ ! -d $DESTDIR/$APPBUNDLE/Contents/Resources ]; then
- mkdir -p $DESTDIR/$APPBUNDLE/Contents/Resources
-fi
-cp $ICNS $DESTDIR/$APPBUNDLE/Contents/Resources/Tremulous.icns || exit 1;
-echo $PKGINFO > $DESTDIR/$APPBUNDLE/Contents/PkgInfo
-echo "
-
-
-
-
- CFBundleDevelopmentRegion
- English
- CFBundleExecutable
- $BINARY
- CFBundleGetInfoString
- $Q3_VERSION
- CFBundleIconFile
- Tremulous.icns
- CFBundleIdentifier
- net.tremulous
- CFBundleInfoDictionaryVersion
- 6.0
- CFBundleName
- Tremulous
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- $Q3_VERSION
- CFBundleSignature
- $PKGINFO
- CFBundleVersion
- $Q3_VERSION
- NSExtensions
-
- NSPrincipalClass
- NSApplication
-
-
- " > $DESTDIR/$APPBUNDLE/Contents/Info.plist
-
-lipo -create -o $DESTDIR/$APPBUNDLE/Contents/MacOS/$BINARY $BIN_OBJ
-cp $BASE_OBJ $DESTDIR/$APPBUNDLE/Contents/MacOS/$BASEDIR/
-cp src/libs/macosx/*.dylib $DESTDIR/$APPBUNDLE/Contents/MacOS/
-
diff --git a/misc/entities.def b/misc/entities.def
deleted file mode 100644
index 06bbd7d..0000000
--- a/misc/entities.def
+++ /dev/null
@@ -1,1707 +0,0 @@
-// Tremulous entity definition file for GTKRadiant
-// Tim Angus 08/09/03
-
-// Based on entities.def from GTKRadiant 1.3.11 which in turn is based on...
-// Based on draft by Suicide 20 7.30.99 and inolen 9-3-99
-// Upgraded by Eutectic: eutectic@ritualistic.com
-// (visible models added by raYGunn - paths provided by Suicide 20)
-// (terrain information added to func_group entity by Paul Jaquays)
-// Q3Map2 entitys/keys added by ydnar
-// Version: 1.5
-// Last updated: 2003-06-09
-
-//=============================================================================
-
-LIGHT ENTITY
-
-//=============================================================================
-
-
-/*QUAKED light (.65 .65 1) (-8 -8 -8) (8 8 8) LINEAR NOANGLE UNUSED1 UNUSED2 NOGRIDLIGHT
-Non-displayed point light source. The -pointscale and -scale arguments to Q3Map2 affect the brightness of these lights. The -skyscale argument affects brightness of entity sun lights.
-
--------- KEYS --------
-_light OR light: overrides the default 300 intensity.
-
-_color: weighted RGB value of light color (default white - 1.0 1.0 1.0).
-
-target: Lights pointed at a target will be spotlights.
-
-radius: overrides the default 64 unit radius of a spotlight at the target point.
-
--------- Q3MAP2 KEYS --------
-_sun: Set this key to 1 on a spotlight to make an infinite sun light.
-
-fade: Fades light attenuation. Only affects linear lights.
-
-scale: Scales light attentation, from SOF2/JK2. Scales the "light" value.
-
--------- SPAWNFLAGS --------
-LINEAR: Use a linear falloff. Default is inverse distance squared (more realistic).
-
-NOANGLE: Ignore angle attenuation.
-
-NOGRIDLIGHT: Do not affect the lightgrid (dynamic entity lighting).
-*/
-
-/*QUAKED lightJunior (0 0.7 0.3) (-6 -6 -6) (6 6 6) LINEAR NOANGLE UNUSED1 UNUSED2 NOGRIDLIGHT
-
-Non-displayed point light source THAT ONLY AFFECTS ENTITIES (lightgrid). The -pointscale and -scale arguments to Q3Map2 affect the brightness of these lights. The -skyscale argument affects brightness of entity sun lights.
-
--------- KEYS --------
-_light OR light: overrides the default 300 intensity.
-
-_color: weighted RGB value of light color (default white - 1.0 1.0 1.0).
-
-target: Lights pointed at a target will be spotlights.
-
-radius: overrides the default 64 unit radius of a spotlight at the target point.
-
--------- Q3MAP2 KEYS --------
-_sun: Set this key to 1 on a spotlight to make an infinite sun light.
-
-fade: Fades light attenuation. Only affects linear lights.
-
-scale: Scales light attentation, from SOF2/JK2. Scales the "light" value.
-
--------- SPAWNFLAGS --------
-LINEAR: Use a linear falloff. Default is inverse distance squared (more realistic).
-
-NOANGLE: Ignore angle attenuation.
-
-NOGRIDLIGHT: Do not affect the lightgrid (dynamic entity lighting). Setting this spawnflag will disable this light entirely.
-*/
-
-//=============================================================================
-
-FUNC_* ENTITIES
-
-//=============================================================================
-
-/*QUAKED func_bobbing (0 .5 .8) ? X_AXIS Y_AXIS
-Solid entity that oscillates back and forth in a linear motion. By default, it will have an amount of displacement in either direction equal to the dimension of the brush in the axis in which it's bobbing. Entity bobs on the Z axis (up-down) by default. It can also emit sound if the "noise" key is set. Will crush the player when blocked.
-
--------- KEYS --------
-speed: amount of time in seconds for one complete oscillation cycle (default 4).
-
-height: sets the amount of travel of the oscillation movement (default 32).
-
-phase: sets the start offset of the oscillation cycle. Values must be 0 < phase < 1. Any integer phase value is the same as no offset (default 0).
-
-noise: path/name of .wav file to play. Use looping sounds only (eg. sound/world/drone6.wav - See Notes).
-
-model2: path/name of model to include (eg: models/mapobjects/jets/jets01.md3).
-
-origin: alternate method of setting XYZ origin of sound and .md3 model included with entity (See Notes).
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- SPAWNFLAGS --------
-X_AXIS: entity will bob along the X axis.
-Y_AXIS: entity will bob along the Y axis.
-
--------- NOTES --------
-In order for the sound to be emitted from the entity, it is recommended to include a brush with an origin shader at its center, otherwise the sound will not follow the entity as it moves. Setting the origin key is simply an alternate method to using an origin brush. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").
-*/
-
-//=============================================================================
-
-/*QUAKED func_button (0 .5 .8) ?
-When a button is touched by a player, it moves in the direction set by the "angle" key, triggers all its targets, stays pressed by an amount of time set by the "wait" key, then returns to it's original position where it can be operated again.
-
--------- KEYS --------
-angle: determines the direction in which the button will move (up = -1, down = -2).
-
-target: all entities with a matching targetname will be triggered.
-
-speed: speed of button's displacement (default 40).
-
-wait: number of seconds button stays pressed (default 1, -1 = return immediately).
-
-lip: lip remaining at end of move (default 4 units).
-
-health: (default 0) if set to any non-zero value, the button must take damage (any amount) to activate.
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-model2: path/name of model to include (eg: models/mapobjects/pipe/pipe02.md3).
-
-origin: alternate method of setting XYZ origin of .md3 model included with entity (See Notes).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
-sound1to2: the sound played when the door, platform or button moves from state 1 to state 2.
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- NOTES --------
-Setting the origin key is simply an alternate method to using an origin brush. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").
-*/
-
-//=============================================================================
-
-/*QUAKED func_door (0 .5 .8) ? START_OPEN - CRUSHER
-Normal sliding door entity. By default, the door will activate when player walks close to it or when damage is inflicted to it.
-
--------- KEYS --------
-angle: determines the opening direction of door (up = -1, down = -2).
-
-speed: determines how fast the door moves (default 100).
-
-wait: number of seconds before door returns (default 2, -1 = return immediately)
-
-lip: lip remaining at end of move (default 8)
-
-targetname: if set, a func_button or trigger is required to activate the door.
-
-health: (default 0) if set to any non-zero value, the button must take damage (any amount) to activate.
-
-dmg: damage to inflict on player when he blocks operation of door (default 4). Door will reverse direction when blocked unless CRUSHER spawnflag is set.
-
-team: assign the same team name to multiple doors that should operate together (see Notes).
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-model2: path/name of model to include (eg: models/mapobjects/pipe/pipe02.md3).
-
-origin: alternate method of setting XYZ origin of .md3 model included with entity (See Notes).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
-sound1to2: the sound played when the door, platform or button moves from state 1 to state 2.
-
-sound2to1: the sound played when the door or platform moves from from state 2 to state 1.
-
-soundPos2: the sound played when the door or platform reaches state 2.
-
-soundPos1: the sound played when the door or platform reaches state 1.
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- SPAWNFLAGS --------
-START_OPEN: the door will spawn in the open state and operate in reverse.
-
-CRUSHER: door will not reverse direction when blocked and will keep damaging player until he dies or gets out of the way.
-
--------- NOTES --------
-Unlike in Quake 2, doors that touch are NOT automatically teamed. If you want doors to operate together, you have to team them manually by assigning the same team name to all of them. Setting the origin key is simply an alternate method to using an origin brush. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").
-*/
-
-//=============================================================================
-
-/*QUAKED func_door_model (0 .5 .8) ?
-A model based door entity. By default, the door will activate when player walks close to it. The opening and closing of the door is provided by an animation in the model itself.
-
--------- KEYS --------
-speed: determines the time taken for the door to change state in msec (default 200).
-
-wait: number of seconds before door returns (default 2)
-
-targetname: if set, a func_button or trigger is required to activate the door.
-
-health: (default 0) if set to any non-zero value, the button must take damage (any amount) to activate.
-
-team: assign the same team name to multiple doors that should operate together (see Notes).
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-model2: path/name of the door model (eg: models/mapobjects/pipe/pipe02.md3).
-
-modelOrigin: means of setting the origin of the model.
-
-scale: scale the model in each of the major axes (e.g. 1.0 1.0 2.0 -- twice as high as normal).
-
-animation: The first frame and number of frames in the door open animation (e.g. 0 10). This will be reversed for the close animation.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
-sound1to2: the sound played when the door, platform or button moves from state 1 to state 2.
-
-sound2to1: the sound played when the door or platform moves from from state 2 to state 1.
-
-soundPos2: the sound played when the door or platform reaches state 2.
-
-soundPos1: the sound played when the door or platform reaches state 1.
-
--------- Q3MAP2 KEYS --------
-
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- NOTES --------
-Every func_door_model needs its model to be positioned, scaled and orientated using the modelOrigin, scale and angle/angles keys repsectively.
-*/
-
-//=============================================================================
-
-/*QUAKED func_door_rotating (0 .5 .8) ? START_OPEN - CRUSHER REVERSE - X_AXIS Y_AXIS
-Rotating door entity. By default, the door will activate when player walks close toit.
-
--------- KEYS --------
-speed: determines how fast the door moves (in degrees/second).
-
-rotatorAngle: the number of degrees through which to rotate (default 90).
-
-wait: number of seconds before door returns (default 2)
-
-targetname: if set, a func_button or trigger is required to activate the door.
-
-health: (default 0) if set to any non-zero value, the button must take damage (any amount) to activate.
-
-dmg: damage to inflict on player when he blocks operation of door (default 4). Door will reverse direction when blocked unless CRUSHER spawnflag is set.
-
-team: assign the same team name to multiple doors that should operate together (see Notes).
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-model2: path/name of model to include (eg: models/mapobjects/pipe/pipe02.md3).
-
-origin: alternate method of setting XYZ origin of .md3 model included with entity (See Notes).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
-sound1to2: the sound played when the door, platform or button moves from state 1 to state 2.
-
-sound2to1: the sound played when the door or platform moves from from state 2 to state 1.
-
-soundPos2: the sound played when the door or platform reaches state 2.
-
-soundPos1: the sound played when the door or platform reaches state 1.
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- SPAWNFLAGS --------
-START_OPEN: the door will spawn in the open state and operate in reverse.
-
-CRUSHER: door will not reverse direction when blocked and will keep damaging player until he dies or gets out of the way.
-
-REVERSE: the door will open the other way.
-
-X_AXIS: rotate on the X axis instead of the Z.
-
-Y_AXIS: rotate on the Y axis instead of the Z.
-
--------- NOTES --------
-Unlike in Quake 2, doors that touch are NOT automatically teamed. If you want doors to operate together, you have to team them manually by assigning the same team name to all of them. Setting the origin key is simply an alternate method to using an origin brush. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").
-
-You need to have an origin brush as part of this entity. The center of that brush will be the point around which it is rotated. It will rotate around the Z axis by default. You can check either the X_AXIS or Y_AXIS box to change that.
-*/
-
-//=============================================================================
-
-/*QUAKED func_group (0 .5 .8) ?
-This is not an entity as such. It is strictly an editor utility to group world brushes and patches together for convenience (selecting, moving, copying, etc). You cannot group entities with this.
-
--------- OLD TERRAIN KEYS (note: obsolete with Q3Map2) --------
-alphamap: this is the path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-layers: this integer value is the number unique root shaders that will be use on the terrain.
-
-shader: this is the path to the metashader used to assign textures to the terrain entity.
-
-terrain: this is an on/off flag. When set to 1, the entity becomes a terrain entity. Note: unecessary when compiling with Q3Map2. See Q3Map2 keys.
-
--------- Q3MAP2 KEYS --------
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- NOTES --------
-The TAB key can be used to flip through the component pieces of a selected func_group entity, isolating individual components. To make a func_group into a terrain entity, refer to the Terrain Construction documentation.
-*/
-
-//=============================================================================
-
-/*QUAKED func_pendulum (0 .5 .8) ?
-Solid entity that describes a pendulum back and forth rotation movement. Rotates on the X axis by default. Pendulum frequency is a physical constant based on the length of the beam and gravity. Blocking the pendulum instantly kills a player.
-
--------- KEYS --------
-angle: angle offset of axis of rotation from default X axis (default 0).
-
-speed: angle of swing arc in either direction from initial position (default 30).
-
-phase: sets the start offset of the swinging cycle. Values must be 0 < phase < 1. Any integer phase value is the same as no offset (default 0).
-
-noise: path/name of .wav file to play. Use looping sounds only (eg. sound/world/drone6.wav).
-
-model2: path/name of model to include (eg: models/mapobjects/jets/jets01.md3).
-
-origin: alternate method of setting XYZ origin of entity's rotation axis and .md3 model included with entity (default "0 0 0" - See Notes).
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- NOTES --------
-You need to have an origin brush as part of this entity. The center of that brush will be the point through which the rotation axis passes. Setting the origin key is simply an alternate method to using an origin brush. Pendulum will rotate along the X axis by default. Very crude operation: pendulum cannot rotate along Z axis, the speed of swing (frequency) is not adjustable. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").
-*/
-
-//=============================================================================
-
-/*QUAKED func_plat (0 .5 .8) ? DONT_WAIT
-Rising platform the player can ride to reach higher places. Plats must always be drawn in the raised position, so they will operate and be lighted correctly but they spawn in the lowered position. The plat will stay in the raised position until the player steps off. There are no proper sounds for this entity, only beep noises. It will spawn in the game and work properly but it sounds silly (see Notes). If DONT_WAIT is set then the platform will not wait for a client to leave before returning to its original position.
-
--------- KEYS --------
-speed: determines how fast the plat moves (default 150).
-
-lip: lip remaining at end of move (default 16). Has no effect if "height" is set.
-
-height: if set, this will determine the total amount of vertical travel of the plat.
-
-dmg: damage to inflict on player when he blocks operation of plat (default 4). Plat will reverse direction when blocked.
-
-targetname: if set, the trigger that points to this will raise the plat each time it fires. The plat raises and comes back down a second later if no player is on it.
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-model2: path/name of model to include (eg: models/mapobjects/pipe/pipe02.md3).
-
-origin: alternate method of setting XYZ origin of .md3 model included with entity (See Notes).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
-sound1to2: the sound played when the door, platform or button moves from state 1 to state 2.
-
-sound2to1: the sound played when the door or platform moves from from state 2 to state 1.
-
-soundPos2: the sound played when the door or platform reaches state 2.
-
-soundPos1: the sound played when the door or platform reaches state 1.
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- NOTES --------
-By default, the total amount of vertical travel of a platform is implicitly determined by the overall vertical size of the brushes of which it's made minus the lip value. But if the "height" key is used, then the total amount of vertical travel of the plat will be exactly that value regardless of the shape and size of the plat and regardless of the value of the "lip" key. Using the "height" key is the best method for any kind of platforms and the only possible one for thin plats which need to travel vertical distances many times their own thickness. Setting the origin key is simply an alternate method to using an origin brush. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value.
-
-There is a way to make plats play proper sounds. Just create a sound\movers\plats folder under baseq3 and put 2 sounds named pt1_strt.wav and pt1_end.wav in it. Those can be the renamed sounds from the Q2 plats or renamed copies of the sound\movers\doors sounds you can extract from your pak0.pk3 file or new custom sounds if you're up to it. Thanks to Fragzilla for the tip.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").
-*/
-
-//=============================================================================
-
-/*QUAKED func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS
-Solid entity that rotates continuously. Rotates on the Z axis by default and requires an origin brush. It will always start on in the game and is not targetable.
-
--------- KEYS --------
-speed: determines how fast entity rotates (default 100).
-
-noise: path/name of .wav file to play. Use looping sounds only (eg. sound/world/drone6.wav).
-
-model2: path/name of model to include (eg: models/mapobjects/bitch/fembotbig.md3).
-
-origin: alternate method of setting XYZ origin of entity's rotation axis and .md3 model included with entity (default "0 0 0" - See Notes).
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- SPAWNFLAGS --------
-X_AXIS: entity will rotate along the X axis.
-
-Y_AXIS: entity will rotate along the Y axis.
-
--------- NOTES --------
-You need to have an origin brush as part of this entity. The center of that brush will be the point through which the rotation axis passes. Setting the origin key is simply an alternate method to using an origin brush. It will rotate along the Z axis by default. You can check either the X_AXIS or Y_AXIS box to change that. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").
-*/
-
-//=============================================================================
-
-/*QUAKED func_static (0 .5 .8) ?
-Static non-solid bspmodel. Can be used for conditional walls and models.
-
--------- KEYS --------
-model2: path/name of model to include (eg: models/mapobjects/bitch/fembotbig.md3).
-
-origin: alternate method of setting XYZ origin of .md3 model included with entity (See Notes).
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-targetname: NOT SUPPORTED BY RENDERER - if set, a func_button or trigger can make entity disappear from the game (See Notes).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- NOTES --------
-When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value. If a model is included with a targeted func_static, the brush(es) of the entity will be removed from the game but the .md3 model won't: it will automatically be moved to the (0 0 0) world origin so you should NOT include an .md3 model to a targeted func_static.
-
-Because the map has only a single bot navigation file, func_static's cannot be used to make significant changes in game play flow between differing game types.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").
-*/
-
-//=============================================================================
-
-/*QUAKED func_timer (0 .5 .8) (-8 -8 -8) (8 8 8) START_ON
-Time delay trigger that will continuously fire its targets after a preset time delay. The time delay can also be randomized. When triggered, the timer will toggle on/off.
-
--------- KEYS --------
-wait: delay in seconds between each triggering of its targets (default 1).
-
-random: random time variance in seconds added or subtracted from "wait" delay (default 0 - see Notes).
-
-target: this points to the entities to trigger.
-
-targetname: a func_button or trigger that points to this will toggle the timer on/off when activated.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- SPAWNFLAGS --------
-START_ON: timer will start on in the game and continuously fire its targets.
-
--------- NOTES --------
-When the random key is set, its value is used to calculate a minimum and a maximum delay. The final time delay will be a random value anywhere between the minimum and maximum values: (min delay = wait - random) (max delay = wait + random).
-*/
-
-//=============================================================================
-
-/*QUAKED func_train (0 .5 .8) ? START_OFF BLOCK_STOPS
-Trains are moving solids that follow a string of path_corner entities. Trains in Tremulous are less basic than in Q3A, they also require an origin brush (see Notes).
-
--------- KEYS --------
-speed: speed of displacement of train (default 100 or overridden by speed value of path).
-
-target: this points to the first path_corner of the path which is also the spawn location of the train's origin.
-
-model2: path/name of model to include (eg: models/mapobjects/pipe/pipe02.md3).
-
-origin: alternate method of setting XYZ origin of the train's brush(es) and .md3 model included with entity (See Notes).
-
-light: constantLight radius of .md3 model included with entity. Has no effect on the entity's brushes (default 0).
-
-color: constantLight color of .md3 model included with entity. Has no effect on the entity's brushes (default 1 1 1).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- SPAWNFLAGS --------
-START_OFF: the train will spawn in the off state
-
-BLOCK_STOPS: with this set a train simply stops if blocked, instead of killing.
-
--------- Q3MAP2 KEYS --------
-_targetname: Used to attach a misc_model entity to this entity.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in this entity (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-
--------- NOTES --------
-1. Trains instakill anything in their path by default.
-2. Trains cannot emit sound.
-3. When BLOCK_STOPS is set, trains cannot be stopped just by getting in their way, the player must be wedged between the train and another obstacle to block it.
-
-Setting the origin key is simply an alternate method to using an origin brush. When using the model2 key, the origin point of the model will correspond to the origin point defined by either the origin brush or the origin coordinate value.
-
-Target this entity with a misc_model to have the model attached to the entity (set the model's "target" key to the same value as this entity's "targetname").*/
-
-
-
-
-//=============================================================================
-
-INFO_* ENTITIES
-
-//=============================================================================
-
-/*QUAKED info_notnull (0 .5 0) (-8 -8 -8) (8 8 8)
-Used as a positional target for entities that can use directional pointing. A target_position can be used instead of this but was kept in Q3A for legacy purposes.
-
--------- KEYS --------
-targetname: must match the target key of entity that uses this for pointing.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-
-//=============================================================================
-
-/*QUAKED info_null (0 .5 0) (-8 -8 -8) (8 8 8)
-Used as a positional target for light entities to create a spotlight effect. A target_position can be used instead of this but was kept in Q3A for legacy purposes.
-
--------- KEYS --------
-targetname: must match the target key of entity that uses this for pointing.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-//=============================================================================
-
-/*QUAKED info_player_intermission (1 0 1) (-8 -8 -8) (8 8 8)
-Camera for intermission screen between matches. This also automatically generates the podium for bot arena matches (see Notes). Can be aimed by setting the "angles" key or targeting an pointing to an aiming entity. Use only one per level.
-
--------- KEYS --------
-angles: alternate "pitch, yaw, roll" angles method of aiming intermission camera (default 0 0 0).
-
-target: point this to an info_notnull or target_position entity to set the camera's pointing angles.
-
--------- NOTES --------
-In genuine bot arena matches, the podium for the 1st, 2nd and 3rd place players at the end of the match is generated by this entity. The podium's origin will automatically be located 128 units in the direction of the camera's view and 84 units down from the y height of the view line at that point. It will also always be generated on a level plane regardless of the pointing angle of the camera so if that angle is too steep, part of the podium model might not be visible. Make sure you leave at least 106 units of free space in front of where the camera points to otherwise the podium model won't be visible at all.
-*/
-
-//=============================================================================
-
-/*QUAKED info_alien_intermission (1 0 1) (-8 -8 -8) (8 8 8)
-Camera for aliens before they spawn. Can be aimed by setting the "angles" key or targeting an pointing to an aiming entity. Use one per level.
-
--------- KEYS --------
-angles: alternate "pitch, yaw, roll" angles method of aiming intermission camera (default 0 0 0).
-
-target: point this to an info_notnull or target_position entity to set the camera's pointing angles.
-*/
-
-//=============================================================================
-
-/*QUAKED info_human_intermission (1 0 1) (-8 -8 -8) (8 8 8)
-Camera for humans before they spawn. Can be aimed by setting the "angles" key or targeting an pointing to an aiming entity. Use one per level.
-
--------- KEYS --------
-angles: alternate "pitch, yaw, roll" angles method of aiming intermission camera (default 0 0 0).
-
-target: point this to an info_notnull or target_position entity to set the camera's pointing angles.
-*/
-
-
-
-//=============================================================================
-
-MISC_* ENTITIES
-
-//=============================================================================
-
-/*QUAKED misc_model (1 .5 .25) (-16 -16 -16) (16 16 16)
-Generic placeholder for inserting MD3 models in game. Requires compilation of map geometry to be added to level. If the map is compiled with Q3Map2, then ASE, 3DS, OBJ and other model formats are supported.
-
--------- KEYS --------
-angle: direction in which model will be oriented.
-
-model: path/name of model to use (eg: models/mapobjects/teleporter/teleporter.md3).
-
--------- Q3MAP2 KEYS --------
-angles: Individual control of PITCH, YAW, and ROLL (default 0 0 0).
-
-modelscale: Floating-point value used to scale a model up or down (default 1.0).
-
-modelscale_vec: Floating-point vector used to scale a model's axes individually (default 1.0 1.0 1.0).
-
-_remap: Used to remap textures/shaders in the model. To remap all shaders to a given shader, use "*;models/mymodel/mytexture". To remap a specific shader, use "models/mymodel/old;models/mymodel/new".
-
-target: Used to attach the misc_model to a brush entity, where its "targetname" key is the same value.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on this model (if model is using lightmapped shaders) (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix.
-*/
-
-//=============================================================================
-
-/*QUAKED misc_anim_model (1 .5 .25) (-16 -16 -16) (16 16 16) TRIGGER_TOGGLE
-A little like misc_model except that it is a game entity and does not become part of the map geometry. An instance of this entity will draw an arbituary md3 in the world with an arbituary frame or with an animation.
-
--------- KEYS --------
-angle: direction in which model will be oriented.
-
-radius: The scale of the model compared to its original size. Defaults to 1.0.
-
-animation: The guts of the entity. This is identical to an entry in an animation.cfg - Start Frame, Number of frames, Looping Frames, Frame rate. For example 0 30 30 20 will play frames 0 through 30 continously at 20 fps.
-
-model: path/name of model to use (eg: models/mapobjects/teleporter/teleporter.md3).
-
--------- SPAWNFLAGS --------
-TRIGGER_TOGGLE: With this set triggering the entity disables the model altogether as opposed to the regular behaviour of toggling the animation.
-*/
-
-//=============================================================================
-
-/*QUAKED misc_particle_system (1 .5 .25) (-8 -8 -8) (8 8 8) SPAWN_DISABLED
-A particle system entity.
-
--------- KEYS --------
-psName: The name of the particle system to spawn at this entity.
-
--------- SPAWNFLAGS --------
-SPAWN_DISABLED: Spawn disabled.
-
--------- NOTES --------
-Triggering this entity toggles it on and off.
-*/
-
-//=============================================================================
-/*QUAKED misc_light_flare (.65 .65 1) (-8 -8 -8) (8 8 8) SPAWN_DISABLED
-A light flare entity.
-
--------- KEYS --------
-targetShaderName: The name of the shader of the light flare.
-
-radius: The radius key is a vector.
-The first component is the size of the light flare. The radius is calculated by taking the distance of the viewer from the light flare and dividing by this key, so the larger the key value, the smaller the flare. Values between 2 and 10 are sensible.
-The second component indicates the angle around the direction the flare points for which it is visible. For example a value of 90 means that you can see the flare while infront of the entity, but not when behind it. If set to zero the light flare will be visible from any angle
-The third component is similar to the first except that it specifies the size of the light source rather than the size of the light flare itself. This is useful when the higher detail flare fading modes are enabled. If this is set to the same value as the first component, fading will commence as soon as the edge of the light flare is occluded by some surface between the viewer and the flare. If it is set larger the flare will overlap the occluding surface before it begins to fade.
-
-angles: This reflects which direction the flare points. It is not important unless the second component of the radius key is employed. angles is a vector of PITCH YAW ROLL. For example a value of "90 0 0" would create a flare pointing down. ROLL is redundant in this context and can be set arbitrarily.
-
--------- SPAWNFLAGS --------
-SPAWN_DISABLED: Spawn disabled.
-
--------- NOTES --------
-Triggering this entity toggles it.
-*/
-
-//=============================================================================
-
-/*QUAKED misc_portal_camera (1 .5 .25) (-8 -8 -8) (8 8 8) SLOWROTATE FASTROTATE
-Portal camera. This camera is used to project its view onto a portal surface in the level through the intermediary of a misc_portal_surface entity. Use the "angles" key or target a target_position or info_notnull entity to set the camera's pointing direction.
-
--------- KEYS --------
-angles: this sets the pitch and yaw aiming angles of the portal camera (default 0 0). Use "roll" key to set roll angle.
-
-target: point this to a target_position entity to set the camera's pointing direction.
-
-targetname: a misc_portal_surface portal surface indicator must point to this.
-
-roll: roll angle of camera. A value of 0 is upside down and 180 is the same as the player's view.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- SPAWNFLAGS --------
-SLOWROTATE: makes the portal camera rotate slowly along the roll axis.
-
-FASTROTATE: makes the portal camera rotate faster along the roll axis.
-
-NOROTATE: no rolling at all.
-
--------- NOTES --------
-Both the setting "angles" key or "targeting a target_position" methods can be used to aim the camera. However, the target_position method is simpler. In both cases, the "roll" key must be used to set the roll angle.
-*/
-
-//=============================================================================
-
-/*QUAKED misc_portal_surface (1 .5 .25) (-8 -8 -8) (8 8 8)
-Portal surface indicator. This will "lock on" the brush face closest to it and identify as a portal. The view displayed on the portal surface is the view of the misc_portal_camera that this entity targets. Also used for mirrors (see Notes).
-
--------- KEYS --------
-target: point this to a misc_portal_camera that "sees" the view you want to display on the portal.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- NOTES --------
-The entity must be no farther than 64 units away from the portal surface to lock onto it. To make a mirror, apply the common/mirror shader to the surface, place this entity near it but don't target a misc_portal_camera.
-*/
-
-//=============================================================================
-
-/*QUAKED misc_teleporter_dest (1 .5 .25) (-32 -32 -24) (32 32 -16)
-Teleport destination location point for trigger_teleporter entities.
-
--------- KEYS --------
-angle: direction in which player will look when teleported.
-
-targetname: make the trigger_teleporter point to this.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-/*QUAKED trigger_teleport (.5 .5 .5) ? SPECTATOR SPAWN_DISABLED
-Allows client side prediction of teleportation events.
-Must point at a target_position, which will be the teleport destination.
-
-If spectator is set, only spectators can use this teleport
-Spectator teleporters are not normally placed in the editor, but are created
-automatically near doors to allow spectators to move through them
-*/
-
-
-
-//=============================================================================
-
-PATH_* ENTITIES
-
-//=============================================================================
-
-/*QUAKED path_corner (.5 .3 0) (-8 -8 -8) (8 8 8)
-Path corner entity that func_trains can be made to follow.
-
--------- KEYS --------
-target: point to next path_corner in the path.
-
-targetname: the train following the path or the previous path_corner in the path points to this.
-
-speed: speed of func_train while moving to the next path corner. This will override the speed value of the train.
-
-wait: number of seconds func_train will pause on path corner before moving to next path corner (default 0 - see Notes).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- NOTES --------
-Setting the wait key to -1 will not make the train stop on the path corner, it will simply default to 0.
-*/
-
-
-
-//=============================================================================
-
-TARGET_* ENTITIES
-
-//=============================================================================
-
-/*QUAKED target_hurt (1 0 0) (-8 -8 -8) (8 8 8)
-When triggered, this hurts the entity that caused the trigger.
-
--------- KEYS --------
-damage: amount of damage to deal (default: 5)
-*/
-
-/*QUAKED target_rumble (1 0 0) (-8 -8 -8) (8 8 8)
-When triggered, this initiates a level-wide rumble effect. All players are affected.
-
--------- KEYS --------
-speed: severity of the quake (default: 100)
-
-count: duration of the quake (default: 10)
-*/
-
-/*QUAKED target_alien_win (1 0 0) (-8 -8 -8) (8 8 8)
-When triggered, this causes an unconditional win for the alien team.
-*/
-
-/*QUAKED target_human_win (1 0 0) (-8 -8 -8) (8 8 8)
-When triggered, this causes an unconditional win for the human team.
-*/
-
-/*QUAKED target_delay (0 .7 .7) (-8 -8 -8) (8 8 8)
-Time delay trigger intermediary. Like a target_relay, this can only be fired by other triggers which will cause it in turn to fire its own targets.
-
--------- KEYS --------
-targetname: activating trigger points to this.
-
-target: this points to entities to activate when this entity is triggered.
-
-wait: delay in seconds from when this gets triggered to when it fires its own targets (default approx. 1).
-
-delay: same as wait? replaces it? WTF?...I'm confused now.
-
-random: random time variance in seconds added or subtracted from "wait" delay (default 0 - see Notes).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- NOTES --------
-When the random key is set, its value is used to calculate a minimum and a maximum delay. The final time delay will be a random value anywhere between the minimum and maximum values: (min delay = wait - random) (max delay = wait + random).
-*/
-
-//=============================================================================
-
-/*QUAKED target_kill (0 .5 0) (-8 -8 -8) (8 8 8)
-This will kill the player who activates the trigger that fires this target.
-
--------- KEYS --------
-targetname: the activating trigger points to this.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-//=============================================================================
-
-/*QUAKED target_location (0 .5 0) (-8 -8 -8) (8 8 8)
-Location marker used by bots and players for team orders and team chat in the course of Teamplay games. The closest target_location in sight is used for the location. If none is in sight, the closest in distance is used.
-
--------- KEYS --------
-message: name of the location (text string). Displayed in parentheses in front of all team chat and order messages.
-
-count: color of the location text displayed in parentheses during team chat. Set to 0-7 for color.
- 0: white (default)
- 1: red
- 2: green
- 3: yellow
- 4: blue
- 5: cyan
- 6: magenta
- 7: white
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-//=============================================================================
-
-/*QUAKED target_position (0 .5 0) (-8 -8 -8) (8 8 8)
-Aiming target for entities like light, misc_portal_camera and trigger_push (jump pads) in particular.
-
--------- KEYS --------
-targetname: the entity that requires an aiming direction points to this.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- NOTES --------
-To make a jump pad, place this entity at the highest point of the jump and target it with a trigger_push entity.
-*/
-
-//=============================================================================
-
-/*QUAKED target_print (0 .5 0) (-8 -8 -8) (8 8 8) HUMAN_TEAM ALIEN_TEAM PRIVATE
-This will print a message on the center of the screen when triggered. By default, all the clients will see the message.
-
--------- KEYS --------
-message: text string to print on screen.
-
-targetname: the activating trigger points to this.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- SPAWNFLAGS --------
-HUMAN_TEAM: only the human team players will see the message.
-ALIEN_TEAM: only the alien team players will see the message.
-PRIVATE: only the player that activates the target will see the message.
-*/
-
-//=============================================================================
-
-/*QUAKED target_push (.5 .5 .5) (-8 -8 -8) (8 8 8) BOUNCEPAD NOSOUND
-This can be used to create jump pads and launch ramps. The direction of push can be set by the "angles" key or pointing to a target_position or info_notnull entity. Unlike trigger_push, this is NOT client side predicted and must be activated by a trigger.
-
--------- KEYS --------
-angles: this sets the pitch and yaw aiming angles of push entity (default 0 0). The roll angle does not apply.
-
-speed: speed of push (default 1000). Has no effect if entity targets an aiming entity.
-
-targetname: the activating trigger points to this. Push originates from the location of the trigger.
-
-target: this points to the aiming entity to which the player will jump.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- SPAWNFLAGS --------
-BOUNCEPAD: if set, trigger will play bounce noise instead of beep noise when activated (recommended).
-NOSOUND: if set, no sound is played at all
-
--------- NOTES --------
-To make a jump pad or launch ramp, create a trigger_multiple where the jump must originate. Place the target_push directly above the trigger_multiple and place the target_position entity at the highest point of the jump. Target the trigger_multiple to the target_push and target the target_push to the target_position/info_notnull (or set the target_push's "angles" key). Note that the "angle" key also works.
-*/
-
-//=============================================================================
-
-/*QUAKED target_relay (0 .7 .7) (-8 -8 -8) (8 8 8) HUMAN_ONLY ALIEN_ONLY RANDOM
-This can only be activated by other triggers which will cause it in turn to activate its own targets.
-
--------- KEYS --------
-targetname: activating trigger points to this.
-
-target: this points to entities to activate when this entity is triggered.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- SPAWNFLAGS --------
-HUMAN_ONLY: only human team players can activate trigger.
-ALIEN_ONLY: only alien team players can activate trigger.
-RANDOM: one one of the targeted entities will be triggered at random.
-*/
-
-//=============================================================================
-
-/*QUAKED target_score (0 .5 0) (-8 -8 -8) (8 8 8)
-This is used to automatically give frag points to the player who activates this. A spawn location entity like info_player_* or CTF respawn points can target this entity to give points to the player when he spawns in the game. Or a trigger can also be used to activate this. The activator of the trigger will get the points.
-
--------- KEYS --------
-targetname: ativating entity points to this.
-
-count: number of frag points to give to player (default 1).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-//=============================================================================
-
-/*QUAKED target_speaker (0 .7 .7) (-8 -8 -8) (8 8 8) LOOPED_ON LOOPED_OFF GLOBAL ACTIVATOR
-Sound generating entity that plays .wav files. Normal non-looping sounds play each time the target_speaker is triggered. Looping sounds can be set to play by themselves (no activating trigger) or be toggled on/off by a trigger.
-
--------- KEYS --------
-noise: path/name of .wav file to play (eg. sound/world/growl1.wav - see Notes).
-
-wait: delay in seconds between each time the sound is played ("random" key must be set - see Notes).
-
-random: random time variance in seconds added or subtracted from "wait" delay ("wait" key must be set - see Notes).
-
-targetname: the activating button or trigger points to this.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- SPAWNFLAGS --------
-LOOPED_ON: sound will loop and initially start on in level (will toggle on/off when triggered).
-
-LOOPED_OFF: sound will loop and initially start off in level (will toggle on/off when triggered).
-
-GLOBAL: sound will play full volume throughout the level.
-
-ACTIVATOR: sound will play only for the player that activated the target.
-
--------- NOTES --------
-The path portion value of the "noise" key can be replaced by the implicit folder character "*" for triggered sounds that belong to a particular player model. For example, if you want to create a "bottomless pit" in which the player screams and dies when he falls into, you would place a trigger_multiple over the floor of the pit and target a target_speaker with it. Then, you would set the "noise" key to "*falling1.wav". The * character means the current player model's sound folder. So if your current player model is Visor, * = sound/player/visor, if your current player model is Sarge, * = sound/player/sarge, etc. This cool feature provides an excellent way to create "player-specific" triggered sounds in your levels.
-
-The combination of the "wait" and "random" keys can be used to play non-looping sounds without requiring an activating trigger but both keys must be used together. The value of the "random" key is used to calculate a minimum and a maximum delay. The final time delay will be a random value anywhere between the minimum and maximum values: (min delay = wait - random) (max delay = wait + random).
-*/
-
-//=============================================================================
-
-/*QUAKED target_teleporter (0 .5 0) (-8 -8 -8) (8 8 8)
-Activating this will teleport players to the location of the targeted misc_teleporter_dest entity. Unlike trigger_teleport, this entity must be activated by a trigger and does NOT allow client prediction of events.
-
--------- KEYS --------
-targetname: activating trigger points to this.
-
-target: this must point to a misc_teleporter_dest entity.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-
-
-
-//=============================================================================
-
-TEAM_* ENTITIES
-
-//=============================================================================
-
-/*QUAKED team_human_spawn (0 .2 1) (-40 -40 -4) (40 40 4)
-The human spawn point.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/telenode/telenode.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_human_armoury (0 .2 1) (-40 -40 -13) (40 40 50)
-The human armoury.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/arm/arm.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_human_dcc (0 .2 1) (-35 -35 -13) (35 35 47)
-The human defense computer.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/dcc/dcc.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_human_medistat (0 .2 1) (-35 -35 -7) (35 35 7)
-The human medical station.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/medistat/medistat.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_human_mgturret (0 .2 1) (-25 -25 -20) (25 25 20)
-The human machinegun turret.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/mgturret/turret_base.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_human_reactor (0 .2 1) (-50 -50 -15) (50 50 95)
-The human reactor.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/reactor/reactor.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_human_repeater (0 .2 1) (-15 -15 -15) (15 15 25)
-The human repeater.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/repeater/repeater.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_human_tesla (0 .2 1) (-22 -22 -40) (22 22 40)
-The human tesla generator.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/tesla/tesla.md3"
-*/
-
-//=============================================================================
-
-
-
-/*QUAKED team_alien_spawn (1 .2 0) (-15 -15 -15) (15 15 15)
-The alien spawn point.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/eggpod/eggpod.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_alien_acid_tube (1 .2 0) (-35 -35 -11) (35 35 40)
-The alien acid tube.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/acid_tube/acid_tube.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_alien_barricade (1 .2 0) (-35 -35 -15) (35 35 60)
-The alien barricade.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/barricade/barricade.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_alien_booster (1 .2 0) (-26 -26 -9) (26 26 9)
-The alien booster.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/booster/booster.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_alien_hovel (1 .2 0) (-50 -50 -20) (50 50 20)
-The alien hovel.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/hovel/hovel.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_alien_overmind (1 .2 0) (-45 -45 -15) (45 45 95)
-The alien overmind.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/overmind/overmind.md3"
-*/
-
-//=============================================================================
-
-/*QUAKED team_alien_trapper (1 .2 0) (-15 -15 -15) (15 15 15)
-The alien trapper.
-
--------- MODEL FOR RADIANT ONLY - DO NOT SET THIS AS A KEY --------
-model="models/buildables/trapper/trapper.md3"
-*/
-
-//=============================================================================
-
-
-
-//=============================================================================
-
-TRIGGER_* ENTITIES
-
-//=============================================================================
-
-/*QUAKED trigger_heal (.5 .5 .5) ? START_OFF SLOW
-Any player that touches this will be healed. It does heal points of healage each server frame. Targeting the trigger will toggle its effects.
-
--------- SPAWNFLAGS --------
-START_OFF: needs to be triggered (toggle) to activate.
-
-SLOW: changes the heal rate to once per second.
-
--------- KEYS --------
-heal: Health points to heal (default 5)
-*/
-
-/*QUAKED trigger_ammo (.5 .5 .5) ? SLOW NOENERGY NOCASE
-Any player that touches this will have the ammo for his held weapon restored. It gives ammo in chunks reflected by the key "ammo" each server frame.
-
--------- SPAWNFLAGS --------
-SLOW: changes the ammo rate to once per second.
-
-NOENERGY: disables this entity for energy weapons.
-
-NOCASE: disables this entity for case based weapons.
-
--------- KEYS --------
-ammo: Amount of ammo to give (default 1)
-*/
-
-/*QUAKED trigger_gravity (.5 .5 .5) ?
-The gravity (for players) within this trigger is determined by the gravity key. Targetting this entity toggles its effects.
-NOT THROUGHLY TESTED: please report whether or not this works for you.
-
--------- KEYS --------
-gravity: The gravity within this trigger (default 800).
-*/
-
-/*QUAKED trigger_buildable (.5 .5 .5) ? SPAWN_DISABLED NEGATE
-Triggered by a buildable or subset of buildables. If no buildables key is supplied every buildable will trigger this entity.
-Targetting this entity toggles it.
-NOT THROUGHLY TESTED: please report whether or not this works for you.
-
--------- SPAWNFLAGS --------
-SPAWN_DISABLED: needs to be triggered (toggle) to activate.
-NEGATE: negate the trigger condition.
-
--------- KEYS --------
-target: this points to the entity to activate.
-
-buildables: a comma delimited list of buildables which will trigger this entity.
-
-wait: time in seconds until trigger becomes re-triggerable after it's been touched (default 0.2, -1 = trigger once).
-
-random: random time variance in seconds added or subtracted from "wait" delay (default 0 - see Notes).
-*/
-
-/*QUAKED trigger_class (.5 .5 .5) ? SPAWN_DISABLED NEGATE
-Triggered by a specific class or subset of classes. If no classes key is supplied every class will trigger this entity.
-Targetting this entity toggles it.
-NOT THROUGHLY TESTED: please report whether or not this works for you.
-
--------- SPAWNFLAGS --------
-SPAWN_DISABLED: needs to be triggered (toggle) to activate.
-NEGATE: negate the trigger condition.
-
--------- KEYS --------
-target: this points to the entity to activate.
-
-classes: a comma delimited list of classes which will trigger this entity.
-
-wait: time in seconds until trigger becomes re-triggerable after it's been touched (default 0.2, -1 = trigger once).
-
-random: random time variance in seconds added or subtracted from "wait" delay (default 0 - see Notes).
-*/
-
-/*QUAKED trigger_equipment (.5 .5 .5) ? SPAWN_DISABLED NEGATE
-Triggered by a player carrying some item (weapon or upgrade) or subset of items. If no equipment key is supplied every human will trigger this entity.
-Targetting this entity toggles it.
-NOT THROUGHLY TESTED: please report whether or not this works for you.
-
--------- SPAWNFLAGS --------
-SPAWN_DISABLED: needs to be triggered (toggle) to activate.
-NEGATE: negate the trigger condition.
-
--------- KEYS --------
-target: this points to the entity to activate.
-
-equipment: a comma delimited list of equipment which will trigger this entity.
-
-wait: time in seconds until trigger becomes re-triggerable after it's been touched (default 0.2, -1 = trigger once).
-
-random: random time variance in seconds added or subtracted from "wait" delay (default 0 - see Notes).
-*/
-
-//=============================================================================
-
-/*QUAKED trigger_stage (.5 .5 .5) (-8 -8 -8) (8 8 8)
-Fires its targets when the team key reaches stage key.
-
--------- KEYS --------
-target: this points to the entity to activate.
-
-team: the team which triggers this entity; 1 for aliens, 2 for humans
-
-stage: the stage at which this entity is triggered; 1 for stage 2, 2 for stage 3
-*/
-
-//=============================================================================
-
-/*QUAKED trigger_win (.5 .5 .5) (-8 -8 -8) (8 8 8)
-Fires its targets when the team key wins.
-
--------- KEYS --------
-target: this points to the entity to activate.
-
-team: the team which triggers this entity; 1 for aliens, 2 for humans
-*/
-
-//=============================================================================
-
-/*QUAKED trigger_always (.5 .5 .5) (-8 -8 -8) (8 8 8)
-Automatic trigger. It will fire the entities it targets as soon as it spawns in the game.
-
--------- KEYS --------
-target: this points to the entity to activate.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-//=============================================================================
-
-/*QUAKED trigger_hurt (.5 .5 .5) ? START_OFF - SILENT NO_PROTECTION SLOW
-Any player that touches this will be hurt by "dmg" points of damage once per server frame (very fast). A sizzling sound is also played while the player is being hurt.
-
--------- KEYS --------
-dmg: number of points of damage inflicted to player per server frame (default 5 - integer values only).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- SPAWNFLAGS --------
-START_OFF needs to be triggered (toggle) for damage
-
-SILENT: supresses the sizzling sound while player is being hurt.
-
-NO_PROTECTION: player will be hurt regardless of protection (see Notes).
-
-SLOW: changes the damage rate to once per second.
-
--------- NOTES --------
-The invulnerability power-up (item_enviro) does not protect the player from damage caused by this entity regardless of whether the NO_PROTECTION spawnflag is set or not. Triggering a trigger_hurt will have no effect if the START_OFF spawnflag is not set. A trigger_hurt always starts on in the game.
-*/
-
-//=============================================================================
-
-/*QUAKED trigger_multiple (.5 .5 .5) ?
-Variable size repeatable trigger. It will fire the entities it targets when touched by player. Can be made to operate like a trigger_once entity by setting the "wait" key to -1. It can also be activated by another trigger that targets it.
-
--------- KEYS --------
-target: this points to the entity to activate.
-
-targetname: activating trigger points to this.
-
-wait: time in seconds until trigger becomes re-triggerable after it's been touched (default 0.2, -1 = trigger once).
-
-random: random time variance in seconds added or subtracted from "wait" delay (default 0 - see Notes).
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- NOTES --------
-When the random key is set, its value is used to calculate a minimum and a maximum delay. The final time delay will be a random value anywhere between the minimum and maximum values: (min delay = wait - random) (max delay = wait + random).
-*/
-
-//=============================================================================
-
-/*QUAKED trigger_push (.5 .5 .5) ?
-This is used to create jump pads and launch ramps. It MUST point to a target_position or info_notnull entity to work. Unlike target_push, this is client side predicted.
-
--------- KEYS --------
-target: this points to the target_position to which the player will jump.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-
--------- NOTES --------
-To make a jump pad or launch ramp, place the target_position/info_notnull entity at the highest point of the jump and target it with this entity.
-*/
-
-//=============================================================================
-
-/*QUAKED trigger_teleport (.5 .5 .5) ?
-Touching this will teleport players to the location of the targeted misc_teleporter_dest entity. This entity allows client prediction of events.
-
--------- KEYS --------
-target: this must point to a misc_teleporter_dest entity.
-
-notfree: when set to 1, entity will not spawn in "Free for all" and "Tournament" modes.
-
-notteam: when set to 1, entity will not spawn in "Teamplay" and "CTF" modes.
-
-notsingle: when set to 1, entity will not spawn in Single Player mode (bot play mode).
-*/
-
-
-
-//=============================================================================
-
-WORLDSPAWN ENTITY
-
-//=============================================================================
-
-/*QUAKED worldspawn (0 0 0) ?
-Only used for the world.
--------- KEYS --------
-message: text to print at user logon. Used for name of level.
-
-music: path/name of looping .wav file used for level's music (eg. music/sonic5.wav).
-
-humanBuildPoints: The maximum amount of power the humans can use. Defaults to 1000.
-
-humanMaxStage: The highest stage the humans are allowed to use [0/1/2]. Defaults to 2.
-humanStage2Threshold: The number of kills the humans must aquire to advance to stage 2. Defaults to 50.
-humanStage3Threshold: The number of kills the humans must aquire to advance to stage 3. Defaults to 100.
-
-alienBuildPoints: The maximum amount of sentience available to the overmind. Defaults to 1000.
-
-alienMaxStage: The highest stage the aliens are allowed to use [0/1/2]. Defaults to 2.
-alienStage2Threshold: The number of kills the aliens must aquire to advance to stage 2. Defaults to 50.
-alienStage3Threshold: The number of kills the aliens must aquire to advance to stage 3. Defaults to 100.
-
-disabledEquipment: A comma delimited list of human weapons or upgrades to disable for this map.
-disabledClasses: A comma delimited list of alien classes to disable for this map.
-disabledBuildables: A comma delimited list of buildables to disable for this map.
-
-_ambient OR ambient: Adds a constant value to overall lighting. Use is not recommended. Ambient light will have a tendency to flatten out variations in light and shade.
-
-_color: RGB value for ambient light color (default is 0 0 0).
-
-gravity: gravity of level (default is normal gravity: 800).
-
-gridsize: granularity of the lightgrid created by q3map. Value is three integers separated by spaces, representing number of units between grid points in X Y Z. Default gridsize value is 128 128 256. Use larger powers of 2 to reduce BSP size and compile time on very large maps.
-
-_blocksize: q3map always splits the BSP tree along the planes X=_blocksize*n and Y=_blocksize*n. Default _blocksize value is 1024. Increase the blocksize using larger powers of 2 to reduce compile times on very large maps with a low structural brush density.
-
--------- Q3MAP2 KEYS --------
-_minlight: Minimum light value, levelwide. Uses the _color key to set color. Does not add unlike ambient.
-
-_minvertexlight: Minimum vertex lighting, levelwide.
-
-_mingridlight: Minimum lightgrid (dynamic entity lighting) levelwide.
-
-_keeplights: Keep light entities in the BSP. Normally stripped out by the BSP process and read from the .map file by the lighting phase.
-
-_noshadersun: Ignore q3map_sun/sun directives in sky shaders and ONLY use entity sun lights.
-
-_farplanedist: Limit on how many units the vis phase of compilation can see. Used in combination with level-wide fog, it can help reduce r_speeds on large, open maps.
-
-_foghull: Shader to use for "fog hull." Foghull shader should be a sky shader. Omit the "textures/" prefix.
-
-_lightmapscale: Floating point value scaling the resolution of lightmaps on brushes/patches in the world. Can be overridden in func_group (or other entities) (default 1.0).
-
-_cs OR _castshadows: Allows per-entity control over shadow casting. Defaults to 0 on entities, 1 on world. 0 = no shadow casting. 1 = cast shadows on world. > 1 = cast shadows on entities with _rs (or _receiveshadows) with the corresponding value, AND world. Negative values imply same, but DO NOT cast shadows on world.
-
-_rs OR _receiveshadows: Allows per-entity control over shadow reception. Defaults to 1 on everything (world shadows). 0 = receives NO shadows. > 1 = receive shadows only from corresponding keyed entities (see above) and world. < 1 = receive shadows ONLY from corresponding keyed entities.
-
-_celshader: Sets the cel shader used for this geometry. Note: omit the "textures/" prefix. Overridable in entities.
-
--------- Q3MAP2 TERRAIN KEYS --------
-_indexmap OR alphamap: Path/name for the art file used to guide the mapping of textures on the terrain surface.
-
-_layers OR layers: Integer value is the number unique root shaders that will be use on the terrain.
-
-_shader OR shader: Path to the metashader used to assign textures to the terrain entity. Note: Omit the "textures/" prefix.
-*/
-
diff --git a/misc/manual.lyx b/misc/manual.lyx
deleted file mode 100644
index a8450bc..0000000
--- a/misc/manual.lyx
+++ /dev/null
@@ -1,8358 +0,0 @@
-#LyX 1.3 created this file. For more info see http://www.lyx.org/
-\lyxformat 221
-\textclass article
-\language english
-\inputencoding auto
-\fontscheme pslatex
-\graphics default
-\paperfontsize default
-\spacing single
-\papersize a4paper
-\paperpackage a4
-\use_geometry 1
-\use_amsmath 0
-\use_natbib 0
-\use_numerical_citations 0
-\paperorientation portrait
-\leftmargin 2cm
-\topmargin 2cm
-\rightmargin 2cm
-\bottommargin 2cm
-\secnumdepth 3
-\tocdepth 3
-\paragraph_separation skip
-\defskip medskip
-\quotes_language english
-\quotes_times 2
-\papercolumns 1
-\papersides 1
-\paperpagestyle empty
-
-\layout Title
-
-TREMULOUS 1.1.0
-\layout Standard
-
-
-\begin_inset LatexCommand \tableofcontents{}
-
-\end_inset
-
-
-\layout Section
-
-Introduction
-\layout Standard
-
-Tremulous is a first person shooter featuring two opposing teams, humans
- and aliens.
- Both teams are able to build structures such as spawn points, which are
- vital to their victory.
- The goal of Tremulous is to eliminate the opposing team and all of their
- spawn points.
-\layout Standard
-
-Each team in Tremulous differs fundamentally from the other.
- The aliens are class based, with two classes initially available: the alien
- team's builder, known as the Granger, and the Dretch, the weakest offensive
- alien.
- The aliens are awarded frags for killing their foes which may be used to
- evolve into stronger classes, capable of greater and more varied maneuvers.
- In contrast the human team is upgrade based, receiving credits for kills
- that may be exchanged at an Armoury structure for new weapons, armour and
- equipment.
- Two such upgrades are available for free: a rifle and a construction kit,
- used for building structures.
-\layout Standard
-
-During a game of Tremulous, each team occupies one of three stages of developmen
-t.
- These stages are reached by accruing more than a specific total number
- of kills by the whole team.
- Each new stage unlocks new classes, upgrades and buildable structures.
- If one team reaches a stage significantly earlier than the other team it
- stands a better chance of defeating the opposing team.
-\layout Standard
-
-Section
-\begin_inset LatexCommand \ref{sec:Game}
-
-\end_inset
-
- details the content of the game including the various controls that are
- used to play.
- Section
-\begin_inset LatexCommand \ref{sec:Technical}
-
-\end_inset
-
- describes some technical aspects of how Tremulous works.
- It is not necessary to read this section in order to play the game.
-\layout Section
-
-
-\begin_inset LatexCommand \label{sec:Game}
-
-\end_inset
-
-Game
-\layout Subsection
-
-Aliens
-\layout Standard
-
-Two classes are available upon joining the alien team: the Dretch and the
- Granger.
- As you gain kills, you may use your earned frags to evolve into higher
- classes with the
-\noun on
-Use Structure/Evolve
-\noun default
- button.
- The alien team is mostly limited to melee attacks and must use stealth
- and speed to defeat the longer range humans.
- All aliens automatically regenerate health at a slow rate.
-\layout Subsubsection
-
-Classes
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Granger
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename granger.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Build
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Destroy Structure
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Deconstruct Structure
-\noun default
- on an alien structure
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Granger
-\emph default
- is the alien team's builder class.
-
-\noun on
-Primary Attack
-\noun default
- will bring up a menu of structures available for building.
- After selecting a structure a glowing outline of it will appear.
- When this outline is green you can use the
-\noun on
-Primary Attack
-\noun default
- button to place it.
- The outline changes to red when the structure cannot be placed in its current
- location.
- To cancel placing the structure press the
-\noun on
-Secondary Attack
-\noun default
- button.
- To remove a placed structure use the
-\noun on
-Deconstruct Structure
-\noun default
- button.
- After building or deconstructing a structure a timer will appear in the
- lower right corner of the screen.
- Until this timer expires you cannot create or destroy another building.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Advanced Granger
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename agranger.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Build
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Slash
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Secondary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Lob Projectile
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Activate Upgrade
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Destroy Structure
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Deconstruct Structure
-\noun default
-on an alien structure
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Wallwalk
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Crouch
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Advanced Granger
-\emph default
- becomes available at no cost when the alien team reaches stage two.
- In addition to the
-\emph on
-Granger's
-\emph default
- abilities, the
-\emph on
-Advanced Granger
-\emph default
- can move faster, jump higher, walk on walls and attack with a slash or
- by lobbing small projectiles with the
-\noun on
-Activate Upgrade
-\noun default
- button.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Dretch
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename dretch.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Bite
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Touch a human
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Wallwalk
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Crouch
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Dretch
-\emph default
- is the alien team's weakest offensive class.
- Its only attack is to make forward contact with a human player or human
- defensive structure.
- The amount of damage dealt to a human depends on what armour they were
- wearing and where they were hit, with headshots resulting in the most damage.
-
-\emph on
-Dretches
-\emph default
- can also wallwalk; toggle it by pressing the
-\noun on
-Crouch
-\noun default
- button.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Basilisk
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename basilisk.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 1
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Slash
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Grab
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Touch a human
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Wallwalk
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Crouch
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Basilisk
-\emph default
- attacks by using the
-\noun on
-Primary Attack
-\noun default
- button.
- It can also grab human players by making contact with them at close range.
- This freezes humans in place and, if they're not wearing a
-\emph on
-Battlesuit
-\emph default
-, restricts their ability to turn.
- The
-\emph on
-Basilisk
-\emph default
- can also wallwalk; toggle it by pressing the
-\noun on
-Crouch
-\noun default
- button.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Advanced Basilisk
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename abasilisk.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 2
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Slash
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Gas
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Secondary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Grab
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Touch a human
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Wallwalk
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Crouch
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-In addition to the
-\emph on
-Basilisk's
-\emph default
- abilities, the
-\emph on
-Advanced Basilisk
-\emph default
- can spray a cloud of noxious gas that will disorient and poison affected
- human players.
- Humans equipped with a
-\emph on
-Battlesuit
-\emph default
- are immune to gas.
- Use this ability with the
-\noun on
-Secondary Attack
-\noun default
- button.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Marauder
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename marauder.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 2
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Bite
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Wall Jump
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Jump into a wall while holding down
-\noun on
-Jump
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Marauder
-\emph default
- attacks with the
-\noun on
-Primary Attack
-\noun default
- button and has the ability to rebound off walls.
- To use this ability jump towards a wall and hold down the
-\noun on
-Jump
-\noun default
- button.
- When you hit the wall you will be propelled upward and in the direction
- opposite of the wall.
- As long as you continue hitting walls you will continue wall jumping.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Advanced Marauder
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename amarauder.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 3
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Bite
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Zap
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Secondary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Wall Jump
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Jump into a wall while holding down
-\noun on
-Jump
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-In addition to the
-\emph on
-Marauder's
-\emph default
- abilities, the
-\emph on
-Advanced Marauder
-\emph default
- can use a chain lightning attack.
- To use this, press the
-\noun on
-Secondary Attack
-\noun default
- button while aiming at a nearby human or human structure.
- If it connects the electric shock will jump to up to two other nearby targets
- doing full damage to the first, half damage to the second and one third
- damage to the third over a period of one second provided the attacker stays
- within range.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Dragoon
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename dragoon.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 3
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Bite
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Pounce
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Hold down
-\noun on
-Secondary Attack
-\noun default
- briefly then release
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Dragoon
-\emph default
- attacks by either biting with the
-\noun on
-Primary Attack
-\noun default
- button or pouncing with
-\noun on
-Secondary Attack
-\noun default
-.
- To pounce, first hold down the
-\noun on
-Secondary Attack
-\noun default
- button to charge up, then release to leap forward and damage anything that
- gets in the way.
- While charging you will be unable to jump normally and will move at a reduced
- rate.
- Aim up a little to fly further when pouncing.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Advanced Dragoon
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename adragoon.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 4
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 3
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Bite
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Pounce
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Hold down
-\noun on
-Secondary Attack
-\noun default
- briefly then release
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Shoot Barb
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Activate Upgrade
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-In addition to the
-\emph on
-Dragoon's
-\emph default
- abilities, the
-\emph on
-Advanced Dragoon
-\emph default
- can fire long ranged spiked barbs with the
-\noun on
-Activate Upgrade
-\noun default
- button.
- Up to three of these barbs may be held in reserve and they regenerate automatic
-ally over time.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Tyrant
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename tyrant.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 5
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 3
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Ability
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Control
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Slash
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Trample
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Hold down
-\noun on
-Secondary Attack
-\noun default
- briefly then release
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Healing Aura
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stand close to teammates to increase their regeneration rate
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Tyrant
-\emph default
- attacks by either slashing with the
-\noun on
-Primary Attack
-\noun default
- button or trampling with
-\noun on
-Secondary Attack
-\noun default
-.
- To trample, first hold down the
-\noun on
-Secondary Attack
-\noun default
- button while moving forward to charge up, then release to run at high speed
- for a short time, damaging anything in your path.
- The
-\emph on
-Tyrant
-\emph default
- also has a healing aura that will double the regeneration rate of lower
- class aliens within range.
-\layout Subsubsection
-
-Structures
-\layout Standard
-
-All alien structures must be built in proximity to an
-\emph on
-Egg
-\emph default
- or an
-\emph on
-Overmind
-\emph default
-.
- All alien structures require the presence of an
-\emph on
- Overmind
-\emph default
- to function.
- All alien structures create `creep' around their bases that slows human
- movement.
- When destroyed, alien structures explode in a shower of acid harmful to
- humans.
- All structures may be built on level floors and when
-\emph on
-Advanced Grangers
-\emph default
- become available some structures may also be built on walls and ceilings.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Overmind
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename overmind.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Sentience: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Overmind
-\emph default
- is the collective consciousness that controls all the alien structures
- in a map and enables aliens to evolve into higher forms.
- There can only be one
-\emph on
-Overmind
-\emph default
- and it must be alive before any other structures can be built.
- If the
-\emph on
-Overmind
-\emph default
- is destroyed then all structures besides
-\emph on
-Eggs
-\emph default
- cease to function and every alien loses the ability to upgrade their class
- until a new
-\emph on
-Overmind
-\emph default
- is built.
- The
-\emph on
-Overmind
-\emph default
- has a limited amount of `sentience' which is distributed amongst every
- other structure built, each having its own cost.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Egg
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename egg.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Sentience: 10
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Egg
-\emph default
- is the most basic and important alien structure; it is from these that
- aliens spawn into the game.
- They are also the only structure that continues to function in the absence
- of an
-\emph on
-Overmind
-\emph default
-.
-
-\emph on
-Eggs
-\emph default
- may be built on ceilings.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Acid Tube
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename acidtube.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Sentience: 8
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Acid Tubes
-\emph default
- are the primary defensive structure for the alien team.
- When approached by a human they eject lethal acid in all directions, even
- over other structures.
-
-\emph on
- Acid Tubes
-\emph default
- may be built on walls and ceilings.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Barricade
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename barricade.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Sentience: 10
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Barricades
-\emph default
- are used to obstruct corridors and doorways, hindering human movement and
- line-of-sight.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Trapper
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename trapper.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Sentience: 8
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Trappers
-\emph default
- fire a blob of adhesive spit at any human in their line of sight, freezing
- them in place and, if they're not wearing a
-\emph on
-Battlesuit
-\emph default
-, restricts their ability to turn.
-
-\emph on
- Trappers
-\emph default
- may be built on walls and ceilings, and are rarely effective when built
- on floors.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Booster
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename booster.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Sentience: 12
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-Any alien that touches a
-\emph on
-Booster
-\emph default
- is provided with a poison enhancement on all their melee attacks for a
- limited time.
- Poison causes victims to lose health steadily over time unless they use
- a
-\emph on
- Medkit
-\emph default
- or visit a
-\emph on
-Medistation
-\emph default
-.
- Poison does not work against humans equipped with a
-\emph on
-Battlesuit
-\emph default
-.
- The
-\emph on
-Booster
-\emph default
- will also double the regeneration rate of any nearby aliens with the exception
- of
-\emph on
- Tyrants
-\emph default
-.
- The healing aura of a
-\emph on
- Tyrant
-\emph off
-
-\emph default
-i
-\emph off
-s not
-\emph default
-cumulative
-\emph off
- with the healing effect of boosters.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Hovel
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename hovel.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Sentience: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 3
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Hovels
-\emph default
- are armored shells that
-\emph on
-Grangers
-\emph default
- may hide in should the need arise.
- There can only be one Hovel.
- They may be entered and exited with the
-\noun on
-Use Structure/Evolve
-\noun default
- button.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Hive
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename hive.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Sentience: 12
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 3
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Hives
-\emph default
- house millions of tiny insectoid aliens.
- When a human approaches the structure the insects attack.
-
-\emph on
-Hives
-\emph default
- may be built on ceilings.
-\layout Subsection
-
-Humans
-\layout Subsubsection
-
-Weapons
-\layout Standard
-
-Humans may spawn with either the
-\emph on
-Construction Kit
-\emph default
- or the
-\emph on
-Rifle
-\emph default
-.
- As credits are earned, humans may sell their old upgrades and purchase
- new ones at an
-\emph on
-Armoury
-\emph default
- structure.
- Ammo may be refilled for normal weapons at
-\emph on
-Armouries
-\emph default
-, or at
-\emph on
-Reactors
-\emph default
- and
-\emph on
-Repeaters
-\emph default
- for energy weapons, all at no cost.
- Players may only carry one weapon at a time, excluding the
-\emph on
-Blaster
-\emph default
-.
- In general the humans rely on long range weapons to make up for their lack
- of mobility relative to the alien team.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Construction Kit
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename ckit.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Construction Kit
-\emph default
- is the humans' method of building structures.
- The
-\noun on
-Primary
-\noun default
-
-\noun on
-Attack
-\noun default
- button will bring up a menu of structures available for building.
- After selecting a structure, a glowing outline of it will appear.
- When this outline is green, pressing the
-\noun on
-Primary Attack
-\noun default
- button will place it.
- When the outline is red, the structure cannot be placed in its current
- location.
- To cancel placing the structure, press the
-\noun on
-Secondary Attack
-\noun default
- button.
- To remove a placed structure, use the
-\noun on
-Deconstruct Structure
-\noun default
- button.
- After building or deconstructing a structure, a timer will show up in the
- lower right corner of the screen.
- Until this timer expires, you cannot create, destroy or repair any structures.
- Damaged structures may otherwise be repaired with the
-\noun on
-Secondary Attack
-\noun default
- button.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Advanced Construction Kit
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename ackit.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-At stage two an upgraded
-\emph on
-Construction Kit
-\emph default
- becomes available that allows the building of more advanced structures.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Blaster
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename blaster.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Blaster
-\emph default
- is the human team's standard issue backup weapon.
- All players spawn with one automatically and may not exchange it for another
- weapon.
- The
-\emph on
-Blaster
-\emph default
- fires a weak projectile and uses no ammo.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Rifle
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename rifle.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Rifle
-\emph default
- is the human team's most basic weapon and is available from spawning.
- It rapidly fires moderately accurate shots with clip sizes of 30.
- Up to 6 extra clips may be carried at a time.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Pain Saw
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename psaw.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 100
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Pain Saw
-\emph default
- is a powerful melee weapon that emits a steady electric hum when in use.
- It uses no ammunition.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Shotgun
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename shotgun.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 150
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Shotgun
-\emph default
- fires 8 pellets at a wide angle and is thus best used in close quarters.
- It holds 8 shots per clip and 3 extra clips may be carried at a time.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Las Gun
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename lasgun.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 250
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Las Gun
-\emph default
- is similar to the
-\emph on
-Rifle
-\emph default
- but is more powerful, accurate, slower to fire and uses no clips.
- It is an energy weapon and so must be refilled at a
-\emph on
-Reactor
-\emph default
- or
-\emph on
-Repeater
-\emph default
-.
- It can hold up to 200 cells at a time, or 300 with a
-\emph on
-Battery Pack
-\emph default
-.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Mass Driver
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename mdriver.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 350
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Mass Driver
-\emph default
- fires powerful, accurate shots at a slow rate of fire.
- It is an energy weapon and holds 5 shots per clip, or 7 with a
-\emph on
-Battery Pack
-\emph default
-.
- Up to 4 extra clips may be carried at a time.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Chaingun
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename chaingun.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 400
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Chaingun
-\emph default
- is a powerful, wildly inaccurate rapid-fire weapon.
- It holds up to 300 bullets at a time and is best used when crouching to
- reduce its kickback.
- Humans equipped with a
-\emph on
-Battlesuit
-\emph default
-do not experience this kickback.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Pulse Rifle
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename prifle.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 400
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Pulse Rifle
-\emph default
- is an energy weapon that fires projectiles at high speeds.
- It holds up to 50 cells per clip, or 75 with a
-\emph on
-Battery Pack
-\emph default
-.
- Up to 4 extra clips may be carried at a time.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Grenade
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename grenade.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 200
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Grenade
-\emph default
- is a hand held explosive device.
- It is thrown for a short distance by using the
-\noun on
-Activate Upgrade
-\noun default
- button.
- After a brief delay it will explode and cause tremendous damage to anything
- in its area of effect.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Flamethrower
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename flamer.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 450
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 3
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Flamethrower
-\emph default
- is a short range incendiary weapon.
- It holds up to 150 shots at a time and can easily damage the careless wielder.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Lucifer Cannon
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename lcannon.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 600
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 3
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Lucifer Cannon
-\emph default
- is the human team's most devastating weapon.
- It is an energy weapon that can hold up to 90 cells at a time, or 135 with
- a
-\emph on
-Battery Pack
-\emph default
-.
- By holding down the
-\noun on
-Primary Attack
-\noun default
- button, a player may charge up a powerful, slow moving projectile with
- splash damage.
- The longer the attack is charged the more powerful the projectile and the
- more ammo used.
- If the attack is charged for too long the weapon will explode, damaging
- the player.
- The
-\noun on
-Secondary Attack
-\noun default
-button fires a smaller projectile that requires no charging.
-\layout Subsubsection
-
-Upgrades
-\layout Standard
-
-Human players may equip themselves with any number of the following upgrades,
- with a few exceptions: the
-\emph on
-Jet Pack
-\emph default
- and
-\emph on
-Battery Pack
-\emph default
- may not be used together and the
-\emph on
-Battlesuit
-\emph default
- may not be used with the
-\emph on
-Jet Pack
-\emph default
-,
-\emph on
-Battery Pack
-\emph default
-,
-\emph on
-Light Armour
-\emph default
-, or
-\emph on
-Helmet
-\emph default
-.
- Only one of any type of upgrade may be carried at a time.
- Upgrades that do not grant an intrinsic effect must be selected in the
- player's inventory with the
-\noun on
-Next Upgrade
-\noun default
- and
-\noun on
-Previous Upgrade
-\noun default
- buttons and then activated with the
-\noun on
-Activate Upgrade
-\noun default
- button.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Light Armour
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename larmour.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 70
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Light Armour
-\emph default
- grants the wearer improved defense to the torso and leg areas.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Helmet
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename helmet.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 90
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Helmet
-\emph default
- improves the defense of the wearer's head and also displays a radar that
- shows the relative positions of nearby enemies and enemy structures.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Medkit
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Medkits
-\emph default
- are a free holdable given to every human upon spawning and refilled at
-\emph on
- Medistations
-\emph default
- to players with full health.
- They may not be refilled or exchanged at
-\emph on
- Armouries
-\emph default
-.
- When used with the
-\noun on
- Activate Upgrade
-\noun default
- button,
-\emph on
- Medkits
-\emph default
- immediately begin restoring health at a slow rate, gradually speeding up
- until all damage incurred before the
-\emph on
- Medkit
-\emph default
- was activated is healed.
- Additionally, if a human is poisoned, using a
-\emph on
- Medkit
-\emph default
- will cure the poison and confer a 30 second immunity to poison.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Battery Pack
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename battpack.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 100
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Battery Pack
-\emph default
- increases the maximum ammo capacity of energy weapons by 50%.
- It may not be used in conjunction with the
-\emph on
-Jet Pack
-\emph default
-.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Jet Pack
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename jetpack.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 120
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Jet Pack
-\emph default
- grants the wearer the power of slow but unlimited flight.
- When activated with the
-\noun on
-Activate Upgrade
-\noun default
- button, a player may ascend or descend using the
-\noun on
-Jump
-\noun default
- or
-\noun on
-Crouch
-\noun default
- buttons, respectively.
- The
-\emph on
-Jet Pack
-\emph default
- ceases to function if there is no operational
-\emph on
-Reactor
-\emph default
-present.
- Additionally it temporarily cuts out if the player receives any damage.
- The
-\emph on
-Jet Pack
-\emph default
- may not be used in conjunction with the
-\emph on
-Battery Pack
-\emph default
-.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Battlesuit
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename bsuit.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Cost: 400
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 3
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Battlesuit
-\emph default
- provides a significant defensive boost to the wearer's entire body.
- Due to this coverage, the
-\emph on
-Battlesuit
-\emph default
- may not be used in conjunction with any other wearable upgrade (
-\emph on
-Light Armour
-\emph default
-,
-\emph on
-Helmet
-\emph default
-,
-\emph on
-Battery Pack
-\emph default
-, and
-\emph on
-Jet Pack
-\emph default
-).
- Players are also prevented from crouching while wearing Battlesuits.
-\layout Subsubsection
-
-Structures
-\layout Standard
-
-All human structures must be built in proximity to a
-\emph on
-Reactor
-\emph default
- or a
-\emph on
-Repeater
-\emph default
-.
- With
-\emph on
-Telenodes
-\emph default
- as the only exception, all structures require the presence of a working
-
-\emph on
-Reactor
-\emph default
- to function.
- All human structures explode in a powerful blast harmful to anything within
- their radius when destroyed.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Reactor
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename reactor.jpg
- scale 75
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Power: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Reactor
-\emph default
- is the power source for all human structures in a map.
- There may only be one
-\emph on
-Reactor
-\emph default
-, and it must be present before any structures other than
-\emph on
- Repeaters
-\emph default
- can be built.
- If the
-\emph on
-Reactor
-\emph default
- is destroyed then all structures besides
-\emph on
-Telenodes
-\emph default
- cease to function.
- The
-\emph on
-Reactor
-\emph default
- has a limited amount of power which is distributed among every other structure
- built, each having its own cost.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Telenode
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename telenode.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Power: 10
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Telenode
-\emph default
- is the most basic and fundamental human structure; it is from these that
- humans spawn into the game.
- They are also the only structure that continues to function in the absence
- of a
-\emph on
- Reactor
-\emph default
-.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Machine Gun Turret
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename turret.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Power: 8
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Machine Gun Turret
-\emph default
- is the primary defensive structure for the human team.
- While they have a clear line of sight to an alien within their range, they
- will track and fire at the alien until it is dead.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Tesla Generator
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename tesla.jpg
- scale 80
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Power: 10
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 3
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Tesla Generators
-\emph default
- are a defensive structure that will unconditionally hit any target within
- their range and line of sight with an electrical surge.
- To be built and function, a
-\emph on
-Tesla Generator
-\emph default
- requires the presence of a
-\emph on
-Defense Computer
-\emph default
- somewhere in the map.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Armoury
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename armoury.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Power: 10
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Armoury
-\emph default
- is an essential part of every human base, allowing upgrades beyond the
- basic spawning equipment to be bought and exchanged.
- It is the sole means of human advancement.
- To use an
-\emph on
-Armoury
-\emph default
-, approach it and press the
-\noun on
-Use Structure/Evolve
-\noun default
- button.
- Ammo for non-energy weapons may also be acquired at no cost from an
-\emph on
-Armoury
-\emph default
- by using the
-\noun on
-Buy Ammo
-\noun default
- button.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Defense Computer
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename dcc.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Power: 8
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Defense Computers
-\emph default
- coordinate the attacks of
-\emph on
-Machine Gun Turrets
-\emph default
-, preventing them from firing at a single target when multiple targets are
- available.
- They are also required for the production of
-\emph on
-Tesla Generators
-\emph default
-.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Medistation
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename medistat.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Power: 8
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 1
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The
-\emph on
-Medistation
-\emph default
- provides the only means for humans to heal themselves.
- By standing on one, a human will quickly regenerate health up to their
- maximum of 100.
-
-\emph on
- Medistations
-\emph default
- will also refill
-\emph on
- Medkits
-\emph default
- to humans with full health.
- Only one person may use a
-\emph on
-Medistation
-\emph default
- at a time.
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\emph on
-Repeater
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\begin_inset Graphics
- filename repeater.jpg
- scale 85
-
-\end_inset
-
-
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Power: 0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Stage: 2
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\emph on
-Repeaters
-\emph default
- serve as power distributors that may be built anywhere not already powered,
- even when no
-\emph on
-Reactor
-\emph default
- is present.
- Any other structure may be built in proximity to a working
-\emph on
-Repeater
-\emph default
- as if it were a
-\emph on
-Reactor
-\emph default
-.
- If a
-\emph on
-Repeater
-\emph default
- powers nothing for 90 seconds, it will automatically self destruct.
-\layout Section
-
-
-\begin_inset LatexCommand \label{sec:Technical}
-
-\end_inset
-
-Technical
-\layout Subsection
-
-Bindings
-\layout Standard
-\align center
-
-\begin_inset Tabular
-
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-Name in menu
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Binding
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Function
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Primary Attack
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-+attack
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Use primary attack function.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Secondary Attack
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-+button5
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Use secondary attack function.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Previous Upgrade
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-weapprev
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As human, preselect the previous upgrade in your inventory.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Next Upgrade
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-weapnext
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As human, preselect the next upgrade in your inventory.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Activate Upgrade
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-+button2
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As human, activate the current preselected inventory item.
- Also used for some alien abilities.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Reload
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-reload
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As human, reload the selected weapon.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Buy Ammo
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-buy ammo
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As human, buy ammo from an
-\emph on
-armoury
-\emph default
-,
-\emph on
-repeater
-\emph default
- or
-\emph on
-reactor
-\emph default
-.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Use Medkit
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-itemact medkit
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As human, activate your
-\emph on
-Medkit
-\emph default
-.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Use Structure/Evolve
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-+button7
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As human, use the structure in front of the player.
- As alien, evolve into a different class.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Deconstruct Structure
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-deconstruct
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As a builder class, deconstruct the structure in front of the player cleanly.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-
-\noun on
-Sprint
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-boost
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Run faster.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-destroy
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As a builder class, destroy the structure in front of the player.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-itemact -
-\end_inset
-
|
-
-\begin_inset Text
-
-\layout Standard
-
-If held, activate the specified item.
- For weapons this will select them.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-itemdeact -
-\end_inset
-
|
-
-\begin_inset Text
-
-\layout Standard
-
-If held, deactivate the specified item.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-itemtoggle -
-\end_inset
-
|
-
-\begin_inset Text
-
-\layout Standard
-
-If held, toggle the state of the specified item.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-sell -
-\end_inset
-
|
-
-\begin_inset Text
-
-\layout Standard
-
-If held and within range of an
-\emph on
-armoury
-\emph default
-, sell the specified item.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-sell weapons
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-If within range of an
-\emph on
-armoury
-\emph default
-, sell all weapons.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-sell upgrades
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-If within range of an
-\emph on
-armoury
-\emph default
-, sell all upgrades.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-buy -
-\end_inset
-
|
-
-\begin_inset Text
-
-\layout Standard
-
-If within range of an
-\emph on
-armoury
-\emph default
- and sufficiently wealthy, buy the specified item.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-class
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Given sufficient kills, evolve to the specified class.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
---
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-
-\series bold
-build
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-As a builder class, build the specified structure.
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-
-\series bold
--
-\series default
- --
-\emph on
-blaster, rifle, ckit, ackit, shotgun, lgun, prifle, mdriver, flamer, chaingun,
- lcannon, psaw, gren, medkit, jetpack
-\layout Standard
-
-
-\series bold
-
-\series default
- --
-\emph on
-builder, builderupg, level0, level1, level1upg, level2, level2upg, level3,
- level3upg, level4
-\layout Standard
-
-
-\series bold
-
-\series default
- --
-\emph on
-eggpod, barricade, booster, acid_tube, hive, trapper, overmind, hovel, telenode,
- medistat, mgturret, tesla, dcc, arm, reactor, repeater
-\layout Subsection
-
-Particle System
-\layout Standard
-
-Files matching the pattern scripts/*.particle are loaded as particle system
- description files.
- Each .particle file can contain an arbitrary number of discrete particle
- systems, much like a .shader file can house many shaders.
- A particle system is declared by a name followed by curly braces within
- which the functionality of the particle system is defined.
- For example:
-\layout LyX-Code
-
-aShinyNewParticleSystem { }
-\layout Standard
-
-Inside the particle system declaration are placed up to four particle ejectors.
- Ejectors are identified by the keyword ejector and curly braces:
-\layout LyX-Code
-
-aShinyNewParticleSystem
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- ejector { }
-\layout LyX-Code
-
- ejector { }
-\layout LyX-Code
-
- thirdPersonOnly
-\layout LyX-Code
-
-}
-\layout Standard
-
-The thirdPersonOnly keyword may be used to specify that the particle system
- is not visible from the first person if it relates to that client.
- The role of the particle ejector is to create some number of new particles
- at a defined rate.
- These attributes are controlled by the following parameters:
-\layout Itemize
-
-
-\emph on
-count |infinite
-\emph default
- - the number of particles this ejector will spawn.
-\layout Itemize
-
-
-\emph on
-delay
-\emph default
- - the delay in msec before the ejector starts spawning.
-\layout Itemize
-
-
-\emph on
-period
-\emph default
- - the period between particle ejections.
-\layout Standard
-
-It is perfectly acceptable to have an initial period of zero.
- In this case the number of particles specified by the count keyword will
- be ejected at once.
- It is not permissible to have count infinite and a period of zero for obvious
- reasons.
-\layout Standard
-
-At ejection time each ejector creates up to four new particles based on
- templates.
- These are specified in the ejector section using the particle keyword:
-\layout LyX-Code
-
-aShinyNewParticleSystem
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- ejector
-\layout LyX-Code
-
- {
-\layout LyX-Code
-
- particle { }
-\layout LyX-Code
-
- particle { }
-\layout LyX-Code
-
- count 50
-\layout LyX-Code
-
- delay 0
-\layout LyX-Code
-
- period 0 - 0
-\layout LyX-Code
-
- }
-\layout LyX-Code
-
-}
-\layout Standard
-
-Each particle template has a number of attributes:
-\layout Itemize
-
-
-\emph on
-shader |sync ...
-
-\emph default
- - this specifies the shaders to use for the particle.
- The frame rate can be set to a static rate or the
-\emph on
-sync
-\emph default
- parameter can be used in which case the frame rate will be synchronised
- to the lifetime of the particle such that the first frame is displayed
- on birth and the last frame is displayed immediately before death.
-\layout Itemize
-
-model ...
- - use one of the specified models as the particle.
- This cannot be used in conjunction with the shader keyword.
-\layout Itemize
-
-modelAnmation |sync - animation
- parameters to use when model particles are employed.
-\layout Itemize
-
-
-\emph on
-displacement
-\emph default
- - a static displacement about the attachment point.
- The
-\emph on
-variance
-\emph default
- parameter specifies a random displacement in all axes.
-\layout Itemize
-
-
-\emph on
-normalDisplacement
-\emph default
- - for particle systems that have their normal set (impact particle systems
- for example) this specifies the magnitude of a displacement along the normal.
-\layout Itemize
-
-
-\emph on
-velocityType static|static_transform|tag|cent|normal
-\emph default
- - this specifies how the particle will compute its initial velocity.
-
-\emph on
-static
-\emph default
- means it is specified statically in the .particle file,
-\emph on
-static_transform means the same, except that it is transformed by the orientatio
-n matrix of what it is attached to, tag
-\emph default
- means the velocity is in the direction of the tag it is attached to,
-\emph on
-cent
-\emph default
- means the velocity is in the direction of the cent it is attached to and
-
-\emph on
-normal
-\emph default
- means the velocity is in the direction of the particle system normal.
-\layout Itemize
-
-
-\emph on
-velocityDir linear|point
-\emph default
- - this specifies whether the initial velocity is computed as a simple direction
- or as the direction towards a secondary point (defined by
-\emph on
-velocityPoint
-\emph default
- or dynamically through
-\emph on
-velocityType cent
-\emph default
-).
-\layout Itemize
-
-
-\emph on
-velocity
-\emph default
- - for when
-\emph on
-velocityType
-\emph default
-
-\emph on
-static
-\emph default
- is present this specifies the direction.
- The
-\emph on
-variance
-\emph default
- here is specified in degrees e.g.
- "~5" - up to 5 degrees deviation.
-\layout Itemize
-
-
-\emph on
-velocityMagnitude
-\emph default
- - the magnitude of the velocity.
-\layout Itemize
-
-
-\emph on
-velocityPoint
-\emph default
- - for when
-\emph on
-velocityType static
-\emph default
- and
-\emph on
-velocityDir point
-\emph default
- are present this specifies the point to move towards.
-\layout Itemize
-
-
-\emph on
-parentVelocityFraction
-\emph default
- - for when the particle system is attached to a cent this specifies the
- fraction of the cent's velocity that is added to the particle's velocity.
-\layout Itemize
-
-
-\emph on
-accelerationType static|static_transform|tag|cent|normal
-\emph default
- - this specifies how the particle will compute its acceleration.
-
-\emph on
-static
-\emph default
- means it is specified statically in the .particle file,
-\emph on
-static_transform means the same, except that it is transformed by the orientatio
-n matrix of what it is attached to,
-\emph default
-
-\emph on
-tag
-\emph default
- means the acceleration is in the direction of the tag it is attached to,
-
-\emph on
-cent
-\emph default
- means the acceleration is in the direction of the cent it is attached to
- and
-\emph on
-normal
-\emph default
- means the acceleration is in the direction of the particle system normal.
-\layout Itemize
-
-
-\emph on
-accelerationDir linear|point
-\emph default
- - this specifies whether the acceleration is computed as a simple direction
- or as the direction towards a secondary point (defined by
-\emph on
-accelerationPoint
-\emph default
- or dynamically through
-\emph on
-accelerationType cent
-\emph default
-).
-\layout Itemize
-
-
-\emph on
-acceleration
-\emph default
- - for when
-\emph on
-accelerationType
-\emph default
- static is present this specifies the direction.
- The
-\emph on
-variance
-\emph default
- here is specified in degrees e.g.
- "~5" - up to 5 degrees deviation.
-\layout Itemize
-
-
-\emph on
-accelerationMagnitude
-\emph default
- - the magnitude of the acceleration.
-\layout Itemize
-
-
-\emph on
-accelerationPoint
-\emph default
- - for when
-\emph on
-accelerationType static
-\emph default
- and
-\emph on
-accelerationDir point
-\emph default
- are present this specifies the point to move towards.
-\layout Itemize
-
-
-\emph on
-bounce |cull
-\emph default
- - the fraction of velocity that is reflected when a particle collides.
- If this is set to 0.0 the particle won't collide.
- When
-\emph on
-cull
-\emph default
- is used particles are culled as soon as they collide with objects.
-\layout Itemize
-
-bounceMark - make a mark at each bounce point
- for up to bounces.
-\layout Itemize
-
-bounceSound - make a sound at each bounce point for up to
- bounces.
-\layout Itemize
-
-dynamicLight { }
- - attach a dynamic light to this particle.
-\layout Itemize
-
-color { } { } - color the particle
- where refers to the initial color component and refers to the final
- color component.
-\layout Itemize
-
-
-\emph on
-overdrawProtection
-\emph default
- - cull particles that occupy a large amount of screen space.
-\layout Itemize
-
-
-\emph on
-realLight
-\emph default
- - light particles using the lightgrid instead of fullbright.
-\layout Itemize
-
-
-\emph on
-cullOnStartSolid
-\emph default
- - cull particles that are spawned inside brushes.
-\layout Itemize
-
-
-\emph on
-radius
-\emph default
- - the radius of the particle throughout its lifetime.
- The
-\emph on
-delay
-\emph default
- parameter specifies the time in msec before radius scaling begins.
- The
-\emph on
-initial
-\emph default
- and
-\emph on
-final
-\emph default
- parameters specify the radii of the particle in quake units.
-\layout Itemize
-
-
-\emph on
-alpha
-\emph default
- - the alpha of the particle throughout its lifetime.
- The
-\emph on
-delay
-\emph default
- parameter specifies the time in msec before alpha scaling begins.
- The
-\emph on
-initial
-\emph default
- and
-\emph on
-final
-\emph default
- parameters specify the alpha of the particle where 1.0 is totally opaque
- and 0.0 is totally transparent.
-\layout Itemize
-
-
-\emph on
-rotation
-\emph default
- - the rotation of the particle throughout its lifetime.
- The
-\emph on
-delay
-\emph default
- parameter specifies the time in msec before the rotation begins.
- The
-\emph on
-initial
-\emph default
- and
-\emph on
-final
-\emph default
- parameters specify the rotation of the particle in degrees.
-\layout Itemize
-
-
-\emph on
-lifeTime
-\emph default
- - the lifetime of the particle.
-\layout Itemize
-
-
-\emph on
-childSystem
-\emph default
- - specifies a particle system to attach to this particle.
-\layout Itemize
-
-childTrailSystem - specifies a trail system to attach to
- this particle.
-\layout Itemize
-
-
-\emph on
-onDeathSystem
-\emph default
- - specifies a particle system to spawn at the point where this particle
- died.
-\layout Standard
-
-Except for vector components,
-\emph on
-shader fps ...
-
-\emph default
- and
-\emph on
-period
-\emph default
-, every value can be specified with a random variance.
- The syntax for this is as follows:
-\layout LyX-Code
-
-[value][~variance[%]]
-\layout Standard
-
-So the following forms are possible, where random is a random number between
- 0.0 and 1.0 inclusive:
-\layout LyX-Code
-
-5.0 // 5.0
-\layout LyX-Code
-
-5.0~8.0 // 5.0 + ( random * 8.0 )
-\layout LyX-Code
-
-5.0~200% // 5.0 + ( random * 5.0 * 200% )
-\layout LyX-Code
-
-~7.0 // random * 7.0
-\layout Standard
-
-This allows for relatively flexible randomisation of most of the particle's
- parameters.
- For parameters taking an initial and final value, specifying the final
- value as '-' will result in a final value the same as the initial value.
-\layout Standard
-
-For the purposes of map based particle systems using
-\emph on
-misc_particle_system
-\emph default
- it is safe to ignore
-\emph on
-velocityType
-\emph default
- and
-\emph on
-accelerationType tag|cent|normal
-\emph default
-,
-\emph on
-normalDisplacement
-\emph default
- and
-\emph on
-parentVelocityFraction
-\emph default
- altogether.
-\layout Standard
-
-Of course, it is not necessary to specify every parameter documented here
- for every particle system.
- If a parameter is not included it will usually default to zero.
- C/C++ style comments can be used throughout.
- There are an enormous number of possible combinations of particle systems
- parameters and as such it is impractical to test them all.
- For this reason it is possible that certain permutations do not behave
- as expected or wrongly.
- In this case you may have discovered a bug - let us know.
- Having said this when you're having problems with a particle system make
- sure you scroll up the console and check that it compiled OK, I've written
- the parser to be very intolerant of error.
-\layout Standard
-
-Here is an example particle system:
-\layout LyX-Code
-
-aShinyNewParticleSystem
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- ejector
-\layout LyX-Code
-
- {
-\layout LyX-Code
-
- particle
-\layout LyX-Code
-
- {
-\layout LyX-Code
-
- shader sync shader1 shader2
-\layout LyX-Code
-
-
-\layout LyX-Code
-
- velocityType static
-\layout LyX-Code
-
- velocityDir linear
-\layout LyX-Code
-
- velocityMagnitude 200
-\layout LyX-Code
-
- velocity 0 0 1 ~30
-\layout LyX-Code
-
-\layout LyX-Code
-
- accelerationType static
-\layout LyX-Code
-
- accelerationDir linear
-\layout LyX-Code
-
- accelerationMagnitude 50
-\layout LyX-Code
-
- acceleration 0 0 1 ~0
-\layout LyX-Code
-
-\layout LyX-Code
-
- radius 0 10.0 50.0
-\layout LyX-Code
-
- alpha 0 1.0 1.0
-\layout LyX-Code
-
- rotation 0 ~360 -
-\layout LyX-Code
-
- bounce 0.4
-\layout LyX-Code
-
- lifeTime 1500
-\layout LyX-Code
-
- }
-\layout LyX-Code
-
-\layout LyX-Code
-
- count 50
-\layout LyX-Code
-
- delay 0
-\layout LyX-Code
-
- period 0 - 0
-\layout LyX-Code
-
- }
-\layout LyX-Code
-
-}
-\layout Subsection
-
-Trail System
-\layout Standard
-
-Files matching the pattern scripts/*.trail are loaded as trail system description
- files.
- Each .trail file can contain an arbitrary number of discrete trail systems,
- much like a .shader file can house many shaders.
- A trail system is declared by a name followed by curly braces within which
- the functionality of the trail system is defined.
- For example:
-\layout LyX-Code
-
-aShinyNewTrailSystem { }
-\layout Standard
-
-Inside the particle system declaration are placed up to four trail beams.
- Beams are identified by the keyword beam and curly braces:
-\layout LyX-Code
-
-aShinyNewTrailSystem
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- beam { }
-\layout LyX-Code
-
- beam { }
-\layout LyX-Code
-
- thirdPersonOnly
-\layout LyX-Code
-
-}
-\layout Standard
-
-The thirdPersonOnly keyword may be used to specify that the trail system
- is not visible from the first person if it relates to that client.
- A trail beam describes the appearance of one element of the trail system:
-\layout LyX-Code
-
-\layout Itemize
-
-
-\emph on
-shader - the shader to use to texture this beam.
-\layout Itemize
-
-segments - the number of quads that make up the beam.
-\layout Itemize
-
-width - the width of the beam at the front and
- back.
-\layout Itemize
-
-alpha - the alpha of the beam at the front and
- back.
-\layout Itemize
-
-color { } { } - the color of the beam at the
- front and back.
-\layout Itemize
-
-segmentTime - how long a single segment lasts when the trail is only
- attached at one end.
-\layout Itemize
-
-fadeOutTime - how long this beam takes to fade away.
-\layout Itemize
-
-textureType [stretch ]|[repeat [front|back] ]
- - how to texture the beam.
- stretch causes the texture to be stretched from the front to the back using
- the specified texture coordinates.
- repeat causes the texture to be repeated over a specified length either
- from the front or the back.
-
-\layout Itemize
-
-model ...
- - use one of the specified models as the particle.
- This cannot be used in conjunction with the shader keyword.
-\layout Itemize
-
-modelAnmation |sync - animation
- parameters to use when model particles are employed.
-\layout Itemize
-
-
-\emph on
-realLight
-\emph default
- - light particles using the lightgrid instead of fullbright.
-\layout Itemize
-
-jitter - this specifies a random jitter of the position
- of each beam node by magnitude every period.
-\layout Itemize
-
-jitterAttachments - if this is specified the end points of the beam are
- jittered as well as the intervening nodes.
-\layout Subsection
-
-Map Rotation System
-\layout Standard
-
-The file
-\emph on
-maprotation.cfg
-\emph default
- is used to describe up to 16 map rotations which may be used by a Tremulous
- server.
- In its most simple form, the syntax is as follows:
-\layout LyX-Code
-
-mapRotation1
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- map1
-\layout LyX-Code
-
- map2
-\layout LyX-Code
-
- map3
-\layout LyX-Code
-
-}
-\layout LyX-Code
-
-\layout LyX-Code
-
-mapRotation2
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- map6
-\layout LyX-Code
-
- map3
-\layout LyX-Code
-
- map9
-\layout LyX-Code
-
-}
-\layout Standard
-
-This specifies two rotations, each consisting of three maps.
- The contents of the cvar
-\emph on
-g_initialMapRotation
-\emph default
- specifies the map rotation to start after the map the server was started
- with has finished.
- It is possible to specify a list of server commands to be run after a map
- has finished:
-\layout LyX-Code
-
-mapRotation3
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- map1
-\layout LyX-Code
-
- {
-\layout LyX-Code
-
- set sv_hostname
-\begin_inset Quotes eld
-\end_inset
-
-Just finished map1!
-\begin_inset Quotes erd
-\end_inset
-
-
-\layout LyX-Code
-
- set g_teamForceBalance 0
-\layout LyX-Code
-
- }
-\layout LyX-Code
-
-
-\layout LyX-Code
-
- map2
-\layout LyX-Code
-
- {
-\layout LyX-Code
-
- set g_teamForceBalance 1
-\layout LyX-Code
-
- }
-\layout LyX-Code
-
-\layout LyX-Code
-
- map3
-\layout LyX-Code
-
-}
-\layout Standard
-
-Primitive logic is also available:
-\layout LyX-Code
-
-mapRotation4
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- map1
-\layout LyX-Code
-
- goto map3
-\layout LyX-Code
-
-\layout LyX-Code
-
- map2
-\layout LyX-Code
-
- if numClients > 8
-\layout LyX-Code
-
- mapRotation3
-\layout LyX-Code
-
-\layout LyX-Code
-
- map3
-\layout LyX-Code
-
- if lastWin aliens
-\layout LyX-Code
-
- mapRotation2
-\layout LyX-Code
-
-
-\layout LyX-Code
-
- if random
-\layout LyX-Code
-
- mapRotation1
-\layout LyX-Code
-
-}
-\layout LyX-Code
-
-\layout LyX-Code
-
-mapRotation5
-\layout LyX-Code
-
-{
-\layout LyX-Code
-
- map1
-\layout LyX-Code
-
- if lastWin humans
-\layout LyX-Code
-
- map4
-\layout LyX-Code
-
- map2
-\layout LyX-Code
-
- map3
-\layout LyX-Code
-
- goto map1
-\layout LyX-Code
-
- map4
-\layout LyX-Code
-
- map5
-\layout LyX-Code
-
-}
-\layout Standard
-
-The
-\series bold
-goto
-\series default
- keyword is used to unconditionally branch to either another map
-\emph on
-in the current rotation
-\emph default
- or another map rotation entirely.
- The
-\series bold
-if
-\series default
-keyword is used in conjunction with a condition to decide whether or not
- to branch to the specified map or rotation (as with the
-\series bold
-goto
-\series default
- keyword).
- The condition itself can be one of
-\series bold
-numClients
-\series default
-,
-\series bold
-lastWin
-\series default
-or
-\series bold
-random
-\series default
-, where
-\series bold
-
-\series default
- is
-\series bold
-<
-\series default
-,
-\series bold
->
-\series default
- or
-\series bold
-=
-\series default
- and
-\series bold
-
-\series default
- is
-\series bold
-aliens
-\series default
- or
-\series bold
-humans
-\series default
-.
- The
-\series bold
-random
-\series default
- condition simply chooses whether or not to execute the change randomly,
- with each outcome equally likely.
-\layout Subsection
-
-Server Administration System (g_admin)
-\layout Standard
-
-The Tremulous game code has a built-in administration system which can work
- outside of traditional server console/rcon admin commands.
- Instead of passwords, administration rights are granted on a unique player
- identifier called cl_guid.
- Because of this, day to day administration tasks (like !kick and !mute)
- can easily be shared among a server's regular players without the risk
- of giving those players too much power or having to share passwords.
-\layout Standard
-
-Although specific admin rights can be granted to an individual, rights are
- primarily handed through a level system.
- By default there are 6 levels defined (0-5).
- Players with out any admin status are treated as level 0 with various additiona
-l rights added to each following level with level 5 having full rights.
- You can change what rights each level has by editing the configuration
- file (see below).
- Levels are referenced by number, but they can also be given names.
- There can up to 32 levels defined.
- The number used to define the level has special significance since rights
- are handled very heirarchically (e.g.
- a level 4 admin can not !mute a level 5 admin since his victim has a higher
- level).
-\layout Standard
-
-Administrator rights can granted with !setlevel command so a server operator
- need not leave the game, edit files, restart, or even type a password to
- adjust another player's admin status.
- However, the configuration for this system is contained in an easy to edit
- text file that allows a great deal of flexibility in configuring fine-grained
- access rights for each user and/or access level.
-\layout Subsubsection
-
-Quick Start
-\layout Standard
-
-To get started, you simply need to ensure that the g_admin cvar is set to
- the name of a writable data file (default is
-\begin_inset Quotes eld
-\end_inset
-
-admin.dat
-\begin_inset Quotes erd
-\end_inset
-
-).
- Then connect to the server with your Tremulous client, then run the following
- command in your client console:
-\layout LyX-Code
-
-/rcon YOUR_RCON_PASSORD !setlevel YOUR_NAME 5
-\layout Standard
-
-By default, the level 5 user is a super-user and has access to all '!' commands.
- From that point you can use the /!help command in your client to familiarize
- yourself with all the commands.
-\layout Subsubsection
-
-Related Cvars
-\layout Standard
-
-
-\begin_inset Tabular
-
-
-
-
-
-
-\begin_inset Text
-
-\layout Standard
-
-g_admin
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Set to the name of the file in the fs_game directory that should
- contain all admin data such as admin definitions and bans.
-\layout Standard
-
-If set to a blank string
-\begin_inset Quotes eld
-\end_inset
-
-
-\begin_inset Quotes erd
-\end_inset
-
- admin commands will not be available.
-\layout Standard
-
-Example:
-\layout Standard
-
-set g_admin
-\begin_inset Quotes eld
-\end_inset
-
-admin.dat
-\begin_inset Quotes erd
-\end_inset
-
-
-\layout Standard
-
-Defaults to
-\begin_inset Quotes eld
-\end_inset
-
-admin.dat
-\begin_inset Quotes erd
-\end_inset
-
- (off)
-\end_inset
- |
-
-
-
-\begin_inset Text
-
-\layout Standard
-
-g_adminLog
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Set to the name of the file in the fs_game directory that will
- log all '!' commands.
-\layout Standard
-
-Defaults to
-\begin_inset Quotes eld
-\end_inset
-
-admin.log
-\begin_inset Quotes erd
-\end_inset
-
-
-\end_inset
- |
-
-
-
-\begin_inset Text
-
-\layout Standard
-
-g_adminParseSay
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Set this to non-zero if you want the admin system to accept commands in
- player chat messages.
-\layout Standard
-
-Default is 1 (on)
-\end_inset
- |
-
-
-
-\begin_inset Text
-
-\layout Standard
-
-g_adminNameProtect
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Set this to non-zero if you want the admin system to lock each admin's name
- to his cl_guid to prevent imporsonation.
-\layout Standard
-
-Default is 1 (on)
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-g_adminTempBan
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-Set this to the number of seconds a player should be automatically banned
- for when he/she is vote kicked or kicked with the !kick command.
-\layout Standard
-
-Default is 120 (two minutes)
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Subsubsection
-
-Data File Format
-\layout Standard
-
-All admin authorization, configuration, and ban information is storedin
- the file identified with the g_admin cvar.
- This file is plain text and each of the data elements are seperated by
- blank lines.
- The supported data elements are [level], [admin], [ban], and [command].
-
-\layout Standard
-
-The [level] block is used to define which admin rights a user of a particular
- level has.
- For example:
-\layout LyX-Code
-
-[level]
-\layout LyX-Code
-
-level = 3
-\layout LyX-Code
-
-name = Level 3 Admin
-\layout LyX-Code
-
-flags = i1ahCpPkmy
-\layout Standard
-
-This definition grants all level 3 admins all the commands identified by
- the characters in the flags string (see flags table below).
-\layout Standard
-
-The [admin] block is used to define all players with administrative rights
- as identified by their cl_guid.
- These blocks are created/updated/deleted automatically when the !setlevel
- command is used.
- Additionally, these blocks can be used to grant special rights to specific
- users above or below the rights given to that user's [level] definition.
- For example:
-\layout LyX-Code
-
-[admin]
-\layout LyX-Code
-
-name = bill
-\layout LyX-Code
-
-guid = 1ABABAA74D54C3D25722E5E21121334
-\layout LyX-Code
-
-level = 3
-\layout LyX-Code
-
-flags = B-ym
-\layout Standard
-
-This grants the user bill all the rights of a level 3 user, plus the 'B'
- flag which grants access to the !showbans command.
- It also takes away from bill the !allready (y) command and the !mute and
- !unmute (m) commands.
-\layout Standard
-
-The [ban] block is created with the !ban command, and removed with the !unban
- command (or when it expires).
- Both the guid and the ip parameters are used for ban enforement.
- The ip parameter can also be used to crudely widen the scope of the IP
- ban.
- For example:
-\layout LyX-Code
-
-[ban]
-\layout LyX-Code
-
-name = all !nexterholland@
-\layout LyX-Code
-
-guid = ABCABCABCABCABCABCABCABCABCABCAB
-\layout LyX-Code
-
-ip = 206.248.131.
-\layout LyX-Code
-
-reason = banned by admin
-\layout LyX-Code
-
-made = 04/18/06 19:15:35
-\layout LyX-Code
-
-expires = 0
-\layout LyX-Code
-
-banner = Fry
-\layout Standard
-
-This would prevent anyone with an IP address inside of 206.248.131.0/24 or
- with the cl_guid ABCABCABCABCABCABCABCABCABCABCAB from connecting to the
- server.
- The expires field is the UNIX timestamp when the ban is no longer in effect,
- the special case is 0 which means it never expires.
-\layout Standard
-
-The [command] block can be used to create simple ! commands.
- The most practial use is to create certain .cfg files which change game
- settings and allow high ranking admins to load up those settings through
- a ! command.
- For example:
-\layout LyX-Code
-
-[command]
-\layout LyX-Code
-
-command = havefun
-\layout LyX-Code
-
-exec = exec fun.cfg
-\layout LyX-Code
-
-desc = Load up some crazy settings/commands levels = 4 5
-\layout Standard
-
-This would allow all level 4 and 5 admins to run the command !havefun which
- would be similar to running the command
-\begin_inset Quotes eld
-\end_inset
-
-exec fun.cfg
-\begin_inset Quotes erd
-\end_inset
-
- on the server console.
-\layout Subsubsection
-
-Admin Flags
-\layout Standard
-
-Both the [level] and [admin] blocks have the flags parameter which is a
- string of characters that grant access rights.
- The following table shows the flags for built-in COMMANDS:
-\layout Standard
-
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-FLAG
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-COMMAND
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-a
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!admintest
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-y
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!allready
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-b
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!ban/!unban
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-c
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!cancelvote
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-h
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!help
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-k
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!kick
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-D
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!listadmins
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-i
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!listplayers
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-K
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!lock/!unlock
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-m
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!mute/!unmute
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-e
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!namelog
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-n
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!nextmap
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-V
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!passvote
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-p
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!putteam
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-G
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!readconfig
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-N
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!rename
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-r
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!restart
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-s
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!setlevel
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-B
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!showbans
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-P
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!spec999
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-C
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-!time
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-The following table shows the flags for RIGHTS:
-\layout Standard
-
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-FLAG
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-RIGHT
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-1
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-cannot be vote kicked
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-3
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-never loses credits/evo for switching teams
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-4
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-can see team chat as a spectator
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-5
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-can switch teams regardless of balance settings
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-6
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-does not need to specify a reason for kick/ban
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-7
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-can call a vote at any time regardless of g_voteLimit
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-8
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-does not need to specify a duration for a ban
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-9
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-can run commands in team chat
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-0
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-inactivity settings do not apply
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-!
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-no ! commands can be used on a player with this flag
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-@
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-does not show up as an admin in the output of listplayers
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Standard
-
-In addition, there are 3 special case characters in the flags string:
-\layout Standard
-
-
-\begin_inset Tabular
-
-
-
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-FLAG
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-MEANING
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-*
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-signifies ALL commands and rights any flags following this character are
- negated.
- The only exceptions are the ! and @ flags which must be given to individual
- admins explicitly.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
-+
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-any flags following this flag will be ADDED.
- this is implied at the beginning of any flags string so it's pretty much
- worthless.
-\end_inset
- |
-
-
-|
-\begin_inset Text
-
-\layout Standard
-
--
-\end_inset
- |
-
-\begin_inset Text
-
-\layout Standard
-
-any flags following this flag will be REMOVED.
- this is particularly useful if you wish to remove a right from an admin
- that has been given through that admin's [level] definition.
-\end_inset
- |
-
-
-
-\end_inset
-
-
-\layout Section
-\pagebreak_top
-Credits
-\layout Standard
-
-Tim
-\emph on
-'Timbo'
-\emph default
- Angus -- Programming and Direction
-\layout Standard
-
-Nick
-\emph on
-'jex'
-\emph default
- Jansens -- Mapping, texturing and 2D artwork
-\layout Standard
-
-Robin
-\emph on
-'OverFlow'
-\emph default
- Marshall -- Modelling, animation and mapping
-\layout Standard
-
-Jan
-\emph on
-'Stannum'
-\emph default
- van der Weg -- Texturing and mapping
-\layout Standard
-
-Mike
-\emph on
-'Veda'
-\emph default
- Mcinnerney -- Modelling, animation and texturing
-\layout Standard
-
-Gordon
-\emph on
-'Godmil'
-\emph default
- Miller -- Mapping
-\layout Standard
-
-'Who-[Soup]' -- Mapping
-\layout Standard
-
-Tristan
-\emph on
-'jhrx'
-\emph default
- Blease -- Mapping
-\layout Standard
-
-Paul
-\emph on
-'MoP'
-\emph default
- Greveson -- Modelling and texturing
-\layout Standard
-
-Chris
-\emph on
-'Dolby'
-\emph default
- McCarthy -- Sound
-\layout Subsection*
-
-Special thanks
-\layout Standard
-
-Asa
-\emph on
-'Norfenstein'
-\emph default
- Kravets -- Manual content, QA, design and balance suggestions
-\layout Standard
-
-
-\emph on
-'Crylar'
-\emph default
- -- Concept art
-\layout Standard
-
-Yves
-\emph on
-'evillair'
-\emph default
- Allaire -- Textures
-\layout Standard
-
-Randy
-\emph on
-'ydnar'
-\emph default
- Reddig -- Textures
-\layout Standard
-
-Richard
-\emph on
-'R1CH'
-\emph default
- Stanway -- Server hosting
-\layout Standard
-
-Stéphane
-\emph on
-'MEGASTeP'
-\emph default
- Peter -- Early test server hosting
-\layout Standard
-
-Sourceforge and TARDIS -- Web hosting
-\layout Standard
-
-icculus.org -- Subversion hosting
-\layout Standard
-
-The contributors to icculus.org/quake3/ -- Various
-\layout Standard
-
-Arsonide, Bajoran, Bt, Chamooze, Crylar, Cybernetsam, dzjepp, ectox, Edo,
- evil poop, Excalibur, FroggyQuim, Idle Wild, juice, Kai, kingping, Lava
- Croft, MajorPain, MiDiaN, Molog, Mutemode, Norfenstein, Orc, R1CH, Ratti,
- Ravyn, Salteh, Sandy, SharkDog, slux, Suddien, Supa, Survivor, Swie, sysrq,
- TerrorEast, Tyler, Vitae, Woo -- Beta testers
-\layout Subsection*
-
-Also thanks
-\layout Standard
-
-babyomen, Carc, djbob, Grim, Grytviken, Gumby, heimdall, Hellbringer, Hentai,
- Mighty_Pea, Psylo, Reaper-1, RR2D02, Saig, Smack, T-bone, The GtkRadiant
- people, The inhabitants of Quake3World, ThePyro, TTimo, ValouR
-\layout Standard
-\align center
-
-\noun on
-Tremulous is copyright darklegion development 2005-2006
-\the_end
diff --git a/misc/merge-ioq3-into-trem.sh b/misc/merge-ioq3-into-trem.sh
deleted file mode 100644
index 1bf9e00..0000000
--- a/misc/merge-ioq3-into-trem.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#! /bin/sh
-
-cd /tmp
-
-# Make sure previous copies are gone
-rm -rf quake3/
-
-# Checkout a new copy of ioq3
-svn co svn://svn.icculus.org/quake3/trunk/ quake3
-cd quake3/
-
-IOQ3REVISION=`svnversion .`
-IOQ3VERSION=ioq3-r$IOQ3REVISION
-
-rm -rf $IOQ3VERSION
-svn export . $IOQ3VERSION
-cd $IOQ3VERSION
-
-# Remove READMEs and the like
-rm -rf BUGS ChangeLog README COPYING.txt NOTTODO TODO id-readme.txt web/
-
-# Remove Q3 ui stuff
-rm -rf ui/
-
-# Remove Windows/VC related stuff
-rm -f `find -iname "*.bat"`
-rm -f `find -iname "*.lnt"`
-rm -f `find -iname "*.sln"`
-rm -f `find -iname "*.vcproj"`
-rm -f `find -iname "*.def"`
-rm -f `find -iname "*.q3asm"`
-rm -f `find -iname "*.mak"`
-rm -f `find -iname "*.ico"`
-rm -f `find -iname "*.bmp"`
-rm -f code/tools/lcc/makefile.nt
-rm -rf code/win32/msvc/
-
-# Remove Linux docs
-rm -rf code/unix/LinuxSupport/
-rm -rf code/unix/setup/
-rm -f code/unix/README.*
-rm -f code/unix/quake3.*
-
-# Remove game code
-rm -rf code/cgame/ code/game/ code/ui/ code/q3_ui/
-
-mv code src
-
-cd ..
-svn_load_dirs svn://svn.icculus.org/tremulous/ -t upstream/$IOQ3VERSION upstream/current $IOQ3VERSION/
diff --git a/misc/server.cfg b/misc/server.cfg
deleted file mode 100644
index 184e9ea..0000000
--- a/misc/server.cfg
+++ /dev/null
@@ -1,39 +0,0 @@
-//Example Tremulous 1.1 decicated server config
-
-set sv_pure 1
-
-//passwords
-set g_needpass 0
-//set g_password password //server password
-//set rconPassword password //rcon password
-
-//loading screen
-set sv_hostname "Tremulous 1.1.0 Server"
-set g_motd "http://tremulous.net/"
-
-//disallow downloads from the server
-set sv_allowdownload 0
-
-//maximum number of clients
-//greater than 24 is not recommended from a gameplay point of view
-set sv_maxclients 24
-
-//after 50 minutes, all build points are removed
-set g_suddenDeathTime 50
-//after 60 minutes, the game will end as a draw
-set timelimit 60
-
-//forces each team to have a similar number of players
-set g_teamForceBalance 1
-
-//following the first map, start this rotation
-set g_initialMapRotation rotation1
-
-//misc settings
-set pmove_fixed 0
-set sv_minRate 5000
-set sv_maxRate 15000
-set sv_minSnaps 10
-
-//start this map first
-map niveus
diff --git a/misc/tremulous.ico b/misc/tremulous.ico
deleted file mode 100644
index c1c847a..0000000
Binary files a/misc/tremulous.ico and /dev/null differ
diff --git a/misc/tremulous.xpm b/misc/tremulous.xpm
deleted file mode 100644
index 5e070c8..0000000
--- a/misc/tremulous.xpm
+++ /dev/null
@@ -1,90 +0,0 @@
-/* XPM */
-static char * tremulous_xpm[] = {
-"48 48 39 1",
-" c None",
-". c #0F0F0F",
-"+ c #181818",
-"@ c #000000",
-"# c #282828",
-"$ c #212121",
-"% c #060606",
-"& c #1D1D1D",
-"* c #252525",
-"= c #080808",
-"- c #0E0E0E",
-"; c #050505",
-"> c #0B0B0B",
-", c #0C0C0C",
-"' c #232323",
-") c #1F1F1F",
-"! c #030303",
-"~ c #0D0D0D",
-"{ c #040404",
-"] c #020202",
-"^ c #141414",
-"/ c #1E1E1E",
-"( c #131313",
-"_ c #111111",
-": c #010101",
-"< c #191919",
-"[ c #090909",
-"} c #292929",
-"| c #070707",
-"1 c #121212",
-"2 c #1B1B1B",
-"3 c #161616",
-"4 c #0A0A0A",
-"5 c #222222",
-"6 c #242424",
-"7 c #1A1A1A",
-"8 c #151515",
-"9 c #101010",
-"0 c #171717",
-" ",
-" ... ",
-" +@@@@@# ",
-" $@@@@@@% ",
-" &@@@@@@@@ * ",
-" =- ;@@@@@@@@> ,@- ",
-" @@' ;@@@@@@@@@ ,@@ ",
-" )@! ;@@@@@@@@@ ~@@; ",
-" ;@{ ]@@@@@@@@@~ ,@@; ",
-" ^@@] /@@@@@@@@@@@( -@@; ",
-" .@@; /@@@@@@@@@@@ -@@@/ ",
-" _@@] /@@@@@@@@@@@ #:@@@_ ",
-" @@@; /@@@@@@@@@@< :@@@- ",
-" :@@! ]@@@@@@@@@ @@@@- ",
-" $@@@; ;@@@@@@@@[ ~]@@@- ",
-" %@@@; }!@@@@@@@@- }|@@@@, ",
-" !@@@; 1@@@@@@@@@@ 2@@@@@~ ",
-" ;@@@% [@@@@@@@@@@@@@@@@, ",
-" @@@@{|||:@@@@@@@@@@@@@@!- ",
-" -@@@@@@@@@@@@@@@@@@@@@] ",
-" .@@@@@@@@@@@@@@@@@@@{ ",
-" ]@@@@@@@@@@@@@@@@@ ",
-" .@@@@@@@@@@@@@@@@ ",
-" +@@@@@@@@@@@@@@@@@@@@@@@@@@/ ",
-" =@@@@@@@@@@@@@@@@@@@@@@@@@/ ",
-" .=@@@@@@@@@@@@@@@@@@% ",
-" ,@@@@@@@@@@@@@@@@@@@@@ ",
-" 2>]@@@@@@@@@@@@@@@@@@@@@@@3 ",
-" *:@@@@@@@@@@@@@@@@@@@@@@@@@^ ",
-" @@@||| 4]@@@@@@@@@@@@@@@@@ ",
-" 556 _@@@@@@@@@@@@@@@@3 ",
-" >@@@@@@@@@@@@@@@@+ ",
-" ;@@@@@@@@@@@@@@@@@7 ",
-" &@@@@@@@@@@@@@@@@@@@+ ",
-" @@@@@@@@@@@@@@@@@@@@@/ ",
-" 8@@@@@@@@@@@@@@@[ =@@| ",
-" ;@@:::@@@@@@@@@[ %@@[ ",
-" @@9 (@@@@@@@4 =@@ ",
-" ,@@ {:@@: {@! ",
-" !@@ << 3@@0 ",
-" !@- 3@@6 ",
-" ]@( (@[ ",
-" 7@@ ]@ ",
-" 7@@ * ",
-" 7@} ",
-" 7@ ",
-" . ",
-" "};
diff --git a/src/AL/VERSION b/src/AL/VERSION
deleted file mode 100644
index 1af4e3f..0000000
--- a/src/AL/VERSION
+++ /dev/null
@@ -1,16 +0,0 @@
-This file identifies the version of the AL headers in this directory. If you
-change or update the AL headers in any way, please make sure you also update
-this file.
-
-SVN revision >= 402
--------------------
-Headers are from OpenAL CVS 6th August 2005:
-$ cvs -d:pserver:guest@opensource.creative.com:/usr/local/cvs-repository
-login
-(use password "guest")
-$ cvs -d:pserver:guest@opensource.creative.com:/usr/local/cvs-repository
-co -D "6 Aug 2005" openal
-
-SVN revision >= 374
--------------------
-Standard OpenAL 1.0 headers
diff --git a/src/AL/al.h b/src/AL/al.h
deleted file mode 100644
index 9fd5598..0000000
--- a/src/AL/al.h
+++ /dev/null
@@ -1,505 +0,0 @@
-#ifndef __al_h_
-#define __al_h_
-
-/**
- * OpenAL cross platform audio library
- * Copyright (C) 1999-2000 by authors.
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- * Or go to http://www.gnu.org/copyleft/lgpl.html
- */
-#include "altypes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* WIN32, not Xbox */
-#ifdef _WIN32
-#ifndef _XBOX
-#ifdef _OPENAL32LIB
-#define ALAPI __declspec(dllexport)
-#else
-#define ALAPI __declspec(dllimport)
-#endif
-#define ALAPIENTRY __cdecl
-#define AL_CALLBACK
-#endif
-#endif
-
-#ifdef TARGET_OS_MAC
-#if TARGET_OS_MAC
-#pragma export on
-#endif
-#endif
-
-#ifndef ALAPI
-#define ALAPI
-#endif
-
-#ifndef ALAPIENTRY
-#define ALAPIENTRY
-#endif
-
-#ifndef CALLBACK
-#define AL_CALLBACK
-#endif
-
-#define OPENAL
-
-#ifndef AL_NO_PROTOTYPES
-
-/*
- * Renderer State management
- */
-ALAPI void ALAPIENTRY alEnable( ALenum capability );
-
-ALAPI void ALAPIENTRY alDisable( ALenum capability );
-
-ALAPI ALboolean ALAPIENTRY alIsEnabled( ALenum capability );
-
-
-/*
- * State retrieval
- */
-ALAPI const ALchar* ALAPIENTRY alGetString( ALenum param );
-
-ALAPI void ALAPIENTRY alGetBooleanv( ALenum param, ALboolean* data );
-
-ALAPI void ALAPIENTRY alGetIntegerv( ALenum param, ALint* data );
-
-ALAPI void ALAPIENTRY alGetFloatv( ALenum param, ALfloat* data );
-
-ALAPI void ALAPIENTRY alGetDoublev( ALenum param, ALdouble* data );
-
-ALAPI ALboolean ALAPIENTRY alGetBoolean( ALenum param );
-
-ALAPI ALint ALAPIENTRY alGetInteger( ALenum param );
-
-ALAPI ALfloat ALAPIENTRY alGetFloat( ALenum param );
-
-ALAPI ALdouble ALAPIENTRY alGetDouble( ALenum param );
-
-
-/*
- * Error support.
- * Obtain the most recent error generated in the AL state machine.
- */
-ALAPI ALenum ALAPIENTRY alGetError( ALvoid );
-
-
-/*
- * Extension support.
- * Query for the presence of an extension, and obtain any appropriate
- * function pointers and enum values.
- */
-ALAPI ALboolean ALAPIENTRY alIsExtensionPresent( const ALchar* extname );
-
-ALAPI void* ALAPIENTRY alGetProcAddress( const ALchar* fname );
-
-ALAPI ALenum ALAPIENTRY alGetEnumValue( const ALchar* ename );
-
-
-/*
- * LISTENER
- * Listener represents the location and orientation of the
- * 'user' in 3D-space.
- *
- * Properties include: -
- *
- * Gain AL_GAIN ALfloat
- * Position AL_POSITION ALfloat[3]
- * Velocity AL_VELOCITY ALfloat[3]
- * Orientation AL_ORIENTATION ALfloat[6] (Forward then Up vectors)
-*/
-
-/*
- * Set Listener parameters
- */
-ALAPI void ALAPIENTRY alListenerf( ALenum param, ALfloat value );
-
-ALAPI void ALAPIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-
-ALAPI void ALAPIENTRY alListenerfv( ALenum param, const ALfloat* values );
-
-ALAPI void ALAPIENTRY alListeneri( ALenum param, ALint value );
-
-ALAPI void ALAPIENTRY alListener3i( ALenum param, ALint value1, ALint value2, ALint value3 );
-
-ALAPI void ALAPIENTRY alListeneriv( ALenum param, const ALint* values );
-
-/*
- * Get Listener parameters
- */
-ALAPI void ALAPIENTRY alGetListenerf( ALenum param, ALfloat* value );
-
-ALAPI void ALAPIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
-
-ALAPI void ALAPIENTRY alGetListenerfv( ALenum param, ALfloat* values );
-
-ALAPI void ALAPIENTRY alGetListeneri( ALenum param, ALint* value );
-
-ALAPI void ALAPIENTRY alGetListener3i( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
-
-ALAPI void ALAPIENTRY alGetListeneriv( ALenum param, ALint* values );
-
-
-/**
- * SOURCE
- * Sources represent individual sound objects in 3D-space.
- * Sources take the PCM data provided in the specified Buffer,
- * apply Source-specific modifications, and then
- * submit them to be mixed according to spatial arrangement etc.
- *
- * Properties include: -
- *
- * Gain AL_GAIN ALfloat
- * Min Gain AL_MIN_GAIN ALfloat
- * Max Gain AL_MAX_GAIN ALfloat
- * Position AL_POSITION ALfloat[3]
- * Velocity AL_VELOCITY ALfloat[3]
- * Direction AL_DIRECTION ALfloat[3]
- * Head Relative Mode AL_SOURCE_RELATIVE ALint (AL_TRUE or AL_FALSE)
- * Reference Distance AL_REFERENCE_DISTANCE ALfloat
- * Max Distance AL_MAX_DISTANCE ALfloat
- * RollOff Factor AL_ROLLOFF_FACTOR ALfloat
- * Inner Angle AL_CONE_INNER_ANGLE ALint or ALfloat
- * Outer Angle AL_CONE_OUTER_ANGLE ALint or ALfloat
- * Cone Outer Gain AL_CONE_OUTER_GAIN ALint or ALfloat
- * Pitch AL_PITCH ALfloat
- * Looping AL_LOOPING ALint (AL_TRUE or AL_FALSE)
- * MS Offset AL_MSEC_OFFSET ALint or ALfloat
- * Byte Offset AL_BYTE_OFFSET ALint or ALfloat
- * Sample Offset AL_SAMPLE_OFFSET ALint or ALfloat
- * Attached Buffer AL_BUFFER ALint
- * State (Query only) AL_SOURCE_STATE ALint
- * Buffers Queued (Query only) AL_BUFFERS_QUEUED ALint
- * Buffers Processed (Query only) AL_BUFFERS_PROCESSED ALint
- */
-
-/* Create Source objects */
-ALAPI void ALAPIENTRY alGenSources( ALsizei n, ALuint* sources );
-
-/* Delete Source objects */
-ALAPI void ALAPIENTRY alDeleteSources( ALsizei n, const ALuint* sources );
-
-/* Verify a handle is a valid Source */
-ALAPI ALboolean ALAPIENTRY alIsSource( ALuint sid );
-
-/*
- * Set Source parameters
- */
-ALAPI void ALAPIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
-
-ALAPI void ALAPIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-
-ALAPI void ALAPIENTRY alSourcefv( ALuint sid, ALenum param, const ALfloat* values );
-
-ALAPI void ALAPIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
-
-ALAPI void ALAPIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
-
-ALAPI void ALAPIENTRY alSourceiv( ALuint sid, ALenum param, const ALint* values );
-
-/*
- * Get Source parameters
- */
-ALAPI void ALAPIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
-
-ALAPI void ALAPIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-
-ALAPI void ALAPIENTRY alGetSourcefv( ALuint sid, ALenum param, ALfloat* values );
-
-ALAPI void ALAPIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
-
-ALAPI void ALAPIENTRY alGetSource3i( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-
-ALAPI void ALAPIENTRY alGetSourceiv( ALuint sid, ALenum param, ALint* values );
-
-
-/*
- * Source vector based playback calls
- */
-
-/* Play, replay, or resume (if paused) a list of Sources */
-ALAPI void ALAPIENTRY alSourcePlayv( ALsizei ns, const ALuint *sids );
-
-/* Stop a list of Sources */
-ALAPI void ALAPIENTRY alSourceStopv( ALsizei ns, const ALuint *sids );
-
-/* Rewind a list of Sources */
-ALAPI void ALAPIENTRY alSourceRewindv( ALsizei ns, const ALuint *sids );
-
-/* Pause a list of Sources */
-ALAPI void ALAPIENTRY alSourcePausev( ALsizei ns, const ALuint *sids );
-
-/*
- * Source based playback calls
- */
-
-/* Play, replay, or resume a Source */
-ALAPI void ALAPIENTRY alSourcePlay( ALuint sid );
-
-/* Stop a Source */
-ALAPI void ALAPIENTRY alSourceStop( ALuint sid );
-
-/* Rewind a Source (set playback postiton to beginning) */
-ALAPI void ALAPIENTRY alSourceRewind( ALuint sid );
-
-/* Pause a Source */
-ALAPI void ALAPIENTRY alSourcePause( ALuint sid );
-
-/*
- * Source Queuing
- */
-ALAPI void ALAPIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, const ALuint *bids );
-
-ALAPI void ALAPIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
-
-
-/**
- * BUFFER
- * Buffer objects are storage space for sample data.
- * Buffers are referred to by Sources. One Buffer can be used
- * by multiple Sources.
- *
- * Properties include: -
- *
- * Frequency (Query only) AL_FREQUENCY ALint
- * Size (Query only) AL_SIZE ALint
- * Bits (Query only) AL_BITS ALint
- * Channels (Query only) AL_CHANNELS ALint
- */
-
-/* Create Buffer objects */
-ALAPI void ALAPIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
-
-/* Delete Buffer objects */
-ALAPI void ALAPIENTRY alDeleteBuffers( ALsizei n, const ALuint* buffers );
-
-/* Verify a handle is a valid Buffer */
-ALAPI ALboolean ALAPIENTRY alIsBuffer( ALuint bid );
-
-/* Specify the data to be copied into a buffer */
-ALAPI void ALAPIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
-
-/*
- * Set Buffer parameters
- */
-ALAPI void ALAPIENTRY alBufferf( ALuint bid, ALenum param, ALfloat value );
-
-ALAPI void ALAPIENTRY alBuffer3f( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-
-ALAPI void ALAPIENTRY alBufferfv( ALuint bid, ALenum param, const ALfloat* values );
-
-ALAPI void ALAPIENTRY alBufferi( ALuint bid, ALenum param, ALint value );
-
-ALAPI void ALAPIENTRY alBuffer3i( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
-
-ALAPI void ALAPIENTRY alBufferiv( ALuint bid, ALenum param, const ALint* values );
-
-/*
- * Get Buffer parameters
- */
-ALAPI void ALAPIENTRY alGetBufferf( ALuint bid, ALenum param, ALfloat* value );
-
-ALAPI void ALAPIENTRY alGetBuffer3f( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-
-ALAPI void ALAPIENTRY alGetBufferfv( ALuint bid, ALenum param, ALfloat* values );
-
-ALAPI void ALAPIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
-
-ALAPI void ALAPIENTRY alGetBuffer3i( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-
-ALAPI void ALAPIENTRY alGetBufferiv( ALuint bid, ALenum param, ALint* values );
-
-
-/*
- * Global Parameters
- */
-ALAPI void ALAPIENTRY alDopplerFactor( ALfloat value );
-
-ALAPI void ALAPIENTRY alDopplerVelocity( ALfloat value );
-
-ALAPI void ALAPIENTRY alSpeedOfSound( ALfloat value );
-
-ALAPI void ALAPIENTRY alDistanceModel( ALenum distanceModel );
-
-#else /* AL_NO_PROTOTYPES */
-
-void (ALAPIENTRY *alEnable)( ALenum capability );
-void (ALAPIENTRY *alDisable)( ALenum capability );
-ALboolean (ALAPIENTRY *alIsEnabled)( ALenum capability );
-const ALchar* (ALAPIENTRY *alGetString)( ALenum param );
-void (ALAPIENTRY *alGetBooleanv)( ALenum param, ALboolean* data );
-void (ALAPIENTRY *alGetIntegerv)( ALenum param, ALint* data );
-void (ALAPIENTRY *alGetFloatv)( ALenum param, ALfloat* data );
-void (ALAPIENTRY *alGetDoublev)( ALenum param, ALdouble* data );
-ALboolean (ALAPIENTRY *alGetBoolean)( ALenum param );
-ALint (ALAPIENTRY *alGetInteger)( ALenum param );
-ALfloat (ALAPIENTRY *alGetFloat)( ALenum param );
-ALdouble (ALAPIENTRY *alGetDouble)( ALenum param );
-ALenum (ALAPIENTRY *alGetError)( ALvoid );
-ALboolean (ALAPIENTRY *alIsExtensionPresent)(const ALchar* extname );
-void* (ALAPIENTRY *alGetProcAddress)( const ALchar* fname );
-ALenum (ALAPIENTRY *alGetEnumValue)( const ALchar* ename );
-void (ALAPIENTRY *alListenerf)( ALenum param, ALfloat value );
-void (ALAPIENTRY *alListener3f)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-void (ALAPIENTRY *alListenerfv)( ALenum param, const ALfloat* values );
-void (ALAPIENTRY *alListeneri)( ALenum param, ALint value );
-void (ALAPIENTRY *alListener3i)( ALenum param, ALint value1, ALint value2, ALint value3 );
-void (ALAPIENTRY *alListeneriv)( ALenum param, const ALint* values );
-void (ALAPIENTRY *alGetListenerf)( ALenum param, ALfloat* value );
-void (ALAPIENTRY *alGetListener3f)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
-void (ALAPIENTRY *alGetListenerfv)( ALenum param, ALfloat* values );
-void (ALAPIENTRY *alGetListeneri)( ALenum param, ALint* value );
-void (ALAPIENTRY *alGetListener3i)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
-void (ALAPIENTRY *alGetListeneriv)( ALenum param, ALint* values );
-void (ALAPIENTRY *alGenSources)( ALsizei n, ALuint* sources );
-void (ALAPIENTRY *alDeleteSources)( ALsizei n, const ALuint* sources );
-ALboolean (ALAPIENTRY *alIsSource)( ALuint sid );
-void (ALAPIENTRY *alSourcef)( ALuint sid, ALenum param, ALfloat value);
-void (ALAPIENTRY *alSource3f)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-void (ALAPIENTRY *alSourcefv)( ALuint sid, ALenum param, const ALfloat* values );
-void (ALAPIENTRY *alSourcei)( ALuint sid, ALenum param, ALint value);
-void (ALAPIENTRY *alSource3i)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
-void (ALAPIENTRY *alSourceiv)( ALuint sid, ALenum param, const ALint* values );
-void (ALAPIENTRY *alGetSourcef)( ALuint sid, ALenum param, ALfloat* value );
-void (ALAPIENTRY *alGetSource3f)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-void (ALAPIENTRY *alGetSourcefv)( ALuint sid, ALenum param, ALfloat* values );
-void (ALAPIENTRY *alGetSourcei)( ALuint sid, ALenum param, ALint* value );
-void (ALAPIENTRY *alGetSource3i)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-void (ALAPIENTRY *alGetSourceiv)( ALuint sid, ALenum param, ALint* values );
-void (ALAPIENTRY *alSourcePlayv)( ALsizei ns, const ALuint *sids );
-void (ALAPIENTRY *alSourceStopv)( ALsizei ns, const ALuint *sids );
-void (ALAPIENTRY *alSourceRewindv)( ALsizei ns, const ALuint *sids );
-void (ALAPIENTRY *alSourcePausev)( ALsizei ns, const ALuint *sids );
-void (ALAPIENTRY *alSourcePlay)( ALuint sid );
-void (ALAPIENTRY *alSourceStop)( ALuint sid );
-void (ALAPIENTRY *alSourceRewind)( ALuint sid );
-void (ALAPIENTRY *alSourcePause)( ALuint sid );
-void (ALAPIENTRY *alSourceQueueBuffers)( ALuint sid, ALsizei numEntries, const ALuint *bids );
-void (ALAPIENTRY *alSourceUnqueueBuffers)( ALuint sid, ALsizei numEntries, ALuint *bids );
-void (ALAPIENTRY *alGenBuffers)( ALsizei n, ALuint* buffers );
-void (ALAPIENTRY *alDeleteBuffers)( ALsizei n, const ALuint* buffers );
-ALboolean (ALAPIENTRY *alIsBuffer)( ALuint bid );
-void (ALAPIENTRY *alBufferData)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
-void (ALAPIENTRY *alBufferf)( ALuint bid, ALenum param, ALfloat value);
-void (ALAPIENTRY *alBuffer3f)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-void (ALAPIENTRY *alBufferfv)( ALuint bid, ALenum param, const ALfloat* values );
-void (ALAPIENTRY *alBufferi)( ALuint bid, ALenum param, ALint value);
-void (ALAPIENTRY *alBuffer3i)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
-void (ALAPIENTRY *alBufferiv)( ALuint bid, ALenum param, const ALint* values );
-void (ALAPIENTRY *alGetBufferf)( ALuint bid, ALenum param, ALfloat* value );
-void (ALAPIENTRY *alGetBuffer3f)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-void (ALAPIENTRY *alGetBufferfv)( ALuint bid, ALenum param, ALfloat* values );
-void (ALAPIENTRY *alGetBufferi)( ALuint bid, ALenum param, ALint* value );
-void (ALAPIENTRY *alGetBuffer3i)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-void (ALAPIENTRY *alGetBufferiv)( ALuint bid, ALenum param, ALint* values );
-void (ALAPIENTRY *alDopplerFactor)( ALfloat value );
-void (ALAPIENTRY *alDopplerVelocity)( ALfloat value );
-void (ALAPIENTRY *alSpeedOfSound)( ALfloat value );
-void (ALAPIENTRY *alDistanceModel)( ALenum distanceModel );
-
-/* Type Definitions */
-
-typedef void (ALAPIENTRY *LPALENABLE)( ALenum capability );
-typedef void (ALAPIENTRY *LPALDISABLE)( ALenum capability );
-typedef ALboolean (ALAPIENTRY *LPALISENABLED)( ALenum capability );
-typedef const ALchar* (ALAPIENTRY *LPALGETSTRING)( ALenum param );
-typedef void (ALAPIENTRY *LPALGETBOOLEANV)( ALenum param, ALboolean* data );
-typedef void (ALAPIENTRY *LPALGETINTEGERV)( ALenum param, ALint* data );
-typedef void (ALAPIENTRY *LPALGETFLOATV)( ALenum param, ALfloat* data );
-typedef void (ALAPIENTRY *LPALGETDOUBLEV)( ALenum param, ALdouble* data );
-typedef ALboolean (ALAPIENTRY *LPALGETBOOLEAN)( ALenum param );
-typedef ALint (ALAPIENTRY *LPALGETINTEGER)( ALenum param );
-typedef ALfloat (ALAPIENTRY *LPALGETFLOAT)( ALenum param );
-typedef ALdouble (ALAPIENTRY *LPALGETDOUBLE)( ALenum param );
-typedef ALenum (ALAPIENTRY *LPALGETERROR)( ALvoid );
-typedef ALboolean (ALAPIENTRY *LPALISEXTENSIONPRESENT)(const ALchar* extname );
-typedef void* (ALAPIENTRY *LPALGETPROCADDRESS)( const ALchar* fname );
-typedef ALenum (ALAPIENTRY *LPALGETENUMVALUE)( const ALchar* ename );
-typedef void (ALAPIENTRY *LPALLISTENERF)( ALenum param, ALfloat value );
-typedef void (ALAPIENTRY *LPALLISTENER3F)( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-typedef void (ALAPIENTRY *LPALLISTENERFV)( ALenum param, const ALfloat* values );
-typedef void (ALAPIENTRY *LPALLISTENERI)( ALenum param, ALint value );
-typedef void (ALAPIENTRY *LPALLISTENER3I)( ALenum param, ALint value1, ALint value2, ALint value3 );
-typedef void (ALAPIENTRY *LPALLISTENERIV)( ALenum param, const ALint* values );
-typedef void (ALAPIENTRY *LPALGETLISTENERF)( ALenum param, ALfloat* value );
-typedef void (ALAPIENTRY *LPALGETLISTENER3F)( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
-typedef void (ALAPIENTRY *LPALGETLISTENERFV)( ALenum param, ALfloat* values );
-typedef void (ALAPIENTRY *LPALGETLISTENERI)( ALenum param, ALint* value );
-typedef void (ALAPIENTRY *LPALGETLISTENER3I)( ALenum param, ALint *value1, ALint *value2, ALint *value3 );
-typedef void (ALAPIENTRY *LPALGETLISTENERIV)( ALenum param, ALint* values );
-typedef void (ALAPIENTRY *LPALGENSOURCES)( ALsizei n, ALuint* sources );
-typedef void (ALAPIENTRY *LPALDELETESOURCES)( ALsizei n, const ALuint* sources );
-typedef ALboolean (ALAPIENTRY *LPALISSOURCE)( ALuint sid );
-typedef void (ALAPIENTRY *LPALSOURCEF)( ALuint sid, ALenum param, ALfloat value);
-typedef void (ALAPIENTRY *LPALSOURCE3F)( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-typedef void (ALAPIENTRY *LPALSOURCEFV)( ALuint sid, ALenum param, const ALfloat* values );
-typedef void (ALAPIENTRY *LPALSOURCEI)( ALuint sid, ALenum param, ALint value);
-typedef void (ALAPIENTRY *LPALSOURCE3I)( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
-typedef void (ALAPIENTRY *LPALSOURCEIV)( ALuint sid, ALenum param, const ALint* values );
-typedef void (ALAPIENTRY *LPALGETSOURCEF)( ALuint sid, ALenum param, ALfloat* value );
-typedef void (ALAPIENTRY *LPALGETSOURCE3F)( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-typedef void (ALAPIENTRY *LPALGETSOURCEFV)( ALuint sid, ALenum param, ALfloat* values );
-typedef void (ALAPIENTRY *LPALGETSOURCEI)( ALuint sid, ALenum param, ALint* value );
-typedef void (ALAPIENTRY *LPALGETSOURCE3I)( ALuint sid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-typedef void (ALAPIENTRY *LPALGETSOURCEIV)( ALuint sid, ALenum param, ALint* values );
-typedef void (ALAPIENTRY *LPALSOURCEPLAYV)( ALsizei ns, const ALuint *sids );
-typedef void (ALAPIENTRY *LPALSOURCESTOPV)( ALsizei ns, const ALuint *sids );
-typedef void (ALAPIENTRY *LPALSOURCEREWINDV)( ALsizei ns, const ALuint *sids );
-typedef void (ALAPIENTRY *LPALSOURCEPAUSEV)( ALsizei ns, const ALuint *sids );
-typedef void (ALAPIENTRY *LPALSOURCEPLAY)( ALuint sid );
-typedef void (ALAPIENTRY *LPALSOURCESTOP)( ALuint sid );
-typedef void (ALAPIENTRY *LPALSOURCEREWIND)( ALuint sid );
-typedef void (ALAPIENTRY *LPALSOURCEPAUSE)( ALuint sid );
-typedef void (ALAPIENTRY *LPALSOURCEQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, const ALuint *bids );
-typedef void (ALAPIENTRY *LPALSOURCEUNQUEUEBUFFERS)(ALuint sid, ALsizei numEntries, ALuint *bids );
-typedef void (ALAPIENTRY *LPALGENBUFFERS)( ALsizei n, ALuint* buffers );
-typedef void (ALAPIENTRY *LPALDELETEBUFFERS)( ALsizei n, const ALuint* buffers );
-typedef ALboolean (ALAPIENTRY *LPALISBUFFER)( ALuint bid );
-typedef void (ALAPIENTRY *LPALBUFFERDATA)( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
-typedef void (ALAPIENTRY *LPALBUFFERF)( ALuint bid, ALenum param, ALfloat value);
-typedef void (ALAPIENTRY *LPALBUFFER3F)( ALuint bid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
-typedef void (ALAPIENTRY *LPALBUFFERFV)( ALuint bid, ALenum param, const ALfloat* values );
-typedef void (ALAPIENTRY *LPALBUFFERI)( ALuint bid, ALenum param, ALint value);
-typedef void (ALAPIENTRY *LPALBUFFER3I)( ALuint bid, ALenum param, ALint value1, ALint value2, ALint value3 );
-typedef void (ALAPIENTRY *LPALBUFFERIV)( ALuint bid, ALenum param, const ALint* values );
-typedef void (ALAPIENTRY *LPALGETBUFFERF)( ALuint bid, ALenum param, ALfloat* value );
-typedef void (ALAPIENTRY *LPALGETBUFFER3F)( ALuint bid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
-typedef void (ALAPIENTRY *LPALGETBUFFERFV)( ALuint bid, ALenum param, ALfloat* values );
-typedef void (ALAPIENTRY *LPALGETBUFFERI)( ALuint bid, ALenum param, ALint* value );
-typedef void (ALAPIENTRY *LPALGETBUFFER3I)( ALuint bid, ALenum param, ALint* value1, ALint* value2, ALint* value3);
-typedef void (ALAPIENTRY *LPALGETBUFFERIV)( ALuint bid, ALenum param, ALint* values );
-typedef void (ALAPIENTRY *LPALDOPPLERFACTOR)( ALfloat value );
-typedef void (ALAPIENTRY *LPALDOPPLERVELOCITY)( ALfloat value );
-typedef void (ALAPIENTRY *LPALSPEEDOFSOUND)( ALfloat value );
-typedef void (ALAPIENTRY *LPALDISTANCEMODEL)( ALenum distanceModel );
-
-#endif /* AL_NO_PROTOTYPES */
-
-#ifdef TARGET_OS_MAC
-#if TARGET_OS_MAC
-#pragma export off
-#endif /* TARGET_OS_MAC */
-#endif /* TARGET_OS_MAC */
-
-
-#ifdef __cplusplus
-} /* extern "C" */
-#endif
-
-#endif /* __al_h_ */
diff --git a/src/AL/alc.h b/src/AL/alc.h
deleted file mode 100644
index 980d8f1..0000000
--- a/src/AL/alc.h
+++ /dev/null
@@ -1,166 +0,0 @@
-#ifndef ALC_CONTEXT_H_
-#define ALC_CONTEXT_H_
-
-#include "altypes.h"
-#include "alctypes.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ALC_VERSION_0_1 1
-
-#ifdef _WIN32
- typedef struct ALCdevice_struct ALCdevice;
- typedef struct ALCcontext_struct ALCcontext;
- #ifndef _XBOX
- #ifdef _OPENAL32LIB
- #define ALCAPI __declspec(dllexport)
- #else
- #define ALCAPI __declspec(dllimport)
- #endif
- #define ALCAPIENTRY __cdecl
- #endif
-#endif
-
-#ifdef TARGET_OS_MAC
- #if TARGET_OS_MAC
- #pragma export on
- #endif
-#endif
-
-#ifndef ALCAPI
- #define ALCAPI
-#endif
-
-#ifndef ALCAPIENTRY
- #define ALCAPIENTRY
-#endif
-
-
-#ifndef ALC_NO_PROTOTYPES
-
-/*
- * Context Management
- */
-ALCAPI ALCcontext * ALCAPIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist );
-
-ALCAPI ALCboolean ALCAPIENTRY alcMakeContextCurrent( ALCcontext *context );
-
-ALCAPI void ALCAPIENTRY alcProcessContext( ALCcontext *context );
-
-ALCAPI void ALCAPIENTRY alcSuspendContext( ALCcontext *context );
-
-ALCAPI void ALCAPIENTRY alcDestroyContext( ALCcontext *context );
-
-ALCAPI ALCcontext * ALCAPIENTRY alcGetCurrentContext( ALCvoid );
-
-ALCAPI ALCdevice* ALCAPIENTRY alcGetContextsDevice( ALCcontext *context );
-
-
-/*
- * Device Management
- */
-ALCAPI ALCdevice * ALCAPIENTRY alcOpenDevice( const ALchar *devicename );
-
-ALCAPI ALCboolean ALCAPIENTRY alcCloseDevice( ALCdevice *device );
-
-
-/*
- * Error support.
- * Obtain the most recent Context error
- */
-ALCAPI ALCenum ALCAPIENTRY alcGetError( ALCdevice *device );
-
-
-/*
- * Extension support.
- * Query for the presence of an extension, and obtain any appropriate
- * function pointers and enum values.
- */
-ALCAPI ALCboolean ALCAPIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname );
-
-ALCAPI void * ALCAPIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname );
-
-ALCAPI ALCenum ALCAPIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname );
-
-
-/*
- * Query functions
- */
-ALCAPI const ALCchar * ALCAPIENTRY alcGetString( ALCdevice *device, ALCenum param );
-
-ALCAPI void ALCAPIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
-
-
-/*
- * Capture functions
- */
-ALCAPI ALCdevice* ALCAPIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-
-ALCAPI ALCboolean ALCAPIENTRY alcCaptureCloseDevice( ALCdevice *device );
-
-ALCAPI void ALCAPIENTRY alcCaptureStart( ALCdevice *device );
-
-ALCAPI void ALCAPIENTRY alcCaptureStop( ALCdevice *device );
-
-ALCAPI void ALCAPIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-#else /* ALC_NO_PROTOTYPES */
-
-ALCAPI ALCcontext * (ALCAPIENTRY *alcCreateContext)( ALCdevice *device, const ALCint* attrlist );
-ALCAPI ALCboolean (ALCAPIENTRY *alcMakeContextCurrent)( ALCcontext *context );
-ALCAPI void (ALCAPIENTRY *alcProcessContext)( ALCcontext *context );
-ALCAPI void (ALCAPIENTRY *alcSuspendContext)( ALCcontext *context );
-ALCAPI void (ALCAPIENTRY *alcDestroyContext)( ALCcontext *context );
-ALCAPI ALCcontext * (ALCAPIENTRY *alcGetCurrentContext)( ALCvoid );
-ALCAPI ALCdevice * (ALCAPIENTRY *alcGetContextsDevice)( ALCcontext *context );
-ALCAPI ALCdevice * (ALCAPIENTRY *alcOpenDevice)( const ALCchar *devicename );
-ALCAPI ALCboolean (ALCAPIENTRY *alcCloseDevice)( ALCdevice *device );
-ALCAPI ALCenum (ALCAPIENTRY *alcGetError)( ALCdevice *device );
-ALCAPI ALCboolean (ALCAPIENTRY *alcIsExtensionPresent)( ALCdevice *device, const ALCchar *extname );
-ALCAPI void * (ALCAPIENTRY *alcGetProcAddress)( ALCdevice *device, const ALCchar *funcname );
-ALCAPI ALCenum (ALCAPIENTRY *alcGetEnumValue)( ALCdevice *device, const ALCchar *enumname );
-ALCAPI const ALCchar* (ALCAPIENTRY *alcGetString)( ALCdevice *device, ALCenum param );
-ALCAPI void (ALCAPIENTRY *alcGetIntegerv)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
-ALCAPI ALCdevice * (ALCAPIENTRY *alcCaptureOpenDevice)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-ALCAPI ALCboolean (ALCAPIENTRY *alcCaptureCloseDevice)( ALCdevice *device );
-ALCAPI void (ALCAPIENTRY *alcCaptureStart)( ALCdevice *device );
-ALCAPI void (ALCAPIENTRY *alcCaptureStop)( ALCdevice *device );
-ALCAPI void (ALCAPIENTRY *alcCaptureSamples)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-/* Type definitions */
-typedef ALCcontext * (ALCAPIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist);
-typedef ALCboolean (ALCAPIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context );
-typedef void (ALCAPIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context );
-typedef void (ALCAPIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context );
-typedef void (ALCAPIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context );
-typedef ALCcontext * (ALCAPIENTRY *LPALCGETCURRENTCONTEXT)( ALCvoid );
-typedef ALCdevice * (ALCAPIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context );
-typedef ALCdevice * (ALCAPIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename );
-typedef ALCboolean (ALCAPIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device );
-typedef ALCenum (ALCAPIENTRY *LPALCGETERROR)( ALCdevice *device );
-typedef ALCboolean (ALCAPIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname );
-typedef void * (ALCAPIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname );
-typedef ALCenum (ALCAPIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname );
-typedef const ALCchar* (ALCAPIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param );
-typedef void (ALCAPIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest );
-typedef ALCdevice * (ALCAPIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
-typedef ALCboolean (ALCAPIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device );
-typedef void (ALCAPIENTRY *LPALCCAPTURESTART)( ALCdevice *device );
-typedef void (ALCAPIENTRY *LPALCCAPTURESTOP)( ALCdevice *device );
-typedef void (ALCAPIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples );
-
-#endif /* ALC_NO_PROTOTYPES */
-
-#ifdef TARGET_OS_MAC
-#if TARGET_OS_MAC
-#pragma export off
-#endif /* TARGET_OS_MAC */
-#endif /* TARGET_OS_MAC */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* ALC_CONTEXT_H_ */
diff --git a/src/AL/alctypes.h b/src/AL/alctypes.h
deleted file mode 100644
index 181384b..0000000
--- a/src/AL/alctypes.h
+++ /dev/null
@@ -1,142 +0,0 @@
-#ifndef _ALCTYPES_H_
-#define _ALCTYPES_H_
-
-#if !defined(_WIN32)
-struct _AL_device;
-typedef struct _AL_device ALCdevice;
-
-typedef void ALCcontext;
-#endif /* _WIN32 */
-
-typedef int ALCenum;
-
-/** ALC boolean type. */
-typedef char ALCboolean;
-
-/** ALC 8bit signed byte. */
-typedef char ALCbyte;
-
-/** ALC 8bit unsigned byte. */
-typedef unsigned char ALCubyte;
-
-/** OpenAL 8bit char */
-typedef char ALCchar;
-
-/** ALC 16bit signed short integer type. */
-typedef short ALCshort;
-
-/** ALC 16bit unsigned short integer type. */
-typedef unsigned short ALCushort;
-
-/** ALC 32bit unsigned integer type. */
-typedef unsigned ALCuint;
-
-/** ALC 32bit signed integer type. */
-typedef int ALCint;
-
-/** ALC 32bit floating point type. */
-typedef float ALCfloat;
-
-/** ALC 64bit double point type. */
-typedef double ALCdouble;
-
-/** ALC 32bit type. */
-typedef int ALCsizei;
-
-/** ALC void type */
-typedef void ALCvoid;
-
-/* Enumerant values begin at column 50. No tabs. */
-
-/* bad value */
-#define ALC_INVALID 0
-
-/* Boolean False. */
-#define ALC_FALSE 0
-
-/* Boolean True. */
-#define ALC_TRUE 1
-
-/**
- * followed by Hz
- */
-#define ALC_FREQUENCY 0x1007
-
-/**
- * followed by Hz
- */
-#define ALC_REFRESH 0x1008
-
-/**
- * followed by AL_TRUE, AL_FALSE
- */
-#define ALC_SYNC 0x1009
-
-/**
- * followed by Num of requested Mono (3D) Sources
- */
-#define ALC_MONO_SOURCES 0x1010
-
-/**
- * followed by Num of requested Stereo Sources
- */
-#define ALC_STEREO_SOURCES 0x1011
-
-/**
- * errors
- */
-
-/**
- * No error
- */
-#define ALC_NO_ERROR ALC_FALSE
-
-/**
- * No device
- */
-#define ALC_INVALID_DEVICE 0xA001
-
-/**
- * invalid context ID
- */
-#define ALC_INVALID_CONTEXT 0xA002
-
-/**
- * bad enum
- */
-#define ALC_INVALID_ENUM 0xA003
-
-/**
- * bad value
- */
-#define ALC_INVALID_VALUE 0xA004
-
-/**
- * Out of memory.
- */
-#define ALC_OUT_OF_MEMORY 0xA005
-
-
-
-/**
- * The Specifier string for default device
- */
-#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
-#define ALC_DEVICE_SPECIFIER 0x1005
-#define ALC_EXTENSIONS 0x1006
-
-#define ALC_MAJOR_VERSION 0x1000
-#define ALC_MINOR_VERSION 0x1001
-
-#define ALC_ATTRIBUTES_SIZE 0x1002
-#define ALC_ALL_ATTRIBUTES 0x1003
-
-/**
- * Capture extension
- */
-#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
-#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
-#define ALC_CAPTURE_SAMPLES 0x312
-
-
-#endif /* _ALCTYPES_H */
diff --git a/src/AL/altypes.h b/src/AL/altypes.h
deleted file mode 100644
index 3ec959f..0000000
--- a/src/AL/altypes.h
+++ /dev/null
@@ -1,352 +0,0 @@
-#ifndef _AL_TYPES_H_
-#define _AL_TYPES_H_
-
-/* define platform type */
-#if !defined(MACINTOSH_AL) && !defined(LINUX_AL) && !defined(WINDOWS_AL)
- #ifdef __APPLE__
- #define MACINTOSH_AL
- #else
- #ifdef _WIN32
- #define WINDOWS_AL
- #else
- #define LINUX_AL
- #endif
- #endif
-#endif
-
-/** OpenAL bool type. */
-typedef char ALboolean;
-
-/** OpenAL 8bit signed byte. */
-typedef char ALbyte;
-
-/** OpenAL 8bit unsigned byte. */
-typedef unsigned char ALubyte;
-
-/** OpenAL 8bit char */
-typedef char ALchar;
-
-/** OpenAL 16bit signed short integer type. */
-typedef short ALshort;
-
-/** OpenAL 16bit unsigned short integer type. */
-typedef unsigned short ALushort;
-
-/** OpenAL 32bit unsigned integer type. */
-typedef unsigned int ALuint;
-
-/** OpenAL 32bit signed integer type. */
-typedef int ALint;
-
-/** OpenAL 32bit floating point type. */
-typedef float ALfloat;
-
-/** OpenAL 64bit double point type. */
-typedef double ALdouble;
-
-/** OpenAL 32bit type. */
-typedef int ALsizei;
-
-/** OpenAL void type (for params, not returns). */
-typedef void ALvoid;
-
-/** OpenAL enumerations. */
-typedef int ALenum;
-
-/** OpenAL bitfields. */
-typedef unsigned int ALbitfield;
-
-/** OpenAL clamped float. */
-typedef ALfloat ALclampf;
-
-/** Openal clamped double. */
-typedef ALdouble ALclampd;
-
-/* Enumerant values begin at column 50. No tabs. */
-
-/* bad value */
-#define AL_INVALID -1
-
-#define AL_NONE 0
-
-/* Boolean False. */
-#define AL_FALSE 0
-
-/** Boolean True. */
-#define AL_TRUE 1
-
-/** Indicate Source has relative coordinates. */
-#define AL_SOURCE_RELATIVE 0x202
-
-
-
-/**
- * Directional source, inner cone angle, in degrees.
- * Range: [0-360]
- * Default: 360
- */
-#define AL_CONE_INNER_ANGLE 0x1001
-
-/**
- * Directional source, outer cone angle, in degrees.
- * Range: [0-360]
- * Default: 360
- */
-#define AL_CONE_OUTER_ANGLE 0x1002
-
-/**
- * Specify the pitch to be applied, either at source,
- * or on mixer results, at listener.
- * Range: [0.5-2.0]
- * Default: 1.0
- */
-#define AL_PITCH 0x1003
-
-/**
- * Specify the current location in three dimensional space.
- * OpenAL, like OpenGL, uses a right handed coordinate system,
- * where in a frontal default view X (thumb) points right,
- * Y points up (index finger), and Z points towards the
- * viewer/camera (middle finger).
- * To switch from a left handed coordinate system, flip the
- * sign on the Z coordinate.
- * Listener position is always in the world coordinate system.
- */
-#define AL_POSITION 0x1004
-
-/** Specify the current direction. */
-#define AL_DIRECTION 0x1005
-
-/** Specify the current velocity in three dimensional space. */
-#define AL_VELOCITY 0x1006
-
-/**
- * Indicate whether source is looping.
- * Type: ALboolean?
- * Range: [AL_TRUE, AL_FALSE]
- * Default: FALSE.
- */
-#define AL_LOOPING 0x1007
-
-/**
- * Indicate the buffer to provide sound samples.
- * Type: ALuint.
- * Range: any valid Buffer id.
- */
-#define AL_BUFFER 0x1009
-
-/**
- * Indicate the gain (volume amplification) applied.
- * Type: ALfloat.
- * Range: ]0.0- ]
- * A value of 1.0 means un-attenuated/unchanged.
- * Each division by 2 equals an attenuation of -6dB.
- * Each multiplicaton with 2 equals an amplification of +6dB.
- * A value of 0.0 is meaningless with respect to a logarithmic
- * scale; it is interpreted as zero volume - the channel
- * is effectively disabled.
- */
-#define AL_GAIN 0x100A
-
-/*
- * Indicate minimum source attenuation
- * Type: ALfloat
- * Range: [0.0 - 1.0]
- *
- * Logarthmic
- */
-#define AL_MIN_GAIN 0x100D
-
-/**
- * Indicate maximum source attenuation
- * Type: ALfloat
- * Range: [0.0 - 1.0]
- *
- * Logarthmic
- */
-#define AL_MAX_GAIN 0x100E
-
-/**
- * Indicate listener orientation.
- *
- * at/up
- */
-#define AL_ORIENTATION 0x100F
-
-/**
- * Specify the channel mask. (Creative)
- * Type: ALuint
- * Range: [0 - 255]
- */
-#define AL_CHANNEL_MASK 0x3000
-
-
-/**
- * Source state information.
- */
-#define AL_SOURCE_STATE 0x1010
-#define AL_INITIAL 0x1011
-#define AL_PLAYING 0x1012
-#define AL_PAUSED 0x1013
-#define AL_STOPPED 0x1014
-
-/**
- * Buffer Queue params
- */
-#define AL_BUFFERS_QUEUED 0x1015
-#define AL_BUFFERS_PROCESSED 0x1016
-
-/**
- * Source buffer position information
- */
-#define AL_SEC_OFFSET 0x1024
-#define AL_SAMPLE_OFFSET 0x1025
-#define AL_BYTE_OFFSET 0x1026
-
-/*
- * Source type (Static, Streaming or undetermined)
- * Source is Static if a Buffer has been attached using AL_BUFFER
- * Source is Streaming if one or more Buffers have been attached using alSourceQueueBuffers
- * Source is undetermined when it has the NULL buffer attached
- */
-#define AL_SOURCE_TYPE 0x1027
-#define AL_STATIC 0x1028
-#define AL_STREAMING 0x1029
-#define AL_UNDETERMINED 0x1030
-
-/** Sound samples: format specifier. */
-#define AL_FORMAT_MONO8 0x1100
-#define AL_FORMAT_MONO16 0x1101
-#define AL_FORMAT_STEREO8 0x1102
-#define AL_FORMAT_STEREO16 0x1103
-
-/**
- * source specific reference distance
- * Type: ALfloat
- * Range: 0.0 - +inf
- *
- * At 0.0, no distance attenuation occurs. Default is
- * 1.0.
- */
-#define AL_REFERENCE_DISTANCE 0x1020
-
-/**
- * source specific rolloff factor
- * Type: ALfloat
- * Range: 0.0 - +inf
- *
- */
-#define AL_ROLLOFF_FACTOR 0x1021
-
-/**
- * Directional source, outer cone gain.
- *
- * Default: 0.0
- * Range: [0.0 - 1.0]
- * Logarithmic
- */
-#define AL_CONE_OUTER_GAIN 0x1022
-
-/**
- * Indicate distance above which sources are not
- * attenuated using the inverse clamped distance model.
- *
- * Default: +inf
- * Type: ALfloat
- * Range: 0.0 - +inf
- */
-#define AL_MAX_DISTANCE 0x1023
-
-/**
- * Sound samples: frequency, in units of Hertz [Hz].
- * This is the number of samples per second. Half of the
- * sample frequency marks the maximum significant
- * frequency component.
- */
-#define AL_FREQUENCY 0x2001
-#define AL_BITS 0x2002
-#define AL_CHANNELS 0x2003
-#define AL_SIZE 0x2004
-#define AL_DATA 0x2005
-
-/**
- * Buffer state.
- *
- * Not supported for public use (yet).
- */
-#define AL_UNUSED 0x2010
-#define AL_PENDING 0x2011
-#define AL_PROCESSED 0x2012
-
-
-/** Errors: No Error. */
-#define AL_NO_ERROR AL_FALSE
-
-/**
- * Invalid Name paramater passed to AL call.
- */
-#define AL_INVALID_NAME 0xA001
-
-/**
- * Invalid parameter passed to AL call.
- */
-#define AL_ILLEGAL_ENUM 0xA002
-#define AL_INVALID_ENUM 0xA002
-
-/**
- * Invalid enum parameter value.
- */
-#define AL_INVALID_VALUE 0xA003
-
-/**
- * Illegal call.
- */
-#define AL_ILLEGAL_COMMAND 0xA004
-#define AL_INVALID_OPERATION 0xA004
-
-
-/**
- * No mojo.
- */
-#define AL_OUT_OF_MEMORY 0xA005
-
-
-/** Context strings: Vendor Name. */
-#define AL_VENDOR 0xB001
-#define AL_VERSION 0xB002
-#define AL_RENDERER 0xB003
-#define AL_EXTENSIONS 0xB004
-
-/** Global tweakage. */
-
-/**
- * Doppler scale. Default 1.0
- */
-#define AL_DOPPLER_FACTOR 0xC000
-
-/**
- * Tweaks speed of propagation.
- */
-#define AL_DOPPLER_VELOCITY 0xC001
-
-/**
- * Speed of Sound in units per second
- */
-#define AL_SPEED_OF_SOUND 0xC003
-
-/**
- * Distance models
- *
- * used in conjunction with DistanceModel
- *
- * implicit: NONE, which disances distance attenuation.
- */
-#define AL_DISTANCE_MODEL 0xD000
-#define AL_INVERSE_DISTANCE 0xD001
-#define AL_INVERSE_DISTANCE_CLAMPED 0xD002
-#define AL_LINEAR_DISTANCE 0xD003
-#define AL_LINEAR_DISTANCE_CLAMPED 0xD004
-#define AL_EXPONENT_DISTANCE 0xD005
-#define AL_EXPONENT_DISTANCE_CLAMPED 0xD006
-
-#endif
diff --git a/src/AL/alut.h b/src/AL/alut.h
deleted file mode 100644
index e29ae58..0000000
--- a/src/AL/alut.h
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef _ALUT_H_
-#define _ALUT_H_
-
-/* define platform type */
-#if !defined(MACINTOSH_AL) && !defined(LINUX_AL) && !defined(WINDOWS_AL)
- #ifdef __APPLE__
- #define MACINTOSH_AL
- #else
- #ifdef _WIN32
- #define WINDOWS_AL
- #else
- #define LINUX_AL
- #endif
- #endif
-#endif
-
-#include "altypes.h"
-
-#ifdef _WIN32
-#define ALUTAPI
-#define ALUTAPIENTRY __cdecl
-#define AL_CALLBACK
-#else /* _WIN32 */
-
-#ifdef TARGET_OS_MAC
-#if TARGET_OS_MAC
-#pragma export on
-#endif /* TARGET_OS_MAC */
-#endif /* TARGET_OS_MAC */
-
-#ifndef ALUTAPI
-#define ALUTAPI
-#endif
-
-#ifndef ALUTAPIENTRY
-#define ALUTAPIENTRY
-#endif
-
-#ifndef AL_CALLBACK
-#define AL_CALLBACK
-#endif
-
-#endif /* _WIN32 */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef ALUT_NO_PROTOTYPES
-
-ALUTAPI void ALUTAPIENTRY alutInit(int *argc, char *argv[]);
-ALUTAPI void ALUTAPIENTRY alutExit(ALvoid);
-
-#ifndef MACINTOSH_AL
-/* Windows and Linux versions have a loop parameter, Macintosh doesn't */
-ALUTAPI void ALUTAPIENTRY alutLoadWAVFile(ALbyte *file, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq, ALboolean *loop);
-ALUTAPI void ALUTAPIENTRY alutLoadWAVMemory(ALbyte *memory, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq, ALboolean *loop);
-#else
-ALUTAPI void ALUTAPIENTRY alutLoadWAVFile(ALbyte *file, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq);
-ALUTAPI void ALUTAPIENTRY alutLoadWAVMemory(ALbyte *memory, ALenum *format, ALvoid **data, ALsizei *size, ALsizei *freq);
-#endif
-
-ALUTAPI void ALUTAPIENTRY alutUnloadWAV(ALenum format, ALvoid *data, ALsizei size, ALsizei freq);
-
-#else /* ALUT_NO_PROTOTYPES */
-
- void (ALUTAPIENTRY *alutInit)( int *argc, char *argv[] );
- void (ALUTAPIENTRY *alutExit)( ALvoid );
-#ifndef MACINTOSH_AL
- void (ALUTAPIENTRY *alutLoadWAVFile)( ALbyte *file,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop );
- void (ALUTAPIENTRY *alutLoadWAVMemory)( ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop );
-#else
- void (ALUTAPIENTRY *alutLoadWAVFile( ALbyte *file,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq );
- void (ALUTAPIENTRY *alutLoadWAVMemory)( ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq );
-#endif
- void (ALUTAPIENTRY *alutUnloadWAV)( ALenum format,ALvoid *data,ALsizei size,ALsizei freq );
-
-#endif /* ALUT_NO_PROTOTYPES */
-
-#ifdef TARGET_OS_MAC
-#if TARGET_OS_MAC
-#pragma export off
-#endif /* TARGET_OS_MAC */
-#endif /* TARGET_OS_MAC */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/SDL12/include/SDL.h b/src/SDL12/include/SDL.h
deleted file mode 100644
index 60ac26c..0000000
--- a/src/SDL12/include/SDL.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Main include header for the SDL library */
-
-#ifndef _SDL_H
-#define _SDL_H
-
-#include "SDL_main.h"
-#include "SDL_stdinc.h"
-#include "SDL_audio.h"
-#include "SDL_cdrom.h"
-#include "SDL_cpuinfo.h"
-#include "SDL_endian.h"
-#include "SDL_error.h"
-#include "SDL_events.h"
-#include "SDL_loadso.h"
-#include "SDL_mutex.h"
-#include "SDL_rwops.h"
-#include "SDL_thread.h"
-#include "SDL_timer.h"
-#include "SDL_video.h"
-#include "SDL_version.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* As of version 0.5, SDL is loaded dynamically into the application */
-
-/* These are the flags which may be passed to SDL_Init() -- you should
- specify the subsystems which you will be using in your application.
-*/
-#define SDL_INIT_TIMER 0x00000001
-#define SDL_INIT_AUDIO 0x00000010
-#define SDL_INIT_VIDEO 0x00000020
-#define SDL_INIT_CDROM 0x00000100
-#define SDL_INIT_JOYSTICK 0x00000200
-#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */
-#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */
-#define SDL_INIT_EVERYTHING 0x0000FFFF
-
-/* This function loads the SDL dynamically linked library and initializes
- * the subsystems specified by 'flags' (and those satisfying dependencies)
- * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup
- * signal handlers for some commonly ignored fatal signals (like SIGSEGV)
- */
-extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);
-
-/* This function initializes specific SDL subsystems */
-extern DECLSPEC int SDLCALL SDL_InitSubSystem(Uint32 flags);
-
-/* This function cleans up specific SDL subsystems */
-extern DECLSPEC void SDLCALL SDL_QuitSubSystem(Uint32 flags);
-
-/* This function returns mask of the specified subsystems which have
- been initialized.
- If 'flags' is 0, it returns a mask of all initialized subsystems.
-*/
-extern DECLSPEC Uint32 SDLCALL SDL_WasInit(Uint32 flags);
-
-/* This function cleans up all initialized subsystems and unloads the
- * dynamically linked library. You should call it upon all exit conditions.
- */
-extern DECLSPEC void SDLCALL SDL_Quit(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_H */
diff --git a/src/SDL12/include/SDL_active.h b/src/SDL12/include/SDL_active.h
deleted file mode 100644
index 2cf474c..0000000
--- a/src/SDL12/include/SDL_active.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Include file for SDL application focus event handling */
-
-#ifndef _SDL_active_h
-#define _SDL_active_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The available application states */
-#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */
-#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */
-#define SDL_APPACTIVE 0x04 /* The application is active */
-
-/* Function prototypes */
-/*
- * This function returns the current state of the application, which is a
- * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and
- * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to
- * see your application, otherwise it has been iconified or disabled.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_GetAppState(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_active_h */
diff --git a/src/SDL12/include/SDL_audio.h b/src/SDL12/include/SDL_audio.h
deleted file mode 100644
index 68ec475..0000000
--- a/src/SDL12/include/SDL_audio.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Access to the raw audio mixing buffer for the SDL library */
-
-#ifndef _SDL_audio_h
-#define _SDL_audio_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_endian.h"
-#include "SDL_mutex.h"
-#include "SDL_thread.h"
-#include "SDL_rwops.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The calculated values in this structure are calculated by SDL_OpenAudio() */
-typedef struct SDL_AudioSpec {
- int freq; /* DSP frequency -- samples per second */
- Uint16 format; /* Audio data format */
- Uint8 channels; /* Number of channels: 1 mono, 2 stereo */
- Uint8 silence; /* Audio buffer silence value (calculated) */
- Uint16 samples; /* Audio buffer size in samples (power of 2) */
- Uint16 padding; /* Necessary for some compile environments */
- Uint32 size; /* Audio buffer size in bytes (calculated) */
- /* This function is called when the audio device needs more data.
- 'stream' is a pointer to the audio data buffer
- 'len' is the length of that buffer in bytes.
- Once the callback returns, the buffer will no longer be valid.
- Stereo samples are stored in a LRLRLR ordering.
- */
- void (SDLCALL *callback)(void *userdata, Uint8 *stream, int len);
- void *userdata;
-} SDL_AudioSpec;
-
-/* Audio format flags (defaults to LSB byte order) */
-#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */
-#define AUDIO_S8 0x8008 /* Signed 8-bit samples */
-#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */
-#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */
-#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */
-#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */
-#define AUDIO_U16 AUDIO_U16LSB
-#define AUDIO_S16 AUDIO_S16LSB
-
-/* Native audio byte ordering */
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define AUDIO_U16SYS AUDIO_U16LSB
-#define AUDIO_S16SYS AUDIO_S16LSB
-#else
-#define AUDIO_U16SYS AUDIO_U16MSB
-#define AUDIO_S16SYS AUDIO_S16MSB
-#endif
-
-
-/* A structure to hold a set of audio conversion filters and buffers */
-typedef struct SDL_AudioCVT {
- int needed; /* Set to 1 if conversion possible */
- Uint16 src_format; /* Source audio format */
- Uint16 dst_format; /* Target audio format */
- double rate_incr; /* Rate conversion increment */
- Uint8 *buf; /* Buffer to hold entire audio data */
- int len; /* Length of original audio buffer */
- int len_cvt; /* Length of converted audio buffer */
- int len_mult; /* buffer must be len*len_mult big */
- double len_ratio; /* Given len, final size is len*len_ratio */
- void (SDLCALL *filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
- int filter_index; /* Current audio conversion function */
-} SDL_AudioCVT;
-
-
-/* Function prototypes */
-
-/* These functions are used internally, and should not be used unless you
- * have a specific need to specify the audio driver you want to use.
- * You should normally use SDL_Init() or SDL_InitSubSystem().
- */
-extern DECLSPEC int SDLCALL SDL_AudioInit(const char *driver_name);
-extern DECLSPEC void SDLCALL SDL_AudioQuit(void);
-
-/* This function fills the given character buffer with the name of the
- * current audio driver, and returns a pointer to it if the audio driver has
- * been initialized. It returns NULL if no driver has been initialized.
- */
-extern DECLSPEC char * SDLCALL SDL_AudioDriverName(char *namebuf, int maxlen);
-
-/*
- * This function opens the audio device with the desired parameters, and
- * returns 0 if successful, placing the actual hardware parameters in the
- * structure pointed to by 'obtained'. If 'obtained' is NULL, the audio
- * data passed to the callback function will be guaranteed to be in the
- * requested format, and will be automatically converted to the hardware
- * audio format if necessary. This function returns -1 if it failed
- * to open the audio device, or couldn't set up the audio thread.
- *
- * When filling in the desired audio spec structure,
- * 'desired->freq' should be the desired audio frequency in samples-per-second.
- * 'desired->format' should be the desired audio format.
- * 'desired->samples' is the desired size of the audio buffer, in samples.
- * This number should be a power of two, and may be adjusted by the audio
- * driver to a value more suitable for the hardware. Good values seem to
- * range between 512 and 8096 inclusive, depending on the application and
- * CPU speed. Smaller values yield faster response time, but can lead
- * to underflow if the application is doing heavy processing and cannot
- * fill the audio buffer in time. A stereo sample consists of both right
- * and left channels in LR ordering.
- * Note that the number of samples is directly related to time by the
- * following formula: ms = (samples*1000)/freq
- * 'desired->size' is the size in bytes of the audio buffer, and is
- * calculated by SDL_OpenAudio().
- * 'desired->silence' is the value used to set the buffer to silence,
- * and is calculated by SDL_OpenAudio().
- * 'desired->callback' should be set to a function that will be called
- * when the audio device is ready for more data. It is passed a pointer
- * to the audio buffer, and the length in bytes of the audio buffer.
- * This function usually runs in a separate thread, and so you should
- * protect data structures that it accesses by calling SDL_LockAudio()
- * and SDL_UnlockAudio() in your code.
- * 'desired->userdata' is passed as the first parameter to your callback
- * function.
- *
- * The audio device starts out playing silence when it's opened, and should
- * be enabled for playing by calling SDL_PauseAudio(0) when you are ready
- * for your audio callback function to be called. Since the audio driver
- * may modify the requested size of the audio buffer, you should allocate
- * any local mixing buffers after you open the audio device.
- */
-extern DECLSPEC int SDLCALL SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);
-
-/*
- * Get the current audio state:
- */
-typedef enum {
- SDL_AUDIO_STOPPED = 0,
- SDL_AUDIO_PLAYING,
- SDL_AUDIO_PAUSED
-} SDL_audiostatus;
-extern DECLSPEC SDL_audiostatus SDLCALL SDL_GetAudioStatus(void);
-
-/*
- * This function pauses and unpauses the audio callback processing.
- * It should be called with a parameter of 0 after opening the audio
- * device to start playing sound. This is so you can safely initialize
- * data for your callback function after opening the audio device.
- * Silence will be written to the audio device during the pause.
- */
-extern DECLSPEC void SDLCALL SDL_PauseAudio(int pause_on);
-
-/*
- * This function loads a WAVE from the data source, automatically freeing
- * that source if 'freesrc' is non-zero. For example, to load a WAVE file,
- * you could do:
- * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
- *
- * If this function succeeds, it returns the given SDL_AudioSpec,
- * filled with the audio data format of the wave data, and sets
- * 'audio_buf' to a malloc()'d buffer containing the audio data,
- * and sets 'audio_len' to the length of that audio buffer, in bytes.
- * You need to free the audio buffer with SDL_FreeWAV() when you are
- * done with it.
- *
- * This function returns NULL and sets the SDL error message if the
- * wave file cannot be opened, uses an unknown data format, or is
- * corrupt. Currently raw and MS-ADPCM WAVE files are supported.
- */
-extern DECLSPEC SDL_AudioSpec * SDLCALL SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);
-
-/* Compatibility convenience function -- loads a WAV from a file */
-#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \
- SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len)
-
-/*
- * This function frees data previously allocated with SDL_LoadWAV_RW()
- */
-extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 *audio_buf);
-
-/*
- * This function takes a source format and rate and a destination format
- * and rate, and initializes the 'cvt' structure with information needed
- * by SDL_ConvertAudio() to convert a buffer of audio data from one format
- * to the other.
- * This function returns 0, or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT *cvt,
- Uint16 src_format, Uint8 src_channels, int src_rate,
- Uint16 dst_format, Uint8 dst_channels, int dst_rate);
-
-/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(),
- * created an audio buffer cvt->buf, and filled it with cvt->len bytes of
- * audio data in the source format, this function will convert it in-place
- * to the desired format.
- * The data conversion may expand the size of the audio data, so the buffer
- * cvt->buf should be allocated after the cvt structure is initialized by
- * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long.
- */
-extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT *cvt);
-
-/*
- * This takes two audio buffers of the playing audio format and mixes
- * them, performing addition, volume adjustment, and overflow clipping.
- * The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME
- * for full audio volume. Note this does not change hardware volume.
- * This is provided for convenience -- you can mix your own audio data.
- */
-#define SDL_MIX_MAXVOLUME 128
-extern DECLSPEC void SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, Uint32 len, int volume);
-
-/*
- * The lock manipulated by these functions protects the callback function.
- * During a LockAudio/UnlockAudio pair, you can be guaranteed that the
- * callback function is not running. Do not call these from the callback
- * function or you will cause deadlock.
- */
-extern DECLSPEC void SDLCALL SDL_LockAudio(void);
-extern DECLSPEC void SDLCALL SDL_UnlockAudio(void);
-
-/*
- * This function shuts down audio processing and closes the audio device.
- */
-extern DECLSPEC void SDLCALL SDL_CloseAudio(void);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_audio_h */
diff --git a/src/SDL12/include/SDL_byteorder.h b/src/SDL12/include/SDL_byteorder.h
deleted file mode 100644
index 3871cfe..0000000
--- a/src/SDL12/include/SDL_byteorder.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* DEPRECATED */
-#include "SDL_endian.h"
diff --git a/src/SDL12/include/SDL_cdrom.h b/src/SDL12/include/SDL_cdrom.h
deleted file mode 100644
index 5f8f0c6..0000000
--- a/src/SDL12/include/SDL_cdrom.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* This is the CD-audio control API for Simple DirectMedia Layer */
-
-#ifndef _SDL_cdrom_h
-#define _SDL_cdrom_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* In order to use these functions, SDL_Init() must have been called
- with the SDL_INIT_CDROM flag. This causes SDL to scan the system
- for CD-ROM drives, and load appropriate drivers.
-*/
-
-/* The maximum number of CD-ROM tracks on a disk */
-#define SDL_MAX_TRACKS 99
-
-/* The types of CD-ROM track possible */
-#define SDL_AUDIO_TRACK 0x00
-#define SDL_DATA_TRACK 0x04
-
-/* The possible states which a CD-ROM drive can be in. */
-typedef enum {
- CD_TRAYEMPTY,
- CD_STOPPED,
- CD_PLAYING,
- CD_PAUSED,
- CD_ERROR = -1
-} CDstatus;
-
-/* Given a status, returns true if there's a disk in the drive */
-#define CD_INDRIVE(status) ((int)(status) > 0)
-
-typedef struct SDL_CDtrack {
- Uint8 id; /* Track number */
- Uint8 type; /* Data or audio track */
- Uint16 unused;
- Uint32 length; /* Length, in frames, of this track */
- Uint32 offset; /* Offset, in frames, from start of disk */
-} SDL_CDtrack;
-
-/* This structure is only current as of the last call to SDL_CDStatus() */
-typedef struct SDL_CD {
- int id; /* Private drive identifier */
- CDstatus status; /* Current drive status */
-
- /* The rest of this structure is only valid if there's a CD in drive */
- int numtracks; /* Number of tracks on disk */
- int cur_track; /* Current track position */
- int cur_frame; /* Current frame offset within current track */
- SDL_CDtrack track[SDL_MAX_TRACKS+1];
-} SDL_CD;
-
-/* Conversion functions from frames to Minute/Second/Frames and vice versa */
-#define CD_FPS 75
-#define FRAMES_TO_MSF(f, M,S,F) { \
- int value = f; \
- *(F) = value%CD_FPS; \
- value /= CD_FPS; \
- *(S) = value%60; \
- value /= 60; \
- *(M) = value; \
-}
-#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F))
-
-/* CD-audio API functions: */
-
-/* Returns the number of CD-ROM drives on the system, or -1 if
- SDL_Init() has not been called with the SDL_INIT_CDROM flag.
- */
-extern DECLSPEC int SDLCALL SDL_CDNumDrives(void);
-
-/* Returns a human-readable, system-dependent identifier for the CD-ROM.
- Example:
- "/dev/cdrom"
- "E:"
- "/dev/disk/ide/1/master"
-*/
-extern DECLSPEC const char * SDLCALL SDL_CDName(int drive);
-
-/* Opens a CD-ROM drive for access. It returns a drive handle on success,
- or NULL if the drive was invalid or busy. This newly opened CD-ROM
- becomes the default CD used when other CD functions are passed a NULL
- CD-ROM handle.
- Drives are numbered starting with 0. Drive 0 is the system default CD-ROM.
-*/
-extern DECLSPEC SDL_CD * SDLCALL SDL_CDOpen(int drive);
-
-/* This function returns the current status of the given drive.
- If the drive has a CD in it, the table of contents of the CD and current
- play position of the CD will be stored in the SDL_CD structure.
-*/
-extern DECLSPEC CDstatus SDLCALL SDL_CDStatus(SDL_CD *cdrom);
-
-/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks'
- tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play
- until the end of the CD. This function will skip data tracks.
- This function should only be called after calling SDL_CDStatus() to
- get track information about the CD.
- For example:
- // Play entire CD:
- if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
- SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
- // Play last track:
- if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
- SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
- }
- // Play first and second track and 10 seconds of third track:
- if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
- SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);
-
- This function returns 0, or -1 if there was an error.
-*/
-extern DECLSPEC int SDLCALL SDL_CDPlayTracks(SDL_CD *cdrom,
- int start_track, int start_frame, int ntracks, int nframes);
-
-/* Play the given CD starting at 'start' frame for 'length' frames.
- It returns 0, or -1 if there was an error.
-*/
-extern DECLSPEC int SDLCALL SDL_CDPlay(SDL_CD *cdrom, int start, int length);
-
-/* Pause play -- returns 0, or -1 on error */
-extern DECLSPEC int SDLCALL SDL_CDPause(SDL_CD *cdrom);
-
-/* Resume play -- returns 0, or -1 on error */
-extern DECLSPEC int SDLCALL SDL_CDResume(SDL_CD *cdrom);
-
-/* Stop play -- returns 0, or -1 on error */
-extern DECLSPEC int SDLCALL SDL_CDStop(SDL_CD *cdrom);
-
-/* Eject CD-ROM -- returns 0, or -1 on error */
-extern DECLSPEC int SDLCALL SDL_CDEject(SDL_CD *cdrom);
-
-/* Closes the handle for the CD-ROM drive */
-extern DECLSPEC void SDLCALL SDL_CDClose(SDL_CD *cdrom);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_video_h */
diff --git a/src/SDL12/include/SDL_config.h b/src/SDL12/include/SDL_config.h
deleted file mode 100644
index 8970ec3..0000000
--- a/src/SDL12/include/SDL_config.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_h
-#define _SDL_config_h
-
-#include "SDL_platform.h"
-
-/* Add any platform that doesn't build using the configure system */
-#if defined(__AMIGA__)
-#include "SDL_config_amiga.h"
-#elif defined(__DREAMCAST__)
-#include "SDL_config_dreamcast.h"
-#elif defined(__MACOS__)
-#include "SDL_config_macos.h"
-#elif defined(__MACOSX__)
-#include "SDL_config_macosx.h"
-#elif defined(__WIN32__)
-#include "SDL_config_win32.h"
-#elif defined(__OS2__)
-#include "SDL_config_os2.h"
-#else
-#include "SDL_config_minimal.h"
-#endif /* platform config */
-
-#endif /* _SDL_config_h */
diff --git a/src/SDL12/include/SDL_config_amiga.h b/src/SDL12/include/SDL_config_amiga.h
deleted file mode 100644
index 23e0861..0000000
--- a/src/SDL12/include/SDL_config_amiga.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_amiga_h
-#define _SDL_config_amiga_h
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#define SDL_HAS_64BIT_TYPE 1
-
-/* Useful headers */
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_AHI 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various cdrom drivers */
-#define SDL_CDROM_DUMMY 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_AMIGA 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DUMMY 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_AMIGA 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_AMIGA 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_CYBERGRAPHICS 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-/* Enable OpenGL support */
-#define SDL_VIDEO_OPENGL 1
-
-#endif /* _SDL_config_amiga_h */
diff --git a/src/SDL12/include/SDL_config_dreamcast.h b/src/SDL12/include/SDL_config_dreamcast.h
deleted file mode 100644
index 9cbeea3..0000000
--- a/src/SDL12/include/SDL_config_dreamcast.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_dreamcast_h
-#define _SDL_config_dreamcast_h
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-typedef unsigned long uintptr_t;
-#define SDL_HAS_64BIT_TYPE 1
-
-/* Useful headers */
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRDUP 1
-#define HAVE_INDEX 1
-#define HAVE_RINDEX 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRICMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_SSCANF 1
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_DC 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various cdrom drivers */
-#define SDL_CDROM_DC 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_DC 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_DUMMY 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_DC 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_DC 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DC 1
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-#endif /* _SDL_config_dreamcast_h */
diff --git a/src/SDL12/include/SDL_config_macos.h b/src/SDL12/include/SDL_config_macos.h
deleted file mode 100644
index c4a1c59..0000000
--- a/src/SDL12/include/SDL_config_macos.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_macos_h
-#define _SDL_config_macos_h
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#include
-
-typedef SInt8 int8_t;
-typedef UInt8 uint8_t;
-typedef SInt16 int16_t;
-typedef UInt16 uint16_t;
-typedef SInt32 int32_t;
-typedef UInt32 uint32_t;
-typedef SInt64 int64_t;
-typedef UInt64 uint64_t;
-typedef unsigned long uintptr_t;
-
-#define SDL_HAS_64BIT_TYPE 1
-
-/* Useful headers */
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_SSCANF 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_SNDMGR 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various cdrom drivers */
-#if TARGET_API_MAC_CARBON
-#define SDL_CDROM_DUMMY 1
-#else
-#define SDL_CDROM_MACOS 1
-#endif
-
-/* Enable various input drivers */
-#if TARGET_API_MAC_CARBON
-#define SDL_JOYSTICK_DUMMY 1
-#else
-#define SDL_JOYSTICK_MACOS 1
-#endif
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_MACOS 1
-
-/* Enable various threading systems */
-#define SDL_THREADS_DISABLED 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_MACOS 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_DRAWSPROCKET 1
-#define SDL_VIDEO_DRIVER_TOOLBOX 1
-
-/* Enable OpenGL support */
-#define SDL_VIDEO_OPENGL 1
-
-#endif /* _SDL_config_macos_h */
diff --git a/src/SDL12/include/SDL_config_macosx.h b/src/SDL12/include/SDL_config_macosx.h
deleted file mode 100644
index 8f04930..0000000
--- a/src/SDL12/include/SDL_config_macosx.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_macosx_h
-#define _SDL_config_macosx_h
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#define SDL_HAS_64BIT_TYPE 1
-
-/* Useful headers */
-/* If we specified an SDK or have a post-PowerPC chip, then alloca.h exists. */
-#if ( (MAC_OS_X_VERSION_MIN_REQUIRED >= 1030) || (!defined(__POWERPC__)) )
-#define HAVE_ALLOCA_H 1
-#endif
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOULL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRNCASECMP 1
-#define HAVE_SSCANF 1
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_SIGACTION 1
-#define HAVE_SETJMP 1
-#define HAVE_NANOSLEEP 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_COREAUDIO 1
-#define SDL_AUDIO_DRIVER_SNDMGR 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various cdrom drivers */
-#define SDL_CDROM_MACOSX 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_IOKIT 1
-
-/* Enable various shared object loading systems */
-#ifdef __ppc__
-/* For Mac OS X 10.2 compatibility */
-#define SDL_LOADSO_DLCOMPAT 1
-#else
-#define SDL_LOADSO_DLOPEN 1
-#endif
-
-/* Enable various threading systems */
-#define SDL_THREAD_PTHREAD 1
-#define SDL_THREAD_PTHREAD_RECURSIVE_MUTEX 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_UNIX 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#if TARGET_API_MAC_CARBON
-#define SDL_VIDEO_DRIVER_TOOLBOX 1
-#else
-#define SDL_VIDEO_DRIVER_QUARTZ 1
-#endif
-
-/* Enable OpenGL support */
-#define SDL_VIDEO_OPENGL 1
-
-/* Enable assembly routines */
-#define SDL_ASSEMBLY_ROUTINES 1
-#ifdef __ppc__
-#define SDL_ALTIVEC_BLITTERS 1
-#endif
-
-#endif /* _SDL_config_macosx_h */
diff --git a/src/SDL12/include/SDL_config_minimal.h b/src/SDL12/include/SDL_config_minimal.h
deleted file mode 100644
index 78b6148..0000000
--- a/src/SDL12/include/SDL_config_minimal.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_minimal_h
-#define _SDL_config_minimal_h
-
-#include "SDL_platform.h"
-
-/* This is the minimal configuration that can be used to build SDL */
-
-#include
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef unsigned int size_t;
-typedef unsigned long uintptr_t;
-
-/* Enable the dummy audio driver (src/audio/dummy/\*.c) */
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable the stub cdrom driver (src/cdrom/dummy/\*.c) */
-#define SDL_CDROM_DISABLED 1
-
-/* Enable the stub joystick driver (src/joystick/dummy/\*.c) */
-#define SDL_JOYSTICK_DISABLED 1
-
-/* Enable the stub shared object loader (src/loadso/dummy/\*.c) */
-#define SDL_LOADSO_DISABLED 1
-
-/* Enable the stub thread support (src/thread/generic/\*.c) */
-#define SDL_THREADS_DISABLED 1
-
-/* Enable the stub timer support (src/timer/dummy/\*.c) */
-#define SDL_TIMERS_DISABLED 1
-
-/* Enable the dummy video driver (src/video/dummy/\*.c) */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-
-#endif /* _SDL_config_minimal_h */
diff --git a/src/SDL12/include/SDL_config_os2.h b/src/SDL12/include/SDL_config_os2.h
deleted file mode 100644
index 8cdea9f..0000000
--- a/src/SDL12/include/SDL_config_os2.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_os2_h
-#define _SDL_config_os2_h
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef unsigned int size_t;
-typedef unsigned long uintptr_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-
-#define SDL_HAS_64BIT_TYPE 1
-
-/* Use Watcom's LIBC */
-#define HAVE_LIBC 1
-
-/* Useful headers */
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#define HAVE_SIGNAL_H 1
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_GETENV 1
-#define HAVE_PUTENV 1
-#define HAVE_UNSETENV 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_BCOPY 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE_STRLCPY 1
-#define HAVE_STRLCAT 1
-#define HAVE_STRDUP 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-#define HAVE_INDEX 1
-#define HAVE_RINDEX 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE__LTOA 1
-#define HAVE__UITOA 1
-#define HAVE__ULTOA 1
-#define HAVE_STRTOL 1
-#define HAVE__I64TOA 1
-#define HAVE__UI64TOA 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE_STRICMP 1
-#define HAVE_STRCASECMP 1
-#define HAVE_SSCANF 1
-#define HAVE_SNPRINTF 1
-#define HAVE_VSNPRINTF 1
-#define HAVE_SETJMP 1
-#define HAVE_CLOCK_GETTIME 1
-
-/* Enable various audio drivers */
-#define SDL_AUDIO_DRIVER_DART 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various cdrom drivers */
-#define SDL_CDROM_OS2 1
-
-/* Enable various input drivers */
-#define SDL_JOYSTICK_OS2 1
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_OS2 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_OS2 1
-
-/* Enable various timer systems */
-#define SDL_TIMER_OS2 1
-
-/* Enable various video drivers */
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_OS2FS 1
-
-/* Enable OpenGL support */
-/* Nothing here yet for OS/2... :( */
-
-/* Enable assembly routines where available */
-#define SDL_ASSEMBLY_ROUTINES 1
-
-#endif /* _SDL_config_os2_h */
diff --git a/src/SDL12/include/SDL_config_win32.h b/src/SDL12/include/SDL_config_win32.h
deleted file mode 100644
index 23e4868..0000000
--- a/src/SDL12/include/SDL_config_win32.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_config_win32_h
-#define _SDL_config_win32_h
-
-#include "SDL_platform.h"
-
-/* This is a set of defines to configure the SDL features */
-
-#ifdef __GNUC__
-#define HAVE_STDINT_H 1
-#elif defined(_MSC_VER)
-typedef signed __int8 int8_t;
-typedef unsigned __int8 uint8_t;
-typedef signed __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef signed __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#ifndef _UINTPTR_T_DEFINED
-#ifdef _WIN64
-typedef unsigned __int64 uintptr_t;
-#else
-typedef unsigned int uintptr_t;
-#endif
-#define _UINTPTR_T_DEFINED
-#endif
-#else /* !__GNUC__ && !_MSC_VER */
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed short int16_t;
-typedef unsigned short uint16_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef signed long long int64_t;
-typedef unsigned long long uint64_t;
-#ifndef _SIZE_T_DEFINED_
-#define _SIZE_T_DEFINED_
-typedef unsigned int size_t;
-#endif
-typedef unsigned int uintptr_t;
-#endif /* __GNUC__ || _MSC_VER */
-#define SDL_HAS_64BIT_TYPE 1
-
-/* Enabled for SDL 1.2 (binary compatibility) */
-#define HAVE_LIBC 1
-#ifdef HAVE_LIBC
-/* Useful headers */
-#define HAVE_STDIO_H 1
-#define STDC_HEADERS 1
-#define HAVE_STRING_H 1
-#define HAVE_CTYPE_H 1
-#define HAVE_MATH_H 1
-#ifndef _WIN32_WCE
-#define HAVE_SIGNAL_H 1
-#endif
-
-/* C library functions */
-#define HAVE_MALLOC 1
-#define HAVE_CALLOC 1
-#define HAVE_REALLOC 1
-#define HAVE_FREE 1
-#define HAVE_ALLOCA 1
-#define HAVE_QSORT 1
-#define HAVE_ABS 1
-#define HAVE_MEMSET 1
-#define HAVE_MEMCPY 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMCMP 1
-#define HAVE_STRLEN 1
-#define HAVE__STRREV 1
-#define HAVE__STRUPR 1
-#define HAVE__STRLWR 1
-#define HAVE_STRCHR 1
-#define HAVE_STRRCHR 1
-#define HAVE_STRSTR 1
-#define HAVE_ITOA 1
-#define HAVE__LTOA 1
-#define HAVE__ULTOA 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_STRTOLL 1
-#define HAVE_STRTOD 1
-#define HAVE_ATOI 1
-#define HAVE_ATOF 1
-#define HAVE_STRCMP 1
-#define HAVE_STRNCMP 1
-#define HAVE__STRICMP 1
-#define HAVE__STRNICMP 1
-#define HAVE_SSCANF 1
-#else
-#define HAVE_STDARG_H 1
-#define HAVE_STDDEF_H 1
-#endif
-
-/* Enable various audio drivers */
-#ifndef _WIN32_WCE
-#define SDL_AUDIO_DRIVER_DSOUND 1
-#endif
-#define SDL_AUDIO_DRIVER_WAVEOUT 1
-#define SDL_AUDIO_DRIVER_DISK 1
-#define SDL_AUDIO_DRIVER_DUMMY 1
-
-/* Enable various cdrom drivers */
-#ifdef _WIN32_WCE
-#define SDL_CDROM_DISABLED 1
-#else
-#define SDL_CDROM_WIN32 1
-#endif
-
-/* Enable various input drivers */
-#ifdef _WIN32_WCE
-#define SDL_JOYSTICK_DISABLED 1
-#else
-#define SDL_JOYSTICK_WINMM 1
-#endif
-
-/* Enable various shared object loading systems */
-#define SDL_LOADSO_WIN32 1
-
-/* Enable various threading systems */
-#define SDL_THREAD_WIN32 1
-
-/* Enable various timer systems */
-#ifdef _WIN32_WCE
-#define SDL_TIMER_WINCE 1
-#else
-#define SDL_TIMER_WIN32 1
-#endif
-
-/* Enable various video drivers */
-#ifdef _WIN32_WCE
-#define SDL_VIDEO_DRIVER_GAPI 1
-#endif
-#ifndef _WIN32_WCE
-#define SDL_VIDEO_DRIVER_DDRAW 1
-#endif
-#define SDL_VIDEO_DRIVER_DUMMY 1
-#define SDL_VIDEO_DRIVER_WINDIB 1
-
-/* Enable OpenGL support */
-#ifndef _WIN32_WCE
-#define SDL_VIDEO_OPENGL 1
-#define SDL_VIDEO_OPENGL_WGL 1
-#endif
-
-/* Enable assembly routines (Win64 doesn't have inline asm) */
-#ifndef _WIN64
-#define SDL_ASSEMBLY_ROUTINES 1
-#endif
-
-#endif /* _SDL_config_win32_h */
diff --git a/src/SDL12/include/SDL_copying.h b/src/SDL12/include/SDL_copying.h
deleted file mode 100644
index 39e122d..0000000
--- a/src/SDL12/include/SDL_copying.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
diff --git a/src/SDL12/include/SDL_cpuinfo.h b/src/SDL12/include/SDL_cpuinfo.h
deleted file mode 100644
index 72acbdd..0000000
--- a/src/SDL12/include/SDL_cpuinfo.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* CPU feature detection for SDL */
-
-#ifndef _SDL_cpuinfo_h
-#define _SDL_cpuinfo_h
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This function returns true if the CPU has the RDTSC instruction
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasRDTSC(void);
-
-/* This function returns true if the CPU has MMX features
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void);
-
-/* This function returns true if the CPU has MMX Ext. features
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasMMXExt(void);
-
-/* This function returns true if the CPU has 3DNow features
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNow(void);
-
-/* This function returns true if the CPU has 3DNow! Ext. features
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_Has3DNowExt(void);
-
-/* This function returns true if the CPU has SSE features
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void);
-
-/* This function returns true if the CPU has SSE2 features
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void);
-
-/* This function returns true if the CPU has AltiVec features
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_cpuinfo_h */
diff --git a/src/SDL12/include/SDL_endian.h b/src/SDL12/include/SDL_endian.h
deleted file mode 100644
index 6257a64..0000000
--- a/src/SDL12/include/SDL_endian.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Functions for reading and writing endian-specific values */
-
-#ifndef _SDL_endian_h
-#define _SDL_endian_h
-
-#include "SDL_stdinc.h"
-
-/* The two types of endianness */
-#define SDL_LIL_ENDIAN 1234
-#define SDL_BIG_ENDIAN 4321
-
-#ifndef SDL_BYTEORDER /* Not defined in SDL_config.h? */
-#if defined(__hppa__) || \
- defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
- (defined(__MIPS__) && defined(__MISPEB__)) || \
- defined(__ppc__) || defined(__POWERPC__) || defined(_M_PPC) || \
- defined(__sparc__)
-#define SDL_BYTEORDER SDL_BIG_ENDIAN
-#else
-#define SDL_BYTEORDER SDL_LIL_ENDIAN
-#endif
-#endif /* !SDL_BYTEORDER */
-
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Use inline functions for compilers that support them, and static
- functions for those that do not. Because these functions become
- static for compilers that do not support inline functions, this
- header should only be included in files that actually use them.
-*/
-#if defined(__GNUC__) && defined(__i386__) && \
- !(__GNUC__ == 2 && __GNUC_MINOR__ == 95 /* broken gcc version */)
-static __inline__ Uint16 SDL_Swap16(Uint16 x)
-{
- __asm__("xchgb %b0,%h0" : "=q" (x) : "0" (x));
- return x;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint16 SDL_Swap16(Uint16 x)
-{
- __asm__("xchgb %b0,%h0" : "=Q" (x) : "0" (x));
- return x;
-}
-#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-static __inline__ Uint16 SDL_Swap16(Uint16 x)
-{
- Uint16 result;
-
- __asm__("rlwimi %0,%2,8,16,23" : "=&r" (result) : "0" (x >> 8), "r" (x));
- return result;
-}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
-static __inline__ Uint16 SDL_Swap16(Uint16 x)
-{
- __asm__("rorw #8,%0" : "=d" (x) : "0" (x) : "cc");
- return x;
-}
-#else
-static __inline__ Uint16 SDL_Swap16(Uint16 x) {
- return((x<<8)|(x>>8));
-}
-#endif
-
-#if defined(__GNUC__) && defined(__i386__)
-static __inline__ Uint32 SDL_Swap32(Uint32 x)
-{
- __asm__("bswap %0" : "=r" (x) : "0" (x));
- return x;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint32 SDL_Swap32(Uint32 x)
-{
- __asm__("bswapl %0" : "=r" (x) : "0" (x));
- return x;
-}
-#elif defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__))
-static __inline__ Uint32 SDL_Swap32(Uint32 x)
-{
- Uint32 result;
-
- __asm__("rlwimi %0,%2,24,16,23" : "=&r" (result) : "0" (x>>24), "r" (x));
- __asm__("rlwimi %0,%2,8,8,15" : "=&r" (result) : "0" (result), "r" (x));
- __asm__("rlwimi %0,%2,24,0,7" : "=&r" (result) : "0" (result), "r" (x));
- return result;
-}
-#elif defined(__GNUC__) && (defined(__M68000__) || defined(__M68020__))
-static __inline__ Uint32 SDL_Swap32(Uint32 x)
-{
- __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0" : "=d" (x) : "0" (x) : "cc");
- return x;
-}
-#else
-static __inline__ Uint32 SDL_Swap32(Uint32 x) {
- return((x<<24)|((x<<8)&0x00FF0000)|((x>>8)&0x0000FF00)|(x>>24));
-}
-#endif
-
-#ifdef SDL_HAS_64BIT_TYPE
-#if defined(__GNUC__) && defined(__i386__)
-static __inline__ Uint64 SDL_Swap64(Uint64 x)
-{
- union {
- struct { Uint32 a,b; } s;
- Uint64 u;
- } v;
- v.u = x;
- __asm__("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
- : "=r" (v.s.a), "=r" (v.s.b)
- : "0" (v.s.a), "1" (v.s.b));
- return v.u;
-}
-#elif defined(__GNUC__) && defined(__x86_64__)
-static __inline__ Uint64 SDL_Swap64(Uint64 x)
-{
- __asm__("bswapq %0" : "=r" (x) : "0" (x));
- return x;
-}
-#else
-static __inline__ Uint64 SDL_Swap64(Uint64 x)
-{
- Uint32 hi, lo;
-
- /* Separate into high and low 32-bit values and swap them */
- lo = (Uint32)(x&0xFFFFFFFF);
- x >>= 32;
- hi = (Uint32)(x&0xFFFFFFFF);
- x = SDL_Swap32(lo);
- x <<= 32;
- x |= SDL_Swap32(hi);
- return(x);
-}
-#endif
-#else
-/* This is mainly to keep compilers from complaining in SDL code.
- If there is no real 64-bit datatype, then compilers will complain about
- the fake 64-bit datatype that SDL provides when it compiles user code.
-*/
-#define SDL_Swap64(X) (X)
-#endif /* SDL_HAS_64BIT_TYPE */
-
-
-/* Byteswap item from the specified endianness to the native endianness */
-#if SDL_BYTEORDER == SDL_LIL_ENDIAN
-#define SDL_SwapLE16(X) (X)
-#define SDL_SwapLE32(X) (X)
-#define SDL_SwapLE64(X) (X)
-#define SDL_SwapBE16(X) SDL_Swap16(X)
-#define SDL_SwapBE32(X) SDL_Swap32(X)
-#define SDL_SwapBE64(X) SDL_Swap64(X)
-#else
-#define SDL_SwapLE16(X) SDL_Swap16(X)
-#define SDL_SwapLE32(X) SDL_Swap32(X)
-#define SDL_SwapLE64(X) SDL_Swap64(X)
-#define SDL_SwapBE16(X) (X)
-#define SDL_SwapBE32(X) (X)
-#define SDL_SwapBE64(X) (X)
-#endif
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_endian_h */
diff --git a/src/SDL12/include/SDL_error.h b/src/SDL12/include/SDL_error.h
deleted file mode 100644
index 26d6bfa..0000000
--- a/src/SDL12/include/SDL_error.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Simple error message routines for SDL */
-
-#ifndef _SDL_error_h
-#define _SDL_error_h
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Public functions */
-extern DECLSPEC void SDLCALL SDL_SetError(const char *fmt, ...);
-extern DECLSPEC char * SDLCALL SDL_GetError(void);
-extern DECLSPEC void SDLCALL SDL_ClearError(void);
-
-/* Private error message function - used internally */
-#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM)
-#define SDL_Unsupported() SDL_Error(SDL_UNSUPPORTED)
-typedef enum {
- SDL_ENOMEM,
- SDL_EFREAD,
- SDL_EFWRITE,
- SDL_EFSEEK,
- SDL_UNSUPPORTED,
- SDL_LASTERROR
-} SDL_errorcode;
-extern DECLSPEC void SDLCALL SDL_Error(SDL_errorcode code);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_error_h */
diff --git a/src/SDL12/include/SDL_events.h b/src/SDL12/include/SDL_events.h
deleted file mode 100644
index 9fe918c..0000000
--- a/src/SDL12/include/SDL_events.h
+++ /dev/null
@@ -1,337 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Include file for SDL event handling */
-
-#ifndef _SDL_events_h
-#define _SDL_events_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_active.h"
-#include "SDL_keyboard.h"
-#include "SDL_mouse.h"
-#include "SDL_joystick.h"
-#include "SDL_quit.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* General keyboard/mouse state definitions */
-#define SDL_RELEASED 0
-#define SDL_PRESSED 1
-
-/* Event enumerations */
-typedef enum {
- SDL_NOEVENT = 0, /* Unused (do not remove) */
- SDL_ACTIVEEVENT, /* Application loses/gains visibility */
- SDL_KEYDOWN, /* Keys pressed */
- SDL_KEYUP, /* Keys released */
- SDL_MOUSEMOTION, /* Mouse moved */
- SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */
- SDL_MOUSEBUTTONUP, /* Mouse button released */
- SDL_JOYAXISMOTION, /* Joystick axis motion */
- SDL_JOYBALLMOTION, /* Joystick trackball motion */
- SDL_JOYHATMOTION, /* Joystick hat position change */
- SDL_JOYBUTTONDOWN, /* Joystick button pressed */
- SDL_JOYBUTTONUP, /* Joystick button released */
- SDL_QUIT, /* User-requested quit */
- SDL_SYSWMEVENT, /* System specific event */
- SDL_EVENT_RESERVEDA, /* Reserved for future use.. */
- SDL_EVENT_RESERVEDB, /* Reserved for future use.. */
- SDL_VIDEORESIZE, /* User resized video mode */
- SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */
- SDL_EVENT_RESERVED2, /* Reserved for future use.. */
- SDL_EVENT_RESERVED3, /* Reserved for future use.. */
- SDL_EVENT_RESERVED4, /* Reserved for future use.. */
- SDL_EVENT_RESERVED5, /* Reserved for future use.. */
- SDL_EVENT_RESERVED6, /* Reserved for future use.. */
- SDL_EVENT_RESERVED7, /* Reserved for future use.. */
- /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */
- SDL_USEREVENT = 24,
- /* This last event is only for bounding internal arrays
- It is the number of bits in the event mask datatype -- Uint32
- */
- SDL_NUMEVENTS = 32
-} SDL_EventType;
-
-/* Predefined event masks */
-#define SDL_EVENTMASK(X) (1<<(X))
-typedef enum {
- SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT),
- SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN),
- SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP),
- SDL_KEYEVENTMASK = SDL_EVENTMASK(SDL_KEYDOWN)|
- SDL_EVENTMASK(SDL_KEYUP),
- SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION),
- SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN),
- SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
- SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)|
- SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)|
- SDL_EVENTMASK(SDL_MOUSEBUTTONUP),
- SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION),
- SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION),
- SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION),
- SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN),
- SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP),
- SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)|
- SDL_EVENTMASK(SDL_JOYBALLMOTION)|
- SDL_EVENTMASK(SDL_JOYHATMOTION)|
- SDL_EVENTMASK(SDL_JOYBUTTONDOWN)|
- SDL_EVENTMASK(SDL_JOYBUTTONUP),
- SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE),
- SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE),
- SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT),
- SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT)
-} SDL_EventMask ;
-#define SDL_ALLEVENTS 0xFFFFFFFF
-
-/* Application visibility event structure */
-typedef struct SDL_ActiveEvent {
- Uint8 type; /* SDL_ACTIVEEVENT */
- Uint8 gain; /* Whether given states were gained or lost (1/0) */
- Uint8 state; /* A mask of the focus states */
-} SDL_ActiveEvent;
-
-/* Keyboard event structure */
-typedef struct SDL_KeyboardEvent {
- Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */
- Uint8 which; /* The keyboard device index */
- Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
- SDL_keysym keysym;
-} SDL_KeyboardEvent;
-
-/* Mouse motion event structure */
-typedef struct SDL_MouseMotionEvent {
- Uint8 type; /* SDL_MOUSEMOTION */
- Uint8 which; /* The mouse device index */
- Uint8 state; /* The current button state */
- Uint16 x, y; /* The X/Y coordinates of the mouse */
- Sint16 xrel; /* The relative motion in the X direction */
- Sint16 yrel; /* The relative motion in the Y direction */
-} SDL_MouseMotionEvent;
-
-/* Mouse button event structure */
-typedef struct SDL_MouseButtonEvent {
- Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */
- Uint8 which; /* The mouse device index */
- Uint8 button; /* The mouse button index */
- Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
- Uint16 x, y; /* The X/Y coordinates of the mouse at press time */
-} SDL_MouseButtonEvent;
-
-/* Joystick axis motion event structure */
-typedef struct SDL_JoyAxisEvent {
- Uint8 type; /* SDL_JOYAXISMOTION */
- Uint8 which; /* The joystick device index */
- Uint8 axis; /* The joystick axis index */
- Sint16 value; /* The axis value (range: -32768 to 32767) */
-} SDL_JoyAxisEvent;
-
-/* Joystick trackball motion event structure */
-typedef struct SDL_JoyBallEvent {
- Uint8 type; /* SDL_JOYBALLMOTION */
- Uint8 which; /* The joystick device index */
- Uint8 ball; /* The joystick trackball index */
- Sint16 xrel; /* The relative motion in the X direction */
- Sint16 yrel; /* The relative motion in the Y direction */
-} SDL_JoyBallEvent;
-
-/* Joystick hat position change event structure */
-typedef struct SDL_JoyHatEvent {
- Uint8 type; /* SDL_JOYHATMOTION */
- Uint8 which; /* The joystick device index */
- Uint8 hat; /* The joystick hat index */
- Uint8 value; /* The hat position value:
- SDL_HAT_LEFTUP SDL_HAT_UP SDL_HAT_RIGHTUP
- SDL_HAT_LEFT SDL_HAT_CENTERED SDL_HAT_RIGHT
- SDL_HAT_LEFTDOWN SDL_HAT_DOWN SDL_HAT_RIGHTDOWN
- Note that zero means the POV is centered.
- */
-} SDL_JoyHatEvent;
-
-/* Joystick button event structure */
-typedef struct SDL_JoyButtonEvent {
- Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */
- Uint8 which; /* The joystick device index */
- Uint8 button; /* The joystick button index */
- Uint8 state; /* SDL_PRESSED or SDL_RELEASED */
-} SDL_JoyButtonEvent;
-
-/* The "window resized" event
- When you get this event, you are responsible for setting a new video
- mode with the new width and height.
- */
-typedef struct SDL_ResizeEvent {
- Uint8 type; /* SDL_VIDEORESIZE */
- int w; /* New width */
- int h; /* New height */
-} SDL_ResizeEvent;
-
-/* The "screen redraw" event */
-typedef struct SDL_ExposeEvent {
- Uint8 type; /* SDL_VIDEOEXPOSE */
-} SDL_ExposeEvent;
-
-/* The "quit requested" event */
-typedef struct SDL_QuitEvent {
- Uint8 type; /* SDL_QUIT */
-} SDL_QuitEvent;
-
-/* A user-defined event type */
-typedef struct SDL_UserEvent {
- Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */
- int code; /* User defined event code */
- void *data1; /* User defined data pointer */
- void *data2; /* User defined data pointer */
-} SDL_UserEvent;
-
-/* If you want to use this event, you should include SDL_syswm.h */
-struct SDL_SysWMmsg;
-typedef struct SDL_SysWMmsg SDL_SysWMmsg;
-typedef struct SDL_SysWMEvent {
- Uint8 type;
- SDL_SysWMmsg *msg;
-} SDL_SysWMEvent;
-
-/* General event structure */
-typedef union SDL_Event {
- Uint8 type;
- SDL_ActiveEvent active;
- SDL_KeyboardEvent key;
- SDL_MouseMotionEvent motion;
- SDL_MouseButtonEvent button;
- SDL_JoyAxisEvent jaxis;
- SDL_JoyBallEvent jball;
- SDL_JoyHatEvent jhat;
- SDL_JoyButtonEvent jbutton;
- SDL_ResizeEvent resize;
- SDL_ExposeEvent expose;
- SDL_QuitEvent quit;
- SDL_UserEvent user;
- SDL_SysWMEvent syswm;
-} SDL_Event;
-
-
-/* Function prototypes */
-
-/* Pumps the event loop, gathering events from the input devices.
- This function updates the event queue and internal input device state.
- This should only be run in the thread that sets the video mode.
-*/
-extern DECLSPEC void SDLCALL SDL_PumpEvents(void);
-
-/* Checks the event queue for messages and optionally returns them.
- If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to
- the back of the event queue.
- If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front
- of the event queue, matching 'mask', will be returned and will not
- be removed from the queue.
- If 'action' is SDL_GETEVENT, up to 'numevents' events at the front
- of the event queue, matching 'mask', will be returned and will be
- removed from the queue.
- This function returns the number of events actually stored, or -1
- if there was an error. This function is thread-safe.
-*/
-typedef enum {
- SDL_ADDEVENT,
- SDL_PEEKEVENT,
- SDL_GETEVENT
-} SDL_eventaction;
-/* */
-extern DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents,
- SDL_eventaction action, Uint32 mask);
-
-/* Polls for currently pending events, and returns 1 if there are any pending
- events, or 0 if there are none available. If 'event' is not NULL, the next
- event is removed from the queue and stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_PollEvent(SDL_Event *event);
-
-/* Waits indefinitely for the next available event, returning 1, or 0 if there
- was an error while waiting for events. If 'event' is not NULL, the next
- event is removed from the queue and stored in that area.
- */
-extern DECLSPEC int SDLCALL SDL_WaitEvent(SDL_Event *event);
-
-/* Add an event to the event queue.
- This function returns 0 on success, or -1 if the event queue was full
- or there was some other error.
- */
-extern DECLSPEC int SDLCALL SDL_PushEvent(SDL_Event *event);
-
-/*
- This function sets up a filter to process all events before they
- change internal state and are posted to the internal event queue.
-
- The filter is protypted as:
-*/
-typedef int (SDLCALL *SDL_EventFilter)(const SDL_Event *event);
-/*
- If the filter returns 1, then the event will be added to the internal queue.
- If it returns 0, then the event will be dropped from the queue, but the
- internal state will still be updated. This allows selective filtering of
- dynamically arriving events.
-
- WARNING: Be very careful of what you do in the event filter function, as
- it may run in a different thread!
-
- There is one caveat when dealing with the SDL_QUITEVENT event type. The
- event filter is only called when the window manager desires to close the
- application window. If the event filter returns 1, then the window will
- be closed, otherwise the window will remain open if possible.
- If the quit event is generated by an interrupt signal, it will bypass the
- internal queue and be delivered to the application at the next event poll.
-*/
-extern DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter);
-
-/*
- Return the current event filter - can be used to "chain" filters.
- If there is no event filter set, this function returns NULL.
-*/
-extern DECLSPEC SDL_EventFilter SDLCALL SDL_GetEventFilter(void);
-
-/*
- This function allows you to set the state of processing certain events.
- If 'state' is set to SDL_IGNORE, that event will be automatically dropped
- from the event queue and will not event be filtered.
- If 'state' is set to SDL_ENABLE, that event will be processed normally.
- If 'state' is set to SDL_QUERY, SDL_EventState() will return the
- current processing state of the specified event.
-*/
-#define SDL_QUERY -1
-#define SDL_IGNORE 0
-#define SDL_DISABLE 0
-#define SDL_ENABLE 1
-extern DECLSPEC Uint8 SDLCALL SDL_EventState(Uint8 type, int state);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_events_h */
diff --git a/src/SDL12/include/SDL_getenv.h b/src/SDL12/include/SDL_getenv.h
deleted file mode 100644
index 853b9ce..0000000
--- a/src/SDL12/include/SDL_getenv.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* DEPRECATED */
-#include "SDL_stdinc.h"
diff --git a/src/SDL12/include/SDL_joystick.h b/src/SDL12/include/SDL_joystick.h
deleted file mode 100644
index e4f72f1..0000000
--- a/src/SDL12/include/SDL_joystick.h
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Include file for SDL joystick event handling */
-
-#ifndef _SDL_joystick_h
-#define _SDL_joystick_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* In order to use these functions, SDL_Init() must have been called
- with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system
- for joysticks, and load appropriate drivers.
-*/
-
-/* The joystick structure used to identify an SDL joystick */
-struct _SDL_Joystick;
-typedef struct _SDL_Joystick SDL_Joystick;
-
-
-/* Function prototypes */
-/*
- * Count the number of joysticks attached to the system
- */
-extern DECLSPEC int SDLCALL SDL_NumJoysticks(void);
-
-/*
- * Get the implementation dependent name of a joystick.
- * This can be called before any joysticks are opened.
- * If no name can be found, this function returns NULL.
- */
-extern DECLSPEC const char * SDLCALL SDL_JoystickName(int device_index);
-
-/*
- * Open a joystick for use - the index passed as an argument refers to
- * the N'th joystick on the system. This index is the value which will
- * identify this joystick in future joystick events.
- *
- * This function returns a joystick identifier, or NULL if an error occurred.
- */
-extern DECLSPEC SDL_Joystick * SDLCALL SDL_JoystickOpen(int device_index);
-
-/*
- * Returns 1 if the joystick has been opened, or 0 if it has not.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickOpened(int device_index);
-
-/*
- * Get the device index of an opened joystick.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickIndex(SDL_Joystick *joystick);
-
-/*
- * Get the number of general axis controls on a joystick
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumAxes(SDL_Joystick *joystick);
-
-/*
- * Get the number of trackballs on a joystick
- * Joystick trackballs have only relative motion events associated
- * with them and their state cannot be polled.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumBalls(SDL_Joystick *joystick);
-
-/*
- * Get the number of POV hats on a joystick
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumHats(SDL_Joystick *joystick);
-
-/*
- * Get the number of buttons on a joystick
- */
-extern DECLSPEC int SDLCALL SDL_JoystickNumButtons(SDL_Joystick *joystick);
-
-/*
- * Update the current state of the open joysticks.
- * This is called automatically by the event loop if any joystick
- * events are enabled.
- */
-extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void);
-
-/*
- * Enable/disable joystick event polling.
- * If joystick events are disabled, you must call SDL_JoystickUpdate()
- * yourself and check the state of the joystick when you want joystick
- * information.
- * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state);
-
-/*
- * Get the current state of an axis control on a joystick
- * The state is a value ranging from -32768 to 32767.
- * The axis indices start at index 0.
- */
-extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);
-
-/*
- * Get the current state of a POV hat on a joystick
- * The return value is one of the following positions:
- */
-#define SDL_HAT_CENTERED 0x00
-#define SDL_HAT_UP 0x01
-#define SDL_HAT_RIGHT 0x02
-#define SDL_HAT_DOWN 0x04
-#define SDL_HAT_LEFT 0x08
-#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP)
-#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN)
-#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP)
-#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN)
-/*
- * The hat indices start at index 0.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);
-
-/*
- * Get the ball axis change since the last poll
- * This returns 0, or -1 if you passed it invalid parameters.
- * The ball indices start at index 0.
- */
-extern DECLSPEC int SDLCALL SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);
-
-/*
- * Get the current state of a button on a joystick
- * The button indices start at index 0.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_JoystickGetButton(SDL_Joystick *joystick, int button);
-
-/*
- * Close a joystick previously opened with SDL_JoystickOpen()
- */
-extern DECLSPEC void SDLCALL SDL_JoystickClose(SDL_Joystick *joystick);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_joystick_h */
diff --git a/src/SDL12/include/SDL_keyboard.h b/src/SDL12/include/SDL_keyboard.h
deleted file mode 100644
index 1ad7dca..0000000
--- a/src/SDL12/include/SDL_keyboard.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Include file for SDL keyboard event handling */
-
-#ifndef _SDL_keyboard_h
-#define _SDL_keyboard_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_keysym.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Keysym structure
- - The scancode is hardware dependent, and should not be used by general
- applications. If no hardware scancode is available, it will be 0.
-
- - The 'unicode' translated character is only available when character
- translation is enabled by the SDL_EnableUNICODE() API. If non-zero,
- this is a UNICODE character corresponding to the keypress. If the
- high 9 bits of the character are 0, then this maps to the equivalent
- ASCII character:
- char ch;
- if ( (keysym.unicode & 0xFF80) == 0 ) {
- ch = keysym.unicode & 0x7F;
- } else {
- An international character..
- }
- */
-typedef struct SDL_keysym {
- Uint8 scancode; /* hardware specific scancode */
- SDLKey sym; /* SDL virtual keysym */
- SDLMod mod; /* current key modifiers */
- Uint16 unicode; /* translated character */
-} SDL_keysym;
-
-/* This is the mask which refers to all hotkey bindings */
-#define SDL_ALL_HOTKEYS 0xFFFFFFFF
-
-/* Function prototypes */
-/*
- * Enable/Disable UNICODE translation of keyboard input.
- * This translation has some overhead, so translation defaults off.
- * If 'enable' is 1, translation is enabled.
- * If 'enable' is 0, translation is disabled.
- * If 'enable' is -1, the translation state is not changed.
- * It returns the previous state of keyboard translation.
- */
-extern DECLSPEC int SDLCALL SDL_EnableUNICODE(int enable);
-
-/*
- * Enable/Disable keyboard repeat. Keyboard repeat defaults to off.
- * 'delay' is the initial delay in ms between the time when a key is
- * pressed, and keyboard repeat begins.
- * 'interval' is the time in ms between keyboard repeat events.
- */
-#define SDL_DEFAULT_REPEAT_DELAY 500
-#define SDL_DEFAULT_REPEAT_INTERVAL 30
-/*
- * If 'delay' is set to 0, keyboard repeat is disabled.
- */
-extern DECLSPEC int SDLCALL SDL_EnableKeyRepeat(int delay, int interval);
-extern DECLSPEC void SDLCALL SDL_GetKeyRepeat(int *delay, int *interval);
-
-/*
- * Get a snapshot of the current state of the keyboard.
- * Returns an array of keystates, indexed by the SDLK_* syms.
- * Used:
- * Uint8 *keystate = SDL_GetKeyState(NULL);
- * if ( keystate[SDLK_RETURN] ) ... is pressed.
- */
-extern DECLSPEC Uint8 * SDLCALL SDL_GetKeyState(int *numkeys);
-
-/*
- * Get the current key modifier state
- */
-extern DECLSPEC SDLMod SDLCALL SDL_GetModState(void);
-
-/*
- * Set the current key modifier state
- * This does not change the keyboard state, only the key modifier flags.
- */
-extern DECLSPEC void SDLCALL SDL_SetModState(SDLMod modstate);
-
-/*
- * Get the name of an SDL virtual keysym
- */
-extern DECLSPEC char * SDLCALL SDL_GetKeyName(SDLKey key);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_keyboard_h */
diff --git a/src/SDL12/include/SDL_keysym.h b/src/SDL12/include/SDL_keysym.h
deleted file mode 100644
index ff44a03..0000000
--- a/src/SDL12/include/SDL_keysym.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_keysym_h
-#define _SDL_keysym_h
-
-/* What we really want is a mapping of every raw key on the keyboard.
- To support international keyboards, we use the range 0xA1 - 0xFF
- as international virtual keycodes. We'll follow in the footsteps of X11...
- The names of the keys
- */
-
-typedef enum {
- /* The keyboard syms have been cleverly chosen to map to ASCII */
- SDLK_UNKNOWN = 0,
- SDLK_FIRST = 0,
- SDLK_BACKSPACE = 8,
- SDLK_TAB = 9,
- SDLK_CLEAR = 12,
- SDLK_RETURN = 13,
- SDLK_PAUSE = 19,
- SDLK_ESCAPE = 27,
- SDLK_SPACE = 32,
- SDLK_EXCLAIM = 33,
- SDLK_QUOTEDBL = 34,
- SDLK_HASH = 35,
- SDLK_DOLLAR = 36,
- SDLK_AMPERSAND = 38,
- SDLK_QUOTE = 39,
- SDLK_LEFTPAREN = 40,
- SDLK_RIGHTPAREN = 41,
- SDLK_ASTERISK = 42,
- SDLK_PLUS = 43,
- SDLK_COMMA = 44,
- SDLK_MINUS = 45,
- SDLK_PERIOD = 46,
- SDLK_SLASH = 47,
- SDLK_0 = 48,
- SDLK_1 = 49,
- SDLK_2 = 50,
- SDLK_3 = 51,
- SDLK_4 = 52,
- SDLK_5 = 53,
- SDLK_6 = 54,
- SDLK_7 = 55,
- SDLK_8 = 56,
- SDLK_9 = 57,
- SDLK_COLON = 58,
- SDLK_SEMICOLON = 59,
- SDLK_LESS = 60,
- SDLK_EQUALS = 61,
- SDLK_GREATER = 62,
- SDLK_QUESTION = 63,
- SDLK_AT = 64,
- /*
- Skip uppercase letters
- */
- SDLK_LEFTBRACKET = 91,
- SDLK_BACKSLASH = 92,
- SDLK_RIGHTBRACKET = 93,
- SDLK_CARET = 94,
- SDLK_UNDERSCORE = 95,
- SDLK_BACKQUOTE = 96,
- SDLK_a = 97,
- SDLK_b = 98,
- SDLK_c = 99,
- SDLK_d = 100,
- SDLK_e = 101,
- SDLK_f = 102,
- SDLK_g = 103,
- SDLK_h = 104,
- SDLK_i = 105,
- SDLK_j = 106,
- SDLK_k = 107,
- SDLK_l = 108,
- SDLK_m = 109,
- SDLK_n = 110,
- SDLK_o = 111,
- SDLK_p = 112,
- SDLK_q = 113,
- SDLK_r = 114,
- SDLK_s = 115,
- SDLK_t = 116,
- SDLK_u = 117,
- SDLK_v = 118,
- SDLK_w = 119,
- SDLK_x = 120,
- SDLK_y = 121,
- SDLK_z = 122,
- SDLK_DELETE = 127,
- /* End of ASCII mapped keysyms */
-
- /* International keyboard syms */
- SDLK_WORLD_0 = 160, /* 0xA0 */
- SDLK_WORLD_1 = 161,
- SDLK_WORLD_2 = 162,
- SDLK_WORLD_3 = 163,
- SDLK_WORLD_4 = 164,
- SDLK_WORLD_5 = 165,
- SDLK_WORLD_6 = 166,
- SDLK_WORLD_7 = 167,
- SDLK_WORLD_8 = 168,
- SDLK_WORLD_9 = 169,
- SDLK_WORLD_10 = 170,
- SDLK_WORLD_11 = 171,
- SDLK_WORLD_12 = 172,
- SDLK_WORLD_13 = 173,
- SDLK_WORLD_14 = 174,
- SDLK_WORLD_15 = 175,
- SDLK_WORLD_16 = 176,
- SDLK_WORLD_17 = 177,
- SDLK_WORLD_18 = 178,
- SDLK_WORLD_19 = 179,
- SDLK_WORLD_20 = 180,
- SDLK_WORLD_21 = 181,
- SDLK_WORLD_22 = 182,
- SDLK_WORLD_23 = 183,
- SDLK_WORLD_24 = 184,
- SDLK_WORLD_25 = 185,
- SDLK_WORLD_26 = 186,
- SDLK_WORLD_27 = 187,
- SDLK_WORLD_28 = 188,
- SDLK_WORLD_29 = 189,
- SDLK_WORLD_30 = 190,
- SDLK_WORLD_31 = 191,
- SDLK_WORLD_32 = 192,
- SDLK_WORLD_33 = 193,
- SDLK_WORLD_34 = 194,
- SDLK_WORLD_35 = 195,
- SDLK_WORLD_36 = 196,
- SDLK_WORLD_37 = 197,
- SDLK_WORLD_38 = 198,
- SDLK_WORLD_39 = 199,
- SDLK_WORLD_40 = 200,
- SDLK_WORLD_41 = 201,
- SDLK_WORLD_42 = 202,
- SDLK_WORLD_43 = 203,
- SDLK_WORLD_44 = 204,
- SDLK_WORLD_45 = 205,
- SDLK_WORLD_46 = 206,
- SDLK_WORLD_47 = 207,
- SDLK_WORLD_48 = 208,
- SDLK_WORLD_49 = 209,
- SDLK_WORLD_50 = 210,
- SDLK_WORLD_51 = 211,
- SDLK_WORLD_52 = 212,
- SDLK_WORLD_53 = 213,
- SDLK_WORLD_54 = 214,
- SDLK_WORLD_55 = 215,
- SDLK_WORLD_56 = 216,
- SDLK_WORLD_57 = 217,
- SDLK_WORLD_58 = 218,
- SDLK_WORLD_59 = 219,
- SDLK_WORLD_60 = 220,
- SDLK_WORLD_61 = 221,
- SDLK_WORLD_62 = 222,
- SDLK_WORLD_63 = 223,
- SDLK_WORLD_64 = 224,
- SDLK_WORLD_65 = 225,
- SDLK_WORLD_66 = 226,
- SDLK_WORLD_67 = 227,
- SDLK_WORLD_68 = 228,
- SDLK_WORLD_69 = 229,
- SDLK_WORLD_70 = 230,
- SDLK_WORLD_71 = 231,
- SDLK_WORLD_72 = 232,
- SDLK_WORLD_73 = 233,
- SDLK_WORLD_74 = 234,
- SDLK_WORLD_75 = 235,
- SDLK_WORLD_76 = 236,
- SDLK_WORLD_77 = 237,
- SDLK_WORLD_78 = 238,
- SDLK_WORLD_79 = 239,
- SDLK_WORLD_80 = 240,
- SDLK_WORLD_81 = 241,
- SDLK_WORLD_82 = 242,
- SDLK_WORLD_83 = 243,
- SDLK_WORLD_84 = 244,
- SDLK_WORLD_85 = 245,
- SDLK_WORLD_86 = 246,
- SDLK_WORLD_87 = 247,
- SDLK_WORLD_88 = 248,
- SDLK_WORLD_89 = 249,
- SDLK_WORLD_90 = 250,
- SDLK_WORLD_91 = 251,
- SDLK_WORLD_92 = 252,
- SDLK_WORLD_93 = 253,
- SDLK_WORLD_94 = 254,
- SDLK_WORLD_95 = 255, /* 0xFF */
-
- /* Numeric keypad */
- SDLK_KP0 = 256,
- SDLK_KP1 = 257,
- SDLK_KP2 = 258,
- SDLK_KP3 = 259,
- SDLK_KP4 = 260,
- SDLK_KP5 = 261,
- SDLK_KP6 = 262,
- SDLK_KP7 = 263,
- SDLK_KP8 = 264,
- SDLK_KP9 = 265,
- SDLK_KP_PERIOD = 266,
- SDLK_KP_DIVIDE = 267,
- SDLK_KP_MULTIPLY = 268,
- SDLK_KP_MINUS = 269,
- SDLK_KP_PLUS = 270,
- SDLK_KP_ENTER = 271,
- SDLK_KP_EQUALS = 272,
-
- /* Arrows + Home/End pad */
- SDLK_UP = 273,
- SDLK_DOWN = 274,
- SDLK_RIGHT = 275,
- SDLK_LEFT = 276,
- SDLK_INSERT = 277,
- SDLK_HOME = 278,
- SDLK_END = 279,
- SDLK_PAGEUP = 280,
- SDLK_PAGEDOWN = 281,
-
- /* Function keys */
- SDLK_F1 = 282,
- SDLK_F2 = 283,
- SDLK_F3 = 284,
- SDLK_F4 = 285,
- SDLK_F5 = 286,
- SDLK_F6 = 287,
- SDLK_F7 = 288,
- SDLK_F8 = 289,
- SDLK_F9 = 290,
- SDLK_F10 = 291,
- SDLK_F11 = 292,
- SDLK_F12 = 293,
- SDLK_F13 = 294,
- SDLK_F14 = 295,
- SDLK_F15 = 296,
-
- /* Key state modifier keys */
- SDLK_NUMLOCK = 300,
- SDLK_CAPSLOCK = 301,
- SDLK_SCROLLOCK = 302,
- SDLK_RSHIFT = 303,
- SDLK_LSHIFT = 304,
- SDLK_RCTRL = 305,
- SDLK_LCTRL = 306,
- SDLK_RALT = 307,
- SDLK_LALT = 308,
- SDLK_RMETA = 309,
- SDLK_LMETA = 310,
- SDLK_LSUPER = 311, /* Left "Windows" key */
- SDLK_RSUPER = 312, /* Right "Windows" key */
- SDLK_MODE = 313, /* "Alt Gr" key */
- SDLK_COMPOSE = 314, /* Multi-key compose key */
-
- /* Miscellaneous function keys */
- SDLK_HELP = 315,
- SDLK_PRINT = 316,
- SDLK_SYSREQ = 317,
- SDLK_BREAK = 318,
- SDLK_MENU = 319,
- SDLK_POWER = 320, /* Power Macintosh power key */
- SDLK_EURO = 321, /* Some european keyboards */
- SDLK_UNDO = 322, /* Atari keyboard has Undo */
-
- /* Add any other keys here */
-
- SDLK_LAST
-} SDLKey;
-
-/* Enumeration of valid key mods (possibly OR'd together) */
-typedef enum {
- KMOD_NONE = 0x0000,
- KMOD_LSHIFT= 0x0001,
- KMOD_RSHIFT= 0x0002,
- KMOD_LCTRL = 0x0040,
- KMOD_RCTRL = 0x0080,
- KMOD_LALT = 0x0100,
- KMOD_RALT = 0x0200,
- KMOD_LMETA = 0x0400,
- KMOD_RMETA = 0x0800,
- KMOD_NUM = 0x1000,
- KMOD_CAPS = 0x2000,
- KMOD_MODE = 0x4000,
- KMOD_RESERVED = 0x8000
-} SDLMod;
-
-#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
-#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT)
-#define KMOD_ALT (KMOD_LALT|KMOD_RALT)
-#define KMOD_META (KMOD_LMETA|KMOD_RMETA)
-
-#endif /* _SDL_keysym_h */
diff --git a/src/SDL12/include/SDL_loadso.h b/src/SDL12/include/SDL_loadso.h
deleted file mode 100644
index ce96449..0000000
--- a/src/SDL12/include/SDL_loadso.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* System dependent library loading routines */
-
-/* Some things to keep in mind:
- - These functions only work on C function names. Other languages may
- have name mangling and intrinsic language support that varies from
- compiler to compiler.
- - Make sure you declare your function pointers with the same calling
- convention as the actual library function. Your code will crash
- mysteriously if you do not do this.
- - Avoid namespace collisions. If you load a symbol from the library,
- it is not defined whether or not it goes into the global symbol
- namespace for the application. If it does and it conflicts with
- symbols in your code or other shared libraries, you will not get
- the results you expect. :)
-*/
-
-
-#ifndef _SDL_loadso_h
-#define _SDL_loadso_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This function dynamically loads a shared object and returns a pointer
- * to the object handle (or NULL if there was an error).
- * The 'sofile' parameter is a system dependent name of the object file.
- */
-extern DECLSPEC void * SDLCALL SDL_LoadObject(const char *sofile);
-
-/* Given an object handle, this function looks up the address of the
- * named function in the shared object and returns it. This address
- * is no longer valid after calling SDL_UnloadObject().
- */
-extern DECLSPEC void * SDLCALL SDL_LoadFunction(void *handle, const char *name);
-
-/* Unload a shared object from memory */
-extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_loadso_h */
diff --git a/src/SDL12/include/SDL_main.h b/src/SDL12/include/SDL_main.h
deleted file mode 100644
index cf8b728..0000000
--- a/src/SDL12/include/SDL_main.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_main_h
-#define _SDL_main_h
-
-#include "SDL_stdinc.h"
-
-/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */
-
-#if defined(__WIN32__) || \
- (defined(__MWERKS__) && !defined(__BEOS__)) || \
- defined(__MACOS__) || defined(__MACOSX__) || \
- defined(__SYMBIAN32__) || defined(QWS)
-
-#ifdef __cplusplus
-#define C_LINKAGE "C"
-#else
-#define C_LINKAGE
-#endif /* __cplusplus */
-
-/* The application's main() function must be called with C linkage,
- and should be declared like this:
-#ifdef __cplusplus
-extern "C"
-#endif
- int main(int argc, char *argv[])
- {
- }
- */
-#define main SDL_main
-
-/* The prototype for the application's main() function */
-extern C_LINKAGE int SDL_main(int argc, char *argv[]);
-
-
-/* From the SDL library code -- needed for registering the app on Win32 */
-#ifdef __WIN32__
-
-#include "begin_code.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This should be called from your WinMain() function, if any */
-extern DECLSPEC void SDLCALL SDL_SetModuleHandle(void *hInst);
-/* This can also be called, but is no longer necessary */
-extern DECLSPEC int SDLCALL SDL_RegisterApp(char *name, Uint32 style, void *hInst);
-/* This can also be called, but is no longer necessary (SDL_Quit calls it) */
-extern DECLSPEC void SDLCALL SDL_UnregisterApp(void);
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-#endif
-
-/* From the SDL library code -- needed for registering QuickDraw on MacOS */
-#if defined(__MACOS__)
-
-#include "begin_code.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Forward declaration so we don't need to include QuickDraw.h */
-struct QDGlobals;
-
-/* This should be called from your main() function, if any */
-extern DECLSPEC void SDLCALL SDL_InitQuickDraw(struct QDGlobals *the_qd);
-
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-#endif
-
-#endif /* Need to redefine main()? */
-
-#endif /* _SDL_main_h */
diff --git a/src/SDL12/include/SDL_mouse.h b/src/SDL12/include/SDL_mouse.h
deleted file mode 100644
index c2364d8..0000000
--- a/src/SDL12/include/SDL_mouse.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Include file for SDL mouse event handling */
-
-#ifndef _SDL_mouse_h
-#define _SDL_mouse_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_video.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct WMcursor WMcursor; /* Implementation dependent */
-typedef struct SDL_Cursor {
- SDL_Rect area; /* The area of the mouse cursor */
- Sint16 hot_x, hot_y; /* The "tip" of the cursor */
- Uint8 *data; /* B/W cursor data */
- Uint8 *mask; /* B/W cursor mask */
- Uint8 *save[2]; /* Place to save cursor area */
- WMcursor *wm_cursor; /* Window-manager cursor */
-} SDL_Cursor;
-
-/* Function prototypes */
-/*
- * Retrieve the current state of the mouse.
- * The current button state is returned as a button bitmask, which can
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
- * current mouse cursor position. You can pass NULL for either x or y.
- */
-extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
-
-/*
- * Retrieve the current state of the mouse.
- * The current button state is returned as a button bitmask, which can
- * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
- * mouse deltas since the last call to SDL_GetRelativeMouseState().
- */
-extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
-
-/*
- * Set the position of the mouse cursor (generates a mouse motion event)
- */
-extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
-
-/*
- * Create a cursor using the specified data and mask (in MSB format).
- * The cursor width must be a multiple of 8 bits.
- *
- * The cursor is created in black and white according to the following:
- * data mask resulting pixel on screen
- * 0 1 White
- * 1 1 Black
- * 0 0 Transparent
- * 1 0 Inverted color if possible, black if not.
- *
- * Cursors created with this function must be freed with SDL_FreeCursor().
- */
-extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
- (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
-
-/*
- * Set the currently active cursor to the specified one.
- * If the cursor is currently visible, the change will be immediately
- * represented on the display.
- */
-extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
-
-/*
- * Returns the currently active cursor.
- */
-extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
-
-/*
- * Deallocates a cursor created with SDL_CreateCursor().
- */
-extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
-
-/*
- * Toggle whether or not the cursor is shown on the screen.
- * The cursor start off displayed, but can be turned off.
- * SDL_ShowCursor() returns 1 if the cursor was being displayed
- * before the call, or 0 if it was not. You can query the current
- * state by passing a 'toggle' value of -1.
- */
-extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
-
-/* Used as a mask when testing buttons in buttonstate
- Button 1: Left mouse button
- Button 2: Middle mouse button
- Button 3: Right mouse button
- Button 4: Mouse wheel up (may also be a real button)
- Button 5: Mouse wheel down (may also be a real button)
- */
-#define SDL_BUTTON(X) (1 << ((X)-1))
-#define SDL_BUTTON_LEFT 1
-#define SDL_BUTTON_MIDDLE 2
-#define SDL_BUTTON_RIGHT 3
-#define SDL_BUTTON_WHEELUP 4
-#define SDL_BUTTON_WHEELDOWN 5
-#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT)
-#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE)
-#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT)
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_mouse_h */
diff --git a/src/SDL12/include/SDL_mutex.h b/src/SDL12/include/SDL_mutex.h
deleted file mode 100644
index 0016528..0000000
--- a/src/SDL12/include/SDL_mutex.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_mutex_h
-#define _SDL_mutex_h
-
-/* Functions to provide thread synchronization primitives
-
- These are independent of the other SDL routines.
-*/
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Synchronization functions which can time out return this value
- if they time out.
-*/
-#define SDL_MUTEX_TIMEDOUT 1
-
-/* This is the timeout value which corresponds to never time out */
-#define SDL_MUTEX_MAXWAIT (~(Uint32)0)
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Mutex functions */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* The SDL mutex structure, defined in SDL_mutex.c */
-struct SDL_mutex;
-typedef struct SDL_mutex SDL_mutex;
-
-/* Create a mutex, initialized unlocked */
-extern DECLSPEC SDL_mutex * SDLCALL SDL_CreateMutex(void);
-
-/* Lock the mutex (Returns 0, or -1 on error) */
-#define SDL_LockMutex(m) SDL_mutexP(m)
-extern DECLSPEC int SDLCALL SDL_mutexP(SDL_mutex *mutex);
-
-/* Unlock the mutex (Returns 0, or -1 on error)
- It is an error to unlock a mutex that has not been locked by
- the current thread, and doing so results in undefined behavior.
- */
-#define SDL_UnlockMutex(m) SDL_mutexV(m)
-extern DECLSPEC int SDLCALL SDL_mutexV(SDL_mutex *mutex);
-
-/* Destroy a mutex */
-extern DECLSPEC void SDLCALL SDL_DestroyMutex(SDL_mutex *mutex);
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Semaphore functions */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* The SDL semaphore structure, defined in SDL_sem.c */
-struct SDL_semaphore;
-typedef struct SDL_semaphore SDL_sem;
-
-/* Create a semaphore, initialized with value, returns NULL on failure. */
-extern DECLSPEC SDL_sem * SDLCALL SDL_CreateSemaphore(Uint32 initial_value);
-
-/* Destroy a semaphore */
-extern DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_sem *sem);
-
-/* This function suspends the calling thread until the semaphore pointed
- * to by sem has a positive count. It then atomically decreases the semaphore
- * count.
- */
-extern DECLSPEC int SDLCALL SDL_SemWait(SDL_sem *sem);
-
-/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds,
- SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error.
-*/
-extern DECLSPEC int SDLCALL SDL_SemTryWait(SDL_sem *sem);
-
-/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if
- the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in
- the allotted time, and -1 on error.
- On some platforms this function is implemented by looping with a delay
- of 1 ms, and so should be avoided if possible.
-*/
-extern DECLSPEC int SDLCALL SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms);
-
-/* Atomically increases the semaphore's count (not blocking), returns 0,
- or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_SemPost(SDL_sem *sem);
-
-/* Returns the current count of the semaphore */
-extern DECLSPEC Uint32 SDLCALL SDL_SemValue(SDL_sem *sem);
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Condition variable functions */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* The SDL condition variable structure, defined in SDL_cond.c */
-struct SDL_cond;
-typedef struct SDL_cond SDL_cond;
-
-/* Create a condition variable */
-extern DECLSPEC SDL_cond * SDLCALL SDL_CreateCond(void);
-
-/* Destroy a condition variable */
-extern DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond);
-
-/* Restart one of the threads that are waiting on the condition variable,
- returns 0 or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondSignal(SDL_cond *cond);
-
-/* Restart all threads that are waiting on the condition variable,
- returns 0 or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondBroadcast(SDL_cond *cond);
-
-/* Wait on the condition variable, unlocking the provided mutex.
- The mutex must be locked before entering this function!
- The mutex is re-locked once the condition variable is signaled.
- Returns 0 when it is signaled, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);
-
-/* Waits for at most 'ms' milliseconds, and returns 0 if the condition
- variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not
- signaled in the allotted time, and -1 on error.
- On some platforms this function is implemented by looping with a delay
- of 1 ms, and so should be avoided if possible.
-*/
-extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_mutex_h */
diff --git a/src/SDL12/include/SDL_name.h b/src/SDL12/include/SDL_name.h
deleted file mode 100644
index 511619a..0000000
--- a/src/SDL12/include/SDL_name.h
+++ /dev/null
@@ -1,11 +0,0 @@
-
-#ifndef _SDLname_h_
-#define _SDLname_h_
-
-#if defined(__STDC__) || defined(__cplusplus)
-#define NeedFunctionPrototypes 1
-#endif
-
-#define SDL_NAME(X) SDL_##X
-
-#endif /* _SDLname_h_ */
diff --git a/src/SDL12/include/SDL_opengl.h b/src/SDL12/include/SDL_opengl.h
deleted file mode 100644
index 36c0a30..0000000
--- a/src/SDL12/include/SDL_opengl.h
+++ /dev/null
@@ -1,6551 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* This is a simple file to encapsulate the OpenGL API headers */
-
-#include "SDL_config.h"
-
-#ifdef __WIN32__
-#define WIN32_LEAN_AND_MEAN
-#ifndef NOMINMAX
-#define NOMINMAX /* Don't defined min() and max() */
-#endif
-#include
-#endif
-#ifndef NO_SDL_GLEXT
-#define __glext_h_ /* Don't let gl.h include glext.h */
-#endif
-#if defined(__MACOSX__)
-#include /* Header File For The OpenGL Library */
-#include /* Header File For The GLU Library */
-#elif defined(__MACOS__)
-#include /* Header File For The OpenGL Library */
-#include /* Header File For The GLU Library */
-#else
-#include /* Header File For The OpenGL Library */
-#include /* Header File For The GLU Library */
-#endif
-#ifndef NO_SDL_GLEXT
-#undef __glext_h_
-#endif
-
-/* This file taken from "GLext.h" from the Jeff Molofee OpenGL tutorials.
- It is included here because glext.h is not available on some systems.
- If you don't want this version included, simply define "NO_SDL_GLEXT"
- */
-#ifndef NO_SDL_GLEXT
-#if !defined(__glext_h_) && !defined(GL_GLEXT_LEGACY)
-#define __glext_h_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** License Applicability. Except to the extent portions of this file are
-** made subject to an alternative license as permitted in the SGI Free
-** Software License B, Version 1.1 (the "License"), the contents of this
-** file are subject only to the provisions of the License. You may not use
-** this file except in compliance with the License. You may obtain a copy
-** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
-** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
-**
-** http://oss.sgi.com/projects/FreeB
-**
-** Note that, as provided in the License, the Software is distributed on an
-** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
-** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
-** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
-** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
-**
-** Original Code. The Original Code is: OpenGL Sample Implementation,
-** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
-** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
-** Copyright in any portions created by third parties is as indicated
-** elsewhere herein. All Rights Reserved.
-**
-** Additional Notice Provisions: This software was created using the
-** OpenGL(R) version 1.2.1 Sample Implementation published by SGI, but has
-** not been independently verified as being compliant with the OpenGL(R)
-** version 1.2.1 Specification.
-*/
-
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
-#define WIN32_LEAN_AND_MEAN 1
-#include
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
-#endif
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
-/*************************************************************/
-
-/* Header file version number, required by OpenGL ABI for Linux */
-/* glext.h last updated 2005/06/20 */
-/* Current version at http://oss.sgi.com/projects/ogl-sample/registry/ */
-#define GL_GLEXT_VERSION 29
-
-#ifndef GL_VERSION_1_2
-#define GL_UNSIGNED_BYTE_3_3_2 0x8032
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_INT_8_8_8_8 0x8035
-#define GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GL_RESCALE_NORMAL 0x803A
-#define GL_TEXTURE_BINDING_3D 0x806A
-#define GL_PACK_SKIP_IMAGES 0x806B
-#define GL_PACK_IMAGE_HEIGHT 0x806C
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_PROXY_TEXTURE_3D 0x8070
-#define GL_TEXTURE_DEPTH 0x8071
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
-#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_BGR 0x80E0
-#define GL_BGRA 0x80E1
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
-#define GL_SINGLE_COLOR 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#endif
-
-#ifndef GL_ARB_imaging
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_BLEND_COLOR 0x8005
-#define GL_FUNC_ADD 0x8006
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-#define GL_BLEND_EQUATION 0x8009
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_CONVOLUTION_1D 0x8010
-#define GL_CONVOLUTION_2D 0x8011
-#define GL_SEPARABLE_2D 0x8012
-#define GL_CONVOLUTION_BORDER_MODE 0x8013
-#define GL_CONVOLUTION_FILTER_SCALE 0x8014
-#define GL_CONVOLUTION_FILTER_BIAS 0x8015
-#define GL_REDUCE 0x8016
-#define GL_CONVOLUTION_FORMAT 0x8017
-#define GL_CONVOLUTION_WIDTH 0x8018
-#define GL_CONVOLUTION_HEIGHT 0x8019
-#define GL_MAX_CONVOLUTION_WIDTH 0x801A
-#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
-#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
-#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
-#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
-#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
-#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
-#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
-#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
-#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
-#define GL_HISTOGRAM 0x8024
-#define GL_PROXY_HISTOGRAM 0x8025
-#define GL_HISTOGRAM_WIDTH 0x8026
-#define GL_HISTOGRAM_FORMAT 0x8027
-#define GL_HISTOGRAM_RED_SIZE 0x8028
-#define GL_HISTOGRAM_GREEN_SIZE 0x8029
-#define GL_HISTOGRAM_BLUE_SIZE 0x802A
-#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
-#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
-#define GL_HISTOGRAM_SINK 0x802D
-#define GL_MINMAX 0x802E
-#define GL_MINMAX_FORMAT 0x802F
-#define GL_MINMAX_SINK 0x8030
-#define GL_TABLE_TOO_LARGE 0x8031
-#define GL_COLOR_MATRIX 0x80B1
-#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
-#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
-#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
-#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
-#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
-#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
-#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
-#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
-#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
-#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
-#define GL_COLOR_TABLE 0x80D0
-#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
-#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
-#define GL_PROXY_COLOR_TABLE 0x80D3
-#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
-#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
-#define GL_COLOR_TABLE_SCALE 0x80D6
-#define GL_COLOR_TABLE_BIAS 0x80D7
-#define GL_COLOR_TABLE_FORMAT 0x80D8
-#define GL_COLOR_TABLE_WIDTH 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
-#define GL_CONSTANT_BORDER 0x8151
-#define GL_REPLICATE_BORDER 0x8153
-#define GL_CONVOLUTION_BORDER_COLOR 0x8154
-#endif
-
-#ifndef GL_VERSION_1_3
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_MULTISAMPLE_BIT 0x20000000
-#define GL_NORMAL_MAP 0x8511
-#define GL_REFLECTION_MAP 0x8512
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-#define GL_COMPRESSED_ALPHA 0x84E9
-#define GL_COMPRESSED_LUMINANCE 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
-#define GL_COMPRESSED_INTENSITY 0x84EC
-#define GL_COMPRESSED_RGB 0x84ED
-#define GL_COMPRESSED_RGBA 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
-#define GL_TEXTURE_COMPRESSED 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_CLAMP_TO_BORDER 0x812D
-#define GL_COMBINE 0x8570
-#define GL_COMBINE_RGB 0x8571
-#define GL_COMBINE_ALPHA 0x8572
-#define GL_SOURCE0_RGB 0x8580
-#define GL_SOURCE1_RGB 0x8581
-#define GL_SOURCE2_RGB 0x8582
-#define GL_SOURCE0_ALPHA 0x8588
-#define GL_SOURCE1_ALPHA 0x8589
-#define GL_SOURCE2_ALPHA 0x858A
-#define GL_OPERAND0_RGB 0x8590
-#define GL_OPERAND1_RGB 0x8591
-#define GL_OPERAND2_RGB 0x8592
-#define GL_OPERAND0_ALPHA 0x8598
-#define GL_OPERAND1_ALPHA 0x8599
-#define GL_OPERAND2_ALPHA 0x859A
-#define GL_RGB_SCALE 0x8573
-#define GL_ADD_SIGNED 0x8574
-#define GL_INTERPOLATE 0x8575
-#define GL_SUBTRACT 0x84E7
-#define GL_CONSTANT 0x8576
-#define GL_PRIMARY_COLOR 0x8577
-#define GL_PREVIOUS 0x8578
-#define GL_DOT3_RGB 0x86AE
-#define GL_DOT3_RGBA 0x86AF
-#endif
-
-#ifndef GL_VERSION_1_4
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_POINT_SIZE_MIN 0x8126
-#define GL_POINT_SIZE_MAX 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION 0x8129
-#define GL_GENERATE_MIPMAP 0x8191
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_DEPTH_COMPONENT24 0x81A6
-#define GL_DEPTH_COMPONENT32 0x81A7
-#define GL_MIRRORED_REPEAT 0x8370
-#define GL_FOG_COORDINATE_SOURCE 0x8450
-#define GL_FOG_COORDINATE 0x8451
-#define GL_FRAGMENT_DEPTH 0x8452
-#define GL_CURRENT_FOG_COORDINATE 0x8453
-#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454
-#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455
-#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456
-#define GL_FOG_COORDINATE_ARRAY 0x8457
-#define GL_COLOR_SUM 0x8458
-#define GL_CURRENT_SECONDARY_COLOR 0x8459
-#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A
-#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B
-#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
-#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
-#define GL_SECONDARY_COLOR_ARRAY 0x845E
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
-#define GL_TEXTURE_FILTER_CONTROL 0x8500
-#define GL_TEXTURE_LOD_BIAS 0x8501
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-#define GL_TEXTURE_DEPTH_SIZE 0x884A
-#define GL_DEPTH_TEXTURE_MODE 0x884B
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#define GL_COMPARE_R_TO_TEXTURE 0x884E
-#endif
-
-#ifndef GL_VERSION_1_5
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_QUERY_COUNTER_BITS 0x8864
-#define GL_CURRENT_QUERY 0x8865
-#define GL_QUERY_RESULT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE 0x8867
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
-#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
-#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
-#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
-#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
-#define GL_READ_ONLY 0x88B8
-#define GL_WRITE_ONLY 0x88B9
-#define GL_READ_WRITE 0x88BA
-#define GL_BUFFER_ACCESS 0x88BB
-#define GL_BUFFER_MAPPED 0x88BC
-#define GL_BUFFER_MAP_POINTER 0x88BD
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STREAM_READ 0x88E1
-#define GL_STREAM_COPY 0x88E2
-#define GL_STATIC_DRAW 0x88E4
-#define GL_STATIC_READ 0x88E5
-#define GL_STATIC_COPY 0x88E6
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_DYNAMIC_READ 0x88E9
-#define GL_DYNAMIC_COPY 0x88EA
-#define GL_SAMPLES_PASSED 0x8914
-#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE
-#define GL_FOG_COORD GL_FOG_COORDINATE
-#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE
-#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE
-#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE
-#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER
-#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY
-#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING
-#define GL_SRC0_RGB GL_SOURCE0_RGB
-#define GL_SRC1_RGB GL_SOURCE1_RGB
-#define GL_SRC2_RGB GL_SOURCE2_RGB
-#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA
-#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA
-#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA
-#endif
-
-#ifndef GL_VERSION_2_0
-#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_MAX_DRAW_BUFFERS 0x8824
-#define GL_DRAW_BUFFER0 0x8825
-#define GL_DRAW_BUFFER1 0x8826
-#define GL_DRAW_BUFFER2 0x8827
-#define GL_DRAW_BUFFER3 0x8828
-#define GL_DRAW_BUFFER4 0x8829
-#define GL_DRAW_BUFFER5 0x882A
-#define GL_DRAW_BUFFER6 0x882B
-#define GL_DRAW_BUFFER7 0x882C
-#define GL_DRAW_BUFFER8 0x882D
-#define GL_DRAW_BUFFER9 0x882E
-#define GL_DRAW_BUFFER10 0x882F
-#define GL_DRAW_BUFFER11 0x8830
-#define GL_DRAW_BUFFER12 0x8831
-#define GL_DRAW_BUFFER13 0x8832
-#define GL_DRAW_BUFFER14 0x8833
-#define GL_DRAW_BUFFER15 0x8834
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_POINT_SPRITE 0x8861
-#define GL_COORD_REPLACE 0x8862
-#define GL_MAX_VERTEX_ATTRIBS 0x8869
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_MAX_TEXTURE_COORDS 0x8871
-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
-#define GL_MAX_VARYING_FLOATS 0x8B4B
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
-#define GL_SHADER_TYPE 0x8B4F
-#define GL_FLOAT_VEC2 0x8B50
-#define GL_FLOAT_VEC3 0x8B51
-#define GL_FLOAT_VEC4 0x8B52
-#define GL_INT_VEC2 0x8B53
-#define GL_INT_VEC3 0x8B54
-#define GL_INT_VEC4 0x8B55
-#define GL_BOOL 0x8B56
-#define GL_BOOL_VEC2 0x8B57
-#define GL_BOOL_VEC3 0x8B58
-#define GL_BOOL_VEC4 0x8B59
-#define GL_FLOAT_MAT2 0x8B5A
-#define GL_FLOAT_MAT3 0x8B5B
-#define GL_FLOAT_MAT4 0x8B5C
-#define GL_SAMPLER_1D 0x8B5D
-#define GL_SAMPLER_2D 0x8B5E
-#define GL_SAMPLER_3D 0x8B5F
-#define GL_SAMPLER_CUBE 0x8B60
-#define GL_SAMPLER_1D_SHADOW 0x8B61
-#define GL_SAMPLER_2D_SHADOW 0x8B62
-#define GL_DELETE_STATUS 0x8B80
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_LINK_STATUS 0x8B82
-#define GL_VALIDATE_STATUS 0x8B83
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_ATTACHED_SHADERS 0x8B85
-#define GL_ACTIVE_UNIFORMS 0x8B86
-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_ACTIVE_ATTRIBUTES 0x8B89
-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
-#define GL_CURRENT_PROGRAM 0x8B8D
-#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
-#define GL_LOWER_LEFT 0x8CA1
-#define GL_UPPER_LEFT 0x8CA2
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-#endif
-
-#ifndef GL_ARB_multitexture
-#define GL_TEXTURE0_ARB 0x84C0
-#define GL_TEXTURE1_ARB 0x84C1
-#define GL_TEXTURE2_ARB 0x84C2
-#define GL_TEXTURE3_ARB 0x84C3
-#define GL_TEXTURE4_ARB 0x84C4
-#define GL_TEXTURE5_ARB 0x84C5
-#define GL_TEXTURE6_ARB 0x84C6
-#define GL_TEXTURE7_ARB 0x84C7
-#define GL_TEXTURE8_ARB 0x84C8
-#define GL_TEXTURE9_ARB 0x84C9
-#define GL_TEXTURE10_ARB 0x84CA
-#define GL_TEXTURE11_ARB 0x84CB
-#define GL_TEXTURE12_ARB 0x84CC
-#define GL_TEXTURE13_ARB 0x84CD
-#define GL_TEXTURE14_ARB 0x84CE
-#define GL_TEXTURE15_ARB 0x84CF
-#define GL_TEXTURE16_ARB 0x84D0
-#define GL_TEXTURE17_ARB 0x84D1
-#define GL_TEXTURE18_ARB 0x84D2
-#define GL_TEXTURE19_ARB 0x84D3
-#define GL_TEXTURE20_ARB 0x84D4
-#define GL_TEXTURE21_ARB 0x84D5
-#define GL_TEXTURE22_ARB 0x84D6
-#define GL_TEXTURE23_ARB 0x84D7
-#define GL_TEXTURE24_ARB 0x84D8
-#define GL_TEXTURE25_ARB 0x84D9
-#define GL_TEXTURE26_ARB 0x84DA
-#define GL_TEXTURE27_ARB 0x84DB
-#define GL_TEXTURE28_ARB 0x84DC
-#define GL_TEXTURE29_ARB 0x84DD
-#define GL_TEXTURE30_ARB 0x84DE
-#define GL_TEXTURE31_ARB 0x84DF
-#define GL_ACTIVE_TEXTURE_ARB 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
-#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
-#endif
-
-#ifndef GL_ARB_transpose_matrix
-#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6
-#endif
-
-#ifndef GL_ARB_multisample
-#define GL_MULTISAMPLE_ARB 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F
-#define GL_SAMPLE_COVERAGE_ARB 0x80A0
-#define GL_SAMPLE_BUFFERS_ARB 0x80A8
-#define GL_SAMPLES_ARB 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB
-#define GL_MULTISAMPLE_BIT_ARB 0x20000000
-#endif
-
-#ifndef GL_ARB_texture_env_add
-#endif
-
-#ifndef GL_ARB_texture_cube_map
-#define GL_NORMAL_MAP_ARB 0x8511
-#define GL_REFLECTION_MAP_ARB 0x8512
-#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
-#endif
-
-#ifndef GL_ARB_texture_compression
-#define GL_COMPRESSED_ALPHA_ARB 0x84E9
-#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
-#define GL_COMPRESSED_INTENSITY_ARB 0x84EC
-#define GL_COMPRESSED_RGB_ARB 0x84ED
-#define GL_COMPRESSED_RGBA_ARB 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0
-#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
-#endif
-
-#ifndef GL_ARB_texture_border_clamp
-#define GL_CLAMP_TO_BORDER_ARB 0x812D
-#endif
-
-#ifndef GL_ARB_point_parameters
-#define GL_POINT_SIZE_MIN_ARB 0x8126
-#define GL_POINT_SIZE_MAX_ARB 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129
-#endif
-
-#ifndef GL_ARB_vertex_blend
-#define GL_MAX_VERTEX_UNITS_ARB 0x86A4
-#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5
-#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6
-#define GL_VERTEX_BLEND_ARB 0x86A7
-#define GL_CURRENT_WEIGHT_ARB 0x86A8
-#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9
-#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA
-#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB
-#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC
-#define GL_WEIGHT_ARRAY_ARB 0x86AD
-#define GL_MODELVIEW0_ARB 0x1700
-#define GL_MODELVIEW1_ARB 0x850A
-#define GL_MODELVIEW2_ARB 0x8722
-#define GL_MODELVIEW3_ARB 0x8723
-#define GL_MODELVIEW4_ARB 0x8724
-#define GL_MODELVIEW5_ARB 0x8725
-#define GL_MODELVIEW6_ARB 0x8726
-#define GL_MODELVIEW7_ARB 0x8727
-#define GL_MODELVIEW8_ARB 0x8728
-#define GL_MODELVIEW9_ARB 0x8729
-#define GL_MODELVIEW10_ARB 0x872A
-#define GL_MODELVIEW11_ARB 0x872B
-#define GL_MODELVIEW12_ARB 0x872C
-#define GL_MODELVIEW13_ARB 0x872D
-#define GL_MODELVIEW14_ARB 0x872E
-#define GL_MODELVIEW15_ARB 0x872F
-#define GL_MODELVIEW16_ARB 0x8730
-#define GL_MODELVIEW17_ARB 0x8731
-#define GL_MODELVIEW18_ARB 0x8732
-#define GL_MODELVIEW19_ARB 0x8733
-#define GL_MODELVIEW20_ARB 0x8734
-#define GL_MODELVIEW21_ARB 0x8735
-#define GL_MODELVIEW22_ARB 0x8736
-#define GL_MODELVIEW23_ARB 0x8737
-#define GL_MODELVIEW24_ARB 0x8738
-#define GL_MODELVIEW25_ARB 0x8739
-#define GL_MODELVIEW26_ARB 0x873A
-#define GL_MODELVIEW27_ARB 0x873B
-#define GL_MODELVIEW28_ARB 0x873C
-#define GL_MODELVIEW29_ARB 0x873D
-#define GL_MODELVIEW30_ARB 0x873E
-#define GL_MODELVIEW31_ARB 0x873F
-#endif
-
-#ifndef GL_ARB_matrix_palette
-#define GL_MATRIX_PALETTE_ARB 0x8840
-#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841
-#define GL_MAX_PALETTE_MATRICES_ARB 0x8842
-#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843
-#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844
-#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845
-#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846
-#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847
-#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848
-#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849
-#endif
-
-#ifndef GL_ARB_texture_env_combine
-#define GL_COMBINE_ARB 0x8570
-#define GL_COMBINE_RGB_ARB 0x8571
-#define GL_COMBINE_ALPHA_ARB 0x8572
-#define GL_SOURCE0_RGB_ARB 0x8580
-#define GL_SOURCE1_RGB_ARB 0x8581
-#define GL_SOURCE2_RGB_ARB 0x8582
-#define GL_SOURCE0_ALPHA_ARB 0x8588
-#define GL_SOURCE1_ALPHA_ARB 0x8589
-#define GL_SOURCE2_ALPHA_ARB 0x858A
-#define GL_OPERAND0_RGB_ARB 0x8590
-#define GL_OPERAND1_RGB_ARB 0x8591
-#define GL_OPERAND2_RGB_ARB 0x8592
-#define GL_OPERAND0_ALPHA_ARB 0x8598
-#define GL_OPERAND1_ALPHA_ARB 0x8599
-#define GL_OPERAND2_ALPHA_ARB 0x859A
-#define GL_RGB_SCALE_ARB 0x8573
-#define GL_ADD_SIGNED_ARB 0x8574
-#define GL_INTERPOLATE_ARB 0x8575
-#define GL_SUBTRACT_ARB 0x84E7
-#define GL_CONSTANT_ARB 0x8576
-#define GL_PRIMARY_COLOR_ARB 0x8577
-#define GL_PREVIOUS_ARB 0x8578
-#endif
-
-#ifndef GL_ARB_texture_env_crossbar
-#endif
-
-#ifndef GL_ARB_texture_env_dot3
-#define GL_DOT3_RGB_ARB 0x86AE
-#define GL_DOT3_RGBA_ARB 0x86AF
-#endif
-
-#ifndef GL_ARB_texture_mirrored_repeat
-#define GL_MIRRORED_REPEAT_ARB 0x8370
-#endif
-
-#ifndef GL_ARB_depth_texture
-#define GL_DEPTH_COMPONENT16_ARB 0x81A5
-#define GL_DEPTH_COMPONENT24_ARB 0x81A6
-#define GL_DEPTH_COMPONENT32_ARB 0x81A7
-#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A
-#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
-#endif
-
-#ifndef GL_ARB_shadow
-#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
-#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
-#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
-#endif
-
-#ifndef GL_ARB_shadow_ambient
-#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
-#endif
-
-#ifndef GL_ARB_window_pos
-#endif
-
-#ifndef GL_ARB_vertex_program
-#define GL_COLOR_SUM_ARB 0x8458
-#define GL_VERTEX_PROGRAM_ARB 0x8620
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
-#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
-#define GL_PROGRAM_LENGTH_ARB 0x8627
-#define GL_PROGRAM_STRING_ARB 0x8628
-#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
-#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
-#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
-#define GL_CURRENT_MATRIX_ARB 0x8641
-#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
-#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
-#define GL_PROGRAM_BINDING_ARB 0x8677
-#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
-#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
-#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
-#define GL_PROGRAM_FORMAT_ARB 0x8876
-#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
-#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
-#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
-#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
-#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
-#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
-#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
-#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
-#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
-#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
-#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
-#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
-#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
-#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
-#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
-#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
-#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
-#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
-#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
-#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
-#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
-#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
-#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
-#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
-#define GL_MATRIX0_ARB 0x88C0
-#define GL_MATRIX1_ARB 0x88C1
-#define GL_MATRIX2_ARB 0x88C2
-#define GL_MATRIX3_ARB 0x88C3
-#define GL_MATRIX4_ARB 0x88C4
-#define GL_MATRIX5_ARB 0x88C5
-#define GL_MATRIX6_ARB 0x88C6
-#define GL_MATRIX7_ARB 0x88C7
-#define GL_MATRIX8_ARB 0x88C8
-#define GL_MATRIX9_ARB 0x88C9
-#define GL_MATRIX10_ARB 0x88CA
-#define GL_MATRIX11_ARB 0x88CB
-#define GL_MATRIX12_ARB 0x88CC
-#define GL_MATRIX13_ARB 0x88CD
-#define GL_MATRIX14_ARB 0x88CE
-#define GL_MATRIX15_ARB 0x88CF
-#define GL_MATRIX16_ARB 0x88D0
-#define GL_MATRIX17_ARB 0x88D1
-#define GL_MATRIX18_ARB 0x88D2
-#define GL_MATRIX19_ARB 0x88D3
-#define GL_MATRIX20_ARB 0x88D4
-#define GL_MATRIX21_ARB 0x88D5
-#define GL_MATRIX22_ARB 0x88D6
-#define GL_MATRIX23_ARB 0x88D7
-#define GL_MATRIX24_ARB 0x88D8
-#define GL_MATRIX25_ARB 0x88D9
-#define GL_MATRIX26_ARB 0x88DA
-#define GL_MATRIX27_ARB 0x88DB
-#define GL_MATRIX28_ARB 0x88DC
-#define GL_MATRIX29_ARB 0x88DD
-#define GL_MATRIX30_ARB 0x88DE
-#define GL_MATRIX31_ARB 0x88DF
-#endif
-
-#ifndef GL_ARB_fragment_program
-#define GL_FRAGMENT_PROGRAM_ARB 0x8804
-#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805
-#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806
-#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807
-#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808
-#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809
-#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A
-#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B
-#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C
-#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D
-#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E
-#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F
-#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810
-#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
-#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
-#endif
-
-#ifndef GL_ARB_vertex_buffer_object
-#define GL_BUFFER_SIZE_ARB 0x8764
-#define GL_BUFFER_USAGE_ARB 0x8765
-#define GL_ARRAY_BUFFER_ARB 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
-#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898
-#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A
-#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B
-#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C
-#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F
-#define GL_READ_ONLY_ARB 0x88B8
-#define GL_WRITE_ONLY_ARB 0x88B9
-#define GL_READ_WRITE_ARB 0x88BA
-#define GL_BUFFER_ACCESS_ARB 0x88BB
-#define GL_BUFFER_MAPPED_ARB 0x88BC
-#define GL_BUFFER_MAP_POINTER_ARB 0x88BD
-#define GL_STREAM_DRAW_ARB 0x88E0
-#define GL_STREAM_READ_ARB 0x88E1
-#define GL_STREAM_COPY_ARB 0x88E2
-#define GL_STATIC_DRAW_ARB 0x88E4
-#define GL_STATIC_READ_ARB 0x88E5
-#define GL_STATIC_COPY_ARB 0x88E6
-#define GL_DYNAMIC_DRAW_ARB 0x88E8
-#define GL_DYNAMIC_READ_ARB 0x88E9
-#define GL_DYNAMIC_COPY_ARB 0x88EA
-#endif
-
-#ifndef GL_ARB_occlusion_query
-#define GL_QUERY_COUNTER_BITS_ARB 0x8864
-#define GL_CURRENT_QUERY_ARB 0x8865
-#define GL_QUERY_RESULT_ARB 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
-#define GL_SAMPLES_PASSED_ARB 0x8914
-#endif
-
-#ifndef GL_ARB_shader_objects
-#define GL_PROGRAM_OBJECT_ARB 0x8B40
-#define GL_SHADER_OBJECT_ARB 0x8B48
-#define GL_OBJECT_TYPE_ARB 0x8B4E
-#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
-#define GL_FLOAT_VEC2_ARB 0x8B50
-#define GL_FLOAT_VEC3_ARB 0x8B51
-#define GL_FLOAT_VEC4_ARB 0x8B52
-#define GL_INT_VEC2_ARB 0x8B53
-#define GL_INT_VEC3_ARB 0x8B54
-#define GL_INT_VEC4_ARB 0x8B55
-#define GL_BOOL_ARB 0x8B56
-#define GL_BOOL_VEC2_ARB 0x8B57
-#define GL_BOOL_VEC3_ARB 0x8B58
-#define GL_BOOL_VEC4_ARB 0x8B59
-#define GL_FLOAT_MAT2_ARB 0x8B5A
-#define GL_FLOAT_MAT3_ARB 0x8B5B
-#define GL_FLOAT_MAT4_ARB 0x8B5C
-#define GL_SAMPLER_1D_ARB 0x8B5D
-#define GL_SAMPLER_2D_ARB 0x8B5E
-#define GL_SAMPLER_3D_ARB 0x8B5F
-#define GL_SAMPLER_CUBE_ARB 0x8B60
-#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
-#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
-#define GL_SAMPLER_2D_RECT_ARB 0x8B63
-#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
-#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
-#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
-#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
-#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
-#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
-#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
-#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
-#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
-#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
-#endif
-
-#ifndef GL_ARB_vertex_shader
-#define GL_VERTEX_SHADER_ARB 0x8B31
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
-#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
-#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
-#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
-#endif
-
-#ifndef GL_ARB_fragment_shader
-#define GL_FRAGMENT_SHADER_ARB 0x8B30
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
-#endif
-
-#ifndef GL_ARB_shading_language_100
-#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
-#endif
-
-#ifndef GL_ARB_texture_non_power_of_two
-#endif
-
-#ifndef GL_ARB_point_sprite
-#define GL_POINT_SPRITE_ARB 0x8861
-#define GL_COORD_REPLACE_ARB 0x8862
-#endif
-
-#ifndef GL_ARB_fragment_program_shadow
-#endif
-
-#ifndef GL_ARB_draw_buffers
-#define GL_MAX_DRAW_BUFFERS_ARB 0x8824
-#define GL_DRAW_BUFFER0_ARB 0x8825
-#define GL_DRAW_BUFFER1_ARB 0x8826
-#define GL_DRAW_BUFFER2_ARB 0x8827
-#define GL_DRAW_BUFFER3_ARB 0x8828
-#define GL_DRAW_BUFFER4_ARB 0x8829
-#define GL_DRAW_BUFFER5_ARB 0x882A
-#define GL_DRAW_BUFFER6_ARB 0x882B
-#define GL_DRAW_BUFFER7_ARB 0x882C
-#define GL_DRAW_BUFFER8_ARB 0x882D
-#define GL_DRAW_BUFFER9_ARB 0x882E
-#define GL_DRAW_BUFFER10_ARB 0x882F
-#define GL_DRAW_BUFFER11_ARB 0x8830
-#define GL_DRAW_BUFFER12_ARB 0x8831
-#define GL_DRAW_BUFFER13_ARB 0x8832
-#define GL_DRAW_BUFFER14_ARB 0x8833
-#define GL_DRAW_BUFFER15_ARB 0x8834
-#endif
-
-#ifndef GL_ARB_texture_rectangle
-#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8
-#endif
-
-#ifndef GL_ARB_color_buffer_float
-#define GL_RGBA_FLOAT_MODE_ARB 0x8820
-#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A
-#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B
-#define GL_CLAMP_READ_COLOR_ARB 0x891C
-#define GL_FIXED_ONLY_ARB 0x891D
-#endif
-
-#ifndef GL_ARB_half_float_pixel
-#define GL_HALF_FLOAT_ARB 0x140B
-#endif
-
-#ifndef GL_ARB_texture_float
-#define GL_TEXTURE_RED_TYPE_ARB 0x8C10
-#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
-#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
-#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
-#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
-#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
-#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
-#define GL_RGBA32F_ARB 0x8814
-#define GL_RGB32F_ARB 0x8815
-#define GL_ALPHA32F_ARB 0x8816
-#define GL_INTENSITY32F_ARB 0x8817
-#define GL_LUMINANCE32F_ARB 0x8818
-#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
-#define GL_RGBA16F_ARB 0x881A
-#define GL_RGB16F_ARB 0x881B
-#define GL_ALPHA16F_ARB 0x881C
-#define GL_INTENSITY16F_ARB 0x881D
-#define GL_LUMINANCE16F_ARB 0x881E
-#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
-#endif
-
-#ifndef GL_ARB_pixel_buffer_object
-#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF
-#endif
-
-#ifndef GL_EXT_abgr
-#define GL_ABGR_EXT 0x8000
-#endif
-
-#ifndef GL_EXT_blend_color
-#define GL_CONSTANT_COLOR_EXT 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002
-#define GL_CONSTANT_ALPHA_EXT 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004
-#define GL_BLEND_COLOR_EXT 0x8005
-#endif
-
-#ifndef GL_EXT_polygon_offset
-#define GL_POLYGON_OFFSET_EXT 0x8037
-#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038
-#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039
-#endif
-
-#ifndef GL_EXT_texture
-#define GL_ALPHA4_EXT 0x803B
-#define GL_ALPHA8_EXT 0x803C
-#define GL_ALPHA12_EXT 0x803D
-#define GL_ALPHA16_EXT 0x803E
-#define GL_LUMINANCE4_EXT 0x803F
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE12_EXT 0x8041
-#define GL_LUMINANCE16_EXT 0x8042
-#define GL_LUMINANCE4_ALPHA4_EXT 0x8043
-#define GL_LUMINANCE6_ALPHA2_EXT 0x8044
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_LUMINANCE12_ALPHA4_EXT 0x8046
-#define GL_LUMINANCE12_ALPHA12_EXT 0x8047
-#define GL_LUMINANCE16_ALPHA16_EXT 0x8048
-#define GL_INTENSITY_EXT 0x8049
-#define GL_INTENSITY4_EXT 0x804A
-#define GL_INTENSITY8_EXT 0x804B
-#define GL_INTENSITY12_EXT 0x804C
-#define GL_INTENSITY16_EXT 0x804D
-#define GL_RGB2_EXT 0x804E
-#define GL_RGB4_EXT 0x804F
-#define GL_RGB5_EXT 0x8050
-#define GL_RGB8_EXT 0x8051
-#define GL_RGB10_EXT 0x8052
-#define GL_RGB12_EXT 0x8053
-#define GL_RGB16_EXT 0x8054
-#define GL_RGBA2_EXT 0x8055
-#define GL_RGBA4_EXT 0x8056
-#define GL_RGB5_A1_EXT 0x8057
-#define GL_RGBA8_EXT 0x8058
-#define GL_RGB10_A2_EXT 0x8059
-#define GL_RGBA12_EXT 0x805A
-#define GL_RGBA16_EXT 0x805B
-#define GL_TEXTURE_RED_SIZE_EXT 0x805C
-#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D
-#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E
-#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F
-#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060
-#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061
-#define GL_REPLACE_EXT 0x8062
-#define GL_PROXY_TEXTURE_1D_EXT 0x8063
-#define GL_PROXY_TEXTURE_2D_EXT 0x8064
-#define GL_TEXTURE_TOO_LARGE_EXT 0x8065
-#endif
-
-#ifndef GL_EXT_texture3D
-#define GL_PACK_SKIP_IMAGES_EXT 0x806B
-#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C
-#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E
-#define GL_TEXTURE_3D_EXT 0x806F
-#define GL_PROXY_TEXTURE_3D_EXT 0x8070
-#define GL_TEXTURE_DEPTH_EXT 0x8071
-#define GL_TEXTURE_WRAP_R_EXT 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073
-#endif
-
-#ifndef GL_SGIS_texture_filter4
-#define GL_FILTER4_SGIS 0x8146
-#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147
-#endif
-
-#ifndef GL_EXT_subtexture
-#endif
-
-#ifndef GL_EXT_copy_texture
-#endif
-
-#ifndef GL_EXT_histogram
-#define GL_HISTOGRAM_EXT 0x8024
-#define GL_PROXY_HISTOGRAM_EXT 0x8025
-#define GL_HISTOGRAM_WIDTH_EXT 0x8026
-#define GL_HISTOGRAM_FORMAT_EXT 0x8027
-#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028
-#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029
-#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A
-#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B
-#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C
-#define GL_HISTOGRAM_SINK_EXT 0x802D
-#define GL_MINMAX_EXT 0x802E
-#define GL_MINMAX_FORMAT_EXT 0x802F
-#define GL_MINMAX_SINK_EXT 0x8030
-#define GL_TABLE_TOO_LARGE_EXT 0x8031
-#endif
-
-#ifndef GL_EXT_convolution
-#define GL_CONVOLUTION_1D_EXT 0x8010
-#define GL_CONVOLUTION_2D_EXT 0x8011
-#define GL_SEPARABLE_2D_EXT 0x8012
-#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013
-#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014
-#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015
-#define GL_REDUCE_EXT 0x8016
-#define GL_CONVOLUTION_FORMAT_EXT 0x8017
-#define GL_CONVOLUTION_WIDTH_EXT 0x8018
-#define GL_CONVOLUTION_HEIGHT_EXT 0x8019
-#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A
-#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B
-#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C
-#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D
-#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E
-#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F
-#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020
-#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021
-#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022
-#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023
-#endif
-
-#ifndef GL_SGI_color_matrix
-#define GL_COLOR_MATRIX_SGI 0x80B1
-#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2
-#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3
-#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4
-#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5
-#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6
-#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7
-#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8
-#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9
-#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA
-#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB
-#endif
-
-#ifndef GL_SGI_color_table
-#define GL_COLOR_TABLE_SGI 0x80D0
-#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1
-#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2
-#define GL_PROXY_COLOR_TABLE_SGI 0x80D3
-#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4
-#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5
-#define GL_COLOR_TABLE_SCALE_SGI 0x80D6
-#define GL_COLOR_TABLE_BIAS_SGI 0x80D7
-#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8
-#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF
-#endif
-
-#ifndef GL_SGIS_pixel_texture
-#define GL_PIXEL_TEXTURE_SGIS 0x8353
-#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354
-#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355
-#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356
-#endif
-
-#ifndef GL_SGIX_pixel_texture
-#define GL_PIXEL_TEX_GEN_SGIX 0x8139
-#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B
-#endif
-
-#ifndef GL_SGIS_texture4D
-#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130
-#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131
-#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132
-#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133
-#define GL_TEXTURE_4D_SGIS 0x8134
-#define GL_PROXY_TEXTURE_4D_SGIS 0x8135
-#define GL_TEXTURE_4DSIZE_SGIS 0x8136
-#define GL_TEXTURE_WRAP_Q_SGIS 0x8137
-#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138
-#define GL_TEXTURE_4D_BINDING_SGIS 0x814F
-#endif
-
-#ifndef GL_SGI_texture_color_table
-#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC
-#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD
-#endif
-
-#ifndef GL_EXT_cmyka
-#define GL_CMYK_EXT 0x800C
-#define GL_CMYKA_EXT 0x800D
-#define GL_PACK_CMYK_HINT_EXT 0x800E
-#define GL_UNPACK_CMYK_HINT_EXT 0x800F
-#endif
-
-#ifndef GL_EXT_texture_object
-#define GL_TEXTURE_PRIORITY_EXT 0x8066
-#define GL_TEXTURE_RESIDENT_EXT 0x8067
-#define GL_TEXTURE_1D_BINDING_EXT 0x8068
-#define GL_TEXTURE_2D_BINDING_EXT 0x8069
-#define GL_TEXTURE_3D_BINDING_EXT 0x806A
-#endif
-
-#ifndef GL_SGIS_detail_texture
-#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095
-#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096
-#define GL_LINEAR_DETAIL_SGIS 0x8097
-#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098
-#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099
-#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A
-#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B
-#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C
-#endif
-
-#ifndef GL_SGIS_sharpen_texture
-#define GL_LINEAR_SHARPEN_SGIS 0x80AD
-#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE
-#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF
-#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0
-#endif
-
-#ifndef GL_EXT_packed_pixels
-#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032
-#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034
-#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035
-#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036
-#endif
-
-#ifndef GL_SGIS_texture_lod
-#define GL_TEXTURE_MIN_LOD_SGIS 0x813A
-#define GL_TEXTURE_MAX_LOD_SGIS 0x813B
-#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C
-#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D
-#endif
-
-#ifndef GL_SGIS_multisample
-#define GL_MULTISAMPLE_SGIS 0x809D
-#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F
-#define GL_SAMPLE_MASK_SGIS 0x80A0
-#define GL_1PASS_SGIS 0x80A1
-#define GL_2PASS_0_SGIS 0x80A2
-#define GL_2PASS_1_SGIS 0x80A3
-#define GL_4PASS_0_SGIS 0x80A4
-#define GL_4PASS_1_SGIS 0x80A5
-#define GL_4PASS_2_SGIS 0x80A6
-#define GL_4PASS_3_SGIS 0x80A7
-#define GL_SAMPLE_BUFFERS_SGIS 0x80A8
-#define GL_SAMPLES_SGIS 0x80A9
-#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA
-#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB
-#define GL_SAMPLE_PATTERN_SGIS 0x80AC
-#endif
-
-#ifndef GL_EXT_rescale_normal
-#define GL_RESCALE_NORMAL_EXT 0x803A
-#endif
-
-#ifndef GL_EXT_vertex_array
-#define GL_VERTEX_ARRAY_EXT 0x8074
-#define GL_NORMAL_ARRAY_EXT 0x8075
-#define GL_COLOR_ARRAY_EXT 0x8076
-#define GL_INDEX_ARRAY_EXT 0x8077
-#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078
-#define GL_EDGE_FLAG_ARRAY_EXT 0x8079
-#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A
-#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B
-#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C
-#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D
-#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E
-#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F
-#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080
-#define GL_COLOR_ARRAY_SIZE_EXT 0x8081
-#define GL_COLOR_ARRAY_TYPE_EXT 0x8082
-#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083
-#define GL_COLOR_ARRAY_COUNT_EXT 0x8084
-#define GL_INDEX_ARRAY_TYPE_EXT 0x8085
-#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086
-#define GL_INDEX_ARRAY_COUNT_EXT 0x8087
-#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A
-#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B
-#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C
-#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D
-#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E
-#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F
-#define GL_COLOR_ARRAY_POINTER_EXT 0x8090
-#define GL_INDEX_ARRAY_POINTER_EXT 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093
-#endif
-
-#ifndef GL_EXT_misc_attribute
-#endif
-
-#ifndef GL_SGIS_generate_mipmap
-#define GL_GENERATE_MIPMAP_SGIS 0x8191
-#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
-#endif
-
-#ifndef GL_SGIX_clipmap
-#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170
-#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171
-#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172
-#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173
-#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174
-#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175
-#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176
-#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177
-#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178
-#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D
-#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E
-#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F
-#endif
-
-#ifndef GL_SGIX_shadow
-#define GL_TEXTURE_COMPARE_SGIX 0x819A
-#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B
-#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C
-#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D
-#endif
-
-#ifndef GL_SGIS_texture_edge_clamp
-#define GL_CLAMP_TO_EDGE_SGIS 0x812F
-#endif
-
-#ifndef GL_SGIS_texture_border_clamp
-#define GL_CLAMP_TO_BORDER_SGIS 0x812D
-#endif
-
-#ifndef GL_EXT_blend_minmax
-#define GL_FUNC_ADD_EXT 0x8006
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#define GL_BLEND_EQUATION_EXT 0x8009
-#endif
-
-#ifndef GL_EXT_blend_subtract
-#define GL_FUNC_SUBTRACT_EXT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B
-#endif
-
-#ifndef GL_EXT_blend_logic_op
-#endif
-
-#ifndef GL_SGIX_interlace
-#define GL_INTERLACE_SGIX 0x8094
-#endif
-
-#ifndef GL_SGIX_pixel_tiles
-#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E
-#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F
-#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140
-#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141
-#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142
-#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143
-#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144
-#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145
-#endif
-
-#ifndef GL_SGIS_texture_select
-#define GL_DUAL_ALPHA4_SGIS 0x8110
-#define GL_DUAL_ALPHA8_SGIS 0x8111
-#define GL_DUAL_ALPHA12_SGIS 0x8112
-#define GL_DUAL_ALPHA16_SGIS 0x8113
-#define GL_DUAL_LUMINANCE4_SGIS 0x8114
-#define GL_DUAL_LUMINANCE8_SGIS 0x8115
-#define GL_DUAL_LUMINANCE12_SGIS 0x8116
-#define GL_DUAL_LUMINANCE16_SGIS 0x8117
-#define GL_DUAL_INTENSITY4_SGIS 0x8118
-#define GL_DUAL_INTENSITY8_SGIS 0x8119
-#define GL_DUAL_INTENSITY12_SGIS 0x811A
-#define GL_DUAL_INTENSITY16_SGIS 0x811B
-#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C
-#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D
-#define GL_QUAD_ALPHA4_SGIS 0x811E
-#define GL_QUAD_ALPHA8_SGIS 0x811F
-#define GL_QUAD_LUMINANCE4_SGIS 0x8120
-#define GL_QUAD_LUMINANCE8_SGIS 0x8121
-#define GL_QUAD_INTENSITY4_SGIS 0x8122
-#define GL_QUAD_INTENSITY8_SGIS 0x8123
-#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124
-#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125
-#endif
-
-#ifndef GL_SGIX_sprite
-#define GL_SPRITE_SGIX 0x8148
-#define GL_SPRITE_MODE_SGIX 0x8149
-#define GL_SPRITE_AXIS_SGIX 0x814A
-#define GL_SPRITE_TRANSLATION_SGIX 0x814B
-#define GL_SPRITE_AXIAL_SGIX 0x814C
-#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D
-#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E
-#endif
-
-#ifndef GL_SGIX_texture_multi_buffer
-#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E
-#endif
-
-#ifndef GL_EXT_point_parameters
-#define GL_POINT_SIZE_MIN_EXT 0x8126
-#define GL_POINT_SIZE_MAX_EXT 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
-#define GL_DISTANCE_ATTENUATION_EXT 0x8129
-#endif
-
-#ifndef GL_SGIS_point_parameters
-#define GL_POINT_SIZE_MIN_SGIS 0x8126
-#define GL_POINT_SIZE_MAX_SGIS 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128
-#define GL_DISTANCE_ATTENUATION_SGIS 0x8129
-#endif
-
-#ifndef GL_SGIX_instruments
-#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180
-#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181
-#endif
-
-#ifndef GL_SGIX_texture_scale_bias
-#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179
-#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A
-#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B
-#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C
-#endif
-
-#ifndef GL_SGIX_framezoom
-#define GL_FRAMEZOOM_SGIX 0x818B
-#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C
-#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D
-#endif
-
-#ifndef GL_SGIX_tag_sample_buffer
-#endif
-
-#ifndef GL_FfdMaskSGIX
-#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001
-#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002
-#endif
-
-#ifndef GL_SGIX_polynomial_ffd
-#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194
-#define GL_TEXTURE_DEFORMATION_SGIX 0x8195
-#define GL_DEFORMATIONS_MASK_SGIX 0x8196
-#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197
-#endif
-
-#ifndef GL_SGIX_reference_plane
-#define GL_REFERENCE_PLANE_SGIX 0x817D
-#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E
-#endif
-
-#ifndef GL_SGIX_flush_raster
-#endif
-
-#ifndef GL_SGIX_depth_texture
-#define GL_DEPTH_COMPONENT16_SGIX 0x81A5
-#define GL_DEPTH_COMPONENT24_SGIX 0x81A6
-#define GL_DEPTH_COMPONENT32_SGIX 0x81A7
-#endif
-
-#ifndef GL_SGIS_fog_function
-#define GL_FOG_FUNC_SGIS 0x812A
-#define GL_FOG_FUNC_POINTS_SGIS 0x812B
-#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C
-#endif
-
-#ifndef GL_SGIX_fog_offset
-#define GL_FOG_OFFSET_SGIX 0x8198
-#define GL_FOG_OFFSET_VALUE_SGIX 0x8199
-#endif
-
-#ifndef GL_HP_image_transform
-#define GL_IMAGE_SCALE_X_HP 0x8155
-#define GL_IMAGE_SCALE_Y_HP 0x8156
-#define GL_IMAGE_TRANSLATE_X_HP 0x8157
-#define GL_IMAGE_TRANSLATE_Y_HP 0x8158
-#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159
-#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A
-#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B
-#define GL_IMAGE_MAG_FILTER_HP 0x815C
-#define GL_IMAGE_MIN_FILTER_HP 0x815D
-#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E
-#define GL_CUBIC_HP 0x815F
-#define GL_AVERAGE_HP 0x8160
-#define GL_IMAGE_TRANSFORM_2D_HP 0x8161
-#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162
-#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163
-#endif
-
-#ifndef GL_HP_convolution_border_modes
-#define GL_IGNORE_BORDER_HP 0x8150
-#define GL_CONSTANT_BORDER_HP 0x8151
-#define GL_REPLICATE_BORDER_HP 0x8153
-#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154
-#endif
-
-#ifndef GL_INGR_palette_buffer
-#endif
-
-#ifndef GL_SGIX_texture_add_env
-#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE
-#endif
-
-#ifndef GL_EXT_color_subtable
-#endif
-
-#ifndef GL_PGI_vertex_hints
-#define GL_VERTEX_DATA_HINT_PGI 0x1A22A
-#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B
-#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C
-#define GL_MAX_VERTEX_HINT_PGI 0x1A22D
-#define GL_COLOR3_BIT_PGI 0x00010000
-#define GL_COLOR4_BIT_PGI 0x00020000
-#define GL_EDGEFLAG_BIT_PGI 0x00040000
-#define GL_INDEX_BIT_PGI 0x00080000
-#define GL_MAT_AMBIENT_BIT_PGI 0x00100000
-#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000
-#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000
-#define GL_MAT_EMISSION_BIT_PGI 0x00800000
-#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000
-#define GL_MAT_SHININESS_BIT_PGI 0x02000000
-#define GL_MAT_SPECULAR_BIT_PGI 0x04000000
-#define GL_NORMAL_BIT_PGI 0x08000000
-#define GL_TEXCOORD1_BIT_PGI 0x10000000
-#define GL_TEXCOORD2_BIT_PGI 0x20000000
-#define GL_TEXCOORD3_BIT_PGI 0x40000000
-#define GL_TEXCOORD4_BIT_PGI 0x80000000
-#define GL_VERTEX23_BIT_PGI 0x00000004
-#define GL_VERTEX4_BIT_PGI 0x00000008
-#endif
-
-#ifndef GL_PGI_misc_hints
-#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8
-#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD
-#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE
-#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202
-#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203
-#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204
-#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C
-#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D
-#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E
-#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F
-#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210
-#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211
-#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216
-#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217
-#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218
-#define GL_FULL_STIPPLE_HINT_PGI 0x1A219
-#define GL_CLIP_NEAR_HINT_PGI 0x1A220
-#define GL_CLIP_FAR_HINT_PGI 0x1A221
-#define GL_WIDE_LINE_HINT_PGI 0x1A222
-#define GL_BACK_NORMALS_HINT_PGI 0x1A223
-#endif
-
-#ifndef GL_EXT_paletted_texture
-#define GL_COLOR_INDEX1_EXT 0x80E2
-#define GL_COLOR_INDEX2_EXT 0x80E3
-#define GL_COLOR_INDEX4_EXT 0x80E4
-#define GL_COLOR_INDEX8_EXT 0x80E5
-#define GL_COLOR_INDEX12_EXT 0x80E6
-#define GL_COLOR_INDEX16_EXT 0x80E7
-#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
-#endif
-
-#ifndef GL_EXT_clip_volume_hint
-#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0
-#endif
-
-#ifndef GL_SGIX_list_priority
-#define GL_LIST_PRIORITY_SGIX 0x8182
-#endif
-
-#ifndef GL_SGIX_ir_instrument1
-#define GL_IR_INSTRUMENT1_SGIX 0x817F
-#endif
-
-#ifndef GL_SGIX_calligraphic_fragment
-#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183
-#endif
-
-#ifndef GL_SGIX_texture_lod_bias
-#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E
-#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F
-#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190
-#endif
-
-#ifndef GL_SGIX_shadow_ambient
-#define GL_SHADOW_AMBIENT_SGIX 0x80BF
-#endif
-
-#ifndef GL_EXT_index_texture
-#endif
-
-#ifndef GL_EXT_index_material
-#define GL_INDEX_MATERIAL_EXT 0x81B8
-#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9
-#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA
-#endif
-
-#ifndef GL_EXT_index_func
-#define GL_INDEX_TEST_EXT 0x81B5
-#define GL_INDEX_TEST_FUNC_EXT 0x81B6
-#define GL_INDEX_TEST_REF_EXT 0x81B7
-#endif
-
-#ifndef GL_EXT_index_array_formats
-#define GL_IUI_V2F_EXT 0x81AD
-#define GL_IUI_V3F_EXT 0x81AE
-#define GL_IUI_N3F_V2F_EXT 0x81AF
-#define GL_IUI_N3F_V3F_EXT 0x81B0
-#define GL_T2F_IUI_V2F_EXT 0x81B1
-#define GL_T2F_IUI_V3F_EXT 0x81B2
-#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3
-#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4
-#endif
-
-#ifndef GL_EXT_compiled_vertex_array
-#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8
-#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9
-#endif
-
-#ifndef GL_EXT_cull_vertex
-#define GL_CULL_VERTEX_EXT 0x81AA
-#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB
-#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC
-#endif
-
-#ifndef GL_SGIX_ycrcb
-#define GL_YCRCB_422_SGIX 0x81BB
-#define GL_YCRCB_444_SGIX 0x81BC
-#endif
-
-#ifndef GL_SGIX_fragment_lighting
-#define GL_FRAGMENT_LIGHTING_SGIX 0x8400
-#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401
-#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402
-#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403
-#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404
-#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405
-#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406
-#define GL_LIGHT_ENV_MODE_SGIX 0x8407
-#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408
-#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409
-#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A
-#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B
-#define GL_FRAGMENT_LIGHT0_SGIX 0x840C
-#define GL_FRAGMENT_LIGHT1_SGIX 0x840D
-#define GL_FRAGMENT_LIGHT2_SGIX 0x840E
-#define GL_FRAGMENT_LIGHT3_SGIX 0x840F
-#define GL_FRAGMENT_LIGHT4_SGIX 0x8410
-#define GL_FRAGMENT_LIGHT5_SGIX 0x8411
-#define GL_FRAGMENT_LIGHT6_SGIX 0x8412
-#define GL_FRAGMENT_LIGHT7_SGIX 0x8413
-#endif
-
-#ifndef GL_IBM_rasterpos_clip
-#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262
-#endif
-
-#ifndef GL_HP_texture_lighting
-#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167
-#define GL_TEXTURE_POST_SPECULAR_HP 0x8168
-#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169
-#endif
-
-#ifndef GL_EXT_draw_range_elements
-#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8
-#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9
-#endif
-
-#ifndef GL_WIN_phong_shading
-#define GL_PHONG_WIN 0x80EA
-#define GL_PHONG_HINT_WIN 0x80EB
-#endif
-
-#ifndef GL_WIN_specular_fog
-#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC
-#endif
-
-#ifndef GL_EXT_light_texture
-#define GL_FRAGMENT_MATERIAL_EXT 0x8349
-#define GL_FRAGMENT_NORMAL_EXT 0x834A
-#define GL_FRAGMENT_COLOR_EXT 0x834C
-#define GL_ATTENUATION_EXT 0x834D
-#define GL_SHADOW_ATTENUATION_EXT 0x834E
-#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F
-#define GL_TEXTURE_LIGHT_EXT 0x8350
-#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351
-#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352
-/* reuse GL_FRAGMENT_DEPTH_EXT */
-#endif
-
-#ifndef GL_SGIX_blend_alpha_minmax
-#define GL_ALPHA_MIN_SGIX 0x8320
-#define GL_ALPHA_MAX_SGIX 0x8321
-#endif
-
-#ifndef GL_SGIX_impact_pixel_texture
-#define GL_PIXEL_TEX_GEN_Q_CEILING_SGIX 0x8184
-#define GL_PIXEL_TEX_GEN_Q_ROUND_SGIX 0x8185
-#define GL_PIXEL_TEX_GEN_Q_FLOOR_SGIX 0x8186
-#define GL_PIXEL_TEX_GEN_ALPHA_REPLACE_SGIX 0x8187
-#define GL_PIXEL_TEX_GEN_ALPHA_NO_REPLACE_SGIX 0x8188
-#define GL_PIXEL_TEX_GEN_ALPHA_LS_SGIX 0x8189
-#define GL_PIXEL_TEX_GEN_ALPHA_MS_SGIX 0x818A
-#endif
-
-#ifndef GL_EXT_bgra
-#define GL_BGR_EXT 0x80E0
-#define GL_BGRA_EXT 0x80E1
-#endif
-
-#ifndef GL_SGIX_async
-#define GL_ASYNC_MARKER_SGIX 0x8329
-#endif
-
-#ifndef GL_SGIX_async_pixel
-#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C
-#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D
-#define GL_ASYNC_READ_PIXELS_SGIX 0x835E
-#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F
-#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360
-#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361
-#endif
-
-#ifndef GL_SGIX_async_histogram
-#define GL_ASYNC_HISTOGRAM_SGIX 0x832C
-#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D
-#endif
-
-#ifndef GL_INTEL_texture_scissor
-#endif
-
-#ifndef GL_INTEL_parallel_arrays
-#define GL_PARALLEL_ARRAYS_INTEL 0x83F4
-#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5
-#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6
-#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7
-#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8
-#endif
-
-#ifndef GL_HP_occlusion_test
-#define GL_OCCLUSION_TEST_HP 0x8165
-#define GL_OCCLUSION_TEST_RESULT_HP 0x8166
-#endif
-
-#ifndef GL_EXT_pixel_transform
-#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330
-#define GL_PIXEL_MAG_FILTER_EXT 0x8331
-#define GL_PIXEL_MIN_FILTER_EXT 0x8332
-#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333
-#define GL_CUBIC_EXT 0x8334
-#define GL_AVERAGE_EXT 0x8335
-#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336
-#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337
-#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338
-#endif
-
-#ifndef GL_EXT_pixel_transform_color_table
-#endif
-
-#ifndef GL_EXT_shared_texture_palette
-#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
-#endif
-
-#ifndef GL_EXT_separate_specular_color
-#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8
-#define GL_SINGLE_COLOR_EXT 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA
-#endif
-
-#ifndef GL_EXT_secondary_color
-#define GL_COLOR_SUM_EXT 0x8458
-#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459
-#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A
-#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B
-#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C
-#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D
-#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E
-#endif
-
-#ifndef GL_EXT_texture_perturb_normal
-#define GL_PERTURB_EXT 0x85AE
-#define GL_TEXTURE_NORMAL_EXT 0x85AF
-#endif
-
-#ifndef GL_EXT_multi_draw_arrays
-#endif
-
-#ifndef GL_EXT_fog_coord
-#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450
-#define GL_FOG_COORDINATE_EXT 0x8451
-#define GL_FRAGMENT_DEPTH_EXT 0x8452
-#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453
-#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454
-#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455
-#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456
-#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457
-#endif
-
-#ifndef GL_REND_screen_coordinates
-#define GL_SCREEN_COORDINATES_REND 0x8490
-#define GL_INVERTED_SCREEN_W_REND 0x8491
-#endif
-
-#ifndef GL_EXT_coordinate_frame
-#define GL_TANGENT_ARRAY_EXT 0x8439
-#define GL_BINORMAL_ARRAY_EXT 0x843A
-#define GL_CURRENT_TANGENT_EXT 0x843B
-#define GL_CURRENT_BINORMAL_EXT 0x843C
-#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E
-#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F
-#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440
-#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441
-#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442
-#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443
-#define GL_MAP1_TANGENT_EXT 0x8444
-#define GL_MAP2_TANGENT_EXT 0x8445
-#define GL_MAP1_BINORMAL_EXT 0x8446
-#define GL_MAP2_BINORMAL_EXT 0x8447
-#endif
-
-#ifndef GL_EXT_texture_env_combine
-#define GL_COMBINE_EXT 0x8570
-#define GL_COMBINE_RGB_EXT 0x8571
-#define GL_COMBINE_ALPHA_EXT 0x8572
-#define GL_RGB_SCALE_EXT 0x8573
-#define GL_ADD_SIGNED_EXT 0x8574
-#define GL_INTERPOLATE_EXT 0x8575
-#define GL_CONSTANT_EXT 0x8576
-#define GL_PRIMARY_COLOR_EXT 0x8577
-#define GL_PREVIOUS_EXT 0x8578
-#define GL_SOURCE0_RGB_EXT 0x8580
-#define GL_SOURCE1_RGB_EXT 0x8581
-#define GL_SOURCE2_RGB_EXT 0x8582
-#define GL_SOURCE0_ALPHA_EXT 0x8588
-#define GL_SOURCE1_ALPHA_EXT 0x8589
-#define GL_SOURCE2_ALPHA_EXT 0x858A
-#define GL_OPERAND0_RGB_EXT 0x8590
-#define GL_OPERAND1_RGB_EXT 0x8591
-#define GL_OPERAND2_RGB_EXT 0x8592
-#define GL_OPERAND0_ALPHA_EXT 0x8598
-#define GL_OPERAND1_ALPHA_EXT 0x8599
-#define GL_OPERAND2_ALPHA_EXT 0x859A
-#endif
-
-#ifndef GL_APPLE_specular_vector
-#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0
-#endif
-
-#ifndef GL_APPLE_transform_hint
-#define GL_TRANSFORM_HINT_APPLE 0x85B1
-#endif
-
-#ifndef GL_SGIX_fog_scale
-#define GL_FOG_SCALE_SGIX 0x81FC
-#define GL_FOG_SCALE_VALUE_SGIX 0x81FD
-#endif
-
-#ifndef GL_SUNX_constant_data
-#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5
-#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6
-#endif
-
-#ifndef GL_SUN_global_alpha
-#define GL_GLOBAL_ALPHA_SUN 0x81D9
-#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA
-#endif
-
-#ifndef GL_SUN_triangle_list
-#define GL_RESTART_SUN 0x0001
-#define GL_REPLACE_MIDDLE_SUN 0x0002
-#define GL_REPLACE_OLDEST_SUN 0x0003
-#define GL_TRIANGLE_LIST_SUN 0x81D7
-#define GL_REPLACEMENT_CODE_SUN 0x81D8
-#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0
-#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1
-#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2
-#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3
-#define GL_R1UI_V3F_SUN 0x85C4
-#define GL_R1UI_C4UB_V3F_SUN 0x85C5
-#define GL_R1UI_C3F_V3F_SUN 0x85C6
-#define GL_R1UI_N3F_V3F_SUN 0x85C7
-#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8
-#define GL_R1UI_T2F_V3F_SUN 0x85C9
-#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA
-#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB
-#endif
-
-#ifndef GL_SUN_vertex
-#endif
-
-#ifndef GL_EXT_blend_func_separate
-#define GL_BLEND_DST_RGB_EXT 0x80C8
-#define GL_BLEND_SRC_RGB_EXT 0x80C9
-#define GL_BLEND_DST_ALPHA_EXT 0x80CA
-#define GL_BLEND_SRC_ALPHA_EXT 0x80CB
-#endif
-
-#ifndef GL_INGR_color_clamp
-#define GL_RED_MIN_CLAMP_INGR 0x8560
-#define GL_GREEN_MIN_CLAMP_INGR 0x8561
-#define GL_BLUE_MIN_CLAMP_INGR 0x8562
-#define GL_ALPHA_MIN_CLAMP_INGR 0x8563
-#define GL_RED_MAX_CLAMP_INGR 0x8564
-#define GL_GREEN_MAX_CLAMP_INGR 0x8565
-#define GL_BLUE_MAX_CLAMP_INGR 0x8566
-#define GL_ALPHA_MAX_CLAMP_INGR 0x8567
-#endif
-
-#ifndef GL_INGR_interlace_read
-#define GL_INTERLACE_READ_INGR 0x8568
-#endif
-
-#ifndef GL_EXT_stencil_wrap
-#define GL_INCR_WRAP_EXT 0x8507
-#define GL_DECR_WRAP_EXT 0x8508
-#endif
-
-#ifndef GL_EXT_422_pixels
-#define GL_422_EXT 0x80CC
-#define GL_422_REV_EXT 0x80CD
-#define GL_422_AVERAGE_EXT 0x80CE
-#define GL_422_REV_AVERAGE_EXT 0x80CF
-#endif
-
-#ifndef GL_NV_texgen_reflection
-#define GL_NORMAL_MAP_NV 0x8511
-#define GL_REFLECTION_MAP_NV 0x8512
-#endif
-
-#ifndef GL_EXT_texture_cube_map
-#define GL_NORMAL_MAP_EXT 0x8511
-#define GL_REFLECTION_MAP_EXT 0x8512
-#define GL_TEXTURE_CUBE_MAP_EXT 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C
-#endif
-
-#ifndef GL_SUN_convolution_border_modes
-#define GL_WRAP_BORDER_SUN 0x81D4
-#endif
-
-#ifndef GL_EXT_texture_env_add
-#endif
-
-#ifndef GL_EXT_texture_lod_bias
-#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
-#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
-#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
-#endif
-
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-#endif
-
-#ifndef GL_EXT_vertex_weighting
-#define GL_MODELVIEW0_STACK_DEPTH_EXT GL_MODELVIEW_STACK_DEPTH
-#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502
-#define GL_MODELVIEW0_MATRIX_EXT GL_MODELVIEW_MATRIX
-#define GL_MODELVIEW1_MATRIX_EXT 0x8506
-#define GL_VERTEX_WEIGHTING_EXT 0x8509
-#define GL_MODELVIEW0_EXT GL_MODELVIEW
-#define GL_MODELVIEW1_EXT 0x850A
-#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B
-#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C
-#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D
-#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E
-#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F
-#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510
-#endif
-
-#ifndef GL_NV_light_max_exponent
-#define GL_MAX_SHININESS_NV 0x8504
-#define GL_MAX_SPOT_EXPONENT_NV 0x8505
-#endif
-
-#ifndef GL_NV_vertex_array_range
-#define GL_VERTEX_ARRAY_RANGE_NV 0x851D
-#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E
-#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F
-#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520
-#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521
-#endif
-
-#ifndef GL_NV_register_combiners
-#define GL_REGISTER_COMBINERS_NV 0x8522
-#define GL_VARIABLE_A_NV 0x8523
-#define GL_VARIABLE_B_NV 0x8524
-#define GL_VARIABLE_C_NV 0x8525
-#define GL_VARIABLE_D_NV 0x8526
-#define GL_VARIABLE_E_NV 0x8527
-#define GL_VARIABLE_F_NV 0x8528
-#define GL_VARIABLE_G_NV 0x8529
-#define GL_CONSTANT_COLOR0_NV 0x852A
-#define GL_CONSTANT_COLOR1_NV 0x852B
-#define GL_PRIMARY_COLOR_NV 0x852C
-#define GL_SECONDARY_COLOR_NV 0x852D
-#define GL_SPARE0_NV 0x852E
-#define GL_SPARE1_NV 0x852F
-#define GL_DISCARD_NV 0x8530
-#define GL_E_TIMES_F_NV 0x8531
-#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
-#define GL_UNSIGNED_IDENTITY_NV 0x8536
-#define GL_UNSIGNED_INVERT_NV 0x8537
-#define GL_EXPAND_NORMAL_NV 0x8538
-#define GL_EXPAND_NEGATE_NV 0x8539
-#define GL_HALF_BIAS_NORMAL_NV 0x853A
-#define GL_HALF_BIAS_NEGATE_NV 0x853B
-#define GL_SIGNED_IDENTITY_NV 0x853C
-#define GL_SIGNED_NEGATE_NV 0x853D
-#define GL_SCALE_BY_TWO_NV 0x853E
-#define GL_SCALE_BY_FOUR_NV 0x853F
-#define GL_SCALE_BY_ONE_HALF_NV 0x8540
-#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541
-#define GL_COMBINER_INPUT_NV 0x8542
-#define GL_COMBINER_MAPPING_NV 0x8543
-#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544
-#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545
-#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546
-#define GL_COMBINER_MUX_SUM_NV 0x8547
-#define GL_COMBINER_SCALE_NV 0x8548
-#define GL_COMBINER_BIAS_NV 0x8549
-#define GL_COMBINER_AB_OUTPUT_NV 0x854A
-#define GL_COMBINER_CD_OUTPUT_NV 0x854B
-#define GL_COMBINER_SUM_OUTPUT_NV 0x854C
-#define GL_MAX_GENERAL_COMBINERS_NV 0x854D
-#define GL_NUM_GENERAL_COMBINERS_NV 0x854E
-#define GL_COLOR_SUM_CLAMP_NV 0x854F
-#define GL_COMBINER0_NV 0x8550
-#define GL_COMBINER1_NV 0x8551
-#define GL_COMBINER2_NV 0x8552
-#define GL_COMBINER3_NV 0x8553
-#define GL_COMBINER4_NV 0x8554
-#define GL_COMBINER5_NV 0x8555
-#define GL_COMBINER6_NV 0x8556
-#define GL_COMBINER7_NV 0x8557
-/* reuse GL_TEXTURE0_ARB */
-/* reuse GL_TEXTURE1_ARB */
-/* reuse GL_ZERO */
-/* reuse GL_NONE */
-/* reuse GL_FOG */
-#endif
-
-#ifndef GL_NV_fog_distance
-#define GL_FOG_DISTANCE_MODE_NV 0x855A
-#define GL_EYE_RADIAL_NV 0x855B
-#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C
-/* reuse GL_EYE_PLANE */
-#endif
-
-#ifndef GL_NV_texgen_emboss
-#define GL_EMBOSS_LIGHT_NV 0x855D
-#define GL_EMBOSS_CONSTANT_NV 0x855E
-#define GL_EMBOSS_MAP_NV 0x855F
-#endif
-
-#ifndef GL_NV_blend_square
-#endif
-
-#ifndef GL_NV_texture_env_combine4
-#define GL_COMBINE4_NV 0x8503
-#define GL_SOURCE3_RGB_NV 0x8583
-#define GL_SOURCE3_ALPHA_NV 0x858B
-#define GL_OPERAND3_RGB_NV 0x8593
-#define GL_OPERAND3_ALPHA_NV 0x859B
-#endif
-
-#ifndef GL_MESA_resize_buffers
-#endif
-
-#ifndef GL_MESA_window_pos
-#endif
-
-#ifndef GL_EXT_texture_compression_s3tc
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
-#endif
-
-#ifndef GL_IBM_cull_vertex
-#define GL_CULL_VERTEX_IBM 103050
-#endif
-
-#ifndef GL_IBM_multimode_draw_arrays
-#endif
-
-#ifndef GL_IBM_vertex_array_lists
-#define GL_VERTEX_ARRAY_LIST_IBM 103070
-#define GL_NORMAL_ARRAY_LIST_IBM 103071
-#define GL_COLOR_ARRAY_LIST_IBM 103072
-#define GL_INDEX_ARRAY_LIST_IBM 103073
-#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074
-#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075
-#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076
-#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077
-#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080
-#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081
-#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082
-#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083
-#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084
-#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085
-#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086
-#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087
-#endif
-
-#ifndef GL_SGIX_subsample
-#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0
-#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1
-#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2
-#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3
-#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4
-#endif
-
-#ifndef GL_SGIX_ycrcb_subsample
-#endif
-
-#ifndef GL_SGIX_ycrcba
-#define GL_YCRCB_SGIX 0x8318
-#define GL_YCRCBA_SGIX 0x8319
-#endif
-
-#ifndef GL_SGI_depth_pass_instrument
-#define GL_DEPTH_PASS_INSTRUMENT_SGIX 0x8310
-#define GL_DEPTH_PASS_INSTRUMENT_COUNTERS_SGIX 0x8311
-#define GL_DEPTH_PASS_INSTRUMENT_MAX_SGIX 0x8312
-#endif
-
-#ifndef GL_3DFX_texture_compression_FXT1
-#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0
-#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1
-#endif
-
-#ifndef GL_3DFX_multisample
-#define GL_MULTISAMPLE_3DFX 0x86B2
-#define GL_SAMPLE_BUFFERS_3DFX 0x86B3
-#define GL_SAMPLES_3DFX 0x86B4
-#define GL_MULTISAMPLE_BIT_3DFX 0x20000000
-#endif
-
-#ifndef GL_3DFX_tbuffer
-#endif
-
-#ifndef GL_EXT_multisample
-#define GL_MULTISAMPLE_EXT 0x809D
-#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
-#define GL_SAMPLE_MASK_EXT 0x80A0
-#define GL_1PASS_EXT 0x80A1
-#define GL_2PASS_0_EXT 0x80A2
-#define GL_2PASS_1_EXT 0x80A3
-#define GL_4PASS_0_EXT 0x80A4
-#define GL_4PASS_1_EXT 0x80A5
-#define GL_4PASS_2_EXT 0x80A6
-#define GL_4PASS_3_EXT 0x80A7
-#define GL_SAMPLE_BUFFERS_EXT 0x80A8
-#define GL_SAMPLES_EXT 0x80A9
-#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA
-#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB
-#define GL_SAMPLE_PATTERN_EXT 0x80AC
-#define GL_MULTISAMPLE_BIT_EXT 0x20000000
-#endif
-
-#ifndef GL_SGIX_vertex_preclip
-#define GL_VERTEX_PRECLIP_SGIX 0x83EE
-#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF
-#endif
-
-#ifndef GL_SGIX_convolution_accuracy
-#define GL_CONVOLUTION_HINT_SGIX 0x8316
-#endif
-
-#ifndef GL_SGIX_resample
-#define GL_PACK_RESAMPLE_SGIX 0x842C
-#define GL_UNPACK_RESAMPLE_SGIX 0x842D
-#define GL_RESAMPLE_REPLICATE_SGIX 0x842E
-#define GL_RESAMPLE_ZERO_FILL_SGIX 0x842F
-#define GL_RESAMPLE_DECIMATE_SGIX 0x8430
-#endif
-
-#ifndef GL_SGIS_point_line_texgen
-#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0
-#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1
-#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2
-#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3
-#define GL_EYE_POINT_SGIS 0x81F4
-#define GL_OBJECT_POINT_SGIS 0x81F5
-#define GL_EYE_LINE_SGIS 0x81F6
-#define GL_OBJECT_LINE_SGIS 0x81F7
-#endif
-
-#ifndef GL_SGIS_texture_color_mask
-#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF
-#endif
-
-#ifndef GL_EXT_texture_env_dot3
-#define GL_DOT3_RGB_EXT 0x8740
-#define GL_DOT3_RGBA_EXT 0x8741
-#endif
-
-#ifndef GL_ATI_texture_mirror_once
-#define GL_MIRROR_CLAMP_ATI 0x8742
-#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743
-#endif
-
-#ifndef GL_NV_fence
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-#endif
-
-#ifndef GL_IBM_texture_mirrored_repeat
-#define GL_MIRRORED_REPEAT_IBM 0x8370
-#endif
-
-#ifndef GL_NV_evaluators
-#define GL_EVAL_2D_NV 0x86C0
-#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1
-#define GL_MAP_TESSELLATION_NV 0x86C2
-#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3
-#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4
-#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5
-#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6
-#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7
-#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8
-#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9
-#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA
-#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB
-#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC
-#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD
-#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE
-#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF
-#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0
-#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1
-#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2
-#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3
-#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4
-#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5
-#define GL_MAX_MAP_TESSELLATION_NV 0x86D6
-#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7
-#endif
-
-#ifndef GL_NV_packed_depth_stencil
-#define GL_DEPTH_STENCIL_NV 0x84F9
-#define GL_UNSIGNED_INT_24_8_NV 0x84FA
-#endif
-
-#ifndef GL_NV_register_combiners2
-#define GL_PER_STAGE_CONSTANTS_NV 0x8535
-#endif
-
-#ifndef GL_NV_texture_compression_vtc
-#endif
-
-#ifndef GL_NV_texture_rectangle
-#define GL_TEXTURE_RECTANGLE_NV 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8
-#endif
-
-#ifndef GL_NV_texture_shader
-#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C
-#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
-#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
-#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9
-#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA
-#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB
-#define GL_DSDT_MAG_INTENSITY_NV 0x86DC
-#define GL_SHADER_CONSISTENT_NV 0x86DD
-#define GL_TEXTURE_SHADER_NV 0x86DE
-#define GL_SHADER_OPERATION_NV 0x86DF
-#define GL_CULL_MODES_NV 0x86E0
-#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1
-#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2
-#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3
-#define GL_OFFSET_TEXTURE_2D_MATRIX_NV GL_OFFSET_TEXTURE_MATRIX_NV
-#define GL_OFFSET_TEXTURE_2D_SCALE_NV GL_OFFSET_TEXTURE_SCALE_NV
-#define GL_OFFSET_TEXTURE_2D_BIAS_NV GL_OFFSET_TEXTURE_BIAS_NV
-#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4
-#define GL_CONST_EYE_NV 0x86E5
-#define GL_PASS_THROUGH_NV 0x86E6
-#define GL_CULL_FRAGMENT_NV 0x86E7
-#define GL_OFFSET_TEXTURE_2D_NV 0x86E8
-#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9
-#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA
-#define GL_DOT_PRODUCT_NV 0x86EC
-#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED
-#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE
-#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0
-#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1
-#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2
-#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3
-#define GL_HILO_NV 0x86F4
-#define GL_DSDT_NV 0x86F5
-#define GL_DSDT_MAG_NV 0x86F6
-#define GL_DSDT_MAG_VIB_NV 0x86F7
-#define GL_HILO16_NV 0x86F8
-#define GL_SIGNED_HILO_NV 0x86F9
-#define GL_SIGNED_HILO16_NV 0x86FA
-#define GL_SIGNED_RGBA_NV 0x86FB
-#define GL_SIGNED_RGBA8_NV 0x86FC
-#define GL_SIGNED_RGB_NV 0x86FE
-#define GL_SIGNED_RGB8_NV 0x86FF
-#define GL_SIGNED_LUMINANCE_NV 0x8701
-#define GL_SIGNED_LUMINANCE8_NV 0x8702
-#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703
-#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704
-#define GL_SIGNED_ALPHA_NV 0x8705
-#define GL_SIGNED_ALPHA8_NV 0x8706
-#define GL_SIGNED_INTENSITY_NV 0x8707
-#define GL_SIGNED_INTENSITY8_NV 0x8708
-#define GL_DSDT8_NV 0x8709
-#define GL_DSDT8_MAG8_NV 0x870A
-#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B
-#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C
-#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
-#define GL_HI_SCALE_NV 0x870E
-#define GL_LO_SCALE_NV 0x870F
-#define GL_DS_SCALE_NV 0x8710
-#define GL_DT_SCALE_NV 0x8711
-#define GL_MAGNITUDE_SCALE_NV 0x8712
-#define GL_VIBRANCE_SCALE_NV 0x8713
-#define GL_HI_BIAS_NV 0x8714
-#define GL_LO_BIAS_NV 0x8715
-#define GL_DS_BIAS_NV 0x8716
-#define GL_DT_BIAS_NV 0x8717
-#define GL_MAGNITUDE_BIAS_NV 0x8718
-#define GL_VIBRANCE_BIAS_NV 0x8719
-#define GL_TEXTURE_BORDER_VALUES_NV 0x871A
-#define GL_TEXTURE_HI_SIZE_NV 0x871B
-#define GL_TEXTURE_LO_SIZE_NV 0x871C
-#define GL_TEXTURE_DS_SIZE_NV 0x871D
-#define GL_TEXTURE_DT_SIZE_NV 0x871E
-#define GL_TEXTURE_MAG_SIZE_NV 0x871F
-#endif
-
-#ifndef GL_NV_texture_shader2
-#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF
-#endif
-
-#ifndef GL_NV_vertex_array_range2
-#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533
-#endif
-
-#ifndef GL_NV_vertex_program
-#define GL_VERTEX_PROGRAM_NV 0x8620
-#define GL_VERTEX_STATE_PROGRAM_NV 0x8621
-#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623
-#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624
-#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625
-#define GL_CURRENT_ATTRIB_NV 0x8626
-#define GL_PROGRAM_LENGTH_NV 0x8627
-#define GL_PROGRAM_STRING_NV 0x8628
-#define GL_MODELVIEW_PROJECTION_NV 0x8629
-#define GL_IDENTITY_NV 0x862A
-#define GL_INVERSE_NV 0x862B
-#define GL_TRANSPOSE_NV 0x862C
-#define GL_INVERSE_TRANSPOSE_NV 0x862D
-#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E
-#define GL_MAX_TRACK_MATRICES_NV 0x862F
-#define GL_MATRIX0_NV 0x8630
-#define GL_MATRIX1_NV 0x8631
-#define GL_MATRIX2_NV 0x8632
-#define GL_MATRIX3_NV 0x8633
-#define GL_MATRIX4_NV 0x8634
-#define GL_MATRIX5_NV 0x8635
-#define GL_MATRIX6_NV 0x8636
-#define GL_MATRIX7_NV 0x8637
-#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640
-#define GL_CURRENT_MATRIX_NV 0x8641
-#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643
-#define GL_PROGRAM_PARAMETER_NV 0x8644
-#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645
-#define GL_PROGRAM_TARGET_NV 0x8646
-#define GL_PROGRAM_RESIDENT_NV 0x8647
-#define GL_TRACK_MATRIX_NV 0x8648
-#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649
-#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A
-#define GL_PROGRAM_ERROR_POSITION_NV 0x864B
-#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650
-#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651
-#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652
-#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653
-#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654
-#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655
-#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656
-#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657
-#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658
-#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659
-#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A
-#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B
-#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C
-#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D
-#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E
-#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F
-#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660
-#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661
-#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662
-#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663
-#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664
-#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665
-#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666
-#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667
-#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668
-#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669
-#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A
-#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B
-#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C
-#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D
-#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E
-#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F
-#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670
-#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671
-#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672
-#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673
-#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674
-#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675
-#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676
-#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677
-#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678
-#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679
-#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A
-#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B
-#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C
-#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D
-#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E
-#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F
-#endif
-
-#ifndef GL_SGIX_texture_coordinate_clamp
-#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369
-#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A
-#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B
-#endif
-
-#ifndef GL_SGIX_scalebias_hint
-#define GL_SCALEBIAS_HINT_SGIX 0x8322
-#endif
-
-#ifndef GL_OML_interlace
-#define GL_INTERLACE_OML 0x8980
-#define GL_INTERLACE_READ_OML 0x8981
-#endif
-
-#ifndef GL_OML_subsample
-#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982
-#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983
-#endif
-
-#ifndef GL_OML_resample
-#define GL_PACK_RESAMPLE_OML 0x8984
-#define GL_UNPACK_RESAMPLE_OML 0x8985
-#define GL_RESAMPLE_REPLICATE_OML 0x8986
-#define GL_RESAMPLE_ZERO_FILL_OML 0x8987
-#define GL_RESAMPLE_AVERAGE_OML 0x8988
-#define GL_RESAMPLE_DECIMATE_OML 0x8989
-#endif
-
-#ifndef GL_NV_copy_depth_to_color
-#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E
-#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F
-#endif
-
-#ifndef GL_ATI_envmap_bumpmap
-#define GL_BUMP_ROT_MATRIX_ATI 0x8775
-#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776
-#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777
-#define GL_BUMP_TEX_UNITS_ATI 0x8778
-#define GL_DUDV_ATI 0x8779
-#define GL_DU8DV8_ATI 0x877A
-#define GL_BUMP_ENVMAP_ATI 0x877B
-#define GL_BUMP_TARGET_ATI 0x877C
-#endif
-
-#ifndef GL_ATI_fragment_shader
-#define GL_FRAGMENT_SHADER_ATI 0x8920
-#define GL_REG_0_ATI 0x8921
-#define GL_REG_1_ATI 0x8922
-#define GL_REG_2_ATI 0x8923
-#define GL_REG_3_ATI 0x8924
-#define GL_REG_4_ATI 0x8925
-#define GL_REG_5_ATI 0x8926
-#define GL_REG_6_ATI 0x8927
-#define GL_REG_7_ATI 0x8928
-#define GL_REG_8_ATI 0x8929
-#define GL_REG_9_ATI 0x892A
-#define GL_REG_10_ATI 0x892B
-#define GL_REG_11_ATI 0x892C
-#define GL_REG_12_ATI 0x892D
-#define GL_REG_13_ATI 0x892E
-#define GL_REG_14_ATI 0x892F
-#define GL_REG_15_ATI 0x8930
-#define GL_REG_16_ATI 0x8931
-#define GL_REG_17_ATI 0x8932
-#define GL_REG_18_ATI 0x8933
-#define GL_REG_19_ATI 0x8934
-#define GL_REG_20_ATI 0x8935
-#define GL_REG_21_ATI 0x8936
-#define GL_REG_22_ATI 0x8937
-#define GL_REG_23_ATI 0x8938
-#define GL_REG_24_ATI 0x8939
-#define GL_REG_25_ATI 0x893A
-#define GL_REG_26_ATI 0x893B
-#define GL_REG_27_ATI 0x893C
-#define GL_REG_28_ATI 0x893D
-#define GL_REG_29_ATI 0x893E
-#define GL_REG_30_ATI 0x893F
-#define GL_REG_31_ATI 0x8940
-#define GL_CON_0_ATI 0x8941
-#define GL_CON_1_ATI 0x8942
-#define GL_CON_2_ATI 0x8943
-#define GL_CON_3_ATI 0x8944
-#define GL_CON_4_ATI 0x8945
-#define GL_CON_5_ATI 0x8946
-#define GL_CON_6_ATI 0x8947
-#define GL_CON_7_ATI 0x8948
-#define GL_CON_8_ATI 0x8949
-#define GL_CON_9_ATI 0x894A
-#define GL_CON_10_ATI 0x894B
-#define GL_CON_11_ATI 0x894C
-#define GL_CON_12_ATI 0x894D
-#define GL_CON_13_ATI 0x894E
-#define GL_CON_14_ATI 0x894F
-#define GL_CON_15_ATI 0x8950
-#define GL_CON_16_ATI 0x8951
-#define GL_CON_17_ATI 0x8952
-#define GL_CON_18_ATI 0x8953
-#define GL_CON_19_ATI 0x8954
-#define GL_CON_20_ATI 0x8955
-#define GL_CON_21_ATI 0x8956
-#define GL_CON_22_ATI 0x8957
-#define GL_CON_23_ATI 0x8958
-#define GL_CON_24_ATI 0x8959
-#define GL_CON_25_ATI 0x895A
-#define GL_CON_26_ATI 0x895B
-#define GL_CON_27_ATI 0x895C
-#define GL_CON_28_ATI 0x895D
-#define GL_CON_29_ATI 0x895E
-#define GL_CON_30_ATI 0x895F
-#define GL_CON_31_ATI 0x8960
-#define GL_MOV_ATI 0x8961
-#define GL_ADD_ATI 0x8963
-#define GL_MUL_ATI 0x8964
-#define GL_SUB_ATI 0x8965
-#define GL_DOT3_ATI 0x8966
-#define GL_DOT4_ATI 0x8967
-#define GL_MAD_ATI 0x8968
-#define GL_LERP_ATI 0x8969
-#define GL_CND_ATI 0x896A
-#define GL_CND0_ATI 0x896B
-#define GL_DOT2_ADD_ATI 0x896C
-#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D
-#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
-#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F
-#define GL_NUM_PASSES_ATI 0x8970
-#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971
-#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972
-#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
-#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974
-#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975
-#define GL_SWIZZLE_STR_ATI 0x8976
-#define GL_SWIZZLE_STQ_ATI 0x8977
-#define GL_SWIZZLE_STR_DR_ATI 0x8978
-#define GL_SWIZZLE_STQ_DQ_ATI 0x8979
-#define GL_SWIZZLE_STRQ_ATI 0x897A
-#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B
-#define GL_RED_BIT_ATI 0x00000001
-#define GL_GREEN_BIT_ATI 0x00000002
-#define GL_BLUE_BIT_ATI 0x00000004
-#define GL_2X_BIT_ATI 0x00000001
-#define GL_4X_BIT_ATI 0x00000002
-#define GL_8X_BIT_ATI 0x00000004
-#define GL_HALF_BIT_ATI 0x00000008
-#define GL_QUARTER_BIT_ATI 0x00000010
-#define GL_EIGHTH_BIT_ATI 0x00000020
-#define GL_SATURATE_BIT_ATI 0x00000040
-#define GL_COMP_BIT_ATI 0x00000002
-#define GL_NEGATE_BIT_ATI 0x00000004
-#define GL_BIAS_BIT_ATI 0x00000008
-#endif
-
-#ifndef GL_ATI_pn_triangles
-#define GL_PN_TRIANGLES_ATI 0x87F0
-#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1
-#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2
-#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3
-#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4
-#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5
-#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6
-#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7
-#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8
-#endif
-
-#ifndef GL_ATI_vertex_array_object
-#define GL_STATIC_ATI 0x8760
-#define GL_DYNAMIC_ATI 0x8761
-#define GL_PRESERVE_ATI 0x8762
-#define GL_DISCARD_ATI 0x8763
-#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764
-#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765
-#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766
-#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767
-#endif
-
-#ifndef GL_EXT_vertex_shader
-#define GL_VERTEX_SHADER_EXT 0x8780
-#define GL_VERTEX_SHADER_BINDING_EXT 0x8781
-#define GL_OP_INDEX_EXT 0x8782
-#define GL_OP_NEGATE_EXT 0x8783
-#define GL_OP_DOT3_EXT 0x8784
-#define GL_OP_DOT4_EXT 0x8785
-#define GL_OP_MUL_EXT 0x8786
-#define GL_OP_ADD_EXT 0x8787
-#define GL_OP_MADD_EXT 0x8788
-#define GL_OP_FRAC_EXT 0x8789
-#define GL_OP_MAX_EXT 0x878A
-#define GL_OP_MIN_EXT 0x878B
-#define GL_OP_SET_GE_EXT 0x878C
-#define GL_OP_SET_LT_EXT 0x878D
-#define GL_OP_CLAMP_EXT 0x878E
-#define GL_OP_FLOOR_EXT 0x878F
-#define GL_OP_ROUND_EXT 0x8790
-#define GL_OP_EXP_BASE_2_EXT 0x8791
-#define GL_OP_LOG_BASE_2_EXT 0x8792
-#define GL_OP_POWER_EXT 0x8793
-#define GL_OP_RECIP_EXT 0x8794
-#define GL_OP_RECIP_SQRT_EXT 0x8795
-#define GL_OP_SUB_EXT 0x8796
-#define GL_OP_CROSS_PRODUCT_EXT 0x8797
-#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798
-#define GL_OP_MOV_EXT 0x8799
-#define GL_OUTPUT_VERTEX_EXT 0x879A
-#define GL_OUTPUT_COLOR0_EXT 0x879B
-#define GL_OUTPUT_COLOR1_EXT 0x879C
-#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D
-#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E
-#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F
-#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0
-#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1
-#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2
-#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3
-#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4
-#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5
-#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6
-#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7
-#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8
-#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9
-#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA
-#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB
-#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC
-#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD
-#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE
-#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF
-#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0
-#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1
-#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2
-#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3
-#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4
-#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5
-#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6
-#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7
-#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8
-#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9
-#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA
-#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB
-#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC
-#define GL_OUTPUT_FOG_EXT 0x87BD
-#define GL_SCALAR_EXT 0x87BE
-#define GL_VECTOR_EXT 0x87BF
-#define GL_MATRIX_EXT 0x87C0
-#define GL_VARIANT_EXT 0x87C1
-#define GL_INVARIANT_EXT 0x87C2
-#define GL_LOCAL_CONSTANT_EXT 0x87C3
-#define GL_LOCAL_EXT 0x87C4
-#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5
-#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6
-#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7
-#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8
-#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE
-#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF
-#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0
-#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1
-#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2
-#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3
-#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4
-#define GL_X_EXT 0x87D5
-#define GL_Y_EXT 0x87D6
-#define GL_Z_EXT 0x87D7
-#define GL_W_EXT 0x87D8
-#define GL_NEGATIVE_X_EXT 0x87D9
-#define GL_NEGATIVE_Y_EXT 0x87DA
-#define GL_NEGATIVE_Z_EXT 0x87DB
-#define GL_NEGATIVE_W_EXT 0x87DC
-#define GL_ZERO_EXT 0x87DD
-#define GL_ONE_EXT 0x87DE
-#define GL_NEGATIVE_ONE_EXT 0x87DF
-#define GL_NORMALIZED_RANGE_EXT 0x87E0
-#define GL_FULL_RANGE_EXT 0x87E1
-#define GL_CURRENT_VERTEX_EXT 0x87E2
-#define GL_MVP_MATRIX_EXT 0x87E3
-#define GL_VARIANT_VALUE_EXT 0x87E4
-#define GL_VARIANT_DATATYPE_EXT 0x87E5
-#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6
-#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7
-#define GL_VARIANT_ARRAY_EXT 0x87E8
-#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9
-#define GL_INVARIANT_VALUE_EXT 0x87EA
-#define GL_INVARIANT_DATATYPE_EXT 0x87EB
-#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC
-#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED
-#endif
-
-#ifndef GL_ATI_vertex_streams
-#define GL_MAX_VERTEX_STREAMS_ATI 0x876B
-#define GL_VERTEX_STREAM0_ATI 0x876C
-#define GL_VERTEX_STREAM1_ATI 0x876D
-#define GL_VERTEX_STREAM2_ATI 0x876E
-#define GL_VERTEX_STREAM3_ATI 0x876F
-#define GL_VERTEX_STREAM4_ATI 0x8770
-#define GL_VERTEX_STREAM5_ATI 0x8771
-#define GL_VERTEX_STREAM6_ATI 0x8772
-#define GL_VERTEX_STREAM7_ATI 0x8773
-#define GL_VERTEX_SOURCE_ATI 0x8774
-#endif
-
-#ifndef GL_ATI_element_array
-#define GL_ELEMENT_ARRAY_ATI 0x8768
-#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769
-#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A
-#endif
-
-#ifndef GL_SUN_mesh_array
-#define GL_QUAD_MESH_SUN 0x8614
-#define GL_TRIANGLE_MESH_SUN 0x8615
-#endif
-
-#ifndef GL_SUN_slice_accum
-#define GL_SLICE_ACCUM_SUN 0x85CC
-#endif
-
-#ifndef GL_NV_multisample_filter_hint
-#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534
-#endif
-
-#ifndef GL_NV_depth_clamp
-#define GL_DEPTH_CLAMP_NV 0x864F
-#endif
-
-#ifndef GL_NV_occlusion_query
-#define GL_PIXEL_COUNTER_BITS_NV 0x8864
-#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865
-#define GL_PIXEL_COUNT_NV 0x8866
-#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867
-#endif
-
-#ifndef GL_NV_point_sprite
-#define GL_POINT_SPRITE_NV 0x8861
-#define GL_COORD_REPLACE_NV 0x8862
-#define GL_POINT_SPRITE_R_MODE_NV 0x8863
-#endif
-
-#ifndef GL_NV_texture_shader3
-#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850
-#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851
-#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852
-#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853
-#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854
-#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855
-#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856
-#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857
-#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858
-#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859
-#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A
-#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B
-#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C
-#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D
-#define GL_HILO8_NV 0x885E
-#define GL_SIGNED_HILO8_NV 0x885F
-#define GL_FORCE_BLUE_TO_ONE_NV 0x8860
-#endif
-
-#ifndef GL_NV_vertex_program1_1
-#endif
-
-#ifndef GL_EXT_shadow_funcs
-#endif
-
-#ifndef GL_EXT_stencil_two_side
-#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
-#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
-#endif
-
-#ifndef GL_ATI_text_fragment_shader
-#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200
-#endif
-
-#ifndef GL_APPLE_client_storage
-#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
-#endif
-
-#ifndef GL_APPLE_element_array
-#define GL_ELEMENT_ARRAY_APPLE 0x8768
-#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8769
-#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x876A
-#endif
-
-#ifndef GL_APPLE_fence
-#define GL_DRAW_PIXELS_APPLE 0x8A0A
-#define GL_FENCE_APPLE 0x8A0B
-#endif
-
-#ifndef GL_APPLE_vertex_array_object
-#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5
-#endif
-
-#ifndef GL_APPLE_vertex_array_range
-#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D
-#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E
-#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F
-#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521
-#define GL_STORAGE_CACHED_APPLE 0x85BE
-#define GL_STORAGE_SHARED_APPLE 0x85BF
-#endif
-
-#ifndef GL_APPLE_ycbcr_422
-#define GL_YCBCR_422_APPLE 0x85B9
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#endif
-
-#ifndef GL_S3_s3tc
-#define GL_RGB_S3TC 0x83A0
-#define GL_RGB4_S3TC 0x83A1
-#define GL_RGBA_S3TC 0x83A2
-#define GL_RGBA4_S3TC 0x83A3
-#endif
-
-#ifndef GL_ATI_draw_buffers
-#define GL_MAX_DRAW_BUFFERS_ATI 0x8824
-#define GL_DRAW_BUFFER0_ATI 0x8825
-#define GL_DRAW_BUFFER1_ATI 0x8826
-#define GL_DRAW_BUFFER2_ATI 0x8827
-#define GL_DRAW_BUFFER3_ATI 0x8828
-#define GL_DRAW_BUFFER4_ATI 0x8829
-#define GL_DRAW_BUFFER5_ATI 0x882A
-#define GL_DRAW_BUFFER6_ATI 0x882B
-#define GL_DRAW_BUFFER7_ATI 0x882C
-#define GL_DRAW_BUFFER8_ATI 0x882D
-#define GL_DRAW_BUFFER9_ATI 0x882E
-#define GL_DRAW_BUFFER10_ATI 0x882F
-#define GL_DRAW_BUFFER11_ATI 0x8830
-#define GL_DRAW_BUFFER12_ATI 0x8831
-#define GL_DRAW_BUFFER13_ATI 0x8832
-#define GL_DRAW_BUFFER14_ATI 0x8833
-#define GL_DRAW_BUFFER15_ATI 0x8834
-#endif
-
-#ifndef GL_ATI_pixel_format_float
-#define GL_TYPE_RGBA_FLOAT_ATI 0x8820
-#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
-#endif
-
-#ifndef GL_ATI_texture_env_combine3
-#define GL_MODULATE_ADD_ATI 0x8744
-#define GL_MODULATE_SIGNED_ADD_ATI 0x8745
-#define GL_MODULATE_SUBTRACT_ATI 0x8746
-#endif
-
-#ifndef GL_ATI_texture_float
-#define GL_RGBA_FLOAT32_ATI 0x8814
-#define GL_RGB_FLOAT32_ATI 0x8815
-#define GL_ALPHA_FLOAT32_ATI 0x8816
-#define GL_INTENSITY_FLOAT32_ATI 0x8817
-#define GL_LUMINANCE_FLOAT32_ATI 0x8818
-#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819
-#define GL_RGBA_FLOAT16_ATI 0x881A
-#define GL_RGB_FLOAT16_ATI 0x881B
-#define GL_ALPHA_FLOAT16_ATI 0x881C
-#define GL_INTENSITY_FLOAT16_ATI 0x881D
-#define GL_LUMINANCE_FLOAT16_ATI 0x881E
-#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F
-#endif
-
-#ifndef GL_NV_float_buffer
-#define GL_FLOAT_R_NV 0x8880
-#define GL_FLOAT_RG_NV 0x8881
-#define GL_FLOAT_RGB_NV 0x8882
-#define GL_FLOAT_RGBA_NV 0x8883
-#define GL_FLOAT_R16_NV 0x8884
-#define GL_FLOAT_R32_NV 0x8885
-#define GL_FLOAT_RG16_NV 0x8886
-#define GL_FLOAT_RG32_NV 0x8887
-#define GL_FLOAT_RGB16_NV 0x8888
-#define GL_FLOAT_RGB32_NV 0x8889
-#define GL_FLOAT_RGBA16_NV 0x888A
-#define GL_FLOAT_RGBA32_NV 0x888B
-#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C
-#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D
-#define GL_FLOAT_RGBA_MODE_NV 0x888E
-#endif
-
-#ifndef GL_NV_fragment_program
-#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868
-#define GL_FRAGMENT_PROGRAM_NV 0x8870
-#define GL_MAX_TEXTURE_COORDS_NV 0x8871
-#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872
-#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873
-#define GL_PROGRAM_ERROR_STRING_NV 0x8874
-#endif
-
-#ifndef GL_NV_half_float
-#define GL_HALF_FLOAT_NV 0x140B
-#endif
-
-#ifndef GL_NV_pixel_data_range
-#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878
-#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879
-#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A
-#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B
-#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C
-#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D
-#endif
-
-#ifndef GL_NV_primitive_restart
-#define GL_PRIMITIVE_RESTART_NV 0x8558
-#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559
-#endif
-
-#ifndef GL_NV_texture_expand_normal
-#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F
-#endif
-
-#ifndef GL_NV_vertex_program2
-#endif
-
-#ifndef GL_ATI_map_object_buffer
-#endif
-
-#ifndef GL_ATI_separate_stencil
-#define GL_STENCIL_BACK_FUNC_ATI 0x8800
-#define GL_STENCIL_BACK_FAIL_ATI 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803
-#endif
-
-#ifndef GL_ATI_vertex_attrib_array_object
-#endif
-
-#ifndef GL_OES_read_format
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
-#endif
-
-#ifndef GL_EXT_depth_bounds_test
-#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890
-#define GL_DEPTH_BOUNDS_EXT 0x8891
-#endif
-
-#ifndef GL_EXT_texture_mirror_clamp
-#define GL_MIRROR_CLAMP_EXT 0x8742
-#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743
-#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912
-#endif
-
-#ifndef GL_EXT_blend_equation_separate
-#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION
-#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D
-#endif
-
-#ifndef GL_MESA_pack_invert
-#define GL_PACK_INVERT_MESA 0x8758
-#endif
-
-#ifndef GL_MESA_ycbcr_texture
-#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB
-#define GL_YCBCR_MESA 0x8757
-#endif
-
-#ifndef GL_EXT_pixel_buffer_object
-#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF
-#endif
-
-#ifndef GL_NV_fragment_program_option
-#endif
-
-#ifndef GL_NV_fragment_program2
-#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4
-#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5
-#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6
-#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7
-#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8
-#endif
-
-#ifndef GL_NV_vertex_program2_option
-/* reuse GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */
-/* reuse GL_MAX_PROGRAM_CALL_DEPTH_NV */
-#endif
-
-#ifndef GL_NV_vertex_program3
-/* reuse GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */
-#endif
-
-#ifndef GL_EXT_framebuffer_object
-#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
-#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
-#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
-#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
-#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT 0x8CD8
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
-#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
-#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
-#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
-#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
-#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
-#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
-#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
-#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
-#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
-#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
-#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
-#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
-#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
-#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
-#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
-#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
-#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
-#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
-#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
-#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
-#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
-#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
-#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
-#define GL_FRAMEBUFFER_EXT 0x8D40
-#define GL_RENDERBUFFER_EXT 0x8D41
-#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
-#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
-#define GL_STENCIL_INDEX1_EXT 0x8D46
-#define GL_STENCIL_INDEX4_EXT 0x8D47
-#define GL_STENCIL_INDEX8_EXT 0x8D48
-#define GL_STENCIL_INDEX16_EXT 0x8D49
-#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
-#endif
-
-#ifndef GL_GREMEDY_string_marker
-#endif
-
-
-/*************************************************************/
-
-#include
-#ifndef GL_VERSION_2_0
-/* GL type for program/shader text */
-typedef char GLchar; /* native character */
-#endif
-
-#ifndef GL_VERSION_1_5
-/* GL types for handling large vertex buffer objects */
-typedef ptrdiff_t GLintptr;
-typedef ptrdiff_t GLsizeiptr;
-#endif
-
-#ifndef GL_ARB_vertex_buffer_object
-/* GL types for handling large vertex buffer objects */
-typedef ptrdiff_t GLintptrARB;
-typedef ptrdiff_t GLsizeiptrARB;
-#endif
-
-#ifndef GL_ARB_shader_objects
-/* GL types for handling shader object handles and program/shader text */
-typedef char GLcharARB; /* native character */
-typedef unsigned int GLhandleARB; /* shader object handle */
-#endif
-
-/* GL types for "half" precision (s10e5) float data in host memory */
-#ifndef GL_ARB_half_float_pixel
-typedef unsigned short GLhalfARB;
-#endif
-
-#ifndef GL_NV_half_float
-typedef unsigned short GLhalfNV;
-#endif
-
-#ifndef GL_VERSION_1_2
-#define GL_VERSION_1_2 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf);
-GLAPI void APIENTRY glBlendEquation (GLenum);
-GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
-GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glCopyColorTable (GLenum, GLenum, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glGetColorTable (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetColorTableParameterfv (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetColorTableParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glColorSubTable (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyColorSubTable (GLenum, GLsizei, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glConvolutionFilter1D (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glConvolutionFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glConvolutionParameterf (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glConvolutionParameterfv (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glConvolutionParameteri (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glConvolutionParameteriv (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum, GLenum, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetConvolutionFilter (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetSeparableFilter (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
-GLAPI void APIENTRY glSeparableFilter2D (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
-GLAPI void APIENTRY glGetHistogram (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetHistogramParameterfv (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetHistogramParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMinmax (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean);
-GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean);
-GLAPI void APIENTRY glResetHistogram (GLenum);
-GLAPI void APIENTRY glResetMinmax (GLenum);
-GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
-typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
-typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
-typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
-typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
-typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-#endif
-
-#ifndef GL_VERSION_1_3
-#define GL_VERSION_1_3 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveTexture (GLenum);
-GLAPI void APIENTRY glClientActiveTexture (GLenum);
-GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord1f (GLenum, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord1fv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord1i (GLenum, GLint);
-GLAPI void APIENTRY glMultiTexCoord1iv (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord1s (GLenum, GLshort);
-GLAPI void APIENTRY glMultiTexCoord1sv (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord2d (GLenum, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord2dv (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord2f (GLenum, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord2fv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord2i (GLenum, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord2iv (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord2s (GLenum, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord2sv (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord3d (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord3dv (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord3f (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord3fv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord3i (GLenum, GLint, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord3iv (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord3s (GLenum, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord3sv (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord4d (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord4dv (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord4f (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord4fv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord4i (GLenum, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord4iv (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord4s (GLenum, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord4sv (GLenum, const GLshort *);
-GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *);
-GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *);
-GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *);
-GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *);
-GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean);
-GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
-#endif
-
-#ifndef GL_VERSION_1_4
-#define GL_VERSION_1_4 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glFogCoordf (GLfloat);
-GLAPI void APIENTRY glFogCoordfv (const GLfloat *);
-GLAPI void APIENTRY glFogCoordd (GLdouble);
-GLAPI void APIENTRY glFogCoorddv (const GLdouble *);
-GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei);
-GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
-GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *);
-GLAPI void APIENTRY glPointParameteri (GLenum, GLint);
-GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *);
-GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *);
-GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *);
-GLAPI void APIENTRY glSecondaryColor3f (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *);
-GLAPI void APIENTRY glSecondaryColor3i (GLint, GLint, GLint);
-GLAPI void APIENTRY glSecondaryColor3iv (const GLint *);
-GLAPI void APIENTRY glSecondaryColor3s (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *);
-GLAPI void APIENTRY glSecondaryColor3ub (GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *);
-GLAPI void APIENTRY glSecondaryColor3ui (GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *);
-GLAPI void APIENTRY glSecondaryColor3us (GLushort, GLushort, GLushort);
-GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *);
-GLAPI void APIENTRY glSecondaryColorPointer (GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glWindowPos2d (GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos2dv (const GLdouble *);
-GLAPI void APIENTRY glWindowPos2f (GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos2fv (const GLfloat *);
-GLAPI void APIENTRY glWindowPos2i (GLint, GLint);
-GLAPI void APIENTRY glWindowPos2iv (const GLint *);
-GLAPI void APIENTRY glWindowPos2s (GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos2sv (const GLshort *);
-GLAPI void APIENTRY glWindowPos3d (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos3dv (const GLdouble *);
-GLAPI void APIENTRY glWindowPos3f (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos3fv (const GLfloat *);
-GLAPI void APIENTRY glWindowPos3i (GLint, GLint, GLint);
-GLAPI void APIENTRY glWindowPos3iv (const GLint *);
-GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos3sv (const GLshort *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
-typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v);
-#endif
-
-#ifndef GL_VERSION_1_5
-#define GL_VERSION_1_5 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenQueries (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeleteQueries (GLsizei, const GLuint *);
-GLAPI GLboolean APIENTRY glIsQuery (GLuint);
-GLAPI void APIENTRY glBeginQuery (GLenum, GLuint);
-GLAPI void APIENTRY glEndQuery (GLenum);
-GLAPI void APIENTRY glGetQueryiv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetQueryObjectiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetQueryObjectuiv (GLuint, GLenum, GLuint *);
-GLAPI void APIENTRY glBindBuffer (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteBuffers (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenBuffers (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsBuffer (GLuint);
-GLAPI void APIENTRY glBufferData (GLenum, GLsizeiptr, const GLvoid *, GLenum);
-GLAPI void APIENTRY glBufferSubData (GLenum, GLintptr, GLsizeiptr, const GLvoid *);
-GLAPI void APIENTRY glGetBufferSubData (GLenum, GLintptr, GLsizeiptr, GLvoid *);
-GLAPI GLvoid* APIENTRY glMapBuffer (GLenum, GLenum);
-GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum);
-GLAPI void APIENTRY glGetBufferParameteriv (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetBufferPointerv (GLenum, GLenum, GLvoid* *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
-typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
-typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
-typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
-typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data);
-typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data);
-typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, GLvoid* *params);
-#endif
-
-#ifndef GL_VERSION_2_0
-#define GL_VERSION_2_0 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationSeparate (GLenum, GLenum);
-GLAPI void APIENTRY glDrawBuffers (GLsizei, const GLenum *);
-GLAPI void APIENTRY glStencilOpSeparate (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glStencilFuncSeparate (GLenum, GLenum, GLint, GLuint);
-GLAPI void APIENTRY glStencilMaskSeparate (GLenum, GLuint);
-GLAPI void APIENTRY glAttachShader (GLuint, GLuint);
-GLAPI void APIENTRY glBindAttribLocation (GLuint, GLuint, const GLchar *);
-GLAPI void APIENTRY glCompileShader (GLuint);
-GLAPI GLuint APIENTRY glCreateProgram (void);
-GLAPI GLuint APIENTRY glCreateShader (GLenum);
-GLAPI void APIENTRY glDeleteProgram (GLuint);
-GLAPI void APIENTRY glDeleteShader (GLuint);
-GLAPI void APIENTRY glDetachShader (GLuint, GLuint);
-GLAPI void APIENTRY glDisableVertexAttribArray (GLuint);
-GLAPI void APIENTRY glEnableVertexAttribArray (GLuint);
-GLAPI void APIENTRY glGetActiveAttrib (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *);
-GLAPI void APIENTRY glGetActiveUniform (GLuint, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLchar *);
-GLAPI void APIENTRY glGetAttachedShaders (GLuint, GLsizei, GLsizei *, GLuint *);
-GLAPI GLint APIENTRY glGetAttribLocation (GLuint, const GLchar *);
-GLAPI void APIENTRY glGetProgramiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetProgramInfoLog (GLuint, GLsizei, GLsizei *, GLchar *);
-GLAPI void APIENTRY glGetShaderiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetShaderInfoLog (GLuint, GLsizei, GLsizei *, GLchar *);
-GLAPI void APIENTRY glGetShaderSource (GLuint, GLsizei, GLsizei *, GLchar *);
-GLAPI GLint APIENTRY glGetUniformLocation (GLuint, const GLchar *);
-GLAPI void APIENTRY glGetUniformfv (GLuint, GLint, GLfloat *);
-GLAPI void APIENTRY glGetUniformiv (GLuint, GLint, GLint *);
-GLAPI void APIENTRY glGetVertexAttribdv (GLuint, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetVertexAttribfv (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVertexAttribiv (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint, GLenum, GLvoid* *);
-GLAPI GLboolean APIENTRY glIsProgram (GLuint);
-GLAPI GLboolean APIENTRY glIsShader (GLuint);
-GLAPI void APIENTRY glLinkProgram (GLuint);
-GLAPI void APIENTRY glShaderSource (GLuint, GLsizei, const GLchar* *, const GLint *);
-GLAPI void APIENTRY glUseProgram (GLuint);
-GLAPI void APIENTRY glUniform1f (GLint, GLfloat);
-GLAPI void APIENTRY glUniform2f (GLint, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform3f (GLint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform4f (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform1i (GLint, GLint);
-GLAPI void APIENTRY glUniform2i (GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform3i (GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform4i (GLint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform1fv (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform2fv (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform3fv (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform4fv (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform1iv (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform2iv (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform3iv (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform4iv (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniformMatrix2fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix3fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix4fv (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glValidateProgram (GLuint);
-GLAPI void APIENTRY glVertexAttrib1d (GLuint, GLdouble);
-GLAPI void APIENTRY glVertexAttrib1dv (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib1f (GLuint, GLfloat);
-GLAPI void APIENTRY glVertexAttrib1fv (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib1s (GLuint, GLshort);
-GLAPI void APIENTRY glVertexAttrib1sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib2d (GLuint, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib2dv (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib2f (GLuint, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib2fv (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib2s (GLuint, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib2sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib3d (GLuint, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib3dv (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib3f (GLuint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib3fv (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib3s (GLuint, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib3sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttrib4Niv (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4Nub (GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttrib4bv (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttrib4d (GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib4dv (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib4f (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib4fv (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib4iv (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttrib4s (GLuint, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib4sv (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4ubv (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttrib4uiv (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttrib4usv (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttribPointer (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
-typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
-typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
-typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
-typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
-typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
-typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
-typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj);
-typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
-typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
-typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length);
-typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
-#endif
-
-#ifndef GL_ARB_multitexture
-#define GL_ARB_multitexture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveTextureARB (GLenum);
-GLAPI void APIENTRY glClientActiveTextureARB (GLenum);
-GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum, GLint);
-GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum, GLshort);
-GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum, GLint, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum, const GLshort *);
-GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum, const GLdouble *);
-GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum, const GLfloat *);
-GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum, const GLint *);
-GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum, const GLshort *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
-#endif
-
-#ifndef GL_ARB_transpose_matrix
-#define GL_ARB_transpose_matrix 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *);
-GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *);
-GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *);
-GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
-#endif
-
-#ifndef GL_ARB_multisample
-#define GL_ARB_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleCoverageARB (GLclampf, GLboolean);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLclampf value, GLboolean invert);
-#endif
-
-#ifndef GL_ARB_texture_env_add
-#define GL_ARB_texture_env_add 1
-#endif
-
-#ifndef GL_ARB_texture_cube_map
-#define GL_ARB_texture_cube_map 1
-#endif
-
-#ifndef GL_ARB_texture_compression
-#define GL_ARB_texture_compression 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum, GLint, GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, GLvoid *img);
-#endif
-
-#ifndef GL_ARB_texture_border_clamp
-#define GL_ARB_texture_border_clamp 1
-#endif
-
-#ifndef GL_ARB_point_parameters
-#define GL_ARB_point_parameters 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfARB (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfvARB (GLenum, const GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params);
-#endif
-
-#ifndef GL_ARB_vertex_blend
-#define GL_ARB_vertex_blend 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWeightbvARB (GLint, const GLbyte *);
-GLAPI void APIENTRY glWeightsvARB (GLint, const GLshort *);
-GLAPI void APIENTRY glWeightivARB (GLint, const GLint *);
-GLAPI void APIENTRY glWeightfvARB (GLint, const GLfloat *);
-GLAPI void APIENTRY glWeightdvARB (GLint, const GLdouble *);
-GLAPI void APIENTRY glWeightubvARB (GLint, const GLubyte *);
-GLAPI void APIENTRY glWeightusvARB (GLint, const GLushort *);
-GLAPI void APIENTRY glWeightuivARB (GLint, const GLuint *);
-GLAPI void APIENTRY glWeightPointerARB (GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glVertexBlendARB (GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights);
-typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights);
-typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights);
-typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights);
-typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights);
-typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights);
-typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights);
-typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights);
-typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count);
-#endif
-
-#ifndef GL_ARB_matrix_palette
-#define GL_ARB_matrix_palette 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint);
-GLAPI void APIENTRY glMatrixIndexubvARB (GLint, const GLubyte *);
-GLAPI void APIENTRY glMatrixIndexusvARB (GLint, const GLushort *);
-GLAPI void APIENTRY glMatrixIndexuivARB (GLint, const GLuint *);
-GLAPI void APIENTRY glMatrixIndexPointerARB (GLint, GLenum, GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);
-typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices);
-typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices);
-typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices);
-typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-
-#ifndef GL_ARB_texture_env_combine
-#define GL_ARB_texture_env_combine 1
-#endif
-
-#ifndef GL_ARB_texture_env_crossbar
-#define GL_ARB_texture_env_crossbar 1
-#endif
-
-#ifndef GL_ARB_texture_env_dot3
-#define GL_ARB_texture_env_dot3 1
-#endif
-
-#ifndef GL_ARB_texture_mirrored_repeat
-#define GL_ARB_texture_mirrored_repeat 1
-#endif
-
-#ifndef GL_ARB_depth_texture
-#define GL_ARB_depth_texture 1
-#endif
-
-#ifndef GL_ARB_shadow
-#define GL_ARB_shadow 1
-#endif
-
-#ifndef GL_ARB_shadow_ambient
-#define GL_ARB_shadow_ambient 1
-#endif
-
-#ifndef GL_ARB_window_pos
-#define GL_ARB_window_pos 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWindowPos2dARB (GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *);
-GLAPI void APIENTRY glWindowPos2fARB (GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *);
-GLAPI void APIENTRY glWindowPos2iARB (GLint, GLint);
-GLAPI void APIENTRY glWindowPos2ivARB (const GLint *);
-GLAPI void APIENTRY glWindowPos2sARB (GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos2svARB (const GLshort *);
-GLAPI void APIENTRY glWindowPos3dARB (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *);
-GLAPI void APIENTRY glWindowPos3fARB (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *);
-GLAPI void APIENTRY glWindowPos3iARB (GLint, GLint, GLint);
-GLAPI void APIENTRY glWindowPos3ivARB (const GLint *);
-GLAPI void APIENTRY glWindowPos3sARB (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos3svARB (const GLshort *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v);
-#endif
-
-#ifndef GL_ARB_vertex_program
-#define GL_ARB_vertex_program 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttrib1dARB (GLuint, GLdouble);
-GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib1fARB (GLuint, GLfloat);
-GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib1sARB (GLuint, GLshort);
-GLAPI void APIENTRY glVertexAttrib1svARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib2dARB (GLuint, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib2fARB (GLuint, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib2sARB (GLuint, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib2svARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib3dARB (GLuint, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib3fARB (GLuint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib3sARB (GLuint, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib3svARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVertexAttrib4dARB (GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib4fARB (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint, const GLint *);
-GLAPI void APIENTRY glVertexAttrib4sARB (GLuint, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib4svARB (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint, const GLuint *);
-GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint, const GLushort *);
-GLAPI void APIENTRY glVertexAttribPointerARB (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint);
-GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint);
-GLAPI void APIENTRY glProgramStringARB (GLenum, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glBindProgramARB (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteProgramsARB (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenProgramsARB (GLsizei, GLuint *);
-GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum, GLuint, const GLdouble *);
-GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum, GLuint, const GLdouble *);
-GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum, GLuint, GLdouble *);
-GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum, GLuint, GLfloat *);
-GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum, GLuint, GLdouble *);
-GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum, GLuint, GLfloat *);
-GLAPI void APIENTRY glGetProgramivARB (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetProgramStringARB (GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVertexAttribivARB (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint, GLenum, GLvoid* *);
-GLAPI GLboolean APIENTRY glIsProgramARB (GLuint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const GLvoid *string);
-typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
-typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, GLvoid *string);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);
-#endif
-
-#ifndef GL_ARB_fragment_program
-#define GL_ARB_fragment_program 1
-/* All ARB_fragment_program entry points are shared with ARB_vertex_program. */
-#endif
-
-#ifndef GL_ARB_vertex_buffer_object
-#define GL_ARB_vertex_buffer_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindBufferARB (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteBuffersARB (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenBuffersARB (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsBufferARB (GLuint);
-GLAPI void APIENTRY glBufferDataARB (GLenum, GLsizeiptrARB, const GLvoid *, GLenum);
-GLAPI void APIENTRY glBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *);
-GLAPI void APIENTRY glGetBufferSubDataARB (GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *);
-GLAPI GLvoid* APIENTRY glMapBufferARB (GLenum, GLenum);
-GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum);
-GLAPI void APIENTRY glGetBufferParameterivARB (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
-typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
-typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
-typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const GLvoid *data, GLenum usage);
-typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid *data);
-typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, GLvoid *data);
-typedef GLvoid* (APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, GLvoid* *params);
-#endif
-
-#ifndef GL_ARB_occlusion_query
-#define GL_ARB_occlusion_query 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenQueriesARB (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeleteQueriesARB (GLsizei, const GLuint *);
-GLAPI GLboolean APIENTRY glIsQueryARB (GLuint);
-GLAPI void APIENTRY glBeginQueryARB (GLenum, GLuint);
-GLAPI void APIENTRY glEndQueryARB (GLenum);
-GLAPI void APIENTRY glGetQueryivARB (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetQueryObjectivARB (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint, GLenum, GLuint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params);
-#endif
-
-#ifndef GL_ARB_shader_objects
-#define GL_ARB_shader_objects 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB);
-GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum);
-GLAPI void APIENTRY glDetachObjectARB (GLhandleARB, GLhandleARB);
-GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum);
-GLAPI void APIENTRY glShaderSourceARB (GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
-GLAPI void APIENTRY glCompileShaderARB (GLhandleARB);
-GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void);
-GLAPI void APIENTRY glAttachObjectARB (GLhandleARB, GLhandleARB);
-GLAPI void APIENTRY glLinkProgramARB (GLhandleARB);
-GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB);
-GLAPI void APIENTRY glValidateProgramARB (GLhandleARB);
-GLAPI void APIENTRY glUniform1fARB (GLint, GLfloat);
-GLAPI void APIENTRY glUniform2fARB (GLint, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform3fARB (GLint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform4fARB (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glUniform1iARB (GLint, GLint);
-GLAPI void APIENTRY glUniform2iARB (GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform3iARB (GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform4iARB (GLint, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glUniform1fvARB (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform2fvARB (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform3fvARB (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform4fvARB (GLint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glUniform1ivARB (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform2ivARB (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform3ivARB (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniform4ivARB (GLint, GLsizei, const GLint *);
-GLAPI void APIENTRY glUniformMatrix2fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix3fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glUniformMatrix4fvARB (GLint, GLsizei, GLboolean, const GLfloat *);
-GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB, GLenum, GLint *);
-GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
-GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
-GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB, const GLcharARB *);
-GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
-GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB, GLint, GLfloat *);
-GLAPI void APIENTRY glGetUniformivARB (GLhandleARB, GLint, GLint *);
-GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
-typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname);
-typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);
-typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);
-typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB* *string, const GLint *length);
-typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);
-typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void);
-typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);
-typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);
-typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);
-typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);
-typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
-typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
-typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
-typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params);
-typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
-#endif
-
-#ifndef GL_ARB_vertex_shader
-#define GL_ARB_vertex_shader 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB, GLuint, const GLcharARB *);
-GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
-GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB, const GLcharARB *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
-typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
-typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
-#endif
-
-#ifndef GL_ARB_fragment_shader
-#define GL_ARB_fragment_shader 1
-#endif
-
-#ifndef GL_ARB_shading_language_100
-#define GL_ARB_shading_language_100 1
-#endif
-
-#ifndef GL_ARB_texture_non_power_of_two
-#define GL_ARB_texture_non_power_of_two 1
-#endif
-
-#ifndef GL_ARB_point_sprite
-#define GL_ARB_point_sprite 1
-#endif
-
-#ifndef GL_ARB_fragment_program_shadow
-#define GL_ARB_fragment_program_shadow 1
-#endif
-
-#ifndef GL_ARB_draw_buffers
-#define GL_ARB_draw_buffers 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawBuffersARB (GLsizei, const GLenum *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs);
-#endif
-
-#ifndef GL_ARB_texture_rectangle
-#define GL_ARB_texture_rectangle 1
-#endif
-
-#ifndef GL_ARB_color_buffer_float
-#define GL_ARB_color_buffer_float 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClampColorARB (GLenum, GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);
-#endif
-
-#ifndef GL_ARB_half_float_pixel
-#define GL_ARB_half_float_pixel 1
-#endif
-
-#ifndef GL_ARB_texture_float
-#define GL_ARB_texture_float 1
-#endif
-
-#ifndef GL_ARB_pixel_buffer_object
-#define GL_ARB_pixel_buffer_object 1
-#endif
-
-#ifndef GL_EXT_abgr
-#define GL_EXT_abgr 1
-#endif
-
-#ifndef GL_EXT_blend_color
-#define GL_EXT_blend_color 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendColorEXT (GLclampf, GLclampf, GLclampf, GLclampf);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
-#endif
-
-#ifndef GL_EXT_polygon_offset
-#define GL_EXT_polygon_offset 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat, GLfloat);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);
-#endif
-
-#ifndef GL_EXT_texture
-#define GL_EXT_texture 1
-#endif
-
-#ifndef GL_EXT_texture3D
-#define GL_EXT_texture3D 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexImage3DEXT (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
-#endif
-
-#ifndef GL_SGIS_texture_filter4
-#define GL_SGIS_texture_filter4 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum, GLenum, GLsizei, const GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights);
-typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
-#endif
-
-#ifndef GL_EXT_subtexture
-#define GL_EXT_subtexture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexSubImage1DEXT (GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
-#endif
-
-#ifndef GL_EXT_copy_texture
-#define GL_EXT_copy_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
-GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
-GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum, GLint, GLint, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-#endif
-
-#ifndef GL_EXT_histogram
-#define GL_EXT_histogram 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetHistogramEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMinmaxEXT (GLenum, GLboolean, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glHistogramEXT (GLenum, GLsizei, GLenum, GLboolean);
-GLAPI void APIENTRY glMinmaxEXT (GLenum, GLenum, GLboolean);
-GLAPI void APIENTRY glResetHistogramEXT (GLenum);
-GLAPI void APIENTRY glResetMinmaxEXT (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
-typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);
-typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target);
-#endif
-
-#ifndef GL_EXT_convolution
-#define GL_EXT_convolution 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum, GLenum, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum, GLenum, GLint, GLint, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum, GLenum, GLenum, GLvoid *, GLvoid *, GLvoid *);
-GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum, GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
-typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
-typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
-#endif
-
-#ifndef GL_EXT_color_matrix
-#define GL_EXT_color_matrix 1
-#endif
-
-#ifndef GL_SGI_color_table
-#define GL_SGI_color_table 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorTableSGI (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glColorTableParameterivSGI (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glCopyColorTableSGI (GLenum, GLenum, GLint, GLint, GLsizei);
-GLAPI void APIENTRY glGetColorTableSGI (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum, GLenum, GLint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params);
-#endif
-
-#ifndef GL_SGIX_pixel_texture
-#define GL_SGIX_pixel_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTexGenSGIX (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);
-#endif
-
-#ifndef GL_SGIS_pixel_texture
-#define GL_SGIS_pixel_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum, GLint);
-GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum, const GLint *);
-GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum, GLfloat);
-GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum, GLint *);
-GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params);
-#endif
-
-#ifndef GL_SGIS_texture4D
-#define GL_SGIS_texture4D 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexImage4DSGIS (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const GLvoid *pixels);
-#endif
-
-#ifndef GL_SGI_texture_color_table
-#define GL_SGI_texture_color_table 1
-#endif
-
-#ifndef GL_EXT_cmyka
-#define GL_EXT_cmyka 1
-#endif
-
-#ifndef GL_EXT_texture_object
-#define GL_EXT_texture_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei, const GLuint *, GLboolean *);
-GLAPI void APIENTRY glBindTextureEXT (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenTexturesEXT (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint);
-GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei, const GLuint *, const GLclampf *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences);
-typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);
-typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures);
-typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures);
-typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture);
-typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities);
-#endif
-
-#ifndef GL_SGIS_detail_texture
-#define GL_SGIS_detail_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
-typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
-#endif
-
-#ifndef GL_SGIS_sharpen_texture
-#define GL_SGIS_sharpen_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
-typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
-#endif
-
-#ifndef GL_EXT_packed_pixels
-#define GL_EXT_packed_pixels 1
-#endif
-
-#ifndef GL_SGIS_texture_lod
-#define GL_SGIS_texture_lod 1
-#endif
-
-#ifndef GL_SGIS_multisample
-#define GL_SGIS_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleMaskSGIS (GLclampf, GLboolean);
-GLAPI void APIENTRY glSamplePatternSGIS (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);
-#endif
-
-#ifndef GL_EXT_rescale_normal
-#define GL_EXT_rescale_normal 1
-#endif
-
-#ifndef GL_EXT_vertex_array
-#define GL_EXT_vertex_array 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glArrayElementEXT (GLint);
-GLAPI void APIENTRY glColorPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glDrawArraysEXT (GLenum, GLint, GLsizei);
-GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei, GLsizei, const GLboolean *);
-GLAPI void APIENTRY glGetPointervEXT (GLenum, GLvoid* *);
-GLAPI void APIENTRY glIndexPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glNormalPointerEXT (GLenum, GLsizei, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glTexCoordPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glVertexPointerEXT (GLint, GLenum, GLsizei, GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i);
-typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer);
-typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, GLvoid* *params);
-typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
-#endif
-
-#ifndef GL_EXT_misc_attribute
-#define GL_EXT_misc_attribute 1
-#endif
-
-#ifndef GL_SGIS_generate_mipmap
-#define GL_SGIS_generate_mipmap 1
-#endif
-
-#ifndef GL_SGIX_clipmap
-#define GL_SGIX_clipmap 1
-#endif
-
-#ifndef GL_SGIX_shadow
-#define GL_SGIX_shadow 1
-#endif
-
-#ifndef GL_SGIS_texture_edge_clamp
-#define GL_SGIS_texture_edge_clamp 1
-#endif
-
-#ifndef GL_SGIS_texture_border_clamp
-#define GL_SGIS_texture_border_clamp 1
-#endif
-
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationEXT (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
-#endif
-
-#ifndef GL_EXT_blend_subtract
-#define GL_EXT_blend_subtract 1
-#endif
-
-#ifndef GL_EXT_blend_logic_op
-#define GL_EXT_blend_logic_op 1
-#endif
-
-#ifndef GL_SGIX_interlace
-#define GL_SGIX_interlace 1
-#endif
-
-#ifndef GL_SGIX_pixel_tiles
-#define GL_SGIX_pixel_tiles 1
-#endif
-
-#ifndef GL_SGIX_texture_select
-#define GL_SGIX_texture_select 1
-#endif
-
-#ifndef GL_SGIX_sprite
-#define GL_SGIX_sprite 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum, GLfloat);
-GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum, const GLfloat *);
-GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum, GLint);
-GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum, const GLint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params);
-#endif
-
-#ifndef GL_SGIX_texture_multi_buffer
-#define GL_SGIX_texture_multi_buffer 1
-#endif
-
-#ifndef GL_EXT_point_parameters
-#define GL_EXT_point_parameters 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);
-#endif
-
-#ifndef GL_SGIS_point_parameters
-#define GL_SGIS_point_parameters 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfSGIS (GLenum, GLfloat);
-GLAPI void APIENTRY glPointParameterfvSGIS (GLenum, const GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
-#endif
-
-#ifndef GL_SGIX_instruments
-#define GL_SGIX_instruments 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLint APIENTRY glGetInstrumentsSGIX (void);
-GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei, GLint *);
-GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *);
-GLAPI void APIENTRY glReadInstrumentsSGIX (GLint);
-GLAPI void APIENTRY glStartInstrumentsSGIX (void);
-GLAPI void APIENTRY glStopInstrumentsSGIX (GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void);
-typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer);
-typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p);
-typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker);
-typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void);
-typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker);
-#endif
-
-#ifndef GL_SGIX_texture_scale_bias
-#define GL_SGIX_texture_scale_bias 1
-#endif
-
-#ifndef GL_SGIX_framezoom
-#define GL_SGIX_framezoom 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFrameZoomSGIX (GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor);
-#endif
-
-#ifndef GL_SGIX_tag_sample_buffer
-#define GL_SGIX_tag_sample_buffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTagSampleBufferSGIX (void);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);
-#endif
-
-#ifndef GL_SGIX_polynomial_ffd
-#define GL_SGIX_polynomial_ffd 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
-GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
-GLAPI void APIENTRY glDeformSGIX (GLbitfield);
-GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
-typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
-typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask);
-typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask);
-#endif
-
-#ifndef GL_SGIX_reference_plane
-#define GL_SGIX_reference_plane 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation);
-#endif
-
-#ifndef GL_SGIX_flush_raster
-#define GL_SGIX_flush_raster 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFlushRasterSGIX (void);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void);
-#endif
-
-#ifndef GL_SGIX_depth_texture
-#define GL_SGIX_depth_texture 1
-#endif
-
-#ifndef GL_SGIS_fog_function
-#define GL_SGIS_fog_function 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFogFuncSGIS (GLsizei, const GLfloat *);
-GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points);
-typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points);
-#endif
-
-#ifndef GL_SGIX_fog_offset
-#define GL_SGIX_fog_offset 1
-#endif
-
-#ifndef GL_HP_image_transform
-#define GL_HP_image_transform 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glImageTransformParameteriHP (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glImageTransformParameterfHP (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glImageTransformParameterivHP (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum, GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params);
-#endif
-
-#ifndef GL_HP_convolution_border_modes
-#define GL_HP_convolution_border_modes 1
-#endif
-
-#ifndef GL_SGIX_texture_add_env
-#define GL_SGIX_texture_add_env 1
-#endif
-
-#ifndef GL_EXT_color_subtable
-#define GL_EXT_color_subtable 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorSubTableEXT (GLenum, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum, GLsizei, GLint, GLint, GLsizei);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
-typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-#endif
-
-#ifndef GL_PGI_vertex_hints
-#define GL_PGI_vertex_hints 1
-#endif
-
-#ifndef GL_PGI_misc_hints
-#define GL_PGI_misc_hints 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glHintPGI (GLenum, GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode);
-#endif
-
-#ifndef GL_EXT_paletted_texture
-#define GL_EXT_paletted_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorTableEXT (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
-GLAPI void APIENTRY glGetColorTableEXT (GLenum, GLenum, GLenum, GLvoid *);
-GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum, GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, GLvoid *data);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-#endif
-
-#ifndef GL_EXT_clip_volume_hint
-#define GL_EXT_clip_volume_hint 1
-#endif
-
-#ifndef GL_SGIX_list_priority
-#define GL_SGIX_list_priority 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetListParameterivSGIX (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glListParameterfSGIX (GLuint, GLenum, GLfloat);
-GLAPI void APIENTRY glListParameterfvSGIX (GLuint, GLenum, const GLfloat *);
-GLAPI void APIENTRY glListParameteriSGIX (GLuint, GLenum, GLint);
-GLAPI void APIENTRY glListParameterivSGIX (GLuint, GLenum, const GLint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params);
-#endif
-
-#ifndef GL_SGIX_ir_instrument1
-#define GL_SGIX_ir_instrument1 1
-#endif
-
-#ifndef GL_SGIX_calligraphic_fragment
-#define GL_SGIX_calligraphic_fragment 1
-#endif
-
-#ifndef GL_SGIX_texture_lod_bias
-#define GL_SGIX_texture_lod_bias 1
-#endif
-
-#ifndef GL_SGIX_shadow_ambient
-#define GL_SGIX_shadow_ambient 1
-#endif
-
-#ifndef GL_EXT_index_texture
-#define GL_EXT_index_texture 1
-#endif
-
-#ifndef GL_EXT_index_material
-#define GL_EXT_index_material 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIndexMaterialEXT (GLenum, GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);
-#endif
-
-#ifndef GL_EXT_index_func
-#define GL_EXT_index_func 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIndexFuncEXT (GLenum, GLclampf);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref);
-#endif
-
-#ifndef GL_EXT_index_array_formats
-#define GL_EXT_index_array_formats 1
-#endif
-
-#ifndef GL_EXT_compiled_vertex_array
-#define GL_EXT_compiled_vertex_array 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLockArraysEXT (GLint, GLsizei);
-GLAPI void APIENTRY glUnlockArraysEXT (void);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void);
-#endif
-
-#ifndef GL_EXT_cull_vertex
-#define GL_EXT_cull_vertex 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCullParameterdvEXT (GLenum, GLdouble *);
-GLAPI void APIENTRY glCullParameterfvEXT (GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params);
-#endif
-
-#ifndef GL_SGIX_ycrcb
-#define GL_SGIX_ycrcb 1
-#endif
-
-#ifndef GL_SGIX_fragment_lighting
-#define GL_SGIX_fragment_lighting 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum, GLenum);
-GLAPI void APIENTRY glFragmentLightfSGIX (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glFragmentLightiSGIX (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glFragmentLightivSGIX (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum, GLfloat);
-GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum, const GLfloat *);
-GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum, GLint);
-GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum, const GLint *);
-GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glLightEnviSGIX (GLenum, GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param);
-#endif
-
-#ifndef GL_IBM_rasterpos_clip
-#define GL_IBM_rasterpos_clip 1
-#endif
-
-#ifndef GL_HP_texture_lighting
-#define GL_HP_texture_lighting 1
-#endif
-
-#ifndef GL_EXT_draw_range_elements
-#define GL_EXT_draw_range_elements 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
-#endif
-
-#ifndef GL_WIN_phong_shading
-#define GL_WIN_phong_shading 1
-#endif
-
-#ifndef GL_WIN_specular_fog
-#define GL_WIN_specular_fog 1
-#endif
-
-#ifndef GL_EXT_light_texture
-#define GL_EXT_light_texture 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glApplyTextureEXT (GLenum);
-GLAPI void APIENTRY glTextureLightEXT (GLenum);
-GLAPI void APIENTRY glTextureMaterialEXT (GLenum, GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);
-typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);
-#endif
-
-#ifndef GL_SGIX_blend_alpha_minmax
-#define GL_SGIX_blend_alpha_minmax 1
-#endif
-
-#ifndef GL_EXT_bgra
-#define GL_EXT_bgra 1
-#endif
-
-#ifndef GL_SGIX_async
-#define GL_SGIX_async 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint);
-GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *);
-GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *);
-GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei);
-GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint, GLsizei);
-GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker);
-typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp);
-typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp);
-typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range);
-typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range);
-typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);
-#endif
-
-#ifndef GL_SGIX_async_pixel
-#define GL_SGIX_async_pixel 1
-#endif
-
-#ifndef GL_SGIX_async_histogram
-#define GL_SGIX_async_histogram 1
-#endif
-
-#ifndef GL_INTEL_parallel_arrays
-#define GL_INTEL_parallel_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexPointervINTEL (GLint, GLenum, const GLvoid* *);
-GLAPI void APIENTRY glNormalPointervINTEL (GLenum, const GLvoid* *);
-GLAPI void APIENTRY glColorPointervINTEL (GLint, GLenum, const GLvoid* *);
-GLAPI void APIENTRY glTexCoordPointervINTEL (GLint, GLenum, const GLvoid* *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
-typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const GLvoid* *pointer);
-typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
-typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const GLvoid* *pointer);
-#endif
-
-#ifndef GL_HP_occlusion_test
-#define GL_HP_occlusion_test 1
-#endif
-
-#ifndef GL_EXT_pixel_transform
-#define GL_EXT_pixel_transform 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum, GLenum, GLint);
-GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum, GLenum, GLfloat);
-GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum, GLenum, const GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
-#endif
-
-#ifndef GL_EXT_pixel_transform_color_table
-#define GL_EXT_pixel_transform_color_table 1
-#endif
-
-#ifndef GL_EXT_shared_texture_palette
-#define GL_EXT_shared_texture_palette 1
-#endif
-
-#ifndef GL_EXT_separate_specular_color
-#define GL_EXT_separate_specular_color 1
-#endif
-
-#ifndef GL_EXT_secondary_color
-#define GL_EXT_secondary_color 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *);
-GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *);
-GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *);
-GLAPI void APIENTRY glSecondaryColor3iEXT (GLint, GLint, GLint);
-GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *);
-GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *);
-GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *);
-GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *);
-GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort, GLushort, GLushort);
-GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *);
-GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint, GLenum, GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-
-#ifndef GL_EXT_texture_perturb_normal
-#define GL_EXT_texture_perturb_normal 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureNormalEXT (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode);
-#endif
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei);
-GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
-#endif
-
-#ifndef GL_EXT_fog_coord
-#define GL_EXT_fog_coord 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFogCoordfEXT (GLfloat);
-GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *);
-GLAPI void APIENTRY glFogCoorddEXT (GLdouble);
-GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *);
-GLAPI void APIENTRY glFogCoordPointerEXT (GLenum, GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
-typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-
-#ifndef GL_REND_screen_coordinates
-#define GL_REND_screen_coordinates 1
-#endif
-
-#ifndef GL_EXT_coordinate_frame
-#define GL_EXT_coordinate_frame 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTangent3bEXT (GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *);
-GLAPI void APIENTRY glTangent3dEXT (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *);
-GLAPI void APIENTRY glTangent3fEXT (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *);
-GLAPI void APIENTRY glTangent3iEXT (GLint, GLint, GLint);
-GLAPI void APIENTRY glTangent3ivEXT (const GLint *);
-GLAPI void APIENTRY glTangent3sEXT (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glTangent3svEXT (const GLshort *);
-GLAPI void APIENTRY glBinormal3bEXT (GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *);
-GLAPI void APIENTRY glBinormal3dEXT (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *);
-GLAPI void APIENTRY glBinormal3fEXT (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *);
-GLAPI void APIENTRY glBinormal3iEXT (GLint, GLint, GLint);
-GLAPI void APIENTRY glBinormal3ivEXT (const GLint *);
-GLAPI void APIENTRY glBinormal3sEXT (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glBinormal3svEXT (const GLshort *);
-GLAPI void APIENTRY glTangentPointerEXT (GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glBinormalPointerEXT (GLenum, GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz);
-typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v);
-typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz);
-typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz);
-typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz);
-typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz);
-typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz);
-typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v);
-typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz);
-typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz);
-typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz);
-typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz);
-typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-
-#ifndef GL_EXT_texture_env_combine
-#define GL_EXT_texture_env_combine 1
-#endif
-
-#ifndef GL_APPLE_specular_vector
-#define GL_APPLE_specular_vector 1
-#endif
-
-#ifndef GL_APPLE_transform_hint
-#define GL_APPLE_transform_hint 1
-#endif
-
-#ifndef GL_SGIX_fog_scale
-#define GL_SGIX_fog_scale 1
-#endif
-
-#ifndef GL_SUNX_constant_data
-#define GL_SUNX_constant_data 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFinishTextureSUNX (void);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void);
-#endif
-
-#ifndef GL_SUN_global_alpha
-#define GL_SUN_global_alpha 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte);
-GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort);
-GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint);
-GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat);
-GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble);
-GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte);
-GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort);
-GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);
-#endif
-
-#ifndef GL_SUN_triangle_list
-#define GL_SUN_triangle_list 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint);
-GLAPI void APIENTRY glReplacementCodeusSUN (GLushort);
-GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte);
-GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *);
-GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *);
-GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *);
-GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum, GLsizei, const GLvoid* *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const GLvoid* *pointer);
-#endif
-
-#ifndef GL_SUN_vertex
-#define GL_SUN_vertex 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat);
-GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat, GLfloat, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *, const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint, GLubyte, GLubyte, GLubyte, GLubyte, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *, const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *, const GLfloat *, const GLfloat *, const GLfloat *, const GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-#endif
-
-#ifndef GL_EXT_blend_func_separate
-#define GL_EXT_blend_func_separate 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum, GLenum, GLenum, GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-#endif
-
-#ifndef GL_INGR_blend_func_separate
-#define GL_INGR_blend_func_separate 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum, GLenum, GLenum, GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-#endif
-
-#ifndef GL_INGR_color_clamp
-#define GL_INGR_color_clamp 1
-#endif
-
-#ifndef GL_INGR_interlace_read
-#define GL_INGR_interlace_read 1
-#endif
-
-#ifndef GL_EXT_stencil_wrap
-#define GL_EXT_stencil_wrap 1
-#endif
-
-#ifndef GL_EXT_422_pixels
-#define GL_EXT_422_pixels 1
-#endif
-
-#ifndef GL_NV_texgen_reflection
-#define GL_NV_texgen_reflection 1
-#endif
-
-#ifndef GL_SUN_convolution_border_modes
-#define GL_SUN_convolution_border_modes 1
-#endif
-
-#ifndef GL_EXT_texture_env_add
-#define GL_EXT_texture_env_add 1
-#endif
-
-#ifndef GL_EXT_texture_lod_bias
-#define GL_EXT_texture_lod_bias 1
-#endif
-
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-#endif
-
-#ifndef GL_EXT_vertex_weighting
-#define GL_EXT_vertex_weighting 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexWeightfEXT (GLfloat);
-GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *);
-GLAPI void APIENTRY glVertexWeightPointerEXT (GLsizei, GLenum, GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLsizei size, GLenum type, GLsizei stride, const GLvoid *pointer);
-#endif
-
-#ifndef GL_NV_light_max_exponent
-#define GL_NV_light_max_exponent 1
-#endif
-
-#ifndef GL_NV_vertex_array_range
-#define GL_NV_vertex_array_range 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFlushVertexArrayRangeNV (void);
-GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
-typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const GLvoid *pointer);
-#endif
-
-#ifndef GL_NV_register_combiners
-#define GL_NV_register_combiners 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCombinerParameterfvNV (GLenum, const GLfloat *);
-GLAPI void APIENTRY glCombinerParameterfNV (GLenum, GLfloat);
-GLAPI void APIENTRY glCombinerParameterivNV (GLenum, const GLint *);
-GLAPI void APIENTRY glCombinerParameteriNV (GLenum, GLint);
-GLAPI void APIENTRY glCombinerInputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glCombinerOutputNV (GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean);
-GLAPI void APIENTRY glFinalCombinerInputNV (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum, GLenum, GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum, GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum, GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum, GLenum, GLint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
-typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
-typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
-typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params);
-#endif
-
-#ifndef GL_NV_fog_distance
-#define GL_NV_fog_distance 1
-#endif
-
-#ifndef GL_NV_texgen_emboss
-#define GL_NV_texgen_emboss 1
-#endif
-
-#ifndef GL_NV_blend_square
-#define GL_NV_blend_square 1
-#endif
-
-#ifndef GL_NV_texture_env_combine4
-#define GL_NV_texture_env_combine4 1
-#endif
-
-#ifndef GL_MESA_resize_buffers
-#define GL_MESA_resize_buffers 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glResizeBuffersMESA (void);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void);
-#endif
-
-#ifndef GL_MESA_window_pos
-#define GL_MESA_window_pos 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWindowPos2dMESA (GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *);
-GLAPI void APIENTRY glWindowPos2fMESA (GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *);
-GLAPI void APIENTRY glWindowPos2iMESA (GLint, GLint);
-GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *);
-GLAPI void APIENTRY glWindowPos2sMESA (GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *);
-GLAPI void APIENTRY glWindowPos3dMESA (GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *);
-GLAPI void APIENTRY glWindowPos3fMESA (GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *);
-GLAPI void APIENTRY glWindowPos3iMESA (GLint, GLint, GLint);
-GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *);
-GLAPI void APIENTRY glWindowPos3sMESA (GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *);
-GLAPI void APIENTRY glWindowPos4dMESA (GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *);
-GLAPI void APIENTRY glWindowPos4fMESA (GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *);
-GLAPI void APIENTRY glWindowPos4iMESA (GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *);
-GLAPI void APIENTRY glWindowPos4sMESA (GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v);
-#endif
-
-#ifndef GL_IBM_cull_vertex
-#define GL_IBM_cull_vertex 1
-#endif
-
-#ifndef GL_IBM_multimode_draw_arrays
-#define GL_IBM_multimode_draw_arrays 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint);
-GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *, const GLsizei *, GLenum, const GLvoid* const *, GLsizei, GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
-typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount, GLint modestride);
-#endif
-
-#ifndef GL_IBM_vertex_array_lists
-#define GL_IBM_vertex_array_lists 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint, const GLboolean* *, GLint);
-GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glIndexPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glNormalPointerListIBM (GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glTexCoordPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
-GLAPI void APIENTRY glVertexPointerListIBM (GLint, GLenum, GLint, const GLvoid* *, GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean* *pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const GLvoid* *pointer, GLint ptrstride);
-#endif
-
-#ifndef GL_SGIX_subsample
-#define GL_SGIX_subsample 1
-#endif
-
-#ifndef GL_SGIX_ycrcba
-#define GL_SGIX_ycrcba 1
-#endif
-
-#ifndef GL_SGIX_ycrcb_subsample
-#define GL_SGIX_ycrcb_subsample 1
-#endif
-
-#ifndef GL_SGIX_depth_pass_instrument
-#define GL_SGIX_depth_pass_instrument 1
-#endif
-
-#ifndef GL_3DFX_texture_compression_FXT1
-#define GL_3DFX_texture_compression_FXT1 1
-#endif
-
-#ifndef GL_3DFX_multisample
-#define GL_3DFX_multisample 1
-#endif
-
-#ifndef GL_3DFX_tbuffer
-#define GL_3DFX_tbuffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTbufferMask3DFX (GLuint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
-#endif
-
-#ifndef GL_EXT_multisample
-#define GL_EXT_multisample 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleMaskEXT (GLclampf, GLboolean);
-GLAPI void APIENTRY glSamplePatternEXT (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);
-#endif
-
-#ifndef GL_SGIX_vertex_preclip
-#define GL_SGIX_vertex_preclip 1
-#endif
-
-#ifndef GL_SGIX_convolution_accuracy
-#define GL_SGIX_convolution_accuracy 1
-#endif
-
-#ifndef GL_SGIX_resample
-#define GL_SGIX_resample 1
-#endif
-
-#ifndef GL_SGIS_point_line_texgen
-#define GL_SGIS_point_line_texgen 1
-#endif
-
-#ifndef GL_SGIS_texture_color_mask
-#define GL_SGIS_texture_color_mask 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean, GLboolean, GLboolean, GLboolean);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-#endif
-
-#ifndef GL_SGIX_igloo_interface
-#define GL_SGIX_igloo_interface 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const GLvoid *params);
-#endif
-
-#ifndef GL_EXT_texture_env_dot3
-#define GL_EXT_texture_env_dot3 1
-#endif
-
-#ifndef GL_ATI_texture_mirror_once
-#define GL_ATI_texture_mirror_once 1
-#endif
-
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeleteFencesNV (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenFencesNV (GLsizei, GLuint *);
-GLAPI GLboolean APIENTRY glIsFenceNV (GLuint);
-GLAPI GLboolean APIENTRY glTestFenceNV (GLuint);
-GLAPI void APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glFinishFenceNV (GLuint);
-GLAPI void APIENTRY glSetFenceNV (GLuint, GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
-typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
-typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
-typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
-typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
-typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
-#endif
-
-#ifndef GL_NV_evaluators
-#define GL_NV_evaluators 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLint, GLint, GLboolean, const GLvoid *);
-GLAPI void APIENTRY glMapParameterivNV (GLenum, GLenum, const GLint *);
-GLAPI void APIENTRY glMapParameterfvNV (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetMapControlPointsNV (GLenum, GLuint, GLenum, GLsizei, GLsizei, GLboolean, GLvoid *);
-GLAPI void APIENTRY glGetMapParameterivNV (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGetMapParameterfvNV (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum, GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum, GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glEvalMapsNV (GLenum, GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const GLvoid *points);
-typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, GLvoid *points);
-typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);
-#endif
-
-#ifndef GL_NV_packed_depth_stencil
-#define GL_NV_packed_depth_stencil 1
-#endif
-
-#ifndef GL_NV_register_combiners2
-#define GL_NV_register_combiners2 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum, GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum, GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params);
-#endif
-
-#ifndef GL_NV_texture_compression_vtc
-#define GL_NV_texture_compression_vtc 1
-#endif
-
-#ifndef GL_NV_texture_rectangle
-#define GL_NV_texture_rectangle 1
-#endif
-
-#ifndef GL_NV_texture_shader
-#define GL_NV_texture_shader 1
-#endif
-
-#ifndef GL_NV_texture_shader2
-#define GL_NV_texture_shader2 1
-#endif
-
-#ifndef GL_NV_vertex_array_range2
-#define GL_NV_vertex_array_range2 1
-#endif
-
-#ifndef GL_NV_vertex_program
-#define GL_NV_vertex_program 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei, const GLuint *, GLboolean *);
-GLAPI void APIENTRY glBindProgramNV (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteProgramsNV (GLsizei, const GLuint *);
-GLAPI void APIENTRY glExecuteProgramNV (GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glGenProgramsNV (GLsizei, GLuint *);
-GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum, GLuint, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum, GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetProgramivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetProgramStringNV (GLuint, GLenum, GLubyte *);
-GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum, GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint, GLenum, GLdouble *);
-GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVertexAttribivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint, GLenum, GLvoid* *);
-GLAPI GLboolean APIENTRY glIsProgramNV (GLuint);
-GLAPI void APIENTRY glLoadProgramNV (GLenum, GLuint, GLsizei, const GLubyte *);
-GLAPI void APIENTRY glProgramParameter4dNV (GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glProgramParameter4dvNV (GLenum, GLuint, const GLdouble *);
-GLAPI void APIENTRY glProgramParameter4fNV (GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramParameter4fvNV (GLenum, GLuint, const GLfloat *);
-GLAPI void APIENTRY glProgramParameters4dvNV (GLenum, GLuint, GLuint, const GLdouble *);
-GLAPI void APIENTRY glProgramParameters4fvNV (GLenum, GLuint, GLuint, const GLfloat *);
-GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei, const GLuint *);
-GLAPI void APIENTRY glTrackMatrixNV (GLenum, GLuint, GLenum, GLenum);
-GLAPI void APIENTRY glVertexAttribPointerNV (GLuint, GLint, GLenum, GLsizei, const GLvoid *);
-GLAPI void APIENTRY glVertexAttrib1dNV (GLuint, GLdouble);
-GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib1fNV (GLuint, GLfloat);
-GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib1sNV (GLuint, GLshort);
-GLAPI void APIENTRY glVertexAttrib1svNV (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib2dNV (GLuint, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib2fNV (GLuint, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib2sNV (GLuint, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib2svNV (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib3dNV (GLuint, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib3fNV (GLuint, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib3sNV (GLuint, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib3svNV (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4dNV (GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVertexAttrib4fNV (GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVertexAttrib4sNV (GLuint, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexAttrib4svNV (GLuint, const GLshort *);
-GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
-GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint, GLsizei, const GLdouble *);
-GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glVertexAttribs1svNV (GLuint, GLsizei, const GLshort *);
-GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint, GLsizei, const GLdouble *);
-GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glVertexAttribs2svNV (GLuint, GLsizei, const GLshort *);
-GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint, GLsizei, const GLdouble *);
-GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glVertexAttribs3svNV (GLuint, GLsizei, const GLshort *);
-GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint, GLsizei, const GLdouble *);
-GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint, GLsizei, const GLfloat *);
-GLAPI void APIENTRY glVertexAttribs4svNV (GLuint, GLsizei, const GLshort *);
-GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint, GLsizei, const GLubyte *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);
-typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
-typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs);
-typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program);
-typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, GLvoid* *pointer);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLuint count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLuint count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
-typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v);
-#endif
-
-#ifndef GL_SGIX_texture_coordinate_clamp
-#define GL_SGIX_texture_coordinate_clamp 1
-#endif
-
-#ifndef GL_SGIX_scalebias_hint
-#define GL_SGIX_scalebias_hint 1
-#endif
-
-#ifndef GL_OML_interlace
-#define GL_OML_interlace 1
-#endif
-
-#ifndef GL_OML_subsample
-#define GL_OML_subsample 1
-#endif
-
-#ifndef GL_OML_resample
-#define GL_OML_resample 1
-#endif
-
-#ifndef GL_NV_copy_depth_to_color
-#define GL_NV_copy_depth_to_color 1
-#endif
-
-#ifndef GL_ATI_envmap_bumpmap
-#define GL_ATI_envmap_bumpmap 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexBumpParameterivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum, GLint *);
-GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param);
-typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param);
-typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);
-#endif
-
-#ifndef GL_ATI_fragment_shader
-#define GL_ATI_fragment_shader 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint);
-GLAPI void APIENTRY glBindFragmentShaderATI (GLuint);
-GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint);
-GLAPI void APIENTRY glBeginFragmentShaderATI (void);
-GLAPI void APIENTRY glEndFragmentShaderATI (void);
-GLAPI void APIENTRY glPassTexCoordATI (GLuint, GLuint, GLenum);
-GLAPI void APIENTRY glSampleMapATI (GLuint, GLuint, GLenum);
-GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint, const GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);
-typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void);
-typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void);
-typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);
-typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);
-typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
-typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
-typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
-typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
-typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
-typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
-typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value);
-#endif
-
-#ifndef GL_ATI_pn_triangles
-#define GL_ATI_pn_triangles 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPNTrianglesiATI (GLenum, GLint);
-GLAPI void APIENTRY glPNTrianglesfATI (GLenum, GLfloat);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);
-#endif
-
-#ifndef GL_ATI_vertex_array_object
-#define GL_ATI_vertex_array_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei, const GLvoid *, GLenum);
-GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint);
-GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint, GLuint, GLsizei, const GLvoid *, GLenum);
-GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetObjectBufferivATI (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glFreeObjectBufferATI (GLuint);
-GLAPI void APIENTRY glArrayObjectATI (GLenum, GLint, GLenum, GLsizei, GLuint, GLuint);
-GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetArrayObjectivATI (GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glVariantArrayObjectATI (GLuint, GLenum, GLsizei, GLuint, GLuint);
-GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint, GLenum, GLint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const GLvoid *pointer, GLenum usage);
-typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const GLvoid *pointer, GLenum preserve);
-typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
-typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
-typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params);
-#endif
-
-#ifndef GL_EXT_vertex_shader
-#define GL_EXT_vertex_shader 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginVertexShaderEXT (void);
-GLAPI void APIENTRY glEndVertexShaderEXT (void);
-GLAPI void APIENTRY glBindVertexShaderEXT (GLuint);
-GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint);
-GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint);
-GLAPI void APIENTRY glShaderOp1EXT (GLenum, GLuint, GLuint);
-GLAPI void APIENTRY glShaderOp2EXT (GLenum, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glShaderOp3EXT (GLenum, GLuint, GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glSwizzleEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glWriteMaskEXT (GLuint, GLuint, GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glInsertComponentEXT (GLuint, GLuint, GLuint);
-GLAPI void APIENTRY glExtractComponentEXT (GLuint, GLuint, GLuint);
-GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum, GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glSetInvariantEXT (GLuint, GLenum, const GLvoid *);
-GLAPI void APIENTRY glSetLocalConstantEXT (GLuint, GLenum, const GLvoid *);
-GLAPI void APIENTRY glVariantbvEXT (GLuint, const GLbyte *);
-GLAPI void APIENTRY glVariantsvEXT (GLuint, const GLshort *);
-GLAPI void APIENTRY glVariantivEXT (GLuint, const GLint *);
-GLAPI void APIENTRY glVariantfvEXT (GLuint, const GLfloat *);
-GLAPI void APIENTRY glVariantdvEXT (GLuint, const GLdouble *);
-GLAPI void APIENTRY glVariantubvEXT (GLuint, const GLubyte *);
-GLAPI void APIENTRY glVariantusvEXT (GLuint, const GLushort *);
-GLAPI void APIENTRY glVariantuivEXT (GLuint, const GLuint *);
-GLAPI void APIENTRY glVariantPointerEXT (GLuint, GLenum, GLuint, const GLvoid *);
-GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint);
-GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint);
-GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum, GLenum);
-GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum, GLenum);
-GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum, GLenum, GLenum);
-GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum, GLenum);
-GLAPI GLuint APIENTRY glBindParameterEXT (GLenum);
-GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint, GLenum);
-GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint, GLenum, GLboolean *);
-GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVariantPointervEXT (GLuint, GLenum, GLvoid* *);
-GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint, GLenum, GLboolean *);
-GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint, GLenum, GLboolean *);
-GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint, GLenum, GLfloat *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void);
-typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void);
-typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id);
-typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range);
-typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1);
-typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
-typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
-typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
-typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
-typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
-typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
-typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);
-typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr);
-typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const GLvoid *addr);
-typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr);
-typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr);
-typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr);
-typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr);
-typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr);
-typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr);
-typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr);
-typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr);
-typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const GLvoid *addr);
-typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
-typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value);
-typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value);
-typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value);
-typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value);
-typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value);
-typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap);
-typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, GLvoid* *data);
-typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-#endif
-
-#ifndef GL_ATI_vertex_streams
-#define GL_ATI_vertex_streams 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexStream1sATI (GLenum, GLshort);
-GLAPI void APIENTRY glVertexStream1svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glVertexStream1iATI (GLenum, GLint);
-GLAPI void APIENTRY glVertexStream1ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glVertexStream1fATI (GLenum, GLfloat);
-GLAPI void APIENTRY glVertexStream1fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glVertexStream1dATI (GLenum, GLdouble);
-GLAPI void APIENTRY glVertexStream1dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glVertexStream2sATI (GLenum, GLshort, GLshort);
-GLAPI void APIENTRY glVertexStream2svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glVertexStream2iATI (GLenum, GLint, GLint);
-GLAPI void APIENTRY glVertexStream2ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glVertexStream2fATI (GLenum, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexStream2fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glVertexStream2dATI (GLenum, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexStream2dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glVertexStream3sATI (GLenum, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexStream3svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glVertexStream3iATI (GLenum, GLint, GLint, GLint);
-GLAPI void APIENTRY glVertexStream3ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glVertexStream3fATI (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexStream3fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glVertexStream3dATI (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexStream3dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glVertexStream4sATI (GLenum, GLshort, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glVertexStream4svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glVertexStream4iATI (GLenum, GLint, GLint, GLint, GLint);
-GLAPI void APIENTRY glVertexStream4ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glVertexStream4fATI (GLenum, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glVertexStream4fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glVertexStream4dATI (GLenum, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glVertexStream4dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glNormalStream3bATI (GLenum, GLbyte, GLbyte, GLbyte);
-GLAPI void APIENTRY glNormalStream3bvATI (GLenum, const GLbyte *);
-GLAPI void APIENTRY glNormalStream3sATI (GLenum, GLshort, GLshort, GLshort);
-GLAPI void APIENTRY glNormalStream3svATI (GLenum, const GLshort *);
-GLAPI void APIENTRY glNormalStream3iATI (GLenum, GLint, GLint, GLint);
-GLAPI void APIENTRY glNormalStream3ivATI (GLenum, const GLint *);
-GLAPI void APIENTRY glNormalStream3fATI (GLenum, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glNormalStream3fvATI (GLenum, const GLfloat *);
-GLAPI void APIENTRY glNormalStream3dATI (GLenum, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glNormalStream3dvATI (GLenum, const GLdouble *);
-GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum);
-GLAPI void APIENTRY glVertexBlendEnviATI (GLenum, GLint);
-GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum, GLfloat);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream);
-typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param);
-#endif
-
-#ifndef GL_ATI_element_array
-#define GL_ATI_element_array 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glElementPointerATI (GLenum, const GLvoid *);
-GLAPI void APIENTRY glDrawElementArrayATI (GLenum, GLsizei);
-GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum, GLuint, GLuint, GLsizei);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);
-#endif
-
-#ifndef GL_SUN_mesh_array
-#define GL_SUN_mesh_array 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum, GLint, GLsizei, GLsizei);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width);
-#endif
-
-#ifndef GL_SUN_slice_accum
-#define GL_SUN_slice_accum 1
-#endif
-
-#ifndef GL_NV_multisample_filter_hint
-#define GL_NV_multisample_filter_hint 1
-#endif
-
-#ifndef GL_NV_depth_clamp
-#define GL_NV_depth_clamp 1
-#endif
-
-#ifndef GL_NV_occlusion_query
-#define GL_NV_occlusion_query 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei, const GLuint *);
-GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint);
-GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint);
-GLAPI void APIENTRY glEndOcclusionQueryNV (void);
-GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint, GLenum, GLint *);
-GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint, GLenum, GLuint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void);
-typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);
-#endif
-
-#ifndef GL_NV_point_sprite
-#define GL_NV_point_sprite 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameteriNV (GLenum, GLint);
-GLAPI void APIENTRY glPointParameterivNV (GLenum, const GLint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
-#endif
-
-#ifndef GL_NV_texture_shader3
-#define GL_NV_texture_shader3 1
-#endif
-
-#ifndef GL_NV_vertex_program1_1
-#define GL_NV_vertex_program1_1 1
-#endif
-
-#ifndef GL_EXT_shadow_funcs
-#define GL_EXT_shadow_funcs 1
-#endif
-
-#ifndef GL_EXT_stencil_two_side
-#define GL_EXT_stencil_two_side 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
-#endif
-
-#ifndef GL_ATI_text_fragment_shader
-#define GL_ATI_text_fragment_shader 1
-#endif
-
-#ifndef GL_APPLE_client_storage
-#define GL_APPLE_client_storage 1
-#endif
-
-#ifndef GL_APPLE_element_array
-#define GL_APPLE_element_array 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glElementPointerAPPLE (GLenum, const GLvoid *);
-GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum, GLint, GLsizei);
-GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, GLint, GLsizei);
-GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum, const GLint *, const GLsizei *, GLsizei);
-GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum, GLuint, GLuint, const GLint *, const GLsizei *, GLsizei);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const GLvoid *pointer);
-typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
-#endif
-
-#ifndef GL_APPLE_fence
-#define GL_APPLE_fence 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenFencesAPPLE (GLsizei, GLuint *);
-GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei, const GLuint *);
-GLAPI void APIENTRY glSetFenceAPPLE (GLuint);
-GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint);
-GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint);
-GLAPI void APIENTRY glFinishFenceAPPLE (GLuint);
-GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum, GLuint);
-GLAPI void APIENTRY glFinishObjectAPPLE (GLenum, GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences);
-typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences);
-typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence);
-typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence);
-typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence);
-typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence);
-typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name);
-typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);
-#endif
-
-#ifndef GL_APPLE_vertex_array_object
-#define GL_APPLE_vertex_array_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint);
-GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei, const GLuint *);
-GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);
-typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);
-typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);
-typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
-#endif
-
-#ifndef GL_APPLE_vertex_array_range
-#define GL_APPLE_vertex_array_range 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei, GLvoid *);
-GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei, GLvoid *);
-GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum, GLint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer);
-typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, GLvoid *pointer);
-typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param);
-#endif
-
-#ifndef GL_APPLE_ycbcr_422
-#define GL_APPLE_ycbcr_422 1
-#endif
-
-#ifndef GL_S3_s3tc
-#define GL_S3_s3tc 1
-#endif
-
-#ifndef GL_ATI_draw_buffers
-#define GL_ATI_draw_buffers 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawBuffersATI (GLsizei, const GLenum *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs);
-#endif
-
-#ifndef GL_ATI_pixel_format_float
-#define GL_ATI_pixel_format_float 1
-/* This is really a WGL extension, but defines some associated GL enums.
- * ATI does not export "GL_ATI_pixel_format_float" in the GL_EXTENSIONS string.
- */
-#endif
-
-#ifndef GL_ATI_texture_env_combine3
-#define GL_ATI_texture_env_combine3 1
-#endif
-
-#ifndef GL_ATI_texture_float
-#define GL_ATI_texture_float 1
-#endif
-
-#ifndef GL_NV_float_buffer
-#define GL_NV_float_buffer 1
-#endif
-
-#ifndef GL_NV_fragment_program
-#define GL_NV_fragment_program 1
-/* Some NV_fragment_program entry points are shared with ARB_vertex_program. */
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat);
-GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble);
-GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint, GLsizei, const GLubyte *, const GLfloat *);
-GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint, GLsizei, const GLubyte *, const GLdouble *);
-GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint, GLsizei, const GLubyte *, GLfloat *);
-GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint, GLsizei, const GLubyte *, GLdouble *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);
-typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);
-typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
-#endif
-
-#ifndef GL_NV_half_float
-#define GL_NV_half_float 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertex2hNV (GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glVertex3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glVertex4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glNormal3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glColor4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV);
-GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum, GLhalfNV);
-GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum, const GLhalfNV *);
-GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum, const GLhalfNV *);
-GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum, const GLhalfNV *);
-GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum, const GLhalfNV *);
-GLAPI void APIENTRY glFogCoordhNV (GLhalfNV);
-GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *);
-GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *);
-GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV);
-GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttrib1hNV (GLuint, GLhalfNV);
-GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttrib2hNV (GLuint, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttrib3hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttrib4hNV (GLuint, GLhalfNV, GLhalfNV, GLhalfNV, GLhalfNV);
-GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint, GLsizei, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint, GLsizei, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint, GLsizei, const GLhalfNV *);
-GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint, GLsizei, const GLhalfNV *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y);
-typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z);
-typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
-typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);
-typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
-typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);
-typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s);
-typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t);
-typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r);
-typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
-typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog);
-typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight);
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
-#endif
-
-#ifndef GL_NV_pixel_data_range
-#define GL_NV_pixel_data_range 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelDataRangeNV (GLenum, GLsizei, GLvoid *);
-GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, GLvoid *pointer);
-typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);
-#endif
-
-#ifndef GL_NV_primitive_restart
-#define GL_NV_primitive_restart 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPrimitiveRestartNV (void);
-GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void);
-typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);
-#endif
-
-#ifndef GL_NV_texture_expand_normal
-#define GL_NV_texture_expand_normal 1
-#endif
-
-#ifndef GL_NV_vertex_program2
-#define GL_NV_vertex_program2 1
-#endif
-
-#ifndef GL_ATI_map_object_buffer
-#define GL_ATI_map_object_buffer 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLvoid* APIENTRY glMapObjectBufferATI (GLuint);
-GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef GLvoid* (APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);
-#endif
-
-#ifndef GL_ATI_separate_stencil
-#define GL_ATI_separate_stencil 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStencilOpSeparateATI (GLenum, GLenum, GLenum, GLenum);
-GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum, GLenum, GLint, GLuint);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-#endif
-
-#ifndef GL_ATI_vertex_attrib_array_object
-#define GL_ATI_vertex_attrib_array_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint, GLint, GLenum, GLboolean, GLsizei, GLuint, GLuint);
-GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint, GLenum, GLfloat *);
-GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint, GLenum, GLint *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params);
-#endif
-
-#ifndef GL_OES_read_format
-#define GL_OES_read_format 1
-#endif
-
-#ifndef GL_EXT_depth_bounds_test
-#define GL_EXT_depth_bounds_test 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDepthBoundsEXT (GLclampd, GLclampd);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);
-#endif
-
-#ifndef GL_EXT_texture_mirror_clamp
-#define GL_EXT_texture_mirror_clamp 1
-#endif
-
-#ifndef GL_EXT_blend_equation_separate
-#define GL_EXT_blend_equation_separate 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum, GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);
-#endif
-
-#ifndef GL_MESA_pack_invert
-#define GL_MESA_pack_invert 1
-#endif
-
-#ifndef GL_MESA_ycbcr_texture
-#define GL_MESA_ycbcr_texture 1
-#endif
-
-#ifndef GL_EXT_pixel_buffer_object
-#define GL_EXT_pixel_buffer_object 1
-#endif
-
-#ifndef GL_NV_fragment_program_option
-#define GL_NV_fragment_program_option 1
-#endif
-
-#ifndef GL_NV_fragment_program2
-#define GL_NV_fragment_program2 1
-#endif
-
-#ifndef GL_NV_vertex_program2_option
-#define GL_NV_vertex_program2_option 1
-#endif
-
-#ifndef GL_NV_vertex_program3
-#define GL_NV_vertex_program3 1
-#endif
-
-#ifndef GL_EXT_framebuffer_object
-#define GL_EXT_framebuffer_object 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint);
-GLAPI void APIENTRY glBindRenderbufferEXT (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *);
-GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei);
-GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum, GLenum, GLint *);
-GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint);
-GLAPI void APIENTRY glBindFramebufferEXT (GLenum, GLuint);
-GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei, const GLuint *);
-GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei, GLuint *);
-GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum);
-GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
-GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLint);
-GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint);
-GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum, GLenum, GLenum, GLint *);
-GLAPI void APIENTRY glGenerateMipmapEXT (GLenum);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
-typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
-typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
-typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
-typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
-#endif
-
-#ifndef GL_GREMEDY_string_marker
-#define GL_GREMEDY_string_marker 1
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei, const GLvoid *);
-#endif /* GL_GLEXT_PROTOTYPES */
-typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const GLvoid *string);
-#endif
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
-#endif /* NO_SDL_GLEXT */
diff --git a/src/SDL12/include/SDL_platform.h b/src/SDL12/include/SDL_platform.h
deleted file mode 100644
index 80274bc..0000000
--- a/src/SDL12/include/SDL_platform.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Try to get a standard set of platform defines */
-
-#ifndef _SDL_platform_h
-#define _SDL_platform_h
-
-#if defined(_AIX)
-#undef __AIX__
-#define __AIX__ 1
-#endif
-#if defined(AMIGA) || defined(__AMIGA) || defined(__amigados__)
-#undef __AMIGA__
-#define __AMIGA__ 1
-#endif
-#if defined(__BEOS__)
-#undef __BEOS__
-#define __BEOS__ 1
-#endif
-#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
-#undef __BSDI__
-#define __BSDI__ 1
-#endif
-#if defined(_arch_dreamcast)
-#undef __DREAMCAST__
-#define __DREAMCAST__ 1
-#endif
-#if defined(__FreeBSD__) || defined(__DragonFly__)
-#undef __FREEBSD__
-#define __FREEBSD__ 1
-#endif
-#if defined(hpux) || defined(__hpux) || defined(__hpux__)
-#undef __HPUX__
-#define __HPUX__ 1
-#endif
-#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
-#undef __IRIX__
-#define __IRIX__ 1
-#endif
-#if defined(linux) || defined(__linux) || defined(__linux__)
-#undef __LINUX__
-#define __LINUX__ 1
-#endif
-#if defined(__APPLE__)
-#undef __MACOSX__
-#define __MACOSX__ 1
-#elif defined(macintosh)
-#undef __MACOS__
-#define __MACOS__ 1
-#endif
-#if defined(__NetBSD__)
-#undef __NETBSD__
-#define __NETBSD__ 1
-#endif
-#if defined(__OpenBSD__)
-#undef __OPENBSD__
-#define __OPENBSD__ 1
-#endif
-#if defined(__OS2__)
-#undef __OS2__
-#define __OS2__ 1
-#endif
-#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
-#undef __OSF__
-#define __OSF__ 1
-#endif
-#if defined(__QNXNTO__)
-#undef __QNXNTO__
-#define __QNXNTO__ 1
-#endif
-#if defined(riscos) || defined(__riscos) || defined(__riscos__)
-#undef __RISCOS__
-#define __RISCOS__ 1
-#endif
-#if defined(__SVR4)
-#undef __SOLARIS__
-#define __SOLARIS__ 1
-#endif
-#if defined(WIN32) || defined(_WIN32)
-#undef __WIN32__
-#define __WIN32__ 1
-#endif
-
-#endif /* _SDL_platform_h */
diff --git a/src/SDL12/include/SDL_quit.h b/src/SDL12/include/SDL_quit.h
deleted file mode 100644
index fcf40fb..0000000
--- a/src/SDL12/include/SDL_quit.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Include file for SDL quit event handling */
-
-#ifndef _SDL_quit_h
-#define _SDL_quit_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-/*
- An SDL_QUITEVENT is generated when the user tries to close the application
- window. If it is ignored or filtered out, the window will remain open.
- If it is not ignored or filtered, it is queued normally and the window
- is allowed to close. When the window is closed, screen updates will
- complete, but have no effect.
-
- SDL_Init() installs signal handlers for SIGINT (keyboard interrupt)
- and SIGTERM (system termination request), if handlers do not already
- exist, that generate SDL_QUITEVENT events as well. There is no way
- to determine the cause of an SDL_QUITEVENT, but setting a signal
- handler in your application will override the default generation of
- quit events for that signal.
-*/
-
-/* There are no functions directly affecting the quit event */
-#define SDL_QuitRequested() \
- (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK))
-
-#endif /* _SDL_quit_h */
diff --git a/src/SDL12/include/SDL_rwops.h b/src/SDL12/include/SDL_rwops.h
deleted file mode 100644
index d7e01d8..0000000
--- a/src/SDL12/include/SDL_rwops.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* This file provides a general interface for SDL to read and write
- data sources. It can easily be extended to files, memory, etc.
-*/
-
-#ifndef _SDL_rwops_h
-#define _SDL_rwops_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This is the read/write operation structure -- very basic */
-
-typedef struct SDL_RWops {
- /* Seek to 'offset' relative to whence, one of stdio's whence values:
- SEEK_SET, SEEK_CUR, SEEK_END
- Returns the final offset in the data source.
- */
- int (SDLCALL *seek)(struct SDL_RWops *context, int offset, int whence);
-
- /* Read up to 'num' objects each of size 'objsize' from the data
- source to the area pointed at by 'ptr'.
- Returns the number of objects read, or -1 if the read failed.
- */
- int (SDLCALL *read)(struct SDL_RWops *context, void *ptr, int size, int maxnum);
-
- /* Write exactly 'num' objects each of size 'objsize' from the area
- pointed at by 'ptr' to data source.
- Returns 'num', or -1 if the write failed.
- */
- int (SDLCALL *write)(struct SDL_RWops *context, const void *ptr, int size, int num);
-
- /* Close and free an allocated SDL_FSops structure */
- int (SDLCALL *close)(struct SDL_RWops *context);
-
- Uint32 type;
- union {
-#ifdef __WIN32__
- struct {
- int append;
- void* h;
- } win32io;
-#endif
-#ifdef HAVE_STDIO_H
- struct {
- int autoclose;
- FILE *fp;
- } stdio;
-#endif
- struct {
- Uint8 *base;
- Uint8 *here;
- Uint8 *stop;
- } mem;
- struct {
- void *data1;
- } unknown;
- } hidden;
-
-} SDL_RWops;
-
-
-/* Functions to create SDL_RWops structures from various data sources */
-
-extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFile(const char *file, const char *mode);
-
-#ifdef HAVE_STDIO_H
-extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromFP(FILE *fp, int autoclose);
-#endif
-
-extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromMem(void *mem, int size);
-extern DECLSPEC SDL_RWops * SDLCALL SDL_RWFromConstMem(const void *mem, int size);
-
-extern DECLSPEC SDL_RWops * SDLCALL SDL_AllocRW(void);
-extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops *area);
-
-#define RW_SEEK_SET 0 /* Seek from the beginning of data */
-#define RW_SEEK_CUR 1 /* Seek relative to current read point */
-#define RW_SEEK_END 2 /* Seek relative to the end of data */
-
-/* Macros to easily read and write from an SDL_RWops structure */
-#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence)
-#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, RW_SEEK_CUR)
-#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n)
-#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n)
-#define SDL_RWclose(ctx) (ctx)->close(ctx)
-
-
-/* Read an item of the specified endianness and return in native format */
-extern DECLSPEC Uint16 SDLCALL SDL_ReadLE16(SDL_RWops *src);
-extern DECLSPEC Uint16 SDLCALL SDL_ReadBE16(SDL_RWops *src);
-extern DECLSPEC Uint32 SDLCALL SDL_ReadLE32(SDL_RWops *src);
-extern DECLSPEC Uint32 SDLCALL SDL_ReadBE32(SDL_RWops *src);
-extern DECLSPEC Uint64 SDLCALL SDL_ReadLE64(SDL_RWops *src);
-extern DECLSPEC Uint64 SDLCALL SDL_ReadBE64(SDL_RWops *src);
-
-/* Write an item of native format to the specified endianness */
-extern DECLSPEC int SDLCALL SDL_WriteLE16(SDL_RWops *dst, Uint16 value);
-extern DECLSPEC int SDLCALL SDL_WriteBE16(SDL_RWops *dst, Uint16 value);
-extern DECLSPEC int SDLCALL SDL_WriteLE32(SDL_RWops *dst, Uint32 value);
-extern DECLSPEC int SDLCALL SDL_WriteBE32(SDL_RWops *dst, Uint32 value);
-extern DECLSPEC int SDLCALL SDL_WriteLE64(SDL_RWops *dst, Uint64 value);
-extern DECLSPEC int SDLCALL SDL_WriteBE64(SDL_RWops *dst, Uint64 value);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_rwops_h */
diff --git a/src/SDL12/include/SDL_stdinc.h b/src/SDL12/include/SDL_stdinc.h
deleted file mode 100644
index 6253562..0000000
--- a/src/SDL12/include/SDL_stdinc.h
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* This is a general header that includes C language support */
-
-#ifndef _SDL_stdinc_h
-#define _SDL_stdinc_h
-
-#include "SDL_config.h"
-
-
-#ifdef HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef HAVE_STDIO_H
-#include
-#endif
-#if defined(STDC_HEADERS)
-# include
-# include
-# include
-#else
-# if defined(HAVE_STDLIB_H)
-# include
-# elif defined(HAVE_MALLOC_H)
-# include
-# endif
-# if defined(HAVE_STDDEF_H)
-# include
-# endif
-# if defined(HAVE_STDARG_H)
-# include
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined(STDC_HEADERS) && defined(HAVE_MEMORY_H)
-# include
-# endif
-# include
-#endif
-#ifdef HAVE_STRINGS_H
-# include
-#endif
-#if defined(HAVE_INTTYPES_H)
-# include
-#elif defined(HAVE_STDINT_H)
-# include
-#endif
-#ifdef HAVE_CTYPE_H
-# include
-#endif
-#ifdef HAVE_ICONV_H
-# include
-#endif
-
-/* The number of elements in an array */
-#define SDL_arraysize(array) (sizeof(array)/sizeof(array[0]))
-#define SDL_TABLESIZE(table) SDL_arraysize(table)
-
-/* Basic data types */
-typedef enum SDL_bool {
- SDL_FALSE = 0,
- SDL_TRUE = 1
-} SDL_bool;
-
-typedef int8_t Sint8;
-typedef uint8_t Uint8;
-typedef int16_t Sint16;
-typedef uint16_t Uint16;
-typedef int32_t Sint32;
-typedef uint32_t Uint32;
-
-#ifdef SDL_HAS_64BIT_TYPE
-typedef int64_t Sint64;
-typedef uint64_t Uint64;
-#else
-/* This is really just a hack to prevent the compiler from complaining */
-typedef struct {
- Uint32 hi;
- Uint32 lo;
-} Uint64, Sint64;
-#endif
-
-/* Make sure the types really have the right sizes */
-#define SDL_COMPILE_TIME_ASSERT(name, x) \
- typedef int SDL_dummy_ ## name[(x) * 2 - 1]
-
-SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1);
-SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1);
-SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2);
-SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2);
-SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4);
-SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4);
-SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8);
-SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
-
-/* Check to make sure enums are the size of ints, for structure packing.
- For both Watcom C/C++ and Borland C/C++ the compiler option that makes
- enums having the size of an int must be enabled.
- This is "-b" for Borland C/C++ and "-ei" for Watcom C/C++ (v11).
-*/
-/* Enable enums always int in CodeWarrior (for MPW use "-enum int") */
-#ifdef __MWERKS__
-#pragma enumsalwaysint on
-#endif
-
-typedef enum {
- DUMMY_ENUM_VALUE
-} SDL_DUMMY_ENUM;
-
-SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int));
-
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef HAVE_MALLOC
-#define SDL_malloc malloc
-#else
-extern DECLSPEC void * SDLCALL SDL_malloc(size_t size);
-#endif
-
-#ifdef HAVE_CALLOC
-#define SDL_calloc calloc
-#else
-extern DECLSPEC void * SDLCALL SDL_calloc(size_t nmemb, size_t size);
-#endif
-
-#ifdef HAVE_REALLOC
-#define SDL_realloc realloc
-#else
-extern DECLSPEC void * SDLCALL SDL_realloc(void *mem, size_t size);
-#endif
-
-#ifdef HAVE_FREE
-#define SDL_free free
-#else
-extern DECLSPEC void SDLCALL SDL_free(void *mem);
-#endif
-
-#if defined(HAVE_ALLOCA) && !defined(alloca)
-# if defined(HAVE_ALLOCA_H)
-# include
-# elif defined(__GNUC__)
-# define alloca __builtin_alloca
-# elif defined(_MSC_VER)
-# include
-# define alloca _alloca
-# elif defined(__WATCOMC__)
-# include
-# elif defined(__DMC__)
-# include
-# elif defined(__AIX__)
- #pragma alloca
-# elif defined(__MRC__)
- void *alloca (unsigned);
-# else
- char *alloca ();
-# endif
-#endif
-#ifdef HAVE_ALLOCA
-#define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*count)
-#define SDL_stack_free(data)
-#else
-#define SDL_stack_alloc(type, count) (type*)SDL_malloc(sizeof(type)*count)
-#define SDL_stack_free(data) SDL_free(data)
-#endif
-
-#ifdef HAVE_GETENV
-#define SDL_getenv getenv
-#else
-extern DECLSPEC char * SDLCALL SDL_getenv(const char *name);
-#endif
-
-#ifdef HAVE_PUTENV
-#define SDL_putenv putenv
-#else
-extern DECLSPEC int SDLCALL SDL_putenv(const char *variable);
-#endif
-
-#ifdef HAVE_QSORT
-#define SDL_qsort qsort
-#else
-extern DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size,
- int (*compare)(const void *, const void *));
-#endif
-
-#ifdef HAVE_ABS
-#define SDL_abs abs
-#else
-#define SDL_abs(X) ((X) < 0 ? -(X) : (X))
-#endif
-
-#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
-#define SDL_max(x, y) (((x) > (y)) ? (x) : (y))
-
-#ifdef HAVE_CTYPE_H
-#define SDL_isdigit(X) isdigit(X)
-#define SDL_isspace(X) isspace(X)
-#define SDL_toupper(X) toupper(X)
-#define SDL_tolower(X) tolower(X)
-#else
-#define SDL_isdigit(X) (((X) >= '0') && ((X) <= '9'))
-#define SDL_isspace(X) (((X) == ' ') || ((X) == '\t') || ((X) == '\r') || ((X) == '\n'))
-#define SDL_toupper(X) (((X) >= 'a') && ((X) <= 'z') ? ('A'+((X)-'a')) : (X))
-#define SDL_tolower(X) (((X) >= 'A') && ((X) <= 'Z') ? ('a'+((X)-'A')) : (X))
-#endif
-
-#ifdef HAVE_MEMSET
-#define SDL_memset memset
-#else
-extern DECLSPEC void * SDLCALL SDL_memset(void *dst, int c, size_t len);
-#endif
-
-#if defined(__GNUC__) && defined(i386)
-#define SDL_memset4(dst, val, len) \
-do { \
- int u0, u1, u2; \
- __asm__ __volatile__ ( \
- "cld\n\t" \
- "rep ; stosl\n\t" \
- : "=&D" (u0), "=&a" (u1), "=&c" (u2) \
- : "0" (dst), "1" (val), "2" ((Uint32)(len)) \
- : "memory" ); \
-} while(0)
-#endif
-#ifndef SDL_memset4
-#define SDL_memset4(dst, val, len) \
-do { \
- unsigned _count = (len); \
- unsigned _n = (_count + 3) / 4; \
- Uint32 *_p = (Uint32 *)(dst); \
- Uint32 _val = (val); \
- switch (_count % 4) { \
- case 0: do { *_p++ = _val; \
- case 3: *_p++ = _val; \
- case 2: *_p++ = _val; \
- case 1: *_p++ = _val; \
- } while ( --_n ); \
- } \
-} while(0)
-#endif
-
-#if defined(__GNUC__) && defined(i386)
-#define SDL_memcpy(dst, src, len) \
-do { \
- int u0, u1, u2; \
- __asm__ __volatile__ ( \
- "cld\n\t" \
- "rep ; movsl\n\t" \
- "testb $2,%b4\n\t" \
- "je 1f\n\t" \
- "movsw\n" \
- "1:\ttestb $1,%b4\n\t" \
- "je 2f\n\t" \
- "movsb\n" \
- "2:" \
- : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
- : "0" ((unsigned)(len)/4), "q" (len), "1" (dst),"2" (src) \
- : "memory" ); \
-} while(0)
-#endif
-#ifndef SDL_memcpy
-#ifdef HAVE_MEMCPY
-#define SDL_memcpy memcpy
-#elif defined(HAVE_BCOPY)
-#define SDL_memcpy(d, s, n) bcopy((s), (d), (n))
-#else
-extern DECLSPEC void * SDLCALL SDL_memcpy(void *dst, const void *src, size_t len);
-#endif
-#endif
-
-#if defined(__GNUC__) && defined(i386)
-#define SDL_memcpy4(dst, src, len) \
-do { \
- int ecx, edi, esi; \
- __asm__ __volatile__ ( \
- "cld\n\t" \
- "rep ; movsl" \
- : "=&c" (ecx), "=&D" (edi), "=&S" (esi) \
- : "0" ((unsigned)(len)), "1" (dst), "2" (src) \
- : "memory" ); \
-} while(0)
-#endif
-#ifndef SDL_memcpy4
-#define SDL_memcpy4(dst, src, len) SDL_memcpy(dst, src, (len) << 2)
-#endif
-
-#if defined(__GNUC__) && defined(i386)
-#define SDL_revcpy(dst, src, len) \
-do { \
- int u0, u1, u2; \
- char *dstp = (char *)(dst); \
- char *srcp = (char *)(src); \
- int n = (len); \
- if ( n >= 4 ) { \
- __asm__ __volatile__ ( \
- "std\n\t" \
- "rep ; movsl\n\t" \
- : "=&c" (u0), "=&D" (u1), "=&S" (u2) \
- : "0" (n >> 2), \
- "1" (dstp+(n-4)), "2" (srcp+(n-4)) \
- : "memory" ); \
- } \
- switch (n & 3) { \
- case 3: dstp[2] = srcp[2]; \
- case 2: dstp[1] = srcp[1]; \
- case 1: dstp[0] = srcp[0]; \
- break; \
- default: \
- break; \
- } \
-} while(0)
-#endif
-#ifndef SDL_revcpy
-extern DECLSPEC void * SDLCALL SDL_revcpy(void *dst, const void *src, size_t len);
-#endif
-
-#ifdef HAVE_MEMMOVE
-#define SDL_memmove memmove
-#elif defined(HAVE_BCOPY)
-#define SDL_memmove(d, s, n) bcopy((s), (d), (n))
-#else
-#define SDL_memmove(dst, src, len) \
-do { \
- if ( dst < src ) { \
- SDL_memcpy(dst, src, len); \
- } else { \
- SDL_revcpy(dst, src, len); \
- } \
-} while(0)
-#endif
-
-#ifdef HAVE_MEMCMP
-#define SDL_memcmp memcmp
-#else
-extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t len);
-#endif
-
-#ifdef HAVE_STRLEN
-#define SDL_strlen strlen
-#else
-extern DECLSPEC size_t SDLCALL SDL_strlen(const char *string);
-#endif
-
-#ifdef HAVE_STRLCPY
-#define SDL_strlcpy strlcpy
-#else
-extern DECLSPEC size_t SDLCALL SDL_strlcpy(char *dst, const char *src, size_t maxlen);
-#endif
-
-#ifdef HAVE_STRLCAT
-#define SDL_strlcat strlcat
-#else
-extern DECLSPEC size_t SDLCALL SDL_strlcat(char *dst, const char *src, size_t maxlen);
-#endif
-
-#ifdef HAVE_STRDUP
-#define SDL_strdup strdup
-#else
-extern DECLSPEC char * SDLCALL SDL_strdup(const char *string);
-#endif
-
-#ifdef HAVE__STRREV
-#define SDL_strrev _strrev
-#else
-extern DECLSPEC char * SDLCALL SDL_strrev(char *string);
-#endif
-
-#ifdef HAVE__STRUPR
-#define SDL_strupr _strupr
-#else
-extern DECLSPEC char * SDLCALL SDL_strupr(char *string);
-#endif
-
-#ifdef HAVE__STRLWR
-#define SDL_strlwr _strlwr
-#else
-extern DECLSPEC char * SDLCALL SDL_strlwr(char *string);
-#endif
-
-#ifdef HAVE_STRCHR
-#define SDL_strchr strchr
-#elif defined(HAVE_INDEX)
-#define SDL_strchr index
-#else
-extern DECLSPEC char * SDLCALL SDL_strchr(const char *string, int c);
-#endif
-
-#ifdef HAVE_STRRCHR
-#define SDL_strrchr strrchr
-#elif defined(HAVE_RINDEX)
-#define SDL_strrchr rindex
-#else
-extern DECLSPEC char * SDLCALL SDL_strrchr(const char *string, int c);
-#endif
-
-#ifdef HAVE_STRSTR
-#define SDL_strstr strstr
-#else
-extern DECLSPEC char * SDLCALL SDL_strstr(const char *haystack, const char *needle);
-#endif
-
-#ifdef HAVE_ITOA
-#define SDL_itoa itoa
-#else
-#define SDL_itoa(value, string, radix) SDL_ltoa((long)value, string, radix)
-#endif
-
-#ifdef HAVE__LTOA
-#define SDL_ltoa _ltoa
-#else
-extern DECLSPEC char * SDLCALL SDL_ltoa(long value, char *string, int radix);
-#endif
-
-#ifdef HAVE__UITOA
-#define SDL_uitoa _uitoa
-#else
-#define SDL_uitoa(value, string, radix) SDL_ultoa((long)value, string, radix)
-#endif
-
-#ifdef HAVE__ULTOA
-#define SDL_ultoa _ultoa
-#else
-extern DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *string, int radix);
-#endif
-
-#ifdef HAVE_STRTOL
-#define SDL_strtol strtol
-#else
-extern DECLSPEC long SDLCALL SDL_strtol(const char *string, char **endp, int base);
-#endif
-
-#ifdef HAVE_STRTOUL
-#define SDL_strtoul strtoul
-#else
-extern DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *string, char **endp, int base);
-#endif
-
-#ifdef SDL_HAS_64BIT_TYPE
-
-#ifdef HAVE__I64TOA
-#define SDL_lltoa _i64toa
-#else
-extern DECLSPEC char* SDLCALL SDL_lltoa(Sint64 value, char *string, int radix);
-#endif
-
-#ifdef HAVE__UI64TOA
-#define SDL_ulltoa _ui64toa
-#else
-extern DECLSPEC char* SDLCALL SDL_ulltoa(Uint64 value, char *string, int radix);
-#endif
-
-#ifdef HAVE_STRTOLL
-#define SDL_strtoll strtoll
-#else
-extern DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *string, char **endp, int base);
-#endif
-
-#ifdef HAVE_STRTOULL
-#define SDL_strtoull strtoull
-#else
-extern DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *string, char **endp, int base);
-#endif
-
-#endif /* SDL_HAS_64BIT_TYPE */
-
-#ifdef HAVE_STRTOD
-#define SDL_strtod strtod
-#else
-extern DECLSPEC double SDLCALL SDL_strtod(const char *string, char **endp);
-#endif
-
-#ifdef HAVE_ATOI
-#define SDL_atoi atoi
-#else
-#define SDL_atoi(X) SDL_strtol(X, NULL, 0)
-#endif
-
-#ifdef HAVE_ATOF
-#define SDL_atof atof
-#else
-#define SDL_atof(X) SDL_strtod(X, NULL)
-#endif
-
-#ifdef HAVE_STRCMP
-#define SDL_strcmp strcmp
-#else
-extern DECLSPEC int SDLCALL SDL_strcmp(const char *str1, const char *str2);
-#endif
-
-#ifdef HAVE_STRNCMP
-#define SDL_strncmp strncmp
-#else
-extern DECLSPEC int SDLCALL SDL_strncmp(const char *str1, const char *str2, size_t maxlen);
-#endif
-
-#ifdef HAVE_STRCASECMP
-#define SDL_strcasecmp strcasecmp
-#elif defined(HAVE__STRICMP)
-#define SDL_strcasecmp _stricmp
-#else
-extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2);
-#endif
-
-#ifdef HAVE_STRNCASECMP
-#define SDL_strncasecmp strncasecmp
-#elif defined(HAVE__STRNICMP)
-#define SDL_strncasecmp _strnicmp
-#else
-extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen);
-#endif
-
-#ifdef HAVE_SSCANF
-#define SDL_sscanf sscanf
-#else
-extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, const char *fmt, ...);
-#endif
-
-#ifdef HAVE_SNPRINTF
-#define SDL_snprintf snprintf
-#else
-extern DECLSPEC int SDLCALL SDL_snprintf(char *text, size_t maxlen, const char *fmt, ...);
-#endif
-
-#ifdef HAVE_VSNPRINTF
-#define SDL_vsnprintf vsnprintf
-#else
-extern DECLSPEC int SDLCALL SDL_vsnprintf(char *text, size_t maxlen, const char *fmt, va_list ap);
-#endif
-
-/* The SDL implementation of iconv() returns these error codes */
-#define SDL_ICONV_ERROR (size_t)-1
-#define SDL_ICONV_E2BIG (size_t)-2
-#define SDL_ICONV_EILSEQ (size_t)-3
-#define SDL_ICONV_EINVAL (size_t)-4
-
-#ifdef HAVE_ICONV
-#define SDL_iconv_t iconv_t
-#define SDL_iconv_open iconv_open
-#define SDL_iconv_close iconv_close
-extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
-#else
-typedef struct _SDL_iconv_t *SDL_iconv_t;
-extern DECLSPEC SDL_iconv_t SDLCALL SDL_iconv_open(const char *tocode, const char *fromcode);
-extern DECLSPEC int SDLCALL SDL_iconv_close(SDL_iconv_t cd);
-extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft);
-#endif
-/* This function converts a string between encodings in one pass, returning a
- string that must be freed with SDL_free() or NULL on error.
-*/
-extern DECLSPEC char * SDLCALL SDL_iconv_string(const char *tocode, const char *fromcode, char *inbuf, size_t inbytesleft);
-#define SDL_iconv_utf8_ascii(S) SDL_iconv_string("ASCII", "UTF-8", S, SDL_strlen(S)+1)
-#define SDL_iconv_utf8_latin1(S) SDL_iconv_string("LATIN1", "UTF-8", S, SDL_strlen(S)+1)
-#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1)
-#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1)
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_stdinc_h */
diff --git a/src/SDL12/include/SDL_syswm.h b/src/SDL12/include/SDL_syswm.h
deleted file mode 100644
index e7f3513..0000000
--- a/src/SDL12/include/SDL_syswm.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Include file for SDL custom system window manager hooks */
-
-#ifndef _SDL_syswm_h
-#define _SDL_syswm_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_version.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Your application has access to a special type of event 'SDL_SYSWMEVENT',
- which contains window-manager specific information and arrives whenever
- an unhandled window event occurs. This event is ignored by default, but
- you can enable it with SDL_EventState()
-*/
-#ifdef SDL_PROTOTYPES_ONLY
-struct SDL_SysWMinfo;
-typedef struct SDL_SysWMinfo SDL_SysWMinfo;
-#else
-
-/* This is the structure for custom window manager events */
-#if defined(SDL_VIDEO_DRIVER_X11)
-#if defined(__APPLE__) && defined(__MACH__)
-/* conflicts with Quickdraw.h */
-#define Cursor X11Cursor
-#endif
-
-#include
-#include
-
-#if defined(__APPLE__) && defined(__MACH__)
-/* matches the re-define above */
-#undef Cursor
-#endif
-
-/* These are the various supported subsystems under UNIX */
-typedef enum {
- SDL_SYSWM_X11
-} SDL_SYSWM_TYPE;
-
-/* The UNIX custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- SDL_SYSWM_TYPE subsystem;
- union {
- XEvent xevent;
- } event;
-};
-
-/* The UNIX custom window manager information structure.
- When this structure is returned, it holds information about which
- low level system it is using, and will be one of SDL_SYSWM_TYPE.
- */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- SDL_SYSWM_TYPE subsystem;
- union {
- struct {
- Display *display; /* The X11 display */
- Window window; /* The X11 display window */
- /* These locking functions should be called around
- any X11 functions using the display variable.
- They lock the event thread, so should not be
- called around event functions or from event filters.
- */
- void (*lock_func)(void);
- void (*unlock_func)(void);
-
- /* Introduced in SDL 1.0.2 */
- Window fswindow; /* The X11 fullscreen window */
- Window wmwindow; /* The X11 managed input window */
- } x11;
- } info;
-} SDL_SysWMinfo;
-
-#elif defined(SDL_VIDEO_DRIVER_NANOX)
-#include
-
-/* The generic custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- int data;
-};
-
-/* The windows custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version ;
- GR_WINDOW_ID window ; /* The display window */
-} SDL_SysWMinfo;
-
-#elif defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
-#define WIN32_LEAN_AND_MEAN
-#include
-
-/* The windows custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- HWND hwnd; /* The window for the message */
- UINT msg; /* The type of message */
- WPARAM wParam; /* WORD message parameter */
- LPARAM lParam; /* LONG message parameter */
-};
-
-/* The windows custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- HWND window; /* The Win32 display window */
- HGLRC hglrc; /* The OpenGL context, if any */
-} SDL_SysWMinfo;
-
-#elif defined(SDL_VIDEO_DRIVER_RISCOS)
-
-/* RISC OS custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- int eventCode; /* The window for the message */
- int pollBlock[64];
-};
-
-/* The RISC OS custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- int wimpVersion; /* Wimp version running under */
- int taskHandle; /* The RISC OS task handle */
- int window; /* The RISC OS display window */
-} SDL_SysWMinfo;
-
-#elif defined(SDL_VIDEO_DRIVER_PHOTON)
-#include
-#include
-
-/* The QNX custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- int data;
-};
-
-/* The QNX custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- int data;
-} SDL_SysWMinfo;
-
-#else
-
-/* The generic custom event structure */
-struct SDL_SysWMmsg {
- SDL_version version;
- int data;
-};
-
-/* The generic custom window manager information structure */
-typedef struct SDL_SysWMinfo {
- SDL_version version;
- int data;
-} SDL_SysWMinfo;
-
-#endif /* video driver type */
-
-#endif /* SDL_PROTOTYPES_ONLY */
-
-/* Function prototypes */
-/*
- * This function gives you custom hooks into the window manager information.
- * It fills the structure pointed to by 'info' with custom information and
- * returns 1 if the function is implemented. If it's not implemented, or
- * the version member of the 'info' structure is invalid, it returns 0.
- *
- * You typically use this function like this:
- * SDL_SysWMInfo info;
- * SDL_VERSION(&info.version);
- * if ( SDL_GetWMInfo(&info) ) { ... }
- */
-extern DECLSPEC int SDLCALL SDL_GetWMInfo(SDL_SysWMinfo *info);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_syswm_h */
diff --git a/src/SDL12/include/SDL_thread.h b/src/SDL12/include/SDL_thread.h
deleted file mode 100644
index e0a35b1..0000000
--- a/src/SDL12/include/SDL_thread.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_thread_h
-#define _SDL_thread_h
-
-/* Header for the SDL thread management routines
-
- These are independent of the other SDL routines.
-*/
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-/* Thread synchronization primitives */
-#include "SDL_mutex.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* The SDL thread structure, defined in SDL_thread.c */
-struct SDL_Thread;
-typedef struct SDL_Thread SDL_Thread;
-
-/* Create a thread */
-#if (defined(__WIN32__) && !defined(HAVE_LIBC)) || defined(__OS2__)
-/*
- We compile SDL into a DLL on OS/2. This means, that it's the DLL which
- creates a new thread for the calling process with the SDL_CreateThread()
- API. There is a problem with this, that only the RTL of the SDL.DLL will
- be initialized for those threads, and not the RTL of the calling application!
- To solve this, we make a little hack here.
- We'll always use the caller's _beginthread() and _endthread() APIs to
- start a new thread. This way, if it's the SDL.DLL which uses this API,
- then the RTL of SDL.DLL will be used to create the new thread, and if it's
- the application, then the RTL of the application will be used.
- So, in short:
- Always use the _beginthread() and _endthread() of the calling runtime library!
-*/
-#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#ifndef _WIN32_WCE
-#include /* This has _beginthread() and _endthread() defined! */
-#endif
-
-#ifdef __OS2__
-typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void *arg);
-typedef void (*pfnSDL_CurrentEndThread)(void);
-#elif __GNUC__
-typedef unsigned long (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *func)(void *), void *arg,
- unsigned, unsigned *threadID);
-typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
-#else
-typedef uintptr_t (__cdecl *pfnSDL_CurrentBeginThread) (void *, unsigned,
- unsigned (__stdcall *func)(void *), void *arg,
- unsigned, unsigned *threadID);
-typedef void (__cdecl *pfnSDL_CurrentEndThread)(unsigned code);
-#endif
-
-extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data, pfnSDL_CurrentBeginThread pfnBeginThread, pfnSDL_CurrentEndThread pfnEndThread);
-
-#ifdef __OS2__
-#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthread, _endthread)
-#elif defined(_WIN32_WCE)
-#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, NULL, NULL)
-#else
-#define SDL_CreateThread(fn, data) SDL_CreateThread(fn, data, _beginthreadex, _endthreadex)
-#endif
-#else
-extern DECLSPEC SDL_Thread * SDLCALL SDL_CreateThread(int (SDLCALL *fn)(void *), void *data);
-#endif
-
-/* Get the 32-bit thread identifier for the current thread */
-extern DECLSPEC Uint32 SDLCALL SDL_ThreadID(void);
-
-/* Get the 32-bit thread identifier for the specified thread,
- equivalent to SDL_ThreadID() if the specified thread is NULL.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetThreadID(SDL_Thread *thread);
-
-/* Wait for a thread to finish.
- The return code for the thread function is placed in the area
- pointed to by 'status', if 'status' is not NULL.
- */
-extern DECLSPEC void SDLCALL SDL_WaitThread(SDL_Thread *thread, int *status);
-
-/* Forcefully kill a thread without worrying about its state */
-extern DECLSPEC void SDLCALL SDL_KillThread(SDL_Thread *thread);
-
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_thread_h */
diff --git a/src/SDL12/include/SDL_timer.h b/src/SDL12/include/SDL_timer.h
deleted file mode 100644
index d21159f..0000000
--- a/src/SDL12/include/SDL_timer.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-#ifndef _SDL_timer_h
-#define _SDL_timer_h
-
-/* Header for the SDL time management routines */
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This is the OS scheduler timeslice, in milliseconds */
-#define SDL_TIMESLICE 10
-
-/* This is the maximum resolution of the SDL timer on all platforms */
-#define TIMER_RESOLUTION 10 /* Experimentally determined */
-
-/* Get the number of milliseconds since the SDL library initialization.
- * Note that this value wraps if the program runs for more than ~49 days.
- */
-extern DECLSPEC Uint32 SDLCALL SDL_GetTicks(void);
-
-/* Wait a specified number of milliseconds before returning */
-extern DECLSPEC void SDLCALL SDL_Delay(Uint32 ms);
-
-/* Function prototype for the timer callback function */
-typedef Uint32 (SDLCALL *SDL_TimerCallback)(Uint32 interval);
-
-/* Set a callback to run after the specified number of milliseconds has
- * elapsed. The callback function is passed the current timer interval
- * and returns the next timer interval. If the returned value is the
- * same as the one passed in, the periodic alarm continues, otherwise a
- * new alarm is scheduled. If the callback returns 0, the periodic alarm
- * is cancelled.
- *
- * To cancel a currently running timer, call SDL_SetTimer(0, NULL);
- *
- * The timer callback function may run in a different thread than your
- * main code, and so shouldn't call any functions from within itself.
- *
- * The maximum resolution of this timer is 10 ms, which means that if
- * you request a 16 ms timer, your callback will run approximately 20 ms
- * later on an unloaded system. If you wanted to set a flag signaling
- * a frame update at 30 frames per second (every 33 ms), you might set a
- * timer for 30 ms:
- * SDL_SetTimer((33/10)*10, flag_update);
- *
- * If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init().
- *
- * Under UNIX, you should not use raise or use SIGALRM and this function
- * in the same program, as it is implemented using setitimer(). You also
- * should not use this function in multi-threaded applications as signals
- * to multi-threaded apps have undefined behavior in some implementations.
- *
- * This function returns 0 if successful, or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);
-
-/* New timer API, supports multiple timers
- * Written by Stephane Peter
- */
-
-/* Function prototype for the new timer callback function.
- * The callback function is passed the current timer interval and returns
- * the next timer interval. If the returned value is the same as the one
- * passed in, the periodic alarm continues, otherwise a new alarm is
- * scheduled. If the callback returns 0, the periodic alarm is cancelled.
- */
-typedef Uint32 (SDLCALL *SDL_NewTimerCallback)(Uint32 interval, void *param);
-
-/* Definition of the timer ID type */
-typedef struct _SDL_TimerID *SDL_TimerID;
-
-/* Add a new timer to the pool of timers already running.
- Returns a timer ID, or NULL when an error occurs.
- */
-extern DECLSPEC SDL_TimerID SDLCALL SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);
-
-/* Remove one of the multiple timers knowing its ID.
- * Returns a boolean value indicating success.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID t);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_timer_h */
diff --git a/src/SDL12/include/SDL_types.h b/src/SDL12/include/SDL_types.h
deleted file mode 100644
index 853b9ce..0000000
--- a/src/SDL12/include/SDL_types.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* DEPRECATED */
-#include "SDL_stdinc.h"
diff --git a/src/SDL12/include/SDL_version.h b/src/SDL12/include/SDL_version.h
deleted file mode 100644
index 262aa7b..0000000
--- a/src/SDL12/include/SDL_version.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* This header defines the current SDL version */
-
-#ifndef _SDL_version_h
-#define _SDL_version_h
-
-#include "SDL_stdinc.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
-*/
-#define SDL_MAJOR_VERSION 1
-#define SDL_MINOR_VERSION 2
-#define SDL_PATCHLEVEL 11
-
-typedef struct SDL_version {
- Uint8 major;
- Uint8 minor;
- Uint8 patch;
-} SDL_version;
-
-/* This macro can be used to fill a version structure with the compile-time
- * version of the SDL library.
- */
-#define SDL_VERSION(X) \
-{ \
- (X)->major = SDL_MAJOR_VERSION; \
- (X)->minor = SDL_MINOR_VERSION; \
- (X)->patch = SDL_PATCHLEVEL; \
-}
-
-/* This macro turns the version numbers into a numeric value:
- (1,2,3) -> (1203)
- This assumes that there will never be more than 100 patchlevels
-*/
-#define SDL_VERSIONNUM(X, Y, Z) \
- ((X)*1000 + (Y)*100 + (Z))
-
-/* This is the version number macro for the current SDL version */
-#define SDL_COMPILEDVERSION \
- SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
-
-/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */
-#define SDL_VERSION_ATLEAST(X, Y, Z) \
- (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
-
-/* This function gets the version of the dynamically linked SDL library.
- it should NOT be used to fill a version structure, instead you should
- use the SDL_Version() macro.
- */
-extern DECLSPEC const SDL_version * SDLCALL SDL_Linked_Version(void);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_version_h */
diff --git a/src/SDL12/include/SDL_video.h b/src/SDL12/include/SDL_video.h
deleted file mode 100644
index 720022e..0000000
--- a/src/SDL12/include/SDL_video.h
+++ /dev/null
@@ -1,889 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2006 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* Header file for access to the SDL raw framebuffer window */
-
-#ifndef _SDL_video_h
-#define _SDL_video_h
-
-#include "SDL_stdinc.h"
-#include "SDL_error.h"
-#include "SDL_rwops.h"
-
-#include "begin_code.h"
-/* Set up for C function definitions, even when using C++ */
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Transparency definitions: These define alpha as the opacity of a surface */
-#define SDL_ALPHA_OPAQUE 255
-#define SDL_ALPHA_TRANSPARENT 0
-
-/* Useful data types */
-typedef struct SDL_Rect {
- Sint16 x, y;
- Uint16 w, h;
-} SDL_Rect;
-
-typedef struct SDL_Color {
- Uint8 r;
- Uint8 g;
- Uint8 b;
- Uint8 unused;
-} SDL_Color;
-#define SDL_Colour SDL_Color
-
-typedef struct SDL_Palette {
- int ncolors;
- SDL_Color *colors;
-} SDL_Palette;
-
-/* Everything in the pixel format structure is read-only */
-typedef struct SDL_PixelFormat {
- SDL_Palette *palette;
- Uint8 BitsPerPixel;
- Uint8 BytesPerPixel;
- Uint8 Rloss;
- Uint8 Gloss;
- Uint8 Bloss;
- Uint8 Aloss;
- Uint8 Rshift;
- Uint8 Gshift;
- Uint8 Bshift;
- Uint8 Ashift;
- Uint32 Rmask;
- Uint32 Gmask;
- Uint32 Bmask;
- Uint32 Amask;
-
- /* RGB color key information */
- Uint32 colorkey;
- /* Alpha value information (per-surface alpha) */
- Uint8 alpha;
-} SDL_PixelFormat;
-
-/* This structure should be treated as read-only, except for 'pixels',
- which, if not NULL, contains the raw pixel data for the surface.
-*/
-typedef struct SDL_Surface {
- Uint32 flags; /* Read-only */
- SDL_PixelFormat *format; /* Read-only */
- int w, h; /* Read-only */
- Uint16 pitch; /* Read-only */
- void *pixels; /* Read-write */
- int offset; /* Private */
-
- /* Hardware-specific surface info */
- struct private_hwdata *hwdata;
-
- /* clipping information */
- SDL_Rect clip_rect; /* Read-only */
- Uint32 unused1; /* for binary compatibility */
-
- /* Allow recursive locks */
- Uint32 locked; /* Private */
-
- /* info for fast blit mapping to other surfaces */
- struct SDL_BlitMap *map; /* Private */
-
- /* format version, bumped at every change to invalidate blit maps */
- unsigned int format_version; /* Private */
-
- /* Reference count -- used when freeing surface */
- int refcount; /* Read-mostly */
-} SDL_Surface;
-
-/* These are the currently supported flags for the SDL_surface */
-/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */
-#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */
-#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */
-#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */
-/* Available for SDL_SetVideoMode() */
-#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
-#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */
-#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */
-#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */
-#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */
-#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */
-#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */
-#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */
-/* Used internally (read-only) */
-#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */
-#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */
-#define SDL_RLEACCELOK 0x00002000 /* Private flag */
-#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */
-#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */
-#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
-
-/* Evaluates to true if the surface needs to be locked before access */
-#define SDL_MUSTLOCK(surface) \
- (surface->offset || \
- ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0))
-
-/* typedef for private surface blitting functions */
-typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect,
- struct SDL_Surface *dst, SDL_Rect *dstrect);
-
-
-/* Useful for determining the video hardware capabilities */
-typedef struct SDL_VideoInfo {
- Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */
- Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */
- Uint32 UnusedBits1 :6;
- Uint32 UnusedBits2 :1;
- Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */
- Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */
- Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */
- Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */
- Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */
- Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */
- Uint32 blit_fill :1; /* Flag: Accelerated color fill */
- Uint32 UnusedBits3 :16;
- Uint32 video_mem; /* The total amount of video memory (in K) */
- SDL_PixelFormat *vfmt; /* Value: The format of the video surface */
- int current_w; /* Value: The current video mode width */
- int current_h; /* Value: The current video mode height */
-} SDL_VideoInfo;
-
-
-/* The most common video overlay formats.
- For an explanation of these pixel formats, see:
- http://www.webartz.com/fourcc/indexyuv.htm
-
- For information on the relationship between color spaces, see:
- http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
- */
-#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */
-#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */
-#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */
-#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */
-#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */
-
-/* The YUV hardware video overlay */
-typedef struct SDL_Overlay {
- Uint32 format; /* Read-only */
- int w, h; /* Read-only */
- int planes; /* Read-only */
- Uint16 *pitches; /* Read-only */
- Uint8 **pixels; /* Read-write */
-
- /* Hardware-specific surface info */
- struct private_yuvhwfuncs *hwfuncs;
- struct private_yuvhwdata *hwdata;
-
- /* Special flags */
- Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */
- Uint32 UnusedBits :31;
-} SDL_Overlay;
-
-
-/* Public enumeration for setting the OpenGL window attributes. */
-typedef enum {
- SDL_GL_RED_SIZE,
- SDL_GL_GREEN_SIZE,
- SDL_GL_BLUE_SIZE,
- SDL_GL_ALPHA_SIZE,
- SDL_GL_BUFFER_SIZE,
- SDL_GL_DOUBLEBUFFER,
- SDL_GL_DEPTH_SIZE,
- SDL_GL_STENCIL_SIZE,
- SDL_GL_ACCUM_RED_SIZE,
- SDL_GL_ACCUM_GREEN_SIZE,
- SDL_GL_ACCUM_BLUE_SIZE,
- SDL_GL_ACCUM_ALPHA_SIZE,
- SDL_GL_STEREO,
- SDL_GL_MULTISAMPLEBUFFERS,
- SDL_GL_MULTISAMPLESAMPLES,
- SDL_GL_ACCELERATED_VISUAL,
- SDL_GL_SWAP_CONTROL
-} SDL_GLattr;
-
-/* flags for SDL_SetPalette() */
-#define SDL_LOGPAL 0x01
-#define SDL_PHYSPAL 0x02
-
-/* Function prototypes */
-
-/* These functions are used internally, and should not be used unless you
- * have a specific need to specify the video driver you want to use.
- * You should normally use SDL_Init() or SDL_InitSubSystem().
- *
- * SDL_VideoInit() initializes the video subsystem -- sets up a connection
- * to the window manager, etc, and determines the current video mode and
- * pixel format, but does not initialize a window or graphics mode.
- * Note that event handling is activated by this routine.
- *
- * If you use both sound and video in your application, you need to call
- * SDL_Init() before opening the sound device, otherwise under Win32 DirectX,
- * you won't be able to set full-screen display modes.
- */
-extern DECLSPEC int SDLCALL SDL_VideoInit(const char *driver_name, Uint32 flags);
-extern DECLSPEC void SDLCALL SDL_VideoQuit(void);
-
-/* This function fills the given character buffer with the name of the
- * video driver, and returns a pointer to it if the video driver has
- * been initialized. It returns NULL if no driver has been initialized.
- */
-extern DECLSPEC char * SDLCALL SDL_VideoDriverName(char *namebuf, int maxlen);
-
-/*
- * This function returns a pointer to the current display surface.
- * If SDL is doing format conversion on the display surface, this
- * function returns the publicly visible surface, not the real video
- * surface.
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_GetVideoSurface(void);
-
-/*
- * This function returns a read-only pointer to information about the
- * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt'
- * member of the returned structure will contain the pixel format of the
- * "best" video mode.
- */
-extern DECLSPEC const SDL_VideoInfo * SDLCALL SDL_GetVideoInfo(void);
-
-/*
- * Check to see if a particular video mode is supported.
- * It returns 0 if the requested mode is not supported under any bit depth,
- * or returns the bits-per-pixel of the closest available mode with the
- * given width and height. If this bits-per-pixel is different from the
- * one used when setting the video mode, SDL_SetVideoMode() will succeed,
- * but will emulate the requested bits-per-pixel with a shadow surface.
- *
- * The arguments to SDL_VideoModeOK() are the same ones you would pass to
- * SDL_SetVideoMode()
- */
-extern DECLSPEC int SDLCALL SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);
-
-/*
- * Return a pointer to an array of available screen dimensions for the
- * given format and video flags, sorted largest to smallest. Returns
- * NULL if there are no dimensions available for a particular format,
- * or (SDL_Rect **)-1 if any dimension is okay for the given format.
- *
- * If 'format' is NULL, the mode list will be for the format given
- * by SDL_GetVideoInfo()->vfmt
- */
-extern DECLSPEC SDL_Rect ** SDLCALL SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);
-
-/*
- * Set up a video mode with the specified width, height and bits-per-pixel.
- *
- * If 'bpp' is 0, it is treated as the current display bits per pixel.
- *
- * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the
- * requested bits-per-pixel, but will return whatever video pixel format is
- * available. The default is to emulate the requested pixel format if it
- * is not natively available.
- *
- * If SDL_HWSURFACE is set in 'flags', the video surface will be placed in
- * video memory, if possible, and you may have to call SDL_LockSurface()
- * in order to access the raw framebuffer. Otherwise, the video surface
- * will be created in system memory.
- *
- * If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle
- * updates asynchronously, but you must always lock before accessing pixels.
- * SDL will wait for updates to complete before returning from the lock.
- *
- * If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee
- * that the colors set by SDL_SetColors() will be the colors you get.
- * Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all
- * of the colors exactly the way they are requested, and you should look
- * at the video surface structure to determine the actual palette.
- * If SDL cannot guarantee that the colors you request can be set,
- * i.e. if the colormap is shared, then the video surface may be created
- * under emulation in system memory, overriding the SDL_HWSURFACE flag.
- *
- * If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set
- * a fullscreen video mode. The default is to create a windowed mode
- * if the current graphics system has a window manager.
- * If the SDL library is able to set a fullscreen video mode, this flag
- * will be set in the surface that is returned.
- *
- * If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up
- * two surfaces in video memory and swap between them when you call
- * SDL_Flip(). This is usually slower than the normal single-buffering
- * scheme, but prevents "tearing" artifacts caused by modifying video
- * memory while the monitor is refreshing. It should only be used by
- * applications that redraw the entire screen on every update.
- *
- * If SDL_RESIZABLE is set in 'flags', the SDL library will allow the
- * window manager, if any, to resize the window at runtime. When this
- * occurs, SDL will send a SDL_VIDEORESIZE event to you application,
- * and you must respond to the event by re-calling SDL_SetVideoMode()
- * with the requested size (or another size that suits the application).
- *
- * If SDL_NOFRAME is set in 'flags', the SDL library will create a window
- * without any title bar or frame decoration. Fullscreen video modes have
- * this flag set automatically.
- *
- * This function returns the video framebuffer surface, or NULL if it fails.
- *
- * If you rely on functionality provided by certain video flags, check the
- * flags of the returned surface to make sure that functionality is available.
- * SDL will fall back to reduced functionality if the exact flags you wanted
- * are not available.
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_SetVideoMode
- (int width, int height, int bpp, Uint32 flags);
-
-/*
- * Makes sure the given list of rectangles is updated on the given screen.
- * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire
- * screen.
- * These functions should not be called while 'screen' is locked.
- */
-extern DECLSPEC void SDLCALL SDL_UpdateRects
- (SDL_Surface *screen, int numrects, SDL_Rect *rects);
-extern DECLSPEC void SDLCALL SDL_UpdateRect
- (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h);
-
-/*
- * On hardware that supports double-buffering, this function sets up a flip
- * and returns. The hardware will wait for vertical retrace, and then swap
- * video buffers before the next video surface blit or lock will return.
- * On hardware that doesn not support double-buffering, this is equivalent
- * to calling SDL_UpdateRect(screen, 0, 0, 0, 0);
- * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when
- * setting the video mode for this function to perform hardware flipping.
- * This function returns 0 if successful, or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_Flip(SDL_Surface *screen);
-
-/*
- * Set the gamma correction for each of the color channels.
- * The gamma values range (approximately) between 0.1 and 10.0
- *
- * If this function isn't supported directly by the hardware, it will
- * be emulated using gamma ramps, if available. If successful, this
- * function returns 0, otherwise it returns -1.
- */
-extern DECLSPEC int SDLCALL SDL_SetGamma(float red, float green, float blue);
-
-/*
- * Set the gamma translation table for the red, green, and blue channels
- * of the video hardware. Each table is an array of 256 16-bit quantities,
- * representing a mapping between the input and output for that channel.
- * The input is the index into the array, and the output is the 16-bit
- * gamma value at that index, scaled to the output color precision.
- *
- * You may pass NULL for any of the channels to leave it unchanged.
- * If the call succeeds, it will return 0. If the display driver or
- * hardware does not support gamma translation, or otherwise fails,
- * this function will return -1.
- */
-extern DECLSPEC int SDLCALL SDL_SetGammaRamp(const Uint16 *red, const Uint16 *green, const Uint16 *blue);
-
-/*
- * Retrieve the current values of the gamma translation tables.
- *
- * You must pass in valid pointers to arrays of 256 16-bit quantities.
- * Any of the pointers may be NULL to ignore that channel.
- * If the call succeeds, it will return 0. If the display driver or
- * hardware does not support gamma translation, or otherwise fails,
- * this function will return -1.
- */
-extern DECLSPEC int SDLCALL SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue);
-
-/*
- * Sets a portion of the colormap for the given 8-bit surface. If 'surface'
- * is not a palettized surface, this function does nothing, returning 0.
- * If all of the colors were set as passed to SDL_SetColors(), it will
- * return 1. If not all the color entries were set exactly as given,
- * it will return 0, and you should look at the surface palette to
- * determine the actual color palette.
- *
- * When 'surface' is the surface associated with the current display, the
- * display colormap will be updated with the requested colors. If
- * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors()
- * will always return 1, and the palette is guaranteed to be set the way
- * you desire, even if the window colormap has to be warped or run under
- * emulation.
- */
-extern DECLSPEC int SDLCALL SDL_SetColors(SDL_Surface *surface,
- SDL_Color *colors, int firstcolor, int ncolors);
-
-/*
- * Sets a portion of the colormap for a given 8-bit surface.
- * 'flags' is one or both of:
- * SDL_LOGPAL -- set logical palette, which controls how blits are mapped
- * to/from the surface,
- * SDL_PHYSPAL -- set physical palette, which controls how pixels look on
- * the screen
- * Only screens have physical palettes. Separate change of physical/logical
- * palettes is only possible if the screen has SDL_HWPALETTE set.
- *
- * The return value is 1 if all colours could be set as requested, and 0
- * otherwise.
- *
- * SDL_SetColors() is equivalent to calling this function with
- * flags = (SDL_LOGPAL|SDL_PHYSPAL).
- */
-extern DECLSPEC int SDLCALL SDL_SetPalette(SDL_Surface *surface, int flags,
- SDL_Color *colors, int firstcolor,
- int ncolors);
-
-/*
- * Maps an RGB triple to an opaque pixel value for a given pixel format
- */
-extern DECLSPEC Uint32 SDLCALL SDL_MapRGB
- (SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b);
-
-/*
- * Maps an RGBA quadruple to a pixel value for a given pixel format
- */
-extern DECLSPEC Uint32 SDLCALL SDL_MapRGBA(SDL_PixelFormat *format,
- Uint8 r, Uint8 g, Uint8 b, Uint8 a);
-
-/*
- * Maps a pixel value into the RGB components for a given pixel format
- */
-extern DECLSPEC void SDLCALL SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt,
- Uint8 *r, Uint8 *g, Uint8 *b);
-
-/*
- * Maps a pixel value into the RGBA components for a given pixel format
- */
-extern DECLSPEC void SDLCALL SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt,
- Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
-
-/*
- * Allocate and free an RGB surface (must be called after SDL_SetVideoMode)
- * If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
- * If the depth is greater than 8 bits, the pixel format is set using the
- * flags '[RGB]mask'.
- * If the function runs out of memory, it will return NULL.
- *
- * The 'flags' tell what kind of surface to create.
- * SDL_SWSURFACE means that the surface should be created in system memory.
- * SDL_HWSURFACE means that the surface should be created in video memory,
- * with the same format as the display surface. This is useful for surfaces
- * that will not change much, to take advantage of hardware acceleration
- * when being blitted to the display surface.
- * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with
- * this surface, but you must always lock it before accessing the pixels.
- * SDL will wait for current blits to finish before returning from the lock.
- * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits.
- * If the hardware supports acceleration of colorkey blits between
- * two surfaces in video memory, SDL will try to place the surface in
- * video memory. If this isn't possible or if there is no hardware
- * acceleration available, the surface will be placed in system memory.
- * SDL_SRCALPHA means that the surface will be used for alpha blits and
- * if the hardware supports hardware acceleration of alpha blits between
- * two surfaces in video memory, to place the surface in video memory
- * if possible, otherwise it will be placed in system memory.
- * If the surface is created in video memory, blits will be _much_ faster,
- * but the surface format must be identical to the video surface format,
- * and the only way to access the pixels member of the surface is to use
- * the SDL_LockSurface() and SDL_UnlockSurface() calls.
- * If the requested surface actually resides in video memory, SDL_HWSURFACE
- * will be set in the flags member of the returned surface. If for some
- * reason the surface could not be placed in video memory, it will not have
- * the SDL_HWSURFACE flag set, and will be created in system memory instead.
- */
-#define SDL_AllocSurface SDL_CreateRGBSurface
-extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurface
- (Uint32 flags, int width, int height, int depth,
- Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
-extern DECLSPEC SDL_Surface * SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
- int width, int height, int depth, int pitch,
- Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
-extern DECLSPEC void SDLCALL SDL_FreeSurface(SDL_Surface *surface);
-
-/*
- * SDL_LockSurface() sets up a surface for directly accessing the pixels.
- * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write
- * to and read from 'surface->pixels', using the pixel format stored in
- * 'surface->format'. Once you are done accessing the surface, you should
- * use SDL_UnlockSurface() to release it.
- *
- * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates
- * to 0, then you can read and write to the surface at any time, and the
- * pixel format of the surface will not change. In particular, if the
- * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you
- * will not need to lock the display surface before accessing it.
- *
- * No operating system or library calls should be made between lock/unlock
- * pairs, as critical system locks may be held during this time.
- *
- * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked.
- */
-extern DECLSPEC int SDLCALL SDL_LockSurface(SDL_Surface *surface);
-extern DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface);
-
-/*
- * Load a surface from a seekable SDL data source (memory or file.)
- * If 'freesrc' is non-zero, the source will be closed after being read.
- * Returns the new surface, or NULL if there was an error.
- * The new surface should be freed with SDL_FreeSurface().
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_RW(SDL_RWops *src, int freesrc);
-
-/* Convenience macro -- load a surface from a file */
-#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)
-
-/*
- * Save a surface to a seekable SDL data source (memory or file.)
- * If 'freedst' is non-zero, the source will be closed after being written.
- * Returns 0 if successful or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_SaveBMP_RW
- (SDL_Surface *surface, SDL_RWops *dst, int freedst);
-
-/* Convenience macro -- save a surface to a file */
-#define SDL_SaveBMP(surface, file) \
- SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1)
-
-/*
- * Sets the color key (transparent pixel) in a blittable surface.
- * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL),
- * 'key' will be the transparent pixel in the source image of a blit.
- * SDL_RLEACCEL requests RLE acceleration for the surface if present,
- * and removes RLE acceleration if absent.
- * If 'flag' is 0, this function clears any current color key.
- * This function returns 0, or -1 if there was an error.
- */
-extern DECLSPEC int SDLCALL SDL_SetColorKey
- (SDL_Surface *surface, Uint32 flag, Uint32 key);
-
-/*
- * This function sets the alpha value for the entire surface, as opposed to
- * using the alpha component of each pixel. This value measures the range
- * of transparency of the surface, 0 being completely transparent to 255
- * being completely opaque. An 'alpha' value of 255 causes blits to be
- * opaque, the source pixels copied to the destination (the default). Note
- * that per-surface alpha can be combined with colorkey transparency.
- *
- * If 'flag' is 0, alpha blending is disabled for the surface.
- * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface.
- * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the
- * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed.
- *
- * The 'alpha' parameter is ignored for surfaces that have an alpha channel.
- */
-extern DECLSPEC int SDLCALL SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);
-
-/*
- * Sets the clipping rectangle for the destination surface in a blit.
- *
- * If the clip rectangle is NULL, clipping will be disabled.
- * If the clip rectangle doesn't intersect the surface, the function will
- * return SDL_FALSE and blits will be completely clipped. Otherwise the
- * function returns SDL_TRUE and blits to the surface will be clipped to
- * the intersection of the surface area and the clipping rectangle.
- *
- * Note that blits are automatically clipped to the edges of the source
- * and destination surfaces.
- */
-extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect);
-
-/*
- * Gets the clipping rectangle for the destination surface in a blit.
- * 'rect' must be a pointer to a valid rectangle which will be filled
- * with the correct values.
- */
-extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);
-
-/*
- * Creates a new surface of the specified format, and then copies and maps
- * the given surface to it so the blit of the converted surface will be as
- * fast as possible. If this function fails, it returns NULL.
- *
- * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those
- * semantics. You can also pass SDL_RLEACCEL in the flags parameter and
- * SDL will try to RLE accelerate colorkey and alpha blits in the resulting
- * surface.
- *
- * This function is used internally by SDL_DisplayFormat().
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurface
- (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);
-
-/*
- * This performs a fast blit from the source surface to the destination
- * surface. It assumes that the source and destination rectangles are
- * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire
- * surface (src or dst) is copied. The final blit rectangles are saved
- * in 'srcrect' and 'dstrect' after all clipping is performed.
- * If the blit is successful, it returns 0, otherwise it returns -1.
- *
- * The blit function should not be called on a locked surface.
- *
- * The blit semantics for surfaces with and without alpha and colorkey
- * are defined as follows:
- *
- * RGBA->RGB:
- * SDL_SRCALPHA set:
- * alpha-blend (using alpha-channel).
- * SDL_SRCCOLORKEY ignored.
- * SDL_SRCALPHA not set:
- * copy RGB.
- * if SDL_SRCCOLORKEY set, only copy the pixels matching the
- * RGB values of the source colour key, ignoring alpha in the
- * comparison.
- *
- * RGB->RGBA:
- * SDL_SRCALPHA set:
- * alpha-blend (using the source per-surface alpha value);
- * set destination alpha to opaque.
- * SDL_SRCALPHA not set:
- * copy RGB, set destination alpha to source per-surface alpha value.
- * both:
- * if SDL_SRCCOLORKEY set, only copy the pixels matching the
- * source colour key.
- *
- * RGBA->RGBA:
- * SDL_SRCALPHA set:
- * alpha-blend (using the source alpha channel) the RGB values;
- * leave destination alpha untouched. [Note: is this correct?]
- * SDL_SRCCOLORKEY ignored.
- * SDL_SRCALPHA not set:
- * copy all of RGBA to the destination.
- * if SDL_SRCCOLORKEY set, only copy the pixels matching the
- * RGB values of the source colour key, ignoring alpha in the
- * comparison.
- *
- * RGB->RGB:
- * SDL_SRCALPHA set:
- * alpha-blend (using the source per-surface alpha value).
- * SDL_SRCALPHA not set:
- * copy RGB.
- * both:
- * if SDL_SRCCOLORKEY set, only copy the pixels matching the
- * source colour key.
- *
- * If either of the surfaces were in video memory, and the blit returns -2,
- * the video memory was lost, so it should be reloaded with artwork and
- * re-blitted:
- while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
- while ( SDL_LockSurface(image) < 0 )
- Sleep(10);
- -- Write image pixels to image->pixels --
- SDL_UnlockSurface(image);
- }
- * This happens under DirectX 5.0 when the system switches away from your
- * fullscreen application. The lock will also fail until you have access
- * to the video memory again.
- */
-/* You should call SDL_BlitSurface() unless you know exactly how SDL
- blitting works internally and how to use the other blit functions.
-*/
-#define SDL_BlitSurface SDL_UpperBlit
-
-/* This is the public blit function, SDL_BlitSurface(), and it performs
- rectangle validation and clipping before passing it to SDL_LowerBlit()
-*/
-extern DECLSPEC int SDLCALL SDL_UpperBlit
- (SDL_Surface *src, SDL_Rect *srcrect,
- SDL_Surface *dst, SDL_Rect *dstrect);
-/* This is a semi-private blit function and it performs low-level surface
- blitting only.
-*/
-extern DECLSPEC int SDLCALL SDL_LowerBlit
- (SDL_Surface *src, SDL_Rect *srcrect,
- SDL_Surface *dst, SDL_Rect *dstrect);
-
-/*
- * This function performs a fast fill of the given rectangle with 'color'
- * The given rectangle is clipped to the destination surface clip area
- * and the final fill rectangle is saved in the passed in pointer.
- * If 'dstrect' is NULL, the whole surface will be filled with 'color'
- * The color should be a pixel of the format used by the surface, and
- * can be generated by the SDL_MapRGB() function.
- * This function returns 0 on success, or -1 on error.
- */
-extern DECLSPEC int SDLCALL SDL_FillRect
- (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);
-
-/*
- * This function takes a surface and copies it to a new surface of the
- * pixel format and colors of the video framebuffer, suitable for fast
- * blitting onto the display surface. It calls SDL_ConvertSurface()
- *
- * If you want to take advantage of hardware colorkey or alpha blit
- * acceleration, you should set the colorkey and alpha value before
- * calling this function.
- *
- * If the conversion fails or runs out of memory, it returns NULL
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormat(SDL_Surface *surface);
-
-/*
- * This function takes a surface and copies it to a new surface of the
- * pixel format and colors of the video framebuffer (if possible),
- * suitable for fast alpha blitting onto the display surface.
- * The new surface will always have an alpha channel.
- *
- * If you want to take advantage of hardware colorkey or alpha blit
- * acceleration, you should set the colorkey and alpha value before
- * calling this function.
- *
- * If the conversion fails or runs out of memory, it returns NULL
- */
-extern DECLSPEC SDL_Surface * SDLCALL SDL_DisplayFormatAlpha(SDL_Surface *surface);
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* YUV video surface overlay functions */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/* This function creates a video output overlay
- Calling the returned surface an overlay is something of a misnomer because
- the contents of the display surface underneath the area where the overlay
- is shown is undefined - it may be overwritten with the converted YUV data.
-*/
-extern DECLSPEC SDL_Overlay * SDLCALL SDL_CreateYUVOverlay(int width, int height,
- Uint32 format, SDL_Surface *display);
-
-/* Lock an overlay for direct access, and unlock it when you are done */
-extern DECLSPEC int SDLCALL SDL_LockYUVOverlay(SDL_Overlay *overlay);
-extern DECLSPEC void SDLCALL SDL_UnlockYUVOverlay(SDL_Overlay *overlay);
-
-/* Blit a video overlay to the display surface.
- The contents of the video surface underneath the blit destination are
- not defined.
- The width and height of the destination rectangle may be different from
- that of the overlay, but currently only 2x scaling is supported.
-*/
-extern DECLSPEC int SDLCALL SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);
-
-/* Free a video overlay */
-extern DECLSPEC void SDLCALL SDL_FreeYUVOverlay(SDL_Overlay *overlay);
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* OpenGL support functions. */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Dynamically load an OpenGL library, or the default one if path is NULL
- *
- * If you do this, you need to retrieve all of the GL functions used in
- * your program from the dynamic library using SDL_GL_GetProcAddress().
- */
-extern DECLSPEC int SDLCALL SDL_GL_LoadLibrary(const char *path);
-
-/*
- * Get the address of a GL function
- */
-extern DECLSPEC void * SDLCALL SDL_GL_GetProcAddress(const char* proc);
-
-/*
- * Set an attribute of the OpenGL subsystem before intialization.
- */
-extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value);
-
-/*
- * Get an attribute of the OpenGL subsystem from the windowing
- * interface, such as glX. This is of course different from getting
- * the values from SDL's internal OpenGL subsystem, which only
- * stores the values you request before initialization.
- *
- * Developers should track the values they pass into SDL_GL_SetAttribute
- * themselves if they want to retrieve these values.
- */
-extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int* value);
-
-/*
- * Swap the OpenGL buffers, if double-buffering is supported.
- */
-extern DECLSPEC void SDLCALL SDL_GL_SwapBuffers(void);
-
-/*
- * Internal functions that should not be called unless you have read
- * and understood the source code for these functions.
- */
-extern DECLSPEC void SDLCALL SDL_GL_UpdateRects(int numrects, SDL_Rect* rects);
-extern DECLSPEC void SDLCALL SDL_GL_Lock(void);
-extern DECLSPEC void SDLCALL SDL_GL_Unlock(void);
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* These functions allow interaction with the window manager, if any. */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*
- * Sets/Gets the title and icon text of the display window (UTF-8 encoded)
- */
-extern DECLSPEC void SDLCALL SDL_WM_SetCaption(const char *title, const char *icon);
-extern DECLSPEC void SDLCALL SDL_WM_GetCaption(char **title, char **icon);
-
-/*
- * Sets the icon for the display window.
- * This function must be called before the first call to SDL_SetVideoMode().
- * It takes an icon surface, and a mask in MSB format.
- * If 'mask' is NULL, the entire icon surface will be used as the icon.
- */
-extern DECLSPEC void SDLCALL SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);
-
-/*
- * This function iconifies the window, and returns 1 if it succeeded.
- * If the function succeeds, it generates an SDL_APPACTIVE loss event.
- * This function is a noop and returns 0 in non-windowed environments.
- */
-extern DECLSPEC int SDLCALL SDL_WM_IconifyWindow(void);
-
-/*
- * Toggle fullscreen mode without changing the contents of the screen.
- * If the display surface does not require locking before accessing
- * the pixel information, then the memory pointers will not change.
- *
- * If this function was able to toggle fullscreen mode (change from
- * running in a window to fullscreen, or vice-versa), it will return 1.
- * If it is not implemented, or fails, it returns 0.
- *
- * The next call to SDL_SetVideoMode() will set the mode fullscreen
- * attribute based on the flags parameter - if SDL_FULLSCREEN is not
- * set, then the display will be windowed by default where supported.
- *
- * This is currently only implemented in the X11 video driver.
- */
-extern DECLSPEC int SDLCALL SDL_WM_ToggleFullScreen(SDL_Surface *surface);
-
-/*
- * This function allows you to set and query the input grab state of
- * the application. It returns the new input grab state.
- */
-typedef enum {
- SDL_GRAB_QUERY = -1,
- SDL_GRAB_OFF = 0,
- SDL_GRAB_ON = 1,
- SDL_GRAB_FULLSCREEN /* Used internally */
-} SDL_GrabMode;
-/*
- * Grabbing means that the mouse is confined to the application window,
- * and nearly all keyboard input is passed directly to the application,
- * and not interpreted by a window manager, if any.
- */
-extern DECLSPEC SDL_GrabMode SDLCALL SDL_WM_GrabInput(SDL_GrabMode mode);
-
-/* Not in public API at the moment - do not use! */
-extern DECLSPEC int SDLCALL SDL_SoftStretch(SDL_Surface *src, SDL_Rect *srcrect,
- SDL_Surface *dst, SDL_Rect *dstrect);
-
-/* Ends C function definitions when using C++ */
-#ifdef __cplusplus
-}
-#endif
-#include "close_code.h"
-
-#endif /* _SDL_video_h */
diff --git a/src/SDL12/include/begin_code.h b/src/SDL12/include/begin_code.h
deleted file mode 100644
index 4027933..0000000
--- a/src/SDL12/include/begin_code.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2004 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* This file sets things up for C dynamic library function definitions,
- static inlined functions, and structures aligned at 4-byte alignment.
- If you don't like ugly C preprocessor code, don't look at this file. :)
-*/
-
-/* This shouldn't be nested -- included it around code only. */
-#ifdef _begin_code_h
-#error Nested inclusion of begin_code.h
-#endif
-#define _begin_code_h
-
-/* Some compilers use a special export keyword */
-#ifndef DECLSPEC
-# if defined(__BEOS__)
-# if defined(__GNUC__)
-# define DECLSPEC __declspec(dllexport)
-# else
-# define DECLSPEC __declspec(export)
-# endif
-# elif defined(__WIN32__)
-# ifdef __BORLANDC__
-# ifdef BUILD_SDL
-# define DECLSPEC
-# else
-# define DECLSPEC __declspec(dllimport)
-# endif
-# else
-# define DECLSPEC __declspec(dllexport)
-# endif
-# elif defined(__OS2__)
-# ifdef __WATCOMC__
-# ifdef BUILD_SDL
-# define DECLSPEC __declspec(dllexport)
-# else
-# define DECLSPEC
-# endif
-# else
-# define DECLSPEC
-# endif
-# else
-# if defined(__GNUC__) && __GNUC__ >= 4
-# define DECLSPEC __attribute__ ((visibility("default")))
-# else
-# define DECLSPEC
-# endif
-# endif
-#endif
-
-/* By default SDL uses the C calling convention */
-#ifndef SDLCALL
-#if defined(__WIN32__) && !defined(__GNUC__)
-#define SDLCALL __cdecl
-#else
-#ifdef __OS2__
-/* But on OS/2, we use the _System calling convention */
-/* to be compatible with every compiler */
-#define SDLCALL _System
-#else
-#define SDLCALL
-#endif
-#endif
-#endif /* SDLCALL */
-
-/* Removed DECLSPEC on Symbian OS because SDL cannot be a DLL in EPOC */
-#ifdef __SYMBIAN32__
-#undef DECLSPEC
-#define DECLSPEC
-#endif /* __SYMBIAN32__ */
-
-/* Force structure packing at 4 byte alignment.
- This is necessary if the header is included in code which has structure
- packing set to an alternate value, say for loading structures from disk.
- The packing is reset to the previous value in close_code.h
- */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__)
-#ifdef _MSC_VER
-#pragma warning(disable: 4103)
-#endif
-#ifdef __BORLANDC__
-#pragma nopackwarning
-#endif
-#pragma pack(push,4)
-#elif (defined(__MWERKS__) && defined(__MACOS__))
-#pragma options align=mac68k4byte
-#pragma enumsalwaysint on
-#endif /* Compiler needs structure packing set */
-
-/* Set up compiler-specific options for inlining functions */
-#ifndef SDL_INLINE_OKAY
-#ifdef __GNUC__
-#define SDL_INLINE_OKAY
-#else
-/* Add any special compiler-specific cases here */
-#if defined(_MSC_VER) || defined(__BORLANDC__) || \
- defined(__DMC__) || defined(__SC__) || \
- defined(__WATCOMC__) || defined(__LCC__) || \
- defined(__DECC)
-#ifndef __inline__
-#define __inline__ __inline
-#endif
-#define SDL_INLINE_OKAY
-#else
-#if !defined(__MRC__) && !defined(_SGI_SOURCE)
-#define __inline__ inline
-#define SDL_INLINE_OKAY
-#endif /* Not a funky compiler */
-#endif /* Visual C++ */
-#endif /* GNU C */
-#endif /* SDL_INLINE_OKAY */
-
-/* If inlining isn't supported, remove "__inline__", turning static
- inlined functions into static functions (resulting in code bloat
- in all files which include the offending header files)
-*/
-#ifndef SDL_INLINE_OKAY
-#define __inline__
-#endif
-
-/* Apparently this is needed by several Windows compilers */
-#if !defined(__MACH__)
-#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else
-#define NULL ((void *)0)
-#endif
-#endif /* NULL */
-#endif /* ! Mac OS X - breaks precompiled headers */
diff --git a/src/SDL12/include/close_code.h b/src/SDL12/include/close_code.h
deleted file mode 100644
index afbb650..0000000
--- a/src/SDL12/include/close_code.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- SDL - Simple DirectMedia Layer
- Copyright (C) 1997-2004 Sam Lantinga
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Sam Lantinga
- slouken@libsdl.org
-*/
-
-/* This file reverses the effects of begin_code.h and should be included
- after you finish any function and structure declarations in your headers
-*/
-
-#undef _begin_code_h
-
-/* Reset structure packing at previous byte alignment */
-#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__)
-#ifdef __BORLANDC__
-#pragma nopackwarning
-#endif
-#if (defined(__MWERKS__) && defined(__MACOS__))
-#pragma options align=reset
-#pragma enumsalwaysint reset
-#else
-#pragma pack(pop)
-#endif
-#endif /* Compiler needs structure packing set */
-
diff --git a/src/cgame/cg_animation.c b/src/cgame/cg_animation.c
deleted file mode 100644
index c370c53..0000000
--- a/src/cgame/cg_animation.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "cg_local.h"
-
-/*
-===============
-CG_RunLerpFrame
-
-Sets cg.snap, cg.oldFrame, and cg.backlerp
-cg.time should be between oldFrameTime and frameTime after exit
-===============
-*/
-void CG_RunLerpFrame( lerpFrame_t *lf )
-{
- int f, numFrames;
- animation_t *anim;
-
- // debugging tool to get no animations
- if( cg_animSpeed.integer == 0 )
- {
- lf->oldFrame = lf->frame = lf->backlerp = 0;
- return;
- }
-
- // if we have passed the current frame, move it to
- // oldFrame and calculate a new frame
- if( cg.time >= lf->frameTime )
- {
- lf->oldFrame = lf->frame;
- lf->oldFrameTime = lf->frameTime;
-
- // get the next frame based on the animation
- anim = lf->animation;
- if( !anim->frameLerp )
- return; // shouldn't happen
-
- if( cg.time < lf->animationTime )
- lf->frameTime = lf->animationTime; // initial lerp
- else
- lf->frameTime = lf->oldFrameTime + anim->frameLerp;
-
- f = ( lf->frameTime - lf->animationTime ) / anim->frameLerp;
- numFrames = anim->numFrames;
- if( anim->flipflop )
- numFrames *= 2;
-
- if( f >= numFrames )
- {
- f -= numFrames;
- if( anim->loopFrames )
- {
- f %= anim->loopFrames;
- f += anim->numFrames - anim->loopFrames;
- }
- else
- {
- f = numFrames - 1;
- // the animation is stuck at the end, so it
- // can immediately transition to another sequence
- lf->frameTime = cg.time;
- }
- }
-
- if( anim->reversed )
- lf->frame = anim->firstFrame + anim->numFrames - 1 - f;
- else if( anim->flipflop && f >= anim->numFrames )
- lf->frame = anim->firstFrame + anim->numFrames - 1 - ( f % anim->numFrames );
- else
- lf->frame = anim->firstFrame + f;
-
- if( cg.time > lf->frameTime )
- {
- lf->frameTime = cg.time;
- if( cg_debugAnim.integer )
- CG_Printf( "Clamp lf->frameTime\n" );
- }
- }
-
- if( lf->frameTime > cg.time + 200 )
- lf->frameTime = cg.time;
-
- if( lf->oldFrameTime > cg.time )
- lf->oldFrameTime = cg.time;
-
- // calculate current lerp value
- if( lf->frameTime == lf->oldFrameTime )
- lf->backlerp = 0;
- else
- lf->backlerp = 1.0 - (float)( cg.time - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime );
-}
diff --git a/src/cgame/cg_animmapobj.c b/src/cgame/cg_animmapobj.c
deleted file mode 100644
index 2e80b7e..0000000
--- a/src/cgame/cg_animmapobj.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "cg_local.h"
-
-
-/*
-===============
-CG_DoorAnimation
-===============
-*/
-static void CG_DoorAnimation( centity_t *cent, int *old, int *now, float *backLerp )
-{
- CG_RunLerpFrame( ¢->lerpFrame );
-
- *old = cent->lerpFrame.oldFrame;
- *now = cent->lerpFrame.frame;
- *backLerp = cent->lerpFrame.backlerp;
-}
-
-
-/*
-===============
-CG_ModelDoor
-===============
-*/
-void CG_ModelDoor( centity_t *cent )
-{
- refEntity_t ent;
- entityState_t *es;
- animation_t anim;
- lerpFrame_t *lf = ¢->lerpFrame;
-
- es = ¢->currentState;
-
- if( !es->modelindex )
- return;
-
- //create the render entity
- memset( &ent, 0, sizeof( ent ) );
- VectorCopy( cent->lerpOrigin, ent.origin );
- VectorCopy( cent->lerpOrigin, ent.oldorigin );
- AnglesToAxis( cent->lerpAngles, ent.axis );
-
- ent.renderfx = RF_NOSHADOW;
-
- //add the door model
- ent.skinNum = 0;
- ent.hModel = cgs.gameModels[ es->modelindex ];
-
- //scale the door
- VectorScale( ent.axis[ 0 ], es->origin2[ 0 ], ent.axis[ 0 ] );
- VectorScale( ent.axis[ 1 ], es->origin2[ 1 ], ent.axis[ 1 ] );
- VectorScale( ent.axis[ 2 ], es->origin2[ 2 ], ent.axis[ 2 ] );
- ent.nonNormalizedAxes = qtrue;
-
- //setup animation
- anim.firstFrame = es->powerups;
- anim.numFrames = es->weapon;
- anim.reversed = !es->legsAnim;
- anim.flipflop = qfalse;
- anim.loopFrames = 0;
- anim.frameLerp = 1000 / es->torsoAnim;
- anim.initialLerp = 1000 / es->torsoAnim;
-
- //door changed state
- if( es->legsAnim != cent->doorState )
- {
- lf->animationTime = lf->frameTime + anim.initialLerp;
- cent->doorState = es->legsAnim;
- }
-
- lf->animation = &anim;
-
- //run animation
- CG_DoorAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
-
- trap_R_AddRefEntityToScene( &ent );
-}
-
-
-/*
-===============
-CG_AMOAnimation
-===============
-*/
-static void CG_AMOAnimation( centity_t *cent, int *old, int *now, float *backLerp )
-{
- if( !( cent->currentState.eFlags & EF_MOVER_STOP ) || cent->animPlaying )
- {
- int delta = cg.time - cent->miscTime;
-
- //hack to prevent "pausing" mucking up the lerping
- if( delta > 900 )
- {
- cent->lerpFrame.oldFrameTime += delta;
- cent->lerpFrame.frameTime += delta;
- }
-
- CG_RunLerpFrame( ¢->lerpFrame );
- cent->miscTime = cg.time;
- }
-
- *old = cent->lerpFrame.oldFrame;
- *now = cent->lerpFrame.frame;
- *backLerp = cent->lerpFrame.backlerp;
-}
-
-
-/*
-==================
-CG_animMapObj
-==================
-*/
-void CG_AnimMapObj( centity_t *cent )
-{
- refEntity_t ent;
- entityState_t *es;
- float scale;
- animation_t anim;
-
- es = ¢->currentState;
-
- // if set to invisible, skip
- if( !es->modelindex || ( es->eFlags & EF_NODRAW ) )
- return;
-
- memset( &ent, 0, sizeof( ent ) );
-
- VectorCopy( es->angles, cent->lerpAngles );
- AnglesToAxis( cent->lerpAngles, ent.axis );
-
- ent.hModel = cgs.gameModels[ es->modelindex ];
-
- VectorCopy( cent->lerpOrigin, ent.origin);
- VectorCopy( cent->lerpOrigin, ent.oldorigin);
-
- ent.nonNormalizedAxes = qfalse;
-
- //scale the model
- if( es->angles2[ 0 ] )
- {
- scale = es->angles2[ 0 ];
- VectorScale( ent.axis[ 0 ], scale, ent.axis[ 0 ] );
- VectorScale( ent.axis[ 1 ], scale, ent.axis[ 1 ] );
- VectorScale( ent.axis[ 2 ], scale, ent.axis[ 2 ] );
- ent.nonNormalizedAxes = qtrue;
- }
-
- //setup animation
- anim.firstFrame = es->powerups;
- anim.numFrames = es->weapon;
- anim.reversed = qfalse;
- anim.flipflop = qfalse;
-
- // if numFrames is negative the animation is reversed
- if( anim.numFrames < 0 )
- {
- anim.numFrames = -anim.numFrames;
- anim.reversed = qtrue;
- }
-
- anim.loopFrames = es->torsoAnim;
-
- if( !es->legsAnim )
- {
- anim.frameLerp = 1000;
- anim.initialLerp = 1000;
- }
- else
- {
- anim.frameLerp = 1000 / es->legsAnim;
- anim.initialLerp = 1000 / es->legsAnim;
- }
-
- cent->lerpFrame.animation = &anim;
-
- if( !anim.loopFrames )
- {
- // add one frame to allow the animation to play the last frame
- // add another to get it to stop playing at the first frame
- anim.numFrames += 2;
-
- if( !cent->animInit )
- {
- cent->animInit = qtrue;
- cent->animPlaying = !( cent->currentState.eFlags & EF_MOVER_STOP );
- }
- else
- {
- if( cent->animLastState !=
- !( cent->currentState.eFlags & EF_MOVER_STOP ) )
- {
- cent->animPlaying = qtrue;
- cent->lerpFrame.animationTime = cg.time;
- cent->lerpFrame.frameTime = cg.time;
- }
- }
- cent->animLastState = !( cent->currentState.eFlags & EF_MOVER_STOP );
- }
-
- //run animation
- CG_AMOAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
-
- // add to refresh list
- trap_R_AddRefEntityToScene(&ent);
-}
diff --git a/src/cgame/cg_attachment.c b/src/cgame/cg_attachment.c
deleted file mode 100644
index 0d3c8ea..0000000
--- a/src/cgame/cg_attachment.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_attachment.c -- an abstract attachment system
-
-#include "cg_local.h"
-
-/*
-===============
-CG_AttachmentPoint
-
-Return the attachment point
-===============
-*/
-qboolean CG_AttachmentPoint( attachment_t *a, vec3_t v )
-{
- centity_t *cent;
-
- if( !a )
- return qfalse;
-
- // if it all breaks, then use the last point we know was correct
- VectorCopy( a->lastValidAttachmentPoint, v );
-
- switch( a->type )
- {
- case AT_STATIC:
- if( !a->staticValid )
- return qfalse;
-
- VectorCopy( a->origin, v );
- break;
-
- case AT_TAG:
- if( !a->tagValid )
- return qfalse;
-
- AxisCopy( axisDefault, a->re.axis );
- CG_PositionRotatedEntityOnTag( &a->re, &a->parent,
- a->model, a->tagName );
- VectorCopy( a->re.origin, v );
- break;
-
- case AT_CENT:
- if( !a->centValid )
- return qfalse;
-
- if( a->centNum == cg.predictedPlayerState.clientNum )
- {
- // this is smoother if it's the local client
- VectorCopy( cg.predictedPlayerState.origin, v );
- }
- else
- {
- cent = &cg_entities[ a->centNum ];
- VectorCopy( cent->lerpOrigin, v );
- }
- break;
-
- case AT_PARTICLE:
- if( !a->particleValid )
- return qfalse;
-
- if( !a->particle->valid )
- {
- a->particleValid = qfalse;
- return qfalse;
- }
- else
- VectorCopy( a->particle->origin, v );
- break;
-
- default:
- CG_Printf( S_COLOR_RED "ERROR: Invalid attachmentType_t in attachment\n" );
- break;
- }
-
- if( a->hasOffset )
- VectorAdd( v, a->offset, v );
-
- VectorCopy( v, a->lastValidAttachmentPoint );
-
- return qtrue;
-}
-
-/*
-===============
-CG_AttachmentDir
-
-Return the attachment direction
-===============
-*/
-qboolean CG_AttachmentDir( attachment_t *a, vec3_t v )
-{
- vec3_t forward;
- centity_t *cent;
-
- if( !a )
- return qfalse;
-
- switch( a->type )
- {
- case AT_STATIC:
- return qfalse;
- break;
-
- case AT_TAG:
- if( !a->tagValid )
- return qfalse;
-
- VectorCopy( a->re.axis[ 0 ], v );
- break;
-
- case AT_CENT:
- if( !a->centValid )
- return qfalse;
-
- cent = &cg_entities[ a->centNum ];
- AngleVectors( cent->lerpAngles, forward, NULL, NULL );
- VectorCopy( forward, v );
- break;
-
- case AT_PARTICLE:
- if( !a->particleValid )
- return qfalse;
-
- if( !a->particle->valid )
- {
- a->particleValid = qfalse;
- return qfalse;
- }
- else
- VectorCopy( a->particle->velocity, v );
- break;
-
- default:
- CG_Printf( S_COLOR_RED "ERROR: Invalid attachmentType_t in attachment\n" );
- break;
- }
-
- VectorNormalize( v );
- return qtrue;
-}
-
-/*
-===============
-CG_AttachmentAxis
-
-Return the attachment axis
-===============
-*/
-qboolean CG_AttachmentAxis( attachment_t *a, vec3_t axis[ 3 ] )
-{
- centity_t *cent;
-
- if( !a )
- return qfalse;
-
- switch( a->type )
- {
- case AT_STATIC:
- return qfalse;
- break;
-
- case AT_TAG:
- if( !a->tagValid )
- return qfalse;
-
- AxisCopy( a->re.axis, axis );
- break;
-
- case AT_CENT:
- if( !a->centValid )
- return qfalse;
-
- cent = &cg_entities[ a->centNum ];
- AnglesToAxis( cent->lerpAngles, axis );
- break;
-
- case AT_PARTICLE:
- return qfalse;
- break;
-
- default:
- CG_Printf( S_COLOR_RED "ERROR: Invalid attachmentType_t in attachment\n" );
- break;
- }
-
- return qtrue;
-}
-
-/*
-===============
-CG_AttachmentVelocity
-
-If the attachment can have velocity, return it
-===============
-*/
-qboolean CG_AttachmentVelocity( attachment_t *a, vec3_t v )
-{
- if( !a )
- return qfalse;
-
- if( a->particleValid && a->particle->valid )
- {
- VectorCopy( a->particle->velocity, v );
- return qtrue;
- }
- else if( a->centValid )
- {
- centity_t *cent = &cg_entities[ a->centNum ];
-
- VectorCopy( cent->currentState.pos.trDelta, v );
- return qtrue;
- }
-
- return qfalse;
-}
-
-/*
-===============
-CG_AttachmentCentNum
-
-If the attachment has a centNum, return it
-===============
-*/
-int CG_AttachmentCentNum( attachment_t *a )
-{
- if( !a || !a->centValid )
- return -1;
-
- return a->centNum;
-}
-
-/*
-===============
-CG_Attached
-
-If the attachment is valid, return qtrue
-===============
-*/
-qboolean CG_Attached( attachment_t *a )
-{
- if( !a )
- return qfalse;
-
- return a->attached;
-}
-
-/*
-===============
-CG_AttachToPoint
-
-Attach to a point in space
-===============
-*/
-void CG_AttachToPoint( attachment_t *a )
-{
- if( !a || !a->staticValid )
- return;
-
- a->type = AT_STATIC;
- a->attached = qtrue;
-}
-
-/*
-===============
-CG_AttachToCent
-
-Attach to a centity_t
-===============
-*/
-void CG_AttachToCent( attachment_t *a )
-{
- if( !a || !a->centValid )
- return;
-
- a->type = AT_CENT;
- a->attached = qtrue;
-}
-
-/*
-===============
-CG_AttachToTag
-
-Attach to a model tag
-===============
-*/
-void CG_AttachToTag( attachment_t *a )
-{
- if( !a || !a->tagValid )
- return;
-
- a->type = AT_TAG;
- a->attached = qtrue;
-}
-
-/*
-===============
-CG_AttachToParticle
-
-Attach to a particle
-===============
-*/
-void CG_AttachToParticle( attachment_t *a )
-{
- if( !a || !a->particleValid )
- return;
-
- a->type = AT_PARTICLE;
- a->attached = qtrue;
-}
-
-/*
-===============
-CG_SetAttachmentPoint
-===============
-*/
-void CG_SetAttachmentPoint( attachment_t *a, vec3_t v )
-{
- if( !a )
- return;
-
- VectorCopy( v, a->origin );
- a->staticValid = qtrue;
-}
-
-/*
-===============
-CG_SetAttachmentCent
-===============
-*/
-void CG_SetAttachmentCent( attachment_t *a, centity_t *cent )
-{
- if( !a || !cent )
- return;
-
- a->centNum = cent->currentState.number;
- a->centValid = qtrue;
-}
-
-/*
-===============
-CG_SetAttachmentTag
-===============
-*/
-void CG_SetAttachmentTag( attachment_t *a, refEntity_t parent,
- qhandle_t model, char *tagName )
-{
- if( !a )
- return;
-
- a->parent = parent;
- a->model = model;
- strncpy( a->tagName, tagName, MAX_STRING_CHARS );
- a->tagValid = qtrue;
-}
-
-/*
-===============
-CG_SetAttachmentParticle
-===============
-*/
-void CG_SetAttachmentParticle( attachment_t *a, particle_t *p )
-{
- if( !a )
- return;
-
- a->particle = p;
- a->particleValid = qtrue;
-}
-
-/*
-===============
-CG_SetAttachmentOffset
-===============
-*/
-void CG_SetAttachmentOffset( attachment_t *a, vec3_t v )
-{
- if( !a )
- return;
-
- VectorCopy( v, a->offset );
- a->hasOffset = qtrue;
-}
diff --git a/src/cgame/cg_buildable.c b/src/cgame/cg_buildable.c
deleted file mode 100644
index e7b4d85..0000000
--- a/src/cgame/cg_buildable.c
+++ /dev/null
@@ -1,1423 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-
-#include "cg_local.h"
-
-char *cg_buildableSoundNames[ MAX_BUILDABLE_ANIMATIONS ] =
-{
- "construct1.wav",
- "construct2.wav",
- "idle1.wav",
- "idle2.wav",
- "idle3.wav",
- "attack1.wav",
- "attack2.wav",
- "spawn1.wav",
- "spawn2.wav",
- "pain1.wav",
- "pain2.wav",
- "destroy1.wav",
- "destroy2.wav",
- "destroyed.wav"
-};
-
-static sfxHandle_t defaultAlienSounds[ MAX_BUILDABLE_ANIMATIONS ];
-static sfxHandle_t defaultHumanSounds[ MAX_BUILDABLE_ANIMATIONS ];
-
-/*
-===================
-CG_AlienBuildableExplosion
-
-Generated a bunch of gibs launching out from a location
-===================
-*/
-void CG_AlienBuildableExplosion( vec3_t origin, vec3_t dir )
-{
- particleSystem_t *ps;
-
- trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.alienBuildableExplosion );
-
- //particle system
- ps = CG_SpawnNewParticleSystem( cgs.media.alienBuildableDestroyedPS );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentPoint( &ps->attachment, origin );
- CG_SetParticleSystemNormal( ps, dir );
- CG_AttachToPoint( &ps->attachment );
- }
-}
-
-/*
-=================
-CG_HumanBuildableExplosion
-
-Called for human buildables as they are destroyed
-=================
-*/
-void CG_HumanBuildableExplosion( vec3_t origin, vec3_t dir )
-{
- particleSystem_t *ps;
-
- trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.humanBuildableExplosion );
-
- //particle system
- ps = CG_SpawnNewParticleSystem( cgs.media.humanBuildableDestroyedPS );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentPoint( &ps->attachment, origin );
- CG_SetParticleSystemNormal( ps, dir );
- CG_AttachToPoint( &ps->attachment );
- }
-}
-
-
-#define CREEP_SIZE 64.0f
-
-/*
-==================
-CG_Creep
-==================
-*/
-static void CG_Creep( centity_t *cent )
-{
- int msec;
- float size, frac;
- trace_t tr;
- vec3_t temp, origin;
- int scaleUpTime = BG_FindBuildTimeForBuildable( cent->currentState.modelindex );
- int time;
-
- time = cent->currentState.time;
-
- //should the creep be growing or receding?
- if( time >= 0 )
- {
- msec = cg.time - time;
- if( msec >= 0 && msec < scaleUpTime )
- frac = (float)msec / scaleUpTime;
- else
- frac = 1.0f;
- }
- else if( time < 0 )
- {
- msec = cg.time + time;
- if( msec >= 0 && msec < CREEP_SCALEDOWN_TIME )
- frac = 1.0f - ( (float)msec / CREEP_SCALEDOWN_TIME );
- else
- frac = 0.0f;
- }
-
- VectorCopy( cent->currentState.origin2, temp );
- VectorScale( temp, -4096, temp );
- VectorAdd( temp, cent->lerpOrigin, temp );
-
- CG_Trace( &tr, cent->lerpOrigin, NULL, NULL, temp, cent->currentState.number, MASK_PLAYERSOLID );
-
- VectorCopy( tr.endpos, origin );
-
- size = CREEP_SIZE * frac;
-
- if( size > 0.0f )
- CG_ImpactMark( cgs.media.creepShader, origin, cent->currentState.origin2,
- 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, qfalse, size, qtrue );
-}
-
-/*
-======================
-CG_ParseBuildableAnimationFile
-
-Read a configuration file containing animation counts and rates
-models/buildables/hivemind/animation.cfg, etc
-======================
-*/
-static qboolean CG_ParseBuildableAnimationFile( const char *filename, buildable_t buildable )
-{
- char *text_p;
- int len;
- int i;
- char *token;
- float fps;
- char text[ 20000 ];
- fileHandle_t f;
- animation_t *animations;
-
- animations = cg_buildables[ buildable ].animations;
-
- // load the file
- len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if( len <= 0 )
- return qfalse;
-
- if( len >= sizeof( text ) - 1 )
- {
- CG_Printf( "File %s too long\n", filename );
- return qfalse;
- }
-
- trap_FS_Read( text, len, f );
- text[ len ] = 0;
- trap_FS_FCloseFile( f );
-
- // parse the text
- text_p = text;
-
- // read information for each frame
- for( i = BANIM_NONE + 1; i < MAX_BUILDABLE_ANIMATIONS; i++ )
- {
-
- token = COM_Parse( &text_p );
- if( !*token )
- break;
-
- animations[ i ].firstFrame = atoi( token );
-
- token = COM_Parse( &text_p );
- if( !*token )
- break;
-
- animations[ i ].numFrames = atoi( token );
- animations[ i ].reversed = qfalse;
- animations[ i ].flipflop = qfalse;
-
- // if numFrames is negative the animation is reversed
- if( animations[ i ].numFrames < 0 )
- {
- animations[ i ].numFrames = -animations[ i ].numFrames;
- animations[ i ].reversed = qtrue;
- }
-
- token = COM_Parse( &text_p );
- if ( !*token )
- break;
-
- animations[i].loopFrames = atoi( token );
-
- token = COM_Parse( &text_p );
- if( !*token )
- break;
-
- fps = atof( token );
- if( fps == 0 )
- fps = 1;
-
- animations[ i ].frameLerp = 1000 / fps;
- animations[ i ].initialLerp = 1000 / fps;
- }
-
- if( i != MAX_BUILDABLE_ANIMATIONS )
- {
- CG_Printf( "Error parsing animation file: %s\n", filename );
- return qfalse;
- }
-
- return qtrue;
-}
-
-/*
-======================
-CG_ParseBuildableSoundFile
-
-Read a configuration file containing sound properties
-sound/buildables/hivemind/sound.cfg, etc
-======================
-*/
-static qboolean CG_ParseBuildableSoundFile( const char *filename, buildable_t buildable )
-{
- char *text_p;
- int len;
- int i;
- char *token;
- char text[ 20000 ];
- fileHandle_t f;
- sound_t *sounds;
-
- sounds = cg_buildables[ buildable ].sounds;
-
- // load the file
- len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if ( len <= 0 )
- return qfalse;
-
- if ( len >= sizeof( text ) - 1 )
- {
- CG_Printf( "File %s too long\n", filename );
- return qfalse;
- }
-
- trap_FS_Read( text, len, f );
- text[len] = 0;
- trap_FS_FCloseFile( f );
-
- // parse the text
- text_p = text;
-
- // read information for each frame
- for( i = BANIM_NONE + 1; i < MAX_BUILDABLE_ANIMATIONS; i++ )
- {
-
- token = COM_Parse( &text_p );
- if ( !*token )
- break;
-
- sounds[ i ].enabled = atoi( token );
-
- token = COM_Parse( &text_p );
- if ( !*token )
- break;
-
- sounds[ i ].looped = atoi( token );
-
- }
-
- if( i != MAX_BUILDABLE_ANIMATIONS )
- {
- CG_Printf( "Error parsing sound file: %s\n", filename );
- return qfalse;
- }
-
- return qtrue;
-}
-/*
-===============
-CG_InitBuildables
-
-Initialises the animation db
-===============
-*/
-void CG_InitBuildables( void )
-{
- char filename[ MAX_QPATH ];
- char soundfile[ MAX_QPATH ];
- char *buildableName;
- char *modelFile;
- int i;
- int j;
- fileHandle_t f;
-
- memset( cg_buildables, 0, sizeof( cg_buildables ) );
-
- //default sounds
- for( j = BANIM_NONE + 1; j < MAX_BUILDABLE_ANIMATIONS; j++ )
- {
- strcpy( soundfile, cg_buildableSoundNames[ j - 1 ] );
-
- Com_sprintf( filename, sizeof( filename ), "sound/buildables/alien/%s", soundfile );
- defaultAlienSounds[ j ] = trap_S_RegisterSound( filename, qfalse );
-
- Com_sprintf( filename, sizeof( filename ), "sound/buildables/human/%s", soundfile );
- defaultHumanSounds[ j ] = trap_S_RegisterSound( filename, qfalse );
- }
-
- cg.buildablesFraction = 0.0f;
-
- for( i = BA_NONE + 1; i < BA_NUM_BUILDABLES; i++ )
- {
- buildableName = BG_FindNameForBuildable( i );
-
- //animation.cfg
- Com_sprintf( filename, sizeof( filename ), "models/buildables/%s/animation.cfg", buildableName );
- if ( !CG_ParseBuildableAnimationFile( filename, i ) )
- Com_Printf( S_COLOR_YELLOW "WARNING: failed to load animation file %s\n", filename );
-
- //sound.cfg
- Com_sprintf( filename, sizeof( filename ), "sound/buildables/%s/sound.cfg", buildableName );
- if ( !CG_ParseBuildableSoundFile( filename, i ) )
- Com_Printf( S_COLOR_YELLOW "WARNING: failed to load sound file %s\n", filename );
-
- //models
- for( j = 0; j <= 3; j++ )
- {
- if( ( modelFile = BG_FindModelsForBuildable( i, j ) ) )
- cg_buildables[ i ].models[ j ] = trap_R_RegisterModel( modelFile );
- }
-
- //sounds
- for( j = BANIM_NONE + 1; j < MAX_BUILDABLE_ANIMATIONS; j++ )
- {
- strcpy( soundfile, cg_buildableSoundNames[ j - 1 ] );
- Com_sprintf( filename, sizeof( filename ), "sound/buildables/%s/%s", buildableName, soundfile );
-
- if( cg_buildables[ i ].sounds[ j ].enabled )
- {
- if( trap_FS_FOpenFile( filename, &f, FS_READ ) > 0 )
- {
- //file exists so close it
- trap_FS_FCloseFile( f );
-
- cg_buildables[ i ].sounds[ j ].sound = trap_S_RegisterSound( filename, qfalse );
- }
- else
- {
- //file doesn't exist - use default
- if( BG_FindTeamForBuildable( i ) == BIT_ALIENS )
- cg_buildables[ i ].sounds[ j ].sound = defaultAlienSounds[ j ];
- else
- cg_buildables[ i ].sounds[ j ].sound = defaultHumanSounds[ j ];
- }
- }
- }
-
- cg.buildablesFraction = (float)i / (float)( BA_NUM_BUILDABLES - 1 );
- trap_UpdateScreen( );
- }
-
- cgs.media.teslaZapTS = CG_RegisterTrailSystem( "models/buildables/tesla/zap" );
-}
-
-/*
-===============
-CG_SetBuildableLerpFrameAnimation
-
-may include ANIM_TOGGLEBIT
-===============
-*/
-static void CG_SetBuildableLerpFrameAnimation( buildable_t buildable, lerpFrame_t *lf, int newAnimation )
-{
- animation_t *anim;
-
- lf->animationNumber = newAnimation;
-
- if( newAnimation < 0 || newAnimation >= MAX_BUILDABLE_ANIMATIONS )
- CG_Error( "Bad animation number: %i", newAnimation );
-
- anim = &cg_buildables[ buildable ].animations[ newAnimation ];
-
- //this item has just spawned so lf->frameTime will be zero
- if( !lf->animation )
- lf->frameTime = cg.time + 1000; //1 sec delay before starting the spawn anim
-
- lf->animation = anim;
- lf->animationTime = lf->frameTime + anim->initialLerp;
-
- if( cg_debugAnim.integer )
- CG_Printf( "Anim: %i\n", newAnimation );
-}
-
-/*
-===============
-CG_RunBuildableLerpFrame
-
-Sets cg.snap, cg.oldFrame, and cg.backlerp
-cg.time should be between oldFrameTime and frameTime after exit
-===============
-*/
-static void CG_RunBuildableLerpFrame( centity_t *cent )
-{
- int f, numFrames;
- buildable_t buildable = cent->currentState.modelindex;
- lerpFrame_t *lf = ¢->lerpFrame;
- animation_t *anim;
- buildableAnimNumber_t newAnimation = cent->buildableAnim & ~( ANIM_TOGGLEBIT|ANIM_FORCEBIT );
-
- // debugging tool to get no animations
- if( cg_animSpeed.integer == 0 )
- {
- lf->oldFrame = lf->frame = lf->backlerp = 0;
- return;
- }
-
- // see if the animation sequence is switching
- if( newAnimation != lf->animationNumber || !lf->animation )
- {
- if( cg_debugRandom.integer )
- CG_Printf( "newAnimation: %d lf->animationNumber: %d lf->animation: %d\n",
- newAnimation, lf->animationNumber, lf->animation );
-
- CG_SetBuildableLerpFrameAnimation( buildable, lf, newAnimation );
-
- if( !cg_buildables[ buildable ].sounds[ newAnimation ].looped &&
- cg_buildables[ buildable ].sounds[ newAnimation ].enabled )
- {
- if( cg_debugRandom.integer )
- CG_Printf( "Sound for animation %d for a %s\n",
- newAnimation, BG_FindHumanNameForBuildable( buildable ) );
-
- trap_S_StartSound( cent->lerpOrigin, cent->currentState.number, CHAN_AUTO,
- cg_buildables[ buildable ].sounds[ newAnimation ].sound );
- }
- }
-
- if( cg_buildables[ buildable ].sounds[ lf->animationNumber ].looped &&
- cg_buildables[ buildable ].sounds[ lf->animationNumber ].enabled )
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin,
- cg_buildables[ buildable ].sounds[ lf->animationNumber ].sound );
-
- // if we have passed the current frame, move it to
- // oldFrame and calculate a new frame
- if( cg.time >= lf->frameTime )
- {
- lf->oldFrame = lf->frame;
- lf->oldFrameTime = lf->frameTime;
-
- // get the next frame based on the animation
- anim = lf->animation;
- if( !anim->frameLerp )
- return; // shouldn't happen
-
- if ( cg.time < lf->animationTime )
- lf->frameTime = lf->animationTime; // initial lerp
- else
- lf->frameTime = lf->oldFrameTime + anim->frameLerp;
-
- f = ( lf->frameTime - lf->animationTime ) / anim->frameLerp;
- numFrames = anim->numFrames;
- if(anim->flipflop)
- numFrames *= 2;
-
- if( f >= numFrames )
- {
- f -= numFrames;
- if( anim->loopFrames )
- {
- f %= anim->loopFrames;
- f += anim->numFrames - anim->loopFrames;
- }
- else
- {
- f = numFrames - 1;
- // the animation is stuck at the end, so it
- // can immediately transition to another sequence
- lf->frameTime = cg.time;
- cent->buildableAnim = cent->currentState.torsoAnim;
- }
- }
-
- if( anim->reversed )
- lf->frame = anim->firstFrame + anim->numFrames - 1 - f;
- else if( anim->flipflop && f >= anim->numFrames )
- lf->frame = anim->firstFrame + anim->numFrames - 1 - ( f % anim->numFrames );
- else
- lf->frame = anim->firstFrame + f;
-
- if( cg.time > lf->frameTime )
- {
- lf->frameTime = cg.time;
- if( cg_debugAnim.integer )
- CG_Printf( "Clamp lf->frameTime\n");
- }
- }
-
- if( lf->frameTime > cg.time + 200 )
- lf->frameTime = cg.time;
-
- if( lf->oldFrameTime > cg.time )
- lf->oldFrameTime = cg.time;
-
- // calculate current lerp value
- if( lf->frameTime == lf->oldFrameTime )
- lf->backlerp = 0;
- else
- lf->backlerp = 1.0 - (float)( cg.time - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime );
-}
-
-/*
-===============
-CG_BuildableAnimation
-===============
-*/
-static void CG_BuildableAnimation( centity_t *cent, int *old, int *now, float *backLerp )
-{
- entityState_t *es = ¢->currentState;
-
- //if no animation is set default to idle anim
- if( cent->buildableAnim == BANIM_NONE )
- cent->buildableAnim = es->torsoAnim;
-
- //display the first frame of the construction anim if not yet spawned
- if( !( es->generic1 & B_SPAWNED_TOGGLEBIT ) )
- {
- animation_t *anim = &cg_buildables[ es->modelindex ].animations[ BANIM_CONSTRUCT1 ];
-
- //so that when animation starts for real it has sensible numbers
- cent->lerpFrame.oldFrameTime =
- cent->lerpFrame.frameTime =
- cent->lerpFrame.animationTime =
- cg.time;
-
- *old = cent->lerpFrame.oldFrame = anim->firstFrame;
- *now = cent->lerpFrame.frame = anim->firstFrame;
- *backLerp = cent->lerpFrame.backlerp = 0.0f;
-
- //ensure that an animation is triggered once the buildable has spawned
- cent->oldBuildableAnim = BANIM_NONE;
- }
- else
- {
- if( ( cent->oldBuildableAnim ^ es->legsAnim ) & ANIM_TOGGLEBIT )
- {
- if( cg_debugAnim.integer )
- CG_Printf( "%d->%d l:%d t:%d %s(%d)\n",
- cent->oldBuildableAnim, cent->buildableAnim,
- es->legsAnim, es->torsoAnim,
- BG_FindHumanNameForBuildable( es->modelindex ), es->number );
-
- if( cent->buildableAnim == es->torsoAnim || es->legsAnim & ANIM_FORCEBIT )
- cent->buildableAnim = cent->oldBuildableAnim = es->legsAnim;
- else
- cent->buildableAnim = cent->oldBuildableAnim = es->torsoAnim;
- }
-
- CG_RunBuildableLerpFrame( cent );
-
- *old = cent->lerpFrame.oldFrame;
- *now = cent->lerpFrame.frame;
- *backLerp = cent->lerpFrame.backlerp;
- }
-}
-
-#define TRACE_DEPTH 64.0f
-
-/*
-===============
-CG_PositionAndOrientateBuildable
-===============
-*/
-static void CG_PositionAndOrientateBuildable( const vec3_t angles, const vec3_t inOrigin,
- const vec3_t normal, const int skipNumber,
- const vec3_t mins, const vec3_t maxs,
- vec3_t outAxis[ 3 ], vec3_t outOrigin )
-{
- vec3_t forward, start, end;
- trace_t tr;
-
- AngleVectors( angles, forward, NULL, NULL );
- VectorCopy( normal, outAxis[ 2 ] );
- ProjectPointOnPlane( outAxis[ 0 ], forward, outAxis[ 2 ] );
-
- if( !VectorNormalize( outAxis[ 0 ] ) )
- {
- AngleVectors( angles, NULL, NULL, forward );
- ProjectPointOnPlane( outAxis[ 0 ], forward, outAxis[ 2 ] );
- VectorNormalize( outAxis[ 0 ] );
- }
-
- CrossProduct( outAxis[ 0 ], outAxis[ 2 ], outAxis[ 1 ] );
- outAxis[ 1 ][ 0 ] = -outAxis[ 1 ][ 0 ];
- outAxis[ 1 ][ 1 ] = -outAxis[ 1 ][ 1 ];
- outAxis[ 1 ][ 2 ] = -outAxis[ 1 ][ 2 ];
-
- VectorMA( inOrigin, -TRACE_DEPTH, normal, end );
- VectorMA( inOrigin, 1.0f, normal, start );
- CG_CapTrace( &tr, start, mins, maxs, end, skipNumber, MASK_PLAYERSOLID );
-
- if( tr.fraction == 1.0f )
- {
- //erm we missed completely - try again with a box trace
- CG_Trace( &tr, start, mins, maxs, end, skipNumber, MASK_PLAYERSOLID );
- }
-
- VectorMA( inOrigin, tr.fraction * -TRACE_DEPTH, normal, outOrigin );
-}
-
-/*
-==================
-CG_GhostBuildable
-==================
-*/
-void CG_GhostBuildable( buildable_t buildable )
-{
- refEntity_t ent;
- playerState_t *ps;
- vec3_t angles, entity_origin;
- vec3_t mins, maxs;
- trace_t tr;
- float scale;
-
- ps = &cg.predictedPlayerState;
-
- memset( &ent, 0, sizeof( ent ) );
-
- BG_FindBBoxForBuildable( buildable, mins, maxs );
-
- BG_PositionBuildableRelativeToPlayer( ps, mins, maxs, CG_Trace, entity_origin, angles, &tr );
-
- CG_PositionAndOrientateBuildable( ps->viewangles, entity_origin, tr.plane.normal, ps->clientNum,
- mins, maxs, ent.axis, ent.origin );
-
- //offset on the Z axis if required
- VectorMA( ent.origin, BG_FindZOffsetForBuildable( buildable ), tr.plane.normal, ent.origin );
-
- VectorCopy( ent.origin, ent.lightingOrigin );
- VectorCopy( ent.origin, ent.oldorigin ); // don't positionally lerp at all
-
- ent.hModel = cg_buildables[ buildable ].models[ 0 ];
-
- if( ps->stats[ STAT_BUILDABLE ] & SB_VALID_TOGGLEBIT )
- ent.customShader = cgs.media.greenBuildShader;
- else
- ent.customShader = cgs.media.redBuildShader;
-
- //rescale the model
- scale = BG_FindModelScaleForBuildable( buildable );
-
- if( scale != 1.0f )
- {
- VectorScale( ent.axis[ 0 ], scale, ent.axis[ 0 ] );
- VectorScale( ent.axis[ 1 ], scale, ent.axis[ 1 ] );
- VectorScale( ent.axis[ 2 ], scale, ent.axis[ 2 ] );
-
- ent.nonNormalizedAxes = qtrue;
- }
- else
- ent.nonNormalizedAxes = qfalse;
-
- // add to refresh list
- trap_R_AddRefEntityToScene( &ent );
-}
-
-/*
-==================
-CG_BuildableParticleEffects
-==================
-*/
-static void CG_BuildableParticleEffects( centity_t *cent )
-{
- entityState_t *es = ¢->currentState;
- buildableTeam_t team = BG_FindTeamForBuildable( es->modelindex );
- int health = es->generic1 & B_HEALTH_MASK;
- float healthFrac = (float)health / B_HEALTH_MASK;
-
- if( !( es->generic1 & B_SPAWNED_TOGGLEBIT ) )
- return;
-
- if( team == BIT_HUMANS )
- {
- if( healthFrac < 0.33f && !CG_IsParticleSystemValid( ¢->buildablePS ) )
- {
- cent->buildablePS = CG_SpawnNewParticleSystem( cgs.media.humanBuildableDamagedPS );
-
- if( CG_IsParticleSystemValid( ¢->buildablePS ) )
- {
- CG_SetAttachmentCent( ¢->buildablePS->attachment, cent );
- CG_AttachToCent( ¢->buildablePS->attachment );
- }
- }
- else if( healthFrac >= 0.33f && CG_IsParticleSystemValid( ¢->buildablePS ) )
- CG_DestroyParticleSystem( ¢->buildablePS );
- }
- else if( team == BIT_ALIENS )
- {
- if( healthFrac < 0.33f && !CG_IsParticleSystemValid( ¢->buildablePS ) )
- {
- cent->buildablePS = CG_SpawnNewParticleSystem( cgs.media.alienBuildableDamagedPS );
-
- if( CG_IsParticleSystemValid( ¢->buildablePS ) )
- {
- CG_SetAttachmentCent( ¢->buildablePS->attachment, cent );
- CG_SetParticleSystemNormal( cent->buildablePS, es->origin2 );
- CG_AttachToCent( ¢->buildablePS->attachment );
- }
- }
- else if( healthFrac >= 0.33f && CG_IsParticleSystemValid( ¢->buildablePS ) )
- CG_DestroyParticleSystem( ¢->buildablePS );
- }
-}
-
-
-void CG_BuildableStatusParse( const char *filename, buildStat_t *bs )
-{
- pc_token_t token;
- int handle;
- const char *s;
- int i;
- float f;
- vec4_t c;
-
- handle = trap_Parse_LoadSource( filename );
- if( !handle )
- return;
- while( 1 )
- {
- if( !trap_Parse_ReadToken( handle, &token ) )
- break;
- if( !Q_stricmp( token.string, "frameShader" ) )
- {
- if( PC_String_Parse( handle, &s ) )
- bs->frameShader = trap_R_RegisterShader( s );
- continue;
- }
- else if( !Q_stricmp( token.string, "overlayShader" ) )
- {
- if( PC_String_Parse( handle, &s ) )
- bs->overlayShader = trap_R_RegisterShader( s );
- continue;
- }
- else if( !Q_stricmp( token.string, "noPowerShader" ) )
- {
- if( PC_String_Parse( handle, &s ) )
- bs->noPowerShader = trap_R_RegisterShader( s );
- continue;
- }
- else if( !Q_stricmp( token.string, "markedShader" ) )
- {
- if( PC_String_Parse( handle, &s ) )
- bs->markedShader = trap_R_RegisterShader( s );
- continue;
- }
- else if( !Q_stricmp( token.string, "healthSevereColor" ) )
- {
- if( PC_Color_Parse( handle, &c ) )
- Vector4Copy( c, bs->healthSevereColor );
- continue;
- }
- else if( !Q_stricmp( token.string, "healthHighColor" ) )
- {
- if( PC_Color_Parse( handle, &c ) )
- Vector4Copy( c, bs->healthHighColor );
- continue;
- }
- else if( !Q_stricmp( token.string, "healthElevatedColor" ) )
- {
- if( PC_Color_Parse( handle, &c ) )
- Vector4Copy( c, bs->healthElevatedColor );
- continue;
- }
- else if( !Q_stricmp( token.string, "healthGuardedColor" ) )
- {
- if( PC_Color_Parse( handle, &c ) )
- Vector4Copy( c, bs->healthGuardedColor );
- continue;
- }
- else if( !Q_stricmp( token.string, "healthLowColor" ) )
- {
- if( PC_Color_Parse( handle, &c ) )
- Vector4Copy( c, bs->healthLowColor );
- continue;
- }
- else if( !Q_stricmp( token.string, "foreColor" ) )
- {
- if( PC_Color_Parse( handle, &c ) )
- Vector4Copy( c, bs->foreColor );
- continue;
- }
- else if( !Q_stricmp( token.string, "backColor" ) )
- {
- if( PC_Color_Parse( handle, &c ) )
- Vector4Copy( c, bs->backColor );
- continue;
- }
- else if( !Q_stricmp( token.string, "frameHeight" ) )
- {
- if( PC_Int_Parse( handle, &i ) )
- bs->frameHeight = i;
- continue;
- }
- else if( !Q_stricmp( token.string, "frameWidth" ) )
- {
- if( PC_Int_Parse( handle, &i ) )
- bs->frameWidth = i;
- continue;
- }
- else if( !Q_stricmp( token.string, "healthPadding" ) )
- {
- if( PC_Int_Parse( handle, &i ) )
- bs->healthPadding = i;
- continue;
- }
- else if( !Q_stricmp( token.string, "overlayHeight" ) )
- {
- if( PC_Int_Parse( handle, &i ) )
- bs->overlayHeight = i;
- continue;
- }
- else if( !Q_stricmp( token.string, "overlayWidth" ) )
- {
- if( PC_Int_Parse( handle, &i ) )
- bs->overlayWidth = i;
- continue;
- }
- else if( !Q_stricmp( token.string, "verticalMargin" ) )
- {
- if( PC_Float_Parse( handle, &f ) )
- bs->verticalMargin = f;
- continue;
- }
- else if( !Q_stricmp( token.string, "horizontalMargin" ) )
- {
- if( PC_Float_Parse( handle, &f ) )
- bs->horizontalMargin = f;
- continue;
- }
- else
- {
- Com_Printf("CG_BuildableStatusParse: unknown token %s in %s\n",
- token.string, filename );
- bs->loaded = qfalse;
- return;
- }
- }
- bs->loaded = qtrue;
-}
-
-#define STATUS_FADE_TIME 200
-#define STATUS_MAX_VIEW_DIST 900.0f
-#define STATUS_PEEK_DIST 20
-/*
-==================
-CG_BuildableStatusDisplay
-==================
-*/
-static void CG_BuildableStatusDisplay( centity_t *cent )
-{
- entityState_t *es = ¢->currentState;
- vec3_t origin;
- float healthScale;
- int health;
- float x, y;
- vec4_t color;
- qboolean powered, marked;
- trace_t tr;
- float d;
- buildStat_t *bs;
- int i, j;
- int entNum;
- vec3_t trOrigin;
- vec3_t right;
- qboolean visible = qfalse;
- vec3_t mins, maxs;
- entityState_t *hit;
-
- if( BG_FindTeamForBuildable( es->modelindex ) == BIT_ALIENS )
- bs = &cgs.alienBuildStat;
- else
- bs = &cgs.humanBuildStat;
-
- if( !bs->loaded )
- return;
-
- d = Distance( cent->lerpOrigin, cg.refdef.vieworg );
- if( d > STATUS_MAX_VIEW_DIST )
- return;
-
- Vector4Copy( bs->foreColor, color );
-
- // trace for center point
- BG_FindBBoxForBuildable( es->modelindex, mins, maxs );
-
- VectorCopy( cent->lerpOrigin, origin );
-
- // center point
- origin[ 2 ] += mins[ 2 ];
- origin[ 2 ] += ( abs( mins[ 2 ] ) + abs( maxs[ 2 ] ) ) / 2;
-
- entNum = cg.predictedPlayerState.clientNum;
-
- // if first try fails, step left, step right
- for( j = 0; j < 3; j++ )
- {
- VectorCopy( cg.refdef.vieworg, trOrigin );
- switch( j )
- {
- case 1:
- // step right
- AngleVectors( cg.refdefViewAngles, NULL, right, NULL );
- VectorMA( trOrigin, STATUS_PEEK_DIST, right, trOrigin );
- break;
- case 2:
- // step left
- AngleVectors( cg.refdefViewAngles, NULL, right, NULL );
- VectorMA( trOrigin, -STATUS_PEEK_DIST, right, trOrigin );
- break;
- default:
- break;
- }
- // look through up to 3 players and/or transparent buildables
- for( i = 0; i < 3; i++ )
- {
- CG_Trace( &tr, trOrigin, NULL, NULL, origin, entNum, MASK_SHOT );
- if( tr.entityNum == cent->currentState.number )
- {
- visible = qtrue;
- break;
- }
-
- if( tr.entityNum == ENTITYNUM_WORLD )
- break;
-
- hit = &cg_entities[ tr.entityNum ].currentState;
-
- if( tr.entityNum < MAX_CLIENTS || ( hit->eType == ET_BUILDABLE &&
- ( !( es->generic1 & B_SPAWNED_TOGGLEBIT ) ||
- BG_FindTransparentTestForBuildable( hit->modelindex ) ) ) )
- {
- entNum = tr.entityNum;
- VectorCopy( tr.endpos, trOrigin );
- }
- else
- break;
- }
- }
- // hack to make the kit obscure view
- if( cg_drawGun.integer && visible &&
- cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS &&
- CG_WorldToScreen( origin, &x, &y ) )
- {
- if( x > 450 && y > 290 )
- visible = qfalse;
- }
-
- if( !visible && cent->buildableStatus.visible )
- {
- cent->buildableStatus.visible = qfalse;
- cent->buildableStatus.lastTime = cg.time;
- }
- else if( visible && !cent->buildableStatus.visible )
- {
- cent->buildableStatus.visible = qtrue;
- cent->buildableStatus.lastTime = cg.time;
- }
-
- // Fade up
- if( cent->buildableStatus.visible )
- {
- if( cent->buildableStatus.lastTime + STATUS_FADE_TIME > cg.time )
- color[ 3 ] = (float)( cg.time - cent->buildableStatus.lastTime ) / STATUS_FADE_TIME;
- }
-
- // Fade down
- if( !cent->buildableStatus.visible )
- {
- if( cent->buildableStatus.lastTime + STATUS_FADE_TIME > cg.time )
- color[ 3 ] = 1.0f - (float)( cg.time - cent->buildableStatus.lastTime ) / STATUS_FADE_TIME;
- else
- return;
- }
-
- health = es->generic1 & B_HEALTH_MASK;
- healthScale = (float)health / B_HEALTH_MASK;
-
- if( health > 0 && healthScale < 0.01f )
- healthScale = 0.01f;
- else if( healthScale < 0.0f )
- healthScale = 0.0f;
- else if( healthScale > 1.0f )
- healthScale = 1.0f;
-
- if( CG_WorldToScreen( origin, &x, &y ) )
- {
- float picH = bs->frameHeight;
- float picW = bs->frameWidth;
- float picX = x;
- float picY = y;
- float scale;
- float subH, subY;
- vec4_t frameColor;
-
- // this is fudged to get the width/height in the cfg to be more realistic
- scale = ( picH / d ) * 3;
-
- powered = es->generic1 & B_POWERED_TOGGLEBIT;
- marked = es->generic1 & B_MARKED_TOGGLEBIT;
-
- picH *= scale;
- picW *= scale;
- picX -= ( picW * 0.5f );
- picY -= ( picH * 0.5f );
-
- // sub-elements such as icons and number
- subH = picH - ( picH * bs->verticalMargin );
- subY = picY + ( picH * 0.5f ) - ( subH * 0.5f );
-
- if( bs->frameShader )
- {
- Vector4Copy( bs->backColor, frameColor );
- frameColor[ 3 ] = color[ 3 ];
- trap_R_SetColor( frameColor );
- CG_DrawPic( picX, picY, picW, picH, bs->frameShader );
- trap_R_SetColor( NULL );
- }
-
- if( health > 0 )
- {
- float hX, hY, hW, hH;
- vec4_t healthColor;
-
- hX = picX + ( bs->healthPadding * scale );
- hY = picY + ( bs->healthPadding * scale );
- hH = picH - ( bs->healthPadding * 2.0f * scale );
- hW = picW * healthScale - ( bs->healthPadding * 2.0f * scale );
-
- if( healthScale == 1.0f )
- Vector4Copy( bs->healthLowColor, healthColor );
- else if( healthScale >= 0.75f )
- Vector4Copy( bs->healthGuardedColor, healthColor );
- else if( healthScale >= 0.50f )
- Vector4Copy( bs->healthElevatedColor, healthColor );
- else if( healthScale >= 0.25f )
- Vector4Copy( bs->healthHighColor, healthColor );
- else
- Vector4Copy( bs->healthSevereColor, healthColor );
-
- healthColor[ 3 ] = color[ 3 ];
- trap_R_SetColor( healthColor );
-
- CG_DrawPic( hX, hY, hW, hH, cgs.media.whiteShader );
- trap_R_SetColor( NULL );
- }
-
- if( bs->overlayShader )
- {
- float oW = bs->overlayWidth;
- float oH = bs->overlayHeight;
- float oX = x;
- float oY = y;
-
- oH *= scale;
- oW *= scale;
- oX -= ( oW * 0.5f );
- oY -= ( oH * 0.5f );
-
- trap_R_SetColor( frameColor );
- CG_DrawPic( oX, oY, oW, oH, bs->overlayShader );
- trap_R_SetColor( NULL );
- }
-
- trap_R_SetColor( color );
- if( !powered )
- {
- float pX;
-
- pX = picX + ( subH * bs->horizontalMargin );
- CG_DrawPic( pX, subY, subH, subH, bs->noPowerShader );
- }
-
- if( marked )
- {
- float mX;
-
- mX = picX + picW - ( subH * bs->horizontalMargin ) - subH;
- CG_DrawPic( mX, subY, subH, subH, bs->markedShader );
- }
-
- {
- float nX;
- int healthMax;
- int healthPoints;
-
- healthMax = BG_FindHealthForBuildable( es->modelindex );
- healthPoints = (int)( healthScale * healthMax );
- if( health > 0 && healthPoints < 1 )
- healthPoints = 1;
- nX = picX + ( picW * 0.5f ) - 2.0f - ( ( subH * 4 ) * 0.5f );
-
- if( healthPoints > 999 )
- nX -= 0.0f;
- else if( healthPoints > 99 )
- nX -= subH * 0.5f;
- else if( healthPoints > 9 )
- nX -= subH * 1.0f;
- else
- nX -= subH * 1.5f;
-
- CG_DrawField( nX, subY, 4, subH, subH, healthPoints );
- }
- trap_R_SetColor( NULL );
- }
-}
-
-static int QDECL CG_SortDistance( const void *a, const void *b )
-{
- centity_t *aent, *bent;
- float adist, bdist;
-
- aent = &cg_entities[ *(int *)a ];
- bent = &cg_entities[ *(int *)b ];
- adist = Distance( cg.refdef.vieworg, aent->lerpOrigin );
- bdist = Distance( cg.refdef.vieworg, bent->lerpOrigin );
- if( adist > bdist )
- return -1;
- else if( adist < bdist )
- return 1;
- else
- return 0;
-}
-
-/*
-==================
-CG_DrawBuildableStatus
-==================
-*/
-void CG_DrawBuildableStatus( void )
-{
- int i;
- centity_t *cent;
- entityState_t *es;
- int buildableList[ MAX_ENTITIES_IN_SNAPSHOT ];
- int buildables = 0;
-
- switch( cg.predictedPlayerState.weapon )
- {
- case WP_ABUILD:
- case WP_ABUILD2:
- case WP_HBUILD:
- case WP_HBUILD2:
- for( i = 0; i < cg.snap->numEntities; i++ )
- {
- cent = &cg_entities[ cg.snap->entities[ i ].number ];
- es = ¢->currentState;
-
- if( es->eType == ET_BUILDABLE &&
- BG_FindTeamForBuildable( es->modelindex ) ==
- BG_FindTeamForWeapon( cg.predictedPlayerState.weapon ) )
- buildableList[ buildables++ ] = cg.snap->entities[ i ].number;
- }
- qsort( buildableList, buildables, sizeof( int ), CG_SortDistance );
- for( i = 0; i < buildables; i++ )
- CG_BuildableStatusDisplay( &cg_entities[ buildableList[ i ] ] );
- break;
-
- default:
- break;
- }
-}
-
-#define BUILDABLE_SOUND_PERIOD 500
-
-/*
-==================
-CG_Buildable
-==================
-*/
-void CG_Buildable( centity_t *cent )
-{
- refEntity_t ent;
- entityState_t *es = ¢->currentState;
- vec3_t angles;
- vec3_t surfNormal, xNormal, mins, maxs;
- vec3_t refNormal = { 0.0f, 0.0f, 1.0f };
- float rotAngle;
- buildableTeam_t team = BG_FindTeamForBuildable( es->modelindex );
- float scale;
- int health;
- float healthScale;
-
- //must be before EF_NODRAW check
- if( team == BIT_ALIENS )
- CG_Creep( cent );
-
- // if set to invisible, skip
- if( es->eFlags & EF_NODRAW )
- {
- if( CG_IsParticleSystemValid( ¢->buildablePS ) )
- CG_DestroyParticleSystem( ¢->buildablePS );
-
- return;
- }
-
- memset ( &ent, 0, sizeof( ent ) );
-
- VectorCopy( cent->lerpOrigin, ent.origin );
- VectorCopy( cent->lerpOrigin, ent.oldorigin );
- VectorCopy( cent->lerpOrigin, ent.lightingOrigin );
-
- VectorCopy( es->origin2, surfNormal );
-
- VectorCopy( es->angles, angles );
- BG_FindBBoxForBuildable( es->modelindex, mins, maxs );
-
- if( es->pos.trType == TR_STATIONARY )
- CG_PositionAndOrientateBuildable( angles, ent.origin, surfNormal, es->number,
- mins, maxs, ent.axis, ent.origin );
-
- //offset on the Z axis if required
- VectorMA( ent.origin, BG_FindZOffsetForBuildable( es->modelindex ), surfNormal, ent.origin );
-
- VectorCopy( ent.origin, ent.oldorigin ); // don't positionally lerp at all
- VectorCopy( ent.origin, ent.lightingOrigin );
-
- ent.hModel = cg_buildables[ es->modelindex ].models[ 0 ];
-
- if( !( es->generic1 & B_SPAWNED_TOGGLEBIT ) )
- {
- sfxHandle_t prebuildSound = cgs.media.humanBuildablePrebuild;
-
- if( team == BIT_HUMANS )
- {
- ent.customShader = cgs.media.humanSpawningShader;
- prebuildSound = cgs.media.humanBuildablePrebuild;
- }
- else if( team == BIT_ALIENS )
- prebuildSound = cgs.media.alienBuildablePrebuild;
-
- trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, prebuildSound );
- }
-
- CG_BuildableAnimation( cent, &ent.oldframe, &ent.frame, &ent.backlerp );
-
- //rescale the model
- scale = BG_FindModelScaleForBuildable( es->modelindex );
-
- if( scale != 1.0f )
- {
- VectorScale( ent.axis[ 0 ], scale, ent.axis[ 0 ] );
- VectorScale( ent.axis[ 1 ], scale, ent.axis[ 1 ] );
- VectorScale( ent.axis[ 2 ], scale, ent.axis[ 2 ] );
-
- ent.nonNormalizedAxes = qtrue;
- }
- else
- ent.nonNormalizedAxes = qfalse;
-
-
- //add to refresh list
- trap_R_AddRefEntityToScene( &ent );
-
- CrossProduct( surfNormal, refNormal, xNormal );
- VectorNormalize( xNormal );
- rotAngle = RAD2DEG( acos( DotProduct( surfNormal, refNormal ) ) );
-
- //turret barrel bit
- if( cg_buildables[ es->modelindex ].models[ 1 ] )
- {
- refEntity_t turretBarrel;
- vec3_t flatAxis[ 3 ];
-
- memset( &turretBarrel, 0, sizeof( turretBarrel ) );
-
- turretBarrel.hModel = cg_buildables[ es->modelindex ].models[ 1 ];
-
- CG_PositionEntityOnTag( &turretBarrel, &ent, ent.hModel, "tag_turret" );
- VectorCopy( cent->lerpOrigin, turretBarrel.lightingOrigin );
- AnglesToAxis( es->angles2, flatAxis );
-
- RotatePointAroundVector( turretBarrel.axis[ 0 ], xNormal, flatAxis[ 0 ], -rotAngle );
- RotatePointAroundVector( turretBarrel.axis[ 1 ], xNormal, flatAxis[ 1 ], -rotAngle );
- RotatePointAroundVector( turretBarrel.axis[ 2 ], xNormal, flatAxis[ 2 ], -rotAngle );
-
- turretBarrel.oldframe = ent.oldframe;
- turretBarrel.frame = ent.frame;
- turretBarrel.backlerp = ent.backlerp;
-
- turretBarrel.customShader = ent.customShader;
-
- if( scale != 1.0f )
- {
- VectorScale( turretBarrel.axis[ 0 ], scale, turretBarrel.axis[ 0 ] );
- VectorScale( turretBarrel.axis[ 1 ], scale, turretBarrel.axis[ 1 ] );
- VectorScale( turretBarrel.axis[ 2 ], scale, turretBarrel.axis[ 2 ] );
-
- turretBarrel.nonNormalizedAxes = qtrue;
- }
- else
- turretBarrel.nonNormalizedAxes = qfalse;
-
- trap_R_AddRefEntityToScene( &turretBarrel );
- }
-
- //turret barrel bit
- if( cg_buildables[ es->modelindex ].models[ 2 ] )
- {
- refEntity_t turretTop;
- vec3_t flatAxis[ 3 ];
- vec3_t swivelAngles;
-
- memset( &turretTop, 0, sizeof( turretTop ) );
-
- VectorCopy( es->angles2, swivelAngles );
- swivelAngles[ PITCH ] = 0.0f;
-
- turretTop.hModel = cg_buildables[ es->modelindex ].models[ 2 ];
-
- CG_PositionRotatedEntityOnTag( &turretTop, &ent, ent.hModel, "tag_turret" );
- VectorCopy( cent->lerpOrigin, turretTop.lightingOrigin );
- AnglesToAxis( swivelAngles, flatAxis );
-
- RotatePointAroundVector( turretTop.axis[ 0 ], xNormal, flatAxis[ 0 ], -rotAngle );
- RotatePointAroundVector( turretTop.axis[ 1 ], xNormal, flatAxis[ 1 ], -rotAngle );
- RotatePointAroundVector( turretTop.axis[ 2 ], xNormal, flatAxis[ 2 ], -rotAngle );
-
- turretTop.oldframe = ent.oldframe;
- turretTop.frame = ent.frame;
- turretTop.backlerp = ent.backlerp;
-
- turretTop.customShader = ent.customShader;
-
- if( scale != 1.0f )
- {
- VectorScale( turretTop.axis[ 0 ], scale, turretTop.axis[ 0 ] );
- VectorScale( turretTop.axis[ 1 ], scale, turretTop.axis[ 1 ] );
- VectorScale( turretTop.axis[ 2 ], scale, turretTop.axis[ 2 ] );
-
- turretTop.nonNormalizedAxes = qtrue;
- }
- else
- turretTop.nonNormalizedAxes = qfalse;
-
- trap_R_AddRefEntityToScene( &turretTop );
- }
-
- //weapon effects for turrets
- if( es->eFlags & EF_FIRING )
- {
- weaponInfo_t *weapon = &cg_weapons[ es->weapon ];
-
- if( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME ||
- BG_FindProjTypeForBuildable( es->modelindex ) == WP_TESLAGEN )
- {
- if( weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 0 ] ||
- weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 1 ] ||
- weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 2 ] )
- {
- trap_R_AddLightToScene( cent->lerpOrigin, 300 + ( rand( ) & 31 ),
- weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 0 ],
- weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 1 ],
- weapon->wim[ WPM_PRIMARY ].flashDlightColor[ 2 ] );
- }
- }
-
- if( weapon->wim[ WPM_PRIMARY ].firingSound )
- {
- trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin,
- weapon->wim[ WPM_PRIMARY ].firingSound );
- }
- else if( weapon->readySound )
- trap_S_AddLoopingSound( es->number, cent->lerpOrigin, vec3_origin, weapon->readySound );
- }
-
- health = es->generic1 & B_HEALTH_MASK;
- healthScale = (float)health / B_HEALTH_MASK;
-
- if( healthScale < cent->lastBuildableHealthScale && ( es->generic1 & B_SPAWNED_TOGGLEBIT ) )
- {
- if( cent->lastBuildableDamageSoundTime + BUILDABLE_SOUND_PERIOD < cg.time )
- {
- if( team == BIT_HUMANS )
- {
- int i = rand( ) % 4;
- trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.humanBuildableDamage[ i ] );
- }
- else if( team == BIT_ALIENS )
- trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.alienBuildableDamage );
-
- cent->lastBuildableDamageSoundTime = cg.time;
- }
- }
-
- cent->lastBuildableHealthScale = healthScale;
-
- //smoke etc for damaged buildables
- CG_BuildableParticleEffects( cent );
-}
diff --git a/src/cgame/cg_consolecmds.c b/src/cgame/cg_consolecmds.c
deleted file mode 100644
index 68aab6c..0000000
--- a/src/cgame/cg_consolecmds.c
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_consolecmds.c -- text commands typed in at the local console, or
-// executed by a key binding
-
-
-#include "cg_local.h"
-
-
-
-void CG_TargetCommand_f( void )
-{
- int targetNum;
- char test[ 4 ];
-
- targetNum = CG_CrosshairPlayer( );
- if( !targetNum )
- return;
-
- trap_Argv( 1, test, 4 );
- trap_SendConsoleCommand( va( "gc %i %i", targetNum, atoi( test ) ) );
-}
-
-
-
-/*
-=================
-CG_SizeUp_f
-
-Keybinding command
-=================
-*/
-static void CG_SizeUp_f( void )
-{
- trap_Cvar_Set( "cg_viewsize", va( "%i", (int)( cg_viewsize.integer + 10 ) ) );
-}
-
-
-/*
-=================
-CG_SizeDown_f
-
-Keybinding command
-=================
-*/
-static void CG_SizeDown_f( void )
-{
- trap_Cvar_Set( "cg_viewsize", va( "%i", (int)( cg_viewsize.integer - 10 ) ) );
-}
-
-
-/*
-=============
-CG_Viewpos_f
-
-Debugging command to print the current position
-=============
-*/
-static void CG_Viewpos_f( void )
-{
- CG_Printf( "(%i %i %i) : %i\n", (int)cg.refdef.vieworg[ 0 ],
- (int)cg.refdef.vieworg[ 1 ], (int)cg.refdef.vieworg[ 2 ],
- (int)cg.refdefViewAngles[ YAW ] );
-}
-
-qboolean CG_RequestScores( void )
-{
- if( cg.scoresRequestTime + 2000 < cg.time )
- {
- // the scores are more than two seconds out of data,
- // so request new ones
- cg.scoresRequestTime = cg.time;
- //TA: added \n SendClientCommand doesn't call flush( )?
- trap_SendClientCommand( "score\n" );
-
- return qtrue;
- }
- else
- return qfalse;
-}
-
-extern menuDef_t *menuScoreboard;
-
-static void CG_scrollScoresDown_f( void )
-{
- if( menuScoreboard && cg.scoreBoardShowing )
- {
- Menu_ScrollFeeder( menuScoreboard, FEEDER_ALIENTEAM_LIST, qtrue );
- Menu_ScrollFeeder( menuScoreboard, FEEDER_HUMANTEAM_LIST, qtrue );
- }
-}
-
-
-static void CG_scrollScoresUp_f( void )
-{
- if( menuScoreboard && cg.scoreBoardShowing )
- {
- Menu_ScrollFeeder( menuScoreboard, FEEDER_ALIENTEAM_LIST, qfalse );
- Menu_ScrollFeeder( menuScoreboard, FEEDER_HUMANTEAM_LIST, qfalse );
- }
-}
-
-static void CG_ScoresDown_f( void )
-{
- if( !cg.showScores )
- {
- Menu_SetFeederSelection( menuScoreboard, FEEDER_ALIENTEAM_LIST, 0, NULL );
- Menu_SetFeederSelection( menuScoreboard, FEEDER_HUMANTEAM_LIST, 0, NULL );
- }
-
- if( CG_RequestScores( ) )
- {
- // leave the current scores up if they were already
- // displayed, but if this is the first hit, clear them out
- if( !cg.showScores )
- {
- if( cg_debugRandom.integer )
- CG_Printf( "CG_ScoresDown_f: scores out of date\n" );
-
- cg.showScores = qtrue;
- cg.numScores = 0;
- }
- }
- else
- {
- // show the cached contents even if they just pressed if it
- // is within two seconds
- cg.showScores = qtrue;
- }
-}
-
-static void CG_ScoresUp_f( void )
-{
- if( cg.showScores )
- {
- cg.showScores = qfalse;
- cg.scoreFadeTime = cg.time;
- }
-}
-
-static void CG_TellTarget_f( void )
-{
- int clientNum;
- char command[ 128 ];
- char message[ 128 ];
-
- clientNum = CG_CrosshairPlayer( );
- if( clientNum == -1 )
- return;
-
- trap_Args( message, 128 );
- Com_sprintf( command, 128, "tell %i %s", clientNum, message );
- trap_SendClientCommand( command );
-}
-
-static void CG_TellAttacker_f( void )
-{
- int clientNum;
- char command[ 128 ];
- char message[ 128 ];
-
- clientNum = CG_LastAttacker( );
- if( clientNum == -1 )
- return;
-
- trap_Args( message, 128 );
- Com_sprintf( command, 128, "tell %i %s", clientNum, message );
- trap_SendClientCommand( command );
-}
-
-typedef struct
-{
- char *cmd;
- void (*function)( void );
-} consoleCommand_t;
-
-static consoleCommand_t commands[ ] =
-{
- { "testgun", CG_TestGun_f },
- { "testmodel", CG_TestModel_f },
- { "nextframe", CG_TestModelNextFrame_f },
- { "prevframe", CG_TestModelPrevFrame_f },
- { "nextskin", CG_TestModelNextSkin_f },
- { "prevskin", CG_TestModelPrevSkin_f },
- { "viewpos", CG_Viewpos_f },
- { "+scores", CG_ScoresDown_f },
- { "-scores", CG_ScoresUp_f },
- { "scoresUp", CG_scrollScoresUp_f },
- { "scoresDown", CG_scrollScoresDown_f },
- { "sizeup", CG_SizeUp_f },
- { "sizedown", CG_SizeDown_f },
- { "weapnext", CG_NextWeapon_f },
- { "weapprev", CG_PrevWeapon_f },
- { "weapon", CG_Weapon_f },
- { "tell_target", CG_TellTarget_f },
- { "tell_attacker", CG_TellAttacker_f },
- { "tcmd", CG_TargetCommand_f },
- { "testPS", CG_TestPS_f },
- { "destroyTestPS", CG_DestroyTestPS_f },
- { "testTS", CG_TestTS_f },
- { "destroyTestTS", CG_DestroyTestTS_f },
-};
-
-
-/*
-=================
-CG_ConsoleCommand
-
-The string has been tokenized and can be retrieved with
-Cmd_Argc() / Cmd_Argv()
-=================
-*/
-qboolean CG_ConsoleCommand( void )
-{
- const char *cmd;
- const char *arg1;
- int i;
-
- cmd = CG_Argv( 0 );
-
- //TA: ugly hacky special case
- if( !Q_stricmp( cmd, "ui_menu" ) )
- {
- arg1 = CG_Argv( 1 );
- trap_SendConsoleCommand( va( "menu %s\n", arg1 ) );
- return qtrue;
- }
-
- for( i = 0; i < sizeof( commands ) / sizeof( commands[ 0 ] ); i++ )
- {
- if( !Q_stricmp( cmd, commands[ i ].cmd ) )
- {
- commands[ i ].function( );
- return qtrue;
- }
- }
-
- return qfalse;
-}
-
-
-/*
-=================
-CG_InitConsoleCommands
-
-Let the client system know about all of our commands
-so it can perform tab completion
-=================
-*/
-void CG_InitConsoleCommands( void )
-{
- int i;
-
- for( i = 0 ; i < sizeof( commands ) / sizeof( commands[ 0 ] ) ; i++ )
- trap_AddCommand( commands[ i ].cmd );
-
- //
- // the game server will interpret these commands, which will be automatically
- // forwarded to the server after they are not recognized locally
- //
- trap_AddCommand( "kill" );
- trap_AddCommand( "say" );
- trap_AddCommand( "say_team" );
- trap_AddCommand( "tell" );
- trap_AddCommand( "vsay" );
- trap_AddCommand( "vsay_team" );
- trap_AddCommand( "vtell" );
- trap_AddCommand( "vtaunt" );
- trap_AddCommand( "vosay" );
- trap_AddCommand( "vosay_team" );
- trap_AddCommand( "votell" );
- trap_AddCommand( "give" );
- trap_AddCommand( "god" );
- trap_AddCommand( "notarget" );
- trap_AddCommand( "noclip" );
- trap_AddCommand( "team" );
- trap_AddCommand( "follow" );
- trap_AddCommand( "levelshot" );
- trap_AddCommand( "addbot" );
- trap_AddCommand( "setviewpos" );
- trap_AddCommand( "callvote" );
- trap_AddCommand( "vote" );
- trap_AddCommand( "callteamvote" );
- trap_AddCommand( "teamvote" );
- trap_AddCommand( "stats" );
- trap_AddCommand( "teamtask" );
- trap_AddCommand( "class" );
- trap_AddCommand( "build" );
- trap_AddCommand( "buy" );
- trap_AddCommand( "sell" );
- trap_AddCommand( "reload" );
- trap_AddCommand( "itemact" );
- trap_AddCommand( "itemdeact" );
- trap_AddCommand( "itemtoggle" );
- trap_AddCommand( "destroy" );
- trap_AddCommand( "deconstruct" );
- trap_AddCommand( "menu" );
- trap_AddCommand( "ui_menu" );
- trap_AddCommand( "mapRotation" );
- trap_AddCommand( "stopMapRotation" );
- trap_AddCommand( "advanceMapRotation" );
- trap_AddCommand( "alienWin" );
- trap_AddCommand( "humanWin" );
-}
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c
deleted file mode 100644
index 82df413..0000000
--- a/src/cgame/cg_draw.c
+++ /dev/null
@@ -1,3524 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_draw.c -- draw all of the graphical elements during
-// active (after loading) gameplay
-
-
-#include "cg_local.h"
-#include "../ui/ui_shared.h"
-
-// used for scoreboard
-extern displayContextDef_t cgDC;
-menuDef_t *menuScoreboard = NULL;
-
-int drawTeamOverlayModificationCount = -1;
-
-int sortedTeamPlayers[ TEAM_MAXOVERLAY ];
-int numSortedTeamPlayers;
-
-//TA UI
-int CG_Text_Width( const char *text, float scale, int limit )
-{
- int count,len;
- float out;
- glyphInfo_t *glyph;
- float useScale;
-// FIXME: see ui_main.c, same problem
-// const unsigned char *s = text;
- const char *s = text;
- fontInfo_t *font = &cgDC.Assets.textFont;
-
- if( scale <= cg_smallFont.value )
- font = &cgDC.Assets.smallFont;
- else if( scale > cg_bigFont.value )
- font = &cgDC.Assets.bigFont;
-
- useScale = scale * font->glyphScale;
- out = 0;
-
- if( text )
- {
- len = strlen( text );
- if( limit > 0 && len > limit )
- len = limit;
-
- count = 0;
- while( s && *s && count < len )
- {
- if( Q_IsColorString( s ) )
- {
- s += 2;
- continue;
- }
- else
- {
- glyph = &font->glyphs[ (int)*s ];
- //TTimo: FIXME: getting nasty warnings without the cast,
- //hopefully this doesn't break the VM build
- out += glyph->xSkip;
- s++;
- count++;
- }
- }
- }
-
- return out * useScale;
-}
-
-int CG_Text_Height( const char *text, float scale, int limit )
-{
- int len, count;
- float max;
- glyphInfo_t *glyph;
- float useScale;
-// TTimo: FIXME
-// const unsigned char *s = text;
- const char *s = text;
- fontInfo_t *font = &cgDC.Assets.textFont;
-
- if( scale <= cg_smallFont.value )
- font = &cgDC.Assets.smallFont;
- else if( scale > cg_bigFont.value )
- font = &cgDC.Assets.bigFont;
-
- useScale = scale * font->glyphScale;
- max = 0;
-
- if( text )
- {
- len = strlen( text );
- if( limit > 0 && len > limit )
- len = limit;
-
- count = 0;
- while( s && *s && count < len )
- {
- if( Q_IsColorString( s ) )
- {
- s += 2;
- continue;
- }
- else
- {
- glyph = &font->glyphs[ (int)*s ];
- //TTimo: FIXME: getting nasty warnings without the cast,
- //hopefully this doesn't break the VM build
- if( max < glyph->height )
- max = glyph->height;
-
- s++;
- count++;
- }
- }
- }
-
- return max * useScale;
-}
-
-void CG_Text_PaintChar( float x, float y, float width, float height, float scale,
- float s, float t, float s2, float t2, qhandle_t hShader )
-{
- float w, h;
- w = width * scale;
- h = height * scale;
- CG_AdjustFrom640( &x, &y, &w, &h );
- trap_R_DrawStretchPic( x, y, w, h, s, t, s2, t2, hShader );
-}
-
-void CG_Text_Paint( float x, float y, float scale, vec4_t color, const char *text,
- float adjust, int limit, int style )
-{
- int len, count;
- vec4_t newColor;
- glyphInfo_t *glyph;
- float useScale;
- fontInfo_t *font = &cgDC.Assets.textFont;
-
- if( scale <= cg_smallFont.value )
- font = &cgDC.Assets.smallFont;
- else if( scale > cg_bigFont.value )
- font = &cgDC.Assets.bigFont;
-
- useScale = scale * font->glyphScale;
- if( text )
- {
-// TTimo: FIXME
-// const unsigned char *s = text;
- const char *s = text;
-
- trap_R_SetColor( color );
- memcpy( &newColor[ 0 ], &color[ 0 ], sizeof( vec4_t ) );
- len = strlen( text );
-
- if( limit > 0 && len > limit )
- len = limit;
-
- count = 0;
- while( s && *s && count < len )
- {
- glyph = &font->glyphs[ (int)*s ];
- //TTimo: FIXME: getting nasty warnings without the cast,
- //hopefully this doesn't break the VM build
-
- if( Q_IsColorString( s ) )
- {
- memcpy( newColor, g_color_table[ ColorIndex( *( s + 1 ) ) ], sizeof( newColor ) );
- newColor[ 3 ] = color[ 3 ];
- trap_R_SetColor( newColor );
- s += 2;
- continue;
- }
- else
- {
- float yadj = useScale * glyph->top;
- if( style == ITEM_TEXTSTYLE_SHADOWED ||
- style == ITEM_TEXTSTYLE_SHADOWEDMORE )
- {
- int ofs = style == ITEM_TEXTSTYLE_SHADOWED ? 1 : 2;
- colorBlack[ 3 ] = newColor[ 3 ];
- trap_R_SetColor( colorBlack );
- CG_Text_PaintChar( x + ofs, y - yadj + ofs,
- glyph->imageWidth,
- glyph->imageHeight,
- useScale,
- glyph->s,
- glyph->t,
- glyph->s2,
- glyph->t2,
- glyph->glyph );
-
- colorBlack[ 3 ] = 1.0;
- trap_R_SetColor( newColor );
- }
- else if( style == ITEM_TEXTSTYLE_NEON )
- {
- vec4_t glow, outer, inner, white;
-
- glow[ 0 ] = newColor[ 0 ] * 0.5;
- glow[ 1 ] = newColor[ 1 ] * 0.5;
- glow[ 2 ] = newColor[ 2 ] * 0.5;
- glow[ 3 ] = newColor[ 3 ] * 0.2;
-
- outer[ 0 ] = newColor[ 0 ];
- outer[ 1 ] = newColor[ 1 ];
- outer[ 2 ] = newColor[ 2 ];
- outer[ 3 ] = newColor[ 3 ];
-
- inner[ 0 ] = newColor[ 0 ] * 1.5 > 1.0f ? 1.0f : newColor[ 0 ] * 1.5;
- inner[ 1 ] = newColor[ 1 ] * 1.5 > 1.0f ? 1.0f : newColor[ 1 ] * 1.5;
- inner[ 2 ] = newColor[ 2 ] * 1.5 > 1.0f ? 1.0f : newColor[ 2 ] * 1.5;
- inner[ 3 ] = newColor[ 3 ];
-
- white[ 0 ] = white[ 1 ] = white[ 2 ] = white[ 3 ] = 1.0f;
-
- trap_R_SetColor( glow );
- CG_Text_PaintChar( x - 3, y - yadj - 3,
- glyph->imageWidth + 6,
- glyph->imageHeight + 6,
- useScale,
- glyph->s,
- glyph->t,
- glyph->s2,
- glyph->t2,
- glyph->glyph );
-
- trap_R_SetColor( outer );
- CG_Text_PaintChar( x - 1, y - yadj - 1,
- glyph->imageWidth + 2,
- glyph->imageHeight + 2,
- useScale,
- glyph->s,
- glyph->t,
- glyph->s2,
- glyph->t2,
- glyph->glyph );
-
- trap_R_SetColor( inner );
- CG_Text_PaintChar( x - 0.5, y - yadj - 0.5,
- glyph->imageWidth + 1,
- glyph->imageHeight + 1,
- useScale,
- glyph->s,
- glyph->t,
- glyph->s2,
- glyph->t2,
- glyph->glyph );
-
- trap_R_SetColor( white );
- }
-
-
- CG_Text_PaintChar( x, y - yadj,
- glyph->imageWidth,
- glyph->imageHeight,
- useScale,
- glyph->s,
- glyph->t,
- glyph->s2,
- glyph->t2,
- glyph->glyph );
-
- x += ( glyph->xSkip * useScale ) + adjust;
- s++;
- count++;
- }
- }
-
- trap_R_SetColor( NULL );
- }
-}
-
-/*
-==============
-CG_DrawFieldPadded
-
-Draws large numbers for status bar and powerups
-==============
-*/
-static void CG_DrawFieldPadded( int x, int y, int width, int cw, int ch, int value )
-{
- char num[ 16 ], *ptr;
- int l, orgL;
- int frame;
- int charWidth, charHeight;
-
- if( !( charWidth = cw ) )
- charWidth = CHAR_WIDTH;
-
- if( !( charHeight = ch ) )
- charWidth = CHAR_HEIGHT;
-
- if( width < 1 )
- return;
-
- // draw number string
- if( width > 4 )
- width = 4;
-
- switch( width )
- {
- case 1:
- value = value > 9 ? 9 : value;
- value = value < 0 ? 0 : value;
- break;
- case 2:
- value = value > 99 ? 99 : value;
- value = value < -9 ? -9 : value;
- break;
- case 3:
- value = value > 999 ? 999 : value;
- value = value < -99 ? -99 : value;
- break;
- case 4:
- value = value > 9999 ? 9999 : value;
- value = value < -999 ? -999 : value;
- break;
- }
-
- Com_sprintf( num, sizeof( num ), "%d", value );
- l = strlen( num );
-
- if( l > width )
- l = width;
-
- orgL = l;
-
- x += 2;
-
- ptr = num;
- while( *ptr && l )
- {
- if( width > orgL )
- {
- CG_DrawPic( x,y, charWidth, charHeight, cgs.media.numberShaders[ 0 ] );
- width--;
- x += charWidth;
- continue;
- }
-
- if( *ptr == '-' )
- frame = STAT_MINUS;
- else
- frame = *ptr - '0';
-
- CG_DrawPic( x,y, charWidth, charHeight, cgs.media.numberShaders[ frame ] );
- x += charWidth;
- ptr++;
- l--;
- }
-}
-
-/*
-==============
-CG_DrawField
-
-Draws large numbers for status bar and powerups
-==============
-*/
-void CG_DrawField( float x, float y, int width, float cw, float ch, int value )
-{
- char num[ 16 ], *ptr;
- int l;
- int frame;
- float charWidth, charHeight;
-
- if( !( charWidth = cw ) )
- charWidth = CHAR_WIDTH;
-
- if( !( charHeight = ch ) )
- charWidth = CHAR_HEIGHT;
-
- if( width < 1 )
- return;
-
- // draw number string
- if( width > 4 )
- width = 4;
-
- switch( width )
- {
- case 1:
- value = value > 9 ? 9 : value;
- value = value < 0 ? 0 : value;
- break;
- case 2:
- value = value > 99 ? 99 : value;
- value = value < -9 ? -9 : value;
- break;
- case 3:
- value = value > 999 ? 999 : value;
- value = value < -99 ? -99 : value;
- break;
- case 4:
- value = value > 9999 ? 9999 : value;
- value = value < -999 ? -999 : value;
- break;
- }
-
- Com_sprintf( num, sizeof( num ), "%d", value );
- l = strlen( num );
-
- if( l > width )
- l = width;
-
- x += 2 + charWidth * ( width - l );
-
- ptr = num;
- while( *ptr && l )
- {
- if( *ptr == '-' )
- frame = STAT_MINUS;
- else
- frame = *ptr -'0';
-
- CG_DrawPic( x,y, charWidth, charHeight, cgs.media.numberShaders[ frame ] );
- x += charWidth;
- ptr++;
- l--;
- }
-}
-
-static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color, float scale,
- int align, int textStyle, int special, float progress )
-{
- float rimWidth = rect->h / 20.0f;
- float doneWidth, leftWidth;
- float tx, ty, tw, th;
- char textBuffer[ 8 ];
-
- if( rimWidth < 0.6f )
- rimWidth = 0.6f;
-
- if( special >= 0.0f )
- rimWidth = special;
-
- if( progress < 0.0f )
- progress = 0.0f;
- else if( progress > 1.0f )
- progress = 1.0f;
-
- doneWidth = ( rect->w - 2 * rimWidth ) * progress;
- leftWidth = ( rect->w - 2 * rimWidth ) - doneWidth;
-
- trap_R_SetColor( color );
-
- //draw rim and bar
- if( align == ITEM_ALIGN_RIGHT )
- {
- CG_DrawPic( rect->x, rect->y, rimWidth, rect->h, cgs.media.whiteShader );
- CG_DrawPic( rect->x + rimWidth, rect->y,
- leftWidth, rimWidth, cgs.media.whiteShader );
- CG_DrawPic( rect->x + rimWidth, rect->y + rect->h - rimWidth,
- leftWidth, rimWidth, cgs.media.whiteShader );
- CG_DrawPic( rect->x + rimWidth + leftWidth, rect->y,
- rimWidth + doneWidth, rect->h, cgs.media.whiteShader );
- }
- else
- {
- CG_DrawPic( rect->x, rect->y, rimWidth + doneWidth, rect->h, cgs.media.whiteShader );
- CG_DrawPic( rimWidth + rect->x + doneWidth, rect->y,
- leftWidth, rimWidth, cgs.media.whiteShader );
- CG_DrawPic( rimWidth + rect->x + doneWidth, rect->y + rect->h - rimWidth,
- leftWidth, rimWidth, cgs.media.whiteShader );
- CG_DrawPic( rect->x + rect->w - rimWidth, rect->y, rimWidth, rect->h, cgs.media.whiteShader );
- }
-
- trap_R_SetColor( NULL );
-
- //draw text
- if( scale > 0.0 )
- {
- Com_sprintf( textBuffer, sizeof( textBuffer ), "%d%%", (int)( progress * 100 ) );
- tw = CG_Text_Width( textBuffer, scale, 0 );
- th = scale * 40.0f;
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- tx = rect->x + ( rect->w / 10.0f );
- ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f );
- break;
-
- case ITEM_ALIGN_RIGHT:
- tx = rect->x + rect->w - ( rect->w / 10.0f ) - tw;
- ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f );
- break;
-
- case ITEM_ALIGN_CENTER:
- tx = rect->x + ( rect->w / 2.0f ) - ( tw / 2.0f );
- ty = rect->y + ( rect->h / 2.0f ) + ( th / 2.0f );
- break;
-
- default:
- tx = ty = 0.0f;
- }
-
- CG_Text_Paint( tx, ty, scale, color, textBuffer, 0, 0, textStyle );
- }
-}
-
-//=============== TA: was cg_newdraw.c
-
-#define NO_CREDITS_TIME 2000
-
-static void CG_DrawPlayerCreditsValue( rectDef_t *rect, vec4_t color, qboolean padding )
-{
- int value;
- playerState_t *ps;
- centity_t *cent;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
- ps = &cg.snap->ps;
-
- //if the build timer pie is showing don't show this
- if( ( cent->currentState.weapon == WP_ABUILD ||
- cent->currentState.weapon == WP_ABUILD2 ) && ps->stats[ STAT_MISC ] )
- return;
-
- value = ps->persistant[ PERS_CREDIT ];
- if( value > -1 )
- {
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS &&
- !CG_AtHighestClass( ) )
- {
- if( cg.time - cg.lastEvolveAttempt <= NO_CREDITS_TIME )
- {
- if( ( ( cg.time - cg.lastEvolveAttempt ) / 300 ) % 2 )
- color[ 3 ] = 0.0f;
- }
- }
-
- trap_R_SetColor( color );
-
- if( padding )
- CG_DrawFieldPadded( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
- else
- CG_DrawField( rect->x, rect->y, 1, rect->w, rect->h, value );
-
- trap_R_SetColor( NULL );
- }
-}
-
-static void CG_DrawPlayerBankValue( rectDef_t *rect, vec4_t color, qboolean padding )
-{
- int value;
- playerState_t *ps;
-
- ps = &cg.snap->ps;
-
- value = ps->persistant[ PERS_BANK ];
- if( value > -1 )
- {
- trap_R_SetColor( color );
-
- if( padding )
- CG_DrawFieldPadded( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
- else
- CG_DrawField( rect->x, rect->y, 1, rect->w, rect->h, value );
-
- trap_R_SetColor( NULL );
- }
-}
-
-#define HH_MIN_ALPHA 0.2f
-#define HH_MAX_ALPHA 0.8f
-#define HH_ALPHA_DIFF (HH_MAX_ALPHA-HH_MIN_ALPHA)
-
-#define AH_MIN_ALPHA 0.2f
-#define AH_MAX_ALPHA 0.8f
-#define AH_ALPHA_DIFF (AH_MAX_ALPHA-AH_MIN_ALPHA)
-
-/*
-==============
-CG_DrawPlayerStamina1
-==============
-*/
-static void CG_DrawPlayerStamina1( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- float stamina = ps->stats[ STAT_STAMINA ];
- float maxStaminaBy3 = (float)MAX_STAMINA / 3.0f;
- float progress;
-
- stamina -= ( 2 * (int)maxStaminaBy3 );
- progress = stamina / maxStaminaBy3;
-
- if( progress > 1.0f )
- progress = 1.0f;
- else if( progress < 0.0f )
- progress = 0.0f;
-
- color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF );
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerStamina2
-==============
-*/
-static void CG_DrawPlayerStamina2( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- float stamina = ps->stats[ STAT_STAMINA ];
- float maxStaminaBy3 = (float)MAX_STAMINA / 3.0f;
- float progress;
-
- stamina -= (int)maxStaminaBy3;
- progress = stamina / maxStaminaBy3;
-
- if( progress > 1.0f )
- progress = 1.0f;
- else if( progress < 0.0f )
- progress = 0.0f;
-
- color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF );
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerStamina3
-==============
-*/
-static void CG_DrawPlayerStamina3( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- float stamina = ps->stats[ STAT_STAMINA ];
- float maxStaminaBy3 = (float)MAX_STAMINA / 3.0f;
- float progress;
-
- progress = stamina / maxStaminaBy3;
-
- if( progress > 1.0f )
- progress = 1.0f;
- else if( progress < 0.0f )
- progress = 0.0f;
-
- color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF );
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerStamina4
-==============
-*/
-static void CG_DrawPlayerStamina4( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- float stamina = ps->stats[ STAT_STAMINA ];
- float progress;
-
- stamina += (float)MAX_STAMINA;
- progress = stamina / (float)MAX_STAMINA;
-
- if( progress > 1.0f )
- progress = 1.0f;
- else if( progress < 0.0f )
- progress = 0.0f;
-
- color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF );
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerStaminaBolt
-==============
-*/
-static void CG_DrawPlayerStaminaBolt( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- float stamina = ps->stats[ STAT_STAMINA ];
-
- if( stamina < 0 )
- color[ 3 ] = HH_MIN_ALPHA;
- else
- color[ 3 ] = HH_MAX_ALPHA;
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerClipsRing
-==============
-*/
-static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- centity_t *cent;
- float buildTime = ps->stats[ STAT_MISC ];
- float progress;
- float maxDelay;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
-
- switch( cent->currentState.weapon )
- {
- case WP_ABUILD:
- case WP_ABUILD2:
- case WP_HBUILD:
- case WP_HBUILD2:
- maxDelay = (float)BG_FindBuildDelayForWeapon( cent->currentState.weapon );
-
- if( buildTime > maxDelay )
- buildTime = maxDelay;
-
- progress = ( maxDelay - buildTime ) / maxDelay;
-
- color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF );
- break;
-
- default:
- if( ps->weaponstate == WEAPON_RELOADING )
- {
- maxDelay = (float)BG_FindReloadTimeForWeapon( cent->currentState.weapon );
- progress = ( maxDelay - (float)ps->weaponTime ) / maxDelay;
-
- color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF );
- }
- break;
- }
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerBuildTimerRing
-==============
-*/
-static void CG_DrawPlayerBuildTimerRing( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- centity_t *cent;
- float buildTime = ps->stats[ STAT_MISC ];
- float progress;
- float maxDelay;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
-
- maxDelay = (float)BG_FindBuildDelayForWeapon( cent->currentState.weapon );
-
- if( buildTime > maxDelay )
- buildTime = maxDelay;
-
- progress = ( maxDelay - buildTime ) / maxDelay;
-
- color[ 3 ] = AH_MIN_ALPHA + ( progress * AH_ALPHA_DIFF );
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerBoosted
-==============
-*/
-static void CG_DrawPlayerBoosted( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- qboolean boosted = ps->stats[ STAT_STATE ] & SS_BOOSTED;
-
- if( boosted )
- color[ 3 ] = AH_MAX_ALPHA;
- else
- color[ 3 ] = AH_MIN_ALPHA;
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerBoosterBolt
-==============
-*/
-static void CG_DrawPlayerBoosterBolt( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- qboolean boosted = ps->stats[ STAT_STATE ] & SS_BOOSTED;
- vec4_t localColor;
-
- Vector4Copy( color, localColor );
-
- if( boosted )
- {
- if( ps->stats[ STAT_BOOSTTIME ] > BOOST_TIME - 3000 )
- {
- qboolean flash = ( ps->stats[ STAT_BOOSTTIME ] / 500 ) % 2;
-
- if( flash )
- localColor[ 3 ] = 1.0f;
- }
- }
-
- trap_R_SetColor( localColor );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerPoisonBarbs
-==============
-*/
-static void CG_DrawPlayerPoisonBarbs( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- int x = rect->x;
- int y = rect->y;
- int width = rect->w;
- int height = rect->h;
- qboolean vertical;
- int iconsize, numBarbs, i;
-
- BG_UnpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &numBarbs, NULL );
-
- if( height > width )
- {
- vertical = qtrue;
- iconsize = width;
- }
- else if( height <= width )
- {
- vertical = qfalse;
- iconsize = height;
- }
-
- if( color[ 3 ] != 0.0 )
- trap_R_SetColor( color );
-
- for( i = 0; i < numBarbs; i ++ )
- {
- if( vertical )
- y += iconsize;
- else
- x += iconsize;
-
- CG_DrawPic( x, y, iconsize, iconsize, shader );
- }
-
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawPlayerWallclimbing
-==============
-*/
-static void CG_DrawPlayerWallclimbing( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- qboolean ww = ps->stats[ STAT_STATE ] & SS_WALLCLIMBING;
-
- if( ww )
- color[ 3 ] = AH_MAX_ALPHA;
- else
- color[ 3 ] = AH_MIN_ALPHA;
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-static void CG_DrawPlayerStamina( rectDef_t *rect, vec4_t color, float scale,
- int align, int textStyle, int special )
-{
- playerState_t *ps = &cg.snap->ps;
- int stamina = ps->stats[ STAT_STAMINA ];
- float progress = ( (float)stamina + (float)MAX_STAMINA ) / ( (float)MAX_STAMINA * 2.0f );
-
- CG_DrawProgressBar( rect, color, scale, align, textStyle, special, progress );
-}
-
-static void CG_DrawPlayerAmmoValue( rectDef_t *rect, vec4_t color )
-{
- int value;
- centity_t *cent;
- playerState_t *ps;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
- ps = &cg.snap->ps;
-
- if( cent->currentState.weapon )
- {
- switch( cent->currentState.weapon )
- {
- case WP_ABUILD:
- case WP_ABUILD2:
- //percentage of BP remaining
- value = cgs.alienBuildPoints;
- break;
-
- case WP_HBUILD:
- case WP_HBUILD2:
- //percentage of BP remaining
- value = cgs.humanBuildPoints;
- break;
-
- default:
- BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &value, NULL );
- break;
- }
-
- if( value > 999 )
- value = 999;
-
- if( value > -1 )
- {
- trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
- trap_R_SetColor( NULL );
- }
- }
-}
-
-
-/*
-==============
-CG_DrawAlienSense
-==============
-*/
-static void CG_DrawAlienSense( rectDef_t *rect )
-{
- if( BG_ClassHasAbility( cg.snap->ps.stats[ STAT_PCLASS ], SCA_ALIENSENSE ) )
- CG_AlienSense( rect );
-}
-
-
-/*
-==============
-CG_DrawHumanScanner
-==============
-*/
-static void CG_DrawHumanScanner( rectDef_t *rect, qhandle_t shader, vec4_t color )
-{
- if( BG_InventoryContainsUpgrade( UP_HELMET, cg.snap->ps.stats ) )
- CG_Scanner( rect, shader, color );
-}
-
-
-/*
-==============
-CG_DrawUsableBuildable
-==============
-*/
-static void CG_DrawUsableBuildable( rectDef_t *rect, qhandle_t shader, vec4_t color )
-{
- vec3_t view, point;
- trace_t trace;
- entityState_t *es;
-
- AngleVectors( cg.refdefViewAngles, view, NULL, NULL );
- VectorMA( cg.refdef.vieworg, 64, view, point );
- CG_Trace( &trace, cg.refdef.vieworg, NULL, NULL,
- point, cg.predictedPlayerState.clientNum, MASK_SHOT );
-
- es = &cg_entities[ trace.entityNum ].currentState;
-
- if( es->eType == ET_BUILDABLE && BG_FindUsableForBuildable( es->modelindex ) &&
- cg.predictedPlayerState.stats[ STAT_PTEAM ] == BG_FindTeamForBuildable( es->modelindex ) )
- {
- //hack to prevent showing the usable buildable when you aren't carrying an energy weapon
- if( ( es->modelindex == BA_H_REACTOR || es->modelindex == BA_H_REPEATER ) &&
- ( !BG_FindUsesEnergyForWeapon( cg.snap->ps.weapon ) ||
- BG_FindInfinteAmmoForWeapon( cg.snap->ps.weapon ) ) )
- return;
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
- }
-}
-
-
-#define BUILD_DELAY_TIME 2000
-
-static void CG_DrawPlayerBuildTimer( rectDef_t *rect, vec4_t color )
-{
- float progress;
- int index;
- centity_t *cent;
- playerState_t *ps;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
- ps = &cg.snap->ps;
-
- if( cent->currentState.weapon )
- {
- switch( cent->currentState.weapon )
- {
- case WP_ABUILD:
- progress = (float)ps->stats[ STAT_MISC ] / (float)ABUILDER_BASE_DELAY;
- break;
-
- case WP_ABUILD2:
- progress = (float)ps->stats[ STAT_MISC ] / (float)ABUILDER_ADV_DELAY;
- break;
-
- case WP_HBUILD:
- progress = (float)ps->stats[ STAT_MISC ] / (float)HBUILD_DELAY;
- break;
-
- case WP_HBUILD2:
- progress = (float)ps->stats[ STAT_MISC ] / (float)HBUILD2_DELAY;
- break;
-
- default:
- return;
- break;
- }
-
- if( !ps->stats[ STAT_MISC ] )
- return;
-
- index = (int)( progress * 8.0f );
-
- if( index > 7 )
- index = 7;
- else if( index < 0 )
- index = 0;
-
- if( cg.time - cg.lastBuildAttempt <= BUILD_DELAY_TIME )
- {
- if( ( ( cg.time - cg.lastBuildAttempt ) / 300 ) % 2 )
- {
- color[ 0 ] = 1.0f;
- color[ 1 ] = color[ 2 ] = 0.0f;
- color[ 3 ] = 1.0f;
- }
- }
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h,
- cgs.media.buildWeaponTimerPie[ index ] );
- trap_R_SetColor( NULL );
- }
-}
-
-static void CG_DrawPlayerClipsValue( rectDef_t *rect, vec4_t color )
-{
- int value;
- centity_t *cent;
- playerState_t *ps;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
- ps = &cg.snap->ps;
-
- if( cent->currentState.weapon )
- {
- switch( cent->currentState.weapon )
- {
- case WP_ABUILD:
- case WP_ABUILD2:
- case WP_HBUILD:
- case WP_HBUILD2:
- break;
-
- default:
- BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, NULL, &value );
-
- if( value > -1 )
- {
- trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
- trap_R_SetColor( NULL );
- }
- break;
- }
- }
-}
-
-static void CG_DrawPlayerHealthValue( rectDef_t *rect, vec4_t color )
-{
- playerState_t *ps;
- int value;
-
- ps = &cg.snap->ps;
-
- value = ps->stats[ STAT_HEALTH ];
-
- trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 4, rect->w / 4, rect->h, value );
- trap_R_SetColor( NULL );
-}
-
-static void CG_DrawPlayerHealthBar( rectDef_t *rect, vec4_t color, float scale,
- int align, int textStyle, int special )
-{
- playerState_t *ps;
- float total;
-
- ps = &cg.snap->ps;
-
- total = ( (float)ps->stats[ STAT_HEALTH ] / (float)ps->stats[ STAT_MAX_HEALTH ] );
- CG_DrawProgressBar( rect, color, scale, align, textStyle, special, total );
-}
-
-/*
-==============
-CG_DrawPlayerHealthCross
-==============
-*/
-static void CG_DrawPlayerHealthCross( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- playerState_t *ps = &cg.snap->ps;
- int health = ps->stats[ STAT_HEALTH ];
-
- if( health < 10 )
- {
- color[ 0 ] = 1.0f;
- color[ 1 ] = color[ 2 ] = 0.0f;
- }
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-static void CG_DrawProgressLabel( rectDef_t *rect, float text_x, float text_y, vec4_t color,
- float scale, int align, const char *s, float fraction )
-{
- vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f };
- float tx, tw = CG_Text_Width( s, scale, 0 );
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- tx = 0.0f;
- break;
-
- case ITEM_ALIGN_RIGHT:
- tx = rect->w - tw;
- break;
-
- case ITEM_ALIGN_CENTER:
- tx = ( rect->w / 2.0f ) - ( tw / 2.0f );
- break;
-
- default:
- tx = 0.0f;
- }
-
- if( fraction < 1.0f )
- CG_Text_Paint( rect->x + text_x + tx, rect->y + text_y, scale, white,
- s, 0, 0, ITEM_TEXTSTYLE_NORMAL );
- else
- CG_Text_Paint( rect->x + text_x + tx, rect->y + text_y, scale, color,
- s, 0, 0, ITEM_TEXTSTYLE_NEON );
-}
-
-static void CG_DrawMediaProgress( rectDef_t *rect, vec4_t color, float scale,
- int align, int textStyle, int special )
-{
- CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.mediaFraction );
-}
-
-static void CG_DrawMediaProgressLabel( rectDef_t *rect, float text_x, float text_y,
- vec4_t color, float scale, int align )
-{
- CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Map and Textures", cg.mediaFraction );
-}
-
-static void CG_DrawBuildablesProgress( rectDef_t *rect, vec4_t color, float scale,
- int align, int textStyle, int special )
-{
- CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.buildablesFraction );
-}
-
-static void CG_DrawBuildablesProgressLabel( rectDef_t *rect, float text_x, float text_y,
- vec4_t color, float scale, int align )
-{
- CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Buildable Models", cg.buildablesFraction );
-}
-
-static void CG_DrawCharModelProgress( rectDef_t *rect, vec4_t color, float scale,
- int align, int textStyle, int special )
-{
- CG_DrawProgressBar( rect, color, scale, align, textStyle, special, cg.charModelFraction );
-}
-
-static void CG_DrawCharModelProgressLabel( rectDef_t *rect, float text_x, float text_y,
- vec4_t color, float scale, int align )
-{
- CG_DrawProgressLabel( rect, text_x, text_y, color, scale, align, "Character Models", cg.charModelFraction );
-}
-
-static void CG_DrawOverallProgress( rectDef_t *rect, vec4_t color, float scale,
- int align, int textStyle, int special )
-{
- float total;
-
- total = ( cg.charModelFraction + cg.buildablesFraction + cg.mediaFraction ) / 3.0f;
- CG_DrawProgressBar( rect, color, scale, align, textStyle, special, total );
-}
-
-static void CG_DrawLevelShot( rectDef_t *rect )
-{
- const char *s;
- const char *info;
- qhandle_t levelshot;
- qhandle_t detail;
-
- info = CG_ConfigString( CS_SERVERINFO );
- s = Info_ValueForKey( info, "mapname" );
- levelshot = trap_R_RegisterShaderNoMip( va( "levelshots/%s.tga", s ) );
-
- if( !levelshot )
- levelshot = trap_R_RegisterShaderNoMip( "gfx/2d/load_screen" );
-
- trap_R_SetColor( NULL );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, levelshot );
-
- // blend a detail texture over it
- detail = trap_R_RegisterShader( "gfx/misc/detail" );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, detail );
-}
-
-static void CG_DrawLoadingString( rectDef_t *rect, float text_x, float text_y, vec4_t color,
- float scale, int align, int textStyle, const char *s )
-{
- float tw, th, tx;
- int pos, i;
- char buffer[ 1024 ];
- char *end;
-
- if( !s[ 0 ] )
- return;
-
- strcpy( buffer, s );
- tw = CG_Text_Width( s, scale, 0 );
- th = scale * 40.0f;
-
- pos = i = 0;
-
- while( pos < strlen( s ) )
- {
- strcpy( buffer, &s[ pos ] );
- tw = CG_Text_Width( buffer, scale, 0 );
-
- while( tw > rect->w )
- {
- end = strrchr( buffer, ' ' );
-
- if( end == NULL )
- break;
-
- *end = '\0';
- tw = CG_Text_Width( buffer, scale, 0 );
- }
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- tx = rect->x;
- break;
-
- case ITEM_ALIGN_RIGHT:
- tx = rect->x + rect->w - tw;
- break;
-
- case ITEM_ALIGN_CENTER:
- tx = rect->x + ( rect->w / 2.0f ) - ( tw / 2.0f );
- break;
-
- default:
- tx = 0.0f;
- }
-
- CG_Text_Paint( tx + text_x, rect->y + text_y + i * ( th + 3 ), scale, color,
- buffer, 0, 0, textStyle );
-
- pos += strlen( buffer ) + 1;
- i++;
- }
-}
-
-static void CG_DrawLevelName( rectDef_t *rect, float text_x, float text_y,
- vec4_t color, float scale, int align, int textStyle )
-{
- const char *s;
-
- s = CG_ConfigString( CS_MESSAGE );
-
- CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, s );
-}
-
-static void CG_DrawMOTD( rectDef_t *rect, float text_x, float text_y,
- vec4_t color, float scale, int align, int textStyle )
-{
- const char *s;
-
- s = CG_ConfigString( CS_MOTD );
-
- CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, s );
-}
-
-static void CG_DrawHostname( rectDef_t *rect, float text_x, float text_y,
- vec4_t color, float scale, int align, int textStyle )
-{
- char buffer[ 1024 ];
- const char *info;
-
- info = CG_ConfigString( CS_SERVERINFO );
-
- Q_strncpyz( buffer, Info_ValueForKey( info, "sv_hostname" ), 1024 );
- Q_CleanStr( buffer );
-
- CG_DrawLoadingString( rect, text_x, text_y, color, scale, align, textStyle, buffer );
-}
-
-/*
-==============
-CG_DrawDemoPlayback
-==============
-*/
-static void CG_DrawDemoPlayback( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- if( !cg_drawDemoState.integer )
- return;
-
- if( trap_GetDemoState( ) != DS_PLAYBACK )
- return;
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-==============
-CG_DrawDemoRecording
-==============
-*/
-static void CG_DrawDemoRecording( rectDef_t *rect, vec4_t color, qhandle_t shader )
-{
- if( !cg_drawDemoState.integer )
- return;
-
- if( trap_GetDemoState( ) != DS_RECORDING )
- return;
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
-}
-
-/*
-======================
-CG_UpdateMediaFraction
-
-======================
-*/
-void CG_UpdateMediaFraction( float newFract )
-{
- cg.mediaFraction = newFract;
-
- trap_UpdateScreen( );
-}
-
-/*
-====================
-CG_DrawLoadingScreen
-
-Draw all the status / pacifier stuff during level loading
-====================
-*/
-void CG_DrawLoadingScreen( void )
-{
- Menu_Paint( Menus_FindByName( "Loading" ), qtrue );
-}
-
-float CG_GetValue( int ownerDraw )
-{
- centity_t *cent;
- playerState_t *ps;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
- ps = &cg.snap->ps;
-
- switch( ownerDraw )
- {
- case CG_PLAYER_AMMO_VALUE:
- if( cent->currentState.weapon )
- {
- int value;
-
- BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups,
- &value, NULL );
-
- return value;
- }
- break;
- case CG_PLAYER_CLIPS_VALUE:
- if( cent->currentState.weapon )
- {
- int value;
-
- BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups,
- NULL, &value );
-
- return value;
- }
- break;
- case CG_PLAYER_HEALTH:
- return ps->stats[ STAT_HEALTH ];
- break;
- default:
- break;
- }
-
- return -1;
-}
-
-const char *CG_GetKillerText( )
-{
- const char *s = "";
- if( cg.killerName[ 0 ] )
- s = va( "Fragged by %s", cg.killerName );
-
- return s;
-}
-
-
-static void CG_DrawKiller( rectDef_t *rect, float scale, vec4_t color,
- qhandle_t shader, int textStyle )
-{
- // fragged by ... line
- if( cg.killerName[ 0 ] )
- {
- int x = rect->x + rect->w / 2;
- CG_Text_Paint( x - CG_Text_Width( CG_GetKillerText( ), scale, 0 ) / 2,
- rect->y + rect->h, scale, color, CG_GetKillerText( ), 0, 0, textStyle );
- }
-}
-
-
-static void CG_Text_Paint_Limit( float *maxX, float x, float y, float scale,
- vec4_t color, const char* text, float adjust, int limit )
-{
- int len, count;
- vec4_t newColor;
- glyphInfo_t *glyph;
-
- if( text )
- {
-// TTimo: FIXME
-// const unsigned char *s = text; // bk001206 - unsigned
- const char *s = text;
- float max = *maxX;
- float useScale;
- fontInfo_t *font = &cgDC.Assets.textFont;
-
- if( scale <= cg_smallFont.value )
- font = &cgDC.Assets.smallFont;
- else if( scale > cg_bigFont.value )
- font = &cgDC.Assets.bigFont;
-
- useScale = scale * font->glyphScale;
- trap_R_SetColor( color );
- len = strlen( text );
-
- if( limit > 0 && len > limit )
- len = limit;
-
- count = 0;
-
- while( s && *s && count < len )
- {
- glyph = &font->glyphs[ (int)*s ];
- //TTimo: FIXME: getting nasty warnings without the cast,
- //hopefully this doesn't break the VM build
-
- if( Q_IsColorString( s ) )
- {
- memcpy( newColor, g_color_table[ ColorIndex( *(s+1) ) ], sizeof( newColor ) );
- newColor[ 3 ] = color[ 3 ];
- trap_R_SetColor( newColor );
- s += 2;
- continue;
- }
- else
- {
- float yadj = useScale * glyph->top;
-
- if( CG_Text_Width( s, useScale, 1 ) + x > max )
- {
- *maxX = 0;
- break;
- }
-
- CG_Text_PaintChar( x, y - yadj,
- glyph->imageWidth,
- glyph->imageHeight,
- useScale,
- glyph->s,
- glyph->t,
- glyph->s2,
- glyph->t2,
- glyph->glyph );
- x += ( glyph->xSkip * useScale ) + adjust;
- *maxX = x;
- count++;
- s++;
- }
- }
-
- trap_R_SetColor( NULL );
- }
-}
-
-static void CG_DrawTeamSpectators( rectDef_t *rect, float scale, vec4_t color, qhandle_t shader )
-{
- if( cg.spectatorLen )
- {
- float maxX;
-
- if( cg.spectatorWidth == -1 )
- {
- cg.spectatorWidth = 0;
- cg.spectatorPaintX = rect->x + 1;
- cg.spectatorPaintX2 = -1;
- }
-
- if( cg.spectatorOffset > cg.spectatorLen )
- {
- cg.spectatorOffset = 0;
- cg.spectatorPaintX = rect->x + 1;
- cg.spectatorPaintX2 = -1;
- }
-
- if( cg.time > cg.spectatorTime )
- {
- cg.spectatorTime = cg.time + 10;
-
- if( cg.spectatorPaintX <= rect->x + 2 )
- {
- if( cg.spectatorOffset < cg.spectatorLen )
- {
- //TA: skip colour directives
- if( Q_IsColorString( &cg.spectatorList[ cg.spectatorOffset ] ) )
- cg.spectatorOffset += 2;
- else
- {
- cg.spectatorPaintX += CG_Text_Width( &cg.spectatorList[ cg.spectatorOffset ], scale, 1 ) - 1;
- cg.spectatorOffset++;
- }
- }
- else
- {
- cg.spectatorOffset = 0;
-
- if( cg.spectatorPaintX2 >= 0 )
- cg.spectatorPaintX = cg.spectatorPaintX2;
- else
- cg.spectatorPaintX = rect->x + rect->w - 2;
-
- cg.spectatorPaintX2 = -1;
- }
- }
- else
- {
- cg.spectatorPaintX--;
-
- if( cg.spectatorPaintX2 >= 0 )
- cg.spectatorPaintX2--;
- }
- }
-
- maxX = rect->x + rect->w - 2;
-
- CG_Text_Paint_Limit( &maxX, cg.spectatorPaintX, rect->y + rect->h - 3, scale, color,
- &cg.spectatorList[ cg.spectatorOffset ], 0, 0 );
-
- if( cg.spectatorPaintX2 >= 0 )
- {
- float maxX2 = rect->x + rect->w - 2;
- CG_Text_Paint_Limit( &maxX2, cg.spectatorPaintX2, rect->y + rect->h - 3, scale,
- color, cg.spectatorList, 0, cg.spectatorOffset );
- }
-
- if( cg.spectatorOffset && maxX > 0 )
- {
- // if we have an offset ( we are skipping the first part of the string ) and we fit the string
- if( cg.spectatorPaintX2 == -1 )
- cg.spectatorPaintX2 = rect->x + rect->w - 2;
- }
- else
- cg.spectatorPaintX2 = -1;
- }
-}
-
-/*
-==================
-CG_DrawStageReport
-==================
-*/
-static void CG_DrawStageReport( rectDef_t *rect, float text_x, float text_y,
- vec4_t color, float scale, int align, int textStyle )
-{
- char s[ MAX_TOKEN_CHARS ];
- int tx, w, kills;
-
- if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_NONE && !cg.intermissionStarted )
- return;
-
- if( cg.intermissionStarted )
- {
- Com_sprintf( s, MAX_TOKEN_CHARS,
- "Stage %d" //PH34R MY MAD-LEET CODING SKILLZ
- " "
- "Stage %d",
- cgs.alienStage + 1, cgs.humanStage + 1 );
- }
- else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- kills = cgs.alienNextStageThreshold - cgs.alienKills;
-
- if( cgs.alienNextStageThreshold < 0 )
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d", cgs.alienStage + 1 );
- else if( kills == 1 )
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kill for next stage",
- cgs.alienStage + 1, kills );
- else
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for next stage",
- cgs.alienStage + 1, kills );
- }
- else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- kills = cgs.humanNextStageThreshold - cgs.humanKills;
-
- if( cgs.humanNextStageThreshold < 0 )
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d", cgs.humanStage + 1 );
- else if( kills == 1 )
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kill for next stage",
- cgs.humanStage + 1, kills );
- else
- Com_sprintf( s, MAX_TOKEN_CHARS, "Stage %d, %d kills for next stage",
- cgs.humanStage + 1, kills );
- }
-
- w = CG_Text_Width( s, scale, 0 );
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- tx = rect->x;
- break;
-
- case ITEM_ALIGN_RIGHT:
- tx = rect->x + rect->w - w;
- break;
-
- case ITEM_ALIGN_CENTER:
- tx = rect->x + ( rect->w / 2.0f ) - ( w / 2.0f );
- break;
-
- default:
- tx = 0.0f;
- }
-
- CG_Text_Paint( text_x + tx, rect->y + text_y, scale, color, s, 0, 0, textStyle );
-}
-
-/*
-==================
-CG_DrawFPS
-==================
-*/
-//TA: personally i think this should be longer - it should really be a cvar
-#define FPS_FRAMES 20
-#define FPS_STRING "fps"
-static void CG_DrawFPS( rectDef_t *rect, float text_x, float text_y,
- float scale, vec4_t color, int align, int textStyle,
- qboolean scalableText )
-{
- char *s;
- int tx, w, totalWidth, strLength;
- static int previousTimes[ FPS_FRAMES ];
- static int index;
- int i, total;
- int fps;
- static int previous;
- int t, frameTime;
-
- if( !cg_drawFPS.integer )
- return;
-
- // don't use serverTime, because that will be drifting to
- // correct for internet lag changes, timescales, timedemos, etc
- t = trap_Milliseconds( );
- frameTime = t - previous;
- previous = t;
-
- previousTimes[ index % FPS_FRAMES ] = frameTime;
- index++;
-
- if( index > FPS_FRAMES )
- {
- // average multiple frames together to smooth changes out a bit
- total = 0;
-
- for( i = 0 ; i < FPS_FRAMES ; i++ )
- total += previousTimes[ i ];
-
- if( !total )
- total = 1;
-
- fps = 1000 * FPS_FRAMES / total;
-
- s = va( "%d", fps );
- w = CG_Text_Width( "0", scale, 0 );
- strLength = CG_DrawStrlen( s );
- totalWidth = CG_Text_Width( FPS_STRING, scale, 0 ) + w * strLength;
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- tx = rect->x;
- break;
-
- case ITEM_ALIGN_RIGHT:
- tx = rect->x + rect->w - totalWidth;
- break;
-
- case ITEM_ALIGN_CENTER:
- tx = rect->x + ( rect->w / 2.0f ) - ( totalWidth / 2.0f );
- break;
-
- default:
- tx = 0.0f;
- }
-
- if( scalableText )
- {
- for( i = 0; i < strLength; i++ )
- {
- char c[ 2 ];
-
- c[ 0 ] = s[ i ];
- c[ 1 ] = '\0';
-
- CG_Text_Paint( text_x + tx + i * w, rect->y + text_y, scale, color, c, 0, 0, textStyle );
- }
- }
- else
- {
- trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 3, rect->w / 3, rect->h, fps );
- trap_R_SetColor( NULL );
- }
-
- if( scalableText )
- CG_Text_Paint( text_x + tx + i * w, rect->y + text_y, scale, color, FPS_STRING, 0, 0, textStyle );
- }
-}
-
-
-/*
-=================
-CG_DrawTimerMins
-=================
-*/
-static void CG_DrawTimerMins( rectDef_t *rect, vec4_t color )
-{
- int mins, seconds;
- int msec;
-
- if( !cg_drawTimer.integer )
- return;
-
- msec = cg.time - cgs.levelStartTime;
-
- seconds = msec / 1000;
- mins = seconds / 60;
- seconds -= mins * 60;
-
- trap_R_SetColor( color );
- CG_DrawField( rect->x, rect->y, 3, rect->w / 3, rect->h, mins );
- trap_R_SetColor( NULL );
-}
-
-
-/*
-=================
-CG_DrawTimerSecs
-=================
-*/
-static void CG_DrawTimerSecs( rectDef_t *rect, vec4_t color )
-{
- int mins, seconds;
- int msec;
-
- if( !cg_drawTimer.integer )
- return;
-
- msec = cg.time - cgs.levelStartTime;
-
- seconds = msec / 1000;
- mins = seconds / 60;
- seconds -= mins * 60;
-
- trap_R_SetColor( color );
- CG_DrawFieldPadded( rect->x, rect->y, 2, rect->w / 2, rect->h, seconds );
- trap_R_SetColor( NULL );
-}
-
-
-/*
-=================
-CG_DrawTimer
-=================
-*/
-static void CG_DrawTimer( rectDef_t *rect, float text_x, float text_y,
- float scale, vec4_t color, int align, int textStyle )
-{
- char *s;
- int i, tx, w, totalWidth, strLength;
- int mins, seconds, tens;
- int msec;
-
- if( !cg_drawTimer.integer )
- return;
-
- msec = cg.time - cgs.levelStartTime;
-
- seconds = msec / 1000;
- mins = seconds / 60;
- seconds -= mins * 60;
- tens = seconds / 10;
- seconds -= tens * 10;
-
- s = va( "%d:%d%d", mins, tens, seconds );
- w = CG_Text_Width( "0", scale, 0 );
- strLength = CG_DrawStrlen( s );
- totalWidth = w * strLength;
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- tx = rect->x;
- break;
-
- case ITEM_ALIGN_RIGHT:
- tx = rect->x + rect->w - totalWidth;
- break;
-
- case ITEM_ALIGN_CENTER:
- tx = rect->x + ( rect->w / 2.0f ) - ( totalWidth / 2.0f );
- break;
-
- default:
- tx = 0.0f;
- }
-
- for( i = 0; i < strLength; i++ )
- {
- char c[ 2 ];
-
- c[ 0 ] = s[ i ];
- c[ 1 ] = '\0';
-
- CG_Text_Paint( text_x + tx + i * w, rect->y + text_y, scale, color, c, 0, 0, textStyle );
- }
-}
-
-/*
-=================
-CG_DrawClock
-=================
-*/
-static void CG_DrawClock( rectDef_t *rect, float text_x, float text_y,
- float scale, vec4_t color, int align, int textStyle )
-{
- char *s;
- int i, tx, w, totalWidth, strLength;
- qtime_t qt;
- int t;
-
- if( !cg_drawClock.integer )
- return;
-
- t = trap_RealTime( &qt );
-
- if( cg_drawClock.integer == 2 )
- {
- s = va( "%02d%s%02d", qt.tm_hour, ( qt.tm_sec % 2 ) ? ":" : " ",
- qt.tm_min );
- }
- else
- {
- char *pm = "am";
- int h = qt.tm_hour;
-
- if( h == 0 )
- h = 12;
- else if( h == 12 )
- pm = "pm";
- else if( h > 12 )
- {
- h -= 12;
- pm = "pm";
- }
-
- s = va( "%d%s%02d%s", h, ( qt.tm_sec % 2 ) ? ":" : " ", qt.tm_min, pm );
- }
- w = CG_Text_Width( "0", scale, 0 );
- strLength = CG_DrawStrlen( s );
- totalWidth = w * strLength;
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- tx = rect->x;
- break;
-
- case ITEM_ALIGN_RIGHT:
- tx = rect->x + rect->w - totalWidth;
- break;
-
- case ITEM_ALIGN_CENTER:
- tx = rect->x + ( rect->w / 2.0f ) - ( totalWidth / 2.0f );
- break;
-
- default:
- tx = 0.0f;
- }
-
- for( i = 0; i < strLength; i++ )
- {
- char c[ 2 ];
-
- c[ 0 ] = s[ i ];
- c[ 1 ] = '\0';
-
- CG_Text_Paint( text_x + tx + i * w, rect->y + text_y, scale, color, c, 0, 0, textStyle );
- }
-}
-
-/*
-==================
-CG_DrawSnapshot
-==================
-*/
-static void CG_DrawSnapshot( rectDef_t *rect, float text_x, float text_y,
- float scale, vec4_t color, int align, int textStyle )
-{
- char *s;
- int w, tx;
-
- if( !cg_drawSnapshot.integer )
- return;
-
- s = va( "time:%d snap:%d cmd:%d", cg.snap->serverTime,
- cg.latestSnapshotNum, cgs.serverCommandSequence );
- w = CG_Text_Width( s, scale, 0 );
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- tx = rect->x;
- break;
-
- case ITEM_ALIGN_RIGHT:
- tx = rect->x + rect->w - w;
- break;
-
- case ITEM_ALIGN_CENTER:
- tx = rect->x + ( rect->w / 2.0f ) - ( w / 2.0f );
- break;
-
- default:
- tx = 0.0f;
- }
-
- CG_Text_Paint( text_x + tx, rect->y + text_y, scale, color, s, 0, 0, textStyle );
-}
-
-/*
-===============================================================================
-
-LAGOMETER
-
-===============================================================================
-*/
-
-#define LAG_SAMPLES 128
-
-typedef struct
-{
- int frameSamples[ LAG_SAMPLES ];
- int frameCount;
- int snapshotFlags[ LAG_SAMPLES ];
- int snapshotSamples[ LAG_SAMPLES ];
- int snapshotCount;
-} lagometer_t;
-
-lagometer_t lagometer;
-
-/*
-==============
-CG_AddLagometerFrameInfo
-
-Adds the current interpolate / extrapolate bar for this frame
-==============
-*/
-void CG_AddLagometerFrameInfo( void )
-{
- int offset;
-
- offset = cg.time - cg.latestSnapshotTime;
- lagometer.frameSamples[ lagometer.frameCount & ( LAG_SAMPLES - 1 ) ] = offset;
- lagometer.frameCount++;
-}
-
-/*
-==============
-CG_AddLagometerSnapshotInfo
-
-Each time a snapshot is received, log its ping time and
-the number of snapshots that were dropped before it.
-
-Pass NULL for a dropped packet.
-==============
-*/
-#define PING_FRAMES 40
-void CG_AddLagometerSnapshotInfo( snapshot_t *snap )
-{
- static int previousPings[ PING_FRAMES ];
- static int index;
- int i;
-
- // dropped packet
- if( !snap )
- {
- lagometer.snapshotSamples[ lagometer.snapshotCount & ( LAG_SAMPLES - 1 ) ] = -1;
- lagometer.snapshotCount++;
- return;
- }
-
- // add this snapshot's info
- lagometer.snapshotSamples[ lagometer.snapshotCount & ( LAG_SAMPLES - 1 ) ] = snap->ping;
- lagometer.snapshotFlags[ lagometer.snapshotCount & ( LAG_SAMPLES - 1 ) ] = snap->snapFlags;
- lagometer.snapshotCount++;
-
- cg.ping = 0;
- if( cg.snap )
- {
- previousPings[ index++ ] = cg.snap->ping;
- index = index % PING_FRAMES;
-
- for( i = 0; i < PING_FRAMES; i++ )
- {
- cg.ping += previousPings[ i ];
- }
-
- cg.ping /= PING_FRAMES;
- }
-}
-
-/*
-==============
-CG_DrawDisconnect
-
-Should we draw something differnet for long lag vs no packets?
-==============
-*/
-static void CG_DrawDisconnect( void )
-{
- float x, y;
- int cmdNum;
- usercmd_t cmd;
- const char *s;
- int w;
- vec4_t color = { 1.0f, 1.0f, 1.0f, 1.0f };
-
- // draw the phone jack if we are completely past our buffers
- cmdNum = trap_GetCurrentCmdNumber( ) - CMD_BACKUP + 1;
- trap_GetUserCmd( cmdNum, &cmd );
-
- // special check for map_restart
- if( cmd.serverTime <= cg.snap->ps.commandTime || cmd.serverTime > cg.time )
- return;
-
- // also add text in center of screen
- s = "Connection Interrupted";
- w = CG_Text_Width( s, 0.7f, 0 );
- CG_Text_Paint( 320 - w / 2, 100, 0.7f, color, s, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
-
- // blink the icon
- if( ( cg.time >> 9 ) & 1 )
- return;
-
- x = 640 - 48;
- y = 480 - 48;
-
- CG_DrawPic( x, y, 48, 48, trap_R_RegisterShader( "gfx/2d/net.tga" ) );
-}
-
-#define MAX_LAGOMETER_PING 900
-#define MAX_LAGOMETER_RANGE 300
-
-
-/*
-==============
-CG_DrawLagometer
-==============
-*/
-static void CG_DrawLagometer( rectDef_t *rect, float text_x, float text_y,
- float scale, vec4_t textColor )
-{
- int a, x, y, i;
- float v;
- float ax, ay, aw, ah, mid, range;
- int color;
- vec4_t adjustedColor;
- float vscale;
- vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f };
-
- if( cg.snap->ps.pm_type == PM_INTERMISSION )
- return;
-
- if( !cg_lagometer.integer )
- return;
-
- if( cg.demoPlayback )
- return;
-
- Vector4Copy( textColor, adjustedColor );
- adjustedColor[ 3 ] = 0.25f;
-
- trap_R_SetColor( adjustedColor );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, cgs.media.whiteShader );
- trap_R_SetColor( NULL );
-
- //
- // draw the graph
- //
- ax = x = rect->x;
- ay = y = rect->y;
- aw = rect->w;
- ah = rect->h;
-
- trap_R_SetColor( NULL );
-
- CG_AdjustFrom640( &ax, &ay, &aw, &ah );
-
- color = -1;
- range = ah / 3;
- mid = ay + range;
-
- vscale = range / MAX_LAGOMETER_RANGE;
-
- // draw the frame interpoalte / extrapolate graph
- for( a = 0 ; a < aw ; a++ )
- {
- i = ( lagometer.frameCount - 1 - a ) & ( LAG_SAMPLES - 1 );
- v = lagometer.frameSamples[ i ];
- v *= vscale;
-
- if( v > 0 )
- {
- if( color != 1 )
- {
- color = 1;
- trap_R_SetColor( g_color_table[ ColorIndex( COLOR_YELLOW ) ] );
- }
-
- if( v > range )
- v = range;
-
- trap_R_DrawStretchPic( ax + aw - a, mid - v, 1, v, 0, 0, 0, 0, cgs.media.whiteShader );
- }
- else if( v < 0 )
- {
- if( color != 2 )
- {
- color = 2;
- trap_R_SetColor( g_color_table[ ColorIndex( COLOR_BLUE ) ] );
- }
-
- v = -v;
- if( v > range )
- v = range;
-
- trap_R_DrawStretchPic( ax + aw - a, mid, 1, v, 0, 0, 0, 0, cgs.media.whiteShader );
- }
- }
-
- // draw the snapshot latency / drop graph
- range = ah / 2;
- vscale = range / MAX_LAGOMETER_PING;
-
- for( a = 0 ; a < aw ; a++ )
- {
- i = ( lagometer.snapshotCount - 1 - a ) & ( LAG_SAMPLES - 1 );
- v = lagometer.snapshotSamples[ i ];
-
- if( v > 0 )
- {
- if( lagometer.snapshotFlags[ i ] & SNAPFLAG_RATE_DELAYED )
- {
- if( color != 5 )
- {
- color = 5; // YELLOW for rate delay
- trap_R_SetColor( g_color_table[ ColorIndex( COLOR_YELLOW ) ] );
- }
- }
- else
- {
- if( color != 3 )
- {
- color = 3;
-
- trap_R_SetColor( g_color_table[ ColorIndex( COLOR_GREEN ) ] );
- }
- }
-
- v = v * vscale;
-
- if( v > range )
- v = range;
-
- trap_R_DrawStretchPic( ax + aw - a, ay + ah - v, 1, v, 0, 0, 0, 0, cgs.media.whiteShader );
- }
- else if( v < 0 )
- {
- if( color != 4 )
- {
- color = 4; // RED for dropped snapshots
- trap_R_SetColor( g_color_table[ ColorIndex( COLOR_RED ) ] );
- }
-
- trap_R_DrawStretchPic( ax + aw - a, ay + ah - range, 1, range, 0, 0, 0, 0, cgs.media.whiteShader );
- }
- }
-
- trap_R_SetColor( NULL );
-
- if( cg_nopredict.integer || cg_synchronousClients.integer )
- CG_Text_Paint( ax, ay, 0.5, white, "snc", 0, 0, ITEM_TEXTSTYLE_NORMAL );
- else
- {
- char *s;
-
- s = va( "%d", cg.ping );
- ax = rect->x + ( rect->w / 2.0f ) - ( CG_Text_Width( s, scale, 0 ) / 2.0f ) + text_x;
- ay = rect->y + ( rect->h / 2.0f ) + ( CG_Text_Height( s, scale, 0 ) / 2.0f ) + text_y;
-
- Vector4Copy( textColor, adjustedColor );
- adjustedColor[ 3 ] = 0.5f;
- CG_Text_Paint( ax, ay, scale, adjustedColor, s, 0, 0, ITEM_TEXTSTYLE_NORMAL );
- }
-
- CG_DrawDisconnect( );
-}
-
-/*
-==============
-CG_DrawTextBlock
-==============
-*/
-static void CG_DrawTextBlock( rectDef_t *rect, float text_x, float text_y, vec4_t color,
- float scale, int align, int textStyle, const char *text,
- menuDef_t *parent, itemDef_t *textItem )
-{
- float x, y, w, h;
-
- //offset the text
- x = rect->x;
- y = rect->y;
- w = rect->w - ( 16 + ( 2 * text_x ) ); //16 to ensure text within frame
- h = rect->h;
-
- textItem->text = text;
-
- textItem->parent = parent;
- memcpy( textItem->window.foreColor, color, sizeof( vec4_t ) );
- textItem->window.flags = 0;
-
- switch( align )
- {
- case ITEM_ALIGN_LEFT:
- textItem->window.rect.x = x;
- break;
-
- case ITEM_ALIGN_RIGHT:
- textItem->window.rect.x = x + w;
- break;
-
- case ITEM_ALIGN_CENTER:
- textItem->window.rect.x = x + ( w / 2 );
- break;
-
- default:
- textItem->window.rect.x = x;
- break;
- }
-
- textItem->window.rect.y = y;
- textItem->window.rect.w = w;
- textItem->window.rect.h = h;
- textItem->window.borderSize = 0;
- textItem->textRect.x = 0;
- textItem->textRect.y = 0;
- textItem->textRect.w = 0;
- textItem->textRect.h = 0;
- textItem->textalignment = align;
- textItem->textalignx = text_x;
- textItem->textaligny = text_y;
- textItem->textscale = scale;
- textItem->textStyle = textStyle;
-
- //hack to utilise existing autowrap code
- Item_Text_AutoWrapped_Paint( textItem );
-}
-
-/*
-===================
-CG_DrawConsole
-===================
-*/
-static void CG_DrawConsole( rectDef_t *rect, float text_x, float text_y, vec4_t color,
- float scale, int align, int textStyle )
-{
- static menuDef_t dummyParent;
- static itemDef_t textItem;
-
- CG_DrawTextBlock( rect, text_x, text_y, color, scale, align, textStyle,
- cg.consoleText, &dummyParent, &textItem );
-}
-
-/*
-===================
-CG_DrawTutorial
-===================
-*/
-static void CG_DrawTutorial( rectDef_t *rect, float text_x, float text_y, vec4_t color,
- float scale, int align, int textStyle )
-{
- static menuDef_t dummyParent;
- static itemDef_t textItem;
-
- if( !cg_tutorial.integer )
- return;
-
- CG_DrawTextBlock( rect, text_x, text_y, color, scale, align, textStyle,
- CG_TutorialText( ), &dummyParent, &textItem );
-}
-
-/*
-===================
-CG_DrawWeaponIcon
-===================
-*/
-void CG_DrawWeaponIcon( rectDef_t *rect, vec4_t color )
-{
- int ammo, clips, maxAmmo;
- centity_t *cent;
- playerState_t *ps;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
- ps = &cg.snap->ps;
-
- BG_UnpackAmmoArray( cent->currentState.weapon, ps->ammo, ps->powerups, &ammo, &clips );
- BG_FindAmmoForWeapon( cent->currentState.weapon, &maxAmmo, NULL );
-
- // don't display if dead
- if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 )
- return;
-
- if( cent->currentState.weapon == 0 )
- return;
-
- CG_RegisterWeapon( cent->currentState.weapon );
-
- if( clips == 0 && !BG_FindInfinteAmmoForWeapon( cent->currentState.weapon ) )
- {
- float ammoPercent = (float)ammo / (float)maxAmmo;
-
- if( ammoPercent < 0.33f )
- {
- color[ 0 ] = 1.0f;
- color[ 1 ] = color[ 2 ] = 0.0f;
- }
- }
-
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS && CG_AtHighestClass( ) )
- {
- if( cg.time - cg.lastEvolveAttempt <= NO_CREDITS_TIME )
- {
- if( ( ( cg.time - cg.lastEvolveAttempt ) / 300 ) % 2 )
- color[ 3 ] = 0.0f;
- }
- }
-
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, cg_weapons[ cent->currentState.weapon ].weaponIcon );
- trap_R_SetColor( NULL );
-}
-
-
-
-/*
-================================================================================
-
-CROSSHAIR
-
-================================================================================
-*/
-
-
-/*
-=================
-CG_DrawCrosshair
-=================
-*/
-static void CG_DrawCrosshair( void )
-{
- float w, h;
- qhandle_t hShader;
- float x, y;
- weaponInfo_t *wi;
-
- if( cg_drawCrosshair.integer == CROSSHAIR_ALWAYSOFF )
- return;
-
- if( cg_drawCrosshair.integer == CROSSHAIR_RANGEDONLY &&
- !BG_FindLongRangedForWeapon( cg.snap->ps.weapon ) )
- {
- return;
- }
-
- if( ( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) ||
- ( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) ||
- ( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) )
- return;
-
- if( cg.renderingThirdPerson )
- return;
-
- wi = &cg_weapons[ cg.snap->ps.weapon ];
-
- w = h = wi->crossHairSize;
-
- x = cg_crosshairX.integer;
- y = cg_crosshairY.integer;
- CG_AdjustFrom640( &x, &y, &w, &h );
-
- hShader = wi->crossHair;
-
- if( hShader != 0 )
- {
- trap_R_DrawStretchPic( x + cg.refdef.x + 0.5 * ( cg.refdef.width - w ),
- y + cg.refdef.y + 0.5 * ( cg.refdef.height - h ),
- w, h, 0, 0, 1, 1, hShader );
- }
-}
-
-
-
-/*
-=================
-CG_ScanForCrosshairEntity
-=================
-*/
-static void CG_ScanForCrosshairEntity( void )
-{
- trace_t trace;
- vec3_t start, end;
- int content;
- pTeam_t team;
-
- VectorCopy( cg.refdef.vieworg, start );
- VectorMA( start, 131072, cg.refdef.viewaxis[ 0 ], end );
-
- CG_Trace( &trace, start, vec3_origin, vec3_origin, end,
- cg.snap->ps.clientNum, CONTENTS_SOLID|CONTENTS_BODY );
-
- if( trace.entityNum >= MAX_CLIENTS )
- return;
-
- // if the player is in fog, don't show it
- content = trap_CM_PointContents( trace.endpos, 0 );
- if( content & CONTENTS_FOG )
- return;
-
- team = cgs.clientinfo[ trace.entityNum ].team;
-
- if( cg.snap->ps.persistant[ PERS_TEAM ] != TEAM_SPECTATOR )
- {
- //only display team names of those on the same team as this player
- if( team != cg.snap->ps.stats[ STAT_PTEAM ] )
- return;
- }
-
- // update the fade timer
- cg.crosshairClientNum = trace.entityNum;
- cg.crosshairClientTime = cg.time;
-}
-
-
-/*
-=====================
-CG_DrawCrosshairNames
-=====================
-*/
-static void CG_DrawCrosshairNames( rectDef_t *rect, float scale, int textStyle )
-{
- float *color;
- char *name;
- float w, x;
-
- if( !cg_drawCrosshairNames.integer )
- return;
-
- if( cg.renderingThirdPerson )
- return;
-
- // scan the known entities to see if the crosshair is sighted on one
- CG_ScanForCrosshairEntity( );
-
- // draw the name of the player being looked at
- color = CG_FadeColor( cg.crosshairClientTime, 1000 );
- if( !color )
- {
- trap_R_SetColor( NULL );
- return;
- }
-
- name = cgs.clientinfo[ cg.crosshairClientNum ].name;
- w = CG_Text_Width( name, scale, 0 );
- x = rect->x + rect->w / 2;
- CG_Text_Paint( x - w / 2, rect->y + rect->h, scale, color, name, 0, 0, textStyle );
- trap_R_SetColor( NULL );
-}
-
-
-/*
-===============
-CG_OwnerDraw
-
-Draw an owner drawn item
-===============
-*/
-void CG_OwnerDraw( float x, float y, float w, float h, float text_x,
- float text_y, int ownerDraw, int ownerDrawFlags,
- int align, float special, float scale, vec4_t color,
- qhandle_t shader, int textStyle )
-{
- rectDef_t rect;
-
- if( cg_drawStatus.integer == 0 )
- return;
-
- rect.x = x;
- rect.y = y;
- rect.w = w;
- rect.h = h;
-
- switch( ownerDraw )
- {
- case CG_PLAYER_CREDITS_VALUE:
- CG_DrawPlayerCreditsValue( &rect, color, qtrue );
- break;
- case CG_PLAYER_BANK_VALUE:
- CG_DrawPlayerBankValue( &rect, color, qtrue );
- break;
- case CG_PLAYER_CREDITS_VALUE_NOPAD:
- CG_DrawPlayerCreditsValue( &rect, color, qfalse );
- break;
- case CG_PLAYER_BANK_VALUE_NOPAD:
- CG_DrawPlayerBankValue( &rect, color, qfalse );
- break;
- case CG_PLAYER_STAMINA:
- CG_DrawPlayerStamina( &rect, color, scale, align, textStyle, special );
- break;
- case CG_PLAYER_STAMINA_1:
- CG_DrawPlayerStamina1( &rect, color, shader );
- break;
- case CG_PLAYER_STAMINA_2:
- CG_DrawPlayerStamina2( &rect, color, shader );
- break;
- case CG_PLAYER_STAMINA_3:
- CG_DrawPlayerStamina3( &rect, color, shader );
- break;
- case CG_PLAYER_STAMINA_4:
- CG_DrawPlayerStamina4( &rect, color, shader );
- break;
- case CG_PLAYER_STAMINA_BOLT:
- CG_DrawPlayerStaminaBolt( &rect, color, shader );
- break;
- case CG_PLAYER_AMMO_VALUE:
- CG_DrawPlayerAmmoValue( &rect, color );
- break;
- case CG_PLAYER_CLIPS_VALUE:
- CG_DrawPlayerClipsValue( &rect, color );
- break;
- case CG_PLAYER_BUILD_TIMER:
- CG_DrawPlayerBuildTimer( &rect, color );
- break;
- case CG_PLAYER_HEALTH:
- CG_DrawPlayerHealthValue( &rect, color );
- break;
- case CG_PLAYER_HEALTH_BAR:
- CG_DrawPlayerHealthBar( &rect, color, scale, align, textStyle, special );
- break;
- case CG_PLAYER_HEALTH_CROSS:
- CG_DrawPlayerHealthCross( &rect, color, shader );
- break;
- case CG_PLAYER_CLIPS_RING:
- CG_DrawPlayerClipsRing( &rect, color, shader );
- break;
- case CG_PLAYER_BUILD_TIMER_RING:
- CG_DrawPlayerBuildTimerRing( &rect, color, shader );
- break;
- case CG_PLAYER_WALLCLIMBING:
- CG_DrawPlayerWallclimbing( &rect, color, shader );
- break;
- case CG_PLAYER_BOOSTED:
- CG_DrawPlayerBoosted( &rect, color, shader );
- break;
- case CG_PLAYER_BOOST_BOLT:
- CG_DrawPlayerBoosterBolt( &rect, color, shader );
- break;
- case CG_PLAYER_POISON_BARBS:
- CG_DrawPlayerPoisonBarbs( &rect, color, shader );
- break;
- case CG_PLAYER_ALIEN_SENSE:
- CG_DrawAlienSense( &rect );
- break;
- case CG_PLAYER_HUMAN_SCANNER:
- CG_DrawHumanScanner( &rect, shader, color );
- break;
- case CG_PLAYER_USABLE_BUILDABLE:
- CG_DrawUsableBuildable( &rect, shader, color );
- break;
- case CG_KILLER:
- CG_DrawKiller( &rect, scale, color, shader, textStyle );
- break;
- case CG_PLAYER_SELECT:
- CG_DrawItemSelect( &rect, color );
- break;
- case CG_PLAYER_WEAPONICON:
- CG_DrawWeaponIcon( &rect, color );
- break;
- case CG_PLAYER_SELECTTEXT:
- CG_DrawItemSelectText( &rect, scale, textStyle );
- break;
- case CG_SPECTATORS:
- CG_DrawTeamSpectators( &rect, scale, color, shader );
- break;
- case CG_PLAYER_CROSSHAIRNAMES:
- CG_DrawCrosshairNames( &rect, scale, textStyle );
- break;
- case CG_STAGE_REPORT_TEXT:
- CG_DrawStageReport( &rect, text_x, text_y, color, scale, align, textStyle );
- break;
-
- //loading screen
- case CG_LOAD_LEVELSHOT:
- CG_DrawLevelShot( &rect );
- break;
- case CG_LOAD_MEDIA:
- CG_DrawMediaProgress( &rect, color, scale, align, textStyle, special );
- break;
- case CG_LOAD_MEDIA_LABEL:
- CG_DrawMediaProgressLabel( &rect, text_x, text_y, color, scale, align );
- break;
- case CG_LOAD_BUILDABLES:
- CG_DrawBuildablesProgress( &rect, color, scale, align, textStyle, special );
- break;
- case CG_LOAD_BUILDABLES_LABEL:
- CG_DrawBuildablesProgressLabel( &rect, text_x, text_y, color, scale, align );
- break;
- case CG_LOAD_CHARMODEL:
- CG_DrawCharModelProgress( &rect, color, scale, align, textStyle, special );
- break;
- case CG_LOAD_CHARMODEL_LABEL:
- CG_DrawCharModelProgressLabel( &rect, text_x, text_y, color, scale, align );
- break;
- case CG_LOAD_OVERALL:
- CG_DrawOverallProgress( &rect, color, scale, align, textStyle, special );
- break;
- case CG_LOAD_LEVELNAME:
- CG_DrawLevelName( &rect, text_x, text_y, color, scale, align, textStyle );
- break;
- case CG_LOAD_MOTD:
- CG_DrawMOTD( &rect, text_x, text_y, color, scale, align, textStyle );
- break;
- case CG_LOAD_HOSTNAME:
- CG_DrawHostname( &rect, text_x, text_y, color, scale, align, textStyle );
- break;
-
- case CG_FPS:
- CG_DrawFPS( &rect, text_x, text_y, scale, color, align, textStyle, qtrue );
- break;
- case CG_FPS_FIXED:
- CG_DrawFPS( &rect, text_x, text_y, scale, color, align, textStyle, qfalse );
- break;
- case CG_TIMER:
- CG_DrawTimer( &rect, text_x, text_y, scale, color, align, textStyle );
- break;
- case CG_CLOCK:
- CG_DrawClock( &rect, text_x, text_y, scale, color, align, textStyle );
- break;
- case CG_TIMER_MINS:
- CG_DrawTimerMins( &rect, color );
- break;
- case CG_TIMER_SECS:
- CG_DrawTimerSecs( &rect, color );
- break;
- case CG_SNAPSHOT:
- CG_DrawSnapshot( &rect, text_x, text_y, scale, color, align, textStyle );
- break;
- case CG_LAGOMETER:
- CG_DrawLagometer( &rect, text_x, text_y, scale, color );
- break;
-
- case CG_DEMO_PLAYBACK:
- CG_DrawDemoPlayback( &rect, color, shader );
- break;
- case CG_DEMO_RECORDING:
- CG_DrawDemoRecording( &rect, color, shader );
- break;
-
- case CG_CONSOLE:
- CG_DrawConsole( &rect, text_x, text_y, color, scale, align, textStyle );
- break;
-
- case CG_TUTORIAL:
- CG_DrawTutorial( &rect, text_x, text_y, color, scale, align, textStyle );
- break;
-
- default:
- break;
- }
-}
-
-void CG_MouseEvent( int x, int y )
-{
- int n;
-
- if( ( cg.predictedPlayerState.pm_type == PM_NORMAL ||
- cg.predictedPlayerState.pm_type == PM_SPECTATOR ) &&
- cg.showScores == qfalse )
- {
- trap_Key_SetCatcher( 0 );
- return;
- }
-
- cgs.cursorX += x;
- if( cgs.cursorX < 0 )
- cgs.cursorX = 0;
- else if( cgs.cursorX > 640 )
- cgs.cursorX = 640;
-
- cgs.cursorY += y;
- if( cgs.cursorY < 0 )
- cgs.cursorY = 0;
- else if( cgs.cursorY > 480 )
- cgs.cursorY = 480;
-
- n = Display_CursorType( cgs.cursorX, cgs.cursorY );
- cgs.activeCursor = 0;
- if( n == CURSOR_ARROW )
- cgs.activeCursor = cgs.media.selectCursor;
- else if( n == CURSOR_SIZER )
- cgs.activeCursor = cgs.media.sizeCursor;
-
- if( cgs.capturedItem )
- Display_MouseMove( cgs.capturedItem, x, y );
- else
- Display_MouseMove( NULL, cgs.cursorX, cgs.cursorY );
-}
-
-/*
-==================
-CG_HideTeamMenus
-==================
-
-*/
-void CG_HideTeamMenu( void )
-{
- Menus_CloseByName( "teamMenu" );
- Menus_CloseByName( "getMenu" );
-}
-
-/*
-==================
-CG_ShowTeamMenus
-==================
-
-*/
-void CG_ShowTeamMenu( void )
-{
- Menus_OpenByName( "teamMenu" );
-}
-
-/*
-==================
-CG_EventHandling
-==================
- type 0 - no event handling
- 1 - team menu
- 2 - hud editor
-
-*/
-void CG_EventHandling( int type )
-{
- cgs.eventHandling = type;
-
- if( type == CGAME_EVENT_NONE )
- CG_HideTeamMenu( );
-}
-
-
-
-void CG_KeyEvent( int key, qboolean down )
-{
- if( !down )
- return;
-
- if( cg.predictedPlayerState.pm_type == PM_NORMAL ||
- ( cg.predictedPlayerState.pm_type == PM_SPECTATOR &&
- cg.showScores == qfalse ) )
- {
- CG_EventHandling( CGAME_EVENT_NONE );
- trap_Key_SetCatcher( 0 );
- return;
- }
-
- Display_HandleKey( key, down, cgs.cursorX, cgs.cursorY );
-
- if( cgs.capturedItem )
- cgs.capturedItem = NULL;
- else
- {
- if( key == K_MOUSE2 && down )
- cgs.capturedItem = Display_CaptureItem( cgs.cursorX, cgs.cursorY );
- }
-}
-
-int CG_ClientNumFromName( const char *p )
-{
- int i;
-
- for( i = 0; i < cgs.maxclients; i++ )
- {
- if( cgs.clientinfo[ i ].infoValid &&
- Q_stricmp( cgs.clientinfo[ i ].name, p ) == 0 )
- return i;
- }
-
- return -1;
-}
-
-void CG_RunMenuScript( char **args )
-{
-}
-
-
-void CG_GetTeamColor( vec4_t *color )
-{
- (*color)[ 0 ] = (*color)[ 2 ] = 0.0f;
- (*color)[ 1 ] = 0.17f;
- (*color)[ 3 ] = 0.25f;
-}
-//END TA UI
-
-
-/*
-================
-CG_DrawLighting
-
-================
-*/
-static void CG_DrawLighting( void )
-{
- centity_t *cent;
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
-
- //fade to black if stamina is low
- if( ( cg.snap->ps.stats[ STAT_STAMINA ] < -800 ) &&
- ( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) )
- {
- vec4_t black = { 0, 0, 0, 0 };
- black[ 3 ] = 1.0 - ( (float)( cg.snap->ps.stats[ STAT_STAMINA ] + 1000 ) / 200.0f );
- trap_R_SetColor( black );
- CG_DrawPic( 0, 0, 640, 480, cgs.media.whiteShader );
- trap_R_SetColor( NULL );
- }
-}
-
-/*
-===============================================================================
-
-CENTER PRINTING
-
-===============================================================================
-*/
-
-
-/*
-==============
-CG_CenterPrint
-
-Called for important messages that should stay in the center of the screen
-for a few moments
-==============
-*/
-void CG_CenterPrint( const char *str, int y, int charWidth )
-{
- char *s;
-
- Q_strncpyz( cg.centerPrint, str, sizeof( cg.centerPrint ) );
-
- cg.centerPrintTime = cg.time;
- cg.centerPrintY = y;
- cg.centerPrintCharWidth = charWidth;
-
- // count the number of lines for centering
- cg.centerPrintLines = 1;
- s = cg.centerPrint;
- while( *s )
- {
- if( *s == '\n' )
- cg.centerPrintLines++;
-
- s++;
- }
-}
-
-
-/*
-===================
-CG_DrawCenterString
-===================
-*/
-static void CG_DrawCenterString( void )
-{
- char *start;
- int l;
- int x, y, w;
- int h;
- float *color;
-
- if( !cg.centerPrintTime )
- return;
-
- color = CG_FadeColor( cg.centerPrintTime, 1000 * cg_centertime.value );
- if( !color )
- return;
-
- trap_R_SetColor( color );
-
- start = cg.centerPrint;
-
- y = cg.centerPrintY - cg.centerPrintLines * BIGCHAR_HEIGHT / 2;
-
- while( 1 )
- {
- char linebuffer[ 1024 ];
-
- for( l = 0; l < 50; l++ )
- {
- if( !start[ l ] || start[ l ] == '\n' )
- break;
-
- linebuffer[ l ] = start[ l ];
- }
-
- linebuffer[ l ] = 0;
-
- w = CG_Text_Width( linebuffer, 0.5, 0 );
- h = CG_Text_Height( linebuffer, 0.5, 0 );
- x = ( SCREEN_WIDTH - w ) / 2;
- CG_Text_Paint( x, y + h, 0.5, color, linebuffer, 0, 0, ITEM_TEXTSTYLE_SHADOWEDMORE );
- y += h + 6;
-
- while( *start && ( *start != '\n' ) )
- start++;
-
- if( !*start )
- break;
-
- start++;
- }
-
- trap_R_SetColor( NULL );
-}
-
-
-
-
-
-//==============================================================================
-
-//FIXME: both vote notes are hardcoded, change to ownerdrawn?
-
-/*
-=================
-CG_DrawVote
-=================
-*/
-static void CG_DrawVote( void )
-{
- char *s;
- int sec;
- vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f };
- char yeskey[ 32 ], nokey[ 32 ];
-
- if( !cgs.voteTime )
- return;
-
- // play a talk beep whenever it is modified
- if( cgs.voteModified )
- {
- cgs.voteModified = qfalse;
- trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND );
- }
-
- sec = ( VOTE_TIME - ( cg.time - cgs.voteTime ) ) / 1000;
-
- if( sec < 0 )
- sec = 0;
- Q_strncpyz( yeskey, CG_KeyBinding( "vote yes" ), sizeof( yeskey ) );
- Q_strncpyz( nokey, CG_KeyBinding( "vote no" ), sizeof( nokey ) );
- s = va( "VOTE(%i): \"%s\" [%s]Yes:%i [%s]No:%i", sec, cgs.voteString,
- yeskey, cgs.voteYes, nokey, cgs.voteNo );
- CG_Text_Paint( 8, 340, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL );
-}
-
-/*
-=================
-CG_DrawTeamVote
-=================
-*/
-static void CG_DrawTeamVote( void )
-{
- char *s;
- int sec, cs_offset;
- vec4_t white = { 1.0f, 1.0f, 1.0f, 1.0f };
- char yeskey[ 32 ], nokey[ 32 ];
-
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS )
- cs_offset = 0;
- else if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS )
- cs_offset = 1;
- else
- return;
-
- if( !cgs.teamVoteTime[ cs_offset ] )
- return;
-
- // play a talk beep whenever it is modified
- if ( cgs.teamVoteModified[ cs_offset ] )
- {
- cgs.teamVoteModified[ cs_offset ] = qfalse;
- trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND );
- }
-
- sec = ( VOTE_TIME - ( cg.time - cgs.teamVoteTime[ cs_offset ] ) ) / 1000;
-
- if( sec < 0 )
- sec = 0;
-
- Q_strncpyz( yeskey, CG_KeyBinding( "teamvote yes" ), sizeof( yeskey ) );
- Q_strncpyz( nokey, CG_KeyBinding( "teamvote no" ), sizeof( nokey ) );
- s = va( "TEAMVOTE(%i): \"%s\" [%s]Yes:%i [%s]No:%i", sec,
- cgs.teamVoteString[ cs_offset ],
- yeskey, cgs.teamVoteYes[cs_offset],
- nokey, cgs.teamVoteNo[ cs_offset ] );
-
- CG_Text_Paint( 8, 360, 0.3f, white, s, 0, 0, ITEM_TEXTSTYLE_NORMAL );
-}
-
-
-static qboolean CG_DrawScoreboard( void )
-{
- static qboolean firstTime = qtrue;
- float fade, *fadeColor;
-
- if( menuScoreboard )
- menuScoreboard->window.flags &= ~WINDOW_FORCED;
-
- if( cg_paused.integer )
- {
- cg.deferredPlayerLoading = 0;
- firstTime = qtrue;
- return qfalse;
- }
-
- if( cg.showScores ||
- cg.predictedPlayerState.pm_type == PM_INTERMISSION )
- {
- fade = 1.0;
- fadeColor = colorWhite;
- }
- else
- {
- cg.deferredPlayerLoading = 0;
- cg.killerName[ 0 ] = 0;
- firstTime = qtrue;
- return qfalse;
- }
-
-
- if( menuScoreboard == NULL )
- menuScoreboard = Menus_FindByName( "teamscore_menu" );
-
- if( menuScoreboard )
- {
- if( firstTime )
- {
- CG_SetScoreSelection( menuScoreboard );
- firstTime = qfalse;
- }
-
- Menu_Paint( menuScoreboard, qtrue );
- }
-
- return qtrue;
-}
-
-/*
-=================
-CG_DrawIntermission
-=================
-*/
-static void CG_DrawIntermission( void )
-{
- if( cg_drawStatus.integer )
- Menu_Paint( Menus_FindByName( "default_hud" ), qtrue );
-
- cg.scoreFadeTime = cg.time;
- cg.scoreBoardShowing = CG_DrawScoreboard( );
-}
-
-#define FOLLOWING_STRING "following "
-
-/*
-=================
-CG_DrawFollow
-=================
-*/
-static qboolean CG_DrawFollow( void )
-{
- float w;
- vec4_t color;
- char buffer[ MAX_STRING_CHARS ];
-
- if( !( cg.snap->ps.pm_flags & PMF_FOLLOW ) )
- return qfalse;
-
- color[ 0 ] = 1;
- color[ 1 ] = 1;
- color[ 2 ] = 1;
- color[ 3 ] = 1;
-
- strcpy( buffer, FOLLOWING_STRING );
- strcat( buffer, cgs.clientinfo[ cg.snap->ps.clientNum ].name );
-
- w = CG_Text_Width( buffer, 0.7f, 0 );
- CG_Text_Paint( 320 - w / 2, 400, 0.7f, color, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
-
- return qtrue;
-}
-
-/*
-=================
-CG_DrawQueue
-=================
-*/
-static qboolean CG_DrawQueue( void )
-{
- float w;
- vec4_t color;
- char buffer[ MAX_STRING_CHARS ];
-
- if( !( cg.snap->ps.pm_flags & PMF_QUEUED ) )
- return qfalse;
-
- color[ 0 ] = 1;
- color[ 1 ] = 1;
- color[ 2 ] = 1;
- color[ 3 ] = 1;
-
- Com_sprintf( buffer, MAX_STRING_CHARS, "You are in position %d of the spawn queue.",
- cg.snap->ps.persistant[ PERS_QUEUEPOS ] + 1 );
-
- w = CG_Text_Width( buffer, 0.7f, 0 );
- CG_Text_Paint( 320 - w / 2, 360, 0.7f, color, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
-
- if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- if( cgs.numAlienSpawns == 1 )
- Com_sprintf( buffer, MAX_STRING_CHARS, "There is 1 spawn remaining." );
- else
- Com_sprintf( buffer, MAX_STRING_CHARS, "There are %d spawns remaining.",
- cgs.numAlienSpawns );
- }
- else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- if( cgs.numHumanSpawns == 1 )
- Com_sprintf( buffer, MAX_STRING_CHARS, "There is 1 spawn remaining." );
- else
- Com_sprintf( buffer, MAX_STRING_CHARS, "There are %d spawns remaining.",
- cgs.numHumanSpawns );
- }
-
- w = CG_Text_Width( buffer, 0.7f, 0 );
- CG_Text_Paint( 320 - w / 2, 400, 0.7f, color, buffer, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
-
- return qtrue;
-}
-
-//==================================================================================
-
-#define SPECTATOR_STRING "SPECTATOR"
-/*
-=================
-CG_Draw2D
-=================
-*/
-static void CG_Draw2D( void )
-{
- vec4_t color;
- float w;
- menuDef_t *menu = NULL, *defaultMenu;
-
- color[ 0 ] = color[ 1 ] = color[ 2 ] = color[ 3 ] = 1.0f;
-
- // if we are taking a levelshot for the menu, don't draw anything
- if( cg.levelShot )
- return;
-
- if( cg_draw2D.integer == 0 )
- return;
-
- if( cg.snap->ps.pm_type == PM_INTERMISSION )
- {
- CG_DrawIntermission( );
- return;
- }
-
- //TA: draw the lighting effects e.g. nvg
- CG_DrawLighting( );
-
-
- defaultMenu = Menus_FindByName( "default_hud" );
-
- if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR )
- {
- w = CG_Text_Width( SPECTATOR_STRING, 0.7f, 0 );
- CG_Text_Paint( 320 - w / 2, 440, 0.7f, color, SPECTATOR_STRING, 0, 0, ITEM_TEXTSTYLE_SHADOWED );
- }
- else
- menu = Menus_FindByName( BG_FindHudNameForClass( cg.predictedPlayerState.stats[ STAT_PCLASS ] ) );
-
- if( !( cg.snap->ps.stats[ STAT_STATE ] & SS_INFESTING ) &&
- !( cg.snap->ps.stats[ STAT_STATE ] & SS_HOVELING ) && menu &&
- ( cg.snap->ps.stats[ STAT_HEALTH ] > 0 ) )
- {
- CG_DrawBuildableStatus( );
- if( cg_drawStatus.integer )
- Menu_Paint( menu, qtrue );
-
- CG_DrawCrosshair( );
- }
- else if( cg_drawStatus.integer )
- Menu_Paint( defaultMenu, qtrue );
-
- CG_DrawVote( );
- CG_DrawTeamVote( );
- CG_DrawFollow( );
- CG_DrawQueue( );
-
- // don't draw center string if scoreboard is up
- cg.scoreBoardShowing = CG_DrawScoreboard( );
-
- if( !cg.scoreBoardShowing )
- CG_DrawCenterString( );
-}
-
-/*
-===============
-CG_ScalePainBlendTCs
-===============
-*/
-static void CG_ScalePainBlendTCs( float* s1, float *t1, float *s2, float *t2 )
-{
- *s1 -= 0.5f;
- *t1 -= 0.5f;
- *s2 -= 0.5f;
- *t2 -= 0.5f;
-
- *s1 *= cg_painBlendZoom.value;
- *t1 *= cg_painBlendZoom.value;
- *s2 *= cg_painBlendZoom.value;
- *t2 *= cg_painBlendZoom.value;
-
- *s1 += 0.5f;
- *t1 += 0.5f;
- *s2 += 0.5f;
- *t2 += 0.5f;
-}
-
-#define PAINBLEND_BORDER 0.15f
-
-/*
-===============
-CG_PainBlend
-===============
-*/
-static void CG_PainBlend( void )
-{
- vec4_t color;
- int damage;
- float damageAsFracOfMax;
- qhandle_t shader = cgs.media.viewBloodShader;
- float x, y, w, h;
- float s1, t1, s2, t2;
-
- if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR || cg.intermissionStarted )
- return;
-
- damage = cg.lastHealth - cg.snap->ps.stats[ STAT_HEALTH ];
-
- if( damage < 0 )
- damage = 0;
-
- damageAsFracOfMax = (float)damage / cg.snap->ps.stats[ STAT_MAX_HEALTH ];
- cg.lastHealth = cg.snap->ps.stats[ STAT_HEALTH ];
-
- cg.painBlendValue += damageAsFracOfMax * cg_painBlendScale.value;
-
- if( cg.painBlendValue > 0.0f )
- {
- cg.painBlendValue -= ( cg.frametime / 1000.0f ) *
- cg_painBlendDownRate.value;
- }
-
- if( cg.painBlendValue > 1.0f )
- cg.painBlendValue = 1.0f;
- else if( cg.painBlendValue <= 0.0f )
- {
- cg.painBlendValue = 0.0f;
- return;
- }
-
- if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- VectorSet( color, 0.43f, 0.8f, 0.37f );
- else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- VectorSet( color, 0.8f, 0.0f, 0.0f );
-
- if( cg.painBlendValue > cg.painBlendTarget )
- {
- cg.painBlendTarget += ( cg.frametime / 1000.0f ) *
- cg_painBlendUpRate.value;
- }
- else if( cg.painBlendValue < cg.painBlendTarget )
- cg.painBlendTarget = cg.painBlendValue;
-
- if( cg.painBlendTarget > cg_painBlendMax.value )
- cg.painBlendTarget = cg_painBlendMax.value;
-
- color[ 3 ] = cg.painBlendTarget;
-
- trap_R_SetColor( color );
-
- //left
- x = 0.0f; y = 0.0f;
- w = PAINBLEND_BORDER * 640.0f; h = 480.0f;
- CG_AdjustFrom640( &x, &y, &w, &h );
- s1 = 0.0f; t1 = 0.0f;
- s2 = PAINBLEND_BORDER; t2 = 1.0f;
- CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 );
- trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader );
-
- //right
- x = 640.0f - ( PAINBLEND_BORDER * 640.0f ); y = 0.0f;
- w = PAINBLEND_BORDER * 640.0f; h = 480.0f;
- CG_AdjustFrom640( &x, &y, &w, &h );
- s1 = 1.0f - PAINBLEND_BORDER; t1 = 0.0f;
- s2 = 1.0f; t2 =1.0f;
- CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 );
- trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader );
-
- //top
- x = PAINBLEND_BORDER * 640.0f; y = 0.0f;
- w = 640.0f - ( 2 * PAINBLEND_BORDER * 640.0f ); h = PAINBLEND_BORDER * 480.0f;
- CG_AdjustFrom640( &x, &y, &w, &h );
- s1 = PAINBLEND_BORDER; t1 = 0.0f;
- s2 = 1.0f - PAINBLEND_BORDER; t2 = PAINBLEND_BORDER;
- CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 );
- trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader );
-
- //bottom
- x = PAINBLEND_BORDER * 640.0f; y = 480.0f - ( PAINBLEND_BORDER * 480.0f );
- w = 640.0f - ( 2 * PAINBLEND_BORDER * 640.0f ); h = PAINBLEND_BORDER * 480.0f;
- CG_AdjustFrom640( &x, &y, &w, &h );
- s1 = PAINBLEND_BORDER; t1 = 1.0f - PAINBLEND_BORDER;
- s2 = 1.0f - PAINBLEND_BORDER; t2 = 1.0f;
- CG_ScalePainBlendTCs( &s1, &t1, &s2, &t2 );
- trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, shader );
-
- trap_R_SetColor( NULL );
-}
-
-/*
-=====================
-CG_ResetPainBlend
-=====================
-*/
-void CG_ResetPainBlend( void )
-{
- cg.painBlendValue = 0.0f;
- cg.painBlendTarget = 0.0f;
- cg.lastHealth = cg.snap->ps.stats[ STAT_HEALTH ];
-}
-
-/*
-=====================
-CG_DrawActive
-
-Perform all drawing needed to completely fill the screen
-=====================
-*/
-void CG_DrawActive( stereoFrame_t stereoView )
-{
- float separation;
- vec3_t baseOrg;
-
- // optionally draw the info screen instead
- if( !cg.snap )
- return;
-
- switch ( stereoView )
- {
- case STEREO_CENTER:
- separation = 0;
- break;
- case STEREO_LEFT:
- separation = -cg_stereoSeparation.value / 2;
- break;
- case STEREO_RIGHT:
- separation = cg_stereoSeparation.value / 2;
- break;
- default:
- separation = 0;
- CG_Error( "CG_DrawActive: Undefined stereoView" );
- }
-
- // clear around the rendered view if sized down
- CG_TileClear( );
-
- // offset vieworg appropriately if we're doing stereo separation
- VectorCopy( cg.refdef.vieworg, baseOrg );
-
- if( separation != 0 )
- VectorMA( cg.refdef.vieworg, -separation, cg.refdef.viewaxis[ 1 ],
- cg.refdef.vieworg );
-
- // draw 3D view
- trap_R_RenderScene( &cg.refdef );
-
- // restore original viewpoint if running stereo
- if( separation != 0 )
- VectorCopy( baseOrg, cg.refdef.vieworg );
-
- // first person blend blobs, done after AnglesToAxis
- if( !cg.renderingThirdPerson )
- CG_PainBlend( );
-
- // draw status bar and other floating elements
- CG_Draw2D( );
-}
-
-
-
diff --git a/src/cgame/cg_drawtools.c b/src/cgame/cg_drawtools.c
deleted file mode 100644
index 06ae071..0000000
--- a/src/cgame/cg_drawtools.c
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_drawtools.c -- helper functions called by cg_draw, cg_scoreboard, cg_info, etc
-
-
-#include "cg_local.h"
-
-/*
-===============
-CG_DrawPlane
-
-Draw a quad in 3 space - basically CG_DrawPic in 3 space
-===============
-*/
-void CG_DrawPlane( vec3_t origin, vec3_t down, vec3_t right, qhandle_t shader )
-{
- polyVert_t verts[ 4 ];
- vec3_t temp;
-
- VectorCopy( origin, verts[ 0 ].xyz );
- verts[ 0 ].st[ 0 ] = 0;
- verts[ 0 ].st[ 1 ] = 0;
- verts[ 0 ].modulate[ 0 ] = 255;
- verts[ 0 ].modulate[ 1 ] = 255;
- verts[ 0 ].modulate[ 2 ] = 255;
- verts[ 0 ].modulate[ 3 ] = 255;
-
- VectorAdd( origin, right, temp );
- VectorCopy( temp, verts[ 1 ].xyz );
- verts[ 1 ].st[ 0 ] = 1;
- verts[ 1 ].st[ 1 ] = 0;
- verts[ 1 ].modulate[ 0 ] = 255;
- verts[ 1 ].modulate[ 1 ] = 255;
- verts[ 1 ].modulate[ 2 ] = 255;
- verts[ 1 ].modulate[ 3 ] = 255;
-
- VectorAdd( origin, right, temp );
- VectorAdd( temp, down, temp );
- VectorCopy( temp, verts[ 2 ].xyz );
- verts[ 2 ].st[ 0 ] = 1;
- verts[ 2 ].st[ 1 ] = 1;
- verts[ 2 ].modulate[ 0 ] = 255;
- verts[ 2 ].modulate[ 1 ] = 255;
- verts[ 2 ].modulate[ 2 ] = 255;
- verts[ 2 ].modulate[ 3 ] = 255;
-
- VectorAdd( origin, down, temp );
- VectorCopy( temp, verts[ 3 ].xyz );
- verts[ 3 ].st[ 0 ] = 0;
- verts[ 3 ].st[ 1 ] = 1;
- verts[ 3 ].modulate[ 0 ] = 255;
- verts[ 3 ].modulate[ 1 ] = 255;
- verts[ 3 ].modulate[ 2 ] = 255;
- verts[ 3 ].modulate[ 3 ] = 255;
-
- trap_R_AddPolyToScene( shader, 4, verts );
-}
-
-/*
-================
-CG_AdjustFrom640
-
-Adjusted for resolution and screen aspect ratio
-================
-*/
-void CG_AdjustFrom640( float *x, float *y, float *w, float *h )
-{
-#if 0
- // adjust for wide screens
- if ( cgs.glconfig.vidWidth * 480 > cgs.glconfig.vidHeight * 640 ) {
- *x += 0.5 * ( cgs.glconfig.vidWidth - ( cgs.glconfig.vidHeight * 640 / 480 ) );
- }
-#endif
- // scale for screen sizes
- *x *= cgs.screenXScale;
- *y *= cgs.screenYScale;
- *w *= cgs.screenXScale;
- *h *= cgs.screenYScale;
-}
-
-/*
-================
-CG_FillRect
-
-Coordinates are 640*480 virtual values
-=================
-*/
-void CG_FillRect( float x, float y, float width, float height, const float *color )
-{
- trap_R_SetColor( color );
-
- CG_AdjustFrom640( &x, &y, &width, &height );
- trap_R_DrawStretchPic( x, y, width, height, 0, 0, 0, 0, cgs.media.whiteShader );
-
- trap_R_SetColor( NULL );
-}
-
-
-/*
-================
-CG_DrawSides
-
-Coords are virtual 640x480
-================
-*/
-void CG_DrawSides( float x, float y, float w, float h, float size )
-{
- CG_AdjustFrom640( &x, &y, &w, &h );
- size *= cgs.screenXScale;
- trap_R_DrawStretchPic( x, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );
- trap_R_DrawStretchPic( x + w - size, y, size, h, 0, 0, 0, 0, cgs.media.whiteShader );
-}
-
-void CG_DrawTopBottom( float x, float y, float w, float h, float size )
-{
- CG_AdjustFrom640( &x, &y, &w, &h );
- size *= cgs.screenYScale;
- trap_R_DrawStretchPic( x, y, w, size, 0, 0, 0, 0, cgs.media.whiteShader );
- trap_R_DrawStretchPic( x, y + h - size, w, size, 0, 0, 0, 0, cgs.media.whiteShader );
-}
-
-
-/*
-================
-CG_DrawRect
-
-Coordinates are 640*480 virtual values
-=================
-*/
-void CG_DrawRect( float x, float y, float width, float height, float size, const float *color )
-{
- trap_R_SetColor( color );
-
- CG_DrawTopBottom( x, y, width, height, size );
- CG_DrawSides( x, y, width, height, size );
-
- trap_R_SetColor( NULL );
-}
-
-
-/*
-================
-CG_DrawPic
-
-Coordinates are 640*480 virtual values
-=================
-*/
-void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader )
-{
- CG_AdjustFrom640( &x, &y, &width, &height );
- trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
-}
-
-
-
-/*
-================
-CG_DrawFadePic
-
-Coordinates are 640*480 virtual values
-=================
-*/
-void CG_DrawFadePic( float x, float y, float width, float height, vec4_t fcolor,
- vec4_t tcolor, float amount, qhandle_t hShader )
-{
- vec4_t finalcolor;
- float inverse;
-
- inverse = 100 - amount;
-
- CG_AdjustFrom640( &x, &y, &width, &height );
-
- finalcolor[ 0 ] = ( ( inverse * fcolor[ 0 ] ) + ( amount * tcolor[ 0 ] ) ) / 100;
- finalcolor[ 1 ] = ( ( inverse * fcolor[ 1 ] ) + ( amount * tcolor[ 1 ] ) ) / 100;
- finalcolor[ 2 ] = ( ( inverse * fcolor[ 2 ] ) + ( amount * tcolor[ 2 ] ) ) / 100;
- finalcolor[ 3 ] = ( ( inverse * fcolor[ 3 ] ) + ( amount * tcolor[ 3 ] ) ) / 100;
-
- trap_R_SetColor( finalcolor );
- trap_R_DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
- trap_R_SetColor( NULL );
-}
-
-/*
-=================
-CG_DrawStrlen
-
-Returns character count, skiping color escape codes
-=================
-*/
-int CG_DrawStrlen( const char *str )
-{
- const char *s = str;
- int count = 0;
-
- while( *s )
- {
- if( Q_IsColorString( s ) )
- s += 2;
- else
- {
- count++;
- s++;
- }
- }
-
- return count;
-}
-
-/*
-=============
-CG_TileClearBox
-
-This repeats a 64*64 tile graphic to fill the screen around a sized down
-refresh window.
-=============
-*/
-static void CG_TileClearBox( int x, int y, int w, int h, qhandle_t hShader )
-{
- float s1, t1, s2, t2;
-
- s1 = x / 64.0;
- t1 = y / 64.0;
- s2 = ( x + w ) / 64.0;
- t2 = ( y + h ) / 64.0;
- trap_R_DrawStretchPic( x, y, w, h, s1, t1, s2, t2, hShader );
-}
-
-
-
-/*
-==============
-CG_TileClear
-
-Clear around a sized down screen
-==============
-*/
-void CG_TileClear( void )
-{
- int top, bottom, left, right;
- int w, h;
-
- w = cgs.glconfig.vidWidth;
- h = cgs.glconfig.vidHeight;
-
- if( cg.refdef.x == 0 && cg.refdef.y == 0 &&
- cg.refdef.width == w && cg.refdef.height == h )
- return; // full screen rendering
-
- top = cg.refdef.y;
- bottom = top + cg.refdef.height - 1;
- left = cg.refdef.x;
- right = left + cg.refdef.width - 1;
-
- // clear above view screen
- CG_TileClearBox( 0, 0, w, top, cgs.media.backTileShader );
-
- // clear below view screen
- CG_TileClearBox( 0, bottom, w, h - bottom, cgs.media.backTileShader );
-
- // clear left of view screen
- CG_TileClearBox( 0, top, left, bottom - top + 1, cgs.media.backTileShader );
-
- // clear right of view screen
- CG_TileClearBox( right, top, w - right, bottom - top + 1, cgs.media.backTileShader );
-}
-
-/*
-================
-CG_FadeColor
-================
-*/
-float *CG_FadeColor( int startMsec, int totalMsec )
-{
- static vec4_t color;
- int t;
-
- if( startMsec == 0 )
- return NULL;
-
- t = cg.time - startMsec;
-
- if( t >= totalMsec )
- return NULL;
-
- // fade out
- if( totalMsec - t < FADE_TIME )
- color[ 3 ] = ( totalMsec - t ) * 1.0 / FADE_TIME;
- else
- color[ 3 ] = 1.0;
-
- color[ 0 ] = color[ 1 ] = color[ 2 ] = 1;
-
- return color;
-}
-
-/*
-================
-CG_WorldToScreen
-================
-*/
-qboolean CG_WorldToScreen( vec3_t point, float *x, float *y )
-{
- vec3_t trans;
- float xc, yc;
- float px, py;
- float z;
-
- px = tan( cg.refdef.fov_x * M_PI / 360.0 );
- py = tan( cg.refdef.fov_y * M_PI / 360.0 );
-
- VectorSubtract( point, cg.refdef.vieworg, trans );
-
- xc = 640.0f / 2.0f;
- yc = 480.0f / 2.0f;
-
- z = DotProduct( trans, cg.refdef.viewaxis[ 0 ] );
- if( z <= 0.001f )
- return qfalse;
-
- if( x )
- *x = xc - DotProduct( trans, cg.refdef.viewaxis[ 1 ] ) * xc / ( z * px );
-
- if( y )
- *y = yc - DotProduct( trans, cg.refdef.viewaxis[ 2 ] ) * yc / ( z * py );
-
- return qtrue;
-}
-
-/*
-================
-CG_KeyBinding
-================
-*/
-char *CG_KeyBinding( const char *bind )
-{
- static char key[ 32 ];
- char bindbuff[ MAX_CVAR_VALUE_STRING ];
- int i;
-
- key[ 0 ] = '\0';
- // NOTE: change K_LAST_KEY to MAX_KEYS for full key support (eventually)
- for( i = 0; i < K_LAST_KEY; i++ )
- {
- trap_Key_GetBindingBuf( i, bindbuff, sizeof( bindbuff ) );
- if( !Q_stricmp( bindbuff, bind ) )
- {
- trap_Key_KeynumToStringBuf( i, key, sizeof( key ) );
- break;
- }
- }
- if( !key[ 0 ] )
- {
- Q_strncpyz( key, "\\", sizeof( key ) );
- Q_strcat( key, sizeof( key ), bind );
- }
- return key;
-}
diff --git a/src/cgame/cg_ents.c b/src/cgame/cg_ents.c
deleted file mode 100644
index 2d2e808..0000000
--- a/src/cgame/cg_ents.c
+++ /dev/null
@@ -1,1256 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_ents.c -- present snapshot entities, happens every single frame
-
-
-#include "cg_local.h"
-
-/*
-======================
-CG_DrawBoxFace
-
-Draws a bounding box face
-======================
-*/
-static void CG_DrawBoxFace( vec3_t a, vec3_t b, vec3_t c, vec3_t d )
-{
- polyVert_t verts[ 4 ];
- vec4_t color = { 255.0f, 0.0f, 0.0f, 128.0f };
-
- VectorCopy( d, verts[ 0 ].xyz );
- verts[ 0 ].st[ 0 ] = 1;
- verts[ 0 ].st[ 1 ] = 1;
- Vector4Copy( color, verts[ 0 ].modulate );
-
- VectorCopy( c, verts[ 1 ].xyz );
- verts[ 1 ].st[ 0 ] = 1;
- verts[ 1 ].st[ 1 ] = 0;
- Vector4Copy( color, verts[ 1 ].modulate );
-
- VectorCopy( b, verts[ 2 ].xyz );
- verts[ 2 ].st[ 0 ] = 0;
- verts[ 2 ].st[ 1 ] = 0;
- Vector4Copy( color, verts[ 2 ].modulate );
-
- VectorCopy( a, verts[ 3 ].xyz );
- verts[ 3 ].st[ 0 ] = 0;
- verts[ 3 ].st[ 1 ] = 1;
- Vector4Copy( color, verts[ 3 ].modulate );
-
- trap_R_AddPolyToScene( cgs.media.outlineShader, 4, verts );
-}
-
-/*
-======================
-CG_DrawBoundingBox
-
-Draws a bounding box
-======================
-*/
-void CG_DrawBoundingBox( vec3_t origin, vec3_t mins, vec3_t maxs )
-{
- vec3_t ppp, mpp, mmp, pmp;
- vec3_t mmm, pmm, ppm, mpm;
-
- ppp[ 0 ] = origin[ 0 ] + maxs[ 0 ];
- ppp[ 1 ] = origin[ 1 ] + maxs[ 1 ];
- ppp[ 2 ] = origin[ 2 ] + maxs[ 2 ];
-
- mpp[ 0 ] = origin[ 0 ] + mins[ 0 ];
- mpp[ 1 ] = origin[ 1 ] + maxs[ 1 ];
- mpp[ 2 ] = origin[ 2 ] + maxs[ 2 ];
-
- mmp[ 0 ] = origin[ 0 ] + mins[ 0 ];
- mmp[ 1 ] = origin[ 1 ] + mins[ 1 ];
- mmp[ 2 ] = origin[ 2 ] + maxs[ 2 ];
-
- pmp[ 0 ] = origin[ 0 ] + maxs[ 0 ];
- pmp[ 1 ] = origin[ 1 ] + mins[ 1 ];
- pmp[ 2 ] = origin[ 2 ] + maxs[ 2 ];
-
- ppm[ 0 ] = origin[ 0 ] + maxs[ 0 ];
- ppm[ 1 ] = origin[ 1 ] + maxs[ 1 ];
- ppm[ 2 ] = origin[ 2 ] + mins[ 2 ];
-
- mpm[ 0 ] = origin[ 0 ] + mins[ 0 ];
- mpm[ 1 ] = origin[ 1 ] + maxs[ 1 ];
- mpm[ 2 ] = origin[ 2 ] + mins[ 2 ];
-
- mmm[ 0 ] = origin[ 0 ] + mins[ 0 ];
- mmm[ 1 ] = origin[ 1 ] + mins[ 1 ];
- mmm[ 2 ] = origin[ 2 ] + mins[ 2 ];
-
- pmm[ 0 ] = origin[ 0 ] + maxs[ 0 ];
- pmm[ 1 ] = origin[ 1 ] + mins[ 1 ];
- pmm[ 2 ] = origin[ 2 ] + mins[ 2 ];
-
- //phew!
-
- CG_DrawBoxFace( ppp, mpp, mmp, pmp );
- CG_DrawBoxFace( ppp, pmp, pmm, ppm );
- CG_DrawBoxFace( mpp, ppp, ppm, mpm );
- CG_DrawBoxFace( mmp, mpp, mpm, mmm );
- CG_DrawBoxFace( pmp, mmp, mmm, pmm );
- CG_DrawBoxFace( mmm, mpm, ppm, pmm );
-}
-
-
-/*
-======================
-CG_PositionEntityOnTag
-
-Modifies the entities position and axis by the given
-tag location
-======================
-*/
-void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
- qhandle_t parentModel, char *tagName )
-{
- int i;
- orientation_t lerped;
-
- // lerp the tag
- trap_R_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
- 1.0 - parent->backlerp, tagName );
-
- // FIXME: allow origin offsets along tag?
- VectorCopy( parent->origin, entity->origin );
- for( i = 0; i < 3; i++ )
- VectorMA( entity->origin, lerped.origin[ i ], parent->axis[ i ], entity->origin );
-
- // had to cast away the const to avoid compiler problems...
- MatrixMultiply( lerped.axis, ( (refEntity_t *)parent )->axis, entity->axis );
- entity->backlerp = parent->backlerp;
-}
-
-
-/*
-======================
-CG_PositionRotatedEntityOnTag
-
-Modifies the entities position and axis by the given
-tag location
-======================
-*/
-void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
- qhandle_t parentModel, char *tagName )
-{
- int i;
- orientation_t lerped;
- vec3_t tempAxis[ 3 ];
-
-//AxisClear( entity->axis );
- // lerp the tag
- trap_R_LerpTag( &lerped, parentModel, parent->oldframe, parent->frame,
- 1.0 - parent->backlerp, tagName );
-
- // FIXME: allow origin offsets along tag?
- VectorCopy( parent->origin, entity->origin );
- for( i = 0; i < 3; i++ )
- VectorMA( entity->origin, lerped.origin[ i ], parent->axis[ i ], entity->origin );
-
- // had to cast away the const to avoid compiler problems...
- MatrixMultiply( entity->axis, lerped.axis, tempAxis );
- MatrixMultiply( tempAxis, ( (refEntity_t *)parent )->axis, entity->axis );
-}
-
-
-
-/*
-==========================================================================
-
-FUNCTIONS CALLED EACH FRAME
-
-==========================================================================
-*/
-
-/*
-======================
-CG_SetEntitySoundPosition
-
-Also called by event processing code
-======================
-*/
-void CG_SetEntitySoundPosition( centity_t *cent )
-{
- if( cent->currentState.solid == SOLID_BMODEL )
- {
- vec3_t origin;
- float *v;
-
- v = cgs.inlineModelMidpoints[ cent->currentState.modelindex ];
- VectorAdd( cent->lerpOrigin, v, origin );
- trap_S_UpdateEntityPosition( cent->currentState.number, origin );
- }
- else
- trap_S_UpdateEntityPosition( cent->currentState.number, cent->lerpOrigin );
-}
-
-/*
-==================
-CG_EntityEffects
-
-Add continuous entity effects, like local entity emission and lighting
-==================
-*/
-static void CG_EntityEffects( centity_t *cent )
-{
- // update sound origins
- CG_SetEntitySoundPosition( cent );
-
- // add loop sound
- if( cent->currentState.loopSound )
- {
- if( cent->currentState.eType != ET_SPEAKER )
- {
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin,
- cgs.gameSounds[ cent->currentState.loopSound ] );
- }
- else
- {
- trap_S_AddRealLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin,
- cgs.gameSounds[ cent->currentState.loopSound ] );
- }
- }
-
-
- // constant light glow
- if ( cent->currentState.constantLight )
- {
- int cl;
- int i, r, g, b;
-
- cl = cent->currentState.constantLight;
- r = cl & 255;
- g = ( cl >> 8 ) & 255;
- b = ( cl >> 16 ) & 255;
- i = ( ( cl >> 24 ) & 255 ) * 4;
- trap_R_AddLightToScene( cent->lerpOrigin, i, r, g, b );
- }
-
- if( CG_IsTrailSystemValid( ¢->muzzleTS ) )
- {
- //FIXME hack to prevent tesla trails reaching too far
- if( cent->currentState.eType == ET_BUILDABLE )
- {
- vec3_t front, back;
-
- CG_AttachmentPoint( ¢->muzzleTS->frontAttachment, front );
- CG_AttachmentPoint( ¢->muzzleTS->backAttachment, back );
-
- if( Distance( front, back ) > ( TESLAGEN_RANGE * M_ROOT3 ) )
- CG_DestroyTrailSystem( ¢->muzzleTS );
- }
-
- if( cg.time > cent->muzzleTSDeathTime && CG_IsTrailSystemValid( ¢->muzzleTS ) )
- CG_DestroyTrailSystem( ¢->muzzleTS );
- }
-}
-
-
-/*
-==================
-CG_General
-==================
-*/
-static void CG_General( centity_t *cent )
-{
- refEntity_t ent;
- entityState_t *s1;
-
- s1 = ¢->currentState;
-
- // if set to invisible, skip
- if( !s1->modelindex )
- return;
-
- memset( &ent, 0, sizeof( ent ) );
-
- // set frame
-
- ent.frame = s1->frame;
- ent.oldframe = ent.frame;
- ent.backlerp = 0;
-
- VectorCopy( cent->lerpOrigin, ent.origin);
- VectorCopy( cent->lerpOrigin, ent.oldorigin);
-
- ent.hModel = cgs.gameModels[ s1->modelindex ];
-
- // player model
- if( s1->number == cg.snap->ps.clientNum )
- ent.renderfx |= RF_THIRD_PERSON; // only draw from mirrors
-
- // convert angles to axis
- AnglesToAxis( cent->lerpAngles, ent.axis );
-
- // add to refresh list
- trap_R_AddRefEntityToScene( &ent );
-}
-
-/*
-==================
-CG_Speaker
-
-Speaker entities can automatically play sounds
-==================
-*/
-static void CG_Speaker( centity_t *cent )
-{
- if( ! cent->currentState.clientNum )
- { // FIXME: use something other than clientNum...
- return; // not auto triggering
- }
-
- if( cg.time < cent->miscTime )
- return;
-
- trap_S_StartSound( NULL, cent->currentState.number, CHAN_ITEM, cgs.gameSounds[ cent->currentState.eventParm ] );
-
- // ent->s.frame = ent->wait * 10;
- // ent->s.clientNum = ent->random * 10;
- cent->miscTime = cg.time + cent->currentState.frame * 100 + cent->currentState.clientNum * 100 * crandom( );
-}
-
-
-//============================================================================
-
-/*
-===============
-CG_LaunchMissile
-===============
-*/
-static void CG_LaunchMissile( centity_t *cent )
-{
- entityState_t *es;
- const weaponInfo_t *wi;
- particleSystem_t *ps;
- trailSystem_t *ts;
- weapon_t weapon;
- weaponMode_t weaponMode;
-
- es = ¢->currentState;
-
- weapon = es->weapon;
- if( weapon > WP_NUM_WEAPONS )
- weapon = WP_NONE;
-
- wi = &cg_weapons[ weapon ];
- weaponMode = es->generic1;
-
- if( wi->wim[ weaponMode ].missileParticleSystem )
- {
- ps = CG_SpawnNewParticleSystem( wi->wim[ weaponMode ].missileParticleSystem );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentCent( &ps->attachment, cent );
- CG_AttachToCent( &ps->attachment );
- }
- }
-
- if( wi->wim[ weaponMode ].missileTrailSystem )
- {
- ts = CG_SpawnNewTrailSystem( wi->wim[ weaponMode ].missileTrailSystem );
-
- if( CG_IsTrailSystemValid( &ts ) )
- {
- CG_SetAttachmentCent( &ts->frontAttachment, cent );
- CG_AttachToCent( &ts->frontAttachment );
- }
- }
-}
-
-/*
-===============
-CG_Missile
-===============
-*/
-static void CG_Missile( centity_t *cent )
-{
- refEntity_t ent;
- entityState_t *es;
- const weaponInfo_t *wi;
- weapon_t weapon;
- weaponMode_t weaponMode;
- const weaponInfoMode_t *wim;
-
- es = ¢->currentState;
-
- weapon = es->weapon;
- if( weapon > WP_NUM_WEAPONS )
- weapon = WP_NONE;
-
- wi = &cg_weapons[ weapon ];
- weaponMode = es->generic1;
-
- wim = &wi->wim[ weaponMode ];
-
- // calculate the axis
- VectorCopy( es->angles, cent->lerpAngles );
-
- // add dynamic light
- if( wim->missileDlight )
- {
- trap_R_AddLightToScene( cent->lerpOrigin, wim->missileDlight,
- wim->missileDlightColor[ 0 ],
- wim->missileDlightColor[ 1 ],
- wim->missileDlightColor[ 2 ] );
- }
-
- // add missile sound
- if( wim->missileSound )
- {
- vec3_t velocity;
-
- BG_EvaluateTrajectoryDelta( ¢->currentState.pos, cg.time, velocity );
-
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, velocity, wim->missileSound );
- }
-
- // create the render entity
- memset( &ent, 0, sizeof( ent ) );
- VectorCopy( cent->lerpOrigin, ent.origin );
- VectorCopy( cent->lerpOrigin, ent.oldorigin );
-
- if( wim->usesSpriteMissle )
- {
- ent.reType = RT_SPRITE;
- ent.radius = wim->missileSpriteSize;
- ent.rotation = 0;
- ent.customShader = wim->missileSprite;
- ent.shaderRGBA[ 0 ] = 0xFF;
- ent.shaderRGBA[ 1 ] = 0xFF;
- ent.shaderRGBA[ 2 ] = 0xFF;
- ent.shaderRGBA[ 3 ] = 0xFF;
- }
- else
- {
- ent.hModel = wim->missileModel;
- ent.renderfx = wim->missileRenderfx | RF_NOSHADOW;
-
- // convert direction of travel into axis
- if( VectorNormalize2( es->pos.trDelta, ent.axis[ 0 ] ) == 0 )
- ent.axis[ 0 ][ 2 ] = 1;
-
- // spin as it moves
- if( es->pos.trType != TR_STATIONARY && wim->missileRotates )
- RotateAroundDirection( ent.axis, cg.time / 4 );
- else
- RotateAroundDirection( ent.axis, es->time );
-
- if( wim->missileAnimates )
- {
- int timeSinceStart = cg.time - es->time;
-
- if( wim->missileAnimLooping )
- {
- ent.frame = wim->missileAnimStartFrame +
- (int)( ( timeSinceStart / 1000.0f ) * wim->missileAnimFrameRate ) %
- wim->missileAnimNumFrames;
- }
- else
- {
- ent.frame = wim->missileAnimStartFrame +
- (int)( ( timeSinceStart / 1000.0f ) * wim->missileAnimFrameRate );
-
- if( ent.frame > ( wim->missileAnimStartFrame + wim->missileAnimNumFrames ) )
- ent.frame = wim->missileAnimStartFrame + wim->missileAnimNumFrames;
- }
- }
- }
-
- //only refresh if there is something to display
- if( wim->missileSprite || wim->missileModel )
- trap_R_AddRefEntityToScene( &ent );
-}
-
-/*
-===============
-CG_Mover
-===============
-*/
-static void CG_Mover( centity_t *cent )
-{
- refEntity_t ent;
- entityState_t *s1;
-
- s1 = ¢->currentState;
-
- // create the render entity
- memset( &ent, 0, sizeof( ent ) );
- VectorCopy( cent->lerpOrigin, ent.origin );
- VectorCopy( cent->lerpOrigin, ent.oldorigin );
- AnglesToAxis( cent->lerpAngles, ent.axis );
-
- ent.renderfx = RF_NOSHADOW;
-
- // flicker between two skins (FIXME?)
- ent.skinNum = ( cg.time >> 6 ) & 1;
-
- // get the model, either as a bmodel or a modelindex
- if( s1->solid == SOLID_BMODEL )
- ent.hModel = cgs.inlineDrawModel[ s1->modelindex ];
- else
- ent.hModel = cgs.gameModels[ s1->modelindex ];
-
- // add to refresh list
- trap_R_AddRefEntityToScene( &ent );
-
- // add the secondary model
- if( s1->modelindex2 )
- {
- ent.skinNum = 0;
- ent.hModel = cgs.gameModels[ s1->modelindex2 ];
- trap_R_AddRefEntityToScene( &ent );
- }
-
-}
-
-/*
-===============
-CG_Beam
-
-Also called as an event
-===============
-*/
-void CG_Beam( centity_t *cent )
-{
- refEntity_t ent;
- entityState_t *s1;
-
- s1 = ¢->currentState;
-
- // create the render entity
- memset( &ent, 0, sizeof( ent ) );
- VectorCopy( s1->pos.trBase, ent.origin );
- VectorCopy( s1->origin2, ent.oldorigin );
- AxisClear( ent.axis );
- ent.reType = RT_BEAM;
-
- ent.renderfx = RF_NOSHADOW;
-
- // add to refresh list
- trap_R_AddRefEntityToScene( &ent );
-}
-
-
-/*
-===============
-CG_Portal
-===============
-*/
-static void CG_Portal( centity_t *cent )
-{
- refEntity_t ent;
- entityState_t *s1;
-
- s1 = ¢->currentState;
-
- // create the render entity
- memset( &ent, 0, sizeof( ent ) );
- VectorCopy( cent->lerpOrigin, ent.origin );
- VectorCopy( s1->origin2, ent.oldorigin );
- ByteToDir( s1->eventParm, ent.axis[ 0 ] );
- PerpendicularVector( ent.axis[ 1 ], ent.axis[ 0 ] );
-
- // negating this tends to get the directions like they want
- // we really should have a camera roll value
- VectorSubtract( vec3_origin, ent.axis[ 1 ], ent.axis[ 1 ] );
-
- CrossProduct( ent.axis[ 0 ], ent.axis[ 1 ], ent.axis[ 2 ] );
- ent.reType = RT_PORTALSURFACE;
- ent.oldframe = s1->powerups;
- ent.frame = s1->frame; // rotation speed
- ent.skinNum = s1->clientNum / 256.0 * 360; // roll offset
-
- // add to refresh list
- trap_R_AddRefEntityToScene( &ent );
-}
-
-//============================================================================
-
-#define SETBOUNDS(v1,v2,r) ((v1)[0]=(-r/2),(v1)[1]=(-r/2),(v1)[2]=(-r/2),\
- (v2)[0]=(r/2),(v2)[1]=(r/2),(v2)[2]=(r/2))
-#define RADIUSSTEP 0.5f
-
-#define FLARE_OFF 0
-#define FLARE_NOFADE 1
-#define FLARE_TIMEFADE 2
-#define FLARE_REALFADE 3
-
-/*
-=========================
-CG_LightFlare
-=========================
-*/
-static void CG_LightFlare( centity_t *cent )
-{
- refEntity_t flare;
- entityState_t *es;
- vec3_t forward, delta;
- float len;
- trace_t tr;
- float maxAngle;
- vec3_t mins, maxs, start, end;
- float srcRadius, srLocal, ratio = 1.0f;
- int entityNum;
-
- es = ¢->currentState;
-
- if( cg.renderingThirdPerson )
- entityNum = MAGIC_TRACE_HACK;
- else
- entityNum = cg.predictedPlayerState.clientNum;
-
- //don't draw light flares
- if( cg_lightFlare.integer == FLARE_OFF )
- return;
-
- //flare is "off"
- if( es->eFlags & EF_NODRAW )
- return;
-
- CG_Trace( &tr, cg.refdef.vieworg, NULL, NULL, es->angles2,
- entityNum, MASK_SHOT );
-
- //if there is no los between the view and the flare source
- //it definately cannot be seen
- if( tr.fraction < 1.0f || tr.allsolid )
- return;
-
- memset( &flare, 0, sizeof( flare ) );
-
- flare.reType = RT_SPRITE;
- flare.customShader = cgs.gameShaders[ es->modelindex ];
- flare.shaderRGBA[ 0 ] = 0xFF;
- flare.shaderRGBA[ 1 ] = 0xFF;
- flare.shaderRGBA[ 2 ] = 0xFF;
- flare.shaderRGBA[ 3 ] = 0xFF;
-
- //flares always drawn before the rest of the scene
- flare.renderfx |= RF_DEPTHHACK;
-
- //bunch of geometry
- AngleVectors( es->angles, forward, NULL, NULL );
- VectorCopy( cent->lerpOrigin, flare.origin );
- VectorSubtract( flare.origin, cg.refdef.vieworg, delta );
- len = VectorLength( delta );
- VectorNormalize( delta );
-
- //flare is too close to camera to be drawn
- if( len < es->generic1 )
- return;
-
- //don't bother for flares behind the view plane
- if( DotProduct( delta, cg.refdef.viewaxis[ 0 ] ) < 0.0 )
- return;
-
- //only recalculate radius and ratio every three frames
- if( !( cg.clientFrame % 2 ) )
- {
- //can only see the flare when in front of it
- flare.radius = len / es->origin2[ 0 ];
-
- if( es->origin2[ 2 ] == 0 )
- srcRadius = srLocal = flare.radius / 2.0f;
- else
- srcRadius = srLocal = len / es->origin2[ 2 ];
-
- maxAngle = es->origin2[ 1 ];
-
- if( maxAngle > 0.0f )
- {
- float radiusMod = 1.0f - ( 180.0f - RAD2DEG(
- acos( DotProduct( delta, forward ) ) ) ) / maxAngle;
-
- if( radiusMod < 0.0f )
- radiusMod = 0.0f;
-
- flare.radius *= radiusMod;
- }
-
- if( flare.radius < 0.0f )
- flare.radius = 0.0f;
-
- VectorMA( flare.origin, -flare.radius, delta, end );
- VectorMA( cg.refdef.vieworg, flare.radius, delta, start );
-
- if( cg_lightFlare.integer == FLARE_REALFADE )
- {
- //"correct" flares
- CG_BiSphereTrace( &tr, cg.refdef.vieworg, end,
- 1.0f, srcRadius, entityNum, MASK_SHOT );
-
- if( tr.fraction < 1.0f )
- ratio = tr.lateralFraction;
- else
- ratio = 1.0f;
- }
- else if( cg_lightFlare.integer == FLARE_TIMEFADE )
- {
- //draw timed flares
- SETBOUNDS( mins, maxs, srcRadius );
- CG_Trace( &tr, start, mins, maxs, end,
- entityNum, MASK_SHOT );
-
- if( ( tr.fraction < 1.0f || tr.startsolid ) && cent->lfs.status )
- {
- cent->lfs.status = qfalse;
- cent->lfs.lastTime = cg.time;
- }
- else if( ( tr.fraction == 1.0f && !tr.startsolid ) && !cent->lfs.status )
- {
- cent->lfs.status = qtrue;
- cent->lfs.lastTime = cg.time;
- }
-
- //fade flare up
- if( cent->lfs.status )
- {
- if( cent->lfs.lastTime + es->time > cg.time )
- ratio = (float)( cg.time - cent->lfs.lastTime ) / es->time;
- }
-
- //fade flare down
- if( !cent->lfs.status )
- {
- if( cent->lfs.lastTime + es->time > cg.time )
- {
- ratio = (float)( cg.time - cent->lfs.lastTime ) / es->time;
- ratio = 1.0f - ratio;
- }
- else
- ratio = 0.0f;
- }
- }
- else if( cg_lightFlare.integer == FLARE_NOFADE )
- {
- //draw nofade flares
- SETBOUNDS( mins, maxs, srcRadius );
- CG_Trace( &tr, start, mins, maxs, end,
- entityNum, MASK_SHOT );
-
- //flare source occluded
- if( ( tr.fraction < 1.0f || tr.startsolid ) )
- ratio = 0.0f;
- }
- }
- else
- {
- ratio = cent->lfs.lastRatio;
- flare.radius = cent->lfs.lastRadius;
- }
-
- cent->lfs.lastRatio = ratio;
- cent->lfs.lastRadius = flare.radius;
-
- if( ratio < 1.0f )
- {
- flare.radius *= ratio;
- flare.shaderRGBA[ 3 ] = (byte)( (float)flare.shaderRGBA[ 3 ] * ratio );
- }
-
- if( flare.radius <= 0.0f )
- return;
-
- trap_R_AddRefEntityToScene( &flare );
-}
-
-/*
-=========================
-CG_Lev2ZapChain
-=========================
-*/
-static void CG_Lev2ZapChain( centity_t *cent )
-{
- int i;
- entityState_t *es;
- centity_t *source = NULL, *target = NULL;
-
- es = ¢->currentState;
-
- for( i = 0; i <= 2; i++ )
- {
- switch( i )
- {
- case 0:
- if( es->time <= 0 )
- continue;
-
- source = &cg_entities[ es->powerups ];
- target = &cg_entities[ es->time ];
- break;
-
- case 1:
- if( es->time2 <= 0 )
- continue;
-
- source = &cg_entities[ es->time ];
- target = &cg_entities[ es->time2 ];
- break;
-
- case 2:
- if( es->constantLight <= 0 )
- continue;
-
- source = &cg_entities[ es->time2 ];
- target = &cg_entities[ es->constantLight ];
- break;
- }
-
- if( !CG_IsTrailSystemValid( ¢->level2ZapTS[ i ] ) )
- cent->level2ZapTS[ i ] = CG_SpawnNewTrailSystem( cgs.media.level2ZapTS );
-
- if( CG_IsTrailSystemValid( ¢->level2ZapTS[ i ] ) )
- {
- CG_SetAttachmentCent( ¢->level2ZapTS[ i ]->frontAttachment, source );
- CG_SetAttachmentCent( ¢->level2ZapTS[ i ]->backAttachment, target );
- CG_AttachToCent( ¢->level2ZapTS[ i ]->frontAttachment );
- CG_AttachToCent( ¢->level2ZapTS[ i ]->backAttachment );
- }
- }
-}
-
-/*
-=========================
-CG_AdjustPositionForMover
-
-Also called by client movement prediction code
-=========================
-*/
-void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out )
-{
- centity_t *cent;
- vec3_t oldOrigin, origin, deltaOrigin;
- vec3_t oldAngles, angles, deltaAngles;
-
- if( moverNum <= 0 || moverNum >= ENTITYNUM_MAX_NORMAL )
- {
- VectorCopy( in, out );
- return;
- }
-
- cent = &cg_entities[ moverNum ];
-
- if( cent->currentState.eType != ET_MOVER )
- {
- VectorCopy( in, out );
- return;
- }
-
- BG_EvaluateTrajectory( ¢->currentState.pos, fromTime, oldOrigin );
- BG_EvaluateTrajectory( ¢->currentState.apos, fromTime, oldAngles );
-
- BG_EvaluateTrajectory( ¢->currentState.pos, toTime, origin );
- BG_EvaluateTrajectory( ¢->currentState.apos, toTime, angles );
-
- VectorSubtract( origin, oldOrigin, deltaOrigin );
- VectorSubtract( angles, oldAngles, deltaAngles );
-
- VectorAdd( in, deltaOrigin, out );
-
- // FIXME: origin change when on a rotating object
-}
-
-
-/*
-=============================
-CG_InterpolateEntityPosition
-=============================
-*/
-static void CG_InterpolateEntityPosition( centity_t *cent )
-{
- vec3_t current, next;
- float f;
-
- // it would be an internal error to find an entity that interpolates without
- // a snapshot ahead of the current one
- if( cg.nextSnap == NULL )
- CG_Error( "CG_InterpoateEntityPosition: cg.nextSnap == NULL" );
-
- f = cg.frameInterpolation;
-
- // this will linearize a sine or parabolic curve, but it is important
- // to not extrapolate player positions if more recent data is available
- BG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, current );
- BG_EvaluateTrajectory( ¢->nextState.pos, cg.nextSnap->serverTime, next );
-
- cent->lerpOrigin[ 0 ] = current[ 0 ] + f * ( next[ 0 ] - current[ 0 ] );
- cent->lerpOrigin[ 1 ] = current[ 1 ] + f * ( next[ 1 ] - current[ 1 ] );
- cent->lerpOrigin[ 2 ] = current[ 2 ] + f * ( next[ 2 ] - current[ 2 ] );
-
- BG_EvaluateTrajectory( ¢->currentState.apos, cg.snap->serverTime, current );
- BG_EvaluateTrajectory( ¢->nextState.apos, cg.nextSnap->serverTime, next );
-
- cent->lerpAngles[ 0 ] = LerpAngle( current[ 0 ], next[ 0 ], f );
- cent->lerpAngles[ 1 ] = LerpAngle( current[ 1 ], next[ 1 ], f );
- cent->lerpAngles[ 2 ] = LerpAngle( current[ 2 ], next[ 2 ], f );
-
-}
-
-/*
-===============
-CG_CalcEntityLerpPositions
-
-===============
-*/
-static void CG_CalcEntityLerpPositions( centity_t *cent )
-{
- // this will be set to how far forward projectiles will be extrapolated
- int timeshift = 0;
-
- // if this player does not want to see extrapolated players
- if( !cg_smoothClients.integer )
- {
- // make sure the clients use TR_INTERPOLATE
- if( cent->currentState.number < MAX_CLIENTS )
- {
- cent->currentState.pos.trType = TR_INTERPOLATE;
- cent->nextState.pos.trType = TR_INTERPOLATE;
- }
- }
-
- if( cent->interpolate && cent->currentState.pos.trType == TR_INTERPOLATE )
- {
- CG_InterpolateEntityPosition( cent );
- return;
- }
-
- // first see if we can interpolate between two snaps for
- // linear extrapolated clients
- if( cent->interpolate && cent->currentState.pos.trType == TR_LINEAR_STOP &&
- cent->currentState.number < MAX_CLIENTS )
- {
- CG_InterpolateEntityPosition( cent );
- return;
- }
-
- if( cg_projectileNudge.integer > 0 &&
- cent->currentState.eType == ET_MISSILE &&
- !( cg.snap->ps.pm_flags & PMF_FOLLOW ) )
- {
- timeshift = cg.ping;
- }
-
- // just use the current frame and evaluate as best we can
- BG_EvaluateTrajectory( ¢->currentState.pos,
- ( cg.time + timeshift ), cent->lerpOrigin );
- BG_EvaluateTrajectory( ¢->currentState.apos,
- ( cg.time + timeshift ), cent->lerpAngles );
-
- if( timeshift )
- {
- trace_t tr;
- vec3_t lastOrigin;
-
- BG_EvaluateTrajectory( ¢->currentState.pos, cg.time, lastOrigin );
-
- CG_Trace( &tr, lastOrigin, vec3_origin, vec3_origin, cent->lerpOrigin,
- cent->currentState.number, MASK_SHOT );
-
- // don't let the projectile go through the floor
- if( tr.fraction < 1.0f )
- VectorLerp( tr.fraction, lastOrigin, cent->lerpOrigin, cent->lerpOrigin );
- }
-
- // adjust for riding a mover if it wasn't rolled into the predicted
- // player state
- if( cent != &cg.predictedPlayerEntity )
- {
- CG_AdjustPositionForMover( cent->lerpOrigin, cent->currentState.groundEntityNum,
- cg.snap->serverTime, cg.time, cent->lerpOrigin );
- }
-}
-
-
-/*
-===============
-CG_CEntityPVSEnter
-
-===============
-*/
-static void CG_CEntityPVSEnter( centity_t *cent )
-{
- entityState_t *es = ¢->currentState;
-
- if( cg_debugPVS.integer )
- CG_Printf( "Entity %d entered PVS\n", cent->currentState.number );
-
- switch( es->eType )
- {
- case ET_MISSILE:
- CG_LaunchMissile( cent );
- break;
- }
-
- //clear any particle systems from previous uses of this centity_t
- cent->muzzlePS = NULL;
- cent->muzzlePsTrigger = qfalse;
- cent->jetPackPS = NULL;
- cent->jetPackState = JPS_OFF;
- cent->buildablePS = NULL;
- cent->entityPS = NULL;
- cent->entityPSMissing = qfalse;
-
- //make sure that the buildable animations are in a consistent state
- //when a buildable enters the PVS
- cent->buildableAnim = cent->lerpFrame.animationNumber = BANIM_NONE;
- cent->oldBuildableAnim = es->legsAnim;
-}
-
-
-/*
-===============
-CG_CEntityPVSLeave
-
-===============
-*/
-static void CG_CEntityPVSLeave( centity_t *cent )
-{
- int i;
- entityState_t *es = ¢->currentState;
-
- if( cg_debugPVS.integer )
- CG_Printf( "Entity %d left PVS\n", cent->currentState.number );
-
- switch( es->eType )
- {
- case ET_LEV2_ZAP_CHAIN:
- for( i = 0; i <= 2; i++ )
- {
- if( CG_IsTrailSystemValid( ¢->level2ZapTS[ i ] ) )
- CG_DestroyTrailSystem( ¢->level2ZapTS[ i ] );
- }
- break;
- }
-}
-
-
-/*
-===============
-CG_AddCEntity
-
-===============
-*/
-static void CG_AddCEntity( centity_t *cent )
-{
- // event-only entities will have been dealt with already
- if( cent->currentState.eType >= ET_EVENTS )
- return;
-
- // calculate the current origin
- CG_CalcEntityLerpPositions( cent );
-
- // add automatic effects
- CG_EntityEffects( cent );
-
- switch( cent->currentState.eType )
- {
- default:
- CG_Error( "Bad entity type: %i\n", cent->currentState.eType );
- break;
-
- case ET_INVISIBLE:
- case ET_PUSH_TRIGGER:
- case ET_TELEPORT_TRIGGER:
- break;
-
- case ET_GENERAL:
- CG_General( cent );
- break;
-
- case ET_CORPSE:
- CG_Corpse( cent );
- break;
-
- case ET_PLAYER:
- CG_Player( cent );
- break;
-
- case ET_BUILDABLE:
- CG_Buildable( cent );
- break;
-
- case ET_MISSILE:
- CG_Missile( cent );
- break;
-
- case ET_MOVER:
- CG_Mover( cent );
- break;
-
- case ET_BEAM:
- CG_Beam( cent );
- break;
-
- case ET_PORTAL:
- CG_Portal( cent );
- break;
-
- case ET_SPEAKER:
- CG_Speaker( cent );
- break;
-
- case ET_PARTICLE_SYSTEM:
- CG_ParticleSystemEntity( cent );
- break;
-
- case ET_ANIMMAPOBJ:
- CG_AnimMapObj( cent );
- break;
-
- case ET_MODELDOOR:
- CG_ModelDoor( cent );
- break;
-
- case ET_LIGHTFLARE:
- CG_LightFlare( cent );
- break;
-
- case ET_LEV2_ZAP_CHAIN:
- CG_Lev2ZapChain( cent );
- break;
- }
-}
-
-/*
-===============
-CG_AddPacketEntities
-
-===============
-*/
-void CG_AddPacketEntities( void )
-{
- int num;
- centity_t *cent;
- playerState_t *ps;
-
- // set cg.frameInterpolation
- if( cg.nextSnap )
- {
- int delta;
-
- delta = ( cg.nextSnap->serverTime - cg.snap->serverTime );
-
- if( delta == 0 )
- cg.frameInterpolation = 0;
- else
- cg.frameInterpolation = (float)( cg.time - cg.snap->serverTime ) / delta;
- }
- else
- {
- cg.frameInterpolation = 0; // actually, it should never be used, because
- // no entities should be marked as interpolating
- }
-
- // the auto-rotating items will all have the same axis
- cg.autoAngles[ 0 ] = 0;
- cg.autoAngles[ 1 ] = ( cg.time & 2047 ) * 360 / 2048.0;
- cg.autoAngles[ 2 ] = 0;
-
- cg.autoAnglesFast[ 0 ] = 0;
- cg.autoAnglesFast[ 1 ] = ( cg.time & 1023 ) * 360 / 1024.0f;
- cg.autoAnglesFast[ 2 ] = 0;
-
- AnglesToAxis( cg.autoAngles, cg.autoAxis );
- AnglesToAxis( cg.autoAnglesFast, cg.autoAxisFast );
-
- // generate and add the entity from the playerstate
- ps = &cg.predictedPlayerState;
- BG_PlayerStateToEntityState( ps, &cg.predictedPlayerEntity.currentState, qfalse );
- cg.predictedPlayerEntity.valid = qtrue;
- CG_AddCEntity( &cg.predictedPlayerEntity );
-
- // lerp the non-predicted value for lightning gun origins
- CG_CalcEntityLerpPositions( &cg_entities[ cg.snap->ps.clientNum ] );
-
- // scanner
- CG_UpdateEntityPositions( );
-
- for( num = 0; num < MAX_GENTITIES; num++ )
- cg_entities[ num ].valid = qfalse;
-
- // add each entity sent over by the server
- for( num = 0; num < cg.snap->numEntities; num++ )
- {
- cent = &cg_entities[ cg.snap->entities[ num ].number ];
- cent->valid = qtrue;
- }
-
- for( num = 0; num < MAX_GENTITIES; num++ )
- {
- cent = &cg_entities[ num ];
-
- if( cent->valid && !cent->oldValid )
- CG_CEntityPVSEnter( cent );
- else if( !cent->valid && cent->oldValid )
- CG_CEntityPVSLeave( cent );
-
- cent->oldValid = cent->valid;
- }
-
- // add each entity sent over by the server
- for( num = 0; num < cg.snap->numEntities; num++ )
- {
- cent = &cg_entities[ cg.snap->entities[ num ].number ];
- CG_AddCEntity( cent );
- }
-
- //make an attempt at drawing bounding boxes of selected entity types
- if( cg_drawBBOX.integer )
- {
- for( num = 0; num < cg.snap->numEntities; num++ )
- {
- float x, zd, zu;
- vec3_t mins, maxs;
- entityState_t *es;
-
- cent = &cg_entities[ cg.snap->entities[ num ].number ];
- es = ¢->currentState;
-
- switch( es->eType )
- {
- case ET_BUILDABLE:
- case ET_MISSILE:
- case ET_CORPSE:
- x = ( es->solid & 255 );
- zd = ( ( es->solid >> 8 ) & 255 );
- zu = ( ( es->solid >> 16 ) & 255 ) - 32;
-
- mins[ 0 ] = mins[ 1 ] = -x;
- maxs[ 0 ] = maxs[ 1 ] = x;
- mins[ 2 ] = -zd;
- maxs[ 2 ] = zu;
-
- CG_DrawBoundingBox( cent->lerpOrigin, mins, maxs );
- break;
-
- default:
- break;
- }
- }
- }
-}
-
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
deleted file mode 100644
index 07bcea9..0000000
--- a/src/cgame/cg_event.c
+++ /dev/null
@@ -1,1034 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_event.c -- handle entity events at snapshot or playerstate transitions
-
-
-#include "cg_local.h"
-
-/*
-=============
-CG_Obituary
-=============
-*/
-static void CG_Obituary( entityState_t *ent )
-{
- int mod;
- int target, attacker;
- char *message;
- char *message2;
- const char *targetInfo;
- const char *attackerInfo;
- char targetName[ 32 ];
- char attackerName[ 32 ];
- char className[ 64 ];
- gender_t gender;
- clientInfo_t *ci;
- qboolean teamKill = qfalse;
-
- target = ent->otherEntityNum;
- attacker = ent->otherEntityNum2;
- mod = ent->eventParm;
-
- if( target < 0 || target >= MAX_CLIENTS )
- CG_Error( "CG_Obituary: target out of range" );
-
- ci = &cgs.clientinfo[ target ];
-
- if( attacker < 0 || attacker >= MAX_CLIENTS )
- {
- attacker = ENTITYNUM_WORLD;
- attackerInfo = NULL;
- }
- else
- {
- attackerInfo = CG_ConfigString( CS_PLAYERS + attacker );
- if( ci && cgs.clientinfo[ attacker ].team == ci->team )
- teamKill = qtrue;
- }
-
- targetInfo = CG_ConfigString( CS_PLAYERS + target );
-
- if( !targetInfo )
- return;
-
- Q_strncpyz( targetName, Info_ValueForKey( targetInfo, "n" ), sizeof( targetName ) - 2 );
- strcat( targetName, S_COLOR_WHITE );
-
- message2 = "";
-
- // check for single client messages
-
- switch( mod )
- {
- case MOD_SUICIDE:
- message = "suicides";
- break;
- case MOD_FALLING:
- message = "fell fowl to gravity";
- break;
- case MOD_CRUSH:
- message = "was squished";
- break;
- case MOD_WATER:
- message = "forgot to pack a snorkel";
- break;
- case MOD_SLIME:
- message = "melted";
- break;
- case MOD_LAVA:
- message = "does a back flip into the lava";
- break;
- case MOD_TARGET_LASER:
- message = "saw the light";
- break;
- case MOD_TRIGGER_HURT:
- message = "was in the wrong place";
- break;
- case MOD_HSPAWN:
- message = "should have run further";
- break;
- case MOD_ASPAWN:
- message = "shouldn't have trod in the acid";
- break;
- case MOD_MGTURRET:
- message = "was gunned down by a turret";
- break;
- case MOD_TESLAGEN:
- message = "was zapped by a tesla generator";
- break;
- case MOD_ATUBE:
- message = "was melted by an acid tube";
- break;
- case MOD_OVERMIND:
- message = "got too close to the overmind";
- break;
- case MOD_REACTOR:
- message = "got too close to the reactor";
- break;
- case MOD_SLOWBLOB:
- message = "should have visited a medical station";
- break;
- case MOD_SWARM:
- message = "was hunted down by the swarm";
- break;
- default:
- message = NULL;
- break;
- }
-
- if( attacker == target )
- {
- gender = ci->gender;
- switch( mod )
- {
- case MOD_FLAMER_SPLASH:
- if( gender == GENDER_FEMALE )
- message = "toasted herself";
- else if( gender == GENDER_NEUTER )
- message = "toasted itself";
- else
- message = "toasted himself";
- break;
-
- case MOD_LCANNON_SPLASH:
- if( gender == GENDER_FEMALE )
- message = "irradiated herself";
- else if( gender == GENDER_NEUTER )
- message = "irradiated itself";
- else
- message = "irradiated himself";
- break;
-
- case MOD_GRENADE:
- if( gender == GENDER_FEMALE )
- message = "blew herself up";
- else if( gender == GENDER_NEUTER )
- message = "blew itself up";
- else
- message = "blew himself up";
- break;
-
- default:
- if( gender == GENDER_FEMALE )
- message = "killed herself";
- else if( gender == GENDER_NEUTER )
- message = "killed itself";
- else
- message = "killed himself";
- break;
- }
- }
-
- if( message )
- {
- CG_Printf( "%s %s.\n", targetName, message );
- return;
- }
-
- // check for double client messages
- if( !attackerInfo )
- {
- attacker = ENTITYNUM_WORLD;
- strcpy( attackerName, "noname" );
- }
- else
- {
- Q_strncpyz( attackerName, Info_ValueForKey( attackerInfo, "n" ), sizeof( attackerName ) - 2);
- strcat( attackerName, S_COLOR_WHITE );
- // check for kill messages about the current clientNum
- if( target == cg.snap->ps.clientNum )
- Q_strncpyz( cg.killerName, attackerName, sizeof( cg.killerName ) );
- }
-
- if( attacker != ENTITYNUM_WORLD )
- {
- switch( mod )
- {
- case MOD_PAINSAW:
- message = "was sawn by";
- break;
- case MOD_BLASTER:
- message = "was blasted by";
- break;
- case MOD_MACHINEGUN:
- message = "was machinegunned by";
- break;
- case MOD_CHAINGUN:
- message = "was chaingunned by";
- break;
- case MOD_SHOTGUN:
- message = "was gunned down by";
- break;
- case MOD_PRIFLE:
- message = "was pulse rifled by";
- break;
- case MOD_MDRIVER:
- message = "was mass driven by";
- break;
- case MOD_LASGUN:
- message = "was lasgunned by";
- break;
- case MOD_FLAMER:
- message = "was grilled by";
- message2 = "'s flamer";
- break;
- case MOD_FLAMER_SPLASH:
- message = "was toasted by";
- message2 = "'s flamer";
- break;
- case MOD_LCANNON:
- message = "felt the full force of";
- message2 = "'s lucifer cannon";
- break;
- case MOD_LCANNON_SPLASH:
- message = "was caught in the fallout of";
- message2 = "'s lucifer cannon";
- break;
- case MOD_GRENADE:
- message = "couldn't escape";
- message2 = "'s grenade";
- break;
-
- case MOD_ABUILDER_CLAW:
- message = "should leave";
- message2 = "'s buildings alone";
- break;
- case MOD_LEVEL0_BITE:
- message = "was bitten by";
- break;
- case MOD_LEVEL1_CLAW:
- message = "was swiped by";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL1 ) );
- message2 = className;
- break;
- case MOD_LEVEL2_CLAW:
- message = "was clawed by";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL2 ) );
- message2 = className;
- break;
- case MOD_LEVEL2_ZAP:
- message = "was zapped by";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL2 ) );
- message2 = className;
- break;
- case MOD_LEVEL3_CLAW:
- message = "was chomped by";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL3 ) );
- message2 = className;
- break;
- case MOD_LEVEL3_POUNCE:
- message = "was pounced upon by";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL3 ) );
- message2 = className;
- break;
- case MOD_LEVEL3_BOUNCEBALL:
- message = "was sniped by";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL3 ) );
- message2 = className;
- break;
- case MOD_LEVEL4_CLAW:
- message = "was mauled by";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL4 ) );
- message2 = className;
- break;
- case MOD_LEVEL4_CHARGE:
- message = "should have gotten out of the way of";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL4 ) );
- message2 = className;
- break;
-
- case MOD_POISON:
- message = "should have used a medkit against";
- message2 = "'s poison";
- break;
- case MOD_LEVEL1_PCLOUD:
- message = "was gassed by";
- Com_sprintf( className, 64, "'s %s",
- BG_FindHumanNameForClassNum( PCL_ALIEN_LEVEL1 ) );
- message2 = className;
- break;
-
-
- case MOD_TELEFRAG:
- message = "tried to invade";
- message2 = "'s personal space";
- break;
- default:
- message = "was killed by";
- break;
- }
-
- if( message )
- {
- CG_Printf( "%s %s %s%s%s\n",
- targetName, message,
- ( teamKill ) ? S_COLOR_RED "TEAMMATE " S_COLOR_WHITE : "",
- attackerName, message2 );
- if( teamKill && attacker == cg.clientNum )
- {
- CG_CenterPrint( va ( "You killed " S_COLOR_RED "TEAMMATE "
- S_COLOR_WHITE "%s", targetName ),
- SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
- }
- return;
- }
- }
-
- // we don't know what it was
- CG_Printf( "%s died.\n", targetName );
-}
-
-//==========================================================================
-
-/*
-================
-CG_PainEvent
-
-Also called by playerstate transition
-================
-*/
-void CG_PainEvent( centity_t *cent, int health )
-{
- char *snd;
-
- // don't do more than two pain sounds a second
- if( cg.time - cent->pe.painTime < 500 )
- return;
-
- if( health < 25 )
- snd = "*pain25_1.wav";
- else if( health < 50 )
- snd = "*pain50_1.wav";
- else if( health < 75 )
- snd = "*pain75_1.wav";
- else
- snd = "*pain100_1.wav";
-
- trap_S_StartSound( NULL, cent->currentState.number, CHAN_VOICE,
- CG_CustomSound( cent->currentState.number, snd ) );
-
- // save pain time for programitic twitch animation
- cent->pe.painTime = cg.time;
- cent->pe.painDirection ^= 1;
-}
-
-/*
-==============
-CG_EntityEvent
-
-An entity has an event value
-also called by CG_CheckPlayerstateEvents
-==============
-*/
-#define DEBUGNAME(x) if(cg_debugEvents.integer){CG_Printf(x"\n");}
-void CG_EntityEvent( centity_t *cent, vec3_t position )
-{
- entityState_t *es;
- int event;
- vec3_t dir;
- const char *s;
- int clientNum;
- clientInfo_t *ci;
- int steptime;
-
- if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR )
- steptime = 200;
- else
- steptime = BG_FindSteptimeForClass( cg.snap->ps.stats[ STAT_PCLASS ] );
-
- es = ¢->currentState;
- event = es->event & ~EV_EVENT_BITS;
-
- if( cg_debugEvents.integer )
- CG_Printf( "ent:%3i event:%3i ", es->number, event );
-
- if( !event )
- {
- DEBUGNAME("ZEROEVENT");
- return;
- }
-
- clientNum = es->clientNum;
- if( clientNum < 0 || clientNum >= MAX_CLIENTS )
- clientNum = 0;
-
- ci = &cgs.clientinfo[ clientNum ];
-
- switch( event )
- {
- //
- // movement generated events
- //
- case EV_FOOTSTEP:
- DEBUGNAME( "EV_FOOTSTEP" );
- if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
- {
- if( ci->footsteps == FOOTSTEP_CUSTOM )
- trap_S_StartSound( NULL, es->number, CHAN_BODY,
- ci->customFootsteps[ rand( ) & 3 ] );
- else
- trap_S_StartSound( NULL, es->number, CHAN_BODY,
- cgs.media.footsteps[ ci->footsteps ][ rand( ) & 3 ] );
- }
- break;
-
- case EV_FOOTSTEP_METAL:
- DEBUGNAME( "EV_FOOTSTEP_METAL" );
- if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
- {
- if( ci->footsteps == FOOTSTEP_CUSTOM )
- trap_S_StartSound( NULL, es->number, CHAN_BODY,
- ci->customMetalFootsteps[ rand( ) & 3 ] );
- else
- trap_S_StartSound( NULL, es->number, CHAN_BODY,
- cgs.media.footsteps[ FOOTSTEP_METAL ][ rand( ) & 3 ] );
- }
- break;
-
- case EV_FOOTSTEP_SQUELCH:
- DEBUGNAME( "EV_FOOTSTEP_SQUELCH" );
- if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
- {
- trap_S_StartSound( NULL, es->number, CHAN_BODY,
- cgs.media.footsteps[ FOOTSTEP_FLESH ][ rand( ) & 3 ] );
- }
- break;
-
- case EV_FOOTSPLASH:
- DEBUGNAME( "EV_FOOTSPLASH" );
- if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
- {
- trap_S_StartSound( NULL, es->number, CHAN_BODY,
- cgs.media.footsteps[ FOOTSTEP_SPLASH ][ rand( ) & 3 ] );
- }
- break;
-
- case EV_FOOTWADE:
- DEBUGNAME( "EV_FOOTWADE" );
- if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
- {
- trap_S_StartSound( NULL, es->number, CHAN_BODY,
- cgs.media.footsteps[ FOOTSTEP_SPLASH ][ rand( ) & 3 ] );
- }
- break;
-
- case EV_SWIM:
- DEBUGNAME( "EV_SWIM" );
- if( cg_footsteps.integer && ci->footsteps != FOOTSTEP_NONE )
- {
- trap_S_StartSound( NULL, es->number, CHAN_BODY,
- cgs.media.footsteps[ FOOTSTEP_SPLASH ][ rand( ) & 3 ] );
- }
- break;
-
-
- case EV_FALL_SHORT:
- DEBUGNAME( "EV_FALL_SHORT" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.landSound );
-
- if( clientNum == cg.predictedPlayerState.clientNum )
- {
- // smooth landing z changes
- cg.landChange = -8;
- cg.landTime = cg.time;
- }
- break;
-
- case EV_FALL_MEDIUM:
- DEBUGNAME( "EV_FALL_MEDIUM" );
- // use normal pain sound
- trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*pain100_1.wav" ) );
-
- if( clientNum == cg.predictedPlayerState.clientNum )
- {
- // smooth landing z changes
- cg.landChange = -16;
- cg.landTime = cg.time;
- }
- break;
-
- case EV_FALL_FAR:
- DEBUGNAME( "EV_FALL_FAR" );
- trap_S_StartSound (NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*fall1.wav" ) );
- cent->pe.painTime = cg.time; // don't play a pain sound right after this
-
- if( clientNum == cg.predictedPlayerState.clientNum )
- {
- // smooth landing z changes
- cg.landChange = -24;
- cg.landTime = cg.time;
- }
- break;
-
- case EV_FALLING:
- DEBUGNAME( "EV_FALLING" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*falling1.wav" ) );
- break;
-
- case EV_STEP_4:
- case EV_STEP_8:
- case EV_STEP_12:
- case EV_STEP_16: // smooth out step up transitions
- case EV_STEPDN_4:
- case EV_STEPDN_8:
- case EV_STEPDN_12:
- case EV_STEPDN_16: // smooth out step down transitions
- DEBUGNAME( "EV_STEP" );
- {
- float oldStep;
- int delta;
- int step;
-
- if( clientNum != cg.predictedPlayerState.clientNum )
- break;
-
- // if we are interpolating, we don't need to smooth steps
- if( cg.demoPlayback || ( cg.snap->ps.pm_flags & PMF_FOLLOW ) ||
- cg_nopredict.integer || cg_synchronousClients.integer )
- break;
-
- // check for stepping up before a previous step is completed
- delta = cg.time - cg.stepTime;
-
- if( delta < steptime )
- oldStep = cg.stepChange * ( steptime - delta ) / steptime;
- else
- oldStep = 0;
-
- // add this amount
- if( event >= EV_STEPDN_4 )
- {
- step = 4 * ( event - EV_STEPDN_4 + 1 );
- cg.stepChange = oldStep - step;
- }
- else
- {
- step = 4 * ( event - EV_STEP_4 + 1 );
- cg.stepChange = oldStep + step;
- }
-
- if( cg.stepChange > MAX_STEP_CHANGE )
- cg.stepChange = MAX_STEP_CHANGE;
- else if( cg.stepChange < -MAX_STEP_CHANGE )
- cg.stepChange = -MAX_STEP_CHANGE;
-
- cg.stepTime = cg.time;
- break;
- }
-
- case EV_JUMP:
- DEBUGNAME( "EV_JUMP" );
- trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*jump1.wav" ) );
-
- if( BG_ClassHasAbility( cg.predictedPlayerState.stats[ STAT_PCLASS ], SCA_WALLJUMPER ) )
- {
- vec3_t surfNormal, refNormal = { 0.0f, 0.0f, 1.0f };
- vec3_t rotAxis;
-
- if( clientNum != cg.predictedPlayerState.clientNum )
- break;
-
- //set surfNormal
- VectorCopy( cg.predictedPlayerState.grapplePoint, surfNormal );
-
- //if we are moving from one surface to another smooth the transition
- if( !VectorCompare( surfNormal, cg.lastNormal ) && surfNormal[ 2 ] != 1.0f )
- {
- CrossProduct( refNormal, surfNormal, rotAxis );
- VectorNormalize( rotAxis );
-
- //add the op
- CG_addSmoothOp( rotAxis, 15.0f, 1.0f );
- }
-
- //copy the current normal to the lastNormal
- VectorCopy( surfNormal, cg.lastNormal );
- }
-
- break;
-
- case EV_LEV1_GRAB:
- DEBUGNAME( "EV_LEV1_GRAB" );
- trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.alienL1Grab );
- break;
-
- case EV_LEV4_CHARGE_PREPARE:
- DEBUGNAME( "EV_LEV4_CHARGE_PREPARE" );
- trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.alienL4ChargePrepare );
- break;
-
- case EV_LEV4_CHARGE_START:
- DEBUGNAME( "EV_LEV4_CHARGE_START" );
- //FIXME: stop cgs.media.alienL4ChargePrepare playing here
- trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.media.alienL4ChargeStart );
- break;
-
- case EV_TAUNT:
- DEBUGNAME( "EV_TAUNT" );
- if( !cg_noTaunt.integer )
- trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, "*taunt.wav" ) );
- break;
-
- case EV_WATER_TOUCH:
- DEBUGNAME( "EV_WATER_TOUCH" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.watrInSound );
- break;
-
- case EV_WATER_LEAVE:
- DEBUGNAME( "EV_WATER_LEAVE" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.watrOutSound );
- break;
-
- case EV_WATER_UNDER:
- DEBUGNAME( "EV_WATER_UNDER" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.watrUnSound );
- break;
-
- case EV_WATER_CLEAR:
- DEBUGNAME( "EV_WATER_CLEAR" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, CG_CustomSound( es->number, "*gasp.wav" ) );
- break;
-
- //
- // weapon events
- //
- case EV_NOAMMO:
- DEBUGNAME( "EV_NOAMMO" );
- {
- }
- break;
-
- case EV_CHANGE_WEAPON:
- DEBUGNAME( "EV_CHANGE_WEAPON" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.selectSound );
- break;
-
- case EV_FIRE_WEAPON:
- DEBUGNAME( "EV_FIRE_WEAPON" );
- CG_FireWeapon( cent, WPM_PRIMARY );
- break;
-
- case EV_FIRE_WEAPON2:
- DEBUGNAME( "EV_FIRE_WEAPON2" );
- CG_FireWeapon( cent, WPM_SECONDARY );
- break;
-
- case EV_FIRE_WEAPON3:
- DEBUGNAME( "EV_FIRE_WEAPON3" );
- CG_FireWeapon( cent, WPM_TERTIARY );
- break;
-
- //=================================================================
-
- //
- // other events
- //
- case EV_PLAYER_TELEPORT_IN:
- DEBUGNAME( "EV_PLAYER_TELEPORT_IN" );
- //deprecated
- break;
-
- case EV_PLAYER_TELEPORT_OUT:
- DEBUGNAME( "EV_PLAYER_TELEPORT_OUT" );
- CG_PlayerDisconnect( position );
- break;
-
- case EV_BUILD_CONSTRUCT:
- DEBUGNAME( "EV_BUILD_CONSTRUCT" );
- //do something useful here
- break;
-
- case EV_BUILD_DESTROY:
- DEBUGNAME( "EV_BUILD_DESTROY" );
- //do something useful here
- break;
-
- case EV_RPTUSE_SOUND:
- DEBUGNAME( "EV_RPTUSE_SOUND" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.repeaterUseSound );
- break;
-
- case EV_GRENADE_BOUNCE:
- DEBUGNAME( "EV_GRENADE_BOUNCE" );
- if( rand( ) & 1 )
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.hardBounceSound1 );
- else
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.hardBounceSound2 );
- break;
-
- //
- // missile impacts
- //
- case EV_MISSILE_HIT:
- DEBUGNAME( "EV_MISSILE_HIT" );
- ByteToDir( es->eventParm, dir );
- CG_MissileHitPlayer( es->weapon, es->generic1, position, dir, es->otherEntityNum );
- break;
-
- case EV_MISSILE_MISS:
- DEBUGNAME( "EV_MISSILE_MISS" );
- ByteToDir( es->eventParm, dir );
- CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_DEFAULT );
- break;
-
- case EV_MISSILE_MISS_METAL:
- DEBUGNAME( "EV_MISSILE_MISS_METAL" );
- ByteToDir( es->eventParm, dir );
- CG_MissileHitWall( es->weapon, es->generic1, 0, position, dir, IMPACTSOUND_METAL );
- break;
-
- case EV_HUMAN_BUILDABLE_EXPLOSION:
- DEBUGNAME( "EV_HUMAN_BUILDABLE_EXPLOSION" );
- ByteToDir( es->eventParm, dir );
- CG_HumanBuildableExplosion( position, dir );
- break;
-
- case EV_ALIEN_BUILDABLE_EXPLOSION:
- DEBUGNAME( "EV_ALIEN_BUILDABLE_EXPLOSION" );
- ByteToDir( es->eventParm, dir );
- CG_AlienBuildableExplosion( position, dir );
- break;
-
- case EV_TESLATRAIL:
- DEBUGNAME( "EV_TESLATRAIL" );
- cent->currentState.weapon = WP_TESLAGEN;
- {
- centity_t *source = &cg_entities[ es->generic1 ];
- centity_t *target = &cg_entities[ es->clientNum ];
- vec3_t sourceOffset = { 0.0f, 0.0f, 28.0f };
-
- if( !CG_IsTrailSystemValid( &source->muzzleTS ) )
- {
- source->muzzleTS = CG_SpawnNewTrailSystem( cgs.media.teslaZapTS );
-
- if( CG_IsTrailSystemValid( &source->muzzleTS ) )
- {
- CG_SetAttachmentCent( &source->muzzleTS->frontAttachment, source );
- CG_SetAttachmentCent( &source->muzzleTS->backAttachment, target );
- CG_AttachToCent( &source->muzzleTS->frontAttachment );
- CG_AttachToCent( &source->muzzleTS->backAttachment );
- CG_SetAttachmentOffset( &source->muzzleTS->frontAttachment, sourceOffset );
-
- source->muzzleTSDeathTime = cg.time + cg_teslaTrailTime.integer;
- }
- }
- }
- break;
-
- case EV_BULLET_HIT_WALL:
- DEBUGNAME( "EV_BULLET_HIT_WALL" );
- ByteToDir( es->eventParm, dir );
- CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qfalse, ENTITYNUM_WORLD );
- break;
-
- case EV_BULLET_HIT_FLESH:
- DEBUGNAME( "EV_BULLET_HIT_FLESH" );
- CG_Bullet( es->pos.trBase, es->otherEntityNum, dir, qtrue, es->eventParm );
- break;
-
- case EV_SHOTGUN:
- DEBUGNAME( "EV_SHOTGUN" );
- CG_ShotgunFire( es );
- break;
-
- case EV_GENERAL_SOUND:
- DEBUGNAME( "EV_GENERAL_SOUND" );
- if( cgs.gameSounds[ es->eventParm ] )
- trap_S_StartSound( NULL, es->number, CHAN_VOICE, cgs.gameSounds[ es->eventParm ] );
- else
- {
- s = CG_ConfigString( CS_SOUNDS + es->eventParm );
- trap_S_StartSound( NULL, es->number, CHAN_VOICE, CG_CustomSound( es->number, s ) );
- }
- break;
-
- case EV_GLOBAL_SOUND: // play from the player's head so it never diminishes
- DEBUGNAME( "EV_GLOBAL_SOUND" );
- if( cgs.gameSounds[ es->eventParm ] )
- trap_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_AUTO, cgs.gameSounds[ es->eventParm ] );
- else
- {
- s = CG_ConfigString( CS_SOUNDS + es->eventParm );
- trap_S_StartSound( NULL, cg.snap->ps.clientNum, CHAN_AUTO, CG_CustomSound( es->number, s ) );
- }
- break;
-
- case EV_PAIN:
- // local player sounds are triggered in CG_CheckLocalSounds,
- // so ignore events on the player
- DEBUGNAME( "EV_PAIN" );
- if( cent->currentState.number != cg.snap->ps.clientNum )
- CG_PainEvent( cent, es->eventParm );
- break;
-
- case EV_DEATH1:
- case EV_DEATH2:
- case EV_DEATH3:
- DEBUGNAME( "EV_DEATHx" );
- trap_S_StartSound( NULL, es->number, CHAN_VOICE,
- CG_CustomSound( es->number, va( "*death%i.wav", event - EV_DEATH1 + 1 ) ) );
- break;
-
- case EV_OBITUARY:
- DEBUGNAME( "EV_OBITUARY" );
- CG_Obituary( es );
- break;
-
- case EV_GIB_PLAYER:
- DEBUGNAME( "EV_GIB_PLAYER" );
- // no gibbing
- break;
-
- case EV_STOPLOOPINGSOUND:
- DEBUGNAME( "EV_STOPLOOPINGSOUND" );
- trap_S_StopLoopingSound( es->number );
- es->loopSound = 0;
- break;
-
- case EV_DEBUG_LINE:
- DEBUGNAME( "EV_DEBUG_LINE" );
- CG_Beam( cent );
- break;
-
- case EV_BUILD_DELAY:
- DEBUGNAME( "EV_BUILD_DELAY" );
- if( clientNum == cg.predictedPlayerState.clientNum )
- {
- trap_S_StartLocalSound( cgs.media.buildableRepairedSound, CHAN_LOCAL_SOUND );
- cg.lastBuildAttempt = cg.time;
- }
- break;
-
- case EV_BUILD_REPAIR:
- DEBUGNAME( "EV_BUILD_REPAIR" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.buildableRepairSound );
- break;
-
- case EV_BUILD_REPAIRED:
- DEBUGNAME( "EV_BUILD_REPAIRED" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.buildableRepairedSound );
- break;
-
- case EV_OVERMIND_ATTACK:
- DEBUGNAME( "EV_OVERMIND_ATTACK" );
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- trap_S_StartLocalSound( cgs.media.alienOvermindAttack, CHAN_ANNOUNCER );
- CG_CenterPrint( "The Overmind is under attack!", 200, GIANTCHAR_WIDTH * 4 );
- }
- break;
-
- case EV_OVERMIND_DYING:
- DEBUGNAME( "EV_OVERMIND_DYING" );
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- trap_S_StartLocalSound( cgs.media.alienOvermindDying, CHAN_ANNOUNCER );
- CG_CenterPrint( "The Overmind is dying!", 200, GIANTCHAR_WIDTH * 4 );
- }
- break;
-
- case EV_DCC_ATTACK:
- DEBUGNAME( "EV_DCC_ATTACK" );
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- //trap_S_StartLocalSound( cgs.media.humanDCCAttack, CHAN_ANNOUNCER );
- CG_CenterPrint( "Our base is under attack!", 200, GIANTCHAR_WIDTH * 4 );
- }
- break;
-
- case EV_OVERMIND_SPAWNS:
- DEBUGNAME( "EV_OVERMIND_SPAWNS" );
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- trap_S_StartLocalSound( cgs.media.alienOvermindSpawns, CHAN_ANNOUNCER );
- CG_CenterPrint( "The Overmind needs spawns!", 200, GIANTCHAR_WIDTH * 4 );
- }
- break;
-
- case EV_ALIEN_EVOLVE:
- DEBUGNAME( "EV_ALIEN_EVOLVE" );
- trap_S_StartSound( NULL, es->number, CHAN_BODY, cgs.media.alienEvolveSound );
- {
- particleSystem_t *ps = CG_SpawnNewParticleSystem( cgs.media.alienEvolvePS );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentCent( &ps->attachment, cent );
- CG_AttachToCent( &ps->attachment );
- }
- }
-
- if( es->number == cg.clientNum )
- {
- CG_ResetPainBlend( );
- cg.spawnTime = cg.time;
- }
- break;
-
- case EV_ALIEN_EVOLVE_FAILED:
- DEBUGNAME( "EV_ALIEN_EVOLVE_FAILED" );
- if( clientNum == cg.predictedPlayerState.clientNum )
- {
- //FIXME: change to "negative" sound
- trap_S_StartLocalSound( cgs.media.buildableRepairedSound, CHAN_LOCAL_SOUND );
- cg.lastEvolveAttempt = cg.time;
- }
- break;
-
- case EV_ALIEN_ACIDTUBE:
- DEBUGNAME( "EV_ALIEN_ACIDTUBE" );
- {
- particleSystem_t *ps = CG_SpawnNewParticleSystem( cgs.media.alienAcidTubePS );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentCent( &ps->attachment, cent );
- ByteToDir( es->eventParm, dir );
- CG_SetParticleSystemNormal( ps, dir );
- CG_AttachToCent( &ps->attachment );
- }
- }
- break;
-
- case EV_MEDKIT_USED:
- DEBUGNAME( "EV_MEDKIT_USED" );
- trap_S_StartSound( NULL, es->number, CHAN_AUTO, cgs.media.medkitUseSound );
- break;
-
- case EV_PLAYER_RESPAWN:
- DEBUGNAME( "EV_PLAYER_RESPAWN" );
- if( es->number == cg.clientNum )
- cg.spawnTime = cg.time;
- break;
-
- default:
- DEBUGNAME( "UNKNOWN" );
- CG_Error( "Unknown event: %i", event );
- break;
- }
-}
-
-
-/*
-==============
-CG_CheckEvents
-
-==============
-*/
-void CG_CheckEvents( centity_t *cent )
-{
- entity_event_t event;
- entity_event_t oldEvent = EV_NONE;
-
- // check for event-only entities
- if( cent->currentState.eType > ET_EVENTS )
- {
- event = cent->currentState.eType - ET_EVENTS;
-
- if( cent->previousEvent )
- return; // already fired
-
- cent->previousEvent = 1;
-
- cent->currentState.event = cent->currentState.eType - ET_EVENTS;
-
- // Move the pointer to the entity that the
- // event was originally attached to
- if( cent->currentState.eFlags & EF_PLAYER_EVENT )
- {
- cent = &cg_entities[ cent->currentState.otherEntityNum ];
- oldEvent = cent->currentState.event;
- cent->currentState.event = event;
- }
- }
- else
- {
- // check for events riding with another entity
- if( cent->currentState.event == cent->previousEvent )
- return;
-
- cent->previousEvent = cent->currentState.event;
- if( ( cent->currentState.event & ~EV_EVENT_BITS ) == 0 )
- return;
- }
-
- // calculate the position at exactly the frame time
- BG_EvaluateTrajectory( ¢->currentState.pos, cg.snap->serverTime, cent->lerpOrigin );
- CG_SetEntitySoundPosition( cent );
-
- CG_EntityEvent( cent, cent->lerpOrigin );
-
- // If this was a reattached spilled event, restore the original event
- if( oldEvent != EV_NONE )
- cent->currentState.event = oldEvent;
-}
-
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
deleted file mode 100644
index 05cbcbd..0000000
--- a/src/cgame/cg_local.h
+++ /dev/null
@@ -1,2071 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-
-#include "../qcommon/q_shared.h"
-#include "../renderer/tr_types.h"
-#include "../game/bg_public.h"
-#include "cg_public.h"
-#include "../ui/ui_shared.h"
-
-// The entire cgame module is unloaded and reloaded on each level change,
-// so there is NO persistant data between levels on the client side.
-// If you absolutely need something stored, it can either be kept
-// by the server in the server stored userinfos, or stashed in a cvar.
-
-#define CG_FONT_THRESHOLD 0.1
-
-#define POWERUP_BLINKS 5
-
-#define POWERUP_BLINK_TIME 1000
-#define FADE_TIME 200
-#define PULSE_TIME 200
-#define DAMAGE_DEFLECT_TIME 100
-#define DAMAGE_RETURN_TIME 400
-#define DAMAGE_TIME 500
-#define LAND_DEFLECT_TIME 150
-#define LAND_RETURN_TIME 300
-#define DUCK_TIME 100
-#define PAIN_TWITCH_TIME 200
-#define WEAPON_SELECT_TIME 1400
-#define ITEM_SCALEUP_TIME 1000
-#define ZOOM_TIME 150
-#define ITEM_BLOB_TIME 200
-#define MUZZLE_FLASH_TIME 20
-#define SINK_TIME 1000 // time for fragments to sink into ground before going away
-#define ATTACKER_HEAD_TIME 10000
-#define REWARD_TIME 3000
-
-#define PULSE_SCALE 1.5 // amount to scale up the icons when activating
-
-#define MAX_STEP_CHANGE 32
-
-#define MAX_VERTS_ON_POLY 10
-#define MAX_MARK_POLYS 256
-
-#define STAT_MINUS 10 // num frame for '-' stats digit
-
-#define ICON_SIZE 48
-#define CHAR_WIDTH 32
-#define CHAR_HEIGHT 48
-#define TEXT_ICON_SPACE 4
-
-// very large characters
-#define GIANT_WIDTH 32
-#define GIANT_HEIGHT 48
-
-#define NUM_CROSSHAIRS 10
-
-#define TEAM_OVERLAY_MAXNAME_WIDTH 12
-#define TEAM_OVERLAY_MAXLOCATION_WIDTH 16
-
-#define DEFAULT_MODEL "sarge"
-#define DEFAULT_TEAM_MODEL "sarge"
-#define DEFAULT_TEAM_HEAD "sarge"
-
-typedef enum
-{
- FOOTSTEP_NORMAL,
- FOOTSTEP_FLESH,
- FOOTSTEP_METAL,
- FOOTSTEP_SPLASH,
- FOOTSTEP_CUSTOM,
- FOOTSTEP_NONE,
-
- FOOTSTEP_TOTAL
-} footstep_t;
-
-typedef enum
-{
- IMPACTSOUND_DEFAULT,
- IMPACTSOUND_METAL,
- IMPACTSOUND_FLESH
-} impactSound_t;
-
-typedef enum
-{
- JPS_OFF,
- JPS_DESCENDING,
- JPS_HOVERING,
- JPS_ASCENDING
-} jetPackState_t;
-
-//======================================================================
-
-// when changing animation, set animationTime to frameTime + lerping time
-// The current lerp will finish out, then it will lerp to the new animation
-typedef struct
-{
- int oldFrame;
- int oldFrameTime; // time when ->oldFrame was exactly on
-
- int frame;
- int frameTime; // time when ->frame will be exactly on
-
- float backlerp;
-
- float yawAngle;
- qboolean yawing;
- float pitchAngle;
- qboolean pitching;
-
- int animationNumber; // may include ANIM_TOGGLEBIT
- animation_t *animation;
- int animationTime; // time when the first frame of the animation will be exact
-} lerpFrame_t;
-
-//======================================================================
-
-//attachment system
-typedef enum
-{
- AT_STATIC,
- AT_TAG,
- AT_CENT,
- AT_PARTICLE
-} attachmentType_t;
-
-//forward declaration for particle_t
-struct particle_s;
-
-typedef struct attachment_s
-{
- attachmentType_t type;
- qboolean attached;
-
- qboolean staticValid;
- qboolean tagValid;
- qboolean centValid;
- qboolean particleValid;
-
- qboolean hasOffset;
- vec3_t offset;
-
- vec3_t lastValidAttachmentPoint;
-
- //AT_STATIC
- vec3_t origin;
-
- //AT_TAG
- refEntity_t re; //FIXME: should be pointers?
- refEntity_t parent; //
- qhandle_t model;
- char tagName[ MAX_STRING_CHARS ];
-
- //AT_CENT
- int centNum;
-
- //AT_PARTICLE
- struct particle_s *particle;
-} attachment_t;
-
-//======================================================================
-
-//particle system stuff
-#define MAX_PARTICLE_FILES 128
-
-#define MAX_PS_SHADER_FRAMES 32
-#define MAX_PS_MODELS 8
-#define MAX_EJECTORS_PER_SYSTEM 4
-#define MAX_PARTICLES_PER_EJECTOR 4
-
-#define MAX_BASEPARTICLE_SYSTEMS 192
-#define MAX_BASEPARTICLE_EJECTORS MAX_BASEPARTICLE_SYSTEMS*MAX_EJECTORS_PER_SYSTEM
-#define MAX_BASEPARTICLES MAX_BASEPARTICLE_EJECTORS*MAX_PARTICLES_PER_EJECTOR
-
-#define MAX_PARTICLE_SYSTEMS 48
-#define MAX_PARTICLE_EJECTORS MAX_PARTICLE_SYSTEMS*MAX_EJECTORS_PER_SYSTEM
-#define MAX_PARTICLES MAX_PARTICLE_EJECTORS*5
-
-#define PARTICLES_INFINITE -1
-#define PARTICLES_SAME_AS_INITIAL -2
-
-//COMPILE TIME STRUCTURES
-typedef enum
-{
- PMT_STATIC,
- PMT_STATIC_TRANSFORM,
- PMT_TAG,
- PMT_CENT_ANGLES,
- PMT_NORMAL
-} pMoveType_t;
-
-typedef enum
-{
- PMD_LINEAR,
- PMD_POINT
-} pDirType_t;
-
-typedef struct pMoveValues_u
-{
- pDirType_t dirType;
-
- //PMD_LINEAR
- vec3_t dir;
- float dirRandAngle;
-
- //PMD_POINT
- vec3_t point;
- float pointRandAngle;
-
- float mag;
- float magRandFrac;
-
- float parentVelFrac;
- float parentVelFracRandFrac;
-} pMoveValues_t;
-
-typedef struct pLerpValues_s
-{
- int delay;
- float delayRandFrac;
-
- float initial;
- float initialRandFrac;
-
- float final;
- float finalRandFrac;
-
- float randFrac;
-} pLerpValues_t;
-
-//particle template
-typedef struct baseParticle_s
-{
- vec3_t displacement;
- float randDisplacement;
- float normalDisplacement;
-
- pMoveType_t velMoveType;
- pMoveValues_t velMoveValues;
-
- pMoveType_t accMoveType;
- pMoveValues_t accMoveValues;
-
- int lifeTime;
- float lifeTimeRandFrac;
-
- float bounceFrac;
- float bounceFracRandFrac;
- qboolean bounceCull;
-
- char bounceMarkName[ MAX_QPATH ];
- qhandle_t bounceMark;
- float bounceMarkRadius;
- float bounceMarkRadiusRandFrac;
- float bounceMarkCount;
- float bounceMarkCountRandFrac;
-
- char bounceSoundName[ MAX_QPATH ];
- qhandle_t bounceSound;
- float bounceSoundCount;
- float bounceSoundCountRandFrac;
-
- pLerpValues_t radius;
- pLerpValues_t alpha;
- pLerpValues_t rotation;
-
- qboolean dynamicLight;
- pLerpValues_t dLightRadius;
- byte dLightColor[ 3 ];
-
- int colorDelay;
- float colorDelayRandFrac;
- byte initialColor[ 3 ];
- byte finalColor[ 3 ];
-
- char childSystemName[ MAX_QPATH ];
- qhandle_t childSystemHandle;
-
- char onDeathSystemName[ MAX_QPATH ];
- qhandle_t onDeathSystemHandle;
-
- char childTrailSystemName[ MAX_QPATH ];
- qhandle_t childTrailSystemHandle;
-
- //particle invariant stuff
- char shaderNames[ MAX_PS_SHADER_FRAMES ][ MAX_QPATH ];
- qhandle_t shaders[ MAX_PS_SHADER_FRAMES ];
- int numFrames;
- float framerate;
-
- char modelNames[ MAX_PS_MODELS ][ MAX_QPATH ];
- qhandle_t models[ MAX_PS_MODELS ];
- int numModels;
- animation_t modelAnimation;
-
- qboolean overdrawProtection;
- qboolean realLight;
- qboolean cullOnStartSolid;
-} baseParticle_t;
-
-
-//ejector template
-typedef struct baseParticleEjector_s
-{
- baseParticle_t *particles[ MAX_PARTICLES_PER_EJECTOR ];
- int numParticles;
-
- pLerpValues_t eject; //zero period indicates creation of all particles at once
-
- int totalParticles; //can be infinite
- float totalParticlesRandFrac;
-} baseParticleEjector_t;
-
-
-//particle system template
-typedef struct baseParticleSystem_s
-{
- char name[ MAX_QPATH ];
- baseParticleEjector_t *ejectors[ MAX_EJECTORS_PER_SYSTEM ];
- int numEjectors;
-
- qboolean thirdPersonOnly;
- qboolean registered; //whether or not the assets for this particle have been loaded
-} baseParticleSystem_t;
-
-
-//RUN TIME STRUCTURES
-typedef struct particleSystem_s
-{
- baseParticleSystem_t *class;
-
- attachment_t attachment;
-
- qboolean valid;
- qboolean lazyRemove; //mark this system for later removal
-
- //for PMT_NORMAL
- qboolean normalValid;
- vec3_t normal;
-} particleSystem_t;
-
-
-typedef struct particleEjector_s
-{
- baseParticleEjector_t *class;
- particleSystem_t *parent;
-
- pLerpValues_t ejectPeriod;
-
- int count;
- int totalParticles;
-
- int nextEjectionTime;
-
- qboolean valid;
-} particleEjector_t;
-
-
-//used for actual particle evaluation
-typedef struct particle_s
-{
- baseParticle_t *class;
- particleEjector_t *parent;
-
- int birthTime;
- int lifeTime;
-
- float bounceMarkRadius;
- int bounceMarkCount;
- int bounceSoundCount;
- qboolean atRest;
-
- vec3_t origin;
- vec3_t velocity;
-
- pMoveType_t accMoveType;
- pMoveValues_t accMoveValues;
-
- int lastEvalTime;
-
- int nextChildTime;
-
- pLerpValues_t radius;
- pLerpValues_t alpha;
- pLerpValues_t rotation;
-
- pLerpValues_t dLightRadius;
-
- int colorDelay;
-
- qhandle_t model;
- lerpFrame_t lf;
- vec3_t lastAxis[ 3 ];
-
- qboolean valid;
- int frameWhenInvalidated;
-
- int sortKey;
-} particle_t;
-
-//======================================================================
-
-//trail system stuff
-#define MAX_TRAIL_FILES 128
-
-#define MAX_BEAMS_PER_SYSTEM 4
-
-#define MAX_BASETRAIL_SYSTEMS 64
-#define MAX_BASETRAIL_BEAMS MAX_BASETRAIL_SYSTEMS*MAX_BEAMS_PER_SYSTEM
-
-#define MAX_TRAIL_SYSTEMS 32
-#define MAX_TRAIL_BEAMS MAX_TRAIL_SYSTEMS*MAX_BEAMS_PER_SYSTEM
-#define MAX_TRAIL_BEAM_NODES 128
-
-#define MAX_TRAIL_BEAM_JITTERS 4
-
-typedef enum
-{
- TBTT_STRETCH,
- TBTT_REPEAT
-} trailBeamTextureType_t;
-
-typedef struct baseTrailJitter_s
-{
- float magnitude;
- int period;
-} baseTrailJitter_t;
-
-//beam template
-typedef struct baseTrailBeam_s
-{
- int numSegments;
- float frontWidth;
- float backWidth;
- float frontAlpha;
- float backAlpha;
- byte frontColor[ 3 ];
- byte backColor[ 3 ];
-
- // the time it takes for a segment to vanish (single attached only)
- int segmentTime;
-
- // the time it takes for a beam to fade out (double attached only)
- int fadeOutTime;
-
- char shaderName[ MAX_QPATH ];
- qhandle_t shader;
-
- trailBeamTextureType_t textureType;
-
- //TBTT_STRETCH
- float frontTextureCoord;
- float backTextureCoord;
-
- //TBTT_REPEAT
- float repeatLength;
- qboolean clampToBack;
-
- qboolean realLight;
-
- int numJitters;
- baseTrailJitter_t jitters[ MAX_TRAIL_BEAM_JITTERS ];
- qboolean jitterAttachments;
-} baseTrailBeam_t;
-
-
-//trail system template
-typedef struct baseTrailSystem_s
-{
- char name[ MAX_QPATH ];
- baseTrailBeam_t *beams[ MAX_BEAMS_PER_SYSTEM ];
- int numBeams;
-
- qboolean thirdPersonOnly;
- qboolean registered; //whether or not the assets for this trail have been loaded
-} baseTrailSystem_t;
-
-typedef struct trailSystem_s
-{
- baseTrailSystem_t *class;
-
- attachment_t frontAttachment;
- attachment_t backAttachment;
-
- int destroyTime;
- qboolean valid;
-} trailSystem_t;
-
-typedef struct trailBeamNode_s
-{
- vec3_t refPosition;
- vec3_t position;
-
- int timeLeft;
-
- float textureCoord;
- float halfWidth;
- byte alpha;
- byte color[ 3 ];
-
- vec2_t jitters[ MAX_TRAIL_BEAM_JITTERS ];
-
- struct trailBeamNode_s *prev;
- struct trailBeamNode_s *next;
-
- qboolean used;
-} trailBeamNode_t;
-
-typedef struct trailBeam_s
-{
- baseTrailBeam_t *class;
- trailSystem_t *parent;
-
- trailBeamNode_t nodePool[ MAX_TRAIL_BEAM_NODES ];
- trailBeamNode_t *nodes;
-
- int lastEvalTime;
-
- qboolean valid;
-
- int nextJitterTimes[ MAX_TRAIL_BEAM_JITTERS ];
-} trailBeam_t;
-
-//======================================================================
-
-// player entities need to track more information
-// than any other type of entity.
-
-// note that not every player entity is a client entity,
-// because corpses after respawn are outside the normal
-// client numbering range
-
-//TA: smoothing of view and model for WW transitions
-#define MAXSMOOTHS 32
-
-typedef struct
-{
- float time;
- float timeMod;
-
- vec3_t rotAxis;
- float rotAngle;
-} smooth_t;
-
-
-typedef struct
-{
- lerpFrame_t legs, torso, flag, nonseg;
- int painTime;
- int painDirection; // flip from 0 to 1
-
- // machinegun spinning
- float barrelAngle;
- int barrelTime;
- qboolean barrelSpinning;
-
- vec3_t lastNormal;
- vec3_t lastAxis[ 3 ];
- smooth_t sList[ MAXSMOOTHS ];
-} playerEntity_t;
-
-typedef struct lightFlareStatus_s
-{
- float lastRadius; //caching of likely flare radius
- float lastRatio; //caching of likely flare ratio
- int lastTime; //last time flare was visible/occluded
- qboolean status; //flare is visble?
-} lightFlareStatus_t;
-
-typedef struct buildableStatus_s
-{
- int lastTime; // Last time status was visible
- qboolean visible; // Status is visble?
-} buildableStatus_t;
-
-//=================================================
-
-// centity_t have a direct corespondence with gentity_t in the game, but
-// only the entityState_t is directly communicated to the cgame
-typedef struct centity_s
-{
- entityState_t currentState; // from cg.frame
- entityState_t nextState; // from cg.nextFrame, if available
- qboolean interpolate; // true if next is valid to interpolate to
- qboolean currentValid; // true if cg.frame holds this entity
-
- int muzzleFlashTime; // move to playerEntity?
- int muzzleFlashTime2; // move to playerEntity?
- int muzzleFlashTime3; // move to playerEntity?
- int previousEvent;
- int teleportFlag;
-
- int trailTime; // so missile trails can handle dropped initial packets
- int dustTrailTime;
- int miscTime;
- int snapShotTime; // last time this entity was found in a snapshot
-
- playerEntity_t pe;
-
- int errorTime; // decay the error from this time
- vec3_t errorOrigin;
- vec3_t errorAngles;
-
- qboolean extrapolated; // false if origin / angles is an interpolation
- vec3_t rawOrigin;
- vec3_t rawAngles;
-
- vec3_t beamEnd;
-
- // exact interpolated position of entity on this frame
- vec3_t lerpOrigin;
- vec3_t lerpAngles;
-
- lerpFrame_t lerpFrame;
-
- //TA:
- buildableAnimNumber_t buildableAnim; //persistant anim number
- buildableAnimNumber_t oldBuildableAnim; //to detect when new anims are set
- particleSystem_t *buildablePS;
- buildableStatus_t buildableStatus;
- float lastBuildableHealthScale;
- int lastBuildableDamageSoundTime;
-
- lightFlareStatus_t lfs;
-
- qboolean doorState;
-
- qboolean animInit;
- qboolean animPlaying;
- qboolean animLastState;
-
- particleSystem_t *muzzlePS;
- qboolean muzzlePsTrigger;
-
- particleSystem_t *jetPackPS;
- jetPackState_t jetPackState;
-
- particleSystem_t *entityPS;
- qboolean entityPSMissing;
-
- trailSystem_t *level2ZapTS[ 3 ];
-
- trailSystem_t *muzzleTS; //used for the tesla and reactor
- int muzzleTSDeathTime;
-
- qboolean valid;
- qboolean oldValid;
-} centity_t;
-
-
-//======================================================================
-
-typedef struct markPoly_s
-{
- struct markPoly_s *prevMark, *nextMark;
- int time;
- qhandle_t markShader;
- qboolean alphaFade; // fade alpha instead of rgb
- float color[ 4 ];
- poly_t poly;
- polyVert_t verts[ MAX_VERTS_ON_POLY ];
-} markPoly_t;
-
-//======================================================================
-
-
-typedef struct
-{
- int client;
- int score;
- int ping;
- int time;
- int team;
- weapon_t weapon;
- upgrade_t upgrade;
-} score_t;
-
-// each client has an associated clientInfo_t
-// that contains media references necessary to present the
-// client model and other color coded effects
-// this is regenerated each time a client's configstring changes,
-// usually as a result of a userinfo (name, model, etc) change
-#define MAX_CUSTOM_SOUNDS 32
-typedef struct
-{
- qboolean infoValid;
-
- char name[ MAX_QPATH ];
- pTeam_t team;
-
- int botSkill; // 0 = not bot, 1-5 = bot
-
- vec3_t color1;
- vec3_t color2;
-
- int score; // updated by score servercmds
- int location; // location index for team mode
- int health; // you only get this info about your teammates
- int armor;
- int curWeapon;
-
- int handicap;
- int wins, losses; // in tourney mode
-
- int teamTask; // task in teamplay (offence/defence)
- qboolean teamLeader; // true when this is a team leader
-
- int powerups; // so can display quad/flag status
-
- int medkitUsageTime;
- int invulnerabilityStartTime;
- int invulnerabilityStopTime;
-
- int breathPuffTime;
-
- // when clientinfo is changed, the loading of models/skins/sounds
- // can be deferred until you are dead, to prevent hitches in
- // gameplay
- char modelName[ MAX_QPATH ];
- char skinName[ MAX_QPATH ];
- char headModelName[ MAX_QPATH ];
- char headSkinName[ MAX_QPATH ];
-
- qboolean newAnims; // true if using the new mission pack animations
- qboolean fixedlegs; // true if legs yaw is always the same as torso yaw
- qboolean fixedtorso; // true if torso never changes yaw
- qboolean nonsegmented; // true if model is Q2 style nonsegmented
-
- vec3_t headOffset; // move head in icon views
- footstep_t footsteps;
- gender_t gender; // from model
-
- qhandle_t legsModel;
- qhandle_t legsSkin;
-
- qhandle_t torsoModel;
- qhandle_t torsoSkin;
-
- qhandle_t headModel;
- qhandle_t headSkin;
-
- qhandle_t nonSegModel; //non-segmented model system
- qhandle_t nonSegSkin; //non-segmented model system
-
- qhandle_t modelIcon;
-
- animation_t animations[ MAX_PLAYER_TOTALANIMATIONS ];
-
- sfxHandle_t sounds[ MAX_CUSTOM_SOUNDS ];
-
- sfxHandle_t customFootsteps[ 4 ];
- sfxHandle_t customMetalFootsteps[ 4 ];
-} clientInfo_t;
-
-
-typedef struct weaponInfoMode_s
-{
- float flashDlight;
- vec3_t flashDlightColor;
- sfxHandle_t flashSound[ 4 ]; // fast firing weapons randomly choose
- qboolean continuousFlash;
-
- qhandle_t missileModel;
- sfxHandle_t missileSound;
- float missileDlight;
- vec3_t missileDlightColor;
- int missileRenderfx;
- qboolean usesSpriteMissle;
- qhandle_t missileSprite;
- int missileSpriteSize;
- qhandle_t missileParticleSystem;
- qhandle_t missileTrailSystem;
- qboolean missileRotates;
- qboolean missileAnimates;
- int missileAnimStartFrame;
- int missileAnimNumFrames;
- int missileAnimFrameRate;
- int missileAnimLooping;
-
- sfxHandle_t firingSound;
- qboolean loopFireSound;
-
- qhandle_t muzzleParticleSystem;
-
- qboolean alwaysImpact;
- qhandle_t impactParticleSystem;
- qhandle_t impactMark;
- qhandle_t impactMarkSize;
- sfxHandle_t impactSound[ 4 ]; //random impact sound
- sfxHandle_t impactFleshSound[ 4 ]; //random impact sound
-} weaponInfoMode_t;
-
-// each WP_* weapon enum has an associated weaponInfo_t
-// that contains media references necessary to present the
-// weapon and its effects
-typedef struct weaponInfo_s
-{
- qboolean registered;
- char *humanName;
-
- qhandle_t handsModel; // the hands don't actually draw, they just position the weapon
- qhandle_t weaponModel;
- qhandle_t barrelModel;
- qhandle_t flashModel;
-
- vec3_t weaponMidpoint; // so it will rotate centered instead of by tag
-
- qhandle_t weaponIcon;
- qhandle_t ammoIcon;
-
- qhandle_t crossHair;
- int crossHairSize;
-
- sfxHandle_t readySound;
-
- qboolean disableIn3rdPerson;
-
- weaponInfoMode_t wim[ WPM_NUM_WEAPONMODES ];
-} weaponInfo_t;
-
-typedef struct upgradeInfo_s
-{
- qboolean registered;
- char *humanName;
-
- qhandle_t upgradeIcon;
-} upgradeInfo_t;
-
-typedef struct
-{
- qboolean looped;
- qboolean enabled;
-
- sfxHandle_t sound;
-} sound_t;
-
-typedef struct
-{
- qhandle_t models[ MAX_BUILDABLE_MODELS ];
- animation_t animations[ MAX_BUILDABLE_ANIMATIONS ];
-
- //same number of sounds as animations
- sound_t sounds[ MAX_BUILDABLE_ANIMATIONS ];
-} buildableInfo_t;
-
-#define MAX_REWARDSTACK 10
-#define MAX_SOUNDBUFFER 20
-
-//======================================================================
-
-//TA:
-typedef struct
-{
- vec3_t alienBuildablePos[ MAX_GENTITIES ];
- int alienBuildableTimes[ MAX_GENTITIES ];
- int numAlienBuildables;
-
- vec3_t humanBuildablePos[ MAX_GENTITIES ];
- int numHumanBuildables;
-
- vec3_t alienClientPos[ MAX_CLIENTS ];
- int numAlienClients;
-
- vec3_t humanClientPos[ MAX_CLIENTS ];
- int numHumanClients;
-
- int lastUpdateTime;
- vec3_t origin;
- vec3_t vangles;
-} entityPos_t;
-
-typedef struct
-{
- int time;
- int length;
-} consoleLine_t;
-
-#define MAX_CONSOLE_TEXT 8192
-#define MAX_CONSOLE_LINES 32
-
-// all cg.stepTime, cg.duckTime, cg.landTime, etc are set to cg.time when the action
-// occurs, and they will have visible effects for #define STEP_TIME or whatever msec after
-
-#define MAX_PREDICTED_EVENTS 16
-
-#define NUM_SAVED_STATES ( CMD_BACKUP + 2 )
-
-typedef struct
-{
- int clientFrame; // incremented each frame
-
- int clientNum;
-
- qboolean demoPlayback;
- qboolean levelShot; // taking a level menu screenshot
- int deferredPlayerLoading;
- qboolean loading; // don't defer players at initial startup
- qboolean intermissionStarted; // don't play voice rewards, because game will end shortly
-
- // there are only one or two snapshot_t that are relevent at a time
- int latestSnapshotNum; // the number of snapshots the client system has received
- int latestSnapshotTime; // the time from latestSnapshotNum, so we don't need to read the snapshot yet
-
- snapshot_t *snap; // cg.snap->serverTime <= cg.time
- snapshot_t *nextSnap; // cg.nextSnap->serverTime > cg.time, or NULL
- snapshot_t activeSnapshots[ 2 ];
-
- float frameInterpolation; // (float)( cg.time - cg.frame->serverTime ) /
- // (cg.nextFrame->serverTime - cg.frame->serverTime)
-
- qboolean thisFrameTeleport;
- qboolean nextFrameTeleport;
-
- int frametime; // cg.time - cg.oldTime
-
- int time; // this is the time value that the client
- // is rendering at.
- int oldTime; // time at last frame, used for missile trails and prediction checking
-
- int physicsTime; // either cg.snap->time or cg.nextSnap->time
-
- int timelimitWarnings; // 5 min, 1 min, overtime
- int fraglimitWarnings;
-
- qboolean mapRestart; // set on a map restart to set back the weapon
-
- qboolean renderingThirdPerson; // during deaths, chasecams, etc
-
- // prediction state
- qboolean hyperspace; // true if prediction has hit a trigger_teleport
- playerState_t predictedPlayerState;
- pmoveExt_t pmext;
- centity_t predictedPlayerEntity;
- qboolean validPPS; // clear until the first call to CG_PredictPlayerState
- int predictedErrorTime;
- vec3_t predictedError;
-
- int eventSequence;
- int predictableEvents[MAX_PREDICTED_EVENTS];
-
- float stepChange; // for stair up smoothing
- int stepTime;
-
- float duckChange; // for duck viewheight smoothing
- int duckTime;
-
- float landChange; // for landing hard
- int landTime;
-
- // input state sent to server
- int weaponSelect;
-
- // auto rotating items
- vec3_t autoAngles;
- vec3_t autoAxis[ 3 ];
- vec3_t autoAnglesFast;
- vec3_t autoAxisFast[ 3 ];
-
- // view rendering
- refdef_t refdef;
- vec3_t refdefViewAngles; // will be converted to refdef.viewaxis
-
- // zoom key
- qboolean zoomed;
- int zoomTime;
- float zoomSensitivity;
-
- // information screen text during loading
- char infoScreenText[ MAX_STRING_CHARS ];
-
- // scoreboard
- int scoresRequestTime;
- int numScores;
- int selectedScore;
- int teamScores[ 2 ];
- score_t scores[MAX_CLIENTS];
- qboolean showScores;
- qboolean scoreBoardShowing;
- int scoreFadeTime;
- char killerName[ MAX_NAME_LENGTH ];
- char spectatorList[ MAX_STRING_CHARS ]; // list of names
- int spectatorLen; // length of list
- float spectatorWidth; // width in device units
- int spectatorTime; // next time to offset
- int spectatorPaintX; // current paint x
- int spectatorPaintX2; // current paint x
- int spectatorOffset; // current offset from start
- int spectatorPaintLen; // current offset from start
-
- // centerprinting
- int centerPrintTime;
- int centerPrintCharWidth;
- int centerPrintY;
- char centerPrint[ 1024 ];
- int centerPrintLines;
-
- // low ammo warning state
- int lowAmmoWarning; // 1 = low, 2 = empty
-
- // kill timers for carnage reward
- int lastKillTime;
-
- // crosshair client ID
- int crosshairClientNum;
- int crosshairClientTime;
-
- // powerup active flashing
- int powerupActive;
- int powerupTime;
-
- // attacking player
- int attackerTime;
- int voiceTime;
-
- // reward medals
- int rewardStack;
- int rewardTime;
- int rewardCount[ MAX_REWARDSTACK ];
- qhandle_t rewardShader[ MAX_REWARDSTACK ];
- qhandle_t rewardSound[ MAX_REWARDSTACK ];
-
- // sound buffer mainly for announcer sounds
- int soundBufferIn;
- int soundBufferOut;
- int soundTime;
- qhandle_t soundBuffer[ MAX_SOUNDBUFFER ];
-
- // for voice chat buffer
- int voiceChatTime;
- int voiceChatBufferIn;
- int voiceChatBufferOut;
-
- // warmup countdown
- int warmup;
- int warmupCount;
-
- //==========================
-
- int itemPickup;
- int itemPickupTime;
- int itemPickupBlendTime; // the pulse around the crosshair is timed seperately
-
- int weaponSelectTime;
- int weaponAnimation;
- int weaponAnimationTime;
-
- // blend blobs
- float damageTime;
- float damageX, damageY, damageValue;
-
- // status bar head
- float headYaw;
- float headEndPitch;
- float headEndYaw;
- int headEndTime;
- float headStartPitch;
- float headStartYaw;
- int headStartTime;
-
- // view movement
- float v_dmg_time;
- float v_dmg_pitch;
- float v_dmg_roll;
-
- vec3_t kick_angles; // weapon kicks
- vec3_t kick_origin;
-
- // temp working variables for player view
- float bobfracsin;
- int bobcycle;
- float xyspeed;
- int nextOrbitTime;
-
- // development tool
- refEntity_t testModelEntity;
- refEntity_t testModelBarrelEntity;
- char testModelName[MAX_QPATH];
- char testModelBarrelName[MAX_QPATH];
- qboolean testGun;
-
- int spawnTime; //TA: fovwarp
- int weapon1Time; //TA: time when BUTTON_ATTACK went t->f f->t
- int weapon2Time; //TA: time when BUTTON_ATTACK2 went t->f f->t
- int weapon3Time; //TA: time when BUTTON_USE_HOLDABLE went t->f f->t
- qboolean weapon1Firing;
- qboolean weapon2Firing;
- qboolean weapon3Firing;
-
- int poisonedTime;
-
- vec3_t lastNormal; //TA: view smoothage
- vec3_t lastVangles; //TA: view smoothage
- smooth_t sList[ MAXSMOOTHS ]; //TA: WW smoothing
-
- int forwardMoveTime; //TA: for struggling
- int rightMoveTime;
- int upMoveTime;
-
- float charModelFraction; //TA: loading percentages
- float mediaFraction;
- float buildablesFraction;
-
- int lastBuildAttempt;
- int lastEvolveAttempt;
-
- char consoleText[ MAX_CONSOLE_TEXT ];
- consoleLine_t consoleLines[ MAX_CONSOLE_LINES ];
- int numConsoleLines;
-
- particleSystem_t *poisonCloudPS;
-
- float painBlendValue;
- float painBlendTarget;
- int lastHealth;
-
- int lastPredictedCommand;
- int lastServerTime;
- playerState_t savedPmoveStates[ NUM_SAVED_STATES ];
- int stateHead, stateTail;
- int ping;
-} cg_t;
-
-
-// all of the model, shader, and sound references that are
-// loaded at gamestate time are stored in cgMedia_t
-// Other media that can be tied to clients, weapons, or items are
-// stored in the clientInfo_t, itemInfo_t, weaponInfo_t, and powerupInfo_t
-typedef struct
-{
- qhandle_t charsetShader;
- qhandle_t whiteShader;
- qhandle_t outlineShader;
-
- qhandle_t level2ZapTS;
-
- qhandle_t balloonShader;
- qhandle_t connectionShader;
-
- qhandle_t viewBloodShader;
- qhandle_t tracerShader;
- qhandle_t crosshairShader[ WP_NUM_WEAPONS ];
- qhandle_t backTileShader;
-
- qhandle_t creepShader;
-
- qhandle_t scannerShader;
- qhandle_t scannerBlipShader;
- qhandle_t scannerLineShader;
-
-
- qhandle_t numberShaders[ 11 ];
-
- qhandle_t shadowMarkShader;
- qhandle_t wakeMarkShader;
-
- // buildable shaders
- qhandle_t greenBuildShader;
- qhandle_t redBuildShader;
- qhandle_t humanSpawningShader;
-
- // disconnect
- qhandle_t disconnectPS;
- qhandle_t disconnectSound;
-
- // sounds
- sfxHandle_t tracerSound;
- sfxHandle_t selectSound;
- sfxHandle_t footsteps[ FOOTSTEP_TOTAL ][ 4 ];
- sfxHandle_t talkSound;
- sfxHandle_t alienTalkSound;
- sfxHandle_t humanTalkSound;
- sfxHandle_t landSound;
- sfxHandle_t fallSound;
-
- sfxHandle_t hardBounceSound1;
- sfxHandle_t hardBounceSound2;
-
- sfxHandle_t voteNow;
- sfxHandle_t votePassed;
- sfxHandle_t voteFailed;
-
- sfxHandle_t watrInSound;
- sfxHandle_t watrOutSound;
- sfxHandle_t watrUnSound;
-
- sfxHandle_t jetpackDescendSound;
- sfxHandle_t jetpackIdleSound;
- sfxHandle_t jetpackAscendSound;
-
- qhandle_t jetPackDescendPS;
- qhandle_t jetPackHoverPS;
- qhandle_t jetPackAscendPS;
-
- sfxHandle_t medkitUseSound;
-
- sfxHandle_t alienStageTransition;
- sfxHandle_t humanStageTransition;
-
- sfxHandle_t alienOvermindAttack;
- sfxHandle_t alienOvermindDying;
- sfxHandle_t alienOvermindSpawns;
-
- sfxHandle_t alienBuildableExplosion;
- sfxHandle_t alienBuildableDamage;
- sfxHandle_t alienBuildablePrebuild;
- sfxHandle_t humanBuildableExplosion;
- sfxHandle_t humanBuildablePrebuild;
- sfxHandle_t humanBuildableDamage[ 4 ];
-
- sfxHandle_t alienL1Grab;
- sfxHandle_t alienL4ChargePrepare;
- sfxHandle_t alienL4ChargeStart;
-
- qhandle_t cursor;
- qhandle_t selectCursor;
- qhandle_t sizeCursor;
-
- //light armour
- qhandle_t larmourHeadSkin;
- qhandle_t larmourLegsSkin;
- qhandle_t larmourTorsoSkin;
-
- qhandle_t jetpackModel;
- qhandle_t jetpackFlashModel;
- qhandle_t battpackModel;
-
- sfxHandle_t repeaterUseSound;
-
- sfxHandle_t buildableRepairSound;
- sfxHandle_t buildableRepairedSound;
-
- qhandle_t poisonCloudPS;
- qhandle_t alienEvolvePS;
- qhandle_t alienAcidTubePS;
-
- sfxHandle_t alienEvolveSound;
-
- qhandle_t humanBuildableDamagedPS;
- qhandle_t humanBuildableDestroyedPS;
- qhandle_t alienBuildableDamagedPS;
- qhandle_t alienBuildableDestroyedPS;
-
- qhandle_t alienBleedPS;
- qhandle_t humanBleedPS;
-
- qhandle_t teslaZapTS;
-
- sfxHandle_t lCannonWarningSound;
-
- qhandle_t buildWeaponTimerPie[ 8 ];
- qhandle_t upgradeClassIconShader;
-} cgMedia_t;
-
-typedef struct
-{
- qhandle_t frameShader;
- qhandle_t overlayShader;
- qhandle_t noPowerShader;
- qhandle_t markedShader;
- vec4_t healthSevereColor;
- vec4_t healthHighColor;
- vec4_t healthElevatedColor;
- vec4_t healthGuardedColor;
- vec4_t healthLowColor;
- int frameHeight;
- int frameWidth;
- int healthPadding;
- int overlayHeight;
- int overlayWidth;
- float verticalMargin;
- float horizontalMargin;
- vec4_t foreColor;
- vec4_t backColor;
- qboolean loaded;
-} buildStat_t;
-
-
-// The client game static (cgs) structure hold everything
-// loaded or calculated from the gamestate. It will NOT
-// be cleared when a tournement restart is done, allowing
-// all clients to begin playing instantly
-typedef struct
-{
- gameState_t gameState; // gamestate from server
- glconfig_t glconfig; // rendering configuration
- float screenXScale; // derived from glconfig
- float screenYScale;
- float screenXBias;
-
- int serverCommandSequence; // reliable command stream counter
- int processedSnapshotNum; // the number of snapshots cgame has requested
-
- qboolean localServer; // detected on startup by checking sv_running
-
- // parsed from serverinfo
- int timelimit;
- int maxclients;
- char mapname[ MAX_QPATH ];
- qboolean markDeconstruct; // Whether or not buildables are marked
-
- int voteTime;
- int voteYes;
- int voteNo;
- qboolean voteModified; // beep whenever changed
- char voteString[ MAX_STRING_TOKENS ];
-
- int teamVoteTime[ 2 ];
- int teamVoteYes[ 2 ];
- int teamVoteNo[ 2 ];
- qboolean teamVoteModified[ 2 ]; // beep whenever changed
- char teamVoteString[ 2 ][ MAX_STRING_TOKENS ];
-
- int levelStartTime;
-
- int scores1, scores2; // from configstrings
-
- qboolean newHud;
-
- int alienBuildPoints;
- int alienBuildPointsTotal;
- int humanBuildPoints;
- int humanBuildPointsTotal;
- int humanBuildPointsPowered;
-
- int alienStage;
- int humanStage;
- int alienKills;
- int humanKills;
- int alienNextStageThreshold;
- int humanNextStageThreshold;
-
- int numAlienSpawns;
- int numHumanSpawns;
-
- //
- // locally derived information from gamestate
- //
- qhandle_t gameModels[ MAX_MODELS ];
- qhandle_t gameShaders[ MAX_GAME_SHADERS ];
- qhandle_t gameParticleSystems[ MAX_GAME_PARTICLE_SYSTEMS ];
- sfxHandle_t gameSounds[ MAX_SOUNDS ];
-
- int numInlineModels;
- qhandle_t inlineDrawModel[ MAX_MODELS ];
- vec3_t inlineModelMidpoints[ MAX_MODELS ];
-
- clientInfo_t clientinfo[ MAX_CLIENTS ];
-
- //TA: corpse info
- clientInfo_t corpseinfo[ MAX_CLIENTS ];
-
- int cursorX;
- int cursorY;
- qboolean eventHandling;
- qboolean mouseCaptured;
- qboolean sizingHud;
- void *capturedItem;
- qhandle_t activeCursor;
-
- buildStat_t alienBuildStat;
- buildStat_t humanBuildStat;
-
- // media
- cgMedia_t media;
-} cgs_t;
-
-//==============================================================================
-
-extern cgs_t cgs;
-extern cg_t cg;
-extern centity_t cg_entities[ MAX_GENTITIES ];
-
-//TA: weapon limit expanded:
-//extern weaponInfo_t cg_weapons[MAX_WEAPONS];
-extern weaponInfo_t cg_weapons[ 32 ];
-//TA: upgrade infos:
-extern upgradeInfo_t cg_upgrades[ 32 ];
-
-//TA: buildable infos:
-extern buildableInfo_t cg_buildables[ BA_NUM_BUILDABLES ];
-
-extern markPoly_t cg_markPolys[ MAX_MARK_POLYS ];
-
-extern vmCvar_t cg_centertime;
-extern vmCvar_t cg_runpitch;
-extern vmCvar_t cg_runroll;
-extern vmCvar_t cg_bobup;
-extern vmCvar_t cg_bobpitch;
-extern vmCvar_t cg_bobroll;
-extern vmCvar_t cg_swingSpeed;
-extern vmCvar_t cg_shadows;
-extern vmCvar_t cg_gibs;
-extern vmCvar_t cg_drawTimer;
-extern vmCvar_t cg_drawClock;
-extern vmCvar_t cg_drawFPS;
-extern vmCvar_t cg_drawDemoState;
-extern vmCvar_t cg_drawSnapshot;
-extern vmCvar_t cg_draw3dIcons;
-extern vmCvar_t cg_drawIcons;
-extern vmCvar_t cg_drawAmmoWarning;
-extern vmCvar_t cg_drawCrosshair;
-extern vmCvar_t cg_drawCrosshairNames;
-extern vmCvar_t cg_drawRewards;
-extern vmCvar_t cg_drawTeamOverlay;
-extern vmCvar_t cg_teamOverlayUserinfo;
-extern vmCvar_t cg_crosshairX;
-extern vmCvar_t cg_crosshairY;
-extern vmCvar_t cg_drawStatus;
-extern vmCvar_t cg_draw2D;
-extern vmCvar_t cg_animSpeed;
-extern vmCvar_t cg_debugAnim;
-extern vmCvar_t cg_debugPosition;
-extern vmCvar_t cg_debugEvents;
-extern vmCvar_t cg_teslaTrailTime;
-extern vmCvar_t cg_railTrailTime;
-extern vmCvar_t cg_errorDecay;
-extern vmCvar_t cg_nopredict;
-extern vmCvar_t cg_debugMove;
-extern vmCvar_t cg_noPlayerAnims;
-extern vmCvar_t cg_showmiss;
-extern vmCvar_t cg_footsteps;
-extern vmCvar_t cg_addMarks;
-extern vmCvar_t cg_brassTime;
-extern vmCvar_t cg_gun_frame;
-extern vmCvar_t cg_gun_x;
-extern vmCvar_t cg_gun_y;
-extern vmCvar_t cg_gun_z;
-extern vmCvar_t cg_drawGun;
-extern vmCvar_t cg_viewsize;
-extern vmCvar_t cg_tracerChance;
-extern vmCvar_t cg_tracerWidth;
-extern vmCvar_t cg_tracerLength;
-extern vmCvar_t cg_autoswitch;
-extern vmCvar_t cg_ignore;
-extern vmCvar_t cg_simpleItems;
-extern vmCvar_t cg_fov;
-extern vmCvar_t cg_zoomFov;
-extern vmCvar_t cg_thirdPersonRange;
-extern vmCvar_t cg_thirdPersonAngle;
-extern vmCvar_t cg_thirdPerson;
-extern vmCvar_t cg_stereoSeparation;
-extern vmCvar_t cg_lagometer;
-extern vmCvar_t cg_drawAttacker;
-extern vmCvar_t cg_synchronousClients;
-extern vmCvar_t cg_stats;
-extern vmCvar_t cg_forceModel;
-extern vmCvar_t cg_buildScript;
-extern vmCvar_t cg_paused;
-extern vmCvar_t cg_blood;
-extern vmCvar_t cg_predictItems;
-extern vmCvar_t cg_deferPlayers;
-extern vmCvar_t cg_drawFriend;
-extern vmCvar_t cg_teamChatsOnly;
-extern vmCvar_t cg_noVoiceChats;
-extern vmCvar_t cg_noVoiceText;
-extern vmCvar_t cg_scorePlum;
-extern vmCvar_t cg_smoothClients;
-extern vmCvar_t pmove_fixed;
-extern vmCvar_t pmove_msec;
-//extern vmCvar_t cg_pmove_fixed;
-extern vmCvar_t cg_cameraOrbit;
-extern vmCvar_t cg_cameraOrbitDelay;
-extern vmCvar_t cg_timescaleFadeEnd;
-extern vmCvar_t cg_timescaleFadeSpeed;
-extern vmCvar_t cg_timescale;
-extern vmCvar_t cg_cameraMode;
-extern vmCvar_t cg_smallFont;
-extern vmCvar_t cg_bigFont;
-extern vmCvar_t cg_noTaunt;
-extern vmCvar_t cg_noProjectileTrail;
-extern vmCvar_t cg_oldRail;
-extern vmCvar_t cg_oldRocket;
-extern vmCvar_t cg_oldPlasma;
-extern vmCvar_t cg_trueLightning;
-extern vmCvar_t cg_creepRes;
-extern vmCvar_t cg_drawSurfNormal;
-extern vmCvar_t cg_drawBBOX;
-extern vmCvar_t cg_debugAlloc;
-extern vmCvar_t cg_wwSmoothTime;
-extern vmCvar_t cg_wwFollow;
-extern vmCvar_t cg_wwToggle;
-extern vmCvar_t cg_depthSortParticles;
-extern vmCvar_t cg_bounceParticles;
-extern vmCvar_t cg_consoleLatency;
-extern vmCvar_t cg_lightFlare;
-extern vmCvar_t cg_debugParticles;
-extern vmCvar_t cg_debugTrails;
-extern vmCvar_t cg_debugPVS;
-extern vmCvar_t cg_disableWarningDialogs;
-extern vmCvar_t cg_disableScannerPlane;
-extern vmCvar_t cg_tutorial;
-
-extern vmCvar_t cg_painBlendUpRate;
-extern vmCvar_t cg_painBlendDownRate;
-extern vmCvar_t cg_painBlendMax;
-extern vmCvar_t cg_painBlendScale;
-extern vmCvar_t cg_painBlendZoom;
-
-//TA: hack to get class an carriage through to UI module
-extern vmCvar_t ui_currentClass;
-extern vmCvar_t ui_carriage;
-extern vmCvar_t ui_stages;
-extern vmCvar_t ui_dialog;
-extern vmCvar_t ui_loading;
-extern vmCvar_t ui_voteActive;
-extern vmCvar_t ui_alienTeamVoteActive;
-extern vmCvar_t ui_humanTeamVoteActive;
-
-extern vmCvar_t cg_debugRandom;
-
-extern vmCvar_t cg_optimizePrediction;
-extern vmCvar_t cg_projectileNudge;
-
-//
-// cg_main.c
-//
-const char *CG_ConfigString( int index );
-const char *CG_Argv( int arg );
-
-void QDECL CG_Printf( const char *msg, ... );
-void QDECL CG_Error( const char *msg, ... );
-
-void CG_StartMusic( void );
-int CG_PlayerCount( void );
-
-void CG_UpdateCvars( void );
-
-int CG_CrosshairPlayer( void );
-int CG_LastAttacker( void );
-void CG_LoadMenus( const char *menuFile );
-void CG_KeyEvent( int key, qboolean down );
-void CG_MouseEvent( int x, int y );
-void CG_EventHandling( int type );
-void CG_SetScoreSelection( void *menu );
-void CG_BuildSpectatorString( void );
-
-qboolean CG_FileExists( char *filename );
-void CG_RemoveNotifyLine( void );
-void CG_AddNotifyText( void );
-
-
-//
-// cg_view.c
-//
-void CG_addSmoothOp( vec3_t rotAxis, float rotAngle, float timeMod ); //TA
-void CG_TestModel_f( void );
-void CG_TestGun_f( void );
-void CG_TestModelNextFrame_f( void );
-void CG_TestModelPrevFrame_f( void );
-void CG_TestModelNextSkin_f( void );
-void CG_TestModelPrevSkin_f( void );
-void CG_AddBufferedSound( sfxHandle_t sfx );
-void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback );
-
-
-//
-// cg_drawtools.c
-//
-void CG_DrawPlane( vec3_t origin, vec3_t down, vec3_t right, qhandle_t shader );
-void CG_AdjustFrom640( float *x, float *y, float *w, float *h );
-void CG_FillRect( float x, float y, float width, float height, const float *color );
-void CG_DrawPic( float x, float y, float width, float height, qhandle_t hShader );
-void CG_DrawFadePic( float x, float y, float width, float height, vec4_t fcolor,
- vec4_t tcolor, float amount, qhandle_t hShader );
-
-int CG_DrawStrlen( const char *str );
-
-float *CG_FadeColor( int startMsec, int totalMsec );
-void CG_TileClear( void );
-void CG_ColorForHealth( vec4_t hcolor );
-void CG_GetColorForHealth( int health, int armor, vec4_t hcolor );
-
-void CG_DrawRect( float x, float y, float width, float height, float size, const float *color );
-void CG_DrawSides(float x, float y, float w, float h, float size);
-void CG_DrawTopBottom(float x, float y, float w, float h, float size);
-qboolean CG_WorldToScreen( vec3_t point, float *x, float *y );
-char *CG_KeyBinding( const char *bind );
-
-
-//
-// cg_draw.c
-//
-extern int sortedTeamPlayers[ TEAM_MAXOVERLAY ];
-extern int numSortedTeamPlayers;
-
-void CG_AddLagometerFrameInfo( void );
-void CG_AddLagometerSnapshotInfo( snapshot_t *snap );
-void CG_CenterPrint( const char *str, int y, int charWidth );
-void CG_DrawActive( stereoFrame_t stereoView );
-void CG_OwnerDraw( float x, float y, float w, float h, float text_x, float text_y,
- int ownerDraw, int ownerDrawFlags, int align, float special,
- float scale, vec4_t color, qhandle_t shader, int textStyle);
-void CG_Text_Paint( float x, float y, float scale, vec4_t color, const char *text, float adjust, int limit, int style );
-int CG_Text_Width( const char *text, float scale, int limit );
-int CG_Text_Height( const char *text, float scale, int limit );
-float CG_GetValue(int ownerDraw);
-void CG_RunMenuScript(char **args);
-void CG_SetPrintString( int type, const char *p );
-void CG_GetTeamColor( vec4_t *color );
-const char *CG_GetKillerText( void );
-void CG_Text_PaintChar( float x, float y, float width, float height, float scale,
- float s, float t, float s2, float t2, qhandle_t hShader );
-void CG_DrawLoadingScreen( void );
-void CG_UpdateMediaFraction( float newFract );
-void CG_ResetPainBlend( void );
-void CG_DrawField( float x, float y, int width, float cw, float ch, int value );
-
-//
-// cg_players.c
-//
-void CG_Player( centity_t *cent );
-void CG_Corpse( centity_t *cent );
-void CG_ResetPlayerEntity( centity_t *cent );
-void CG_AddRefEntityWithPowerups( refEntity_t *ent, int powerups, int team );
-void CG_NewClientInfo( int clientNum );
-void CG_PrecacheClientInfo( pClass_t class, char *model, char *skin );
-sfxHandle_t CG_CustomSound( int clientNum, const char *soundName );
-void CG_PlayerDisconnect( vec3_t org );
-void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum );
-qboolean CG_AtHighestClass( void );
-
-//
-// cg_buildable.c
-//
-void CG_GhostBuildable( buildable_t buildable );
-void CG_Buildable( centity_t *cent );
-void CG_BuildableStatusParse( const char *filename, buildStat_t *bs );
-void CG_DrawBuildableStatus( void );
-void CG_InitBuildables( void );
-void CG_HumanBuildableExplosion( vec3_t origin, vec3_t dir );
-void CG_AlienBuildableExplosion( vec3_t origin, vec3_t dir );
-
-//
-// cg_animation.c
-//
-void CG_RunLerpFrame( lerpFrame_t *lf );
-
-//
-// cg_animmapobj.c
-//
-void CG_AnimMapObj( centity_t *cent );
-void CG_ModelDoor( centity_t *cent );
-
-//
-// cg_predict.c
-//
-
-#define MAGIC_TRACE_HACK -2
-
-void CG_BuildSolidList( void );
-int CG_PointContents( const vec3_t point, int passEntityNum );
-void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs,
- const vec3_t end, int skipNumber, int mask );
-void CG_CapTrace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs,
- const vec3_t end, int skipNumber, int mask );
-void CG_BiSphereTrace( trace_t *result, const vec3_t start, const vec3_t end,
- const float startRadius, const float endRadius, int skipNumber, int mask );
-void CG_PredictPlayerState( void );
-
-
-//
-// cg_events.c
-//
-void CG_CheckEvents( centity_t *cent );
-void CG_EntityEvent( centity_t *cent, vec3_t position );
-void CG_PainEvent( centity_t *cent, int health );
-
-
-//
-// cg_ents.c
-//
-void CG_DrawBoundingBox( vec3_t origin, vec3_t mins, vec3_t maxs );
-void CG_SetEntitySoundPosition( centity_t *cent );
-void CG_AddPacketEntities( void );
-void CG_Beam( centity_t *cent );
-void CG_AdjustPositionForMover( const vec3_t in, int moverNum, int fromTime, int toTime, vec3_t out );
-
-void CG_PositionEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
- qhandle_t parentModel, char *tagName );
-void CG_PositionRotatedEntityOnTag( refEntity_t *entity, const refEntity_t *parent,
- qhandle_t parentModel, char *tagName );
-
-
-
-
-//
-// cg_weapons.c
-//
-void CG_NextWeapon_f( void );
-void CG_PrevWeapon_f( void );
-void CG_Weapon_f( void );
-
-void CG_InitUpgrades( void );
-void CG_RegisterUpgrade( int upgradeNum );
-void CG_InitWeapons( void );
-void CG_RegisterWeapon( int weaponNum );
-
-void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode );
-void CG_MissileHitWall( weapon_t weapon, weaponMode_t weaponMode, int clientNum,
- vec3_t origin, vec3_t dir, impactSound_t soundType );
-void CG_MissileHitPlayer( weapon_t weapon, weaponMode_t weaponMode, vec3_t origin, vec3_t dir, int entityNum );
-void CG_Bullet( vec3_t origin, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum );
-void CG_ShotgunFire( entityState_t *es );
-
-void CG_AddViewWeapon (playerState_t *ps);
-void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent );
-void CG_DrawItemSelect( rectDef_t *rect, vec4_t color );
-void CG_DrawItemSelectText( rectDef_t *rect, float scale, int textStyle );
-
-
-//
-// cg_scanner.c
-//
-void CG_UpdateEntityPositions( void );
-void CG_Scanner( rectDef_t *rect, qhandle_t shader, vec4_t color );
-void CG_AlienSense( rectDef_t *rect );
-
-//
-// cg_marks.c
-//
-void CG_InitMarkPolys( void );
-void CG_AddMarks( void );
-void CG_ImpactMark( qhandle_t markShader,
- const vec3_t origin, const vec3_t dir,
- float orientation,
- float r, float g, float b, float a,
- qboolean alphaFade,
- float radius, qboolean temporary );
-
-//
-// cg_snapshot.c
-//
-void CG_ProcessSnapshots( void );
-
-//
-// cg_consolecmds.c
-//
-qboolean CG_ConsoleCommand( void );
-void CG_InitConsoleCommands( void );
-qboolean CG_RequestScores( void );
-
-//
-// cg_servercmds.c
-//
-void CG_ExecuteNewServerCommands( int latestSequence );
-void CG_ParseServerinfo( void );
-void CG_SetConfigValues( void );
-void CG_ShaderStateChanged(void);
-
-//
-// cg_playerstate.c
-//
-void CG_Respawn( void );
-void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops );
-void CG_CheckChangedPredictableEvents( playerState_t *ps );
-
-//
-// cg_mem.c
-//
-void CG_InitMemory( void );
-void *CG_Alloc( int size );
-void CG_Free( void *ptr );
-void CG_DefragmentMemory( void );
-
-//
-// cg_attachment.c
-//
-qboolean CG_AttachmentPoint( attachment_t *a, vec3_t v );
-qboolean CG_AttachmentDir( attachment_t *a, vec3_t v );
-qboolean CG_AttachmentAxis( attachment_t *a, vec3_t axis[ 3 ] );
-qboolean CG_AttachmentVelocity( attachment_t *a, vec3_t v );
-int CG_AttachmentCentNum( attachment_t *a );
-
-qboolean CG_Attached( attachment_t *a );
-
-void CG_AttachToPoint( attachment_t *a );
-void CG_AttachToCent( attachment_t *a );
-void CG_AttachToTag( attachment_t *a );
-void CG_AttachToParticle( attachment_t *a );
-void CG_SetAttachmentPoint( attachment_t *a, vec3_t v );
-void CG_SetAttachmentCent( attachment_t *a, centity_t *cent );
-void CG_SetAttachmentTag( attachment_t *a, refEntity_t parent,
- qhandle_t model, char *tagName );
-void CG_SetAttachmentParticle( attachment_t *a, particle_t *p );
-
-void CG_SetAttachmentOffset( attachment_t *a, vec3_t v );
-
-//
-// cg_particles.c
-//
-void CG_LoadParticleSystems( void );
-qhandle_t CG_RegisterParticleSystem( char *name );
-
-particleSystem_t *CG_SpawnNewParticleSystem( qhandle_t psHandle );
-void CG_DestroyParticleSystem( particleSystem_t **ps );
-
-qboolean CG_IsParticleSystemInfinite( particleSystem_t *ps );
-qboolean CG_IsParticleSystemValid( particleSystem_t **ps );
-
-void CG_SetParticleSystemNormal( particleSystem_t *ps, vec3_t normal );
-
-void CG_AddParticles( void );
-
-void CG_ParticleSystemEntity( centity_t *cent );
-
-void CG_TestPS_f( void );
-void CG_DestroyTestPS_f( void );
-
-//
-// cg_trails.c
-//
-void CG_LoadTrailSystems( void );
-qhandle_t CG_RegisterTrailSystem( char *name );
-
-trailSystem_t *CG_SpawnNewTrailSystem( qhandle_t psHandle );
-void CG_DestroyTrailSystem( trailSystem_t **ts );
-
-qboolean CG_IsTrailSystemValid( trailSystem_t **ts );
-
-void CG_AddTrails( void );
-
-void CG_TestTS_f( void );
-void CG_DestroyTestTS_f( void );
-
-//
-// cg_ptr.c
-//
-int CG_ReadPTRCode( void );
-void CG_WritePTRCode( int code );
-
-//
-// cg_tutorial.c
-//
-const char *CG_TutorialText( void );
-
-//
-//===============================================
-
-//
-// system traps
-// These functions are how the cgame communicates with the main game system
-//
-
-
-// print message on the local console
-void trap_Print( const char *fmt );
-
-// abort the game
-void trap_Error( const char *fmt );
-
-// milliseconds should only be used for performance tuning, never
-// for anything game related. Get time from the CG_DrawActiveFrame parameter
-int trap_Milliseconds( void );
-
-// console variable interaction
-void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags );
-void trap_Cvar_Update( vmCvar_t *vmCvar );
-void trap_Cvar_Set( const char *var_name, const char *value );
-void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize );
-
-// ServerCommand and ConsoleCommand parameter access
-int trap_Argc( void );
-void trap_Argv( int n, char *buffer, int bufferLength );
-void trap_Args( char *buffer, int bufferLength );
-void trap_LiteralArgs( char *buffer, int bufferLength );
-
-// filesystem access
-// returns length of file
-int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode );
-void trap_FS_Read( void *buffer, int len, fileHandle_t f );
-void trap_FS_Write( const void *buffer, int len, fileHandle_t f );
-void trap_FS_FCloseFile( fileHandle_t f );
-void trap_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin ); // fsOrigin_t
-int trap_FS_GetFileList( const char *path, const char *extension,
- char *listbuf, int bufsize );
-
-// add commands to the local console as if they were typed in
-// for map changing, etc. The command is not executed immediately,
-// but will be executed in order the next time console commands
-// are processed
-void trap_SendConsoleCommand( const char *text );
-
-// register a command name so the console can perform command completion.
-// FIXME: replace this with a normal console command "defineCommand"?
-void trap_AddCommand( const char *cmdName );
-
-// send a string to the server over the network
-void trap_SendClientCommand( const char *s );
-
-// force a screen update, only used during gamestate load
-void trap_UpdateScreen( void );
-
-// model collision
-void trap_CM_LoadMap( const char *mapname );
-int trap_CM_NumInlineModels( void );
-clipHandle_t trap_CM_InlineModel( int index ); // 0 = world, 1+ = bmodels
-clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs );
-int trap_CM_PointContents( const vec3_t p, clipHandle_t model );
-int trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin, const vec3_t angles );
-void trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
- const vec3_t mins, const vec3_t maxs,
- clipHandle_t model, int brushmask );
-void trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
- const vec3_t mins, const vec3_t maxs,
- clipHandle_t model, int brushmask,
- const vec3_t origin, const vec3_t angles );
-void trap_CM_CapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
- const vec3_t mins, const vec3_t maxs,
- clipHandle_t model, int brushmask );
-void trap_CM_TransformedCapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
- const vec3_t mins, const vec3_t maxs,
- clipHandle_t model, int brushmask,
- const vec3_t origin, const vec3_t angles );
-void trap_CM_BiSphereTrace( trace_t *results, const vec3_t start,
- const vec3_t end, float startRad, float endRad,
- clipHandle_t model, int mask );
-void trap_CM_TransformedBiSphereTrace( trace_t *results, const vec3_t start,
- const vec3_t end, float startRad, float endRad,
- clipHandle_t model, int mask,
- const vec3_t origin );
-
-// Returns the projection of a polygon onto the solid brushes in the world
-int trap_CM_MarkFragments( int numPoints, const vec3_t *points,
- const vec3_t projection,
- int maxPoints, vec3_t pointBuffer,
- int maxFragments, markFragment_t *fragmentBuffer );
-
-// normal sounds will have their volume dynamically changed as their entity
-// moves and the listener moves
-void trap_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx );
-void trap_S_StopLoopingSound( int entnum );
-
-// a local sound is always played full volume
-void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum );
-void trap_S_ClearLoopingSounds( qboolean killall );
-void trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
-void trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
-void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin );
-
-// respatialize recalculates the volumes of sound as they should be heard by the
-// given entityNum and position
-void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
-sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed ); // returns buzz if not found
-void trap_S_StartBackgroundTrack( const char *intro, const char *loop ); // empty name stops music
-void trap_S_StopBackgroundTrack( void );
-
-
-void trap_R_LoadWorldMap( const char *mapname );
-
-// all media should be registered during level startup to prevent
-// hitches during gameplay
-qhandle_t trap_R_RegisterModel( const char *name ); // returns rgb axis if not found
-qhandle_t trap_R_RegisterSkin( const char *name ); // returns all white if not found
-qhandle_t trap_R_RegisterShader( const char *name ); // returns all white if not found
-qhandle_t trap_R_RegisterShaderNoMip( const char *name ); // returns all white if not found
-
-// a scene is built up by calls to R_ClearScene and the various R_Add functions.
-// Nothing is drawn until R_RenderScene is called.
-void trap_R_ClearScene( void );
-void trap_R_AddRefEntityToScene( const refEntity_t *re );
-
-// polys are intended for simple wall marks, not really for doing
-// significant construction
-void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts );
-void trap_R_AddPolysToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int numPolys );
-void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b );
-void trap_R_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b );
-int trap_R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir );
-void trap_R_RenderScene( const refdef_t *fd );
-void trap_R_SetColor( const float *rgba ); // NULL = 1,1,1,1
-void trap_R_DrawStretchPic( float x, float y, float w, float h,
- float s1, float t1, float s2, float t2, qhandle_t hShader );
-void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs );
-int trap_R_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame,
- float frac, const char *tagName );
-void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset );
-
-// The glconfig_t will not change during the life of a cgame.
-// If it needs to change, the entire cgame will be restarted, because
-// all the qhandle_t are then invalid.
-void trap_GetGlconfig( glconfig_t *glconfig );
-
-// the gamestate should be grabbed at startup, and whenever a
-// configstring changes
-void trap_GetGameState( gameState_t *gamestate );
-
-// cgame will poll each frame to see if a newer snapshot has arrived
-// that it is interested in. The time is returned seperately so that
-// snapshot latency can be calculated.
-void trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime );
-
-// a snapshot get can fail if the snapshot (or the entties it holds) is so
-// old that it has fallen out of the client system queue
-qboolean trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot );
-
-// retrieve a text command from the server stream
-// the current snapshot will hold the number of the most recent command
-// qfalse can be returned if the client system handled the command
-// argc() / argv() can be used to examine the parameters of the command
-qboolean trap_GetServerCommand( int serverCommandNumber );
-
-// returns the most recent command number that can be passed to GetUserCmd
-// this will always be at least one higher than the number in the current
-// snapshot, and it may be quite a few higher if it is a fast computer on
-// a lagged connection
-int trap_GetCurrentCmdNumber( void );
-
-qboolean trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd );
-
-// used for the weapon select and zoom
-void trap_SetUserCmdValue( int stateValue, float sensitivityScale );
-
-// aids for VM testing
-void testPrintInt( char *string, int i );
-void testPrintFloat( char *string, float f );
-
-int trap_MemoryRemaining( void );
-void trap_R_RegisterFont(const char *fontName, int pointSize, fontInfo_t *font);
-qboolean trap_Key_IsDown( int keynum );
-int trap_Key_GetCatcher( void );
-void trap_Key_SetCatcher( int catcher );
-int trap_Key_GetKey( const char *binding );
-void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
-void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen );
-void trap_Key_SetBinding( int keynum, const char *binding );
-
-int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits );
-e_status trap_CIN_StopCinematic( int handle );
-e_status trap_CIN_RunCinematic( int handle );
-void trap_CIN_DrawCinematic( int handle );
-void trap_CIN_SetExtents( int handle, int x, int y, int w, int h );
-
-void trap_SnapVector( float *v );
-int trap_RealTime( qtime_t *tm );
-
-qboolean trap_loadCamera( const char *name );
-void trap_startCamera( int time );
-qboolean trap_getCameraInfo( int time, vec3_t *origin, vec3_t *angles );
-
-qboolean trap_GetEntityToken( char *buffer, int bufferSize );
-
-int trap_GetDemoState( void );
-int trap_GetDemoPos( void );
-void trap_GetDemoName( char *buffer, int size );
-
-// cg_drawCrosshair settings
-#define CROSSHAIR_ALWAYSOFF 0
-#define CROSSHAIR_RANGEDONLY 1
-#define CROSSHAIR_ALWAYSON 2
-
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
deleted file mode 100644
index 1797b97..0000000
--- a/src/cgame/cg_main.c
+++ /dev/null
@@ -1,1840 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_main.c -- initialization and primary entry point for cgame
-
-
-#include "cg_local.h"
-
-#include "../ui/ui_shared.h"
-// display context for new ui stuff
-displayContextDef_t cgDC;
-
-int forceModelModificationCount = -1;
-
-void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum );
-void CG_Shutdown( void );
-
-/*
-================
-vmMain
-
-This is the only way control passes into the module.
-This must be the very first function compiled into the .q3vm file
-================
-*/
-intptr_t vmMain( int command, int arg0, int arg1, int arg2, int arg3,
- int arg4, int arg5, int arg6, int arg7,
- int arg8, int arg9, int arg10, int arg11 )
-{
- switch( command )
- {
- case CG_INIT:
- CG_Init( arg0, arg1, arg2 );
- return 0;
-
- case CG_SHUTDOWN:
- CG_Shutdown( );
- return 0;
-
- case CG_CONSOLE_COMMAND:
- return CG_ConsoleCommand( );
-
- case CG_CONSOLE_TEXT:
- CG_AddNotifyText( );
- return 0;
-
- case CG_DRAW_ACTIVE_FRAME:
- CG_DrawActiveFrame( arg0, arg1, arg2 );
- return 0;
-
- case CG_CROSSHAIR_PLAYER:
- return CG_CrosshairPlayer( );
-
- case CG_LAST_ATTACKER:
- return CG_LastAttacker( );
-
- case CG_KEY_EVENT:
- CG_KeyEvent( arg0, arg1 );
- return 0;
-
- case CG_MOUSE_EVENT:
- cgDC.cursorx = cgs.cursorX;
- cgDC.cursory = cgs.cursorY;
- CG_MouseEvent( arg0, arg1 );
- return 0;
-
- case CG_EVENT_HANDLING:
- CG_EventHandling( arg0 );
- return 0;
-
- default:
- CG_Error( "vmMain: unknown command %i", command );
- break;
- }
-
- return -1;
-}
-
-
-cg_t cg;
-cgs_t cgs;
-centity_t cg_entities[ MAX_GENTITIES ];
-
-//TA: weapons limit expanded:
-//weaponInfo_t cg_weapons[MAX_WEAPONS];
-weaponInfo_t cg_weapons[ 32 ];
-upgradeInfo_t cg_upgrades[ 32 ];
-
-buildableInfo_t cg_buildables[ BA_NUM_BUILDABLES ];
-
-vmCvar_t cg_teslaTrailTime;
-vmCvar_t cg_railTrailTime;
-vmCvar_t cg_centertime;
-vmCvar_t cg_runpitch;
-vmCvar_t cg_runroll;
-vmCvar_t cg_bobup;
-vmCvar_t cg_bobpitch;
-vmCvar_t cg_bobroll;
-vmCvar_t cg_swingSpeed;
-vmCvar_t cg_shadows;
-vmCvar_t cg_gibs;
-vmCvar_t cg_drawTimer;
-vmCvar_t cg_drawClock;
-vmCvar_t cg_drawFPS;
-vmCvar_t cg_drawDemoState;
-vmCvar_t cg_drawSnapshot;
-vmCvar_t cg_draw3dIcons;
-vmCvar_t cg_drawIcons;
-vmCvar_t cg_drawAmmoWarning;
-vmCvar_t cg_drawCrosshair;
-vmCvar_t cg_drawCrosshairNames;
-vmCvar_t cg_drawRewards;
-vmCvar_t cg_crosshairX;
-vmCvar_t cg_crosshairY;
-vmCvar_t cg_draw2D;
-vmCvar_t cg_drawStatus;
-vmCvar_t cg_animSpeed;
-vmCvar_t cg_debugAnim;
-vmCvar_t cg_debugPosition;
-vmCvar_t cg_debugEvents;
-vmCvar_t cg_errorDecay;
-vmCvar_t cg_nopredict;
-vmCvar_t cg_debugMove;
-vmCvar_t cg_noPlayerAnims;
-vmCvar_t cg_showmiss;
-vmCvar_t cg_footsteps;
-vmCvar_t cg_addMarks;
-vmCvar_t cg_brassTime;
-vmCvar_t cg_viewsize;
-vmCvar_t cg_drawGun;
-vmCvar_t cg_gun_frame;
-vmCvar_t cg_gun_x;
-vmCvar_t cg_gun_y;
-vmCvar_t cg_gun_z;
-vmCvar_t cg_tracerChance;
-vmCvar_t cg_tracerWidth;
-vmCvar_t cg_tracerLength;
-vmCvar_t cg_autoswitch;
-vmCvar_t cg_ignore;
-vmCvar_t cg_simpleItems;
-vmCvar_t cg_fov;
-vmCvar_t cg_zoomFov;
-vmCvar_t cg_thirdPerson;
-vmCvar_t cg_thirdPersonRange;
-vmCvar_t cg_thirdPersonAngle;
-vmCvar_t cg_stereoSeparation;
-vmCvar_t cg_lagometer;
-vmCvar_t cg_drawAttacker;
-vmCvar_t cg_synchronousClients;
-vmCvar_t cg_stats;
-vmCvar_t cg_buildScript;
-vmCvar_t cg_forceModel;
-vmCvar_t cg_paused;
-vmCvar_t cg_blood;
-vmCvar_t cg_predictItems;
-vmCvar_t cg_deferPlayers;
-vmCvar_t cg_drawTeamOverlay;
-vmCvar_t cg_teamOverlayUserinfo;
-vmCvar_t cg_drawFriend;
-vmCvar_t cg_teamChatsOnly;
-vmCvar_t cg_noVoiceChats;
-vmCvar_t cg_noVoiceText;
-vmCvar_t cg_hudFiles;
-vmCvar_t cg_scorePlum;
-vmCvar_t cg_smoothClients;
-vmCvar_t pmove_fixed;
-//vmCvar_t cg_pmove_fixed;
-vmCvar_t pmove_msec;
-vmCvar_t cg_pmove_msec;
-vmCvar_t cg_cameraMode;
-vmCvar_t cg_cameraOrbit;
-vmCvar_t cg_cameraOrbitDelay;
-vmCvar_t cg_timescaleFadeEnd;
-vmCvar_t cg_timescaleFadeSpeed;
-vmCvar_t cg_timescale;
-vmCvar_t cg_smallFont;
-vmCvar_t cg_bigFont;
-vmCvar_t cg_noTaunt;
-vmCvar_t cg_noProjectileTrail;
-vmCvar_t cg_oldRail;
-vmCvar_t cg_oldRocket;
-vmCvar_t cg_oldPlasma;
-vmCvar_t cg_trueLightning;
-vmCvar_t cg_creepRes;
-vmCvar_t cg_drawSurfNormal;
-vmCvar_t cg_drawBBOX;
-vmCvar_t cg_debugAlloc;
-vmCvar_t cg_wwSmoothTime;
-vmCvar_t cg_wwFollow;
-vmCvar_t cg_wwToggle;
-vmCvar_t cg_depthSortParticles;
-vmCvar_t cg_bounceParticles;
-vmCvar_t cg_consoleLatency;
-vmCvar_t cg_lightFlare;
-vmCvar_t cg_debugParticles;
-vmCvar_t cg_debugTrails;
-vmCvar_t cg_debugPVS;
-vmCvar_t cg_disableWarningDialogs;
-vmCvar_t cg_disableScannerPlane;
-vmCvar_t cg_tutorial;
-
-vmCvar_t cg_painBlendUpRate;
-vmCvar_t cg_painBlendDownRate;
-vmCvar_t cg_painBlendMax;
-vmCvar_t cg_painBlendScale;
-vmCvar_t cg_painBlendZoom;
-
-//TA: hack to get class and carriage through to UI module
-vmCvar_t ui_currentClass;
-vmCvar_t ui_carriage;
-vmCvar_t ui_stages;
-vmCvar_t ui_dialog;
-vmCvar_t ui_loading;
-vmCvar_t ui_voteActive;
-vmCvar_t ui_alienTeamVoteActive;
-vmCvar_t ui_humanTeamVoteActive;
-
-vmCvar_t cg_debugRandom;
-
-vmCvar_t cg_optimizePrediction;
-vmCvar_t cg_projectileNudge;
-
-
-typedef struct
-{
- vmCvar_t *vmCvar;
- char *cvarName;
- char *defaultString;
- int cvarFlags;
-} cvarTable_t;
-
-static cvarTable_t cvarTable[ ] =
-{
- { &cg_ignore, "cg_ignore", "0", 0 }, // used for debugging
- { &cg_autoswitch, "cg_autoswitch", "1", CVAR_ARCHIVE },
- { &cg_drawGun, "cg_drawGun", "1", CVAR_ARCHIVE },
- { &cg_zoomFov, "cg_zoomfov", "22.5", CVAR_ARCHIVE },
- { &cg_fov, "cg_fov", "90", CVAR_ARCHIVE },
- { &cg_viewsize, "cg_viewsize", "100", CVAR_ARCHIVE },
- { &cg_stereoSeparation, "cg_stereoSeparation", "0.4", CVAR_ARCHIVE },
- { &cg_shadows, "cg_shadows", "1", CVAR_ARCHIVE },
- { &cg_gibs, "cg_gibs", "1", CVAR_ARCHIVE },
- { &cg_draw2D, "cg_draw2D", "1", CVAR_ARCHIVE },
- { &cg_drawStatus, "cg_drawStatus", "1", CVAR_ARCHIVE },
- { &cg_drawTimer, "cg_drawTimer", "1", CVAR_ARCHIVE },
- { &cg_drawClock, "cg_drawClock", "0", CVAR_ARCHIVE },
- { &cg_drawFPS, "cg_drawFPS", "1", CVAR_ARCHIVE },
- { &cg_drawDemoState, "cg_drawDemoState", "1", CVAR_ARCHIVE },
- { &cg_drawSnapshot, "cg_drawSnapshot", "0", CVAR_ARCHIVE },
- { &cg_draw3dIcons, "cg_draw3dIcons", "1", CVAR_ARCHIVE },
- { &cg_drawIcons, "cg_drawIcons", "1", CVAR_ARCHIVE },
- { &cg_drawAmmoWarning, "cg_drawAmmoWarning", "1", CVAR_ARCHIVE },
- { &cg_drawAttacker, "cg_drawAttacker", "1", CVAR_ARCHIVE },
- { &cg_drawCrosshair, "cg_drawCrosshair", "1", CVAR_ARCHIVE },
- { &cg_drawCrosshairNames, "cg_drawCrosshairNames", "1", CVAR_ARCHIVE },
- { &cg_drawRewards, "cg_drawRewards", "1", CVAR_ARCHIVE },
- { &cg_crosshairX, "cg_crosshairX", "0", CVAR_ARCHIVE },
- { &cg_crosshairY, "cg_crosshairY", "0", CVAR_ARCHIVE },
- { &cg_brassTime, "cg_brassTime", "2500", CVAR_ARCHIVE },
- { &cg_simpleItems, "cg_simpleItems", "0", CVAR_ARCHIVE },
- { &cg_addMarks, "cg_marks", "1", CVAR_ARCHIVE },
- { &cg_lagometer, "cg_lagometer", "0", CVAR_ARCHIVE },
- { &cg_teslaTrailTime, "cg_teslaTrailTime", "250", CVAR_ARCHIVE },
- { &cg_railTrailTime, "cg_railTrailTime", "400", CVAR_ARCHIVE },
- { &cg_gun_x, "cg_gunX", "0", CVAR_CHEAT },
- { &cg_gun_y, "cg_gunY", "0", CVAR_CHEAT },
- { &cg_gun_z, "cg_gunZ", "0", CVAR_CHEAT },
- { &cg_centertime, "cg_centertime", "3", CVAR_CHEAT },
- { &cg_runpitch, "cg_runpitch", "0.002", CVAR_ARCHIVE},
- { &cg_runroll, "cg_runroll", "0.005", CVAR_ARCHIVE },
- { &cg_bobup , "cg_bobup", "0.005", CVAR_CHEAT },
- { &cg_bobpitch, "cg_bobpitch", "0.002", CVAR_ARCHIVE },
- { &cg_bobroll, "cg_bobroll", "0.002", CVAR_ARCHIVE },
- { &cg_swingSpeed, "cg_swingSpeed", "0.3", CVAR_CHEAT },
- { &cg_animSpeed, "cg_animspeed", "1", CVAR_CHEAT },
- { &cg_debugAnim, "cg_debuganim", "0", CVAR_CHEAT },
- { &cg_debugPosition, "cg_debugposition", "0", CVAR_CHEAT },
- { &cg_debugEvents, "cg_debugevents", "0", CVAR_CHEAT },
- { &cg_errorDecay, "cg_errordecay", "100", 0 },
- { &cg_nopredict, "cg_nopredict", "0", 0 },
- { &cg_debugMove, "cg_debugMove", "0", 0 },
- { &cg_noPlayerAnims, "cg_noplayeranims", "0", CVAR_CHEAT },
- { &cg_showmiss, "cg_showmiss", "0", 0 },
- { &cg_footsteps, "cg_footsteps", "1", CVAR_CHEAT },
- { &cg_tracerChance, "cg_tracerchance", "0.4", CVAR_CHEAT },
- { &cg_tracerWidth, "cg_tracerwidth", "1", CVAR_CHEAT },
- { &cg_tracerLength, "cg_tracerlength", "100", CVAR_CHEAT },
- { &cg_thirdPersonRange, "cg_thirdPersonRange", "40", CVAR_CHEAT },
- { &cg_thirdPersonAngle, "cg_thirdPersonAngle", "0", CVAR_CHEAT },
- { &cg_thirdPerson, "cg_thirdPerson", "0", CVAR_CHEAT },
- { &cg_forceModel, "cg_forceModel", "0", CVAR_ARCHIVE },
- { &cg_predictItems, "cg_predictItems", "1", CVAR_ARCHIVE },
- { &cg_deferPlayers, "cg_deferPlayers", "1", CVAR_ARCHIVE },
- { &cg_drawTeamOverlay, "cg_drawTeamOverlay", "0", CVAR_ARCHIVE },
- { &cg_teamOverlayUserinfo, "teamoverlay", "0", CVAR_ROM | CVAR_USERINFO },
- { &cg_stats, "cg_stats", "0", 0 },
- { &cg_drawFriend, "cg_drawFriend", "1", CVAR_ARCHIVE },
- { &cg_teamChatsOnly, "cg_teamChatsOnly", "0", CVAR_ARCHIVE },
- { &cg_noVoiceChats, "cg_noVoiceChats", "0", CVAR_ARCHIVE },
- { &cg_noVoiceText, "cg_noVoiceText", "0", CVAR_ARCHIVE },
- { &cg_creepRes, "cg_creepRes", "16", CVAR_ARCHIVE },
- { &cg_drawSurfNormal, "cg_drawSurfNormal", "0", CVAR_CHEAT },
- { &cg_drawBBOX, "cg_drawBBOX", "0", CVAR_CHEAT },
- { &cg_debugAlloc, "cg_debugAlloc", "0", 0 },
- { &cg_wwSmoothTime, "cg_wwSmoothTime", "300", CVAR_ARCHIVE },
- { &cg_wwFollow, "cg_wwFollow", "1", CVAR_ARCHIVE|CVAR_USERINFO },
- { &cg_wwToggle, "cg_wwToggle", "1", CVAR_ARCHIVE|CVAR_USERINFO },
- { &cg_depthSortParticles, "cg_depthSortParticles", "1", CVAR_ARCHIVE },
- { &cg_bounceParticles, "cg_bounceParticles", "0", CVAR_ARCHIVE },
- { &cg_consoleLatency, "cg_consoleLatency", "3000", CVAR_ARCHIVE },
- { &cg_lightFlare, "cg_lightFlare", "3", CVAR_ARCHIVE },
- { &cg_debugParticles, "cg_debugParticles", "0", CVAR_CHEAT },
- { &cg_debugTrails, "cg_debugTrails", "0", CVAR_CHEAT },
- { &cg_debugPVS, "cg_debugPVS", "0", CVAR_CHEAT },
- { &cg_disableWarningDialogs, "cg_disableWarningDialogs", "0", CVAR_ARCHIVE },
- { &cg_disableScannerPlane, "cg_disableScannerPlane", "0", CVAR_ARCHIVE },
- { &cg_tutorial, "cg_tutorial", "1", CVAR_ARCHIVE },
- { &cg_hudFiles, "cg_hudFiles", "ui/hud.txt", CVAR_ARCHIVE},
-
- { &cg_painBlendUpRate, "cg_painBlendUpRate", "10.0", 0 },
- { &cg_painBlendDownRate, "cg_painBlendDownRate", "0.5", 0 },
- { &cg_painBlendMax, "cg_painBlendMax", "0.7", 0 },
- { &cg_painBlendScale, "cg_painBlendScale", "7.0", 0 },
- { &cg_painBlendZoom, "cg_painBlendZoom", "0.65", 0 },
-
- { &ui_currentClass, "ui_currentClass", "0", 0 },
- { &ui_carriage, "ui_carriage", "", 0 },
- { &ui_stages, "ui_stages", "0 0", 0 },
- { &ui_dialog, "ui_dialog", "Text not set", 0 },
- { &ui_loading, "ui_loading", "0", 0 },
- { &ui_voteActive, "ui_voteActive", "0", 0 },
- { &ui_humanTeamVoteActive, "ui_humanTeamVoteActive", "0", 0 },
- { &ui_alienTeamVoteActive, "ui_alienTeamVoteActive", "0", 0 },
-
- { &cg_debugRandom, "cg_debugRandom", "0", 0 },
-
- { &cg_optimizePrediction, "cg_optimizePrediction", "1", CVAR_ARCHIVE },
- { &cg_projectileNudge, "cg_projectileNudge", "1", CVAR_ARCHIVE },
-
- // the following variables are created in other parts of the system,
- // but we also reference them here
-
- { &cg_buildScript, "com_buildScript", "0", 0 }, // force loading of all possible data amd error on failures
- { &cg_paused, "cl_paused", "0", CVAR_ROM },
- { &cg_blood, "com_blood", "1", CVAR_ARCHIVE },
- { &cg_synchronousClients, "g_synchronousClients", "0", 0 }, // communicated by systeminfo
- { &cg_cameraOrbit, "cg_cameraOrbit", "0", CVAR_CHEAT},
- { &cg_cameraOrbitDelay, "cg_cameraOrbitDelay", "50", CVAR_ARCHIVE},
- { &cg_timescaleFadeEnd, "cg_timescaleFadeEnd", "1", 0},
- { &cg_timescaleFadeSpeed, "cg_timescaleFadeSpeed", "0", 0},
- { &cg_timescale, "timescale", "1", 0},
- { &cg_scorePlum, "cg_scorePlums", "1", CVAR_USERINFO | CVAR_ARCHIVE},
- { &cg_smoothClients, "cg_smoothClients", "0", CVAR_USERINFO | CVAR_ARCHIVE},
- { &cg_cameraMode, "com_cameraMode", "0", CVAR_CHEAT},
-
- { &pmove_fixed, "pmove_fixed", "0", 0},
- { &pmove_msec, "pmove_msec", "8", 0},
- { &cg_noTaunt, "cg_noTaunt", "0", CVAR_ARCHIVE},
- { &cg_noProjectileTrail, "cg_noProjectileTrail", "0", CVAR_ARCHIVE},
- { &cg_smallFont, "ui_smallFont", "0.2", CVAR_ARCHIVE},
- { &cg_bigFont, "ui_bigFont", "0.5", CVAR_ARCHIVE},
- { &cg_oldRail, "cg_oldRail", "1", CVAR_ARCHIVE},
- { &cg_oldRocket, "cg_oldRocket", "1", CVAR_ARCHIVE},
- { &cg_oldPlasma, "cg_oldPlasma", "1", CVAR_ARCHIVE},
- { &cg_trueLightning, "cg_trueLightning", "0.0", CVAR_ARCHIVE}
-// { &cg_pmove_fixed, "cg_pmove_fixed", "0", CVAR_USERINFO | CVAR_ARCHIVE }
-};
-
-static int cvarTableSize = sizeof( cvarTable ) / sizeof( cvarTable[0] );
-
-/*
-=================
-CG_RegisterCvars
-=================
-*/
-void CG_RegisterCvars( void )
-{
- int i;
- cvarTable_t *cv;
- char var[ MAX_TOKEN_CHARS ];
-
- for( i = 0, cv = cvarTable; i < cvarTableSize; i++, cv++ )
- {
- trap_Cvar_Register( cv->vmCvar, cv->cvarName,
- cv->defaultString, cv->cvarFlags );
- }
-
- //repress standard Q3 console
- trap_Cvar_Set( "con_notifytime", "-2" );
-
- // see if we are also running the server on this machine
- trap_Cvar_VariableStringBuffer( "sv_running", var, sizeof( var ) );
- cgs.localServer = atoi( var );
- forceModelModificationCount = cg_forceModel.modificationCount;
-
- trap_Cvar_Register( NULL, "model", DEFAULT_MODEL, CVAR_USERINFO | CVAR_ARCHIVE );
- trap_Cvar_Register( NULL, "headmodel", DEFAULT_MODEL, CVAR_USERINFO | CVAR_ARCHIVE );
- trap_Cvar_Register( NULL, "team_model", DEFAULT_TEAM_MODEL, CVAR_USERINFO | CVAR_ARCHIVE );
- trap_Cvar_Register( NULL, "team_headmodel", DEFAULT_TEAM_HEAD, CVAR_USERINFO | CVAR_ARCHIVE );
-}
-
-
-/*
-===================
-CG_ForceModelChange
-===================
-*/
-static void CG_ForceModelChange( void )
-{
- int i;
-
- for( i = 0; i < MAX_CLIENTS; i++ )
- {
- const char *clientInfo;
-
- clientInfo = CG_ConfigString( CS_PLAYERS + i );
-
- if( !clientInfo[ 0 ] )
- continue;
-
- CG_NewClientInfo( i );
- }
-}
-
-
-/*
-=================
-CG_UpdateCvars
-=================
-*/
-void CG_UpdateCvars( void )
-{
- int i;
- cvarTable_t *cv;
-
- for( i = 0, cv = cvarTable; i < cvarTableSize; i++, cv++ )
- trap_Cvar_Update( cv->vmCvar );
-
- // check for modications here
-
- // if force model changed
- if( forceModelModificationCount != cg_forceModel.modificationCount )
- {
- forceModelModificationCount = cg_forceModel.modificationCount;
- CG_ForceModelChange( );
- }
-}
-
-
-int CG_CrosshairPlayer( void )
-{
- if( cg.time > ( cg.crosshairClientTime + 1000 ) )
- return -1;
-
- return cg.crosshairClientNum;
-}
-
-
-int CG_LastAttacker( void )
-{
- if( !cg.attackerTime )
- return -1;
-
- return cg.snap->ps.persistant[ PERS_ATTACKER ];
-}
-
-/*
-=================
-CG_RemoveNotifyLine
-=================
-*/
-void CG_RemoveNotifyLine( void )
-{
- int i, offset, totalLength;
-
- if( cg.numConsoleLines == 0 )
- return;
-
- offset = cg.consoleLines[ 0 ].length;
- totalLength = strlen( cg.consoleText ) - offset;
-
- //slide up consoleText
- for( i = 0; i <= totalLength; i++ )
- cg.consoleText[ i ] = cg.consoleText[ i + offset ];
-
- //pop up the first consoleLine
- for( i = 0; i < cg.numConsoleLines; i++ )
- cg.consoleLines[ i ] = cg.consoleLines[ i + 1 ];
-
- cg.numConsoleLines--;
-}
-
-/*
-=================
-CG_AddNotifyText
-=================
-*/
-void CG_AddNotifyText( void )
-{
- char buffer[ BIG_INFO_STRING ];
-
- trap_LiteralArgs( buffer, BIG_INFO_STRING );
-
- if( !buffer[ 0 ] )
- {
- cg.consoleText[ 0 ] = '\0';
- cg.numConsoleLines = 0;
- return;
- }
-
- if( cg.numConsoleLines == MAX_CONSOLE_LINES )
- CG_RemoveNotifyLine( );
-
- Q_strcat( cg.consoleText, MAX_CONSOLE_TEXT, buffer );
- cg.consoleLines[ cg.numConsoleLines ].time = cg.time;
- cg.consoleLines[ cg.numConsoleLines ].length = strlen( buffer );
- cg.numConsoleLines++;
-}
-
-void QDECL CG_Printf( const char *msg, ... )
-{
- va_list argptr;
- char text[ 1024 ];
-
- va_start( argptr, msg );
- vsprintf( text, msg, argptr );
- va_end( argptr );
-
- trap_Print( text );
-}
-
-void QDECL CG_Error( const char *msg, ... )
-{
- va_list argptr;
- char text[ 1024 ];
-
- va_start( argptr, msg );
- vsprintf( text, msg, argptr );
- va_end( argptr );
-
- trap_Error( text );
-}
-
-void QDECL Com_Error( int level, const char *error, ... )
-{
- va_list argptr;
- char text[1024];
-
- va_start( argptr, error );
- vsprintf( text, error, argptr );
- va_end( argptr );
-
- CG_Error( "%s", text );
-}
-
-void QDECL Com_Printf( const char *msg, ... ) {
- va_list argptr;
- char text[1024];
-
- va_start (argptr, msg);
- vsprintf (text, msg, argptr);
- va_end (argptr);
-
- CG_Printf ("%s", text);
-}
-
-
-
-/*
-================
-CG_Argv
-================
-*/
-const char *CG_Argv( int arg )
-{
- static char buffer[ MAX_STRING_CHARS ];
-
- trap_Argv( arg, buffer, sizeof( buffer ) );
-
- return buffer;
-}
-
-
-//========================================================================
-
-/*
-=================
-CG_FileExists
-
-Test if a specific file exists or not
-=================
-*/
-qboolean CG_FileExists( char *filename )
-{
- fileHandle_t f;
-
- if( trap_FS_FOpenFile( filename, &f, FS_READ ) > 0 )
- {
- //file exists so close it
- trap_FS_FCloseFile( f );
-
- return qtrue;
- }
- else
- return qfalse;
-}
-
-/*
-=================
-CG_RegisterSounds
-
-called during a precache command
-=================
-*/
-static void CG_RegisterSounds( void )
-{
- int i;
- char name[ MAX_QPATH ];
- const char *soundName;
-
- cgs.media.alienStageTransition = trap_S_RegisterSound( "sound/announcements/overmindevolved.wav", qtrue );
- cgs.media.humanStageTransition = trap_S_RegisterSound( "sound/announcements/reinforcement.wav", qtrue );
-
- cgs.media.alienOvermindAttack = trap_S_RegisterSound( "sound/announcements/overmindattack.wav", qtrue );
- cgs.media.alienOvermindDying = trap_S_RegisterSound( "sound/announcements/overminddying.wav", qtrue );
- cgs.media.alienOvermindSpawns = trap_S_RegisterSound( "sound/announcements/overmindspawns.wav", qtrue );
-
- cgs.media.alienL1Grab = trap_S_RegisterSound( "sound/player/level1/grab.wav", qtrue );
- cgs.media.alienL4ChargePrepare = trap_S_RegisterSound( "sound/player/level4/charge_prepare.wav", qtrue );
- cgs.media.alienL4ChargeStart = trap_S_RegisterSound( "sound/player/level4/charge_start.wav", qtrue );
-
- cgs.media.tracerSound = trap_S_RegisterSound( "sound/weapons/tracer.wav", qfalse );
- cgs.media.selectSound = trap_S_RegisterSound( "sound/weapons/change.wav", qfalse );
-
- cgs.media.talkSound = trap_S_RegisterSound( "sound/misc/talk.wav", qfalse );
- cgs.media.alienTalkSound = trap_S_RegisterSound( "sound/misc/alien_talk.wav", qfalse );
- cgs.media.humanTalkSound = trap_S_RegisterSound( "sound/misc/human_talk.wav", qfalse );
- cgs.media.landSound = trap_S_RegisterSound( "sound/player/land1.wav", qfalse );
-
- cgs.media.watrInSound = trap_S_RegisterSound( "sound/player/watr_in.wav", qfalse );
- cgs.media.watrOutSound = trap_S_RegisterSound( "sound/player/watr_out.wav", qfalse );
- cgs.media.watrUnSound = trap_S_RegisterSound( "sound/player/watr_un.wav", qfalse );
-
- cgs.media.disconnectSound = trap_S_RegisterSound( "sound/misc/disconnect.wav", qfalse );
-
- for( i = 0; i < 4; i++ )
- {
- Com_sprintf( name, sizeof( name ), "sound/player/footsteps/step%i.wav", i + 1 );
- cgs.media.footsteps[ FOOTSTEP_NORMAL ][ i ] = trap_S_RegisterSound( name, qfalse );
-
- Com_sprintf( name, sizeof( name ), "sound/player/footsteps/flesh%i.wav", i + 1 );
- cgs.media.footsteps[ FOOTSTEP_FLESH ][ i ] = trap_S_RegisterSound( name, qfalse );
-
- Com_sprintf( name, sizeof( name ), "sound/player/footsteps/splash%i.wav", i + 1 );
- cgs.media.footsteps[ FOOTSTEP_SPLASH ][ i ] = trap_S_RegisterSound( name, qfalse );
-
- Com_sprintf( name, sizeof( name ), "sound/player/footsteps/clank%i.wav", i + 1 );
- cgs.media.footsteps[ FOOTSTEP_METAL ][ i ] = trap_S_RegisterSound( name, qfalse );
- }
-
- for( i = 1 ; i < MAX_SOUNDS ; i++ )
- {
- soundName = CG_ConfigString( CS_SOUNDS + i );
-
- if( !soundName[ 0 ] )
- break;
-
- if( soundName[ 0 ] == '*' )
- continue; // custom sound
-
- cgs.gameSounds[ i ] = trap_S_RegisterSound( soundName, qfalse );
- }
-
- cgs.media.jetpackDescendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/low.wav", qfalse );
- cgs.media.jetpackIdleSound = trap_S_RegisterSound( "sound/upgrades/jetpack/idle.wav", qfalse );
- cgs.media.jetpackAscendSound = trap_S_RegisterSound( "sound/upgrades/jetpack/hi.wav", qfalse );
-
- cgs.media.medkitUseSound = trap_S_RegisterSound( "sound/upgrades/medkit/medkit.wav", qfalse );
-
- cgs.media.alienEvolveSound = trap_S_RegisterSound( "sound/player/alienevolve.wav", qfalse );
-
- cgs.media.alienBuildableExplosion = trap_S_RegisterSound( "sound/buildables/alien/explosion.wav", qfalse );
- cgs.media.alienBuildableDamage = trap_S_RegisterSound( "sound/buildables/alien/damage.wav", qfalse );
- cgs.media.alienBuildablePrebuild = trap_S_RegisterSound( "sound/buildables/alien/prebuild.wav", qfalse );
-
- cgs.media.humanBuildableExplosion = trap_S_RegisterSound( "sound/buildables/human/explosion.wav", qfalse );
- cgs.media.humanBuildablePrebuild = trap_S_RegisterSound( "sound/buildables/human/prebuild.wav", qfalse );
-
- for( i = 0; i < 4; i++ )
- cgs.media.humanBuildableDamage[ i ] = trap_S_RegisterSound(
- va( "sound/buildables/human/damage%d.wav", i ), qfalse );
-
- cgs.media.hardBounceSound1 = trap_S_RegisterSound( "sound/misc/hard_bounce1.wav", qfalse );
- cgs.media.hardBounceSound2 = trap_S_RegisterSound( "sound/misc/hard_bounce2.wav", qfalse );
-
- cgs.media.repeaterUseSound = trap_S_RegisterSound( "sound/buildables/repeater/use.wav", qfalse );
-
- cgs.media.buildableRepairSound = trap_S_RegisterSound( "sound/buildables/human/repair.wav", qfalse );
- cgs.media.buildableRepairedSound = trap_S_RegisterSound( "sound/buildables/human/repaired.wav", qfalse );
-
- cgs.media.lCannonWarningSound = trap_S_RegisterSound( "models/weapons/lcannon/warning.wav", qfalse );
-}
-
-
-//===================================================================================
-
-
-/*
-=================
-CG_RegisterGraphics
-
-This function may execute for a couple of minutes with a slow disk.
-=================
-*/
-static void CG_RegisterGraphics( void )
-{
- int i;
- static char *sb_nums[ 11 ] =
- {
- "gfx/2d/numbers/zero_32b",
- "gfx/2d/numbers/one_32b",
- "gfx/2d/numbers/two_32b",
- "gfx/2d/numbers/three_32b",
- "gfx/2d/numbers/four_32b",
- "gfx/2d/numbers/five_32b",
- "gfx/2d/numbers/six_32b",
- "gfx/2d/numbers/seven_32b",
- "gfx/2d/numbers/eight_32b",
- "gfx/2d/numbers/nine_32b",
- "gfx/2d/numbers/minus_32b",
- };
- static char *buildWeaponTimerPieShaders[ 8 ] =
- {
- "ui/assets/neutral/1_5pie",
- "ui/assets/neutral/3_0pie",
- "ui/assets/neutral/4_5pie",
- "ui/assets/neutral/6_0pie",
- "ui/assets/neutral/7_5pie",
- "ui/assets/neutral/9_0pie",
- "ui/assets/neutral/10_5pie",
- "ui/assets/neutral/12_0pie",
- };
-
- // clear any references to old media
- memset( &cg.refdef, 0, sizeof( cg.refdef ) );
- trap_R_ClearScene( );
-
- trap_R_LoadWorldMap( cgs.mapname );
- CG_UpdateMediaFraction( 0.66f );
-
- for( i = 0; i < 11; i++ )
- cgs.media.numberShaders[ i ] = trap_R_RegisterShader( sb_nums[ i ] );
-
- cgs.media.viewBloodShader = trap_R_RegisterShader( "gfx/damage/fullscreen_painblend" );
-
- cgs.media.connectionShader = trap_R_RegisterShader( "gfx/2d/net" );
-
- cgs.media.creepShader = trap_R_RegisterShader( "creep" );
-
- cgs.media.scannerBlipShader = trap_R_RegisterShader( "gfx/2d/blip" );
- cgs.media.scannerLineShader = trap_R_RegisterShader( "gfx/2d/stalk" );
-
- cgs.media.tracerShader = trap_R_RegisterShader( "gfx/misc/tracer" );
-
- cgs.media.backTileShader = trap_R_RegisterShader( "console" );
-
-
- //TA: building shaders
- cgs.media.greenBuildShader = trap_R_RegisterShader("gfx/misc/greenbuild" );
- cgs.media.redBuildShader = trap_R_RegisterShader("gfx/misc/redbuild" );
- cgs.media.humanSpawningShader = trap_R_RegisterShader("models/buildables/telenode/rep_cyl" );
-
- for( i = 0; i < 8; i++ )
- cgs.media.buildWeaponTimerPie[ i ] = trap_R_RegisterShader( buildWeaponTimerPieShaders[ i ] );
-
- cgs.media.upgradeClassIconShader = trap_R_RegisterShader( "icons/icona_upgrade.tga" );
-
- cgs.media.balloonShader = trap_R_RegisterShader( "gfx/sprites/chatballoon" );
-
- cgs.media.disconnectPS = CG_RegisterParticleSystem( "disconnectPS" );
-
- CG_UpdateMediaFraction( 0.7f );
-
- memset( cg_weapons, 0, sizeof( cg_weapons ) );
- memset( cg_upgrades, 0, sizeof( cg_upgrades ) );
-
- cgs.media.shadowMarkShader = trap_R_RegisterShader( "gfx/marks/shadow" );
- cgs.media.wakeMarkShader = trap_R_RegisterShader( "gfx/marks/wake" );
-
- cgs.media.poisonCloudPS = CG_RegisterParticleSystem( "firstPersonPoisonCloudPS" );
- cgs.media.alienEvolvePS = CG_RegisterParticleSystem( "alienEvolvePS" );
- cgs.media.alienAcidTubePS = CG_RegisterParticleSystem( "alienAcidTubePS" );
-
- cgs.media.jetPackDescendPS = CG_RegisterParticleSystem( "jetPackDescendPS" );
- cgs.media.jetPackHoverPS = CG_RegisterParticleSystem( "jetPackHoverPS" );
- cgs.media.jetPackAscendPS = CG_RegisterParticleSystem( "jetPackAscendPS" );
-
- cgs.media.humanBuildableDamagedPS = CG_RegisterParticleSystem( "humanBuildableDamagedPS" );
- cgs.media.alienBuildableDamagedPS = CG_RegisterParticleSystem( "alienBuildableDamagedPS" );
- cgs.media.humanBuildableDestroyedPS = CG_RegisterParticleSystem( "humanBuildableDestroyedPS" );
- cgs.media.alienBuildableDestroyedPS = CG_RegisterParticleSystem( "alienBuildableDestroyedPS" );
-
- cgs.media.alienBleedPS = CG_RegisterParticleSystem( "alienBleedPS" );
- cgs.media.humanBleedPS = CG_RegisterParticleSystem( "humanBleedPS" );
-
- CG_BuildableStatusParse( "ui/assets/human/buildstat.cfg", &cgs.humanBuildStat );
- CG_BuildableStatusParse( "ui/assets/alien/buildstat.cfg", &cgs.alienBuildStat );
-
- // register the inline models
- cgs.numInlineModels = trap_CM_NumInlineModels( );
-
- for( i = 1; i < cgs.numInlineModels; i++ )
- {
- char name[ 10 ];
- vec3_t mins, maxs;
- int j;
-
- Com_sprintf( name, sizeof( name ), "*%i", i );
-
- cgs.inlineDrawModel[ i ] = trap_R_RegisterModel( name );
- trap_R_ModelBounds( cgs.inlineDrawModel[ i ], mins, maxs );
-
- for( j = 0 ; j < 3 ; j++ )
- cgs.inlineModelMidpoints[ i ][ j ] = mins[ j ] + 0.5 * ( maxs[ j ] - mins[ j ] );
- }
-
- // register all the server specified models
- for( i = 1; i < MAX_MODELS; i++ )
- {
- const char *modelName;
-
- modelName = CG_ConfigString( CS_MODELS + i );
-
- if( !modelName[ 0 ] )
- break;
-
- cgs.gameModels[ i ] = trap_R_RegisterModel( modelName );
- }
-
- CG_UpdateMediaFraction( 0.8f );
-
- // register all the server specified shaders
- for( i = 1; i < MAX_GAME_SHADERS; i++ )
- {
- const char *shaderName;
-
- shaderName = CG_ConfigString( CS_SHADERS + i );
-
- if( !shaderName[ 0 ] )
- break;
-
- cgs.gameShaders[ i ] = trap_R_RegisterShader( shaderName );
- }
-
- CG_UpdateMediaFraction( 0.9f );
-
- // register all the server specified particle systems
- for( i = 1; i < MAX_GAME_PARTICLE_SYSTEMS; i++ )
- {
- const char *psName;
-
- psName = CG_ConfigString( CS_PARTICLE_SYSTEMS + i );
-
- if( !psName[ 0 ] )
- break;
-
- cgs.gameParticleSystems[ i ] = CG_RegisterParticleSystem( (char *)psName );
- }
-}
-
-
-/*
-=======================
-CG_BuildSpectatorString
-
-=======================
-*/
-void CG_BuildSpectatorString( void )
-{
- int i;
-
- cg.spectatorList[ 0 ] = 0;
-
- for( i = 0; i < MAX_CLIENTS; i++ )
- {
- if( cgs.clientinfo[ i ].infoValid && cgs.clientinfo[ i ].team == PTE_NONE )
- Q_strcat( cg.spectatorList, sizeof( cg.spectatorList ), va( "%s " S_COLOR_WHITE, cgs.clientinfo[ i ].name ) );
- }
-
- i = strlen( cg.spectatorList );
-
- if( i != cg.spectatorLen )
- {
- cg.spectatorLen = i;
- cg.spectatorWidth = -1;
- }
-}
-
-
-
-/*
-===================
-CG_RegisterClients
-
-===================
-*/
-static void CG_RegisterClients( void )
-{
- int i;
-
- cg.charModelFraction = 0.0f;
-
- //precache all the models/sounds/etc
- for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
- {
- CG_PrecacheClientInfo( i, BG_FindModelNameForClass( i ),
- BG_FindSkinNameForClass( i ) );
-
- cg.charModelFraction = (float)i / (float)PCL_NUM_CLASSES;
- trap_UpdateScreen( );
- }
-
- cgs.media.larmourHeadSkin = trap_R_RegisterSkin( "models/players/human_base/head_light.skin" );
- cgs.media.larmourLegsSkin = trap_R_RegisterSkin( "models/players/human_base/lower_light.skin" );
- cgs.media.larmourTorsoSkin = trap_R_RegisterSkin( "models/players/human_base/upper_light.skin" );
-
- cgs.media.jetpackModel = trap_R_RegisterModel( "models/players/human_base/jetpack.md3" );
- cgs.media.jetpackFlashModel = trap_R_RegisterModel( "models/players/human_base/jetpack_flash.md3" );
- cgs.media.battpackModel = trap_R_RegisterModel( "models/players/human_base/battpack.md3" );
-
- cg.charModelFraction = 1.0f;
- trap_UpdateScreen( );
-
- //load all the clientinfos of clients already connected to the server
- for( i = 0; i < MAX_CLIENTS; i++ )
- {
- const char *clientInfo;
-
- clientInfo = CG_ConfigString( CS_PLAYERS + i );
- if( !clientInfo[ 0 ] )
- continue;
-
- CG_NewClientInfo( i );
- }
-
- CG_BuildSpectatorString( );
-}
-
-//===========================================================================
-
-/*
-=================
-CG_ConfigString
-=================
-*/
-const char *CG_ConfigString( int index )
-{
- if( index < 0 || index >= MAX_CONFIGSTRINGS )
- CG_Error( "CG_ConfigString: bad index: %i", index );
-
- return cgs.gameState.stringData + cgs.gameState.stringOffsets[ index ];
-}
-
-//==================================================================
-
-/*
-======================
-CG_StartMusic
-
-======================
-*/
-void CG_StartMusic( void )
-{
- char *s;
- char parm1[ MAX_QPATH ], parm2[ MAX_QPATH ];
-
- // start the background music
- s = (char *)CG_ConfigString( CS_MUSIC );
- Q_strncpyz( parm1, COM_Parse( &s ), sizeof( parm1 ) );
- Q_strncpyz( parm2, COM_Parse( &s ), sizeof( parm2 ) );
-
- trap_S_StartBackgroundTrack( parm1, parm2 );
-}
-
-/*
-======================
-CG_PlayerCount
-======================
-*/
-int CG_PlayerCount( void )
-{
- int i, count = 0;
-
- CG_RequestScores( );
-
- for( i = 0; i < cg.numScores; i++ )
- {
- if( cg.scores[ i ].team == PTE_ALIENS ||
- cg.scores[ i ].team == PTE_HUMANS )
- count++;
- }
-
- return count;
-}
-
-//
-// ==============================
-// new hud stuff ( mission pack )
-// ==============================
-//
-char *CG_GetMenuBuffer( const char *filename )
-{
- int len;
- fileHandle_t f;
- static char buf[ MAX_MENUFILE ];
-
- len = trap_FS_FOpenFile( filename, &f, FS_READ );
-
- if( !f )
- {
- trap_Print( va( S_COLOR_RED "menu file not found: %s, using default\n", filename ) );
- return NULL;
- }
-
- if( len >= MAX_MENUFILE )
- {
- trap_Print( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i",
- filename, len, MAX_MENUFILE ) );
- trap_FS_FCloseFile( f );
- return NULL;
- }
-
- trap_FS_Read( buf, len, f );
- buf[len] = 0;
- trap_FS_FCloseFile( f );
-
- return buf;
-}
-
-qboolean CG_Asset_Parse( int handle )
-{
- pc_token_t token;
- const char *tempStr;
-
- if( !trap_Parse_ReadToken( handle, &token ) )
- return qfalse;
-
- if( Q_stricmp( token.string, "{" ) != 0 )
- return qfalse;
-
- while( 1 )
- {
- if( !trap_Parse_ReadToken( handle, &token ) )
- return qfalse;
-
- if( Q_stricmp( token.string, "}" ) == 0 )
- return qtrue;
-
- // font
- if( Q_stricmp( token.string, "font" ) == 0 )
- {
- int pointSize;
-
- if( !PC_String_Parse( handle, &tempStr ) || !PC_Int_Parse( handle, &pointSize ) )
- return qfalse;
-
- cgDC.registerFont( tempStr, pointSize, &cgDC.Assets.textFont );
- continue;
- }
-
- // smallFont
- if( Q_stricmp( token.string, "smallFont" ) == 0 )
- {
- int pointSize;
-
- if( !PC_String_Parse( handle, &tempStr ) || !PC_Int_Parse( handle, &pointSize ) )
- return qfalse;
-
- cgDC.registerFont( tempStr, pointSize, &cgDC.Assets.smallFont );
- continue;
- }
-
- // font
- if( Q_stricmp( token.string, "bigfont" ) == 0 )
- {
- int pointSize;
-
- if( !PC_String_Parse( handle, &tempStr ) || !PC_Int_Parse( handle, &pointSize ) )
- return qfalse;
-
- cgDC.registerFont( tempStr, pointSize, &cgDC.Assets.bigFont );
- continue;
- }
-
- // gradientbar
- if( Q_stricmp( token.string, "gradientbar" ) == 0 )
- {
- if( !PC_String_Parse( handle, &tempStr ) )
- return qfalse;
-
- cgDC.Assets.gradientBar = trap_R_RegisterShaderNoMip( tempStr );
- continue;
- }
-
- // enterMenuSound
- if( Q_stricmp( token.string, "menuEnterSound" ) == 0 )
- {
- if( !PC_String_Parse( handle, &tempStr ) )
- return qfalse;
-
- cgDC.Assets.menuEnterSound = trap_S_RegisterSound( tempStr, qfalse );
- continue;
- }
-
- // exitMenuSound
- if( Q_stricmp( token.string, "menuExitSound" ) == 0 )
- {
- if( !PC_String_Parse( handle, &tempStr ) )
- return qfalse;
-
- cgDC.Assets.menuExitSound = trap_S_RegisterSound( tempStr, qfalse );
- continue;
- }
-
- // itemFocusSound
- if( Q_stricmp( token.string, "itemFocusSound" ) == 0 )
- {
- if( !PC_String_Parse( handle, &tempStr ) )
- return qfalse;
-
- cgDC.Assets.itemFocusSound = trap_S_RegisterSound( tempStr, qfalse );
- continue;
- }
-
- // menuBuzzSound
- if( Q_stricmp( token.string, "menuBuzzSound" ) == 0 )
- {
- if( !PC_String_Parse( handle, &tempStr ) )
- return qfalse;
-
- cgDC.Assets.menuBuzzSound = trap_S_RegisterSound( tempStr, qfalse );
- continue;
- }
-
- if( Q_stricmp( token.string, "cursor" ) == 0 )
- {
- if( !PC_String_Parse( handle, &cgDC.Assets.cursorStr ) )
- return qfalse;
-
- cgDC.Assets.cursor = trap_R_RegisterShaderNoMip( cgDC.Assets.cursorStr );
- continue;
- }
-
- if( Q_stricmp( token.string, "fadeClamp" ) == 0 )
- {
- if( !PC_Float_Parse( handle, &cgDC.Assets.fadeClamp ) )
- return qfalse;
-
- continue;
- }
-
- if( Q_stricmp( token.string, "fadeCycle" ) == 0 )
- {
- if( !PC_Int_Parse( handle, &cgDC.Assets.fadeCycle ) )
- return qfalse;
-
- continue;
- }
-
- if( Q_stricmp( token.string, "fadeAmount" ) == 0 )
- {
- if( !PC_Float_Parse( handle, &cgDC.Assets.fadeAmount ) )
- return qfalse;
-
- continue;
- }
-
- if( Q_stricmp( token.string, "shadowX" ) == 0 )
- {
- if( !PC_Float_Parse( handle, &cgDC.Assets.shadowX ) )
- return qfalse;
-
- continue;
- }
-
- if( Q_stricmp( token.string, "shadowY" ) == 0 )
- {
- if( !PC_Float_Parse( handle, &cgDC.Assets.shadowY ) )
- return qfalse;
-
- continue;
- }
-
- if( Q_stricmp( token.string, "shadowColor" ) == 0 )
- {
- if( !PC_Color_Parse( handle, &cgDC.Assets.shadowColor ) )
- return qfalse;
-
- cgDC.Assets.shadowFadeClamp = cgDC.Assets.shadowColor[ 3 ];
- continue;
- }
- }
-
- return qfalse; // bk001204 - why not?
-}
-
-void CG_ParseMenu( const char *menuFile )
-{
- pc_token_t token;
- int handle;
-
- handle = trap_Parse_LoadSource( menuFile );
-
- if( !handle )
- handle = trap_Parse_LoadSource( "ui/testhud.menu" );
-
- if( !handle )
- return;
-
- while( 1 )
- {
- if( !trap_Parse_ReadToken( handle, &token ) )
- break;
-
- //if ( Q_stricmp( token, "{" ) ) {
- // Com_Printf( "Missing { in menu file\n" );
- // break;
- //}
-
- //if ( menuCount == MAX_MENUS ) {
- // Com_Printf( "Too many menus!\n" );
- // break;
- //}
-
- if( token.string[ 0 ] == '}' )
- break;
-
- if( Q_stricmp( token.string, "assetGlobalDef" ) == 0 )
- {
- if( CG_Asset_Parse( handle ) )
- continue;
- else
- break;
- }
-
-
- if( Q_stricmp( token.string, "menudef" ) == 0 )
- {
- // start a new menu
- Menu_New( handle );
- }
- }
-
- trap_Parse_FreeSource( handle );
-}
-
-qboolean CG_Load_Menu( char **p )
-{
- char *token;
-
- token = COM_ParseExt( p, qtrue );
-
- if( token[ 0 ] != '{' )
- return qfalse;
-
- while( 1 )
- {
- token = COM_ParseExt( p, qtrue );
-
- if( Q_stricmp( token, "}" ) == 0 )
- return qtrue;
-
- if( !token || token[ 0 ] == 0 )
- return qfalse;
-
- CG_ParseMenu( token );
- }
- return qfalse;
-}
-
-
-
-void CG_LoadMenus( const char *menuFile )
-{
- char *token;
- char *p;
- int len, start;
- fileHandle_t f;
- static char buf[ MAX_MENUDEFFILE ];
-
- start = trap_Milliseconds( );
-
- len = trap_FS_FOpenFile( menuFile, &f, FS_READ );
-
- if( !f )
- {
- trap_Error( va( S_COLOR_YELLOW "menu file not found: %s, using default\n", menuFile ) );
- len = trap_FS_FOpenFile( "ui/hud.txt", &f, FS_READ );
-
- if( !f )
- trap_Error( va( S_COLOR_RED "default menu file not found: ui/hud.txt, unable to continue!\n" ) );
- }
-
- if( len >= MAX_MENUDEFFILE )
- {
- trap_Error( va( S_COLOR_RED "menu file too large: %s is %i, max allowed is %i",
- menuFile, len, MAX_MENUDEFFILE ) );
- trap_FS_FCloseFile( f );
- return;
- }
-
- trap_FS_Read( buf, len, f );
- buf[ len ] = 0;
- trap_FS_FCloseFile( f );
-
- COM_Compress( buf );
-
- Menu_Reset( );
-
- p = buf;
-
- while( 1 )
- {
- token = COM_ParseExt( &p, qtrue );
-
- if( !token || token[ 0 ] == 0 || token[ 0 ] == '}' )
- break;
-
- if( Q_stricmp( token, "}" ) == 0 )
- break;
-
- if( Q_stricmp( token, "loadmenu" ) == 0 )
- {
- if( CG_Load_Menu( &p ) )
- continue;
- else
- break;
- }
- }
-
- Com_Printf( "UI menu load time = %d milli seconds\n", trap_Milliseconds( ) - start );
-}
-
-
-
-static qboolean CG_OwnerDrawHandleKey( int ownerDraw, int flags, float *special, int key )
-{
- return qfalse;
-}
-
-
-static int CG_FeederCount( float feederID )
-{
- int i, count = 0;
-
- if( feederID == FEEDER_ALIENTEAM_LIST )
- {
- for( i = 0; i < cg.numScores; i++ )
- {
- if( cg.scores[ i ].team == PTE_ALIENS )
- count++;
- }
- }
- else if( feederID == FEEDER_HUMANTEAM_LIST )
- {
- for( i = 0; i < cg.numScores; i++ )
- {
- if( cg.scores[ i ].team == PTE_HUMANS )
- count++;
- }
- }
-
- return count;
-}
-
-
-void CG_SetScoreSelection( void *p )
-{
- menuDef_t *menu = (menuDef_t*)p;
- playerState_t *ps = &cg.snap->ps;
- int i, alien, human;
- int feeder;
-
- alien = human = 0;
-
- for( i = 0; i < cg.numScores; i++ )
- {
- if( cg.scores[ i ].team == PTE_ALIENS )
- alien++;
- else if( cg.scores[ i ].team == PTE_HUMANS )
- human++;
-
- if( ps->clientNum == cg.scores[ i ].client )
- cg.selectedScore = i;
- }
-
- if( menu == NULL )
- // just interested in setting the selected score
- return;
-
- feeder = FEEDER_ALIENTEAM_LIST;
- i = alien;
-
- if( cg.scores[ cg.selectedScore ].team == PTE_HUMANS )
- {
- feeder = FEEDER_HUMANTEAM_LIST;
- i = human;
- }
-
- Menu_SetFeederSelection(menu, feeder, i, NULL);
-}
-
-// FIXME: might need to cache this info
-static clientInfo_t * CG_InfoFromScoreIndex( int index, int team, int *scoreIndex )
-{
- int i, count;
- count = 0;
-
- for( i = 0; i < cg.numScores; i++ )
- {
- if( cg.scores[ i ].team == team )
- {
- if( count == index )
- {
- *scoreIndex = i;
- return &cgs.clientinfo[ cg.scores[ i ].client ];
- }
- count++;
- }
- }
-
- *scoreIndex = index;
- return &cgs.clientinfo[ cg.scores[ index ].client ];
-}
-
-static const char *CG_FeederItemText( float feederID, int index, int column, qhandle_t *handle )
-{
- int scoreIndex = 0;
- clientInfo_t *info = NULL;
- int team = -1;
- score_t *sp = NULL;
- qboolean showIcons = qfalse;
-
- *handle = -1;
-
- if( feederID == FEEDER_ALIENTEAM_LIST )
- team = PTE_ALIENS;
- else if( feederID == FEEDER_HUMANTEAM_LIST )
- team = PTE_HUMANS;
-
- info = CG_InfoFromScoreIndex( index, team, &scoreIndex );
- sp = &cg.scores[ scoreIndex ];
-
- if( ( atoi( CG_ConfigString( CS_CLIENTS_READY ) ) & ( 1 << sp->client ) ) &&
- cg.intermissionStarted )
- showIcons = qfalse;
- else if( cg.snap->ps.pm_type == PM_SPECTATOR || cg.snap->ps.pm_flags & PMF_FOLLOW ||
- team == cg.snap->ps.stats[ STAT_PTEAM ] || cg.intermissionStarted )
- showIcons = qtrue;
-
- if( info && info->infoValid )
- {
- switch( column )
- {
- case 0:
- if( showIcons )
- {
- if( sp->weapon != WP_NONE )
- *handle = cg_weapons[ sp->weapon ].weaponIcon;
- }
- break;
-
- case 1:
- if( showIcons )
- {
- if( sp->team == PTE_HUMANS && sp->upgrade != UP_NONE )
- *handle = cg_upgrades[ sp->upgrade ].upgradeIcon;
- else if( sp->team == PTE_ALIENS )
- {
- switch( sp->weapon )
- {
- case WP_ABUILD2:
- case WP_ALEVEL1_UPG:
- case WP_ALEVEL2_UPG:
- case WP_ALEVEL3_UPG:
- *handle = cgs.media.upgradeClassIconShader;
- break;
-
- default:
- break;
- }
- }
- }
- break;
-
- case 2:
- if( ( atoi( CG_ConfigString( CS_CLIENTS_READY ) ) & ( 1 << sp->client ) ) &&
- cg.intermissionStarted )
- return "Ready";
- break;
-
- case 3:
- return info->name;
- break;
-
- case 4:
- return va( "%d", info->score );
- break;
-
- case 5:
- return va( "%4d", sp->time );
- break;
-
- case 6:
- if( sp->ping == -1 )
- return "connecting";
-
- return va( "%4d", sp->ping );
- break;
- }
- }
-
- return "";
-}
-
-static qhandle_t CG_FeederItemImage( float feederID, int index )
-{
- return 0;
-}
-
-static void CG_FeederSelection( float feederID, int index )
-{
- int i, count;
- int team = ( feederID == FEEDER_ALIENTEAM_LIST ) ? PTE_ALIENS : PTE_HUMANS;
- count = 0;
-
- for( i = 0; i < cg.numScores; i++ )
- {
- if( cg.scores[ i ].team == team )
- {
- if( index == count )
- cg.selectedScore = i;
-
- count++;
- }
- }
-}
-
-static float CG_Cvar_Get( const char *cvar )
-{
- char buff[ 128 ];
-
- memset( buff, 0, sizeof( buff ) );
- trap_Cvar_VariableStringBuffer( cvar, buff, sizeof( buff ) );
- return atof( buff );
-}
-
-void CG_Text_PaintWithCursor( float x, float y, float scale, vec4_t color, const char *text,
- int cursorPos, char cursor, int limit, int style )
-{
- CG_Text_Paint( x, y, scale, color, text, 0, limit, style );
-}
-
-static int CG_OwnerDrawWidth( int ownerDraw, float scale )
-{
- switch( ownerDraw )
- {
- case CG_KILLER:
- return CG_Text_Width( CG_GetKillerText( ), scale, 0 );
- break;
- }
-
- return 0;
-}
-
-static int CG_PlayCinematic( const char *name, float x, float y, float w, float h )
-{
- return trap_CIN_PlayCinematic( name, x, y, w, h, CIN_loop );
-}
-
-static void CG_StopCinematic( int handle )
-{
- trap_CIN_StopCinematic( handle );
-}
-
-static void CG_DrawCinematic( int handle, float x, float y, float w, float h )
-{
- trap_CIN_SetExtents( handle, x, y, w, h );
- trap_CIN_DrawCinematic( handle );
-}
-
-static void CG_RunCinematicFrame( int handle )
-{
- trap_CIN_RunCinematic( handle );
-}
-
-//TA: hack to prevent warning
-static qboolean CG_OwnerDrawVisible( int parameter )
-{
- return qfalse;
-}
-
-/*
-=================
-CG_LoadHudMenu
-=================
-*/
-void CG_LoadHudMenu( void )
-{
- char buff[ 1024 ];
- const char *hudSet;
-
- cgDC.registerShaderNoMip = &trap_R_RegisterShaderNoMip;
- cgDC.setColor = &trap_R_SetColor;
- cgDC.drawHandlePic = &CG_DrawPic;
- cgDC.drawStretchPic = &trap_R_DrawStretchPic;
- cgDC.drawText = &CG_Text_Paint;
- cgDC.textWidth = &CG_Text_Width;
- cgDC.textHeight = &CG_Text_Height;
- cgDC.registerModel = &trap_R_RegisterModel;
- cgDC.modelBounds = &trap_R_ModelBounds;
- cgDC.fillRect = &CG_FillRect;
- cgDC.drawRect = &CG_DrawRect;
- cgDC.drawSides = &CG_DrawSides;
- cgDC.drawTopBottom = &CG_DrawTopBottom;
- cgDC.clearScene = &trap_R_ClearScene;
- cgDC.addRefEntityToScene = &trap_R_AddRefEntityToScene;
- cgDC.renderScene = &trap_R_RenderScene;
- cgDC.registerFont = &trap_R_RegisterFont;
- cgDC.ownerDrawItem = &CG_OwnerDraw;
- cgDC.getValue = &CG_GetValue;
- cgDC.ownerDrawVisible = &CG_OwnerDrawVisible;
- cgDC.runScript = &CG_RunMenuScript;
- cgDC.getTeamColor = &CG_GetTeamColor;
- cgDC.setCVar = trap_Cvar_Set;
- cgDC.getCVarString = trap_Cvar_VariableStringBuffer;
- cgDC.getCVarValue = CG_Cvar_Get;
- cgDC.drawTextWithCursor = &CG_Text_PaintWithCursor;
- //cgDC.setOverstrikeMode = &trap_Key_SetOverstrikeMode;
- //cgDC.getOverstrikeMode = &trap_Key_GetOverstrikeMode;
- cgDC.startLocalSound = &trap_S_StartLocalSound;
- cgDC.ownerDrawHandleKey = &CG_OwnerDrawHandleKey;
- cgDC.feederCount = &CG_FeederCount;
- cgDC.feederItemImage = &CG_FeederItemImage;
- cgDC.feederItemText = &CG_FeederItemText;
- cgDC.feederSelection = &CG_FeederSelection;
- //cgDC.setBinding = &trap_Key_SetBinding;
- //cgDC.getBindingBuf = &trap_Key_GetBindingBuf;
- //cgDC.keynumToStringBuf = &trap_Key_KeynumToStringBuf;
- //cgDC.executeText = &trap_Cmd_ExecuteText;
- cgDC.Error = &Com_Error;
- cgDC.Print = &Com_Printf;
- cgDC.ownerDrawWidth = &CG_OwnerDrawWidth;
- //cgDC.Pause = &CG_Pause;
- cgDC.registerSound = &trap_S_RegisterSound;
- cgDC.startBackgroundTrack = &trap_S_StartBackgroundTrack;
- cgDC.stopBackgroundTrack = &trap_S_StopBackgroundTrack;
- cgDC.playCinematic = &CG_PlayCinematic;
- cgDC.stopCinematic = &CG_StopCinematic;
- cgDC.drawCinematic = &CG_DrawCinematic;
- cgDC.runCinematicFrame = &CG_RunCinematicFrame;
-
- Init_Display( &cgDC );
-
- Menu_Reset( );
-
- trap_Cvar_VariableStringBuffer( "cg_hudFiles", buff, sizeof( buff ) );
- hudSet = buff;
-
- if( hudSet[ 0 ] == '\0' )
- hudSet = "ui/hud.txt";
-
- CG_LoadMenus( hudSet );
-}
-
-void CG_AssetCache( void )
-{
- cgDC.Assets.gradientBar = trap_R_RegisterShaderNoMip( ASSET_GRADIENTBAR );
- cgDC.Assets.scrollBar = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR );
- cgDC.Assets.scrollBarArrowDown = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWDOWN );
- cgDC.Assets.scrollBarArrowUp = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWUP );
- cgDC.Assets.scrollBarArrowLeft = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWLEFT );
- cgDC.Assets.scrollBarArrowRight = trap_R_RegisterShaderNoMip( ASSET_SCROLLBAR_ARROWRIGHT );
- cgDC.Assets.scrollBarThumb = trap_R_RegisterShaderNoMip( ASSET_SCROLL_THUMB );
- cgDC.Assets.sliderBar = trap_R_RegisterShaderNoMip( ASSET_SLIDER_BAR );
- cgDC.Assets.sliderThumb = trap_R_RegisterShaderNoMip( ASSET_SLIDER_THUMB );
-}
-
-/*
-=================
-CG_Init
-
-Called after every level change or subsystem restart
-Will perform callbacks to make the loading info screen update.
-=================
-*/
-void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum )
-{
- const char *s;
-
- // clear everything
- memset( &cgs, 0, sizeof( cgs ) );
- memset( &cg, 0, sizeof( cg ) );
- memset( &cg.pmext, 0, sizeof( cg.pmext ) );
- memset( cg_entities, 0, sizeof( cg_entities ) );
-
- cg.clientNum = clientNum;
-
- cgs.processedSnapshotNum = serverMessageNum;
- cgs.serverCommandSequence = serverCommandSequence;
-
- // load a few needed things before we do any screen updates
- cgs.media.whiteShader = trap_R_RegisterShader( "white" );
- cgs.media.charsetShader = trap_R_RegisterShader( "gfx/2d/bigchars" );
- cgs.media.outlineShader = trap_R_RegisterShader( "outline" );
-
- //inform UI to repress cursor whilst loading
- trap_Cvar_Set( "ui_loading", "1" );
-
- //TA: load overrides
- BG_InitClassOverrides( );
- BG_InitBuildableOverrides( );
- BG_InitAllowedGameElements( );
-
- //TA: dyn memory
- CG_InitMemory( );
-
- CG_RegisterCvars( );
-
- CG_InitConsoleCommands( );
-
- //TA: moved up for LoadHudMenu
- String_Init( );
-
- //TA: TA UI
- CG_AssetCache( );
- CG_LoadHudMenu( ); // load new hud stuff
-
- cg.weaponSelect = WP_NONE;
-
- // old servers
-
- // get the rendering configuration from the client system
- trap_GetGlconfig( &cgs.glconfig );
- cgs.screenXScale = cgs.glconfig.vidWidth / 640.0;
- cgs.screenYScale = cgs.glconfig.vidHeight / 480.0;
-
- // get the gamestate from the client system
- trap_GetGameState( &cgs.gameState );
-
- // check version
- s = CG_ConfigString( CS_GAME_VERSION );
-
- if( strcmp( s, GAME_VERSION ) )
- CG_Error( "Client/Server game mismatch: %s/%s", GAME_VERSION, s );
-
- s = CG_ConfigString( CS_LEVEL_START_TIME );
- cgs.levelStartTime = atoi( s );
-
- CG_ParseServerinfo( );
-
- // load the new map
- trap_CM_LoadMap( cgs.mapname );
-
- cg.loading = qtrue; // force players to load instead of defer
-
- CG_LoadTrailSystems( );
- CG_UpdateMediaFraction( 0.05f );
-
- CG_LoadParticleSystems( );
- CG_UpdateMediaFraction( 0.05f );
-
- CG_RegisterSounds( );
- CG_UpdateMediaFraction( 0.60f );
-
- CG_RegisterGraphics( );
- CG_UpdateMediaFraction( 0.90f );
-
- CG_InitWeapons( );
- CG_UpdateMediaFraction( 0.95f );
-
- CG_InitUpgrades( );
- CG_UpdateMediaFraction( 1.0f );
-
- //TA:
- CG_InitBuildables( );
-
- CG_RegisterClients( ); // if low on memory, some clients will be deferred
-
- cg.loading = qfalse; // future players will be deferred
-
- CG_InitMarkPolys( );
-
- // remove the last loading update
- cg.infoScreenText[ 0 ] = 0;
-
- // Make sure we have update values (scores)
- CG_SetConfigValues( );
-
- CG_StartMusic( );
-
- CG_ShaderStateChanged( );
-
- trap_S_ClearLoopingSounds( qtrue );
-
- trap_Cvar_Set( "ui_loading", "0" );
-}
-
-/*
-=================
-CG_Shutdown
-
-Called before every level change or subsystem restart
-=================
-*/
-void CG_Shutdown( void )
-{
- // some mods may need to do cleanup work here,
- // like closing files or archiving session data
-}
diff --git a/src/cgame/cg_marks.c b/src/cgame/cg_marks.c
deleted file mode 100644
index 380f1f0..0000000
--- a/src/cgame/cg_marks.c
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_marks.c -- wall marks
-
-
-#include "cg_local.h"
-
-/*
-===================================================================
-
-MARK POLYS
-
-===================================================================
-*/
-
-
-markPoly_t cg_activeMarkPolys; // double linked list
-markPoly_t *cg_freeMarkPolys; // single linked list
-markPoly_t cg_markPolys[ MAX_MARK_POLYS ];
-static int markTotal;
-
-/*
-===================
-CG_InitMarkPolys
-
-This is called at startup and for tournement restarts
-===================
-*/
-void CG_InitMarkPolys( void )
-{
- int i;
-
- memset( cg_markPolys, 0, sizeof( cg_markPolys ) );
-
- cg_activeMarkPolys.nextMark = &cg_activeMarkPolys;
- cg_activeMarkPolys.prevMark = &cg_activeMarkPolys;
- cg_freeMarkPolys = cg_markPolys;
-
- for( i = 0; i < MAX_MARK_POLYS - 1; i++ )
- cg_markPolys[ i ].nextMark = &cg_markPolys[ i + 1 ];
-}
-
-
-/*
-==================
-CG_FreeMarkPoly
-==================
-*/
-void CG_FreeMarkPoly( markPoly_t *le )
-{
- if( !le->prevMark )
- CG_Error( "CG_FreeLocalEntity: not active" );
-
- // remove from the doubly linked active list
- le->prevMark->nextMark = le->nextMark;
- le->nextMark->prevMark = le->prevMark;
-
- // the free list is only singly linked
- le->nextMark = cg_freeMarkPolys;
- cg_freeMarkPolys = le;
-}
-
-/*
-===================
-CG_AllocMark
-
-Will allways succeed, even if it requires freeing an old active mark
-===================
-*/
-markPoly_t *CG_AllocMark( void )
-{
- markPoly_t *le;
- int time;
-
- if( !cg_freeMarkPolys )
- {
- // no free entities, so free the one at the end of the chain
- // remove the oldest active entity
- time = cg_activeMarkPolys.prevMark->time;
-
- while( cg_activeMarkPolys.prevMark && time == cg_activeMarkPolys.prevMark->time )
- CG_FreeMarkPoly( cg_activeMarkPolys.prevMark );
- }
-
- le = cg_freeMarkPolys;
- cg_freeMarkPolys = cg_freeMarkPolys->nextMark;
-
- memset( le, 0, sizeof( *le ) );
-
- // link into the active list
- le->nextMark = cg_activeMarkPolys.nextMark;
- le->prevMark = &cg_activeMarkPolys;
- cg_activeMarkPolys.nextMark->prevMark = le;
- cg_activeMarkPolys.nextMark = le;
- return le;
-}
-
-
-
-/*
-=================
-CG_ImpactMark
-
-origin should be a point within a unit of the plane
-dir should be the plane normal
-
-temporary marks will not be stored or randomly oriented, but immediately
-passed to the renderer.
-=================
-*/
-#define MAX_MARK_FRAGMENTS 128
-#define MAX_MARK_POINTS 384
-
-void CG_ImpactMark( qhandle_t markShader, const vec3_t origin, const vec3_t dir,
- float orientation, float red, float green, float blue, float alpha,
- qboolean alphaFade, float radius, qboolean temporary )
-{
- vec3_t axis[ 3 ];
- float texCoordScale;
- vec3_t originalPoints[ 4 ];
- byte colors[ 4 ];
- int i, j;
- int numFragments;
- markFragment_t markFragments[ MAX_MARK_FRAGMENTS ], *mf;
- vec3_t markPoints[ MAX_MARK_POINTS ];
- vec3_t projection;
-
- if( !cg_addMarks.integer )
- return;
-
- if( radius <= 0 )
- CG_Error( "CG_ImpactMark called with <= 0 radius" );
-
- //if ( markTotal >= MAX_MARK_POLYS ) {
- // return;
- //}
-
- // create the texture axis
- VectorNormalize2( dir, axis[ 0 ] );
- PerpendicularVector( axis[ 1 ], axis[ 0 ] );
- RotatePointAroundVector( axis[ 2 ], axis[ 0 ], axis[ 1 ], orientation );
- CrossProduct( axis[ 0 ], axis[ 2 ], axis[ 1 ] );
-
- texCoordScale = 0.5 * 1.0 / radius;
-
- // create the full polygon
- for( i = 0; i < 3; i++ )
- {
- originalPoints[ 0 ][ i ] = origin[ i ] - radius * axis[ 1 ][ i ] - radius * axis[ 2 ][ i ];
- originalPoints[ 1 ][ i ] = origin[ i ] + radius * axis[ 1 ][ i ] - radius * axis[ 2 ][ i ];
- originalPoints[ 2 ][ i ] = origin[ i ] + radius * axis[ 1 ][ i ] + radius * axis[ 2 ][ i ];
- originalPoints[ 3 ][ i ] = origin[ i ] - radius * axis[ 1 ][ i ] + radius * axis[ 2 ][ i ];
- }
-
- // get the fragments
- VectorScale( dir, -20, projection );
- numFragments = trap_CM_MarkFragments( 4, (void *)originalPoints,
- projection, MAX_MARK_POINTS, markPoints[ 0 ],
- MAX_MARK_FRAGMENTS, markFragments );
-
- colors[ 0 ] = red * 255;
- colors[ 1 ] = green * 255;
- colors[ 2 ] = blue * 255;
- colors[ 3 ] = alpha * 255;
-
- for( i = 0, mf = markFragments; i < numFragments; i++, mf++ )
- {
- polyVert_t *v;
- polyVert_t verts[ MAX_VERTS_ON_POLY ];
- markPoly_t *mark;
-
- // we have an upper limit on the complexity of polygons
- // that we store persistantly
- if( mf->numPoints > MAX_VERTS_ON_POLY )
- mf->numPoints = MAX_VERTS_ON_POLY;
-
- for( j = 0, v = verts; j < mf->numPoints; j++, v++ )
- {
- vec3_t delta;
-
- VectorCopy( markPoints[ mf->firstPoint + j ], v->xyz );
-
- VectorSubtract( v->xyz, origin, delta );
- v->st[ 0 ] = 0.5 + DotProduct( delta, axis[ 1 ] ) * texCoordScale;
- v->st[ 1 ] = 0.5 + DotProduct( delta, axis[ 2 ] ) * texCoordScale;
- *(int *)v->modulate = *(int *)colors;
- }
-
- // if it is a temporary (shadow) mark, add it immediately and forget about it
- if( temporary )
- {
- trap_R_AddPolyToScene( markShader, mf->numPoints, verts );
- continue;
- }
-
- // otherwise save it persistantly
- mark = CG_AllocMark( );
- mark->time = cg.time;
- mark->alphaFade = alphaFade;
- mark->markShader = markShader;
- mark->poly.numVerts = mf->numPoints;
- mark->color[ 0 ] = red;
- mark->color[ 1 ] = green;
- mark->color[ 2 ] = blue;
- mark->color[ 3 ] = alpha;
- memcpy( mark->verts, verts, mf->numPoints * sizeof( verts[ 0 ] ) );
- markTotal++;
- }
-}
-
-
-/*
-===============
-CG_AddMarks
-===============
-*/
-#define MARK_TOTAL_TIME 10000
-#define MARK_FADE_TIME 1000
-
-void CG_AddMarks( void )
-{
- int j;
- markPoly_t *mp, *next;
- int t;
- int fade;
-
- if( !cg_addMarks.integer )
- return;
-
- mp = cg_activeMarkPolys.nextMark;
- for ( ; mp != &cg_activeMarkPolys; mp = next )
- {
- // grab next now, so if the local entity is freed we
- // still have it
- next = mp->nextMark;
-
- // see if it is time to completely remove it
- if( cg.time > mp->time + MARK_TOTAL_TIME )
- {
- CG_FreeMarkPoly( mp );
- continue;
- }
-
- // fade all marks out with time
- t = mp->time + MARK_TOTAL_TIME - cg.time;
- if( t < MARK_FADE_TIME )
- {
- fade = 255 * t / MARK_FADE_TIME;
- if( mp->alphaFade )
- {
- for( j = 0; j < mp->poly.numVerts; j++ )
- mp->verts[ j ].modulate[ 3 ] = fade;
- }
- else
- {
- for( j = 0; j < mp->poly.numVerts; j++ )
- {
- mp->verts[ j ].modulate[ 0 ] = mp->color[ 0 ] * fade;
- mp->verts[ j ].modulate[ 1 ] = mp->color[ 1 ] * fade;
- mp->verts[ j ].modulate[ 2 ] = mp->color[ 2 ] * fade;
- }
- }
- }
-
- trap_R_AddPolyToScene( mp->markShader, mp->poly.numVerts, mp->verts );
- }
-}
-
diff --git a/src/cgame/cg_mem.c b/src/cgame/cg_mem.c
deleted file mode 100644
index 6cf5ddd..0000000
--- a/src/cgame/cg_mem.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "cg_local.h"
-
-#define POOLSIZE (256 * 1024)
-#define FREEMEMCOOKIE ((int)0xDEADBE3F) // Any unlikely to be used value
-#define ROUNDBITS 31 // Round to 32 bytes
-
-struct freememnode
-{
- // Size of ROUNDBITS
- int cookie, size; // Size includes node (obviously)
- struct freememnode *prev, *next;
-};
-
-static char memoryPool[ POOLSIZE ];
-static struct freememnode *freehead;
-static int freemem;
-
-void *CG_Alloc( int size )
-{
- // Find a free block and allocate.
- // Does two passes, attempts to fill same-sized free slot first.
-
- struct freememnode *fmn, *prev, *next, *smallest;
- int allocsize, smallestsize;
- char *endptr;
- int *ptr;
-
- allocsize = ( size + sizeof(int) + ROUNDBITS ) & ~ROUNDBITS; // Round to 32-byte boundary
- ptr = NULL;
-
- smallest = NULL;
- smallestsize = POOLSIZE + 1; // Guaranteed not to miss any slots :)
- for( fmn = freehead; fmn; fmn = fmn->next )
- {
- if( fmn->cookie != FREEMEMCOOKIE )
- CG_Error( "CG_Alloc: Memory corruption detected!\n" );
-
- if( fmn->size >= allocsize )
- {
- // We've got a block
- if( fmn->size == allocsize )
- {
- // Same size, just remove
-
- prev = fmn->prev;
- next = fmn->next;
- if( prev )
- prev->next = next; // Point previous node to next
- if( next )
- next->prev = prev; // Point next node to previous
- if( fmn == freehead )
- freehead = next; // Set head pointer to next
- ptr = (int *) fmn;
- break; // Stop the loop, this is fine
- }
- else
- {
- // Keep track of the smallest free slot
- if( fmn->size < smallestsize )
- {
- smallest = fmn;
- smallestsize = fmn->size;
- }
- }
- }
- }
-
- if( !ptr && smallest )
- {
- // We found a slot big enough
- smallest->size -= allocsize;
- endptr = (char *) smallest + smallest->size;
- ptr = (int *) endptr;
- }
-
- if( ptr )
- {
- freemem -= allocsize;
- if( cg_debugAlloc.integer )
- CG_Printf( "CG_Alloc of %i bytes (%i left)\n", allocsize, freemem );
- memset( ptr, 0, allocsize );
- *ptr++ = allocsize; // Store a copy of size for deallocation
- return( (void *) ptr );
- }
-
- CG_Error( "CG_Alloc: failed on allocation of %i bytes\n", size );
- return( NULL );
-}
-
-void CG_Free( void *ptr )
-{
- // Release allocated memory, add it to the free list.
-
- struct freememnode *fmn;
- char *freeend;
- int *freeptr;
-
- freeptr = ptr;
- freeptr--;
-
- freemem += *freeptr;
- if( cg_debugAlloc.integer )
- CG_Printf( "CG_Free of %i bytes (%i left)\n", *freeptr, freemem );
-
- for( fmn = freehead; fmn; fmn = fmn->next )
- {
- freeend = ((char *) fmn) + fmn->size;
- if( freeend == (char *) freeptr )
- {
- // Released block can be merged to an existing node
-
- fmn->size += *freeptr; // Add size of node.
- return;
- }
- }
- // No merging, add to head of list
-
- fmn = (struct freememnode *) freeptr;
- fmn->size = *freeptr; // Set this first to avoid corrupting *freeptr
- fmn->cookie = FREEMEMCOOKIE;
- fmn->prev = NULL;
- fmn->next = freehead;
- freehead->prev = fmn;
- freehead = fmn;
-}
-
-void CG_InitMemory( void )
-{
- // Set up the initial node
-
- freehead = (struct freememnode *) memoryPool;
- freehead->cookie = FREEMEMCOOKIE;
- freehead->size = POOLSIZE;
- freehead->next = NULL;
- freehead->prev = NULL;
- freemem = sizeof(memoryPool);
-}
-
-void CG_DefragmentMemory( void )
-{
- // If there's a frenzy of deallocation and we want to
- // allocate something big, this is useful. Otherwise...
- // not much use.
-
- struct freememnode *startfmn, *endfmn, *fmn;
-
- for( startfmn = freehead; startfmn; )
- {
- endfmn = (struct freememnode *)(((char *) startfmn) + startfmn->size);
- for( fmn = freehead; fmn; )
- {
- if( fmn->cookie != FREEMEMCOOKIE )
- CG_Error( "CG_DefragmentMemory: Memory corruption detected!\n" );
-
- if( fmn == endfmn )
- {
- // We can add fmn onto startfmn.
-
- if( fmn->prev )
- fmn->prev->next = fmn->next;
- if( fmn->next )
- {
- if( !(fmn->next->prev = fmn->prev) )
- freehead = fmn->next; // We're removing the head node
- }
- startfmn->size += fmn->size;
- memset( fmn, 0, sizeof(struct freememnode) ); // A redundant call, really.
-
- startfmn = freehead;
- endfmn = fmn = NULL; // Break out of current loop
- }
- else
- fmn = fmn->next;
- }
-
- if( endfmn )
- startfmn = startfmn->next; // endfmn acts as a 'restart' flag here
- }
-}
diff --git a/src/cgame/cg_particles.c b/src/cgame/cg_particles.c
deleted file mode 100644
index 80c4b23..0000000
--- a/src/cgame/cg_particles.c
+++ /dev/null
@@ -1,2567 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_particles.c -- the particle system
-
-
-#include "cg_local.h"
-
-static baseParticleSystem_t baseParticleSystems[ MAX_BASEPARTICLE_SYSTEMS ];
-static baseParticleEjector_t baseParticleEjectors[ MAX_BASEPARTICLE_EJECTORS ];
-static baseParticle_t baseParticles[ MAX_BASEPARTICLES ];
-static int numBaseParticleSystems = 0;
-static int numBaseParticleEjectors = 0;
-static int numBaseParticles = 0;
-
-static particleSystem_t particleSystems[ MAX_PARTICLE_SYSTEMS ];
-static particleEjector_t particleEjectors[ MAX_PARTICLE_EJECTORS ];
-static particle_t particles[ MAX_PARTICLES ];
-static particle_t *sortedParticles[ MAX_PARTICLES ];
-static particle_t *radixBuffer[ MAX_PARTICLES ];
-
-/*
-===============
-CG_LerpValues
-
-Lerp between two values
-===============
-*/
-static float CG_LerpValues( float a, float b, float f )
-{
- if( b == PARTICLES_SAME_AS_INITIAL )
- return a;
- else
- return ( (a) + (f) * ( (b) - (a) ) );
-}
-
-/*
-===============
-CG_RandomiseValue
-
-Randomise some value by some variance
-===============
-*/
-static float CG_RandomiseValue( float value, float variance )
-{
- if( value != 0.0f )
- return value * ( 1.0f + ( random( ) * variance ) );
- else
- return random( ) * variance;
-}
-
-/*
-===============
-CG_SpreadVector
-
-Randomly spread a vector by some amount
-===============
-*/
-static void CG_SpreadVector( vec3_t v, float spread )
-{
- vec3_t p, r1, r2;
- float randomSpread = crandom( ) * spread;
- float randomRotation = random( ) * 360.0f;
-
- PerpendicularVector( p, v );
-
- RotatePointAroundVector( r1, p, v, randomSpread );
- RotatePointAroundVector( r2, v, r1, randomRotation );
-
- VectorCopy( r2, v );
-}
-
-/*
-===============
-CG_DestroyParticle
-
-Destroy an individual particle
-===============
-*/
-static void CG_DestroyParticle( particle_t *p, vec3_t impactNormal )
-{
- //this particle has an onDeath particle system attached
- if( p->class->onDeathSystemName[ 0 ] != '\0' )
- {
- particleSystem_t *ps;
-
- ps = CG_SpawnNewParticleSystem( p->class->onDeathSystemHandle );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- if( impactNormal )
- CG_SetParticleSystemNormal( ps, impactNormal );
-
- CG_SetAttachmentPoint( &ps->attachment, p->origin );
- CG_AttachToPoint( &ps->attachment );
- }
- }
-
- p->valid = qfalse;
-
- //this gives other systems a couple of
- //frames to realise the particle is gone
- p->frameWhenInvalidated = cg.clientFrame;
-}
-
-/*
-===============
-CG_SpawnNewParticle
-
-Introduce a new particle into the world
-===============
-*/
-static particle_t *CG_SpawnNewParticle( baseParticle_t *bp, particleEjector_t *parent )
-{
- int i, j;
- particle_t *p = NULL;
- particleEjector_t *pe = parent;
- particleSystem_t *ps = parent->parent;
- vec3_t attachmentPoint, attachmentVelocity;
- vec3_t transform[ 3 ];
-
- for( i = 0; i < MAX_PARTICLES; i++ )
- {
- p = &particles[ i ];
-
- //FIXME: the + 1 may be unnecessary
- if( !p->valid && cg.clientFrame > p->frameWhenInvalidated + 1 )
- {
- memset( p, 0, sizeof( particle_t ) );
-
- //found a free slot
- p->class = bp;
- p->parent = pe;
-
- p->birthTime = cg.time;
- p->lifeTime = (int)CG_RandomiseValue( (float)bp->lifeTime, bp->lifeTimeRandFrac );
-
- p->radius.delay = (int)CG_RandomiseValue( (float)bp->radius.delay, bp->radius.delayRandFrac );
- p->radius.initial = CG_RandomiseValue( bp->radius.initial, bp->radius.initialRandFrac );
- p->radius.final = CG_RandomiseValue( bp->radius.final, bp->radius.finalRandFrac );
-
- p->alpha.delay = (int)CG_RandomiseValue( (float)bp->alpha.delay, bp->alpha.delayRandFrac );
- p->alpha.initial = CG_RandomiseValue( bp->alpha.initial, bp->alpha.initialRandFrac );
- p->alpha.final = CG_RandomiseValue( bp->alpha.final, bp->alpha.finalRandFrac );
-
- p->rotation.delay = (int)CG_RandomiseValue( (float)bp->rotation.delay, bp->rotation.delayRandFrac );
- p->rotation.initial = CG_RandomiseValue( bp->rotation.initial, bp->rotation.initialRandFrac );
- p->rotation.final = CG_RandomiseValue( bp->rotation.final, bp->rotation.finalRandFrac );
-
- p->dLightRadius.delay =
- (int)CG_RandomiseValue( (float)bp->dLightRadius.delay, bp->dLightRadius.delayRandFrac );
- p->dLightRadius.initial =
- CG_RandomiseValue( bp->dLightRadius.initial, bp->dLightRadius.initialRandFrac );
- p->dLightRadius.final =
- CG_RandomiseValue( bp->dLightRadius.final, bp->dLightRadius.finalRandFrac );
-
- p->colorDelay = CG_RandomiseValue( bp->colorDelay, bp->colorDelayRandFrac );
-
- p->bounceMarkRadius = CG_RandomiseValue( bp->bounceMarkRadius, bp->bounceMarkRadiusRandFrac );
- p->bounceMarkCount =
- rint( CG_RandomiseValue( (float)bp->bounceMarkCount, bp->bounceMarkCountRandFrac ) );
- p->bounceSoundCount =
- rint( CG_RandomiseValue( (float)bp->bounceSoundCount, bp->bounceSoundCountRandFrac ) );
-
- if( bp->numModels )
- {
- p->model = bp->models[ rand( ) % bp->numModels ];
-
- if( bp->modelAnimation.frameLerp < 0 )
- {
- bp->modelAnimation.frameLerp = p->lifeTime / bp->modelAnimation.numFrames;
- bp->modelAnimation.initialLerp = p->lifeTime / bp->modelAnimation.numFrames;
- }
- }
-
- if( !CG_AttachmentPoint( &ps->attachment, attachmentPoint ) )
- return NULL;
-
- VectorCopy( attachmentPoint, p->origin );
-
- if( CG_AttachmentAxis( &ps->attachment, transform ) )
- {
- vec3_t transDisplacement;
-
- VectorMatrixMultiply( bp->displacement, transform, transDisplacement );
- VectorAdd( p->origin, transDisplacement, p->origin );
- }
- else
- VectorAdd( p->origin, bp->displacement, p->origin );
-
- for( j = 0; j <= 2; j++ )
- p->origin[ j ] += ( crandom( ) * bp->randDisplacement );
-
- switch( bp->velMoveType )
- {
- case PMT_STATIC:
- if( bp->velMoveValues.dirType == PMD_POINT )
- VectorSubtract( bp->velMoveValues.point, p->origin, p->velocity );
- else if( bp->velMoveValues.dirType == PMD_LINEAR )
- VectorCopy( bp->velMoveValues.dir, p->velocity );
- break;
-
- case PMT_STATIC_TRANSFORM:
- if( !CG_AttachmentAxis( &ps->attachment, transform ) )
- return NULL;
-
- if( bp->velMoveValues.dirType == PMD_POINT )
- {
- vec3_t transPoint;
-
- VectorMatrixMultiply( bp->velMoveValues.point, transform, transPoint );
- VectorSubtract( transPoint, p->origin, p->velocity );
- }
- else if( bp->velMoveValues.dirType == PMD_LINEAR )
- VectorMatrixMultiply( bp->velMoveValues.dir, transform, p->velocity );
- break;
-
- case PMT_TAG:
- case PMT_CENT_ANGLES:
- if( bp->velMoveValues.dirType == PMD_POINT )
- VectorSubtract( attachmentPoint, p->origin, p->velocity );
- else if( bp->velMoveValues.dirType == PMD_LINEAR )
- {
- if( !CG_AttachmentDir( &ps->attachment, p->velocity ) )
- return NULL;
- }
- break;
-
- case PMT_NORMAL:
- if( !ps->normalValid )
- {
- CG_Printf( S_COLOR_RED "ERROR: a particle with velocityType "
- "normal has no normal\n" );
- return NULL;
- }
-
- VectorCopy( ps->normal, p->velocity );
-
- //normal displacement
- VectorNormalize( p->velocity );
- VectorMA( p->origin, bp->normalDisplacement, p->velocity, p->origin );
- break;
- }
-
- VectorNormalize( p->velocity );
- CG_SpreadVector( p->velocity, bp->velMoveValues.dirRandAngle );
- VectorScale( p->velocity,
- CG_RandomiseValue( bp->velMoveValues.mag, bp->velMoveValues.magRandFrac ),
- p->velocity );
-
- if( CG_AttachmentVelocity( &ps->attachment, attachmentVelocity ) )
- {
- VectorMA( p->velocity,
- CG_RandomiseValue( bp->velMoveValues.parentVelFrac,
- bp->velMoveValues.parentVelFracRandFrac ), attachmentVelocity, p->velocity );
- }
-
- p->lastEvalTime = cg.time;
-
- p->valid = qtrue;
-
- //this particle has a child particle system attached
- if( bp->childSystemName[ 0 ] != '\0' )
- {
- particleSystem_t *ps = CG_SpawnNewParticleSystem( bp->childSystemHandle );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentParticle( &ps->attachment, p );
- CG_AttachToParticle( &ps->attachment );
- }
- }
-
- //this particle has a child trail system attached
- if( bp->childTrailSystemName[ 0 ] != '\0' )
- {
- trailSystem_t *ts = CG_SpawnNewTrailSystem( bp->childTrailSystemHandle );
-
- if( CG_IsTrailSystemValid( &ts ) )
- {
- CG_SetAttachmentParticle( &ts->frontAttachment, p );
- CG_AttachToParticle( &ts->frontAttachment );
- }
- }
-
- break;
- }
- }
-
- return p;
-}
-
-
-/*
-===============
-CG_SpawnNewParticles
-
-Check if there are any ejectors that should be
-introducing new particles
-===============
-*/
-static void CG_SpawnNewParticles( void )
-{
- int i, j;
- particle_t *p;
- particleSystem_t *ps;
- particleEjector_t *pe;
- baseParticleEjector_t *bpe;
- float lerpFrac;
- int count;
-
- for( i = 0; i < MAX_PARTICLE_EJECTORS; i++ )
- {
- pe = &particleEjectors[ i ];
- ps = pe->parent;
-
- if( pe->valid )
- {
- //a non attached particle system can't make particles
- if( !CG_Attached( &ps->attachment ) )
- continue;
-
- bpe = particleEjectors[ i ].class;
-
- //if this system is scheduled for removal don't make any new particles
- if( !ps->lazyRemove )
- {
- while( pe->nextEjectionTime <= cg.time &&
- ( pe->count > 0 || pe->totalParticles == PARTICLES_INFINITE ) )
- {
- for( j = 0; j < bpe->numParticles; j++ )
- CG_SpawnNewParticle( bpe->particles[ j ], pe );
-
- if( pe->count > 0 )
- pe->count--;
-
- //calculate next ejection time
- lerpFrac = 1.0 - ( (float)pe->count / (float)pe->totalParticles );
- pe->nextEjectionTime = cg.time + (int)CG_RandomiseValue(
- CG_LerpValues( pe->ejectPeriod.initial,
- pe->ejectPeriod.final,
- lerpFrac ),
- pe->ejectPeriod.randFrac );
- }
- }
-
- if( pe->count == 0 || ps->lazyRemove )
- {
- count = 0;
-
- //wait for child particles to die before declaring this pe invalid
- for( j = 0; j < MAX_PARTICLES; j++ )
- {
- p = &particles[ j ];
-
- if( p->valid && p->parent == pe )
- count++;
- }
-
- if( !count )
- pe->valid = qfalse;
- }
- }
- }
-}
-
-
-/*
-===============
-CG_SpawnNewParticleEjector
-
-Allocate a new particle ejector
-===============
-*/
-static particleEjector_t *CG_SpawnNewParticleEjector( baseParticleEjector_t *bpe,
- particleSystem_t *parent )
-{
- int i;
- particleEjector_t *pe = NULL;
- particleSystem_t *ps = parent;
-
- for( i = 0; i < MAX_PARTICLE_EJECTORS; i++ )
- {
- pe = &particleEjectors[ i ];
-
- if( !pe->valid )
- {
- memset( pe, 0, sizeof( particleEjector_t ) );
-
- //found a free slot
- pe->class = bpe;
- pe->parent = ps;
-
- pe->ejectPeriod.initial = bpe->eject.initial;
- pe->ejectPeriod.final = bpe->eject.final;
- pe->ejectPeriod.randFrac = bpe->eject.randFrac;
-
- pe->nextEjectionTime = cg.time +
- (int)CG_RandomiseValue( (float)bpe->eject.delay, bpe->eject.delayRandFrac );
- pe->count = pe->totalParticles =
- (int)rint( CG_RandomiseValue( (float)bpe->totalParticles, bpe->totalParticlesRandFrac ) );
-
- pe->valid = qtrue;
-
- if( cg_debugParticles.integer >= 1 )
- CG_Printf( "PE %s created\n", ps->class->name );
-
- break;
- }
- }
-
- return pe;
-}
-
-
-/*
-===============
-CG_SpawnNewParticleSystem
-
-Allocate a new particle system
-===============
-*/
-particleSystem_t *CG_SpawnNewParticleSystem( qhandle_t psHandle )
-{
- int i, j;
- particleSystem_t *ps = NULL;
- baseParticleSystem_t *bps = &baseParticleSystems[ psHandle - 1 ];
-
- if( !bps->registered )
- {
- CG_Printf( S_COLOR_RED "ERROR: a particle system has not been registered yet\n" );
- return NULL;
- }
-
- for( i = 0; i < MAX_PARTICLE_SYSTEMS; i++ )
- {
- ps = &particleSystems[ i ];
-
- if( !ps->valid )
- {
- memset( ps, 0, sizeof( particleSystem_t ) );
-
- //found a free slot
- ps->class = bps;
-
- ps->valid = qtrue;
- ps->lazyRemove = qfalse;
-
- for( j = 0; j < bps->numEjectors; j++ )
- CG_SpawnNewParticleEjector( bps->ejectors[ j ], ps );
-
- if( cg_debugParticles.integer >= 1 )
- CG_Printf( "PS %s created\n", bps->name );
-
- break;
- }
- }
-
- return ps;
-}
-
-/*
-===============
-CG_RegisterParticleSystem
-
-Load the shaders required for a particle system
-===============
-*/
-qhandle_t CG_RegisterParticleSystem( char *name )
-{
- int i, j, k, l;
- baseParticleSystem_t *bps;
- baseParticleEjector_t *bpe;
- baseParticle_t *bp;
-
- for( i = 0; i < MAX_BASEPARTICLE_SYSTEMS; i++ )
- {
- bps = &baseParticleSystems[ i ];
-
- if( !Q_stricmpn( bps->name, name, MAX_QPATH ) )
- {
- //already registered
- if( bps->registered )
- return i + 1;
-
- for( j = 0; j < bps->numEjectors; j++ )
- {
- bpe = bps->ejectors[ j ];
-
- for( l = 0; l < bpe->numParticles; l++ )
- {
- bp = bpe->particles[ l ];
-
- for( k = 0; k < bp->numFrames; k++ )
- bp->shaders[ k ] = trap_R_RegisterShader( bp->shaderNames[ k ] );
-
- for( k = 0; k < bp->numModels; k++ )
- bp->models[ k ] = trap_R_RegisterModel( bp->modelNames[ k ] );
-
- if( bp->bounceMarkName[ 0 ] != '\0' )
- bp->bounceMark = trap_R_RegisterShader( bp->bounceMarkName );
-
- if( bp->bounceSoundName[ 0 ] != '\0' )
- bp->bounceSound = trap_S_RegisterSound( bp->bounceSoundName, qfalse );
-
- //recursively register any children
- if( bp->childSystemName[ 0 ] != '\0' )
- {
- //don't care about a handle for children since
- //the system deals with it
- CG_RegisterParticleSystem( bp->childSystemName );
- }
-
- if( bp->onDeathSystemName[ 0 ] != '\0' )
- {
- //don't care about a handle for children since
- //the system deals with it
- CG_RegisterParticleSystem( bp->onDeathSystemName );
- }
-
- if( bp->childTrailSystemName[ 0 ] != '\0' )
- bp->childTrailSystemHandle = CG_RegisterTrailSystem( bp->childTrailSystemName );
- }
- }
-
- if( cg_debugParticles.integer >= 1 )
- CG_Printf( "Registered particle system %s\n", name );
-
- bps->registered = qtrue;
-
- //avoid returning 0
- return i + 1;
- }
- }
-
- CG_Printf( S_COLOR_RED "ERROR: failed to register particle system %s\n", name );
- return 0;
-}
-
-
-/*
-===============
-CG_ParseValueAndVariance
-
-Parse a value and its random variance
-===============
-*/
-static void CG_ParseValueAndVariance( char *token, float *value, float *variance, qboolean allowNegative )
-{
- char valueBuffer[ 16 ];
- char varianceBuffer[ 16 ];
- char *variancePtr = NULL, *varEndPointer = NULL;
- float localValue = 0.0f;
- float localVariance = 0.0f;
-
- Q_strncpyz( valueBuffer, token, sizeof( valueBuffer ) );
- Q_strncpyz( varianceBuffer, token, sizeof( varianceBuffer ) );
-
- variancePtr = strchr( valueBuffer, '~' );
-
- //variance included
- if( variancePtr )
- {
- variancePtr[ 0 ] = '\0';
- variancePtr++;
-
- localValue = atof_neg( valueBuffer, allowNegative );
-
- varEndPointer = strchr( variancePtr, '%' );
-
- if( varEndPointer )
- {
- varEndPointer[ 0 ] = '\0';
- localVariance = atof_neg( variancePtr, qfalse ) / 100.0f;
- }
- else
- {
- if( localValue != 0.0f )
- localVariance = atof_neg( variancePtr, qfalse ) / localValue;
- else
- localVariance = atof_neg( variancePtr, qfalse );
- }
- }
- else
- localValue = atof_neg( valueBuffer, allowNegative );
-
- if( value != NULL )
- *value = localValue;
-
- if( variance != NULL )
- *variance = localVariance;
-}
-
-/*
-===============
-CG_ParseColor
-===============
-*/
-static qboolean CG_ParseColor( byte *c, char **text_p )
-{
- char *token;
- int i;
-
- for( i = 0; i <= 2; i++ )
- {
- token = COM_Parse( text_p );
-
- if( !Q_stricmp( token, "" ) )
- return qfalse;
-
- c[ i ] = (int)( (float)0xFF * atof_neg( token, qfalse ) );
- }
-
- return qtrue;
-}
-
-/*
-===============
-CG_ParseParticle
-
-Parse a particle section
-===============
-*/
-static qboolean CG_ParseParticle( baseParticle_t *bp, char **text_p )
-{
- char *token;
- float number, randFrac;
- int i;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( text_p );
-
- if( !token )
- break;
-
- if( !Q_stricmp( token, "" ) )
- return qfalse;
-
- if( !Q_stricmp( token, "bounce" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "cull" ) )
- {
- bp->bounceCull = qtrue;
-
- bp->bounceFrac = -1.0f;
- bp->bounceFracRandFrac = 0.0f;
- }
- else
- {
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->bounceFrac = number;
- bp->bounceFracRandFrac = randFrac;
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "bounceMark" ) )
- {
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->bounceMarkCount = number;
- bp->bounceMarkCountRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->bounceMarkRadius = number;
- bp->bounceMarkRadiusRandFrac = randFrac;
-
- token = COM_ParseExt( text_p, qfalse );
- if( !*token )
- break;
-
- Q_strncpyz( bp->bounceMarkName, token, MAX_QPATH );
-
- continue;
- }
- else if( !Q_stricmp( token, "bounceSound" ) )
- {
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->bounceSoundCount = number;
- bp->bounceSoundCountRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- Q_strncpyz( bp->bounceSoundName, token, MAX_QPATH );
-
- continue;
- }
- else if( !Q_stricmp( token, "shader" ) )
- {
- if( bp->numModels > 0 )
- {
- CG_Printf( S_COLOR_RED "ERROR: 'shader' not allowed in "
- "conjunction with 'model'\n", token );
- break;
- }
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "sync" ) )
- bp->framerate = 0.0f;
- else
- bp->framerate = atof_neg( token, qfalse );
-
- token = COM_ParseExt( text_p, qfalse );
- if( !*token )
- break;
-
- while( *token && bp->numFrames < MAX_PS_SHADER_FRAMES )
- {
- Q_strncpyz( bp->shaderNames[ bp->numFrames++ ], token, MAX_QPATH );
- token = COM_ParseExt( text_p, qfalse );
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "model" ) )
- {
- if( bp->numFrames > 0 )
- {
- CG_Printf( S_COLOR_RED "ERROR: 'model' not allowed in "
- "conjunction with 'shader'\n", token );
- break;
- }
-
- token = COM_ParseExt( text_p, qfalse );
- if( !*token )
- break;
-
- while( *token && bp->numModels < MAX_PS_MODELS )
- {
- Q_strncpyz( bp->modelNames[ bp->numModels++ ], token, MAX_QPATH );
- token = COM_ParseExt( text_p, qfalse );
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "modelAnimation" ) )
- {
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- bp->modelAnimation.firstFrame = atoi_neg( token, qfalse );
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- bp->modelAnimation.numFrames = atoi( token );
- bp->modelAnimation.reversed = qfalse;
- bp->modelAnimation.flipflop = qfalse;
-
- // if numFrames is negative the animation is reversed
- if( bp->modelAnimation.numFrames < 0 )
- {
- bp->modelAnimation.numFrames = -bp->modelAnimation.numFrames;
- bp->modelAnimation.reversed = qtrue;
- }
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- bp->modelAnimation.loopFrames = atoi( token );
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- if( !Q_stricmp( token, "sync" ) )
- {
- bp->modelAnimation.frameLerp = -1;
- bp->modelAnimation.initialLerp = -1;
- }
- else
- {
- float fps = atof_neg( token, qfalse );
-
- if( fps == 0.0f )
- fps = 1.0f;
-
- bp->modelAnimation.frameLerp = 1000 / fps;
- bp->modelAnimation.initialLerp = 1000 / fps;
- }
-
- continue;
- }
- ///
- else if( !Q_stricmp( token, "velocityType" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "static" ) )
- bp->velMoveType = PMT_STATIC;
- else if( !Q_stricmp( token, "static_transform" ) )
- bp->velMoveType = PMT_STATIC_TRANSFORM;
- else if( !Q_stricmp( token, "tag" ) )
- bp->velMoveType = PMT_TAG;
- else if( !Q_stricmp( token, "cent" ) )
- bp->velMoveType = PMT_CENT_ANGLES;
- else if( !Q_stricmp( token, "normal" ) )
- bp->velMoveType = PMT_NORMAL;
-
- continue;
- }
- else if( !Q_stricmp( token, "velocityDir" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "linear" ) )
- bp->velMoveValues.dirType = PMD_LINEAR;
- else if( !Q_stricmp( token, "point" ) )
- bp->velMoveValues.dirType = PMD_POINT;
-
- continue;
- }
- else if( !Q_stricmp( token, "velocityMagnitude" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->velMoveValues.mag = number;
- bp->velMoveValues.magRandFrac = randFrac;
-
- continue;
- }
- else if( !Q_stricmp( token, "parentVelocityFraction" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->velMoveValues.parentVelFrac = number;
- bp->velMoveValues.parentVelFracRandFrac = randFrac;
-
- continue;
- }
- else if( !Q_stricmp( token, "velocity" ) )
- {
- for( i = 0; i <= 2; i++ )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- bp->velMoveValues.dir[ i ] = atof_neg( token, qtrue );
- }
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, NULL, &randFrac, qfalse );
-
- bp->velMoveValues.dirRandAngle = randFrac;
-
- continue;
- }
- else if( !Q_stricmp( token, "velocityPoint" ) )
- {
- for( i = 0; i <= 2; i++ )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- bp->velMoveValues.point[ i ] = atof_neg( token, qtrue );
- }
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, NULL, &randFrac, qfalse );
-
- bp->velMoveValues.pointRandAngle = randFrac;
-
- continue;
- }
- ///
- else if( !Q_stricmp( token, "accelerationType" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "static" ) )
- bp->accMoveType = PMT_STATIC;
- else if( !Q_stricmp( token, "static_transform" ) )
- bp->accMoveType = PMT_STATIC_TRANSFORM;
- else if( !Q_stricmp( token, "tag" ) )
- bp->accMoveType = PMT_TAG;
- else if( !Q_stricmp( token, "cent" ) )
- bp->accMoveType = PMT_CENT_ANGLES;
- else if( !Q_stricmp( token, "normal" ) )
- bp->accMoveType = PMT_NORMAL;
-
- continue;
- }
- else if( !Q_stricmp( token, "accelerationDir" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "linear" ) )
- bp->accMoveValues.dirType = PMD_LINEAR;
- else if( !Q_stricmp( token, "point" ) )
- bp->accMoveValues.dirType = PMD_POINT;
-
- continue;
- }
- else if( !Q_stricmp( token, "accelerationMagnitude" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->accMoveValues.mag = number;
- bp->accMoveValues.magRandFrac = randFrac;
-
- continue;
- }
- else if( !Q_stricmp( token, "acceleration" ) )
- {
- for( i = 0; i <= 2; i++ )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- bp->accMoveValues.dir[ i ] = atof_neg( token, qtrue );
- }
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, NULL, &randFrac, qfalse );
-
- bp->accMoveValues.dirRandAngle = randFrac;
-
- continue;
- }
- else if( !Q_stricmp( token, "accelerationPoint" ) )
- {
- for( i = 0; i <= 2; i++ )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- bp->accMoveValues.point[ i ] = atof_neg( token, qtrue );
- }
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, NULL, &randFrac, qfalse );
-
- bp->accMoveValues.pointRandAngle = randFrac;
-
- continue;
- }
- ///
- else if( !Q_stricmp( token, "displacement" ) )
- {
- for( i = 0; i <= 2; i++ )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- bp->displacement[ i ] = atof_neg( token, qtrue );
- }
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, NULL, &randFrac, qfalse );
-
- bp->randDisplacement = randFrac;
-
- continue;
- }
- else if( !Q_stricmp( token, "normalDisplacement" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- bp->normalDisplacement = atof_neg( token, qtrue );
-
- continue;
- }
- else if( !Q_stricmp( token, "overdrawProtection" ) )
- {
- bp->overdrawProtection = qtrue;
-
- continue;
- }
- else if( !Q_stricmp( token, "realLight" ) )
- {
- bp->realLight = qtrue;
-
- continue;
- }
- else if( !Q_stricmp( token, "dynamicLight" ) )
- {
- bp->dynamicLight = qtrue;
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->dLightRadius.delay = (int)number;
- bp->dLightRadius.delayRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->dLightRadius.initial = number;
- bp->dLightRadius.initialRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- {
- bp->dLightRadius.final = PARTICLES_SAME_AS_INITIAL;
- bp->dLightRadius.finalRandFrac = 0.0f;
- }
- else
- {
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->dLightRadius.final = number;
- bp->dLightRadius.finalRandFrac = randFrac;
- }
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- if( !Q_stricmp( token, "{" ) )
- {
- if( !CG_ParseColor( bp->dLightColor, text_p ) )
- break;
-
- token = COM_Parse( text_p );
- if( Q_stricmp( token, "}" ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '}'\n" );
- break;
- }
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "cullOnStartSolid" ) )
- {
- bp->cullOnStartSolid = qtrue;
-
- continue;
- }
- else if( !Q_stricmp( token, "radius" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->radius.delay = (int)number;
- bp->radius.delayRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->radius.initial = number;
- bp->radius.initialRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- {
- bp->radius.final = PARTICLES_SAME_AS_INITIAL;
- bp->radius.finalRandFrac = 0.0f;
- }
- else
- {
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->radius.final = number;
- bp->radius.finalRandFrac = randFrac;
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "alpha" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->alpha.delay = (int)number;
- bp->alpha.delayRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->alpha.initial = number;
- bp->alpha.initialRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- {
- bp->alpha.final = PARTICLES_SAME_AS_INITIAL;
- bp->alpha.finalRandFrac = 0.0f;
- }
- else
- {
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->alpha.final = number;
- bp->alpha.finalRandFrac = randFrac;
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "color" ) )
- {
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->colorDelay = (int)number;
- bp->colorDelayRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- if( !Q_stricmp( token, "{" ) )
- {
- if( !CG_ParseColor( bp->initialColor, text_p ) )
- break;
-
- token = COM_Parse( text_p );
- if( Q_stricmp( token, "}" ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '}'\n" );
- break;
- }
-
- token = COM_Parse( text_p );
- if( !*token )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- {
- bp->finalColor[ 0 ] = bp->initialColor[ 0 ];
- bp->finalColor[ 1 ] = bp->initialColor[ 1 ];
- bp->finalColor[ 2 ] = bp->initialColor[ 2 ];
- }
- else if( !Q_stricmp( token, "{" ) )
- {
- if( !CG_ParseColor( bp->finalColor, text_p ) )
- break;
-
- token = COM_Parse( text_p );
- if( Q_stricmp( token, "}" ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '}'\n" );
- break;
- }
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '{'\n" );
- break;
- }
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '{'\n" );
- break;
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "rotation" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->rotation.delay = (int)number;
- bp->rotation.delayRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qtrue );
-
- bp->rotation.initial = number;
- bp->rotation.initialRandFrac = randFrac;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- {
- bp->rotation.final = PARTICLES_SAME_AS_INITIAL;
- bp->rotation.finalRandFrac = 0.0f;
- }
- else
- {
- CG_ParseValueAndVariance( token, &number, &randFrac, qtrue );
-
- bp->rotation.final = number;
- bp->rotation.finalRandFrac = randFrac;
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "lifeTime" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bp->lifeTime = (int)number;
- bp->lifeTimeRandFrac = randFrac;
-
- continue;
- }
- else if( !Q_stricmp( token, "childSystem" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- Q_strncpyz( bp->childSystemName, token, MAX_QPATH );
-
- continue;
- }
- else if( !Q_stricmp( token, "onDeathSystem" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- Q_strncpyz( bp->onDeathSystemName, token, MAX_QPATH );
-
- continue;
- }
- else if( !Q_stricmp( token, "childTrailSystem" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- Q_strncpyz( bp->childTrailSystemName, token, MAX_QPATH );
-
- continue;
- }
- else if( !Q_stricmp( token, "}" ) )
- return qtrue; //reached the end of this particle
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unknown token '%s' in particle\n", token );
- return qfalse;
- }
- }
-
- return qfalse;
-}
-
-/*
-===============
-CG_InitialiseBaseParticle
-===============
-*/
-static void CG_InitialiseBaseParticle( baseParticle_t *bp )
-{
- memset( bp, 0, sizeof( baseParticle_t ) );
-
- memset( bp->initialColor, 0xFF, sizeof( bp->initialColor ) );
- memset( bp->finalColor, 0xFF, sizeof( bp->finalColor ) );
-}
-
-/*
-===============
-CG_ParseParticleEjector
-
-Parse a particle ejector section
-===============
-*/
-static qboolean CG_ParseParticleEjector( baseParticleEjector_t *bpe, char **text_p )
-{
- char *token;
- float number, randFrac;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( text_p );
-
- if( !token )
- break;
-
- if( !Q_stricmp( token, "" ) )
- return qfalse;
-
- if( !Q_stricmp( token, "{" ) )
- {
- CG_InitialiseBaseParticle( &baseParticles[ numBaseParticles ] );
-
- if( !CG_ParseParticle( &baseParticles[ numBaseParticles ], text_p ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: failed to parse particle\n" );
- return qfalse;
- }
-
- if( bpe->numParticles == MAX_PARTICLES_PER_EJECTOR )
- {
- CG_Printf( S_COLOR_RED "ERROR: ejector has > %d particles\n", MAX_PARTICLES_PER_EJECTOR );
- return qfalse;
- }
- else if( numBaseParticles == MAX_BASEPARTICLES )
- {
- CG_Printf( S_COLOR_RED "ERROR: maximum number of particles (%d) reached\n", MAX_BASEPARTICLES );
- return qfalse;
- }
- else
- {
- //start parsing particles again
- bpe->particles[ bpe->numParticles ] = &baseParticles[ numBaseParticles ];
- bpe->numParticles++;
- numBaseParticles++;
- }
- continue;
- }
- else if( !Q_stricmp( token, "delay" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bpe->eject.delay = (int)number;
- bpe->eject.delayRandFrac = randFrac;
-
- continue;
- }
- else if( !Q_stricmp( token, "period" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- bpe->eject.initial = atoi_neg( token, qfalse );
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- bpe->eject.final = PARTICLES_SAME_AS_INITIAL;
- else
- bpe->eject.final = atoi_neg( token, qfalse );
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- CG_ParseValueAndVariance( token, NULL, &bpe->eject.randFrac, qfalse );
-
- continue;
- }
- else if( !Q_stricmp( token, "count" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "infinite" ) )
- {
- bpe->totalParticles = PARTICLES_INFINITE;
- bpe->totalParticlesRandFrac = 0.0f;
- }
- else
- {
- CG_ParseValueAndVariance( token, &number, &randFrac, qfalse );
-
- bpe->totalParticles = (int)number;
- bpe->totalParticlesRandFrac = randFrac;
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "particle" ) ) //acceptable text
- continue;
- else if( !Q_stricmp( token, "}" ) )
- return qtrue; //reached the end of this particle ejector
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unknown token '%s' in particle ejector\n", token );
- return qfalse;
- }
- }
-
- return qfalse;
-}
-
-
-/*
-===============
-CG_ParseParticleSystem
-
-Parse a particle system section
-===============
-*/
-static qboolean CG_ParseParticleSystem( baseParticleSystem_t *bps, char **text_p, const char *name )
-{
- char *token;
- baseParticleEjector_t *bpe;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( text_p );
-
- if( !token )
- break;
-
- if( !Q_stricmp( token, "" ) )
- return qfalse;
-
- if( !Q_stricmp( token, "{" ) )
- {
- if( !CG_ParseParticleEjector( &baseParticleEjectors[ numBaseParticleEjectors ], text_p ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: failed to parse particle ejector\n" );
- return qfalse;
- }
-
- bpe = &baseParticleEjectors[ numBaseParticleEjectors ];
-
- //check for infinite count + zero period
- if( bpe->totalParticles == PARTICLES_INFINITE &&
- ( bpe->eject.initial == 0.0f || bpe->eject.final == 0.0f ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: ejector with 'count infinite' potentially has zero period\n" );
- return qfalse;
- }
-
- if( bps->numEjectors == MAX_EJECTORS_PER_SYSTEM )
- {
- CG_Printf( S_COLOR_RED "ERROR: particle system has > %d ejectors\n", MAX_EJECTORS_PER_SYSTEM );
- return qfalse;
- }
- else if( numBaseParticleEjectors == MAX_BASEPARTICLE_EJECTORS )
- {
- CG_Printf( S_COLOR_RED "ERROR: maximum number of particle ejectors (%d) reached\n",
- MAX_BASEPARTICLE_EJECTORS );
- return qfalse;
- }
- else
- {
- //start parsing ejectors again
- bps->ejectors[ bps->numEjectors ] = &baseParticleEjectors[ numBaseParticleEjectors ];
- bps->numEjectors++;
- numBaseParticleEjectors++;
- }
- continue;
- }
- else if( !Q_stricmp( token, "thirdPersonOnly" ) )
- bps->thirdPersonOnly = qtrue;
- else if( !Q_stricmp( token, "ejector" ) ) //acceptable text
- continue;
- else if( !Q_stricmp( token, "}" ) )
- {
- if( cg_debugParticles.integer >= 1 )
- CG_Printf( "Parsed particle system %s\n", name );
-
- return qtrue; //reached the end of this particle system
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unknown token '%s' in particle system %s\n", token, bps->name );
- return qfalse;
- }
- }
-
- return qfalse;
-}
-
-/*
-===============
-CG_ParseParticleFile
-
-Load the particle systems from a particle file
-===============
-*/
-static qboolean CG_ParseParticleFile( const char *fileName )
-{
- char *text_p;
- int i;
- int len;
- char *token;
- char text[ 32000 ];
- char psName[ MAX_QPATH ];
- qboolean psNameSet = qfalse;
- fileHandle_t f;
-
- // load the file
- len = trap_FS_FOpenFile( fileName, &f, FS_READ );
- if( len <= 0 )
- return qfalse;
-
- if( len >= sizeof( text ) - 1 )
- {
- CG_Printf( S_COLOR_RED "ERROR: particle file %s too long\n", fileName );
- return qfalse;
- }
-
- trap_FS_Read( text, len, f );
- text[ len ] = 0;
- trap_FS_FCloseFile( f );
-
- // parse the text
- text_p = text;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( &text_p );
-
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "{" ) )
- {
- if( psNameSet )
- {
- //check for name space clashes
- for( i = 0; i < numBaseParticleSystems; i++ )
- {
- if( !Q_stricmp( baseParticleSystems[ i ].name, psName ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: a particle system is already named %s\n", psName );
- return qfalse;
- }
- }
-
- Q_strncpyz( baseParticleSystems[ numBaseParticleSystems ].name, psName, MAX_QPATH );
-
- if( !CG_ParseParticleSystem( &baseParticleSystems[ numBaseParticleSystems ], &text_p, psName ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: %s: failed to parse particle system %s\n", fileName, psName );
- return qfalse;
- }
-
- //start parsing particle systems again
- psNameSet = qfalse;
-
- if( numBaseParticleSystems == MAX_BASEPARTICLE_SYSTEMS )
- {
- CG_Printf( S_COLOR_RED "ERROR: maximum number of particle systems (%d) reached\n",
- MAX_BASEPARTICLE_SYSTEMS );
- return qfalse;
- }
- else
- numBaseParticleSystems++;
-
- continue;
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unamed particle system\n" );
- return qfalse;
- }
- }
-
- if( !psNameSet )
- {
- Q_strncpyz( psName, token, sizeof( psName ) );
- psNameSet = qtrue;
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: particle system already named\n" );
- return qfalse;
- }
- }
-
- return qtrue;
-}
-
-
-/*
-===============
-CG_LoadParticleSystems
-
-Load particle systems from .particle files
-===============
-*/
-void CG_LoadParticleSystems( void )
-{
- int i, j, numFiles, fileLen;
- char fileList[ MAX_PARTICLE_FILES * MAX_QPATH ];
- char fileName[ MAX_QPATH ];
- char *filePtr;
-
- //clear out the old
- numBaseParticleSystems = 0;
- numBaseParticleEjectors = 0;
- numBaseParticles = 0;
-
- for( i = 0; i < MAX_BASEPARTICLE_SYSTEMS; i++ )
- {
- baseParticleSystem_t *bps = &baseParticleSystems[ i ];
- memset( bps, 0, sizeof( baseParticleSystem_t ) );
- }
-
- for( i = 0; i < MAX_BASEPARTICLE_EJECTORS; i++ )
- {
- baseParticleEjector_t *bpe = &baseParticleEjectors[ i ];
- memset( bpe, 0, sizeof( baseParticleEjector_t ) );
- }
-
- for( i = 0; i < MAX_BASEPARTICLES; i++ )
- {
- baseParticle_t *bp = &baseParticles[ i ];
- memset( bp, 0, sizeof( baseParticle_t ) );
- }
-
-
- //and bring in the new
- numFiles = trap_FS_GetFileList( "scripts", ".particle",
- fileList, MAX_PARTICLE_FILES * MAX_QPATH );
- filePtr = fileList;
-
- for( i = 0; i < numFiles; i++, filePtr += fileLen + 1 )
- {
- fileLen = strlen( filePtr );
- strcpy( fileName, "scripts/" );
- strcat( fileName, filePtr );
- CG_Printf( "...loading '%s'\n", fileName );
- CG_ParseParticleFile( fileName );
- }
-
- //connect any child systems to their psHandle
- for( i = 0; i < numBaseParticles; i++ )
- {
- baseParticle_t *bp = &baseParticles[ i ];
-
- if( bp->childSystemName[ 0 ] )
- {
- //particle class has a child, resolve the name
- for( j = 0; j < numBaseParticleSystems; j++ )
- {
- baseParticleSystem_t *bps = &baseParticleSystems[ j ];
-
- if( !Q_stricmp( bps->name, bp->childSystemName ) )
- {
- //FIXME: add checks for cycles and infinite children
-
- bp->childSystemHandle = j + 1;
-
- break;
- }
- }
-
- if( j == numBaseParticleSystems )
- {
- //couldn't find named particle system
- CG_Printf( S_COLOR_YELLOW "WARNING: failed to find child %s\n", bp->childSystemName );
- bp->childSystemName[ 0 ] = '\0';
- }
- }
-
- if( bp->onDeathSystemName[ 0 ] )
- {
- //particle class has a child, resolve the name
- for( j = 0; j < numBaseParticleSystems; j++ )
- {
- baseParticleSystem_t *bps = &baseParticleSystems[ j ];
-
- if( !Q_stricmp( bps->name, bp->onDeathSystemName ) )
- {
- //FIXME: add checks for cycles and infinite children
-
- bp->onDeathSystemHandle = j + 1;
-
- break;
- }
- }
-
- if( j == numBaseParticleSystems )
- {
- //couldn't find named particle system
- CG_Printf( S_COLOR_YELLOW "WARNING: failed to find onDeath system %s\n", bp->onDeathSystemName );
- bp->onDeathSystemName[ 0 ] = '\0';
- }
- }
- }
-}
-
-/*
-===============
-CG_SetParticleSystemNormal
-===============
-*/
-void CG_SetParticleSystemNormal( particleSystem_t *ps, vec3_t normal )
-{
- if( ps == NULL || !ps->valid )
- {
- CG_Printf( S_COLOR_YELLOW "WARNING: tried to modify a NULL particle system\n" );
- return;
- }
-
- ps->normalValid = qtrue;
- VectorCopy( normal, ps->normal );
- VectorNormalize( ps->normal );
-}
-
-
-/*
-===============
-CG_DestroyParticleSystem
-
-Destroy a particle system
-
-This doesn't actually invalidate anything, it just stops
-particle ejectors from producing new particles so the
-garbage collector will eventually remove this system.
-However is does set the pointer to NULL so the user is
-unable to manipulate this particle system any longer.
-===============
-*/
-void CG_DestroyParticleSystem( particleSystem_t **ps )
-{
- int i;
- particleEjector_t *pe;
-
- if( *ps == NULL || !(*ps)->valid )
- {
- CG_Printf( S_COLOR_YELLOW "WARNING: tried to destroy a NULL particle system\n" );
- return;
- }
-
- if( cg_debugParticles.integer >= 1 )
- CG_Printf( "PS destroyed\n" );
-
- for( i = 0; i < MAX_PARTICLE_EJECTORS; i++ )
- {
- pe = &particleEjectors[ i ];
-
- if( pe->valid && pe->parent == *ps )
- pe->totalParticles = pe->count = 0;
- }
-
- *ps = NULL;
-}
-
-/*
-===============
-CG_IsParticleSystemInfinite
-
-Test a particle system for 'count infinite' ejectors
-===============
-*/
-qboolean CG_IsParticleSystemInfinite( particleSystem_t *ps )
-{
- int i;
- particleEjector_t *pe;
-
- if( ps == NULL )
- {
- CG_Printf( S_COLOR_YELLOW "WARNING: tried to test a NULL particle system\n" );
- return qfalse;
- }
-
- if( !ps->valid )
- {
- CG_Printf( S_COLOR_YELLOW "WARNING: tried to test an invalid particle system\n" );
- return qfalse;
- }
-
- //don't bother checking already invalid systems
- if( !ps->valid )
- return qfalse;
-
- for( i = 0; i < MAX_PARTICLE_EJECTORS; i++ )
- {
- pe = &particleEjectors[ i ];
-
- if( pe->valid && pe->parent == ps )
- {
- if( pe->totalParticles == PARTICLES_INFINITE )
- return qtrue;
- }
- }
-
- return qfalse;
-}
-
-/*
-===============
-CG_IsParticleSystemValid
-
-Test a particle system for validity
-===============
-*/
-qboolean CG_IsParticleSystemValid( particleSystem_t **ps )
-{
- if( *ps == NULL || ( *ps && !(*ps)->valid ) )
- {
- if( *ps && !(*ps)->valid )
- *ps = NULL;
-
- return qfalse;
- }
-
- return qtrue;
-}
-
-/*
-===============
-CG_GarbageCollectParticleSystems
-
-Destroy inactive particle systems
-===============
-*/
-static void CG_GarbageCollectParticleSystems( void )
-{
- int i, j, count;
- particleSystem_t *ps;
- particleEjector_t *pe;
- int centNum;
-
- for( i = 0; i < MAX_PARTICLE_SYSTEMS; i++ )
- {
- ps = &particleSystems[ i ];
- count = 0;
-
- //don't bother checking already invalid systems
- if( !ps->valid )
- continue;
-
- for( j = 0; j < MAX_PARTICLE_EJECTORS; j++ )
- {
- pe = &particleEjectors[ j ];
-
- if( pe->valid && pe->parent == ps )
- count++;
- }
-
- if( !count )
- ps->valid = qfalse;
-
- //check systems where the parent cent has left the PVS
- //( local player entity is always valid )
- if( ( centNum = CG_AttachmentCentNum( &ps->attachment ) ) >= 0 &&
- centNum != cg.snap->ps.clientNum )
- {
- if( !cg_entities[ centNum ].valid )
- ps->lazyRemove = qtrue;
- }
-
- if( cg_debugParticles.integer >= 1 && !ps->valid )
- CG_Printf( "PS %s garbage collected\n", ps->class->name );
- }
-}
-
-
-/*
-===============
-CG_CalculateTimeFrac
-
-Calculate the fraction of time passed
-===============
-*/
-static float CG_CalculateTimeFrac( int birth, int life, int delay )
-{
- float frac;
-
- frac = ( (float)cg.time - (float)( birth + delay ) ) / (float)( life - delay );
-
- if( frac < 0.0f )
- frac = 0.0f;
- else if( frac > 1.0f )
- frac = 1.0f;
-
- return frac;
-}
-
-/*
-===============
-CG_EvaluateParticlePhysics
-
-Compute the physics on a specific particle
-===============
-*/
-static void CG_EvaluateParticlePhysics( particle_t *p )
-{
- particleSystem_t *ps = p->parent->parent;
- baseParticle_t *bp = p->class;
- vec3_t acceleration, newOrigin;
- vec3_t mins, maxs;
- float deltaTime, bounce, radius, dot;
- trace_t trace;
- vec3_t transform[ 3 ];
-
- if( p->atRest )
- {
- VectorClear( p->velocity );
- return;
- }
-
- switch( bp->accMoveType )
- {
- case PMT_STATIC:
- if( bp->accMoveValues.dirType == PMD_POINT )
- VectorSubtract( bp->accMoveValues.point, p->origin, acceleration );
- else if( bp->accMoveValues.dirType == PMD_LINEAR )
- VectorCopy( bp->accMoveValues.dir, acceleration );
-
- break;
-
- case PMT_STATIC_TRANSFORM:
- if( !CG_AttachmentAxis( &ps->attachment, transform ) )
- return;
-
- if( bp->accMoveValues.dirType == PMD_POINT )
- {
- vec3_t transPoint;
-
- VectorMatrixMultiply( bp->accMoveValues.point, transform, transPoint );
- VectorSubtract( transPoint, p->origin, acceleration );
- }
- else if( bp->accMoveValues.dirType == PMD_LINEAR )
- VectorMatrixMultiply( bp->accMoveValues.dir, transform, acceleration );
- break;
-
- case PMT_TAG:
- case PMT_CENT_ANGLES:
- if( bp->accMoveValues.dirType == PMD_POINT )
- {
- vec3_t point;
-
- if( !CG_AttachmentPoint( &ps->attachment, point ) )
- return;
-
- VectorSubtract( point, p->origin, acceleration );
- }
- else if( bp->accMoveValues.dirType == PMD_LINEAR )
- {
- if( !CG_AttachmentDir( &ps->attachment, acceleration ) )
- return;
- }
- break;
-
- case PMT_NORMAL:
- if( !ps->normalValid )
- return;
-
- VectorCopy( ps->normal, acceleration );
-
- break;
- }
-
-#define MAX_ACC_RADIUS 1000.0f
-
- if( bp->accMoveValues.dirType == PMD_POINT )
- {
- //FIXME: so this fall off is a bit... odd -- it works..
- float r2 = DotProduct( acceleration, acceleration ); // = radius^2
- float scale = ( MAX_ACC_RADIUS - r2 ) / MAX_ACC_RADIUS;
-
- if( scale > 1.0f )
- scale = 1.0f;
- else if( scale < 0.1f )
- scale = 0.1f;
-
- scale *= CG_RandomiseValue( bp->accMoveValues.mag, bp->accMoveValues.magRandFrac );
-
- VectorNormalize( acceleration );
- CG_SpreadVector( acceleration, bp->accMoveValues.dirRandAngle );
- VectorScale( acceleration, scale, acceleration );
- }
- else if( bp->accMoveValues.dirType == PMD_LINEAR )
- {
- VectorNormalize( acceleration );
- CG_SpreadVector( acceleration, bp->accMoveValues.dirRandAngle );
- VectorScale( acceleration,
- CG_RandomiseValue( bp->accMoveValues.mag, bp->accMoveValues.magRandFrac ),
- acceleration );
- }
-
- radius = CG_LerpValues( p->radius.initial,
- p->radius.final,
- CG_CalculateTimeFrac( p->birthTime,
- p->lifeTime,
- p->radius.delay ) );
-
- VectorSet( mins, -radius, -radius, -radius );
- VectorSet( maxs, radius, radius, radius );
-
- bounce = CG_RandomiseValue( bp->bounceFrac, bp->bounceFracRandFrac );
-
- deltaTime = (float)( cg.time - p->lastEvalTime ) * 0.001;
- VectorMA( p->velocity, deltaTime, acceleration, p->velocity );
- VectorMA( p->origin, deltaTime, p->velocity, newOrigin );
- p->lastEvalTime = cg.time;
-
- // we're not doing particle physics, but at least cull them in solids
- if( !cg_bounceParticles.integer )
- {
- int contents = trap_CM_PointContents( newOrigin, 0 );
-
- if( ( contents & CONTENTS_SOLID ) || ( contents & CONTENTS_NODROP ) )
- CG_DestroyParticle( p, NULL );
- else
- VectorCopy( newOrigin, p->origin );
- return;
- }
-
- CG_Trace( &trace, p->origin, mins, maxs, newOrigin,
- CG_AttachmentCentNum( &ps->attachment ), CONTENTS_SOLID );
-
- //not hit anything or not a collider
- if( trace.fraction == 1.0f || bounce == 0.0f )
- {
- VectorCopy( newOrigin, p->origin );
- return;
- }
-
- //remove particles that get into a CONTENTS_NODROP brush
- if( ( trap_CM_PointContents( trace.endpos, 0 ) & CONTENTS_NODROP ) ||
- ( bp->cullOnStartSolid && trace.startsolid ) )
- {
- CG_DestroyParticle( p, NULL );
- return;
- }
- else if( bp->bounceCull )
- {
- CG_DestroyParticle( p, trace.plane.normal );
- return;
- }
-
- //reflect the velocity on the trace plane
- dot = DotProduct( p->velocity, trace.plane.normal );
- VectorMA( p->velocity, -2.0f * dot, trace.plane.normal, p->velocity );
-
- VectorScale( p->velocity, bounce, p->velocity );
-
- if( trace.plane.normal[ 2 ] > 0.5f &&
- ( p->velocity[ 2 ] < 40.0f ||
- p->velocity[ 2 ] < -cg.frametime * p->velocity[ 2 ] ) )
- p->atRest = qtrue;
-
- if( bp->bounceMarkName[ 0 ] && p->bounceMarkCount > 0 )
- {
- CG_ImpactMark( bp->bounceMark, trace.endpos, trace.plane.normal,
- random( ) * 360, 1, 1, 1, 1, qtrue, bp->bounceMarkRadius, qfalse );
- p->bounceMarkCount--;
- }
-
- if( bp->bounceSoundName[ 0 ] && p->bounceSoundCount > 0 )
- {
- trap_S_StartSound( trace.endpos, ENTITYNUM_WORLD, CHAN_AUTO, bp->bounceSound );
- p->bounceSoundCount--;
- }
-
- VectorCopy( trace.endpos, p->origin );
-}
-
-
-#define GETKEY(x,y) (((x)>>y)&0xFF)
-
-/*
-===============
-CG_Radix
-===============
-*/
-static void CG_Radix( int bits, int size, particle_t **source, particle_t **dest )
-{
- int count[ 256 ];
- int index[ 256 ];
- int i;
-
- memset( count, 0, sizeof( count ) );
-
- for( i = 0; i < size; i++ )
- count[ GETKEY( source[ i ]->sortKey, bits ) ]++;
-
- index[ 0 ] = 0;
-
- for( i = 1; i < 256; i++ )
- index[ i ] = index[ i - 1 ] + count[ i - 1 ];
-
- for( i = 0; i < size; i++ )
- dest[ index[ GETKEY( source[ i ]->sortKey, bits ) ]++ ] = source[ i ];
-}
-
-/*
-===============
-CG_RadixSort
-
-Radix sort with 4 byte size buckets
-===============
-*/
-static void CG_RadixSort( particle_t **source, particle_t **temp, int size )
-{
- CG_Radix( 0, size, source, temp );
- CG_Radix( 8, size, temp, source );
- CG_Radix( 16, size, source, temp );
- CG_Radix( 24, size, temp, source );
-}
-
-/*
-===============
-CG_CompactAndSortParticles
-
-Depth sort the particles
-===============
-*/
-static void CG_CompactAndSortParticles( void )
-{
- int i, j = 0;
- int numParticles;
- vec3_t delta;
-
- for( i = 0; i < MAX_PARTICLES; i++ )
- sortedParticles[ i ] = &particles[ i ];
-
- if( !cg_depthSortParticles.integer )
- return;
-
- for( i = MAX_PARTICLES - 1; i >= 0; i-- )
- {
- if( sortedParticles[ i ]->valid )
- {
- //find the first hole
- while( j < MAX_PARTICLES && sortedParticles[ j ]->valid )
- j++;
-
- //no more holes
- if( j >= i )
- break;
-
- sortedParticles[ j ] = sortedParticles[ i ];
- }
- }
-
- numParticles = i;
-
- //set sort keys
- for( i = 0; i < numParticles; i++ )
- {
- VectorSubtract( sortedParticles[ i ]->origin, cg.refdef.vieworg, delta );
- sortedParticles[ i ]->sortKey = (int)DotProduct( delta, delta );
- }
-
- CG_RadixSort( sortedParticles, radixBuffer, numParticles );
-
- //FIXME: wtf?
- //reverse order of particles array
- for( i = 0; i < numParticles; i++ )
- radixBuffer[ i ] = sortedParticles[ numParticles - i - 1 ];
-
- for( i = 0; i < numParticles; i++ )
- sortedParticles[ i ] = radixBuffer[ i ];
-}
-
-/*
-===============
-CG_RenderParticle
-
-Actually render a particle
-===============
-*/
-static void CG_RenderParticle( particle_t *p )
-{
- refEntity_t re;
- float timeFrac, scale;
- int index;
- baseParticle_t *bp = p->class;
- particleSystem_t *ps = p->parent->parent;
- baseParticleSystem_t *bps = ps->class;
- vec3_t alight, dlight, lightdir;
- int i;
- vec3_t up = { 0.0f, 0.0f, 1.0f };
-
- memset( &re, 0, sizeof( refEntity_t ) );
-
- timeFrac = CG_CalculateTimeFrac( p->birthTime, p->lifeTime, 0 );
-
- scale = CG_LerpValues( p->radius.initial,
- p->radius.final,
- CG_CalculateTimeFrac( p->birthTime,
- p->lifeTime,
- p->radius.delay ) );
-
- re.shaderTime = p->birthTime / 1000.0f;
-
- if( bp->numFrames ) //shader based
- {
- re.reType = RT_SPRITE;
-
- //apply environmental lighting to the particle
- if( bp->realLight )
- {
- trap_R_LightForPoint( p->origin, alight, dlight, lightdir );
- for( i = 0; i <= 2; i++ )
- re.shaderRGBA[ i ] = (byte)alight[ i ];
- }
- else
- {
- vec3_t colorRange;
-
- VectorSubtract( bp->finalColor,
- bp->initialColor, colorRange );
-
- VectorMA( bp->initialColor,
- CG_CalculateTimeFrac( p->birthTime,
- p->lifeTime,
- p->colorDelay ),
- colorRange, re.shaderRGBA );
- }
-
- re.shaderRGBA[ 3 ] = (byte)( (float)0xFF *
- CG_LerpValues( p->alpha.initial,
- p->alpha.final,
- CG_CalculateTimeFrac( p->birthTime,
- p->lifeTime,
- p->alpha.delay ) ) );
-
- re.radius = scale;
-
- re.rotation = CG_LerpValues( p->rotation.initial,
- p->rotation.final,
- CG_CalculateTimeFrac( p->birthTime,
- p->lifeTime,
- p->rotation.delay ) );
-
- // if the view would be "inside" the sprite, kill the sprite
- // so it doesn't add too much overdraw
- if( Distance( p->origin, cg.refdef.vieworg ) < re.radius && bp->overdrawProtection )
- return;
-
- if( bp->framerate == 0.0f )
- {
- //sync animation time to lifeTime of particle
- index = (int)( timeFrac * ( bp->numFrames + 1 ) );
-
- if( index >= bp->numFrames )
- index = bp->numFrames - 1;
-
- re.customShader = bp->shaders[ index ];
- }
- else
- {
- //looping animation
- index = (int)( bp->framerate * timeFrac * p->lifeTime * 0.001 ) % bp->numFrames;
- re.customShader = bp->shaders[ index ];
- }
-
- }
- else if( bp->numModels ) //model based
- {
- re.reType = RT_MODEL;
-
- re.hModel = p->model;
-
- if( p->atRest )
- AxisCopy( p->lastAxis, re.axis );
- else
- {
- // convert direction of travel into axis
- VectorNormalize2( p->velocity, re.axis[ 0 ] );
-
- if( re.axis[ 0 ][ 0 ] == 0.0f && re.axis[ 0 ][ 1 ] == 0.0f )
- AxisCopy( axisDefault, re.axis );
- else
- {
- ProjectPointOnPlane( re.axis[ 2 ], up, re.axis[ 0 ] );
- VectorNormalize( re.axis[ 2 ] );
- CrossProduct( re.axis[ 2 ], re.axis[ 0 ], re.axis[ 1 ] );
- }
-
- AxisCopy( re.axis, p->lastAxis );
- }
-
- if( scale != 1.0f )
- {
- VectorScale( re.axis[ 0 ], scale, re.axis[ 0 ] );
- VectorScale( re.axis[ 1 ], scale, re.axis[ 1 ] );
- VectorScale( re.axis[ 2 ], scale, re.axis[ 2 ] );
- re.nonNormalizedAxes = qtrue;
- }
- else
- re.nonNormalizedAxes = qfalse;
-
- p->lf.animation = &bp->modelAnimation;
-
- //run animation
- CG_RunLerpFrame( &p->lf );
-
- re.oldframe = p->lf.oldFrame;
- re.frame = p->lf.frame;
- re.backlerp = p->lf.backlerp;
- }
-
- if( bps->thirdPersonOnly &&
- CG_AttachmentCentNum( &ps->attachment ) == cg.snap->ps.clientNum &&
- !cg.renderingThirdPerson )
- re.renderfx |= RF_THIRD_PERSON;
-
- if( bp->dynamicLight && !( re.renderfx & RF_THIRD_PERSON ) )
- {
- trap_R_AddLightToScene( p->origin,
- CG_LerpValues( p->dLightRadius.initial, p->dLightRadius.final,
- CG_CalculateTimeFrac( p->birthTime, p->lifeTime, p->dLightRadius.delay ) ),
- (float)bp->dLightColor[ 0 ] / (float)0xFF,
- (float)bp->dLightColor[ 1 ] / (float)0xFF,
- (float)bp->dLightColor[ 2 ] / (float)0xFF );
- }
-
- VectorCopy( p->origin, re.origin );
-
- trap_R_AddRefEntityToScene( &re );
-}
-
-/*
-===============
-CG_AddParticles
-
-Add particles to the scene
-===============
-*/
-void CG_AddParticles( void )
-{
- int i;
- particle_t *p;
- int numPS = 0, numPE = 0, numP = 0;
-
- //remove expired particle systems
- CG_GarbageCollectParticleSystems( );
-
- //check each ejector and introduce any new particles
- CG_SpawnNewParticles( );
-
- //sorting
- CG_CompactAndSortParticles( );
-
- for( i = 0; i < MAX_PARTICLES; i++ )
- {
- p = sortedParticles[ i ];
-
- if( p->valid )
- {
- if( p->birthTime + p->lifeTime > cg.time )
- {
- //particle is active
- CG_EvaluateParticlePhysics( p );
- CG_RenderParticle( p );
- }
- else
- CG_DestroyParticle( p, NULL );
- }
- }
-
- if( cg_debugParticles.integer >= 2 )
- {
- for( i = 0; i < MAX_PARTICLE_SYSTEMS; i++ )
- if( particleSystems[ i ].valid )
- numPS++;
-
- for( i = 0; i < MAX_PARTICLE_EJECTORS; i++ )
- if( particleEjectors[ i ].valid )
- numPE++;
-
- for( i = 0; i < MAX_PARTICLES; i++ )
- if( particles[ i ].valid )
- numP++;
-
- CG_Printf( "PS: %d PE: %d P: %d\n", numPS, numPE, numP );
- }
-}
-
-/*
-===============
-CG_ParticleSystemEntity
-
-Particle system entity client code
-===============
-*/
-void CG_ParticleSystemEntity( centity_t *cent )
-{
- entityState_t *es;
-
- es = ¢->currentState;
-
- if( es->eFlags & EF_NODRAW )
- {
- if( CG_IsParticleSystemValid( ¢->entityPS ) && CG_IsParticleSystemInfinite( cent->entityPS ) )
- CG_DestroyParticleSystem( ¢->entityPS );
-
- return;
- }
-
- if( !CG_IsParticleSystemValid( ¢->entityPS ) && !cent->entityPSMissing )
- {
- cent->entityPS = CG_SpawnNewParticleSystem( cgs.gameParticleSystems[ es->modelindex ] );
-
- if( CG_IsParticleSystemValid( ¢->entityPS ) )
- {
- CG_SetAttachmentPoint( ¢->entityPS->attachment, cent->lerpOrigin );
- CG_SetAttachmentCent( ¢->entityPS->attachment, cent );
- CG_AttachToPoint( ¢->entityPS->attachment );
- }
- else
- cent->entityPSMissing = qtrue;
- }
-}
-
-static particleSystem_t *testPS;
-static qhandle_t testPSHandle;
-
-/*
-===============
-CG_DestroyTestPS_f
-
-Destroy the test a particle system
-===============
-*/
-void CG_DestroyTestPS_f( void )
-{
- if( CG_IsParticleSystemValid( &testPS ) )
- CG_DestroyParticleSystem( &testPS );
-}
-
-/*
-===============
-CG_TestPS_f
-
-Test a particle system
-===============
-*/
-void CG_TestPS_f( void )
-{
- vec3_t origin;
- vec3_t up = { 0.0f, 0.0f, 1.0f };
- char psName[ MAX_QPATH ];
-
- if( trap_Argc( ) < 2 )
- return;
-
- Q_strncpyz( psName, CG_Argv( 1 ), MAX_QPATH );
- testPSHandle = CG_RegisterParticleSystem( psName );
-
- if( testPSHandle )
- {
- CG_DestroyTestPS_f( );
-
- testPS = CG_SpawnNewParticleSystem( testPSHandle );
-
- VectorMA( cg.refdef.vieworg, 100, cg.refdef.viewaxis[ 0 ], origin );
-
- if( CG_IsParticleSystemValid( &testPS ) )
- {
- CG_SetAttachmentPoint( &testPS->attachment, origin );
- CG_SetParticleSystemNormal( testPS, up );
- CG_AttachToPoint( &testPS->attachment );
- }
- }
-}
diff --git a/src/cgame/cg_players.c b/src/cgame/cg_players.c
deleted file mode 100644
index b594330..0000000
--- a/src/cgame/cg_players.c
+++ /dev/null
@@ -1,2565 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_players.c -- handle the media and animation for player entities
-
-
-#include "cg_local.h"
-
-char *cg_customSoundNames[ MAX_CUSTOM_SOUNDS ] =
-{
- "*death1.wav",
- "*death2.wav",
- "*death3.wav",
- "*jump1.wav",
- "*pain25_1.wav",
- "*pain50_1.wav",
- "*pain75_1.wav",
- "*pain100_1.wav",
- "*falling1.wav",
- "*gasp.wav",
- "*drown.wav",
- "*fall1.wav",
- "*taunt.wav"
-};
-
-
-/*
-================
-CG_CustomSound
-
-================
-*/
-sfxHandle_t CG_CustomSound( int clientNum, const char *soundName )
-{
- clientInfo_t *ci;
- int i;
-
- if( soundName[ 0 ] != '*' )
- return trap_S_RegisterSound( soundName, qfalse );
-
- if( clientNum < 0 || clientNum >= MAX_CLIENTS )
- clientNum = 0;
-
- ci = &cgs.clientinfo[ clientNum ];
-
- for( i = 0; i < MAX_CUSTOM_SOUNDS && cg_customSoundNames[ i ]; i++ )
- {
- if( !strcmp( soundName, cg_customSoundNames[ i ] ) )
- return ci->sounds[ i ];
- }
-
- CG_Error( "Unknown custom sound: %s", soundName );
- return 0;
-}
-
-
-
-/*
-=============================================================================
-
-CLIENT INFO
-
-=============================================================================
-*/
-
-/*
-======================
-CG_ParseAnimationFile
-
-Read a configuration file containing animation coutns and rates
-models/players/visor/animation.cfg, etc
-======================
-*/
-static qboolean CG_ParseAnimationFile( const char *filename, clientInfo_t *ci )
-{
- char *text_p, *prev;
- int len;
- int i;
- char *token;
- float fps;
- int skip;
- char text[ 20000 ];
- fileHandle_t f;
- animation_t *animations;
-
- animations = ci->animations;
-
- // load the file
- len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if( len <= 0 )
- return qfalse;
-
- if( len >= sizeof( text ) - 1 )
- {
- CG_Printf( "File %s too long\n", filename );
- trap_FS_FCloseFile( f );
- return qfalse;
- }
-
- trap_FS_Read( text, len, f );
- text[ len ] = 0;
- trap_FS_FCloseFile( f );
-
- // parse the text
- text_p = text;
- skip = 0; // quite the compiler warning
-
- ci->footsteps = FOOTSTEP_NORMAL;
- VectorClear( ci->headOffset );
- ci->gender = GENDER_MALE;
- ci->fixedlegs = qfalse;
- ci->fixedtorso = qfalse;
- ci->nonsegmented = qfalse;
-
- // read optional parameters
- while( 1 )
- {
- prev = text_p; // so we can unget
- token = COM_Parse( &text_p );
-
- if( !token )
- break;
-
- if( !Q_stricmp( token, "footsteps" ) )
- {
- token = COM_Parse( &text_p );
- if( !token )
- break;
-
- if( !Q_stricmp( token, "default" ) || !Q_stricmp( token, "normal" ) )
- ci->footsteps = FOOTSTEP_NORMAL;
- else if( !Q_stricmp( token, "flesh" ) )
- ci->footsteps = FOOTSTEP_FLESH;
- else if( !Q_stricmp( token, "none" ) )
- ci->footsteps = FOOTSTEP_NONE;
- else if( !Q_stricmp( token, "custom" ) )
- ci->footsteps = FOOTSTEP_CUSTOM;
- else
- CG_Printf( "Bad footsteps parm in %s: %s\n", filename, token );
-
- continue;
- }
- else if( !Q_stricmp( token, "headoffset" ) )
- {
- for( i = 0 ; i < 3 ; i++ )
- {
- token = COM_Parse( &text_p );
- if( !token )
- break;
-
- ci->headOffset[ i ] = atof( token );
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "sex" ) )
- {
- token = COM_Parse( &text_p );
-
- if( !token )
- break;
-
- if( token[ 0 ] == 'f' || token[ 0 ] == 'F' )
- ci->gender = GENDER_FEMALE;
- else if( token[ 0 ] == 'n' || token[ 0 ] == 'N' )
- ci->gender = GENDER_NEUTER;
- else
- ci->gender = GENDER_MALE;
-
- continue;
- }
- else if( !Q_stricmp( token, "fixedlegs" ) )
- {
- ci->fixedlegs = qtrue;
- continue;
- }
- else if( !Q_stricmp( token, "fixedtorso" ) )
- {
- ci->fixedtorso = qtrue;
- continue;
- }
- else if( !Q_stricmp( token, "nonsegmented" ) )
- {
- ci->nonsegmented = qtrue;
- continue;
- }
-
- // if it is a number, start parsing animations
- if( token[ 0 ] >= '0' && token[ 0 ] <= '9' )
- {
- text_p = prev; // unget the token
- break;
- }
-
- Com_Printf( "unknown token '%s' is %s\n", token, filename );
- }
-
- if( !ci->nonsegmented )
- {
- // read information for each frame
- for( i = 0; i < MAX_PLAYER_ANIMATIONS; i++ )
- {
- token = COM_Parse( &text_p );
-
- if( !*token )
- {
- if( i >= TORSO_GETFLAG && i <= TORSO_NEGATIVE )
- {
- animations[ i ].firstFrame = animations[ TORSO_GESTURE ].firstFrame;
- animations[ i ].frameLerp = animations[ TORSO_GESTURE ].frameLerp;
- animations[ i ].initialLerp = animations[ TORSO_GESTURE ].initialLerp;
- animations[ i ].loopFrames = animations[ TORSO_GESTURE ].loopFrames;
- animations[ i ].numFrames = animations[ TORSO_GESTURE ].numFrames;
- animations[ i ].reversed = qfalse;
- animations[ i ].flipflop = qfalse;
- continue;
- }
-
- break;
- }
-
- animations[ i ].firstFrame = atoi( token );
-
- // leg only frames are adjusted to not count the upper body only frames
- if( i == LEGS_WALKCR )
- skip = animations[ LEGS_WALKCR ].firstFrame - animations[ TORSO_GESTURE ].firstFrame;
-
- if( i >= LEGS_WALKCR && inonsegmented )
- {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower_%s.skin", modelName, skinName );
- ci->legsSkin = trap_R_RegisterSkin( filename );
- if( !ci->legsSkin )
- Com_Printf( "Leg skin load failure: %s\n", filename );
-
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper_%s.skin", modelName, skinName );
- ci->torsoSkin = trap_R_RegisterSkin( filename );
- if( !ci->torsoSkin )
- Com_Printf( "Torso skin load failure: %s\n", filename );
-
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/head_%s.skin", modelName, skinName );
- ci->headSkin = trap_R_RegisterSkin( filename );
- if( !ci->headSkin )
- Com_Printf( "Head skin load failure: %s\n", filename );
-
- if( !ci->legsSkin || !ci->torsoSkin || !ci->headSkin )
- return qfalse;
- }
- else
- {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/nonseg_%s.skin", modelName, skinName );
- ci->nonSegSkin = trap_R_RegisterSkin( filename );
- if( !ci->nonSegSkin )
- Com_Printf( "Non-segmented skin load failure: %s\n", filename );
-
- if( !ci->nonSegSkin )
- return qfalse;
- }
-
- return qtrue;
-}
-
-/*
-==========================
-CG_RegisterClientModelname
-==========================
-*/
-static qboolean CG_RegisterClientModelname( clientInfo_t *ci, const char *modelName, const char *skinName )
-{
- char filename[ MAX_QPATH * 2 ];
-
- // do this first so the nonsegmented property is set
- // load the animations
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/animation.cfg", modelName );
- if( !CG_ParseAnimationFile( filename, ci ) )
- {
- Com_Printf( "Failed to load animation file %s\n", filename );
- return qfalse;
- }
-
- // load cmodels before models so filecache works
-
- if( !ci->nonsegmented )
- {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/lower.md3", modelName );
- ci->legsModel = trap_R_RegisterModel( filename );
- if( !ci->legsModel )
- {
- Com_Printf( "Failed to load model file %s\n", filename );
- return qfalse;
- }
-
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/upper.md3", modelName );
- ci->torsoModel = trap_R_RegisterModel( filename );
- if( !ci->torsoModel )
- {
- Com_Printf( "Failed to load model file %s\n", filename );
- return qfalse;
- }
-
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/head.md3", modelName );
- ci->headModel = trap_R_RegisterModel( filename );
- if( !ci->headModel )
- {
- Com_Printf( "Failed to load model file %s\n", filename );
- return qfalse;
- }
- }
- else
- {
- Com_sprintf( filename, sizeof( filename ), "models/players/%s/nonseg.md3", modelName );
- ci->nonSegModel = trap_R_RegisterModel( filename );
- if( !ci->nonSegModel )
- {
- Com_Printf( "Failed to load model file %s\n", filename );
- return qfalse;
- }
- }
-
- // if any skins failed to load, return failure
- if( !CG_RegisterClientSkin( ci, modelName, skinName ) )
- {
- Com_Printf( "Failed to load skin file: %s : %s\n", modelName, skinName );
- return qfalse;
- }
-
- //FIXME: skins do not load without icon present. do we want icons anyway?
-/* Com_sprintf( filename, sizeof( filename ), "models/players/%s/icon_%s.tga", modelName, skinName );
- ci->modelIcon = trap_R_RegisterShaderNoMip( filename );
- if( !ci->modelIcon )
- {
- Com_Printf( "Failed to load icon file: %s\n", filename );
- return qfalse;
- }*/
-
- return qtrue;
-}
-
-/*
-====================
-CG_ColorFromString
-====================
-*/
-static void CG_ColorFromString( const char *v, vec3_t color )
-{
- int val;
-
- VectorClear( color );
-
- val = atoi( v );
-
- if( val < 1 || val > 7 )
- {
- VectorSet( color, 1, 1, 1 );
- return;
- }
-
- if( val & 1 )
- color[ 2 ] = 1.0f;
-
- if( val & 2 )
- color[ 1 ] = 1.0f;
-
- if( val & 4 )
- color[ 0 ] = 1.0f;
-}
-
-
-/*
-===================
-CG_LoadClientInfo
-
-Load it now, taking the disk hits
-===================
-*/
-static void CG_LoadClientInfo( clientInfo_t *ci )
-{
- const char *dir, *fallback;
- int i;
- const char *s;
- int clientNum;
-
- if( !CG_RegisterClientModelname( ci, ci->modelName, ci->skinName ) )
- {
- if( cg_buildScript.integer )
- CG_Error( "CG_RegisterClientModelname( %s, %s ) failed", ci->modelName, ci->skinName );
-
- // fall back
- if( !CG_RegisterClientModelname( ci, DEFAULT_MODEL, "default" ) )
- CG_Error( "DEFAULT_MODEL (%s) failed to register", DEFAULT_MODEL );
- }
-
- // sounds
- dir = ci->modelName;
- fallback = DEFAULT_MODEL;
-
- for( i = 0; i < MAX_CUSTOM_SOUNDS; i++ )
- {
- s = cg_customSoundNames[ i ];
-
- if( !s )
- break;
-
- // fanny about a bit with sounds that are missing
- if( !CG_FileExists( va( "sound/player/%s/%s", dir, s + 1 ) ) )
- {
- //file doesn't exist
-
- if( i == 11 || i == 8 ) //fall or falling
- {
- ci->sounds[ i ] = trap_S_RegisterSound( "sound/null.wav", qfalse );
- }
- else
- {
- if( i == 9 ) //gasp
- s = cg_customSoundNames[ 7 ]; //pain100_1
- else if( i == 10 ) //drown
- s = cg_customSoundNames[ 0 ]; //death1
-
- ci->sounds[ i ] = trap_S_RegisterSound( va( "sound/player/%s/%s", dir, s + 1 ), qfalse );
- if( !ci->sounds[ i ] )
- ci->sounds[ i ] = trap_S_RegisterSound( va( "sound/player/%s/%s", fallback, s + 1 ), qfalse );
- }
- }
- else
- {
- ci->sounds[ i ] = trap_S_RegisterSound( va( "sound/player/%s/%s", dir, s + 1 ), qfalse );
- if( !ci->sounds[ i ] )
- ci->sounds[ i ] = trap_S_RegisterSound( va( "sound/player/%s/%s", fallback, s + 1 ), qfalse );
- }
- }
-
- if( ci->footsteps == FOOTSTEP_CUSTOM )
- {
- for( i = 0; i < 4; i++ )
- {
- ci->customFootsteps[ i ] = trap_S_RegisterSound( va( "sound/player/%s/step%d.wav", dir, i + 1 ), qfalse );
- if( !ci->customFootsteps[ i ] )
- ci->customFootsteps[ i ] = trap_S_RegisterSound( va( "sound/player/footsteps/step%d.wav", i + 1 ), qfalse );
-
- ci->customMetalFootsteps[ i ] = trap_S_RegisterSound( va( "sound/player/%s/clank%d.wav", dir, i + 1 ), qfalse );
- if( !ci->customMetalFootsteps[ i ] )
- ci->customMetalFootsteps[ i ] = trap_S_RegisterSound( va( "sound/player/footsteps/clank%d.wav", i + 1 ), qfalse );
- }
- }
-
- // reset any existing players and bodies, because they might be in bad
- // frames for this new model
- clientNum = ci - cgs.clientinfo;
- for( i = 0; i < MAX_GENTITIES; i++ )
- {
- if( cg_entities[ i ].currentState.clientNum == clientNum &&
- cg_entities[ i ].currentState.eType == ET_PLAYER )
- CG_ResetPlayerEntity( &cg_entities[ i ] );
- }
-}
-
-/*
-======================
-CG_CopyClientInfoModel
-======================
-*/
-static void CG_CopyClientInfoModel( clientInfo_t *from, clientInfo_t *to )
-{
- VectorCopy( from->headOffset, to->headOffset );
- to->footsteps = from->footsteps;
- to->gender = from->gender;
-
- to->legsModel = from->legsModel;
- to->legsSkin = from->legsSkin;
- to->torsoModel = from->torsoModel;
- to->torsoSkin = from->torsoSkin;
- to->headModel = from->headModel;
- to->headSkin = from->headSkin;
- to->nonSegModel = from->nonSegModel;
- to->nonSegSkin = from->nonSegSkin;
- to->nonsegmented = from->nonsegmented;
- to->modelIcon = from->modelIcon;
-
- memcpy( to->animations, from->animations, sizeof( to->animations ) );
- memcpy( to->sounds, from->sounds, sizeof( to->sounds ) );
- memcpy( to->customFootsteps, from->customFootsteps, sizeof( to->customFootsteps ) );
- memcpy( to->customMetalFootsteps, from->customMetalFootsteps, sizeof( to->customMetalFootsteps ) );
-}
-
-
-/*
-======================
-CG_GetCorpseNum
-======================
-*/
-static int CG_GetCorpseNum( pClass_t class )
-{
- int i;
- clientInfo_t *match;
- char *modelName;
- char *skinName;
-
- modelName = BG_FindModelNameForClass( class );
- skinName = BG_FindSkinNameForClass( class );
-
- for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
- {
- match = &cgs.corpseinfo[ i ];
-
- if( !match->infoValid )
- continue;
-
- if( !Q_stricmp( modelName, match->modelName )
- && !Q_stricmp( skinName, match->skinName ) )
- {
- // this clientinfo is identical, so use it's handles
- return i;
- }
- }
-
- //something has gone horribly wrong
- return -1;
-}
-
-
-/*
-======================
-CG_ScanForExistingClientInfo
-======================
-*/
-static qboolean CG_ScanForExistingClientInfo( clientInfo_t *ci )
-{
- int i;
- clientInfo_t *match;
-
- for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
- {
- match = &cgs.corpseinfo[ i ];
-
- if( !match->infoValid )
- continue;
-
- if( !Q_stricmp( ci->modelName, match->modelName ) &&
- !Q_stricmp( ci->skinName, match->skinName ) )
- {
- // this clientinfo is identical, so use it's handles
- CG_CopyClientInfoModel( match, ci );
-
- return qtrue;
- }
- }
-
- // shouldn't happen
- return qfalse;
-}
-
-
-/*
-======================
-CG_PrecacheClientInfo
-======================
-*/
-void CG_PrecacheClientInfo( pClass_t class, char *model, char *skin )
-{
- clientInfo_t *ci;
- clientInfo_t newInfo;
-
- ci = &cgs.corpseinfo[ class ];
-
- // the old value
- memset( &newInfo, 0, sizeof( newInfo ) );
-
- // model
- Q_strncpyz( newInfo.modelName, model, sizeof( newInfo.modelName ) );
- Q_strncpyz( newInfo.headModelName, model, sizeof( newInfo.headModelName ) );
-
- // modelName didn not include a skin name
- if( !skin )
- {
- Q_strncpyz( newInfo.skinName, "default", sizeof( newInfo.skinName ) );
- Q_strncpyz( newInfo.headSkinName, "default", sizeof( newInfo.headSkinName ) );
- }
- else
- {
- Q_strncpyz( newInfo.skinName, skin, sizeof( newInfo.skinName ) );
- Q_strncpyz( newInfo.headSkinName, skin, sizeof( newInfo.headSkinName ) );
- }
-
- newInfo.infoValid = qtrue;
-
- // actually register the models
- *ci = newInfo;
- CG_LoadClientInfo( ci );
-}
-
-
-/*
-======================
-CG_NewClientInfo
-======================
-*/
-void CG_NewClientInfo( int clientNum )
-{
- clientInfo_t *ci;
- clientInfo_t newInfo;
- const char *configstring;
- const char *v;
- char *slash;
-
- ci = &cgs.clientinfo[ clientNum ];
-
- configstring = CG_ConfigString( clientNum + CS_PLAYERS );
- if( !configstring[ 0 ] )
- {
- memset( ci, 0, sizeof( *ci ) );
- return; // player just left
- }
-
- // the old value
- memset( &newInfo, 0, sizeof( newInfo ) );
-
- // isolate the player's name
- v = Info_ValueForKey( configstring, "n" );
- Q_strncpyz( newInfo.name, v, sizeof( newInfo.name ) );
-
- // colors
- v = Info_ValueForKey( configstring, "c1" );
- CG_ColorFromString( v, newInfo.color1 );
-
- v = Info_ValueForKey( configstring, "c2" );
- CG_ColorFromString( v, newInfo.color2 );
-
- // bot skill
- v = Info_ValueForKey( configstring, "skill" );
- newInfo.botSkill = atoi( v );
-
- // handicap
- v = Info_ValueForKey( configstring, "hc" );
- newInfo.handicap = atoi( v );
-
- // wins
- v = Info_ValueForKey( configstring, "w" );
- newInfo.wins = atoi( v );
-
- // losses
- v = Info_ValueForKey( configstring, "l" );
- newInfo.losses = atoi( v );
-
- // team
- v = Info_ValueForKey( configstring, "t" );
- newInfo.team = atoi( v );
-
- // team task
- v = Info_ValueForKey( configstring, "tt" );
- newInfo.teamTask = atoi( v );
-
- // team leader
- v = Info_ValueForKey( configstring, "tl" );
- newInfo.teamLeader = atoi( v );
-
- // model
- v = Info_ValueForKey( configstring, "model" );
- Q_strncpyz( newInfo.modelName, v, sizeof( newInfo.modelName ) );
-
- slash = strchr( newInfo.modelName, '/' );
-
- if( !slash )
- {
- // modelName didn not include a skin name
- Q_strncpyz( newInfo.skinName, "default", sizeof( newInfo.skinName ) );
- }
- else
- {
- Q_strncpyz( newInfo.skinName, slash + 1, sizeof( newInfo.skinName ) );
- // truncate modelName
- *slash = 0;
- }
-
- //CG_Printf( "NCI: %s\n", v );
-
- // head model
- v = Info_ValueForKey( configstring, "hmodel" );
- Q_strncpyz( newInfo.headModelName, v, sizeof( newInfo.headModelName ) );
-
- slash = strchr( newInfo.headModelName, '/' );
-
- if( !slash )
- {
- // modelName didn not include a skin name
- Q_strncpyz( newInfo.headSkinName, "default", sizeof( newInfo.headSkinName ) );
- }
- else
- {
- Q_strncpyz( newInfo.headSkinName, slash + 1, sizeof( newInfo.headSkinName ) );
- // truncate modelName
- *slash = 0;
- }
-
- // replace whatever was there with the new one
- newInfo.infoValid = qtrue;
- *ci = newInfo;
-
- // scan for an existing clientinfo that matches this modelname
- // so we can avoid loading checks if possible
- if( !CG_ScanForExistingClientInfo( ci ) )
- CG_LoadClientInfo( ci );
-}
-
-
-
-/*
-=============================================================================
-
-PLAYER ANIMATION
-
-=============================================================================
-*/
-
-
-/*
-===============
-CG_SetLerpFrameAnimation
-
-may include ANIM_TOGGLEBIT
-===============
-*/
-static void CG_SetLerpFrameAnimation( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation )
-{
- animation_t *anim;
-
- lf->animationNumber = newAnimation;
- newAnimation &= ~ANIM_TOGGLEBIT;
-
- if( newAnimation < 0 || newAnimation >= MAX_PLAYER_TOTALANIMATIONS )
- CG_Error( "Bad animation number: %i", newAnimation );
-
- anim = &ci->animations[ newAnimation ];
-
- lf->animation = anim;
- lf->animationTime = lf->frameTime + anim->initialLerp;
-
- if( cg_debugAnim.integer )
- CG_Printf( "Anim: %i\n", newAnimation );
-}
-
-/*
-===============
-CG_RunPlayerLerpFrame
-
-Sets cg.snap, cg.oldFrame, and cg.backlerp
-cg.time should be between oldFrameTime and frameTime after exit
-===============
-*/
-static void CG_RunPlayerLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int newAnimation, float speedScale )
-{
- int f, numFrames;
- animation_t *anim;
-
- // debugging tool to get no animations
- if( cg_animSpeed.integer == 0 )
- {
- lf->oldFrame = lf->frame = lf->backlerp = 0;
- return;
- }
-
- // see if the animation sequence is switching
- if( newAnimation != lf->animationNumber || !lf->animation )
- {
- CG_SetLerpFrameAnimation( ci, lf, newAnimation );
- }
-
- // if we have passed the current frame, move it to
- // oldFrame and calculate a new frame
- if( cg.time >= lf->frameTime )
- {
- lf->oldFrame = lf->frame;
- lf->oldFrameTime = lf->frameTime;
-
- // get the next frame based on the animation
- anim = lf->animation;
- if( !anim->frameLerp )
- return; // shouldn't happen
-
- if( cg.time < lf->animationTime )
- lf->frameTime = lf->animationTime; // initial lerp
- else
- lf->frameTime = lf->oldFrameTime + anim->frameLerp;
-
- f = ( lf->frameTime - lf->animationTime ) / anim->frameLerp;
- f *= speedScale; // adjust for haste, etc
- numFrames = anim->numFrames;
-
- if( anim->flipflop )
- numFrames *= 2;
-
- if( f >= numFrames )
- {
- f -= numFrames;
- if( anim->loopFrames )
- {
- f %= anim->loopFrames;
- f += anim->numFrames - anim->loopFrames;
- }
- else
- {
- f = numFrames - 1;
- // the animation is stuck at the end, so it
- // can immediately transition to another sequence
- lf->frameTime = cg.time;
- }
- }
-
- if( anim->reversed )
- lf->frame = anim->firstFrame + anim->numFrames - 1 - f;
- else if( anim->flipflop && f>=anim->numFrames )
- lf->frame = anim->firstFrame + anim->numFrames - 1 - ( f % anim->numFrames );
- else
- lf->frame = anim->firstFrame + f;
-
- if( cg.time > lf->frameTime )
- {
- lf->frameTime = cg.time;
-
- if( cg_debugAnim.integer )
- CG_Printf( "Clamp lf->frameTime\n" );
- }
- }
-
- if( lf->frameTime > cg.time + 200 )
- lf->frameTime = cg.time;
-
- if( lf->oldFrameTime > cg.time )
- lf->oldFrameTime = cg.time;
-
- // calculate current lerp value
- if( lf->frameTime == lf->oldFrameTime )
- lf->backlerp = 0;
- else
- lf->backlerp = 1.0 - (float)( cg.time - lf->oldFrameTime ) / ( lf->frameTime - lf->oldFrameTime );
-}
-
-
-/*
-===============
-CG_ClearLerpFrame
-===============
-*/
-static void CG_ClearLerpFrame( clientInfo_t *ci, lerpFrame_t *lf, int animationNumber )
-{
- lf->frameTime = lf->oldFrameTime = cg.time;
- CG_SetLerpFrameAnimation( ci, lf, animationNumber );
- lf->oldFrame = lf->frame = lf->animation->firstFrame;
-}
-
-
-/*
-===============
-CG_PlayerAnimation
-===============
-*/
-static void CG_PlayerAnimation( centity_t *cent, int *legsOld, int *legs, float *legsBackLerp,
- int *torsoOld, int *torso, float *torsoBackLerp )
-{
- clientInfo_t *ci;
- int clientNum;
- float speedScale = 1.0f;
-
- clientNum = cent->currentState.clientNum;
-
- if( cg_noPlayerAnims.integer )
- {
- *legsOld = *legs = *torsoOld = *torso = 0;
- return;
- }
-
- ci = &cgs.clientinfo[ clientNum ];
-
- // do the shuffle turn frames locally
- if( cent->pe.legs.yawing && ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == LEGS_IDLE )
- CG_RunPlayerLerpFrame( ci, ¢->pe.legs, LEGS_TURN, speedScale );
- else
- CG_RunPlayerLerpFrame( ci, ¢->pe.legs, cent->currentState.legsAnim, speedScale );
-
- *legsOld = cent->pe.legs.oldFrame;
- *legs = cent->pe.legs.frame;
- *legsBackLerp = cent->pe.legs.backlerp;
-
- CG_RunPlayerLerpFrame( ci, ¢->pe.torso, cent->currentState.torsoAnim, speedScale );
-
- *torsoOld = cent->pe.torso.oldFrame;
- *torso = cent->pe.torso.frame;
- *torsoBackLerp = cent->pe.torso.backlerp;
-}
-
-
-/*
-===============
-CG_PlayerNonSegAnimation
-===============
-*/
-static void CG_PlayerNonSegAnimation( centity_t *cent, int *nonSegOld,
- int *nonSeg, float *nonSegBackLerp )
-{
- clientInfo_t *ci;
- int clientNum;
- float speedScale = 1.0f;
-
- clientNum = cent->currentState.clientNum;
-
- if( cg_noPlayerAnims.integer )
- {
- *nonSegOld = *nonSeg = 0;
- return;
- }
-
- ci = &cgs.clientinfo[ clientNum ];
-
- // do the shuffle turn frames locally
- if( cent->pe.nonseg.yawing && ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) == NSPA_STAND )
- CG_RunPlayerLerpFrame( ci, ¢->pe.nonseg, NSPA_TURN, speedScale );
- else
- CG_RunPlayerLerpFrame( ci, ¢->pe.nonseg, cent->currentState.legsAnim, speedScale );
-
- *nonSegOld = cent->pe.nonseg.oldFrame;
- *nonSeg = cent->pe.nonseg.frame;
- *nonSegBackLerp = cent->pe.nonseg.backlerp;
-}
-
-/*
-=============================================================================
-
-PLAYER ANGLES
-
-=============================================================================
-*/
-
-/*
-==================
-CG_SwingAngles
-==================
-*/
-static void CG_SwingAngles( float destination, float swingTolerance, float clampTolerance,
- float speed, float *angle, qboolean *swinging )
-{
- float swing;
- float move;
- float scale;
-
- if( !*swinging )
- {
- // see if a swing should be started
- swing = AngleSubtract( *angle, destination );
-
- if( swing > swingTolerance || swing < -swingTolerance )
- *swinging = qtrue;
- }
-
- if( !*swinging )
- return;
-
- // modify the speed depending on the delta
- // so it doesn't seem so linear
- swing = AngleSubtract( destination, *angle );
- scale = fabs( swing );
-
- if( scale < swingTolerance * 0.5 )
- scale = 0.5;
- else if( scale < swingTolerance )
- scale = 1.0;
- else
- scale = 2.0;
-
- // swing towards the destination angle
- if( swing >= 0 )
- {
- move = cg.frametime * scale * speed;
-
- if( move >= swing )
- {
- move = swing;
- *swinging = qfalse;
- }
- *angle = AngleMod( *angle + move );
- }
- else if( swing < 0 )
- {
- move = cg.frametime * scale * -speed;
-
- if( move <= swing )
- {
- move = swing;
- *swinging = qfalse;
- }
- *angle = AngleMod( *angle + move );
- }
-
- // clamp to no more than tolerance
- swing = AngleSubtract( destination, *angle );
- if( swing > clampTolerance )
- *angle = AngleMod( destination - ( clampTolerance - 1 ) );
- else if( swing < -clampTolerance )
- *angle = AngleMod( destination + ( clampTolerance - 1 ) );
-}
-
-/*
-=================
-CG_AddPainTwitch
-=================
-*/
-static void CG_AddPainTwitch( centity_t *cent, vec3_t torsoAngles )
-{
- int t;
- float f;
-
- t = cg.time - cent->pe.painTime;
-
- if( t >= PAIN_TWITCH_TIME )
- return;
-
- f = 1.0 - (float)t / PAIN_TWITCH_TIME;
-
- if( cent->pe.painDirection )
- torsoAngles[ ROLL ] += 20 * f;
- else
- torsoAngles[ ROLL ] -= 20 * f;
-}
-
-
-/*
-===============
-CG_PlayerAngles
-
-Handles seperate torso motion
-
- legs pivot based on direction of movement
-
- head always looks exactly at cent->lerpAngles
-
- if motion < 20 degrees, show in head only
- if < 45 degrees, also show in torso
-===============
-*/
-static void CG_PlayerAngles( centity_t *cent, vec3_t srcAngles,
- vec3_t legs[ 3 ], vec3_t torso[ 3 ], vec3_t head[ 3 ] )
-{
- vec3_t legsAngles, torsoAngles, headAngles;
- float dest;
- static int movementOffsets[ 8 ] = { 0, 22, 45, -22, 0, 22, -45, -22 };
- vec3_t velocity;
- float speed;
- int dir, clientNum;
- clientInfo_t *ci;
-
- VectorCopy( srcAngles, headAngles );
- headAngles[ YAW ] = AngleMod( headAngles[ YAW ] );
- VectorClear( legsAngles );
- VectorClear( torsoAngles );
-
- // --------- yaw -------------
-
- // allow yaw to drift a bit
- if( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) != LEGS_IDLE ||
- ( cent->currentState.torsoAnim & ~ANIM_TOGGLEBIT ) != TORSO_STAND )
- {
- // if not standing still, always point all in the same direction
- cent->pe.torso.yawing = qtrue; // always center
- cent->pe.torso.pitching = qtrue; // always center
- cent->pe.legs.yawing = qtrue; // always center
- }
-
- // adjust legs for movement dir
- if( cent->currentState.eFlags & EF_DEAD )
- {
- // don't let dead bodies twitch
- dir = 0;
- }
- else
- {
- // did use angles2.. now uses time2.. looks a bit funny but time2 isn't used othwise
- dir = cent->currentState.time2;
- if( dir < 0 || dir > 7 )
- CG_Error( "Bad player movement angle" );
- }
-
- legsAngles[ YAW ] = headAngles[ YAW ] + movementOffsets[ dir ];
- torsoAngles[ YAW ] = headAngles[ YAW ] + 0.25 * movementOffsets[ dir ];
-
- // torso
- if( cent->currentState.eFlags & EF_DEAD )
- {
- CG_SwingAngles( torsoAngles[ YAW ], 0, 0, cg_swingSpeed.value,
- ¢->pe.torso.yawAngle, ¢->pe.torso.yawing );
- CG_SwingAngles( legsAngles[ YAW ], 0, 0, cg_swingSpeed.value,
- ¢->pe.legs.yawAngle, ¢->pe.legs.yawing );
- }
- else
- {
- CG_SwingAngles( torsoAngles[ YAW ], 25, 90, cg_swingSpeed.value,
- ¢->pe.torso.yawAngle, ¢->pe.torso.yawing );
- CG_SwingAngles( legsAngles[ YAW ], 40, 90, cg_swingSpeed.value,
- ¢->pe.legs.yawAngle, ¢->pe.legs.yawing );
- }
-
- torsoAngles[ YAW ] = cent->pe.torso.yawAngle;
- legsAngles[ YAW ] = cent->pe.legs.yawAngle;
-
- // --------- pitch -------------
-
- // only show a fraction of the pitch angle in the torso
- if( headAngles[ PITCH ] > 180 )
- dest = ( -360 + headAngles[ PITCH ] ) * 0.75f;
- else
- dest = headAngles[ PITCH ] * 0.75f;
-
- CG_SwingAngles( dest, 15, 30, 0.1f, ¢->pe.torso.pitchAngle, ¢->pe.torso.pitching );
- torsoAngles[ PITCH ] = cent->pe.torso.pitchAngle;
-
- //
- clientNum = cent->currentState.clientNum;
-
- if( clientNum >= 0 && clientNum < MAX_CLIENTS )
- {
- ci = &cgs.clientinfo[ clientNum ];
- if( ci->fixedtorso )
- torsoAngles[ PITCH ] = 0.0f;
- }
-
- // --------- roll -------------
-
-
- // lean towards the direction of travel
- VectorCopy( cent->currentState.pos.trDelta, velocity );
- speed = VectorNormalize( velocity );
-
- if( speed )
- {
- vec3_t axis[ 3 ];
- float side;
-
- speed *= 0.05f;
-
- AnglesToAxis( legsAngles, axis );
- side = speed * DotProduct( velocity, axis[ 1 ] );
- legsAngles[ ROLL ] -= side;
-
- side = speed * DotProduct( velocity, axis[ 0 ] );
- legsAngles[ PITCH ] += side;
- }
-
- //
- clientNum = cent->currentState.clientNum;
-
- if( clientNum >= 0 && clientNum < MAX_CLIENTS )
- {
- ci = &cgs.clientinfo[ clientNum ];
-
- if( ci->fixedlegs )
- {
- legsAngles[ YAW ] = torsoAngles[ YAW ];
- legsAngles[ PITCH ] = 0.0f;
- legsAngles[ ROLL ] = 0.0f;
- }
- }
-
- // pain twitch
- CG_AddPainTwitch( cent, torsoAngles );
-
- // pull the angles back out of the hierarchial chain
- AnglesSubtract( headAngles, torsoAngles, headAngles );
- AnglesSubtract( torsoAngles, legsAngles, torsoAngles );
- AnglesToAxis( legsAngles, legs );
- AnglesToAxis( torsoAngles, torso );
- AnglesToAxis( headAngles, head );
-}
-
-#define MODEL_WWSMOOTHTIME 200
-
-/*
-===============
-CG_PlayerWWSmoothing
-
-Smooth the angles of transitioning wall walkers
-===============
-*/
-static void CG_PlayerWWSmoothing( centity_t *cent, vec3_t in[ 3 ], vec3_t out[ 3 ] )
-{
- entityState_t *es = ¢->currentState;
- int i;
- vec3_t surfNormal, rotAxis, temp;
- vec3_t refNormal = { 0.0f, 0.0f, 1.0f };
- vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f };
- float stLocal, sFraction, rotAngle;
- vec3_t inAxis[ 3 ], lastAxis[ 3 ], outAxis[ 3 ];
-
- //set surfNormal
- if( !(es->eFlags & EF_WALLCLIMB ) )
- VectorCopy( refNormal, surfNormal );
- else if( !( es->eFlags & EF_WALLCLIMBCEILING ) )
- VectorCopy( es->angles2, surfNormal );
- else
- VectorCopy( ceilingNormal, surfNormal );
-
- AxisCopy( in, inAxis );
-
- if( !VectorCompare( surfNormal, cent->pe.lastNormal ) )
- {
- //if we moving from the ceiling to the floor special case
- //( x product of colinear vectors is undefined)
- if( VectorCompare( ceilingNormal, cent->pe.lastNormal ) &&
- VectorCompare( refNormal, surfNormal ) )
- {
- VectorCopy( in[ 1 ], rotAxis );
- rotAngle = 180.0f;
- }
- else
- {
- AxisCopy( cent->pe.lastAxis, lastAxis );
- rotAngle = DotProduct( inAxis[ 0 ], lastAxis[ 0 ] ) +
- DotProduct( inAxis[ 1 ], lastAxis[ 1 ] ) +
- DotProduct( inAxis[ 2 ], lastAxis[ 2 ] );
-
- rotAngle = RAD2DEG( acos( ( rotAngle - 1.0f ) / 2.0f ) );
-
- CrossProduct( lastAxis[ 0 ], inAxis[ 0 ], temp );
- VectorCopy( temp, rotAxis );
- CrossProduct( lastAxis[ 1 ], inAxis[ 1 ], temp );
- VectorAdd( rotAxis, temp, rotAxis );
- CrossProduct( lastAxis[ 2 ], inAxis[ 2 ], temp );
- VectorAdd( rotAxis, temp, rotAxis );
-
- VectorNormalize( rotAxis );
- }
-
- //iterate through smooth array
- for( i = 0; i < MAXSMOOTHS; i++ )
- {
- //found an unused index in the smooth array
- if( cent->pe.sList[ i ].time + MODEL_WWSMOOTHTIME < cg.time )
- {
- //copy to array and stop
- VectorCopy( rotAxis, cent->pe.sList[ i ].rotAxis );
- cent->pe.sList[ i ].rotAngle = rotAngle;
- cent->pe.sList[ i ].time = cg.time;
- break;
- }
- }
- }
-
- //iterate through ops
- for( i = MAXSMOOTHS - 1; i >= 0; i-- )
- {
- //if this op has time remaining, perform it
- if( cg.time < cent->pe.sList[ i ].time + MODEL_WWSMOOTHTIME )
- {
- stLocal = 1.0f - ( ( ( cent->pe.sList[ i ].time + MODEL_WWSMOOTHTIME ) - cg.time ) / MODEL_WWSMOOTHTIME );
- sFraction = -( cos( stLocal * M_PI ) + 1.0f ) / 2.0f;
-
- RotatePointAroundVector( outAxis[ 0 ], cent->pe.sList[ i ].rotAxis,
- inAxis[ 0 ], sFraction * cent->pe.sList[ i ].rotAngle );
- RotatePointAroundVector( outAxis[ 1 ], cent->pe.sList[ i ].rotAxis,
- inAxis[ 1 ], sFraction * cent->pe.sList[ i ].rotAngle );
- RotatePointAroundVector( outAxis[ 2 ], cent->pe.sList[ i ].rotAxis,
- inAxis[ 2 ], sFraction * cent->pe.sList[ i ].rotAngle );
-
- AxisCopy( outAxis, inAxis );
- }
- }
-
- //outAxis has been copied to inAxis
- AxisCopy( inAxis, out );
-}
-
-/*
-===============
-CG_PlayerNonSegAngles
-
-Resolve angles for non-segmented models
-===============
-*/
-static void CG_PlayerNonSegAngles( centity_t *cent, vec3_t srcAngles, vec3_t nonSegAxis[ 3 ] )
-{
- vec3_t localAngles;
- vec3_t velocity;
- float speed;
- int dir;
- entityState_t *es = ¢->currentState;
- vec3_t surfNormal;
- vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f };
-
- VectorCopy( srcAngles, localAngles );
- localAngles[ YAW ] = AngleMod( localAngles[ YAW ] );
- localAngles[ PITCH ] = 0.0f;
- localAngles[ ROLL ] = 0.0f;
-
- //set surfNormal
- if( !( es->eFlags & EF_WALLCLIMBCEILING ) )
- VectorCopy( es->angles2, surfNormal );
- else
- VectorCopy( ceilingNormal, surfNormal );
-
- //make sure that WW transitions don't cause the swing stuff to go nuts
- if( !VectorCompare( surfNormal, cent->pe.lastNormal ) )
- {
- //stop CG_SwingAngles having an eppy
- cent->pe.nonseg.yawAngle = localAngles[ YAW ];
- cent->pe.nonseg.yawing = qfalse;
- }
-
- // --------- yaw -------------
-
- // allow yaw to drift a bit
- if( ( cent->currentState.legsAnim & ~ANIM_TOGGLEBIT ) != NSPA_STAND )
- {
- // if not standing still, always point all in the same direction
- cent->pe.nonseg.yawing = qtrue; // always center
- }
-
- // adjust legs for movement dir
- if( cent->currentState.eFlags & EF_DEAD )
- {
- // don't let dead bodies twitch
- dir = 0;
- }
- else
- {
- // did use angles2.. now uses time2.. looks a bit funny but time2 isn't used othwise
- dir = cent->currentState.time2;
- if( dir < 0 || dir > 7 )
- CG_Error( "Bad player movement angle" );
- }
-
- // torso
- if( cent->currentState.eFlags & EF_DEAD )
- {
- CG_SwingAngles( localAngles[ YAW ], 0, 0, cg_swingSpeed.value,
- ¢->pe.nonseg.yawAngle, ¢->pe.nonseg.yawing );
- }
- else
- {
- CG_SwingAngles( localAngles[ YAW ], 40, 90, cg_swingSpeed.value,
- ¢->pe.nonseg.yawAngle, ¢->pe.nonseg.yawing );
- }
-
- localAngles[ YAW ] = cent->pe.nonseg.yawAngle;
-
- // --------- pitch -------------
-
- //NO PITCH!
-
-
- // --------- roll -------------
-
-
- // lean towards the direction of travel
- VectorCopy( cent->currentState.pos.trDelta, velocity );
- speed = VectorNormalize( velocity );
-
- if( speed )
- {
- vec3_t axis[ 3 ];
- float side;
-
- //much less than with the regular model system
- speed *= 0.01f;
-
- AnglesToAxis( localAngles, axis );
- side = speed * DotProduct( velocity, axis[ 1 ] );
- localAngles[ ROLL ] -= side;
-
- side = speed * DotProduct( velocity, axis[ 0 ] );
- localAngles[ PITCH ] += side;
- }
-
- //FIXME: PAIN[123] animations?
- // pain twitch
- //CG_AddPainTwitch( cent, torsoAngles );
-
- AnglesToAxis( localAngles, nonSegAxis );
-}
-
-
-//==========================================================================
-
-/*
-===============
-CG_PlayerUpgrade
-===============
-*/
-static void CG_PlayerUpgrades( centity_t *cent, refEntity_t *torso )
-{
- int held, active;
- refEntity_t jetpack;
- refEntity_t battpack;
- refEntity_t flash;
- entityState_t *es = ¢->currentState;
-
- held = es->modelindex;
- active = es->modelindex2;
-
- if( held & ( 1 << UP_JETPACK ) )
- {
- memset( &jetpack, 0, sizeof( jetpack ) );
- VectorCopy( torso->lightingOrigin, jetpack.lightingOrigin );
- jetpack.shadowPlane = torso->shadowPlane;
- jetpack.renderfx = torso->renderfx;
-
- jetpack.hModel = cgs.media.jetpackModel;
-
- //identity matrix
- AxisCopy( axisDefault, jetpack.axis );
-
- //FIXME: change to tag_back when it exists
- CG_PositionRotatedEntityOnTag( &jetpack, torso, torso->hModel, "tag_head" );
-
- trap_R_AddRefEntityToScene( &jetpack );
-
- if( active & ( 1 << UP_JETPACK ) )
- {
- if( es->pos.trDelta[ 2 ] > 10.0f )
- {
- if( cent->jetPackState != JPS_ASCENDING )
- {
- if( CG_IsParticleSystemValid( ¢->jetPackPS ) )
- CG_DestroyParticleSystem( ¢->jetPackPS );
-
- cent->jetPackPS = CG_SpawnNewParticleSystem( cgs.media.jetPackAscendPS );
- cent->jetPackState = JPS_ASCENDING;
- }
-
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin,
- vec3_origin, cgs.media.jetpackAscendSound );
- }
- else if( es->pos.trDelta[ 2 ] < -10.0f )
- {
- if( cent->jetPackState != JPS_DESCENDING )
- {
- if( CG_IsParticleSystemValid( ¢->jetPackPS ) )
- CG_DestroyParticleSystem( ¢->jetPackPS );
-
- cent->jetPackPS = CG_SpawnNewParticleSystem( cgs.media.jetPackDescendPS );
- cent->jetPackState = JPS_DESCENDING;
- }
-
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin,
- vec3_origin, cgs.media.jetpackDescendSound );
- }
- else
- {
- if( cent->jetPackState != JPS_HOVERING )
- {
- if( CG_IsParticleSystemValid( ¢->jetPackPS ) )
- CG_DestroyParticleSystem( ¢->jetPackPS );
-
- cent->jetPackPS = CG_SpawnNewParticleSystem( cgs.media.jetPackHoverPS );
- cent->jetPackState = JPS_HOVERING;
- }
-
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin,
- vec3_origin, cgs.media.jetpackIdleSound );
- }
-
- memset( &flash, 0, sizeof( flash ) );
- VectorCopy( torso->lightingOrigin, flash.lightingOrigin );
- flash.shadowPlane = torso->shadowPlane;
- flash.renderfx = torso->renderfx;
-
- flash.hModel = cgs.media.jetpackFlashModel;
- if( !flash.hModel )
- return;
-
- AxisCopy( axisDefault, flash.axis );
-
- CG_PositionRotatedEntityOnTag( &flash, &jetpack, jetpack.hModel, "tag_flash" );
- trap_R_AddRefEntityToScene( &flash );
-
- if( CG_IsParticleSystemValid( ¢->jetPackPS ) )
- {
- CG_SetAttachmentTag( ¢->jetPackPS->attachment,
- jetpack, jetpack.hModel, "tag_flash" );
- CG_SetAttachmentCent( ¢->jetPackPS->attachment, cent );
- CG_AttachToTag( ¢->jetPackPS->attachment );
- }
- }
- else if( CG_IsParticleSystemValid( ¢->jetPackPS ) )
- {
- CG_DestroyParticleSystem( ¢->jetPackPS );
- cent->jetPackState = JPS_OFF;
- }
- }
- else if( CG_IsParticleSystemValid( ¢->jetPackPS ) )
- {
- CG_DestroyParticleSystem( ¢->jetPackPS );
- cent->jetPackState = JPS_OFF;
- }
-
- if( held & ( 1 << UP_BATTPACK ) )
- {
- memset( &battpack, 0, sizeof( battpack ) );
- VectorCopy( torso->lightingOrigin, battpack.lightingOrigin );
- battpack.shadowPlane = torso->shadowPlane;
- battpack.renderfx = torso->renderfx;
-
- battpack.hModel = cgs.media.battpackModel;
-
- //identity matrix
- AxisCopy( axisDefault, battpack.axis );
-
- //FIXME: change to tag_back when it exists
- CG_PositionRotatedEntityOnTag( &battpack, torso, torso->hModel, "tag_head" );
-
- trap_R_AddRefEntityToScene( &battpack );
- }
-
- if( es->eFlags & EF_BLOBLOCKED )
- {
- vec3_t temp, origin, up = { 0.0f, 0.0f, 1.0f };
- trace_t tr;
- float size;
-
- VectorCopy( es->pos.trBase, temp );
- temp[ 2 ] -= 4096.0f;
-
- CG_Trace( &tr, es->pos.trBase, NULL, NULL, temp, es->number, MASK_SOLID );
- VectorCopy( tr.endpos, origin );
-
- size = 32.0f;
-
- if( size > 0.0f )
- CG_ImpactMark( cgs.media.creepShader, origin, up,
- 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, qfalse, size, qtrue );
- }
-}
-
-
-/*
-===============
-CG_PlayerFloatSprite
-
-Float a sprite over the player's head
-===============
-*/
-static void CG_PlayerFloatSprite( centity_t *cent, qhandle_t shader )
-{
- int rf;
- refEntity_t ent;
-
- if( cent->currentState.number == cg.snap->ps.clientNum && !cg.renderingThirdPerson )
- rf = RF_THIRD_PERSON; // only show in mirrors
- else
- rf = 0;
-
- memset( &ent, 0, sizeof( ent ) );
- VectorCopy( cent->lerpOrigin, ent.origin );
- ent.origin[ 2 ] += 48;
- ent.reType = RT_SPRITE;
- ent.customShader = shader;
- ent.radius = 10;
- ent.renderfx = rf;
- ent.shaderRGBA[ 0 ] = 255;
- ent.shaderRGBA[ 1 ] = 255;
- ent.shaderRGBA[ 2 ] = 255;
- ent.shaderRGBA[ 3 ] = 255;
- trap_R_AddRefEntityToScene( &ent );
-}
-
-
-
-/*
-===============
-CG_PlayerSprites
-
-Float sprites over the player's head
-===============
-*/
-static void CG_PlayerSprites( centity_t *cent )
-{
- if( cent->currentState.eFlags & EF_CONNECTION )
- {
- CG_PlayerFloatSprite( cent, cgs.media.connectionShader );
- return;
- }
-
- if( cent->currentState.eFlags & EF_TALK )
- {
- // the masses have decreed this to be wrong
-/* CG_PlayerFloatSprite( cent, cgs.media.balloonShader );
- return;*/
- }
-}
-
-/*
-===============
-CG_PlayerShadow
-
-Returns the Z component of the surface being shadowed
-
- should it return a full plane instead of a Z?
-===============
-*/
-#define SHADOW_DISTANCE 128
-static qboolean CG_PlayerShadow( centity_t *cent, float *shadowPlane, pClass_t class )
-{
- vec3_t end, mins, maxs;
- trace_t trace;
- float alpha;
- entityState_t *es = ¢->currentState;
- vec3_t surfNormal = { 0.0f, 0.0f, 1.0f };
-
- BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL );
- mins[ 2 ] = 0.0f;
- maxs[ 2 ] = 2.0f;
-
- if( es->eFlags & EF_WALLCLIMB )
- {
- if( es->eFlags & EF_WALLCLIMBCEILING )
- VectorSet( surfNormal, 0.0f, 0.0f, -1.0f );
- else
- VectorCopy( es->angles2, surfNormal );
- }
-
- *shadowPlane = 0;
-
- if( cg_shadows.integer == 0 )
- return qfalse;
-
- // send a trace down from the player to the ground
- VectorCopy( cent->lerpOrigin, end );
- VectorMA( cent->lerpOrigin, -SHADOW_DISTANCE, surfNormal, end );
-
- trap_CM_BoxTrace( &trace, cent->lerpOrigin, end, mins, maxs, 0, MASK_PLAYERSOLID );
-
- // no shadow if too high
- if( trace.fraction == 1.0 || trace.startsolid || trace.allsolid )
- return qfalse;
-
- // FIXME: stencil shadows will be broken for walls.
- // Unfortunately there isn't much that can be
- // done since Q3 references only the Z coord
- // of the shadowPlane
- if( surfNormal[ 2 ] < 0.0f )
- *shadowPlane = trace.endpos[ 2 ] - 1.0f;
- else
- *shadowPlane = trace.endpos[ 2 ] + 1.0f;
-
- if( cg_shadows.integer != 1 ) // no mark for stencil or projection shadows
- return qtrue;
-
- // fade the shadow out with height
- alpha = 1.0 - trace.fraction;
-
- // add the mark as a temporary, so it goes directly to the renderer
- // without taking a spot in the cg_marks array
- CG_ImpactMark( cgs.media.shadowMarkShader, trace.endpos, trace.plane.normal,
- cent->pe.legs.yawAngle, 0.0f, 0.0f, 0.0f, alpha, qfalse,
- 24.0f * BG_FindShadowScaleForClass( class ), qtrue );
-
- return qtrue;
-}
-
-
-/*
-===============
-CG_PlayerSplash
-
-Draw a mark at the water surface
-===============
-*/
-static void CG_PlayerSplash( centity_t *cent, pClass_t class )
-{
- vec3_t start, end;
- vec3_t mins, maxs;
- trace_t trace;
- int contents;
-
- if( !cg_shadows.integer )
- return;
-
- BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL );
-
- VectorCopy( cent->lerpOrigin, end );
- end[ 2 ] += mins[ 2 ];
-
- // if the feet aren't in liquid, don't make a mark
- // this won't handle moving water brushes, but they wouldn't draw right anyway...
- contents = trap_CM_PointContents( end, 0 );
-
- if( !( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) ) )
- return;
-
- VectorCopy( cent->lerpOrigin, start );
- start[ 2 ] += 32;
-
- // if the head isn't out of liquid, don't make a mark
- contents = trap_CM_PointContents( start, 0 );
-
- if( contents & ( CONTENTS_SOLID | CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) )
- return;
-
- // trace down to find the surface
- trap_CM_BoxTrace( &trace, start, end, NULL, NULL, 0,
- ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) );
-
- if( trace.fraction == 1.0f )
- return;
-
- CG_ImpactMark( cgs.media.wakeMarkShader, trace.endpos, trace.plane.normal,
- cent->pe.legs.yawAngle, 1.0f, 1.0f, 1.0f, 1.0f, qfalse,
- 32.0f * BG_FindShadowScaleForClass( class ), qtrue );
-}
-
-
-/*
-=================
-CG_LightVerts
-=================
-*/
-int CG_LightVerts( vec3_t normal, int numVerts, polyVert_t *verts )
-{
- int i, j;
- float incoming;
- vec3_t ambientLight;
- vec3_t lightDir;
- vec3_t directedLight;
-
- trap_R_LightForPoint( verts[ 0 ].xyz, ambientLight, directedLight, lightDir );
-
- for( i = 0; i < numVerts; i++ )
- {
- incoming = DotProduct( normal, lightDir );
-
- if( incoming <= 0 )
- {
- verts[ i ].modulate[ 0 ] = ambientLight[ 0 ];
- verts[ i ].modulate[ 1 ] = ambientLight[ 1 ];
- verts[ i ].modulate[ 2 ] = ambientLight[ 2 ];
- verts[ i ].modulate[ 3 ] = 255;
- continue;
- }
-
- j = ( ambientLight[ 0 ] + incoming * directedLight[ 0 ] );
-
- if( j > 255 )
- j = 255;
-
- verts[ i ].modulate[ 0 ] = j;
-
- j = ( ambientLight[ 1 ] + incoming * directedLight[ 1 ] );
-
- if( j > 255 )
- j = 255;
-
- verts[ i ].modulate[ 1 ] = j;
-
- j = ( ambientLight[ 2 ] + incoming * directedLight[ 2 ] );
-
- if( j > 255 )
- j = 255;
-
- verts[ i ].modulate[ 2 ] = j;
-
- verts[ i ].modulate[ 3 ] = 255;
- }
- return qtrue;
-}
-
-
-/*
-=================
-CG_LightFromDirection
-=================
-*/
-int CG_LightFromDirection( vec3_t point, vec3_t direction )
-{
- int j;
- float incoming;
- vec3_t ambientLight;
- vec3_t lightDir;
- vec3_t directedLight;
- vec3_t result;
-
- trap_R_LightForPoint( point, ambientLight, directedLight, lightDir );
-
- incoming = DotProduct( direction, lightDir );
-
- if( incoming <= 0 )
- {
- result[ 0 ] = ambientLight[ 0 ];
- result[ 1 ] = ambientLight[ 1 ];
- result[ 2 ] = ambientLight[ 2 ];
- return (int)( (float)( result[ 0 ] + result[ 1 ] + result[ 2 ] ) / 3.0f );
- }
-
- j = ( ambientLight[ 0 ] + incoming * directedLight[ 0 ] );
-
- if( j > 255 )
- j = 255;
-
- result[ 0 ] = j;
-
- j = ( ambientLight[ 1 ] + incoming * directedLight[ 1 ] );
-
- if( j > 255 )
- j = 255;
-
- result[ 1 ] = j;
-
- j = ( ambientLight[ 2 ] + incoming * directedLight[ 2 ] );
-
- if( j > 255 )
- j = 255;
-
- result[ 2 ] = j;
-
- return (int)((float)( result[ 0 ] + result[ 1 ] + result[ 2 ] ) / 3.0f );
-}
-
-
-/*
-=================
-CG_AmbientLight
-=================
-*/
-int CG_AmbientLight( vec3_t point )
-{
- vec3_t ambientLight;
- vec3_t lightDir;
- vec3_t directedLight;
- vec3_t result;
-
- trap_R_LightForPoint( point, ambientLight, directedLight, lightDir );
-
- result[ 0 ] = ambientLight[ 0 ];
- result[ 1 ] = ambientLight[ 1 ];
- result[ 2 ] = ambientLight[ 2 ];
- return (int)((float)( result[ 0 ] + result[ 1 ] + result[ 2 ] ) / 3.0f );
-}
-
-#define TRACE_DEPTH 32.0f
-
-/*
-===============
-CG_Player
-===============
-*/
-void CG_Player( centity_t *cent )
-{
- clientInfo_t *ci;
-
- // NOTE: legs is used for nonsegmented models
- // this helps reduce code to be changed
- refEntity_t legs;
- refEntity_t torso;
- refEntity_t head;
- int clientNum;
- int renderfx;
- qboolean shadow = qfalse;
- float shadowPlane;
- entityState_t *es = ¢->currentState;
- pClass_t class = ( es->powerups >> 8 ) & 0xFF;
- float scale;
- vec3_t tempAxis[ 3 ], tempAxis2[ 3 ];
- vec3_t angles;
- int held = es->modelindex;
- vec3_t surfNormal = { 0.0f, 0.0f, 1.0f };
-
- // the client number is stored in clientNum. It can't be derived
- // from the entity number, because a single client may have
- // multiple corpses on the level using the same clientinfo
- clientNum = es->clientNum;
- if( clientNum < 0 || clientNum >= MAX_CLIENTS )
- CG_Error( "Bad clientNum on player entity" );
-
- ci = &cgs.clientinfo[ clientNum ];
-
- // it is possible to see corpses from disconnected players that may
- // not have valid clientinfo
- if( !ci->infoValid )
- return;
-
- //don't draw
- if( es->eFlags & EF_NODRAW )
- return;
-
- // get the player model information
- renderfx = 0;
- if( es->number == cg.snap->ps.clientNum )
- {
- if( !cg.renderingThirdPerson )
- renderfx = RF_THIRD_PERSON; // only draw in mirrors
- else if( cg_cameraMode.integer )
- return;
- }
-
- if( cg_drawBBOX.integer )
- {
- vec3_t mins, maxs;
-
- BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL );
- CG_DrawBoundingBox( cent->lerpOrigin, mins, maxs );
- }
-
- memset( &legs, 0, sizeof( legs ) );
- memset( &torso, 0, sizeof( torso ) );
- memset( &head, 0, sizeof( head ) );
-
- VectorCopy( cent->lerpAngles, angles );
- AnglesToAxis( cent->lerpAngles, tempAxis );
-
- //rotate lerpAngles to floor
- if( es->eFlags & EF_WALLCLIMB &&
- BG_RotateAxis( es->angles2, tempAxis, tempAxis2, qtrue, es->eFlags & EF_WALLCLIMBCEILING ) )
- AxisToAngles( tempAxis2, angles );
- else
- VectorCopy( cent->lerpAngles, angles );
-
- //normalise the pitch
- if( angles[ PITCH ] < -180.0f )
- angles[ PITCH ] += 360.0f;
-
- // get the rotation information
- if( !ci->nonsegmented )
- CG_PlayerAngles( cent, angles, legs.axis, torso.axis, head.axis );
- else
- CG_PlayerNonSegAngles( cent, angles, legs.axis );
-
- AxisCopy( legs.axis, tempAxis );
-
- //rotate the legs axis to back to the wall
- if( es->eFlags & EF_WALLCLIMB &&
- BG_RotateAxis( es->angles2, legs.axis, tempAxis, qfalse, es->eFlags & EF_WALLCLIMBCEILING ) )
- AxisCopy( tempAxis, legs.axis );
-
- //smooth out WW transitions so the model doesn't hop around
- CG_PlayerWWSmoothing( cent, legs.axis, legs.axis );
-
- AxisCopy( tempAxis, cent->pe.lastAxis );
-
- // get the animation state (after rotation, to allow feet shuffle)
- if( !ci->nonsegmented )
- CG_PlayerAnimation( cent, &legs.oldframe, &legs.frame, &legs.backlerp,
- &torso.oldframe, &torso.frame, &torso.backlerp );
- else
- CG_PlayerNonSegAnimation( cent, &legs.oldframe, &legs.frame, &legs.backlerp );
-
- // add the talk baloon or disconnect icon
- CG_PlayerSprites( cent );
-
- // add the shadow
- if( ( es->number == cg.snap->ps.clientNum && cg.renderingThirdPerson ) ||
- es->number != cg.snap->ps.clientNum )
- shadow = CG_PlayerShadow( cent, &shadowPlane, class );
-
- // add a water splash if partially in and out of water
- CG_PlayerSplash( cent, class );
-
- if( cg_shadows.integer == 3 && shadow )
- renderfx |= RF_SHADOW_PLANE;
-
- renderfx |= RF_LIGHTING_ORIGIN; // use the same origin for all
-
- //
- // add the legs
- //
- if( !ci->nonsegmented )
- {
- legs.hModel = ci->legsModel;
-
- if( held & ( 1 << UP_LIGHTARMOUR ) )
- legs.customSkin = cgs.media.larmourLegsSkin;
- else
- legs.customSkin = ci->legsSkin;
- }
- else
- {
- legs.hModel = ci->nonSegModel;
- legs.customSkin = ci->nonSegSkin;
- }
-
- VectorCopy( cent->lerpOrigin, legs.origin );
-
- VectorCopy( cent->lerpOrigin, legs.lightingOrigin );
- legs.shadowPlane = shadowPlane;
- legs.renderfx = renderfx;
- VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all
-
- //move the origin closer into the wall with a CapTrace
- if( es->eFlags & EF_WALLCLIMB && !( es->eFlags & EF_DEAD ) && !( cg.intermissionStarted ) )
- {
- vec3_t start, end, mins, maxs;
- trace_t tr;
-
- if( es->eFlags & EF_WALLCLIMBCEILING )
- VectorSet( surfNormal, 0.0f, 0.0f, -1.0f );
- else
- VectorCopy( es->angles2, surfNormal );
-
- BG_FindBBoxForClass( class, mins, maxs, NULL, NULL, NULL );
-
- VectorMA( legs.origin, -TRACE_DEPTH, surfNormal, end );
- VectorMA( legs.origin, 1.0f, surfNormal, start );
- CG_CapTrace( &tr, start, mins, maxs, end, es->number, MASK_PLAYERSOLID );
-
- //if the trace misses completely then just use legs.origin
- //apparently capsule traces are "smaller" than box traces
- if( tr.fraction != 1.0f )
- VectorMA( legs.origin, tr.fraction * -TRACE_DEPTH, surfNormal, legs.origin );
-
- VectorCopy( legs.origin, legs.lightingOrigin );
- VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all
- }
-
- //rescale the model
- scale = BG_FindModelScaleForClass( class );
-
- if( scale != 1.0f )
- {
- VectorScale( legs.axis[ 0 ], scale, legs.axis[ 0 ] );
- VectorScale( legs.axis[ 1 ], scale, legs.axis[ 1 ] );
- VectorScale( legs.axis[ 2 ], scale, legs.axis[ 2 ] );
-
- legs.nonNormalizedAxes = qtrue;
- }
-
- //offset on the Z axis if required
- VectorMA( legs.origin, BG_FindZOffsetForClass( class ), surfNormal, legs.origin );
- VectorCopy( legs.origin, legs.lightingOrigin );
- VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all
-
- trap_R_AddRefEntityToScene( &legs );
-
- // if the model failed, allow the default nullmodel to be displayed
- if( !legs.hModel )
- return;
-
- if( !ci->nonsegmented )
- {
- //
- // add the torso
- //
- torso.hModel = ci->torsoModel;
-
- if( held & ( 1 << UP_LIGHTARMOUR ) )
- torso.customSkin = cgs.media.larmourTorsoSkin;
- else
- torso.customSkin = ci->torsoSkin;
-
- if( !torso.hModel )
- return;
-
- VectorCopy( cent->lerpOrigin, torso.lightingOrigin );
-
- CG_PositionRotatedEntityOnTag( &torso, &legs, ci->legsModel, "tag_torso" );
-
- torso.shadowPlane = shadowPlane;
- torso.renderfx = renderfx;
-
- trap_R_AddRefEntityToScene( &torso );
-
- //
- // add the head
- //
- head.hModel = ci->headModel;
-
- if( held & ( 1 << UP_HELMET ) )
- head.customSkin = cgs.media.larmourHeadSkin;
- else
- head.customSkin = ci->headSkin;
-
- if( !head.hModel )
- return;
-
- VectorCopy( cent->lerpOrigin, head.lightingOrigin );
-
- CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_head" );
-
- head.shadowPlane = shadowPlane;
- head.renderfx = renderfx;
-
- trap_R_AddRefEntityToScene( &head );
- }
-
- //
- // add the gun / barrel / flash
- //
- if( es->weapon != WP_NONE )
- {
- if( !ci->nonsegmented )
- CG_AddPlayerWeapon( &torso, NULL, cent );
- else
- CG_AddPlayerWeapon( &legs, NULL, cent );
- }
-
- CG_PlayerUpgrades( cent, &torso );
-
- //sanity check that particle systems are stopped when dead
- if( es->eFlags & EF_DEAD )
- {
- if( CG_IsParticleSystemValid( ¢->muzzlePS ) )
- CG_DestroyParticleSystem( ¢->muzzlePS );
-
- if( CG_IsParticleSystemValid( ¢->jetPackPS ) )
- CG_DestroyParticleSystem( ¢->jetPackPS );
- }
-
- VectorCopy( surfNormal, cent->pe.lastNormal );
-}
-
-/*
-===============
-CG_Corpse
-===============
-*/
-void CG_Corpse( centity_t *cent )
-{
- clientInfo_t *ci;
- refEntity_t legs;
- refEntity_t torso;
- refEntity_t head;
- entityState_t *es = ¢->currentState;
- int corpseNum;
- int renderfx;
- qboolean shadow = qfalse;
- float shadowPlane;
- vec3_t origin, liveZ, deadZ;
- float scale;
-
- corpseNum = CG_GetCorpseNum( es->clientNum );
-
- if( corpseNum < 0 || corpseNum >= MAX_CLIENTS )
- CG_Error( "Bad corpseNum on corpse entity: %d", corpseNum );
-
- ci = &cgs.corpseinfo[ corpseNum ];
-
- // it is possible to see corpses from disconnected players that may
- // not have valid clientinfo
- if( !ci->infoValid )
- return;
-
- memset( &legs, 0, sizeof( legs ) );
- memset( &torso, 0, sizeof( torso ) );
- memset( &head, 0, sizeof( head ) );
-
- VectorCopy( cent->lerpOrigin, origin );
- BG_FindBBoxForClass( es->clientNum, liveZ, NULL, NULL, deadZ, NULL );
- origin[ 2 ] -= ( liveZ[ 2 ] - deadZ[ 2 ] );
-
- VectorCopy( es->angles, cent->lerpAngles );
-
- // get the rotation information
- if( !ci->nonsegmented )
- CG_PlayerAngles( cent, cent->lerpAngles, legs.axis, torso.axis, head.axis );
- else
- CG_PlayerNonSegAngles( cent, cent->lerpAngles, legs.axis );
-
- //set the correct frame (should always be dead)
- if( cg_noPlayerAnims.integer )
- legs.oldframe = legs.frame = torso.oldframe = torso.frame = 0;
- else if( !ci->nonsegmented )
- {
- memset( ¢->pe.legs, 0, sizeof( lerpFrame_t ) );
- CG_RunPlayerLerpFrame( ci, ¢->pe.legs, es->legsAnim, 1 );
- legs.oldframe = cent->pe.legs.oldFrame;
- legs.frame = cent->pe.legs.frame;
- legs.backlerp = cent->pe.legs.backlerp;
-
- memset( ¢->pe.torso, 0, sizeof( lerpFrame_t ) );
- CG_RunPlayerLerpFrame( ci, ¢->pe.torso, es->torsoAnim, 1 );
- torso.oldframe = cent->pe.torso.oldFrame;
- torso.frame = cent->pe.torso.frame;
- torso.backlerp = cent->pe.torso.backlerp;
- }
- else
- {
- memset( ¢->pe.nonseg, 0, sizeof( lerpFrame_t ) );
- CG_RunPlayerLerpFrame( ci, ¢->pe.nonseg, es->legsAnim, 1 );
- legs.oldframe = cent->pe.nonseg.oldFrame;
- legs.frame = cent->pe.nonseg.frame;
- legs.backlerp = cent->pe.nonseg.backlerp;
- }
-
- // add the shadow
- shadow = CG_PlayerShadow( cent, &shadowPlane, es->clientNum );
-
- // get the player model information
- renderfx = 0;
-
- if( cg_shadows.integer == 3 && shadow )
- renderfx |= RF_SHADOW_PLANE;
-
- renderfx |= RF_LIGHTING_ORIGIN; // use the same origin for all
-
- //
- // add the legs
- //
- if( !ci->nonsegmented )
- {
- legs.hModel = ci->legsModel;
- legs.customSkin = ci->legsSkin;
- }
- else
- {
- legs.hModel = ci->nonSegModel;
- legs.customSkin = ci->nonSegSkin;
- }
-
- VectorCopy( origin, legs.origin );
-
- VectorCopy( origin, legs.lightingOrigin );
- legs.shadowPlane = shadowPlane;
- legs.renderfx = renderfx;
- legs.origin[ 2 ] += BG_FindZOffsetForClass( es->clientNum );
- VectorCopy( legs.origin, legs.oldorigin ); // don't positionally lerp at all
-
- //rescale the model
- scale = BG_FindModelScaleForClass( es->clientNum );
-
- if( scale != 1.0f )
- {
- VectorScale( legs.axis[ 0 ], scale, legs.axis[ 0 ] );
- VectorScale( legs.axis[ 1 ], scale, legs.axis[ 1 ] );
- VectorScale( legs.axis[ 2 ], scale, legs.axis[ 2 ] );
-
- legs.nonNormalizedAxes = qtrue;
- }
-
- //CG_AddRefEntityWithPowerups( &legs, es->powerups, ci->team );
- trap_R_AddRefEntityToScene( &legs );
-
- // if the model failed, allow the default nullmodel to be displayed
- if( !legs.hModel )
- return;
-
- if( !ci->nonsegmented )
- {
- //
- // add the torso
- //
- torso.hModel = ci->torsoModel;
- if( !torso.hModel )
- return;
-
- torso.customSkin = ci->torsoSkin;
-
- VectorCopy( origin, torso.lightingOrigin );
-
- CG_PositionRotatedEntityOnTag( &torso, &legs, ci->legsModel, "tag_torso" );
-
- torso.shadowPlane = shadowPlane;
- torso.renderfx = renderfx;
-
- //CG_AddRefEntityWithPowerups( &torso, es->powerups, ci->team );
- trap_R_AddRefEntityToScene( &torso );
-
- //
- // add the head
- //
- head.hModel = ci->headModel;
- if( !head.hModel )
- return;
-
- head.customSkin = ci->headSkin;
-
- VectorCopy( origin, head.lightingOrigin );
-
- CG_PositionRotatedEntityOnTag( &head, &torso, ci->torsoModel, "tag_head");
-
- head.shadowPlane = shadowPlane;
- head.renderfx = renderfx;
-
- //CG_AddRefEntityWithPowerups( &head, es->powerups, ci->team );
- trap_R_AddRefEntityToScene( &head );
- }
-}
-
-
-//=====================================================================
-
-/*
-===============
-CG_ResetPlayerEntity
-
-A player just came into view or teleported, so reset all animation info
-===============
-*/
-void CG_ResetPlayerEntity( centity_t *cent )
-{
- cent->errorTime = -99999; // guarantee no error decay added
- cent->extrapolated = qfalse;
-
- CG_ClearLerpFrame( &cgs.clientinfo[ cent->currentState.clientNum ],
- ¢->pe.legs, cent->currentState.legsAnim );
- CG_ClearLerpFrame( &cgs.clientinfo[ cent->currentState.clientNum ],
- ¢->pe.torso, cent->currentState.torsoAnim );
- CG_ClearLerpFrame( &cgs.clientinfo[ cent->currentState.clientNum ],
- ¢->pe.nonseg, cent->currentState.legsAnim );
-
- BG_EvaluateTrajectory( ¢->currentState.pos, cg.time, cent->lerpOrigin );
- BG_EvaluateTrajectory( ¢->currentState.apos, cg.time, cent->lerpAngles );
-
- VectorCopy( cent->lerpOrigin, cent->rawOrigin );
- VectorCopy( cent->lerpAngles, cent->rawAngles );
-
- memset( ¢->pe.legs, 0, sizeof( cent->pe.legs ) );
- cent->pe.legs.yawAngle = cent->rawAngles[ YAW ];
- cent->pe.legs.yawing = qfalse;
- cent->pe.legs.pitchAngle = 0;
- cent->pe.legs.pitching = qfalse;
-
- memset( ¢->pe.torso, 0, sizeof( cent->pe.legs ) );
- cent->pe.torso.yawAngle = cent->rawAngles[ YAW ];
- cent->pe.torso.yawing = qfalse;
- cent->pe.torso.pitchAngle = cent->rawAngles[ PITCH ];
- cent->pe.torso.pitching = qfalse;
-
- memset( ¢->pe.nonseg, 0, sizeof( cent->pe.nonseg ) );
- cent->pe.nonseg.yawAngle = cent->rawAngles[ YAW ];
- cent->pe.nonseg.yawing = qfalse;
- cent->pe.nonseg.pitchAngle = cent->rawAngles[ PITCH ];
- cent->pe.nonseg.pitching = qfalse;
-
- if( cg_debugPosition.integer )
- CG_Printf( "%i ResetPlayerEntity yaw=%i\n", cent->currentState.number, cent->pe.torso.yawAngle );
-}
-
-/*
-==================
-CG_PlayerDisconnect
-
-Player disconnecting
-==================
-*/
-void CG_PlayerDisconnect( vec3_t org )
-{
- particleSystem_t *ps;
-
- trap_S_StartSound( org, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.disconnectSound );
-
- ps = CG_SpawnNewParticleSystem( cgs.media.disconnectPS );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentPoint( &ps->attachment, org );
- CG_AttachToPoint( &ps->attachment );
- }
-}
-
-/*
-=================
-CG_Bleed
-
-This is the spurt of blood when a character gets hit
-=================
-*/
-void CG_Bleed( vec3_t origin, vec3_t normal, int entityNum )
-{
- pTeam_t team = cgs.clientinfo[ entityNum ].team;
- qhandle_t bleedPS;
- particleSystem_t *ps;
-
- if( !cg_blood.integer )
- return;
-
- if( team == PTE_ALIENS )
- bleedPS = cgs.media.alienBleedPS;
- else if( team == PTE_HUMANS )
- bleedPS = cgs.media.humanBleedPS;
- else
- return;
-
- ps = CG_SpawnNewParticleSystem( bleedPS );
-
- if( CG_IsParticleSystemValid( &ps ) )
- {
- CG_SetAttachmentPoint( &ps->attachment, origin );
- CG_SetAttachmentCent( &ps->attachment, &cg_entities[ entityNum ] );
- CG_AttachToPoint( &ps->attachment );
-
- CG_SetParticleSystemNormal( ps, normal );
- }
-}
-
-/*
-===============
-CG_AtHighestClass
-
-Is the local client at the highest class possible?
-===============
-*/
-qboolean CG_AtHighestClass( void )
-{
- int i;
- qboolean superiorClasses = qfalse;
-
- for( i = PCL_NONE + 1; i < PCL_NUM_CLASSES; i++ )
- {
- if( BG_ClassCanEvolveFromTo(
- cg.predictedPlayerState.stats[ STAT_PCLASS ], i,
- ALIEN_MAX_KILLS, 0 ) >= 0 &&
- BG_FindStagesForClass( i, cgs.alienStage ) &&
- BG_ClassIsAllowed( i ) )
- {
- superiorClasses = qtrue;
- break;
- }
- }
-
- return !superiorClasses;
-}
-
diff --git a/src/cgame/cg_playerstate.c b/src/cgame/cg_playerstate.c
deleted file mode 100644
index e1bcb09..0000000
--- a/src/cgame/cg_playerstate.c
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_playerstate.c -- this file acts on changes in a new playerState_t
-// With normal play, this will be done after local prediction, but when
-// following another player or playing back a demo, it will be checked
-// when the snapshot transitions like all the other entities
-
-
-#include "cg_local.h"
-
-/*
-==============
-CG_DamageFeedback
-==============
-*/
-void CG_DamageFeedback( int yawByte, int pitchByte, int damage )
-{
- float left, front, up;
- float kick;
- int health;
- float scale;
- vec3_t dir;
- vec3_t angles;
- float dist;
- float yaw, pitch;
-
- // show the attacking player's head and name in corner
- cg.attackerTime = cg.time;
-
- // the lower on health you are, the greater the view kick will be
- health = cg.snap->ps.stats[STAT_HEALTH];
-
- if( health < 40 )
- scale = 1;
- else
- scale = 40.0 / health;
-
- kick = damage * scale;
-
- if( kick < 5 )
- kick = 5;
-
- if( kick > 10 )
- kick = 10;
-
- // if yaw and pitch are both 255, make the damage always centered (falling, etc)
- if( yawByte == 255 && pitchByte == 255 )
- {
- cg.damageX = 0;
- cg.damageY = 0;
- cg.v_dmg_roll = 0;
- cg.v_dmg_pitch = -kick;
- }
- else
- {
- // positional
- pitch = pitchByte / 255.0 * 360;
- yaw = yawByte / 255.0 * 360;
-
- angles[ PITCH ] = pitch;
- angles[ YAW ] = yaw;
- angles[ ROLL ] = 0;
-
- AngleVectors( angles, dir, NULL, NULL );
- VectorSubtract( vec3_origin, dir, dir );
-
- front = DotProduct( dir, cg.refdef.viewaxis[ 0 ] );
- left = DotProduct( dir, cg.refdef.viewaxis[ 1 ] );
- up = DotProduct( dir, cg.refdef.viewaxis[ 2 ] );
-
- dir[ 0 ] = front;
- dir[ 1 ] = left;
- dir[ 2 ] = 0;
- dist = VectorLength( dir );
-
- if( dist < 0.1f )
- dist = 0.1f;
-
- cg.v_dmg_roll = kick * left;
-
- cg.v_dmg_pitch = -kick * front;
-
- if( front <= 0.1 )
- front = 0.1f;
-
- cg.damageX = -left / front;
- cg.damageY = up / dist;
- }
-
- // clamp the position
- if( cg.damageX > 1.0 )
- cg.damageX = 1.0;
-
- if( cg.damageX < - 1.0 )
- cg.damageX = -1.0;
-
- if( cg.damageY > 1.0 )
- cg.damageY = 1.0;
-
- if( cg.damageY < - 1.0 )
- cg.damageY = -1.0;
-
- // don't let the screen flashes vary as much
- if( kick > 10 )
- kick = 10;
-
- cg.damageValue = kick;
- cg.v_dmg_time = cg.time + DAMAGE_TIME;
- cg.damageTime = cg.snap->serverTime;
-}
-
-
-
-
-/*
-================
-CG_Respawn
-
-A respawn happened this snapshot
-================
-*/
-void CG_Respawn( void )
-{
- // no error decay on player movement
- cg.thisFrameTeleport = qtrue;
-
- // display weapons available
- cg.weaponSelectTime = cg.time;
-
- // select the weapon the server says we are using
- cg.weaponSelect = cg.snap->ps.weapon;
-
- CG_ResetPainBlend( );
-}
-
-/*
-==============
-CG_CheckPlayerstateEvents
-
-==============
-*/
-void CG_CheckPlayerstateEvents( playerState_t *ps, playerState_t *ops )
-{
- int i;
- int event;
- centity_t *cent;
-
- if( ps->externalEvent && ps->externalEvent != ops->externalEvent )
- {
- cent = &cg_entities[ ps->clientNum ];
- cent->currentState.event = ps->externalEvent;
- cent->currentState.eventParm = ps->externalEventParm;
- CG_EntityEvent( cent, cent->lerpOrigin );
- }
-
- cent = &cg.predictedPlayerEntity; // cg_entities[ ps->clientNum ];
-
- // go through the predictable events buffer
- for( i = ps->eventSequence - MAX_PS_EVENTS; i < ps->eventSequence; i++ )
- {
- // if we have a new predictable event
- if( i >= ops->eventSequence ||
- // or the server told us to play another event instead of a predicted event we already issued
- // or something the server told us changed our prediction causing a different event
- ( i > ops->eventSequence - MAX_PS_EVENTS && ps->events[ i & ( MAX_PS_EVENTS - 1 ) ] !=
- ops->events[ i & ( MAX_PS_EVENTS - 1 ) ] ) )
- {
- event = ps->events[ i & ( MAX_PS_EVENTS - 1 ) ];
-
- cent->currentState.event = event;
- cent->currentState.eventParm = ps->eventParms[ i & ( MAX_PS_EVENTS - 1 ) ];
- CG_EntityEvent( cent, cent->lerpOrigin );
- cg.predictableEvents[ i & ( MAX_PREDICTED_EVENTS - 1 ) ] = event;
-
- cg.eventSequence++;
- }
- }
-}
-
-
-/*
-==================
-CG_CheckChangedPredictableEvents
-==================
-*/
-void CG_CheckChangedPredictableEvents( playerState_t *ps )
-{
- int i;
- int event;
- centity_t *cent;
-
- cent = &cg.predictedPlayerEntity;
-
- for( i = ps->eventSequence - MAX_PS_EVENTS; i < ps->eventSequence; i++ )
- {
- //
- if( i >= cg.eventSequence )
- continue;
-
- // if this event is not further back in than the maximum predictable events we remember
- if( i > cg.eventSequence - MAX_PREDICTED_EVENTS )
- {
- // if the new playerstate event is different from a previously predicted one
- if( ps->events[ i & ( MAX_PS_EVENTS - 1 ) ] != cg.predictableEvents[ i & ( MAX_PREDICTED_EVENTS - 1 ) ] )
- {
- event = ps->events[ i & ( MAX_PS_EVENTS - 1 ) ];
- cent->currentState.event = event;
- cent->currentState.eventParm = ps->eventParms[ i & ( MAX_PS_EVENTS - 1 ) ];
- CG_EntityEvent( cent, cent->lerpOrigin );
-
- cg.predictableEvents[ i & ( MAX_PREDICTED_EVENTS - 1 ) ] = event;
-
- if( cg_showmiss.integer )
- CG_Printf( "WARNING: changed predicted event\n" );
- }
- }
- }
-}
-
-/*
-==================
-CG_CheckLocalSounds
-==================
-*/
-void CG_CheckLocalSounds( playerState_t *ps, playerState_t *ops )
-{
- int reward;
-
- // don't play the sounds if the player just changed teams
- if( ps->persistant[ PERS_TEAM ] != ops->persistant[ PERS_TEAM ] )
- return;
-
- // health changes of more than -1 should make pain sounds
- if( ps->stats[ STAT_HEALTH ] < ops->stats[ STAT_HEALTH ] - 1 )
- {
- if( ps->stats[ STAT_HEALTH ] > 0 )
- CG_PainEvent( &cg.predictedPlayerEntity, ps->stats[ STAT_HEALTH ] );
- }
-
-
- // if we are going into the intermission, don't start any voices
- if( cg.intermissionStarted )
- return;
-
- // reward sounds
- reward = qfalse;
-}
-
-
-/*
-===============
-CG_TransitionPlayerState
-
-===============
-*/
-void CG_TransitionPlayerState( playerState_t *ps, playerState_t *ops )
-{
- // check for changing follow mode
- if( ps->clientNum != ops->clientNum )
- {
- cg.thisFrameTeleport = qtrue;
- // make sure we don't get any unwanted transition effects
- *ops = *ps;
-
- CG_ResetPainBlend( );
- }
-
- // damage events (player is getting wounded)
- if( ps->damageEvent != ops->damageEvent && ps->damageCount )
- CG_DamageFeedback( ps->damageYaw, ps->damagePitch, ps->damageCount );
-
- // respawning
- if( ps->persistant[ PERS_SPAWN_COUNT ] != ops->persistant[ PERS_SPAWN_COUNT ] )
- CG_Respawn( );
-
- if( cg.mapRestart )
- {
- CG_Respawn( );
- cg.mapRestart = qfalse;
- }
-
- if( cg.snap->ps.pm_type != PM_INTERMISSION &&
- ps->persistant[ PERS_TEAM ] != TEAM_SPECTATOR )
- CG_CheckLocalSounds( ps, ops );
-
- // run events
- CG_CheckPlayerstateEvents( ps, ops );
-
- // smooth the ducking viewheight change
- if( ps->viewheight != ops->viewheight )
- {
- cg.duckChange = ps->viewheight - ops->viewheight;
- cg.duckTime = cg.time;
- }
-}
-
diff --git a/src/cgame/cg_predict.c b/src/cgame/cg_predict.c
deleted file mode 100644
index 34f00c4..0000000
--- a/src/cgame/cg_predict.c
+++ /dev/null
@@ -1,878 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_predict.c -- this file generates cg.predictedPlayerState by either
-// interpolating between snapshots from the server or locally predicting
-// ahead the client's movement.
-// It also handles local physics interaction, like fragments bouncing off walls
-
-
-#include "cg_local.h"
-
-static pmove_t cg_pmove;
-
-static int cg_numSolidEntities;
-static centity_t *cg_solidEntities[MAX_ENTITIES_IN_SNAPSHOT];
-static int cg_numTriggerEntities;
-static centity_t *cg_triggerEntities[MAX_ENTITIES_IN_SNAPSHOT];
-
-/*
-====================
-CG_BuildSolidList
-
-When a new cg.snap has been set, this function builds a sublist
-of the entities that are actually solid, to make for more
-efficient collision detection
-====================
-*/
-void CG_BuildSolidList( void )
-{
- int i;
- centity_t *cent;
- snapshot_t *snap;
- entityState_t *ent;
-
- cg_numSolidEntities = 0;
- cg_numTriggerEntities = 0;
-
- if( cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport )
- snap = cg.nextSnap;
- else
- snap = cg.snap;
-
- for( i = 0; i < snap->numEntities; i++ )
- {
- cent = &cg_entities[ snap->entities[ i ].number ];
- ent = ¢->currentState;
-
- if( ent->eType == ET_ITEM || ent->eType == ET_PUSH_TRIGGER || ent->eType == ET_TELEPORT_TRIGGER )
- {
- cg_triggerEntities[ cg_numTriggerEntities ] = cent;
- cg_numTriggerEntities++;
- continue;
- }
-
- if( cent->nextState.solid && ent->eType != ET_MISSILE )
- {
- cg_solidEntities[ cg_numSolidEntities ] = cent;
- cg_numSolidEntities++;
- continue;
- }
- }
-}
-
-/*
-====================
-CG_ClipMoveToEntities
-
-====================
-*/
-static void CG_ClipMoveToEntities ( const vec3_t start, const vec3_t mins,
- const vec3_t maxs, const vec3_t end, int skipNumber,
- int mask, trace_t *tr, traceType_t collisionType )
-{
- int i, j, x, zd, zu;
- trace_t trace;
- entityState_t *ent;
- clipHandle_t cmodel;
- vec3_t bmins, bmaxs;
- vec3_t origin, angles;
- centity_t *cent;
-
- //SUPAR HACK
- //this causes a trace to collide with the local player
- if( skipNumber == MAGIC_TRACE_HACK )
- j = cg_numSolidEntities + 1;
- else
- j = cg_numSolidEntities;
-
- for( i = 0; i < j; i++ )
- {
- if( i < cg_numSolidEntities )
- cent = cg_solidEntities[ i ];
- else
- cent = &cg.predictedPlayerEntity;
-
- ent = ¢->currentState;
-
- if( ent->number == skipNumber )
- continue;
-
- if( ent->solid == SOLID_BMODEL )
- {
- // special value for bmodel
- cmodel = trap_CM_InlineModel( ent->modelindex );
- VectorCopy( cent->lerpAngles, angles );
- BG_EvaluateTrajectory( ¢->currentState.pos, cg.physicsTime, origin );
- }
- else
- {
- // encoded bbox
- x = ( ent->solid & 255 );
- zd = ( ( ent->solid >> 8 ) & 255 );
- zu = ( ( ent->solid >> 16 ) & 255 ) - 32;
-
- bmins[ 0 ] = bmins[ 1 ] = -x;
- bmaxs[ 0 ] = bmaxs[ 1 ] = x;
- bmins[ 2 ] = -zd;
- bmaxs[ 2 ] = zu;
-
- if( i == cg_numSolidEntities )
- BG_FindBBoxForClass( ( ent->powerups >> 8 ) & 0xFF, bmins, bmaxs, NULL, NULL, NULL );
-
- cmodel = trap_CM_TempBoxModel( bmins, bmaxs );
- VectorCopy( vec3_origin, angles );
- VectorCopy( cent->lerpOrigin, origin );
- }
-
-
- if( collisionType == TT_CAPSULE )
- {
- trap_CM_TransformedCapsuleTrace ( &trace, start, end,
- mins, maxs, cmodel, mask, origin, angles );
- }
- else if( collisionType == TT_AABB )
- {
- trap_CM_TransformedBoxTrace ( &trace, start, end,
- mins, maxs, cmodel, mask, origin, angles );
- }
- else if( collisionType == TT_BISPHERE )
- {
- trap_CM_TransformedBiSphereTrace( &trace, start, end,
- mins[ 0 ], maxs[ 0 ], cmodel, mask, origin );
- }
-
- if( trace.allsolid || trace.fraction < tr->fraction )
- {
- trace.entityNum = ent->number;
-
- if( tr->lateralFraction < trace.lateralFraction )
- {
- float oldLateralFraction = tr->lateralFraction;
- *tr = trace;
- tr->lateralFraction = oldLateralFraction;
- }
- else
- *tr = trace;
- }
- else if( trace.startsolid )
- tr->startsolid = qtrue;
-
- if( tr->allsolid )
- return;
- }
-}
-
-/*
-================
-CG_Trace
-================
-*/
-void CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
- int skipNumber, int mask )
-{
- trace_t t;
-
- trap_CM_BoxTrace( &t, start, end, mins, maxs, 0, mask );
- t.entityNum = t.fraction != 1.0 ? ENTITYNUM_WORLD : ENTITYNUM_NONE;
- // check all other solid models
- CG_ClipMoveToEntities( start, mins, maxs, end, skipNumber, mask, &t, TT_AABB );
-
- *result = t;
-}
-
-/*
-================
-CG_CapTrace
-================
-*/
-void CG_CapTrace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,
- int skipNumber, int mask )
-{
- trace_t t;
-
- trap_CM_CapsuleTrace( &t, start, end, mins, maxs, 0, mask );
- t.entityNum = t.fraction != 1.0 ? ENTITYNUM_WORLD : ENTITYNUM_NONE;
- // check all other solid models
- CG_ClipMoveToEntities( start, mins, maxs, end, skipNumber, mask, &t, TT_CAPSULE );
-
- *result = t;
-}
-
-/*
-================
-CG_BiSphereTrace
-================
-*/
-void CG_BiSphereTrace( trace_t *result, const vec3_t start, const vec3_t end,
- const float startRadius, const float endRadius, int skipNumber, int mask )
-{
- trace_t t;
- vec3_t mins, maxs;
-
- mins[ 0 ] = startRadius;
- maxs[ 0 ] = endRadius;
-
- trap_CM_BiSphereTrace( &t, start, end, startRadius, endRadius, 0, mask );
- t.entityNum = t.fraction != 1.0 ? ENTITYNUM_WORLD : ENTITYNUM_NONE;
- // check all other solid models
- CG_ClipMoveToEntities( start, mins, maxs, end, skipNumber, mask, &t, TT_BISPHERE );
-
- *result = t;
-}
-
-/*
-================
-CG_PointContents
-================
-*/
-int CG_PointContents( const vec3_t point, int passEntityNum )
-{
- int i;
- entityState_t *ent;
- centity_t *cent;
- clipHandle_t cmodel;
- int contents;
-
- contents = trap_CM_PointContents (point, 0);
-
- for( i = 0; i < cg_numSolidEntities; i++ )
- {
- cent = cg_solidEntities[ i ];
-
- ent = ¢->currentState;
-
- if( ent->number == passEntityNum )
- continue;
-
- if( ent->solid != SOLID_BMODEL ) // special value for bmodel
- continue;
-
- cmodel = trap_CM_InlineModel( ent->modelindex );
-
- if( !cmodel )
- continue;
-
- contents |= trap_CM_TransformedPointContents( point, cmodel, ent->origin, ent->angles );
- }
-
- return contents;
-}
-
-
-/*
-========================
-CG_InterpolatePlayerState
-
-Generates cg.predictedPlayerState by interpolating between
-cg.snap->player_state and cg.nextFrame->player_state
-========================
-*/
-static void CG_InterpolatePlayerState( qboolean grabAngles )
-{
- float f;
- int i;
- playerState_t *out;
- snapshot_t *prev, *next;
-
- out = &cg.predictedPlayerState;
- prev = cg.snap;
- next = cg.nextSnap;
-
- *out = cg.snap->ps;
-
- // if we are still allowing local input, short circuit the view angles
- if( grabAngles )
- {
- usercmd_t cmd;
- int cmdNum;
-
- cmdNum = trap_GetCurrentCmdNumber( );
- trap_GetUserCmd( cmdNum, &cmd );
-
- PM_UpdateViewAngles( out, &cmd );
- }
-
- // if the next frame is a teleport, we can't lerp to it
- if( cg.nextFrameTeleport )
- return;
-
- if( !next || next->serverTime <= prev->serverTime )
- return;
-
- f = (float)( cg.time - prev->serverTime ) / ( next->serverTime - prev->serverTime );
-
- i = next->ps.bobCycle;
- if( i < prev->ps.bobCycle )
- i += 256; // handle wraparound
-
- out->bobCycle = prev->ps.bobCycle + f * ( i - prev->ps.bobCycle );
-
- for( i = 0; i < 3; i++ )
- {
- out->origin[ i ] = prev->ps.origin[ i ] + f * ( next->ps.origin[ i ] - prev->ps.origin[ i ] );
-
- if( !grabAngles )
- out->viewangles[ i ] = LerpAngle( prev->ps.viewangles[ i ], next->ps.viewangles[ i ], f );
-
- out->velocity[ i ] = prev->ps.velocity[ i ] +
- f * (next->ps.velocity[ i ] - prev->ps.velocity[ i ] );
- }
-}
-
-
-/*
-=========================
-CG_TouchTriggerPrediction
-
-Predict push triggers and items
-=========================
-*/
-static void CG_TouchTriggerPrediction( void )
-{
- int i;
- trace_t trace;
- entityState_t *ent;
- clipHandle_t cmodel;
- centity_t *cent;
- qboolean spectator;
-
- // dead clients don't activate triggers
- if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 )
- return;
-
- spectator = ( cg.predictedPlayerState.pm_type == PM_SPECTATOR );
-
- if( cg.predictedPlayerState.pm_type != PM_NORMAL && !spectator )
- return;
-
- for( i = 0; i < cg_numTriggerEntities; i++ )
- {
- cent = cg_triggerEntities[ i ];
- ent = ¢->currentState;
-
- if( ent->solid != SOLID_BMODEL )
- continue;
-
- cmodel = trap_CM_InlineModel( ent->modelindex );
- if( !cmodel )
- continue;
-
- trap_CM_BoxTrace( &trace, cg.predictedPlayerState.origin, cg.predictedPlayerState.origin,
- cg_pmove.mins, cg_pmove.maxs, cmodel, -1 );
-
- if( !trace.startsolid )
- continue;
-
- if( ent->eType == ET_TELEPORT_TRIGGER )
- cg.hyperspace = qtrue;
- }
-}
-
-static int CG_IsUnacceptableError( playerState_t *ps, playerState_t *pps )
-{
- vec3_t delta;
- int i;
-
- if( pps->pm_type != ps->pm_type ||
- pps->pm_flags != ps->pm_flags ||
- pps->pm_time != ps->pm_time )
- {
- return 1;
- }
-
- VectorSubtract( pps->origin, ps->origin, delta );
- if( VectorLengthSquared( delta ) > 0.1f * 0.1f )
- {
- if( cg_showmiss.integer )
- {
- CG_Printf( "origin delta: %.2f ", VectorLength( delta ) );
- }
- return 2;
- }
-
- VectorSubtract( pps->velocity, ps->velocity, delta );
- if( VectorLengthSquared( delta ) > 0.1f * 0.1f )
- {
- if( cg_showmiss.integer )
- {
- CG_Printf( "velocity delta: %.2f ", VectorLength( delta ) );
- }
- return 3;
- }
-
- if( pps->weaponTime != ps->weaponTime ||
- pps->gravity != ps->gravity ||
- pps->speed != ps->speed ||
- pps->delta_angles[ 0 ] != ps->delta_angles[ 0 ] ||
- pps->delta_angles[ 1 ] != ps->delta_angles[ 1 ] ||
- pps->delta_angles[ 2 ] != ps->delta_angles[ 2 ] ||
- pps->groundEntityNum != ps->groundEntityNum )
- {
- return 4;
- }
-
- if( pps->legsTimer != ps->legsTimer ||
- pps->legsAnim != ps->legsAnim ||
- pps->torsoTimer != ps->torsoTimer ||
- pps->torsoAnim != ps->torsoAnim ||
- pps->movementDir != ps->movementDir )
- {
- return 5;
- }
-
- VectorSubtract( pps->grapplePoint, ps->grapplePoint, delta );
- if( VectorLengthSquared( delta ) > 0.1f * 0.1f )
- return 6;
-
- if( pps->eFlags != ps->eFlags )
- return 7;
-
- if( pps->eventSequence != ps->eventSequence )
- return 8;
-
- for( i = 0; i < MAX_PS_EVENTS; i++ )
- {
- if ( pps->events[ i ] != ps->events[ i ] ||
- pps->eventParms[ i ] != ps->eventParms[ i ] )
- {
- return 9;
- }
- }
-
- if( pps->externalEvent != ps->externalEvent ||
- pps->externalEventParm != ps->externalEventParm ||
- pps->externalEventTime != ps->externalEventTime )
- {
- return 10;
- }
-
- if( pps->clientNum != ps->clientNum ||
- pps->weapon != ps->weapon ||
- pps->weaponstate != ps->weaponstate )
- {
- return 11;
- }
-
- if( fabs( AngleDelta( ps->viewangles[ 0 ], pps->viewangles[ 0 ] ) ) > 1.0f ||
- fabs( AngleDelta( ps->viewangles[ 1 ], pps->viewangles[ 1 ] ) ) > 1.0f ||
- fabs( AngleDelta( ps->viewangles[ 2 ], pps->viewangles[ 2 ] ) ) > 1.0f )
- {
- return 12;
- }
-
- if( pps->viewheight != ps->viewheight )
- return 13;
-
- if( pps->damageEvent != ps->damageEvent ||
- pps->damageYaw != ps->damageYaw ||
- pps->damagePitch != ps->damagePitch ||
- pps->damageCount != ps->damageCount )
- {
- return 14;
- }
-
- for( i = 0; i < MAX_STATS; i++ )
- {
- if( pps->stats[ i ] != ps->stats[ i ] )
- return 15;
- }
-
- for( i = 0; i < MAX_PERSISTANT; i++ )
- {
- if( pps->persistant[ i ] != ps->persistant[ i ] )
- return 16;
- }
-
- for( i = 0; i < MAX_WEAPONS; i++ )
- {
- if( pps->ammo[ i ] != ps->ammo[ i ] )
- return 18;
- }
-
- if( pps->generic1 != ps->generic1 ||
- pps->loopSound != ps->loopSound )
- {
- return 19;
- }
-
- return 0;
-}
-
-
-/*
-=================
-CG_PredictPlayerState
-
-Generates cg.predictedPlayerState for the current cg.time
-cg.predictedPlayerState is guaranteed to be valid after exiting.
-
-For demo playback, this will be an interpolation between two valid
-playerState_t.
-
-For normal gameplay, it will be the result of predicted usercmd_t on
-top of the most recent playerState_t received from the server.
-
-Each new snapshot will usually have one or more new usercmd over the last,
-but we simulate all unacknowledged commands each time, not just the new ones.
-This means that on an internet connection, quite a few pmoves may be issued
-each frame.
-
-OPTIMIZE: don't re-simulate unless the newly arrived snapshot playerState_t
-differs from the predicted one. Would require saving all intermediate
-playerState_t during prediction.
-
-We detect prediction errors and allow them to be decayed off over several frames
-to ease the jerk.
-=================
-*/
-void CG_PredictPlayerState( void )
-{
- int cmdNum, current, i;
- playerState_t oldPlayerState;
- qboolean moved;
- usercmd_t oldestCmd;
- usercmd_t latestCmd;
- int stateIndex = 0, predictCmd = 0;
-
- cg.hyperspace = qfalse; // will be set if touching a trigger_teleport
-
- // if this is the first frame we must guarantee
- // predictedPlayerState is valid even if there is some
- // other error condition
- if( !cg.validPPS )
- {
- cg.validPPS = qtrue;
- cg.predictedPlayerState = cg.snap->ps;
- }
-
-
- // demo playback just copies the moves
- if( cg.demoPlayback || (cg.snap->ps.pm_flags & PMF_FOLLOW) )
- {
- CG_InterpolatePlayerState( qfalse );
- return;
- }
-
- // non-predicting local movement will grab the latest angles
- if( cg_nopredict.integer || cg_synchronousClients.integer )
- {
- CG_InterpolatePlayerState( qtrue );
- return;
- }
-
- // prepare for pmove
- cg_pmove.ps = &cg.predictedPlayerState;
- cg_pmove.pmext = &cg.pmext;
- cg_pmove.trace = CG_Trace;
- cg_pmove.pointcontents = CG_PointContents;
- cg_pmove.debugLevel = cg_debugMove.integer;
-
- if( cg_pmove.ps->pm_type == PM_DEAD )
- cg_pmove.tracemask = MASK_PLAYERSOLID & ~CONTENTS_BODY;
- else
- cg_pmove.tracemask = MASK_PLAYERSOLID;
-
- if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR )
- cg_pmove.tracemask &= ~CONTENTS_BODY; // spectators can fly through bodies
-
- cg_pmove.noFootsteps = 0;
-
- // save the state before the pmove so we can detect transitions
- oldPlayerState = cg.predictedPlayerState;
-
- current = trap_GetCurrentCmdNumber( );
-
- // if we don't have the commands right after the snapshot, we
- // can't accurately predict a current position, so just freeze at
- // the last good position we had
- cmdNum = current - CMD_BACKUP + 1;
- trap_GetUserCmd( cmdNum, &oldestCmd );
-
- if( oldestCmd.serverTime > cg.snap->ps.commandTime &&
- oldestCmd.serverTime < cg.time )
- { // special check for map_restart
- if( cg_showmiss.integer )
- CG_Printf( "exceeded PACKET_BACKUP on commands\n" );
-
- return;
- }
-
- // get the latest command so we can know which commands are from previous map_restarts
- trap_GetUserCmd( current, &latestCmd );
-
- // get the most recent information we have, even if
- // the server time is beyond our current cg.time,
- // because predicted player positions are going to
- // be ahead of everything else anyway
- if( cg.nextSnap && !cg.nextFrameTeleport && !cg.thisFrameTeleport )
- {
- cg.predictedPlayerState = cg.nextSnap->ps;
- cg.physicsTime = cg.nextSnap->serverTime;
- }
- else
- {
- cg.predictedPlayerState = cg.snap->ps;
- cg.physicsTime = cg.snap->serverTime;
- }
-
- if( pmove_msec.integer < 8 )
- trap_Cvar_Set( "pmove_msec", "8" );
- else if( pmove_msec.integer > 33 )
- trap_Cvar_Set( "pmove_msec", "33" );
-
- cg_pmove.pmove_fixed = pmove_fixed.integer;// | cg_pmove_fixed.integer;
- cg_pmove.pmove_msec = pmove_msec.integer;
-
- // Like the comments described above, a player's state is entirely
- // re-predicted from the last valid snapshot every client frame, which
- // can be really, really, really slow. Every old command has to be
- // run again. For every client frame that is *not* directly after a
- // snapshot, this is unnecessary, since we have no new information.
- // For those, we'll play back the predictions from the last frame and
- // predict only the newest commands. Essentially, we'll be doing
- // an incremental predict instead of a full predict.
- //
- // If we have a new snapshot, we can compare its player state's command
- // time to the command times in the queue to find a match. If we find
- // a matching state, and the predicted version has not deviated, we can
- // use the predicted state as a base - and also do an incremental predict.
- //
- // With this method, we get incremental predicts on every client frame
- // except a frame following a new snapshot in which there was a prediction
- // error. This yeilds anywhere from a 15% to 40% performance increase,
- // depending on how much of a bottleneck the CPU is.
- if( cg_optimizePrediction.integer )
- {
- if( cg.nextFrameTeleport || cg.thisFrameTeleport )
- {
- // do a full predict
- cg.lastPredictedCommand = 0;
- cg.stateTail = cg.stateHead;
- predictCmd = current - CMD_BACKUP + 1;
- }
- // cg.physicsTime is the current snapshot's serverTime if it's the same
- // as the last one
- else if( cg.physicsTime == cg.lastServerTime )
- {
- // we have no new information, so do an incremental predict
- predictCmd = cg.lastPredictedCommand + 1;
- }
- else
- {
- // we have a new snapshot
- int i;
- int errorcode;
- qboolean error = qtrue;
-
- // loop through the saved states queue
- for( i = cg.stateHead; i != cg.stateTail;
- i = ( i + 1 ) % NUM_SAVED_STATES )
- {
- // if we find a predicted state whose commandTime matches the snapshot
- // player state's commandTime
- if( cg.savedPmoveStates[ i ].commandTime !=
- cg.predictedPlayerState.commandTime )
- {
- continue;
- }
- // make sure the state differences are acceptable
- errorcode = CG_IsUnacceptableError( &cg.predictedPlayerState,
- &cg.savedPmoveStates[ i ] );
-
- if( errorcode )
- {
- if( cg_showmiss.integer )
- CG_Printf("errorcode %d at %d\n", errorcode, cg.time);
- break;
- }
-
- // this one is almost exact, so we'll copy it in as the starting point
- *cg_pmove.ps = cg.savedPmoveStates[ i ];
- // advance the head
- cg.stateHead = ( i + 1 ) % NUM_SAVED_STATES;
-
- // set the next command to predict
- predictCmd = cg.lastPredictedCommand + 1;
-
- // a saved state matched, so flag it
- error = qfalse;
- break;
- }
-
- // if no saved states matched
- if( error )
- {
- // do a full predict
- cg.lastPredictedCommand = 0;
- cg.stateTail = cg.stateHead;
- predictCmd = current - CMD_BACKUP + 1;
- }
- }
-
- // keep track of the server time of the last snapshot so we
- // know when we're starting from a new one in future calls
- cg.lastServerTime = cg.physicsTime;
- stateIndex = cg.stateHead;
- }
-
- // run cmds
- moved = qfalse;
-
- for( cmdNum = current - CMD_BACKUP + 1; cmdNum <= current; cmdNum++ )
- {
- // get the command
- trap_GetUserCmd( cmdNum, &cg_pmove.cmd );
-
- if( cg_pmove.pmove_fixed )
- PM_UpdateViewAngles( cg_pmove.ps, &cg_pmove.cmd );
-
- // don't do anything if the time is before the snapshot player time
- if( cg_pmove.cmd.serverTime <= cg.predictedPlayerState.commandTime )
- continue;
-
- // don't do anything if the command was from a previous map_restart
- if( cg_pmove.cmd.serverTime > latestCmd.serverTime )
- continue;
-
- // check for a prediction error from last frame
- // on a lan, this will often be the exact value
- // from the snapshot, but on a wan we will have
- // to predict several commands to get to the point
- // we want to compare
- if( cg.predictedPlayerState.commandTime == oldPlayerState.commandTime )
- {
- vec3_t delta;
- float len;
-
- if( cg.thisFrameTeleport )
- {
- // a teleport will not cause an error decay
- VectorClear( cg.predictedError );
-
- if( cg_showmiss.integer )
- CG_Printf( "PredictionTeleport\n" );
-
- cg.thisFrameTeleport = qfalse;
- }
- else
- {
- vec3_t adjusted;
- CG_AdjustPositionForMover( cg.predictedPlayerState.origin,
- cg.predictedPlayerState.groundEntityNum, cg.physicsTime, cg.oldTime, adjusted );
-
- if( cg_showmiss.integer )
- {
- if( !VectorCompare( oldPlayerState.origin, adjusted ) )
- CG_Printf("prediction error\n");
- }
-
- VectorSubtract( oldPlayerState.origin, adjusted, delta );
- len = VectorLength( delta );
-
- if( len > 0.1 )
- {
- if( cg_showmiss.integer )
- CG_Printf( "Prediction miss: %f\n", len );
-
- if( cg_errorDecay.integer )
- {
- int t;
- float f;
-
- t = cg.time - cg.predictedErrorTime;
- f = ( cg_errorDecay.value - t ) / cg_errorDecay.value;
-
- if( f < 0 )
- f = 0;
-
- if( f > 0 && cg_showmiss.integer )
- CG_Printf( "Double prediction decay: %f\n", f );
-
- VectorScale( cg.predictedError, f, cg.predictedError );
- }
- else
- VectorClear( cg.predictedError );
-
- VectorAdd( delta, cg.predictedError, cg.predictedError );
- cg.predictedErrorTime = cg.oldTime;
- }
- }
- }
-
- // don't predict gauntlet firing, which is only supposed to happen
- // when it actually inflicts damage
- for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
- cg_pmove.autoWeaponHit[ i ] = qfalse;
-
- if( cg_pmove.pmove_fixed )
- cg_pmove.cmd.serverTime = ( ( cg_pmove.cmd.serverTime + pmove_msec.integer - 1 ) /
- pmove_msec.integer ) * pmove_msec.integer;
-
- if( !cg_optimizePrediction.integer )
- {
- Pmove( &cg_pmove );
- }
- else if( cg_optimizePrediction.integer && ( cmdNum >= predictCmd ||
- ( stateIndex + 1 ) % NUM_SAVED_STATES == cg.stateHead ) )
- {
- Pmove( &cg_pmove );
- // record the last predicted command
- cg.lastPredictedCommand = cmdNum;
-
- // if we haven't run out of space in the saved states queue
- if( ( stateIndex + 1 ) % NUM_SAVED_STATES != cg.stateHead )
- {
- // save the state for the false case ( of cmdNum >= predictCmd )
- // in later calls to this function
- cg.savedPmoveStates[ stateIndex ] = *cg_pmove.ps;
- stateIndex = ( stateIndex + 1 ) % NUM_SAVED_STATES;
- cg.stateTail = stateIndex;
- }
- }
- else
- {
- *cg_pmove.ps = cg.savedPmoveStates[ stateIndex ];
- stateIndex = ( stateIndex + 1 ) % NUM_SAVED_STATES;
- }
-
- moved = qtrue;
-
- // add push trigger movement effects
- CG_TouchTriggerPrediction( );
-
- // check for predictable events that changed from previous predictions
- //CG_CheckChangedPredictableEvents(&cg.predictedPlayerState);
- }
-
- // adjust for the movement of the groundentity
- CG_AdjustPositionForMover( cg.predictedPlayerState.origin,
- cg.predictedPlayerState.groundEntityNum,
- cg.physicsTime, cg.time, cg.predictedPlayerState.origin );
-
-
- // fire events and other transition triggered things
- CG_TransitionPlayerState( &cg.predictedPlayerState, &oldPlayerState );
-
-
-}
diff --git a/src/cgame/cg_ptr.c b/src/cgame/cg_ptr.c
deleted file mode 100644
index 1881087..0000000
--- a/src/cgame/cg_ptr.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_ptr.c -- post timeout restoration handling
-
-
-#include "cg_local.h"
-
-#define PTRC_FILE "ptrc.cfg"
-
-/*
-===============
-CG_ReadPTRCode
-
-Read a PTR code from disk
-===============
-*/
-int CG_ReadPTRCode( void )
-{
- int len;
- char text[ 16 ];
- fileHandle_t f;
-
- // load the file
- len = trap_FS_FOpenFile( PTRC_FILE, &f, FS_READ );
- if( len <= 0 )
- return 0;
-
- // should never happen - malformed write
- if( len >= sizeof( text ) - 1 )
- return 0;
-
- trap_FS_Read( text, len, f );
- text[ len ] = 0;
- trap_FS_FCloseFile( f );
-
- return atoi( text );
-}
-
-/*
-===============
-CG_WritePTRCode
-
-Write a PTR code to disk
-===============
-*/
-void CG_WritePTRCode( int code )
-{
- char text[ 16 ];
- fileHandle_t f;
-
- Com_sprintf( text, 16, "%d", code );
-
- // open file
- if( trap_FS_FOpenFile( PTRC_FILE, &f, FS_WRITE ) < 0 )
- return;
-
- // write the code
- trap_FS_Write( text, strlen( text ), f );
-
- trap_FS_FCloseFile( f );
-}
diff --git a/src/cgame/cg_scanner.c b/src/cgame/cg_scanner.c
deleted file mode 100644
index ab98b23..0000000
--- a/src/cgame/cg_scanner.c
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-
-#include "cg_local.h"
-
-static entityPos_t entityPositions;
-
-#define HUMAN_SCANNER_UPDATE_PERIOD 700
-
-/*
-=============
-CG_UpdateEntityPositions
-
-Update this client's perception of entity positions
-=============
-*/
-void CG_UpdateEntityPositions( void )
-{
- centity_t *cent = NULL;
- int i;
-
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- if( entityPositions.lastUpdateTime + HUMAN_SCANNER_UPDATE_PERIOD > cg.time )
- return;
- }
-
- VectorCopy( cg.refdef.vieworg, entityPositions.origin );
- VectorCopy( cg.refdefViewAngles, entityPositions.vangles );
- entityPositions.lastUpdateTime = cg.time;
-
- entityPositions.numAlienBuildables = 0;
- entityPositions.numHumanBuildables = 0;
- entityPositions.numAlienClients = 0;
- entityPositions.numHumanClients = 0;
-
- for( i = 0; i < cg.snap->numEntities; i++ )
- {
- cent = &cg_entities[ cg.snap->entities[ i ].number ];
-
- if( cent->currentState.eType == ET_BUILDABLE )
- {
- //TA: add to list of item positions (for creep)
- if( cent->currentState.modelindex2 == BIT_ALIENS )
- {
- VectorCopy( cent->lerpOrigin, entityPositions.alienBuildablePos[
- entityPositions.numAlienBuildables ] );
- entityPositions.alienBuildableTimes[
- entityPositions.numAlienBuildables ] = cent->miscTime;
-
- if( entityPositions.numAlienBuildables < MAX_GENTITIES )
- entityPositions.numAlienBuildables++;
- }
- else if( cent->currentState.modelindex2 == BIT_HUMANS )
- {
- VectorCopy( cent->lerpOrigin, entityPositions.humanBuildablePos[
- entityPositions.numHumanBuildables ] );
-
- if( entityPositions.numHumanBuildables < MAX_GENTITIES )
- entityPositions.numHumanBuildables++;
- }
- }
- else if( cent->currentState.eType == ET_PLAYER )
- {
- int team = cent->currentState.powerups & 0x00FF;
-
- if( team == PTE_ALIENS )
- {
- VectorCopy( cent->lerpOrigin, entityPositions.alienClientPos[
- entityPositions.numAlienClients ] );
-
- if( entityPositions.numAlienClients < MAX_CLIENTS )
- entityPositions.numAlienClients++;
- }
- else if( team == PTE_HUMANS )
- {
- VectorCopy( cent->lerpOrigin, entityPositions.humanClientPos[
- entityPositions.numHumanClients ] );
-
- if( entityPositions.numHumanClients < MAX_CLIENTS )
- entityPositions.numHumanClients++;
- }
- }
- }
-}
-
-#define STALKWIDTH 2.0f
-#define BLIPX 16.0f
-#define BLIPY 8.0f
-#define FAR_ALPHA 0.8f
-#define NEAR_ALPHA 1.2f
-
-/*
-=============
-CG_DrawBlips
-
-Draw blips and stalks for the human scanner
-=============
-*/
-static void CG_DrawBlips( rectDef_t *rect, vec3_t origin, vec4_t colour )
-{
- vec3_t drawOrigin;
- vec3_t up = { 0, 0, 1 };
- float alphaMod = 1.0f;
- float timeFractionSinceRefresh = 1.0f -
- ( (float)( cg.time - entityPositions.lastUpdateTime ) /
- (float)HUMAN_SCANNER_UPDATE_PERIOD );
- vec4_t localColour;
-
- Vector4Copy( colour, localColour );
-
- RotatePointAroundVector( drawOrigin, up, origin, -entityPositions.vangles[ 1 ] - 90 );
- drawOrigin[ 0 ] /= ( 2 * HELMET_RANGE / rect->w );
- drawOrigin[ 1 ] /= ( 2 * HELMET_RANGE / rect->h );
- drawOrigin[ 2 ] /= ( 2 * HELMET_RANGE / rect->w );
-
- alphaMod = FAR_ALPHA +
- ( ( drawOrigin[ 1 ] + ( rect->h / 2.0f ) ) / rect->h ) * ( NEAR_ALPHA - FAR_ALPHA );
-
- localColour[ 3 ] *= alphaMod;
- localColour[ 3 ] *= ( 0.5f + ( timeFractionSinceRefresh * 0.5f ) );
-
- if( localColour[ 3 ] > 1.0f )
- localColour[ 3 ] = 1.0f;
- else if( localColour[ 3 ] < 0.0f )
- localColour[ 3 ] = 0.0f;
-
- trap_R_SetColor( localColour );
-
- if( drawOrigin[ 2 ] > 0 )
- CG_DrawPic( rect->x + ( rect->w / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ],
- rect->y + ( rect->h / 2 ) + drawOrigin[ 1 ] - drawOrigin[ 2 ],
- STALKWIDTH, drawOrigin[ 2 ], cgs.media.scannerLineShader );
- else
- CG_DrawPic( rect->x + ( rect->w / 2 ) - ( STALKWIDTH / 2 ) - drawOrigin[ 0 ],
- rect->y + ( rect->h / 2 ) + drawOrigin[ 1 ],
- STALKWIDTH, -drawOrigin[ 2 ], cgs.media.scannerLineShader );
-
- CG_DrawPic( rect->x + ( rect->w / 2 ) - ( BLIPX / 2 ) - drawOrigin[ 0 ],
- rect->y + ( rect->h / 2 ) - ( BLIPY / 2 ) + drawOrigin[ 1 ] - drawOrigin[ 2 ],
- BLIPX, BLIPY, cgs.media.scannerBlipShader );
- trap_R_SetColor( NULL );
-}
-
-#define BLIPX2 24.0f
-#define BLIPY2 24.0f
-
-/*
-=============
-CG_DrawDir
-
-Draw dot marking the direction to an enemy
-=============
-*/
-static void CG_DrawDir( rectDef_t *rect, vec3_t origin, vec4_t colour )
-{
- vec3_t drawOrigin;
- vec3_t noZOrigin;
- vec3_t normal, antinormal, normalDiff;
- vec3_t view, noZview;
- vec3_t up = { 0.0f, 0.0f, 1.0f };
- vec3_t top = { 0.0f, -1.0f, 0.0f };
- float angle;
- playerState_t *ps = &cg.snap->ps;
-
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
- {
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
- VectorSet( normal, 0.0f, 0.0f, -1.0f );
- else
- VectorCopy( ps->grapplePoint, normal );
- }
- else
- VectorSet( normal, 0.0f, 0.0f, 1.0f );
-
- AngleVectors( entityPositions.vangles, view, NULL, NULL );
-
- ProjectPointOnPlane( noZOrigin, origin, normal );
- ProjectPointOnPlane( noZview, view, normal );
- VectorNormalize( noZOrigin );
- VectorNormalize( noZview );
-
- //calculate the angle between the images of the blip and the view
- angle = RAD2DEG( acos( DotProduct( noZOrigin, noZview ) ) );
- CrossProduct( noZOrigin, noZview, antinormal );
- VectorNormalize( antinormal );
-
- //decide which way to rotate
- VectorSubtract( normal, antinormal, normalDiff );
- if( VectorLength( normalDiff ) < 1.0f )
- angle = 360.0f - angle;
-
- RotatePointAroundVector( drawOrigin, up, top, angle );
-
- trap_R_SetColor( colour );
- CG_DrawPic( rect->x + ( rect->w / 2 ) - ( BLIPX2 / 2 ) - drawOrigin[ 0 ] * ( rect->w / 2 ),
- rect->y + ( rect->h / 2 ) - ( BLIPY2 / 2 ) + drawOrigin[ 1 ] * ( rect->h / 2 ),
- BLIPX2, BLIPY2, cgs.media.scannerBlipShader );
- trap_R_SetColor( NULL );
-}
-
-/*
-=============
-CG_AlienSense
-=============
-*/
-void CG_AlienSense( rectDef_t *rect )
-{
- int i;
- vec3_t origin;
- vec3_t relOrigin;
- vec4_t buildable = { 1.0f, 0.0f, 0.0f, 0.7f };
- vec4_t client = { 0.0f, 0.0f, 1.0f, 0.7f };
-
- VectorCopy( entityPositions.origin, origin );
-
- //draw human buildables
- for( i = 0; i < entityPositions.numHumanBuildables; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.humanBuildablePos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < ALIENSENSE_RANGE )
- CG_DrawDir( rect, relOrigin, buildable );
- }
-
- //draw human clients
- for( i = 0; i < entityPositions.numHumanClients; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.humanClientPos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < ALIENSENSE_RANGE )
- CG_DrawDir( rect, relOrigin, client );
- }
-}
-
-/*
-=============
-CG_Scanner
-=============
-*/
-void CG_Scanner( rectDef_t *rect, qhandle_t shader, vec4_t color )
-{
- int i;
- vec3_t origin;
- vec3_t relOrigin;
- vec4_t hIabove;
- vec4_t hIbelow;
- vec4_t aIabove = { 1.0f, 0.0f, 0.0f, 0.75f };
- vec4_t aIbelow = { 1.0f, 0.0f, 0.0f, 0.5f };
-
- Vector4Copy( color, hIabove );
- hIabove[ 3 ] *= 1.5f;
- Vector4Copy( color, hIbelow );
-
- VectorCopy( entityPositions.origin, origin );
-
- //draw human buildables below scanner plane
- for( i = 0; i < entityPositions.numHumanBuildables; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.humanBuildablePos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < HELMET_RANGE && ( relOrigin[ 2 ] < 0 ) )
- CG_DrawBlips( rect, relOrigin, hIbelow );
- }
-
- //draw alien buildables below scanner plane
- for( i = 0; i < entityPositions.numAlienBuildables; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.alienBuildablePos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < HELMET_RANGE && ( relOrigin[ 2 ] < 0 ) )
- CG_DrawBlips( rect, relOrigin, aIbelow );
- }
-
- //draw human clients below scanner plane
- for( i = 0; i < entityPositions.numHumanClients; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.humanClientPos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < HELMET_RANGE && ( relOrigin[ 2 ] < 0 ) )
- CG_DrawBlips( rect, relOrigin, hIbelow );
- }
-
- //draw alien buildables below scanner plane
- for( i = 0; i < entityPositions.numAlienClients; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.alienClientPos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < HELMET_RANGE && ( relOrigin[ 2 ] < 0 ) )
- CG_DrawBlips( rect, relOrigin, aIbelow );
- }
-
- if( !cg_disableScannerPlane.integer )
- {
- trap_R_SetColor( color );
- CG_DrawPic( rect->x, rect->y, rect->w, rect->h, shader );
- trap_R_SetColor( NULL );
- }
-
- //draw human buildables above scanner plane
- for( i = 0; i < entityPositions.numHumanBuildables; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.humanBuildablePos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < HELMET_RANGE && ( relOrigin[ 2 ] > 0 ) )
- CG_DrawBlips( rect, relOrigin, hIabove );
- }
-
- //draw alien buildables above scanner plane
- for( i = 0; i < entityPositions.numAlienBuildables; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.alienBuildablePos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < HELMET_RANGE && ( relOrigin[ 2 ] > 0 ) )
- CG_DrawBlips( rect, relOrigin, aIabove );
- }
-
- //draw human clients above scanner plane
- for( i = 0; i < entityPositions.numHumanClients; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.humanClientPos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < HELMET_RANGE && ( relOrigin[ 2 ] > 0 ) )
- CG_DrawBlips( rect, relOrigin, hIabove );
- }
-
- //draw alien clients above scanner plane
- for( i = 0; i < entityPositions.numAlienClients; i++ )
- {
- VectorClear( relOrigin );
- VectorSubtract( entityPositions.alienClientPos[ i ], origin, relOrigin );
-
- if( VectorLength( relOrigin ) < HELMET_RANGE && ( relOrigin[ 2 ] > 0 ) )
- CG_DrawBlips( rect, relOrigin, aIabove );
- }
-}
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
deleted file mode 100644
index 7fb3e06..0000000
--- a/src/cgame/cg_servercmds.c
+++ /dev/null
@@ -1,1016 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_servercmds.c -- reliably sequenced text commands sent by the server
-// these are processed at snapshot transition time, so there will definately
-// be a valid snapshot this frame
-
-
-#include "cg_local.h"
-
-/*
-=================
-CG_ParseScores
-
-=================
-*/
-static void CG_ParseScores( void )
-{
- int i;
-
- cg.numScores = atoi( CG_Argv( 1 ) );
-
- if( cg.numScores > MAX_CLIENTS )
- cg.numScores = MAX_CLIENTS;
-
- cg.teamScores[ 0 ] = atoi( CG_Argv( 2 ) );
- cg.teamScores[ 1 ] = atoi( CG_Argv( 3 ) );
-
- memset( cg.scores, 0, sizeof( cg.scores ) );
-
- if( cg_debugRandom.integer )
- CG_Printf( "cg.numScores: %d\n", cg.numScores );
-
- for( i = 0; i < cg.numScores; i++ )
- {
- //
- cg.scores[ i ].client = atoi( CG_Argv( i * 6 + 4 ) );
- cg.scores[ i ].score = atoi( CG_Argv( i * 6 + 5 ) );
- cg.scores[ i ].ping = atoi( CG_Argv( i * 6 + 6 ) );
- cg.scores[ i ].time = atoi( CG_Argv( i * 6 + 7 ) );
- cg.scores[ i ].weapon = atoi( CG_Argv( i * 6 + 8 ) );
- cg.scores[ i ].upgrade = atoi( CG_Argv( i * 6 + 9 ) );
-
- if( cg.scores[ i ].client < 0 || cg.scores[ i ].client >= MAX_CLIENTS )
- cg.scores[ i ].client = 0;
-
- cgs.clientinfo[ cg.scores[ i ].client ].score = cg.scores[ i ].score;
- cgs.clientinfo[ cg.scores[ i ].client ].powerups = 0;
-
- cg.scores[ i ].team = cgs.clientinfo[ cg.scores[ i ].client ].team;
- }
-}
-
-/*
-=================
-CG_ParseTeamInfo
-
-=================
-*/
-static void CG_ParseTeamInfo( void )
-{
- int i;
- int client;
-
- numSortedTeamPlayers = atoi( CG_Argv( 1 ) );
-
- for( i = 0; i < numSortedTeamPlayers; i++ )
- {
- client = atoi( CG_Argv( i * 6 + 2 ) );
-
- sortedTeamPlayers[ i ] = client;
-
- cgs.clientinfo[ client ].location = atoi( CG_Argv( i * 6 + 3 ) );
- cgs.clientinfo[ client ].health = atoi( CG_Argv( i * 6 + 4 ) );
- cgs.clientinfo[ client ].armor = atoi( CG_Argv( i * 6 + 5 ) );
- cgs.clientinfo[ client ].curWeapon = atoi( CG_Argv( i * 6 + 6 ) );
- cgs.clientinfo[ client ].powerups = atoi( CG_Argv( i * 6 + 7 ) );
- }
-}
-
-
-/*
-================
-CG_ParseServerinfo
-
-This is called explicitly when the gamestate is first received,
-and whenever the server updates any serverinfo flagged cvars
-================
-*/
-void CG_ParseServerinfo( void )
-{
- const char *info;
- char *mapname;
-
- info = CG_ConfigString( CS_SERVERINFO );
- cgs.timelimit = atoi( Info_ValueForKey( info, "timelimit" ) );
- cgs.maxclients = atoi( Info_ValueForKey( info, "sv_maxclients" ) );
- cgs.markDeconstruct = atoi( Info_ValueForKey( info, "g_markDeconstruct" ) );
- mapname = Info_ValueForKey( info, "mapname" );
- Com_sprintf( cgs.mapname, sizeof( cgs.mapname ), "maps/%s.bsp", mapname );
-}
-
-/*
-==================
-CG_ParseWarmup
-==================
-*/
-static void CG_ParseWarmup( void )
-{
- const char *info;
- int warmup;
-
- info = CG_ConfigString( CS_WARMUP );
-
- warmup = atoi( info );
- cg.warmupCount = -1;
-
- if( warmup == 0 && cg.warmup )
- {
- }
-
- cg.warmup = warmup;
-}
-
-/*
-================
-CG_SetConfigValues
-
-Called on load to set the initial values from configure strings
-================
-*/
-void CG_SetConfigValues( void )
-{
- sscanf( CG_ConfigString( CS_BUILDPOINTS ),
- "%d %d %d %d %d", &cgs.alienBuildPoints,
- &cgs.alienBuildPointsTotal,
- &cgs.humanBuildPoints,
- &cgs.humanBuildPointsTotal,
- &cgs.humanBuildPointsPowered );
-
- sscanf( CG_ConfigString( CS_STAGES ), "%d %d %d %d %d %d", &cgs.alienStage, &cgs.humanStage,
- &cgs.alienKills, &cgs.humanKills, &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold );
- sscanf( CG_ConfigString( CS_SPAWNS ), "%d %d", &cgs.numAlienSpawns, &cgs.numHumanSpawns );
-
- cgs.levelStartTime = atoi( CG_ConfigString( CS_LEVEL_START_TIME ) );
- cg.warmup = atoi( CG_ConfigString( CS_WARMUP ) );
-}
-
-
-/*
-=====================
-CG_ShaderStateChanged
-=====================
-*/
-void CG_ShaderStateChanged( void )
-{
- char originalShader[ MAX_QPATH ];
- char newShader[ MAX_QPATH ];
- char timeOffset[ 16 ];
- const char *o;
- char *n, *t;
-
- o = CG_ConfigString( CS_SHADERSTATE );
-
- while( o && *o )
- {
- n = strstr( o, "=" );
-
- if( n && *n )
- {
- strncpy( originalShader, o, n - o );
- originalShader[ n - o ] = 0;
- n++;
- t = strstr( n, ":" );
-
- if( t && *t )
- {
- strncpy( newShader, n, t - n );
- newShader[ t - n ] = 0;
- }
- else
- break;
-
- t++;
- o = strstr( t, "@" );
-
- if( o )
- {
- strncpy( timeOffset, t, o - t );
- timeOffset[ o - t ] = 0;
- o++;
- trap_R_RemapShader( originalShader, newShader, timeOffset );
- }
- }
- else
- break;
- }
-}
-
-/*
-================
-CG_AnnounceAlienStageTransistion
-================
-*/
-static void CG_AnnounceAlienStageTransistion( stage_t from, stage_t to )
-{
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] != PTE_ALIENS )
- return;
-
- trap_S_StartLocalSound( cgs.media.alienStageTransition, CHAN_ANNOUNCER );
- CG_CenterPrint( "We have evolved!", 200, GIANTCHAR_WIDTH * 4 );
-}
-
-/*
-================
-CG_AnnounceHumanStageTransistion
-================
-*/
-static void CG_AnnounceHumanStageTransistion( stage_t from, stage_t to )
-{
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] != PTE_HUMANS )
- return;
-
- trap_S_StartLocalSound( cgs.media.humanStageTransition, CHAN_ANNOUNCER );
- CG_CenterPrint( "Reinforcements have arrived!", 200, GIANTCHAR_WIDTH * 4 );
-}
-
-/*
-================
-CG_ConfigStringModified
-
-================
-*/
-static void CG_ConfigStringModified( void )
-{
- const char *str;
- int num;
-
- num = atoi( CG_Argv( 1 ) );
-
- // get the gamestate from the client system, which will have the
- // new configstring already integrated
- trap_GetGameState( &cgs.gameState );
-
- // look up the individual string that was modified
- str = CG_ConfigString( num );
-
- // do something with it if necessary
- if( num == CS_MUSIC )
- CG_StartMusic( );
- else if( num == CS_SERVERINFO )
- CG_ParseServerinfo( );
- else if( num == CS_WARMUP )
- CG_ParseWarmup( );
- else if( num == CS_BUILDPOINTS )
- sscanf( str, "%d %d %d %d %d", &cgs.alienBuildPoints,
- &cgs.alienBuildPointsTotal,
- &cgs.humanBuildPoints,
- &cgs.humanBuildPointsTotal,
- &cgs.humanBuildPointsPowered );
- else if( num == CS_STAGES )
- {
- stage_t oldAlienStage = cgs.alienStage;
- stage_t oldHumanStage = cgs.humanStage;
-
- sscanf( str, "%d %d %d %d %d %d",
- &cgs.alienStage, &cgs.humanStage,
- &cgs.alienKills, &cgs.humanKills,
- &cgs.alienNextStageThreshold, &cgs.humanNextStageThreshold );
-
- if( cgs.alienStage != oldAlienStage )
- CG_AnnounceAlienStageTransistion( oldAlienStage, cgs.alienStage );
-
- if( cgs.humanStage != oldHumanStage )
- CG_AnnounceHumanStageTransistion( oldHumanStage, cgs.humanStage );
- }
- else if( num == CS_SPAWNS )
- sscanf( str, "%d %d", &cgs.numAlienSpawns, &cgs.numHumanSpawns );
- else if( num == CS_LEVEL_START_TIME )
- cgs.levelStartTime = atoi( str );
- else if( num == CS_VOTE_TIME )
- {
- cgs.voteTime = atoi( str );
- cgs.voteModified = qtrue;
-
- if( cgs.voteTime )
- trap_Cvar_Set( "ui_voteActive", "1" );
- else
- trap_Cvar_Set( "ui_voteActive", "0" );
- }
- else if( num == CS_VOTE_YES )
- {
- cgs.voteYes = atoi( str );
- cgs.voteModified = qtrue;
- }
- else if( num == CS_VOTE_NO )
- {
- cgs.voteNo = atoi( str );
- cgs.voteModified = qtrue;
- }
- else if( num == CS_VOTE_STRING )
- Q_strncpyz( cgs.voteString, str, sizeof( cgs.voteString ) );
- else if( num >= CS_TEAMVOTE_TIME && num <= CS_TEAMVOTE_TIME + 1 )
- {
- int cs_offset = num - CS_TEAMVOTE_TIME;
-
- cgs.teamVoteTime[ cs_offset ] = atoi( str );
- cgs.teamVoteModified[ cs_offset ] = qtrue;
-
- if( cs_offset == 0 )
- {
- if( cgs.teamVoteTime[ cs_offset ] )
- trap_Cvar_Set( "ui_humanTeamVoteActive", "1" );
- else
- trap_Cvar_Set( "ui_humanTeamVoteActive", "0" );
- }
- else if( cs_offset == 1 )
- {
- if( cgs.teamVoteTime[ cs_offset ] )
- trap_Cvar_Set( "ui_alienTeamVoteActive", "1" );
- else
- trap_Cvar_Set( "ui_alienTeamVoteActive", "0" );
- }
- }
- else if( num >= CS_TEAMVOTE_YES && num <= CS_TEAMVOTE_YES + 1 )
- {
- cgs.teamVoteYes[ num - CS_TEAMVOTE_YES ] = atoi( str );
- cgs.teamVoteModified[ num - CS_TEAMVOTE_YES ] = qtrue;
- }
- else if( num >= CS_TEAMVOTE_NO && num <= CS_TEAMVOTE_NO + 1 )
- {
- cgs.teamVoteNo[ num - CS_TEAMVOTE_NO ] = atoi( str );
- cgs.teamVoteModified[ num - CS_TEAMVOTE_NO ] = qtrue;
- }
- else if( num >= CS_TEAMVOTE_STRING && num <= CS_TEAMVOTE_STRING + 1 )
- {
- Q_strncpyz( cgs.teamVoteString[ num - CS_TEAMVOTE_STRING ], str,
- sizeof( cgs.teamVoteString[ num - CS_TEAMVOTE_STRING ] ) );
- }
- else if( num == CS_INTERMISSION )
- cg.intermissionStarted = atoi( str );
- else if( num >= CS_MODELS && num < CS_MODELS+MAX_MODELS )
- cgs.gameModels[ num - CS_MODELS ] = trap_R_RegisterModel( str );
- else if( num >= CS_SHADERS && num < CS_SHADERS+MAX_GAME_SHADERS )
- cgs.gameShaders[ num - CS_SHADERS ] = trap_R_RegisterShader( str );
- else if( num >= CS_PARTICLE_SYSTEMS && num < CS_PARTICLE_SYSTEMS+MAX_GAME_PARTICLE_SYSTEMS )
- cgs.gameParticleSystems[ num - CS_PARTICLE_SYSTEMS ] = CG_RegisterParticleSystem( (char *)str );
- else if( num >= CS_SOUNDS && num < CS_SOUNDS+MAX_SOUNDS )
- {
- if( str[ 0 ] != '*' )
- { // player specific sounds don't register here
- cgs.gameSounds[ num - CS_SOUNDS ] = trap_S_RegisterSound( str, qfalse );
- }
- }
- else if( num >= CS_PLAYERS && num < CS_PLAYERS+MAX_CLIENTS )
- {
- CG_NewClientInfo( num - CS_PLAYERS );
- CG_BuildSpectatorString( );
- }
- else if( num == CS_WINNER )
- {
- trap_Cvar_Set( "ui_winner", str );
- }
- else if( num == CS_SHADERSTATE )
- {
- CG_ShaderStateChanged( );
- }
-}
-
-
-/*
-===============
-CG_MapRestart
-
-The server has issued a map_restart, so the next snapshot
-is completely new and should not be interpolated to.
-
-A tournement restart will clear everything, but doesn't
-require a reload of all the media
-===============
-*/
-static void CG_MapRestart( void )
-{
- if( cg_showmiss.integer )
- CG_Printf( "CG_MapRestart\n" );
-
- CG_InitMarkPolys( );
-
- // make sure the "3 frags left" warnings play again
- cg.fraglimitWarnings = 0;
-
- cg.timelimitWarnings = 0;
-
- cg.intermissionStarted = qfalse;
-
- cgs.voteTime = 0;
-
- cg.mapRestart = qtrue;
-
- CG_StartMusic( );
-
- trap_S_ClearLoopingSounds( qtrue );
-
- // we really should clear more parts of cg here and stop sounds
-
- // play the "fight" sound if this is a restart without warmup
- if( cg.warmup == 0 )
- CG_CenterPrint( "FIGHT!", 120, GIANTCHAR_WIDTH * 2 );
-
- trap_Cvar_Set( "cg_thirdPerson", "0" );
-}
-
-/*
-=================
-CG_RemoveChatEscapeChar
-=================
-*/
-static void CG_RemoveChatEscapeChar( char *text )
-{
- int i, l;
-
- l = 0;
- for( i = 0; text[ i ]; i++ )
- {
- if( text[ i ] == '\x19' )
- continue;
-
- text[ l++ ] = text[ i ];
- }
-
- text[ l ] = '\0';
-}
-
-/*
-===============
-CG_SetUIVars
-
-Set some cvars used by the UI
-===============
-*/
-static void CG_SetUIVars( void )
-{
- int i;
- char carriageCvar[ MAX_TOKEN_CHARS ];
-
- *carriageCvar = 0;
-
- //determine what the player is carrying
- for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
- {
- if( BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) &&
- BG_FindPurchasableForWeapon( i ) )
- strcat( carriageCvar, va( "W%d ", i ) );
- }
- for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
- {
- if( BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) &&
- BG_FindPurchasableForUpgrade( i ) )
- strcat( carriageCvar, va( "U%d ", i ) );
- }
- strcat( carriageCvar, "$" );
-
- trap_Cvar_Set( "ui_carriage", carriageCvar );
-
- trap_Cvar_Set( "ui_stages", va( "%d %d", cgs.alienStage, cgs.humanStage ) );
-}
-
-
-/*
-==============
-CG_Menu
-==============
-*/
-void CG_Menu( int menu )
-{
- const char *cmd = NULL; // command to send
- const char *longMsg = NULL; // command parameter
- const char *shortMsg = NULL; // non-modal version of message
- CG_SetUIVars( );
-
- // string literals have static storage duration, this is safe,
- // cleaner and much more readable.
- switch( menu )
- {
- case MN_TEAM:
- cmd = "menu tremulous_teamselect\n";
- break;
-
- case MN_A_CLASS:
- cmd = "menu tremulous_alienclass\n";
- break;
-
- case MN_H_SPAWN:
- cmd = "menu tremulous_humanitem\n";
- break;
-
- case MN_A_BUILD:
- cmd = "menu tremulous_alienbuild\n";
- break;
-
- case MN_H_BUILD:
- cmd = "menu tremulous_humanbuild\n";
- break;
-
- case MN_H_ARMOURY:
- cmd = "menu tremulous_humanarmoury\n";
- break;
-
- case MN_A_TEAMFULL:
- longMsg = "The alien team has too many players. Please wait until slots "
- "become available or join the human team.";
- shortMsg = "The alien team has too many players\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_H_TEAMFULL:
- longMsg = "The human team has too many players. Please wait until slots "
- "become available or join the alien team.";
- shortMsg = "The human team has too many players\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_A_TEAMCHANGEBUILDTIMER:
- longMsg = "You cannot leave the Alien team until your build timer "
- "has expired.";
- shortMsg = "You cannot change teams until your build timer expires.\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_H_TEAMCHANGEBUILDTIMER:
- longMsg = "You cannot leave the Human team until your build timer "
- "has expired.";
- shortMsg = "You cannot change teams until your build timer expires.\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- //===============================
-
- case MN_H_NOROOM:
- longMsg = "There is no room to build here. Move until the buildable turns "
- "translucent green indicating a valid build location.";
- shortMsg = "There is no room to build here\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NOPOWER:
- longMsg = "There is no power remaining. Free up power by destroying "
- "existing buildable objects.";
- shortMsg = "There is no power remaining\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NOTPOWERED:
- longMsg = "This buildable is not powered. Build a Reactor and/or Repeater "
- "in order to power it.";
- shortMsg = "This buildable is not powered\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NORMAL:
- longMsg = "Cannot build on this surface. The surface is too steep or "
- "unsuitable to build on. Please choose another site for this "
- "structure.";
- shortMsg = "Cannot build on this surface\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_REACTOR:
- longMsg = "There can only be one Reactor. Destroy the existing one if you "
- "wish to move it.";
- shortMsg = "There can only be one Reactor\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_REPEATER:
- longMsg = "There is no power here. If available, a Repeater may be used to "
- "transmit power to this location.";
- shortMsg = "There is no power here\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NODCC:
- longMsg = "There is no Defense Computer. A Defense Computer is needed to "
- "build this.";
- shortMsg = "There is no Defense Computer\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_TNODEWARN:
- longMsg = "WARNING: This Telenode will not be powered. Build near a power "
- "structure to prevent seeing this message again.";
- shortMsg = "This Telenode will not be powered\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_RPTWARN:
- longMsg = "WARNING: This Repeater will not be powered as there is no parent "
- "Reactor providing power. Build a Reactor.";
- shortMsg = "This Repeater will not be powered\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_RPTWARN2:
- longMsg = "This area already has power. A Repeater is not required here.";
- shortMsg = "This area already has power\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NOSLOTS:
- longMsg = "You have no room to carry this. Please sell any conflicting "
- "upgrades before purchasing this item.";
- shortMsg = "You have no room to carry this\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NOFUNDS:
- longMsg = "Insufficient funds. You do not have enough credits to perform "
- "this action.";
- shortMsg = "Insufficient funds\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_ITEMHELD:
- longMsg = "You already hold this item. It is not possible to carry multiple "
- "items of the same type.";
- shortMsg = "You already hold this item\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NOARMOURYHERE:
- longMsg = "You must be near a powered Armoury in order to purchase "
- "weapons, upgrades or non-energy ammunition.";
- shortMsg = "You must be near a powered Armoury\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NOENERGYAMMOHERE:
- longMsg = "You must be near an Armoury, Reactor or Repeater in order "
- "to purchase energy ammunition.";
- shortMsg = "You must be near an Armoury, Reactor or Repeater\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NOROOMBSUITON:
- longMsg = "There is not enough room here to put on a Battle Suit. "
- "Make sure you have enough head room to climb in.";
- shortMsg = "Not enough room here to put on a Battle Suit\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_NOROOMBSUITOFF:
- longMsg = "There is not enough room here to take off your Battle Suit. "
- "Make sure you have enough head room to climb out.";
- shortMsg = "Not enough room here to take off your Battle Suit\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
- case MN_H_ARMOURYBUILDTIMER:
- longMsg = "You are not allowed to buy or sell weapons until your "
- "build timer has expired.";
- shortMsg = "You can not buy or sell weapos until your build timer "
- "expires\n";
- cmd = "menu tremulous_human_dialog\n";
- break;
-
-
- //===============================
-
- case MN_A_NOROOM:
- longMsg = "There is no room to build here. Move until the structure turns "
- "translucent green indicating a valid build location.";
- shortMsg = "There is no room to build here\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_NOCREEP:
- longMsg = "There is no creep here. You must build near existing Eggs or "
- "the Overmind. Alien structures will not support themselves.";
- shortMsg = "There is no creep here\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_NOOVMND:
- longMsg = "There is no Overmind. An Overmind must be built to control "
- "the structure you tried to place";
- shortMsg = "There is no Overmind\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_OVERMIND:
- longMsg = "There can only be one Overmind. Destroy the existing one if you "
- "wish to move it.";
- shortMsg = "There can only be one Overmind\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_HOVEL:
- longMsg = "There can only be one Hovel. Destroy the existing one if you "
- "wish to move it.";
- shortMsg = "There can only be one Hovel\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_NOASSERT:
- longMsg = "The Overmind cannot control any more structures. Destroy existing "
- "structures to build more.";
- shortMsg = "The Overmind cannot control any more structures\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_SPWNWARN:
- longMsg = "WARNING: This spawn will not be controlled by an Overmind. "
- "Build an Overmind to prevent seeing this message again.";
- shortMsg = "This spawn will not be controlled by an Overmind\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_NORMAL:
- longMsg = "Cannot build on this surface. This surface is too steep or "
- "unsuitable to build on. Please choose another site for this "
- "structure.";
- shortMsg = "Cannot build on this surface\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_NOEROOM:
- longMsg = "There is no room to evolve here. Move away from walls or other "
- "nearby objects and try again.";
- cmd = "menu tremulous_alien_dialog\n";
- shortMsg = "There is no room to evolve here\n";
- break;
-
- case MN_A_TOOCLOSE:
- longMsg = "This location is too close to the enemy to evolve. Move away "
- "until you are no longer aware of the enemy's presence and try "
- "again.";
- shortMsg = "This location is too close to the enemy to evolve\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_NOOVMND_EVOLVE:
- longMsg = "There is no Overmind. An Overmind must be built to allow "
- "you to upgrade.";
- shortMsg = "There is no Overmind\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_EVOLVEBUILDTIMER:
- longMsg = "You cannot Evolve until your build timer has expired.";
- shortMsg = "You cannot Evolve until your build timer expires\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_HOVEL_OCCUPIED:
- longMsg = "This Hovel is already occupied by another builder.";
- shortMsg = "This Hovel is already occupied by another builder\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_HOVEL_BLOCKED:
- longMsg = "The exit to this Hovel is currently blocked. Please wait until it "
- "becomes clear then try again.";
- shortMsg = "The exit to this Hovel is currently blocked\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_HOVEL_EXIT:
- longMsg = "The exit to this Hovel would always be blocked. Please choose "
- "a more suitable location.";
- shortMsg = "The exit to this Hovel would always be blocked\n";
- cmd = "menu tremulous_alien_dialog\n";
- break;
-
- case MN_A_INFEST:
- trap_Cvar_Set( "ui_currentClass", va( "%d %d", cg.snap->ps.stats[ STAT_PCLASS ],
- cg.snap->ps.persistant[ PERS_CREDIT ] ) );
- cmd = "menu tremulous_alienupgrade\n";
- break;
-
- default:
- Com_Printf( "cgame: debug: no such menu %d\n", menu );
- }
-
- if( !cg_disableWarningDialogs.integer || !shortMsg )
- {
- // Player either wants dialog window or there's no short message
- if( cmd )
- {
- if( longMsg )
- trap_Cvar_Set( "ui_dialog", longMsg );
-
- trap_SendConsoleCommand( cmd );
- }
- }
- else
- {
- // There is short message and player wants it
- CG_Printf( shortMsg );
- }
-}
-
-/*
-=================
-CG_ServerCommand
-
-The string has been tokenized and can be retrieved with
-Cmd_Argc() / Cmd_Argv()
-=================
-*/
-static void CG_ServerCommand( void )
-{
- const char *cmd;
- char text[ MAX_SAY_TEXT ];
-
- cmd = CG_Argv( 0 );
-
- if( !cmd[ 0 ] )
- {
- // server claimed the command
- return;
- }
-
- if( !strcmp( cmd, "cp" ) )
- {
- CG_CenterPrint( CG_Argv( 1 ), SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
- return;
- }
-
- if( !strcmp( cmd, "cs" ) )
- {
- CG_ConfigStringModified( );
- return;
- }
-
- if( !strcmp( cmd, "print" ) )
- {
- CG_Printf( "%s", CG_Argv( 1 ) );
- return;
- }
-
- if( !strcmp( cmd, "chat" ) )
- {
- if( !cg_teamChatsOnly.integer )
- {
- Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT );
- if( Q_stricmpn( text, "[skipnotify]", 12 ) )
- trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND );
- CG_RemoveChatEscapeChar( text );
- CG_Printf( "%s\n", text );
- }
-
- return;
- }
-
- if( !strcmp( cmd, "tchat" ) )
- {
- Q_strncpyz( text, CG_Argv( 1 ), MAX_SAY_TEXT );
- if( Q_stricmpn( text, "[skipnotify]", 12 ) )
- {
- if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- trap_S_StartLocalSound( cgs.media.alienTalkSound, CHAN_LOCAL_SOUND );
- else if( cg.snap->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- trap_S_StartLocalSound( cgs.media.humanTalkSound, CHAN_LOCAL_SOUND );
- else
- trap_S_StartLocalSound( cgs.media.talkSound, CHAN_LOCAL_SOUND );
- }
- CG_RemoveChatEscapeChar( text );
- CG_Printf( "%s\n", text );
- return;
- }
-
- if( !strcmp( cmd, "scores" ) )
- {
- CG_ParseScores( );
- return;
- }
-
- if( !strcmp( cmd, "tinfo" ) )
- {
- CG_ParseTeamInfo( );
- return;
- }
-
- if( !strcmp( cmd, "map_restart" ) )
- {
- CG_MapRestart( );
- return;
- }
-
- if( Q_stricmp( cmd, "remapShader" ) == 0 )
- {
- if( trap_Argc( ) == 4 )
- trap_R_RemapShader( CG_Argv( 1 ), CG_Argv( 2 ), CG_Argv( 3 ) );
- }
-
- // clientLevelShot is sent before taking a special screenshot for
- // the menu system during development
- if( !strcmp( cmd, "clientLevelShot" ) )
- {
- cg.levelShot = qtrue;
- return;
- }
-
- //the server has triggered a menu
- if( !strcmp( cmd, "servermenu" ) )
- {
- if( trap_Argc( ) == 2 && !cg.demoPlayback )
- CG_Menu( atoi( CG_Argv( 1 ) ) );
-
- return;
- }
-
- //the server thinks this client should close all menus
- if( !strcmp( cmd, "serverclosemenus" ) )
- {
- trap_SendConsoleCommand( "closemenus\n" );
- return;
- }
-
- //poison cloud effect needs to be reliable
- if( !strcmp( cmd, "poisoncloud" ) )
- {
- cg.poisonedTime = cg.time;
-
- if( CG_IsParticleSystemValid( &cg.poisonCloudPS ) )
- {
- cg.poisonCloudPS = CG_SpawnNewParticleSystem( cgs.media.poisonCloudPS );
- CG_SetAttachmentCent( &cg.poisonCloudPS->attachment, &cg.predictedPlayerEntity );
- CG_AttachToCent( &cg.poisonCloudPS->attachment );
- }
-
- return;
- }
-
- if( !strcmp( cmd, "weaponswitch" ) )
- {
- CG_Printf( "client weaponswitch\n" );
- if( trap_Argc( ) == 2 )
- {
- cg.weaponSelect = atoi( CG_Argv( 1 ) );
- cg.weaponSelectTime = cg.time;
- }
-
- return;
- }
-
- // server requests a ptrc
- if( !strcmp( cmd, "ptrcrequest" ) )
- {
- int code = CG_ReadPTRCode( );
-
- trap_SendClientCommand( va( "ptrcverify %d", code ) );
- return;
- }
-
- // server issues a ptrc
- if( !strcmp( cmd, "ptrcissue" ) )
- {
- if( trap_Argc( ) == 2 )
- {
- int code = atoi( CG_Argv( 1 ) );
-
- CG_WritePTRCode( code );
- }
-
- return;
- }
-
- // reply to ptrcverify
- if( !strcmp( cmd, "ptrcconfirm" ) )
- {
- trap_SendConsoleCommand( "menu ptrc_popmenu\n" );
-
- return;
- }
-
- CG_Printf( "Unknown client game command: %s\n", cmd );
-}
-
-
-/*
-====================
-CG_ExecuteNewServerCommands
-
-Execute all of the server commands that were received along
-with this this snapshot.
-====================
-*/
-void CG_ExecuteNewServerCommands( int latestSequence )
-{
- while( cgs.serverCommandSequence < latestSequence )
- {
- if( trap_GetServerCommand( ++cgs.serverCommandSequence ) )
- CG_ServerCommand( );
- }
-}
diff --git a/src/cgame/cg_snapshot.c b/src/cgame/cg_snapshot.c
deleted file mode 100644
index f439a69..0000000
--- a/src/cgame/cg_snapshot.c
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_snapshot.c -- things that happen on snapshot transition,
-// not necessarily every single rendered frame
-
-
-#include "cg_local.h"
-
-/*
-==================
-CG_ResetEntity
-==================
-*/
-static void CG_ResetEntity( centity_t *cent )
-{
- // if the previous snapshot this entity was updated in is at least
- // an event window back in time then we can reset the previous event
- if( cent->snapShotTime < cg.time - EVENT_VALID_MSEC )
- cent->previousEvent = 0;
-
- cent->trailTime = cg.snap->serverTime;
-
- VectorCopy( cent->currentState.origin, cent->lerpOrigin );
- VectorCopy( cent->currentState.angles, cent->lerpAngles );
-
- if( cent->currentState.eType == ET_PLAYER )
- CG_ResetPlayerEntity( cent );
-}
-
-/*
-===============
-CG_TransitionEntity
-
-cent->nextState is moved to cent->currentState and events are fired
-===============
-*/
-static void CG_TransitionEntity( centity_t *cent )
-{
- cent->currentState = cent->nextState;
- cent->currentValid = qtrue;
-
- // reset if the entity wasn't in the last frame or was teleported
- if( !cent->interpolate )
- CG_ResetEntity( cent );
-
- // clear the next state. if will be set by the next CG_SetNextSnap
- cent->interpolate = qfalse;
-
- // check for events
- CG_CheckEvents( cent );
-}
-
-
-/*
-==================
-CG_SetInitialSnapshot
-
-This will only happen on the very first snapshot, or
-on tourney restarts. All other times will use
-CG_TransitionSnapshot instead.
-
-FIXME: Also called by map_restart?
-==================
-*/
-void CG_SetInitialSnapshot( snapshot_t *snap )
-{
- int i;
- centity_t *cent;
- entityState_t *state;
-
- cg.snap = snap;
-
- BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].currentState, qfalse );
-
- // sort out solid entities
- CG_BuildSolidList( );
-
- CG_ExecuteNewServerCommands( snap->serverCommandSequence );
-
- // set our local weapon selection pointer to
- // what the server has indicated the current weapon is
- CG_Respawn( );
-
- for( i = 0; i < cg.snap->numEntities; i++ )
- {
- state = &cg.snap->entities[ i ];
- cent = &cg_entities[ state->number ];
-
- memcpy( ¢->currentState, state, sizeof( entityState_t ) );
- //cent->currentState = *state;
- cent->interpolate = qfalse;
- cent->currentValid = qtrue;
-
- CG_ResetEntity( cent );
-
- // check for events
- CG_CheckEvents( cent );
- }
-}
-
-
-/*
-===================
-CG_TransitionSnapshot
-
-The transition point from snap to nextSnap has passed
-===================
-*/
-static void CG_TransitionSnapshot( void )
-{
- centity_t *cent;
- snapshot_t *oldFrame;
- int i;
-
- if( !cg.snap )
- CG_Error( "CG_TransitionSnapshot: NULL cg.snap" );
-
- if( !cg.nextSnap )
- CG_Error( "CG_TransitionSnapshot: NULL cg.nextSnap" );
-
- // execute any server string commands before transitioning entities
- CG_ExecuteNewServerCommands( cg.nextSnap->serverCommandSequence );
-
- // if we had a map_restart, set everthing with initial
- if( !cg.snap ) { } //TA: ?
-
- // clear the currentValid flag for all entities in the existing snapshot
- for( i = 0; i < cg.snap->numEntities; i++ )
- {
- cent = &cg_entities[ cg.snap->entities[ i ].number ];
- cent->currentValid = qfalse;
- }
-
- // move nextSnap to snap and do the transitions
- oldFrame = cg.snap;
- cg.snap = cg.nextSnap;
-
- BG_PlayerStateToEntityState( &cg.snap->ps, &cg_entities[ cg.snap->ps.clientNum ].currentState, qfalse );
- cg_entities[ cg.snap->ps.clientNum ].interpolate = qfalse;
-
- for( i = 0; i < cg.snap->numEntities; i++ )
- {
- cent = &cg_entities[ cg.snap->entities[ i ].number ];
- CG_TransitionEntity( cent );
-
- // remember time of snapshot this entity was last updated in
- cent->snapShotTime = cg.snap->serverTime;
- }
-
- cg.nextSnap = NULL;
-
- // check for playerstate transition events
- if( oldFrame )
- {
- playerState_t *ops, *ps;
-
- ops = &oldFrame->ps;
- ps = &cg.snap->ps;
- // teleporting checks are irrespective of prediction
- if( ( ps->eFlags ^ ops->eFlags ) & EF_TELEPORT_BIT )
- cg.thisFrameTeleport = qtrue; // will be cleared by prediction code
-
- // if we are not doing client side movement prediction for any
- // reason, then the client events and view changes will be issued now
- if( cg.demoPlayback || ( cg.snap->ps.pm_flags & PMF_FOLLOW ) ||
- cg_nopredict.integer || cg_synchronousClients.integer )
- CG_TransitionPlayerState( ps, ops );
- }
-}
-
-
-/*
-===================
-CG_SetNextSnap
-
-A new snapshot has just been read in from the client system.
-===================
-*/
-static void CG_SetNextSnap( snapshot_t *snap )
-{
- int num;
- entityState_t *es;
- centity_t *cent;
-
- cg.nextSnap = snap;
-
- BG_PlayerStateToEntityState( &snap->ps, &cg_entities[ snap->ps.clientNum ].nextState, qfalse );
- cg_entities[ cg.snap->ps.clientNum ].interpolate = qtrue;
-
- // check for extrapolation errors
- for( num = 0 ; num < snap->numEntities ; num++ )
- {
- es = &snap->entities[ num ];
- cent = &cg_entities[ es->number ];
-
- memcpy( ¢->nextState, es, sizeof( entityState_t ) );
- //cent->nextState = *es;
-
- // if this frame is a teleport, or the entity wasn't in the
- // previous frame, don't interpolate
- if( !cent->currentValid || ( ( cent->currentState.eFlags ^ es->eFlags ) & EF_TELEPORT_BIT ) )
- cent->interpolate = qfalse;
- else
- cent->interpolate = qtrue;
- }
-
- // if the next frame is a teleport for the playerstate, we
- // can't interpolate during demos
- if( cg.snap && ( ( snap->ps.eFlags ^ cg.snap->ps.eFlags ) & EF_TELEPORT_BIT ) )
- cg.nextFrameTeleport = qtrue;
- else
- cg.nextFrameTeleport = qfalse;
-
- // if changing follow mode, don't interpolate
- if( cg.nextSnap->ps.clientNum != cg.snap->ps.clientNum )
- cg.nextFrameTeleport = qtrue;
-
- // if changing server restarts, don't interpolate
- if( ( cg.nextSnap->snapFlags ^ cg.snap->snapFlags ) & SNAPFLAG_SERVERCOUNT )
- cg.nextFrameTeleport = qtrue;
-
- // sort out solid entities
- CG_BuildSolidList( );
-}
-
-
-/*
-========================
-CG_ReadNextSnapshot
-
-This is the only place new snapshots are requested
-This may increment cgs.processedSnapshotNum multiple
-times if the client system fails to return a
-valid snapshot.
-========================
-*/
-static snapshot_t *CG_ReadNextSnapshot( void )
-{
- qboolean r;
- snapshot_t *dest;
-
- if( cg.latestSnapshotNum > cgs.processedSnapshotNum + 1000 )
- {
- CG_Printf( "WARNING: CG_ReadNextSnapshot: way out of range, %i > %i",
- cg.latestSnapshotNum, cgs.processedSnapshotNum );
- }
-
- while( cgs.processedSnapshotNum < cg.latestSnapshotNum )
- {
- // decide which of the two slots to load it into
- if( cg.snap == &cg.activeSnapshots[ 0 ] )
- dest = &cg.activeSnapshots[ 1 ];
- else
- dest = &cg.activeSnapshots[ 0 ];
-
- // try to read the snapshot from the client system
- cgs.processedSnapshotNum++;
- r = trap_GetSnapshot( cgs.processedSnapshotNum, dest );
-
- // FIXME: why would trap_GetSnapshot return a snapshot with the same server time
- if( cg.snap && r && dest->serverTime == cg.snap->serverTime )
- {
- //continue;
- }
-
- // if it succeeded, return
- if( r )
- {
- CG_AddLagometerSnapshotInfo( dest );
- return dest;
- }
-
- // a GetSnapshot will return failure if the snapshot
- // never arrived, or is so old that its entities
- // have been shoved off the end of the circular
- // buffer in the client system.
-
- // record as a dropped packet
- CG_AddLagometerSnapshotInfo( NULL );
-
- // If there are additional snapshots, continue trying to
- // read them.
- }
-
- // nothing left to read
- return NULL;
-}
-
-
-/*
-============
-CG_ProcessSnapshots
-
-We are trying to set up a renderable view, so determine
-what the simulated time is, and try to get snapshots
-both before and after that time if available.
-
-If we don't have a valid cg.snap after exiting this function,
-then a 3D game view cannot be rendered. This should only happen
-right after the initial connection. After cg.snap has been valid
-once, it will never turn invalid.
-
-Even if cg.snap is valid, cg.nextSnap may not be, if the snapshot
-hasn't arrived yet (it becomes an extrapolating situation instead
-of an interpolating one)
-
-============
-*/
-void CG_ProcessSnapshots( void )
-{
- snapshot_t *snap;
- int n;
-
- // see what the latest snapshot the client system has is
- trap_GetCurrentSnapshotNumber( &n, &cg.latestSnapshotTime );
-
- if( n != cg.latestSnapshotNum )
- {
- if( n < cg.latestSnapshotNum )
- {
- // this should never happen
- CG_Error( "CG_ProcessSnapshots: n < cg.latestSnapshotNum" );
- }
-
- cg.latestSnapshotNum = n;
- }
-
- // If we have yet to receive a snapshot, check for it.
- // Once we have gotten the first snapshot, cg.snap will
- // always have valid data for the rest of the game
- while( !cg.snap )
- {
- snap = CG_ReadNextSnapshot( );
-
- if( !snap )
- {
- // we can't continue until we get a snapshot
- return;
- }
-
- // set our weapon selection to what
- // the playerstate is currently using
- if( !( snap->snapFlags & SNAPFLAG_NOT_ACTIVE ) )
- CG_SetInitialSnapshot( snap );
- }
-
- // loop until we either have a valid nextSnap with a serverTime
- // greater than cg.time to interpolate towards, or we run
- // out of available snapshots
- do
- {
- // if we don't have a nextframe, try and read a new one in
- if( !cg.nextSnap )
- {
- snap = CG_ReadNextSnapshot( );
-
- // if we still don't have a nextframe, we will just have to
- // extrapolate
- if( !snap )
- break;
-
- CG_SetNextSnap( snap );
-
- // if time went backwards, we have a level restart
- if( cg.nextSnap->serverTime < cg.snap->serverTime )
- CG_Error( "CG_ProcessSnapshots: Server time went backwards" );
- }
-
- // if our time is < nextFrame's, we have a nice interpolating state
- if( cg.time >= cg.snap->serverTime && cg.time < cg.nextSnap->serverTime )
- break;
-
- // we have passed the transition from nextFrame to frame
- CG_TransitionSnapshot( );
- } while( 1 );
-
- // assert our valid conditions upon exiting
- if( cg.snap == NULL )
- CG_Error( "CG_ProcessSnapshots: cg.snap == NULL" );
-
- if( cg.time < cg.snap->serverTime )
- {
- // this can happen right after a vid_restart
- cg.time = cg.snap->serverTime;
- }
-
- if( cg.nextSnap != NULL && cg.nextSnap->serverTime <= cg.time )
- CG_Error( "CG_ProcessSnapshots: cg.nextSnap->serverTime <= cg.time" );
-}
-
diff --git a/src/cgame/cg_syscalls.asm b/src/cgame/cg_syscalls.asm
deleted file mode 100644
index 0479f1d..0000000
--- a/src/cgame/cg_syscalls.asm
+++ /dev/null
@@ -1,116 +0,0 @@
-code
-
-equ trap_Print -1
-equ trap_Error -2
-equ trap_Milliseconds -3
-equ trap_Cvar_Register -4
-equ trap_Cvar_Update -5
-equ trap_Cvar_Set -6
-equ trap_Cvar_VariableStringBuffer -7
-equ trap_Argc -8
-equ trap_Argv -9
-equ trap_Args -10
-equ trap_FS_FOpenFile -11
-equ trap_FS_Read -12
-equ trap_FS_Write -13
-equ trap_FS_FCloseFile -14
-equ trap_SendConsoleCommand -15
-equ trap_AddCommand -16
-equ trap_SendClientCommand -17
-equ trap_UpdateScreen -18
-equ trap_CM_LoadMap -19
-equ trap_CM_NumInlineModels -20
-equ trap_CM_InlineModel -21
-equ trap_CM_LoadModel -22
-equ trap_CM_TempBoxModel -23
-equ trap_CM_PointContents -24
-equ trap_CM_TransformedPointContents -25
-equ trap_CM_BoxTrace -26
-equ trap_CM_TransformedBoxTrace -27
-equ trap_CM_MarkFragments -28
-equ trap_S_StartSound -29
-equ trap_S_StartLocalSound -30
-equ trap_S_ClearLoopingSounds -31
-equ trap_S_AddLoopingSound -32
-equ trap_S_UpdateEntityPosition -33
-equ trap_S_Respatialize -34
-equ trap_S_RegisterSound -35
-equ trap_S_StartBackgroundTrack -36
-equ trap_R_LoadWorldMap -37
-equ trap_R_RegisterModel -38
-equ trap_R_RegisterSkin -39
-equ trap_R_RegisterShader -40
-equ trap_R_ClearScene -41
-equ trap_R_AddRefEntityToScene -42
-equ trap_R_AddPolyToScene -43
-equ trap_R_AddLightToScene -44
-equ trap_R_RenderScene -45
-equ trap_R_SetColor -46
-equ trap_R_DrawStretchPic -47
-equ trap_R_ModelBounds -48
-equ trap_R_LerpTag -49
-equ trap_GetGlconfig -50
-equ trap_GetGameState -51
-equ trap_GetCurrentSnapshotNumber -52
-equ trap_GetSnapshot -53
-equ trap_GetServerCommand -54
-equ trap_GetCurrentCmdNumber -55
-equ trap_GetUserCmd -56
-equ trap_SetUserCmdValue -57
-equ trap_R_RegisterShaderNoMip -58
-equ trap_MemoryRemaining -59
-equ trap_R_RegisterFont -60
-equ trap_Key_IsDown -61
-equ trap_Key_GetCatcher -62
-equ trap_Key_SetCatcher -63
-equ trap_Key_GetKey -64
-equ trap_S_StopBackgroundTrack -65
-equ trap_RealTime -66
-equ trap_SnapVector -67
-equ trap_RemoveCommand -68
-equ trap_R_LightForPoint -69
-equ trap_CIN_PlayCinematic -70
-equ trap_CIN_StopCinematic -71
-equ trap_CIN_RunCinematic -72
-equ trap_CIN_DrawCinematic -73
-equ trap_CIN_SetExtents -74
-equ trap_R_RemapShader -75
-equ trap_S_AddRealLoopingSound -76
-equ trap_S_StopLoopingSound -77
-equ trap_CM_TempCapsuleModel -78
-equ trap_CM_CapsuleTrace -79
-equ trap_CM_TransformedCapsuleTrace -80
-equ trap_R_AddAdditiveLightToScene -81
-equ trap_GetEntityToken -82
-equ trap_R_AddPolysToScene -83
-equ trap_R_inPVS -84
-equ trap_FS_Seek -85
-equ trap_FS_GetFileList -86
-equ trap_LiteralArgs -87
-equ trap_CM_BiSphereTrace -88
-equ trap_CM_TransformedBiSphereTrace -89
-equ trap_GetDemoState -90
-equ trap_GetDemoPos -91
-equ trap_GetDemoName -92
-equ trap_Key_KeynumToStringBuf -93
-equ trap_Key_GetBindingBuf -94
-equ trap_Key_SetBinding -95
-
-equ trap_Parse_AddGlobalDefine -96
-equ trap_Parse_LoadSource -97
-equ trap_Parse_FreeSource -98
-equ trap_Parse_ReadToken -99
-equ trap_Parse_SourceFileAndLine -100
-
-equ memset -201
-equ memcpy -202
-equ strncpy -203
-equ sin -204
-equ cos -205
-equ atan2 -206
-equ sqrt -207
-equ floor -208
-equ ceil -209
-equ testPrintInt -210
-equ testPrintFloat -211
-
diff --git a/src/cgame/cg_syscalls.c b/src/cgame/cg_syscalls.c
deleted file mode 100644
index 43afc2c..0000000
--- a/src/cgame/cg_syscalls.c
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_syscalls.c -- this file is only included when building a dll
-// cg_syscalls.asm is included instead when building a qvm
-
-
-#include "cg_local.h"
-
-static intptr_t (QDECL *syscall)( intptr_t arg, ... ) = (intptr_t (QDECL *)( intptr_t, ...))-1;
-
-
-void dllEntry( intptr_t (QDECL *syscallptr)( intptr_t arg,... ) )
-{
- syscall = syscallptr;
-}
-
-
-int PASSFLOAT( float x )
-{
- float floatTemp;
- floatTemp = x;
- return *(int *)&floatTemp;
-}
-
-void trap_Print( const char *fmt )
-{
- syscall( CG_PRINT, fmt );
-}
-
-void trap_Error( const char *fmt )
-{
- syscall( CG_ERROR, fmt );
-}
-
-int trap_Milliseconds( void )
-{
- return syscall( CG_MILLISECONDS );
-}
-
-void trap_Cvar_Register( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags )
-{
- syscall( CG_CVAR_REGISTER, vmCvar, varName, defaultValue, flags );
-}
-
-void trap_Cvar_Update( vmCvar_t *vmCvar )
-{
- syscall( CG_CVAR_UPDATE, vmCvar );
-}
-
-void trap_Cvar_Set( const char *var_name, const char *value )
-{
- syscall( CG_CVAR_SET, var_name, value );
-}
-
-void trap_Cvar_VariableStringBuffer( const char *var_name, char *buffer, int bufsize )
-{
- syscall( CG_CVAR_VARIABLESTRINGBUFFER, var_name, buffer, bufsize );
-}
-
-int trap_Argc( void )
-{
- return syscall( CG_ARGC );
-}
-
-void trap_Argv( int n, char *buffer, int bufferLength )
-{
- syscall( CG_ARGV, n, buffer, bufferLength );
-}
-
-void trap_Args( char *buffer, int bufferLength )
-{
- syscall( CG_ARGS, buffer, bufferLength );
-}
-
-void trap_LiteralArgs( char *buffer, int bufferLength )
-{
- syscall( CG_LITERAL_ARGS, buffer, bufferLength );
-}
-
-int trap_FS_FOpenFile( const char *qpath, fileHandle_t *f, fsMode_t mode )
-{
- return syscall( CG_FS_FOPENFILE, qpath, f, mode );
-}
-
-void trap_FS_Read( void *buffer, int len, fileHandle_t f )
-{
- syscall( CG_FS_READ, buffer, len, f );
-}
-
-void trap_FS_Write( const void *buffer, int len, fileHandle_t f )
-{
- syscall( CG_FS_WRITE, buffer, len, f );
-}
-
-void trap_FS_FCloseFile( fileHandle_t f )
-{
- syscall( CG_FS_FCLOSEFILE, f );
-}
-
-void trap_FS_Seek( fileHandle_t f, long offset, fsOrigin_t origin )
-{
- syscall( CG_FS_SEEK, f, offset, origin );
-}
-
-int trap_FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize )
-{
- return syscall( CG_FS_GETFILELIST, path, extension, listbuf, bufsize );
-}
-
-void trap_SendConsoleCommand( const char *text )
-{
- syscall( CG_SENDCONSOLECOMMAND, text );
-}
-
-void trap_AddCommand( const char *cmdName )
-{
- syscall( CG_ADDCOMMAND, cmdName );
-}
-
-void trap_RemoveCommand( const char *cmdName )
-{
- syscall( CG_REMOVECOMMAND, cmdName );
-}
-
-void trap_SendClientCommand( const char *s )
-{
- syscall( CG_SENDCLIENTCOMMAND, s );
-}
-
-void trap_UpdateScreen( void )
-{
- syscall( CG_UPDATESCREEN );
-}
-
-void trap_CM_LoadMap( const char *mapname )
-{
- syscall( CG_CM_LOADMAP, mapname );
-}
-
-int trap_CM_NumInlineModels( void )
-{
- return syscall( CG_CM_NUMINLINEMODELS );
-}
-
-clipHandle_t trap_CM_InlineModel( int index )
-{
- return syscall( CG_CM_INLINEMODEL, index );
-}
-
-clipHandle_t trap_CM_TempBoxModel( const vec3_t mins, const vec3_t maxs )
-{
- return syscall( CG_CM_TEMPBOXMODEL, mins, maxs );
-}
-
-clipHandle_t trap_CM_TempCapsuleModel( const vec3_t mins, const vec3_t maxs )
-{
- return syscall( CG_CM_TEMPCAPSULEMODEL, mins, maxs );
-}
-
-int trap_CM_PointContents( const vec3_t p, clipHandle_t model )
-{
- return syscall( CG_CM_POINTCONTENTS, p, model );
-}
-
-int trap_CM_TransformedPointContents( const vec3_t p, clipHandle_t model, const vec3_t origin,
- const vec3_t angles )
-{
- return syscall( CG_CM_TRANSFORMEDPOINTCONTENTS, p, model, origin, angles );
-}
-
-void trap_CM_BoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
- const vec3_t mins, const vec3_t maxs,
- clipHandle_t model, int brushmask )
-{
- syscall( CG_CM_BOXTRACE, results, start, end, mins, maxs, model, brushmask );
-}
-
-void trap_CM_CapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
- const vec3_t mins, const vec3_t maxs,
- clipHandle_t model, int brushmask )
-{
- syscall( CG_CM_CAPSULETRACE, results, start, end, mins, maxs, model, brushmask );
-}
-
-void trap_CM_TransformedBoxTrace( trace_t *results, const vec3_t start, const vec3_t end,
- const vec3_t mins, const vec3_t maxs,
- clipHandle_t model, int brushmask,
- const vec3_t origin, const vec3_t angles )
-{
- syscall( CG_CM_TRANSFORMEDBOXTRACE, results, start, end, mins, maxs, model, brushmask, origin, angles );
-}
-
-void trap_CM_TransformedCapsuleTrace( trace_t *results, const vec3_t start, const vec3_t end,
- const vec3_t mins, const vec3_t maxs,
- clipHandle_t model, int brushmask,
- const vec3_t origin, const vec3_t angles )
-{
- syscall( CG_CM_TRANSFORMEDCAPSULETRACE, results, start, end, mins, maxs, model, brushmask, origin, angles );
-}
-
-void trap_CM_BiSphereTrace( trace_t *results, const vec3_t start,
- const vec3_t end, float startRad, float endRad,
- clipHandle_t model, int mask )
-{
- syscall( CG_CM_BISPHERETRACE, results, start, end,
- PASSFLOAT( startRad ), PASSFLOAT( endRad ), model, mask );
-}
-
-void trap_CM_TransformedBiSphereTrace( trace_t *results, const vec3_t start,
- const vec3_t end, float startRad, float endRad,
- clipHandle_t model, int mask,
- const vec3_t origin )
-{
- syscall( CG_CM_TRANSFORMEDBISPHERETRACE, results, start, end, PASSFLOAT( startRad ),
- PASSFLOAT( endRad ), model, mask, origin );
-}
-
-int trap_CM_MarkFragments( int numPoints, const vec3_t *points,
- const vec3_t projection,
- int maxPoints, vec3_t pointBuffer,
- int maxFragments, markFragment_t *fragmentBuffer )
-{
- return syscall( CG_CM_MARKFRAGMENTS, numPoints, points, projection, maxPoints,
- pointBuffer, maxFragments, fragmentBuffer );
-}
-
-void trap_S_StartSound( vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfx )
-{
- syscall( CG_S_STARTSOUND, origin, entityNum, entchannel, sfx );
-}
-
-void trap_S_StartLocalSound( sfxHandle_t sfx, int channelNum )
-{
- syscall( CG_S_STARTLOCALSOUND, sfx, channelNum );
-}
-
-void trap_S_ClearLoopingSounds( qboolean killall )
-{
- syscall( CG_S_CLEARLOOPINGSOUNDS, killall );
-}
-
-void trap_S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx )
-{
- syscall( CG_S_ADDLOOPINGSOUND, entityNum, origin, velocity, sfx );
-}
-
-void trap_S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx )
-{
- syscall( CG_S_ADDREALLOOPINGSOUND, entityNum, origin, velocity, sfx );
-}
-
-void trap_S_StopLoopingSound( int entityNum )
-{
- syscall( CG_S_STOPLOOPINGSOUND, entityNum );
-}
-
-void trap_S_UpdateEntityPosition( int entityNum, const vec3_t origin )
-{
- syscall( CG_S_UPDATEENTITYPOSITION, entityNum, origin );
-}
-
-void trap_S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater )
-{
- syscall( CG_S_RESPATIALIZE, entityNum, origin, axis, inwater );
-}
-
-sfxHandle_t trap_S_RegisterSound( const char *sample, qboolean compressed )
-{
- return syscall( CG_S_REGISTERSOUND, sample, compressed );
-}
-
-void trap_S_StartBackgroundTrack( const char *intro, const char *loop )
-{
- syscall( CG_S_STARTBACKGROUNDTRACK, intro, loop );
-}
-
-void trap_R_LoadWorldMap( const char *mapname )
-{
- syscall( CG_R_LOADWORLDMAP, mapname );
-}
-
-qhandle_t trap_R_RegisterModel( const char *name )
-{
- return syscall( CG_R_REGISTERMODEL, name );
-}
-
-qhandle_t trap_R_RegisterSkin( const char *name )
-{
- return syscall( CG_R_REGISTERSKIN, name );
-}
-
-qhandle_t trap_R_RegisterShader( const char *name )
-{
- return syscall( CG_R_REGISTERSHADER, name );
-}
-
-qhandle_t trap_R_RegisterShaderNoMip( const char *name )
-{
- return syscall( CG_R_REGISTERSHADERNOMIP, name );
-}
-
-void trap_R_RegisterFont( const char *fontName, int pointSize, fontInfo_t *font )
-{
- syscall(CG_R_REGISTERFONT, fontName, pointSize, font );
-}
-
-void trap_R_ClearScene( void )
-{
- syscall( CG_R_CLEARSCENE );
-}
-
-void trap_R_AddRefEntityToScene( const refEntity_t *re )
-{
- syscall( CG_R_ADDREFENTITYTOSCENE, re );
-}
-
-void trap_R_AddPolyToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts )
-{
- syscall( CG_R_ADDPOLYTOSCENE, hShader, numVerts, verts );
-}
-
-void trap_R_AddPolysToScene( qhandle_t hShader , int numVerts, const polyVert_t *verts, int num )
-{
- syscall( CG_R_ADDPOLYSTOSCENE, hShader, numVerts, verts, num );
-}
-
-int trap_R_LightForPoint( vec3_t point, vec3_t ambientLight, vec3_t directedLight, vec3_t lightDir )
-{
- return syscall( CG_R_LIGHTFORPOINT, point, ambientLight, directedLight, lightDir );
-}
-
-void trap_R_AddLightToScene( const vec3_t org, float intensity, float r, float g, float b )
-{
- syscall( CG_R_ADDLIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
-}
-
-void trap_R_AddAdditiveLightToScene( const vec3_t org, float intensity, float r, float g, float b )
-{
- syscall( CG_R_ADDADDITIVELIGHTTOSCENE, org, PASSFLOAT(intensity), PASSFLOAT(r), PASSFLOAT(g), PASSFLOAT(b) );
-}
-
-void trap_R_RenderScene( const refdef_t *fd )
-{
- syscall( CG_R_RENDERSCENE, fd );
-}
-
-void trap_R_SetColor( const float *rgba )
-{
- syscall( CG_R_SETCOLOR, rgba );
-}
-
-void trap_R_DrawStretchPic( float x, float y, float w, float h,
- float s1, float t1, float s2, float t2, qhandle_t hShader )
-{
- syscall( CG_R_DRAWSTRETCHPIC, PASSFLOAT(x), PASSFLOAT(y), PASSFLOAT(w), PASSFLOAT(h),
- PASSFLOAT(s1), PASSFLOAT(t1), PASSFLOAT(s2), PASSFLOAT(t2), hShader );
-}
-
-void trap_R_ModelBounds( clipHandle_t model, vec3_t mins, vec3_t maxs ) {
- syscall( CG_R_MODELBOUNDS, model, mins, maxs );
-}
-
-int trap_R_LerpTag( orientation_t *tag, clipHandle_t mod, int startFrame, int endFrame,
- float frac, const char *tagName )
-{
- return syscall( CG_R_LERPTAG, tag, mod, startFrame, endFrame, PASSFLOAT(frac), tagName );
-}
-
-void trap_R_RemapShader( const char *oldShader, const char *newShader, const char *timeOffset )
-{
- syscall( CG_R_REMAP_SHADER, oldShader, newShader, timeOffset );
-}
-
-void trap_GetGlconfig( glconfig_t *glconfig )
-{
- syscall( CG_GETGLCONFIG, glconfig );
-}
-
-void trap_GetGameState( gameState_t *gamestate )
-{
- syscall( CG_GETGAMESTATE, gamestate );
-}
-
-void trap_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime )
-{
- syscall( CG_GETCURRENTSNAPSHOTNUMBER, snapshotNumber, serverTime );
-}
-
-qboolean trap_GetSnapshot( int snapshotNumber, snapshot_t *snapshot )
-{
- return syscall( CG_GETSNAPSHOT, snapshotNumber, snapshot );
-}
-
-qboolean trap_GetServerCommand( int serverCommandNumber )
-{
- return syscall( CG_GETSERVERCOMMAND, serverCommandNumber );
-}
-
-int trap_GetCurrentCmdNumber( void )
-{
- return syscall( CG_GETCURRENTCMDNUMBER );
-}
-
-qboolean trap_GetUserCmd( int cmdNumber, usercmd_t *ucmd )
-{
- return syscall( CG_GETUSERCMD, cmdNumber, ucmd );
-}
-
-void trap_SetUserCmdValue( int stateValue, float sensitivityScale )
-{
- syscall( CG_SETUSERCMDVALUE, stateValue, PASSFLOAT( sensitivityScale ) );
-}
-
-void testPrintInt( char *string, int i )
-{
- syscall( CG_TESTPRINTINT, string, i );
-}
-
-void testPrintFloat( char *string, float f )
-{
- syscall( CG_TESTPRINTFLOAT, string, PASSFLOAT(f) );
-}
-
-int trap_MemoryRemaining( void )
-{
- return syscall( CG_MEMORY_REMAINING );
-}
-
-qboolean trap_Key_IsDown( int keynum )
-{
- return syscall( CG_KEY_ISDOWN, keynum );
-}
-
-int trap_Key_GetCatcher( void )
-{
- return syscall( CG_KEY_GETCATCHER );
-}
-
-void trap_Key_SetCatcher( int catcher )
-{
- syscall( CG_KEY_SETCATCHER, catcher );
-}
-
-int trap_Key_GetKey( const char *binding )
-{
- return syscall( CG_KEY_GETKEY, binding );
-}
-
-int trap_Parse_AddGlobalDefine( char *define )
-{
- return syscall( CG_PARSE_ADD_GLOBAL_DEFINE, define );
-}
-
-int trap_Parse_LoadSource( const char *filename )
-{
- return syscall( CG_PARSE_LOAD_SOURCE, filename );
-}
-
-int trap_Parse_FreeSource( int handle )
-{
- return syscall( CG_PARSE_FREE_SOURCE, handle );
-}
-
-int trap_Parse_ReadToken( int handle, pc_token_t *pc_token )
-{
- return syscall( CG_PARSE_READ_TOKEN, handle, pc_token );
-}
-
-int trap_Parse_SourceFileAndLine( int handle, char *filename, int *line )
-{
- return syscall( CG_PARSE_SOURCE_FILE_AND_LINE, handle, filename, line );
-}
-
-void trap_S_StopBackgroundTrack( void )
-{
- syscall( CG_S_STOPBACKGROUNDTRACK );
-}
-
-int trap_RealTime(qtime_t *qtime)
-{
- return syscall( CG_REAL_TIME, qtime );
-}
-
-void trap_SnapVector( float *v )
-{
- syscall( CG_SNAPVECTOR, v );
-}
-
-// this returns a handle. arg0 is the name in the format "idlogo.roq", set arg1 to NULL, alteredstates to qfalse (do not alter gamestate)
-int trap_CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits )
-{
- return syscall(CG_CIN_PLAYCINEMATIC, arg0, xpos, ypos, width, height, bits);
-}
-
-// stops playing the cinematic and ends it. should always return FMV_EOF
-// cinematics must be stopped in reverse order of when they are started
-e_status trap_CIN_StopCinematic( int handle )
-{
- return syscall(CG_CIN_STOPCINEMATIC, handle);
-}
-
-
-// will run a frame of the cinematic but will not draw it. Will return FMV_EOF if the end of the cinematic has been reached.
-e_status trap_CIN_RunCinematic( int handle )
-{
- return syscall(CG_CIN_RUNCINEMATIC, handle);
-}
-
-
-// draws the current frame
-void trap_CIN_DrawCinematic( int handle )
-{
- syscall(CG_CIN_DRAWCINEMATIC, handle);
-}
-
-
-// allows you to resize the animation dynamically
-void trap_CIN_SetExtents( int handle, int x, int y, int w, int h )
-{
- syscall(CG_CIN_SETEXTENTS, handle, x, y, w, h);
-}
-
-int trap_GetDemoState( void )
-{
- return syscall( CG_GETDEMOSTATE );
-}
-
-int trap_GetDemoPos( void )
-{
- return syscall( CG_GETDEMOPOS );
-}
-
-void trap_GetDemoName( char *buffer, int size )
-{
- syscall( CG_GETDEMONAME, buffer, size );
-}
-
-void trap_Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
- syscall( CG_KEY_KEYNUMTOSTRINGBUF, keynum, buf, buflen );
-}
-
-void trap_Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
- syscall( CG_KEY_GETBINDINGBUF, keynum, buf, buflen );
-}
-
-void trap_Key_SetBinding( int keynum, const char *binding ) {
- syscall( CG_KEY_SETBINDING, keynum, binding );
-}
-
diff --git a/src/cgame/cg_trails.c b/src/cgame/cg_trails.c
deleted file mode 100644
index c8943ed..0000000
--- a/src/cgame/cg_trails.c
+++ /dev/null
@@ -1,1500 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_trails.c -- the trail system
-
-
-#include "cg_local.h"
-
-static baseTrailSystem_t baseTrailSystems[ MAX_BASETRAIL_SYSTEMS ];
-static baseTrailBeam_t baseTrailBeams[ MAX_BASETRAIL_BEAMS ];
-static int numBaseTrailSystems = 0;
-static int numBaseTrailBeams = 0;
-
-static trailSystem_t trailSystems[ MAX_TRAIL_SYSTEMS ];
-static trailBeam_t trailBeams[ MAX_TRAIL_BEAMS ];
-
-/*
-===============
-CG_CalculateBeamNodeProperties
-
-Fills in trailBeamNode_t.textureCoord
-===============
-*/
-static void CG_CalculateBeamNodeProperties( trailBeam_t *tb )
-{
- trailBeamNode_t *i = NULL;
- trailSystem_t *ts;
- baseTrailBeam_t *btb;
- float nodeDistances[ MAX_TRAIL_BEAM_NODES ];
- float totalDistance = 0.0f, position = 0.0f;
- int j, numNodes = 0;
- float TCRange, widthRange, alphaRange;
- vec3_t colorRange;
- float fadeAlpha = 1.0f;
-
- if( !tb || !tb->nodes )
- return;
-
- ts = tb->parent;
- btb = tb->class;
-
- if( ts->destroyTime > 0 && btb->fadeOutTime )
- {
- fadeAlpha -= ( cg.time - ts->destroyTime ) / btb->fadeOutTime;
-
- if( fadeAlpha < 0.0f )
- fadeAlpha = 0.0f;
- }
-
- TCRange = tb->class->backTextureCoord -
- tb->class->frontTextureCoord;
- widthRange = tb->class->backWidth -
- tb->class->frontWidth;
- alphaRange = tb->class->backAlpha -
- tb->class->frontAlpha;
- VectorSubtract( tb->class->backColor,
- tb->class->frontColor, colorRange );
-
- for( i = tb->nodes; i && i->next; i = i->next )
- {
- nodeDistances[ numNodes++ ] =
- Distance( i->position, i->next->position );
- }
-
- for( j = 0; j < numNodes; j++ )
- totalDistance += nodeDistances[ j ];
-
- for( j = 0, i = tb->nodes; i; i = i->next, j++ )
- {
- if( tb->class->textureType == TBTT_STRETCH )
- {
- i->textureCoord = tb->class->frontTextureCoord +
- ( ( position / totalDistance ) * TCRange );
- }
- else if( tb->class->textureType == TBTT_REPEAT )
- {
- if( tb->class->clampToBack )
- i->textureCoord = ( totalDistance - position ) /
- tb->class->repeatLength;
- else
- i->textureCoord = position / tb->class->repeatLength;
- }
-
- i->halfWidth = ( tb->class->frontWidth +
- ( ( position / totalDistance ) * widthRange ) ) / 2.0f;
- i->alpha = (byte)( (float)0xFF * ( tb->class->frontAlpha +
- ( ( position / totalDistance ) * alphaRange ) ) * fadeAlpha );
- VectorMA( tb->class->frontColor, ( position / totalDistance ),
- colorRange, i->color );
-
- position += nodeDistances[ j ];
- }
-}
-
-/*
-===============
-CG_LightVertex
-
-Lights a particular vertex
-===============
-*/
-static void CG_LightVertex( vec3_t point, byte alpha, byte *rgba )
-{
- int i;
- vec3_t alight, dlight, lightdir;
-
- trap_R_LightForPoint( point, alight, dlight, lightdir );
- for( i = 0; i <= 2; i++ )
- rgba[ i ] = (int)alight[ i ];
-
- rgba[ 3 ] = alpha;
-}
-
-/*
-===============
-CG_RenderBeam
-
-Renders a beam
-===============
-*/
-static void CG_RenderBeam( trailBeam_t *tb )
-{
- trailBeamNode_t *i = NULL;
- trailBeamNode_t *prev = NULL;
- trailBeamNode_t *next = NULL;
- vec3_t up;
- polyVert_t verts[ ( MAX_TRAIL_BEAM_NODES - 1 ) * 4 ];
- int numVerts = 0;
- baseTrailBeam_t *btb;
- trailSystem_t *ts;
- baseTrailSystem_t *bts;
-
- if( !tb || !tb->nodes )
- return;
-
- btb = tb->class;
- ts = tb->parent;
- bts = ts->class;
-
- if( bts->thirdPersonOnly &&
- ( CG_AttachmentCentNum( &ts->frontAttachment ) == cg.snap->ps.clientNum ||
- CG_AttachmentCentNum( &ts->backAttachment ) == cg.snap->ps.clientNum ) &&
- !cg.renderingThirdPerson )
- return;
-
- CG_CalculateBeamNodeProperties( tb );
-
- i = tb->nodes;
-
- do
- {
- prev = i->prev;
- next = i->next;
-
- if( prev && next )
- {
- //this node has two neighbours
- GetPerpendicularViewVector( cg.refdef.vieworg, next->position, prev->position, up );
- }
- else if( !prev && next )
- {
- //this is the front
- GetPerpendicularViewVector( cg.refdef.vieworg, next->position, i->position, up );
- }
- else if( prev && !next )
- {
- //this is the back
- GetPerpendicularViewVector( cg.refdef.vieworg, i->position, prev->position, up );
- }
- else
- break;
-
- if( prev )
- {
- VectorMA( i->position, i->halfWidth, up, verts[ numVerts ].xyz );
- verts[ numVerts ].st[ 0 ] = i->textureCoord;
- verts[ numVerts ].st[ 1 ] = 1.0f;
-
- if( btb->realLight )
- CG_LightVertex( verts[ numVerts ].xyz, i->alpha, verts[ numVerts ].modulate );
- else
- {
- VectorCopy( i->color, verts[ numVerts ].modulate );
- verts[ numVerts ].modulate[ 3 ] = i->alpha;
- }
-
- numVerts++;
-
- VectorMA( i->position, -i->halfWidth, up, verts[ numVerts ].xyz );
- verts[ numVerts ].st[ 0 ] = i->textureCoord;
- verts[ numVerts ].st[ 1 ] = 0.0f;
-
- if( btb->realLight )
- CG_LightVertex( verts[ numVerts ].xyz, i->alpha, verts[ numVerts ].modulate );
- else
- {
- VectorCopy( i->color, verts[ numVerts ].modulate );
- verts[ numVerts ].modulate[ 3 ] = i->alpha;
- }
-
- numVerts++;
- }
-
- if( next )
- {
- VectorMA( i->position, -i->halfWidth, up, verts[ numVerts ].xyz );
- verts[ numVerts ].st[ 0 ] = i->textureCoord;
- verts[ numVerts ].st[ 1 ] = 0.0f;
-
- if( btb->realLight )
- CG_LightVertex( verts[ numVerts ].xyz, i->alpha, verts[ numVerts ].modulate );
- else
- {
- VectorCopy( i->color, verts[ numVerts ].modulate );
- verts[ numVerts ].modulate[ 3 ] = i->alpha;
- }
-
- numVerts++;
-
- VectorMA( i->position, i->halfWidth, up, verts[ numVerts ].xyz );
- verts[ numVerts ].st[ 0 ] = i->textureCoord;
- verts[ numVerts ].st[ 1 ] = 1.0f;
-
- if( btb->realLight )
- CG_LightVertex( verts[ numVerts ].xyz, i->alpha, verts[ numVerts ].modulate );
- else
- {
- VectorCopy( i->color, verts[ numVerts ].modulate );
- verts[ numVerts ].modulate[ 3 ] = i->alpha;
- }
-
- numVerts++;
- }
-
- i = i->next;
- } while( i );
-
- trap_R_AddPolysToScene( tb->class->shader, 4, &verts[ 0 ], numVerts / 4 );
-}
-
-/*
-===============
-CG_AllocateBeamNode
-
-Allocates a trailBeamNode_t from a trailBeam_t's nodePool
-===============
-*/
-static trailBeamNode_t *CG_AllocateBeamNode( trailBeam_t *tb )
-{
- baseTrailBeam_t *btb = tb->class;
- int i;
- trailBeamNode_t *tbn;
-
- for( i = 0; i < MAX_TRAIL_BEAM_NODES; i++ )
- {
- tbn = &tb->nodePool[ i ];
- if( !tbn->used )
- {
- tbn->timeLeft = btb->segmentTime;
- tbn->prev = NULL;
- tbn->next = NULL;
- tbn->used = qtrue;
- return tbn;
- }
- }
-
- // no space left
- return NULL;
-}
-
-/*
-===============
-CG_DestroyBeamNode
-
-Removes a node from a beam
-Returns the new head
-===============
-*/
-static trailBeamNode_t *CG_DestroyBeamNode( trailBeamNode_t *tbn )
-{
- trailBeamNode_t *newHead = NULL;
-
- if( tbn->prev )
- {
- if( tbn->next )
- {
- // node is in the middle
- tbn->prev->next = tbn->next;
- tbn->next->prev = tbn->prev;
- }
- else // node is at the back
- tbn->prev->next = NULL;
-
- // find the new head (shouldn't have changed)
- newHead = tbn->prev;
-
- while( newHead->prev )
- newHead = newHead->prev;
- }
- else if( tbn->next )
- {
- //node is at the front
- tbn->next->prev = NULL;
- newHead = tbn->next;
- }
-
- tbn->prev = NULL;
- tbn->next = NULL;
- tbn->used = qfalse;
-
- return newHead;
-}
-
-/*
-===============
-CG_FindLastBeamNode
-
-Returns the last beam node in a beam
-===============
-*/
-static trailBeamNode_t *CG_FindLastBeamNode( trailBeam_t *tb )
-{
- trailBeamNode_t *i = tb->nodes;
-
- while( i && i->next )
- i = i->next;
-
- return i;
-}
-
-/*
-===============
-CG_CountBeamNodes
-
-Returns the number of nodes in a beam
-===============
-*/
-static int CG_CountBeamNodes( trailBeam_t *tb )
-{
- trailBeamNode_t *i = tb->nodes;
- int numNodes = 0;
-
- while( i )
- {
- numNodes++;
- i = i->next;
- }
-
- return numNodes;
-}
-
-/*
-===============
-CG_PrependBeamNode
-
-Prepend a new beam node to the front of a beam
-Returns the new node
-===============
-*/
-static trailBeamNode_t *CG_PrependBeamNode( trailBeam_t *tb )
-{
- trailBeamNode_t *i;
-
- if( tb->nodes )
- {
- // prepend another node
- i = CG_AllocateBeamNode( tb );
-
- if( i )
- {
- i->next = tb->nodes;
- tb->nodes->prev = i;
- tb->nodes = i;
- }
- }
- else //add first node
- {
- i = CG_AllocateBeamNode( tb );
-
- if( i )
- tb->nodes = i;
- }
-
- return i;
-}
-
-/*
-===============
-CG_AppendBeamNode
-
-Append a new beam node to the back of a beam
-Returns the new node
-===============
-*/
-static trailBeamNode_t *CG_AppendBeamNode( trailBeam_t *tb )
-{
- trailBeamNode_t *last, *i;
-
- if( tb->nodes )
- {
- // append another node
- last = CG_FindLastBeamNode( tb );
- i = CG_AllocateBeamNode( tb );
-
- if( i )
- {
- last->next = i;
- i->prev = last;
- i->next = NULL;
- }
- }
- else //add first node
- {
- i = CG_AllocateBeamNode( tb );
-
- if( i )
- tb->nodes = i;
- }
-
- return i;
-}
-
-/*
-===============
-CG_ApplyJitters
-===============
-*/
-static void CG_ApplyJitters( trailBeam_t *tb )
-{
- trailBeamNode_t *i = NULL;
- int j;
- baseTrailBeam_t *btb;
- trailSystem_t *ts;
- trailBeamNode_t *start;
- trailBeamNode_t *end;
-
- if( !tb || !tb->nodes )
- return;
-
- btb = tb->class;
- ts = tb->parent;
-
- for( j = 0; j < btb->numJitters; j++ )
- {
- if( tb->nextJitterTimes[ j ] <= cg.time )
- {
- for( i = tb->nodes; i; i = i->next )
- {
- i->jitters[ j ][ 0 ] = ( crandom( ) * btb->jitters[ j ].magnitude );
- i->jitters[ j ][ 1 ] = ( crandom( ) * btb->jitters[ j ].magnitude );
- }
-
- tb->nextJitterTimes[ j ] = cg.time + btb->jitters[ j ].period;
- }
- }
-
- start = tb->nodes;
- end = CG_FindLastBeamNode( tb );
-
- if( !btb->jitterAttachments )
- {
- if( CG_Attached( &ts->frontAttachment ) && start->next )
- start = start->next;
-
- if( CG_Attached( &ts->backAttachment ) && end->prev )
- end = end->prev;
- }
-
- for( i = start; i; i = i->next )
- {
- vec3_t forward, right, up;
- trailBeamNode_t *prev;
- trailBeamNode_t *next;
- float upJitter = 0.0f, rightJitter = 0.0f;
-
- prev = i->prev;
- next = i->next;
-
- if( prev && next )
- {
- //this node has two neighbours
- GetPerpendicularViewVector( cg.refdef.vieworg, next->position, prev->position, up );
- VectorSubtract( next->position, prev->position, forward );
- }
- else if( !prev && next )
- {
- //this is the front
- GetPerpendicularViewVector( cg.refdef.vieworg, next->position, i->position, up );
- VectorSubtract( next->position, i->position, forward );
- }
- else if( prev && !next )
- {
- //this is the back
- GetPerpendicularViewVector( cg.refdef.vieworg, i->position, prev->position, up );
- VectorSubtract( i->position, prev->position, forward );
- }
-
- VectorNormalize( forward );
- CrossProduct( forward, up, right );
- VectorNormalize( right );
-
- for( j = 0; j < btb->numJitters; j++ )
- {
- upJitter += i->jitters[ j ][ 0 ];
- rightJitter += i->jitters[ j ][ 1 ];
- }
-
- VectorMA( i->position, upJitter, up, i->position );
- VectorMA( i->position, rightJitter, right, i->position );
-
- if( i == end )
- break;
- }
-}
-
-/*
-===============
-CG_UpdateBeam
-
-Updates a beam
-===============
-*/
-static void CG_UpdateBeam( trailBeam_t *tb )
-{
- baseTrailBeam_t *btb;
- trailSystem_t *ts;
- trailBeamNode_t *i;
- int deltaTime;
- int nodesToAdd;
- int j;
- int numNodes;
-
- if( !tb )
- return;
-
- btb = tb->class;
- ts = tb->parent;
-
- deltaTime = cg.time - tb->lastEvalTime;
- tb->lastEvalTime = cg.time;
-
- // first make sure this beam has enough nodes
- if( ts->destroyTime <= 0 )
- {
- nodesToAdd = btb->numSegments - CG_CountBeamNodes( tb ) + 1;
-
- while( nodesToAdd-- )
- {
- i = CG_AppendBeamNode( tb );
-
- if( !tb->nodes->next && CG_Attached( &ts->frontAttachment ) )
- {
- // this is the first node to be added
- if( !CG_AttachmentPoint( &ts->frontAttachment, i->refPosition ) )
- CG_DestroyTrailSystem( &ts );
- }
- else
- VectorCopy( i->prev->refPosition, i->refPosition );
- }
- }
-
- numNodes = CG_CountBeamNodes( tb );
-
- for( i = tb->nodes; i; i = i->next )
- VectorCopy( i->refPosition, i->position );
-
- if( CG_Attached( &ts->frontAttachment ) && CG_Attached( &ts->backAttachment ) )
- {
- // beam between two attachments
- vec3_t dir, front, back;
-
- if( ts->destroyTime > 0 && ( cg.time - ts->destroyTime ) >= btb->fadeOutTime )
- {
- tb->valid = qfalse;
- return;
- }
-
- if( !CG_AttachmentPoint( &ts->frontAttachment, front ) )
- CG_DestroyTrailSystem( &ts );
-
- if( !CG_AttachmentPoint( &ts->backAttachment, back ) )
- CG_DestroyTrailSystem( &ts );
-
- VectorSubtract( back, front, dir );
-
- for( j = 0, i = tb->nodes; i; i = i->next, j++ )
- {
- float scale = (float)j / (float)( numNodes - 1 );
-
- VectorMA( front, scale, dir, i->position );
- }
- }
- else if( CG_Attached( &ts->frontAttachment ) )
- {
- // beam from one attachment
-
- // cull the trail tail
- i = CG_FindLastBeamNode( tb );
-
- if( i && i->timeLeft >= 0 )
- {
- i->timeLeft -= deltaTime;
-
- if( i->timeLeft < 0 )
- {
- tb->nodes = CG_DestroyBeamNode( i );
-
- if( !tb->nodes )
- {
- tb->valid = qfalse;
- return;
- }
-
- // if the ts has been destroyed, stop creating new nodes
- if( ts->destroyTime <= 0 )
- CG_PrependBeamNode( tb );
- }
- else if( i->timeLeft >= 0 && i->prev )
- {
- vec3_t dir;
- float length;
-
- VectorSubtract( i->refPosition, i->prev->refPosition, dir );
- length = VectorNormalize( dir ) *
- ( (float)i->timeLeft / (float)tb->class->segmentTime );
-
- VectorMA( i->prev->refPosition, length, dir, i->position );
- }
- }
-
- if( tb->nodes )
- {
- if( !CG_AttachmentPoint( &ts->frontAttachment, tb->nodes->refPosition ) )
- CG_DestroyTrailSystem( &ts );
-
- VectorCopy( tb->nodes->refPosition, tb->nodes->position );
- }
- }
-
- CG_ApplyJitters( tb );
-}
-
-/*
-===============
-CG_ParseTrailBeamColor
-===============
-*/
-static qboolean CG_ParseTrailBeamColor( byte *c, char **text_p )
-{
- char *token;
- int i;
-
- for( i = 0; i <= 2; i++ )
- {
- token = COM_Parse( text_p );
-
- if( !Q_stricmp( token, "" ) )
- return qfalse;
-
- c[ i ] = (int)( (float)0xFF * atof_neg( token, qfalse ) );
- }
-
- return qtrue;
-}
-
-/*
-===============
-CG_ParseTrailBeam
-
-Parse a trail beam
-===============
-*/
-static qboolean CG_ParseTrailBeam( baseTrailBeam_t *btb, char **text_p )
-{
- char *token;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( text_p );
-
- if( !Q_stricmp( token, "" ) )
- return qfalse;
-
- if( !Q_stricmp( token, "segments" ) )
- {
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->numSegments = atoi_neg( token, qfalse );
-
- if( btb->numSegments >= MAX_TRAIL_BEAM_NODES )
- {
- btb->numSegments = MAX_TRAIL_BEAM_NODES - 1;
- CG_Printf( S_COLOR_YELLOW "WARNING: too many segments in trail beam\n" );
- }
- continue;
- }
- else if( !Q_stricmp( token, "width" ) )
- {
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->frontWidth = atof_neg( token, qfalse );
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- btb->backWidth = btb->frontWidth;
- else
- btb->backWidth = atof_neg( token, qfalse );
- continue;
- }
- else if( !Q_stricmp( token, "alpha" ) )
- {
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->frontAlpha = atof_neg( token, qfalse );
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- btb->backAlpha = btb->frontAlpha;
- else
- btb->backAlpha = atof_neg( token, qfalse );
- continue;
- }
- else if( !Q_stricmp( token, "color" ) )
- {
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "{" ) )
- {
- if( !CG_ParseTrailBeamColor( btb->frontColor, text_p ) )
- break;
-
- token = COM_Parse( text_p );
- if( Q_stricmp( token, "}" ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '}'\n" );
- break;
- }
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "-" ) )
- {
- btb->backColor[ 0 ] = btb->frontColor[ 0 ];
- btb->backColor[ 1 ] = btb->frontColor[ 1 ];
- btb->backColor[ 2 ] = btb->frontColor[ 2 ];
- }
- else if( !Q_stricmp( token, "{" ) )
- {
- if( !CG_ParseTrailBeamColor( btb->backColor, text_p ) )
- break;
-
- token = COM_Parse( text_p );
- if( Q_stricmp( token, "}" ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '}'\n" );
- break;
- }
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '{'\n" );
- break;
- }
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: missing '{'\n" );
- break;
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "segmentTime" ) )
- {
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->segmentTime = atoi_neg( token, qfalse );
- continue;
- }
- else if( !Q_stricmp( token, "fadeOutTime" ) )
- {
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->fadeOutTime = atoi_neg( token, qfalse );
- continue;
- }
- else if( !Q_stricmp( token, "shader" ) )
- {
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- Q_strncpyz( btb->shaderName, token, MAX_QPATH );
-
- continue;
- }
- else if( !Q_stricmp( token, "textureType" ) )
- {
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "stretch" ) )
- {
- btb->textureType = TBTT_STRETCH;
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->frontTextureCoord = atof_neg( token, qfalse );
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->backTextureCoord = atof_neg( token, qfalse );
- }
- else if( !Q_stricmp( token, "repeat" ) )
- {
- btb->textureType = TBTT_REPEAT;
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "front" ) )
- btb->clampToBack = qfalse;
- else if( !Q_stricmp( token, "back" ) )
- btb->clampToBack = qtrue;
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unknown textureType clamp \"%s\"\n", token );
- break;
- }
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->repeatLength = atof_neg( token, qfalse );
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unknown textureType \"%s\"\n", token );
- break;
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "realLight" ) )
- {
- btb->realLight = qtrue;
-
- continue;
- }
- else if( !Q_stricmp( token, "jitter" ) )
- {
- if( btb->numJitters == MAX_TRAIL_BEAM_JITTERS )
- {
- CG_Printf( S_COLOR_RED "ERROR: too many jitters\n", token );
- break;
- }
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->jitters[ btb->numJitters ].magnitude = atof_neg( token, qfalse );
-
- token = COM_Parse( text_p );
- if( !Q_stricmp( token, "" ) )
- break;
-
- btb->jitters[ btb->numJitters ].period = atoi_neg( token, qfalse );
-
- btb->numJitters++;
-
- continue;
- }
- else if( !Q_stricmp( token, "jitterAttachments" ) )
- {
- btb->jitterAttachments = qtrue;
-
- continue;
- }
- else if( !Q_stricmp( token, "}" ) )
- return qtrue; //reached the end of this trail beam
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unknown token '%s' in trail beam\n", token );
- return qfalse;
- }
- }
-
- return qfalse;
-}
-
-/*
-===============
-CG_InitialiseBaseTrailBeam
-===============
-*/
-static void CG_InitialiseBaseTrailBeam( baseTrailBeam_t *btb )
-{
- memset( btb, 0, sizeof( baseTrailBeam_t ) );
-
- btb->numSegments = 1;
- btb->frontWidth = btb->backWidth = 1.0f;
- btb->frontAlpha = btb->backAlpha = 1.0f;
- memset( btb->frontColor, 0xFF, sizeof( btb->frontColor ) );
- memset( btb->backColor, 0xFF, sizeof( btb->backColor ) );
-
- btb->segmentTime = 100;
-
- btb->textureType = TBTT_STRETCH;
- btb->frontTextureCoord = 0.0f;
- btb->backTextureCoord = 1.0f;
-}
-
-/*
-===============
-CG_ParseTrailSystem
-
-Parse a trail system section
-===============
-*/
-static qboolean CG_ParseTrailSystem( baseTrailSystem_t *bts, char **text_p, const char *name )
-{
- char *token;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( text_p );
-
- if( !Q_stricmp( token, "" ) )
- return qfalse;
-
- if( !Q_stricmp( token, "{" ) )
- {
- CG_InitialiseBaseTrailBeam( &baseTrailBeams[ numBaseTrailBeams ] );
-
- if( !CG_ParseTrailBeam( &baseTrailBeams[ numBaseTrailBeams ], text_p ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: failed to parse trail beam\n" );
- return qfalse;
- }
-
- if( bts->numBeams == MAX_BEAMS_PER_SYSTEM )
- {
- CG_Printf( S_COLOR_RED "ERROR: trail system has > %d beams\n", MAX_BEAMS_PER_SYSTEM );
- return qfalse;
- }
- else if( numBaseTrailBeams == MAX_BASETRAIL_BEAMS )
- {
- CG_Printf( S_COLOR_RED "ERROR: maximum number of trail beams (%d) reached\n",
- MAX_BASETRAIL_BEAMS );
- return qfalse;
- }
- else
- {
- //start parsing beams again
- bts->beams[ bts->numBeams ] = &baseTrailBeams[ numBaseTrailBeams ];
- bts->numBeams++;
- numBaseTrailBeams++;
- }
- continue;
- }
- else if( !Q_stricmp( token, "thirdPersonOnly" ) )
- bts->thirdPersonOnly = qtrue;
- else if( !Q_stricmp( token, "beam" ) ) //acceptable text
- continue;
- else if( !Q_stricmp( token, "}" ) )
- {
- if( cg_debugTrails.integer >= 1 )
- CG_Printf( "Parsed trail system %s\n", name );
-
- return qtrue; //reached the end of this trail system
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unknown token '%s' in trail system %s\n", token, bts->name );
- return qfalse;
- }
- }
-
- return qfalse;
-}
-
-/*
-===============
-CG_ParseTrailFile
-
-Load the trail systems from a trail file
-===============
-*/
-static qboolean CG_ParseTrailFile( const char *fileName )
-{
- char *text_p;
- int i;
- int len;
- char *token;
- char text[ 32000 ];
- char tsName[ MAX_QPATH ];
- qboolean tsNameSet = qfalse;
- fileHandle_t f;
-
- // load the file
- len = trap_FS_FOpenFile( fileName, &f, FS_READ );
- if( len <= 0 )
- return qfalse;
-
- if( len >= sizeof( text ) - 1 )
- {
- CG_Printf( S_COLOR_RED "ERROR: trail file %s too long\n", fileName );
- return qfalse;
- }
-
- trap_FS_Read( text, len, f );
- text[ len ] = 0;
- trap_FS_FCloseFile( f );
-
- // parse the text
- text_p = text;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( &text_p );
-
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "{" ) )
- {
- if( tsNameSet )
- {
- //check for name space clashes
- for( i = 0; i < numBaseTrailSystems; i++ )
- {
- if( !Q_stricmp( baseTrailSystems[ i ].name, tsName ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: a trail system is already named %s\n", tsName );
- return qfalse;
- }
- }
-
- Q_strncpyz( baseTrailSystems[ numBaseTrailSystems ].name, tsName, MAX_QPATH );
-
- if( !CG_ParseTrailSystem( &baseTrailSystems[ numBaseTrailSystems ], &text_p, tsName ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: %s: failed to parse trail system %s\n", fileName, tsName );
- return qfalse;
- }
-
- //start parsing trail systems again
- tsNameSet = qfalse;
-
- if( numBaseTrailSystems == MAX_BASETRAIL_SYSTEMS )
- {
- CG_Printf( S_COLOR_RED "ERROR: maximum number of trail systems (%d) reached\n",
- MAX_BASETRAIL_SYSTEMS );
- return qfalse;
- }
- else
- numBaseTrailSystems++;
-
- continue;
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unamed trail system\n" );
- return qfalse;
- }
- }
-
- if( !tsNameSet )
- {
- Q_strncpyz( tsName, token, sizeof( tsName ) );
- tsNameSet = qtrue;
- }
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: trail system already named\n" );
- return qfalse;
- }
- }
-
- return qtrue;
-}
-
-/*
-===============
-CG_LoadTrailSystems
-
-Load trail system templates
-===============
-*/
-void CG_LoadTrailSystems( void )
-{
- int i, numFiles, fileLen;
- char fileList[ MAX_TRAIL_FILES * MAX_QPATH ];
- char fileName[ MAX_QPATH ];
- char *filePtr;
-
- //clear out the old
- numBaseTrailSystems = 0;
- numBaseTrailBeams = 0;
-
- for( i = 0; i < MAX_BASETRAIL_SYSTEMS; i++ )
- {
- baseTrailSystem_t *bts = &baseTrailSystems[ i ];
- memset( bts, 0, sizeof( baseTrailSystem_t ) );
- }
-
- for( i = 0; i < MAX_BASETRAIL_BEAMS; i++ )
- {
- baseTrailBeam_t *btb = &baseTrailBeams[ i ];
- memset( btb, 0, sizeof( baseTrailBeam_t ) );
- }
-
- //and bring in the new
- numFiles = trap_FS_GetFileList( "scripts", ".trail",
- fileList, MAX_TRAIL_FILES * MAX_QPATH );
- filePtr = fileList;
-
- for( i = 0; i < numFiles; i++, filePtr += fileLen + 1 )
- {
- fileLen = strlen( filePtr );
- strcpy( fileName, "scripts/" );
- strcat( fileName, filePtr );
- CG_Printf( "...loading '%s'\n", fileName );
- CG_ParseTrailFile( fileName );
- }
-}
-
-/*
-===============
-CG_RegisterTrailSystem
-
-Load the media that a trail system needs
-===============
-*/
-qhandle_t CG_RegisterTrailSystem( char *name )
-{
- int i, j;
- baseTrailSystem_t *bts;
- baseTrailBeam_t *btb;
-
- for( i = 0; i < MAX_BASETRAIL_SYSTEMS; i++ )
- {
- bts = &baseTrailSystems[ i ];
-
- if( !Q_stricmp( bts->name, name ) )
- {
- //already registered
- if( bts->registered )
- return i + 1;
-
- for( j = 0; j < bts->numBeams; j++ )
- {
- btb = bts->beams[ j ];
-
- btb->shader = trap_R_RegisterShader( btb->shaderName );
- }
-
- if( cg_debugTrails.integer >= 1 )
- CG_Printf( "Registered trail system %s\n", name );
-
- bts->registered = qtrue;
-
- //avoid returning 0
- return i + 1;
- }
- }
-
- CG_Printf( S_COLOR_RED "ERROR: failed to register trail system %s\n", name );
- return 0;
-}
-
-
-/*
-===============
-CG_SpawnNewTrailBeam
-
-Allocate a new trail beam
-===============
-*/
-static trailBeam_t *CG_SpawnNewTrailBeam( baseTrailBeam_t *btb,
- trailSystem_t *parent )
-{
- int i;
- trailBeam_t *tb = NULL;
- trailSystem_t *ts = parent;
-
- for( i = 0; i < MAX_TRAIL_BEAMS; i++ )
- {
- tb = &trailBeams[ i ];
-
- if( !tb->valid )
- {
- memset( tb, 0, sizeof( trailBeam_t ) );
-
- //found a free slot
- tb->class = btb;
- tb->parent = ts;
-
- tb->valid = qtrue;
-
- if( cg_debugTrails.integer >= 1 )
- CG_Printf( "TB %s created\n", ts->class->name );
-
- break;
- }
- }
-
- return tb;
-}
-
-
-/*
-===============
-CG_SpawnNewTrailSystem
-
-Spawns a new trail system
-===============
-*/
-trailSystem_t *CG_SpawnNewTrailSystem( qhandle_t psHandle )
-{
- int i, j;
- trailSystem_t *ts = NULL;
- baseTrailSystem_t *bts = &baseTrailSystems[ psHandle - 1 ];
-
- if( !bts->registered )
- {
- CG_Printf( S_COLOR_RED "ERROR: a trail system has not been registered yet\n" );
- return NULL;
- }
-
- for( i = 0; i < MAX_TRAIL_SYSTEMS; i++ )
- {
- ts = &trailSystems[ i ];
-
- if( !ts->valid )
- {
- memset( ts, 0, sizeof( trailSystem_t ) );
-
- //found a free slot
- ts->class = bts;
-
- ts->valid = qtrue;
- ts->destroyTime = -1;
-
- for( j = 0; j < bts->numBeams; j++ )
- CG_SpawnNewTrailBeam( bts->beams[ j ], ts );
-
- if( cg_debugTrails.integer >= 1 )
- CG_Printf( "TS %s created\n", bts->name );
-
- break;
- }
- }
-
- return ts;
-}
-
-/*
-===============
-CG_DestroyTrailSystem
-
-Destroy a trail system
-===============
-*/
-void CG_DestroyTrailSystem( trailSystem_t **ts )
-{
- (*ts)->destroyTime = cg.time;
-
- if( CG_Attached( &(*ts)->frontAttachment ) &&
- !CG_Attached( &(*ts)->backAttachment ) )
- {
- vec3_t v;
-
- // attach the trail head to a static point
- CG_AttachmentPoint( &(*ts)->frontAttachment, v );
- CG_SetAttachmentPoint( &(*ts)->frontAttachment, v );
- CG_AttachToPoint( &(*ts)->frontAttachment );
-
- (*ts)->frontAttachment.centValid = qfalse; // a bit naughty
- }
-
- ts = NULL;
-}
-
-/*
-===============
-CG_IsTrailSystemValid
-
-Test a trail system for validity
-===============
-*/
-qboolean CG_IsTrailSystemValid( trailSystem_t **ts )
-{
- if( *ts == NULL || ( *ts && !(*ts)->valid ) )
- {
- if( *ts && !(*ts)->valid )
- *ts = NULL;
-
- return qfalse;
- }
-
- return qtrue;
-}
-
-/*
-===============
-CG_GarbageCollectTrailSystems
-
-Destroy inactive trail systems
-===============
-*/
-static void CG_GarbageCollectTrailSystems( void )
-{
- int i, j, count;
- trailSystem_t *ts;
- trailBeam_t *tb;
- int centNum;
-
- for( i = 0; i < MAX_TRAIL_SYSTEMS; i++ )
- {
- ts = &trailSystems[ i ];
- count = 0;
-
- //don't bother checking already invalid systems
- if( !ts->valid )
- continue;
-
- for( j = 0; j < MAX_TRAIL_BEAMS; j++ )
- {
- tb = &trailBeams[ j ];
-
- if( tb->valid && tb->parent == ts )
- count++;
- }
-
- if( !count )
- ts->valid = qfalse;
-
- //check systems where the parent cent has left the PVS
- //( local player entity is always valid )
- if( ( centNum = CG_AttachmentCentNum( &ts->frontAttachment ) ) >= 0 &&
- centNum != cg.snap->ps.clientNum )
- {
- trailSystem_t *tempTS = ts;
-
- if( !cg_entities[ centNum ].valid )
- CG_DestroyTrailSystem( &tempTS );
- }
-
- if( ( centNum = CG_AttachmentCentNum( &ts->backAttachment ) ) >= 0 &&
- centNum != cg.snap->ps.clientNum )
- {
- trailSystem_t *tempTS = ts;
-
- if( !cg_entities[ centNum ].valid )
- CG_DestroyTrailSystem( &tempTS );
- }
-
- if( cg_debugTrails.integer >= 1 && !ts->valid )
- CG_Printf( "TS %s garbage collected\n", ts->class->name );
- }
-}
-
-/*
-===============
-CG_AddTrails
-
-Add trails to the scene
-===============
-*/
-void CG_AddTrails( void )
-{
- int i;
- trailBeam_t *tb;
- int numTS = 0, numTB = 0;
-
- //remove expired trail systems
- CG_GarbageCollectTrailSystems( );
-
- for( i = 0; i < MAX_TRAIL_BEAMS; i++ )
- {
- tb = &trailBeams[ i ];
-
- if( tb->valid )
- {
- CG_UpdateBeam( tb );
- CG_RenderBeam( tb );
- }
- }
-
- if( cg_debugTrails.integer >= 2 )
- {
- for( i = 0; i < MAX_TRAIL_SYSTEMS; i++ )
- if( trailSystems[ i ].valid )
- numTS++;
-
- for( i = 0; i < MAX_TRAIL_BEAMS; i++ )
- if( trailBeams[ i ].valid )
- numTB++;
-
- CG_Printf( "TS: %d TB: %d\n", numTS, numTB );
- }
-}
-
-static trailSystem_t *testTS;
-static qhandle_t testTSHandle;
-
-/*
-===============
-CG_DestroyTestTS_f
-
-Destroy the test a trail system
-===============
-*/
-void CG_DestroyTestTS_f( void )
-{
- if( CG_IsTrailSystemValid( &testTS ) )
- CG_DestroyTrailSystem( &testTS );
-}
-
-/*
-===============
-CG_TestTS_f
-
-Test a trail system
-===============
-*/
-void CG_TestTS_f( void )
-{
- char tsName[ MAX_QPATH ];
-
- if( trap_Argc( ) < 2 )
- return;
-
- Q_strncpyz( tsName, CG_Argv( 1 ), MAX_QPATH );
- testTSHandle = CG_RegisterTrailSystem( tsName );
-
- if( testTSHandle )
- {
- CG_DestroyTestTS_f( );
-
- testTS = CG_SpawnNewTrailSystem( testTSHandle );
-
- if( CG_IsTrailSystemValid( &testTS ) )
- {
- CG_SetAttachmentCent( &testTS->frontAttachment, &cg_entities[ 0 ] );
- CG_AttachToCent( &testTS->frontAttachment );
- }
- }
-}
diff --git a/src/cgame/cg_tutorial.c b/src/cgame/cg_tutorial.c
deleted file mode 100644
index ddc4cbc..0000000
--- a/src/cgame/cg_tutorial.c
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_tutorial.c -- the tutorial system
-
-#include "cg_local.h"
-
-typedef struct
-{
- char *command;
- char *humanName;
- keyNum_t keys[ 2 ];
-} bind_t;
-
-static bind_t bindings[ ] =
-{
- { "+button2", "Activate Upgrade", { -1, -1 } },
- { "+speed", "Run/Walk", { -1, -1 } },
- { "boost", "Sprint", { -1, -1 } },
- { "+moveup", "Jump", { -1, -1 } },
- { "+movedown", "Crouch", { -1, -1 } },
- { "+attack", "Primary Attack", { -1, -1 } },
- { "+button5", "Secondary Attack", { -1, -1 } },
- { "reload", "Reload", { -1, -1 } },
- { "buy ammo", "Buy Ammo", { -1, -1 } },
- { "itemact medkit", "Use Medkit", { -1, -1 } },
- { "+button7", "Use Structure/Evolve", { -1, -1 } },
- { "deconstruct", "Deconstruct Structure", { -1, -1 } },
- { "weapprev", "Previous Upgrade", { -1, -1 } },
- { "weapnext", "Next Upgrade", { -1, -1 } }
-};
-
-static const int numBindings = sizeof( bindings ) / sizeof( bind_t );
-
-/*
-=================
-CG_GetBindings
-=================
-*/
-static void CG_GetBindings( void )
-{
- int i, j, numKeys;
- char buffer[ MAX_STRING_CHARS ];
-
- for( i = 0; i < numBindings; i++ )
- {
- bindings[ i ].keys[ 0 ] = bindings[ i ].keys[ 1 ] = K_NONE;
- numKeys = 0;
-
- for( j = 0; j < K_LAST_KEY; j++ )
- {
- trap_Key_GetBindingBuf( j, buffer, MAX_STRING_CHARS );
-
- if( buffer[ 0 ] == 0 )
- continue;
-
- if( !Q_stricmp( buffer, bindings[ i ].command ) )
- {
- bindings[ i ].keys[ numKeys++ ] = j;
-
- if( numKeys > 1 )
- break;
- }
- }
- }
-}
-
-/*
-===============
-CG_KeyNameForCommand
-===============
-*/
-static const char *CG_KeyNameForCommand( const char *command )
-{
- int i, j;
- static char buffer[ MAX_STRING_CHARS ];
- int firstKeyLength;
-
- buffer[ 0 ] = '\0';
-
- for( i = 0; i < numBindings; i++ )
- {
- if( !Q_stricmp( command, bindings[ i ].command ) )
- {
- if( bindings[ i ].keys[ 0 ] != K_NONE )
- {
- trap_Key_KeynumToStringBuf( bindings[ i ].keys[ 0 ],
- buffer, MAX_STRING_CHARS );
- firstKeyLength = strlen( buffer );
-
- for( j = 0; j < firstKeyLength; j++ )
- buffer[ j ] = toupper( buffer[ j ] );
-
- if( bindings[ i ].keys[ 1 ] != K_NONE )
- {
- Q_strcat( buffer, MAX_STRING_CHARS, " or " );
- trap_Key_KeynumToStringBuf( bindings[ i ].keys[ 1 ],
- buffer + strlen( buffer ), MAX_STRING_CHARS - strlen( buffer ) );
-
- for( j = firstKeyLength + 4; j < strlen( buffer ); j++ )
- buffer[ j ] = toupper( buffer[ j ] );
- }
- }
- else
- {
- Q_strncpyz( buffer, va( "\"%s\"", bindings[ i ].humanName ),
- MAX_STRING_CHARS );
- Q_strcat( buffer, MAX_STRING_CHARS, " (unbound)" );
- }
-
- return buffer;
- }
- }
-
- return "";
-}
-
-#define MAX_TUTORIAL_TEXT 4096
-
-/*
-===============
-CG_BuildableInRange
-===============
-*/
-static entityState_t *CG_BuildableInRange( playerState_t *ps, float *healthFraction )
-{
- vec3_t view, point;
- trace_t trace;
- entityState_t *es;
- int health;
-
- AngleVectors( cg.refdefViewAngles, view, NULL, NULL );
- VectorMA( cg.refdef.vieworg, 64, view, point );
- CG_Trace( &trace, cg.refdef.vieworg, NULL, NULL,
- point, ps->clientNum, MASK_SHOT );
-
- es = &cg_entities[ trace.entityNum ].currentState;
-
- if( healthFraction )
- {
- health = es->generic1 & B_HEALTH_MASK;
- *healthFraction = (float)health / B_HEALTH_MASK;
- }
-
- if( es->eType == ET_BUILDABLE &&
- ps->stats[ STAT_PTEAM ] == BG_FindTeamForBuildable( es->modelindex ) )
- return es;
- else
- return NULL;
-}
-
-/*
-===============
-CG_AlienBuilderText
-===============
-*/
-static void CG_AlienBuilderText( char *text, playerState_t *ps )
-{
- buildable_t buildable = ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT;
- entityState_t *es;
-
- if( buildable > BA_NONE )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to place the %s\n",
- CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForBuildable( buildable ) ) );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to cancel placing the %s\n",
- CG_KeyNameForCommand( "+button5" ),
- BG_FindHumanNameForBuildable( buildable ) ) );
- }
- else
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to build a structure\n",
- CG_KeyNameForCommand( "+attack" ) ) );
-
- if( ( es = CG_BuildableInRange( ps, NULL ) ) )
- {
- if( cgs.markDeconstruct )
- {
- if( es->generic1 & B_MARKED_TOGGLEBIT )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to unmark this structure\n",
- CG_KeyNameForCommand( "deconstruct" ) ) );
- }
- else
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to mark this structure\n",
- CG_KeyNameForCommand( "deconstruct" ) ) );
- }
- }
- else
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to destroy this structure\n",
- CG_KeyNameForCommand( "deconstruct" ) ) );
- }
- }
- }
-
- if( ps->stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0_UPG )
- {
- if( ( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) == BA_NONE )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to swipe\n",
- CG_KeyNameForCommand( "+button5" ) ) );
- }
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to launch a projectile\n",
- CG_KeyNameForCommand( "+button2" ) ) );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to walk on walls\n",
- CG_KeyNameForCommand( "+movedown" ) ) );
- }
-}
-
-/*
-===============
-CG_AlienLevel0Text
-===============
-*/
-static void CG_AlienLevel0Text( char *text, playerState_t *ps )
-{
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- "Touch a human to damage it\n" );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to walk on walls\n",
- CG_KeyNameForCommand( "+movedown" ) ) );
-}
-
-/*
-===============
-CG_AlienLevel1Text
-===============
-*/
-static void CG_AlienLevel1Text( char *text, playerState_t *ps )
-{
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- "Touch a human to grab it\n" );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to swipe\n",
- CG_KeyNameForCommand( "+attack" ) ) );
-
- if( ps->stats[ STAT_PCLASS ] == PCL_ALIEN_LEVEL1_UPG )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to spray poisonous gas\n",
- CG_KeyNameForCommand( "+button5" ) ) );
- }
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to walk on walls\n",
- CG_KeyNameForCommand( "+movedown" ) ) );
-}
-
-/*
-===============
-CG_AlienLevel2Text
-===============
-*/
-static void CG_AlienLevel2Text( char *text, playerState_t *ps )
-{
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to bite\n",
- CG_KeyNameForCommand( "+attack" ) ) );
-
- if( ps->stats[ STAT_PCLASS ] == PCL_ALIEN_LEVEL2_UPG )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to invoke an electrical attack\n",
- CG_KeyNameForCommand( "+button5" ) ) );
- }
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Hold down %s then touch a wall to wall jump\n",
- CG_KeyNameForCommand( "+moveup" ) ) );
-}
-
-/*
-===============
-CG_AlienLevel3Text
-===============
-*/
-static void CG_AlienLevel3Text( char *text, playerState_t *ps )
-{
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to bite\n",
- CG_KeyNameForCommand( "+attack" ) ) );
-
- if( ps->stats[ STAT_PCLASS ] == PCL_ALIEN_LEVEL3_UPG )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to launch a projectile\n",
- CG_KeyNameForCommand( "+button2" ) ) );
- }
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Hold down and release %s to pounce\n",
- CG_KeyNameForCommand( "+button5" ) ) );
-}
-
-/*
-===============
-CG_AlienLevel4Text
-===============
-*/
-static void CG_AlienLevel4Text( char *text, playerState_t *ps )
-{
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to swipe\n",
- CG_KeyNameForCommand( "+attack" ) ) );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Hold down and release %s to charge\n",
- CG_KeyNameForCommand( "+button5" ) ) );
-}
-
-/*
-===============
-CG_HumanCkitText
-===============
-*/
-static void CG_HumanCkitText( char *text, playerState_t *ps )
-{
- buildable_t buildable = ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT;
- float health;
-
- if( buildable > BA_NONE )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to place the %s\n",
- CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForBuildable( buildable ) ) );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to cancel placing the %s\n",
- CG_KeyNameForCommand( "+button5" ),
- BG_FindHumanNameForBuildable( buildable ) ) );
- }
- else
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to build a structure\n",
- CG_KeyNameForCommand( "+attack" ) ) );
-
- if( CG_BuildableInRange( ps, &health ) )
- {
- if( health < 1.0f )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Hold %s to repair this structure\n",
- CG_KeyNameForCommand( "+button5" ) ) );
- }
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to destroy this structure\n",
- CG_KeyNameForCommand( "deconstruct" ) ) );
- }
- }
-}
-
-/*
-===============
-CG_HumanText
-===============
-*/
-static void CG_HumanText( char *text, playerState_t *ps )
-{
- char *name;
- int ammo, clips;
- upgrade_t upgrade = UP_NONE;
-
- if( cg.weaponSelect <= 32 )
- name = cg_weapons[ cg.weaponSelect ].humanName;
- else if( cg.weaponSelect > 32 )
- {
- name = cg_upgrades[ cg.weaponSelect - 32 ].humanName;
- upgrade = cg.weaponSelect - 32;
- }
-
- BG_UnpackAmmoArray( ps->weapon, ps->ammo, ps->powerups, &ammo, &clips );
-
- if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( ps->weapon ) )
- {
- //no ammo
- switch( ps->weapon )
- {
- case WP_MACHINEGUN:
- case WP_CHAINGUN:
- case WP_SHOTGUN:
- case WP_FLAMER:
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Find an Armoury and press %s for more ammo\n",
- CG_KeyNameForCommand( "buy ammo" ) ) );
- break;
-
- case WP_LAS_GUN:
- case WP_PULSE_RIFLE:
- case WP_MASS_DRIVER:
- case WP_LUCIFER_CANNON:
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Find a Reactor or Repeater and press %s for more ammo\n",
- CG_KeyNameForCommand( "buy ammo" ) ) );
- break;
-
- default:
- break;
- }
- }
- else
- {
- switch( ps->weapon )
- {
- case WP_BLASTER:
- case WP_MACHINEGUN:
- case WP_SHOTGUN:
- case WP_LAS_GUN:
- case WP_CHAINGUN:
- case WP_PULSE_RIFLE:
- case WP_FLAMER:
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to fire the %s\n",
- CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForWeapon( ps->weapon ) ) );
- break;
-
- case WP_MASS_DRIVER:
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to fire the %s\n",
- CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForWeapon( ps->weapon ) ) );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Hold %s to zoom\n",
- CG_KeyNameForCommand( "+button5" ) ) );
- break;
-
- case WP_PAIN_SAW:
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Hold %s to activate the %s\n",
- CG_KeyNameForCommand( "+attack" ),
- BG_FindHumanNameForWeapon( ps->weapon ) ) );
- break;
-
- case WP_LUCIFER_CANNON:
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Hold and release %s to fire a charged shot\n",
- CG_KeyNameForCommand( "+attack" ) ) );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to fire the %s\n",
- CG_KeyNameForCommand( "+button5" ),
- BG_FindHumanNameForWeapon( ps->weapon ) ) );
- break;
-
- case WP_HBUILD:
- case WP_HBUILD2:
- CG_HumanCkitText( text, ps );
- break;
-
- default:
- break;
- }
- }
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s and ",
- CG_KeyNameForCommand( "weapprev" ) ) );
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "%s to select an upgrade\n",
- CG_KeyNameForCommand( "weapnext" ) ) );
-
- if( upgrade == UP_NONE ||
- ( upgrade > UP_NONE && BG_FindUsableForUpgrade( upgrade ) ) )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to use the %s\n",
- CG_KeyNameForCommand( "+button2" ),
- name ) );
- }
-
- if( ps->stats[ STAT_HEALTH ] <= 35 &&
- BG_InventoryContainsUpgrade( UP_MEDKIT, ps->stats ) )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to use your %s\n",
- CG_KeyNameForCommand( "itemact medkit" ),
- BG_FindHumanNameForUpgrade( UP_MEDKIT ) ) );
- }
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to use a structure\n",
- CG_KeyNameForCommand( "+button7" ) ) );
-
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to sprint\n",
- CG_KeyNameForCommand( "boost" ) ) );
-}
-
-/*
-===============
-CG_SpectatorText
-===============
-*/
-static void CG_SpectatorText( char *text, playerState_t *ps )
-{
- if( ps->pm_flags & PMF_FOLLOW )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to return to free spectator mode\n",
- CG_KeyNameForCommand( "+button2" ) ) );
-
- if( CG_PlayerCount( ) > 1 )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s or ",
- CG_KeyNameForCommand( "weapprev" ) ) );
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "%s to change player\n",
- CG_KeyNameForCommand( "weapnext" ) ) );
- }
- }
- else if( ps->pm_type == PM_SPECTATOR )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to join a team\n",
- CG_KeyNameForCommand( "+attack" ) ) );
-
- if( CG_PlayerCount( ) > 0 )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to enter spectator follow mode\n",
- CG_KeyNameForCommand( "+button2" ) ) );
- }
- }
- else
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to spawn\n",
- CG_KeyNameForCommand( "+attack" ) ) );
- }
-}
-
-/*
-===============
-CG_TutorialText
-
-Returns context help for the current class/weapon
-===============
-*/
-const char *CG_TutorialText( void )
-{
- playerState_t *ps;
- static char text[ MAX_TUTORIAL_TEXT ];
-
- CG_GetBindings( );
-
- text[ 0 ] = '\0';
- ps = &cg.snap->ps;
-
- if( !cg.intermissionStarted && !cg.demoPlayback )
- {
- if( ps->persistant[ PERS_TEAM ] == TEAM_SPECTATOR ||
- ps->pm_flags & PMF_FOLLOW )
- {
- CG_SpectatorText( text, ps );
- }
- else if( ps->stats[ STAT_HEALTH ] > 0 )
- {
- switch( ps->stats[ STAT_PCLASS ] )
- {
- case PCL_ALIEN_BUILDER0:
- case PCL_ALIEN_BUILDER0_UPG:
- CG_AlienBuilderText( text, ps );
- break;
-
- case PCL_ALIEN_LEVEL0:
- CG_AlienLevel0Text( text, ps );
- break;
-
- case PCL_ALIEN_LEVEL1:
- case PCL_ALIEN_LEVEL1_UPG:
- CG_AlienLevel1Text( text, ps );
- break;
-
- case PCL_ALIEN_LEVEL2:
- case PCL_ALIEN_LEVEL2_UPG:
- CG_AlienLevel2Text( text, ps );
- break;
-
- case PCL_ALIEN_LEVEL3:
- case PCL_ALIEN_LEVEL3_UPG:
- CG_AlienLevel3Text( text, ps );
- break;
-
- case PCL_ALIEN_LEVEL4:
- CG_AlienLevel4Text( text, ps );
- break;
-
- case PCL_HUMAN:
- CG_HumanText( text, ps );
- break;
-
- default:
- break;
- }
-
- if( ps->stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- entityState_t *es = CG_BuildableInRange( ps, NULL );
-
- if( ps->stats[ STAT_STATE ] & SS_HOVELING )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to exit the hovel\n",
- CG_KeyNameForCommand( "+button7" ) ) );
- }
- else if( es && es->modelindex == BA_A_HOVEL &&
- es->generic1 & B_SPAWNED_TOGGLEBIT &&
- ( ps->stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0 ||
- ps->stats[ STAT_PCLASS ] == PCL_ALIEN_BUILDER0_UPG ) )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to enter the hovel\n",
- CG_KeyNameForCommand( "+button7" ) ) );
- }
- else if( BG_UpgradeClassAvailable( ps ) )
- {
- Q_strcat( text, MAX_TUTORIAL_TEXT,
- va( "Press %s to evolve\n",
- CG_KeyNameForCommand( "+button7" ) ) );
- }
- }
- }
-
- Q_strcat( text, MAX_TUTORIAL_TEXT, "Press ESC for the menu" );
- }
-
- return text;
-}
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
deleted file mode 100644
index 477196c..0000000
--- a/src/cgame/cg_view.c
+++ /dev/null
@@ -1,1340 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_view.c -- setup all the parameters (position, angle, etc)
-// for a 3D rendering
-
-
-#include "cg_local.h"
-
-
-/*
-=============================================================================
-
- MODEL TESTING
-
-The viewthing and gun positioning tools from Q2 have been integrated and
-enhanced into a single model testing facility.
-
-Model viewing can begin with either "testmodel " or "testgun ".
-
-The names must be the full pathname after the basedir, like
-"models/weapons/v_launch/tris.md3" or "players/male/tris.md3"
-
-Testmodel will create a fake entity 100 units in front of the current view
-position, directly facing the viewer. It will remain immobile, so you can
-move around it to view it from different angles.
-
-Testgun will cause the model to follow the player around and supress the real
-view weapon model. The default frame 0 of most guns is completely off screen,
-so you will probably have to cycle a couple frames to see it.
-
-"nextframe", "prevframe", "nextskin", and "prevskin" commands will change the
-frame or skin of the testmodel. These are bound to F5, F6, F7, and F8 in
-q3default.cfg.
-
-If a gun is being tested, the "gun_x", "gun_y", and "gun_z" variables will let
-you adjust the positioning.
-
-Note that none of the model testing features update while the game is paused, so
-it may be convenient to test with deathmatch set to 1 so that bringing down the
-console doesn't pause the game.
-
-=============================================================================
-*/
-
-/*
-=================
-CG_TestModel_f
-
-Creates an entity in front of the current position, which
-can then be moved around
-=================
-*/
-void CG_TestModel_f( void )
-{
- vec3_t angles;
-
- memset( &cg.testModelEntity, 0, sizeof( cg.testModelEntity ) );
- memset( &cg.testModelBarrelEntity, 0, sizeof( cg.testModelBarrelEntity ) );
-
- if( trap_Argc( ) < 2 )
- return;
-
- Q_strncpyz( cg.testModelName, CG_Argv( 1 ), MAX_QPATH );
- cg.testModelEntity.hModel = trap_R_RegisterModel( cg.testModelName );
-
- Q_strncpyz( cg.testModelBarrelName, CG_Argv( 1 ), MAX_QPATH );
- cg.testModelBarrelName[ strlen( cg.testModelBarrelName ) - 4 ] = '\0';
- Q_strcat( cg.testModelBarrelName, MAX_QPATH, "_barrel.md3" );
- cg.testModelBarrelEntity.hModel = trap_R_RegisterModel( cg.testModelBarrelName );
-
- if( trap_Argc( ) == 3 )
- {
- cg.testModelEntity.backlerp = atof( CG_Argv( 2 ) );
- cg.testModelEntity.frame = 1;
- cg.testModelEntity.oldframe = 0;
- }
-
- if( !cg.testModelEntity.hModel )
- {
- CG_Printf( "Can't register model\n" );
- return;
- }
-
- VectorMA( cg.refdef.vieworg, 100, cg.refdef.viewaxis[ 0 ], cg.testModelEntity.origin );
-
- angles[ PITCH ] = 0;
- angles[ YAW ] = 180 + cg.refdefViewAngles[ 1 ];
- angles[ ROLL ] = 0;
-
- AnglesToAxis( angles, cg.testModelEntity.axis );
- cg.testGun = qfalse;
-
- if( cg.testModelBarrelEntity.hModel )
- {
- angles[ YAW ] = 0;
- angles[ PITCH ] = 0;
- angles[ ROLL ] = 0;
- AnglesToAxis( angles, cg.testModelBarrelEntity.axis );
- }
-}
-
-/*
-=================
-CG_TestGun_f
-
-Replaces the current view weapon with the given model
-=================
-*/
-void CG_TestGun_f( void )
-{
- CG_TestModel_f( );
- cg.testGun = qtrue;
- cg.testModelEntity.renderfx = RF_MINLIGHT | RF_DEPTHHACK | RF_FIRST_PERSON;
-}
-
-
-void CG_TestModelNextFrame_f( void )
-{
- cg.testModelEntity.frame++;
- CG_Printf( "frame %i\n", cg.testModelEntity.frame );
-}
-
-void CG_TestModelPrevFrame_f( void )
-{
- cg.testModelEntity.frame--;
-
- if( cg.testModelEntity.frame < 0 )
- cg.testModelEntity.frame = 0;
-
- CG_Printf( "frame %i\n", cg.testModelEntity.frame );
-}
-
-void CG_TestModelNextSkin_f( void )
-{
- cg.testModelEntity.skinNum++;
- CG_Printf( "skin %i\n", cg.testModelEntity.skinNum );
-}
-
-void CG_TestModelPrevSkin_f( void )
-{
- cg.testModelEntity.skinNum--;
-
- if( cg.testModelEntity.skinNum < 0 )
- cg.testModelEntity.skinNum = 0;
-
- CG_Printf( "skin %i\n", cg.testModelEntity.skinNum );
-}
-
-static void CG_AddTestModel( void )
-{
- int i;
-
- // re-register the model, because the level may have changed
- cg.testModelEntity.hModel = trap_R_RegisterModel( cg.testModelName );
- cg.testModelBarrelEntity.hModel = trap_R_RegisterModel( cg.testModelBarrelName );
-
- if( !cg.testModelEntity.hModel )
- {
- CG_Printf( "Can't register model\n" );
- return;
- }
-
- // if testing a gun, set the origin reletive to the view origin
- if( cg.testGun )
- {
- VectorCopy( cg.refdef.vieworg, cg.testModelEntity.origin );
- VectorCopy( cg.refdef.viewaxis[ 0 ], cg.testModelEntity.axis[ 0 ] );
- VectorCopy( cg.refdef.viewaxis[ 1 ], cg.testModelEntity.axis[ 1 ] );
- VectorCopy( cg.refdef.viewaxis[ 2 ], cg.testModelEntity.axis[ 2 ] );
-
- // allow the position to be adjusted
- for( i = 0; i < 3; i++ )
- {
- cg.testModelEntity.origin[ i ] += cg.refdef.viewaxis[ 0 ][ i ] * cg_gun_x.value;
- cg.testModelEntity.origin[ i ] += cg.refdef.viewaxis[ 1 ][ i ] * cg_gun_y.value;
- cg.testModelEntity.origin[ i ] += cg.refdef.viewaxis[ 2 ][ i ] * cg_gun_z.value;
- }
- }
-
- trap_R_AddRefEntityToScene( &cg.testModelEntity );
-
- if( cg.testModelBarrelEntity.hModel )
- {
- CG_PositionEntityOnTag( &cg.testModelBarrelEntity, &cg.testModelEntity,
- cg.testModelEntity.hModel, "tag_barrel" );
-
- trap_R_AddRefEntityToScene( &cg.testModelBarrelEntity );
- }
-}
-
-
-
-//============================================================================
-
-
-/*
-=================
-CG_CalcVrect
-
-Sets the coordinates of the rendered window
-=================
-*/
-static void CG_CalcVrect( void )
-{
- int size;
-
- // the intermission should allways be full screen
- if( cg.snap->ps.pm_type == PM_INTERMISSION )
- size = 100;
- else
- {
- // bound normal viewsize
- if( cg_viewsize.integer < 30 )
- {
- trap_Cvar_Set( "cg_viewsize", "30" );
- size = 30;
- }
- else if( cg_viewsize.integer > 100 )
- {
- trap_Cvar_Set( "cg_viewsize","100" );
- size = 100;
- }
- else
- size = cg_viewsize.integer;
- }
-
- cg.refdef.width = cgs.glconfig.vidWidth * size / 100;
- cg.refdef.width &= ~1;
-
- cg.refdef.height = cgs.glconfig.vidHeight * size / 100;
- cg.refdef.height &= ~1;
-
- cg.refdef.x = ( cgs.glconfig.vidWidth - cg.refdef.width ) / 2;
- cg.refdef.y = ( cgs.glconfig.vidHeight - cg.refdef.height ) / 2;
-}
-
-//==============================================================================
-
-
-/*
-===============
-CG_OffsetThirdPersonView
-
-===============
-*/
-#define FOCUS_DISTANCE 512
-static void CG_OffsetThirdPersonView( void )
-{
- vec3_t forward, right, up;
- vec3_t view;
- vec3_t focusAngles;
- trace_t trace;
- static vec3_t mins = { -8, -8, -8 };
- static vec3_t maxs = { 8, 8, 8 };
- vec3_t focusPoint;
- float focusDist;
- float forwardScale, sideScale;
- vec3_t surfNormal;
-
- if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING )
- {
- if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
- VectorSet( surfNormal, 0.0f, 0.0f, -1.0f );
- else
- VectorCopy( cg.predictedPlayerState.grapplePoint, surfNormal );
- }
- else
- VectorSet( surfNormal, 0.0f, 0.0f, 1.0f );
-
- VectorMA( cg.refdef.vieworg, cg.predictedPlayerState.viewheight, surfNormal, cg.refdef.vieworg );
-
- VectorCopy( cg.refdefViewAngles, focusAngles );
-
- // if dead, look at killer
- if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 )
- {
- focusAngles[ YAW ] = cg.predictedPlayerState.stats[ STAT_VIEWLOCK ];
- cg.refdefViewAngles[ YAW ] = cg.predictedPlayerState.stats[ STAT_VIEWLOCK ];
- }
-
- //if ( focusAngles[PITCH] > 45 ) {
- // focusAngles[PITCH] = 45; // don't go too far overhead
- //}
- AngleVectors( focusAngles, forward, NULL, NULL );
-
- VectorMA( cg.refdef.vieworg, FOCUS_DISTANCE, forward, focusPoint );
-
- VectorCopy( cg.refdef.vieworg, view );
-
- VectorMA( view, 12, surfNormal, view );
-
- //cg.refdefViewAngles[PITCH] *= 0.5;
-
- AngleVectors( cg.refdefViewAngles, forward, right, up );
-
- forwardScale = cos( cg_thirdPersonAngle.value / 180 * M_PI );
- sideScale = sin( cg_thirdPersonAngle.value / 180 * M_PI );
- VectorMA( view, -cg_thirdPersonRange.value * forwardScale, forward, view );
- VectorMA( view, -cg_thirdPersonRange.value * sideScale, right, view );
-
- // trace a ray from the origin to the viewpoint to make sure the view isn't
- // in a solid block. Use an 8 by 8 block to prevent the view from near clipping anything
-
- if( !cg_cameraMode.integer )
- {
- CG_Trace( &trace, cg.refdef.vieworg, mins, maxs, view, cg.predictedPlayerState.clientNum, MASK_SOLID );
-
- if( trace.fraction != 1.0 )
- {
- VectorCopy( trace.endpos, view );
- view[ 2 ] += ( 1.0 - trace.fraction ) * 32;
- // try another trace to this position, because a tunnel may have the ceiling
- // close enogh that this is poking out
-
- CG_Trace( &trace, cg.refdef.vieworg, mins, maxs, view, cg.predictedPlayerState.clientNum, MASK_SOLID );
- VectorCopy( trace.endpos, view );
- }
- }
-
- VectorCopy( view, cg.refdef.vieworg );
-
- // select pitch to look at focus point from vieword
- VectorSubtract( focusPoint, cg.refdef.vieworg, focusPoint );
- focusDist = sqrt( focusPoint[ 0 ] * focusPoint[ 0 ] + focusPoint[ 1 ] * focusPoint[ 1 ] );
- if ( focusDist < 1 ) {
- focusDist = 1; // should never happen
- }
- cg.refdefViewAngles[ PITCH ] = -180 / M_PI * atan2( focusPoint[ 2 ], focusDist );
- cg.refdefViewAngles[ YAW ] -= cg_thirdPersonAngle.value;
-}
-
-
-// this causes a compiler bug on mac MrC compiler
-static void CG_StepOffset( void )
-{
- float steptime;
- int timeDelta;
- vec3_t normal;
- playerState_t *ps = &cg.predictedPlayerState;
-
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
- {
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
- VectorSet( normal, 0.0f, 0.0f, -1.0f );
- else
- VectorCopy( ps->grapplePoint, normal );
- }
- else
- VectorSet( normal, 0.0f, 0.0f, 1.0f );
-
- steptime = BG_FindSteptimeForClass( ps->stats[ STAT_PCLASS ] );
-
- // smooth out stair climbing
- timeDelta = cg.time - cg.stepTime;
- if( timeDelta < steptime )
- {
- float stepChange = cg.stepChange
- * (steptime - timeDelta) / steptime;
-
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
- VectorMA( cg.refdef.vieworg, -stepChange, normal, cg.refdef.vieworg );
- else
- cg.refdef.vieworg[ 2 ] -= stepChange;
- }
-}
-
-#define PCLOUD_ROLL_AMPLITUDE 25.0f
-#define PCLOUD_ROLL_FREQUENCY 0.4f
-#define PCLOUD_ZOOM_AMPLITUDE 15
-#define PCLOUD_ZOOM_FREQUENCY 0.7f
-
-
-/*
-===============
-CG_OffsetFirstPersonView
-
-===============
-*/
-static void CG_OffsetFirstPersonView( void )
-{
- float *origin;
- float *angles;
- float bob;
- float ratio;
- float delta;
- float speed;
- float f;
- vec3_t predictedVelocity;
- int timeDelta;
- float bob2;
- vec3_t normal, baseOrigin;
- playerState_t *ps = &cg.predictedPlayerState;
-
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING )
- {
- if( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING )
- VectorSet( normal, 0.0f, 0.0f, -1.0f );
- else
- VectorCopy( ps->grapplePoint, normal );
- }
- else
- VectorSet( normal, 0.0f, 0.0f, 1.0f );
-
-
- if( cg.snap->ps.pm_type == PM_INTERMISSION )
- return;
-
- origin = cg.refdef.vieworg;
- angles = cg.refdefViewAngles;
-
- VectorCopy( origin, baseOrigin );
-
- // if dead, fix the angle and don't add any kick
- if( cg.snap->ps.stats[ STAT_HEALTH ] <= 0 )
- {
- angles[ ROLL ] = 40;
- angles[ PITCH ] = -15;
- angles[ YAW ] = cg.snap->ps.stats[ STAT_VIEWLOCK ];
- origin[ 2 ] += cg.predictedPlayerState.viewheight;
- return;
- }
-
- // add angles based on weapon kick
- VectorAdd( angles, cg.kick_angles, angles );
-
- // add angles based on damage kick
- if( cg.damageTime )
- {
- ratio = cg.time - cg.damageTime;
- if( ratio < DAMAGE_DEFLECT_TIME )
- {
- ratio /= DAMAGE_DEFLECT_TIME;
- angles[ PITCH ] += ratio * cg.v_dmg_pitch;
- angles[ ROLL ] += ratio * cg.v_dmg_roll;
- }
- else
- {
- ratio = 1.0 - ( ratio - DAMAGE_DEFLECT_TIME ) / DAMAGE_RETURN_TIME;
- if( ratio > 0 )
- {
- angles[ PITCH ] += ratio * cg.v_dmg_pitch;
- angles[ ROLL ] += ratio * cg.v_dmg_roll;
- }
- }
- }
-
- // add pitch based on fall kick
-#if 0
- ratio = ( cg.time - cg.landTime) / FALL_TIME;
- if (ratio < 0)
- ratio = 0;
- angles[PITCH] += ratio * cg.fall_value;
-#endif
-
- // add angles based on velocity
- VectorCopy( cg.predictedPlayerState.velocity, predictedVelocity );
-
- delta = DotProduct( predictedVelocity, cg.refdef.viewaxis[ 0 ] );
- angles[ PITCH ] += delta * cg_runpitch.value;
-
- delta = DotProduct( predictedVelocity, cg.refdef.viewaxis[ 1 ] );
- angles[ ROLL ] -= delta * cg_runroll.value;
-
- // add angles based on bob
- // bob amount is class dependant
-
- if( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR )
- bob2 = 0.0f;
- else
- bob2 = BG_FindBobForClass( cg.predictedPlayerState.stats[ STAT_PCLASS ] );
-
-
-#define LEVEL4_FEEDBACK 10.0f
-
- //give a charging player some feedback
- if( ps->weapon == WP_ALEVEL4 )
- {
- if( ps->stats[ STAT_MISC ] > 0 )
- {
- float fraction = (float)ps->stats[ STAT_MISC ] / (float)LEVEL4_CHARGE_TIME;
-
- if( fraction > 1.0f )
- fraction = 1.0f;
-
- bob2 *= ( 1.0f + fraction * LEVEL4_FEEDBACK );
- }
- }
-
- if( bob2 != 0.0f )
- {
- // make sure the bob is visible even at low speeds
- speed = cg.xyspeed > 200 ? cg.xyspeed : 200;
-
- delta = cg.bobfracsin * ( bob2 ) * speed;
- if( cg.predictedPlayerState.pm_flags & PMF_DUCKED )
- delta *= 3; // crouching
-
- angles[ PITCH ] += delta;
- delta = cg.bobfracsin * ( bob2 ) * speed;
- if( cg.predictedPlayerState.pm_flags & PMF_DUCKED )
- delta *= 3; // crouching accentuates roll
-
- if( cg.bobcycle & 1 )
- delta = -delta;
-
- angles[ ROLL ] += delta;
- }
-
-#define LEVEL3_FEEDBACK 20.0f
-
- //provide some feedback for pouncing
- if( cg.predictedPlayerState.weapon == WP_ALEVEL3 ||
- cg.predictedPlayerState.weapon == WP_ALEVEL3_UPG )
- {
- if( cg.predictedPlayerState.stats[ STAT_MISC ] > 0 )
- {
- float fraction1, fraction2;
- vec3_t forward;
-
- AngleVectors( angles, forward, NULL, NULL );
- VectorNormalize( forward );
-
- fraction1 = (float)( cg.time - cg.weapon2Time ) / (float)LEVEL3_POUNCE_CHARGE_TIME;
-
- if( fraction1 > 1.0f )
- fraction1 = 1.0f;
-
- fraction2 = -sin( fraction1 * M_PI / 2 );
-
- VectorMA( origin, LEVEL3_FEEDBACK * fraction2, forward, origin );
- }
- }
-
-#define STRUGGLE_DIST 5.0f
-#define STRUGGLE_TIME 250
-
- //allow the player to struggle a little whilst grabbed
- if( cg.predictedPlayerState.pm_type == PM_GRABBED )
- {
- vec3_t forward, right, up;
- usercmd_t cmd;
- int cmdNum;
- float fFraction, rFraction, uFraction;
- float fFraction2, rFraction2, uFraction2;
-
- cmdNum = trap_GetCurrentCmdNumber();
- trap_GetUserCmd( cmdNum, &cmd );
-
- AngleVectors( angles, forward, right, up );
-
- fFraction = (float)( cg.time - cg.forwardMoveTime ) / STRUGGLE_TIME;
- rFraction = (float)( cg.time - cg.rightMoveTime ) / STRUGGLE_TIME;
- uFraction = (float)( cg.time - cg.upMoveTime ) / STRUGGLE_TIME;
-
- if( fFraction > 1.0f )
- fFraction = 1.0f;
- if( rFraction > 1.0f )
- rFraction = 1.0f;
- if( uFraction > 1.0f )
- uFraction = 1.0f;
-
- fFraction2 = -sin( fFraction * M_PI / 2 );
- rFraction2 = -sin( rFraction * M_PI / 2 );
- uFraction2 = -sin( uFraction * M_PI / 2 );
-
- if( cmd.forwardmove > 0 )
- VectorMA( origin, STRUGGLE_DIST * fFraction, forward, origin );
- else if( cmd.forwardmove < 0 )
- VectorMA( origin, -STRUGGLE_DIST * fFraction, forward, origin );
- else
- cg.forwardMoveTime = cg.time;
-
- if( cmd.rightmove > 0 )
- VectorMA( origin, STRUGGLE_DIST * rFraction, right, origin );
- else if( cmd.rightmove < 0 )
- VectorMA( origin, -STRUGGLE_DIST * rFraction, right, origin );
- else
- cg.rightMoveTime = cg.time;
-
- if( cmd.upmove > 0 )
- VectorMA( origin, STRUGGLE_DIST * uFraction, up, origin );
- else if( cmd.upmove < 0 )
- VectorMA( origin, -STRUGGLE_DIST * uFraction, up, origin );
- else
- cg.upMoveTime = cg.time;
- }
-
- if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_POISONCLOUDED &&
- !( cg.snap->ps.pm_flags & PMF_FOLLOW ) )
- {
- float fraction = sin( ( (float)cg.time / 1000.0f ) * M_PI * 2 * PCLOUD_ROLL_FREQUENCY );
- float pitchFraction = sin( ( (float)cg.time / 1000.0f ) * M_PI * 5 * PCLOUD_ROLL_FREQUENCY );
-
- fraction *= 1.0f - ( ( cg.time - cg.poisonedTime ) / (float)LEVEL1_PCLOUD_TIME );
- pitchFraction *= 1.0f - ( ( cg.time - cg.poisonedTime ) / (float)LEVEL1_PCLOUD_TIME );
-
- angles[ ROLL ] += fraction * PCLOUD_ROLL_AMPLITUDE;
- angles[ YAW ] += fraction * PCLOUD_ROLL_AMPLITUDE;
- angles[ PITCH ] += pitchFraction * PCLOUD_ROLL_AMPLITUDE / 2.0f;
- }
-
- // this *feels* more realisitic for humans
- if( cg.predictedPlayerState.stats[ STAT_PTEAM ] == PTE_HUMANS )
- {
- angles[PITCH] += cg.bobfracsin * bob2 * 0.5;
-
- // heavy breathing effects //FIXME: sound
- if( cg.predictedPlayerState.stats[ STAT_STAMINA ] < 0 )
- {
- float deltaBreath = (float)(
- cg.predictedPlayerState.stats[ STAT_STAMINA ] < 0 ?
- -cg.predictedPlayerState.stats[ STAT_STAMINA ] :
- cg.predictedPlayerState.stats[ STAT_STAMINA ] ) / 200.0;
- float deltaAngle = cos( (float)cg.time/150.0 ) * deltaBreath;
-
- deltaAngle += ( deltaAngle < 0 ? -deltaAngle : deltaAngle ) * 0.5;
-
- angles[ PITCH ] -= deltaAngle;
- }
- }
-
-//===================================
-
- // add view height
- // when wall climbing the viewheight is not straight up
- if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING )
- VectorMA( origin, ps->viewheight, normal, origin );
- else
- origin[ 2 ] += cg.predictedPlayerState.viewheight;
-
- // smooth out duck height changes
- timeDelta = cg.time - cg.duckTime;
- if( timeDelta < DUCK_TIME)
- {
- cg.refdef.vieworg[ 2 ] -= cg.duckChange
- * ( DUCK_TIME - timeDelta ) / DUCK_TIME;
- }
-
- // add bob height
- bob = cg.bobfracsin * cg.xyspeed * bob2;
-
- if( bob > 6 )
- bob = 6;
-
- // likewise for bob
- if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_WALLCLIMBING )
- VectorMA( origin, bob, normal, origin );
- else
- origin[ 2 ] += bob;
-
-
- // add fall height
- delta = cg.time - cg.landTime;
-
- if( delta < LAND_DEFLECT_TIME )
- {
- f = delta / LAND_DEFLECT_TIME;
- cg.refdef.vieworg[ 2 ] += cg.landChange * f;
- }
- else if( delta < LAND_DEFLECT_TIME + LAND_RETURN_TIME )
- {
- delta -= LAND_DEFLECT_TIME;
- f = 1.0 - ( delta / LAND_RETURN_TIME );
- cg.refdef.vieworg[ 2 ] += cg.landChange * f;
- }
-
- // add step offset
- CG_StepOffset( );
-
- // add kick offset
-
- VectorAdd (origin, cg.kick_origin, origin);
-}
-
-//======================================================================
-
-/*
-====================
-CG_CalcFov
-
-Fixed fov at intermissions, otherwise account for fov variable and zooms.
-====================
-*/
-#define WAVE_AMPLITUDE 1
-#define WAVE_FREQUENCY 0.4
-
-#define FOVWARPTIME 400.0
-
-static int CG_CalcFov( void )
-{
- float x;
- float phase;
- float v;
- int contents;
- float fov_x, fov_y;
- float zoomFov;
- float f;
- int inwater;
- int attribFov;
- usercmd_t cmd;
- int cmdNum;
-
- cmdNum = trap_GetCurrentCmdNumber( );
- trap_GetUserCmd( cmdNum, &cmd );
-
- if( cg.predictedPlayerState.pm_type == PM_INTERMISSION ||
- ( cg.snap->ps.persistant[ PERS_TEAM ] == TEAM_SPECTATOR ) )
- {
- // if in intermission, use a fixed value
- fov_x = 90;
- }
- else
- {
- // don't lock the fov globally - we need to be able to change it
- attribFov = BG_FindFovForClass( cg.predictedPlayerState.stats[ STAT_PCLASS ] );
- fov_x = attribFov;
-
- if ( fov_x < 1 )
- fov_x = 1;
- else if ( fov_x > 160 )
- fov_x = 160;
-
- if( cg.spawnTime > ( cg.time - FOVWARPTIME ) &&
- BG_ClassHasAbility( cg.predictedPlayerState.stats[ STAT_PCLASS ], SCA_FOVWARPS ) )
- {
- float temp, temp2;
-
- temp = (float)( cg.time - cg.spawnTime ) / FOVWARPTIME;
- temp2 = ( 170 - fov_x ) * temp;
-
- //Com_Printf( "%f %f\n", temp*100, temp2*100 );
-
- fov_x = 170 - temp2;
- }
-
- // account for zooms
- zoomFov = BG_FindZoomFovForWeapon( cg.predictedPlayerState.weapon );
- if ( zoomFov < 1 )
- zoomFov = 1;
- else if ( zoomFov > attribFov )
- zoomFov = attribFov;
-
- // only do all the zoom stuff if the client CAN zoom
- // FIXME: zoom control is currently hard coded to BUTTON_ATTACK2
- if( BG_WeaponCanZoom( cg.predictedPlayerState.weapon ) )
- {
- if ( cg.zoomed )
- {
- f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
-
- if ( f > 1.0 )
- fov_x = zoomFov;
- else
- fov_x = fov_x + f * ( zoomFov - fov_x );
-
- // BUTTON_ATTACK2 isn't held so unzoom next time
- if( !( cmd.buttons & BUTTON_ATTACK2 ) )
- {
- cg.zoomed = qfalse;
- cg.zoomTime = cg.time;
- }
- }
- else
- {
- f = ( cg.time - cg.zoomTime ) / (float)ZOOM_TIME;
-
- if ( f > 1.0 )
- fov_x = fov_x;
- else
- fov_x = zoomFov + f * ( fov_x - zoomFov );
-
- // BUTTON_ATTACK2 is held so zoom next time
- if( cmd.buttons & BUTTON_ATTACK2 )
- {
- cg.zoomed = qtrue;
- cg.zoomTime = cg.time;
- }
- }
- }
- }
-
- x = cg.refdef.width / tan( fov_x / 360 * M_PI );
- fov_y = atan2( cg.refdef.height, x );
- fov_y = fov_y * 360 / M_PI;
-
- // warp if underwater
- contents = CG_PointContents( cg.refdef.vieworg, -1 );
-
- if( contents & ( CONTENTS_WATER | CONTENTS_SLIME | CONTENTS_LAVA ) )
- {
- phase = cg.time / 1000.0 * WAVE_FREQUENCY * M_PI * 2;
- v = WAVE_AMPLITUDE * sin( phase );
- fov_x += v;
- fov_y -= v;
- inwater = qtrue;
- }
- else
- inwater = qfalse;
-
- if( cg.predictedPlayerState.stats[ STAT_STATE ] & SS_POISONCLOUDED &&
- cg.predictedPlayerState.stats[ STAT_HEALTH ] > 0 &&
- !( cg.snap->ps.pm_flags & PMF_FOLLOW ) )
- {
- phase = cg.time / 1000.0 * PCLOUD_ZOOM_FREQUENCY * M_PI * 2;
- v = PCLOUD_ZOOM_AMPLITUDE * sin( phase );
- v *= 1.0f - ( ( cg.time - cg.poisonedTime ) / (float)LEVEL1_PCLOUD_TIME );
- fov_x += v;
- fov_y += v;
- }
-
-
- // set it
- cg.refdef.fov_x = fov_x;
- cg.refdef.fov_y = fov_y;
-
- if( !cg.zoomed )
- cg.zoomSensitivity = 1;
- else
- cg.zoomSensitivity = cg.refdef.fov_y / 75.0;
-
- return inwater;
-}
-
-
-
-#define NORMAL_HEIGHT 64.0f
-#define NORMAL_WIDTH 6.0f
-
-/*
-===============
-CG_DrawSurfNormal
-
-Draws a vector against
-the surface player is looking at
-===============
-*/
-static void CG_DrawSurfNormal( void )
-{
- trace_t tr;
- vec3_t end, temp;
- polyVert_t normal[ 4 ];
- vec4_t color = { 0.0f, 255.0f, 0.0f, 128.0f };
-
- VectorMA( cg.refdef.vieworg, 8192, cg.refdef.viewaxis[ 0 ], end );
-
- CG_Trace( &tr, cg.refdef.vieworg, NULL, NULL, end, cg.predictedPlayerState.clientNum, MASK_SOLID );
-
- VectorCopy( tr.endpos, normal[ 0 ].xyz );
- normal[ 0 ].st[ 0 ] = 0;
- normal[ 0 ].st[ 1 ] = 0;
- Vector4Copy( color, normal[ 0 ].modulate );
-
- VectorMA( tr.endpos, NORMAL_WIDTH, cg.refdef.viewaxis[ 1 ], temp );
- VectorCopy( temp, normal[ 1 ].xyz);
- normal[ 1 ].st[ 0 ] = 0;
- normal[ 1 ].st[ 1 ] = 1;
- Vector4Copy( color, normal[ 1 ].modulate );
-
- VectorMA( tr.endpos, NORMAL_HEIGHT, tr.plane.normal, temp );
- VectorMA( temp, NORMAL_WIDTH, cg.refdef.viewaxis[ 1 ], temp );
- VectorCopy( temp, normal[ 2 ].xyz );
- normal[ 2 ].st[ 0 ] = 1;
- normal[ 2 ].st[ 1 ] = 1;
- Vector4Copy( color, normal[ 2 ].modulate );
-
- VectorMA( tr.endpos, NORMAL_HEIGHT, tr.plane.normal, temp );
- VectorCopy( temp, normal[ 3 ].xyz );
- normal[ 3 ].st[ 0 ] = 1;
- normal[ 3 ].st[ 1 ] = 0;
- Vector4Copy( color, normal[ 3 ].modulate );
-
- trap_R_AddPolyToScene( cgs.media.outlineShader, 4, normal );
-}
-
-/*
-===============
-CG_addSmoothOp
-===============
-*/
-void CG_addSmoothOp( vec3_t rotAxis, float rotAngle, float timeMod )
-{
- int i;
-
- //iterate through smooth array
- for( i = 0; i < MAXSMOOTHS; i++ )
- {
- //found an unused index in the smooth array
- if( cg.sList[ i ].time + cg_wwSmoothTime.integer < cg.time )
- {
- //copy to array and stop
- VectorCopy( rotAxis, cg.sList[ i ].rotAxis );
- cg.sList[ i ].rotAngle = rotAngle;
- cg.sList[ i ].time = cg.time;
- cg.sList[ i ].timeMod = timeMod;
- return;
- }
- }
-
- //no free indices in the smooth array
-}
-
-/*
-===============
-CG_smoothWWTransitions
-===============
-*/
-static void CG_smoothWWTransitions( playerState_t *ps, const vec3_t in, vec3_t out )
-{
- vec3_t surfNormal, rotAxis, temp;
- vec3_t refNormal = { 0.0f, 0.0f, 1.0f };
- vec3_t ceilingNormal = { 0.0f, 0.0f, -1.0f };
- int i;
- float stLocal, sFraction, rotAngle;
- float smoothTime, timeMod;
- qboolean performed = qfalse;
- vec3_t inAxis[ 3 ], lastAxis[ 3 ], outAxis[ 3 ];
-
- if( cg.snap->ps.pm_flags & PMF_FOLLOW )
- {
- VectorCopy( in, out );
- return;
- }
-
- //set surfNormal
- if( !( ps->stats[ STAT_STATE ] & SS_WALLCLIMBINGCEILING ) )
- VectorCopy( ps->grapplePoint, surfNormal );
- else
- VectorCopy( ceilingNormal, surfNormal );
-
- AnglesToAxis( in, inAxis );
-
- //if we are moving from one surface to another smooth the transition
- if( !VectorCompare( surfNormal, cg.lastNormal ) )
- {
- //if we moving from the ceiling to the floor special case
- //( x product of colinear vectors is undefined)
- if( VectorCompare( ceilingNormal, cg.lastNormal ) &&
- VectorCompare( refNormal, surfNormal ) )
- {
- AngleVectors( in, temp, NULL, NULL );
- ProjectPointOnPlane( rotAxis, temp, refNormal );
- VectorNormalize( rotAxis );
- rotAngle = 180.0f;
- timeMod = 1.5f;
- }
- else
- {
- AnglesToAxis( cg.lastVangles, lastAxis );
- rotAngle = DotProduct( inAxis[ 0 ], lastAxis[ 0 ] ) +
- DotProduct( inAxis[ 1 ], lastAxis[ 1 ] ) +
- DotProduct( inAxis[ 2 ], lastAxis[ 2 ] );
-
- rotAngle = RAD2DEG( acos( ( rotAngle - 1.0f ) / 2.0f ) );
-
- CrossProduct( lastAxis[ 0 ], inAxis[ 0 ], temp );
- VectorCopy( temp, rotAxis );
- CrossProduct( lastAxis[ 1 ], inAxis[ 1 ], temp );
- VectorAdd( rotAxis, temp, rotAxis );
- CrossProduct( lastAxis[ 2 ], inAxis[ 2 ], temp );
- VectorAdd( rotAxis, temp, rotAxis );
-
- VectorNormalize( rotAxis );
-
- timeMod = 1.0f;
- }
-
- //add the op
- CG_addSmoothOp( rotAxis, rotAngle, timeMod );
- }
-
- //iterate through ops
- for( i = MAXSMOOTHS - 1; i >= 0; i-- )
- {
- smoothTime = (int)( cg_wwSmoothTime.integer * cg.sList[ i ].timeMod );
-
- //if this op has time remaining, perform it
- if( cg.time < cg.sList[ i ].time + smoothTime )
- {
- stLocal = 1.0f - ( ( ( cg.sList[ i ].time + smoothTime ) - cg.time ) / smoothTime );
- sFraction = -( cos( stLocal * M_PI ) + 1.0f ) / 2.0f;
-
- RotatePointAroundVector( outAxis[ 0 ], cg.sList[ i ].rotAxis,
- inAxis[ 0 ], sFraction * cg.sList[ i ].rotAngle );
- RotatePointAroundVector( outAxis[ 1 ], cg.sList[ i ].rotAxis,
- inAxis[ 1 ], sFraction * cg.sList[ i ].rotAngle );
- RotatePointAroundVector( outAxis[ 2 ], cg.sList[ i ].rotAxis,
- inAxis[ 2 ], sFraction * cg.sList[ i ].rotAngle );
-
- AxisCopy( outAxis, inAxis );
- performed = qtrue;
- }
- }
-
- //if we performed any ops then return the smoothed angles
- //otherwise simply return the in angles
- if( performed )
- AxisToAngles( outAxis, out );
- else
- VectorCopy( in, out );
-
- //copy the current normal to the lastNormal
- VectorCopy( in, cg.lastVangles );
- VectorCopy( surfNormal, cg.lastNormal );
-}
-
-/*
-===============
-CG_smoothWJTransitions
-===============
-*/
-static void CG_smoothWJTransitions( playerState_t *ps, const vec3_t in, vec3_t out )
-{
- int i;
- float stLocal, sFraction;
- qboolean performed = qfalse;
- vec3_t inAxis[ 3 ], outAxis[ 3 ];
-
- if( cg.snap->ps.pm_flags & PMF_FOLLOW )
- {
- VectorCopy( in, out );
- return;
- }
-
- AnglesToAxis( in, inAxis );
-
- //iterate through ops
- for( i = MAXSMOOTHS - 1; i >= 0; i-- )
- {
- //if this op has time remaining, perform it
- if( cg.time < cg.sList[ i ].time + cg_wwSmoothTime.integer )
- {
- stLocal = ( ( cg.sList[ i ].time + cg_wwSmoothTime.integer ) - cg.time ) / cg_wwSmoothTime.integer;
- sFraction = 1.0f - ( ( cos( stLocal * M_PI * 2.0f ) + 1.0f ) / 2.0f );
-
- RotatePointAroundVector( outAxis[ 0 ], cg.sList[ i ].rotAxis,
- inAxis[ 0 ], sFraction * cg.sList[ i ].rotAngle );
- RotatePointAroundVector( outAxis[ 1 ], cg.sList[ i ].rotAxis,
- inAxis[ 1 ], sFraction * cg.sList[ i ].rotAngle );
- RotatePointAroundVector( outAxis[ 2 ], cg.sList[ i ].rotAxis,
- inAxis[ 2 ], sFraction * cg.sList[ i ].rotAngle );
-
- AxisCopy( outAxis, inAxis );
- performed = qtrue;
- }
- }
-
- //if we performed any ops then return the smoothed angles
- //otherwise simply return the in angles
- if( performed )
- AxisToAngles( outAxis, out );
- else
- VectorCopy( in, out );
-}
-
-
-/*
-===============
-CG_CalcViewValues
-
-Sets cg.refdef view values
-===============
-*/
-static int CG_CalcViewValues( void )
-{
- playerState_t *ps;
-
- memset( &cg.refdef, 0, sizeof( cg.refdef ) );
-
- // calculate size of 3D view
- CG_CalcVrect( );
-
- ps = &cg.predictedPlayerState;
-
- // intermission view
- if( ps->pm_type == PM_INTERMISSION )
- {
- VectorCopy( ps->origin, cg.refdef.vieworg );
- VectorCopy( ps->viewangles, cg.refdefViewAngles );
- AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
-
- return CG_CalcFov( );
- }
-
- cg.bobcycle = ( ps->bobCycle & 128 ) >> 7;
- cg.bobfracsin = fabs( sin( ( ps->bobCycle & 127 ) / 127.0 * M_PI ) );
- cg.xyspeed = sqrt( ps->velocity[ 0 ] * ps->velocity[ 0 ] +
- ps->velocity[ 1 ] * ps->velocity[ 1 ] );
-
- VectorCopy( ps->origin, cg.refdef.vieworg );
-
- if( BG_ClassHasAbility( ps->stats[ STAT_PCLASS ], SCA_WALLCLIMBER ) )
- CG_smoothWWTransitions( ps, ps->viewangles, cg.refdefViewAngles );
- else if( BG_ClassHasAbility( ps->stats[ STAT_PCLASS ], SCA_WALLJUMPER ) )
- CG_smoothWJTransitions( ps, ps->viewangles, cg.refdefViewAngles );
- else
- VectorCopy( ps->viewangles, cg.refdefViewAngles );
-
- //clumsy logic, but it needs to be this way round because the CS propogation
- //delay screws things up otherwise
- if( !BG_ClassHasAbility( ps->stats[ STAT_PCLASS ], SCA_WALLJUMPER ) )
- {
- if( !( ps->stats[ STAT_STATE ] & SS_WALLCLIMBING ) )
- VectorSet( cg.lastNormal, 0.0f, 0.0f, 1.0f );
- }
-
- // add error decay
- if( cg_errorDecay.value > 0 )
- {
- int t;
- float f;
-
- t = cg.time - cg.predictedErrorTime;
- f = ( cg_errorDecay.value - t ) / cg_errorDecay.value;
-
- if( f > 0 && f < 1 )
- VectorMA( cg.refdef.vieworg, f, cg.predictedError, cg.refdef.vieworg );
- else
- cg.predictedErrorTime = 0;
- }
-
- //shut off the poison cloud effect if it's still on the go
- if( cg.snap->ps.stats[ STAT_HEALTH ] <= 0 )
- {
- if( CG_IsParticleSystemValid( &cg.poisonCloudPS ) )
- CG_DestroyParticleSystem( &cg.poisonCloudPS );
- }
-
- if( cg.renderingThirdPerson )
- {
- // back away from character
- CG_OffsetThirdPersonView( );
- }
- else
- {
- // offset for local bobbing and kicks
- CG_OffsetFirstPersonView( );
- }
-
- // position eye reletive to origin
- AnglesToAxis( cg.refdefViewAngles, cg.refdef.viewaxis );
-
- if( cg.hyperspace )
- cg.refdef.rdflags |= RDF_NOWORLDMODEL | RDF_HYPERSPACE;
-
- //draw the surface normal looking at
- if( cg_drawSurfNormal.integer )
- CG_DrawSurfNormal( );
-
- // field of view
- return CG_CalcFov( );
-}
-
-/*
-=====================
-CG_AddBufferedSound
-=====================
-*/
-void CG_AddBufferedSound( sfxHandle_t sfx )
-{
- if( !sfx )
- return;
-
- cg.soundBuffer[ cg.soundBufferIn ] = sfx;
- cg.soundBufferIn = ( cg.soundBufferIn + 1 ) % MAX_SOUNDBUFFER;
-
- if( cg.soundBufferIn == cg.soundBufferOut )
- cg.soundBufferOut++;
-}
-
-/*
-=====================
-CG_PlayBufferedSounds
-=====================
-*/
-static void CG_PlayBufferedSounds( void )
-{
- if( cg.soundTime < cg.time )
- {
- if( cg.soundBufferOut != cg.soundBufferIn && cg.soundBuffer[ cg.soundBufferOut ] )
- {
- trap_S_StartLocalSound( cg.soundBuffer[ cg.soundBufferOut ], CHAN_ANNOUNCER );
- cg.soundBuffer[ cg.soundBufferOut ] = 0;
- cg.soundBufferOut = ( cg.soundBufferOut + 1 ) % MAX_SOUNDBUFFER;
- cg.soundTime = cg.time + 750;
- }
- }
-}
-
-//=========================================================================
-
-/*
-=================
-CG_DrawActiveFrame
-
-Generates and draws a game scene and status information at the given time.
-=================
-*/
-void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demoPlayback )
-{
- int inwater;
-
- cg.time = serverTime;
- cg.demoPlayback = demoPlayback;
-
- // update cvars
- CG_UpdateCvars( );
-
- // if we are only updating the screen as a loading
- // pacifier, don't even try to read snapshots
- if( cg.infoScreenText[ 0 ] != 0 )
- {
- CG_DrawLoadingScreen( );
- return;
- }
-
- // any looped sounds will be respecified as entities
- // are added to the render list
- trap_S_ClearLoopingSounds( qfalse );
-
- // clear all the render lists
- trap_R_ClearScene( );
-
- // set up cg.snap and possibly cg.nextSnap
- CG_ProcessSnapshots( );
-
- // if we haven't received any snapshots yet, all
- // we can draw is the information screen
- if( !cg.snap || ( cg.snap->snapFlags & SNAPFLAG_NOT_ACTIVE ) )
- {
- CG_DrawLoadingScreen( );
- return;
- }
-
- // let the client system know what our weapon and zoom settings are
- trap_SetUserCmdValue( cg.weaponSelect, cg.zoomSensitivity );
-
- // this counter will be bumped for every valid scene we generate
- cg.clientFrame++;
-
- // update cg.predictedPlayerState
- CG_PredictPlayerState( );
-
- // decide on third person view
- cg.renderingThirdPerson = cg_thirdPerson.integer || ( cg.snap->ps.stats[ STAT_HEALTH ] <= 0 );
-
- // build cg.refdef
- inwater = CG_CalcViewValues( );
-
- // build the render lists
- if( !cg.hyperspace )
- {
- CG_AddPacketEntities( ); // after calcViewValues, so predicted player state is correct
- CG_AddMarks( );
- }
-
- CG_AddViewWeapon( &cg.predictedPlayerState );
-
- //after CG_AddViewWeapon
- if( !cg.hyperspace )
- {
- CG_AddParticles( );
- CG_AddTrails( );
- }
-
- // add buffered sounds
- CG_PlayBufferedSounds( );
-
- // finish up the rest of the refdef
- if( cg.testModelEntity.hModel )
- CG_AddTestModel( );
-
- cg.refdef.time = cg.time;
- memcpy( cg.refdef.areamask, cg.snap->areamask, sizeof( cg.refdef.areamask ) );
-
- //remove expired console lines
- if( cg.consoleLines[ 0 ].time + cg_consoleLatency.integer < cg.time && cg_consoleLatency.integer > 0 )
- CG_RemoveNotifyLine( );
-
- // update audio positions
- trap_S_Respatialize( cg.snap->ps.clientNum, cg.refdef.vieworg, cg.refdef.viewaxis, inwater );
-
- // make sure the lagometerSample and frame timing isn't done twice when in stereo
- if( stereoView != STEREO_RIGHT )
- {
- cg.frametime = cg.time - cg.oldTime;
-
- if( cg.frametime < 0 )
- cg.frametime = 0;
-
- cg.oldTime = cg.time;
- CG_AddLagometerFrameInfo( );
- }
-
- if( cg_timescale.value != cg_timescaleFadeEnd.value )
- {
- if( cg_timescale.value < cg_timescaleFadeEnd.value )
- {
- cg_timescale.value += cg_timescaleFadeSpeed.value * ( (float)cg.frametime ) / 1000;
- if( cg_timescale.value > cg_timescaleFadeEnd.value )
- cg_timescale.value = cg_timescaleFadeEnd.value;
- }
- else
- {
- cg_timescale.value -= cg_timescaleFadeSpeed.value * ( (float)cg.frametime ) / 1000;
- if( cg_timescale.value < cg_timescaleFadeEnd.value )
- cg_timescale.value = cg_timescaleFadeEnd.value;
- }
-
- if( cg_timescaleFadeSpeed.value )
- trap_Cvar_Set( "timescale", va( "%f", cg_timescale.value ) );
- }
-
- // actually issue the rendering calls
- CG_DrawActive( stereoView );
-
- if( cg_stats.integer )
- CG_Printf( "cg.clientFrame:%i\n", cg.clientFrame );
-}
-
diff --git a/src/cgame/cg_weapons.c b/src/cgame/cg_weapons.c
deleted file mode 100644
index deae4e0..0000000
--- a/src/cgame/cg_weapons.c
+++ /dev/null
@@ -1,1845 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cg_weapons.c -- events and effects dealing with weapons
-
-
-#include "cg_local.h"
-
-/*
-=================
-CG_RegisterUpgrade
-
-The server says this item is used on this level
-=================
-*/
-void CG_RegisterUpgrade( int upgradeNum )
-{
- upgradeInfo_t *upgradeInfo;
- char *icon;
-
- upgradeInfo = &cg_upgrades[ upgradeNum ];
-
- if( upgradeNum == 0 )
- return;
-
- if( upgradeInfo->registered )
- return;
-
- memset( upgradeInfo, 0, sizeof( *upgradeInfo ) );
- upgradeInfo->registered = qtrue;
-
- if( !BG_FindNameForUpgrade( upgradeNum ) )
- CG_Error( "Couldn't find upgrade %i", upgradeNum );
-
- upgradeInfo->humanName = BG_FindHumanNameForUpgrade( upgradeNum );
-
- //la la la la la, i'm not listening!
- if( upgradeNum == UP_GRENADE )
- upgradeInfo->upgradeIcon = cg_weapons[ WP_GRENADE ].weaponIcon;
- else if( ( icon = BG_FindIconForUpgrade( upgradeNum ) ) )
- upgradeInfo->upgradeIcon = trap_R_RegisterShader( icon );
-}
-
-/*
-===============
-CG_InitUpgrades
-
-Precaches upgrades
-===============
-*/
-void CG_InitUpgrades( void )
-{
- int i;
-
- memset( cg_upgrades, 0, sizeof( cg_upgrades ) );
-
- for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
- CG_RegisterUpgrade( i );
-}
-
-
-/*
-===============
-CG_ParseWeaponModeSection
-
-Parse a weapon mode section
-===============
-*/
-static qboolean CG_ParseWeaponModeSection( weaponInfoMode_t *wim, char **text_p )
-{
- char *token;
- int i;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( text_p );
-
- if( !token )
- break;
-
- if( !Q_stricmp( token, "" ) )
- return qfalse;
-
- if( !Q_stricmp( token, "missileModel" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileModel = trap_R_RegisterModel( token );
-
- if( !wim->missileModel )
- CG_Printf( S_COLOR_RED "ERROR: missile model not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "missileSprite" ) )
- {
- int size = 0;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- size = atoi( token );
-
- if( size < 0 )
- size = 0;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileSprite = trap_R_RegisterShader( token );
- wim->missileSpriteSize = size;
- wim->usesSpriteMissle = qtrue;
-
- if( !wim->missileSprite )
- CG_Printf( S_COLOR_RED "ERROR: missile sprite not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "missileRotates" ) )
- {
- wim->missileRotates = qtrue;
-
- continue;
- }
- else if( !Q_stricmp( token, "missileAnimates" ) )
- {
- wim->missileAnimates = qtrue;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileAnimStartFrame = atoi( token );
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileAnimNumFrames = atoi( token );
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileAnimFrameRate = atoi( token );
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileAnimLooping = atoi( token );
-
- continue;
- }
- else if( !Q_stricmp( token, "missileParticleSystem" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileParticleSystem = CG_RegisterParticleSystem( token );
-
- if( !wim->missileParticleSystem )
- CG_Printf( S_COLOR_RED "ERROR: missile particle system not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "missileTrailSystem" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileTrailSystem = CG_RegisterTrailSystem( token );
-
- if( !wim->missileTrailSystem )
- CG_Printf( S_COLOR_RED "ERROR: missile trail system not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "muzzleParticleSystem" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->muzzleParticleSystem = CG_RegisterParticleSystem( token );
-
- if( !wim->muzzleParticleSystem )
- CG_Printf( S_COLOR_RED "ERROR: muzzle particle system not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "impactParticleSystem" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->impactParticleSystem = CG_RegisterParticleSystem( token );
-
- if( !wim->impactParticleSystem )
- CG_Printf( S_COLOR_RED "ERROR: impact particle system not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "impactMark" ) )
- {
- int size = 0;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- size = atoi( token );
-
- if( size < 0 )
- size = 0;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->impactMark = trap_R_RegisterShader( token );
- wim->impactMarkSize = size;
-
- if( !wim->impactMark )
- CG_Printf( S_COLOR_RED "ERROR: impact mark shader not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "impactSound" ) )
- {
- int index = 0;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- index = atoi( token );
-
- if( index < 0 )
- index = 0;
- else if( index > 3 )
- index = 3;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->impactSound[ index ] = trap_S_RegisterSound( token, qfalse );
-
- continue;
- }
- else if( !Q_stricmp( token, "impactFleshSound" ) )
- {
- int index = 0;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- index = atoi( token );
-
- if( index < 0 )
- index = 0;
- else if( index > 3 )
- index = 3;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->impactFleshSound[ index ] = trap_S_RegisterSound( token, qfalse );
-
- continue;
- }
- else if( !Q_stricmp( token, "alwaysImpact" ) )
- {
- wim->alwaysImpact = qtrue;
-
- continue;
- }
- else if( !Q_stricmp( token, "flashDLightColor" ) )
- {
- for( i = 0 ; i < 3 ; i++ )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->flashDlightColor[ i ] = atof( token );
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "continuousFlash" ) )
- {
- wim->continuousFlash = qtrue;
-
- continue;
- }
- else if( !Q_stricmp( token, "missileDlightColor" ) )
- {
- for( i = 0 ; i < 3 ; i++ )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileDlightColor[ i ] = atof( token );
- }
-
- continue;
- }
- else if( !Q_stricmp( token, "missileDlight" ) )
- {
- int size = 0;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- size = atoi( token );
-
- if( size < 0 )
- size = 0;
-
- wim->missileDlight = size;
-
- continue;
- }
- else if( !Q_stricmp( token, "firingSound" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->firingSound = trap_S_RegisterSound( token, qfalse );
-
- continue;
- }
- else if( !Q_stricmp( token, "missileSound" ) )
- {
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->missileSound = trap_S_RegisterSound( token, qfalse );
-
- continue;
- }
- else if( !Q_stricmp( token, "flashSound" ) )
- {
- int index = 0;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- index = atoi( token );
-
- if( index < 0 )
- index = 0;
- else if( index > 3 )
- index = 3;
-
- token = COM_Parse( text_p );
- if( !token )
- break;
-
- wim->flashSound[ index ] = trap_S_RegisterSound( token, qfalse );
-
- continue;
- }
- else if( !Q_stricmp( token, "}" ) )
- return qtrue; //reached the end of this weapon section
- else
- {
- CG_Printf( S_COLOR_RED "ERROR: unknown token '%s' in weapon section\n", token );
- return qfalse;
- }
- }
-
- return qfalse;
-}
-
-
-/*
-======================
-CG_ParseWeaponFile
-
-Parses a configuration file describing a weapon
-======================
-*/
-static qboolean CG_ParseWeaponFile( const char *filename, weaponInfo_t *wi )
-{
- char *text_p;
- int len;
- char *token;
- char text[ 20000 ];
- fileHandle_t f;
- weaponMode_t weaponMode = WPM_NONE;
-
- // load the file
- len = trap_FS_FOpenFile( filename, &f, FS_READ );
- if( len <= 0 )
- return qfalse;
-
- if( len >= sizeof( text ) - 1 )
- {
- CG_Printf( "File %s too long\n", filename );
- return qfalse;
- }
-
- trap_FS_Read( text, len, f );
- text[ len ] = 0;
- trap_FS_FCloseFile( f );
-
- // parse the text
- text_p = text;
-
- // read optional parameters
- while( 1 )
- {
- token = COM_Parse( &text_p );
-
- if( !token )
- break;
-
- if( !Q_stricmp( token, "" ) )
- break;
-
- if( !Q_stricmp( token, "{" ) )
- {
- if( weaponMode == WPM_NONE )
- {
- CG_Printf( S_COLOR_RED "ERROR: weapon mode section started without a declaration\n" );
- return qfalse;
- }
- else if( !CG_ParseWeaponModeSection( &wi->wim[ weaponMode ], &text_p ) )
- {
- CG_Printf( S_COLOR_RED "ERROR: failed to parse weapon mode section\n" );
- return qfalse;
- }
-
- //start parsing ejectors again
- weaponMode = WPM_NONE;
-
- continue;
- }
- else if( !Q_stricmp( token, "primary" ) )
- {
- weaponMode = WPM_PRIMARY;
- continue;
- }
- else if( !Q_stricmp( token, "secondary" ) )
- {
- weaponMode = WPM_SECONDARY;
- continue;
- }
- else if( !Q_stricmp( token, "tertiary" ) )
- {
- weaponMode = WPM_TERTIARY;
- continue;
- }
- else if( !Q_stricmp( token, "weaponModel" ) )
- {
- char path[ MAX_QPATH ];
-
- token = COM_Parse( &text_p );
- if( !token )
- break;
-
- wi->weaponModel = trap_R_RegisterModel( token );
-
- if( !wi->weaponModel )
- CG_Printf( S_COLOR_RED "ERROR: weapon model not found %s\n", token );
-
- strcpy( path, token );
- COM_StripExtension( path, path, MAX_QPATH );
- strcat( path, "_flash.md3" );
- wi->flashModel = trap_R_RegisterModel( path );
-
- strcpy( path, token );
- COM_StripExtension( path, path, MAX_QPATH );
- strcat( path, "_barrel.md3" );
- wi->barrelModel = trap_R_RegisterModel( path );
-
- strcpy( path, token );
- COM_StripExtension( path, path, MAX_QPATH );
- strcat( path, "_hand.md3" );
- wi->handsModel = trap_R_RegisterModel( path );
-
- if( !wi->handsModel )
- wi->handsModel = trap_R_RegisterModel( "models/weapons2/shotgun/shotgun_hand.md3" );
-
- continue;
- }
- else if( !Q_stricmp( token, "idleSound" ) )
- {
- token = COM_Parse( &text_p );
- if( !token )
- break;
-
- wi->readySound = trap_S_RegisterSound( token, qfalse );
-
- continue;
- }
- else if( !Q_stricmp( token, "icon" ) )
- {
- token = COM_Parse( &text_p );
- if( !token )
- break;
-
- wi->weaponIcon = wi->ammoIcon = trap_R_RegisterShader( token );
-
- if( !wi->weaponIcon )
- CG_Printf( S_COLOR_RED "ERROR: weapon icon not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "crosshair" ) )
- {
- int size = 0;
-
- token = COM_Parse( &text_p );
- if( !token )
- break;
-
- size = atoi( token );
-
- if( size < 0 )
- size = 0;
-
- token = COM_Parse( &text_p );
- if( !token )
- break;
-
- wi->crossHair = trap_R_RegisterShader( token );
- wi->crossHairSize = size;
-
- if( !wi->crossHair )
- CG_Printf( S_COLOR_RED "ERROR: weapon crosshair not found %s\n", token );
-
- continue;
- }
- else if( !Q_stricmp( token, "disableIn3rdPerson" ) )
- {
- wi->disableIn3rdPerson = qtrue;
-
- continue;
- }
-
- Com_Printf( S_COLOR_RED "ERROR: unknown token '%s'\n", token );
- return qfalse;
- }
-
- return qtrue;
-}
-
-/*
-=================
-CG_RegisterWeapon
-=================
-*/
-void CG_RegisterWeapon( int weaponNum )
-{
- weaponInfo_t *weaponInfo;
- char path[ MAX_QPATH ];
- vec3_t mins, maxs;
- int i;
-
- weaponInfo = &cg_weapons[ weaponNum ];
-
- if( weaponNum == 0 )
- return;
-
- if( weaponInfo->registered )
- return;
-
- memset( weaponInfo, 0, sizeof( *weaponInfo ) );
- weaponInfo->registered = qtrue;
-
- if( !BG_FindNameForWeapon( weaponNum ) )
- CG_Error( "Couldn't find weapon %i", weaponNum );
-
- Com_sprintf( path, MAX_QPATH, "models/weapons/%s/weapon.cfg", BG_FindNameForWeapon( weaponNum ) );
-
- weaponInfo->humanName = BG_FindHumanNameForWeapon( weaponNum );
-
- if( !CG_ParseWeaponFile( path, weaponInfo ) )
- Com_Printf( S_COLOR_RED "ERROR: failed to parse %s\n", path );
-
- // calc midpoint for rotation
- trap_R_ModelBounds( weaponInfo->weaponModel, mins, maxs );
- for( i = 0 ; i < 3 ; i++ )
- weaponInfo->weaponMidpoint[ i ] = mins[ i ] + 0.5 * ( maxs[ i ] - mins[ i ] );
-
- //FIXME:
- for( i = WPM_NONE + 1; i < WPM_NUM_WEAPONMODES; i++ )
- weaponInfo->wim[ i ].loopFireSound = qfalse;
-}
-
-/*
-===============
-CG_InitWeapons
-
-Precaches weapons
-===============
-*/
-void CG_InitWeapons( void )
-{
- int i;
-
- memset( cg_weapons, 0, sizeof( cg_weapons ) );
-
- for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
- CG_RegisterWeapon( i );
-
- cgs.media.level2ZapTS = CG_RegisterTrailSystem( "models/weapons/lev2zap/lightning" );
-}
-
-
-/*
-========================================================================================
-
-VIEW WEAPON
-
-========================================================================================
-*/
-
-/*
-=================
-CG_MapTorsoToWeaponFrame
-
-=================
-*/
-static int CG_MapTorsoToWeaponFrame( clientInfo_t *ci, int frame )
-{
-
- // change weapon
- if( frame >= ci->animations[ TORSO_DROP ].firstFrame &&
- frame < ci->animations[ TORSO_DROP ].firstFrame + 9 )
- return frame - ci->animations[ TORSO_DROP ].firstFrame + 6;
-
- // stand attack
- if( frame >= ci->animations[ TORSO_ATTACK ].firstFrame &&
- frame < ci->animations[ TORSO_ATTACK ].firstFrame + 6 )
- return 1 + frame - ci->animations[ TORSO_ATTACK ].firstFrame;
-
- // stand attack 2
- if( frame >= ci->animations[ TORSO_ATTACK2 ].firstFrame &&
- frame < ci->animations[ TORSO_ATTACK2 ].firstFrame + 6 )
- return 1 + frame - ci->animations[ TORSO_ATTACK2 ].firstFrame;
-
- return 0;
-}
-
-
-/*
-==============
-CG_CalculateWeaponPosition
-==============
-*/
-static void CG_CalculateWeaponPosition( vec3_t origin, vec3_t angles )
-{
- float scale;
- int delta;
- float fracsin;
- float bob;
-
- VectorCopy( cg.refdef.vieworg, origin );
- VectorCopy( cg.refdefViewAngles, angles );
-
- // on odd legs, invert some angles
- if( cg.bobcycle & 1 )
- scale = -cg.xyspeed;
- else
- scale = cg.xyspeed;
-
- // gun angles from bobbing
- // bob amount is class dependant
- bob = BG_FindBobForClass( cg.predictedPlayerState.stats[ STAT_PCLASS ] );
-
- if( bob != 0 )
- {
- angles[ ROLL ] += scale * cg.bobfracsin * 0.005;
- angles[ YAW ] += scale * cg.bobfracsin * 0.01;
- angles[ PITCH ] += cg.xyspeed * cg.bobfracsin * 0.005;
- }
-
- // drop the weapon when landing
- if( !BG_ClassHasAbility( cg.predictedPlayerState.stats[ STAT_PCLASS ], SCA_NOWEAPONDRIFT ) )
- {
- delta = cg.time - cg.landTime;
- if( delta < LAND_DEFLECT_TIME )
- origin[ 2 ] += cg.landChange*0.25 * delta / LAND_DEFLECT_TIME;
- else if( delta < LAND_DEFLECT_TIME + LAND_RETURN_TIME )
- origin[ 2 ] += cg.landChange*0.25 *
- ( LAND_DEFLECT_TIME + LAND_RETURN_TIME - delta ) / LAND_RETURN_TIME;
-
- // idle drift
- scale = cg.xyspeed + 40;
- fracsin = sin( cg.time * 0.001 );
- angles[ ROLL ] += scale * fracsin * 0.01;
- angles[ YAW ] += scale * fracsin * 0.01;
- angles[ PITCH ] += scale * fracsin * 0.01;
- }
-}
-
-
-/*
-======================
-CG_MachinegunSpinAngle
-======================
-*/
-#define SPIN_SPEED 0.9
-#define COAST_TIME 1000
-static float CG_MachinegunSpinAngle( centity_t *cent, qboolean firing )
-{
- int delta;
- float angle;
- float speed;
-
- delta = cg.time - cent->pe.barrelTime;
- if( cent->pe.barrelSpinning )
- angle = cent->pe.barrelAngle + delta * SPIN_SPEED;
- else
- {
- if( delta > COAST_TIME )
- delta = COAST_TIME;
-
- speed = 0.5 * ( SPIN_SPEED + (float)( COAST_TIME - delta ) / COAST_TIME );
- angle = cent->pe.barrelAngle + delta * speed;
- }
-
- if( cent->pe.barrelSpinning == !firing )
- {
- cent->pe.barrelTime = cg.time;
- cent->pe.barrelAngle = AngleMod( angle );
- cent->pe.barrelSpinning = firing;
- }
-
- return angle;
-}
-
-
-/*
-=============
-CG_AddPlayerWeapon
-
-Used for both the view weapon (ps is valid) and the world modelother character models (ps is NULL)
-The main player will have this called for BOTH cases, so effects like light and
-sound should only be done on the world model case.
-=============
-*/
-void CG_AddPlayerWeapon( refEntity_t *parent, playerState_t *ps, centity_t *cent )
-{
- refEntity_t gun;
- refEntity_t barrel;
- refEntity_t flash;
- vec3_t angles;
- weapon_t weaponNum;
- weaponMode_t weaponMode;
- weaponInfo_t *weapon;
- qboolean noGunModel;
- qboolean firing;
-
- weaponNum = cent->currentState.weapon;
- weaponMode = cent->currentState.generic1;
-
- if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES )
- weaponMode = WPM_PRIMARY;
-
- if( ( ( cent->currentState.eFlags & EF_FIRING ) && weaponMode == WPM_PRIMARY ) ||
- ( ( cent->currentState.eFlags & EF_FIRING2 ) && weaponMode == WPM_SECONDARY ) ||
- ( ( cent->currentState.eFlags & EF_FIRING3 ) && weaponMode == WPM_TERTIARY ) )
- firing = qtrue;
- else
- firing = qfalse;
-
- CG_RegisterWeapon( weaponNum );
- weapon = &cg_weapons[ weaponNum ];
-
- // add the weapon
- memset( &gun, 0, sizeof( gun ) );
- VectorCopy( parent->lightingOrigin, gun.lightingOrigin );
- gun.shadowPlane = parent->shadowPlane;
- gun.renderfx = parent->renderfx;
-
- // set custom shading for railgun refire rate
- if( ps )
- {
- gun.shaderRGBA[ 0 ] = 255;
- gun.shaderRGBA[ 1 ] = 255;
- gun.shaderRGBA[ 2 ] = 255;
- gun.shaderRGBA[ 3 ] = 255;
-
- //set weapon[1/2]Time when respective buttons change state
- if( cg.weapon1Firing != ( cg.predictedPlayerState.eFlags & EF_FIRING ) )
- {
- cg.weapon1Time = cg.time;
- cg.weapon1Firing = ( cg.predictedPlayerState.eFlags & EF_FIRING );
- }
-
- if( cg.weapon2Firing != ( cg.predictedPlayerState.eFlags & EF_FIRING2 ) )
- {
- cg.weapon2Time = cg.time;
- cg.weapon2Firing = ( cg.predictedPlayerState.eFlags & EF_FIRING2 );
- }
-
- if( cg.weapon3Firing != ( cg.predictedPlayerState.eFlags & EF_FIRING3 ) )
- {
- cg.weapon3Time = cg.time;
- cg.weapon3Firing = ( cg.predictedPlayerState.eFlags & EF_FIRING3 );
- }
- }
-
- gun.hModel = weapon->weaponModel;
-
- noGunModel = ( ( !ps || cg.renderingThirdPerson ) && weapon->disableIn3rdPerson ) || !gun.hModel;
-
- if( !ps )
- {
- // add weapon ready sound
- if( firing && weapon->wim[ weaponMode ].firingSound )
- {
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin,
- weapon->wim[ weaponMode ].firingSound );
- }
- else if( weapon->readySound )
- trap_S_AddLoopingSound( cent->currentState.number, cent->lerpOrigin, vec3_origin, weapon->readySound );
- }
-
- if( !noGunModel )
- {
- CG_PositionEntityOnTag( &gun, parent, parent->hModel, "tag_weapon" );
-
- trap_R_AddRefEntityToScene( &gun );
-
- // add the spinning barrel
- if( weapon->barrelModel )
- {
- memset( &barrel, 0, sizeof( barrel ) );
- VectorCopy( parent->lightingOrigin, barrel.lightingOrigin );
- barrel.shadowPlane = parent->shadowPlane;
- barrel.renderfx = parent->renderfx;
-
- barrel.hModel = weapon->barrelModel;
- angles[ YAW ] = 0;
- angles[ PITCH ] = 0;
- angles[ ROLL ] = CG_MachinegunSpinAngle( cent, firing );
- AnglesToAxis( angles, barrel.axis );
-
- CG_PositionRotatedEntityOnTag( &barrel, &gun, weapon->weaponModel, "tag_barrel" );
-
- trap_R_AddRefEntityToScene( &barrel );
- }
- }
-
- if( CG_IsParticleSystemValid( ¢->muzzlePS ) )
- {
- if( ps || cg.renderingThirdPerson ||
- cent->currentState.number != cg.predictedPlayerState.clientNum )
- {
- if( noGunModel )
- CG_SetAttachmentTag( ¢->muzzlePS->attachment, *parent, parent->hModel, "tag_weapon" );
- else
- CG_SetAttachmentTag( ¢->muzzlePS->attachment, gun, weapon->weaponModel, "tag_flash" );
- }
-
- //if the PS is infinite disable it when not firing
- if( !firing && CG_IsParticleSystemInfinite( cent->muzzlePS ) )
- CG_DestroyParticleSystem( ¢->muzzlePS );
- }
-
- // add the flash
- if( !weapon->wim[ weaponMode ].continuousFlash || !firing )
- {
- // impulse flash
- if( cg.time - cent->muzzleFlashTime > MUZZLE_FLASH_TIME )
- return;
- }
-
- memset( &flash, 0, sizeof( flash ) );
- VectorCopy( parent->lightingOrigin, flash.lightingOrigin );
- flash.shadowPlane = parent->shadowPlane;
- flash.renderfx = parent->renderfx;
-
- flash.hModel = weapon->flashModel;
- if( flash.hModel )
- {
- angles[ YAW ] = 0;
- angles[ PITCH ] = 0;
- angles[ ROLL ] = crandom( ) * 10;
- AnglesToAxis( angles, flash.axis );
-
- if( noGunModel )
- CG_PositionRotatedEntityOnTag( &flash, parent, parent->hModel, "tag_weapon" );
- else
- CG_PositionRotatedEntityOnTag( &flash, &gun, weapon->weaponModel, "tag_flash" );
-
- trap_R_AddRefEntityToScene( &flash );
- }
-
- if( ps || cg.renderingThirdPerson ||
- cent->currentState.number != cg.predictedPlayerState.clientNum )
- {
- if( weapon->wim[ weaponMode ].muzzleParticleSystem && cent->muzzlePsTrigger )
- {
- cent->muzzlePS = CG_SpawnNewParticleSystem( weapon->wim[ weaponMode ].muzzleParticleSystem );
-
- if( CG_IsParticleSystemValid( ¢->muzzlePS ) )
- {
- if( noGunModel )
- CG_SetAttachmentTag( ¢->muzzlePS->attachment, *parent, parent->hModel, "tag_weapon" );
- else
- CG_SetAttachmentTag( ¢->muzzlePS->attachment, gun, weapon->weaponModel, "tag_flash" );
-
- CG_SetAttachmentCent( ¢->muzzlePS->attachment, cent );
- CG_AttachToTag( ¢->muzzlePS->attachment );
- }
-
- cent->muzzlePsTrigger = qfalse;
- }
-
- // make a dlight for the flash
- if( weapon->wim[ weaponMode ].flashDlightColor[ 0 ] ||
- weapon->wim[ weaponMode ].flashDlightColor[ 1 ] ||
- weapon->wim[ weaponMode ].flashDlightColor[ 2 ] )
- {
- trap_R_AddLightToScene( flash.origin, 300 + ( rand( ) & 31 ),
- weapon->wim[ weaponMode ].flashDlightColor[ 0 ],
- weapon->wim[ weaponMode ].flashDlightColor[ 1 ],
- weapon->wim[ weaponMode ].flashDlightColor[ 2 ] );
- }
- }
-}
-
-/*
-==============
-CG_AddViewWeapon
-
-Add the weapon, and flash for the player's view
-==============
-*/
-void CG_AddViewWeapon( playerState_t *ps )
-{
- refEntity_t hand;
- centity_t *cent;
- clientInfo_t *ci;
- float fovOffset;
- vec3_t angles;
- weaponInfo_t *wi;
- weapon_t weapon = ps->weapon;
- weaponMode_t weaponMode = ps->generic1;
-
- if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES )
- weaponMode = WPM_PRIMARY;
-
- CG_RegisterWeapon( weapon );
- wi = &cg_weapons[ weapon ];
- cent = &cg.predictedPlayerEntity; // &cg_entities[cg.snap->ps.clientNum];
-
- if( ( ps->persistant[PERS_TEAM] == TEAM_SPECTATOR ) ||
- ( ps->stats[ STAT_STATE ] & SS_INFESTING ) ||
- ( ps->stats[ STAT_STATE ] & SS_HOVELING ) )
- return;
-
- // no weapon carried - can't draw it
- if( weapon == WP_NONE )
- return;
-
- if( ps->pm_type == PM_INTERMISSION )
- return;
-
- // draw a prospective buildable infront of the player
- if( ( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE )
- CG_GhostBuildable( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT );
-
- if( weapon == WP_LUCIFER_CANNON && ps->stats[ STAT_MISC ] > 0 )
- {
- if( ps->stats[ STAT_MISC ] > ( LCANNON_TOTAL_CHARGE - ( LCANNON_TOTAL_CHARGE / 3 ) ) )
- trap_S_AddLoopingSound( ps->clientNum, ps->origin, vec3_origin, cgs.media.lCannonWarningSound );
- }
-
- // no gun if in third person view
- if( cg.renderingThirdPerson )
- return;
-
- // allow the gun to be completely removed
- if( !cg_drawGun.integer )
- {
- vec3_t origin;
-
- VectorCopy( cg.refdef.vieworg, origin );
- VectorMA( origin, -8, cg.refdef.viewaxis[ 2 ], origin );
-
- if( cent->muzzlePS )
- CG_SetAttachmentPoint( ¢->muzzlePS->attachment, origin );
-
- //check for particle systems
- if( wi->wim[ weaponMode ].muzzleParticleSystem && cent->muzzlePsTrigger )
- {
- cent->muzzlePS = CG_SpawnNewParticleSystem( wi->wim[ weaponMode ].muzzleParticleSystem );
-
- if( CG_IsParticleSystemValid( ¢->muzzlePS ) )
- {
- CG_SetAttachmentPoint( ¢->muzzlePS->attachment, origin );
- CG_SetAttachmentCent( ¢->muzzlePS->attachment, cent );
- CG_AttachToPoint( ¢->muzzlePS->attachment );
- }
- cent->muzzlePsTrigger = qfalse;
- }
-
- return;
- }
-
- // don't draw if testing a gun model
- if( cg.testGun )
- return;
-
- // drop gun lower at higher fov
- if( cg.refdef.fov_y > 90 )
- fovOffset = -0.4 * ( cg.refdef.fov_y - 90 );
- else
- fovOffset = 0;
-
- memset( &hand, 0, sizeof( hand ) );
-
- // set up gun position
- CG_CalculateWeaponPosition( hand.origin, angles );
-
- VectorMA( hand.origin, cg_gun_x.value, cg.refdef.viewaxis[ 0 ], hand.origin );
- VectorMA( hand.origin, cg_gun_y.value, cg.refdef.viewaxis[ 1 ], hand.origin );
- VectorMA( hand.origin, ( cg_gun_z.value + fovOffset ), cg.refdef.viewaxis[ 2 ], hand.origin );
-
- if( weapon == WP_LUCIFER_CANNON && ps->stats[ STAT_MISC ] > 0 )
- {
- float fraction = (float)ps->stats[ STAT_MISC ] / (float)LCANNON_TOTAL_CHARGE;
-
- VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 0 ], hand.origin );
- VectorMA( hand.origin, random( ) * fraction, cg.refdef.viewaxis[ 1 ], hand.origin );
- }
-
- AnglesToAxis( angles, hand.axis );
-
- // map torso animations to weapon animations
- if( cg_gun_frame.integer )
- {
- // development tool
- hand.frame = hand.oldframe = cg_gun_frame.integer;
- hand.backlerp = 0;
- }
- else
- {
- // get clientinfo for animation map
- ci = &cgs.clientinfo[ cent->currentState.clientNum ];
- hand.frame = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.frame );
- hand.oldframe = CG_MapTorsoToWeaponFrame( ci, cent->pe.torso.oldFrame );
- hand.backlerp = cent->pe.torso.backlerp;
- }
-
- hand.hModel = wi->handsModel;
- hand.renderfx = RF_DEPTHHACK | RF_FIRST_PERSON | RF_MINLIGHT;
-
- // add everything onto the hand
- CG_AddPlayerWeapon( &hand, ps, &cg.predictedPlayerEntity );
-}
-
-/*
-==============================================================================
-
-WEAPON SELECTION
-
-==============================================================================
-*/
-
-/*
-===============
-CG_WeaponSelectable
-===============
-*/
-static qboolean CG_WeaponSelectable( weapon_t weapon )
-{
- //int ammo, clips;
- //
- //BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips );
- //
- // this is a pain in the ass
- //if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) )
- // return qfalse;
-
- if( !BG_InventoryContainsWeapon( weapon, cg.snap->ps.stats ) )
- return qfalse;
-
- return qtrue;
-}
-
-
-/*
-===============
-CG_UpgradeSelectable
-===============
-*/
-static qboolean CG_UpgradeSelectable( upgrade_t upgrade )
-{
- if( !BG_InventoryContainsUpgrade( upgrade, cg.snap->ps.stats ) )
- return qfalse;
-
- return BG_FindUsableForUpgrade( upgrade );
-}
-
-
-#define ICON_BORDER 4
-
-/*
-===================
-CG_DrawItemSelect
-===================
-*/
-void CG_DrawItemSelect( rectDef_t *rect, vec4_t color )
-{
- int i;
- int x = rect->x;
- int y = rect->y;
- int width = rect->w;
- int height = rect->h;
- int iconsize;
- int items[ 64 ];
- int numItems = 0, selectedItem = 0;
- int length;
- int selectWindow;
- qboolean vertical;
- centity_t *cent;
- playerState_t *ps;
-
- int colinfo[ 64 ];
-
- cent = &cg_entities[ cg.snap->ps.clientNum ];
- ps = &cg.snap->ps;
-
- // don't display if dead
- if( cg.predictedPlayerState.stats[ STAT_HEALTH ] <= 0 )
- return;
-
- if( !( cg.snap->ps.pm_flags & PMF_FOLLOW ) )
- {
- // first make sure that whatever it selected is actually selectable
- if( cg.weaponSelect <= 32 && !CG_WeaponSelectable( cg.weaponSelect ) )
- CG_NextWeapon_f( );
- else if( cg.weaponSelect > 32 && !CG_UpgradeSelectable( cg.weaponSelect - 32 ) )
- CG_NextWeapon_f( );
- }
-
- // showing weapon select clears pickup item display, but not the blend blob
- cg.itemPickupTime = 0;
-
- if( height > width )
- {
- vertical = qtrue;
- iconsize = width;
- length = height / width;
- }
- else if( height <= width )
- {
- vertical = qfalse;
- iconsize = height;
- length = width / height;
- }
-
- selectWindow = length / 2;
-
- for( i = WP_NONE + 1; i < WP_NUM_WEAPONS; i++ )
- {
- if( !BG_InventoryContainsWeapon( i, cg.snap->ps.stats ) )
- continue;
-
- {
- int ammo, clips;
-
- BG_UnpackAmmoArray( i, cg.snap->ps.ammo, cg.snap->ps.powerups, &ammo, &clips );
-
- if( !ammo && !clips && !BG_FindInfinteAmmoForWeapon( i ) )
- colinfo[ numItems ] = 1;
- else
- colinfo[ numItems ] = 0;
-
- }
-
- if( i == cg.weaponSelect )
- selectedItem = numItems;
-
- CG_RegisterWeapon( i );
- items[ numItems ] = i;
- numItems++;
- }
-
- for( i = UP_NONE + 1; i < UP_NUM_UPGRADES; i++ )
- {
- if( !BG_InventoryContainsUpgrade( i, cg.snap->ps.stats ) )
- continue;
- colinfo[ numItems ] = 0;
- if( !BG_FindUsableForUpgrade ( i ) )
- colinfo[ numItems ] = 2;
-
-
- if( i == cg.weaponSelect - 32 )
- selectedItem = numItems;
-
- CG_RegisterUpgrade( i );
- items[ numItems ] = i + 32;
- numItems++;
- }
-
- for( i = 0; i < length; i++ )
- {
- int displacement = i - selectWindow;
- int item = displacement + selectedItem;
-
- if( ( item >= 0 ) && ( item < numItems ) )
- {
- switch( colinfo[ item ] )
- {
- case 0:
- color = colorCyan;
- break;
- case 1:
- color = colorRed;
- break;
- case 2:
- color = colorMdGrey;
- break;
- }
- color[3] = 0.5;
-
- trap_R_SetColor( color );
-
- if( items[ item ] <= 32 )
- CG_DrawPic( x, y, iconsize, iconsize, cg_weapons[ items[ item ] ].weaponIcon );
- else if( items[ item ] > 32 )
- CG_DrawPic( x, y, iconsize, iconsize, cg_upgrades[ items[ item ] - 32 ].upgradeIcon );
-
- trap_R_SetColor( NULL );
- }
-
- if( vertical )
- y += iconsize;
- else
- x += iconsize;
- }
-}
-
-
-/*
-===================
-CG_DrawItemSelectText
-===================
-*/
-void CG_DrawItemSelectText( rectDef_t *rect, float scale, int textStyle )
-{
- int x, w;
- char *name;
- float *color;
-
- color = CG_FadeColor( cg.weaponSelectTime, WEAPON_SELECT_TIME );
- if( !color )
- return;
-
- trap_R_SetColor( color );
-
- // draw the selected name
- if( cg.weaponSelect <= 32 )
- {
- if( cg_weapons[ cg.weaponSelect ].registered &&
- BG_InventoryContainsWeapon( cg.weaponSelect, cg.snap->ps.stats ) )
- {
- if( ( name = cg_weapons[ cg.weaponSelect ].humanName ) )
- {
- w = CG_Text_Width( name, scale, 0 );
- x = rect->x + rect->w / 2;
- CG_Text_Paint( x - w / 2, rect->y + rect->h, scale, color, name, 0, 0, textStyle );
- }
- }
- }
- else if( cg.weaponSelect > 32 )
- {
- if( cg_upgrades[ cg.weaponSelect - 32 ].registered &&
- BG_InventoryContainsUpgrade( cg.weaponSelect - 32, cg.snap->ps.stats ) )
- {
- if( ( name = cg_upgrades[ cg.weaponSelect - 32 ].humanName ) )
- {
- w = CG_Text_Width( name, scale, 0 );
- x = rect->x + rect->w / 2;
- CG_Text_Paint( x - w / 2, rect->y + rect->h, scale, color, name, 0, 0, textStyle );
- }
- }
- }
-
- trap_R_SetColor( NULL );
-}
-
-
-/*
-===============
-CG_NextWeapon_f
-===============
-*/
-void CG_NextWeapon_f( void )
-{
- int i;
- int original;
-
- if( !cg.snap )
- return;
-
- if( cg.snap->ps.pm_flags & PMF_FOLLOW )
- {
- trap_SendClientCommand( "followprev\n" );
- return;
- }
-
- cg.weaponSelectTime = cg.time;
- original = cg.weaponSelect;
-
- for( i = 0; i < 64; i++ )
- {
- cg.weaponSelect++;
- if( cg.weaponSelect == 64 )
- cg.weaponSelect = 0;
-
- if( cg.weaponSelect <= 32 )
- {
- if( CG_WeaponSelectable( cg.weaponSelect ) )
- break;
- }
- else if( cg.weaponSelect > 32 )
- {
- if( CG_UpgradeSelectable( cg.weaponSelect - 32 ) )
- break;
- }
- }
-
- if( i == 64 )
- cg.weaponSelect = original;
-}
-
-/*
-===============
-CG_PrevWeapon_f
-===============
-*/
-void CG_PrevWeapon_f( void )
-{
- int i;
- int original;
-
- if( !cg.snap )
- return;
-
- if( cg.snap->ps.pm_flags & PMF_FOLLOW )
- {
- trap_SendClientCommand( "follownext\n" );
- return;
- }
-
- cg.weaponSelectTime = cg.time;
- original = cg.weaponSelect;
-
- for( i = 0; i < 64; i++ )
- {
- cg.weaponSelect--;
- if( cg.weaponSelect == -1 )
- cg.weaponSelect = 63;
-
- if( cg.weaponSelect <= 32 )
- {
- if( CG_WeaponSelectable( cg.weaponSelect ) )
- break;
- }
- else if( cg.weaponSelect > 32 )
- {
- if( CG_UpgradeSelectable( cg.weaponSelect - 32 ) )
- break;
- }
- }
-
- if( i == 64 )
- cg.weaponSelect = original;
-}
-
-/*
-===============
-CG_Weapon_f
-===============
-*/
-void CG_Weapon_f( void )
-{
- int num;
-
- if( !cg.snap )
- return;
-
- if( cg.snap->ps.pm_flags & PMF_FOLLOW )
- return;
-
- num = atoi( CG_Argv( 1 ) );
-
- if( num < 1 || num > 31 )
- return;
-
- cg.weaponSelectTime = cg.time;
-
- if( !BG_InventoryContainsWeapon( num, cg.snap->ps.stats ) )
- return; // don't have the weapon
-
- cg.weaponSelect = num;
-}
-
-
-/*
-===================================================================================================
-
-WEAPON EVENTS
-
-===================================================================================================
-*/
-
-/*
-================
-CG_FireWeapon
-
-Caused by an EV_FIRE_WEAPON event
-================
-*/
-void CG_FireWeapon( centity_t *cent, weaponMode_t weaponMode )
-{
- entityState_t *es;
- int c;
- weaponInfo_t *wi;
- weapon_t weaponNum;
-
- es = ¢->currentState;
-
- weaponNum = es->weapon;
-
- if( weaponNum == WP_NONE )
- return;
-
- if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES )
- weaponMode = WPM_PRIMARY;
-
- if( weaponNum >= WP_NUM_WEAPONS )
- {
- CG_Error( "CG_FireWeapon: ent->weapon >= WP_NUM_WEAPONS" );
- return;
- }
-
- wi = &cg_weapons[ weaponNum ];
-
- // mark the entity as muzzle flashing, so when it is added it will
- // append the flash to the weapon model
- cent->muzzleFlashTime = cg.time;
-
- if( wi->wim[ weaponMode ].muzzleParticleSystem )
- {
- if( !CG_IsParticleSystemValid( ¢->muzzlePS ) ||
- !CG_IsParticleSystemInfinite( cent->muzzlePS ) )
- cent->muzzlePsTrigger = qtrue;
- }
-
- // play a sound
- for( c = 0; c < 4; c++ )
- {
- if( !wi->wim[ weaponMode ].flashSound[ c ] )
- break;
- }
-
- if( c > 0 )
- {
- c = rand( ) % c;
- if( wi->wim[ weaponMode ].flashSound[ c ] )
- trap_S_StartSound( NULL, es->number, CHAN_WEAPON, wi->wim[ weaponMode ].flashSound[ c ] );
- }
-}
-
-
-/*
-=================
-CG_MissileHitWall
-
-Caused by an EV_MISSILE_MISS event, or directly by local bullet tracing
-=================
-*/
-void CG_MissileHitWall( weapon_t weaponNum, weaponMode_t weaponMode, int clientNum,
- vec3_t origin, vec3_t dir, impactSound_t soundType )
-{
- qhandle_t mark = 0;
- qhandle_t ps = 0;
- int c;
- float radius = 1.0f;
- weaponInfo_t *weapon = &cg_weapons[ weaponNum ];
-
- if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES )
- weaponMode = WPM_PRIMARY;
-
- mark = weapon->wim[ weaponMode ].impactMark;
- radius = weapon->wim[ weaponMode ].impactMarkSize;
- ps = weapon->wim[ weaponMode ].impactParticleSystem;
-
- if( soundType == IMPACTSOUND_FLESH )
- {
- //flesh sound
- for( c = 0; c < 4; c++ )
- {
- if( !weapon->wim[ weaponMode ].impactFleshSound[ c ] )
- break;
- }
-
- if( c > 0 )
- {
- c = rand( ) % c;
- if( weapon->wim[ weaponMode ].impactFleshSound[ c ] )
- trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, weapon->wim[ weaponMode ].impactFleshSound[ c ] );
- }
- }
- else
- {
- //normal sound
- for( c = 0; c < 4; c++ )
- {
- if( !weapon->wim[ weaponMode ].impactSound[ c ] )
- break;
- }
-
- if( c > 0 )
- {
- c = rand( ) % c;
- if( weapon->wim[ weaponMode ].impactSound[ c ] )
- trap_S_StartSound( origin, ENTITYNUM_WORLD, CHAN_AUTO, weapon->wim[ weaponMode ].impactSound[ c ] );
- }
- }
-
- //create impact particle system
- if( ps )
- {
- particleSystem_t *partSystem = CG_SpawnNewParticleSystem( ps );
-
- if( CG_IsParticleSystemValid( &partSystem ) )
- {
- CG_SetAttachmentPoint( &partSystem->attachment, origin );
- CG_SetParticleSystemNormal( partSystem, dir );
- CG_AttachToPoint( &partSystem->attachment );
- }
- }
-
- //
- // impact mark
- //
- if( radius > 0.0f )
- CG_ImpactMark( mark, origin, dir, random( ) * 360, 1, 1, 1, 1, qfalse, radius, qfalse );
-}
-
-
-/*
-=================
-CG_MissileHitPlayer
-=================
-*/
-void CG_MissileHitPlayer( weapon_t weaponNum, weaponMode_t weaponMode,
- vec3_t origin, vec3_t dir, int entityNum )
-{
- vec3_t normal;
- weaponInfo_t *weapon = &cg_weapons[ weaponNum ];
-
- VectorCopy( dir, normal );
- VectorInverse( normal );
-
- CG_Bleed( origin, normal, entityNum );
-
- if( weaponMode <= WPM_NONE || weaponMode >= WPM_NUM_WEAPONMODES )
- weaponMode = WPM_PRIMARY;
-
- if( weapon->wim[ weaponMode ].alwaysImpact )
- CG_MissileHitWall( weaponNum, weaponMode, 0, origin, dir, IMPACTSOUND_FLESH );
-}
-
-
-/*
-============================================================================
-
-BULLETS
-
-============================================================================
-*/
-
-
-/*
-===============
-CG_Tracer
-===============
-*/
-void CG_Tracer( vec3_t source, vec3_t dest )
-{
- vec3_t forward, right;
- polyVert_t verts[ 4 ];
- vec3_t line;
- float len, begin, end;
- vec3_t start, finish;
- vec3_t midpoint;
-
- // tracer
- VectorSubtract( dest, source, forward );
- len = VectorNormalize( forward );
-
- // start at least a little ways from the muzzle
- if( len < 100 )
- return;
-
- begin = 50 + random( ) * ( len - 60 );
- end = begin + cg_tracerLength.value;
- if( end > len )
- end = len;
-
- VectorMA( source, begin, forward, start );
- VectorMA( source, end, forward, finish );
-
- line[ 0 ] = DotProduct( forward, cg.refdef.viewaxis[ 1 ] );
- line[ 1 ] = DotProduct( forward, cg.refdef.viewaxis[ 2 ] );
-
- VectorScale( cg.refdef.viewaxis[ 1 ], line[ 1 ], right );
- VectorMA( right, -line[ 0 ], cg.refdef.viewaxis[ 2 ], right );
- VectorNormalize( right );
-
- VectorMA( finish, cg_tracerWidth.value, right, verts[ 0 ].xyz );
- verts[ 0 ].st[ 0 ] = 0;
- verts[ 0 ].st[ 1 ] = 1;
- verts[ 0 ].modulate[ 0 ] = 255;
- verts[ 0 ].modulate[ 1 ] = 255;
- verts[ 0 ].modulate[ 2 ] = 255;
- verts[ 0 ].modulate[ 3 ] = 255;
-
- VectorMA( finish, -cg_tracerWidth.value, right, verts[ 1 ].xyz );
- verts[ 1 ].st[ 0 ] = 1;
- verts[ 1 ].st[ 1 ] = 0;
- verts[ 1 ].modulate[ 0 ] = 255;
- verts[ 1 ].modulate[ 1 ] = 255;
- verts[ 1 ].modulate[ 2 ] = 255;
- verts[ 1 ].modulate[ 3 ] = 255;
-
- VectorMA( start, -cg_tracerWidth.value, right, verts[ 2 ].xyz );
- verts[ 2 ].st[ 0 ] = 1;
- verts[ 2 ].st[ 1 ] = 1;
- verts[ 2 ].modulate[ 0 ] = 255;
- verts[ 2 ].modulate[ 1 ] = 255;
- verts[ 2 ].modulate[ 2 ] = 255;
- verts[ 2 ].modulate[ 3 ] = 255;
-
- VectorMA( start, cg_tracerWidth.value, right, verts[ 3 ].xyz );
- verts[ 3 ].st[ 0 ] = 0;
- verts[ 3 ].st[ 1 ] = 0;
- verts[ 3 ].modulate[ 0 ] = 255;
- verts[ 3 ].modulate[ 1 ] = 255;
- verts[ 3 ].modulate[ 2 ] = 255;
- verts[ 3 ].modulate[ 3 ] = 255;
-
- trap_R_AddPolyToScene( cgs.media.tracerShader, 4, verts );
-
- midpoint[ 0 ] = ( start[ 0 ] + finish[ 0 ] ) * 0.5;
- midpoint[ 1 ] = ( start[ 1 ] + finish[ 1 ] ) * 0.5;
- midpoint[ 2 ] = ( start[ 2 ] + finish[ 2 ] ) * 0.5;
-
- // add the tracer sound
- trap_S_StartSound( midpoint, ENTITYNUM_WORLD, CHAN_AUTO, cgs.media.tracerSound );
-}
-
-
-/*
-======================
-CG_CalcMuzzlePoint
-======================
-*/
-static qboolean CG_CalcMuzzlePoint( int entityNum, vec3_t muzzle )
-{
- vec3_t forward;
- centity_t *cent;
- int anim;
-
- if( entityNum == cg.snap->ps.clientNum )
- {
- VectorCopy( cg.snap->ps.origin, muzzle );
- muzzle[ 2 ] += cg.snap->ps.viewheight;
- AngleVectors( cg.snap->ps.viewangles, forward, NULL, NULL );
- VectorMA( muzzle, 14, forward, muzzle );
- return qtrue;
- }
-
- cent = &cg_entities[entityNum];
-
- if( !cent->currentValid )
- return qfalse;
-
- VectorCopy( cent->currentState.pos.trBase, muzzle );
-
- AngleVectors( cent->currentState.apos.trBase, forward, NULL, NULL );
- anim = cent->currentState.legsAnim & ~ANIM_TOGGLEBIT;
-
- if( anim == LEGS_WALKCR || anim == LEGS_IDLECR )
- muzzle[ 2 ] += CROUCH_VIEWHEIGHT;
- else
- muzzle[ 2 ] += DEFAULT_VIEWHEIGHT;
-
- VectorMA( muzzle, 14, forward, muzzle );
-
- return qtrue;
-
-}
-
-
-/*
-======================
-CG_Bullet
-
-Renders bullet effects.
-======================
-*/
-void CG_Bullet( vec3_t end, int sourceEntityNum, vec3_t normal, qboolean flesh, int fleshEntityNum )
-{
- vec3_t start;
-
- // if the shooter is currently valid, calc a source point and possibly
- // do trail effects
- if( sourceEntityNum >= 0 && cg_tracerChance.value > 0 )
- {
- if( CG_CalcMuzzlePoint( sourceEntityNum, start ) )
- {
- // draw a tracer
- if( random( ) < cg_tracerChance.value )
- CG_Tracer( start, end );
- }
- }
-
- // impact splash and mark
- if( flesh )
- CG_Bleed( end, normal, fleshEntityNum );
- else
- CG_MissileHitWall( WP_MACHINEGUN, WPM_PRIMARY, 0, end, normal, IMPACTSOUND_DEFAULT );
-}
-
-/*
-============================================================================
-
-SHOTGUN TRACING
-
-============================================================================
-*/
-
-/*
-================
-CG_ShotgunPattern
-
-Perform the same traces the server did to locate the
-hit splashes
-================
-*/
-static void CG_ShotgunPattern( vec3_t origin, vec3_t origin2, int seed, int otherEntNum )
-{
- int i;
- float r, u;
- vec3_t end;
- vec3_t forward, right, up;
- trace_t tr;
-
- // derive the right and up vectors from the forward vector, because
- // the client won't have any other information
- VectorNormalize2( origin2, forward );
- PerpendicularVector( right, forward );
- CrossProduct( forward, right, up );
-
- // generate the "random" spread pattern
- for( i = 0; i < SHOTGUN_PELLETS; i++ )
- {
- r = Q_crandom( &seed ) * SHOTGUN_SPREAD * 16;
- u = Q_crandom( &seed ) * SHOTGUN_SPREAD * 16;
- VectorMA( origin, 8192 * 16, forward, end );
- VectorMA( end, r, right, end );
- VectorMA( end, u, up, end );
-
- CG_Trace( &tr, origin, NULL, NULL, end, otherEntNum, MASK_SHOT );
-
- if( !( tr.surfaceFlags & SURF_NOIMPACT ) )
- {
- if( cg_entities[ tr.entityNum ].currentState.eType == ET_PLAYER )
- CG_MissileHitPlayer( WP_SHOTGUN, WPM_PRIMARY, tr.endpos, tr.plane.normal, tr.entityNum );
- else if( tr.surfaceFlags & SURF_METALSTEPS )
- CG_MissileHitWall( WP_SHOTGUN, WPM_PRIMARY, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_METAL );
- else
- CG_MissileHitWall( WP_SHOTGUN, WPM_PRIMARY, 0, tr.endpos, tr.plane.normal, IMPACTSOUND_DEFAULT );
- }
- }
-}
-
-/*
-==============
-CG_ShotgunFire
-==============
-*/
-void CG_ShotgunFire( entityState_t *es )
-{
- vec3_t v;
-
- VectorSubtract( es->origin2, es->pos.trBase, v );
- VectorNormalize( v );
- VectorScale( v, 32, v );
- VectorAdd( es->pos.trBase, v, v );
-
- CG_ShotgunPattern( es->pos.trBase, es->origin2, es->eventParm, es->otherEntityNum );
-}
-
diff --git a/src/client/cl_avi.c b/src/client/cl_avi.c
deleted file mode 100644
index c54e705..0000000
--- a/src/client/cl_avi.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2005-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "client.h"
-#include "snd_local.h"
-
-#define INDEX_FILE_EXTENSION ".index.dat"
-
-#define MAX_RIFF_CHUNKS 16
-
-typedef struct audioFormat_s
-{
- int rate;
- int format;
- int channels;
- int bits;
-
- int sampleSize;
- int totalBytes;
-} audioFormat_t;
-
-typedef struct aviFileData_s
-{
- qboolean fileOpen;
- fileHandle_t f;
- char fileName[ MAX_QPATH ];
- int fileSize;
- int moviOffset;
- int moviSize;
-
- fileHandle_t idxF;
- int numIndices;
-
- int frameRate;
- int framePeriod;
- int width, height;
- int numVideoFrames;
- int maxRecordSize;
- qboolean motionJpeg;
-
- qboolean audio;
- audioFormat_t a;
- int numAudioFrames;
-
- int chunkStack[ MAX_RIFF_CHUNKS ];
- int chunkStackTop;
-
- byte *cBuffer, *eBuffer;
-} aviFileData_t;
-
-static aviFileData_t afd;
-
-#define MAX_AVI_BUFFER 2048
-
-static byte buffer[ MAX_AVI_BUFFER ];
-static int bufIndex;
-
-/*
-===============
-SafeFS_Write
-===============
-*/
-static ID_INLINE void SafeFS_Write( const void *buffer, int len, fileHandle_t f )
-{
- if( FS_Write( buffer, len, f ) < len )
- Com_Error( ERR_DROP, "Failed to write avi file\n" );
-}
-
-/*
-===============
-WRITE_STRING
-===============
-*/
-static ID_INLINE void WRITE_STRING( const char *s )
-{
- Com_Memcpy( &buffer[ bufIndex ], s, strlen( s ) );
- bufIndex += strlen( s );
-}
-
-/*
-===============
-WRITE_4BYTES
-===============
-*/
-static ID_INLINE void WRITE_4BYTES( int x )
-{
- buffer[ bufIndex + 0 ] = (byte)( ( x >> 0 ) & 0xFF );
- buffer[ bufIndex + 1 ] = (byte)( ( x >> 8 ) & 0xFF );
- buffer[ bufIndex + 2 ] = (byte)( ( x >> 16 ) & 0xFF );
- buffer[ bufIndex + 3 ] = (byte)( ( x >> 24 ) & 0xFF );
- bufIndex += 4;
-}
-
-/*
-===============
-WRITE_2BYTES
-===============
-*/
-static ID_INLINE void WRITE_2BYTES( int x )
-{
- buffer[ bufIndex + 0 ] = (byte)( ( x >> 0 ) & 0xFF );
- buffer[ bufIndex + 1 ] = (byte)( ( x >> 8 ) & 0xFF );
- bufIndex += 2;
-}
-
-/*
-===============
-WRITE_1BYTES
-===============
-*/
-static ID_INLINE void WRITE_1BYTES( int x )
-{
- buffer[ bufIndex ] = x;
- bufIndex += 1;
-}
-
-/*
-===============
-START_CHUNK
-===============
-*/
-static ID_INLINE void START_CHUNK( const char *s )
-{
- if( afd.chunkStackTop == MAX_RIFF_CHUNKS )
- {
- Com_Error( ERR_DROP, "ERROR: Top of chunkstack breached\n" );
- }
-
- afd.chunkStack[ afd.chunkStackTop ] = bufIndex;
- afd.chunkStackTop++;
- WRITE_STRING( s );
- WRITE_4BYTES( 0 );
-}
-
-/*
-===============
-END_CHUNK
-===============
-*/
-static ID_INLINE void END_CHUNK( void )
-{
- int endIndex = bufIndex;
-
- if( afd.chunkStackTop <= 0 )
- {
- Com_Error( ERR_DROP, "ERROR: Bottom of chunkstack breached\n" );
- }
-
- afd.chunkStackTop--;
- bufIndex = afd.chunkStack[ afd.chunkStackTop ];
- bufIndex += 4;
- WRITE_4BYTES( endIndex - bufIndex - 4 );
- bufIndex = endIndex;
- bufIndex = PAD( bufIndex, 2 );
-}
-
-/*
-===============
-CL_WriteAVIHeader
-===============
-*/
-void CL_WriteAVIHeader( void )
-{
- bufIndex = 0;
- afd.chunkStackTop = 0;
-
- START_CHUNK( "RIFF" );
- {
- WRITE_STRING( "AVI " );
- {
- START_CHUNK( "LIST" );
- {
- WRITE_STRING( "hdrl" );
- WRITE_STRING( "avih" );
- WRITE_4BYTES( 56 ); //"avih" "chunk" size
- WRITE_4BYTES( afd.framePeriod ); //dwMicroSecPerFrame
- WRITE_4BYTES( afd.maxRecordSize *
- afd.frameRate ); //dwMaxBytesPerSec
- WRITE_4BYTES( 0 ); //dwReserved1
- WRITE_4BYTES( 0x110 ); //dwFlags bits HAS_INDEX and IS_INTERLEAVED
- WRITE_4BYTES( afd.numVideoFrames ); //dwTotalFrames
- WRITE_4BYTES( 0 ); //dwInitialFrame
-
- if( afd.audio ) //dwStreams
- WRITE_4BYTES( 2 );
- else
- WRITE_4BYTES( 1 );
-
- WRITE_4BYTES( afd.maxRecordSize ); //dwSuggestedBufferSize
- WRITE_4BYTES( afd.width ); //dwWidth
- WRITE_4BYTES( afd.height ); //dwHeight
- WRITE_4BYTES( 0 ); //dwReserved[ 0 ]
- WRITE_4BYTES( 0 ); //dwReserved[ 1 ]
- WRITE_4BYTES( 0 ); //dwReserved[ 2 ]
- WRITE_4BYTES( 0 ); //dwReserved[ 3 ]
-
- START_CHUNK( "LIST" );
- {
- WRITE_STRING( "strl" );
- WRITE_STRING( "strh" );
- WRITE_4BYTES( 56 ); //"strh" "chunk" size
- WRITE_STRING( "vids" );
-
- if( afd.motionJpeg )
- WRITE_STRING( "MJPG" );
- else
- WRITE_4BYTES( 0 ); // BI_RGB
-
- WRITE_4BYTES( 0 ); //dwFlags
- WRITE_4BYTES( 0 ); //dwPriority
- WRITE_4BYTES( 0 ); //dwInitialFrame
-
- WRITE_4BYTES( 1 ); //dwTimescale
- WRITE_4BYTES( afd.frameRate ); //dwDataRate
- WRITE_4BYTES( 0 ); //dwStartTime
- WRITE_4BYTES( afd.numVideoFrames ); //dwDataLength
-
- WRITE_4BYTES( afd.maxRecordSize ); //dwSuggestedBufferSize
- WRITE_4BYTES( -1 ); //dwQuality
- WRITE_4BYTES( 0 ); //dwSampleSize
- WRITE_2BYTES( 0 ); //rcFrame
- WRITE_2BYTES( 0 ); //rcFrame
- WRITE_2BYTES( afd.width ); //rcFrame
- WRITE_2BYTES( afd.height ); //rcFrame
-
- WRITE_STRING( "strf" );
- WRITE_4BYTES( 40 ); //"strf" "chunk" size
- WRITE_4BYTES( 40 ); //biSize
- WRITE_4BYTES( afd.width ); //biWidth
- WRITE_4BYTES( afd.height ); //biHeight
- WRITE_2BYTES( 1 ); //biPlanes
- WRITE_2BYTES( 24 ); //biBitCount
-
- if( afd.motionJpeg ) { //biCompression
- WRITE_STRING( "MJPG" );
- WRITE_4BYTES( afd.width *
- afd.height ); //biSizeImage
- } else {
- WRITE_4BYTES( 0 ); // BI_RGB
- WRITE_4BYTES( afd.width *
- afd.height*3 ); //biSizeImage
- }
-
- WRITE_4BYTES( 0 ); //biXPelsPetMeter
- WRITE_4BYTES( 0 ); //biYPelsPetMeter
- WRITE_4BYTES( 0 ); //biClrUsed
- WRITE_4BYTES( 0 ); //biClrImportant
- }
- END_CHUNK( );
-
- if( afd.audio )
- {
- START_CHUNK( "LIST" );
- {
- WRITE_STRING( "strl" );
- WRITE_STRING( "strh" );
- WRITE_4BYTES( 56 ); //"strh" "chunk" size
- WRITE_STRING( "auds" );
- WRITE_4BYTES( 0 ); //FCC
- WRITE_4BYTES( 0 ); //dwFlags
- WRITE_4BYTES( 0 ); //dwPriority
- WRITE_4BYTES( 0 ); //dwInitialFrame
-
- WRITE_4BYTES( afd.a.sampleSize ); //dwTimescale
- WRITE_4BYTES( afd.a.sampleSize *
- afd.a.rate ); //dwDataRate
- WRITE_4BYTES( 0 ); //dwStartTime
- WRITE_4BYTES( afd.a.totalBytes /
- afd.a.sampleSize ); //dwDataLength
-
- WRITE_4BYTES( 0 ); //dwSuggestedBufferSize
- WRITE_4BYTES( -1 ); //dwQuality
- WRITE_4BYTES( afd.a.sampleSize ); //dwSampleSize
- WRITE_2BYTES( 0 ); //rcFrame
- WRITE_2BYTES( 0 ); //rcFrame
- WRITE_2BYTES( 0 ); //rcFrame
- WRITE_2BYTES( 0 ); //rcFrame
-
- WRITE_STRING( "strf" );
- WRITE_4BYTES( 18 ); //"strf" "chunk" size
- WRITE_2BYTES( afd.a.format ); //wFormatTag
- WRITE_2BYTES( afd.a.channels ); //nChannels
- WRITE_4BYTES( afd.a.rate ); //nSamplesPerSec
- WRITE_4BYTES( afd.a.sampleSize *
- afd.a.rate ); //nAvgBytesPerSec
- WRITE_2BYTES( afd.a.sampleSize ); //nBlockAlign
- WRITE_2BYTES( afd.a.bits ); //wBitsPerSample
- WRITE_2BYTES( 0 ); //cbSize
- }
- END_CHUNK( );
- }
- }
- END_CHUNK( );
-
- afd.moviOffset = bufIndex;
-
- START_CHUNK( "LIST" );
- {
- WRITE_STRING( "movi" );
- }
- }
- }
-}
-
-/*
-===============
-CL_OpenAVIForWriting
-
-Creates an AVI file and gets it into a state where
-writing the actual data can begin
-===============
-*/
-qboolean CL_OpenAVIForWriting( const char *fileName )
-{
- if( afd.fileOpen )
- return qfalse;
-
- Com_Memset( &afd, 0, sizeof( aviFileData_t ) );
-
- // Don't start if a framerate has not been chosen
- if( cl_aviFrameRate->integer <= 0 )
- {
- Com_Printf( S_COLOR_RED "cl_aviFrameRate must be >= 1\n" );
- return qfalse;
- }
-
- if( ( afd.f = FS_FOpenFileWrite( fileName ) ) <= 0 )
- return qfalse;
-
- if( ( afd.idxF = FS_FOpenFileWrite(
- va( "%s" INDEX_FILE_EXTENSION, fileName ) ) ) <= 0 )
- {
- FS_FCloseFile( afd.f );
- return qfalse;
- }
-
- Q_strncpyz( afd.fileName, fileName, MAX_QPATH );
-
- afd.frameRate = cl_aviFrameRate->integer;
- afd.framePeriod = (int)( 1000000.0f / afd.frameRate );
- afd.width = cls.glconfig.vidWidth;
- afd.height = cls.glconfig.vidHeight;
-
- if( cl_aviMotionJpeg->integer )
- afd.motionJpeg = qtrue;
- else
- afd.motionJpeg = qfalse;
-
- afd.cBuffer = Z_Malloc( afd.width * afd.height * 4 );
- afd.eBuffer = Z_Malloc( afd.width * afd.height * 4 );
-
- afd.a.rate = dma.speed;
- afd.a.format = WAV_FORMAT_PCM;
- afd.a.channels = dma.channels;
- afd.a.bits = dma.samplebits;
- afd.a.sampleSize = ( afd.a.bits / 8 ) * afd.a.channels;
-
- if( afd.a.rate % afd.frameRate )
- {
- int suggestRate = afd.frameRate;
-
- while( ( afd.a.rate % suggestRate ) && suggestRate >= 1 )
- suggestRate--;
-
- Com_Printf( S_COLOR_YELLOW "WARNING: cl_aviFrameRate is not a divisor "
- "of the audio rate, suggest %d\n", suggestRate );
- }
-
- if( !Cvar_VariableIntegerValue( "s_initsound" ) )
- {
- afd.audio = qfalse;
- }
- else if( Q_stricmp( Cvar_VariableString( "s_backend" ), "OpenAL" ) )
- {
- if( afd.a.bits == 16 && afd.a.channels == 2 )
- afd.audio = qtrue;
- else
- afd.audio = qfalse; //FIXME: audio not implemented for this case
- }
- else
- {
- afd.audio = qfalse;
- Com_Printf( S_COLOR_YELLOW "WARNING: Audio capture is not supported "
- "with OpenAL. Set s_useOpenAL to 0 for audio capture\n" );
- }
-
- // This doesn't write a real header, but allocates the
- // correct amount of space at the beginning of the file
- CL_WriteAVIHeader( );
-
- SafeFS_Write( buffer, bufIndex, afd.f );
- afd.fileSize = bufIndex;
-
- bufIndex = 0;
- START_CHUNK( "idx1" );
- SafeFS_Write( buffer, bufIndex, afd.idxF );
-
- afd.moviSize = 4; // For the "movi"
- afd.fileOpen = qtrue;
-
- return qtrue;
-}
-
-/*
-===============
-CL_CheckFileSize
-===============
-*/
-static qboolean CL_CheckFileSize( int bytesToAdd )
-{
- unsigned int newFileSize;
-
- newFileSize =
- afd.fileSize + // Current file size
- bytesToAdd + // What we want to add
- ( afd.numIndices * 16 ) + // The index
- 4; // The index size
-
- // I assume all the operating systems
- // we target can handle a 2Gb file
- if( newFileSize > INT_MAX )
- {
- // Close the current file...
- CL_CloseAVI( );
-
- // ...And open a new one
- CL_OpenAVIForWriting( va( "%s_", afd.fileName ) );
-
- return qtrue;
- }
-
- return qfalse;
-}
-
-/*
-===============
-CL_WriteAVIVideoFrame
-===============
-*/
-void CL_WriteAVIVideoFrame( const byte *imageBuffer, int size )
-{
- int chunkOffset = afd.fileSize - afd.moviOffset - 8;
- int chunkSize = 8 + size;
- int paddingSize = PAD( size, 2 ) - size;
- byte padding[ 4 ] = { 0 };
-
- if( !afd.fileOpen )
- return;
-
- // Chunk header + contents + padding
- if( CL_CheckFileSize( 8 + size + 2 ) )
- return;
-
- bufIndex = 0;
- WRITE_STRING( "00dc" );
- WRITE_4BYTES( size );
-
- SafeFS_Write( buffer, 8, afd.f );
- SafeFS_Write( imageBuffer, size, afd.f );
- SafeFS_Write( padding, paddingSize, afd.f );
- afd.fileSize += ( chunkSize + paddingSize );
-
- afd.numVideoFrames++;
- afd.moviSize += ( chunkSize + paddingSize );
-
- if( size > afd.maxRecordSize )
- afd.maxRecordSize = size;
-
- // Index
- bufIndex = 0;
- WRITE_STRING( "00dc" ); //dwIdentifier
- WRITE_4BYTES( 0x00000010 ); //dwFlags (all frames are KeyFrames)
- WRITE_4BYTES( chunkOffset ); //dwOffset
- WRITE_4BYTES( size ); //dwLength
- SafeFS_Write( buffer, 16, afd.idxF );
-
- afd.numIndices++;
-}
-
-#define PCM_BUFFER_SIZE 44100
-
-/*
-===============
-CL_WriteAVIAudioFrame
-===============
-*/
-void CL_WriteAVIAudioFrame( const byte *pcmBuffer, int size )
-{
- static byte pcmCaptureBuffer[ PCM_BUFFER_SIZE ] = { 0 };
- static int bytesInBuffer = 0;
-
- if( !afd.audio )
- return;
-
- if( !afd.fileOpen )
- return;
-
- // Chunk header + contents + padding
- if( CL_CheckFileSize( 8 + bytesInBuffer + size + 2 ) )
- return;
-
- if( bytesInBuffer + size > PCM_BUFFER_SIZE )
- {
- Com_Printf( S_COLOR_YELLOW
- "WARNING: Audio capture buffer overflow -- truncating\n" );
- size = PCM_BUFFER_SIZE - bytesInBuffer;
- }
-
- Com_Memcpy( &pcmCaptureBuffer[ bytesInBuffer ], pcmBuffer, size );
- bytesInBuffer += size;
-
- // Only write if we have a frame's worth of audio
- if( bytesInBuffer >= (int)ceil( (float)afd.a.rate / (float)afd.frameRate ) *
- afd.a.sampleSize )
- {
- int chunkOffset = afd.fileSize - afd.moviOffset - 8;
- int chunkSize = 8 + bytesInBuffer;
- int paddingSize = PAD( bytesInBuffer, 2 ) - bytesInBuffer;
- byte padding[ 4 ] = { 0 };
-
- bufIndex = 0;
- WRITE_STRING( "01wb" );
- WRITE_4BYTES( bytesInBuffer );
-
- SafeFS_Write( buffer, 8, afd.f );
- SafeFS_Write( pcmBuffer, bytesInBuffer, afd.f );
- SafeFS_Write( padding, paddingSize, afd.f );
- afd.fileSize += ( chunkSize + paddingSize );
-
- afd.numAudioFrames++;
- afd.moviSize += ( chunkSize + paddingSize );
- afd.a.totalBytes =+ bytesInBuffer;
-
- // Index
- bufIndex = 0;
- WRITE_STRING( "01wb" ); //dwIdentifier
- WRITE_4BYTES( 0 ); //dwFlags
- WRITE_4BYTES( chunkOffset ); //dwOffset
- WRITE_4BYTES( bytesInBuffer ); //dwLength
- SafeFS_Write( buffer, 16, afd.idxF );
-
- afd.numIndices++;
-
- bytesInBuffer = 0;
- }
-}
-
-/*
-===============
-CL_TakeVideoFrame
-===============
-*/
-void CL_TakeVideoFrame( void )
-{
- // AVI file isn't open
- if( !afd.fileOpen )
- return;
-
- re.TakeVideoFrame( afd.width, afd.height,
- afd.cBuffer, afd.eBuffer, afd.motionJpeg );
-}
-
-/*
-===============
-CL_CloseAVI
-
-Closes the AVI file and writes an index chunk
-===============
-*/
-qboolean CL_CloseAVI( void )
-{
- int indexRemainder;
- int indexSize = afd.numIndices * 16;
- const char *idxFileName = va( "%s" INDEX_FILE_EXTENSION, afd.fileName );
-
- // AVI file isn't open
- if( !afd.fileOpen )
- return qfalse;
-
- afd.fileOpen = qfalse;
-
- FS_Seek( afd.idxF, 4, FS_SEEK_SET );
- bufIndex = 0;
- WRITE_4BYTES( indexSize );
- SafeFS_Write( buffer, bufIndex, afd.idxF );
- FS_FCloseFile( afd.idxF );
-
- // Write index
-
- // Open the temp index file
- if( ( indexSize = FS_FOpenFileRead( idxFileName,
- &afd.idxF, qtrue ) ) <= 0 )
- {
- FS_FCloseFile( afd.f );
- return qfalse;
- }
-
- indexRemainder = indexSize;
-
- // Append index to end of avi file
- while( indexRemainder > MAX_AVI_BUFFER )
- {
- FS_Read( buffer, MAX_AVI_BUFFER, afd.idxF );
- SafeFS_Write( buffer, MAX_AVI_BUFFER, afd.f );
- afd.fileSize += MAX_AVI_BUFFER;
- indexRemainder -= MAX_AVI_BUFFER;
- }
- FS_Read( buffer, indexRemainder, afd.idxF );
- SafeFS_Write( buffer, indexRemainder, afd.f );
- afd.fileSize += indexRemainder;
- FS_FCloseFile( afd.idxF );
-
- // Remove temp index file
- FS_HomeRemove( idxFileName );
-
- // Write the real header
- FS_Seek( afd.f, 0, FS_SEEK_SET );
- CL_WriteAVIHeader( );
-
- bufIndex = 4;
- WRITE_4BYTES( afd.fileSize - 8 ); // "RIFF" size
-
- bufIndex = afd.moviOffset + 4; // Skip "LIST"
- WRITE_4BYTES( afd.moviSize );
-
- SafeFS_Write( buffer, bufIndex, afd.f );
-
- Z_Free( afd.cBuffer );
- Z_Free( afd.eBuffer );
- FS_FCloseFile( afd.f );
-
- Com_Printf( "Wrote %d:%d frames to %s\n", afd.numVideoFrames, afd.numAudioFrames, afd.fileName );
-
- return qtrue;
-}
-
-/*
-===============
-CL_VideoRecording
-===============
-*/
-qboolean CL_VideoRecording( void )
-{
- return afd.fileOpen;
-}
diff --git a/src/client/cl_cgame.c b/src/client/cl_cgame.c
deleted file mode 100644
index 68b34c6..0000000
--- a/src/client/cl_cgame.c
+++ /dev/null
@@ -1,1072 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// cl_cgame.c -- client system interaction with client game
-
-#include "client.h"
-
-extern qboolean loadCamera(const char *name);
-extern void startCamera(int time);
-extern qboolean getCameraInfo(int time, vec3_t *origin, vec3_t *angles);
-
-/*
-====================
-CL_GetGameState
-====================
-*/
-void CL_GetGameState( gameState_t *gs ) {
- *gs = cl.gameState;
-}
-
-/*
-====================
-CL_GetGlconfig
-====================
-*/
-void CL_GetGlconfig( glconfig_t *glconfig ) {
- *glconfig = cls.glconfig;
-}
-
-
-/*
-====================
-CL_GetUserCmd
-====================
-*/
-qboolean CL_GetUserCmd( int cmdNumber, usercmd_t *ucmd ) {
- // cmds[cmdNumber] is the last properly generated command
-
- // can't return anything that we haven't created yet
- if ( cmdNumber > cl.cmdNumber ) {
- Com_Error( ERR_DROP, "CL_GetUserCmd: %i >= %i", cmdNumber, cl.cmdNumber );
- }
-
- // the usercmd has been overwritten in the wrapping
- // buffer because it is too far out of date
- if ( cmdNumber <= cl.cmdNumber - CMD_BACKUP ) {
- return qfalse;
- }
-
- *ucmd = cl.cmds[ cmdNumber & CMD_MASK ];
-
- return qtrue;
-}
-
-int CL_GetCurrentCmdNumber( void ) {
- return cl.cmdNumber;
-}
-
-
-/*
-====================
-CL_GetParseEntityState
-====================
-*/
-qboolean CL_GetParseEntityState( int parseEntityNumber, entityState_t *state ) {
- // can't return anything that hasn't been parsed yet
- if ( parseEntityNumber >= cl.parseEntitiesNum ) {
- Com_Error( ERR_DROP, "CL_GetParseEntityState: %i >= %i",
- parseEntityNumber, cl.parseEntitiesNum );
- }
-
- // can't return anything that has been overwritten in the circular buffer
- if ( parseEntityNumber <= cl.parseEntitiesNum - MAX_PARSE_ENTITIES ) {
- return qfalse;
- }
-
- *state = cl.parseEntities[ parseEntityNumber & ( MAX_PARSE_ENTITIES - 1 ) ];
- return qtrue;
-}
-
-/*
-====================
-CL_GetCurrentSnapshotNumber
-====================
-*/
-void CL_GetCurrentSnapshotNumber( int *snapshotNumber, int *serverTime ) {
- *snapshotNumber = cl.snap.messageNum;
- *serverTime = cl.snap.serverTime;
-}
-
-/*
-====================
-CL_GetSnapshot
-====================
-*/
-qboolean CL_GetSnapshot( int snapshotNumber, snapshot_t *snapshot ) {
- clSnapshot_t *clSnap;
- int i, count;
-
- if ( snapshotNumber > cl.snap.messageNum ) {
- Com_Error( ERR_DROP, "CL_GetSnapshot: snapshotNumber > cl.snapshot.messageNum" );
- }
-
- // if the frame has fallen out of the circular buffer, we can't return it
- if ( cl.snap.messageNum - snapshotNumber >= PACKET_BACKUP ) {
- return qfalse;
- }
-
- // if the frame is not valid, we can't return it
- clSnap = &cl.snapshots[snapshotNumber & PACKET_MASK];
- if ( !clSnap->valid ) {
- return qfalse;
- }
-
- // if the entities in the frame have fallen out of their
- // circular buffer, we can't return it
- if ( cl.parseEntitiesNum - clSnap->parseEntitiesNum >= MAX_PARSE_ENTITIES ) {
- return qfalse;
- }
-
- // write the snapshot
- snapshot->snapFlags = clSnap->snapFlags;
- snapshot->serverCommandSequence = clSnap->serverCommandNum;
- snapshot->ping = clSnap->ping;
- snapshot->serverTime = clSnap->serverTime;
- Com_Memcpy( snapshot->areamask, clSnap->areamask, sizeof( snapshot->areamask ) );
- snapshot->ps = clSnap->ps;
- count = clSnap->numEntities;
- if ( count > MAX_ENTITIES_IN_SNAPSHOT ) {
- Com_DPrintf( "CL_GetSnapshot: truncated %i entities to %i\n", count, MAX_ENTITIES_IN_SNAPSHOT );
- count = MAX_ENTITIES_IN_SNAPSHOT;
- }
- snapshot->numEntities = count;
- for ( i = 0 ; i < count ; i++ ) {
- snapshot->entities[i] =
- cl.parseEntities[ ( clSnap->parseEntitiesNum + i ) & (MAX_PARSE_ENTITIES-1) ];
- }
-
- // FIXME: configstring changes and server commands!!!
-
- return qtrue;
-}
-
-/*
-=====================
-CL_SetUserCmdValue
-=====================
-*/
-void CL_SetUserCmdValue( int userCmdValue, float sensitivityScale ) {
- cl.cgameUserCmdValue = userCmdValue;
- cl.cgameSensitivity = sensitivityScale;
-}
-
-/*
-=====================
-CL_AddCgameCommand
-=====================
-*/
-void CL_AddCgameCommand( const char *cmdName ) {
- Cmd_AddCommand( cmdName, NULL );
-}
-
-/*
-=====================
-CL_CgameError
-=====================
-*/
-void CL_CgameError( const char *string ) {
- Com_Error( ERR_DROP, "%s", string );
-}
-
-
-/*
-=====================
-CL_ConfigstringModified
-=====================
-*/
-void CL_ConfigstringModified( void ) {
- char *old, *s;
- int i, index;
- char *dup;
- gameState_t oldGs;
- int len;
-
- index = atoi( Cmd_Argv(1) );
- if ( index < 0 || index >= MAX_CONFIGSTRINGS ) {
- Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
- }
- // get everything after "cs "
- s = Cmd_ArgsFrom(2);
-
- old = cl.gameState.stringData + cl.gameState.stringOffsets[ index ];
- if ( !strcmp( old, s ) ) {
- return; // unchanged
- }
-
- // build the new gameState_t
- oldGs = cl.gameState;
-
- Com_Memset( &cl.gameState, 0, sizeof( cl.gameState ) );
-
- // leave the first 0 for uninitialized strings
- cl.gameState.dataCount = 1;
-
- for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) {
- if ( i == index ) {
- dup = s;
- } else {
- dup = oldGs.stringData + oldGs.stringOffsets[ i ];
- }
- if ( !dup[0] ) {
- continue; // leave with the default empty string
- }
-
- len = strlen( dup );
-
- if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {
- Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );
- }
-
- // append it to the gameState string buffer
- cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;
- Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, dup, len + 1 );
- cl.gameState.dataCount += len + 1;
- }
-
- if ( index == CS_SYSTEMINFO ) {
- // parse serverId and other cvars
- CL_SystemInfoChanged();
- }
-
-}
-
-
-/*
-===================
-CL_GetServerCommand
-
-Set up argc/argv for the given command
-===================
-*/
-qboolean CL_GetServerCommand( int serverCommandNumber ) {
- char *s;
- char *cmd;
- static char bigConfigString[BIG_INFO_STRING];
- int argc;
-
- // if we have irretrievably lost a reliable command, drop the connection
- if ( serverCommandNumber <= clc.serverCommandSequence - MAX_RELIABLE_COMMANDS ) {
- // when a demo record was started after the client got a whole bunch of
- // reliable commands then the client never got those first reliable commands
- if ( clc.demoplaying )
- return qfalse;
- Com_Error( ERR_DROP, "CL_GetServerCommand: a reliable command was cycled out" );
- return qfalse;
- }
-
- if ( serverCommandNumber > clc.serverCommandSequence ) {
- Com_Error( ERR_DROP, "CL_GetServerCommand: requested a command not received" );
- return qfalse;
- }
-
- s = clc.serverCommands[ serverCommandNumber & ( MAX_RELIABLE_COMMANDS - 1 ) ];
- clc.lastExecutedServerCommand = serverCommandNumber;
-
- Com_DPrintf( "serverCommand: %i : %s\n", serverCommandNumber, s );
-
-rescan:
- Cmd_TokenizeString( s );
- cmd = Cmd_Argv(0);
- argc = Cmd_Argc();
-
- if ( !strcmp( cmd, "disconnect" ) ) {
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=552
- // allow server to indicate why they were disconnected
- if ( argc >= 2 )
- Com_Error (ERR_SERVERDISCONNECT, va( "Server Disconnected - %s", Cmd_Argv( 1 ) ) );
- else
- Com_Error (ERR_SERVERDISCONNECT,"Server disconnected\n");
- }
-
- if ( !strcmp( cmd, "bcs0" ) ) {
- Com_sprintf( bigConfigString, BIG_INFO_STRING, "cs %s \"%s", Cmd_Argv(1), Cmd_Argv(2) );
- return qfalse;
- }
-
- if ( !strcmp( cmd, "bcs1" ) ) {
- s = Cmd_Argv(2);
- if( strlen(bigConfigString) + strlen(s) >= BIG_INFO_STRING ) {
- Com_Error( ERR_DROP, "bcs exceeded BIG_INFO_STRING" );
- }
- strcat( bigConfigString, s );
- return qfalse;
- }
-
- if ( !strcmp( cmd, "bcs2" ) ) {
- s = Cmd_Argv(2);
- if( strlen(bigConfigString) + strlen(s) + 1 >= BIG_INFO_STRING ) {
- Com_Error( ERR_DROP, "bcs exceeded BIG_INFO_STRING" );
- }
- strcat( bigConfigString, s );
- strcat( bigConfigString, "\"" );
- s = bigConfigString;
- goto rescan;
- }
-
- if ( !strcmp( cmd, "cs" ) ) {
- CL_ConfigstringModified();
- // reparse the string, because CL_ConfigstringModified may have done another Cmd_TokenizeString()
- Cmd_TokenizeString( s );
- return qtrue;
- }
-
- if ( !strcmp( cmd, "map_restart" ) ) {
- // clear notify lines and outgoing commands before passing
- // the restart to the cgame
- Con_ClearNotify();
- Com_Memset( cl.cmds, 0, sizeof( cl.cmds ) );
- return qtrue;
- }
-
- // the clientLevelShot command is used during development
- // to generate 128*128 screenshots from the intermission
- // point of levels for the menu system to use
- // we pass it along to the cgame to make apropriate adjustments,
- // but we also clear the console and notify lines here
- if ( !strcmp( cmd, "clientLevelShot" ) ) {
- // don't do it if we aren't running the server locally,
- // otherwise malicious remote servers could overwrite
- // the existing thumbnails
- if ( !com_sv_running->integer ) {
- return qfalse;
- }
- // close the console
- Con_Close();
- // take a special screenshot next frame
- Cbuf_AddText( "wait ; wait ; wait ; wait ; screenshot levelshot\n" );
- return qtrue;
- }
-
- // we may want to put a "connect to other server" command here
-
- // cgame can now act on the command
- return qtrue;
-}
-
-
-/*
-====================
-CL_CM_LoadMap
-
-Just adds default parameters that cgame doesn't need to know about
-====================
-*/
-void CL_CM_LoadMap( const char *mapname ) {
- int checksum;
-
- CM_LoadMap( mapname, qtrue, &checksum );
-}
-
-/*
-====================
-CL_ShutdonwCGame
-
-====================
-*/
-void CL_ShutdownCGame( void ) {
- cls.keyCatchers &= ~KEYCATCH_CGAME;
- cls.cgameStarted = qfalse;
- if ( !cgvm ) {
- return;
- }
- VM_Call( cgvm, CG_SHUTDOWN );
- VM_Free( cgvm );
- cgvm = NULL;
-}
-
-static int FloatAsInt( float f ) {
- int temp;
-
- *(float *)&temp = f;
-
- return temp;
-}
-
-/*
-====================
-CL_CgameSystemCalls
-
-The cgame module is making a system call
-====================
-*/
-intptr_t CL_CgameSystemCalls( intptr_t *args ) {
- switch( args[0] ) {
- case CG_PRINT:
- Com_Printf( "%s", (const char*)VMA(1) );
- return 0;
- case CG_ERROR:
- Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
- return 0;
- case CG_MILLISECONDS:
- return Sys_Milliseconds();
- case CG_CVAR_REGISTER:
- Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] );
- return 0;
- case CG_CVAR_UPDATE:
- Cvar_Update( VMA(1) );
- return 0;
- case CG_CVAR_SET:
- Cvar_Set( VMA(1), VMA(2) );
- return 0;
- case CG_CVAR_VARIABLESTRINGBUFFER:
- Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
- return 0;
- case CG_ARGC:
- return Cmd_Argc();
- case CG_ARGV:
- Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
- return 0;
- case CG_ARGS:
- Cmd_ArgsBuffer( VMA(1), args[2] );
- return 0;
- case CG_LITERAL_ARGS:
- Cmd_LiteralArgsBuffer( VMA(1), args[2] );
- return 0;
- case CG_FS_FOPENFILE:
- return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );
- case CG_FS_READ:
- FS_Read2( VMA(1), args[2], args[3] );
- return 0;
- case CG_FS_WRITE:
- FS_Write( VMA(1), args[2], args[3] );
- return 0;
- case CG_FS_FCLOSEFILE:
- FS_FCloseFile( args[1] );
- return 0;
- case CG_FS_SEEK:
- return FS_Seek( args[1], args[2], args[3] );
- case CG_FS_GETFILELIST:
- return FS_GetFileList( VMA(1), VMA(2), VMA(3), args[4] );
- case CG_SENDCONSOLECOMMAND:
- Cbuf_AddText( VMA(1) );
- return 0;
- case CG_ADDCOMMAND:
- CL_AddCgameCommand( VMA(1) );
- return 0;
- case CG_REMOVECOMMAND:
- Cmd_RemoveCommand( VMA(1) );
- return 0;
- case CG_SENDCLIENTCOMMAND:
- CL_AddReliableCommand( VMA(1) );
- return 0;
- case CG_UPDATESCREEN:
- // this is used during lengthy level loading, so pump message loop
-// Com_EventLoop(); // FIXME: if a server restarts here, BAD THINGS HAPPEN!
-// We can't call Com_EventLoop here, a restart will crash and this _does_ happen
-// if there is a map change while we are downloading at pk3.
-// ZOID
- SCR_UpdateScreen();
- return 0;
- case CG_CM_LOADMAP:
- CL_CM_LoadMap( VMA(1) );
- return 0;
- case CG_CM_NUMINLINEMODELS:
- return CM_NumInlineModels();
- case CG_CM_INLINEMODEL:
- return CM_InlineModel( args[1] );
- case CG_CM_TEMPBOXMODEL:
- return CM_TempBoxModel( VMA(1), VMA(2), /*int capsule*/ qfalse );
- case CG_CM_TEMPCAPSULEMODEL:
- return CM_TempBoxModel( VMA(1), VMA(2), /*int capsule*/ qtrue );
- case CG_CM_POINTCONTENTS:
- return CM_PointContents( VMA(1), args[2] );
- case CG_CM_TRANSFORMEDPOINTCONTENTS:
- return CM_TransformedPointContents( VMA(1), args[2], VMA(3), VMA(4) );
- case CG_CM_BOXTRACE:
- CM_BoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], TT_AABB );
- return 0;
- case CG_CM_CAPSULETRACE:
- CM_BoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5), args[6], args[7], TT_CAPSULE );
- return 0;
- case CG_CM_TRANSFORMEDBOXTRACE:
- CM_TransformedBoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5),
- args[6], args[7], VMA(8), VMA(9), TT_AABB );
- return 0;
- case CG_CM_TRANSFORMEDCAPSULETRACE:
- CM_TransformedBoxTrace( VMA(1), VMA(2), VMA(3), VMA(4), VMA(5),
- args[6], args[7], VMA(8), VMA(9), TT_CAPSULE );
- return 0;
- case CG_CM_BISPHERETRACE:
- CM_BiSphereTrace( VMA(1), VMA(2), VMA(3), VMF(4), VMF(5), args[6], args[7] );
- return 0;
- case CG_CM_TRANSFORMEDBISPHERETRACE:
- CM_TransformedBiSphereTrace( VMA(1), VMA(2), VMA(3), VMF(4), VMF(5),
- args[6], args[7], VMA(8) );
- return 0;
- case CG_CM_MARKFRAGMENTS:
- return re.MarkFragments( args[1], VMA(2), VMA(3), args[4], VMA(5), args[6], VMA(7) );
- case CG_S_STARTSOUND:
- S_StartSound( VMA(1), args[2], args[3], args[4] );
- return 0;
- case CG_S_STARTLOCALSOUND:
- S_StartLocalSound( args[1], args[2] );
- return 0;
- case CG_S_CLEARLOOPINGSOUNDS:
- S_ClearLoopingSounds(args[1]);
- return 0;
- case CG_S_ADDLOOPINGSOUND:
- S_AddLoopingSound( args[1], VMA(2), VMA(3), args[4] );
- return 0;
- case CG_S_ADDREALLOOPINGSOUND:
- S_AddRealLoopingSound( args[1], VMA(2), VMA(3), args[4] );
- return 0;
- case CG_S_STOPLOOPINGSOUND:
- S_StopLoopingSound( args[1] );
- return 0;
- case CG_S_UPDATEENTITYPOSITION:
- S_UpdateEntityPosition( args[1], VMA(2) );
- return 0;
- case CG_S_RESPATIALIZE:
- S_Respatialize( args[1], VMA(2), VMA(3), args[4] );
- return 0;
- case CG_S_REGISTERSOUND:
- return S_RegisterSound( VMA(1), args[2] );
- case CG_S_STARTBACKGROUNDTRACK:
- S_StartBackgroundTrack( VMA(1), VMA(2) );
- return 0;
- case CG_R_LOADWORLDMAP:
- re.LoadWorld( VMA(1) );
- return 0;
- case CG_R_REGISTERMODEL:
- return re.RegisterModel( VMA(1) );
- case CG_R_REGISTERSKIN:
- return re.RegisterSkin( VMA(1) );
- case CG_R_REGISTERSHADER:
- return re.RegisterShader( VMA(1) );
- case CG_R_REGISTERSHADERNOMIP:
- return re.RegisterShaderNoMip( VMA(1) );
- case CG_R_REGISTERFONT:
- re.RegisterFont( VMA(1), args[2], VMA(3));
- case CG_R_CLEARSCENE:
- re.ClearScene();
- return 0;
- case CG_R_ADDREFENTITYTOSCENE:
- re.AddRefEntityToScene( VMA(1) );
- return 0;
- case CG_R_ADDPOLYTOSCENE:
- re.AddPolyToScene( args[1], args[2], VMA(3), 1 );
- return 0;
- case CG_R_ADDPOLYSTOSCENE:
- re.AddPolyToScene( args[1], args[2], VMA(3), args[4] );
- return 0;
- case CG_R_LIGHTFORPOINT:
- return re.LightForPoint( VMA(1), VMA(2), VMA(3), VMA(4) );
- case CG_R_ADDLIGHTTOSCENE:
- re.AddLightToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5) );
- return 0;
- case CG_R_ADDADDITIVELIGHTTOSCENE:
- re.AddAdditiveLightToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5) );
- return 0;
- case CG_R_RENDERSCENE:
- re.RenderScene( VMA(1) );
- return 0;
- case CG_R_SETCOLOR:
- re.SetColor( VMA(1) );
- return 0;
- case CG_R_DRAWSTRETCHPIC:
- re.DrawStretchPic( VMF(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), VMF(7), VMF(8), args[9] );
- return 0;
- case CG_R_MODELBOUNDS:
- re.ModelBounds( args[1], VMA(2), VMA(3) );
- return 0;
- case CG_R_LERPTAG:
- return re.LerpTag( VMA(1), args[2], args[3], args[4], VMF(5), VMA(6) );
- case CG_GETGLCONFIG:
- CL_GetGlconfig( VMA(1) );
- return 0;
- case CG_GETGAMESTATE:
- CL_GetGameState( VMA(1) );
- return 0;
- case CG_GETCURRENTSNAPSHOTNUMBER:
- CL_GetCurrentSnapshotNumber( VMA(1), VMA(2) );
- return 0;
- case CG_GETSNAPSHOT:
- return CL_GetSnapshot( args[1], VMA(2) );
- case CG_GETSERVERCOMMAND:
- return CL_GetServerCommand( args[1] );
- case CG_GETCURRENTCMDNUMBER:
- return CL_GetCurrentCmdNumber();
- case CG_GETUSERCMD:
- return CL_GetUserCmd( args[1], VMA(2) );
- case CG_SETUSERCMDVALUE:
- CL_SetUserCmdValue( args[1], VMF(2) );
- return 0;
- case CG_MEMORY_REMAINING:
- return Hunk_MemoryRemaining();
- case CG_KEY_ISDOWN:
- return Key_IsDown( args[1] );
- case CG_KEY_GETCATCHER:
- return Key_GetCatcher();
- case CG_KEY_SETCATCHER:
- Key_SetCatcher( args[1] );
- return 0;
- case CG_KEY_GETKEY:
- return Key_GetKey( VMA(1) );
-
- case CG_GETDEMOSTATE:
- return CL_DemoState( );
- case CG_GETDEMOPOS:
- return CL_DemoPos( );
- case CG_GETDEMONAME:
- CL_DemoName( VMA(1), args[2] );
- return 0;
-
- case CG_KEY_KEYNUMTOSTRINGBUF:
- Key_KeynumToStringBuf( args[1], VMA(2), args[3] );
- return 0;
- case CG_KEY_GETBINDINGBUF:
- Key_GetBindingBuf( args[1], VMA(2), args[3] );
- return 0;
- case CG_KEY_SETBINDING:
- Key_SetBinding( args[1], VMA(2) );
- return 0;
-
- case CG_PARSE_ADD_GLOBAL_DEFINE:
- return Parse_AddGlobalDefine( VMA(1) );
- case CG_PARSE_LOAD_SOURCE:
- return Parse_LoadSourceHandle( VMA(1) );
- case CG_PARSE_FREE_SOURCE:
- return Parse_FreeSourceHandle( args[1] );
- case CG_PARSE_READ_TOKEN:
- return Parse_ReadTokenHandle( args[1], VMA(2) );
- case CG_PARSE_SOURCE_FILE_AND_LINE:
- return Parse_SourceFileAndLine( args[1], VMA(2), VMA(3) );
-
- case CG_MEMSET:
- Com_Memset( VMA(1), args[2], args[3] );
- return 0;
- case CG_MEMCPY:
- Com_Memcpy( VMA(1), VMA(2), args[3] );
- return 0;
- case CG_STRNCPY:
- strncpy( VMA(1), VMA(2), args[3] );
- return args[1];
- case CG_SIN:
- return FloatAsInt( sin( VMF(1) ) );
- case CG_COS:
- return FloatAsInt( cos( VMF(1) ) );
- case CG_ATAN2:
- return FloatAsInt( atan2( VMF(1), VMF(2) ) );
- case CG_SQRT:
- return FloatAsInt( sqrt( VMF(1) ) );
- case CG_FLOOR:
- return FloatAsInt( floor( VMF(1) ) );
- case CG_CEIL:
- return FloatAsInt( ceil( VMF(1) ) );
- case CG_ACOS:
- return FloatAsInt( Q_acos( VMF(1) ) );
-
- case CG_S_STOPBACKGROUNDTRACK:
- S_StopBackgroundTrack();
- return 0;
-
- case CG_REAL_TIME:
- return Com_RealTime( VMA(1) );
- case CG_SNAPVECTOR:
- Sys_SnapVector( VMA(1) );
- return 0;
-
- case CG_CIN_PLAYCINEMATIC:
- return CIN_PlayCinematic(VMA(1), args[2], args[3], args[4], args[5], args[6]);
-
- case CG_CIN_STOPCINEMATIC:
- return CIN_StopCinematic(args[1]);
-
- case CG_CIN_RUNCINEMATIC:
- return CIN_RunCinematic(args[1]);
-
- case CG_CIN_DRAWCINEMATIC:
- CIN_DrawCinematic(args[1]);
- return 0;
-
- case CG_CIN_SETEXTENTS:
- CIN_SetExtents(args[1], args[2], args[3], args[4], args[5]);
- return 0;
-
- case CG_R_REMAP_SHADER:
- re.RemapShader( VMA(1), VMA(2), VMA(3) );
- return 0;
-
-/*
- case CG_LOADCAMERA:
- return loadCamera(VMA(1));
-
- case CG_STARTCAMERA:
- startCamera(args[1]);
- return 0;
-
- case CG_GETCAMERAINFO:
- return getCameraInfo(args[1], VMA(2), VMA(3));
-*/
- case CG_GET_ENTITY_TOKEN:
- return re.GetEntityToken( VMA(1), args[2] );
- case CG_R_INPVS:
- return re.inPVS( VMA(1), VMA(2) );
-
- default:
- assert(0); // bk010102
- Com_Error( ERR_DROP, "Bad cgame system trap: %ld", (long int) args[0] );
- }
- return 0;
-}
-
-
-/*
-====================
-CL_InitCGame
-
-Should only be called by CL_StartHunkUsers
-====================
-*/
-void CL_InitCGame( void ) {
- const char *info;
- const char *mapname;
- int t1, t2;
- vmInterpret_t interpret;
-
- t1 = Sys_Milliseconds();
-
- // put away the console
- Con_Close();
-
- // find the current mapname
- info = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SERVERINFO ];
- mapname = Info_ValueForKey( info, "mapname" );
- Com_sprintf( cl.mapname, sizeof( cl.mapname ), "maps/%s.bsp", mapname );
-
- // load the dll or bytecode
- if ( cl_connectedToPureServer != 0 ) {
- // if sv_pure is set we only allow qvms to be loaded
- interpret = VMI_COMPILED;
- }
- else {
- interpret = Cvar_VariableValue( "vm_cgame" );
- }
- cgvm = VM_Create( "cgame", CL_CgameSystemCalls, interpret );
- if ( !cgvm ) {
- Com_Error( ERR_DROP, "VM_Create on cgame failed" );
- }
- cls.state = CA_LOADING;
-
- // init for this gamestate
- // use the lastExecutedServerCommand instead of the serverCommandSequence
- // otherwise server commands sent just before a gamestate are dropped
- VM_Call( cgvm, CG_INIT, clc.serverMessageSequence, clc.lastExecutedServerCommand, clc.clientNum );
-
- // reset any CVAR_CHEAT cvars registered by cgame
- if ( !clc.demoplaying && !cl_connectedToCheatServer )
- Cvar_SetCheatState();
-
- // we will send a usercmd this frame, which
- // will cause the server to send us the first snapshot
- cls.state = CA_PRIMED;
-
- t2 = Sys_Milliseconds();
-
- Com_Printf( "CL_InitCGame: %5.2f seconds\n", (t2-t1)/1000.0 );
-
- // have the renderer touch all its images, so they are present
- // on the card even if the driver does deferred loading
- re.EndRegistration();
-
- // make sure everything is paged in
- if (!Sys_LowPhysicalMemory()) {
- Com_TouchMemory();
- }
-
- // clear anything that got printed
- Con_ClearNotify ();
-}
-
-
-/*
-====================
-CL_GameCommand
-
-See if the current console command is claimed by the cgame
-====================
-*/
-qboolean CL_GameCommand( void ) {
- if ( !cgvm ) {
- return qfalse;
- }
-
- return VM_Call( cgvm, CG_CONSOLE_COMMAND );
-}
-
-/*
-====================
-CL_GameConsoleText
-====================
-*/
-void CL_GameConsoleText( void ) {
- if ( !cgvm ) {
- return;
- }
-
- VM_Call( cgvm, CG_CONSOLE_TEXT );
-}
-
-
-/*
-=====================
-CL_CGameRendering
-=====================
-*/
-void CL_CGameRendering( stereoFrame_t stereo ) {
- VM_Call( cgvm, CG_DRAW_ACTIVE_FRAME, cl.serverTime, stereo, clc.demoplaying );
- VM_Debug( 0 );
-}
-
-
-/*
-=================
-CL_AdjustTimeDelta
-
-Adjust the clients view of server time.
-
-We attempt to have cl.serverTime exactly equal the server's view
-of time plus the timeNudge, but with variable latencies over
-the internet it will often need to drift a bit to match conditions.
-
-Our ideal time would be to have the adjusted time approach, but not pass,
-the very latest snapshot.
-
-Adjustments are only made when a new snapshot arrives with a rational
-latency, which keeps the adjustment process framerate independent and
-prevents massive overadjustment during times of significant packet loss
-or bursted delayed packets.
-=================
-*/
-
-#define RESET_TIME 500
-
-void CL_AdjustTimeDelta( void ) {
- int resetTime;
- int newDelta;
- int deltaDelta;
-
- cl.newSnapshots = qfalse;
-
- // the delta never drifts when replaying a demo
- if ( clc.demoplaying ) {
- return;
- }
-
- // if the current time is WAY off, just correct to the current value
- if ( com_sv_running->integer ) {
- resetTime = 100;
- } else {
- resetTime = RESET_TIME;
- }
-
- newDelta = cl.snap.serverTime - cls.realtime;
- deltaDelta = abs( newDelta - cl.serverTimeDelta );
-
- if ( deltaDelta > RESET_TIME ) {
- cl.serverTimeDelta = newDelta;
- cl.oldServerTime = cl.snap.serverTime; // FIXME: is this a problem for cgame?
- cl.serverTime = cl.snap.serverTime;
- if ( cl_showTimeDelta->integer ) {
- Com_Printf( " " );
- }
- } else if ( deltaDelta > 100 ) {
- // fast adjust, cut the difference in half
- if ( cl_showTimeDelta->integer ) {
- Com_Printf( " " );
- }
- cl.serverTimeDelta = ( cl.serverTimeDelta + newDelta ) >> 1;
- } else {
- // slow drift adjust, only move 1 or 2 msec
-
- // if any of the frames between this and the previous snapshot
- // had to be extrapolated, nudge our sense of time back a little
- // the granularity of +1 / -2 is too high for timescale modified frametimes
- if ( com_timescale->value == 0 || com_timescale->value == 1 ) {
- if ( cl.extrapolatedSnapshot ) {
- cl.extrapolatedSnapshot = qfalse;
- cl.serverTimeDelta -= 2;
- } else {
- // otherwise, move our sense of time forward to minimize total latency
- cl.serverTimeDelta++;
- }
- }
- }
-
- if ( cl_showTimeDelta->integer ) {
- Com_Printf( "%i ", cl.serverTimeDelta );
- }
-}
-
-
-/*
-==================
-CL_FirstSnapshot
-==================
-*/
-void CL_FirstSnapshot( void ) {
- // ignore snapshots that don't have entities
- if ( cl.snap.snapFlags & SNAPFLAG_NOT_ACTIVE ) {
- return;
- }
- cls.state = CA_ACTIVE;
-
- // set the timedelta so we are exactly on this first frame
- cl.serverTimeDelta = cl.snap.serverTime - cls.realtime;
- cl.oldServerTime = cl.snap.serverTime;
-
- clc.timeDemoBaseTime = cl.snap.serverTime;
-
- // if this is the first frame of active play,
- // execute the contents of activeAction now
- // this is to allow scripting a timedemo to start right
- // after loading
- if ( cl_activeAction->string[0] ) {
- Cbuf_AddText( cl_activeAction->string );
- Cvar_Set( "activeAction", "" );
- }
-
- Sys_BeginProfiling();
-}
-
-/*
-==================
-CL_SetCGameTime
-==================
-*/
-void CL_SetCGameTime( void ) {
- // getting a valid frame message ends the connection process
- if ( cls.state != CA_ACTIVE ) {
- if ( cls.state != CA_PRIMED ) {
- return;
- }
- if ( clc.demoplaying ) {
- // we shouldn't get the first snapshot on the same frame
- // as the gamestate, because it causes a bad time skip
- if ( !clc.firstDemoFrameSkipped ) {
- clc.firstDemoFrameSkipped = qtrue;
- return;
- }
- CL_ReadDemoMessage();
- }
- if ( cl.newSnapshots ) {
- cl.newSnapshots = qfalse;
- CL_FirstSnapshot();
- }
- if ( cls.state != CA_ACTIVE ) {
- return;
- }
- }
-
- // if we have gotten to this point, cl.snap is guaranteed to be valid
- if ( !cl.snap.valid ) {
- Com_Error( ERR_DROP, "CL_SetCGameTime: !cl.snap.valid" );
- }
-
- // allow pause in single player
- if ( sv_paused->integer && CL_CheckPaused() && com_sv_running->integer ) {
- // paused
- return;
- }
-
- if ( cl.snap.serverTime < cl.oldFrameServerTime ) {
- Com_Error( ERR_DROP, "cl.snap.serverTime < cl.oldFrameServerTime" );
- }
- cl.oldFrameServerTime = cl.snap.serverTime;
-
-
- // get our current view of time
-
- if ( clc.demoplaying && cl_freezeDemo->integer ) {
- // cl_freezeDemo is used to lock a demo in place for single frame advances
-
- } else {
- // cl_timeNudge is a user adjustable cvar that allows more
- // or less latency to be added in the interest of better
- // smoothness or better responsiveness.
- int tn;
-
- tn = cl_timeNudge->integer;
- if (tn<-30) {
- tn = -30;
- } else if (tn>30) {
- tn = 30;
- }
-
- cl.serverTime = cls.realtime + cl.serverTimeDelta - tn;
-
- // guarantee that time will never flow backwards, even if
- // serverTimeDelta made an adjustment or cl_timeNudge was changed
- if ( cl.serverTime < cl.oldServerTime ) {
- cl.serverTime = cl.oldServerTime;
- }
- cl.oldServerTime = cl.serverTime;
-
- // note if we are almost past the latest frame (without timeNudge),
- // so we will try and adjust back a bit when the next snapshot arrives
- if ( cls.realtime + cl.serverTimeDelta >= cl.snap.serverTime - 5 ) {
- cl.extrapolatedSnapshot = qtrue;
- }
- }
-
- // if we have gotten new snapshots, drift serverTimeDelta
- // don't do this every frame, or a period of packet loss would
- // make a huge adjustment
- if ( cl.newSnapshots ) {
- CL_AdjustTimeDelta();
- }
-
- if ( !clc.demoplaying ) {
- return;
- }
-
- // if we are playing a demo back, we can just keep reading
- // messages from the demo file until the cgame definately
- // has valid snapshots to interpolate between
-
- // a timedemo will always use a deterministic set of time samples
- // no matter what speed machine it is run on,
- // while a normal demo may have different time samples
- // each time it is played back
- if ( cl_timedemo->integer ) {
- if (!clc.timeDemoStart) {
- clc.timeDemoStart = Sys_Milliseconds();
- }
- clc.timeDemoFrames++;
- cl.serverTime = clc.timeDemoBaseTime + clc.timeDemoFrames * 50;
- }
-
- while ( cl.serverTime >= cl.snap.serverTime ) {
- // feed another messag, which should change
- // the contents of cl.snap
- CL_ReadDemoMessage();
- if ( cls.state != CA_ACTIVE ) {
- return; // end of demo
- }
- }
-
-}
-
-
-
diff --git a/src/client/cl_cin.c b/src/client/cl_cin.c
deleted file mode 100644
index 1d8a5f8..0000000
--- a/src/client/cl_cin.c
+++ /dev/null
@@ -1,1658 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-/*****************************************************************************
- * name: cl_cin.c
- *
- * desc: video and cinematic playback
- *
- * $Archive: /MissionPack/code/client/cl_cin.c $
- *
- * cl_glconfig.hwtype trtypes 3dfx/ragepro need 256x256
- *
- *****************************************************************************/
-
-#include "client.h"
-#include "snd_local.h"
-
-#define MAXSIZE 8
-#define MINSIZE 4
-
-#define DEFAULT_CIN_WIDTH 512
-#define DEFAULT_CIN_HEIGHT 512
-
-#define ROQ_QUAD 0x1000
-#define ROQ_QUAD_INFO 0x1001
-#define ROQ_CODEBOOK 0x1002
-#define ROQ_QUAD_VQ 0x1011
-#define ROQ_QUAD_JPEG 0x1012
-#define ROQ_QUAD_HANG 0x1013
-#define ROQ_PACKET 0x1030
-#define ZA_SOUND_MONO 0x1020
-#define ZA_SOUND_STEREO 0x1021
-
-#define MAX_VIDEO_HANDLES 16
-
-extern glconfig_t glConfig;
-extern int s_paintedtime;
-extern int s_rawend;
-
-
-static void RoQ_init( void );
-
-/******************************************************************************
-*
-* Class: trFMV
-*
-* Description: RoQ/RnR manipulation routines
-* not entirely complete for first run
-*
-******************************************************************************/
-
-static long ROQ_YY_tab[256];
-static long ROQ_UB_tab[256];
-static long ROQ_UG_tab[256];
-static long ROQ_VG_tab[256];
-static long ROQ_VR_tab[256];
-static unsigned short vq2[256*16*4];
-static unsigned short vq4[256*64*4];
-static unsigned short vq8[256*256*4];
-
-
-typedef struct {
- byte linbuf[DEFAULT_CIN_WIDTH*DEFAULT_CIN_HEIGHT*4*2];
- byte file[65536];
- short sqrTable[256];
-
- int mcomp[256];
- byte *qStatus[2][32768];
-
- long oldXOff, oldYOff, oldysize, oldxsize;
-
- int currentHandle;
-} cinematics_t;
-
-typedef struct {
- char fileName[MAX_OSPATH];
- int CIN_WIDTH, CIN_HEIGHT;
- int xpos, ypos, width, height;
- qboolean looping, holdAtEnd, dirty, alterGameState, silent, shader;
- fileHandle_t iFile;
- e_status status;
- unsigned int startTime;
- unsigned int lastTime;
- long tfps;
- long RoQPlayed;
- long ROQSize;
- unsigned int RoQFrameSize;
- long onQuad;
- long numQuads;
- long samplesPerLine;
- unsigned int roq_id;
- long screenDelta;
-
- void ( *VQ0)(byte *status, void *qdata );
- void ( *VQ1)(byte *status, void *qdata );
- void ( *VQNormal)(byte *status, void *qdata );
- void ( *VQBuffer)(byte *status, void *qdata );
-
- long samplesPerPixel; // defaults to 2
- byte* gray;
- unsigned int xsize, ysize, maxsize, minsize;
-
- qboolean half, smootheddouble, inMemory;
- long normalBuffer0;
- long roq_flags;
- long roqF0;
- long roqF1;
- long t[2];
- long roqFPS;
- int playonwalls;
- byte* buf;
- long drawX, drawY;
-} cin_cache;
-
-static cinematics_t cin;
-static cin_cache cinTable[MAX_VIDEO_HANDLES];
-static int currentHandle = -1;
-static int CL_handle = -1;
-
-extern int s_soundtime; // sample PAIRS
-extern int s_paintedtime; // sample PAIRS
-
-
-void CIN_CloseAllVideos(void) {
- int i;
-
- for ( i = 0 ; i < MAX_VIDEO_HANDLES ; i++ ) {
- if (cinTable[i].fileName[0] != 0 ) {
- CIN_StopCinematic(i);
- }
- }
-}
-
-
-static int CIN_HandleForVideo(void) {
- int i;
-
- for ( i = 0 ; i < MAX_VIDEO_HANDLES ; i++ ) {
- if ( cinTable[i].fileName[0] == 0 ) {
- return i;
- }
- }
- Com_Error( ERR_DROP, "CIN_HandleForVideo: none free" );
- return -1;
-}
-
-
-extern int CL_ScaledMilliseconds(void);
-
-//-----------------------------------------------------------------------------
-// RllSetupTable
-//
-// Allocates and initializes the square table.
-//
-// Parameters: None
-//
-// Returns: Nothing
-//-----------------------------------------------------------------------------
-static void RllSetupTable( void )
-{
- int z;
-
- for (z=0;z<128;z++) {
- cin.sqrTable[z] = (short)(z*z);
- cin.sqrTable[z+128] = (short)(-cin.sqrTable[z]);
- }
-}
-
-
-
-//-----------------------------------------------------------------------------
-// RllDecodeMonoToMono
-//
-// Decode mono source data into a mono buffer.
-//
-// Parameters: from -> buffer holding encoded data
-// to -> buffer to hold decoded data
-// size = number of bytes of input (= # of shorts of output)
-// signedOutput = 0 for unsigned output, non-zero for signed output
-// flag = flags from asset header
-//
-// Returns: Number of samples placed in output buffer
-//-----------------------------------------------------------------------------
-long RllDecodeMonoToMono(unsigned char *from,short *to,unsigned int size,char signedOutput ,unsigned short flag)
-{
- unsigned int z;
- int prev;
-
- if (signedOutput)
- prev = flag - 0x8000;
- else
- prev = flag;
-
- for (z=0;z buffer holding encoded data
-// to -> buffer to hold decoded data
-// size = number of bytes of input (= 1/4 # of bytes of output)
-// signedOutput = 0 for unsigned output, non-zero for signed output
-// flag = flags from asset header
-//
-// Returns: Number of samples placed in output buffer
-//-----------------------------------------------------------------------------
-long RllDecodeMonoToStereo(unsigned char *from,short *to,unsigned int size,char signedOutput,unsigned short flag)
-{
- unsigned int z;
- int prev;
-
- if (signedOutput)
- prev = flag - 0x8000;
- else
- prev = flag;
-
- for (z = 0; z < size; z++) {
- prev = (short)(prev + cin.sqrTable[from[z]]);
- to[z*2+0] = to[z*2+1] = (short)(prev);
- }
-
- return size; // * 2 * sizeof(short));
-}
-
-
-//-----------------------------------------------------------------------------
-// RllDecodeStereoToStereo
-//
-// Decode stereo source data into a stereo buffer.
-//
-// Parameters: from -> buffer holding encoded data
-// to -> buffer to hold decoded data
-// size = number of bytes of input (= 1/2 # of bytes of output)
-// signedOutput = 0 for unsigned output, non-zero for signed output
-// flag = flags from asset header
-//
-// Returns: Number of samples placed in output buffer
-//-----------------------------------------------------------------------------
-long RllDecodeStereoToStereo(unsigned char *from,short *to,unsigned int size,char signedOutput, unsigned short flag)
-{
- unsigned int z;
- unsigned char *zz = from;
- int prevL, prevR;
-
- if (signedOutput) {
- prevL = (flag & 0xff00) - 0x8000;
- prevR = ((flag & 0x00ff) << 8) - 0x8000;
- } else {
- prevL = flag & 0xff00;
- prevR = (flag & 0x00ff) << 8;
- }
-
- for (z=0;z>1); //*sizeof(short));
-}
-
-
-//-----------------------------------------------------------------------------
-// RllDecodeStereoToMono
-//
-// Decode stereo source data into a mono buffer.
-//
-// Parameters: from -> buffer holding encoded data
-// to -> buffer to hold decoded data
-// size = number of bytes of input (= # of bytes of output)
-// signedOutput = 0 for unsigned output, non-zero for signed output
-// flag = flags from asset header
-//
-// Returns: Number of samples placed in output buffer
-//-----------------------------------------------------------------------------
-long RllDecodeStereoToMono(unsigned char *from,short *to,unsigned int size,char signedOutput, unsigned short flag)
-{
- unsigned int z;
- int prevL,prevR;
-
- if (signedOutput) {
- prevL = (flag & 0xff00) - 0x8000;
- prevR = ((flag & 0x00ff) << 8) -0x8000;
- } else {
- prevL = flag & 0xff00;
- prevR = (flag & 0x00ff) << 8;
- }
-
- for (z=0;z> 2) );
- }
-}
-
-#define VQ2TO4(a,b,c,d) { \
- *c++ = a[0]; \
- *d++ = a[0]; \
- *d++ = a[0]; \
- *c++ = a[1]; \
- *d++ = a[1]; \
- *d++ = a[1]; \
- *c++ = b[0]; \
- *d++ = b[0]; \
- *d++ = b[0]; \
- *c++ = b[1]; \
- *d++ = b[1]; \
- *d++ = b[1]; \
- *d++ = a[0]; \
- *d++ = a[0]; \
- *d++ = a[1]; \
- *d++ = a[1]; \
- *d++ = b[0]; \
- *d++ = b[0]; \
- *d++ = b[1]; \
- *d++ = b[1]; \
- a += 2; b += 2; }
-
-#define VQ2TO2(a,b,c,d) { \
- *c++ = *a; \
- *d++ = *a; \
- *d++ = *a; \
- *c++ = *b; \
- *d++ = *b; \
- *d++ = *b; \
- *d++ = *a; \
- *d++ = *a; \
- *d++ = *b; \
- *d++ = *b; \
- a++; b++; }
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-
-static unsigned short yuv_to_rgb( long y, long u, long v )
-{
- long r,g,b,YY = (long)(ROQ_YY_tab[(y)]);
-
- r = (YY + ROQ_VR_tab[v]) >> 9;
- g = (YY + ROQ_UG_tab[u] + ROQ_VG_tab[v]) >> 8;
- b = (YY + ROQ_UB_tab[u]) >> 9;
-
- if (r<0) r = 0; if (g<0) g = 0; if (b<0) b = 0;
- if (r > 31) r = 31; if (g > 63) g = 63; if (b > 31) b = 31;
-
- return (unsigned short)((r<<11)+(g<<5)+(b));
-}
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-static unsigned int yuv_to_rgb24( long y, long u, long v )
-{
- long r,g,b,YY = (long)(ROQ_YY_tab[(y)]);
-
- r = (YY + ROQ_VR_tab[v]) >> 6;
- g = (YY + ROQ_UG_tab[u] + ROQ_VG_tab[v]) >> 6;
- b = (YY + ROQ_UB_tab[u]) >> 6;
-
- if (r<0) r = 0; if (g<0) g = 0; if (b<0) b = 0;
- if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255;
-
- return LittleLong ((r)|(g<<8)|(b<<16)|(255<<24));
-}
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-
-static void decodeCodeBook( byte *input, unsigned short roq_flags )
-{
- long i, j, two, four;
- unsigned short *aptr, *bptr, *cptr, *dptr;
- long y0,y1,y2,y3,cr,cb;
- byte *bbptr, *baptr, *bcptr, *bdptr;
- unsigned int *iaptr, *ibptr, *icptr, *idptr;
-
- if (!roq_flags) {
- two = four = 256;
- } else {
- two = roq_flags>>8;
- if (!two) two = 256;
- four = roq_flags&0xff;
- }
-
- four *= 2;
-
- bptr = (unsigned short *)vq2;
-
- if (!cinTable[currentHandle].half) {
- if (!cinTable[currentHandle].smootheddouble) {
-//
-// normal height
-//
- if (cinTable[currentHandle].samplesPerPixel==2) {
- for(i=0;i cinTable[currentHandle].CIN_WIDTH) bigx = cinTable[currentHandle].CIN_WIDTH;
- if (bigy > cinTable[currentHandle].CIN_HEIGHT) bigy = cinTable[currentHandle].CIN_HEIGHT;
-
- if ( (startX >= lowx) && (startX+quadSize) <= (bigx) && (startY+quadSize) <= (bigy) && (startY >= lowy) && quadSize <= MAXSIZE) {
- useY = startY;
- scroff = cin.linbuf + (useY+((cinTable[currentHandle].CIN_HEIGHT-bigy)>>1)+yOff)*(cinTable[currentHandle].samplesPerLine) + (((startX+xOff))*cinTable[currentHandle].samplesPerPixel);
-
- cin.qStatus[0][cinTable[currentHandle].onQuad ] = scroff;
- cin.qStatus[1][cinTable[currentHandle].onQuad++] = scroff+offset;
- }
-
- if ( quadSize != MINSIZE ) {
- quadSize >>= 1;
- recurseQuad( startX, startY , quadSize, xOff, yOff );
- recurseQuad( startX+quadSize, startY , quadSize, xOff, yOff );
- recurseQuad( startX, startY+quadSize , quadSize, xOff, yOff );
- recurseQuad( startX+quadSize, startY+quadSize , quadSize, xOff, yOff );
- }
-}
-
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-
-static void setupQuad( long xOff, long yOff )
-{
- long numQuadCels, i,x,y;
- byte *temp;
-
- if (xOff == cin.oldXOff && yOff == cin.oldYOff && cinTable[currentHandle].ysize == cin.oldysize && cinTable[currentHandle].xsize == cin.oldxsize) {
- return;
- }
-
- cin.oldXOff = xOff;
- cin.oldYOff = yOff;
- cin.oldysize = cinTable[currentHandle].ysize;
- cin.oldxsize = cinTable[currentHandle].xsize;
-
- numQuadCels = (cinTable[currentHandle].CIN_WIDTH*cinTable[currentHandle].CIN_HEIGHT) / (16);
- numQuadCels += numQuadCels/4 + numQuadCels/16;
- numQuadCels += 64; // for overflow
-
- numQuadCels = (cinTable[currentHandle].xsize*cinTable[currentHandle].ysize) / (16);
- numQuadCels += numQuadCels/4;
- numQuadCels += 64; // for overflow
-
- cinTable[currentHandle].onQuad = 0;
-
- for(y=0;y<(long)cinTable[currentHandle].ysize;y+=16)
- for(x=0;x<(long)cinTable[currentHandle].xsize;x+=16)
- recurseQuad( x, y, 16, xOff, yOff );
-
- temp = NULL;
-
- for(i=(numQuadCels-64);i256) {
- cinTable[currentHandle].drawX = 256;
- }
- if (cinTable[currentHandle].drawY>256) {
- cinTable[currentHandle].drawY = 256;
- }
- if (cinTable[currentHandle].CIN_WIDTH != 256 || cinTable[currentHandle].CIN_HEIGHT != 256) {
- Com_Printf("HACK: approxmimating cinematic for Rage Pro or Voodoo\n");
- }
- }
-}
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-
-static void RoQPrepMcomp( long xoff, long yoff )
-{
- long i, j, x, y, temp, temp2;
-
- i=cinTable[currentHandle].samplesPerLine; j=cinTable[currentHandle].samplesPerPixel;
- if ( cinTable[currentHandle].xsize == (cinTable[currentHandle].ysize*4) && !cinTable[currentHandle].half ) { j = j+j; i = i+i; }
-
- for(y=0;y<16;y++) {
- temp2 = (y+yoff-8)*i;
- for(x=0;x<16;x++) {
- temp = (x+xoff-8)*j;
- cin.mcomp[(x*16)+y] = cinTable[currentHandle].normalBuffer0-(temp2+temp);
- }
- }
-}
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-
-static void initRoQ( void )
-{
- if (currentHandle < 0) return;
-
- cinTable[currentHandle].VQNormal = (void (*)(byte *, void *))blitVQQuad32fs;
- cinTable[currentHandle].VQBuffer = (void (*)(byte *, void *))blitVQQuad32fs;
- cinTable[currentHandle].samplesPerPixel = 4;
- ROQ_GenYUVTables();
- RllSetupTable();
-}
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-/*
-static byte* RoQFetchInterlaced( byte *source ) {
- int x, *src, *dst;
-
- if (currentHandle < 0) return NULL;
-
- src = (int *)source;
- dst = (int *)cinTable[currentHandle].buf2;
-
- for(x=0;x<256*256;x++) {
- *dst = *src;
- dst++; src += 2;
- }
- return cinTable[currentHandle].buf2;
-}
-*/
-static void RoQReset( void ) {
-
- if (currentHandle < 0) return;
-
- Sys_EndStreamedFile(cinTable[currentHandle].iFile);
- FS_FCloseFile( cinTable[currentHandle].iFile );
- FS_FOpenFileRead (cinTable[currentHandle].fileName, &cinTable[currentHandle].iFile, qtrue);
- // let the background thread start reading ahead
- Sys_BeginStreamedFile( cinTable[currentHandle].iFile, 0x10000 );
- Sys_StreamedRead (cin.file, 16, 1, cinTable[currentHandle].iFile);
- RoQ_init();
- cinTable[currentHandle].status = FMV_LOOPED;
-}
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-
-static void RoQInterrupt(void)
-{
- byte *framedata;
- short sbuf[32768];
- int ssize;
-
- if (currentHandle < 0) return;
-
- Sys_StreamedRead( cin.file, cinTable[currentHandle].RoQFrameSize+8, 1, cinTable[currentHandle].iFile );
- if ( cinTable[currentHandle].RoQPlayed >= cinTable[currentHandle].ROQSize ) {
- if (cinTable[currentHandle].holdAtEnd==qfalse) {
- if (cinTable[currentHandle].looping) {
- RoQReset();
- } else {
- cinTable[currentHandle].status = FMV_EOF;
- }
- } else {
- cinTable[currentHandle].status = FMV_IDLE;
- }
- return;
- }
-
- framedata = cin.file;
-//
-// new frame is ready
-//
-redump:
- switch(cinTable[currentHandle].roq_id)
- {
- case ROQ_QUAD_VQ:
- if ((cinTable[currentHandle].numQuads&1)) {
- cinTable[currentHandle].normalBuffer0 = cinTable[currentHandle].t[1];
- RoQPrepMcomp( cinTable[currentHandle].roqF0, cinTable[currentHandle].roqF1 );
- cinTable[currentHandle].VQ1( (byte *)cin.qStatus[1], framedata);
- cinTable[currentHandle].buf = cin.linbuf + cinTable[currentHandle].screenDelta;
- } else {
- cinTable[currentHandle].normalBuffer0 = cinTable[currentHandle].t[0];
- RoQPrepMcomp( cinTable[currentHandle].roqF0, cinTable[currentHandle].roqF1 );
- cinTable[currentHandle].VQ0( (byte *)cin.qStatus[0], framedata );
- cinTable[currentHandle].buf = cin.linbuf;
- }
- if (cinTable[currentHandle].numQuads == 0) { // first frame
- Com_Memcpy(cin.linbuf+cinTable[currentHandle].screenDelta, cin.linbuf, cinTable[currentHandle].samplesPerLine*cinTable[currentHandle].ysize);
- }
- cinTable[currentHandle].numQuads++;
- cinTable[currentHandle].dirty = qtrue;
- break;
- case ROQ_CODEBOOK:
- decodeCodeBook( framedata, (unsigned short)cinTable[currentHandle].roq_flags );
- break;
- case ZA_SOUND_MONO:
- if (!cinTable[currentHandle].silent) {
- ssize = RllDecodeMonoToStereo( framedata, sbuf, cinTable[currentHandle].RoQFrameSize, 0, (unsigned short)cinTable[currentHandle].roq_flags);
- S_RawSamples( ssize, 22050, 2, 1, (byte *)sbuf, 1.0f );
- }
- break;
- case ZA_SOUND_STEREO:
- if (!cinTable[currentHandle].silent) {
- if (cinTable[currentHandle].numQuads == -1) {
- S_Update();
- s_rawend = s_soundtime;
- }
- ssize = RllDecodeStereoToStereo( framedata, sbuf, cinTable[currentHandle].RoQFrameSize, 0, (unsigned short)cinTable[currentHandle].roq_flags);
- S_RawSamples( ssize, 22050, 2, 2, (byte *)sbuf, 1.0f );
- }
- break;
- case ROQ_QUAD_INFO:
- if (cinTable[currentHandle].numQuads == -1) {
- readQuadInfo( framedata );
- setupQuad( 0, 0 );
- // we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
- cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds()*com_timescale->value;
- }
- if (cinTable[currentHandle].numQuads != 1) cinTable[currentHandle].numQuads = 0;
- break;
- case ROQ_PACKET:
- cinTable[currentHandle].inMemory = cinTable[currentHandle].roq_flags;
- cinTable[currentHandle].RoQFrameSize = 0; // for header
- break;
- case ROQ_QUAD_HANG:
- cinTable[currentHandle].RoQFrameSize = 0;
- break;
- case ROQ_QUAD_JPEG:
- break;
- default:
- cinTable[currentHandle].status = FMV_EOF;
- break;
- }
-//
-// read in next frame data
-//
- if ( cinTable[currentHandle].RoQPlayed >= cinTable[currentHandle].ROQSize ) {
- if (cinTable[currentHandle].holdAtEnd==qfalse) {
- if (cinTable[currentHandle].looping) {
- RoQReset();
- } else {
- cinTable[currentHandle].status = FMV_EOF;
- }
- } else {
- cinTable[currentHandle].status = FMV_IDLE;
- }
- return;
- }
-
- framedata += cinTable[currentHandle].RoQFrameSize;
- cinTable[currentHandle].roq_id = framedata[0] + framedata[1]*256;
- cinTable[currentHandle].RoQFrameSize = framedata[2] + framedata[3]*256 + framedata[4]*65536;
- cinTable[currentHandle].roq_flags = framedata[6] + framedata[7]*256;
- cinTable[currentHandle].roqF0 = (char)framedata[7];
- cinTable[currentHandle].roqF1 = (char)framedata[6];
-
- if (cinTable[currentHandle].RoQFrameSize>65536||cinTable[currentHandle].roq_id==0x1084) {
- Com_DPrintf("roq_size>65536||roq_id==0x1084\n");
- cinTable[currentHandle].status = FMV_EOF;
- if (cinTable[currentHandle].looping) {
- RoQReset();
- }
- return;
- }
- if (cinTable[currentHandle].inMemory && (cinTable[currentHandle].status != FMV_EOF)) { cinTable[currentHandle].inMemory--; framedata += 8; goto redump; }
-//
-// one more frame hits the dust
-//
-// assert(cinTable[currentHandle].RoQFrameSize <= 65536);
-// r = Sys_StreamedRead( cin.file, cinTable[currentHandle].RoQFrameSize+8, 1, cinTable[currentHandle].iFile );
- cinTable[currentHandle].RoQPlayed += cinTable[currentHandle].RoQFrameSize+8;
-}
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-
-static void RoQ_init( void )
-{
- // we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
- cinTable[currentHandle].startTime = cinTable[currentHandle].lastTime = CL_ScaledMilliseconds()*com_timescale->value;
-
- cinTable[currentHandle].RoQPlayed = 24;
-
-/* get frame rate */
- cinTable[currentHandle].roqFPS = cin.file[ 6] + cin.file[ 7]*256;
-
- if (!cinTable[currentHandle].roqFPS) cinTable[currentHandle].roqFPS = 30;
-
- cinTable[currentHandle].numQuads = -1;
-
- cinTable[currentHandle].roq_id = cin.file[ 8] + cin.file[ 9]*256;
- cinTable[currentHandle].RoQFrameSize = cin.file[10] + cin.file[11]*256 + cin.file[12]*65536;
- cinTable[currentHandle].roq_flags = cin.file[14] + cin.file[15]*256;
-
- if (cinTable[currentHandle].RoQFrameSize > 65536 || !cinTable[currentHandle].RoQFrameSize) {
- return;
- }
-
-}
-
-/******************************************************************************
-*
-* Function:
-*
-* Description:
-*
-******************************************************************************/
-
-static void RoQShutdown( void ) {
- if (!cinTable[currentHandle].buf) {
- return;
- }
-
- if ( cinTable[currentHandle].status == FMV_IDLE ) {
- return;
- }
- Com_DPrintf("finished cinematic\n");
- cinTable[currentHandle].status = FMV_IDLE;
-
- if (cinTable[currentHandle].iFile) {
- Sys_EndStreamedFile( cinTable[currentHandle].iFile );
- FS_FCloseFile( cinTable[currentHandle].iFile );
- cinTable[currentHandle].iFile = 0;
- }
-
- if (cinTable[currentHandle].alterGameState) {
- cls.state = CA_DISCONNECTED;
- CL_handle = -1;
- }
- cinTable[currentHandle].fileName[0] = 0;
- currentHandle = -1;
-}
-
-/*
-==================
-SCR_StopCinematic
-==================
-*/
-e_status CIN_StopCinematic(int handle) {
-
- if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return FMV_EOF;
- currentHandle = handle;
-
- Com_DPrintf("trFMV::stop(), closing %s\n", cinTable[currentHandle].fileName);
-
- if (!cinTable[currentHandle].buf) {
- return FMV_EOF;
- }
-
- if (cinTable[currentHandle].alterGameState) {
- if ( cls.state != CA_CINEMATIC ) {
- return cinTable[currentHandle].status;
- }
- }
- cinTable[currentHandle].status = FMV_EOF;
- RoQShutdown();
-
- return FMV_EOF;
-}
-
-/*
-==================
-SCR_RunCinematic
-
-Fetch and decompress the pending frame
-==================
-*/
-
-
-e_status CIN_RunCinematic (int handle)
-{
- // bk001204 - init
- int start = 0;
- int thisTime = 0;
-
- if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return FMV_EOF;
-
- if (cin.currentHandle != handle) {
- currentHandle = handle;
- cin.currentHandle = currentHandle;
- cinTable[currentHandle].status = FMV_EOF;
- RoQReset();
- }
-
- if (cinTable[handle].playonwalls < -1)
- {
- return cinTable[handle].status;
- }
-
- currentHandle = handle;
-
- if (cinTable[currentHandle].alterGameState) {
- if ( cls.state != CA_CINEMATIC ) {
- return cinTable[currentHandle].status;
- }
- }
-
- if (cinTable[currentHandle].status == FMV_IDLE) {
- return cinTable[currentHandle].status;
- }
-
- // we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
- thisTime = CL_ScaledMilliseconds()*com_timescale->value;
- if (cinTable[currentHandle].shader && (abs(thisTime - cinTable[currentHandle].lastTime))>100) {
- cinTable[currentHandle].startTime += thisTime - cinTable[currentHandle].lastTime;
- }
- // we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
- cinTable[currentHandle].tfps = ((((CL_ScaledMilliseconds()*com_timescale->value) - cinTable[currentHandle].startTime)*3)/100);
-
- start = cinTable[currentHandle].startTime;
- while( (cinTable[currentHandle].tfps != cinTable[currentHandle].numQuads)
- && (cinTable[currentHandle].status == FMV_PLAY) )
- {
- RoQInterrupt();
- if (start != cinTable[currentHandle].startTime) {
- // we need to use CL_ScaledMilliseconds because of the smp mode calls from the renderer
- cinTable[currentHandle].tfps = ((((CL_ScaledMilliseconds()*com_timescale->value)
- - cinTable[currentHandle].startTime)*3)/100);
- start = cinTable[currentHandle].startTime;
- }
- }
-
- cinTable[currentHandle].lastTime = thisTime;
-
- if (cinTable[currentHandle].status == FMV_LOOPED) {
- cinTable[currentHandle].status = FMV_PLAY;
- }
-
- if (cinTable[currentHandle].status == FMV_EOF) {
- if (cinTable[currentHandle].looping) {
- RoQReset();
- } else {
- RoQShutdown();
- }
- }
-
- return cinTable[currentHandle].status;
-}
-
-/*
-==================
-CL_PlayCinematic
-
-==================
-*/
-int CIN_PlayCinematic( const char *arg, int x, int y, int w, int h, int systemBits ) {
- unsigned short RoQID;
- char name[MAX_OSPATH];
- int i;
-
- if (strstr(arg, "/") == NULL && strstr(arg, "\\") == NULL) {
- Com_sprintf (name, sizeof(name), "video/%s", arg);
- } else {
- Com_sprintf (name, sizeof(name), "%s", arg);
- }
-
- if (!(systemBits & CIN_system)) {
- for ( i = 0 ; i < MAX_VIDEO_HANDLES ; i++ ) {
- if (!strcmp(cinTable[i].fileName, name) ) {
- return i;
- }
- }
- }
-
- Com_DPrintf("SCR_PlayCinematic( %s )\n", arg);
-
- Com_Memset(&cin, 0, sizeof(cinematics_t) );
- currentHandle = CIN_HandleForVideo();
-
- cin.currentHandle = currentHandle;
-
- strcpy(cinTable[currentHandle].fileName, name);
-
- cinTable[currentHandle].ROQSize = 0;
- cinTable[currentHandle].ROQSize = FS_FOpenFileRead (cinTable[currentHandle].fileName, &cinTable[currentHandle].iFile, qtrue);
-
- if (cinTable[currentHandle].ROQSize<=0) {
- Com_DPrintf("play(%s), ROQSize<=0\n", arg);
- cinTable[currentHandle].fileName[0] = 0;
- return -1;
- }
-
- CIN_SetExtents(currentHandle, x, y, w, h);
- CIN_SetLooping(currentHandle, (systemBits & CIN_loop)!=0);
-
- cinTable[currentHandle].CIN_HEIGHT = DEFAULT_CIN_HEIGHT;
- cinTable[currentHandle].CIN_WIDTH = DEFAULT_CIN_WIDTH;
- cinTable[currentHandle].holdAtEnd = (systemBits & CIN_hold) != 0;
- cinTable[currentHandle].alterGameState = (systemBits & CIN_system) != 0;
- cinTable[currentHandle].playonwalls = 1;
- cinTable[currentHandle].silent = (systemBits & CIN_silent) != 0;
- cinTable[currentHandle].shader = (systemBits & CIN_shader) != 0;
-
- if (cinTable[currentHandle].alterGameState) {
- // close the menu
- if ( uivm ) {
- VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NONE );
- }
- } else {
- cinTable[currentHandle].playonwalls = cl_inGameVideo->integer;
- }
-
- initRoQ();
-
- FS_Read (cin.file, 16, cinTable[currentHandle].iFile);
-
- RoQID = (unsigned short)(cin.file[0]) + (unsigned short)(cin.file[1])*256;
- if (RoQID == 0x1084)
- {
- RoQ_init();
-// FS_Read (cin.file, cinTable[currentHandle].RoQFrameSize+8, cinTable[currentHandle].iFile);
- // let the background thread start reading ahead
- Sys_BeginStreamedFile( cinTable[currentHandle].iFile, 0x10000 );
-
- cinTable[currentHandle].status = FMV_PLAY;
- Com_DPrintf("trFMV::play(), playing %s\n", arg);
-
- if (cinTable[currentHandle].alterGameState) {
- cls.state = CA_CINEMATIC;
- }
-
- Con_Close();
-
- s_rawend = s_soundtime;
-
- return currentHandle;
- }
- Com_DPrintf("trFMV::play(), invalid RoQ ID\n");
-
- RoQShutdown();
- return -1;
-}
-
-void CIN_SetExtents (int handle, int x, int y, int w, int h) {
- if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return;
- cinTable[handle].xpos = x;
- cinTable[handle].ypos = y;
- cinTable[handle].width = w;
- cinTable[handle].height = h;
- cinTable[handle].dirty = qtrue;
-}
-
-void CIN_SetLooping(int handle, qboolean loop) {
- if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return;
- cinTable[handle].looping = loop;
-}
-
-/*
-==================
-SCR_DrawCinematic
-
-==================
-*/
-void CIN_DrawCinematic (int handle) {
- float x, y, w, h;
- byte *buf;
-
- if (handle < 0 || handle>= MAX_VIDEO_HANDLES || cinTable[handle].status == FMV_EOF) return;
-
- if (!cinTable[handle].buf) {
- return;
- }
-
- x = cinTable[handle].xpos;
- y = cinTable[handle].ypos;
- w = cinTable[handle].width;
- h = cinTable[handle].height;
- buf = cinTable[handle].buf;
- SCR_AdjustFrom640( &x, &y, &w, &h );
-
- if (cinTable[handle].dirty && (cinTable[handle].CIN_WIDTH != cinTable[handle].drawX || cinTable[handle].CIN_HEIGHT != cinTable[handle].drawY)) {
- int ix, iy, *buf2, *buf3, xm, ym, ll;
-
- xm = cinTable[handle].CIN_WIDTH/256;
- ym = cinTable[handle].CIN_HEIGHT/256;
- ll = 8;
- if (cinTable[handle].CIN_WIDTH==512) {
- ll = 9;
- }
-
- buf3 = (int*)buf;
- buf2 = Hunk_AllocateTempMemory( 256*256*4 );
- if (xm==2 && ym==2) {
- byte *bc2, *bc3;
- int ic, iiy;
-
- bc2 = (byte *)buf2;
- bc3 = (byte *)buf3;
- for (iy = 0; iy<256; iy++) {
- iiy = iy<<12;
- for (ix = 0; ix<2048; ix+=8) {
- for(ic = ix;ic<(ix+4);ic++) {
- *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic]+bc3[iiy+2048+ic]+bc3[iiy+2048+4+ic])>>2;
- bc2++;
- }
- }
- }
- } else if (xm==2 && ym==1) {
- byte *bc2, *bc3;
- int ic, iiy;
-
- bc2 = (byte *)buf2;
- bc3 = (byte *)buf3;
- for (iy = 0; iy<256; iy++) {
- iiy = iy<<11;
- for (ix = 0; ix<2048; ix+=8) {
- for(ic = ix;ic<(ix+4);ic++) {
- *bc2=(bc3[iiy+ic]+bc3[iiy+4+ic])>>1;
- bc2++;
- }
- }
- }
- } else {
- for (iy = 0; iy<256; iy++) {
- for (ix = 0; ix<256; ix++) {
- buf2[(iy<<8)+ix] = buf3[((iy*ym)<= 0) {
- do {
- SCR_RunCinematic();
- } while (cinTable[currentHandle].buf == NULL && cinTable[currentHandle].status == FMV_PLAY); // wait for first frame (load codebook and sound)
- }
-}
-
-
-void SCR_DrawCinematic (void) {
- if (CL_handle >= 0 && CL_handle < MAX_VIDEO_HANDLES) {
- CIN_DrawCinematic(CL_handle);
- }
-}
-
-void SCR_RunCinematic (void)
-{
- if (CL_handle >= 0 && CL_handle < MAX_VIDEO_HANDLES) {
- CIN_RunCinematic(CL_handle);
- }
-}
-
-void SCR_StopCinematic(void) {
- if (CL_handle >= 0 && CL_handle < MAX_VIDEO_HANDLES) {
- CIN_StopCinematic(CL_handle);
- S_StopAllSounds ();
- CL_handle = -1;
- }
-}
-
-void CIN_UploadCinematic(int handle) {
- if (handle >= 0 && handle < MAX_VIDEO_HANDLES) {
- if (!cinTable[handle].buf) {
- return;
- }
- if (cinTable[handle].playonwalls <= 0 && cinTable[handle].dirty) {
- if (cinTable[handle].playonwalls == 0) {
- cinTable[handle].playonwalls = -1;
- } else {
- if (cinTable[handle].playonwalls == -1) {
- cinTable[handle].playonwalls = -2;
- } else {
- cinTable[handle].dirty = qfalse;
- }
- }
- }
- re.UploadCinematic( 256, 256, 256, 256, cinTable[handle].buf, handle, cinTable[handle].dirty);
- if (cl_inGameVideo->integer == 0 && cinTable[handle].playonwalls == 1) {
- cinTable[handle].playonwalls--;
- }
- }
-}
-
diff --git a/src/client/cl_console.c b/src/client/cl_console.c
deleted file mode 100644
index 3e32139..0000000
--- a/src/client/cl_console.c
+++ /dev/null
@@ -1,701 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// console.c
-
-#include "client.h"
-
-
-int g_console_field_width = 78;
-
-
-#define NUM_CON_TIMES 4
-
-#define CON_TEXTSIZE 32768
-typedef struct {
- qboolean initialized;
-
- short text[CON_TEXTSIZE];
- int current; // line where next message will be printed
- int x; // offset in current line for next print
- int display; // bottom of console displays this line
-
- int linewidth; // characters across screen
- int totallines; // total lines in console scrollback
-
- float xadjust; // for wide aspect screens
-
- float displayFrac; // aproaches finalFrac at scr_conspeed
- float finalFrac; // 0.0 to 1.0 lines of console to display
-
- int vislines; // in scanlines
-
- vec4_t color;
-} console_t;
-
-extern console_t con;
-
-console_t con;
-
-cvar_t *con_conspeed;
-
-#define DEFAULT_CONSOLE_WIDTH 78
-
-vec4_t console_color = {1.0, 1.0, 1.0, 1.0};
-
-
-/*
-================
-Con_ToggleConsole_f
-================
-*/
-void Con_ToggleConsole_f (void) {
- // closing a full screen console restarts the demo loop
- if ( cls.state == CA_DISCONNECTED && cls.keyCatchers == KEYCATCH_CONSOLE ) {
- CL_StartDemoLoop();
- return;
- }
-
- Field_Clear( &g_consoleField );
- g_consoleField.widthInChars = g_console_field_width;
-
- cls.keyCatchers ^= KEYCATCH_CONSOLE;
-}
-
-/*
-================
-Con_MessageMode_f
-================
-*/
-void Con_MessageMode_f (void) {
- chat_playerNum = -1;
- chat_team = qfalse;
- Field_Clear( &chatField );
- chatField.widthInChars = 30;
-
- cls.keyCatchers ^= KEYCATCH_MESSAGE;
-}
-
-/*
-================
-Con_MessageMode2_f
-================
-*/
-void Con_MessageMode2_f (void) {
- chat_playerNum = -1;
- chat_team = qtrue;
- Field_Clear( &chatField );
- chatField.widthInChars = 25;
- cls.keyCatchers ^= KEYCATCH_MESSAGE;
-}
-
-/*
-================
-Con_MessageMode3_f
-================
-*/
-void Con_MessageMode3_f (void) {
- chat_playerNum = VM_Call( cgvm, CG_CROSSHAIR_PLAYER );
- if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) {
- chat_playerNum = -1;
- return;
- }
- chat_team = qfalse;
- Field_Clear( &chatField );
- chatField.widthInChars = 30;
- cls.keyCatchers ^= KEYCATCH_MESSAGE;
-}
-
-/*
-================
-Con_MessageMode4_f
-================
-*/
-void Con_MessageMode4_f (void) {
- chat_playerNum = VM_Call( cgvm, CG_LAST_ATTACKER );
- if ( chat_playerNum < 0 || chat_playerNum >= MAX_CLIENTS ) {
- chat_playerNum = -1;
- return;
- }
- chat_team = qfalse;
- Field_Clear( &chatField );
- chatField.widthInChars = 30;
- cls.keyCatchers ^= KEYCATCH_MESSAGE;
-}
-
-/*
-================
-Con_Clear_f
-================
-*/
-void Con_Clear_f (void) {
- int i;
-
- for ( i = 0 ; i < CON_TEXTSIZE ; i++ ) {
- con.text[i] = (ColorIndex(COLOR_WHITE)<<8) | ' ';
- }
-
- Con_Bottom(); // go to end
-}
-
-
-/*
-================
-Con_Dump_f
-
-Save the console contents out to a file
-================
-*/
-void Con_Dump_f (void)
-{
- int l, x, i;
- short *line;
- fileHandle_t f;
- char buffer[1024];
-
- if (Cmd_Argc() != 2)
- {
- Com_Printf ("usage: condump \n");
- return;
- }
-
- Com_Printf ("Dumped console text to %s.\n", Cmd_Argv(1) );
-
- f = FS_FOpenFileWrite( Cmd_Argv( 1 ) );
- if (!f)
- {
- Com_Printf ("ERROR: couldn't open.\n");
- return;
- }
-
- // skip empty lines
- for (l = con.current - con.totallines + 1 ; l <= con.current ; l++)
- {
- line = con.text + (l%con.totallines)*con.linewidth;
- for (x=0 ; x=0 ; x--)
- {
- if (buffer[x] == ' ')
- buffer[x] = 0;
- else
- break;
- }
- strcat( buffer, "\n" );
- FS_Write(buffer, strlen(buffer), f);
- }
-
- FS_FCloseFile( f );
-}
-
-
-/*
-================
-Con_ClearNotify
-================
-*/
-void Con_ClearNotify( void ) {
- Cmd_TokenizeString( NULL );
- CL_GameConsoleText( );
-}
-
-
-
-/*
-================
-Con_CheckResize
-
-If the line width has changed, reformat the buffer.
-================
-*/
-void Con_CheckResize (void)
-{
- int i, j, width, oldwidth, oldtotallines, numlines, numchars;
- short tbuf[CON_TEXTSIZE];
-
- width = (SCREEN_WIDTH / SMALLCHAR_WIDTH) - 2;
-
- if (width == con.linewidth)
- return;
-
- if (width < 1) // video hasn't been initialized yet
- {
- width = DEFAULT_CONSOLE_WIDTH;
- con.linewidth = width;
- con.totallines = CON_TEXTSIZE / con.linewidth;
- for(i=0; iinteger ) {
- return;
- }
-
- if (!con.initialized) {
- con.color[0] =
- con.color[1] =
- con.color[2] =
- con.color[3] = 1.0f;
- con.linewidth = -1;
- Con_CheckResize ();
- con.initialized = qtrue;
- }
-
- if( !skipnotify && !( cls.keyCatchers & KEYCATCH_CONSOLE ) ) {
- Cmd_SaveCmdContext( );
-
- // feed the text to cgame
- Cmd_TokenizeString( txt );
- CL_GameConsoleText( );
-
- Cmd_RestoreCmdContext( );
- }
-
- color = ColorIndex(COLOR_WHITE);
-
- while ( (c = *txt) != 0 ) {
- if ( Q_IsColorString( txt ) ) {
- color = ColorIndex( *(txt+1) );
- txt += 2;
- continue;
- }
-
- // count word length
- for (l=0 ; l< con.linewidth ; l++) {
- if ( txt[l] <= ' ') {
- break;
- }
-
- }
-
- // word wrap
- if (l != con.linewidth && (con.x + l >= con.linewidth) ) {
- Con_Linefeed(skipnotify);
-
- }
-
- txt++;
-
- switch (c)
- {
- case '\n':
- Con_Linefeed (skipnotify);
- break;
- case '\r':
- con.x = 0;
- break;
- default: // display character and advance
- y = con.current % con.totallines;
- con.text[y*con.linewidth+con.x] = (color << 8) | c;
- con.x++;
- if (con.x >= con.linewidth) {
- Con_Linefeed(skipnotify);
- con.x = 0;
- }
- break;
- }
- }
-}
-
-
-/*
-==============================================================================
-
-DRAWING
-
-==============================================================================
-*/
-
-
-/*
-================
-Con_DrawInput
-
-Draw the editline after a ] prompt
-================
-*/
-void Con_DrawInput (void) {
- int y;
-
- if ( cls.state != CA_DISCONNECTED && !(cls.keyCatchers & KEYCATCH_CONSOLE ) ) {
- return;
- }
-
- y = con.vislines - ( SMALLCHAR_HEIGHT * 2 );
-
- re.SetColor( con.color );
-
- SCR_DrawSmallChar( con.xadjust + 1 * SMALLCHAR_WIDTH, y, ']' );
-
- Field_Draw( &g_consoleField, con.xadjust + 2 * SMALLCHAR_WIDTH, y,
- SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue );
-}
-
-/*
-================
-Con_DrawSolidConsole
-
-Draws the console with the solid background
-================
-*/
-void Con_DrawSolidConsole( float frac ) {
- int i, x, y;
- int rows;
- short *text;
- int row;
- int lines;
-// qhandle_t conShader;
- int currentColor;
- vec4_t color;
-
- lines = cls.glconfig.vidHeight * frac;
- if (lines <= 0)
- return;
-
- if (lines > cls.glconfig.vidHeight )
- lines = cls.glconfig.vidHeight;
-
- // on wide screens, we will center the text
- con.xadjust = 0;
- SCR_AdjustFrom640( &con.xadjust, NULL, NULL, NULL );
-
- // draw the background
- y = frac * SCREEN_HEIGHT - 2;
- if ( y < 1 ) {
- y = 0;
- }
- else {
- SCR_DrawPic( 0, 0, SCREEN_WIDTH, y, cls.consoleShader );
- }
-
- color[0] = 1;
- color[1] = 0;
- color[2] = 0;
- color[3] = 1;
- SCR_FillRect( 0, y, SCREEN_WIDTH, 2, color );
-
-
- // draw the version number
-
- re.SetColor( g_color_table[ColorIndex(COLOR_RED)] );
-
- i = strlen( SVN_VERSION );
-
- for (x=0 ; x= con.totallines) {
- // past scrollback wrap point
- continue;
- }
-
- text = con.text + (row % con.totallines)*con.linewidth;
-
- for (x=0 ; x>8)&7 ) != currentColor ) {
- currentColor = (text[x]>>8)&7;
- re.SetColor( g_color_table[currentColor] );
- }
- SCR_DrawSmallChar( con.xadjust + (x+1)*SMALLCHAR_WIDTH, y, text[x] & 0xff );
- }
- }
-
- // draw the input prompt, user text, and cursor if desired
- Con_DrawInput ();
-
- re.SetColor( NULL );
-}
-
-
-
-/*
-==================
-Con_DrawConsole
-==================
-*/
-void Con_DrawConsole( void ) {
- // check for console width changes from a vid mode change
- Con_CheckResize ();
-
- // if disconnected, render console full screen
- if ( cls.state == CA_DISCONNECTED ) {
- if ( !( cls.keyCatchers & (KEYCATCH_UI | KEYCATCH_CGAME)) ) {
- Con_DrawSolidConsole( 1.0 );
- return;
- }
- }
-
- if ( con.displayFrac ) {
- Con_DrawSolidConsole( con.displayFrac );
- }
-
- if( cls.keyCatchers & ( KEYCATCH_UI | KEYCATCH_CGAME ) )
- return;
-
- // draw the chat line
- if( cls.keyCatchers & KEYCATCH_MESSAGE )
- {
- int skip;
-
- if( chat_team )
- {
- SCR_DrawBigString( 8, 232, "Team Say:", 1.0f );
- skip = 11;
- }
- else
- {
- SCR_DrawBigString( 8, 232, "Say:", 1.0f );
- skip = 5;
- }
-
- Field_BigDraw( &chatField, skip * BIGCHAR_WIDTH, 232,
- SCREEN_WIDTH - ( skip + 1 ) * BIGCHAR_WIDTH, qtrue );
- }
-}
-
-//================================================================
-
-/*
-==================
-Con_RunConsole
-
-Scroll it up or down
-==================
-*/
-void Con_RunConsole (void) {
- // decide on the destination height of the console
- if ( cls.keyCatchers & KEYCATCH_CONSOLE )
- con.finalFrac = 0.5; // half screen
- else
- con.finalFrac = 0; // none visible
-
- // scroll towards the destination height
- if (con.finalFrac < con.displayFrac)
- {
- con.displayFrac -= con_conspeed->value*cls.realFrametime*0.001;
- if (con.finalFrac > con.displayFrac)
- con.displayFrac = con.finalFrac;
-
- }
- else if (con.finalFrac > con.displayFrac)
- {
- con.displayFrac += con_conspeed->value*cls.realFrametime*0.001;
- if (con.finalFrac < con.displayFrac)
- con.displayFrac = con.finalFrac;
- }
-
-}
-
-
-void Con_PageUp( void ) {
- con.display -= 2;
- if ( con.current - con.display >= con.totallines ) {
- con.display = con.current - con.totallines + 1;
- }
-}
-
-void Con_PageDown( void ) {
- con.display += 2;
- if (con.display > con.current) {
- con.display = con.current;
- }
-}
-
-void Con_Top( void ) {
- con.display = con.totallines;
- if ( con.current - con.display >= con.totallines ) {
- con.display = con.current - con.totallines + 1;
- }
-}
-
-void Con_Bottom( void ) {
- con.display = con.current;
-}
-
-
-void Con_Close( void ) {
- if ( !com_cl_running->integer ) {
- return;
- }
- Field_Clear( &g_consoleField );
- cls.keyCatchers &= ~KEYCATCH_CONSOLE;
- con.finalFrac = 0; // none visible
- con.displayFrac = 0;
-}
diff --git a/src/client/cl_curl.c b/src/client/cl_curl.c
deleted file mode 100644
index 9c5e3cc..0000000
--- a/src/client/cl_curl.c
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2006 Tony J. White (tjw@tjw.org)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#if USE_CURL
-#include "client.h"
-cvar_t *cl_cURLLib;
-
-#if USE_CURL_DLOPEN
-
-#if USE_SDL_VIDEO
-#include "SDL.h"
-#include "SDL_loadso.h"
-#define OBJTYPE void *
-#define OBJLOAD(x) SDL_LoadObject(x)
-#define SYMLOAD(x,y) SDL_LoadFunction(x,y)
-#define OBJFREE(x) SDL_UnloadObject(x)
-
-#elif defined _WIN32
-#include
-#define OBJTYPE HMODULE
-#define OBJLOAD(x) LoadLibrary(x)
-#define SYMLOAD(x,y) GetProcAddress(x,y)
-#define OBJFREE(x) FreeLibrary(x)
-
-#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X || defined __sun
-#include
-#define OBJTYPE void *
-#define OBJLOAD(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
-#define SYMLOAD(x,y) dlsym(x,y)
-#define OBJFREE(x) dlclose(x)
-#else
-
-#error "Your platform has no lib loading code or it is disabled"
-#endif
-
-#if defined __linux__ || defined __FreeBSD__ || defined MACOS_X
-#include
-#include
-#endif
-
-char* (*qcurl_version)(void);
-
-CURL* (*qcurl_easy_init)(void);
-CURLcode (*qcurl_easy_setopt)(CURL *curl, CURLoption option, ...);
-CURLcode (*qcurl_easy_perform)(CURL *curl);
-void (*qcurl_easy_cleanup)(CURL *curl);
-CURLcode (*qcurl_easy_getinfo)(CURL *curl, CURLINFO info, ...);
-CURL* (*qcurl_easy_duphandle)(CURL *curl);
-void (*qcurl_easy_reset)(CURL *curl);
-const char *(*qcurl_easy_strerror)(CURLcode);
-
-CURLM* (*qcurl_multi_init)(void);
-CURLMcode (*qcurl_multi_add_handle)(CURLM *multi_handle,
- CURL *curl_handle);
-CURLMcode (*qcurl_multi_remove_handle)(CURLM *multi_handle,
- CURL *curl_handle);
-CURLMcode (*qcurl_multi_fdset)(CURLM *multi_handle,
- fd_set *read_fd_set,
- fd_set *write_fd_set,
- fd_set *exc_fd_set,
- int *max_fd);
-CURLMcode (*qcurl_multi_perform)(CURLM *multi_handle,
- int *running_handles);
-CURLMcode (*qcurl_multi_cleanup)(CURLM *multi_handle);
-CURLMsg *(*qcurl_multi_info_read)(CURLM *multi_handle,
- int *msgs_in_queue);
-const char *(*qcurl_multi_strerror)(CURLMcode);
-
-static OBJTYPE cURLLib = NULL;
-
-/*
-=================
-GPA
-=================
-*/
-static void *GPA(char *str)
-{
- void *rv;
-
- rv = SYMLOAD(cURLLib, str);
- if(!rv)
- {
- Com_Printf("Can't load symbol %s\n", str);
- clc.cURLEnabled = qfalse;
- return NULL;
- }
- else
- {
- Com_DPrintf("Loaded symbol %s (0x%p)\n", str, rv);
- return rv;
- }
-}
-#endif /* USE_CURL_DLOPEN */
-
-/*
-=================
-CL_cURL_Init
-=================
-*/
-qboolean CL_cURL_Init()
-{
-#if USE_CURL_DLOPEN
- if(cURLLib)
- return qtrue;
-
-
- Com_Printf("Loading \"%s\"...", cl_cURLLib->string);
- if( (cURLLib = OBJLOAD(cl_cURLLib->string)) == 0 )
- {
-#ifdef _WIN32
- return qfalse;
-#else
- char fn[1024];
- getcwd(fn, sizeof(fn));
- strncat(fn, "/", sizeof(fn)-strlen(fn)-1);
- strncat(fn, cl_cURLLib->string, sizeof(fn)-strlen(fn)-1);
-
- if( (cURLLib = OBJLOAD(fn)) == 0 )
- {
- return qfalse;
- }
-#endif /* _WIN32 */
- }
-
- clc.cURLEnabled = qtrue;
-
- qcurl_version = GPA("curl_version");
-
- qcurl_easy_init = GPA("curl_easy_init");
- qcurl_easy_setopt = GPA("curl_easy_setopt");
- qcurl_easy_perform = GPA("curl_easy_perform");
- qcurl_easy_cleanup = GPA("curl_easy_cleanup");
- qcurl_easy_getinfo = GPA("curl_easy_getinfo");
- qcurl_easy_duphandle = GPA("curl_easy_duphandle");
- qcurl_easy_reset = GPA("curl_easy_reset");
- qcurl_easy_strerror = GPA("curl_easy_strerror");
-
- qcurl_multi_init = GPA("curl_multi_init");
- qcurl_multi_add_handle = GPA("curl_multi_add_handle");
- qcurl_multi_remove_handle = GPA("curl_multi_remove_handle");
- qcurl_multi_fdset = GPA("curl_multi_fdset");
- qcurl_multi_perform = GPA("curl_multi_perform");
- qcurl_multi_cleanup = GPA("curl_multi_cleanup");
- qcurl_multi_info_read = GPA("curl_multi_info_read");
- qcurl_multi_strerror = GPA("curl_multi_strerror");
-
- if(!clc.cURLEnabled)
- {
- CL_cURL_Shutdown();
- Com_Printf("FAIL One or more symbols not found\n");
- return qfalse;
- }
- Com_Printf("OK\n");
-
- return qtrue;
-#else
- clc.cURLEnabled = qtrue;
- return qtrue;
-#endif /* USE_CURL_DLOPEN */
-}
-
-/*
-=================
-CL_cURL_Shutdown
-=================
-*/
-void CL_cURL_Shutdown( void )
-{
- CL_cURL_Cleanup();
-#if USE_CURL_DLOPEN
- if(cURLLib)
- {
- OBJFREE(cURLLib);
- cURLLib = NULL;
- }
- qcurl_easy_init = NULL;
- qcurl_easy_setopt = NULL;
- qcurl_easy_perform = NULL;
- qcurl_easy_cleanup = NULL;
- qcurl_easy_getinfo = NULL;
- qcurl_easy_duphandle = NULL;
- qcurl_easy_reset = NULL;
-
- qcurl_multi_init = NULL;
- qcurl_multi_add_handle = NULL;
- qcurl_multi_remove_handle = NULL;
- qcurl_multi_fdset = NULL;
- qcurl_multi_perform = NULL;
- qcurl_multi_cleanup = NULL;
- qcurl_multi_info_read = NULL;
- qcurl_multi_strerror = NULL;
-#endif /* USE_CURL_DLOPEN */
-}
-
-void CL_cURL_Cleanup(void)
-{
- if(clc.downloadCURLM) {
- if(clc.downloadCURL) {
- qcurl_multi_remove_handle(clc.downloadCURLM,
- clc.downloadCURL);
- qcurl_easy_cleanup(clc.downloadCURL);
- }
- qcurl_multi_cleanup(clc.downloadCURLM);
- clc.downloadCURLM = NULL;
- clc.downloadCURL = NULL;
- }
- else if(clc.downloadCURL) {
- qcurl_easy_cleanup(clc.downloadCURL);
- clc.downloadCURL = NULL;
- }
-}
-
-static int CL_cURL_CallbackProgress( void *dummy, double dltotal, double dlnow,
- double ultotal, double ulnow )
-{
- clc.downloadSize = (int)dltotal;
- Cvar_SetValue( "cl_downloadSize", clc.downloadSize );
- clc.downloadCount = (int)dlnow;
- Cvar_SetValue( "cl_downloadCount", clc.downloadCount );
- return 0;
-}
-
-static int CL_cURL_CallbackWrite(void *buffer, size_t size, size_t nmemb,
- void *stream)
-{
- FS_Write( buffer, size*nmemb, ((fileHandle_t*)stream)[0] );
- return size*nmemb;
-}
-
-void CL_cURL_BeginDownload( const char *localName, const char *remoteURL )
-{
- clc.cURLUsed = qtrue;
- Com_Printf("URL: %s\n", remoteURL);
- Com_DPrintf("***** CL_cURL_BeginDownload *****\n"
- "Localname: %s\n"
- "RemoteURL: %s\n"
- "****************************\n", localName, remoteURL);
- CL_cURL_Cleanup();
- Q_strncpyz(clc.downloadURL, remoteURL, sizeof(clc.downloadURL));
- Q_strncpyz(clc.downloadName, localName, sizeof(clc.downloadName));
- Com_sprintf(clc.downloadTempName, sizeof(clc.downloadTempName),
- "%s.tmp", localName);
-
- // Set so UI gets access to it
- Cvar_Set("cl_downloadName", localName);
- Cvar_Set("cl_downloadSize", "0");
- Cvar_Set("cl_downloadCount", "0");
- Cvar_SetValue("cl_downloadTime", cls.realtime);
-
- clc.downloadBlock = 0; // Starting new file
- clc.downloadCount = 0;
-
- clc.downloadCURL = qcurl_easy_init();
- if(!clc.downloadCURL) {
- Com_Error(ERR_DROP, "CL_cURL_BeginDownload: qcurl_easy_init() "
- "failed\n");
- return;
- }
- clc.download = FS_SV_FOpenFileWrite(clc.downloadTempName);
- if(!clc.download) {
- Com_Error(ERR_DROP, "CL_cURL_BeginDownload: failed to open "
- "%s for writing\n", clc.downloadTempName);
- return;
- }
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, clc.download);
- if(com_developer->integer)
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_VERBOSE, 1);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_URL, clc.downloadURL);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_TRANSFERTEXT, 0);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_REFERER, va("ioQ3://%s",
- NET_AdrToString(clc.serverAddress)));
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_USERAGENT, va("%s %s",
- Q3_VERSION, qcurl_version()));
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEFUNCTION,
- CL_cURL_CallbackWrite);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_WRITEDATA, &clc.download);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_NOPROGRESS, 0);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSFUNCTION,
- CL_cURL_CallbackProgress);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_PROGRESSDATA, NULL);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FAILONERROR, 1);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_FOLLOWLOCATION, 1);
- qcurl_easy_setopt(clc.downloadCURL, CURLOPT_MAXREDIRS, 5);
- clc.downloadCURLM = qcurl_multi_init();
- if(!clc.downloadCURLM) {
- qcurl_easy_cleanup(clc.downloadCURL);
- clc.downloadCURL = NULL;
- Com_Error(ERR_DROP, "CL_cURL_BeginDownload: qcurl_multi_init() "
- "failed\n");
- return;
- }
- qcurl_multi_add_handle(clc.downloadCURLM, clc.downloadCURL);
-
- if(!(clc.sv_allowDownload & DLF_NO_DISCONNECT) &&
- !clc.cURLDisconnected) {
-
- CL_AddReliableCommand("disconnect");
- CL_WritePacket();
- CL_WritePacket();
- CL_WritePacket();
- clc.cURLDisconnected = qtrue;
- }
-}
-
-void CL_cURL_PerformDownload(void)
-{
- CURLMcode res;
- CURLMsg *msg;
- int c;
- int i = 0;
-
- res = qcurl_multi_perform(clc.downloadCURLM, &c);
- while(res == CURLM_CALL_MULTI_PERFORM && i < 100) {
- res = qcurl_multi_perform(clc.downloadCURLM, &c);
- i++;
- }
- if(res == CURLM_CALL_MULTI_PERFORM)
- return;
- msg = qcurl_multi_info_read(clc.downloadCURLM, &c);
- if(msg == NULL) {
- return;
- }
- FS_FCloseFile(clc.download);
- if(msg->msg == CURLMSG_DONE && msg->data.result == CURLE_OK) {
- FS_SV_Rename(clc.downloadTempName, clc.downloadName);
- clc.downloadRestart = qtrue;
- }
- else {
- long code;
-
- qcurl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE,
- &code);
- Com_Error(ERR_DROP, "Download Error: %s Code: %ld URL: %s",
- qcurl_easy_strerror(msg->data.result),
- code, clc.downloadURL);
- }
- *clc.downloadTempName = *clc.downloadName = 0;
- Cvar_Set( "cl_downloadName", "" );
- CL_NextDownload();
-}
-#endif /* USE_CURL */
diff --git a/src/client/cl_curl.h b/src/client/cl_curl.h
deleted file mode 100644
index 7b3f892..0000000
--- a/src/client/cl_curl.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 2006 Tony J. White (tjw@tjw.org)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-
-#ifndef __QCURL_H__
-#define __QCURL_H__
-
-extern cvar_t *cl_cURLLib;
-
-#include "../qcommon/q_shared.h"
-#include "../qcommon/qcommon.h"
-
-#ifdef WIN32
-#define DEFAULT_CURL_LIB "libcurl-3.dll"
-#elif defined(MACOS_X)
-#define DEFAULT_CURL_LIB "libcurl.dylib"
-#else
-#define DEFAULT_CURL_LIB "libcurl.so.3"
-#endif
-
-#if USE_LOCAL_HEADERS
- #include "../libcurl/curl/curl.h"
-#else
- #include
-#endif
-
-
-#if USE_CURL_DLOPEN
-extern char* (*qcurl_version)(void);
-
-extern CURL* (*qcurl_easy_init)(void);
-extern CURLcode (*qcurl_easy_setopt)(CURL *curl, CURLoption option, ...);
-extern CURLcode (*qcurl_easy_perform)(CURL *curl);
-extern void (*qcurl_easy_cleanup)(CURL *curl);
-extern CURLcode (*qcurl_easy_getinfo)(CURL *curl, CURLINFO info, ...);
-extern void (*qcurl_easy_reset)(CURL *curl);
-extern const char *(*qcurl_easy_strerror)(CURLcode);
-
-extern CURLM* (*qcurl_multi_init)(void);
-extern CURLMcode (*qcurl_multi_add_handle)(CURLM *multi_handle,
- CURL *curl_handle);
-extern CURLMcode (*qcurl_multi_remove_handle)(CURLM *multi_handle,
- CURL *curl_handle);
-extern CURLMcode (*qcurl_multi_fdset)(CURLM *multi_handle,
- fd_set *read_fd_set,
- fd_set *write_fd_set,
- fd_set *exc_fd_set,
- int *max_fd);
-extern CURLMcode (*qcurl_multi_perform)(CURLM *multi_handle,
- int *running_handles);
-extern CURLMcode (*qcurl_multi_cleanup)(CURLM *multi_handle);
-extern CURLMsg *(*qcurl_multi_info_read)(CURLM *multi_handle,
- int *msgs_in_queue);
-extern const char *(*qcurl_multi_strerror)(CURLMcode);
-#else
-#define qcurl_version curl_version
-
-#define qcurl_easy_init curl_easy_init
-#define qcurl_easy_setopt curl_easy_setopt
-#define qcurl_easy_perform curl_easy_perform
-#define qcurl_easy_cleanup curl_easy_cleanup
-#define qcurl_easy_getinfo curl_easy_getinfo
-#define qcurl_easy_duphandle curl_easy_duphandle
-#define qcurl_easy_reset curl_easy_reset
-#define qcurl_easy_strerror curl_easy_strerror
-
-#define qcurl_multi_init curl_multi_init
-#define qcurl_multi_add_handle curl_multi_add_handle
-#define qcurl_multi_remove_handle curl_multi_remove_handle
-#define qcurl_multi_fdset curl_multi_fdset
-#define qcurl_multi_perform curl_multi_perform
-#define qcurl_multi_cleanup curl_multi_cleanup
-#define qcurl_multi_info_read curl_multi_info_read
-#define qcurl_multi_strerror curl_multi_strerror
-#endif
-
-qboolean CL_cURL_Init( void );
-void CL_cURL_Shutdown( void );
-void CL_cURL_BeginDownload( const char *localName, const char *remoteURL );
-void CL_cURL_PerformDownload( void );
-void CL_cURL_Cleanup( void );
-#endif // __QCURL_H__
diff --git a/src/client/cl_input.c b/src/client/cl_input.c
deleted file mode 100644
index 6faec21..0000000
--- a/src/client/cl_input.c
+++ /dev/null
@@ -1,903 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// cl.input.c -- builds an intended movement command to send to the server
-
-#include "client.h"
-
-unsigned frame_msec;
-int old_com_frameTime;
-
-/*
-===============================================================================
-
-KEY BUTTONS
-
-Continuous button event tracking is complicated by the fact that two different
-input sources (say, mouse button 1 and the control key) can both press the
-same button, but the button should only be released when both of the
-pressing key have been released.
-
-When a key event issues a button command (+forward, +attack, etc), it appends
-its key number as argv(1) so it can be matched up with the release.
-
-argv(2) will be set to the time the event happened, which allows exact
-control even at low framerates when the down and up events may both get qued
-at the same time.
-
-===============================================================================
-*/
-
-
-kbutton_t in_left, in_right, in_forward, in_back;
-kbutton_t in_lookup, in_lookdown, in_moveleft, in_moveright;
-kbutton_t in_strafe, in_speed;
-kbutton_t in_up, in_down;
-
-kbutton_t in_buttons[16];
-
-
-qboolean in_mlooking;
-
-
-void IN_MLookDown( void ) {
- in_mlooking = qtrue;
-}
-
-void IN_MLookUp( void ) {
- in_mlooking = qfalse;
- if ( !cl_freelook->integer ) {
- IN_CenterView ();
- }
-}
-
-void IN_KeyDown( kbutton_t *b ) {
- int k;
- char *c;
-
- c = Cmd_Argv(1);
- if ( c[0] ) {
- k = atoi(c);
- } else {
- k = -1; // typed manually at the console for continuous down
- }
-
- if ( k == b->down[0] || k == b->down[1] ) {
- return; // repeating key
- }
-
- if ( !b->down[0] ) {
- b->down[0] = k;
- } else if ( !b->down[1] ) {
- b->down[1] = k;
- } else {
- Com_Printf ("Three keys down for a button!\n");
- return;
- }
-
- if ( b->active ) {
- return; // still down
- }
-
- // save timestamp for partial frame summing
- c = Cmd_Argv(2);
- b->downtime = atoi(c);
-
- b->active = qtrue;
- b->wasPressed = qtrue;
-}
-
-void IN_KeyUp( kbutton_t *b ) {
- int k;
- char *c;
- unsigned uptime;
-
- c = Cmd_Argv(1);
- if ( c[0] ) {
- k = atoi(c);
- } else {
- // typed manually at the console, assume for unsticking, so clear all
- b->down[0] = b->down[1] = 0;
- b->active = qfalse;
- return;
- }
-
- if ( b->down[0] == k ) {
- b->down[0] = 0;
- } else if ( b->down[1] == k ) {
- b->down[1] = 0;
- } else {
- return; // key up without coresponding down (menu pass through)
- }
- if ( b->down[0] || b->down[1] ) {
- return; // some other key is still holding it down
- }
-
- b->active = qfalse;
-
- // save timestamp for partial frame summing
- c = Cmd_Argv(2);
- uptime = atoi(c);
- if ( uptime ) {
- b->msec += uptime - b->downtime;
- } else {
- b->msec += frame_msec / 2;
- }
-
- b->active = qfalse;
-}
-
-
-
-/*
-===============
-CL_KeyState
-
-Returns the fraction of the frame that the key was down
-===============
-*/
-float CL_KeyState( kbutton_t *key ) {
- float val;
- int msec;
-
- msec = key->msec;
- key->msec = 0;
-
- if ( key->active ) {
- // still down
- if ( !key->downtime ) {
- msec = com_frameTime;
- } else {
- msec += com_frameTime - key->downtime;
- }
- key->downtime = com_frameTime;
- }
-
-#if 0
- if (msec) {
- Com_Printf ("%i ", msec);
- }
-#endif
-
- val = (float)msec / frame_msec;
- if ( val < 0 ) {
- val = 0;
- }
- if ( val > 1 ) {
- val = 1;
- }
-
- return val;
-}
-
-
-
-void IN_UpDown(void) {IN_KeyDown(&in_up);}
-void IN_UpUp(void) {IN_KeyUp(&in_up);}
-void IN_DownDown(void) {IN_KeyDown(&in_down);}
-void IN_DownUp(void) {IN_KeyUp(&in_down);}
-void IN_LeftDown(void) {IN_KeyDown(&in_left);}
-void IN_LeftUp(void) {IN_KeyUp(&in_left);}
-void IN_RightDown(void) {IN_KeyDown(&in_right);}
-void IN_RightUp(void) {IN_KeyUp(&in_right);}
-void IN_ForwardDown(void) {IN_KeyDown(&in_forward);}
-void IN_ForwardUp(void) {IN_KeyUp(&in_forward);}
-void IN_BackDown(void) {IN_KeyDown(&in_back);}
-void IN_BackUp(void) {IN_KeyUp(&in_back);}
-void IN_LookupDown(void) {IN_KeyDown(&in_lookup);}
-void IN_LookupUp(void) {IN_KeyUp(&in_lookup);}
-void IN_LookdownDown(void) {IN_KeyDown(&in_lookdown);}
-void IN_LookdownUp(void) {IN_KeyUp(&in_lookdown);}
-void IN_MoveleftDown(void) {IN_KeyDown(&in_moveleft);}
-void IN_MoveleftUp(void) {IN_KeyUp(&in_moveleft);}
-void IN_MoverightDown(void) {IN_KeyDown(&in_moveright);}
-void IN_MoverightUp(void) {IN_KeyUp(&in_moveright);}
-
-void IN_SpeedDown(void) {IN_KeyDown(&in_speed);}
-void IN_SpeedUp(void) {IN_KeyUp(&in_speed);}
-void IN_StrafeDown(void) {IN_KeyDown(&in_strafe);}
-void IN_StrafeUp(void) {IN_KeyUp(&in_strafe);}
-
-void IN_Button0Down(void) {IN_KeyDown(&in_buttons[0]);}
-void IN_Button0Up(void) {IN_KeyUp(&in_buttons[0]);}
-void IN_Button1Down(void) {IN_KeyDown(&in_buttons[1]);}
-void IN_Button1Up(void) {IN_KeyUp(&in_buttons[1]);}
-void IN_Button2Down(void) {IN_KeyDown(&in_buttons[2]);}
-void IN_Button2Up(void) {IN_KeyUp(&in_buttons[2]);}
-void IN_Button3Down(void) {IN_KeyDown(&in_buttons[3]);}
-void IN_Button3Up(void) {IN_KeyUp(&in_buttons[3]);}
-void IN_Button4Down(void) {IN_KeyDown(&in_buttons[4]);}
-void IN_Button4Up(void) {IN_KeyUp(&in_buttons[4]);}
-void IN_Button5Down(void) {IN_KeyDown(&in_buttons[5]);}
-void IN_Button5Up(void) {IN_KeyUp(&in_buttons[5]);}
-void IN_Button6Down(void) {IN_KeyDown(&in_buttons[6]);}
-void IN_Button6Up(void) {IN_KeyUp(&in_buttons[6]);}
-void IN_Button7Down(void) {IN_KeyDown(&in_buttons[7]);}
-void IN_Button7Up(void) {IN_KeyUp(&in_buttons[7]);}
-void IN_Button8Down(void) {IN_KeyDown(&in_buttons[8]);}
-void IN_Button8Up(void) {IN_KeyUp(&in_buttons[8]);}
-void IN_Button9Down(void) {IN_KeyDown(&in_buttons[9]);}
-void IN_Button9Up(void) {IN_KeyUp(&in_buttons[9]);}
-void IN_Button10Down(void) {IN_KeyDown(&in_buttons[10]);}
-void IN_Button10Up(void) {IN_KeyUp(&in_buttons[10]);}
-void IN_Button11Down(void) {IN_KeyDown(&in_buttons[11]);}
-void IN_Button11Up(void) {IN_KeyUp(&in_buttons[11]);}
-void IN_Button12Down(void) {IN_KeyDown(&in_buttons[12]);}
-void IN_Button12Up(void) {IN_KeyUp(&in_buttons[12]);}
-void IN_Button13Down(void) {IN_KeyDown(&in_buttons[13]);}
-void IN_Button13Up(void) {IN_KeyUp(&in_buttons[13]);}
-void IN_Button14Down(void) {IN_KeyDown(&in_buttons[14]);}
-void IN_Button14Up(void) {IN_KeyUp(&in_buttons[14]);}
-void IN_Button15Down(void) {IN_KeyDown(&in_buttons[15]);}
-void IN_Button15Up(void) {IN_KeyUp(&in_buttons[15]);}
-
-void IN_ButtonDown (void) {
- IN_KeyDown(&in_buttons[1]);}
-void IN_ButtonUp (void) {
- IN_KeyUp(&in_buttons[1]);}
-
-void IN_CenterView (void) {
- cl.viewangles[PITCH] = -SHORT2ANGLE(cl.snap.ps.delta_angles[PITCH]);
-}
-
-
-//==========================================================================
-
-cvar_t *cl_upspeed;
-cvar_t *cl_forwardspeed;
-cvar_t *cl_sidespeed;
-
-cvar_t *cl_yawspeed;
-cvar_t *cl_pitchspeed;
-
-cvar_t *cl_run;
-
-cvar_t *cl_anglespeedkey;
-
-
-/*
-================
-CL_AdjustAngles
-
-Moves the local angle positions
-================
-*/
-void CL_AdjustAngles( void ) {
- float speed;
-
- if ( in_speed.active ) {
- speed = 0.001 * cls.frametime * cl_anglespeedkey->value;
- } else {
- speed = 0.001 * cls.frametime;
- }
-
- if ( !in_strafe.active ) {
- cl.viewangles[YAW] -= speed*cl_yawspeed->value*CL_KeyState (&in_right);
- cl.viewangles[YAW] += speed*cl_yawspeed->value*CL_KeyState (&in_left);
- }
-
- cl.viewangles[PITCH] -= speed*cl_pitchspeed->value * CL_KeyState (&in_lookup);
- cl.viewangles[PITCH] += speed*cl_pitchspeed->value * CL_KeyState (&in_lookdown);
-}
-
-/*
-================
-CL_KeyMove
-
-Sets the usercmd_t based on key states
-================
-*/
-void CL_KeyMove( usercmd_t *cmd ) {
- int movespeed;
- int forward, side, up;
-
- //
- // adjust for speed key / running
- // the walking flag is to keep animations consistant
- // even during acceleration and develeration
- //
- if ( in_speed.active ^ cl_run->integer ) {
- movespeed = 127;
- cmd->buttons &= ~BUTTON_WALKING;
- } else {
- cmd->buttons |= BUTTON_WALKING;
- movespeed = 64;
- }
-
- forward = 0;
- side = 0;
- up = 0;
- if ( in_strafe.active ) {
- side += movespeed * CL_KeyState (&in_right);
- side -= movespeed * CL_KeyState (&in_left);
- }
-
- side += movespeed * CL_KeyState (&in_moveright);
- side -= movespeed * CL_KeyState (&in_moveleft);
-
-
- up += movespeed * CL_KeyState (&in_up);
- up -= movespeed * CL_KeyState (&in_down);
-
- forward += movespeed * CL_KeyState (&in_forward);
- forward -= movespeed * CL_KeyState (&in_back);
-
- cmd->forwardmove = ClampChar( forward );
- cmd->rightmove = ClampChar( side );
- cmd->upmove = ClampChar( up );
-}
-
-/*
-=================
-CL_MouseEvent
-=================
-*/
-void CL_MouseEvent( int dx, int dy, int time ) {
- if ( cls.keyCatchers & KEYCATCH_UI ) {
- VM_Call( uivm, UI_MOUSE_EVENT, dx, dy );
- } else if (cls.keyCatchers & KEYCATCH_CGAME) {
- VM_Call (cgvm, CG_MOUSE_EVENT, dx, dy);
- } else {
- cl.mouseDx[cl.mouseIndex] += dx;
- cl.mouseDy[cl.mouseIndex] += dy;
- }
-}
-
-/*
-=================
-CL_JoystickEvent
-
-Joystick values stay set until changed
-=================
-*/
-void CL_JoystickEvent( int axis, int value, int time ) {
- if ( axis < 0 || axis >= MAX_JOYSTICK_AXIS ) {
- Com_Error( ERR_DROP, "CL_JoystickEvent: bad axis %i", axis );
- }
- cl.joystickAxis[axis] = value;
-}
-
-/*
-=================
-CL_JoystickMove
-=================
-*/
-void CL_JoystickMove( usercmd_t *cmd ) {
- int movespeed;
- float anglespeed;
-
- if ( in_speed.active ^ cl_run->integer ) {
- movespeed = 2;
- } else {
- movespeed = 1;
- cmd->buttons |= BUTTON_WALKING;
- }
-
- if ( in_speed.active ) {
- anglespeed = 0.001 * cls.frametime * cl_anglespeedkey->value;
- } else {
- anglespeed = 0.001 * cls.frametime;
- }
-
- if ( !in_strafe.active ) {
- cl.viewangles[YAW] += anglespeed * cl_yawspeed->value * cl.joystickAxis[AXIS_SIDE];
- } else {
- cmd->rightmove = ClampChar( cmd->rightmove + cl.joystickAxis[AXIS_SIDE] );
- }
-
- if ( in_mlooking ) {
- cl.viewangles[PITCH] += anglespeed * cl_pitchspeed->value * cl.joystickAxis[AXIS_FORWARD];
- } else {
- cmd->forwardmove = ClampChar( cmd->forwardmove + cl.joystickAxis[AXIS_FORWARD] );
- }
-
- cmd->upmove = ClampChar( cmd->upmove + cl.joystickAxis[AXIS_UP] );
-}
-
-/*
-=================
-CL_MouseMove
-=================
-*/
-void CL_MouseMove( usercmd_t *cmd ) {
- float mx, my;
- float accelSensitivity;
- float rate;
-
- // allow mouse smoothing
- if ( m_filter->integer ) {
- mx = ( cl.mouseDx[0] + cl.mouseDx[1] ) * 0.5;
- my = ( cl.mouseDy[0] + cl.mouseDy[1] ) * 0.5;
- } else {
- mx = cl.mouseDx[cl.mouseIndex];
- my = cl.mouseDy[cl.mouseIndex];
- }
- cl.mouseIndex ^= 1;
- cl.mouseDx[cl.mouseIndex] = 0;
- cl.mouseDy[cl.mouseIndex] = 0;
-
- rate = sqrt( mx * mx + my * my ) / (float)frame_msec;
- accelSensitivity = ( cl_sensitivity->value *
- cl_platformSensitivity->value ) + rate * cl_mouseAccel->value;
-
- // scale by FOV
- accelSensitivity *= cl.cgameSensitivity;
-
- if ( rate && cl_showMouseRate->integer ) {
- Com_Printf( "%f : %f\n", rate, accelSensitivity );
- }
-
- mx *= accelSensitivity;
- my *= accelSensitivity;
-
- if (!mx && !my) {
- return;
- }
-
- // add mouse X/Y movement to cmd
- if ( in_strafe.active ) {
- cmd->rightmove = ClampChar( cmd->rightmove + m_side->value * mx );
- } else {
- cl.viewangles[YAW] -= m_yaw->value * mx;
- }
-
- if ( (in_mlooking || cl_freelook->integer) && !in_strafe.active ) {
- cl.viewangles[PITCH] += m_pitch->value * my;
- } else {
- cmd->forwardmove = ClampChar( cmd->forwardmove - m_forward->value * my );
- }
-}
-
-
-/*
-==============
-CL_CmdButtons
-==============
-*/
-void CL_CmdButtons( usercmd_t *cmd ) {
- int i;
-
- //
- // figure button bits
- // send a button bit even if the key was pressed and released in
- // less than a frame
- //
- for (i = 0 ; i < 15 ; i++) {
- if ( in_buttons[i].active || in_buttons[i].wasPressed ) {
- cmd->buttons |= 1 << i;
- }
- in_buttons[i].wasPressed = qfalse;
- }
-
- if ( cls.keyCatchers ) {
- cmd->buttons |= BUTTON_TALK;
- }
-
- // allow the game to know if any key at all is
- // currently pressed, even if it isn't bound to anything
- if ( anykeydown && !cls.keyCatchers ) {
- cmd->buttons |= BUTTON_ANY;
- }
-}
-
-
-/*
-==============
-CL_FinishMove
-==============
-*/
-void CL_FinishMove( usercmd_t *cmd ) {
- int i;
-
- // copy the state that the cgame is currently sending
- cmd->weapon = cl.cgameUserCmdValue;
-
- // send the current server time so the amount of movement
- // can be determined without allowing cheating
- cmd->serverTime = cl.serverTime;
-
- for (i=0 ; i<3 ; i++) {
- cmd->angles[i] = ANGLE2SHORT(cl.viewangles[i]);
- }
-}
-
-
-/*
-=================
-CL_CreateCmd
-=================
-*/
-usercmd_t CL_CreateCmd( void ) {
- usercmd_t cmd;
- vec3_t oldAngles;
-
- VectorCopy( cl.viewangles, oldAngles );
-
- // keyboard angle adjustment
- CL_AdjustAngles ();
-
- Com_Memset( &cmd, 0, sizeof( cmd ) );
-
- CL_CmdButtons( &cmd );
-
- // get basic movement from keyboard
- CL_KeyMove( &cmd );
-
- // get basic movement from mouse
- CL_MouseMove( &cmd );
-
- // get basic movement from joystick
- CL_JoystickMove( &cmd );
-
- // check to make sure the angles haven't wrapped
- if ( cl.viewangles[PITCH] - oldAngles[PITCH] > 90 ) {
- cl.viewangles[PITCH] = oldAngles[PITCH] + 90;
- } else if ( oldAngles[PITCH] - cl.viewangles[PITCH] > 90 ) {
- cl.viewangles[PITCH] = oldAngles[PITCH] - 90;
- }
-
- // store out the final values
- CL_FinishMove( &cmd );
-
- // draw debug graphs of turning for mouse testing
- if ( cl_debugMove->integer ) {
- if ( cl_debugMove->integer == 1 ) {
- SCR_DebugGraph( abs(cl.viewangles[YAW] - oldAngles[YAW]), 0 );
- }
- if ( cl_debugMove->integer == 2 ) {
- SCR_DebugGraph( abs(cl.viewangles[PITCH] - oldAngles[PITCH]), 0 );
- }
- }
-
- return cmd;
-}
-
-
-/*
-=================
-CL_CreateNewCommands
-
-Create a new usercmd_t structure for this frame
-=================
-*/
-void CL_CreateNewCommands( void ) {
- usercmd_t *cmd;
- int cmdNum;
-
- // no need to create usercmds until we have a gamestate
- if ( cls.state < CA_PRIMED ) {
- return;
- }
-
- frame_msec = com_frameTime - old_com_frameTime;
-
- // if running less than 5fps, truncate the extra time to prevent
- // unexpected moves after a hitch
- if ( frame_msec > 200 ) {
- frame_msec = 200;
- }
- old_com_frameTime = com_frameTime;
-
-
- // generate a command for this frame
- cl.cmdNumber++;
- cmdNum = cl.cmdNumber & CMD_MASK;
- cl.cmds[cmdNum] = CL_CreateCmd ();
- cmd = &cl.cmds[cmdNum];
-}
-
-/*
-=================
-CL_ReadyToSendPacket
-
-Returns qfalse if we are over the maxpackets limit
-and should choke back the bandwidth a bit by not sending
-a packet this frame. All the commands will still get
-delivered in the next packet, but saving a header and
-getting more delta compression will reduce total bandwidth.
-=================
-*/
-qboolean CL_ReadyToSendPacket( void ) {
- int oldPacketNum;
- int delta;
-
- // don't send anything if playing back a demo
- if ( clc.demoplaying || cls.state == CA_CINEMATIC ) {
- return qfalse;
- }
-
- // If we are downloading, we send no less than 50ms between packets
- if ( *clc.downloadTempName &&
- cls.realtime - clc.lastPacketSentTime < 50 ) {
- return qfalse;
- }
-
- // if we don't have a valid gamestate yet, only send
- // one packet a second
- if ( cls.state != CA_ACTIVE &&
- cls.state != CA_PRIMED &&
- !*clc.downloadTempName &&
- cls.realtime - clc.lastPacketSentTime < 1000 ) {
- return qfalse;
- }
-
- // send every frame for loopbacks
- if ( clc.netchan.remoteAddress.type == NA_LOOPBACK ) {
- return qtrue;
- }
-
- // send every frame for LAN
- if ( cl_lanForcePackets->integer && Sys_IsLANAddress( clc.netchan.remoteAddress ) ) {
- return qtrue;
- }
-
- // check for exceeding cl_maxpackets
- if ( cl_maxpackets->integer < 15 ) {
- Cvar_Set( "cl_maxpackets", "15" );
- } else if ( cl_maxpackets->integer > 125 ) {
- Cvar_Set( "cl_maxpackets", "125" );
- }
- oldPacketNum = (clc.netchan.outgoingSequence - 1) & PACKET_MASK;
- delta = cls.realtime - cl.outPackets[ oldPacketNum ].p_realtime;
- if ( delta < 1000 / cl_maxpackets->integer ) {
- // the accumulated commands will go out in the next packet
- return qfalse;
- }
-
- return qtrue;
-}
-
-/*
-===================
-CL_WritePacket
-
-Create and send the command packet to the server
-Including both the reliable commands and the usercmds
-
-During normal gameplay, a client packet will contain something like:
-
-4 sequence number
-2 qport
-4 serverid
-4 acknowledged sequence number
-4 clc.serverCommandSequence
-
-1 clc_move or clc_moveNoDelta
-1 command count
-
-
-===================
-*/
-void CL_WritePacket( void ) {
- msg_t buf;
- byte data[MAX_MSGLEN];
- int i, j;
- usercmd_t *cmd, *oldcmd;
- usercmd_t nullcmd;
- int packetNum;
- int oldPacketNum;
- int count, key;
-
- // don't send anything if playing back a demo
- if ( clc.demoplaying || cls.state == CA_CINEMATIC ) {
- return;
- }
-
- Com_Memset( &nullcmd, 0, sizeof(nullcmd) );
- oldcmd = &nullcmd;
-
- MSG_Init( &buf, data, sizeof(data) );
-
- MSG_Bitstream( &buf );
- // write the current serverId so the server
- // can tell if this is from the current gameState
- MSG_WriteLong( &buf, cl.serverId );
-
- // write the last message we received, which can
- // be used for delta compression, and is also used
- // to tell if we dropped a gamestate
- MSG_WriteLong( &buf, clc.serverMessageSequence );
-
- // write the last reliable message we received
- MSG_WriteLong( &buf, clc.serverCommandSequence );
-
- // write any unacknowledged clientCommands
- for ( i = clc.reliableAcknowledge + 1 ; i <= clc.reliableSequence ; i++ ) {
- MSG_WriteByte( &buf, clc_clientCommand );
- MSG_WriteLong( &buf, i );
- MSG_WriteString( &buf, clc.reliableCommands[ i & (MAX_RELIABLE_COMMANDS-1) ] );
- }
-
- // we want to send all the usercmds that were generated in the last
- // few packet, so even if a couple packets are dropped in a row,
- // all the cmds will make it to the server
- if ( cl_packetdup->integer < 0 ) {
- Cvar_Set( "cl_packetdup", "0" );
- } else if ( cl_packetdup->integer > 5 ) {
- Cvar_Set( "cl_packetdup", "5" );
- }
- oldPacketNum = (clc.netchan.outgoingSequence - 1 - cl_packetdup->integer) & PACKET_MASK;
- count = cl.cmdNumber - cl.outPackets[ oldPacketNum ].p_cmdNumber;
- if ( count > MAX_PACKET_USERCMDS ) {
- count = MAX_PACKET_USERCMDS;
- Com_Printf("MAX_PACKET_USERCMDS\n");
- }
- if ( count >= 1 ) {
- if ( cl_showSend->integer ) {
- Com_Printf( "(%i)", count );
- }
-
- // begin a client move command
- if ( cl_nodelta->integer || !cl.snap.valid || clc.demowaiting
- || clc.serverMessageSequence != cl.snap.messageNum ) {
- MSG_WriteByte (&buf, clc_moveNoDelta);
- } else {
- MSG_WriteByte (&buf, clc_move);
- }
-
- // write the command count
- MSG_WriteByte( &buf, count );
-
- // use the checksum feed in the key
- key = clc.checksumFeed;
- // also use the message acknowledge
- key ^= clc.serverMessageSequence;
- // also use the last acknowledged server command in the key
- key ^= Com_HashKey(clc.serverCommands[ clc.serverCommandSequence & (MAX_RELIABLE_COMMANDS-1) ], 32);
-
- // write all the commands, including the predicted command
- for ( i = 0 ; i < count ; i++ ) {
- j = (cl.cmdNumber - count + i + 1) & CMD_MASK;
- cmd = &cl.cmds[j];
- MSG_WriteDeltaUsercmdKey (&buf, key, oldcmd, cmd);
- oldcmd = cmd;
- }
- }
-
- //
- // deliver the message
- //
- packetNum = clc.netchan.outgoingSequence & PACKET_MASK;
- cl.outPackets[ packetNum ].p_realtime = cls.realtime;
- cl.outPackets[ packetNum ].p_serverTime = oldcmd->serverTime;
- cl.outPackets[ packetNum ].p_cmdNumber = cl.cmdNumber;
- clc.lastPacketSentTime = cls.realtime;
-
- if ( cl_showSend->integer ) {
- Com_Printf( "%i ", buf.cursize );
- }
-
- CL_Netchan_Transmit (&clc.netchan, &buf);
-
- // clients never really should have messages large enough
- // to fragment, but in case they do, fire them all off
- // at once
- // TTimo: this causes a packet burst, which is bad karma for winsock
- // added a WARNING message, we'll see if there are legit situations where this happens
- while ( clc.netchan.unsentFragments ) {
- Com_DPrintf( "WARNING: #462 unsent fragments (not supposed to happen!)\n" );
- CL_Netchan_TransmitNextFragment( &clc.netchan );
- }
-}
-
-/*
-=================
-CL_SendCmd
-
-Called every frame to builds and sends a command packet to the server.
-=================
-*/
-void CL_SendCmd( void ) {
- // don't send any message if not connected
- if ( cls.state < CA_CONNECTED ) {
- return;
- }
-
- // don't send commands if paused
- if ( com_sv_running->integer && sv_paused->integer && cl_paused->integer ) {
- return;
- }
-
- // we create commands even if a demo is playing,
- CL_CreateNewCommands();
-
- // don't send a packet if the last packet was sent too recently
- if ( !CL_ReadyToSendPacket() ) {
- if ( cl_showSend->integer ) {
- Com_Printf( ". " );
- }
- return;
- }
-
- CL_WritePacket();
-}
-
-/*
-============
-CL_InitInput
-============
-*/
-void CL_InitInput( void ) {
- Cmd_AddCommand ("centerview",IN_CenterView);
-
- Cmd_AddCommand ("+moveup",IN_UpDown);
- Cmd_AddCommand ("-moveup",IN_UpUp);
- Cmd_AddCommand ("+movedown",IN_DownDown);
- Cmd_AddCommand ("-movedown",IN_DownUp);
- Cmd_AddCommand ("+left",IN_LeftDown);
- Cmd_AddCommand ("-left",IN_LeftUp);
- Cmd_AddCommand ("+right",IN_RightDown);
- Cmd_AddCommand ("-right",IN_RightUp);
- Cmd_AddCommand ("+forward",IN_ForwardDown);
- Cmd_AddCommand ("-forward",IN_ForwardUp);
- Cmd_AddCommand ("+back",IN_BackDown);
- Cmd_AddCommand ("-back",IN_BackUp);
- Cmd_AddCommand ("+lookup", IN_LookupDown);
- Cmd_AddCommand ("-lookup", IN_LookupUp);
- Cmd_AddCommand ("+lookdown", IN_LookdownDown);
- Cmd_AddCommand ("-lookdown", IN_LookdownUp);
- Cmd_AddCommand ("+strafe", IN_StrafeDown);
- Cmd_AddCommand ("-strafe", IN_StrafeUp);
- Cmd_AddCommand ("+moveleft", IN_MoveleftDown);
- Cmd_AddCommand ("-moveleft", IN_MoveleftUp);
- Cmd_AddCommand ("+moveright", IN_MoverightDown);
- Cmd_AddCommand ("-moveright", IN_MoverightUp);
- Cmd_AddCommand ("+speed", IN_SpeedDown);
- Cmd_AddCommand ("-speed", IN_SpeedUp);
- Cmd_AddCommand ("+attack", IN_Button0Down);
- Cmd_AddCommand ("-attack", IN_Button0Up);
- Cmd_AddCommand ("+button0", IN_Button0Down);
- Cmd_AddCommand ("-button0", IN_Button0Up);
- Cmd_AddCommand ("+button1", IN_Button1Down);
- Cmd_AddCommand ("-button1", IN_Button1Up);
- Cmd_AddCommand ("+button2", IN_Button2Down);
- Cmd_AddCommand ("-button2", IN_Button2Up);
- Cmd_AddCommand ("+button3", IN_Button3Down);
- Cmd_AddCommand ("-button3", IN_Button3Up);
- Cmd_AddCommand ("+button4", IN_Button4Down);
- Cmd_AddCommand ("-button4", IN_Button4Up);
- Cmd_AddCommand ("+button5", IN_Button5Down);
- Cmd_AddCommand ("-button5", IN_Button5Up);
- Cmd_AddCommand ("+button6", IN_Button6Down);
- Cmd_AddCommand ("-button6", IN_Button6Up);
- Cmd_AddCommand ("+button7", IN_Button7Down);
- Cmd_AddCommand ("-button7", IN_Button7Up);
- Cmd_AddCommand ("+button8", IN_Button8Down);
- Cmd_AddCommand ("-button8", IN_Button8Up);
- Cmd_AddCommand ("+button9", IN_Button9Down);
- Cmd_AddCommand ("-button9", IN_Button9Up);
- Cmd_AddCommand ("+button10", IN_Button10Down);
- Cmd_AddCommand ("-button10", IN_Button10Up);
- Cmd_AddCommand ("+button11", IN_Button11Down);
- Cmd_AddCommand ("-button11", IN_Button11Up);
- Cmd_AddCommand ("+button12", IN_Button12Down);
- Cmd_AddCommand ("-button12", IN_Button12Up);
- Cmd_AddCommand ("+button13", IN_Button13Down);
- Cmd_AddCommand ("-button13", IN_Button13Up);
- Cmd_AddCommand ("+button14", IN_Button14Down);
- Cmd_AddCommand ("-button14", IN_Button14Up);
- Cmd_AddCommand ("+mlook", IN_MLookDown);
- Cmd_AddCommand ("-mlook", IN_MLookUp);
-
- cl_nodelta = Cvar_Get ("cl_nodelta", "0", 0);
- cl_debugMove = Cvar_Get ("cl_debugMove", "0", 0);
-}
diff --git a/src/client/cl_keys.c b/src/client/cl_keys.c
deleted file mode 100644
index b283ffb..0000000
--- a/src/client/cl_keys.c
+++ /dev/null
@@ -1,1549 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-#include "client.h"
-
-/*
-
-key up events are sent even if in console mode
-
-*/
-
-field_t historyEditLines[COMMAND_HISTORY];
-
-int nextHistoryLine; // the last line in the history buffer, not masked
-int historyLine; // the line being displayed from history buffer
- // will be <= nextHistoryLine
-
-field_t g_consoleField;
-field_t chatField;
-qboolean chat_team;
-
-int chat_playerNum;
-
-
-qboolean key_overstrikeMode;
-
-int anykeydown;
-qkey_t keys[MAX_KEYS];
-
-
-typedef struct {
- char *name;
- int keynum;
-} keyname_t;
-
-
-// names not in this list can either be lowercase ascii, or '0xnn' hex sequences
-keyname_t keynames[] =
-{
- {"TAB", K_TAB},
- {"ENTER", K_ENTER},
- {"ESCAPE", K_ESCAPE},
- {"SPACE", K_SPACE},
- {"BACKSPACE", K_BACKSPACE},
- {"UPARROW", K_UPARROW},
- {"DOWNARROW", K_DOWNARROW},
- {"LEFTARROW", K_LEFTARROW},
- {"RIGHTARROW", K_RIGHTARROW},
-
- {"ALT", K_ALT},
- {"CTRL", K_CTRL},
- {"SHIFT", K_SHIFT},
-
- {"COMMAND", K_COMMAND},
-
- {"CAPSLOCK", K_CAPSLOCK},
-
-
- {"F1", K_F1},
- {"F2", K_F2},
- {"F3", K_F3},
- {"F4", K_F4},
- {"F5", K_F5},
- {"F6", K_F6},
- {"F7", K_F7},
- {"F8", K_F8},
- {"F9", K_F9},
- {"F10", K_F10},
- {"F11", K_F11},
- {"F12", K_F12},
- {"F13", K_F13},
- {"F14", K_F14},
- {"F15", K_F15},
-
- {"INS", K_INS},
- {"DEL", K_DEL},
- {"PGDN", K_PGDN},
- {"PGUP", K_PGUP},
- {"HOME", K_HOME},
- {"END", K_END},
-
- {"MOUSE1", K_MOUSE1},
- {"MOUSE2", K_MOUSE2},
- {"MOUSE3", K_MOUSE3},
- {"MOUSE4", K_MOUSE4},
- {"MOUSE5", K_MOUSE5},
-
- {"MWHEELUP", K_MWHEELUP },
- {"MWHEELDOWN", K_MWHEELDOWN },
-
- {"JOY1", K_JOY1},
- {"JOY2", K_JOY2},
- {"JOY3", K_JOY3},
- {"JOY4", K_JOY4},
- {"JOY5", K_JOY5},
- {"JOY6", K_JOY6},
- {"JOY7", K_JOY7},
- {"JOY8", K_JOY8},
- {"JOY9", K_JOY9},
- {"JOY10", K_JOY10},
- {"JOY11", K_JOY11},
- {"JOY12", K_JOY12},
- {"JOY13", K_JOY13},
- {"JOY14", K_JOY14},
- {"JOY15", K_JOY15},
- {"JOY16", K_JOY16},
- {"JOY17", K_JOY17},
- {"JOY18", K_JOY18},
- {"JOY19", K_JOY19},
- {"JOY20", K_JOY20},
- {"JOY21", K_JOY21},
- {"JOY22", K_JOY22},
- {"JOY23", K_JOY23},
- {"JOY24", K_JOY24},
- {"JOY25", K_JOY25},
- {"JOY26", K_JOY26},
- {"JOY27", K_JOY27},
- {"JOY28", K_JOY28},
- {"JOY29", K_JOY29},
- {"JOY30", K_JOY30},
- {"JOY31", K_JOY31},
- {"JOY32", K_JOY32},
-
- {"AUX1", K_AUX1},
- {"AUX2", K_AUX2},
- {"AUX3", K_AUX3},
- {"AUX4", K_AUX4},
- {"AUX5", K_AUX5},
- {"AUX6", K_AUX6},
- {"AUX7", K_AUX7},
- {"AUX8", K_AUX8},
- {"AUX9", K_AUX9},
- {"AUX10", K_AUX10},
- {"AUX11", K_AUX11},
- {"AUX12", K_AUX12},
- {"AUX13", K_AUX13},
- {"AUX14", K_AUX14},
- {"AUX15", K_AUX15},
- {"AUX16", K_AUX16},
-
- {"KP_HOME", K_KP_HOME },
- {"KP_UPARROW", K_KP_UPARROW },
- {"KP_PGUP", K_KP_PGUP },
- {"KP_LEFTARROW", K_KP_LEFTARROW },
- {"KP_5", K_KP_5 },
- {"KP_RIGHTARROW", K_KP_RIGHTARROW },
- {"KP_END", K_KP_END },
- {"KP_DOWNARROW", K_KP_DOWNARROW },
- {"KP_PGDN", K_KP_PGDN },
- {"KP_ENTER", K_KP_ENTER },
- {"KP_INS", K_KP_INS },
- {"KP_DEL", K_KP_DEL },
- {"KP_SLASH", K_KP_SLASH },
- {"KP_MINUS", K_KP_MINUS },
- {"KP_PLUS", K_KP_PLUS },
- {"KP_NUMLOCK", K_KP_NUMLOCK },
- {"KP_STAR", K_KP_STAR },
- {"KP_EQUALS", K_KP_EQUALS },
-
- {"PAUSE", K_PAUSE},
-
- {"SEMICOLON", ';'}, // because a raw semicolon seperates commands
-
- {"WORLD_0", K_WORLD_0},
- {"WORLD_1", K_WORLD_1},
- {"WORLD_2", K_WORLD_2},
- {"WORLD_3", K_WORLD_3},
- {"WORLD_4", K_WORLD_4},
- {"WORLD_5", K_WORLD_5},
- {"WORLD_6", K_WORLD_6},
- {"WORLD_7", K_WORLD_7},
- {"WORLD_8", K_WORLD_8},
- {"WORLD_9", K_WORLD_9},
- {"WORLD_10", K_WORLD_10},
- {"WORLD_11", K_WORLD_11},
- {"WORLD_12", K_WORLD_12},
- {"WORLD_13", K_WORLD_13},
- {"WORLD_14", K_WORLD_14},
- {"WORLD_15", K_WORLD_15},
- {"WORLD_16", K_WORLD_16},
- {"WORLD_17", K_WORLD_17},
- {"WORLD_18", K_WORLD_18},
- {"WORLD_19", K_WORLD_19},
- {"WORLD_20", K_WORLD_20},
- {"WORLD_21", K_WORLD_21},
- {"WORLD_22", K_WORLD_22},
- {"WORLD_23", K_WORLD_23},
- {"WORLD_24", K_WORLD_24},
- {"WORLD_25", K_WORLD_25},
- {"WORLD_26", K_WORLD_26},
- {"WORLD_27", K_WORLD_27},
- {"WORLD_28", K_WORLD_28},
- {"WORLD_29", K_WORLD_29},
- {"WORLD_30", K_WORLD_30},
- {"WORLD_31", K_WORLD_31},
- {"WORLD_32", K_WORLD_32},
- {"WORLD_33", K_WORLD_33},
- {"WORLD_34", K_WORLD_34},
- {"WORLD_35", K_WORLD_35},
- {"WORLD_36", K_WORLD_36},
- {"WORLD_37", K_WORLD_37},
- {"WORLD_38", K_WORLD_38},
- {"WORLD_39", K_WORLD_39},
- {"WORLD_40", K_WORLD_40},
- {"WORLD_41", K_WORLD_41},
- {"WORLD_42", K_WORLD_42},
- {"WORLD_43", K_WORLD_43},
- {"WORLD_44", K_WORLD_44},
- {"WORLD_45", K_WORLD_45},
- {"WORLD_46", K_WORLD_46},
- {"WORLD_47", K_WORLD_47},
- {"WORLD_48", K_WORLD_48},
- {"WORLD_49", K_WORLD_49},
- {"WORLD_50", K_WORLD_50},
- {"WORLD_51", K_WORLD_51},
- {"WORLD_52", K_WORLD_52},
- {"WORLD_53", K_WORLD_53},
- {"WORLD_54", K_WORLD_54},
- {"WORLD_55", K_WORLD_55},
- {"WORLD_56", K_WORLD_56},
- {"WORLD_57", K_WORLD_57},
- {"WORLD_58", K_WORLD_58},
- {"WORLD_59", K_WORLD_59},
- {"WORLD_60", K_WORLD_60},
- {"WORLD_61", K_WORLD_61},
- {"WORLD_62", K_WORLD_62},
- {"WORLD_63", K_WORLD_63},
- {"WORLD_64", K_WORLD_64},
- {"WORLD_65", K_WORLD_65},
- {"WORLD_66", K_WORLD_66},
- {"WORLD_67", K_WORLD_67},
- {"WORLD_68", K_WORLD_68},
- {"WORLD_69", K_WORLD_69},
- {"WORLD_70", K_WORLD_70},
- {"WORLD_71", K_WORLD_71},
- {"WORLD_72", K_WORLD_72},
- {"WORLD_73", K_WORLD_73},
- {"WORLD_74", K_WORLD_74},
- {"WORLD_75", K_WORLD_75},
- {"WORLD_76", K_WORLD_76},
- {"WORLD_77", K_WORLD_77},
- {"WORLD_78", K_WORLD_78},
- {"WORLD_79", K_WORLD_79},
- {"WORLD_80", K_WORLD_80},
- {"WORLD_81", K_WORLD_81},
- {"WORLD_82", K_WORLD_82},
- {"WORLD_83", K_WORLD_83},
- {"WORLD_84", K_WORLD_84},
- {"WORLD_85", K_WORLD_85},
- {"WORLD_86", K_WORLD_86},
- {"WORLD_87", K_WORLD_87},
- {"WORLD_88", K_WORLD_88},
- {"WORLD_89", K_WORLD_89},
- {"WORLD_90", K_WORLD_90},
- {"WORLD_91", K_WORLD_91},
- {"WORLD_92", K_WORLD_92},
- {"WORLD_93", K_WORLD_93},
- {"WORLD_94", K_WORLD_94},
- {"WORLD_95", K_WORLD_95},
-
- {"WINDOWS", K_SUPER},
- {"COMPOSE", K_COMPOSE},
- {"MODE", K_MODE},
- {"HELP", K_HELP},
- {"PRINT", K_PRINT},
- {"SYSREQ", K_SYSREQ},
- {"SCROLLOCK", K_SCROLLOCK },
- {"BREAK", K_BREAK},
- {"MENU", K_MENU},
- {"POWER", K_POWER},
- {"EURO", K_EURO},
- {"UNDO", K_UNDO},
-
- {NULL,0}
-};
-
-/*
-=============================================================================
-
-EDIT FIELDS
-
-=============================================================================
-*/
-
-
-/*
-===================
-Field_Draw
-
-Handles horizontal scrolling and cursor blinking
-x, y, amd width are in pixels
-===================
-*/
-void Field_VariableSizeDraw( field_t *edit, int x, int y, int width, int size, qboolean showCursor ) {
- int len;
- int drawLen;
- int prestep;
- int cursorChar;
- char str[MAX_STRING_CHARS];
- int i;
-
- drawLen = edit->widthInChars;
- len = strlen( edit->buffer ) + 1;
-
- // guarantee that cursor will be visible
- if ( len <= drawLen ) {
- prestep = 0;
- } else {
- if ( edit->scroll + drawLen > len ) {
- edit->scroll = len - drawLen;
- if ( edit->scroll < 0 ) {
- edit->scroll = 0;
- }
- }
- prestep = edit->scroll;
-
-/*
- if ( edit->cursor < len - drawLen ) {
- prestep = edit->cursor; // cursor at start
- } else {
- prestep = len - drawLen;
- }
-*/
- }
-
- if ( prestep + drawLen > len ) {
- drawLen = len - prestep;
- }
-
- // extract characters from the field at
- if ( drawLen >= MAX_STRING_CHARS ) {
- Com_Error( ERR_DROP, "drawLen >= MAX_STRING_CHARS" );
- }
-
- Com_Memcpy( str, edit->buffer + prestep, drawLen );
- str[ drawLen ] = 0;
-
- // draw it
- if ( size == SMALLCHAR_WIDTH ) {
- float color[4];
-
- color[0] = color[1] = color[2] = color[3] = 1.0;
- SCR_DrawSmallStringExt( x, y, str, color, qfalse );
- } else {
- // draw big string with drop shadow
- SCR_DrawBigString( x, y, str, 1.0 );
- }
-
- // draw the cursor
- if ( !showCursor ) {
- return;
- }
-
- if ( (int)( cls.realtime >> 8 ) & 1 ) {
- return; // off blink
- }
-
- if ( key_overstrikeMode ) {
- cursorChar = 11;
- } else {
- cursorChar = 10;
- }
-
- i = drawLen - ( Q_PrintStrlen( str ) + 1 );
-
- if ( size == SMALLCHAR_WIDTH ) {
- SCR_DrawSmallChar( x + ( edit->cursor - prestep - i ) * size, y, cursorChar );
- } else {
- str[0] = cursorChar;
- str[1] = 0;
- SCR_DrawBigString( x + ( edit->cursor - prestep - i ) * size, y, str, 1.0 );
-
- }
-}
-
-void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor )
-{
- Field_VariableSizeDraw( edit, x, y, width, SMALLCHAR_WIDTH, showCursor );
-}
-
-void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor )
-{
- Field_VariableSizeDraw( edit, x, y, width, BIGCHAR_WIDTH, showCursor );
-}
-
-/*
-================
-Field_Paste
-================
-*/
-void Field_Paste( field_t *edit ) {
- char *cbd;
- int pasteLen, i;
-
- cbd = Sys_GetClipboardData();
-
- if ( !cbd ) {
- return;
- }
-
- // send as if typed, so insert / overstrike works properly
- pasteLen = strlen( cbd );
- for ( i = 0 ; i < pasteLen ; i++ ) {
- Field_CharEvent( edit, cbd[i] );
- }
-
- Z_Free( cbd );
-}
-
-/*
-=================
-Field_KeyDownEvent
-
-Performs the basic line editing functions for the console,
-in-game talk, and menu fields
-
-Key events are used for non-printable characters, others are gotten from char events.
-=================
-*/
-void Field_KeyDownEvent( field_t *edit, int key ) {
- int len;
-
- // shift-insert is paste
- if ( ( ( key == K_INS ) || ( key == K_KP_INS ) ) && keys[K_SHIFT].down ) {
- Field_Paste( edit );
- return;
- }
-
- len = strlen( edit->buffer );
-
- if ( key == K_DEL ) {
- if ( edit->cursor < len ) {
- memmove( edit->buffer + edit->cursor,
- edit->buffer + edit->cursor + 1, len - edit->cursor );
- }
- return;
- }
-
- if ( key == K_RIGHTARROW )
- {
- if ( edit->cursor < len ) {
- edit->cursor++;
- }
-
- if ( edit->cursor >= edit->scroll + edit->widthInChars && edit->cursor <= len )
- {
- edit->scroll++;
- }
- return;
- }
-
- if ( key == K_LEFTARROW )
- {
- if ( edit->cursor > 0 ) {
- edit->cursor--;
- }
- if ( edit->cursor < edit->scroll )
- {
- edit->scroll--;
- }
- return;
- }
-
- if ( key == K_HOME || ( tolower(key) == 'a' && keys[K_CTRL].down ) ) {
- edit->cursor = 0;
- return;
- }
-
- if ( key == K_END || ( tolower(key) == 'e' && keys[K_CTRL].down ) ) {
- edit->cursor = len;
- return;
- }
-
- if ( key == K_INS ) {
- key_overstrikeMode = !key_overstrikeMode;
- return;
- }
-}
-
-/*
-==================
-Field_CharEvent
-==================
-*/
-void Field_CharEvent( field_t *edit, int ch ) {
- int len;
-
- if ( ch == 'v' - 'a' + 1 ) { // ctrl-v is paste
- Field_Paste( edit );
- return;
- }
-
- if ( ch == 'c' - 'a' + 1 ) { // ctrl-c clears the field
- Field_Clear( edit );
- return;
- }
-
- len = strlen( edit->buffer );
-
- if ( ch == 'h' - 'a' + 1 ) { // ctrl-h is backspace
- if ( edit->cursor > 0 ) {
- memmove( edit->buffer + edit->cursor - 1,
- edit->buffer + edit->cursor, len + 1 - edit->cursor );
- edit->cursor--;
- if ( edit->cursor < edit->scroll )
- {
- edit->scroll--;
- }
- }
- return;
- }
-
- if ( ch == 'a' - 'a' + 1 ) { // ctrl-a is home
- edit->cursor = 0;
- edit->scroll = 0;
- return;
- }
-
- if ( ch == 'e' - 'a' + 1 ) { // ctrl-e is end
- edit->cursor = len;
- edit->scroll = edit->cursor - edit->widthInChars;
- return;
- }
-
- //
- // ignore any other non printable chars
- //
- if ( ch < 32 ) {
- return;
- }
-
- if ( key_overstrikeMode ) {
- if ( edit->cursor == MAX_EDIT_LINE - 1 )
- return;
- edit->buffer[edit->cursor] = ch;
- edit->cursor++;
- } else { // insert mode
- if ( len == MAX_EDIT_LINE - 1 ) {
- return; // all full
- }
- memmove( edit->buffer + edit->cursor + 1,
- edit->buffer + edit->cursor, len + 1 - edit->cursor );
- edit->buffer[edit->cursor] = ch;
- edit->cursor++;
- }
-
-
- if ( edit->cursor >= edit->widthInChars ) {
- edit->scroll++;
- }
-
- if ( edit->cursor == len + 1) {
- edit->buffer[edit->cursor] = 0;
- }
-}
-
-/*
-=============================================================================
-
-CONSOLE LINE EDITING
-
-==============================================================================
-*/
-
-/*
-====================
-Console_Key
-
-Handles history and console scrollback
-====================
-*/
-void Console_Key (int key) {
- // ctrl-L clears screen
- if ( key == 'l' && keys[K_CTRL].down ) {
- Cbuf_AddText ("clear\n");
- return;
- }
-
- // enter finishes the line
- if ( key == K_ENTER || key == K_KP_ENTER ) {
- // if not in the game explicitly prepend a slash if needed
- if ( cls.state != CA_ACTIVE && g_consoleField.buffer[0] != '\\'
- && g_consoleField.buffer[0] != '/' ) {
- char temp[MAX_EDIT_LINE-1];
-
- Q_strncpyz( temp, g_consoleField.buffer, sizeof( temp ) );
- Com_sprintf( g_consoleField.buffer, sizeof( g_consoleField.buffer ), "\\%s", temp );
- g_consoleField.cursor++;
- }
-
- Com_Printf ( "]%s\n", g_consoleField.buffer );
-
- // leading slash is an explicit command
- if ( g_consoleField.buffer[0] == '\\' || g_consoleField.buffer[0] == '/' ) {
- Cbuf_AddText( g_consoleField.buffer+1 ); // valid command
- Cbuf_AddText ("\n");
- } else {
- // other text will be chat messages
- if ( !g_consoleField.buffer[0] ) {
- return; // empty lines just scroll the console without adding to history
- } else {
- Cbuf_AddText ("cmd say ");
- Cbuf_AddText( g_consoleField.buffer );
- Cbuf_AddText ("\n");
- }
- }
-
- // copy line to history buffer
- historyEditLines[nextHistoryLine % COMMAND_HISTORY] = g_consoleField;
- nextHistoryLine++;
- historyLine = nextHistoryLine;
-
- Field_Clear( &g_consoleField );
-
- g_consoleField.widthInChars = g_console_field_width;
-
- CL_SaveConsoleHistory( );
-
- if ( cls.state == CA_DISCONNECTED ) {
- SCR_UpdateScreen (); // force an update, because the command
- } // may take some time
- return;
- }
-
- // command completion
-
- if (key == K_TAB) {
- Field_AutoComplete(&g_consoleField);
- return;
- }
-
- // command history (ctrl-p ctrl-n for unix style)
-
- if ( (key == K_MWHEELUP && keys[K_SHIFT].down) || ( key == K_UPARROW ) || ( key == K_KP_UPARROW ) ||
- ( ( tolower(key) == 'p' ) && keys[K_CTRL].down ) ) {
- if ( nextHistoryLine - historyLine < COMMAND_HISTORY
- && historyLine > 0 ) {
- historyLine--;
- }
- g_consoleField = historyEditLines[ historyLine % COMMAND_HISTORY ];
- return;
- }
-
- if ( (key == K_MWHEELDOWN && keys[K_SHIFT].down) || ( key == K_DOWNARROW ) || ( key == K_KP_DOWNARROW ) ||
- ( ( tolower(key) == 'n' ) && keys[K_CTRL].down ) ) {
- historyLine++;
- if (historyLine >= nextHistoryLine) {
- historyLine = nextHistoryLine;
- Field_Clear( &g_consoleField );
- g_consoleField.widthInChars = g_console_field_width;
- return;
- }
- g_consoleField = historyEditLines[ historyLine % COMMAND_HISTORY ];
- return;
- }
-
- // console scrolling
- if ( key == K_PGUP ) {
- Con_PageUp();
- return;
- }
-
- if ( key == K_PGDN) {
- Con_PageDown();
- return;
- }
-
- if ( key == K_MWHEELUP) { //----(SA) added some mousewheel functionality to the console
- Con_PageUp();
- if(keys[K_CTRL].down) { // hold to accelerate scrolling
- Con_PageUp();
- Con_PageUp();
- }
- return;
- }
-
- if ( key == K_MWHEELDOWN) { //----(SA) added some mousewheel functionality to the console
- Con_PageDown();
- if(keys[K_CTRL].down) { // hold to accelerate scrolling
- Con_PageDown();
- Con_PageDown();
- }
- return;
- }
-
- // ctrl-home = top of console
- if ( key == K_HOME && keys[K_CTRL].down ) {
- Con_Top();
- return;
- }
-
- // ctrl-end = bottom of console
- if ( key == K_END && keys[K_CTRL].down ) {
- Con_Bottom();
- return;
- }
-
- // pass to the normal editline routine
- Field_KeyDownEvent( &g_consoleField, key );
-}
-
-//============================================================================
-
-
-/*
-================
-Message_Key
-
-In game talk message
-================
-*/
-void Message_Key( int key ) {
-
- char buffer[MAX_STRING_CHARS];
-
-
- if (key == K_ESCAPE) {
- cls.keyCatchers &= ~KEYCATCH_MESSAGE;
- Field_Clear( &chatField );
- return;
- }
-
- if ( key == K_ENTER || key == K_KP_ENTER )
- {
- if ( chatField.buffer[0] && cls.state == CA_ACTIVE ) {
- if (chat_playerNum != -1 )
-
- Com_sprintf( buffer, sizeof( buffer ), "tell %i \"%s\"\n", chat_playerNum, chatField.buffer );
-
- else if (chat_team)
-
- Com_sprintf( buffer, sizeof( buffer ), "say_team \"%s\"\n", chatField.buffer );
- else
- Com_sprintf( buffer, sizeof( buffer ), "say \"%s\"\n", chatField.buffer );
-
-
-
- CL_AddReliableCommand( buffer );
- }
- cls.keyCatchers &= ~KEYCATCH_MESSAGE;
- Field_Clear( &chatField );
- return;
- }
-
- Field_KeyDownEvent( &chatField, key );
-}
-
-//============================================================================
-
-
-qboolean Key_GetOverstrikeMode( void ) {
- return key_overstrikeMode;
-}
-
-
-void Key_SetOverstrikeMode( qboolean state ) {
- key_overstrikeMode = state;
-}
-
-
-/*
-===================
-Key_IsDown
-===================
-*/
-qboolean Key_IsDown( int keynum ) {
- if ( keynum < 0 || keynum >= MAX_KEYS ) {
- return qfalse;
- }
-
- return keys[keynum].down;
-}
-
-
-/*
-===================
-Key_StringToKeynum
-
-Returns a key number to be used to index keys[] by looking at
-the given string. Single ascii characters return themselves, while
-the K_* names are matched up.
-
-0x11 will be interpreted as raw hex, which will allow new controlers
-
-to be configured even if they don't have defined names.
-===================
-*/
-int Key_StringToKeynum( char *str ) {
- keyname_t *kn;
-
- if ( !str || !str[0] ) {
- return -1;
- }
- if ( !str[1] ) {
- return str[0];
- }
-
- // check for hex code
- if ( str[0] == '0' && str[1] == 'x' && strlen( str ) == 4) {
- int n1, n2;
-
- n1 = str[2];
- if ( n1 >= '0' && n1 <= '9' ) {
- n1 -= '0';
- } else if ( n1 >= 'a' && n1 <= 'f' ) {
- n1 = n1 - 'a' + 10;
- } else {
- n1 = 0;
- }
-
- n2 = str[3];
- if ( n2 >= '0' && n2 <= '9' ) {
- n2 -= '0';
- } else if ( n2 >= 'a' && n2 <= 'f' ) {
- n2 = n2 - 'a' + 10;
- } else {
- n2 = 0;
- }
-
- return n1 * 16 + n2;
- }
-
- // scan for a text match
- for ( kn=keynames ; kn->name ; kn++ ) {
- if ( !Q_stricmp( str,kn->name ) )
- return kn->keynum;
- }
-
- return -1;
-}
-
-/*
-===================
-Key_KeynumToString
-
-Returns a string (either a single ascii char, a K_* name, or a 0x11 hex string) for the
-given keynum.
-===================
-*/
-char *Key_KeynumToString( int keynum ) {
- keyname_t *kn;
- static char tinystr[5];
- int i, j;
-
- if ( keynum == -1 ) {
- return "";
- }
-
- if ( keynum < 0 || keynum >= MAX_KEYS ) {
- return "";
- }
-
- // check for printable ascii (don't use quote)
- if ( keynum > 32 && keynum < 127 && keynum != '"' && keynum != ';' ) {
- tinystr[0] = keynum;
- tinystr[1] = 0;
- return tinystr;
- }
-
- // check for a key string
- for ( kn=keynames ; kn->name ; kn++ ) {
- if (keynum == kn->keynum) {
- return kn->name;
- }
- }
-
- // make a hex string
- i = keynum >> 4;
- j = keynum & 15;
-
- tinystr[0] = '0';
- tinystr[1] = 'x';
- tinystr[2] = i > 9 ? i - 10 + 'a' : i + '0';
- tinystr[3] = j > 9 ? j - 10 + 'a' : j + '0';
- tinystr[4] = 0;
-
- return tinystr;
-}
-
-
-/*
-===================
-Key_SetBinding
-===================
-*/
-void Key_SetBinding( int keynum, const char *binding ) {
- if ( keynum < 0 || keynum >= MAX_KEYS ) {
- return;
- }
-
- // free old bindings
- if ( keys[ keynum ].binding ) {
- Z_Free( keys[ keynum ].binding );
- }
-
- // allocate memory for new binding
- keys[keynum].binding = CopyString( binding );
-
- // consider this like modifying an archived cvar, so the
- // file write will be triggered at the next oportunity
- cvar_modifiedFlags |= CVAR_ARCHIVE;
-}
-
-
-/*
-===================
-Key_GetBinding
-===================
-*/
-char *Key_GetBinding( int keynum ) {
- if ( keynum < 0 || keynum >= MAX_KEYS ) {
- return "";
- }
-
- return keys[ keynum ].binding;
-}
-
-/*
-===================
-Key_GetKey
-===================
-*/
-
-int Key_GetKey(const char *binding) {
- int i;
-
- if (binding) {
- for (i=0 ; i < MAX_KEYS ; i++) {
- if (keys[i].binding && Q_stricmp(binding, keys[i].binding) == 0) {
- return i;
- }
- }
- }
- return -1;
-}
-
-/*
-===================
-Key_Unbind_f
-===================
-*/
-void Key_Unbind_f (void)
-{
- int b;
-
- if (Cmd_Argc() != 2)
- {
- Com_Printf ("unbind : remove commands from a key\n");
- return;
- }
-
- b = Key_StringToKeynum (Cmd_Argv(1));
- if (b==-1)
- {
- Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
- return;
- }
-
- Key_SetBinding (b, "");
-}
-
-/*
-===================
-Key_Unbindall_f
-===================
-*/
-void Key_Unbindall_f (void)
-{
- int i;
-
- for (i=0 ; i < MAX_KEYS; i++)
- if (keys[i].binding)
- Key_SetBinding (i, "");
-}
-
-
-/*
-===================
-Key_Bind_f
-===================
-*/
-void Key_Bind_f (void)
-{
- int i, c, b;
- char cmd[1024];
-
- c = Cmd_Argc();
-
- if (c < 2)
- {
- Com_Printf ("bind [command] : attach a command to a key\n");
- return;
- }
- b = Key_StringToKeynum (Cmd_Argv(1));
- if (b==-1)
- {
- Com_Printf ("\"%s\" isn't a valid key\n", Cmd_Argv(1));
- return;
- }
-
- if (c == 2)
- {
- if (keys[b].binding)
- Com_Printf ("\"%s\" = \"%s\"\n", Cmd_Argv(1), keys[b].binding );
- else
- Com_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) );
- return;
- }
-
-// copy the rest of the command line
- cmd[0] = 0; // start out with a null string
- for (i=2 ; i< c ; i++)
- {
- strcat (cmd, Cmd_Argv(i));
- if (i != (c-1))
- strcat (cmd, " ");
- }
-
- Key_SetBinding (b, cmd);
-}
-
-/*
-============
-Key_WriteBindings
-
-Writes lines containing "bind key value"
-============
-*/
-void Key_WriteBindings( fileHandle_t f ) {
- int i;
-
- FS_Printf (f, "unbindall\n" );
-
- for (i=0 ; i= 200) {
- Com_Printf ("%s is unbound, use controls menu to set.\n"
- , Key_KeynumToString( key ) );
- }
- } else if (kb[0] == '+') {
- int i;
- char button[1024], *buttonPtr;
- buttonPtr = button;
- for ( i = 0; ; i++ ) {
- if ( kb[i] == ';' || !kb[i] ) {
- *buttonPtr = '\0';
- if ( button[0] == '+') {
- // button commands add keynum and time as parms so that multiple
- // sources can be discriminated and subframe corrected
- Com_sprintf (cmd, sizeof(cmd), "%s %i %i\n", button, key, time);
- Cbuf_AddText (cmd);
- } else {
- // down-only command
- Cbuf_AddText (button);
- Cbuf_AddText ("\n");
- }
- buttonPtr = button;
- while ( (kb[i] <= ' ' || kb[i] == ';') && kb[i] != 0 ) {
- i++;
- }
- }
- *buttonPtr++ = kb[i];
- if ( !kb[i] ) {
- break;
- }
- }
- } else {
- // down-only command
- Cbuf_AddText (kb);
- Cbuf_AddText ("\n");
- }
- }
-}
-
-
-/*
-===================
-CL_CharEvent
-
-Normal keyboard characters, already shifted / capslocked / etc
-===================
-*/
-void CL_CharEvent( int key ) {
- // the console key should never be used as a char
- if ( key == '`' || key == '~' ) {
- return;
- }
-
- // delete is not a printable character and is
- // otherwise handled by Field_KeyDownEvent
- if ( key == 127 ) {
- return;
- }
-
- // distribute the key down event to the apropriate handler
- if ( cls.keyCatchers & KEYCATCH_CONSOLE )
- {
- Field_CharEvent( &g_consoleField, key );
- }
- else if ( cls.keyCatchers & KEYCATCH_UI )
- {
- VM_Call( uivm, UI_KEY_EVENT, key | K_CHAR_FLAG, qtrue );
- }
- else if ( cls.keyCatchers & KEYCATCH_MESSAGE )
- {
- Field_CharEvent( &chatField, key );
- }
- else if ( cls.state == CA_DISCONNECTED )
- {
- Field_CharEvent( &g_consoleField, key );
- }
-}
-
-
-/*
-===================
-Key_ClearStates
-===================
-*/
-void Key_ClearStates (void)
-{
- int i;
-
- anykeydown = 0;
-
- for ( i=0 ; i < MAX_KEYS ; i++ ) {
- if ( keys[i].down ) {
- CL_KeyEvent( i, qfalse, 0 );
-
- }
- keys[i].down = 0;
- keys[i].repeats = 0;
- }
-}
-
-/*
-====================
-Key_KeynumToStringBuf
-====================
-*/
-void Key_KeynumToStringBuf( int keynum, char *buf, int buflen ) {
- Q_strncpyz( buf, Key_KeynumToString( keynum ), buflen );
-}
-
-/*
-====================
-Key_GetBindingBuf
-====================
-*/
-void Key_GetBindingBuf( int keynum, char *buf, int buflen ) {
- char *value;
-
- value = Key_GetBinding( keynum );
- if ( value ) {
- Q_strncpyz( buf, value, buflen );
- }
- else {
- *buf = 0;
- }
-}
-
-/*
-====================
-Key_GetCatcher
-====================
-*/
-int Key_GetCatcher( void ) {
- return cls.keyCatchers;
-}
-
-/*
-====================
-Ket_SetCatcher
-====================
-*/
-void Key_SetCatcher( int catcher ) {
- cls.keyCatchers = catcher;
-}
-
-// This must not exceed MAX_CMD_LINE
-#define MAX_CONSOLE_SAVE_BUFFER 1024
-#define CONSOLE_HISTORY_FILE "q3history"
-static char consoleSaveBuffer[ MAX_CONSOLE_SAVE_BUFFER ];
-static int consoleSaveBufferSize = 0;
-
-/*
-================
-CL_LoadConsoleHistory
-
-Load the console history from cl_consoleHistory
-================
-*/
-void CL_LoadConsoleHistory( void )
-{
- char *token, *text_p;
- int i, numChars, numLines = 0;
- fileHandle_t f;
-
- consoleSaveBufferSize = FS_FOpenFileRead( CONSOLE_HISTORY_FILE, &f, qfalse );
- if( !f )
- {
- Com_Printf( "Couldn't read %s.\n", CONSOLE_HISTORY_FILE );
- return;
- }
-
- if( consoleSaveBufferSize <= MAX_CONSOLE_SAVE_BUFFER &&
- FS_Read( consoleSaveBuffer, consoleSaveBufferSize, f ) == consoleSaveBufferSize )
- {
- text_p = consoleSaveBuffer;
-
- for( i = COMMAND_HISTORY - 1; i >= 0; i-- )
- {
- if( !*( token = COM_Parse( &text_p ) ) )
- break;
-
- historyEditLines[ i ].cursor = atoi( token );
-
- if( !*( token = COM_Parse( &text_p ) ) )
- break;
-
- historyEditLines[ i ].scroll = atoi( token );
-
- if( !*( token = COM_Parse( &text_p ) ) )
- break;
-
- numChars = atoi( token );
- text_p++;
- if( numChars > ( strlen( consoleSaveBuffer ) - ( text_p - consoleSaveBuffer ) ) )
- {
- Com_DPrintf( S_COLOR_YELLOW "WARNING: probable corrupt history\n" );
- break;
- }
- Com_Memcpy( historyEditLines[ i ].buffer,
- text_p, numChars );
- historyEditLines[ i ].buffer[ numChars ] = '\0';
- text_p += numChars;
-
- numLines++;
- }
-
- memmove( &historyEditLines[ 0 ], &historyEditLines[ i + 1 ],
- numLines * sizeof( field_t ) );
- for( i = numLines; i < COMMAND_HISTORY; i++ )
- Field_Clear( &historyEditLines[ i ] );
-
- historyLine = nextHistoryLine = numLines;
- }
- else
- Com_Printf( "Couldn't read %s.\n", CONSOLE_HISTORY_FILE );
-
- FS_FCloseFile( f );
-}
-
-/*
-================
-CL_SaveConsoleHistory
-
-Save the console history into the cvar cl_consoleHistory
-so that it persists across invocations of q3
-================
-*/
-void CL_SaveConsoleHistory( void )
-{
- int i;
- int lineLength, saveBufferLength, additionalLength;
- fileHandle_t f;
-
- consoleSaveBuffer[ 0 ] = '\0';
-
- i = ( nextHistoryLine - 1 ) % COMMAND_HISTORY;
- do
- {
- if( historyEditLines[ i ].buffer[ 0 ] )
- {
- lineLength = strlen( historyEditLines[ i ].buffer );
- saveBufferLength = strlen( consoleSaveBuffer );
-
- //ICK
- additionalLength = lineLength + strlen( "999 999 999 " );
-
- if( saveBufferLength + additionalLength < MAX_CONSOLE_SAVE_BUFFER )
- {
- Q_strcat( consoleSaveBuffer, MAX_CONSOLE_SAVE_BUFFER,
- va( "%d %d %d %s ",
- historyEditLines[ i ].cursor,
- historyEditLines[ i ].scroll,
- lineLength,
- historyEditLines[ i ].buffer ) );
- }
- else
- break;
- }
- i = ( i - 1 + COMMAND_HISTORY ) % COMMAND_HISTORY;
- }
- while( i != ( nextHistoryLine - 1 ) % COMMAND_HISTORY );
-
- consoleSaveBufferSize = strlen( consoleSaveBuffer );
-
- f = FS_FOpenFileWrite( CONSOLE_HISTORY_FILE );
- if( !f )
- {
- Com_Printf( "Couldn't write %s.\n", CONSOLE_HISTORY_FILE );
- return;
- }
-
- if( FS_Write( consoleSaveBuffer, consoleSaveBufferSize, f ) < consoleSaveBufferSize )
- Com_Printf( "Couldn't write %s.\n", CONSOLE_HISTORY_FILE );
-
- FS_FCloseFile( f );
-}
diff --git a/src/client/cl_main.c b/src/client/cl_main.c
deleted file mode 100644
index 28d9573..0000000
--- a/src/client/cl_main.c
+++ /dev/null
@@ -1,3534 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// cl_main.c -- client main loop
-
-#include "client.h"
-#include
-
-cvar_t *cl_nodelta;
-cvar_t *cl_debugMove;
-
-cvar_t *cl_noprint;
-cvar_t *cl_motd;
-
-cvar_t *rcon_client_password;
-cvar_t *rconAddress;
-
-cvar_t *cl_timeout;
-cvar_t *cl_maxpackets;
-cvar_t *cl_packetdup;
-cvar_t *cl_timeNudge;
-cvar_t *cl_showTimeDelta;
-cvar_t *cl_freezeDemo;
-
-cvar_t *cl_shownet;
-cvar_t *cl_showSend;
-cvar_t *cl_timedemo;
-cvar_t *cl_autoRecordDemo;
-cvar_t *cl_aviFrameRate;
-cvar_t *cl_aviMotionJpeg;
-cvar_t *cl_forceavidemo;
-
-cvar_t *cl_freelook;
-cvar_t *cl_sensitivity;
-cvar_t *cl_platformSensitivity;
-
-cvar_t *cl_mouseAccel;
-cvar_t *cl_showMouseRate;
-
-cvar_t *m_pitch;
-cvar_t *m_yaw;
-cvar_t *m_forward;
-cvar_t *m_side;
-cvar_t *m_filter;
-
-cvar_t *cl_activeAction;
-
-cvar_t *cl_motdString;
-
-cvar_t *cl_allowDownload;
-cvar_t *cl_conXOffset;
-cvar_t *cl_inGameVideo;
-
-cvar_t *cl_serverStatusResendTime;
-cvar_t *cl_trn;
-
-cvar_t *cl_lanForcePackets;
-
-cvar_t *cl_guidServerUniq;
-
-clientActive_t cl;
-clientConnection_t clc;
-clientStatic_t cls;
-vm_t *cgvm;
-
-// Structure containing functions exported from refresh DLL
-refexport_t re;
-
-ping_t cl_pinglist[MAX_PINGREQUESTS];
-
-typedef struct serverStatus_s
-{
- char string[BIG_INFO_STRING];
- netadr_t address;
- int time, startTime;
- qboolean pending;
- qboolean print;
- qboolean retrieved;
-} serverStatus_t;
-
-serverStatus_t cl_serverStatusList[MAX_SERVERSTATUSREQUESTS];
-int serverStatusCount;
-
-#if defined __USEA3D && defined __A3D_GEOM
- void hA3Dg_ExportRenderGeom (refexport_t *incoming_re);
-#endif
-
-extern void SV_BotFrame( int time );
-void CL_CheckForResend( void );
-void CL_ShowIP_f(void);
-void CL_ServerStatus_f(void);
-void CL_ServerStatusResponse( netadr_t from, msg_t *msg );
-
-/*
-===============
-CL_CDDialog
-
-Called by Com_Error when a cd is needed
-===============
-*/
-void CL_CDDialog( void ) {
- cls.cddialog = qtrue; // start it next frame
-}
-
-
-/*
-=======================================================================
-
-CLIENT RELIABLE COMMAND COMMUNICATION
-
-=======================================================================
-*/
-
-/*
-======================
-CL_AddReliableCommand
-
-The given command will be transmitted to the server, and is gauranteed to
-not have future usercmd_t executed before it is executed
-======================
-*/
-void CL_AddReliableCommand( const char *cmd ) {
- int index;
-
- // if we would be losing an old command that hasn't been acknowledged,
- // we must drop the connection
- if ( clc.reliableSequence - clc.reliableAcknowledge > MAX_RELIABLE_COMMANDS ) {
- Com_Error( ERR_DROP, "Client command overflow" );
- }
- clc.reliableSequence++;
- index = clc.reliableSequence & ( MAX_RELIABLE_COMMANDS - 1 );
- Q_strncpyz( clc.reliableCommands[ index ], cmd, sizeof( clc.reliableCommands[ index ] ) );
-}
-
-/*
-======================
-CL_ChangeReliableCommand
-======================
-*/
-void CL_ChangeReliableCommand( void ) {
- int r, index, l;
-
- r = clc.reliableSequence - (random() * 5);
- index = clc.reliableSequence & ( MAX_RELIABLE_COMMANDS - 1 );
- l = strlen(clc.reliableCommands[ index ]);
- if ( l >= MAX_STRING_CHARS - 1 ) {
- l = MAX_STRING_CHARS - 2;
- }
- clc.reliableCommands[ index ][ l ] = '\n';
- clc.reliableCommands[ index ][ l+1 ] = '\0';
-}
-
-/*
-=======================================================================
-
-CLIENT SIDE DEMO RECORDING
-
-=======================================================================
-*/
-
-/*
-====================
-CL_WriteDemoMessage
-
-Dumps the current net message, prefixed by the length
-====================
-*/
-void CL_WriteDemoMessage ( msg_t *msg, int headerBytes ) {
- int len, swlen;
-
- // write the packet sequence
- len = clc.serverMessageSequence;
- swlen = LittleLong( len );
- FS_Write (&swlen, 4, clc.demofile);
-
- // skip the packet sequencing information
- len = msg->cursize - headerBytes;
- swlen = LittleLong(len);
- FS_Write (&swlen, 4, clc.demofile);
- FS_Write ( msg->data + headerBytes, len, clc.demofile );
-}
-
-
-/*
-====================
-CL_StopRecording_f
-
-stop recording a demo
-====================
-*/
-void CL_StopRecord_f( void ) {
- int len;
-
- if ( !clc.demorecording ) {
- Com_Printf ("Not recording a demo.\n");
- return;
- }
-
- // finish up
- len = -1;
- FS_Write (&len, 4, clc.demofile);
- FS_Write (&len, 4, clc.demofile);
- FS_FCloseFile (clc.demofile);
- clc.demofile = 0;
- clc.demorecording = qfalse;
- clc.spDemoRecording = qfalse;
- Com_Printf ("Stopped demo.\n");
-}
-
-/*
-==================
-CL_DemoFilename
-==================
-*/
-void CL_DemoFilename( int number, char *fileName ) {
- int a,b,c,d;
-
- if(number < 0 || number > 9999)
- number = 9999;
-
- a = number / 1000;
- number -= a*1000;
- b = number / 100;
- number -= b*100;
- c = number / 10;
- number -= c*10;
- d = number;
-
- Com_sprintf( fileName, MAX_OSPATH, "demo%i%i%i%i"
- , a, b, c, d );
-}
-
-/*
-====================
-CL_Record_f
-
-record
-
-Begins recording a demo from the current position
-====================
-*/
-static char demoName[MAX_QPATH]; // compiler bug workaround
-void CL_Record_f( void ) {
- char name[MAX_OSPATH];
- byte bufData[MAX_MSGLEN];
- msg_t buf;
- int i;
- int len;
- entityState_t *ent;
- entityState_t nullstate;
- char *s;
-
- if ( Cmd_Argc() > 2 ) {
- Com_Printf ("record \n");
- return;
- }
-
- if ( clc.demorecording ) {
- if (!clc.spDemoRecording) {
- Com_Printf ("Already recording.\n");
- }
- return;
- }
-
- if ( cls.state != CA_ACTIVE ) {
- Com_Printf ("You must be in a level to record.\n");
- return;
- }
-
- // sync 0 doesn't prevent recording, so not forcing it off .. everyone does g_sync 1 ; record ; g_sync 0 ..
- if ( NET_IsLocalAddress( clc.serverAddress ) && !Cvar_VariableValue( "g_synchronousClients" ) ) {
- Com_Printf (S_COLOR_YELLOW "WARNING: You should set 'g_synchronousClients 1' for smoother demo recording\n");
- }
-
- if ( Cmd_Argc() == 2 ) {
- s = Cmd_Argv(1);
- Q_strncpyz( demoName, s, sizeof( demoName ) );
- Com_sprintf (name, sizeof(name), "demos/%s.dm_%d", demoName, PROTOCOL_VERSION );
- } else {
- int number;
-
- // scan for a free demo name
- for ( number = 0 ; number <= 9999 ; number++ ) {
- CL_DemoFilename( number, demoName );
- Com_sprintf (name, sizeof(name), "demos/%s.dm_%d", demoName, PROTOCOL_VERSION );
-
- if (!FS_FileExists(name))
- break; // file doesn't exist
- }
- }
-
- // open the demo file
-
- Com_Printf ("recording to %s.\n", name);
- clc.demofile = FS_FOpenFileWrite( name );
- if ( !clc.demofile ) {
- Com_Printf ("ERROR: couldn't open.\n");
- return;
- }
- clc.demorecording = qtrue;
- if (Cvar_VariableValue("ui_recordSPDemo")) {
- clc.spDemoRecording = qtrue;
- } else {
- clc.spDemoRecording = qfalse;
- }
-
-
- Q_strncpyz( clc.demoName, demoName, sizeof( clc.demoName ) );
-
- // don't start saving messages until a non-delta compressed message is received
- clc.demowaiting = qtrue;
-
- // write out the gamestate message
- MSG_Init (&buf, bufData, sizeof(bufData));
- MSG_Bitstream(&buf);
-
- // NOTE, MRE: all server->client messages now acknowledge
- MSG_WriteLong( &buf, clc.reliableSequence );
-
- MSG_WriteByte (&buf, svc_gamestate);
- MSG_WriteLong (&buf, clc.serverCommandSequence );
-
- // configstrings
- for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) {
- if ( !cl.gameState.stringOffsets[i] ) {
- continue;
- }
- s = cl.gameState.stringData + cl.gameState.stringOffsets[i];
- MSG_WriteByte (&buf, svc_configstring);
- MSG_WriteShort (&buf, i);
- MSG_WriteBigString (&buf, s);
- }
-
- // baselines
- Com_Memset (&nullstate, 0, sizeof(nullstate));
- for ( i = 0; i < MAX_GENTITIES ; i++ ) {
- ent = &cl.entityBaselines[i];
- if ( !ent->number ) {
- continue;
- }
- MSG_WriteByte (&buf, svc_baseline);
- MSG_WriteDeltaEntity (&buf, &nullstate, ent, qtrue );
- }
-
- MSG_WriteByte( &buf, svc_EOF );
-
- // finished writing the gamestate stuff
-
- // write the client num
- MSG_WriteLong(&buf, clc.clientNum);
- // write the checksum feed
- MSG_WriteLong(&buf, clc.checksumFeed);
-
- // finished writing the client packet
- MSG_WriteByte( &buf, svc_EOF );
-
- // write it to the demo file
- len = LittleLong( clc.serverMessageSequence - 1 );
- FS_Write (&len, 4, clc.demofile);
-
- len = LittleLong (buf.cursize);
- FS_Write (&len, 4, clc.demofile);
- FS_Write (buf.data, buf.cursize, clc.demofile);
-
- // the rest of the demo file will be copied from net messages
-}
-
-/*
-=======================================================================
-
-CLIENT SIDE DEMO PLAYBACK
-
-=======================================================================
-*/
-
-/*
-=================
-CL_DemoCompleted
-=================
-*/
-void CL_DemoCompleted( void ) {
- if (cl_timedemo && cl_timedemo->integer) {
- int time;
-
- time = Sys_Milliseconds() - clc.timeDemoStart;
- if ( time > 0 ) {
- Com_Printf ("%i frames, %3.1f seconds: %3.1f fps\n", clc.timeDemoFrames,
- time/1000.0, clc.timeDemoFrames*1000.0 / time);
- }
- }
-
- CL_Disconnect( qtrue );
- CL_NextDemo();
-}
-
-/*
-=================
-CL_ReadDemoMessage
-=================
-*/
-void CL_ReadDemoMessage( void ) {
- int r;
- msg_t buf;
- byte bufData[ MAX_MSGLEN ];
- int s;
-
- if ( !clc.demofile ) {
- CL_DemoCompleted ();
- return;
- }
-
- // get the sequence number
- r = FS_Read( &s, 4, clc.demofile);
- if ( r != 4 ) {
- CL_DemoCompleted ();
- return;
- }
- clc.serverMessageSequence = LittleLong( s );
-
- // init the message
- MSG_Init( &buf, bufData, sizeof( bufData ) );
-
- // get the length
- r = FS_Read (&buf.cursize, 4, clc.demofile);
- if ( r != 4 ) {
- CL_DemoCompleted ();
- return;
- }
- buf.cursize = LittleLong( buf.cursize );
- if ( buf.cursize == -1 ) {
- CL_DemoCompleted ();
- return;
- }
- if ( buf.cursize > buf.maxsize ) {
- Com_Error (ERR_DROP, "CL_ReadDemoMessage: demoMsglen > MAX_MSGLEN");
- }
- r = FS_Read( buf.data, buf.cursize, clc.demofile );
- if ( r != buf.cursize ) {
- Com_Printf( "Demo file was truncated.\n");
- CL_DemoCompleted ();
- return;
- }
-
- clc.lastPacketTime = cls.realtime;
- buf.readcount = 0;
- CL_ParseServerMessage( &buf );
-}
-
-/*
-====================
-CL_WalkDemoExt
-====================
-*/
-static void CL_WalkDemoExt(char *arg, char *name, int *demofile)
-{
- int i = 0;
- *demofile = 0;
- while(demo_protocols[i])
- {
- Com_sprintf (name, MAX_OSPATH, "demos/%s.dm_%d", arg, demo_protocols[i]);
- FS_FOpenFileRead( name, demofile, qtrue );
- if (*demofile)
- {
- Com_Printf("Demo file: %s\n", name);
- break;
- }
- else
- Com_Printf("Not found: %s\n", name);
- i++;
- }
-}
-
-/*
-====================
-CL_PlayDemo_f
-
-demo
-
-====================
-*/
-void CL_PlayDemo_f( void ) {
- char name[MAX_OSPATH];
- char *arg, *ext_test;
- int protocol, i;
- char retry[MAX_OSPATH];
-
- if (Cmd_Argc() != 2) {
- Com_Printf ("playdemo \n");
- return;
- }
-
- // make sure a local server is killed
- // 2 means don't force disconnect of local client
- Cvar_Set( "sv_killserver", "2" );
-
- CL_Disconnect( qtrue );
-
- // open the demo file
- arg = Cmd_Argv(1);
-
- // check for an extension .dm_?? (?? is protocol)
- ext_test = arg + strlen(arg) - 6;
- if ((strlen(arg) > 6) && (ext_test[0] == '.') && ((ext_test[1] == 'd') || (ext_test[1] == 'D')) && ((ext_test[2] == 'm') || (ext_test[2] == 'M')) && (ext_test[3] == '_'))
- {
- protocol = atoi(ext_test+4);
- i=0;
- while(demo_protocols[i])
- {
- if (demo_protocols[i] == protocol)
- break;
- i++;
- }
- if (demo_protocols[i])
- {
- Com_sprintf (name, sizeof(name), "demos/%s", arg);
- FS_FOpenFileRead( name, &clc.demofile, qtrue );
- } else {
- Com_Printf("Protocol %d not supported for demos\n", protocol);
- Q_strncpyz(retry, arg, sizeof(retry));
- retry[strlen(retry)-6] = 0;
- CL_WalkDemoExt( retry, name, &clc.demofile );
- }
- } else {
- CL_WalkDemoExt( arg, name, &clc.demofile );
- }
-
- if (!clc.demofile) {
- Com_Error( ERR_DROP, "couldn't open %s", name);
- return;
- }
- Q_strncpyz( clc.demoName, Cmd_Argv(1), sizeof( clc.demoName ) );
-
- Con_Close();
-
- cls.state = CA_CONNECTED;
- clc.demoplaying = qtrue;
- Q_strncpyz( cls.servername, Cmd_Argv(1), sizeof( cls.servername ) );
-
- // read demo messages until connected
- while ( cls.state >= CA_CONNECTED && cls.state < CA_PRIMED ) {
- CL_ReadDemoMessage();
- }
- // don't get the first snapshot this frame, to prevent the long
- // time from the gamestate load from messing causing a time skip
- clc.firstDemoFrameSkipped = qfalse;
-}
-
-
-/*
-====================
-CL_StartDemoLoop
-
-Closing the main menu will restart the demo loop
-====================
-*/
-void CL_StartDemoLoop( void ) {
- // start the demo loop again
- Cbuf_AddText ("d1\n");
- cls.keyCatchers = 0;
-}
-
-/*
-==================
-CL_NextDemo
-
-Called when a demo or cinematic finishes
-If the "nextdemo" cvar is set, that command will be issued
-==================
-*/
-void CL_NextDemo( void ) {
- char v[MAX_STRING_CHARS];
-
- Q_strncpyz( v, Cvar_VariableString ("nextdemo"), sizeof(v) );
- v[MAX_STRING_CHARS-1] = 0;
- Com_DPrintf("CL_NextDemo: %s\n", v );
- if (!v[0]) {
- return;
- }
-
- Cvar_Set ("nextdemo","");
- Cbuf_AddText (v);
- Cbuf_AddText ("\n");
- Cbuf_Execute();
-}
-
-/*
-==================
-CL_DemoState
-
-Returns the current state of the demo system
-==================
-*/
-demoState_t CL_DemoState( void ) {
- if( clc.demoplaying ) {
- return DS_PLAYBACK;
- } else if( clc.demorecording ) {
- return DS_RECORDING;
- } else {
- return DS_NONE;
- }
-}
-
-/*
-==================
-CL_DemoPos
-
-Returns the current position of the demo
-==================
-*/
-int CL_DemoPos( void ) {
- if( clc.demoplaying || clc.demorecording ) {
- return FS_FTell( clc.demofile );
- } else {
- return 0;
- }
-}
-
-/*
-==================
-CL_DemoName
-
-Returns the name of the demo
-==================
-*/
-void CL_DemoName( char *buffer, int size ) {
- if( clc.demoplaying || clc.demorecording ) {
- Q_strncpyz( buffer, clc.demoName, size );
- } else if( size >= 1 ) {
- buffer[ 0 ] = '\0';
- }
-}
-
-//======================================================================
-
-/*
-=====================
-CL_ShutdownAll
-=====================
-*/
-void CL_ShutdownAll(void) {
-
-#if USE_CURL
- CL_cURL_Shutdown();
-#endif
- // clear sounds
- S_DisableSounds();
- // shutdown CGame
- CL_ShutdownCGame();
- // shutdown UI
- CL_ShutdownUI();
-
- // shutdown the renderer
- if ( re.Shutdown ) {
- re.Shutdown( qfalse ); // don't destroy window or context
- }
-
- cls.uiStarted = qfalse;
- cls.cgameStarted = qfalse;
- cls.rendererStarted = qfalse;
- cls.soundRegistered = qfalse;
-}
-
-/*
-=================
-CL_FlushMemory
-
-Called by CL_MapLoading, CL_Connect_f, CL_PlayDemo_f, and CL_ParseGamestate the only
-ways a client gets into a game
-Also called by Com_Error
-=================
-*/
-void CL_FlushMemory( void ) {
-
- // shutdown all the client stuff
- CL_ShutdownAll();
-
- // if not running a server clear the whole hunk
- if ( !com_sv_running->integer ) {
- // clear the whole hunk
- Hunk_Clear();
- // clear collision map data
- CM_ClearMap();
- }
- else {
- // clear all the client data on the hunk
- Hunk_ClearToMark();
- }
-
- CL_StartHunkUsers();
-}
-
-/*
-=====================
-CL_MapLoading
-
-A local server is starting to load a map, so update the
-screen to let the user know about it, then dump all client
-memory on the hunk from cgame, ui, and renderer
-=====================
-*/
-void CL_MapLoading( void ) {
- if ( !com_cl_running->integer ) {
- return;
- }
-
- Con_Close();
- cls.keyCatchers = 0;
-
- // if we are already connected to the local host, stay connected
- if ( cls.state >= CA_CONNECTED && !Q_stricmp( cls.servername, "localhost" ) ) {
- cls.state = CA_CONNECTED; // so the connect screen is drawn
- Com_Memset( cls.updateInfoString, 0, sizeof( cls.updateInfoString ) );
- Com_Memset( clc.serverMessage, 0, sizeof( clc.serverMessage ) );
- Com_Memset( &cl.gameState, 0, sizeof( cl.gameState ) );
- clc.lastPacketSentTime = -9999;
- SCR_UpdateScreen();
- } else {
- CL_Disconnect( qtrue );
- Q_strncpyz( cls.servername, "localhost", sizeof(cls.servername) );
- cls.state = CA_CHALLENGING; // so the connect screen is drawn
- cls.keyCatchers = 0;
- SCR_UpdateScreen();
- clc.connectTime = -RETRANSMIT_TIMEOUT;
- NET_StringToAdr( cls.servername, &clc.serverAddress);
- // we don't need a challenge on the localhost
-
- CL_CheckForResend();
- }
-}
-
-/*
-=====================
-CL_ClearState
-
-Called before parsing a gamestate
-=====================
-*/
-void CL_ClearState (void) {
-
-// S_StopAllSounds();
-
- Com_Memset( &cl, 0, sizeof( cl ) );
-}
-
-/*
-====================
-CL_UpdateGUID
-
-update cl_guid using QKEY_FILE and optional prefix
-====================
-*/
-static void CL_UpdateGUID( char *prefix, int prefix_len )
-{
- fileHandle_t f;
- int len;
-
- len = FS_SV_FOpenFileRead( QKEY_FILE, &f );
- FS_FCloseFile( f );
-
- if( len != QKEY_SIZE )
- Cvar_Set( "cl_guid", "" );
- else
- Cvar_Set( "cl_guid", Com_MD5File( QKEY_FILE, QKEY_SIZE,
- prefix, prefix_len ) );
-}
-
-
-/*
-=====================
-CL_Disconnect
-
-Called when a connection, demo, or cinematic is being terminated.
-Goes from a connected state to either a menu state or a console state
-Sends a disconnect message to the server
-This is also called on Com_Error and Com_Quit, so it shouldn't cause any errors
-=====================
-*/
-void CL_Disconnect( qboolean showMainMenu ) {
- if ( !com_cl_running || !com_cl_running->integer ) {
- return;
- }
-
- // shutting down the client so enter full screen ui mode
- Cvar_Set("r_uiFullScreen", "1");
-
- if ( clc.demorecording ) {
- CL_StopRecord_f ();
- }
-
- if (clc.download) {
- FS_FCloseFile( clc.download );
- clc.download = 0;
- }
- *clc.downloadTempName = *clc.downloadName = 0;
- Cvar_Set( "cl_downloadName", "" );
-
- if ( clc.demofile ) {
- FS_FCloseFile( clc.demofile );
- clc.demofile = 0;
- }
-
- if ( uivm && showMainMenu ) {
- VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_NONE );
- }
-
- SCR_StopCinematic ();
- S_ClearSoundBuffer();
-
- // send a disconnect message to the server
- // send it a few times in case one is dropped
- if ( cls.state >= CA_CONNECTED ) {
- CL_AddReliableCommand( "disconnect" );
- CL_WritePacket();
- CL_WritePacket();
- CL_WritePacket();
- }
-
- CL_ClearState ();
-
- // wipe the client connection
- Com_Memset( &clc, 0, sizeof( clc ) );
-
- cls.state = CA_DISCONNECTED;
-
- // allow cheats locally
- Cvar_Set( "sv_cheats", "1" );
-
- // not connected to a pure server anymore
- cl_connectedToPureServer = qfalse;
-
- // Stop recording any video
- if( CL_VideoRecording( ) ) {
- CL_CloseAVI( );
- }
- CL_UpdateGUID( NULL, 0 );
-}
-
-
-/*
-===================
-CL_ForwardCommandToServer
-
-adds the current command line as a clientCommand
-things like godmode, noclip, etc, are commands directed to the server,
-so when they are typed in at the console, they will need to be forwarded.
-===================
-*/
-void CL_ForwardCommandToServer( const char *string ) {
- char *cmd;
-
- cmd = Cmd_Argv(0);
-
- // ignore key up commands
- if ( cmd[0] == '-' ) {
- return;
- }
-
- if ( clc.demoplaying || cls.state < CA_CONNECTED || cmd[0] == '+' ) {
- Com_Printf ("Unknown command \"%s\"\n", cmd);
- return;
- }
-
- if ( Cmd_Argc() > 1 ) {
- CL_AddReliableCommand( string );
- } else {
- CL_AddReliableCommand( cmd );
- }
-}
-
-/*
-===================
-CL_RequestMotd
-
-===================
-*/
-void CL_RequestMotd( void ) {
- char info[MAX_INFO_STRING];
-
- if ( !cl_motd->integer ) {
- return;
- }
- Com_Printf( "Resolving %s\n", MASTER_SERVER_NAME );
- if ( !NET_StringToAdr( MASTER_SERVER_NAME, &cls.updateServer ) ) {
- Com_Printf( "Couldn't resolve address\n" );
- return;
- }
- cls.updateServer.port = BigShort( PORT_MASTER );
- Com_Printf( "%s resolved to %i.%i.%i.%i:%i\n", MASTER_SERVER_NAME,
- cls.updateServer.ip[0], cls.updateServer.ip[1],
- cls.updateServer.ip[2], cls.updateServer.ip[3],
- BigShort( cls.updateServer.port ) );
-
- info[0] = 0;
- // NOTE TTimo xoring against Com_Milliseconds, otherwise we may not have a true randomization
- // only srand I could catch before here is tr_noise.c l:26 srand(1001)
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=382
- // NOTE: the Com_Milliseconds xoring only affects the lower 16-bit word,
- // but I decided it was enough randomization
- Com_sprintf( cls.updateChallenge, sizeof( cls.updateChallenge ),
- "%i", ((rand() << 16) ^ rand()) ^ Com_Milliseconds());
-
- Info_SetValueForKey( info, "challenge", cls.updateChallenge );
- Info_SetValueForKey( info, "renderer", cls.glconfig.renderer_string );
- Info_SetValueForKey( info, "version", com_version->string );
-
- NET_OutOfBandPrint( NS_CLIENT, cls.updateServer, "getmotd%s", info );
-}
-
-/*
-======================================================================
-
-CONSOLE COMMANDS
-
-======================================================================
-*/
-
-/*
-==================
-CL_ForwardToServer_f
-==================
-*/
-void CL_ForwardToServer_f( void ) {
- if ( cls.state != CA_ACTIVE || clc.demoplaying ) {
- Com_Printf ("Not connected to a server.\n");
- return;
- }
-
- // don't forward the first argument
- if ( Cmd_Argc() > 1 ) {
- CL_AddReliableCommand( Cmd_Args() );
- }
-}
-
-/*
-==================
-CL_Setenv_f
-
-Mostly for controlling voodoo environment variables
-==================
-*/
-void CL_Setenv_f( void ) {
- int argc = Cmd_Argc();
-
- if ( argc > 2 ) {
- char buffer[1024];
- int i;
-
- strcpy( buffer, Cmd_Argv(1) );
- strcat( buffer, "=" );
-
- for ( i = 2; i < argc; i++ ) {
- strcat( buffer, Cmd_Argv( i ) );
- strcat( buffer, " " );
- }
-
- putenv( buffer );
- } else if ( argc == 2 ) {
- char *env = getenv( Cmd_Argv(1) );
-
- if ( env ) {
- Com_Printf( "%s=%s\n", Cmd_Argv(1), env );
- } else {
- Com_Printf( "%s undefined\n", Cmd_Argv(1));
- }
- }
-}
-
-
-/*
-==================
-CL_Disconnect_f
-==================
-*/
-void CL_Disconnect_f( void ) {
- SCR_StopCinematic();
- Cvar_Set("ui_singlePlayerActive", "0");
- if ( cls.state != CA_DISCONNECTED && cls.state != CA_CINEMATIC ) {
- Com_Error (ERR_DISCONNECT, "Disconnected from server");
- }
-}
-
-
-/*
-================
-CL_Reconnect_f
-
-================
-*/
-void CL_Reconnect_f( void ) {
- if ( !strlen( cls.servername ) || !strcmp( cls.servername, "localhost" ) ) {
- Com_Printf( "Can't reconnect to localhost.\n" );
- return;
- }
- Cvar_Set("ui_singlePlayerActive", "0");
- Cbuf_AddText( va("connect %s\n", cls.servername ) );
-}
-
-/*
-================
-CL_Connect_f
-
-================
-*/
-void CL_Connect_f( void ) {
- char *server;
- char serverString[ 22 ];
-
- if ( Cmd_Argc() != 2 ) {
- Com_Printf( "usage: connect [server]\n");
- return;
- }
-
- Cvar_Set("ui_singlePlayerActive", "0");
-
- // fire a message off to the motd server
- CL_RequestMotd();
-
- // clear any previous "server full" type messages
- clc.serverMessage[0] = 0;
-
- server = Cmd_Argv (1);
-
- if ( com_sv_running->integer && !strcmp( server, "localhost" ) ) {
- // if running a local server, kill it
- SV_Shutdown( "Server quit" );
- }
-
- // make sure a local server is killed
- Cvar_Set( "sv_killserver", "1" );
- SV_Frame( 0 );
-
- CL_Disconnect( qtrue );
- Con_Close();
-
- /* MrE: 2000-09-13: now called in CL_DownloadsComplete
- CL_FlushMemory( );
- */
-
- Q_strncpyz( cls.servername, server, sizeof(cls.servername) );
-
- if (!NET_StringToAdr( cls.servername, &clc.serverAddress) ) {
- Com_Printf ("Bad server address\n");
- cls.state = CA_DISCONNECTED;
- return;
- }
- if (clc.serverAddress.port == 0) {
- clc.serverAddress.port = BigShort( PORT_SERVER );
- }
- Com_sprintf( serverString, sizeof( serverString ), "%i.%i.%i.%i:%i",
- clc.serverAddress.ip[0], clc.serverAddress.ip[1],
- clc.serverAddress.ip[2], clc.serverAddress.ip[3],
- BigShort( clc.serverAddress.port ) );
-
- Com_Printf( "%s resolved to %s\n", cls.servername, serverString );
-
- if( cl_guidServerUniq->integer )
- CL_UpdateGUID( serverString, strlen( serverString ) );
- else
- CL_UpdateGUID( NULL, 0 );
-
- // if we aren't playing on a lan, we need to authenticate
- // with the cd key
- if ( NET_IsLocalAddress( clc.serverAddress ) ) {
- cls.state = CA_CHALLENGING;
- } else {
- cls.state = CA_CONNECTING;
- }
-
- cls.keyCatchers = 0;
- clc.connectTime = -99999; // CL_CheckForResend() will fire immediately
- clc.connectPacketCount = 0;
-
- // server connection string
- Cvar_Set( "cl_currentServerAddress", server );
-}
-
-#define MAX_RCON_MESSAGE 1024
-
-/*
-=====================
-CL_Rcon_f
-
- Send the rest of the command line over as
- an unconnected command.
-=====================
-*/
-void CL_Rcon_f( void ) {
- char message[MAX_RCON_MESSAGE];
- netadr_t to;
-
- if ( !rcon_client_password->string ) {
- Com_Printf ("You must set 'rconpassword' before\n"
- "issuing an rcon command.\n");
- return;
- }
-
- message[0] = -1;
- message[1] = -1;
- message[2] = -1;
- message[3] = -1;
- message[4] = 0;
-
- Q_strcat (message, MAX_RCON_MESSAGE, "rcon ");
-
- Q_strcat (message, MAX_RCON_MESSAGE, rcon_client_password->string);
- Q_strcat (message, MAX_RCON_MESSAGE, " ");
-
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=543
- Q_strcat (message, MAX_RCON_MESSAGE, Cmd_Cmd()+5);
-
- if ( cls.state >= CA_CONNECTED ) {
- to = clc.netchan.remoteAddress;
- } else {
- if (!strlen(rconAddress->string)) {
- Com_Printf ("You must either be connected,\n"
- "or set the 'rconAddress' cvar\n"
- "to issue rcon commands\n");
-
- return;
- }
- NET_StringToAdr (rconAddress->string, &to);
- if (to.port == 0) {
- to.port = BigShort (PORT_SERVER);
- }
- }
-
- NET_SendPacket (NS_CLIENT, strlen(message)+1, message, to);
-}
-
-/*
-=================
-CL_SendPureChecksums
-=================
-*/
-void CL_SendPureChecksums( void ) {
- const char *pChecksums;
- char cMsg[MAX_INFO_VALUE];
- int i;
-
- // if we are pure we need to send back a command with our referenced pk3 checksums
- pChecksums = FS_ReferencedPakPureChecksums();
-
- // "cp"
- // "Yf"
- Com_sprintf(cMsg, sizeof(cMsg), "Yf ");
- Q_strcat(cMsg, sizeof(cMsg), va("%d ", cl.serverId) );
- Q_strcat(cMsg, sizeof(cMsg), pChecksums);
- for (i = 0; i < 2; i++) {
- cMsg[i] += 10;
- }
- CL_AddReliableCommand( cMsg );
-}
-
-/*
-=================
-CL_ResetPureClientAtServer
-=================
-*/
-void CL_ResetPureClientAtServer( void ) {
- CL_AddReliableCommand( va("vdr") );
-}
-
-/*
-=================
-CL_Vid_Restart_f
-
-Restart the video subsystem
-
-we also have to reload the UI and CGame because the renderer
-doesn't know what graphics to reload
-=================
-*/
-void CL_Vid_Restart_f( void ) {
-
- // Settings may have changed so stop recording now
- if( CL_VideoRecording( ) ) {
- CL_CloseAVI( );
- }
-
- if(clc.demorecording)
- CL_StopRecord_f();
-
- // don't let them loop during the restart
- S_StopAllSounds();
- // shutdown the UI
- CL_ShutdownUI();
- // shutdown the CGame
- CL_ShutdownCGame();
- // shutdown the renderer and clear the renderer interface
- CL_ShutdownRef();
- // client is no longer pure untill new checksums are sent
- CL_ResetPureClientAtServer();
- // clear pak references
- FS_ClearPakReferences( FS_UI_REF | FS_CGAME_REF );
- // reinitialize the filesystem if the game directory or checksum has changed
- FS_ConditionalRestart( clc.checksumFeed );
-
- cls.rendererStarted = qfalse;
- cls.uiStarted = qfalse;
- cls.cgameStarted = qfalse;
- cls.soundRegistered = qfalse;
-
- // unpause so the cgame definately gets a snapshot and renders a frame
- Cvar_Set( "cl_paused", "0" );
-
- // if not running a server clear the whole hunk
- if ( !com_sv_running->integer ) {
- // clear the whole hunk
- Hunk_Clear();
- }
- else {
- // clear all the client data on the hunk
- Hunk_ClearToMark();
- }
-
- // initialize the renderer interface
- CL_InitRef();
-
- // startup all the client stuff
- CL_StartHunkUsers();
-
- // start the cgame if connected
- if ( cls.state > CA_CONNECTED && cls.state != CA_CINEMATIC ) {
- cls.cgameStarted = qtrue;
- CL_InitCGame();
- // send pure checksums
- CL_SendPureChecksums();
- }
-}
-
-/*
-=================
-CL_Snd_Restart_f
-
-Restart the sound subsystem
-The cgame and game must also be forced to restart because
-handles will be invalid
-=================
-*/
-void CL_Snd_Restart_f( void ) {
- S_Shutdown();
- S_Init();
-
- CL_Vid_Restart_f();
-}
-
-
-/*
-==================
-CL_PK3List_f
-==================
-*/
-void CL_OpenedPK3List_f( void ) {
- Com_Printf("Opened PK3 Names: %s\n", FS_LoadedPakNames());
-}
-
-/*
-==================
-CL_PureList_f
-==================
-*/
-void CL_ReferencedPK3List_f( void ) {
- Com_Printf("Referenced PK3 Names: %s\n", FS_ReferencedPakNames());
-}
-
-/*
-==================
-CL_Configstrings_f
-==================
-*/
-void CL_Configstrings_f( void ) {
- int i;
- int ofs;
-
- if ( cls.state != CA_ACTIVE ) {
- Com_Printf( "Not connected to a server.\n");
- return;
- }
-
- for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) {
- ofs = cl.gameState.stringOffsets[ i ];
- if ( !ofs ) {
- continue;
- }
- Com_Printf( "%4i: %s\n", i, cl.gameState.stringData + ofs );
- }
-}
-
-/*
-==============
-CL_Clientinfo_f
-==============
-*/
-void CL_Clientinfo_f( void ) {
- Com_Printf( "--------- Client Information ---------\n" );
- Com_Printf( "state: %i\n", cls.state );
- Com_Printf( "Server: %s\n", cls.servername );
- Com_Printf ("User info settings:\n");
- Info_Print( Cvar_InfoString( CVAR_USERINFO ) );
- Com_Printf( "--------------------------------------\n" );
-}
-
-
-//====================================================================
-
-/*
-=================
-CL_DownloadsComplete
-
-Called when all downloading has been completed
-=================
-*/
-void CL_DownloadsComplete( void ) {
-
-#if USE_CURL
- // if we downloaded with cURL
- if(clc.cURLUsed) {
- clc.cURLUsed = qfalse;
- CL_cURL_Shutdown();
- if( clc.cURLDisconnected ) {
- if(clc.downloadRestart) {
- FS_Restart(clc.checksumFeed);
- clc.downloadRestart = qfalse;
- }
- clc.cURLDisconnected = qfalse;
- CL_Reconnect_f();
- return;
- }
- }
-#endif
-
- // if we downloaded files we need to restart the file system
- if (clc.downloadRestart) {
- clc.downloadRestart = qfalse;
-
- FS_Restart(clc.checksumFeed); // We possibly downloaded a pak, restart the file system to load it
-
- // inform the server so we get new gamestate info
- CL_AddReliableCommand( "donedl" );
-
- // by sending the donedl command we request a new gamestate
- // so we don't want to load stuff yet
- return;
- }
-
- // let the client game init and load data
- cls.state = CA_LOADING;
-
- // Pump the loop, this may change gamestate!
- Com_EventLoop();
-
- // if the gamestate was changed by calling Com_EventLoop
- // then we loaded everything already and we don't want to do it again.
- if ( cls.state != CA_LOADING ) {
- return;
- }
-
- // starting to load a map so we get out of full screen ui mode
- Cvar_Set("r_uiFullScreen", "0");
-
- // flush client memory and start loading stuff
- // this will also (re)load the UI
- // if this is a local client then only the client part of the hunk
- // will be cleared, note that this is done after the hunk mark has been set
- CL_FlushMemory();
-
- // initialize the CGame
- cls.cgameStarted = qtrue;
- CL_InitCGame();
-
- // set pure checksums
- CL_SendPureChecksums();
-
- CL_WritePacket();
- CL_WritePacket();
- CL_WritePacket();
-}
-
-/*
-=================
-CL_BeginDownload
-
-Requests a file to download from the server. Stores it in the current
-game directory.
-=================
-*/
-void CL_BeginDownload( const char *localName, const char *remoteName ) {
-
- Com_DPrintf("***** CL_BeginDownload *****\n"
- "Localname: %s\n"
- "Remotename: %s\n"
- "****************************\n", localName, remoteName);
-
- Q_strncpyz ( clc.downloadName, localName, sizeof(clc.downloadName) );
- Com_sprintf( clc.downloadTempName, sizeof(clc.downloadTempName), "%s.tmp", localName );
-
- // Set so UI gets access to it
- Cvar_Set( "cl_downloadName", remoteName );
- Cvar_Set( "cl_downloadSize", "0" );
- Cvar_Set( "cl_downloadCount", "0" );
- Cvar_SetValue( "cl_downloadTime", cls.realtime );
-
- clc.downloadBlock = 0; // Starting new file
- clc.downloadCount = 0;
-
- // Stop any errant looping sounds that may be playing
- S_ClearLoopingSounds( qtrue );
-
- CL_AddReliableCommand( va("download %s", remoteName) );
-}
-
-/*
-=================
-CL_NextDownload
-
-A download completed or failed
-=================
-*/
-void CL_NextDownload(void) {
- char *s;
- char *remoteName, *localName;
- qboolean useCURL = qfalse;
-
- // We are looking to start a download here
- if (*clc.downloadList) {
- s = clc.downloadList;
-
- // format is:
- // @remotename@localname@remotename@localname, etc.
-
- if (*s == '@')
- s++;
- remoteName = s;
-
- if ( (s = strchr(s, '@')) == NULL ) {
- CL_DownloadsComplete();
- return;
- }
-
- *s++ = 0;
- localName = s;
- if ( (s = strchr(s, '@')) != NULL )
- *s++ = 0;
- else
- s = localName + strlen(localName); // point at the nul byte
-#if USE_CURL
- if(!(cl_allowDownload->integer & DLF_NO_REDIRECT)) {
- if(clc.sv_allowDownload & DLF_NO_REDIRECT) {
- Com_Printf("WARNING: server does not "
- "allow download redirection "
- "(sv_allowDownload is %d)\n",
- clc.sv_allowDownload);
- }
- else if(!*clc.sv_dlURL) {
- Com_Printf("WARNING: server allows "
- "download redirection, but does not "
- "have sv_dlURL set\n");
- }
- else if(!CL_cURL_Init()) {
- Com_Printf("WARNING: could not load "
- "cURL library\n");
- }
- else {
- CL_cURL_BeginDownload(localName, va("%s/%s",
- clc.sv_dlURL, remoteName));
- useCURL = qtrue;
- }
- }
- else if(!(clc.sv_allowDownload & DLF_NO_REDIRECT)) {
- Com_Printf("WARNING: server allows download "
- "redirection, but it disabled by client "
- "configuration (cl_allowDownload is %d)\n",
- cl_allowDownload->integer);
- }
-#endif /* USE_CURL */
- if(!useCURL) {
- if((cl_allowDownload->integer & DLF_NO_UDP)) {
- Com_Error(ERR_DROP, "UDP Downloads are "
- "disabled on your client. "
- "(cl_allowDownload is %d)",
- cl_allowDownload->integer);
- return;
- }
- else {
- CL_BeginDownload( localName, remoteName );
- }
- }
- clc.downloadRestart = qtrue;
-
- // move over the rest
- memmove( clc.downloadList, s, strlen(s) + 1);
-
- return;
- }
-
- CL_DownloadsComplete();
-}
-
-/*
-=================
-CL_InitDownloads
-
-After receiving a valid game state, we valid the cgame and local zip files here
-and determine if we need to download them
-=================
-*/
-void CL_InitDownloads(void) {
- char missingfiles[1024];
-
- if ( !(cl_allowDownload->integer & DLF_ENABLE) )
- {
- // autodownload is disabled on the client
- // but it's possible that some referenced files on the server are missing
- if (FS_ComparePaks( missingfiles, sizeof( missingfiles ), qfalse ) )
- {
- // NOTE TTimo I would rather have that printed as a modal message box
- // but at this point while joining the game we don't know wether we will successfully join or not
- Com_Printf( "\nWARNING: You are missing some files referenced by the server:\n%s"
- "You might not be able to join the game\n"
- "Go to the setting menu to turn on autodownload, or get the file elsewhere\n\n", missingfiles );
- }
- }
- else if ( FS_ComparePaks( clc.downloadList, sizeof( clc.downloadList ) , qtrue ) ) {
-
- Com_Printf("Need paks: %s\n", clc.downloadList );
-
- if ( *clc.downloadList ) {
- // if autodownloading is not enabled on the server
- cls.state = CA_CONNECTED;
- CL_NextDownload();
- return;
- }
-
- }
-
- CL_DownloadsComplete();
-}
-
-/*
-=================
-CL_CheckForResend
-
-Resend a connect message if the last one has timed out
-=================
-*/
-void CL_CheckForResend( void ) {
- int port, i;
- char info[MAX_INFO_STRING];
- char data[MAX_INFO_STRING];
-
- // don't send anything if playing back a demo
- if ( clc.demoplaying ) {
- return;
- }
-
- // resend if we haven't gotten a reply yet
- if ( cls.state != CA_CONNECTING && cls.state != CA_CHALLENGING ) {
- return;
- }
-
- if ( cls.realtime - clc.connectTime < RETRANSMIT_TIMEOUT ) {
- return;
- }
-
- clc.connectTime = cls.realtime; // for retransmit requests
- clc.connectPacketCount++;
-
-
- switch ( cls.state ) {
- case CA_CONNECTING:
- // requesting a challenge
- NET_OutOfBandPrint(NS_CLIENT, clc.serverAddress, "getchallenge");
- break;
-
- case CA_CHALLENGING:
- // sending back the challenge
- port = Cvar_VariableValue ("net_qport");
-
- Q_strncpyz( info, Cvar_InfoString( CVAR_USERINFO ), sizeof( info ) );
- Info_SetValueForKey( info, "protocol", va("%i", PROTOCOL_VERSION ) );
- Info_SetValueForKey( info, "qport", va("%i", port ) );
- Info_SetValueForKey( info, "challenge", va("%i", clc.challenge ) );
-
- strcpy(data, "connect ");
- // TTimo adding " " around the userinfo string to avoid truncated userinfo on the server
- // (Com_TokenizeString tokenizes around spaces)
- data[8] = '"';
-
- for(i=0;iadr.type = NA_IP;
- server->adr.ip[0] = address->ip[0];
- server->adr.ip[1] = address->ip[1];
- server->adr.ip[2] = address->ip[2];
- server->adr.ip[3] = address->ip[3];
- server->adr.port = address->port;
- server->clients = 0;
- server->hostName[0] = '\0';
- server->mapName[0] = '\0';
- server->maxClients = 0;
- server->maxPing = 0;
- server->minPing = 0;
- server->ping = -1;
- server->game[0] = '\0';
- server->gameType = 0;
- server->netType = 0;
-}
-
-#define MAX_SERVERSPERPACKET 256
-
-/*
-===================
-CL_ServersResponsePacket
-===================
-*/
-void CL_ServersResponsePacket( netadr_t from, msg_t *msg ) {
- int i, count, max, total;
- serverAddress_t addresses[MAX_SERVERSPERPACKET];
- int numservers;
- byte* buffptr;
- byte* buffend;
-
- Com_Printf("CL_ServersResponsePacket\n");
-
- if (cls.numglobalservers == -1) {
- // state to detect lack of servers or lack of response
- cls.numglobalservers = 0;
- cls.numGlobalServerAddresses = 0;
- }
-
- if (cls.nummplayerservers == -1) {
- cls.nummplayerservers = 0;
- }
-
- // parse through server response string
- numservers = 0;
- buffptr = msg->data;
- buffend = buffptr + msg->cursize;
- while (buffptr+1 < buffend) {
- // advance to initial token
- do {
- if (*buffptr++ == '\\')
- break;
- }
- while (buffptr < buffend);
-
- if ( buffptr >= buffend - 6 ) {
- break;
- }
-
- // parse out ip
- addresses[numservers].ip[0] = *buffptr++;
- addresses[numservers].ip[1] = *buffptr++;
- addresses[numservers].ip[2] = *buffptr++;
- addresses[numservers].ip[3] = *buffptr++;
-
- // parse out port
- addresses[numservers].port = (*buffptr++)<<8;
- addresses[numservers].port += *buffptr++;
- addresses[numservers].port = BigShort( addresses[numservers].port );
-
- // syntax check
- if (*buffptr != '\\') {
- break;
- }
-
- Com_DPrintf( "server: %d ip: %d.%d.%d.%d:%d\n",numservers,
- addresses[numservers].ip[0],
- addresses[numservers].ip[1],
- addresses[numservers].ip[2],
- addresses[numservers].ip[3],
- BigShort( addresses[numservers].port ) );
-
- numservers++;
- if (numservers >= MAX_SERVERSPERPACKET) {
- break;
- }
-
- // parse out EOT
- if (buffptr[1] == 'E' && buffptr[2] == 'O' && buffptr[3] == 'T') {
- break;
- }
- }
-
- if (cls.masterNum == 0) {
- count = cls.numglobalservers;
- max = MAX_GLOBAL_SERVERS;
- } else {
- count = cls.nummplayerservers;
- max = MAX_OTHER_SERVERS;
- }
-
- for (i = 0; i < numservers && count < max; i++) {
- // build net address
- serverInfo_t *server = (cls.masterNum == 0) ? &cls.globalServers[count] : &cls.mplayerServers[count];
-
- CL_InitServerInfo( server, &addresses[i] );
- // advance to next slot
- count++;
- }
-
- // if getting the global list
- if (cls.masterNum == 0) {
- if ( cls.numGlobalServerAddresses < MAX_GLOBAL_SERVERS ) {
- // if we couldn't store the servers in the main list anymore
- for (; i < numservers && count >= max; i++) {
- serverAddress_t *addr;
- // just store the addresses in an additional list
- addr = &cls.globalServerAddresses[cls.numGlobalServerAddresses++];
- addr->ip[0] = addresses[i].ip[0];
- addr->ip[1] = addresses[i].ip[1];
- addr->ip[2] = addresses[i].ip[2];
- addr->ip[3] = addresses[i].ip[3];
- addr->port = addresses[i].port;
- }
- }
- }
-
- if (cls.masterNum == 0) {
- cls.numglobalservers = count;
- total = count + cls.numGlobalServerAddresses;
- } else {
- cls.nummplayerservers = count;
- total = count;
- }
-
- Com_Printf("%d servers parsed (total %d)\n", numservers, total);
-}
-
-/*
-=================
-CL_ConnectionlessPacket
-
-Responses to broadcasts, etc
-=================
-*/
-void CL_ConnectionlessPacket( netadr_t from, msg_t *msg ) {
- char *s;
- char c[ BIG_INFO_STRING ];
- char arg1[ BIG_INFO_STRING ];
-
- MSG_BeginReadingOOB( msg );
- MSG_ReadLong( msg ); // skip the -1
-
- s = MSG_ReadStringLine( msg );
-
- Cmd_TokenizeString( s );
-
- Q_strncpyz( c, Cmd_Argv( 0 ), BIG_INFO_STRING );
- Q_strncpyz( arg1, Cmd_Argv( 1 ), BIG_INFO_STRING );
-
- Com_DPrintf ("CL packet %s: %s\n", NET_AdrToString(from), c);
-
- // challenge from the server we are connecting to
- if ( !Q_stricmp(c, "challengeResponse") ) {
- if ( cls.state != CA_CONNECTING ) {
- Com_Printf( "Unwanted challenge response received. Ignored.\n" );
- } else {
- // start sending challenge repsonse instead of challenge request packets
- clc.challenge = atoi(arg1);
- cls.state = CA_CHALLENGING;
- clc.connectPacketCount = 0;
- clc.connectTime = -99999;
-
- // take this address as the new server address. This allows
- // a server proxy to hand off connections to multiple servers
- clc.serverAddress = from;
- Com_DPrintf ("challengeResponse: %d\n", clc.challenge);
- }
- return;
- }
-
- // server connection
- if ( !Q_stricmp(c, "connectResponse") ) {
- if ( cls.state >= CA_CONNECTED ) {
- Com_Printf ("Dup connect received. Ignored.\n");
- return;
- }
- if ( cls.state != CA_CHALLENGING ) {
- Com_Printf ("connectResponse packet while not connecting. Ignored.\n");
- return;
- }
- if ( !NET_CompareBaseAdr( from, clc.serverAddress ) ) {
- Com_Printf( "connectResponse from a different address. Ignored.\n" );
- Com_Printf( "%s should have been %s\n", NET_AdrToString( from ),
- NET_AdrToString( clc.serverAddress ) );
- return;
- }
- Netchan_Setup (NS_CLIENT, &clc.netchan, from, Cvar_VariableValue( "net_qport" ) );
- cls.state = CA_CONNECTED;
- clc.lastPacketSentTime = -9999; // send first packet immediately
- return;
- }
-
- // server responding to an info broadcast
- if ( !Q_stricmp(c, "infoResponse") ) {
- CL_ServerInfoPacket( from, msg );
- return;
- }
-
- // server responding to a get playerlist
- if ( !Q_stricmp(c, "statusResponse") ) {
- CL_ServerStatusResponse( from, msg );
- return;
- }
-
- // a disconnect message from the server, which will happen if the server
- // dropped the connection but it is still getting packets from us
- if (!Q_stricmp(c, "disconnect")) {
- CL_DisconnectPacket( from );
- return;
- }
-
- // echo request from server
- if ( !Q_stricmp(c, "echo") ) {
- NET_OutOfBandPrint( NS_CLIENT, from, "%s", arg1 );
- return;
- }
-
- // global MOTD from trem master
- if ( !Q_stricmp(c, "motd") ) {
- CL_MotdPacket( from, arg1 );
- return;
- }
-
- // echo request from server
- if ( !Q_stricmp(c, "print") ) {
- s = MSG_ReadString( msg );
- Q_strncpyz( clc.serverMessage, s, sizeof( clc.serverMessage ) );
- Com_Printf( "%s", s );
- return;
- }
-
- // echo request from server
- if ( !Q_strncmp(c, "getserversResponse", 18) ) {
- CL_ServersResponsePacket( from, msg );
- return;
- }
-
- Com_DPrintf ("Unknown connectionless packet command.\n");
-}
-
-
-/*
-=================
-CL_PacketEvent
-
-A packet has arrived from the main event loop
-=================
-*/
-void CL_PacketEvent( netadr_t from, msg_t *msg ) {
- int headerBytes;
-
- clc.lastPacketTime = cls.realtime;
-
- if ( msg->cursize >= 4 && *(int *)msg->data == -1 ) {
- CL_ConnectionlessPacket( from, msg );
- return;
- }
-
- if ( cls.state < CA_CONNECTED ) {
- return; // can't be a valid sequenced packet
- }
-
- if ( msg->cursize < 4 ) {
- Com_Printf ("%s: Runt packet\n",NET_AdrToString( from ));
- return;
- }
-
- //
- // packet from server
- //
- if ( !NET_CompareAdr( from, clc.netchan.remoteAddress ) ) {
- Com_DPrintf ("%s:sequenced packet without connection\n"
- ,NET_AdrToString( from ) );
- // FIXME: send a client disconnect?
- return;
- }
-
- if (!CL_Netchan_Process( &clc.netchan, msg) ) {
- return; // out of order, duplicated, etc
- }
-
- // the header is different lengths for reliable and unreliable messages
- headerBytes = msg->readcount;
-
- // track the last message received so it can be returned in
- // client messages, allowing the server to detect a dropped
- // gamestate
- clc.serverMessageSequence = LittleLong( *(int *)msg->data );
-
- clc.lastPacketTime = cls.realtime;
- CL_ParseServerMessage( msg );
-
- //
- // we don't know if it is ok to save a demo message until
- // after we have parsed the frame
- //
- if ( clc.demorecording && !clc.demowaiting ) {
- CL_WriteDemoMessage( msg, headerBytes );
- }
-}
-
-/*
-==================
-CL_CheckTimeout
-
-==================
-*/
-void CL_CheckTimeout( void ) {
- //
- // check timeout
- //
- if ( ( !CL_CheckPaused() || !sv_paused->integer )
- && cls.state >= CA_CONNECTED && cls.state != CA_CINEMATIC
- && cls.realtime - clc.lastPacketTime > cl_timeout->value*1000) {
- if (++cl.timeoutcount > 5) { // timeoutcount saves debugger
- Com_Printf ("\nServer connection timed out.\n");
- CL_Disconnect( qtrue );
- return;
- }
- } else {
- cl.timeoutcount = 0;
- }
-}
-
-/*
-==================
-CL_CheckPaused
-Check whether client has been paused.
-==================
-*/
-qboolean CL_CheckPaused(void)
-{
- // if cl_paused->modified is set, the cvar has only been changed in
- // this frame. Keep paused in this frame to ensure the server doesn't
- // lag behind.
- if(cl_paused->integer || cl_paused->modified)
- return qtrue;
-
- return qfalse;
-}
-
-//============================================================================
-
-/*
-==================
-CL_CheckUserinfo
-
-==================
-*/
-void CL_CheckUserinfo( void ) {
- // don't add reliable commands when not yet connected
- if(cls.state < CA_CHALLENGING)
- return;
-
- // don't overflow the reliable command buffer when paused
- if(CL_CheckPaused())
- return;
-
- // send a reliable userinfo update if needed
- if(cvar_modifiedFlags & CVAR_USERINFO)
- {
- cvar_modifiedFlags &= ~CVAR_USERINFO;
- CL_AddReliableCommand( va("userinfo \"%s\"", Cvar_InfoString( CVAR_USERINFO ) ) );
- }
-}
-
-/*
-==================
-CL_Frame
-
-==================
-*/
-void CL_Frame ( int msec ) {
-
- if ( !com_cl_running->integer ) {
- return;
- }
-
-#if USE_CURL
- if(clc.downloadCURLM) {
- CL_cURL_PerformDownload();
- // we can't process frames normally when in disconnected
- // download mode since the ui vm expects cls.state to be
- // CA_CONNECTED
- if(clc.cURLDisconnected) {
- cls.realFrametime = msec;
- cls.frametime = msec;
- cls.realtime += cls.frametime;
- SCR_UpdateScreen();
- S_Update();
- Con_RunConsole();
- cls.framecount++;
- return;
- }
- }
-#endif
-
- if ( cls.state == CA_DISCONNECTED && !( cls.keyCatchers & KEYCATCH_UI )
- && !com_sv_running->integer ) {
- // if disconnected, bring up the menu
- S_StopAllSounds();
- VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
- }
-
- // if recording an avi, lock to a fixed fps
- if ( CL_VideoRecording( ) && cl_aviFrameRate->integer && msec) {
- // save the current screen
- if ( cls.state == CA_ACTIVE || cl_forceavidemo->integer) {
- CL_TakeVideoFrame( );
-
- // fixed time for next frame'
- msec = (int)ceil( (1000.0f / cl_aviFrameRate->value) * com_timescale->value );
- if (msec == 0) {
- msec = 1;
- }
- }
- }
-
- if( cl_autoRecordDemo->integer ) {
- if( cls.state == CA_ACTIVE && !clc.demorecording && !clc.demoplaying ) {
- // If not recording a demo, and we should be, start one
- qtime_t now;
- char *nowString;
- char *p;
- char mapName[ MAX_QPATH ];
- char serverName[ MAX_OSPATH ];
-
- Com_RealTime( &now );
- nowString = va( "%04d%02d%02d%02d%02d%02d",
- 1900 + now.tm_year,
- 1 + now.tm_mon,
- now.tm_mday,
- now.tm_hour,
- now.tm_min,
- now.tm_sec );
-
- Q_strncpyz( serverName, cls.servername, MAX_OSPATH );
- // Replace the ":" in the address as it is not a valid
- // file name character
- p = strstr( serverName, ":" );
- if( p ) {
- *p = '.';
- }
-
- Q_strncpyz( mapName, COM_SkipPath( cl.mapname ), sizeof( cl.mapname ) );
- COM_StripExtension(mapName, mapName, sizeof(mapName));
-
- Cbuf_ExecuteText( EXEC_NOW,
- va( "record %s-%s-%s", nowString, serverName, mapName ) );
- }
- else if( cls.state != CA_ACTIVE && clc.demorecording ) {
- // Recording, but not CA_ACTIVE, so stop recording
- CL_StopRecord_f( );
- }
- }
-
- // save the msec before checking pause
- cls.realFrametime = msec;
-
- // decide the simulation time
- cls.frametime = msec;
-
- cls.realtime += cls.frametime;
-
- if ( cl_timegraph->integer ) {
- SCR_DebugGraph ( cls.realFrametime * 0.25, 0 );
- }
-
- // see if we need to update any userinfo
- CL_CheckUserinfo();
-
- // if we haven't gotten a packet in a long time,
- // drop the connection
- CL_CheckTimeout();
-
- // send intentions now
- CL_SendCmd();
-
- // resend a connection request if necessary
- CL_CheckForResend();
-
- // decide on the serverTime to render
- CL_SetCGameTime();
-
- // update the screen
- SCR_UpdateScreen();
-
- // update audio
- S_Update();
-
- // advance local effects for next frame
- SCR_RunCinematic();
-
- Con_RunConsole();
-
- cls.framecount++;
-}
-
-
-//============================================================================
-
-/*
-================
-CL_RefPrintf
-
-DLL glue
-================
-*/
-void QDECL CL_RefPrintf( int print_level, const char *fmt, ...) {
- va_list argptr;
- char msg[MAXPRINTMSG];
-
- va_start (argptr,fmt);
- Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
- va_end (argptr);
-
- if ( print_level == PRINT_ALL ) {
- Com_Printf ("%s", msg);
- } else if ( print_level == PRINT_WARNING ) {
- Com_Printf (S_COLOR_YELLOW "%s", msg); // yellow
- } else if ( print_level == PRINT_DEVELOPER ) {
- Com_DPrintf (S_COLOR_RED "%s", msg); // red
- }
-}
-
-
-
-/*
-============
-CL_ShutdownRef
-============
-*/
-void CL_ShutdownRef( void ) {
- if ( !re.Shutdown ) {
- return;
- }
- re.Shutdown( qtrue );
- Com_Memset( &re, 0, sizeof( re ) );
-}
-
-/*
-============
-CL_InitRenderer
-============
-*/
-void CL_InitRenderer( void ) {
- // this sets up the renderer and calls R_Init
- re.BeginRegistration( &cls.glconfig );
-
- // load character sets
- cls.charSetShader = re.RegisterShader( "gfx/2d/bigchars" );
- cls.whiteShader = re.RegisterShader( "white" );
- cls.consoleShader = re.RegisterShader( "console" );
- g_console_field_width = cls.glconfig.vidWidth / SMALLCHAR_WIDTH - 2;
- g_consoleField.widthInChars = g_console_field_width;
-}
-
-/*
-============================
-CL_StartHunkUsers
-
-After the server has cleared the hunk, these will need to be restarted
-This is the only place that any of these functions are called from
-============================
-*/
-void CL_StartHunkUsers( void ) {
- if (!com_cl_running) {
- return;
- }
-
- if ( !com_cl_running->integer ) {
- return;
- }
-
- if ( !cls.rendererStarted ) {
- cls.rendererStarted = qtrue;
- CL_InitRenderer();
- }
-
- if ( !cls.soundStarted ) {
- cls.soundStarted = qtrue;
- S_Init();
- }
-
- if ( !cls.soundRegistered ) {
- cls.soundRegistered = qtrue;
- S_BeginRegistration();
- }
-
- if ( !cls.uiStarted ) {
- cls.uiStarted = qtrue;
- CL_InitUI();
- }
-}
-
-/*
-============
-CL_RefMalloc
-============
-*/
-void *CL_RefMalloc( int size ) {
- return Z_TagMalloc( size, TAG_RENDERER );
-}
-
-int CL_ScaledMilliseconds(void) {
- return Sys_Milliseconds()*com_timescale->value;
-}
-
-/*
-============
-CL_InitRef
-============
-*/
-void CL_InitRef( void ) {
- refimport_t ri;
- refexport_t *ret;
-
- Com_Printf( "----- Initializing Renderer ----\n" );
-
- ri.Cmd_AddCommand = Cmd_AddCommand;
- ri.Cmd_RemoveCommand = Cmd_RemoveCommand;
- ri.Cmd_Argc = Cmd_Argc;
- ri.Cmd_Argv = Cmd_Argv;
- ri.Cmd_ExecuteText = Cbuf_ExecuteText;
- ri.Printf = CL_RefPrintf;
- ri.Error = Com_Error;
- ri.Milliseconds = CL_ScaledMilliseconds;
- ri.Malloc = CL_RefMalloc;
- ri.Free = Z_Free;
-#ifdef HUNK_DEBUG
- ri.Hunk_AllocDebug = Hunk_AllocDebug;
-#else
- ri.Hunk_Alloc = Hunk_Alloc;
-#endif
- ri.Hunk_AllocateTempMemory = Hunk_AllocateTempMemory;
- ri.Hunk_FreeTempMemory = Hunk_FreeTempMemory;
- ri.CM_DrawDebugSurface = CM_DrawDebugSurface;
- ri.FS_ReadFile = FS_ReadFile;
- ri.FS_FreeFile = FS_FreeFile;
- ri.FS_WriteFile = FS_WriteFile;
- ri.FS_FreeFileList = FS_FreeFileList;
- ri.FS_ListFiles = FS_ListFiles;
- ri.FS_FileIsInPAK = FS_FileIsInPAK;
- ri.FS_FileExists = FS_FileExists;
- ri.Cvar_Get = Cvar_Get;
- ri.Cvar_Set = Cvar_Set;
-
- // cinematic stuff
-
- ri.CIN_UploadCinematic = CIN_UploadCinematic;
- ri.CIN_PlayCinematic = CIN_PlayCinematic;
- ri.CIN_RunCinematic = CIN_RunCinematic;
-
- ri.CL_WriteAVIVideoFrame = CL_WriteAVIVideoFrame;
-
- ret = GetRefAPI( REF_API_VERSION, &ri );
-
-#if defined __USEA3D && defined __A3D_GEOM
- hA3Dg_ExportRenderGeom (ret);
-#endif
-
- Com_Printf( "-------------------------------\n");
-
- if ( !ret ) {
- Com_Error (ERR_FATAL, "Couldn't initialize refresh" );
- }
-
- re = *ret;
-
- // unpause so the cgame definately gets a snapshot and renders a frame
- Cvar_Set( "cl_paused", "0" );
-}
-
-
-//===========================================================================================
-
-
-void CL_SetModel_f( void ) {
- char *arg;
- char name[256];
-
- arg = Cmd_Argv( 1 );
- if (arg[0]) {
- Cvar_Set( "model", arg );
- Cvar_Set( "headmodel", arg );
- } else {
- Cvar_VariableStringBuffer( "model", name, sizeof(name) );
- Com_Printf("model is set to %s\n", name);
- }
-}
-
-
-//===========================================================================================
-
-
-/*
-===============
-CL_Video_f
-
-video
-video [filename]
-===============
-*/
-void CL_Video_f( void )
-{
- char filename[ MAX_OSPATH ];
- int i, last;
-
- if( !clc.demoplaying )
- {
- Com_Printf( "The video command can only be used when playing back demos\n" );
- return;
- }
-
- if( Cmd_Argc( ) == 2 )
- {
- // explicit filename
- Com_sprintf( filename, MAX_OSPATH, "videos/%s.avi", Cmd_Argv( 1 ) );
- }
- else
- {
- // scan for a free filename
- for( i = 0; i <= 9999; i++ )
- {
- int a, b, c, d;
-
- last = i;
-
- a = last / 1000;
- last -= a * 1000;
- b = last / 100;
- last -= b * 100;
- c = last / 10;
- last -= c * 10;
- d = last;
-
- Com_sprintf( filename, MAX_OSPATH, "videos/video%d%d%d%d.avi",
- a, b, c, d );
-
- if( !FS_FileExists( filename ) )
- break; // file doesn't exist
- }
-
- if( i > 9999 )
- {
- Com_Printf( S_COLOR_RED "ERROR: no free file names to create video\n" );
- return;
- }
- }
-
- CL_OpenAVIForWriting( filename );
-}
-
-/*
-===============
-CL_StopVideo_f
-===============
-*/
-void CL_StopVideo_f( void )
-{
- CL_CloseAVI( );
-}
-
-/*
-===============
-CL_GenerateQKey
-
-test to see if a valid QKEY_FILE exists. If one does not, try to generate
-it by filling it with 2048 bytes of random data.
-===============
-*/
-static void CL_GenerateQKey(void)
-{
- int len = 0;
- unsigned char buff[ QKEY_SIZE ];
- fileHandle_t f;
-
- len = FS_SV_FOpenFileRead( QKEY_FILE, &f );
- FS_FCloseFile( f );
- if( len == QKEY_SIZE ) {
- Com_Printf( "QKEY found.\n" );
- return;
- }
- else {
- if( len > 0 ) {
- Com_Printf( "QKEY file size != %d, regenerating\n",
- QKEY_SIZE );
- }
-
- Com_Printf( "QKEY building random string\n" );
- Com_RandomBytes( buff, sizeof(buff) );
-
- f = FS_SV_FOpenFileWrite( QKEY_FILE );
- if( !f ) {
- Com_Printf( "QKEY could not open %s for write\n",
- QKEY_FILE );
- return;
- }
- FS_Write( buff, sizeof(buff), f );
- FS_FCloseFile( f );
- Com_Printf( "QKEY generated\n" );
- }
-}
-
-/*
-====================
-CL_Init
-====================
-*/
-void CL_Init( void ) {
- const char *playerName;
-
- Com_Printf( "----- Client Initialization -----\n" );
-
- Con_Init ();
-
- CL_ClearState ();
-
- cls.state = CA_DISCONNECTED; // no longer CA_UNINITIALIZED
-
- cls.realtime = 0;
-
- CL_InitInput ();
-
- //
- // register our variables
- //
- cl_noprint = Cvar_Get( "cl_noprint", "0", 0 );
- cl_motd = Cvar_Get ("cl_motd", "1", 0);
-
- cl_timeout = Cvar_Get ("cl_timeout", "200", 0);
-
- cl_timeNudge = Cvar_Get ("cl_timeNudge", "0", CVAR_TEMP );
- cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_TEMP );
- cl_showSend = Cvar_Get ("cl_showSend", "0", CVAR_TEMP );
- cl_showTimeDelta = Cvar_Get ("cl_showTimeDelta", "0", CVAR_TEMP );
- cl_freezeDemo = Cvar_Get ("cl_freezeDemo", "0", CVAR_TEMP );
- rcon_client_password = Cvar_Get ("rconPassword", "", CVAR_TEMP );
- cl_activeAction = Cvar_Get( "activeAction", "", CVAR_TEMP );
-
- cl_timedemo = Cvar_Get ("timedemo", "0", 0);
- cl_autoRecordDemo = Cvar_Get ("cl_autoRecordDemo", "0", CVAR_ARCHIVE);
- cl_aviFrameRate = Cvar_Get ("cl_aviFrameRate", "25", CVAR_ARCHIVE);
- cl_aviMotionJpeg = Cvar_Get ("cl_aviMotionJpeg", "1", CVAR_ARCHIVE);
- cl_forceavidemo = Cvar_Get ("cl_forceavidemo", "0", 0);
-
- rconAddress = Cvar_Get ("rconAddress", "", 0);
-
- cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_ARCHIVE);
- cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "140", CVAR_ARCHIVE);
- cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", 0);
-
- cl_maxpackets = Cvar_Get ("cl_maxpackets", "30", CVAR_ARCHIVE );
- cl_packetdup = Cvar_Get ("cl_packetdup", "1", CVAR_ARCHIVE );
-
- cl_run = Cvar_Get ("cl_run", "1", CVAR_ARCHIVE);
- cl_sensitivity = Cvar_Get ("sensitivity", "5", CVAR_ARCHIVE);
- cl_platformSensitivity = Cvar_Get ("cl_platformSensitivity", "1.0", CVAR_ROM);
- cl_mouseAccel = Cvar_Get ("cl_mouseAccel", "0", CVAR_ARCHIVE);
- cl_freelook = Cvar_Get( "cl_freelook", "1", CVAR_ARCHIVE );
-
- cl_showMouseRate = Cvar_Get ("cl_showmouserate", "0", 0);
-
- cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE);
-#if USE_CURL
- cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE);
-#endif
-
- cl_conXOffset = Cvar_Get ("cl_conXOffset", "0", 0);
-#ifdef MACOS_X
- // In game video is REALLY slow in Mac OS X right now due to driver slowness
- cl_inGameVideo = Cvar_Get ("r_inGameVideo", "0", CVAR_ARCHIVE);
-#else
- cl_inGameVideo = Cvar_Get ("r_inGameVideo", "1", CVAR_ARCHIVE);
-#endif
-
- cl_serverStatusResendTime = Cvar_Get ("cl_serverStatusResendTime", "750", 0);
-
- // init autoswitch so the ui will have it correctly even
- // if the cgame hasn't been started
- Cvar_Get ("cg_autoswitch", "1", CVAR_ARCHIVE);
-
- m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE);
- m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_ARCHIVE);
- m_forward = Cvar_Get ("m_forward", "0.25", CVAR_ARCHIVE);
- m_side = Cvar_Get ("m_side", "0.25", CVAR_ARCHIVE);
-#ifdef MACOS_X
- // Input is jittery on OS X w/o this
- m_filter = Cvar_Get ("m_filter", "1", CVAR_ARCHIVE);
-#else
- m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE);
-#endif
-
- cl_motdString = Cvar_Get( "cl_motdString", "", CVAR_ROM );
-
- Cvar_Get( "cl_maxPing", "800", CVAR_ARCHIVE );
-
- cl_lanForcePackets = Cvar_Get ("cl_lanForcePackets", "1", CVAR_ARCHIVE);
-
- cl_guidServerUniq = Cvar_Get ("cl_guidServerUniq", "1", CVAR_ARCHIVE);
-
- // userinfo
- playerName = getenv( "USER" ); // Unixy stuff
- if( playerName == NULL )
- {
- playerName = getenv( "USERNAME" ); // Windows
- if( playerName == NULL )
- {
- playerName = "Newbie"; // Default
- }
- }
- Cvar_Get ("name", playerName, CVAR_USERINFO | CVAR_ARCHIVE );
-
- Cvar_Get ("rate", "25000", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("snaps", "20", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("model", "sarge", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("headmodel", "sarge", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("team_model", "james", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("team_headmodel", "*james", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("color1", "4", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("color2", "5", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("handicap", "100", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("teamtask", "0", CVAR_USERINFO );
- Cvar_Get ("sex", "male", CVAR_USERINFO | CVAR_ARCHIVE );
- Cvar_Get ("cl_anonymous", "0", CVAR_USERINFO | CVAR_ARCHIVE );
-
- Cvar_Get ("password", "", CVAR_USERINFO);
- Cvar_Get ("cg_predictItems", "1", CVAR_USERINFO | CVAR_ARCHIVE );
-
-
- // cgame might not be initialized before menu is used
- Cvar_Get ("cg_viewsize", "100", CVAR_ARCHIVE );
-
- //
- // register our commands
- //
- Cmd_AddCommand ("cmd", CL_ForwardToServer_f);
- Cmd_AddCommand ("configstrings", CL_Configstrings_f);
- Cmd_AddCommand ("clientinfo", CL_Clientinfo_f);
- Cmd_AddCommand ("snd_restart", CL_Snd_Restart_f);
- Cmd_AddCommand ("vid_restart", CL_Vid_Restart_f);
- Cmd_AddCommand ("disconnect", CL_Disconnect_f);
- Cmd_AddCommand ("record", CL_Record_f);
- Cmd_AddCommand ("demo", CL_PlayDemo_f);
- Cmd_AddCommand ("cinematic", CL_PlayCinematic_f);
- Cmd_AddCommand ("stoprecord", CL_StopRecord_f);
- Cmd_AddCommand ("connect", CL_Connect_f);
- Cmd_AddCommand ("reconnect", CL_Reconnect_f);
- Cmd_AddCommand ("localservers", CL_LocalServers_f);
- Cmd_AddCommand ("globalservers", CL_GlobalServers_f);
- Cmd_AddCommand ("rcon", CL_Rcon_f);
- Cmd_AddCommand ("setenv", CL_Setenv_f );
- Cmd_AddCommand ("ping", CL_Ping_f );
- Cmd_AddCommand ("serverstatus", CL_ServerStatus_f );
- Cmd_AddCommand ("showip", CL_ShowIP_f );
- Cmd_AddCommand ("fs_openedList", CL_OpenedPK3List_f );
- Cmd_AddCommand ("fs_referencedList", CL_ReferencedPK3List_f );
- Cmd_AddCommand ("model", CL_SetModel_f );
- Cmd_AddCommand ("video", CL_Video_f );
- Cmd_AddCommand ("stopvideo", CL_StopVideo_f );
- CL_InitRef();
-
- SCR_Init ();
-
- Cbuf_Execute ();
-
- Cvar_Set( "cl_running", "1" );
-
- CL_GenerateQKey();
- Cvar_Get( "cl_guid", "", CVAR_USERINFO | CVAR_ROM );
- CL_UpdateGUID( NULL, 0 );
-
- Com_Printf( "----- Client Initialization Complete -----\n" );
-}
-
-
-/*
-===============
-CL_Shutdown
-
-===============
-*/
-void CL_Shutdown( void ) {
- static qboolean recursive = qfalse;
-
- // check whether the client is running at all.
- if(!(com_cl_running && com_cl_running->integer))
- return;
-
- Com_Printf( "----- CL_Shutdown -----\n" );
-
- if ( recursive ) {
- printf ("recursive shutdown\n");
- return;
- }
- recursive = qtrue;
-
- CL_Disconnect( qtrue );
-
- S_Shutdown();
- CL_ShutdownRef();
-
- CL_ShutdownUI();
-
- Cmd_RemoveCommand ("cmd");
- Cmd_RemoveCommand ("configstrings");
- Cmd_RemoveCommand ("userinfo");
- Cmd_RemoveCommand ("snd_restart");
- Cmd_RemoveCommand ("vid_restart");
- Cmd_RemoveCommand ("disconnect");
- Cmd_RemoveCommand ("record");
- Cmd_RemoveCommand ("demo");
- Cmd_RemoveCommand ("cinematic");
- Cmd_RemoveCommand ("stoprecord");
- Cmd_RemoveCommand ("connect");
- Cmd_RemoveCommand ("localservers");
- Cmd_RemoveCommand ("globalservers");
- Cmd_RemoveCommand ("rcon");
- Cmd_RemoveCommand ("setenv");
- Cmd_RemoveCommand ("ping");
- Cmd_RemoveCommand ("serverstatus");
- Cmd_RemoveCommand ("showip");
- Cmd_RemoveCommand ("model");
- Cmd_RemoveCommand ("video");
- Cmd_RemoveCommand ("stopvideo");
-
- Cvar_Set( "cl_running", "0" );
-
- recursive = qfalse;
-
- Com_Memset( &cls, 0, sizeof( cls ) );
-
- Com_Printf( "-----------------------\n" );
-
-}
-
-static void CL_SetServerInfo(serverInfo_t *server, const char *info, int ping) {
- if (server) {
- if (info) {
- server->clients = atoi(Info_ValueForKey(info, "clients"));
- Q_strncpyz(server->hostName,Info_ValueForKey(info, "hostname"), MAX_HOSTNAME_LENGTH );
- Q_strncpyz(server->mapName, Info_ValueForKey(info, "mapname"), MAX_NAME_LENGTH);
- server->maxClients = atoi(Info_ValueForKey(info, "sv_maxclients"));
- Q_strncpyz(server->game,Info_ValueForKey(info, "game"), MAX_NAME_LENGTH);
- server->gameType = atoi(Info_ValueForKey(info, "gametype"));
- server->netType = atoi(Info_ValueForKey(info, "nettype"));
- server->minPing = atoi(Info_ValueForKey(info, "minping"));
- server->maxPing = atoi(Info_ValueForKey(info, "maxping"));
- }
- server->ping = ping;
- }
-}
-
-static void CL_SetServerInfoByAddress(netadr_t from, const char *info, int ping) {
- int i;
-
- for (i = 0; i < MAX_OTHER_SERVERS; i++) {
- if (NET_CompareAdr(from, cls.localServers[i].adr)) {
- CL_SetServerInfo(&cls.localServers[i], info, ping);
- }
- }
-
- for (i = 0; i < MAX_OTHER_SERVERS; i++) {
- if (NET_CompareAdr(from, cls.mplayerServers[i].adr)) {
- CL_SetServerInfo(&cls.mplayerServers[i], info, ping);
- }
- }
-
- for (i = 0; i < MAX_GLOBAL_SERVERS; i++) {
- if (NET_CompareAdr(from, cls.globalServers[i].adr)) {
- CL_SetServerInfo(&cls.globalServers[i], info, ping);
- }
- }
-
- for (i = 0; i < MAX_OTHER_SERVERS; i++) {
- if (NET_CompareAdr(from, cls.favoriteServers[i].adr)) {
- CL_SetServerInfo(&cls.favoriteServers[i], info, ping);
- }
- }
-
-}
-
-/*
-===================
-CL_ServerInfoPacket
-===================
-*/
-void CL_ServerInfoPacket( netadr_t from, msg_t *msg ) {
- int i, type;
- char info[MAX_INFO_STRING];
- char* str;
- char *infoString;
- int prot;
-
- infoString = MSG_ReadString( msg );
-
- // if this isn't the correct protocol version, ignore it
- prot = atoi( Info_ValueForKey( infoString, "protocol" ) );
- if ( prot != PROTOCOL_VERSION ) {
- Com_DPrintf( "Different protocol info packet: %s\n", infoString );
- return;
- }
-
- // iterate servers waiting for ping response
- for (i=0; iretrieved = qtrue;
- return qfalse;
- }
-
- // if this server status request has the same address
- if ( NET_CompareAdr( to, serverStatus->address) ) {
- // if we recieved an response for this server status request
- if (!serverStatus->pending) {
- Q_strncpyz(serverStatusString, serverStatus->string, maxLen);
- serverStatus->retrieved = qtrue;
- serverStatus->startTime = 0;
- return qtrue;
- }
- // resend the request regularly
- else if ( serverStatus->startTime < Com_Milliseconds() - cl_serverStatusResendTime->integer ) {
- serverStatus->print = qfalse;
- serverStatus->pending = qtrue;
- serverStatus->retrieved = qfalse;
- serverStatus->time = 0;
- serverStatus->startTime = Com_Milliseconds();
- NET_OutOfBandPrint( NS_CLIENT, to, "getstatus" );
- return qfalse;
- }
- }
- // if retrieved
- else if ( serverStatus->retrieved ) {
- serverStatus->address = to;
- serverStatus->print = qfalse;
- serverStatus->pending = qtrue;
- serverStatus->retrieved = qfalse;
- serverStatus->startTime = Com_Milliseconds();
- serverStatus->time = 0;
- NET_OutOfBandPrint( NS_CLIENT, to, "getstatus" );
- return qfalse;
- }
- return qfalse;
-}
-
-/*
-===================
-CL_ServerStatusResponse
-===================
-*/
-void CL_ServerStatusResponse( netadr_t from, msg_t *msg ) {
- char *s;
- char info[MAX_INFO_STRING];
- int i, l, score, ping;
- int len;
- serverStatus_t *serverStatus;
-
- serverStatus = NULL;
- for (i = 0; i < MAX_SERVERSTATUSREQUESTS; i++) {
- if ( NET_CompareAdr( from, cl_serverStatusList[i].address ) ) {
- serverStatus = &cl_serverStatusList[i];
- break;
- }
- }
- // if we didn't request this server status
- if (!serverStatus) {
- return;
- }
-
- s = MSG_ReadStringLine( msg );
-
- len = 0;
- Com_sprintf(&serverStatus->string[len], sizeof(serverStatus->string)-len, "%s", s);
-
- if (serverStatus->print) {
- Com_Printf("Server settings:\n");
- // print cvars
- while (*s) {
- for (i = 0; i < 2 && *s; i++) {
- if (*s == '\\')
- s++;
- l = 0;
- while (*s) {
- info[l++] = *s;
- if (l >= MAX_INFO_STRING-1)
- break;
- s++;
- if (*s == '\\') {
- break;
- }
- }
- info[l] = '\0';
- if (i) {
- Com_Printf("%s\n", info);
- }
- else {
- Com_Printf("%-24s", info);
- }
- }
- }
- }
-
- len = strlen(serverStatus->string);
- Com_sprintf(&serverStatus->string[len], sizeof(serverStatus->string)-len, "\\");
-
- if (serverStatus->print) {
- Com_Printf("\nPlayers:\n");
- Com_Printf("num: score: ping: name:\n");
- }
- for (i = 0, s = MSG_ReadStringLine( msg ); *s; s = MSG_ReadStringLine( msg ), i++) {
-
- len = strlen(serverStatus->string);
- Com_sprintf(&serverStatus->string[len], sizeof(serverStatus->string)-len, "\\%s", s);
-
- if (serverStatus->print) {
- score = ping = 0;
- sscanf(s, "%d %d", &score, &ping);
- s = strchr(s, ' ');
- if (s)
- s = strchr(s+1, ' ');
- if (s)
- s++;
- else
- s = "unknown";
- Com_Printf("%-2d %-3d %-3d %s\n", i, score, ping, s );
- }
- }
- len = strlen(serverStatus->string);
- Com_sprintf(&serverStatus->string[len], sizeof(serverStatus->string)-len, "\\");
-
- serverStatus->time = Com_Milliseconds();
- serverStatus->address = from;
- serverStatus->pending = qfalse;
- if (serverStatus->print) {
- serverStatus->retrieved = qtrue;
- }
-}
-
-/*
-==================
-CL_LocalServers_f
-==================
-*/
-void CL_LocalServers_f( void ) {
- char *message;
- int i, j;
- netadr_t to;
-
- Com_Printf( "Scanning for servers on the local network...\n");
-
- // reset the list, waiting for response
- cls.numlocalservers = 0;
- cls.pingUpdateSource = AS_LOCAL;
-
- for (i = 0; i < MAX_OTHER_SERVERS; i++) {
- qboolean b = cls.localServers[i].visible;
- Com_Memset(&cls.localServers[i], 0, sizeof(cls.localServers[i]));
- cls.localServers[i].visible = b;
- }
- Com_Memset( &to, 0, sizeof( to ) );
-
- // The 'xxx' in the message is a challenge that will be echoed back
- // by the server. We don't care about that here, but master servers
- // can use that to prevent spoofed server responses from invalid ip
- message = "\377\377\377\377getinfo xxx";
-
- // send each message twice in case one is dropped
- for ( i = 0 ; i < 2 ; i++ ) {
- // send a broadcast packet on each server port
- // we support multiple server ports so a single machine
- // can nicely run multiple servers
- for ( j = 0 ; j < NUM_SERVER_PORTS ; j++ ) {
- to.port = BigShort( (short)(PORT_SERVER + j) );
-
- to.type = NA_BROADCAST;
- NET_SendPacket( NS_CLIENT, strlen( message ), message, to );
-
- to.type = NA_BROADCAST_IPX;
- NET_SendPacket( NS_CLIENT, strlen( message ), message, to );
- }
- }
-}
-
-/*
-==================
-CL_GlobalServers_f
-==================
-*/
-void CL_GlobalServers_f( void ) {
- netadr_t to;
- int i;
- int count;
- char *buffptr;
- char command[1024];
-
- if ( Cmd_Argc() < 3) {
- Com_Printf( "usage: globalservers [keywords]\n");
- return;
- }
-
- cls.masterNum = atoi( Cmd_Argv(1) );
-
- Com_Printf( "Requesting servers from the master...\n");
-
- // reset the list, waiting for response
- // -1 is used to distinguish a "no response"
-
- if( cls.masterNum == 1 ) {
- NET_StringToAdr( MASTER_SERVER_NAME, &to );
- cls.nummplayerservers = -1;
- cls.pingUpdateSource = AS_MPLAYER;
- }
- else {
- NET_StringToAdr( MASTER_SERVER_NAME, &to );
- cls.numglobalservers = -1;
- cls.pingUpdateSource = AS_GLOBAL;
- }
- to.type = NA_IP;
- to.port = BigShort(PORT_MASTER);
-
- sprintf( command, "getservers %s", Cmd_Argv(2) );
-
- // tack on keywords
- buffptr = command + strlen( command );
- count = Cmd_Argc();
- for (i=3; i= MAX_PINGREQUESTS)
- return;
-
- cl_pinglist[n].adr.port = 0;
-}
-
-/*
-==================
-CL_GetPingQueueCount
-==================
-*/
-int CL_GetPingQueueCount( void )
-{
- int i;
- int count;
- ping_t* pingptr;
-
- count = 0;
- pingptr = cl_pinglist;
-
- for (i=0; iadr.port) {
- count++;
- }
- }
-
- return (count);
-}
-
-/*
-==================
-CL_GetFreePing
-==================
-*/
-ping_t* CL_GetFreePing( void )
-{
- ping_t* pingptr;
- ping_t* best;
- int oldest;
- int i;
- int time;
-
- pingptr = cl_pinglist;
- for (i=0; iadr.port)
- {
- if (!pingptr->time)
- {
- if (cls.realtime - pingptr->start < 500)
- {
- // still waiting for response
- continue;
- }
- }
- else if (pingptr->time < 500)
- {
- // results have not been queried
- continue;
- }
- }
-
- // clear it
- pingptr->adr.port = 0;
- return (pingptr);
- }
-
- // use oldest entry
- pingptr = cl_pinglist;
- best = cl_pinglist;
- oldest = INT_MIN;
- for (i=0; istart;
- if (time > oldest)
- {
- oldest = time;
- best = pingptr;
- }
- }
-
- return (best);
-}
-
-/*
-==================
-CL_Ping_f
-==================
-*/
-void CL_Ping_f( void ) {
- netadr_t to;
- ping_t* pingptr;
- char* server;
-
- if ( Cmd_Argc() != 2 ) {
- Com_Printf( "usage: ping [server]\n");
- return;
- }
-
- Com_Memset( &to, 0, sizeof(netadr_t) );
-
- server = Cmd_Argv(1);
-
- if ( !NET_StringToAdr( server, &to ) ) {
- return;
- }
-
- pingptr = CL_GetFreePing();
-
- memcpy( &pingptr->adr, &to, sizeof (netadr_t) );
- pingptr->start = cls.realtime;
- pingptr->time = 0;
-
- CL_SetServerInfoByAddress(pingptr->adr, NULL, 0);
-
- NET_OutOfBandPrint( NS_CLIENT, to, "getinfo xxx" );
-}
-
-/*
-==================
-CL_UpdateVisiblePings_f
-==================
-*/
-qboolean CL_UpdateVisiblePings_f(int source) {
- int slots, i;
- char buff[MAX_STRING_CHARS];
- int pingTime;
- int max;
- qboolean status = qfalse;
-
- if (source < 0 || source > AS_FAVORITES) {
- return qfalse;
- }
-
- cls.pingUpdateSource = source;
-
- slots = CL_GetPingQueueCount();
- if (slots < MAX_PINGREQUESTS) {
- serverInfo_t *server = NULL;
-
- max = (source == AS_GLOBAL) ? MAX_GLOBAL_SERVERS : MAX_OTHER_SERVERS;
- switch (source) {
- case AS_LOCAL :
- server = &cls.localServers[0];
- max = cls.numlocalservers;
- break;
- case AS_MPLAYER :
- server = &cls.mplayerServers[0];
- max = cls.nummplayerservers;
- break;
- case AS_GLOBAL :
- server = &cls.globalServers[0];
- max = cls.numglobalservers;
- break;
- case AS_FAVORITES :
- server = &cls.favoriteServers[0];
- max = cls.numfavoriteservers;
- break;
- }
- for (i = 0; i < max; i++) {
- if (server[i].visible) {
- if (server[i].ping == -1) {
- int j;
-
- if (slots >= MAX_PINGREQUESTS) {
- break;
- }
- for (j = 0; j < MAX_PINGREQUESTS; j++) {
- if (!cl_pinglist[j].adr.port) {
- continue;
- }
- if (NET_CompareAdr( cl_pinglist[j].adr, server[i].adr)) {
- // already on the list
- break;
- }
- }
- if (j >= MAX_PINGREQUESTS) {
- status = qtrue;
- for (j = 0; j < MAX_PINGREQUESTS; j++) {
- if (!cl_pinglist[j].adr.port) {
- break;
- }
- }
- memcpy(&cl_pinglist[j].adr, &server[i].adr, sizeof(netadr_t));
- cl_pinglist[j].start = cls.realtime;
- cl_pinglist[j].time = 0;
- NET_OutOfBandPrint( NS_CLIENT, cl_pinglist[j].adr, "getinfo xxx" );
- slots++;
- }
- }
- // if the server has a ping higher than cl_maxPing or
- // the ping packet got lost
- else if (server[i].ping == 0) {
- // if we are updating global servers
- if (source == AS_GLOBAL) {
- //
- if ( cls.numGlobalServerAddresses > 0 ) {
- // overwrite this server with one from the additional global servers
- cls.numGlobalServerAddresses--;
- CL_InitServerInfo(&server[i], &cls.globalServerAddresses[cls.numGlobalServerAddresses]);
- // NOTE: the server[i].visible flag stays untouched
- }
- }
- }
- }
- }
- }
-
- if (slots) {
- status = qtrue;
- }
- for (i = 0; i < MAX_PINGREQUESTS; i++) {
- if (!cl_pinglist[i].adr.port) {
- continue;
- }
- CL_GetPing( i, buff, MAX_STRING_CHARS, &pingTime );
- if (pingTime != 0) {
- CL_ClearPing(i);
- status = qtrue;
- }
- }
-
- return status;
-}
-
-/*
-==================
-CL_ServerStatus_f
-==================
-*/
-void CL_ServerStatus_f(void) {
- netadr_t to;
- char *server;
- serverStatus_t *serverStatus;
-
- Com_Memset( &to, 0, sizeof(netadr_t) );
-
- if ( Cmd_Argc() != 2 ) {
- if ( cls.state != CA_ACTIVE || clc.demoplaying ) {
- Com_Printf ("Not connected to a server.\n");
- Com_Printf( "Usage: serverstatus [server]\n");
- return;
- }
- server = cls.servername;
- }
- else {
- server = Cmd_Argv(1);
- }
-
- if ( !NET_StringToAdr( server, &to ) ) {
- return;
- }
-
- NET_OutOfBandPrint( NS_CLIENT, to, "getstatus" );
-
- serverStatus = CL_GetServerStatus( to );
- serverStatus->address = to;
- serverStatus->print = qtrue;
- serverStatus->pending = qtrue;
-}
-
-/*
-==================
-CL_ShowIP_f
-==================
-*/
-void CL_ShowIP_f(void) {
- Sys_ShowIP();
-}
diff --git a/src/client/cl_net_chan.c b/src/client/cl_net_chan.c
deleted file mode 100644
index ef214fe..0000000
--- a/src/client/cl_net_chan.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "../qcommon/q_shared.h"
-#include "../qcommon/qcommon.h"
-#include "client.h"
-
-/*
-==============
-CL_Netchan_Encode
-
- // first 12 bytes of the data are always:
- long serverId;
- long messageAcknowledge;
- long reliableAcknowledge;
-
-==============
-*/
-static void CL_Netchan_Encode( msg_t *msg ) {
- int serverId, messageAcknowledge, reliableAcknowledge;
- int i, index, srdc, sbit, soob;
- byte key, *string;
-
- if ( msg->cursize <= CL_ENCODE_START ) {
- return;
- }
-
- srdc = msg->readcount;
- sbit = msg->bit;
- soob = msg->oob;
-
- msg->bit = 0;
- msg->readcount = 0;
- msg->oob = 0;
-
- serverId = MSG_ReadLong(msg);
- messageAcknowledge = MSG_ReadLong(msg);
- reliableAcknowledge = MSG_ReadLong(msg);
-
- msg->oob = soob;
- msg->bit = sbit;
- msg->readcount = srdc;
-
- string = (byte *)clc.serverCommands[ reliableAcknowledge & (MAX_RELIABLE_COMMANDS-1) ];
- index = 0;
- //
- key = clc.challenge ^ serverId ^ messageAcknowledge;
- for (i = CL_ENCODE_START; i < msg->cursize; i++) {
- // modify the key with the last received now acknowledged server command
- if (!string[index])
- index = 0;
- if (string[index] > 127 || string[index] == '%') {
- key ^= '.' << (i & 1);
- }
- else {
- key ^= string[index] << (i & 1);
- }
- index++;
- // encode the data with this key
- *(msg->data + i) = (*(msg->data + i)) ^ key;
- }
-}
-
-/*
-==============
-CL_Netchan_Decode
-
- // first four bytes of the data are always:
- long reliableAcknowledge;
-
-==============
-*/
-static void CL_Netchan_Decode( msg_t *msg ) {
- long reliableAcknowledge, i, index;
- byte key, *string;
- int srdc, sbit, soob;
-
- srdc = msg->readcount;
- sbit = msg->bit;
- soob = msg->oob;
-
- msg->oob = 0;
-
- reliableAcknowledge = MSG_ReadLong(msg);
-
- msg->oob = soob;
- msg->bit = sbit;
- msg->readcount = srdc;
-
- string = (byte *) clc.reliableCommands[ reliableAcknowledge & (MAX_RELIABLE_COMMANDS-1) ];
- index = 0;
- // xor the client challenge with the netchan sequence number (need something that changes every message)
- key = clc.challenge ^ LittleLong( *(unsigned *)msg->data );
- for (i = msg->readcount + CL_DECODE_START; i < msg->cursize; i++) {
- // modify the key with the last sent and with this message acknowledged client command
- if (!string[index])
- index = 0;
- if (string[index] > 127 || string[index] == '%') {
- key ^= '.' << (i & 1);
- }
- else {
- key ^= string[index] << (i & 1);
- }
- index++;
- // decode the data with this key
- *(msg->data + i) = *(msg->data + i) ^ key;
- }
-}
-
-/*
-=================
-CL_Netchan_TransmitNextFragment
-=================
-*/
-void CL_Netchan_TransmitNextFragment( netchan_t *chan ) {
- Netchan_TransmitNextFragment( chan );
-}
-
-/*
-===============
-CL_Netchan_Transmit
-================
-*/
-void CL_Netchan_Transmit( netchan_t *chan, msg_t* msg ) {
- MSG_WriteByte( msg, clc_EOF );
-
- CL_Netchan_Encode( msg );
- Netchan_Transmit( chan, msg->cursize, msg->data );
-}
-
-extern int oldsize;
-int newsize = 0;
-
-/*
-=================
-CL_Netchan_Process
-=================
-*/
-qboolean CL_Netchan_Process( netchan_t *chan, msg_t *msg ) {
- int ret;
-
- ret = Netchan_Process( chan, msg );
- if (!ret)
- return qfalse;
- CL_Netchan_Decode( msg );
- newsize += msg->cursize;
- return qtrue;
-}
diff --git a/src/client/cl_parse.c b/src/client/cl_parse.c
deleted file mode 100644
index 63b1b6e..0000000
--- a/src/client/cl_parse.c
+++ /dev/null
@@ -1,722 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// cl_parse.c -- parse a message received from the server
-
-#include "client.h"
-
-char *svc_strings[256] = {
- "svc_bad",
-
- "svc_nop",
- "svc_gamestate",
- "svc_configstring",
- "svc_baseline",
- "svc_serverCommand",
- "svc_download",
- "svc_snapshot"
-};
-
-void SHOWNET( msg_t *msg, char *s) {
- if ( cl_shownet->integer >= 2) {
- Com_Printf ("%3i:%s\n", msg->readcount-1, s);
- }
-}
-
-
-/*
-=========================================================================
-
-MESSAGE PARSING
-
-=========================================================================
-*/
-
-/*
-==================
-CL_DeltaEntity
-
-Parses deltas from the given base and adds the resulting entity
-to the current frame
-==================
-*/
-void CL_DeltaEntity (msg_t *msg, clSnapshot_t *frame, int newnum, entityState_t *old,
- qboolean unchanged) {
- entityState_t *state;
-
- // save the parsed entity state into the big circular buffer so
- // it can be used as the source for a later delta
- state = &cl.parseEntities[cl.parseEntitiesNum & (MAX_PARSE_ENTITIES-1)];
-
- if ( unchanged ) {
- *state = *old;
- } else {
- MSG_ReadDeltaEntity( msg, old, state, newnum );
- }
-
- if ( state->number == (MAX_GENTITIES-1) ) {
- return; // entity was delta removed
- }
- cl.parseEntitiesNum++;
- frame->numEntities++;
-}
-
-/*
-==================
-CL_ParsePacketEntities
-
-==================
-*/
-void CL_ParsePacketEntities( msg_t *msg, clSnapshot_t *oldframe, clSnapshot_t *newframe) {
- int newnum;
- entityState_t *oldstate;
- int oldindex, oldnum;
-
- newframe->parseEntitiesNum = cl.parseEntitiesNum;
- newframe->numEntities = 0;
-
- // delta from the entities present in oldframe
- oldindex = 0;
- oldstate = NULL;
- if (!oldframe) {
- oldnum = 99999;
- } else {
- if ( oldindex >= oldframe->numEntities ) {
- oldnum = 99999;
- } else {
- oldstate = &cl.parseEntities[
- (oldframe->parseEntitiesNum + oldindex) & (MAX_PARSE_ENTITIES-1)];
- oldnum = oldstate->number;
- }
- }
-
- while ( 1 ) {
- // read the entity index number
- newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
-
- if ( newnum == (MAX_GENTITIES-1) ) {
- break;
- }
-
- if ( msg->readcount > msg->cursize ) {
- Com_Error (ERR_DROP,"CL_ParsePacketEntities: end of message");
- }
-
- while ( oldnum < newnum ) {
- // one or more entities from the old packet are unchanged
- if ( cl_shownet->integer == 3 ) {
- Com_Printf ("%3i: unchanged: %i\n", msg->readcount, oldnum);
- }
- CL_DeltaEntity( msg, newframe, oldnum, oldstate, qtrue );
-
- oldindex++;
-
- if ( oldindex >= oldframe->numEntities ) {
- oldnum = 99999;
- } else {
- oldstate = &cl.parseEntities[
- (oldframe->parseEntitiesNum + oldindex) & (MAX_PARSE_ENTITIES-1)];
- oldnum = oldstate->number;
- }
- }
- if (oldnum == newnum) {
- // delta from previous state
- if ( cl_shownet->integer == 3 ) {
- Com_Printf ("%3i: delta: %i\n", msg->readcount, newnum);
- }
- CL_DeltaEntity( msg, newframe, newnum, oldstate, qfalse );
-
- oldindex++;
-
- if ( oldindex >= oldframe->numEntities ) {
- oldnum = 99999;
- } else {
- oldstate = &cl.parseEntities[
- (oldframe->parseEntitiesNum + oldindex) & (MAX_PARSE_ENTITIES-1)];
- oldnum = oldstate->number;
- }
- continue;
- }
-
- if ( oldnum > newnum ) {
- // delta from baseline
- if ( cl_shownet->integer == 3 ) {
- Com_Printf ("%3i: baseline: %i\n", msg->readcount, newnum);
- }
- CL_DeltaEntity( msg, newframe, newnum, &cl.entityBaselines[newnum], qfalse );
- continue;
- }
-
- }
-
- // any remaining entities in the old frame are copied over
- while ( oldnum != 99999 ) {
- // one or more entities from the old packet are unchanged
- if ( cl_shownet->integer == 3 ) {
- Com_Printf ("%3i: unchanged: %i\n", msg->readcount, oldnum);
- }
- CL_DeltaEntity( msg, newframe, oldnum, oldstate, qtrue );
-
- oldindex++;
-
- if ( oldindex >= oldframe->numEntities ) {
- oldnum = 99999;
- } else {
- oldstate = &cl.parseEntities[
- (oldframe->parseEntitiesNum + oldindex) & (MAX_PARSE_ENTITIES-1)];
- oldnum = oldstate->number;
- }
- }
-}
-
-
-/*
-================
-CL_ParseSnapshot
-
-If the snapshot is parsed properly, it will be copied to
-cl.snap and saved in cl.snapshots[]. If the snapshot is invalid
-for any reason, no changes to the state will be made at all.
-================
-*/
-void CL_ParseSnapshot( msg_t *msg ) {
- int len;
- clSnapshot_t *old;
- clSnapshot_t newSnap;
- int deltaNum;
- int oldMessageNum;
- int i, packetNum;
-
- // get the reliable sequence acknowledge number
- // NOTE: now sent with all server to client messages
- //clc.reliableAcknowledge = MSG_ReadLong( msg );
-
- // read in the new snapshot to a temporary buffer
- // we will only copy to cl.snap if it is valid
- Com_Memset (&newSnap, 0, sizeof(newSnap));
-
- // we will have read any new server commands in this
- // message before we got to svc_snapshot
- newSnap.serverCommandNum = clc.serverCommandSequence;
-
- newSnap.serverTime = MSG_ReadLong( msg );
-
- // if we were just unpaused, we can only *now* really let the
- // change come into effect or the client hangs.
- cl_paused->modified = 0;
-
- newSnap.messageNum = clc.serverMessageSequence;
-
- deltaNum = MSG_ReadByte( msg );
- if ( !deltaNum ) {
- newSnap.deltaNum = -1;
- } else {
- newSnap.deltaNum = newSnap.messageNum - deltaNum;
- }
- newSnap.snapFlags = MSG_ReadByte( msg );
-
- // If the frame is delta compressed from data that we
- // no longer have available, we must suck up the rest of
- // the frame, but not use it, then ask for a non-compressed
- // message
- if ( newSnap.deltaNum <= 0 ) {
- newSnap.valid = qtrue; // uncompressed frame
- old = NULL;
- clc.demowaiting = qfalse; // we can start recording now
- } else {
- old = &cl.snapshots[newSnap.deltaNum & PACKET_MASK];
- if ( !old->valid ) {
- // should never happen
- Com_Printf ("Delta from invalid frame (not supposed to happen!).\n");
- } else if ( old->messageNum != newSnap.deltaNum ) {
- // The frame that the server did the delta from
- // is too old, so we can't reconstruct it properly.
- Com_Printf ("Delta frame too old.\n");
- } else if ( cl.parseEntitiesNum - old->parseEntitiesNum > MAX_PARSE_ENTITIES-128 ) {
- Com_Printf ("Delta parseEntitiesNum too old.\n");
- } else {
- newSnap.valid = qtrue; // valid delta parse
- }
- }
-
- // read areamask
- len = MSG_ReadByte( msg );
-
- if(len > sizeof(newSnap.areamask))
- {
- Com_Error (ERR_DROP,"CL_ParseSnapshot: Invalid size %d for areamask.", len);
- return;
- }
-
- MSG_ReadData( msg, &newSnap.areamask, len);
-
- // read playerinfo
- SHOWNET( msg, "playerstate" );
- if ( old ) {
- MSG_ReadDeltaPlayerstate( msg, &old->ps, &newSnap.ps );
- } else {
- MSG_ReadDeltaPlayerstate( msg, NULL, &newSnap.ps );
- }
-
- // read packet entities
- SHOWNET( msg, "packet entities" );
- CL_ParsePacketEntities( msg, old, &newSnap );
-
- // if not valid, dump the entire thing now that it has
- // been properly read
- if ( !newSnap.valid ) {
- return;
- }
-
- // clear the valid flags of any snapshots between the last
- // received and this one, so if there was a dropped packet
- // it won't look like something valid to delta from next
- // time we wrap around in the buffer
- oldMessageNum = cl.snap.messageNum + 1;
-
- if ( newSnap.messageNum - oldMessageNum >= PACKET_BACKUP ) {
- oldMessageNum = newSnap.messageNum - ( PACKET_BACKUP - 1 );
- }
- for ( ; oldMessageNum < newSnap.messageNum ; oldMessageNum++ ) {
- cl.snapshots[oldMessageNum & PACKET_MASK].valid = qfalse;
- }
-
- // copy to the current good spot
- cl.snap = newSnap;
- cl.snap.ping = 999;
- // calculate ping time
- for ( i = 0 ; i < PACKET_BACKUP ; i++ ) {
- packetNum = ( clc.netchan.outgoingSequence - 1 - i ) & PACKET_MASK;
- if ( cl.snap.ps.commandTime >= cl.outPackets[ packetNum ].p_serverTime ) {
- cl.snap.ping = cls.realtime - cl.outPackets[ packetNum ].p_realtime;
- break;
- }
- }
- // save the frame off in the backup array for later delta comparisons
- cl.snapshots[cl.snap.messageNum & PACKET_MASK] = cl.snap;
-
- if (cl_shownet->integer == 3) {
- Com_Printf( " snapshot:%i delta:%i ping:%i\n", cl.snap.messageNum,
- cl.snap.deltaNum, cl.snap.ping );
- }
-
- cl.newSnapshots = qtrue;
-}
-
-
-//=====================================================================
-
-int cl_connectedToPureServer;
-int cl_connectedToCheatServer;
-
-/*
-==================
-CL_SystemInfoChanged
-
-The systeminfo configstring has been changed, so parse
-new information out of it. This will happen at every
-gamestate, and possibly during gameplay.
-==================
-*/
-void CL_SystemInfoChanged( void ) {
- char *systemInfo;
- const char *s, *t;
- char key[BIG_INFO_KEY];
- char value[BIG_INFO_VALUE];
- qboolean gameSet;
-
- systemInfo = cl.gameState.stringData + cl.gameState.stringOffsets[ CS_SYSTEMINFO ];
- // NOTE TTimo:
- // when the serverId changes, any further messages we send to the server will use this new serverId
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=475
- // in some cases, outdated cp commands might get sent with this news serverId
- cl.serverId = atoi( Info_ValueForKey( systemInfo, "sv_serverid" ) );
-
- // don't set any vars when playing a demo
- if ( clc.demoplaying ) {
- return;
- }
-
- s = Info_ValueForKey( systemInfo, "sv_cheats" );
- cl_connectedToCheatServer = atoi( s );
- if ( !cl_connectedToCheatServer ) {
- Cvar_SetCheatState();
- }
-
- // check pure server string
- s = Info_ValueForKey( systemInfo, "sv_paks" );
- t = Info_ValueForKey( systemInfo, "sv_pakNames" );
- FS_PureServerSetLoadedPaks( s, t );
-
- s = Info_ValueForKey( systemInfo, "sv_referencedPaks" );
- t = Info_ValueForKey( systemInfo, "sv_referencedPakNames" );
- FS_PureServerSetReferencedPaks( s, t );
-
- gameSet = qfalse;
- // scan through all the variables in the systeminfo and locally set cvars to match
- s = systemInfo;
- while ( s ) {
- int cvar_flags;
-
- Info_NextPair( &s, key, value );
- if ( !key[0] ) {
- break;
- }
-
- // ehw!
- if (!Q_stricmp(key, "fs_game"))
- {
- if(FS_CheckDirTraversal(value))
- {
- Com_Printf(S_COLOR_YELLOW "WARNING: Server sent invalid fs_game value %s\n", value);
- continue;
- }
-
- gameSet = qtrue;
- }
-
- if((cvar_flags = Cvar_Flags(key)) == CVAR_NONEXISTENT)
- Cvar_Get(key, value, CVAR_SERVER_CREATED | CVAR_ROM);
- else
- {
- // If this cvar may not be modified by a server discard the value.
- if(!(cvar_flags & (CVAR_SYSTEMINFO | CVAR_SERVER_CREATED)))
- {
- Com_Printf(S_COLOR_YELLOW "WARNING: server is not allowed to set %s=%s\n", key, value);
- continue;
- }
-
- Cvar_Set(key, value);
- }
- }
- // if game folder should not be set and it is set at the client side
- if ( !gameSet && *Cvar_VariableString("fs_game") ) {
- Cvar_Set( "fs_game", "" );
- }
- cl_connectedToPureServer = Cvar_VariableValue( "sv_pure" );
-}
-
-/*
-==================
-CL_ParseServerInfo
-==================
-*/
-static void CL_ParseServerInfo(void)
-{
- const char *serverInfo;
-
- serverInfo = cl.gameState.stringData
- + cl.gameState.stringOffsets[ CS_SERVERINFO ];
-
- clc.sv_allowDownload = atoi(Info_ValueForKey(serverInfo,
- "sv_allowDownload"));
- Q_strncpyz(clc.sv_dlURL,
- Info_ValueForKey(serverInfo, "sv_dlURL"),
- sizeof(clc.sv_dlURL));
-}
-
-/*
-==================
-CL_ParseGamestate
-==================
-*/
-void CL_ParseGamestate( msg_t *msg ) {
- int i;
- entityState_t *es;
- int newnum;
- entityState_t nullstate;
- int cmd;
- char *s;
-
- Con_Close();
-
- clc.connectPacketCount = 0;
-
- // wipe local client state
- CL_ClearState();
-
- // a gamestate always marks a server command sequence
- clc.serverCommandSequence = MSG_ReadLong( msg );
-
- // parse all the configstrings and baselines
- cl.gameState.dataCount = 1; // leave a 0 at the beginning for uninitialized configstrings
- while ( 1 ) {
- cmd = MSG_ReadByte( msg );
-
- if ( cmd == svc_EOF ) {
- break;
- }
-
- if ( cmd == svc_configstring ) {
- int len;
-
- i = MSG_ReadShort( msg );
- if ( i < 0 || i >= MAX_CONFIGSTRINGS ) {
- Com_Error( ERR_DROP, "configstring > MAX_CONFIGSTRINGS" );
- }
- s = MSG_ReadBigString( msg );
- len = strlen( s );
-
- if ( len + 1 + cl.gameState.dataCount > MAX_GAMESTATE_CHARS ) {
- Com_Error( ERR_DROP, "MAX_GAMESTATE_CHARS exceeded" );
- }
-
- // append it to the gameState string buffer
- cl.gameState.stringOffsets[ i ] = cl.gameState.dataCount;
- Com_Memcpy( cl.gameState.stringData + cl.gameState.dataCount, s, len + 1 );
- cl.gameState.dataCount += len + 1;
- } else if ( cmd == svc_baseline ) {
- newnum = MSG_ReadBits( msg, GENTITYNUM_BITS );
- if ( newnum < 0 || newnum >= MAX_GENTITIES ) {
- Com_Error( ERR_DROP, "Baseline number out of range: %i", newnum );
- }
- Com_Memset (&nullstate, 0, sizeof(nullstate));
- es = &cl.entityBaselines[ newnum ];
- MSG_ReadDeltaEntity( msg, &nullstate, es, newnum );
- } else {
- Com_Error( ERR_DROP, "CL_ParseGamestate: bad command byte" );
- }
- }
-
- clc.clientNum = MSG_ReadLong(msg);
- // read the checksum feed
- clc.checksumFeed = MSG_ReadLong( msg );
-
- // parse useful values out of CS_SERVERINFO
- CL_ParseServerInfo();
-
- // parse serverId and other cvars
- CL_SystemInfoChanged();
-
- // stop recording now so the demo won't have an unnecessary level load at the end.
- if(cl_autoRecordDemo->integer && clc.demorecording)
- CL_StopRecord_f();
-
- // reinitialize the filesystem if the game directory has changed
- FS_ConditionalRestart( clc.checksumFeed );
-
- // This used to call CL_StartHunkUsers, but now we enter the download state before loading the
- // cgame
- CL_InitDownloads();
-
- // make sure the game starts
- Cvar_Set( "cl_paused", "0" );
-}
-
-
-//=====================================================================
-
-/*
-=====================
-CL_ParseDownload
-
-A download message has been received from the server
-=====================
-*/
-void CL_ParseDownload ( msg_t *msg ) {
- int size;
- unsigned char data[MAX_MSGLEN];
- int block;
-
- if (!*clc.downloadTempName) {
- Com_Printf("Server sending download, but no download was requested\n");
- CL_AddReliableCommand( "stopdl" );
- return;
- }
-
- // read the data
- block = MSG_ReadShort ( msg );
-
- if ( !block )
- {
- // block zero is special, contains file size
- clc.downloadSize = MSG_ReadLong ( msg );
-
- Cvar_SetValue( "cl_downloadSize", clc.downloadSize );
-
- if (clc.downloadSize < 0)
- {
- Com_Error(ERR_DROP, MSG_ReadString( msg ) );
- return;
- }
- }
-
- size = MSG_ReadShort ( msg );
- if (size < 0 || size > sizeof(data))
- {
- Com_Error(ERR_DROP, "CL_ParseDownload: Invalid size %d for download chunk.", size);
- return;
- }
-
- MSG_ReadData(msg, data, size);
-
- if (clc.downloadBlock != block) {
- Com_DPrintf( "CL_ParseDownload: Expected block %d, got %d\n", clc.downloadBlock, block);
- return;
- }
-
- // open the file if not opened yet
- if (!clc.download)
- {
- clc.download = FS_SV_FOpenFileWrite( clc.downloadTempName );
-
- if (!clc.download) {
- Com_Printf( "Could not create %s\n", clc.downloadTempName );
- CL_AddReliableCommand( "stopdl" );
- CL_NextDownload();
- return;
- }
- }
-
- if (size)
- FS_Write( data, size, clc.download );
-
- CL_AddReliableCommand( va("nextdl %d", clc.downloadBlock) );
- clc.downloadBlock++;
-
- clc.downloadCount += size;
-
- // So UI gets access to it
- Cvar_SetValue( "cl_downloadCount", clc.downloadCount );
-
- if (!size) { // A zero length block means EOF
- if (clc.download) {
- FS_FCloseFile( clc.download );
- clc.download = 0;
-
- // rename the file
- FS_SV_Rename ( clc.downloadTempName, clc.downloadName );
- }
- *clc.downloadTempName = *clc.downloadName = 0;
- Cvar_Set( "cl_downloadName", "" );
-
- // send intentions now
- // We need this because without it, we would hold the last nextdl and then start
- // loading right away. If we take a while to load, the server is happily trying
- // to send us that last block over and over.
- // Write it twice to help make sure we acknowledge the download
- CL_WritePacket();
- CL_WritePacket();
-
- // get another file if needed
- CL_NextDownload ();
- }
-}
-
-/*
-=====================
-CL_ParseCommandString
-
-Command strings are just saved off until cgame asks for them
-when it transitions a snapshot
-=====================
-*/
-void CL_ParseCommandString( msg_t *msg ) {
- char *s;
- int seq;
- int index;
-
- seq = MSG_ReadLong( msg );
- s = MSG_ReadString( msg );
-
- // see if we have already executed stored it off
- if ( clc.serverCommandSequence >= seq ) {
- return;
- }
- clc.serverCommandSequence = seq;
-
- index = seq & (MAX_RELIABLE_COMMANDS-1);
- Q_strncpyz( clc.serverCommands[ index ], s, sizeof( clc.serverCommands[ index ] ) );
-}
-
-
-/*
-=====================
-CL_ParseServerMessage
-=====================
-*/
-void CL_ParseServerMessage( msg_t *msg ) {
- int cmd;
-
- if ( cl_shownet->integer == 1 ) {
- Com_Printf ("%i ",msg->cursize);
- } else if ( cl_shownet->integer >= 2 ) {
- Com_Printf ("------------------\n");
- }
-
- MSG_Bitstream(msg);
-
- // get the reliable sequence acknowledge number
- clc.reliableAcknowledge = MSG_ReadLong( msg );
- //
- if ( clc.reliableAcknowledge < clc.reliableSequence - MAX_RELIABLE_COMMANDS ) {
- clc.reliableAcknowledge = clc.reliableSequence;
- }
-
- //
- // parse the message
- //
- while ( 1 ) {
- if ( msg->readcount > msg->cursize ) {
- Com_Error (ERR_DROP,"CL_ParseServerMessage: read past end of server message");
- break;
- }
-
- cmd = MSG_ReadByte( msg );
-
- if ( cmd == svc_EOF) {
- SHOWNET( msg, "END OF MESSAGE" );
- break;
- }
-
- if ( cl_shownet->integer >= 2 ) {
- if ( !svc_strings[cmd] ) {
- Com_Printf( "%3i:BAD CMD %i\n", msg->readcount-1, cmd );
- } else {
- SHOWNET( msg, svc_strings[cmd] );
- }
- }
-
- // other commands
- switch ( cmd ) {
- default:
- Com_Error (ERR_DROP,"CL_ParseServerMessage: Illegible server message\n");
- break;
- case svc_nop:
- break;
- case svc_serverCommand:
- CL_ParseCommandString( msg );
- break;
- case svc_gamestate:
- CL_ParseGamestate( msg );
- break;
- case svc_snapshot:
- CL_ParseSnapshot( msg );
- break;
- case svc_download:
- CL_ParseDownload( msg );
- break;
- }
- }
-}
-
-
diff --git a/src/client/cl_scrn.c b/src/client/cl_scrn.c
deleted file mode 100644
index 21f4b93..0000000
--- a/src/client/cl_scrn.c
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// cl_scrn.c -- master for refresh, status bar, console, chat, notify, etc
-
-#include "client.h"
-
-qboolean scr_initialized; // ready to draw
-
-cvar_t *cl_timegraph;
-cvar_t *cl_debuggraph;
-cvar_t *cl_graphheight;
-cvar_t *cl_graphscale;
-cvar_t *cl_graphshift;
-
-/*
-================
-SCR_DrawNamedPic
-
-Coordinates are 640*480 virtual values
-=================
-*/
-void SCR_DrawNamedPic( float x, float y, float width, float height, const char *picname ) {
- qhandle_t hShader;
-
- assert( width != 0 );
-
- hShader = re.RegisterShader( picname );
- SCR_AdjustFrom640( &x, &y, &width, &height );
- re.DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
-}
-
-
-/*
-================
-SCR_AdjustFrom640
-
-Adjusted for resolution and screen aspect ratio
-================
-*/
-void SCR_AdjustFrom640( float *x, float *y, float *w, float *h ) {
- float xscale;
- float yscale;
-
-#if 0
- // adjust for wide screens
- if ( cls.glconfig.vidWidth * 480 > cls.glconfig.vidHeight * 640 ) {
- *x += 0.5 * ( cls.glconfig.vidWidth - ( cls.glconfig.vidHeight * 640 / 480 ) );
- }
-#endif
-
- // scale for screen sizes
- xscale = cls.glconfig.vidWidth / 640.0;
- yscale = cls.glconfig.vidHeight / 480.0;
- if ( x ) {
- *x *= xscale;
- }
- if ( y ) {
- *y *= yscale;
- }
- if ( w ) {
- *w *= xscale;
- }
- if ( h ) {
- *h *= yscale;
- }
-}
-
-/*
-================
-SCR_FillRect
-
-Coordinates are 640*480 virtual values
-=================
-*/
-void SCR_FillRect( float x, float y, float width, float height, const float *color ) {
- re.SetColor( color );
-
- SCR_AdjustFrom640( &x, &y, &width, &height );
- re.DrawStretchPic( x, y, width, height, 0, 0, 0, 0, cls.whiteShader );
-
- re.SetColor( NULL );
-}
-
-
-/*
-================
-SCR_DrawPic
-
-Coordinates are 640*480 virtual values
-=================
-*/
-void SCR_DrawPic( float x, float y, float width, float height, qhandle_t hShader ) {
- SCR_AdjustFrom640( &x, &y, &width, &height );
- re.DrawStretchPic( x, y, width, height, 0, 0, 1, 1, hShader );
-}
-
-
-
-/*
-** SCR_DrawChar
-** chars are drawn at 640*480 virtual screen size
-*/
-static void SCR_DrawChar( int x, int y, float size, int ch ) {
- int row, col;
- float frow, fcol;
- float ax, ay, aw, ah;
-
- ch &= 255;
-
- if ( ch == ' ' ) {
- return;
- }
-
- if ( y < -size ) {
- return;
- }
-
- ax = x;
- ay = y;
- aw = size;
- ah = size;
- SCR_AdjustFrom640( &ax, &ay, &aw, &ah );
-
- row = ch>>4;
- col = ch&15;
-
- frow = row*0.0625;
- fcol = col*0.0625;
- size = 0.0625;
-
- re.DrawStretchPic( ax, ay, aw, ah,
- fcol, frow,
- fcol + size, frow + size,
- cls.charSetShader );
-}
-
-/*
-** SCR_DrawSmallChar
-** small chars are drawn at native screen resolution
-*/
-void SCR_DrawSmallChar( int x, int y, int ch ) {
- int row, col;
- float frow, fcol;
- float size;
-
- ch &= 255;
-
- if ( ch == ' ' ) {
- return;
- }
-
- if ( y < -SMALLCHAR_HEIGHT ) {
- return;
- }
-
- row = ch>>4;
- col = ch&15;
-
- frow = row*0.0625;
- fcol = col*0.0625;
- size = 0.0625;
-
- re.DrawStretchPic( x, y, SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT,
- fcol, frow,
- fcol + size, frow + size,
- cls.charSetShader );
-}
-
-
-/*
-==================
-SCR_DrawBigString[Color]
-
-Draws a multi-colored string with a drop shadow, optionally forcing
-to a fixed color.
-
-Coordinates are at 640 by 480 virtual resolution
-==================
-*/
-void SCR_DrawStringExt( int x, int y, float size, const char *string, float *setColor, qboolean forceColor ) {
- vec4_t color;
- const char *s;
- int xx;
-
- // draw the drop shadow
- color[0] = color[1] = color[2] = 0;
- color[3] = setColor[3];
- re.SetColor( color );
- s = string;
- xx = x;
- while ( *s ) {
- if ( Q_IsColorString( s ) ) {
- s += 2;
- continue;
- }
- SCR_DrawChar( xx+2, y+2, size, *s );
- xx += size;
- s++;
- }
-
-
- // draw the colored text
- s = string;
- xx = x;
- re.SetColor( setColor );
- while ( *s ) {
- if ( Q_IsColorString( s ) ) {
- if ( !forceColor ) {
- Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) );
- color[3] = setColor[3];
- re.SetColor( color );
- }
- s += 2;
- continue;
- }
- SCR_DrawChar( xx, y, size, *s );
- xx += size;
- s++;
- }
- re.SetColor( NULL );
-}
-
-
-void SCR_DrawBigString( int x, int y, const char *s, float alpha ) {
- float color[4];
-
- color[0] = color[1] = color[2] = 1.0;
- color[3] = alpha;
- SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qfalse );
-}
-
-void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color ) {
- SCR_DrawStringExt( x, y, BIGCHAR_WIDTH, s, color, qtrue );
-}
-
-
-/*
-==================
-SCR_DrawSmallString[Color]
-
-Draws a multi-colored string with a drop shadow, optionally forcing
-to a fixed color.
-
-Coordinates are at 640 by 480 virtual resolution
-==================
-*/
-void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor ) {
- vec4_t color;
- const char *s;
- int xx;
-
- // draw the colored text
- s = string;
- xx = x;
- re.SetColor( setColor );
- while ( *s ) {
- if ( Q_IsColorString( s ) ) {
- if ( !forceColor ) {
- Com_Memcpy( color, g_color_table[ColorIndex(*(s+1))], sizeof( color ) );
- color[3] = setColor[3];
- re.SetColor( color );
- }
- s += 2;
- continue;
- }
- SCR_DrawSmallChar( xx, y, *s );
- xx += SMALLCHAR_WIDTH;
- s++;
- }
- re.SetColor( NULL );
-}
-
-
-
-/*
-** SCR_Strlen -- skips color escape codes
-*/
-static int SCR_Strlen( const char *str ) {
- const char *s = str;
- int count = 0;
-
- while ( *s ) {
- if ( Q_IsColorString( s ) ) {
- s += 2;
- } else {
- count++;
- s++;
- }
- }
-
- return count;
-}
-
-/*
-** SCR_GetBigStringWidth
-*/
-int SCR_GetBigStringWidth( const char *str ) {
- return SCR_Strlen( str ) * 16;
-}
-
-
-//===============================================================================
-
-/*
-===============================================================================
-
-DEBUG GRAPH
-
-===============================================================================
-*/
-
-typedef struct
-{
- float value;
- int color;
-} graphsamp_t;
-
-static int current;
-static graphsamp_t values[1024];
-
-/*
-==============
-SCR_DebugGraph
-==============
-*/
-void SCR_DebugGraph (float value, int color)
-{
- values[current&1023].value = value;
- values[current&1023].color = color;
- current++;
-}
-
-/*
-==============
-SCR_DrawDebugGraph
-==============
-*/
-void SCR_DrawDebugGraph (void)
-{
- int a, x, y, w, i, h;
- float v;
- int color;
-
- //
- // draw the graph
- //
- w = cls.glconfig.vidWidth;
- x = 0;
- y = cls.glconfig.vidHeight;
- re.SetColor( g_color_table[0] );
- re.DrawStretchPic(x, y - cl_graphheight->integer,
- w, cl_graphheight->integer, 0, 0, 0, 0, cls.whiteShader );
- re.SetColor( NULL );
-
- for (a=0 ; ainteger + cl_graphshift->integer;
-
- if (v < 0)
- v += cl_graphheight->integer * (1+(int)(-v / cl_graphheight->integer));
- h = (int)v % cl_graphheight->integer;
- re.DrawStretchPic( x+w-1-a, y - h, 1, h, 0, 0, 0, 0, cls.whiteShader );
- }
-}
-
-//=============================================================================
-
-/*
-==================
-SCR_Init
-==================
-*/
-void SCR_Init( void ) {
- cl_timegraph = Cvar_Get ("timegraph", "0", CVAR_CHEAT);
- cl_debuggraph = Cvar_Get ("debuggraph", "0", CVAR_CHEAT);
- cl_graphheight = Cvar_Get ("graphheight", "32", CVAR_CHEAT);
- cl_graphscale = Cvar_Get ("graphscale", "1", CVAR_CHEAT);
- cl_graphshift = Cvar_Get ("graphshift", "0", CVAR_CHEAT);
-
- scr_initialized = qtrue;
-}
-
-
-//=======================================================
-
-/*
-==================
-SCR_DrawScreenField
-
-This will be called twice if rendering in stereo mode
-==================
-*/
-void SCR_DrawScreenField( stereoFrame_t stereoFrame ) {
- re.BeginFrame( stereoFrame );
-
- // wide aspect ratio screens need to have the sides cleared
- // unless they are displaying game renderings
- if ( cls.state != CA_ACTIVE && cls.state != CA_CINEMATIC ) {
- if ( cls.glconfig.vidWidth * 480 > cls.glconfig.vidHeight * 640 ) {
- re.SetColor( g_color_table[0] );
- re.DrawStretchPic( 0, 0, cls.glconfig.vidWidth, cls.glconfig.vidHeight, 0, 0, 0, 0, cls.whiteShader );
- re.SetColor( NULL );
- }
- }
-
- if ( !uivm ) {
- Com_DPrintf("draw screen without UI loaded\n");
- return;
- }
-
- // if the menu is going to cover the entire screen, we
- // don't need to render anything under it
- if ( !VM_Call( uivm, UI_IS_FULLSCREEN )) {
- switch( cls.state ) {
- default:
- Com_Error( ERR_FATAL, "SCR_DrawScreenField: bad cls.state" );
- break;
- case CA_CINEMATIC:
- SCR_DrawCinematic();
- break;
- case CA_DISCONNECTED:
- // force menu up
- S_StopAllSounds();
- VM_Call( uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN );
- break;
- case CA_CONNECTING:
- case CA_CHALLENGING:
- case CA_CONNECTED:
- // connecting clients will only show the connection dialog
- // refresh to update the time
- VM_Call( uivm, UI_REFRESH, cls.realtime );
- VM_Call( uivm, UI_DRAW_CONNECT_SCREEN, qfalse );
- break;
- case CA_LOADING:
- case CA_PRIMED:
- // draw the game information screen and loading progress
- CL_CGameRendering( stereoFrame );
-
- // also draw the connection information, so it doesn't
- // flash away too briefly on local or lan games
- // refresh to update the time
- VM_Call( uivm, UI_REFRESH, cls.realtime );
- VM_Call( uivm, UI_DRAW_CONNECT_SCREEN, qtrue );
- break;
- case CA_ACTIVE:
- CL_CGameRendering( stereoFrame );
- break;
- }
- }
-
- // the menu draws next
- if ( cls.keyCatchers & KEYCATCH_UI && uivm ) {
- VM_Call( uivm, UI_REFRESH, cls.realtime );
- }
-
- // console draws next
- Con_DrawConsole ();
-
- // debug graph can be drawn on top of anything
- if ( cl_debuggraph->integer || cl_timegraph->integer || cl_debugMove->integer ) {
- SCR_DrawDebugGraph ();
- }
-}
-
-/*
-==================
-SCR_UpdateScreen
-
-This is called every frame, and can also be called explicitly to flush
-text to the screen.
-==================
-*/
-void SCR_UpdateScreen( void ) {
- static int recursive;
-
- if ( !scr_initialized ) {
- return; // not initialized yet
- }
-
- if ( ++recursive > 2 ) {
- Com_Error( ERR_FATAL, "SCR_UpdateScreen: recursively called" );
- }
- recursive = 1;
-
- // if running in stereo, we need to draw the frame twice
- if ( cls.glconfig.stereoEnabled ) {
- SCR_DrawScreenField( STEREO_LEFT );
- SCR_DrawScreenField( STEREO_RIGHT );
- } else {
- SCR_DrawScreenField( STEREO_CENTER );
- }
-
- if ( com_speeds->integer ) {
- re.EndFrame( &time_frontend, &time_backend );
- } else {
- re.EndFrame( NULL, NULL );
- }
-
- recursive = 0;
-}
-
diff --git a/src/client/cl_ui.c b/src/client/cl_ui.c
deleted file mode 100644
index 6a4bb16..0000000
--- a/src/client/cl_ui.c
+++ /dev/null
@@ -1,1102 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "client.h"
-
-vm_t *uivm;
-
-/*
-====================
-GetClientState
-====================
-*/
-static void GetClientState( uiClientState_t *state ) {
- state->connectPacketCount = clc.connectPacketCount;
- state->connState = cls.state;
- Q_strncpyz( state->servername, cls.servername, sizeof( state->servername ) );
- Q_strncpyz( state->updateInfoString, cls.updateInfoString, sizeof( state->updateInfoString ) );
- Q_strncpyz( state->messageString, clc.serverMessage, sizeof( state->messageString ) );
- state->clientNum = cl.snap.ps.clientNum;
-}
-
-/*
-====================
-LAN_LoadCachedServers
-====================
-*/
-void LAN_LoadCachedServers( void ) {
- int size;
- fileHandle_t fileIn;
- cls.numglobalservers = cls.nummplayerservers = cls.numfavoriteservers = 0;
- cls.numGlobalServerAddresses = 0;
- if (FS_SV_FOpenFileRead("servercache.dat", &fileIn)) {
- FS_Read(&cls.numglobalservers, sizeof(int), fileIn);
- FS_Read(&cls.nummplayerservers, sizeof(int), fileIn);
- FS_Read(&cls.numfavoriteservers, sizeof(int), fileIn);
- FS_Read(&size, sizeof(int), fileIn);
- if (size == sizeof(cls.globalServers) + sizeof(cls.favoriteServers) + sizeof(cls.mplayerServers)) {
- FS_Read(&cls.globalServers, sizeof(cls.globalServers), fileIn);
- FS_Read(&cls.mplayerServers, sizeof(cls.mplayerServers), fileIn);
- FS_Read(&cls.favoriteServers, sizeof(cls.favoriteServers), fileIn);
- } else {
- cls.numglobalservers = cls.nummplayerservers = cls.numfavoriteservers = 0;
- cls.numGlobalServerAddresses = 0;
- }
- FS_FCloseFile(fileIn);
- }
-}
-
-/*
-====================
-LAN_SaveServersToCache
-====================
-*/
-void LAN_SaveServersToCache( void ) {
- int size;
- fileHandle_t fileOut = FS_SV_FOpenFileWrite("servercache.dat");
- FS_Write(&cls.numglobalservers, sizeof(int), fileOut);
- FS_Write(&cls.nummplayerservers, sizeof(int), fileOut);
- FS_Write(&cls.numfavoriteservers, sizeof(int), fileOut);
- size = sizeof(cls.globalServers) + sizeof(cls.favoriteServers) + sizeof(cls.mplayerServers);
- FS_Write(&size, sizeof(int), fileOut);
- FS_Write(&cls.globalServers, sizeof(cls.globalServers), fileOut);
- FS_Write(&cls.mplayerServers, sizeof(cls.mplayerServers), fileOut);
- FS_Write(&cls.favoriteServers, sizeof(cls.favoriteServers), fileOut);
- FS_FCloseFile(fileOut);
-}
-
-
-/*
-====================
-LAN_ResetPings
-====================
-*/
-static void LAN_ResetPings(int source) {
- int count,i;
- serverInfo_t *servers = NULL;
- count = 0;
-
- switch (source) {
- case AS_LOCAL :
- servers = &cls.localServers[0];
- count = MAX_OTHER_SERVERS;
- break;
- case AS_MPLAYER :
- servers = &cls.mplayerServers[0];
- count = MAX_OTHER_SERVERS;
- break;
- case AS_GLOBAL :
- servers = &cls.globalServers[0];
- count = MAX_GLOBAL_SERVERS;
- break;
- case AS_FAVORITES :
- servers = &cls.favoriteServers[0];
- count = MAX_OTHER_SERVERS;
- break;
- }
- if (servers) {
- for (i = 0; i < count; i++) {
- servers[i].ping = -1;
- }
- }
-}
-
-/*
-====================
-LAN_AddServer
-====================
-*/
-static int LAN_AddServer(int source, const char *name, const char *address) {
- int max, *count, i;
- netadr_t adr;
- serverInfo_t *servers = NULL;
- max = MAX_OTHER_SERVERS;
- count = NULL;
-
- switch (source) {
- case AS_LOCAL :
- count = &cls.numlocalservers;
- servers = &cls.localServers[0];
- break;
- case AS_MPLAYER :
- count = &cls.nummplayerservers;
- servers = &cls.mplayerServers[0];
- break;
- case AS_GLOBAL :
- max = MAX_GLOBAL_SERVERS;
- count = &cls.numglobalservers;
- servers = &cls.globalServers[0];
- break;
- case AS_FAVORITES :
- count = &cls.numfavoriteservers;
- servers = &cls.favoriteServers[0];
- break;
- }
- if (servers && *count < max) {
- NET_StringToAdr( address, &adr );
- for ( i = 0; i < *count; i++ ) {
- if (NET_CompareAdr(servers[i].adr, adr)) {
- break;
- }
- }
- if (i >= *count) {
- servers[*count].adr = adr;
- Q_strncpyz(servers[*count].hostName, name, sizeof(servers[*count].hostName));
- servers[*count].visible = qtrue;
- (*count)++;
- return 1;
- }
- return 0;
- }
- return -1;
-}
-
-/*
-====================
-LAN_RemoveServer
-====================
-*/
-static void LAN_RemoveServer(int source, const char *addr) {
- int *count, i;
- serverInfo_t *servers = NULL;
- count = NULL;
- switch (source) {
- case AS_LOCAL :
- count = &cls.numlocalservers;
- servers = &cls.localServers[0];
- break;
- case AS_MPLAYER :
- count = &cls.nummplayerservers;
- servers = &cls.mplayerServers[0];
- break;
- case AS_GLOBAL :
- count = &cls.numglobalservers;
- servers = &cls.globalServers[0];
- break;
- case AS_FAVORITES :
- count = &cls.numfavoriteservers;
- servers = &cls.favoriteServers[0];
- break;
- }
- if (servers) {
- netadr_t comp;
- NET_StringToAdr( addr, &comp );
- for (i = 0; i < *count; i++) {
- if (NET_CompareAdr( comp, servers[i].adr)) {
- int j = i;
- while (j < *count - 1) {
- Com_Memcpy(&servers[j], &servers[j+1], sizeof(servers[j]));
- j++;
- }
- (*count)--;
- break;
- }
- }
- }
-}
-
-
-/*
-====================
-LAN_GetServerCount
-====================
-*/
-static int LAN_GetServerCount( int source ) {
- switch (source) {
- case AS_LOCAL :
- return cls.numlocalservers;
- break;
- case AS_MPLAYER :
- return cls.nummplayerservers;
- break;
- case AS_GLOBAL :
- return cls.numglobalservers;
- break;
- case AS_FAVORITES :
- return cls.numfavoriteservers;
- break;
- }
- return 0;
-}
-
-/*
-====================
-LAN_GetLocalServerAddressString
-====================
-*/
-static void LAN_GetServerAddressString( int source, int n, char *buf, int buflen ) {
- switch (source) {
- case AS_LOCAL :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- Q_strncpyz(buf, NET_AdrToString( cls.localServers[n].adr) , buflen );
- return;
- }
- break;
- case AS_MPLAYER :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- Q_strncpyz(buf, NET_AdrToString( cls.mplayerServers[n].adr) , buflen );
- return;
- }
- break;
- case AS_GLOBAL :
- if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
- Q_strncpyz(buf, NET_AdrToString( cls.globalServers[n].adr) , buflen );
- return;
- }
- break;
- case AS_FAVORITES :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- Q_strncpyz(buf, NET_AdrToString( cls.favoriteServers[n].adr) , buflen );
- return;
- }
- break;
- }
- buf[0] = '\0';
-}
-
-/*
-====================
-LAN_GetServerInfo
-====================
-*/
-static void LAN_GetServerInfo( int source, int n, char *buf, int buflen ) {
- char info[MAX_STRING_CHARS];
- serverInfo_t *server = NULL;
- info[0] = '\0';
- switch (source) {
- case AS_LOCAL :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- server = &cls.localServers[n];
- }
- break;
- case AS_MPLAYER :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- server = &cls.mplayerServers[n];
- }
- break;
- case AS_GLOBAL :
- if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
- server = &cls.globalServers[n];
- }
- break;
- case AS_FAVORITES :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- server = &cls.favoriteServers[n];
- }
- break;
- }
- if (server && buf) {
- buf[0] = '\0';
- Info_SetValueForKey( info, "hostname", server->hostName);
- Info_SetValueForKey( info, "mapname", server->mapName);
- Info_SetValueForKey( info, "clients", va("%i",server->clients));
- Info_SetValueForKey( info, "sv_maxclients", va("%i",server->maxClients));
- Info_SetValueForKey( info, "ping", va("%i",server->ping));
- Info_SetValueForKey( info, "minping", va("%i",server->minPing));
- Info_SetValueForKey( info, "maxping", va("%i",server->maxPing));
- Info_SetValueForKey( info, "game", server->game);
- Info_SetValueForKey( info, "gametype", va("%i",server->gameType));
- Info_SetValueForKey( info, "nettype", va("%i",server->netType));
- Info_SetValueForKey( info, "addr", NET_AdrToString(server->adr));
- Q_strncpyz(buf, info, buflen);
- } else {
- if (buf) {
- buf[0] = '\0';
- }
- }
-}
-
-/*
-====================
-LAN_GetServerPing
-====================
-*/
-static int LAN_GetServerPing( int source, int n ) {
- serverInfo_t *server = NULL;
- switch (source) {
- case AS_LOCAL :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- server = &cls.localServers[n];
- }
- break;
- case AS_MPLAYER :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- server = &cls.mplayerServers[n];
- }
- break;
- case AS_GLOBAL :
- if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
- server = &cls.globalServers[n];
- }
- break;
- case AS_FAVORITES :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- server = &cls.favoriteServers[n];
- }
- break;
- }
- if (server) {
- return server->ping;
- }
- return -1;
-}
-
-/*
-====================
-LAN_GetServerPtr
-====================
-*/
-static serverInfo_t *LAN_GetServerPtr( int source, int n ) {
- switch (source) {
- case AS_LOCAL :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- return &cls.localServers[n];
- }
- break;
- case AS_MPLAYER :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- return &cls.mplayerServers[n];
- }
- break;
- case AS_GLOBAL :
- if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
- return &cls.globalServers[n];
- }
- break;
- case AS_FAVORITES :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- return &cls.favoriteServers[n];
- }
- break;
- }
- return NULL;
-}
-
-/*
-====================
-LAN_CompareServers
-====================
-*/
-static int LAN_CompareServers( int source, int sortKey, int sortDir, int s1, int s2 ) {
- int res;
- serverInfo_t *server1, *server2;
-
- server1 = LAN_GetServerPtr(source, s1);
- server2 = LAN_GetServerPtr(source, s2);
- if (!server1 || !server2) {
- return 0;
- }
-
- res = 0;
- switch( sortKey ) {
- case SORT_HOST:
- {
- char hostName1[ MAX_HOSTNAME_LENGTH ];
- char hostName2[ MAX_HOSTNAME_LENGTH ];
- char *p;
- int i;
-
- for( p = server1->hostName, i = 0; *p != '\0'; p++ )
- {
- if( Q_isalpha( *p ) )
- hostName1[ i++ ] = *p;
- }
- hostName1[ i ] = '\0';
-
- for( p = server2->hostName, i = 0; *p != '\0'; p++ )
- {
- if( Q_isalpha( *p ) )
- hostName2[ i++ ] = *p;
- }
- hostName2[ i ] = '\0';
-
- res = Q_stricmp( hostName1, hostName2 );
- }
- break;
-
- case SORT_MAP:
- res = Q_stricmp( server1->mapName, server2->mapName );
- break;
- case SORT_CLIENTS:
- if (server1->clients < server2->clients) {
- res = -1;
- }
- else if (server1->clients > server2->clients) {
- res = 1;
- }
- else {
- res = 0;
- }
- break;
- case SORT_PING:
- if (server1->ping < server2->ping) {
- res = -1;
- }
- else if (server1->ping > server2->ping) {
- res = 1;
- }
- else {
- res = 0;
- }
- break;
- }
-
- if (sortDir) {
- if (res < 0)
- return 1;
- if (res > 0)
- return -1;
- return 0;
- }
- return res;
-}
-
-/*
-====================
-LAN_GetPingQueueCount
-====================
-*/
-static int LAN_GetPingQueueCount( void ) {
- return (CL_GetPingQueueCount());
-}
-
-/*
-====================
-LAN_ClearPing
-====================
-*/
-static void LAN_ClearPing( int n ) {
- CL_ClearPing( n );
-}
-
-/*
-====================
-LAN_GetPing
-====================
-*/
-static void LAN_GetPing( int n, char *buf, int buflen, int *pingtime ) {
- CL_GetPing( n, buf, buflen, pingtime );
-}
-
-/*
-====================
-LAN_GetPingInfo
-====================
-*/
-static void LAN_GetPingInfo( int n, char *buf, int buflen ) {
- CL_GetPingInfo( n, buf, buflen );
-}
-
-/*
-====================
-LAN_MarkServerVisible
-====================
-*/
-static void LAN_MarkServerVisible(int source, int n, qboolean visible ) {
- if (n == -1) {
- int count = MAX_OTHER_SERVERS;
- serverInfo_t *server = NULL;
- switch (source) {
- case AS_LOCAL :
- server = &cls.localServers[0];
- break;
- case AS_MPLAYER :
- server = &cls.mplayerServers[0];
- break;
- case AS_GLOBAL :
- server = &cls.globalServers[0];
- count = MAX_GLOBAL_SERVERS;
- break;
- case AS_FAVORITES :
- server = &cls.favoriteServers[0];
- break;
- }
- if (server) {
- for (n = 0; n < count; n++) {
- server[n].visible = visible;
- }
- }
-
- } else {
- switch (source) {
- case AS_LOCAL :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- cls.localServers[n].visible = visible;
- }
- break;
- case AS_MPLAYER :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- cls.mplayerServers[n].visible = visible;
- }
- break;
- case AS_GLOBAL :
- if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
- cls.globalServers[n].visible = visible;
- }
- break;
- case AS_FAVORITES :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- cls.favoriteServers[n].visible = visible;
- }
- break;
- }
- }
-}
-
-
-/*
-=======================
-LAN_ServerIsVisible
-=======================
-*/
-static int LAN_ServerIsVisible(int source, int n ) {
- switch (source) {
- case AS_LOCAL :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- return cls.localServers[n].visible;
- }
- break;
- case AS_MPLAYER :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- return cls.mplayerServers[n].visible;
- }
- break;
- case AS_GLOBAL :
- if (n >= 0 && n < MAX_GLOBAL_SERVERS) {
- return cls.globalServers[n].visible;
- }
- break;
- case AS_FAVORITES :
- if (n >= 0 && n < MAX_OTHER_SERVERS) {
- return cls.favoriteServers[n].visible;
- }
- break;
- }
- return qfalse;
-}
-
-/*
-=======================
-LAN_UpdateVisiblePings
-=======================
-*/
-qboolean LAN_UpdateVisiblePings(int source ) {
- return CL_UpdateVisiblePings_f(source);
-}
-
-/*
-====================
-LAN_GetServerStatus
-====================
-*/
-int LAN_GetServerStatus( char *serverAddress, char *serverStatus, int maxLen ) {
- return CL_ServerStatus( serverAddress, serverStatus, maxLen );
-}
-
-/*
-====================
-CL_GetGlConfig
-====================
-*/
-static void CL_GetGlconfig( glconfig_t *config ) {
- *config = cls.glconfig;
-}
-
-/*
-====================
-CL_GetClipboardData
-====================
-*/
-static void CL_GetClipboardData( char *buf, int buflen ) {
- char *cbd;
-
- cbd = Sys_GetClipboardData();
-
- if ( !cbd ) {
- *buf = 0;
- return;
- }
-
- Q_strncpyz( buf, cbd, buflen );
-
- Z_Free( cbd );
-}
-
-/*
-====================
-GetConfigString
-====================
-*/
-static int GetConfigString(int index, char *buf, int size)
-{
- int offset;
-
- if (index < 0 || index >= MAX_CONFIGSTRINGS)
- return qfalse;
-
- offset = cl.gameState.stringOffsets[index];
- if (!offset) {
- if( size ) {
- buf[0] = 0;
- }
- return qfalse;
- }
-
- Q_strncpyz( buf, cl.gameState.stringData+offset, size);
-
- return qtrue;
-}
-
-/*
-====================
-FloatAsInt
-====================
-*/
-static int FloatAsInt( float f ) {
- int temp;
-
- *(float *)&temp = f;
-
- return temp;
-}
-
-/*
-====================
-CL_UISystemCalls
-
-The ui module is making a system call
-====================
-*/
-intptr_t CL_UISystemCalls( intptr_t *args ) {
- switch( args[0] ) {
- case UI_ERROR:
- Com_Error( ERR_DROP, "%s", (const char*)VMA(1) );
- return 0;
-
- case UI_PRINT:
- Com_Printf( "%s", (const char*)VMA(1) );
- return 0;
-
- case UI_MILLISECONDS:
- return Sys_Milliseconds();
-
- case UI_CVAR_REGISTER:
- Cvar_Register( VMA(1), VMA(2), VMA(3), args[4] );
- return 0;
-
- case UI_CVAR_UPDATE:
- Cvar_Update( VMA(1) );
- return 0;
-
- case UI_CVAR_SET:
- Cvar_Set( VMA(1), VMA(2) );
- return 0;
-
- case UI_CVAR_VARIABLEVALUE:
- return FloatAsInt( Cvar_VariableValue( VMA(1) ) );
-
- case UI_CVAR_VARIABLESTRINGBUFFER:
- Cvar_VariableStringBuffer( VMA(1), VMA(2), args[3] );
- return 0;
-
- case UI_CVAR_SETVALUE:
- Cvar_SetValue( VMA(1), VMF(2) );
- return 0;
-
- case UI_CVAR_RESET:
- Cvar_Reset( VMA(1) );
- return 0;
-
- case UI_CVAR_CREATE:
- Cvar_Get( VMA(1), VMA(2), args[3] );
- return 0;
-
- case UI_CVAR_INFOSTRINGBUFFER:
- Cvar_InfoStringBuffer( args[1], VMA(2), args[3] );
- return 0;
-
- case UI_ARGC:
- return Cmd_Argc();
-
- case UI_ARGV:
- Cmd_ArgvBuffer( args[1], VMA(2), args[3] );
- return 0;
-
- case UI_CMD_EXECUTETEXT:
- Cbuf_ExecuteText( args[1], VMA(2) );
- return 0;
-
- case UI_FS_FOPENFILE:
- return FS_FOpenFileByMode( VMA(1), VMA(2), args[3] );
-
- case UI_FS_READ:
- FS_Read2( VMA(1), args[2], args[3] );
- return 0;
-
- case UI_FS_WRITE:
- FS_Write( VMA(1), args[2], args[3] );
- return 0;
-
- case UI_FS_FCLOSEFILE:
- FS_FCloseFile( args[1] );
- return 0;
-
- case UI_FS_GETFILELIST:
- return FS_GetFileList( VMA(1), VMA(2), VMA(3), args[4] );
-
- case UI_FS_SEEK:
- return FS_Seek( args[1], args[2], args[3] );
-
- case UI_R_REGISTERMODEL:
- return re.RegisterModel( VMA(1) );
-
- case UI_R_REGISTERSKIN:
- return re.RegisterSkin( VMA(1) );
-
- case UI_R_REGISTERSHADERNOMIP:
- return re.RegisterShaderNoMip( VMA(1) );
-
- case UI_R_CLEARSCENE:
- re.ClearScene();
- return 0;
-
- case UI_R_ADDREFENTITYTOSCENE:
- re.AddRefEntityToScene( VMA(1) );
- return 0;
-
- case UI_R_ADDPOLYTOSCENE:
- re.AddPolyToScene( args[1], args[2], VMA(3), 1 );
- return 0;
-
- case UI_R_ADDLIGHTTOSCENE:
- re.AddLightToScene( VMA(1), VMF(2), VMF(3), VMF(4), VMF(5) );
- return 0;
-
- case UI_R_RENDERSCENE:
- re.RenderScene( VMA(1) );
- return 0;
-
- case UI_R_SETCOLOR:
- re.SetColor( VMA(1) );
- return 0;
-
- case UI_R_DRAWSTRETCHPIC:
- re.DrawStretchPic( VMF(1), VMF(2), VMF(3), VMF(4), VMF(5), VMF(6), VMF(7), VMF(8), args[9] );
- return 0;
-
- case UI_R_MODELBOUNDS:
- re.ModelBounds( args[1], VMA(2), VMA(3) );
- return 0;
-
- case UI_UPDATESCREEN:
- SCR_UpdateScreen();
- return 0;
-
- case UI_CM_LERPTAG:
- re.LerpTag( VMA(1), args[2], args[3], args[4], VMF(5), VMA(6) );
- return 0;
-
- case UI_S_REGISTERSOUND:
- return S_RegisterSound( VMA(1), args[2] );
-
- case UI_S_STARTLOCALSOUND:
- S_StartLocalSound( args[1], args[2] );
- return 0;
-
- case UI_KEY_KEYNUMTOSTRINGBUF:
- Key_KeynumToStringBuf( args[1], VMA(2), args[3] );
- return 0;
-
- case UI_KEY_GETBINDINGBUF:
- Key_GetBindingBuf( args[1], VMA(2), args[3] );
- return 0;
-
- case UI_KEY_SETBINDING:
- Key_SetBinding( args[1], VMA(2) );
- return 0;
-
- case UI_KEY_ISDOWN:
- return Key_IsDown( args[1] );
-
- case UI_KEY_GETOVERSTRIKEMODE:
- return Key_GetOverstrikeMode();
-
- case UI_KEY_SETOVERSTRIKEMODE:
- Key_SetOverstrikeMode( args[1] );
- return 0;
-
- case UI_KEY_CLEARSTATES:
- Key_ClearStates();
- return 0;
-
- case UI_KEY_GETCATCHER:
- return Key_GetCatcher();
-
- case UI_KEY_SETCATCHER:
- Key_SetCatcher( args[1] );
- return 0;
-
- case UI_GETCLIPBOARDDATA:
- CL_GetClipboardData( VMA(1), args[2] );
- return 0;
-
- case UI_GETCLIENTSTATE:
- GetClientState( VMA(1) );
- return 0;
-
- case UI_GETGLCONFIG:
- CL_GetGlconfig( VMA(1) );
- return 0;
-
- case UI_GETCONFIGSTRING:
- return GetConfigString( args[1], VMA(2), args[3] );
-
- case UI_LAN_LOADCACHEDSERVERS:
- LAN_LoadCachedServers();
- return 0;
-
- case UI_LAN_SAVECACHEDSERVERS:
- LAN_SaveServersToCache();
- return 0;
-
- case UI_LAN_ADDSERVER:
- return LAN_AddServer(args[1], VMA(2), VMA(3));
-
- case UI_LAN_REMOVESERVER:
- LAN_RemoveServer(args[1], VMA(2));
- return 0;
-
- case UI_LAN_GETPINGQUEUECOUNT:
- return LAN_GetPingQueueCount();
-
- case UI_LAN_CLEARPING:
- LAN_ClearPing( args[1] );
- return 0;
-
- case UI_LAN_GETPING:
- LAN_GetPing( args[1], VMA(2), args[3], VMA(4) );
- return 0;
-
- case UI_LAN_GETPINGINFO:
- LAN_GetPingInfo( args[1], VMA(2), args[3] );
- return 0;
-
- case UI_LAN_GETSERVERCOUNT:
- return LAN_GetServerCount(args[1]);
-
- case UI_LAN_GETSERVERADDRESSSTRING:
- LAN_GetServerAddressString( args[1], args[2], VMA(3), args[4] );
- return 0;
-
- case UI_LAN_GETSERVERINFO:
- LAN_GetServerInfo( args[1], args[2], VMA(3), args[4] );
- return 0;
-
- case UI_LAN_GETSERVERPING:
- return LAN_GetServerPing( args[1], args[2] );
-
- case UI_LAN_MARKSERVERVISIBLE:
- LAN_MarkServerVisible( args[1], args[2], args[3] );
- return 0;
-
- case UI_LAN_SERVERISVISIBLE:
- return LAN_ServerIsVisible( args[1], args[2] );
-
- case UI_LAN_UPDATEVISIBLEPINGS:
- return LAN_UpdateVisiblePings( args[1] );
-
- case UI_LAN_RESETPINGS:
- LAN_ResetPings( args[1] );
- return 0;
-
- case UI_LAN_SERVERSTATUS:
- return LAN_GetServerStatus( VMA(1), VMA(2), args[3] );
-
- case UI_LAN_COMPARESERVERS:
- return LAN_CompareServers( args[1], args[2], args[3], args[4], args[5] );
-
- case UI_MEMORY_REMAINING:
- return Hunk_MemoryRemaining();
-
- case UI_SET_PBCLSTATUS:
- return 0;
-
- case UI_R_REGISTERFONT:
- re.RegisterFont( VMA(1), args[2], VMA(3));
- return 0;
-
- case UI_MEMSET:
- Com_Memset( VMA(1), args[2], args[3] );
- return 0;
-
- case UI_MEMCPY:
- Com_Memcpy( VMA(1), VMA(2), args[3] );
- return 0;
-
- case UI_STRNCPY:
- strncpy( VMA(1), VMA(2), args[3] );
- return args[1];
-
- case UI_SIN:
- return FloatAsInt( sin( VMF(1) ) );
-
- case UI_COS:
- return FloatAsInt( cos( VMF(1) ) );
-
- case UI_ATAN2:
- return FloatAsInt( atan2( VMF(1), VMF(2) ) );
-
- case UI_SQRT:
- return FloatAsInt( sqrt( VMF(1) ) );
-
- case UI_FLOOR:
- return FloatAsInt( floor( VMF(1) ) );
-
- case UI_CEIL:
- return FloatAsInt( ceil( VMF(1) ) );
-
- case UI_PARSE_ADD_GLOBAL_DEFINE:
- return Parse_AddGlobalDefine( VMA(1) );
- case UI_PARSE_LOAD_SOURCE:
- return Parse_LoadSourceHandle( VMA(1) );
- case UI_PARSE_FREE_SOURCE:
- return Parse_FreeSourceHandle( args[1] );
- case UI_PARSE_READ_TOKEN:
- return Parse_ReadTokenHandle( args[1], VMA(2) );
- case UI_PARSE_SOURCE_FILE_AND_LINE:
- return Parse_SourceFileAndLine( args[1], VMA(2), VMA(3) );
-
- case UI_S_STOPBACKGROUNDTRACK:
- S_StopBackgroundTrack();
- return 0;
- case UI_S_STARTBACKGROUNDTRACK:
- S_StartBackgroundTrack( VMA(1), VMA(2));
- return 0;
-
- case UI_REAL_TIME:
- return Com_RealTime( VMA(1) );
-
- case UI_CIN_PLAYCINEMATIC:
- Com_DPrintf("UI_CIN_PlayCinematic\n");
- return CIN_PlayCinematic(VMA(1), args[2], args[3], args[4], args[5], args[6]);
-
- case UI_CIN_STOPCINEMATIC:
- return CIN_StopCinematic(args[1]);
-
- case UI_CIN_RUNCINEMATIC:
- return CIN_RunCinematic(args[1]);
-
- case UI_CIN_DRAWCINEMATIC:
- CIN_DrawCinematic(args[1]);
- return 0;
-
- case UI_CIN_SETEXTENTS:
- CIN_SetExtents(args[1], args[2], args[3], args[4], args[5]);
- return 0;
-
- case UI_R_REMAP_SHADER:
- re.RemapShader( VMA(1), VMA(2), VMA(3) );
- return 0;
-
- default:
- Com_Error( ERR_DROP, "Bad UI system trap: %ld", (long int) args[0] );
-
- }
-
- return 0;
-}
-
-/*
-====================
-CL_ShutdownUI
-====================
-*/
-void CL_ShutdownUI( void ) {
- cls.keyCatchers &= ~KEYCATCH_UI;
- cls.uiStarted = qfalse;
- if ( !uivm ) {
- return;
- }
- VM_Call( uivm, UI_SHUTDOWN );
- VM_Free( uivm );
- uivm = NULL;
-}
-
-/*
-====================
-CL_InitUI
-====================
-*/
-#define UI_OLD_API_VERSION 4
-
-void CL_InitUI( void ) {
- int v;
- vmInterpret_t interpret;
-
- // load the dll or bytecode
- if ( cl_connectedToPureServer != 0 ) {
- // if sv_pure is set we only allow qvms to be loaded
- interpret = VMI_COMPILED;
- }
- else {
- interpret = Cvar_VariableValue( "vm_ui" );
- }
- uivm = VM_Create( "ui", CL_UISystemCalls, interpret );
- if ( !uivm ) {
- Com_Error( ERR_FATAL, "VM_Create on UI failed" );
- }
-
- // sanity check
- v = VM_Call( uivm, UI_GETAPIVERSION );
- if (v == UI_OLD_API_VERSION) {
- // init for this gamestate
- VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE));
- }
- else if (v != UI_API_VERSION) {
- Com_Error( ERR_DROP, "User Interface is version %d, expected %d", v, UI_API_VERSION );
- cls.uiStarted = qfalse;
- }
- else {
- // init for this gamestate
- VM_Call( uivm, UI_INIT, (cls.state >= CA_AUTHORIZING && cls.state < CA_ACTIVE) );
- }
-
- // reset any CVAR_CHEAT cvars registered by ui
- if ( !clc.demoplaying && !cl_connectedToCheatServer )
- Cvar_SetCheatState();
-}
-
-/*
-====================
-UI_GameCommand
-
-See if the current console command is claimed by the ui
-====================
-*/
-qboolean UI_GameCommand( void ) {
- if ( !uivm ) {
- return qfalse;
- }
-
- return VM_Call( uivm, UI_CONSOLE_COMMAND, cls.realtime );
-}
diff --git a/src/client/client.h b/src/client/client.h
deleted file mode 100644
index ea98c4f..0000000
--- a/src/client/client.h
+++ /dev/null
@@ -1,561 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// client.h -- primary header for client
-
-#include "../qcommon/q_shared.h"
-#include "../qcommon/qcommon.h"
-#include "../renderer/tr_public.h"
-#include "../ui/ui_public.h"
-#include "keys.h"
-#include "snd_public.h"
-#include "../cgame/cg_public.h"
-#include "../game/bg_public.h"
-
-#if USE_CURL
-#include "cl_curl.h"
-#endif /* USE_CURL */
-
-// file full of random crap that gets used to create cl_guid
-#define QKEY_FILE "qkey"
-#define QKEY_SIZE 2048
-
-#define RETRANSMIT_TIMEOUT 3000 // time between connection packet retransmits
-
-// snapshots are a view of the server at a given time
-typedef struct {
- qboolean valid; // cleared if delta parsing was invalid
- int snapFlags; // rate delayed and dropped commands
-
- int serverTime; // server time the message is valid for (in msec)
-
- int messageNum; // copied from netchan->incoming_sequence
- int deltaNum; // messageNum the delta is from
- int ping; // time from when cmdNum-1 was sent to time packet was reeceived
- byte areamask[MAX_MAP_AREA_BYTES]; // portalarea visibility bits
-
- int cmdNum; // the next cmdNum the server is expecting
- playerState_t ps; // complete information about the current player at this time
-
- int numEntities; // all of the entities that need to be presented
- int parseEntitiesNum; // at the time of this snapshot
-
- int serverCommandNum; // execute all commands up to this before
- // making the snapshot current
-} clSnapshot_t;
-
-
-
-/*
-=============================================================================
-
-the clientActive_t structure is wiped completely at every
-new gamestate_t, potentially several times during an established connection
-
-=============================================================================
-*/
-
-typedef struct {
- int p_cmdNumber; // cl.cmdNumber when packet was sent
- int p_serverTime; // usercmd->serverTime when packet was sent
- int p_realtime; // cls.realtime when packet was sent
-} outPacket_t;
-
-// the parseEntities array must be large enough to hold PACKET_BACKUP frames of
-// entities, so that when a delta compressed message arives from the server
-// it can be un-deltad from the original
-#define MAX_PARSE_ENTITIES 2048
-
-extern int g_console_field_width;
-
-typedef struct {
- int timeoutcount; // it requres several frames in a timeout condition
- // to disconnect, preventing debugging breaks from
- // causing immediate disconnects on continue
- clSnapshot_t snap; // latest received from server
-
- int serverTime; // may be paused during play
- int oldServerTime; // to prevent time from flowing bakcwards
- int oldFrameServerTime; // to check tournament restarts
- int serverTimeDelta; // cl.serverTime = cls.realtime + cl.serverTimeDelta
- // this value changes as net lag varies
- qboolean extrapolatedSnapshot; // set if any cgame frame has been forced to extrapolate
- // cleared when CL_AdjustTimeDelta looks at it
- qboolean newSnapshots; // set on parse of any valid packet
-
- gameState_t gameState; // configstrings
- char mapname[MAX_QPATH]; // extracted from CS_SERVERINFO
-
- int parseEntitiesNum; // index (not anded off) into cl_parse_entities[]
-
- int mouseDx[2], mouseDy[2]; // added to by mouse events
- int mouseIndex;
- int joystickAxis[MAX_JOYSTICK_AXIS]; // set by joystick events
-
- // cgame communicates a few values to the client system
- int cgameUserCmdValue; // current weapon to add to usercmd_t
- float cgameSensitivity;
-
- // cmds[cmdNumber] is the predicted command, [cmdNumber-1] is the last
- // properly generated command
- usercmd_t cmds[CMD_BACKUP]; // each mesage will send several old cmds
- int cmdNumber; // incremented each frame, because multiple
- // frames may need to be packed into a single packet
-
- outPacket_t outPackets[PACKET_BACKUP]; // information about each packet we have sent out
-
- // the client maintains its own idea of view angles, which are
- // sent to the server each frame. It is cleared to 0 upon entering each level.
- // the server sends a delta each frame which is added to the locally
- // tracked view angles to account for standing on rotating objects,
- // and teleport direction changes
- vec3_t viewangles;
-
- int serverId; // included in each client message so the server
- // can tell if it is for a prior map_restart
- // big stuff at end of structure so most offsets are 15 bits or less
- clSnapshot_t snapshots[PACKET_BACKUP];
-
- entityState_t entityBaselines[MAX_GENTITIES]; // for delta compression when not in previous frame
-
- entityState_t parseEntities[MAX_PARSE_ENTITIES];
-} clientActive_t;
-
-extern clientActive_t cl;
-
-/*
-=============================================================================
-
-the clientConnection_t structure is wiped when disconnecting from a server,
-either to go to a full screen console, play a demo, or connect to a different server
-
-A connection can be to either a server through the network layer or a
-demo through a file.
-
-=============================================================================
-*/
-
-
-typedef struct {
-
- int clientNum;
- int lastPacketSentTime; // for retransmits during connection
- int lastPacketTime; // for timeouts
-
- netadr_t serverAddress;
- int connectTime; // for connection retransmits
- int connectPacketCount; // for display on connection dialog
- char serverMessage[MAX_STRING_TOKENS]; // for display on connection dialog
-
- int challenge; // from the server to use for connecting
- int checksumFeed; // from the server for checksum calculations
-
- // these are our reliable messages that go to the server
- int reliableSequence;
- int reliableAcknowledge; // the last one the server has executed
- char reliableCommands[MAX_RELIABLE_COMMANDS][MAX_STRING_CHARS];
-
- // server message (unreliable) and command (reliable) sequence
- // numbers are NOT cleared at level changes, but continue to
- // increase as long as the connection is valid
-
- // message sequence is used by both the network layer and the
- // delta compression layer
- int serverMessageSequence;
-
- // reliable messages received from server
- int serverCommandSequence;
- int lastExecutedServerCommand; // last server command grabbed or executed with CL_GetServerCommand
- char serverCommands[MAX_RELIABLE_COMMANDS][MAX_STRING_CHARS];
-
- // file transfer from server
- fileHandle_t download;
- char downloadTempName[MAX_OSPATH];
- char downloadName[MAX_OSPATH];
-#ifdef USE_CURL
- qboolean cURLEnabled;
- qboolean cURLUsed;
- qboolean cURLDisconnected;
- char downloadURL[MAX_OSPATH];
- CURL *downloadCURL;
- CURLM *downloadCURLM;
-#endif /* USE_CURL */
- int sv_allowDownload;
- char sv_dlURL[MAX_CVAR_VALUE_STRING];
- int downloadNumber;
- int downloadBlock; // block we are waiting for
- int downloadCount; // how many bytes we got
- int downloadSize; // how many bytes we got
- char downloadList[MAX_INFO_STRING]; // list of paks we need to download
- qboolean downloadRestart; // if true, we need to do another FS_Restart because we downloaded a pak
-
- // demo information
- char demoName[MAX_QPATH];
- qboolean spDemoRecording;
- qboolean demorecording;
- qboolean demoplaying;
- qboolean demowaiting; // don't record until a non-delta message is received
- qboolean firstDemoFrameSkipped;
- fileHandle_t demofile;
-
- int timeDemoFrames; // counter of rendered frames
- int timeDemoStart; // cls.realtime before first frame
- int timeDemoBaseTime; // each frame will be at this time + frameNum * 50
-
- // big stuff at end of structure so most offsets are 15 bits or less
- netchan_t netchan;
-} clientConnection_t;
-
-extern clientConnection_t clc;
-
-/*
-==================================================================
-
-the clientStatic_t structure is never wiped, and is used even when
-no client connection is active at all
-
-==================================================================
-*/
-
-typedef struct {
- netadr_t adr;
- int start;
- int time;
- char info[MAX_INFO_STRING];
-} ping_t;
-
-typedef struct {
- netadr_t adr;
- char hostName[MAX_HOSTNAME_LENGTH];
- char mapName[MAX_NAME_LENGTH];
- char game[MAX_NAME_LENGTH];
- int netType;
- int gameType;
- int clients;
- int maxClients;
- int minPing;
- int maxPing;
- int ping;
- qboolean visible;
-} serverInfo_t;
-
-typedef struct {
- byte ip[4];
- unsigned short port;
-} serverAddress_t;
-
-typedef struct {
- connstate_t state; // connection status
- int keyCatchers; // bit flags
-
- qboolean cddialog; // bring up the cd needed dialog next frame
-
- char servername[MAX_OSPATH]; // name of server from original connect (used by reconnect)
-
- // when the server clears the hunk, all of these must be restarted
- qboolean rendererStarted;
- qboolean soundStarted;
- qboolean soundRegistered;
- qboolean uiStarted;
- qboolean cgameStarted;
-
- int framecount;
- int frametime; // msec since last frame
-
- int realtime; // ignores pause
- int realFrametime; // ignoring pause, so console always works
-
- int numlocalservers;
- serverInfo_t localServers[MAX_OTHER_SERVERS];
-
- int numglobalservers;
- serverInfo_t globalServers[MAX_GLOBAL_SERVERS];
- // additional global servers
- int numGlobalServerAddresses;
- serverAddress_t globalServerAddresses[MAX_GLOBAL_SERVERS];
-
- int numfavoriteservers;
- serverInfo_t favoriteServers[MAX_OTHER_SERVERS];
-
- int nummplayerservers;
- serverInfo_t mplayerServers[MAX_OTHER_SERVERS];
-
- int pingUpdateSource; // source currently pinging or updating
-
- int masterNum;
-
- // update server info
- netadr_t updateServer;
- char updateChallenge[MAX_TOKEN_CHARS];
- char updateInfoString[MAX_INFO_STRING];
-
- netadr_t authorizeServer;
-
- // rendering info
- glconfig_t glconfig;
- qhandle_t charSetShader;
- qhandle_t whiteShader;
- qhandle_t consoleShader;
-} clientStatic_t;
-
-extern clientStatic_t cls;
-
-//=============================================================================
-
-extern vm_t *cgvm; // interface to cgame dll or vm
-extern vm_t *uivm; // interface to ui dll or vm
-extern refexport_t re; // interface to refresh .dll
-
-
-//
-// cvars
-//
-extern cvar_t *cl_nodelta;
-extern cvar_t *cl_debugMove;
-extern cvar_t *cl_noprint;
-extern cvar_t *cl_timegraph;
-extern cvar_t *cl_maxpackets;
-extern cvar_t *cl_packetdup;
-extern cvar_t *cl_shownet;
-extern cvar_t *cl_showSend;
-extern cvar_t *cl_timeNudge;
-extern cvar_t *cl_showTimeDelta;
-extern cvar_t *cl_freezeDemo;
-
-extern cvar_t *cl_yawspeed;
-extern cvar_t *cl_pitchspeed;
-extern cvar_t *cl_run;
-extern cvar_t *cl_anglespeedkey;
-
-extern cvar_t *cl_sensitivity;
-extern cvar_t *cl_platformSensitivity;
-extern cvar_t *cl_freelook;
-
-extern cvar_t *cl_mouseAccel;
-extern cvar_t *cl_showMouseRate;
-
-extern cvar_t *m_pitch;
-extern cvar_t *m_yaw;
-extern cvar_t *m_forward;
-extern cvar_t *m_side;
-extern cvar_t *m_filter;
-
-extern cvar_t *cl_timedemo;
-extern cvar_t *cl_aviFrameRate;
-extern cvar_t *cl_aviMotionJpeg;
-
-extern cvar_t *cl_activeAction;
-
-extern cvar_t *cl_allowDownload;
-extern cvar_t *cl_downloadMethod;
-extern cvar_t *cl_conXOffset;
-extern cvar_t *cl_inGameVideo;
-
-extern cvar_t *cl_lanForcePackets;
-extern cvar_t *cl_autoRecordDemo;
-
-//=================================================
-
-//
-// cl_main
-//
-
-void CL_Init (void);
-void CL_FlushMemory(void);
-void CL_ShutdownAll(void);
-void CL_AddReliableCommand( const char *cmd );
-
-void CL_StartHunkUsers( void );
-
-void CL_Disconnect_f (void);
-void CL_GetChallengePacket (void);
-void CL_Vid_Restart_f( void );
-void CL_Snd_Restart_f (void);
-void CL_StartDemoLoop( void );
-void CL_NextDemo( void );
-void CL_ReadDemoMessage( void );
-demoState_t CL_DemoState( void );
-int CL_DemoPos( void );
-void CL_DemoName( char *buffer, int size );
-void CL_StopRecord_f( void );
-
-void CL_InitDownloads(void);
-void CL_NextDownload(void);
-
-void CL_GetPing( int n, char *buf, int buflen, int *pingtime );
-void CL_GetPingInfo( int n, char *buf, int buflen );
-void CL_ClearPing( int n );
-int CL_GetPingQueueCount( void );
-
-void CL_ShutdownRef( void );
-void CL_InitRef( void );
-int CL_ServerStatus( char *serverAddress, char *serverStatusString, int maxLen );
-
-qboolean CL_CheckPaused(void);
-
-//
-// cl_input
-//
-typedef struct {
- int down[2]; // key nums holding it down
- unsigned downtime; // msec timestamp
- unsigned msec; // msec down this frame if both a down and up happened
- qboolean active; // current state
- qboolean wasPressed; // set when down, not cleared when up
-} kbutton_t;
-
-extern kbutton_t in_mlook, in_klook;
-extern kbutton_t in_strafe;
-extern kbutton_t in_speed;
-
-void CL_InitInput (void);
-void CL_SendCmd (void);
-void CL_ClearState (void);
-void CL_ReadPackets (void);
-
-void CL_WritePacket( void );
-void IN_CenterView (void);
-
-void CL_VerifyCode( void );
-
-float CL_KeyState (kbutton_t *key);
-char *Key_KeynumToString (int keynum);
-
-//
-// cl_parse.c
-//
-extern int cl_connectedToPureServer;
-extern int cl_connectedToCheatServer;
-
-void CL_SystemInfoChanged( void );
-void CL_ParseServerMessage( msg_t *msg );
-
-//====================================================================
-
-void CL_ServerInfoPacket( netadr_t from, msg_t *msg );
-void CL_LocalServers_f( void );
-void CL_GlobalServers_f( void );
-void CL_FavoriteServers_f( void );
-void CL_Ping_f( void );
-qboolean CL_UpdateVisiblePings_f( int source );
-
-
-//
-// console
-//
-void Con_DrawCharacter (int cx, int line, int num);
-
-void Con_CheckResize (void);
-void Con_Init (void);
-void Con_Clear_f (void);
-void Con_ToggleConsole_f (void);
-void Con_DrawNotify (void);
-void Con_ClearNotify (void);
-void Con_RunConsole (void);
-void Con_DrawConsole (void);
-void Con_PageUp( void );
-void Con_PageDown( void );
-void Con_Top( void );
-void Con_Bottom( void );
-void Con_Close( void );
-
-void CL_LoadConsoleHistory( void );
-void CL_SaveConsoleHistory( void );
-
-//
-// cl_scrn.c
-//
-void SCR_Init (void);
-void SCR_UpdateScreen (void);
-
-void SCR_DebugGraph (float value, int color);
-
-int SCR_GetBigStringWidth( const char *str ); // returns in virtual 640x480 coordinates
-
-void SCR_AdjustFrom640( float *x, float *y, float *w, float *h );
-void SCR_FillRect( float x, float y, float width, float height,
- const float *color );
-void SCR_DrawPic( float x, float y, float width, float height, qhandle_t hShader );
-void SCR_DrawNamedPic( float x, float y, float width, float height, const char *picname );
-
-void SCR_DrawBigString( int x, int y, const char *s, float alpha ); // draws a string with embedded color control characters with fade
-void SCR_DrawBigStringColor( int x, int y, const char *s, vec4_t color ); // ignores embedded color control characters
-void SCR_DrawSmallStringExt( int x, int y, const char *string, float *setColor, qboolean forceColor );
-void SCR_DrawSmallChar( int x, int y, int ch );
-
-
-//
-// cl_cin.c
-//
-
-void CL_PlayCinematic_f( void );
-void SCR_DrawCinematic (void);
-void SCR_RunCinematic (void);
-void SCR_StopCinematic (void);
-int CIN_PlayCinematic( const char *arg0, int xpos, int ypos, int width, int height, int bits);
-e_status CIN_StopCinematic(int handle);
-e_status CIN_RunCinematic (int handle);
-void CIN_DrawCinematic (int handle);
-void CIN_SetExtents (int handle, int x, int y, int w, int h);
-void CIN_SetLooping (int handle, qboolean loop);
-void CIN_UploadCinematic(int handle);
-void CIN_CloseAllVideos(void);
-
-//
-// cl_cgame.c
-//
-void CL_InitCGame( void );
-void CL_ShutdownCGame( void );
-qboolean CL_GameCommand( void );
-void CL_GameConsoleText( void );
-void CL_CGameRendering( stereoFrame_t stereo );
-void CL_SetCGameTime( void );
-void CL_FirstSnapshot( void );
-void CL_ShaderStateChanged(void);
-
-//
-// cl_ui.c
-//
-void CL_InitUI( void );
-void CL_ShutdownUI( void );
-int Key_GetCatcher( void );
-void Key_SetCatcher( int catcher );
-void LAN_LoadCachedServers( void );
-void LAN_SaveServersToCache( void );
-
-
-//
-// cl_net_chan.c
-//
-void CL_Netchan_Transmit( netchan_t *chan, msg_t* msg); //int length, const byte *data );
-void CL_Netchan_TransmitNextFragment( netchan_t *chan );
-qboolean CL_Netchan_Process( netchan_t *chan, msg_t *msg );
-
-//
-// cl_avi.c
-//
-qboolean CL_OpenAVIForWriting( const char *filename );
-void CL_TakeVideoFrame( void );
-void CL_WriteAVIVideoFrame( const byte *imageBuffer, int size );
-void CL_WriteAVIAudioFrame( const byte *pcmBuffer, int size );
-qboolean CL_CloseAVI( void );
-qboolean CL_VideoRecording( void );
diff --git a/src/client/keycodes.h b/src/client/keycodes.h
deleted file mode 100644
index ae6f189..0000000
--- a/src/client/keycodes.h
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-//
-#ifndef __KEYCODES_H__
-#define __KEYCODES_H__
-
-//
-// these are the key numbers that should be passed to KeyEvent
-//
-
-// normal keys should be passed as lowercased ascii
-
-typedef enum {
- K_NONE = -1,
- K_TAB = 9,
- K_ENTER = 13,
- K_ESCAPE = 27,
- K_SPACE = 32,
-
- K_BACKSPACE = 127,
-
- K_COMMAND = 128,
- K_CAPSLOCK,
- K_POWER,
- K_PAUSE,
-
- K_UPARROW,
- K_DOWNARROW,
- K_LEFTARROW,
- K_RIGHTARROW,
-
- K_ALT,
- K_CTRL,
- K_SHIFT,
- K_INS,
- K_DEL,
- K_PGDN,
- K_PGUP,
- K_HOME,
- K_END,
-
- K_F1,
- K_F2,
- K_F3,
- K_F4,
- K_F5,
- K_F6,
- K_F7,
- K_F8,
- K_F9,
- K_F10,
- K_F11,
- K_F12,
- K_F13,
- K_F14,
- K_F15,
-
- K_KP_HOME,
- K_KP_UPARROW,
- K_KP_PGUP,
- K_KP_LEFTARROW,
- K_KP_5,
- K_KP_RIGHTARROW,
- K_KP_END,
- K_KP_DOWNARROW,
- K_KP_PGDN,
- K_KP_ENTER,
- K_KP_INS,
- K_KP_DEL,
- K_KP_SLASH,
- K_KP_MINUS,
- K_KP_PLUS,
- K_KP_NUMLOCK,
- K_KP_STAR,
- K_KP_EQUALS,
-
- K_MOUSE1,
- K_MOUSE2,
- K_MOUSE3,
- K_MOUSE4,
- K_MOUSE5,
-
- K_MWHEELDOWN,
- K_MWHEELUP,
-
- K_JOY1,
- K_JOY2,
- K_JOY3,
- K_JOY4,
- K_JOY5,
- K_JOY6,
- K_JOY7,
- K_JOY8,
- K_JOY9,
- K_JOY10,
- K_JOY11,
- K_JOY12,
- K_JOY13,
- K_JOY14,
- K_JOY15,
- K_JOY16,
- K_JOY17,
- K_JOY18,
- K_JOY19,
- K_JOY20,
- K_JOY21,
- K_JOY22,
- K_JOY23,
- K_JOY24,
- K_JOY25,
- K_JOY26,
- K_JOY27,
- K_JOY28,
- K_JOY29,
- K_JOY30,
- K_JOY31,
- K_JOY32,
-
- K_AUX1,
- K_AUX2,
- K_AUX3,
- K_AUX4,
- K_AUX5,
- K_AUX6,
- K_AUX7,
- K_AUX8,
- K_AUX9,
- K_AUX10,
- K_AUX11,
- K_AUX12,
- K_AUX13,
- K_AUX14,
- K_AUX15,
- K_AUX16,
-
- K_WORLD_0,
- K_WORLD_1,
- K_WORLD_2,
- K_WORLD_3,
- K_WORLD_4,
- K_WORLD_5,
- K_WORLD_6,
- K_WORLD_7,
- K_WORLD_8,
- K_WORLD_9,
- K_WORLD_10,
- K_WORLD_11,
- K_WORLD_12,
- K_WORLD_13,
- K_WORLD_14,
- K_WORLD_15,
- K_WORLD_16,
- K_WORLD_17,
- K_WORLD_18,
- K_WORLD_19,
- K_WORLD_20,
- K_WORLD_21,
- K_WORLD_22,
- K_WORLD_23,
- K_WORLD_24,
- K_WORLD_25,
- K_WORLD_26,
- K_WORLD_27,
- K_WORLD_28,
- K_WORLD_29,
- K_WORLD_30,
- K_WORLD_31,
- K_WORLD_32,
- K_WORLD_33,
- K_WORLD_34,
- K_WORLD_35,
- K_WORLD_36,
- K_WORLD_37,
- K_WORLD_38,
- K_WORLD_39,
- K_WORLD_40,
- K_WORLD_41,
- K_WORLD_42,
- K_WORLD_43,
- K_WORLD_44,
- K_WORLD_45,
- K_WORLD_46,
- K_WORLD_47,
- K_WORLD_48,
- K_WORLD_49,
- K_WORLD_50,
- K_WORLD_51,
- K_WORLD_52,
- K_WORLD_53,
- K_WORLD_54,
- K_WORLD_55,
- K_WORLD_56,
- K_WORLD_57,
- K_WORLD_58,
- K_WORLD_59,
- K_WORLD_60,
- K_WORLD_61,
- K_WORLD_62,
- K_WORLD_63,
- K_WORLD_64,
- K_WORLD_65,
- K_WORLD_66,
- K_WORLD_67,
- K_WORLD_68,
- K_WORLD_69,
- K_WORLD_70,
- K_WORLD_71,
- K_WORLD_72,
- K_WORLD_73,
- K_WORLD_74,
- K_WORLD_75,
- K_WORLD_76,
- K_WORLD_77,
- K_WORLD_78,
- K_WORLD_79,
- K_WORLD_80,
- K_WORLD_81,
- K_WORLD_82,
- K_WORLD_83,
- K_WORLD_84,
- K_WORLD_85,
- K_WORLD_86,
- K_WORLD_87,
- K_WORLD_88,
- K_WORLD_89,
- K_WORLD_90,
- K_WORLD_91,
- K_WORLD_92,
- K_WORLD_93,
- K_WORLD_94,
- K_WORLD_95,
-
- K_SUPER,
- K_COMPOSE,
- K_MODE,
- K_HELP,
- K_PRINT,
- K_SYSREQ,
- K_SCROLLOCK,
- K_BREAK,
- K_MENU,
- K_EURO,
- K_UNDO,
-
- MAX_KEYS
-} keyNum_t;
-
-// MAX_KEYS replaces K_LAST_KEY, however some mods may have used K_LAST_KEY
-// in detecting binds, so we leave it defined to the old hardcoded value
-// of maxiumum keys to prevent mods from crashing older versions of the engine
-#define K_LAST_KEY 256
-
-// The menu code needs to get both key and char events, but
-// to avoid duplicating the paths, the char events are just
-// distinguished by or'ing in K_CHAR_FLAG (ugly)
-#define K_CHAR_FLAG 1024
-
-#endif
diff --git a/src/client/keys.h b/src/client/keys.h
deleted file mode 100644
index 3c3fe80..0000000
--- a/src/client/keys.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-#include "keycodes.h"
-
-typedef struct {
- qboolean down;
- int repeats; // if > 1, it is autorepeating
- char *binding;
-} qkey_t;
-
-extern qboolean key_overstrikeMode;
-extern qkey_t keys[MAX_KEYS];
-
-// NOTE TTimo the declaration of field_t and Field_Clear is now in qcommon/qcommon.h
-void Field_KeyDownEvent( field_t *edit, int key );
-void Field_CharEvent( field_t *edit, int ch );
-void Field_Draw( field_t *edit, int x, int y, int width, qboolean showCursor );
-void Field_BigDraw( field_t *edit, int x, int y, int width, qboolean showCursor );
-
-#define COMMAND_HISTORY 32
-extern field_t historyEditLines[COMMAND_HISTORY];
-
-extern field_t g_consoleField;
-extern field_t chatField;
-extern int anykeydown;
-extern qboolean chat_team;
-extern int chat_playerNum;
-
-void Key_WriteBindings( fileHandle_t f );
-void Key_SetBinding( int keynum, const char *binding );
-char *Key_GetBinding( int keynum );
-qboolean Key_IsDown( int keynum );
-qboolean Key_GetOverstrikeMode( void );
-void Key_SetOverstrikeMode( qboolean state );
-void Key_ClearStates( void );
-int Key_GetKey(const char *binding);
-void Key_KeynumToStringBuf( int keynum, char *buf, int buflen );
-void Key_GetBindingBuf( int keynum, char *buf, int buflen );
diff --git a/src/client/qal.c b/src/client/qal.c
deleted file mode 100644
index c0b4a21..0000000
--- a/src/client/qal.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// Dynamically loads OpenAL
-
-#if USE_OPENAL
-
-#include "qal.h"
-
-#if USE_OPENAL_DLOPEN
-
-#if USE_SDL_VIDEO
-#include "SDL.h"
-#include "SDL_loadso.h"
-#define OBJTYPE void *
-#define OBJLOAD(x) SDL_LoadObject(x)
-#define SYMLOAD(x,y) SDL_LoadFunction(x,y)
-#define OBJFREE(x) SDL_UnloadObject(x)
-
-#elif defined _WIN32
-#include
-#define OBJTYPE HMODULE
-#define OBJLOAD(x) LoadLibrary(x)
-#define SYMLOAD(x,y) GetProcAddress(x,y)
-#define OBJFREE(x) FreeLibrary(x)
-
-#elif defined __linux__ || defined __FreeBSD__ || defined MACOS_X || defined __sun
-#include
-#define OBJTYPE void *
-#define OBJLOAD(x) dlopen(x, RTLD_LAZY | RTLD_GLOBAL)
-#define SYMLOAD(x,y) dlsym(x,y)
-#define OBJFREE(x) dlclose(x)
-#else
-
-#error "Your platform has no lib loading code or it is disabled"
-#endif
-
-#if defined __linux__ || defined __FreeBSD__ || defined MACOS_X
-#include
-#include
-#endif
-
-LPALENABLE qalEnable;
-LPALDISABLE qalDisable;
-LPALISENABLED qalIsEnabled;
-LPALGETSTRING qalGetString;
-LPALGETBOOLEANV qalGetBooleanv;
-LPALGETINTEGERV qalGetIntegerv;
-LPALGETFLOATV qalGetFloatv;
-LPALGETDOUBLEV qalGetDoublev;
-LPALGETBOOLEAN qalGetBoolean;
-LPALGETINTEGER qalGetInteger;
-LPALGETFLOAT qalGetFloat;
-LPALGETDOUBLE qalGetDouble;
-LPALGETERROR qalGetError;
-LPALISEXTENSIONPRESENT qalIsExtensionPresent;
-LPALGETPROCADDRESS qalGetProcAddress;
-LPALGETENUMVALUE qalGetEnumValue;
-LPALLISTENERF qalListenerf;
-LPALLISTENER3F qalListener3f;
-LPALLISTENERFV qalListenerfv;
-LPALLISTENERI qalListeneri;
-LPALGETLISTENERF qalGetListenerf;
-LPALGETLISTENER3F qalGetListener3f;
-LPALGETLISTENERFV qalGetListenerfv;
-LPALGETLISTENERI qalGetListeneri;
-LPALGENSOURCES qalGenSources;
-LPALDELETESOURCES qalDeleteSources;
-LPALISSOURCE qalIsSource;
-LPALSOURCEF qalSourcef;
-LPALSOURCE3F qalSource3f;
-LPALSOURCEFV qalSourcefv;
-LPALSOURCEI qalSourcei;
-LPALGETSOURCEF qalGetSourcef;
-LPALGETSOURCE3F qalGetSource3f;
-LPALGETSOURCEFV qalGetSourcefv;
-LPALGETSOURCEI qalGetSourcei;
-LPALSOURCEPLAYV qalSourcePlayv;
-LPALSOURCESTOPV qalSourceStopv;
-LPALSOURCEREWINDV qalSourceRewindv;
-LPALSOURCEPAUSEV qalSourcePausev;
-LPALSOURCEPLAY qalSourcePlay;
-LPALSOURCESTOP qalSourceStop;
-LPALSOURCEREWIND qalSourceRewind;
-LPALSOURCEPAUSE qalSourcePause;
-LPALSOURCEQUEUEBUFFERS qalSourceQueueBuffers;
-LPALSOURCEUNQUEUEBUFFERS qalSourceUnqueueBuffers;
-LPALGENBUFFERS qalGenBuffers;
-LPALDELETEBUFFERS qalDeleteBuffers;
-LPALISBUFFER qalIsBuffer;
-LPALBUFFERDATA qalBufferData;
-LPALGETBUFFERF qalGetBufferf;
-LPALGETBUFFERI qalGetBufferi;
-LPALDOPPLERFACTOR qalDopplerFactor;
-LPALDOPPLERVELOCITY qalDopplerVelocity;
-LPALDISTANCEMODEL qalDistanceModel;
-
-LPALCCREATECONTEXT qalcCreateContext;
-LPALCMAKECONTEXTCURRENT qalcMakeContextCurrent;
-LPALCPROCESSCONTEXT qalcProcessContext;
-LPALCSUSPENDCONTEXT qalcSuspendContext;
-LPALCDESTROYCONTEXT qalcDestroyContext;
-LPALCGETCURRENTCONTEXT qalcGetCurrentContext;
-LPALCGETCONTEXTSDEVICE qalcGetContextsDevice;
-LPALCOPENDEVICE qalcOpenDevice;
-LPALCCLOSEDEVICE qalcCloseDevice;
-LPALCGETERROR qalcGetError;
-LPALCISEXTENSIONPRESENT qalcIsExtensionPresent;
-LPALCGETPROCADDRESS qalcGetProcAddress;
-LPALCGETENUMVALUE qalcGetEnumValue;
-LPALCGETSTRING qalcGetString;
-LPALCGETINTEGERV qalcGetIntegerv;
-
-static OBJTYPE OpenALLib = NULL;
-
-static qboolean alinit_fail = qfalse;
-
-/*
-=================
-GPA
-=================
-*/
-static void *GPA(char *str)
-{
- void *rv;
-
- rv = SYMLOAD(OpenALLib, str);
- if(!rv)
- {
- Com_Printf( " Can't load symbol %s\n", str);
- alinit_fail = qtrue;
- return NULL;
- }
- else
- {
- Com_DPrintf( " Loaded symbol %s (%p)\n", str, rv);
- return rv;
- }
-}
-
-/*
-=================
-QAL_Init
-=================
-*/
-qboolean QAL_Init(const char *libname)
-{
- if(OpenALLib)
- return qtrue;
-
- Com_Printf( "Loading \"%s\"...\n", libname);
- if( (OpenALLib = OBJLOAD(libname)) == 0 )
- {
-#ifdef _WIN32
- return qfalse;
-#else
- char fn[1024];
- getcwd(fn, sizeof(fn));
- strncat(fn, "/", sizeof(fn) - strlen(fn) - 1);
- strncat(fn, libname, sizeof(fn) - strlen(fn) - 1);
-
- if( (OpenALLib = OBJLOAD(fn)) == 0 )
- {
- return qfalse;
- }
-#endif
- }
-
- alinit_fail = qfalse;
-
- qalEnable = GPA("alEnable");
- qalDisable = GPA("alDisable");
- qalIsEnabled = GPA("alIsEnabled");
- qalGetString = GPA("alGetString");
- qalGetBooleanv = GPA("alGetBooleanv");
- qalGetIntegerv = GPA("alGetIntegerv");
- qalGetFloatv = GPA("alGetFloatv");
- qalGetDoublev = GPA("alGetDoublev");
- qalGetBoolean = GPA("alGetBoolean");
- qalGetInteger = GPA("alGetInteger");
- qalGetFloat = GPA("alGetFloat");
- qalGetDouble = GPA("alGetDouble");
- qalGetError = GPA("alGetError");
- qalIsExtensionPresent = GPA("alIsExtensionPresent");
- qalGetProcAddress = GPA("alGetProcAddress");
- qalGetEnumValue = GPA("alGetEnumValue");
- qalListenerf = GPA("alListenerf");
- qalListener3f = GPA("alListener3f");
- qalListenerfv = GPA("alListenerfv");
- qalListeneri = GPA("alListeneri");
- qalGetListenerf = GPA("alGetListenerf");
- qalGetListener3f = GPA("alGetListener3f");
- qalGetListenerfv = GPA("alGetListenerfv");
- qalGetListeneri = GPA("alGetListeneri");
- qalGenSources = GPA("alGenSources");
- qalDeleteSources = GPA("alDeleteSources");
- qalIsSource = GPA("alIsSource");
- qalSourcef = GPA("alSourcef");
- qalSource3f = GPA("alSource3f");
- qalSourcefv = GPA("alSourcefv");
- qalSourcei = GPA("alSourcei");
- qalGetSourcef = GPA("alGetSourcef");
- qalGetSource3f = GPA("alGetSource3f");
- qalGetSourcefv = GPA("alGetSourcefv");
- qalGetSourcei = GPA("alGetSourcei");
- qalSourcePlayv = GPA("alSourcePlayv");
- qalSourceStopv = GPA("alSourceStopv");
- qalSourceRewindv = GPA("alSourceRewindv");
- qalSourcePausev = GPA("alSourcePausev");
- qalSourcePlay = GPA("alSourcePlay");
- qalSourceStop = GPA("alSourceStop");
- qalSourceRewind = GPA("alSourceRewind");
- qalSourcePause = GPA("alSourcePause");
- qalSourceQueueBuffers = GPA("alSourceQueueBuffers");
- qalSourceUnqueueBuffers = GPA("alSourceUnqueueBuffers");
- qalGenBuffers = GPA("alGenBuffers");
- qalDeleteBuffers = GPA("alDeleteBuffers");
- qalIsBuffer = GPA("alIsBuffer");
- qalBufferData = GPA("alBufferData");
- qalGetBufferf = GPA("alGetBufferf");
- qalGetBufferi = GPA("alGetBufferi");
- qalDopplerFactor = GPA("alDopplerFactor");
- qalDopplerVelocity = GPA("alDopplerVelocity");
- qalDistanceModel = GPA("alDistanceModel");
-
- qalcCreateContext = GPA("alcCreateContext");
- qalcMakeContextCurrent = GPA("alcMakeContextCurrent");
- qalcProcessContext = GPA("alcProcessContext");
- qalcSuspendContext = GPA("alcSuspendContext");
- qalcDestroyContext = GPA("alcDestroyContext");
- qalcGetCurrentContext = GPA("alcGetCurrentContext");
- qalcGetContextsDevice = GPA("alcGetContextsDevice");
- qalcOpenDevice = GPA("alcOpenDevice");
- qalcCloseDevice = GPA("alcCloseDevice");
- qalcGetError = GPA("alcGetError");
- qalcIsExtensionPresent = GPA("alcIsExtensionPresent");
- qalcGetProcAddress = GPA("alcGetProcAddress");
- qalcGetEnumValue = GPA("alcGetEnumValue");
- qalcGetString = GPA("alcGetString");
- qalcGetIntegerv = GPA("alcGetIntegerv");
-
- if(alinit_fail)
- {
- QAL_Shutdown();
- Com_Printf( " One or more symbols not found\n");
- return qfalse;
- }
-
- return qtrue;
-}
-
-/*
-=================
-QAL_Shutdown
-=================
-*/
-void QAL_Shutdown( void )
-{
- if(OpenALLib)
- {
- OBJFREE(OpenALLib);
- OpenALLib = NULL;
- }
-
- qalEnable = NULL;
- qalDisable = NULL;
- qalIsEnabled = NULL;
- qalGetString = NULL;
- qalGetBooleanv = NULL;
- qalGetIntegerv = NULL;
- qalGetFloatv = NULL;
- qalGetDoublev = NULL;
- qalGetBoolean = NULL;
- qalGetInteger = NULL;
- qalGetFloat = NULL;
- qalGetDouble = NULL;
- qalGetError = NULL;
- qalIsExtensionPresent = NULL;
- qalGetProcAddress = NULL;
- qalGetEnumValue = NULL;
- qalListenerf = NULL;
- qalListener3f = NULL;
- qalListenerfv = NULL;
- qalListeneri = NULL;
- qalGetListenerf = NULL;
- qalGetListener3f = NULL;
- qalGetListenerfv = NULL;
- qalGetListeneri = NULL;
- qalGenSources = NULL;
- qalDeleteSources = NULL;
- qalIsSource = NULL;
- qalSourcef = NULL;
- qalSource3f = NULL;
- qalSourcefv = NULL;
- qalSourcei = NULL;
- qalGetSourcef = NULL;
- qalGetSource3f = NULL;
- qalGetSourcefv = NULL;
- qalGetSourcei = NULL;
- qalSourcePlayv = NULL;
- qalSourceStopv = NULL;
- qalSourceRewindv = NULL;
- qalSourcePausev = NULL;
- qalSourcePlay = NULL;
- qalSourceStop = NULL;
- qalSourceRewind = NULL;
- qalSourcePause = NULL;
- qalSourceQueueBuffers = NULL;
- qalSourceUnqueueBuffers = NULL;
- qalGenBuffers = NULL;
- qalDeleteBuffers = NULL;
- qalIsBuffer = NULL;
- qalBufferData = NULL;
- qalGetBufferf = NULL;
- qalGetBufferi = NULL;
- qalDopplerFactor = NULL;
- qalDopplerVelocity = NULL;
- qalDistanceModel = NULL;
-
- qalcCreateContext = NULL;
- qalcMakeContextCurrent = NULL;
- qalcProcessContext = NULL;
- qalcSuspendContext = NULL;
- qalcDestroyContext = NULL;
- qalcGetCurrentContext = NULL;
- qalcGetContextsDevice = NULL;
- qalcOpenDevice = NULL;
- qalcCloseDevice = NULL;
- qalcGetError = NULL;
- qalcIsExtensionPresent = NULL;
- qalcGetProcAddress = NULL;
- qalcGetEnumValue = NULL;
- qalcGetString = NULL;
- qalcGetIntegerv = NULL;
-}
-#else
-qboolean QAL_Init(const char *libname)
-{
- return qtrue;
-}
-void QAL_Shutdown( void )
-{
-}
-#endif
-#endif
diff --git a/src/client/qal.h b/src/client/qal.h
deleted file mode 100644
index 7747d98..0000000
--- a/src/client/qal.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-
-#ifndef __QAL_H__
-#define __QAL_H__
-
-#include "../qcommon/q_shared.h"
-#include "../qcommon/qcommon.h"
-
-#if USE_OPENAL_DLOPEN
-#define AL_NO_PROTOTYPES
-#define ALC_NO_PROTOTYPES
-#endif
-
-#if USE_LOCAL_HEADERS
-#include "../AL/al.h"
-#include "../AL/alc.h"
-#else
-#ifdef _MSC_VER
- // MSVC users must install the OpenAL SDK which doesn't use the AL/*.h scheme.
- #include
- #include
-#else
- #include
- #include
-#endif
-#endif
-
-#if USE_OPENAL_DLOPEN
-extern LPALENABLE qalEnable;
-extern LPALDISABLE qalDisable;
-extern LPALISENABLED qalIsEnabled;
-extern LPALGETSTRING qalGetString;
-extern LPALGETBOOLEANV qalGetBooleanv;
-extern LPALGETINTEGERV qalGetIntegerv;
-extern LPALGETFLOATV qalGetFloatv;
-extern LPALGETDOUBLEV qalGetDoublev;
-extern LPALGETBOOLEAN qalGetBoolean;
-extern LPALGETINTEGER qalGetInteger;
-extern LPALGETFLOAT qalGetFloat;
-extern LPALGETDOUBLE qalGetDouble;
-extern LPALGETERROR qalGetError;
-extern LPALISEXTENSIONPRESENT qalIsExtensionPresent;
-extern LPALGETPROCADDRESS qalGetProcAddress;
-extern LPALGETENUMVALUE qalGetEnumValue;
-extern LPALLISTENERF qalListenerf;
-extern LPALLISTENER3F qalListener3f;
-extern LPALLISTENERFV qalListenerfv;
-extern LPALLISTENERI qalListeneri;
-extern LPALLISTENER3I qalListener3i;
-extern LPALLISTENERIV qalListeneriv;
-extern LPALGETLISTENERF qalGetListenerf;
-extern LPALGETLISTENER3F qalGetListener3f;
-extern LPALGETLISTENERFV qalGetListenerfv;
-extern LPALGETLISTENERI qalGetListeneri;
-extern LPALGETLISTENER3I qalGetListener3i;
-extern LPALGETLISTENERIV qalGetListeneriv;
-extern LPALGENSOURCES qalGenSources;
-extern LPALDELETESOURCES qalDeleteSources;
-extern LPALISSOURCE qalIsSource;
-extern LPALSOURCEF qalSourcef;
-extern LPALSOURCE3F qalSource3f;
-extern LPALSOURCEFV qalSourcefv;
-extern LPALSOURCEI qalSourcei;
-extern LPALSOURCE3I qalSource3i;
-extern LPALSOURCEIV qalSourceiv;
-extern LPALGETSOURCEF qalGetSourcef;
-extern LPALGETSOURCE3F qalGetSource3f;
-extern LPALGETSOURCEFV qalGetSourcefv;
-extern LPALGETSOURCEI qalGetSourcei;
-extern LPALGETSOURCE3I qalGetSource3i;
-extern LPALGETSOURCEIV qalGetSourceiv;
-extern LPALSOURCEPLAYV qalSourcePlayv;
-extern LPALSOURCESTOPV qalSourceStopv;
-extern LPALSOURCEREWINDV qalSourceRewindv;
-extern LPALSOURCEPAUSEV qalSourcePausev;
-extern LPALSOURCEPLAY qalSourcePlay;
-extern LPALSOURCESTOP qalSourceStop;
-extern LPALSOURCEREWIND qalSourceRewind;
-extern LPALSOURCEPAUSE qalSourcePause;
-extern LPALSOURCEQUEUEBUFFERS qalSourceQueueBuffers;
-extern LPALSOURCEUNQUEUEBUFFERS qalSourceUnqueueBuffers;
-extern LPALGENBUFFERS qalGenBuffers;
-extern LPALDELETEBUFFERS qalDeleteBuffers;
-extern LPALISBUFFER qalIsBuffer;
-extern LPALBUFFERDATA qalBufferData;
-extern LPALBUFFERF qalBufferf;
-extern LPALBUFFER3F qalBuffer3f;
-extern LPALBUFFERFV qalBufferfv;
-extern LPALBUFFERF qalBufferi;
-extern LPALBUFFER3F qalBuffer3i;
-extern LPALBUFFERFV qalBufferiv;
-extern LPALGETBUFFERF qalGetBufferf;
-extern LPALGETBUFFER3F qalGetBuffer3f;
-extern LPALGETBUFFERFV qalGetBufferfv;
-extern LPALGETBUFFERI qalGetBufferi;
-extern LPALGETBUFFER3I qalGetBuffer3i;
-extern LPALGETBUFFERIV qalGetBufferiv;
-extern LPALDOPPLERFACTOR qalDopplerFactor;
-extern LPALDOPPLERVELOCITY qalDopplerVelocity;
-extern LPALSPEEDOFSOUND qalSpeedOfSound;
-extern LPALDISTANCEMODEL qalDistanceModel;
-
-extern LPALCCREATECONTEXT qalcCreateContext;
-extern LPALCMAKECONTEXTCURRENT qalcMakeContextCurrent;
-extern LPALCPROCESSCONTEXT qalcProcessContext;
-extern LPALCSUSPENDCONTEXT qalcSuspendContext;
-extern LPALCDESTROYCONTEXT qalcDestroyContext;
-extern LPALCGETCURRENTCONTEXT qalcGetCurrentContext;
-extern LPALCGETCONTEXTSDEVICE qalcGetContextsDevice;
-extern LPALCOPENDEVICE qalcOpenDevice;
-extern LPALCCLOSEDEVICE qalcCloseDevice;
-extern LPALCGETERROR qalcGetError;
-extern LPALCISEXTENSIONPRESENT qalcIsExtensionPresent;
-extern LPALCGETPROCADDRESS qalcGetProcAddress;
-extern LPALCGETENUMVALUE qalcGetEnumValue;
-extern LPALCGETSTRING qalcGetString;
-extern LPALCGETINTEGERV qalcGetIntegerv;
-extern LPALCCAPTUREOPENDEVICE qalcCaptureOpenDevice;
-extern LPALCCAPTURECLOSEDEVICE qalcCaptureCloseDevice;
-extern LPALCCAPTURESTART qalcCaptureStart;
-extern LPALCCAPTURESTOP qalcCaptureStop;
-extern LPALCCAPTURESAMPLES qalcCaptureSamples;
-#else
-#define qalEnable alEnable
-#define qalDisable alDisable
-#define qalIsEnabled alIsEnabled
-#define qalGetString alGetString
-#define qalGetBooleanv alGetBooleanv
-#define qalGetIntegerv alGetIntegerv
-#define qalGetFloatv alGetFloatv
-#define qalGetDoublev alGetDoublev
-#define qalGetBoolean alGetBoolean
-#define qalGetInteger alGetInteger
-#define qalGetFloat alGetFloat
-#define qalGetDouble alGetDouble
-#define qalGetError alGetError
-#define qalIsExtensionPresent alIsExtensionPresent
-#define qalGetProcAddress alGetProcAddress
-#define qalGetEnumValue alGetEnumValue
-#define qalListenerf alListenerf
-#define qalListener3f alListener3f
-#define qalListenerfv alListenerfv
-#define qalListeneri alListeneri
-#define qalListener3i alListener3i
-#define qalListeneriv alListeneriv
-#define qalGetListenerf alGetListenerf
-#define qalGetListener3f alGetListener3f
-#define qalGetListenerfv alGetListenerfv
-#define qalGetListeneri alGetListeneri
-#define qalGetListener3i alGetListener3i
-#define qalGetListeneriv alGetListeneriv
-#define qalGenSources alGenSources
-#define qalDeleteSources alDeleteSources
-#define qalIsSource alIsSource
-#define qalSourcef alSourcef
-#define qalSource3f alSource3f
-#define qalSourcefv alSourcefv
-#define qalSourcei alSourcei
-#define qalSource3i alSource3i
-#define qalSourceiv alSourceiv
-#define qalGetSourcef alGetSourcef
-#define qalGetSource3f alGetSource3f
-#define qalGetSourcefv alGetSourcefv
-#define qalGetSourcei alGetSourcei
-#define qalGetSource3i alGetSource3i
-#define qalGetSourceiv alGetSourceiv
-#define qalSourcePlayv alSourcePlayv
-#define qalSourceStopv alSourceStopv
-#define qalSourceRewindv alSourceRewindv
-#define qalSourcePausev alSourcePausev
-#define qalSourcePlay alSourcePlay
-#define qalSourceStop alSourceStop
-#define qalSourceRewind alSourceRewind
-#define qalSourcePause alSourcePause
-#define qalSourceQueueBuffers alSourceQueueBuffers
-#define qalSourceUnqueueBuffers alSourceUnqueueBuffers
-#define qalGenBuffers alGenBuffers
-#define qalDeleteBuffers alDeleteBuffers
-#define qalIsBuffer alIsBuffer
-#define qalBufferData alBufferData
-#define qalBufferf alBufferf
-#define qalBuffer3f alBuffer3f
-#define qalBufferfv alBufferfv
-#define qalBufferi alBufferi
-#define qalBuffer3i alBuffer3i
-#define qalBufferiv alBufferiv
-#define qalGetBufferf alGetBufferf
-#define qalGetBuffer3f alGetBuffer3f
-#define qalGetBufferfv alGetBufferfv
-#define qalGetBufferi alGetBufferi
-#define qalGetBuffer3i alGetBuffer3i
-#define qalGetBufferiv alGetBufferiv
-#define qalDopplerFactor alDopplerFactor
-#define qalDopplerVelocity alDopplerVelocity
-#define qalSpeedOfSound alSpeedOfSound
-#define qalDistanceModel alDistanceModel
-
-#define qalcCreateContext alcCreateContext
-#define qalcMakeContextCurrent alcMakeContextCurrent
-#define qalcProcessContext alcProcessContext
-#define qalcSuspendContext alcSuspendContext
-#define qalcDestroyContext alcDestroyContext
-#define qalcGetCurrentContext alcGetCurrentContext
-#define qalcGetContextsDevice alcGetContextsDevice
-#define qalcOpenDevice alcOpenDevice
-#define qalcCloseDevice alcCloseDevice
-#define qalcGetError alcGetError
-#define qalcIsExtensionPresent alcIsExtensionPresent
-#define qalcGetProcAddress alcGetProcAddress
-#define qalcGetEnumValue alcGetEnumValue
-#define qalcGetString alcGetString
-#define qalcGetIntegerv alcGetIntegerv
-#define qalcCaptureOpenDevice alcCaptureOpenDevice
-#define qalcCaptureCloseDevice alcCaptureCloseDevice
-#define qalcCaptureStart alcCaptureStart
-#define qalcCaptureStop alcCaptureStop
-#define qalcCaptureSamples alcCaptureSamples
-#endif
-
-qboolean QAL_Init(const char *libname);
-void QAL_Shutdown( void );
-
-#endif // __QAL_H__
diff --git a/src/client/snd_adpcm.c b/src/client/snd_adpcm.c
deleted file mode 100644
index 89e68f4..0000000
--- a/src/client/snd_adpcm.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/***********************************************************
-Copyright 1992 by Stichting Mathematisch Centrum, Amsterdam, The
-Netherlands.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the names of Stichting Mathematisch
-Centrum or CWI not be used in advertising or publicity pertaining to
-distribution of the software without specific, written prior permission.
-
-STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
-THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
-FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-******************************************************************/
-
-/*
-** Intel/DVI ADPCM coder/decoder.
-**
-** The algorithm for this coder was taken from the IMA Compatability Project
-** proceedings, Vol 2, Number 2; May 1992.
-**
-** Version 1.2, 18-Dec-92.
-*/
-
-#include "snd_local.h"
-
-
-/* Intel ADPCM step variation table */
-static int indexTable[16] = {
- -1, -1, -1, -1, 2, 4, 6, 8,
- -1, -1, -1, -1, 2, 4, 6, 8,
-};
-
-static int stepsizeTable[89] = {
- 7, 8, 9, 10, 11, 12, 13, 14, 16, 17,
- 19, 21, 23, 25, 28, 31, 34, 37, 41, 45,
- 50, 55, 60, 66, 73, 80, 88, 97, 107, 118,
- 130, 143, 157, 173, 190, 209, 230, 253, 279, 307,
- 337, 371, 408, 449, 494, 544, 598, 658, 724, 796,
- 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066,
- 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358,
- 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899,
- 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767
-};
-
-
-void S_AdpcmEncode( short indata[], char outdata[], int len, struct adpcm_state *state ) {
- short *inp; /* Input buffer pointer */
- signed char *outp; /* output buffer pointer */
- int val; /* Current input sample value */
- int sign; /* Current adpcm sign bit */
- int delta; /* Current adpcm output value */
- int diff; /* Difference between val and sample */
- int step; /* Stepsize */
- int valpred; /* Predicted output value */
- int vpdiff; /* Current change to valpred */
- int index; /* Current step change index */
- int outputbuffer; /* place to keep previous 4-bit value */
- int bufferstep; /* toggle between outputbuffer/output */
-
- outp = (signed char *)outdata;
- inp = indata;
-
- valpred = state->sample;
- index = state->index;
- step = stepsizeTable[index];
-
- outputbuffer = 0; // quiet a compiler warning
- bufferstep = 1;
-
- for ( ; len > 0 ; len-- ) {
- val = *inp++;
-
- /* Step 1 - compute difference with previous value */
- diff = val - valpred;
- sign = (diff < 0) ? 8 : 0;
- if ( sign ) diff = (-diff);
-
- /* Step 2 - Divide and clamp */
- /* Note:
- ** This code *approximately* computes:
- ** delta = diff*4/step;
- ** vpdiff = (delta+0.5)*step/4;
- ** but in shift step bits are dropped. The net result of this is
- ** that even if you have fast mul/div hardware you cannot put it to
- ** good use since the fixup would be too expensive.
- */
- delta = 0;
- vpdiff = (step >> 3);
-
- if ( diff >= step ) {
- delta = 4;
- diff -= step;
- vpdiff += step;
- }
- step >>= 1;
- if ( diff >= step ) {
- delta |= 2;
- diff -= step;
- vpdiff += step;
- }
- step >>= 1;
- if ( diff >= step ) {
- delta |= 1;
- vpdiff += step;
- }
-
- /* Step 3 - Update previous value */
- if ( sign )
- valpred -= vpdiff;
- else
- valpred += vpdiff;
-
- /* Step 4 - Clamp previous value to 16 bits */
- if ( valpred > 32767 )
- valpred = 32767;
- else if ( valpred < -32768 )
- valpred = -32768;
-
- /* Step 5 - Assemble value, update index and step values */
- delta |= sign;
-
- index += indexTable[delta];
- if ( index < 0 ) index = 0;
- if ( index > 88 ) index = 88;
- step = stepsizeTable[index];
-
- /* Step 6 - Output value */
- if ( bufferstep ) {
- outputbuffer = (delta << 4) & 0xf0;
- } else {
- *outp++ = (delta & 0x0f) | outputbuffer;
- }
- bufferstep = !bufferstep;
- }
-
- /* Output last step, if needed */
- if ( !bufferstep )
- *outp++ = outputbuffer;
-
- state->sample = valpred;
- state->index = index;
-}
-
-
-/* static */ void S_AdpcmDecode( const char indata[], short *outdata, int len, struct adpcm_state *state ) {
- signed char *inp; /* Input buffer pointer */
- int outp; /* output buffer pointer */
- int sign; /* Current adpcm sign bit */
- int delta; /* Current adpcm output value */
- int step; /* Stepsize */
- int valpred; /* Predicted value */
- int vpdiff; /* Current change to valpred */
- int index; /* Current step change index */
- int inputbuffer; /* place to keep next 4-bit value */
- int bufferstep; /* toggle between inputbuffer/input */
-
- outp = 0;
- inp = (signed char *)indata;
-
- valpred = state->sample;
- index = state->index;
- step = stepsizeTable[index];
-
- bufferstep = 0;
- inputbuffer = 0; // quiet a compiler warning
- for ( ; len > 0 ; len-- ) {
-
- /* Step 1 - get the delta value */
- if ( bufferstep ) {
- delta = inputbuffer & 0xf;
- } else {
- inputbuffer = *inp++;
- delta = (inputbuffer >> 4) & 0xf;
- }
- bufferstep = !bufferstep;
-
- /* Step 2 - Find new index value (for later) */
- index += indexTable[delta];
- if ( index < 0 ) index = 0;
- if ( index > 88 ) index = 88;
-
- /* Step 3 - Separate sign and magnitude */
- sign = delta & 8;
- delta = delta & 7;
-
- /* Step 4 - Compute difference and new predicted value */
- /*
- ** Computes 'vpdiff = (delta+0.5)*step/4', but see comment
- ** in adpcm_coder.
- */
- vpdiff = step >> 3;
- if ( delta & 4 ) vpdiff += step;
- if ( delta & 2 ) vpdiff += step>>1;
- if ( delta & 1 ) vpdiff += step>>2;
-
- if ( sign )
- valpred -= vpdiff;
- else
- valpred += vpdiff;
-
- /* Step 5 - clamp output value */
- if ( valpred > 32767 )
- valpred = 32767;
- else if ( valpred < -32768 )
- valpred = -32768;
-
- /* Step 6 - Update step value */
- step = stepsizeTable[index];
-
- /* Step 7 - Output value */
- outdata[outp] = valpred;
- outp++;
- }
-
- state->sample = valpred;
- state->index = index;
-}
-
-
-/*
-====================
-S_AdpcmMemoryNeeded
-
-Returns the amount of memory (in bytes) needed to store the samples in out internal adpcm format
-====================
-*/
-int S_AdpcmMemoryNeeded( const wavinfo_t *info ) {
- float scale;
- int scaledSampleCount;
- int sampleMemory;
- int blockCount;
- int headerMemory;
-
- // determine scale to convert from input sampling rate to desired sampling rate
- scale = (float)info->rate / dma.speed;
-
- // calc number of samples at playback sampling rate
- scaledSampleCount = info->samples / scale;
-
- // calc memory need to store those samples using ADPCM at 4 bits per sample
- sampleMemory = scaledSampleCount / 2;
-
- // calc number of sample blocks needed of PAINTBUFFER_SIZE
- blockCount = scaledSampleCount / PAINTBUFFER_SIZE;
- if( scaledSampleCount % PAINTBUFFER_SIZE ) {
- blockCount++;
- }
-
- // calc memory needed to store the block headers
- headerMemory = blockCount * sizeof(adpcm_state_t);
-
- return sampleMemory + headerMemory;
-}
-
-
-/*
-====================
-S_AdpcmGetSamples
-====================
-*/
-void S_AdpcmGetSamples(sndBuffer *chunk, short *to) {
- adpcm_state_t state;
- byte *out;
-
- // get the starting state from the block header
- state.index = chunk->adpcm.index;
- state.sample = chunk->adpcm.sample;
-
- out = (byte *)chunk->sndChunk;
- // get samples
- S_AdpcmDecode((char *) out, to, SND_CHUNK_SIZE_BYTE*2, &state );
-}
-
-
-/*
-====================
-S_AdpcmEncodeSound
-====================
-*/
-void S_AdpcmEncodeSound( sfx_t *sfx, short *samples ) {
- adpcm_state_t state;
- int inOffset;
- int count;
- int n;
- sndBuffer *newchunk, *chunk;
- byte *out;
-
- inOffset = 0;
- count = sfx->soundLength;
- state.index = 0;
- state.sample = samples[0];
-
- chunk = NULL;
- while( count ) {
- n = count;
- if( n > SND_CHUNK_SIZE_BYTE*2 ) {
- n = SND_CHUNK_SIZE_BYTE*2;
- }
-
- newchunk = SND_malloc();
- if (sfx->soundData == NULL) {
- sfx->soundData = newchunk;
- } else {
- chunk->next = newchunk;
- }
- chunk = newchunk;
-
- // output the header
- chunk->adpcm.index = state.index;
- chunk->adpcm.sample = state.sample;
-
- out = (byte *)chunk->sndChunk;
-
- // encode the samples
- S_AdpcmEncode( samples + inOffset, (char *) out, n, &state );
-
- inOffset += n;
- count -= n;
- }
-}
diff --git a/src/client/snd_codec.c b/src/client/snd_codec.c
deleted file mode 100644
index 088236a..0000000
--- a/src/client/snd_codec.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "client.h"
-#include "snd_codec.h"
-
-static snd_codec_t *codecs;
-
-/*
-=================
-S_FileExtension
-=================
-*/
-static char *S_FileExtension(const char *fni)
-{
- // we should search from the ending to the last '/'
-
- char *fn = (char *) fni + strlen(fni) - 1;
- char *eptr = NULL;
-
- while(*fn != '/' && fn != fni)
- {
- if(*fn == '.')
- eptr = fn;
- fn--;
- }
-
- return eptr;
-}
-
-/*
-=================
-S_FindCodecForFile
-
-Select an appropriate codec for a file based on its extension
-=================
-*/
-static snd_codec_t *S_FindCodecForFile(const char *filename)
-{
- char *ext = S_FileExtension(filename);
- snd_codec_t *codec = codecs;
-
- if(!ext)
- {
- // No extension - auto-detect
- while(codec)
- {
- char fn[MAX_QPATH];
-
- // there is no extension so we do not need to subtract 4 chars
- Q_strncpyz(fn, filename, MAX_QPATH);
- COM_DefaultExtension(fn, MAX_QPATH, codec->ext);
-
- // Check it exists
- if(FS_ReadFile(fn, NULL) != -1)
- return codec;
-
- // Nope. Next!
- codec = codec->next;
- }
-
- // Nothin'
- return NULL;
- }
-
- while(codec)
- {
- if(!Q_stricmp(ext, codec->ext))
- return codec;
- codec = codec->next;
- }
-
- return NULL;
-}
-
-/*
-=================
-S_CodecInit
-=================
-*/
-void S_CodecInit()
-{
- codecs = NULL;
- S_CodecRegister(&wav_codec);
-#if USE_CODEC_VORBIS
- S_CodecRegister(&ogg_codec);
-#endif
-}
-
-/*
-=================
-S_CodecShutdown
-=================
-*/
-void S_CodecShutdown()
-{
- codecs = NULL;
-}
-
-/*
-=================
-S_CodecRegister
-=================
-*/
-void S_CodecRegister(snd_codec_t *codec)
-{
- codec->next = codecs;
- codecs = codec;
-}
-
-/*
-=================
-S_CodecLoad
-=================
-*/
-void *S_CodecLoad(const char *filename, snd_info_t *info)
-{
- snd_codec_t *codec;
- char fn[MAX_QPATH];
-
- codec = S_FindCodecForFile(filename);
- if(!codec)
- {
- Com_Printf("Unknown extension for %s\n", filename);
- return NULL;
- }
-
- strncpy(fn, filename, sizeof(fn));
- COM_DefaultExtension(fn, sizeof(fn), codec->ext);
-
- return codec->load(fn, info);
-}
-
-/*
-=================
-S_CodecOpenStream
-=================
-*/
-snd_stream_t *S_CodecOpenStream(const char *filename)
-{
- snd_codec_t *codec;
- char fn[MAX_QPATH];
-
- codec = S_FindCodecForFile(filename);
- if(!codec)
- {
- Com_Printf("Unknown extension for %s\n", filename);
- return NULL;
- }
-
- strncpy(fn, filename, sizeof(fn));
- COM_DefaultExtension(fn, sizeof(fn), codec->ext);
-
- return codec->open(fn);
-}
-
-void S_CodecCloseStream(snd_stream_t *stream)
-{
- stream->codec->close(stream);
-}
-
-int S_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
-{
- return stream->codec->read(stream, bytes, buffer);
-}
-
-//=======================================================================
-// Util functions (used by codecs)
-
-/*
-=================
-S_CodecUtilOpen
-=================
-*/
-snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec)
-{
- snd_stream_t *stream;
- fileHandle_t hnd;
- int length;
-
- // Try to open the file
- length = FS_FOpenFileRead(filename, &hnd, qtrue);
- if(!hnd)
- {
- Com_Printf("Can't read sound file %s\n", filename);
- return NULL;
- }
-
- // Allocate a stream
- stream = Z_Malloc(sizeof(snd_stream_t));
- if(!stream)
- {
- FS_FCloseFile(hnd);
- return NULL;
- }
-
- // Copy over, return
- stream->codec = codec;
- stream->file = hnd;
- stream->length = length;
- return stream;
-}
-
-/*
-=================
-S_CodecUtilClose
-=================
-*/
-void S_CodecUtilClose(snd_stream_t *stream)
-{
- FS_FCloseFile(stream->file);
- Z_Free(stream);
-}
diff --git a/src/client/snd_codec.h b/src/client/snd_codec.h
deleted file mode 100644
index 582e65e..0000000
--- a/src/client/snd_codec.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#ifndef _SND_CODEC_H_
-#define _SND_CODEC_H_
-
-#include "../qcommon/q_shared.h"
-#include "../qcommon/qcommon.h"
-
-typedef struct snd_info_s
-{
- int rate;
- int width;
- int channels;
- int samples;
- int size;
- int dataofs;
-} snd_info_t;
-
-typedef struct snd_codec_s snd_codec_t;
-
-typedef struct snd_stream_s
-{
- snd_codec_t *codec;
- fileHandle_t file;
- snd_info_t info;
- int length;
- int pos;
- void *ptr;
-} snd_stream_t;
-
-// Codec functions
-typedef void *(*CODEC_LOAD)(const char *filename, snd_info_t *info);
-typedef snd_stream_t *(*CODEC_OPEN)(const char *filename);
-typedef int (*CODEC_READ)(snd_stream_t *stream, int bytes, void *buffer);
-typedef void (*CODEC_CLOSE)(snd_stream_t *stream);
-
-// Codec data structure
-struct snd_codec_s
-{
- char *ext;
- CODEC_LOAD load;
- CODEC_OPEN open;
- CODEC_READ read;
- CODEC_CLOSE close;
- snd_codec_t *next;
-};
-
-// Codec management
-void S_CodecInit( void );
-void S_CodecShutdown( void );
-void S_CodecRegister(snd_codec_t *codec);
-void *S_CodecLoad(const char *filename, snd_info_t *info);
-snd_stream_t *S_CodecOpenStream(const char *filename);
-void S_CodecCloseStream(snd_stream_t *stream);
-int S_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer);
-
-// Util functions (used by codecs)
-snd_stream_t *S_CodecUtilOpen(const char *filename, snd_codec_t *codec);
-void S_CodecUtilClose(snd_stream_t *stream);
-
-// WAV Codec
-extern snd_codec_t wav_codec;
-void *S_WAV_CodecLoad(const char *filename, snd_info_t *info);
-snd_stream_t *S_WAV_CodecOpenStream(const char *filename);
-void S_WAV_CodecCloseStream(snd_stream_t *stream);
-int S_WAV_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer);
-
-// Ogg Vorbis codec
-#ifdef USE_CODEC_VORBIS
-extern snd_codec_t ogg_codec;
-void *S_OGG_CodecLoad(const char *filename, snd_info_t *info);
-snd_stream_t *S_OGG_CodecOpenStream(const char *filename);
-void S_OGG_CodecCloseStream(snd_stream_t *stream);
-int S_OGG_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer);
-#endif // USE_CODEC_VORBIS
-
-#endif // !_SND_CODEC_H_
diff --git a/src/client/snd_codec_ogg.c b/src/client/snd_codec_ogg.c
deleted file mode 100644
index f13f9a8..0000000
--- a/src/client/snd_codec_ogg.c
+++ /dev/null
@@ -1,473 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-Copyright (C) 2005-2006 Joerg Dietrich
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-// OGG support is enabled by this define
-#if USE_CODEC_VORBIS
-
-// includes for the Q3 sound system
-#include "client.h"
-#include "snd_codec.h"
-
-// includes for the OGG codec
-#include
-#include
-
-// The OGG codec can return the samples in a number of different formats,
-// we use the standard signed short format.
-#define OGG_SAMPLEWIDTH 2
-
-// Q3 OGG codec
-snd_codec_t ogg_codec =
-{
- ".ogg",
- S_OGG_CodecLoad,
- S_OGG_CodecOpenStream,
- S_OGG_CodecReadStream,
- S_OGG_CodecCloseStream,
- NULL
-};
-
-// callbacks for vobisfile
-
-// fread() replacement
-size_t S_OGG_Callback_read(void *ptr, size_t size, size_t nmemb, void *datasource)
-{
- snd_stream_t *stream;
- int byteSize = 0;
- int bytesRead = 0;
- size_t nMembRead = 0;
-
- // check if input is valid
- if(!ptr)
- {
- errno = EFAULT;
- return 0;
- }
-
- if(!(size && nmemb))
- {
- // It's not an error, caller just wants zero bytes!
- errno = 0;
- return 0;
- }
-
- if(!datasource)
- {
- errno = EBADF;
- return 0;
- }
-
- // we use a snd_stream_t in the generic pointer to pass around
- stream = (snd_stream_t *) datasource;
-
- // FS_Read does not support multi-byte elements
- byteSize = nmemb * size;
-
- // read it with the Q3 function FS_Read()
- bytesRead = FS_Read(ptr, byteSize, stream->file);
-
- // update the file position
- stream->pos += bytesRead;
-
- // this function returns the number of elements read not the number of bytes
- nMembRead = bytesRead / size;
-
- // even if the last member is only read partially
- // it is counted as a whole in the return value
- if(bytesRead % size)
- {
- nMembRead++;
- }
-
- return nMembRead;
-}
-
-// fseek() replacement
-int S_OGG_Callback_seek(void *datasource, ogg_int64_t offset, int whence)
-{
- snd_stream_t *stream;
- int retVal = 0;
-
- // check if input is valid
- if(!datasource)
- {
- errno = EBADF;
- return -1;
- }
-
- // snd_stream_t in the generic pointer
- stream = (snd_stream_t *) datasource;
-
- // we must map the whence to its Q3 counterpart
- switch(whence)
- {
- case SEEK_SET :
- {
- // set the file position in the actual file with the Q3 function
- retVal = FS_Seek(stream->file, (long) offset, FS_SEEK_SET);
-
- // something has gone wrong, so we return here
- if(!(retVal == 0))
- {
- return retVal;
- }
-
- // keep track of file position
- stream->pos = (int) offset;
- break;
- }
-
- case SEEK_CUR :
- {
- // set the file position in the actual file with the Q3 function
- retVal = FS_Seek(stream->file, (long) offset, FS_SEEK_CUR);
-
- // something has gone wrong, so we return here
- if(!(retVal == 0))
- {
- return retVal;
- }
-
- // keep track of file position
- stream->pos += (int) offset;
- break;
- }
-
- case SEEK_END :
- {
- // Quake 3 seems to have trouble with FS_SEEK_END
- // so we use the file length and FS_SEEK_SET
-
- // set the file position in the actual file with the Q3 function
- retVal = FS_Seek(stream->file, (long) stream->length + (long) offset, FS_SEEK_SET);
-
- // something has gone wrong, so we return here
- if(!(retVal == 0))
- {
- return retVal;
- }
-
- // keep track of file position
- stream->pos = stream->length + (int) offset;
- break;
- }
-
- default :
- {
- // unknown whence, so we return an error
- errno = EINVAL;
- return -1;
- }
- }
-
- // stream->pos shouldn't be smaller than zero or bigger than the filesize
- stream->pos = (stream->pos < 0) ? 0 : stream->pos;
- stream->pos = (stream->pos > stream->length) ? stream->length : stream->pos;
-
- return 0;
-}
-
-// fclose() replacement
-int S_OGG_Callback_close(void *datasource)
-{
- // we do nothing here and close all things manually in S_OGG_CodecCloseStream()
- return 0;
-}
-
-// ftell() replacement
-long S_OGG_Callback_tell(void *datasource)
-{
- // check if input is valid
- if(!datasource)
- {
- errno = EBADF;
- return -1;
- }
-
- // we keep track of the file position in stream->pos
- return (long) (((snd_stream_t *) datasource) -> pos);
-}
-
-// the callback structure
-const ov_callbacks S_OGG_Callbacks =
-{
- &S_OGG_Callback_read,
- &S_OGG_Callback_seek,
- &S_OGG_Callback_close,
- &S_OGG_Callback_tell
-};
-
-/*
-=================
-S_OGG_CodecOpenStream
-=================
-*/
-snd_stream_t *S_OGG_CodecOpenStream(const char *filename)
-{
- snd_stream_t *stream;
-
- // OGG codec control structure
- OggVorbis_File *vf;
-
- // some variables used to get informations about the OGG
- vorbis_info *OGGInfo;
- ogg_int64_t numSamples;
-
- // check if input is valid
- if(!filename)
- {
- return NULL;
- }
-
- // Open the stream
- stream = S_CodecUtilOpen(filename, &ogg_codec);
- if(!stream)
- {
- return NULL;
- }
-
- // alloctate the OggVorbis_File
- vf = Z_Malloc(sizeof(OggVorbis_File));
- if(!vf)
- {
- S_CodecUtilClose(stream);
-
- return NULL;
- }
-
- // open the codec with our callbacks and stream as the generic pointer
- if(ov_open_callbacks(stream, vf, NULL, 0, S_OGG_Callbacks) != 0)
- {
- Z_Free(vf);
-
- S_CodecUtilClose(stream);
-
- return NULL;
- }
-
- // the stream must be seekable
- if(!ov_seekable(vf))
- {
- ov_clear(vf);
-
- Z_Free(vf);
-
- S_CodecUtilClose(stream);
-
- return NULL;
- }
-
- // we only support OGGs with one substream
- if(ov_streams(vf) != 1)
- {
- ov_clear(vf);
-
- Z_Free(vf);
-
- S_CodecUtilClose(stream);
-
- return NULL;
- }
-
- // get the info about channels and rate
- OGGInfo = ov_info(vf, 0);
- if(!OGGInfo)
- {
- ov_clear(vf);
-
- Z_Free(vf);
-
- S_CodecUtilClose(stream);
-
- return NULL;
- }
-
- // get the number of sample-frames in the OGG
- numSamples = ov_pcm_total(vf, 0);
-
- // fill in the info-structure in the stream
- stream->info.rate = OGGInfo->rate;
- stream->info.width = OGG_SAMPLEWIDTH;
- stream->info.channels = OGGInfo->channels;
- stream->info.samples = numSamples;
- stream->info.size = stream->info.samples * stream->info.channels * stream->info.width;
- stream->info.dataofs = 0;
-
- // We use stream->pos for the file pointer in the compressed ogg file
- stream->pos = 0;
-
- // We use the generic pointer in stream for the OGG codec control structure
- stream->ptr = vf;
-
- return stream;
-}
-
-/*
-=================
-S_OGG_CodecCloseStream
-=================
-*/
-void S_OGG_CodecCloseStream(snd_stream_t *stream)
-{
- // check if input is valid
- if(!stream)
- {
- return;
- }
-
- // let the OGG codec cleanup its stuff
- ov_clear((OggVorbis_File *) stream->ptr);
-
- // free the OGG codec control struct
- Z_Free(stream->ptr);
-
- // close the stream
- S_CodecUtilClose(stream);
-}
-
-/*
-=================
-S_OGG_CodecReadStream
-=================
-*/
-int S_OGG_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
-{
- // buffer handling
- int bytesRead, bytesLeft, c;
- char *bufPtr;
-
- // Bitstream for the decoder
- int BS = 0;
-
- // big endian machines want their samples in big endian order
- int IsBigEndian = 0;
-
-# ifdef Q3_BIG_ENDIAN
- IsBigEndian = 1;
-# endif // Q3_BIG_ENDIAN
-
- // check if input is valid
- if(!(stream && buffer))
- {
- return 0;
- }
-
- if(bytes <= 0)
- {
- return 0;
- }
-
- bytesRead = 0;
- bytesLeft = bytes;
- bufPtr = buffer;
-
- // cycle until we have the requested or all available bytes read
- while(-1)
- {
- // read some bytes from the OGG codec
- c = ov_read((OggVorbis_File *) stream->ptr, bufPtr, bytesLeft, IsBigEndian, OGG_SAMPLEWIDTH, 1, &BS);
-
- // no more bytes are left
- if(c <= 0)
- {
- break;
- }
-
- bytesRead += c;
- bytesLeft -= c;
- bufPtr += c;
-
- // we have enough bytes
- if(bytesLeft <= 0)
- {
- break;
- }
- }
-
- return bytesRead;
-}
-
-/*
-=====================================================================
-S_OGG_CodecLoad
-
-We handle S_OGG_CodecLoad as a special case of the streaming functions
-where we read the whole stream at once.
-======================================================================
-*/
-void *S_OGG_CodecLoad(const char *filename, snd_info_t *info)
-{
- snd_stream_t *stream;
- byte *buffer;
- int bytesRead;
-
- // check if input is valid
- if(!(filename && info))
- {
- return NULL;
- }
-
- // open the file as a stream
- stream = S_OGG_CodecOpenStream(filename);
- if(!stream)
- {
- return NULL;
- }
-
- // copy over the info
- info->rate = stream->info.rate;
- info->width = stream->info.width;
- info->channels = stream->info.channels;
- info->samples = stream->info.samples;
- info->size = stream->info.size;
- info->dataofs = stream->info.dataofs;
-
- // allocate a buffer
- // this buffer must be free-ed by the caller of this function
- buffer = Z_Malloc(info->size);
- if(!buffer)
- {
- S_OGG_CodecCloseStream(stream);
-
- return NULL;
- }
-
- // fill the buffer
- bytesRead = S_OGG_CodecReadStream(stream, info->size, buffer);
-
- // we don't even have read a single byte
- if(bytesRead <= 0)
- {
- Z_Free(buffer);
- S_OGG_CodecCloseStream(stream);
-
- return NULL;
- }
-
- S_OGG_CodecCloseStream(stream);
-
- return buffer;
-}
-
-#endif // USE_CODEC_VORBIS
diff --git a/src/client/snd_codec_wav.c b/src/client/snd_codec_wav.c
deleted file mode 100644
index e38b360..0000000
--- a/src/client/snd_codec_wav.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "client.h"
-#include "snd_codec.h"
-
-/*
-=================
-FGetLittleLong
-=================
-*/
-static int FGetLittleLong( fileHandle_t f ) {
- int v;
-
- FS_Read( &v, sizeof(v), f );
-
- return LittleLong( v);
-}
-
-/*
-=================
-FGetLittleShort
-=================
-*/
-static short FGetLittleShort( fileHandle_t f ) {
- short v;
-
- FS_Read( &v, sizeof(v), f );
-
- return LittleShort( v);
-}
-
-/*
-=================
-S_ReadChunkInfo
-=================
-*/
-static int S_ReadChunkInfo(fileHandle_t f, char *name)
-{
- int len, r;
-
- name[4] = 0;
-
- r = FS_Read(name, 4, f);
- if(r != 4)
- return -1;
-
- len = FGetLittleLong(f);
- if( len < 0 ) {
- Com_Printf( S_COLOR_YELLOW "WARNING: Negative chunk length\n" );
- return -1;
- }
-
- return len;
-}
-
-/*
-=================
-S_FindRIFFChunk
-
-Returns the length of the data in the chunk, or -1 if not found
-=================
-*/
-static int S_FindRIFFChunk( fileHandle_t f, char *chunk ) {
- char name[5];
- int len;
-
- while( ( len = S_ReadChunkInfo(f, name) ) >= 0 )
- {
- // If this is the right chunk, return
- if( !Q_strncmp( name, chunk, 4 ) )
- return len;
-
- len = PAD( len, 2 );
-
- // Not the right chunk - skip it
- FS_Seek( f, len, FS_SEEK_CUR );
- }
-
- return -1;
-}
-
-/*
-=================
-S_ByteSwapRawSamples
-=================
-*/
-static void S_ByteSwapRawSamples( int samples, int width, int s_channels, const byte *data ) {
- int i;
-
- if ( width != 2 ) {
- return;
- }
- if ( LittleShort( 256 ) == 256 ) {
- return;
- }
-
- if ( s_channels == 2 ) {
- samples <<= 1;
- }
- for ( i = 0 ; i < samples ; i++ ) {
- ((short *)data)[i] = LittleShort( ((short *)data)[i] );
- }
-}
-
-/*
-=================
-S_ReadRIFFHeader
-=================
-*/
-static qboolean S_ReadRIFFHeader(fileHandle_t file, snd_info_t *info)
-{
- char dump[16];
- int wav_format;
- int bits;
- int fmtlen = 0;
-
- // skip the riff wav header
- FS_Read(dump, 12, file);
-
- // Scan for the format chunk
- if((fmtlen = S_FindRIFFChunk(file, "fmt ")) < 0)
- {
- Com_Printf( S_COLOR_RED "ERROR: Couldn't find \"fmt\" chunk\n");
- return qfalse;
- }
-
- // Save the parameters
- wav_format = FGetLittleShort(file);
- info->channels = FGetLittleShort(file);
- info->rate = FGetLittleLong(file);
- FGetLittleLong(file);
- FGetLittleShort(file);
- bits = FGetLittleShort(file);
-
- if( bits < 8 )
- {
- Com_Printf( S_COLOR_RED "ERROR: Less than 8 bit sound is not supported\n");
- return qfalse;
- }
-
- info->width = bits / 8;
- info->dataofs = 0;
-
- // Skip the rest of the format chunk if required
- if(fmtlen > 16)
- {
- fmtlen -= 16;
- FS_Seek( file, fmtlen, FS_SEEK_CUR );
- }
-
- // Scan for the data chunk
- if( (info->size = S_FindRIFFChunk(file, "data")) < 0)
- {
- Com_Printf( S_COLOR_RED "ERROR: Couldn't find \"data\" chunk\n");
- return qfalse;
- }
- info->samples = (info->size / info->width) / info->channels;
-
- return qtrue;
-}
-
-// WAV codec
-snd_codec_t wav_codec =
-{
- ".wav",
- S_WAV_CodecLoad,
- S_WAV_CodecOpenStream,
- S_WAV_CodecReadStream,
- S_WAV_CodecCloseStream,
- NULL
-};
-
-/*
-=================
-S_WAV_CodecLoad
-=================
-*/
-void *S_WAV_CodecLoad(const char *filename, snd_info_t *info)
-{
- fileHandle_t file;
- void *buffer;
-
- // Try to open the file
- FS_FOpenFileRead(filename, &file, qtrue);
- if(!file)
- {
- Com_Printf( S_COLOR_RED "ERROR: Could not open \"%s\"\n",
- filename);
- return NULL;
- }
-
- // Read the RIFF header
- if(!S_ReadRIFFHeader(file, info))
- {
- FS_FCloseFile(file);
- Com_Printf( S_COLOR_RED "ERROR: Incorrect/unsupported format in \"%s\"\n",
- filename);
- return NULL;
- }
-
- // Allocate some memory
- buffer = Z_Malloc(info->size);
- if(!buffer)
- {
- FS_FCloseFile(file);
- Com_Printf( S_COLOR_RED "ERROR: Out of memory reading \"%s\"\n",
- filename);
- return NULL;
- }
-
- // Read, byteswap
- FS_Read(buffer, info->size, file);
- S_ByteSwapRawSamples(info->samples, info->width, info->channels, (byte *)buffer);
-
- // Close and return
- FS_FCloseFile(file);
- return buffer;
-}
-
-/*
-=================
-S_WAV_CodecOpenStream
-=================
-*/
-snd_stream_t *S_WAV_CodecOpenStream(const char *filename)
-{
- snd_stream_t *rv;
-
- // Open
- rv = S_CodecUtilOpen(filename, &wav_codec);
- if(!rv)
- return NULL;
-
- // Read the RIFF header
- if(!S_ReadRIFFHeader(rv->file, &rv->info))
- {
- S_CodecUtilClose(rv);
- return NULL;
- }
-
- return rv;
-}
-
-/*
-=================
-S_WAV_CodecCloseStream
-=================
-*/
-void S_WAV_CodecCloseStream(snd_stream_t *stream)
-{
- S_CodecUtilClose(stream);
-}
-
-/*
-=================
-S_WAV_CodecReadStream
-=================
-*/
-int S_WAV_CodecReadStream(snd_stream_t *stream, int bytes, void *buffer)
-{
- int remaining = stream->info.size - stream->pos;
- int samples;
-
- if(remaining <= 0)
- return 0;
- if(bytes > remaining)
- bytes = remaining;
- stream->pos += bytes;
- samples = (bytes / stream->info.width) / stream->info.channels;
- FS_Read(buffer, bytes, stream->file);
- S_ByteSwapRawSamples(samples, stream->info.width, stream->info.channels, buffer);
- return bytes;
-}
diff --git a/src/client/snd_dma.c b/src/client/snd_dma.c
deleted file mode 100644
index 7e7897b..0000000
--- a/src/client/snd_dma.c
+++ /dev/null
@@ -1,1500 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-/*****************************************************************************
- * name: snd_dma.c
- *
- * desc: main control for any streaming sound output device
- *
- * $Archive: /MissionPack/code/client/snd_dma.c $
- *
- *****************************************************************************/
-
-#include "snd_local.h"
-#include "snd_codec.h"
-#include "client.h"
-
-void S_Play_f(void);
-void S_SoundList_f(void);
-void S_Music_f(void);
-
-void S_Update_( void );
-void S_UpdateBackgroundTrack( void );
-void S_Base_StopAllSounds(void);
-void S_Base_StopBackgroundTrack( void );
-
-snd_stream_t *s_backgroundStream = NULL;
-static char s_backgroundLoop[MAX_QPATH];
-//static char s_backgroundMusic[MAX_QPATH]; //TTimo: unused
-
-
-// =======================================================================
-// Internal sound data & structures
-// =======================================================================
-
-// only begin attenuating sound volumes when outside the FULLVOLUME range
-#define SOUND_FULLVOLUME 80
-
-#define SOUND_ATTENUATE 0.0008f
-
-channel_t s_channels[MAX_CHANNELS];
-channel_t loop_channels[MAX_CHANNELS];
-int numLoopChannels;
-
-static int s_soundStarted;
-static qboolean s_soundMuted;
-
-dma_t dma;
-
-static int listener_number;
-static vec3_t listener_origin;
-static vec3_t listener_axis[3];
-
-int s_soundtime; // sample PAIRS
-int s_paintedtime; // sample PAIRS
-
-// MAX_SFX may be larger than MAX_SOUNDS because
-// of custom player sounds
-#define MAX_SFX 4096
-sfx_t s_knownSfx[MAX_SFX];
-int s_numSfx = 0;
-
-#define LOOP_HASH 128
-static sfx_t *sfxHash[LOOP_HASH];
-
-cvar_t *s_testsound;
-cvar_t *s_khz;
-cvar_t *s_show;
-cvar_t *s_mixahead;
-cvar_t *s_mixPreStep;
-
-static loopSound_t loopSounds[MAX_GENTITIES];
-static channel_t *freelist = NULL;
-
-int s_rawend;
-portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES];
-
-
-// ====================================================================
-// User-setable variables
-// ====================================================================
-
-
-void S_Base_SoundInfo(void) {
- Com_Printf("----- Sound Info -----\n" );
- if (!s_soundStarted) {
- Com_Printf ("sound system not started\n");
- } else {
- Com_Printf("%5d stereo\n", dma.channels - 1);
- Com_Printf("%5d samples\n", dma.samples);
- Com_Printf("%5d samplebits\n", dma.samplebits);
- Com_Printf("%5d submission_chunk\n", dma.submission_chunk);
- Com_Printf("%5d speed\n", dma.speed);
- Com_Printf("%p dma buffer\n", dma.buffer);
- if ( s_backgroundStream ) {
- Com_Printf("Background file: %s\n", s_backgroundLoop );
- } else {
- Com_Printf("No background file.\n" );
- }
-
- }
- Com_Printf("----------------------\n" );
-}
-
-/*
-=================
-S_Base_SoundList
-=================
-*/
-void S_Base_SoundList( void ) {
- int i;
- sfx_t *sfx;
- int size, total;
- char type[4][16];
- char mem[2][16];
-
- strcpy(type[0], "16bit");
- strcpy(type[1], "adpcm");
- strcpy(type[2], "daub4");
- strcpy(type[3], "mulaw");
- strcpy(mem[0], "paged out");
- strcpy(mem[1], "resident ");
- total = 0;
- for (sfx=s_knownSfx, i=0 ; isoundLength;
- total += size;
- Com_Printf("%6i[%s] : %s[%s]\n", size, type[sfx->soundCompressionMethod],
- sfx->soundName, mem[sfx->inMemory] );
- }
- Com_Printf ("Total resident: %i\n", total);
- S_DisplayFreeMemory();
-}
-
-
-
-void S_ChannelFree(channel_t *v) {
- v->thesfx = NULL;
- *(channel_t **)v = freelist;
- freelist = (channel_t*)v;
-}
-
-channel_t* S_ChannelMalloc( void ) {
- channel_t *v;
- if (freelist == NULL) {
- return NULL;
- }
- v = freelist;
- freelist = *(channel_t **)freelist;
- v->allocTime = Com_Milliseconds();
- return v;
-}
-
-void S_ChannelSetup( void ) {
- channel_t *p, *q;
-
- // clear all the sounds so they don't
- Com_Memset( s_channels, 0, sizeof( s_channels ) );
-
- p = s_channels;;
- q = p + MAX_CHANNELS;
- while (--q > p) {
- *(channel_t **)q = q-1;
- }
-
- *(channel_t **)q = NULL;
- freelist = p + MAX_CHANNELS - 1;
- Com_DPrintf("Channel memory manager started\n");
-}
-
-
-
-// =======================================================================
-// Load a sound
-// =======================================================================
-
-/*
-================
-return a hash value for the sfx name
-================
-*/
-static long S_HashSFXName(const char *name) {
- int i;
- long hash;
- char letter;
-
- hash = 0;
- i = 0;
- while (name[i] != '\0') {
- letter = tolower(name[i]);
- if (letter =='.') break; // don't include extension
- if (letter =='\\') letter = '/'; // damn path names
- hash+=(long)(letter)*(i+119);
- i++;
- }
- hash &= (LOOP_HASH-1);
- return hash;
-}
-
-/*
-==================
-S_FindName
-
-Will allocate a new sfx if it isn't found
-==================
-*/
-static sfx_t *S_FindName( const char *name ) {
- int i;
- int hash;
-
- sfx_t *sfx;
-
- if (!name) {
- Com_Error (ERR_FATAL, "S_FindName: NULL\n");
- }
- if (!name[0]) {
- Com_Error (ERR_FATAL, "S_FindName: empty name\n");
- }
-
- if (strlen(name) >= MAX_QPATH) {
- Com_Error (ERR_FATAL, "Sound name too long: %s", name);
- }
-
- hash = S_HashSFXName(name);
-
- sfx = sfxHash[hash];
- // see if already loaded
- while (sfx) {
- if (!Q_stricmp(sfx->soundName, name) ) {
- return sfx;
- }
- sfx = sfx->next;
- }
-
- // find a free sfx
- for (i=0 ; i < s_numSfx ; i++) {
- if (!s_knownSfx[i].soundName[0]) {
- break;
- }
- }
-
- if (i == s_numSfx) {
- if (s_numSfx == MAX_SFX) {
- Com_Error (ERR_FATAL, "S_FindName: out of sfx_t");
- }
- s_numSfx++;
- }
-
- sfx = &s_knownSfx[i];
- Com_Memset (sfx, 0, sizeof(*sfx));
- strcpy (sfx->soundName, name);
-
- sfx->next = sfxHash[hash];
- sfxHash[hash] = sfx;
-
- return sfx;
-}
-
-/*
-=================
-S_DefaultSound
-=================
-*/
-void S_DefaultSound( sfx_t *sfx ) {
-
- int i;
-
- sfx->soundLength = 512;
- sfx->soundData = SND_malloc();
- sfx->soundData->next = NULL;
-
-
- for ( i = 0 ; i < sfx->soundLength ; i++ ) {
- sfx->soundData->sndChunk[i] = i;
- }
-}
-
-/*
-===================
-S_DisableSounds
-
-Disables sounds until the next S_BeginRegistration.
-This is called when the hunk is cleared and the sounds
-are no longer valid.
-===================
-*/
-void S_Base_DisableSounds( void ) {
- S_Base_StopAllSounds();
- s_soundMuted = qtrue;
-}
-
-/*
-==================
-S_RegisterSound
-
-Creates a default buzz sound if the file can't be loaded
-==================
-*/
-sfxHandle_t S_Base_RegisterSound( const char *name, qboolean compressed ) {
- sfx_t *sfx;
-
- compressed = qfalse;
- if (!s_soundStarted) {
- return 0;
- }
-
- if ( strlen( name ) >= MAX_QPATH ) {
- Com_Printf( "Sound name exceeds MAX_QPATH\n" );
- return 0;
- }
-
- sfx = S_FindName( name );
- if ( sfx->soundData ) {
- if ( sfx->defaultSound ) {
- Com_Printf( S_COLOR_YELLOW "WARNING: could not find %s - using default\n", sfx->soundName );
- return 0;
- }
- return sfx - s_knownSfx;
- }
-
- sfx->inMemory = qfalse;
- sfx->soundCompressed = compressed;
-
- S_memoryLoad(sfx);
-
- if ( sfx->defaultSound ) {
- Com_Printf( S_COLOR_YELLOW "WARNING: could not find %s - using default\n", sfx->soundName );
- return 0;
- }
-
- return sfx - s_knownSfx;
-}
-
-/*
-=====================
-S_BeginRegistration
-
-=====================
-*/
-void S_Base_BeginRegistration( void ) {
- s_soundMuted = qfalse; // we can play again
-
- if (s_numSfx == 0) {
- SND_setup();
-
- s_numSfx = 0;
- Com_Memset( s_knownSfx, 0, sizeof( s_knownSfx ) );
- Com_Memset(sfxHash, 0, sizeof(sfx_t *)*LOOP_HASH);
-
- S_Base_RegisterSound("sound/feedback/hit.wav", qfalse); // changed to a sound in baseq3
- }
-}
-
-void S_memoryLoad(sfx_t *sfx) {
- // load the sound file
- if ( !S_LoadSound ( sfx ) ) {
-// Com_Printf( S_COLOR_YELLOW "WARNING: couldn't load sound: %s\n", sfx->soundName );
- sfx->defaultSound = qtrue;
- }
- sfx->inMemory = qtrue;
-}
-
-//=============================================================================
-
-/*
-=================
-S_SpatializeOrigin
-
-Used for spatializing s_channels
-=================
-*/
-void S_SpatializeOrigin (vec3_t origin, int master_vol, int *left_vol, int *right_vol)
-{
- vec_t dot;
- vec_t dist;
- vec_t lscale, rscale, scale;
- vec3_t source_vec;
- vec3_t vec;
-
- const float dist_mult = SOUND_ATTENUATE;
-
- // calculate stereo seperation and distance attenuation
- VectorSubtract(origin, listener_origin, source_vec);
-
- dist = VectorNormalize(source_vec);
- dist -= SOUND_FULLVOLUME;
- if (dist < 0)
- dist = 0; // close enough to be at full volume
- dist *= dist_mult; // different attenuation levels
-
- VectorRotate( source_vec, listener_axis, vec );
-
- dot = -vec[1];
-
- if (dma.channels == 1)
- { // no attenuation = no spatialization
- rscale = 1.0;
- lscale = 1.0;
- }
- else
- {
- rscale = 0.5 * (1.0 + dot);
- lscale = 0.5 * (1.0 - dot);
- if ( rscale < 0 ) {
- rscale = 0;
- }
- if ( lscale < 0 ) {
- lscale = 0;
- }
- }
-
- // add in distance effect
- scale = (1.0 - dist) * rscale;
- *right_vol = (master_vol * scale);
- if (*right_vol < 0)
- *right_vol = 0;
-
- scale = (1.0 - dist) * lscale;
- *left_vol = (master_vol * scale);
- if (*left_vol < 0)
- *left_vol = 0;
-}
-
-// =======================================================================
-// Start a sound effect
-// =======================================================================
-
-/*
-====================
-S_StartSound
-
-Validates the parms and ques the sound up
-if pos is NULL, the sound will be dynamically sourced from the entity
-Entchannel 0 will never override a playing sound
-====================
-*/
-void S_Base_StartSound(vec3_t origin, int entityNum, int entchannel, sfxHandle_t sfxHandle ) {
- channel_t *ch;
- sfx_t *sfx;
- int i, oldest, chosen, time;
- int inplay, allowed;
-
- if ( !s_soundStarted || s_soundMuted ) {
- return;
- }
-
- if ( !origin && ( entityNum < 0 || entityNum > MAX_GENTITIES ) ) {
- Com_Error( ERR_DROP, "S_StartSound: bad entitynum %i", entityNum );
- }
-
- if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
- Com_Printf( S_COLOR_YELLOW "S_StartSound: handle %i out of range\n", sfxHandle );
- return;
- }
-
- sfx = &s_knownSfx[ sfxHandle ];
-
- if (sfx->inMemory == qfalse) {
- S_memoryLoad(sfx);
- }
-
- if ( s_show->integer == 1 ) {
- Com_Printf( "%i : %s\n", s_paintedtime, sfx->soundName );
- }
-
- time = Com_Milliseconds();
-
-// Com_Printf("playing %s\n", sfx->soundName);
- // pick a channel to play on
-
- allowed = 4;
- if (entityNum == listener_number) {
- allowed = 8;
- }
-
- ch = s_channels;
- inplay = 0;
- for ( i = 0; i < MAX_CHANNELS ; i++, ch++ ) {
- if (ch[i].entnum == entityNum && ch[i].thesfx == sfx) {
- if (time - ch[i].allocTime < 50) {
-// if (Cvar_VariableValue( "cg_showmiss" )) {
-// Com_Printf("double sound start\n");
-// }
- return;
- }
- inplay++;
- }
- }
-
- if (inplay>allowed) {
- return;
- }
-
- sfx->lastTimeUsed = time;
-
- ch = S_ChannelMalloc(); // entityNum, entchannel);
- if (!ch) {
- ch = s_channels;
-
- oldest = sfx->lastTimeUsed;
- chosen = -1;
- for ( i = 0 ; i < MAX_CHANNELS ; i++, ch++ ) {
- if (ch->entnum != listener_number && ch->entnum == entityNum && ch->allocTimeentchannel != CHAN_ANNOUNCER) {
- oldest = ch->allocTime;
- chosen = i;
- }
- }
- if (chosen == -1) {
- ch = s_channels;
- for ( i = 0 ; i < MAX_CHANNELS ; i++, ch++ ) {
- if (ch->entnum != listener_number && ch->allocTimeentchannel != CHAN_ANNOUNCER) {
- oldest = ch->allocTime;
- chosen = i;
- }
- }
- if (chosen == -1) {
- if (ch->entnum == listener_number) {
- for ( i = 0 ; i < MAX_CHANNELS ; i++, ch++ ) {
- if (ch->allocTimeallocTime;
- chosen = i;
- }
- }
- }
- if (chosen == -1) {
- Com_DPrintf("dropping sound\n");
- return;
- }
- }
- }
- ch = &s_channels[chosen];
- ch->allocTime = sfx->lastTimeUsed;
- }
-
- if (origin) {
- VectorCopy (origin, ch->origin);
- ch->fixed_origin = qtrue;
- } else {
- ch->fixed_origin = qfalse;
- }
-
- ch->master_vol = 127;
- ch->entnum = entityNum;
- ch->thesfx = sfx;
- ch->startSample = START_SAMPLE_IMMEDIATE;
- ch->entchannel = entchannel;
- ch->leftvol = ch->master_vol; // these will get calced at next spatialize
- ch->rightvol = ch->master_vol; // unless the game isn't running
- ch->doppler = qfalse;
-}
-
-
-/*
-==================
-S_StartLocalSound
-==================
-*/
-void S_Base_StartLocalSound( sfxHandle_t sfxHandle, int channelNum ) {
- if ( !s_soundStarted || s_soundMuted ) {
- return;
- }
-
- if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
- Com_Printf( S_COLOR_YELLOW "S_StartLocalSound: handle %i out of range\n", sfxHandle );
- return;
- }
-
- S_Base_StartSound (NULL, listener_number, channelNum, sfxHandle );
-}
-
-
-/*
-==================
-S_ClearSoundBuffer
-
-If we are about to perform file access, clear the buffer
-so sound doesn't stutter.
-==================
-*/
-void S_Base_ClearSoundBuffer( void ) {
- int clear;
-
- if (!s_soundStarted)
- return;
-
- // stop looping sounds
- Com_Memset(loopSounds, 0, MAX_GENTITIES*sizeof(loopSound_t));
- Com_Memset(loop_channels, 0, MAX_CHANNELS*sizeof(channel_t));
- numLoopChannels = 0;
-
- S_ChannelSetup();
-
- s_rawend = 0;
-
- if (dma.samplebits == 8)
- clear = 0x80;
- else
- clear = 0;
-
- SNDDMA_BeginPainting ();
- if (dma.buffer)
- // TTimo: due to a particular bug workaround in linux sound code,
- // have to optionally use a custom C implementation of Com_Memset
- // not affecting win32, we have #define Snd_Memset Com_Memset
- // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=371
- Snd_Memset(dma.buffer, clear, dma.samples * dma.samplebits/8);
- SNDDMA_Submit ();
-}
-
-/*
-==================
-S_StopAllSounds
-==================
-*/
-void S_Base_StopAllSounds(void) {
- if ( !s_soundStarted ) {
- return;
- }
-
- // stop the background music
- S_Base_StopBackgroundTrack();
-
- S_Base_ClearSoundBuffer ();
-}
-
-/*
-==============================================================
-
-continuous looping sounds are added each frame
-
-==============================================================
-*/
-
-void S_Base_StopLoopingSound(int entityNum) {
- loopSounds[entityNum].active = qfalse;
-// loopSounds[entityNum].sfx = 0;
- loopSounds[entityNum].kill = qfalse;
-}
-
-/*
-==================
-S_ClearLoopingSounds
-
-==================
-*/
-void S_Base_ClearLoopingSounds( qboolean killall ) {
- int i;
- for ( i = 0 ; i < MAX_GENTITIES ; i++) {
- if (killall || loopSounds[i].kill == qtrue || (loopSounds[i].sfx && loopSounds[i].sfx->soundLength == 0)) {
- loopSounds[i].kill = qfalse;
- S_Base_StopLoopingSound(i);
- }
- }
- numLoopChannels = 0;
-}
-
-/*
-==================
-S_AddLoopingSound
-
-Called during entity generation for a frame
-Include velocity in case I get around to doing doppler...
-==================
-*/
-void S_Base_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle ) {
- sfx_t *sfx;
-
- if ( !s_soundStarted || s_soundMuted ) {
- return;
- }
-
- if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
- Com_Printf( S_COLOR_YELLOW "S_AddLoopingSound: handle %i out of range\n", sfxHandle );
- return;
- }
-
- sfx = &s_knownSfx[ sfxHandle ];
-
- if (sfx->inMemory == qfalse) {
- S_memoryLoad(sfx);
- }
-
- if ( !sfx->soundLength ) {
- Com_Error( ERR_DROP, "%s has length 0", sfx->soundName );
- }
-
- VectorCopy( origin, loopSounds[entityNum].origin );
- VectorCopy( velocity, loopSounds[entityNum].velocity );
- loopSounds[entityNum].active = qtrue;
- loopSounds[entityNum].kill = qtrue;
- loopSounds[entityNum].doppler = qfalse;
- loopSounds[entityNum].oldDopplerScale = 1.0;
- loopSounds[entityNum].dopplerScale = 1.0;
- loopSounds[entityNum].sfx = sfx;
-
- if (s_doppler->integer && VectorLengthSquared(velocity)>0.0) {
- vec3_t out;
- float lena, lenb;
-
- loopSounds[entityNum].doppler = qtrue;
- lena = DistanceSquared(loopSounds[listener_number].origin, loopSounds[entityNum].origin);
- VectorAdd(loopSounds[entityNum].origin, loopSounds[entityNum].velocity, out);
- lenb = DistanceSquared(loopSounds[listener_number].origin, out);
- if ((loopSounds[entityNum].framenum+1) != cls.framecount) {
- loopSounds[entityNum].oldDopplerScale = 1.0;
- } else {
- loopSounds[entityNum].oldDopplerScale = loopSounds[entityNum].dopplerScale;
- }
- loopSounds[entityNum].dopplerScale = lenb/(lena*100);
- if (loopSounds[entityNum].dopplerScale<=1.0) {
- loopSounds[entityNum].doppler = qfalse; // don't bother doing the math
- } else if (loopSounds[entityNum].dopplerScale>MAX_DOPPLER_SCALE) {
- loopSounds[entityNum].dopplerScale = MAX_DOPPLER_SCALE;
- }
- }
-
- loopSounds[entityNum].framenum = cls.framecount;
-}
-
-/*
-==================
-S_AddLoopingSound
-
-Called during entity generation for a frame
-Include velocity in case I get around to doing doppler...
-==================
-*/
-void S_Base_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfxHandle ) {
- sfx_t *sfx;
-
- if ( !s_soundStarted || s_soundMuted ) {
- return;
- }
-
- if ( sfxHandle < 0 || sfxHandle >= s_numSfx ) {
- Com_Printf( S_COLOR_YELLOW "S_AddRealLoopingSound: handle %i out of range\n", sfxHandle );
- return;
- }
-
- sfx = &s_knownSfx[ sfxHandle ];
-
- if (sfx->inMemory == qfalse) {
- S_memoryLoad(sfx);
- }
-
- if ( !sfx->soundLength ) {
- Com_Error( ERR_DROP, "%s has length 0", sfx->soundName );
- }
- VectorCopy( origin, loopSounds[entityNum].origin );
- VectorCopy( velocity, loopSounds[entityNum].velocity );
- loopSounds[entityNum].sfx = sfx;
- loopSounds[entityNum].active = qtrue;
- loopSounds[entityNum].kill = qfalse;
- loopSounds[entityNum].doppler = qfalse;
-}
-
-
-
-/*
-==================
-S_AddLoopSounds
-
-Spatialize all of the looping sounds.
-All sounds are on the same cycle, so any duplicates can just
-sum up the channel multipliers.
-==================
-*/
-void S_AddLoopSounds (void) {
- int i, j, time;
- int left_total, right_total, left, right;
- channel_t *ch;
- loopSound_t *loop, *loop2;
- static int loopFrame;
-
-
- numLoopChannels = 0;
-
- time = Com_Milliseconds();
-
- loopFrame++;
- for ( i = 0 ; i < MAX_GENTITIES ; i++) {
- loop = &loopSounds[i];
- if ( !loop->active || loop->mergeFrame == loopFrame ) {
- continue; // already merged into an earlier sound
- }
-
- if (loop->kill) {
- S_SpatializeOrigin( loop->origin, 127, &left_total, &right_total); // 3d
- } else {
- S_SpatializeOrigin( loop->origin, 90, &left_total, &right_total); // sphere
- }
-
- loop->sfx->lastTimeUsed = time;
-
- for (j=(i+1); j< MAX_GENTITIES ; j++) {
- loop2 = &loopSounds[j];
- if ( !loop2->active || loop2->doppler || loop2->sfx != loop->sfx) {
- continue;
- }
- loop2->mergeFrame = loopFrame;
-
- if (loop2->kill) {
- S_SpatializeOrigin( loop2->origin, 127, &left, &right); // 3d
- } else {
- S_SpatializeOrigin( loop2->origin, 90, &left, &right); // sphere
- }
-
- loop2->sfx->lastTimeUsed = time;
- left_total += left;
- right_total += right;
- }
- if (left_total == 0 && right_total == 0) {
- continue; // not audible
- }
-
- // allocate a channel
- ch = &loop_channels[numLoopChannels];
-
- if (left_total > 255) {
- left_total = 255;
- }
- if (right_total > 255) {
- right_total = 255;
- }
-
- ch->master_vol = 127;
- ch->leftvol = left_total;
- ch->rightvol = right_total;
- ch->thesfx = loop->sfx;
- ch->doppler = loop->doppler;
- ch->dopplerScale = loop->dopplerScale;
- ch->oldDopplerScale = loop->oldDopplerScale;
- numLoopChannels++;
- if (numLoopChannels == MAX_CHANNELS) {
- return;
- }
- }
-}
-
-//=============================================================================
-
-/*
-=================
-S_ByteSwapRawSamples
-
-If raw data has been loaded in little endien binary form, this must be done.
-If raw data was calculated, as with ADPCM, this should not be called.
-=================
-*/
-void S_ByteSwapRawSamples( int samples, int width, int s_channels, const byte *data ) {
- int i;
-
- if ( width != 2 ) {
- return;
- }
- if ( LittleShort( 256 ) == 256 ) {
- return;
- }
-
- if ( s_channels == 2 ) {
- samples <<= 1;
- }
- for ( i = 0 ; i < samples ; i++ ) {
- ((short *)data)[i] = LittleShort( ((short *)data)[i] );
- }
-}
-
-portable_samplepair_t *S_GetRawSamplePointer( void ) {
- return s_rawsamples;
-}
-
-/*
-============
-S_RawSamples
-
-Music streaming
-============
-*/
-void S_Base_RawSamples( int samples, int rate, int width, int s_channels, const byte *data, float volume ) {
- int i;
- int src, dst;
- float scale;
- int intVolume;
-
- if ( !s_soundStarted || s_soundMuted ) {
- return;
- }
-
- intVolume = 256 * volume;
-
- if ( s_rawend < s_soundtime ) {
- Com_DPrintf( "S_RawSamples: resetting minimum: %i < %i\n", s_rawend, s_soundtime );
- s_rawend = s_soundtime;
- }
-
- scale = (float)rate / dma.speed;
-
-//Com_Printf ("%i < %i < %i\n", s_soundtime, s_paintedtime, s_rawend);
- if (s_channels == 2 && width == 2)
- {
- if (scale == 1.0)
- { // optimized case
- for (i=0 ; i= samples)
- break;
- dst = s_rawend&(MAX_RAW_SAMPLES-1);
- s_rawend++;
- s_rawsamples[dst].left = ((short *)data)[src*2] * intVolume;
- s_rawsamples[dst].right = ((short *)data)[src*2+1] * intVolume;
- }
- }
- }
- else if (s_channels == 1 && width == 2)
- {
- for (i=0 ; ; i++)
- {
- src = i*scale;
- if (src >= samples)
- break;
- dst = s_rawend&(MAX_RAW_SAMPLES-1);
- s_rawend++;
- s_rawsamples[dst].left = ((short *)data)[src] * intVolume;
- s_rawsamples[dst].right = ((short *)data)[src] * intVolume;
- }
- }
- else if (s_channels == 2 && width == 1)
- {
- intVolume *= 256;
-
- for (i=0 ; ; i++)
- {
- src = i*scale;
- if (src >= samples)
- break;
- dst = s_rawend&(MAX_RAW_SAMPLES-1);
- s_rawend++;
- s_rawsamples[dst].left = ((char *)data)[src*2] * intVolume;
- s_rawsamples[dst].right = ((char *)data)[src*2+1] * intVolume;
- }
- }
- else if (s_channels == 1 && width == 1)
- {
- intVolume *= 256;
-
- for (i=0 ; ; i++)
- {
- src = i*scale;
- if (src >= samples)
- break;
- dst = s_rawend&(MAX_RAW_SAMPLES-1);
- s_rawend++;
- s_rawsamples[dst].left = (((byte *)data)[src]-128) * intVolume;
- s_rawsamples[dst].right = (((byte *)data)[src]-128) * intVolume;
- }
- }
-
- if ( s_rawend > s_soundtime + MAX_RAW_SAMPLES ) {
- Com_DPrintf( "S_RawSamples: overflowed %i > %i\n", s_rawend, s_soundtime );
- }
-}
-
-//=============================================================================
-
-/*
-=====================
-S_UpdateEntityPosition
-
-let the sound system know where an entity currently is
-======================
-*/
-void S_Base_UpdateEntityPosition( int entityNum, const vec3_t origin ) {
- if ( entityNum < 0 || entityNum > MAX_GENTITIES ) {
- Com_Error( ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum );
- }
- VectorCopy( origin, loopSounds[entityNum].origin );
-}
-
-
-/*
-============
-S_Respatialize
-
-Change the volumes of all the playing sounds for changes in their positions
-============
-*/
-void S_Base_Respatialize( int entityNum, const vec3_t head, vec3_t axis[3], int inwater ) {
- int i;
- channel_t *ch;
- vec3_t origin;
-
- if ( !s_soundStarted || s_soundMuted ) {
- return;
- }
-
- listener_number = entityNum;
- VectorCopy(head, listener_origin);
- VectorCopy(axis[0], listener_axis[0]);
- VectorCopy(axis[1], listener_axis[1]);
- VectorCopy(axis[2], listener_axis[2]);
-
- // update spatialization for dynamic sounds
- ch = s_channels;
- for ( i = 0 ; i < MAX_CHANNELS ; i++, ch++ ) {
- if ( !ch->thesfx ) {
- continue;
- }
- // anything coming from the view entity will always be full volume
- if (ch->entnum == listener_number) {
- ch->leftvol = ch->master_vol;
- ch->rightvol = ch->master_vol;
- } else {
- if (ch->fixed_origin) {
- VectorCopy( ch->origin, origin );
- } else {
- VectorCopy( loopSounds[ ch->entnum ].origin, origin );
- }
-
- S_SpatializeOrigin (origin, ch->master_vol, &ch->leftvol, &ch->rightvol);
- }
- }
-
- // add loopsounds
- S_AddLoopSounds ();
-}
-
-
-/*
-========================
-S_ScanChannelStarts
-
-Returns qtrue if any new sounds were started since the last mix
-========================
-*/
-qboolean S_ScanChannelStarts( void ) {
- channel_t *ch;
- int i;
- qboolean newSamples;
-
- newSamples = qfalse;
- ch = s_channels;
-
- for (i=0; ithesfx ) {
- continue;
- }
- // if this channel was just started this frame,
- // set the sample count to it begins mixing
- // into the very first sample
- if ( ch->startSample == START_SAMPLE_IMMEDIATE ) {
- ch->startSample = s_paintedtime;
- newSamples = qtrue;
- continue;
- }
-
- // if it is completely finished by now, clear it
- if ( ch->startSample + (ch->thesfx->soundLength) <= s_paintedtime ) {
- S_ChannelFree(ch);
- }
- }
-
- return newSamples;
-}
-
-/*
-============
-S_Update
-
-Called once each time through the main loop
-============
-*/
-void S_Base_Update( void ) {
- int i;
- int total;
- channel_t *ch;
-
- if ( !s_soundStarted || s_soundMuted ) {
-// Com_DPrintf ("not started or muted\n");
- return;
- }
-
- //
- // debugging output
- //
- if ( s_show->integer == 2 ) {
- total = 0;
- ch = s_channels;
- for (i=0 ; ithesfx && (ch->leftvol || ch->rightvol) ) {
- Com_Printf ("%d %d %s\n", ch->leftvol, ch->rightvol, ch->thesfx->soundName);
- total++;
- }
- }
-
- Com_Printf ("----(%i)---- painted: %i\n", total, s_paintedtime);
- }
-
- // add raw data from streamed samples
- S_UpdateBackgroundTrack();
-
- // mix some sound
- S_Update_();
-}
-
-void S_GetSoundtime(void)
-{
- int samplepos;
- static int buffers;
- static int oldsamplepos;
- int fullsamples;
-
- fullsamples = dma.samples / dma.channels;
-
- if( CL_VideoRecording( ) )
- {
- s_soundtime += (int)ceil( dma.speed / cl_aviFrameRate->value );
- return;
- }
-
- // it is possible to miscount buffers if it has wrapped twice between
- // calls to S_Update. Oh well.
- samplepos = SNDDMA_GetDMAPos();
- if (samplepos < oldsamplepos)
- {
- buffers++; // buffer wrapped
-
- if (s_paintedtime > 0x40000000)
- { // time to chop things off to avoid 32 bit limits
- buffers = 0;
- s_paintedtime = fullsamples;
- S_Base_StopAllSounds ();
- }
- }
- oldsamplepos = samplepos;
-
- s_soundtime = buffers*fullsamples + samplepos/dma.channels;
-
-#if 0
-// check to make sure that we haven't overshot
- if (s_paintedtime < s_soundtime)
- {
- Com_DPrintf ("S_Update_ : overflow\n");
- s_paintedtime = s_soundtime;
- }
-#endif
-
- if ( dma.submission_chunk < 256 ) {
- s_paintedtime = s_soundtime + s_mixPreStep->value * dma.speed;
- } else {
- s_paintedtime = s_soundtime + dma.submission_chunk;
- }
-}
-
-
-void S_Update_(void) {
- unsigned endtime;
- int samps;
- static float lastTime = 0.0f;
- float ma, op;
- float thisTime, sane;
- static int ot = -1;
-
- if ( !s_soundStarted || s_soundMuted ) {
- return;
- }
-
- thisTime = Com_Milliseconds();
-
- // Updates s_soundtime
- S_GetSoundtime();
-
- if (s_soundtime == ot) {
- return;
- }
- ot = s_soundtime;
-
- // clear any sound effects that end before the current time,
- // and start any new sounds
- S_ScanChannelStarts();
-
- sane = thisTime - lastTime;
- if (sane<11) {
- sane = 11; // 85hz
- }
-
- ma = s_mixahead->value * dma.speed;
- op = s_mixPreStep->value + sane*dma.speed*0.01;
-
- if (op < ma) {
- ma = op;
- }
-
- // mix ahead of current position
- endtime = s_soundtime + ma;
-
- // mix to an even submission block size
- endtime = (endtime + dma.submission_chunk-1)
- & ~(dma.submission_chunk-1);
-
- // never mix more than the complete buffer
- samps = dma.samples >> (dma.channels-1);
- if (endtime - s_soundtime > samps)
- endtime = s_soundtime + samps;
-
-
-
- SNDDMA_BeginPainting ();
-
- S_PaintChannels (endtime);
-
- SNDDMA_Submit ();
-
- lastTime = thisTime;
-}
-
-
-
-/*
-===============================================================================
-
-background music functions
-
-===============================================================================
-*/
-
-/*
-======================
-S_StopBackgroundTrack
-======================
-*/
-void S_Base_StopBackgroundTrack( void ) {
- if(!s_backgroundStream)
- return;
- S_CodecCloseStream(s_backgroundStream);
- s_backgroundStream = NULL;
- s_rawend = 0;
-}
-
-/*
-======================
-S_StartBackgroundTrack
-======================
-*/
-void S_Base_StartBackgroundTrack( const char *intro, const char *loop ){
- if ( !intro ) {
- intro = "";
- }
- if ( !loop || !loop[0] ) {
- loop = intro;
- }
- Com_DPrintf( "S_StartBackgroundTrack( %s, %s )\n", intro, loop );
-
- if ( !intro[0] ) {
- return;
- }
-
- if( !loop ) {
- s_backgroundLoop[0] = 0;
- } else {
- Q_strncpyz( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) );
- }
-
- // close the background track, but DON'T reset s_rawend
- // if restarting the same back ground track
- if(s_backgroundStream)
- {
- S_CodecCloseStream(s_backgroundStream);
- s_backgroundStream = NULL;
- }
-
- // Open stream
- s_backgroundStream = S_CodecOpenStream(intro);
- if(!s_backgroundStream) {
- Com_Printf( S_COLOR_YELLOW "WARNING: couldn't open music file %s\n", intro );
- return;
- }
-
- if(s_backgroundStream->info.channels != 2 || s_backgroundStream->info.rate != 22050) {
- Com_Printf(S_COLOR_YELLOW "WARNING: music file %s is not 22k stereo\n", intro );
- }
-}
-
-/*
-======================
-S_UpdateBackgroundTrack
-======================
-*/
-void S_UpdateBackgroundTrack( void ) {
- int bufferSamples;
- int fileSamples;
- byte raw[30000]; // just enough to fit in a mac stack frame
- int fileBytes;
- int r;
- static float musicVolume = 0.5f;
-
- if(!s_backgroundStream) {
- return;
- }
-
- // graeme see if this is OK
- musicVolume = (musicVolume + (s_musicVolume->value * 2))/4.0f;
-
- // don't bother playing anything if musicvolume is 0
- if ( musicVolume <= 0 ) {
- return;
- }
-
- // see how many samples should be copied into the raw buffer
- if ( s_rawend < s_soundtime ) {
- s_rawend = s_soundtime;
- }
-
- while ( s_rawend < s_soundtime + MAX_RAW_SAMPLES ) {
- bufferSamples = MAX_RAW_SAMPLES - (s_rawend - s_soundtime);
-
- // decide how much data needs to be read from the file
- fileSamples = bufferSamples * s_backgroundStream->info.rate / dma.speed;
-
- // our max buffer size
- fileBytes = fileSamples * (s_backgroundStream->info.width * s_backgroundStream->info.channels);
- if ( fileBytes > sizeof(raw) ) {
- fileBytes = sizeof(raw);
- fileSamples = fileBytes / (s_backgroundStream->info.width * s_backgroundStream->info.channels);
- }
-
- // Read
- r = S_CodecReadStream(s_backgroundStream, fileBytes, raw);
- if(r < fileBytes)
- {
- fileBytes = r;
- fileSamples = r / (s_backgroundStream->info.width * s_backgroundStream->info.channels);
- }
-
- if(r > 0)
- {
- // add to raw buffer
- S_Base_RawSamples( fileSamples, s_backgroundStream->info.rate,
- s_backgroundStream->info.width, s_backgroundStream->info.channels, raw, musicVolume );
- }
- else
- {
- // loop
- if(s_backgroundLoop[0])
- {
- S_CodecCloseStream(s_backgroundStream);
- s_backgroundStream = NULL;
- S_Base_StartBackgroundTrack( s_backgroundLoop, s_backgroundLoop );
- if(!s_backgroundStream)
- return;
- }
- else
- {
- S_Base_StopBackgroundTrack();
- return;
- }
- }
-
- }
-}
-
-
-/*
-======================
-S_FreeOldestSound
-======================
-*/
-
-void S_FreeOldestSound( void ) {
- int i, oldest, used;
- sfx_t *sfx;
- sndBuffer *buffer, *nbuffer;
-
- oldest = Com_Milliseconds();
- used = 0;
-
- for (i=1 ; i < s_numSfx ; i++) {
- sfx = &s_knownSfx[i];
- if (sfx->inMemory && sfx->lastTimeUsedlastTimeUsed;
- }
- }
-
- sfx = &s_knownSfx[used];
-
- Com_DPrintf("S_FreeOldestSound: freeing sound %s\n", sfx->soundName);
-
- buffer = sfx->soundData;
- while(buffer != NULL) {
- nbuffer = buffer->next;
- SND_free(buffer);
- buffer = nbuffer;
- }
- sfx->inMemory = qfalse;
- sfx->soundData = NULL;
-}
-
-// =======================================================================
-// Shutdown sound engine
-// =======================================================================
-
-void S_Base_Shutdown( void ) {
- if ( !s_soundStarted ) {
- return;
- }
-
- SNDDMA_Shutdown();
-
- s_soundStarted = 0;
-
- Cmd_RemoveCommand("s_info");
-}
-
-/*
-================
-S_Init
-================
-*/
-qboolean S_Base_Init( soundInterface_t *si ) {
- qboolean r;
-
- if( !si ) {
- return qfalse;
- }
-
- s_khz = Cvar_Get ("s_khz", "22", CVAR_ARCHIVE);
- s_mixahead = Cvar_Get ("s_mixahead", "0.2", CVAR_ARCHIVE);
- s_mixPreStep = Cvar_Get ("s_mixPreStep", "0.05", CVAR_ARCHIVE);
- s_show = Cvar_Get ("s_show", "0", CVAR_CHEAT);
- s_testsound = Cvar_Get ("s_testsound", "0", CVAR_CHEAT);
-
- r = SNDDMA_Init();
-
- if ( r ) {
- s_soundStarted = 1;
- s_soundMuted = 1;
-// s_numSfx = 0;
-
- Com_Memset(sfxHash, 0, sizeof(sfx_t *)*LOOP_HASH);
-
- s_soundtime = 0;
- s_paintedtime = 0;
-
- S_Base_StopAllSounds( );
- } else {
- return qfalse;
- }
-
- si->Shutdown = S_Base_Shutdown;
- si->StartSound = S_Base_StartSound;
- si->StartLocalSound = S_Base_StartLocalSound;
- si->StartBackgroundTrack = S_Base_StartBackgroundTrack;
- si->StopBackgroundTrack = S_Base_StopBackgroundTrack;
- si->RawSamples = S_Base_RawSamples;
- si->StopAllSounds = S_Base_StopAllSounds;
- si->ClearLoopingSounds = S_Base_ClearLoopingSounds;
- si->AddLoopingSound = S_Base_AddLoopingSound;
- si->AddRealLoopingSound = S_Base_AddRealLoopingSound;
- si->StopLoopingSound = S_Base_StopLoopingSound;
- si->Respatialize = S_Base_Respatialize;
- si->UpdateEntityPosition = S_Base_UpdateEntityPosition;
- si->Update = S_Base_Update;
- si->DisableSounds = S_Base_DisableSounds;
- si->BeginRegistration = S_Base_BeginRegistration;
- si->RegisterSound = S_Base_RegisterSound;
- si->ClearSoundBuffer = S_Base_ClearSoundBuffer;
- si->SoundInfo = S_Base_SoundInfo;
- si->SoundList = S_Base_SoundList;
-
- return qtrue;
-}
diff --git a/src/client/snd_local.h b/src/client/snd_local.h
deleted file mode 100644
index 45a5779..0000000
--- a/src/client/snd_local.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// snd_local.h -- private sound definations
-
-
-#include "../qcommon/q_shared.h"
-#include "../qcommon/qcommon.h"
-#include "snd_public.h"
-
-#define PAINTBUFFER_SIZE 4096 // this is in samples
-
-#define SND_CHUNK_SIZE 1024 // samples
-#define SND_CHUNK_SIZE_FLOAT (SND_CHUNK_SIZE/2) // floats
-#define SND_CHUNK_SIZE_BYTE (SND_CHUNK_SIZE*2) // floats
-
-typedef struct {
- int left; // the final values will be clamped to +/- 0x00ffff00 and shifted down
- int right;
-} portable_samplepair_t;
-
-typedef struct adpcm_state {
- short sample; /* Previous output value */
- char index; /* Index into stepsize table */
-} adpcm_state_t;
-
-typedef struct sndBuffer_s {
- short sndChunk[SND_CHUNK_SIZE];
- struct sndBuffer_s *next;
- int size;
- adpcm_state_t adpcm;
-} sndBuffer;
-
-typedef struct sfx_s {
- sndBuffer *soundData;
- qboolean defaultSound; // couldn't be loaded, so use buzz
- qboolean inMemory; // not in Memory
- qboolean soundCompressed; // not in Memory
- int soundCompressionMethod;
- int soundLength;
- char soundName[MAX_QPATH];
- int lastTimeUsed;
- struct sfx_s *next;
-} sfx_t;
-
-typedef struct {
- int channels;
- int samples; // mono samples in buffer
- int submission_chunk; // don't mix less than this #
- int samplebits;
- int speed;
- byte *buffer;
-} dma_t;
-
-#define START_SAMPLE_IMMEDIATE 0x7fffffff
-
-#define MAX_DOPPLER_SCALE 50.0f //arbitrary
-
-typedef struct loopSound_s {
- vec3_t origin;
- vec3_t velocity;
- sfx_t *sfx;
- int mergeFrame;
- qboolean active;
- qboolean kill;
- qboolean doppler;
- float dopplerScale;
- float oldDopplerScale;
- int framenum;
-} loopSound_t;
-
-typedef struct
-{
- int allocTime;
- int startSample; // START_SAMPLE_IMMEDIATE = set immediately on next mix
- int entnum; // to allow overriding a specific sound
- int entchannel; // to allow overriding a specific sound
- int leftvol; // 0-255 volume after spatialization
- int rightvol; // 0-255 volume after spatialization
- int master_vol; // 0-255 volume before spatialization
- float dopplerScale;
- float oldDopplerScale;
- vec3_t origin; // only use if fixed_origin is set
- qboolean fixed_origin; // use origin instead of fetching entnum's origin
- sfx_t *thesfx; // sfx structure
- qboolean doppler;
-} channel_t;
-
-
-#define WAV_FORMAT_PCM 1
-
-
-typedef struct {
- int format;
- int rate;
- int width;
- int channels;
- int samples;
- int dataofs; // chunk starts this many bytes from file start
-} wavinfo_t;
-
-// Interface between Q3 sound "api" and the sound backend
-typedef struct
-{
- void (*Shutdown)(void);
- void (*StartSound)( vec3_t origin, int entnum, int entchannel, sfxHandle_t sfx );
- void (*StartLocalSound)( sfxHandle_t sfx, int channelNum );
- void (*StartBackgroundTrack)( const char *intro, const char *loop );
- void (*StopBackgroundTrack)( void );
- void (*RawSamples)(int samples, int rate, int width, int channels, const byte *data, float volume);
- void (*StopAllSounds)( void );
- void (*ClearLoopingSounds)( qboolean killall );
- void (*AddLoopingSound)( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
- void (*AddRealLoopingSound)( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
- void (*StopLoopingSound)(int entityNum );
- void (*Respatialize)( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
- void (*UpdateEntityPosition)( int entityNum, const vec3_t origin );
- void (*Update)( void );
- void (*DisableSounds)( void );
- void (*BeginRegistration)( void );
- sfxHandle_t (*RegisterSound)( const char *sample, qboolean compressed );
- void (*ClearSoundBuffer)( void );
- void (*SoundInfo)( void );
- void (*SoundList)( void );
-} soundInterface_t;
-
-
-/*
-====================================================================
-
- SYSTEM SPECIFIC FUNCTIONS
-
-====================================================================
-*/
-
-// initializes cycling through a DMA buffer and returns information on it
-qboolean SNDDMA_Init(void);
-
-// gets the current DMA position
-int SNDDMA_GetDMAPos(void);
-
-// shutdown the DMA xfer.
-void SNDDMA_Shutdown(void);
-
-void SNDDMA_BeginPainting (void);
-
-void SNDDMA_Submit(void);
-
-//====================================================================
-
-#define MAX_CHANNELS 96
-
-extern channel_t s_channels[MAX_CHANNELS];
-extern channel_t loop_channels[MAX_CHANNELS];
-extern int numLoopChannels;
-
-extern int s_paintedtime;
-extern int s_rawend;
-extern vec3_t listener_forward;
-extern vec3_t listener_right;
-extern vec3_t listener_up;
-extern dma_t dma;
-
-#define MAX_RAW_SAMPLES 16384
-extern portable_samplepair_t s_rawsamples[MAX_RAW_SAMPLES];
-
-extern cvar_t *s_volume;
-extern cvar_t *s_musicVolume;
-extern cvar_t *s_doppler;
-
-extern cvar_t *s_testsound;
-
-qboolean S_LoadSound( sfx_t *sfx );
-
-void SND_free(sndBuffer *v);
-sndBuffer* SND_malloc( void );
-void SND_setup( void );
-
-void S_PaintChannels(int endtime);
-
-void S_memoryLoad(sfx_t *sfx);
-portable_samplepair_t *S_GetRawSamplePointer( void );
-
-// spatializes a channel
-void S_Spatialize(channel_t *ch);
-
-// adpcm functions
-int S_AdpcmMemoryNeeded( const wavinfo_t *info );
-void S_AdpcmEncodeSound( sfx_t *sfx, short *samples );
-void S_AdpcmGetSamples(sndBuffer *chunk, short *to);
-
-// wavelet function
-
-#define SENTINEL_MULAW_ZERO_RUN 127
-#define SENTINEL_MULAW_FOUR_BIT_RUN 126
-
-void S_FreeOldestSound( void );
-
-#define NXStream byte
-
-void encodeWavelet(sfx_t *sfx, short *packets);
-void decodeWavelet( sndBuffer *stream, short *packets);
-
-void encodeMuLaw( sfx_t *sfx, short *packets);
-extern short mulawToShort[256];
-
-extern short *sfxScratchBuffer;
-extern sfx_t *sfxScratchPointer;
-extern int sfxScratchIndex;
-
-qboolean S_Base_Init( soundInterface_t *si );
-
-// OpenAL stuff
-typedef enum
-{
- SRCPRI_AMBIENT = 0, // Ambient sound effects
- SRCPRI_ENTITY, // Entity sound effects
- SRCPRI_ONESHOT, // One-shot sounds
- SRCPRI_LOCAL, // Local sounds
- SRCPRI_STREAM // Streams (music, cutscenes)
-} alSrcPriority_t;
-
-typedef int srcHandle_t;
-
-qboolean S_AL_Init( soundInterface_t *si );
diff --git a/src/client/snd_main.c b/src/client/snd_main.c
deleted file mode 100644
index eb31f2d..0000000
--- a/src/client/snd_main.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Foobar; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "client.h"
-#include "snd_codec.h"
-#include "snd_local.h"
-#include "snd_public.h"
-
-cvar_t *s_volume;
-cvar_t *s_musicVolume;
-cvar_t *s_doppler;
-cvar_t *s_backend;
-
-static soundInterface_t si;
-
-/*
-=================
-S_ValidateInterface
-=================
-*/
-static qboolean S_ValidSoundInterface( soundInterface_t *si )
-{
- if( !si->Shutdown ) return qfalse;
- if( !si->StartSound ) return qfalse;
- if( !si->StartLocalSound ) return qfalse;
- if( !si->StartBackgroundTrack ) return qfalse;
- if( !si->StopBackgroundTrack ) return qfalse;
- if( !si->RawSamples ) return qfalse;
- if( !si->StopAllSounds ) return qfalse;
- if( !si->ClearLoopingSounds ) return qfalse;
- if( !si->AddLoopingSound ) return qfalse;
- if( !si->AddRealLoopingSound ) return qfalse;
- if( !si->StopLoopingSound ) return qfalse;
- if( !si->Respatialize ) return qfalse;
- if( !si->UpdateEntityPosition ) return qfalse;
- if( !si->Update ) return qfalse;
- if( !si->DisableSounds ) return qfalse;
- if( !si->BeginRegistration ) return qfalse;
- if( !si->RegisterSound ) return qfalse;
- if( !si->ClearSoundBuffer ) return qfalse;
- if( !si->SoundInfo ) return qfalse;
- if( !si->SoundList ) return qfalse;
-
- return qtrue;
-}
-
-/*
-=================
-S_StartSound
-=================
-*/
-void S_StartSound( vec3_t origin, int entnum, int entchannel, sfxHandle_t sfx )
-{
- if( si.StartSound ) {
- si.StartSound( origin, entnum, entchannel, sfx );
- }
-}
-
-/*
-=================
-S_StartLocalSound
-=================
-*/
-void S_StartLocalSound( sfxHandle_t sfx, int channelNum )
-{
- if( si.StartLocalSound ) {
- si.StartLocalSound( sfx, channelNum );
- }
-}
-
-/*
-=================
-S_StartBackgroundTrack
-=================
-*/
-void S_StartBackgroundTrack( const char *intro, const char *loop )
-{
- if( si.StartBackgroundTrack ) {
- si.StartBackgroundTrack( intro, loop );
- }
-}
-
-/*
-=================
-S_StopBackgroundTrack
-=================
-*/
-void S_StopBackgroundTrack( void )
-{
- if( si.StopBackgroundTrack ) {
- si.StopBackgroundTrack( );
- }
-}
-
-/*
-=================
-S_RawSamples
-=================
-*/
-void S_RawSamples (int samples, int rate, int width, int channels,
- const byte *data, float volume)
-{
- if( si.RawSamples ) {
- si.RawSamples( samples, rate, width, channels, data, volume );
- }
-}
-
-/*
-=================
-S_StopAllSounds
-=================
-*/
-void S_StopAllSounds( void )
-{
- if( si.StopAllSounds ) {
- si.StopAllSounds( );
- }
-}
-
-/*
-=================
-S_ClearLoopingSounds
-=================
-*/
-void S_ClearLoopingSounds( qboolean killall )
-{
- if( si.ClearLoopingSounds ) {
- si.ClearLoopingSounds( killall );
- }
-}
-
-/*
-=================
-S_AddLoopingSound
-=================
-*/
-void S_AddLoopingSound( int entityNum, const vec3_t origin,
- const vec3_t velocity, sfxHandle_t sfx )
-{
- if( si.AddLoopingSound ) {
- si.AddLoopingSound( entityNum, origin, velocity, sfx );
- }
-}
-
-/*
-=================
-S_AddRealLoopingSound
-=================
-*/
-void S_AddRealLoopingSound( int entityNum, const vec3_t origin,
- const vec3_t velocity, sfxHandle_t sfx )
-{
- if( si.AddRealLoopingSound ) {
- si.AddRealLoopingSound( entityNum, origin, velocity, sfx );
- }
-}
-
-/*
-=================
-S_StopLoopingSound
-=================
-*/
-void S_StopLoopingSound( int entityNum )
-{
- if( si.StopLoopingSound ) {
- si.StopLoopingSound( entityNum );
- }
-}
-
-/*
-=================
-S_Respatialize
-=================
-*/
-void S_Respatialize( int entityNum, const vec3_t origin,
- vec3_t axis[3], int inwater )
-{
- if( si.Respatialize ) {
- si.Respatialize( entityNum, origin, axis, inwater );
- }
-}
-
-/*
-=================
-S_UpdateEntityPosition
-=================
-*/
-void S_UpdateEntityPosition( int entityNum, const vec3_t origin )
-{
- if( si.UpdateEntityPosition ) {
- si.UpdateEntityPosition( entityNum, origin );
- }
-}
-
-/*
-=================
-S_Update
-=================
-*/
-void S_Update( void )
-{
- if( si.Update ) {
- si.Update( );
- }
-}
-
-/*
-=================
-S_DisableSounds
-=================
-*/
-void S_DisableSounds( void )
-{
- if( si.DisableSounds ) {
- si.DisableSounds( );
- }
-}
-
-/*
-=================
-S_BeginRegistration
-=================
-*/
-void S_BeginRegistration( void )
-{
- if( si.BeginRegistration ) {
- si.BeginRegistration( );
- }
-}
-
-/*
-=================
-S_RegisterSound
-=================
-*/
-sfxHandle_t S_RegisterSound( const char *sample, qboolean compressed )
-{
- if( si.RegisterSound ) {
- return si.RegisterSound( sample, compressed );
- } else {
- return 0;
- }
-}
-
-/*
-=================
-S_ClearSoundBuffer
-=================
-*/
-void S_ClearSoundBuffer( void )
-{
- if( si.ClearSoundBuffer ) {
- si.ClearSoundBuffer( );
- }
-}
-
-/*
-=================
-S_SoundInfo
-=================
-*/
-void S_SoundInfo( void )
-{
- if( si.SoundInfo ) {
- si.SoundInfo( );
- }
-}
-
-/*
-=================
-S_SoundList
-=================
-*/
-void S_SoundList( void )
-{
- if( si.SoundList ) {
- si.SoundList( );
- }
-}
-
-//=============================================================================
-
-/*
-=================
-S_Play_f
-=================
-*/
-void S_Play_f( void ) {
- int i;
- sfxHandle_t h;
- char name[256];
-
- if( !si.RegisterSound || !si.StartLocalSound ) {
- return;
- }
-
- i = 1;
- while ( i [loopfile]\n");
- return;
- }
-
-}
-
-//=============================================================================
-
-/*
-=================
-S_Init
-=================
-*/
-void S_Init( void )
-{
- cvar_t *cv;
- qboolean started = qfalse;
-
- Com_Printf( "------ Initializing Sound ------\n" );
-
- s_volume = Cvar_Get( "s_volume", "0.8", CVAR_ARCHIVE );
- s_musicVolume = Cvar_Get( "s_musicvolume", "0.25", CVAR_ARCHIVE );
- s_doppler = Cvar_Get( "s_doppler", "1", CVAR_ARCHIVE );
- s_backend = Cvar_Get( "s_backend", "", CVAR_ROM );
-
- cv = Cvar_Get( "s_initsound", "1", 0 );
- if( !cv->integer ) {
- Com_Printf( "Sound disabled.\n" );
- } else {
-
- S_CodecInit( );
-
- Cmd_AddCommand( "play", S_Play_f );
- Cmd_AddCommand( "music", S_Music_f );
- Cmd_AddCommand( "s_list", S_SoundList );
- Cmd_AddCommand( "s_stop", S_StopAllSounds );
- Cmd_AddCommand( "s_info", S_SoundInfo );
-
- cv = Cvar_Get( "s_useOpenAL", "0", CVAR_ARCHIVE );
- if( cv->integer ) {
- //OpenAL
- started = S_AL_Init( &si );
- Cvar_Set( "s_backend", "OpenAL" );
- }
-
- if( !started ) {
- started = S_Base_Init( &si );
- Cvar_Set( "s_backend", "base" );
- }
-
- if( started ) {
- if( !S_ValidSoundInterface( &si ) ) {
- Com_Error( ERR_FATAL, "Sound interface invalid." );
- }
-
- S_SoundInfo( );
- Com_Printf( "Sound initialization successful.\n" );
- } else {
- Com_Printf( "Sound initialization failed.\n" );
- }
- }
-
- Com_Printf( "--------------------------------\n");
-}
-
-/*
-=================
-S_Shutdown
-=================
-*/
-void S_Shutdown( void )
-{
- if( si.Shutdown ) {
- si.Shutdown( );
- }
-
- Com_Memset( &si, 0, sizeof( soundInterface_t ) );
-
- Cmd_RemoveCommand( "play" );
- Cmd_RemoveCommand( "music");
- Cmd_RemoveCommand( "s_list" );
- Cmd_RemoveCommand( "s_stop" );
- Cmd_RemoveCommand( "s_info" );
-
- S_CodecShutdown( );
-}
-
diff --git a/src/client/snd_mem.c b/src/client/snd_mem.c
deleted file mode 100644
index decab20..0000000
--- a/src/client/snd_mem.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-/*****************************************************************************
- * name: snd_mem.c
- *
- * desc: sound caching
- *
- * $Archive: /MissionPack/code/client/snd_mem.c $
- *
- *****************************************************************************/
-
-#include "snd_local.h"
-#include "snd_codec.h"
-
-#define DEF_COMSOUNDMEGS "8"
-
-/*
-===============================================================================
-
-memory management
-
-===============================================================================
-*/
-
-static sndBuffer *buffer = NULL;
-static sndBuffer *freelist = NULL;
-static int inUse = 0;
-static int totalInUse = 0;
-
-short *sfxScratchBuffer = NULL;
-sfx_t *sfxScratchPointer = NULL;
-int sfxScratchIndex = 0;
-
-void SND_free(sndBuffer *v) {
- *(sndBuffer **)v = freelist;
- freelist = (sndBuffer*)v;
- inUse += sizeof(sndBuffer);
-}
-
-sndBuffer* SND_malloc(void) {
- sndBuffer *v;
-redo:
- if (freelist == NULL) {
- S_FreeOldestSound();
- goto redo;
- }
-
- inUse -= sizeof(sndBuffer);
- totalInUse += sizeof(sndBuffer);
-
- v = freelist;
- freelist = *(sndBuffer **)freelist;
- v->next = NULL;
- return v;
-}
-
-void SND_setup(void) {
- sndBuffer *p, *q;
- cvar_t *cv;
- int scs;
-
- cv = Cvar_Get( "com_soundMegs", DEF_COMSOUNDMEGS, CVAR_LATCH | CVAR_ARCHIVE );
-
- scs = (cv->integer*1536);
-
- buffer = malloc(scs*sizeof(sndBuffer) );
- // allocate the stack based hunk allocator
- sfxScratchBuffer = malloc(SND_CHUNK_SIZE * sizeof(short) * 4); //Hunk_Alloc(SND_CHUNK_SIZE * sizeof(short) * 4);
- sfxScratchPointer = NULL;
-
- inUse = scs*sizeof(sndBuffer);
- p = buffer;;
- q = p + scs;
- while (--q > p)
- *(sndBuffer **)q = q-1;
-
- *(sndBuffer **)q = NULL;
- freelist = p + scs - 1;
-
- Com_Printf("Sound memory manager started\n");
-}
-
-/*
-================
-ResampleSfx
-
-resample / decimate to the current source rate
-================
-*/
-static void ResampleSfx( sfx_t *sfx, int inrate, int inwidth, byte *data, qboolean compressed ) {
- int outcount;
- int srcsample;
- float stepscale;
- int i;
- int sample, samplefrac, fracstep;
- int part;
- sndBuffer *chunk;
-
- stepscale = (float)inrate / dma.speed; // this is usually 0.5, 1, or 2
-
- outcount = sfx->soundLength / stepscale;
- sfx->soundLength = outcount;
-
- samplefrac = 0;
- fracstep = stepscale * 256;
- chunk = sfx->soundData;
-
- for (i=0 ; i> 8;
- samplefrac += fracstep;
- if( inwidth == 2 ) {
- sample = ( ((short *)data)[srcsample] );
- } else {
- sample = (int)( (unsigned char)(data[srcsample]) - 128) << 8;
- }
- part = (i&(SND_CHUNK_SIZE-1));
- if (part == 0) {
- sndBuffer *newchunk;
- newchunk = SND_malloc();
- if (chunk == NULL) {
- sfx->soundData = newchunk;
- } else {
- chunk->next = newchunk;
- }
- chunk = newchunk;
- }
-
- chunk->sndChunk[part] = sample;
- }
-}
-
-/*
-================
-ResampleSfx
-
-resample / decimate to the current source rate
-================
-*/
-static int ResampleSfxRaw( short *sfx, int inrate, int inwidth, int samples, byte *data ) {
- int outcount;
- int srcsample;
- float stepscale;
- int i;
- int sample, samplefrac, fracstep;
-
- stepscale = (float)inrate / dma.speed; // this is usually 0.5, 1, or 2
-
- outcount = samples / stepscale;
-
- samplefrac = 0;
- fracstep = stepscale * 256;
-
- for (i=0 ; i> 8;
- samplefrac += fracstep;
- if( inwidth == 2 ) {
- sample = LittleShort ( ((short *)data)[srcsample] );
- } else {
- sample = (int)( (unsigned char)(data[srcsample]) - 128) << 8;
- }
- sfx[i] = sample;
- }
- return outcount;
-}
-
-//=============================================================================
-
-/*
-==============
-S_LoadSound
-
-The filename may be different than sfx->name in the case
-of a forced fallback of a player specific sound
-==============
-*/
-qboolean S_LoadSound( sfx_t *sfx )
-{
- byte *data;
- short *samples;
- snd_info_t info;
-// int size;
-
- // player specific sounds are never directly loaded
- if ( sfx->soundName[0] == '*') {
- return qfalse;
- }
-
- // load it in
- data = S_CodecLoad(sfx->soundName, &info);
- if(!data)
- return qfalse;
-
- if ( info.width == 1 ) {
- Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is a 8 bit wav file\n", sfx->soundName);
- }
-
- if ( info.rate != 22050 ) {
- Com_DPrintf(S_COLOR_YELLOW "WARNING: %s is not a 22kHz wav file\n", sfx->soundName);
- }
-
- samples = Hunk_AllocateTempMemory(info.samples * sizeof(short) * 2);
-
- sfx->lastTimeUsed = Com_Milliseconds()+1;
-
- // each of these compression schemes works just fine
- // but the 16bit quality is much nicer and with a local
- // install assured we can rely upon the sound memory
- // manager to do the right thing for us and page
- // sound in as needed
-
- if( sfx->soundCompressed == qtrue) {
- sfx->soundCompressionMethod = 1;
- sfx->soundData = NULL;
- sfx->soundLength = ResampleSfxRaw( samples, info.rate, info.width, info.samples, data + info.dataofs );
- S_AdpcmEncodeSound(sfx, samples);
-#if 0
- } else if (info.samples>(SND_CHUNK_SIZE*16) && info.width >1) {
- sfx->soundCompressionMethod = 3;
- sfx->soundData = NULL;
- sfx->soundLength = ResampleSfxRaw( samples, info.rate, info.width, info.samples, (data + info.dataofs) );
- encodeMuLaw( sfx, samples);
- } else if (info.samples>(SND_CHUNK_SIZE*6400) && info.width >1) {
- sfx->soundCompressionMethod = 2;
- sfx->soundData = NULL;
- sfx->soundLength = ResampleSfxRaw( samples, info.rate, info.width, info.samples, (data + info.dataofs) );
- encodeWavelet( sfx, samples);
-#endif
- } else {
- sfx->soundCompressionMethod = 0;
- sfx->soundLength = info.samples;
- sfx->soundData = NULL;
- ResampleSfx( sfx, info.rate, info.width, data + info.dataofs, qfalse );
- }
-
- Hunk_FreeTempMemory(samples);
- Z_Free(data);
-
- return qtrue;
-}
-
-void S_DisplayFreeMemory(void) {
- Com_Printf("%d bytes free sound buffer memory, %d total used\n", inUse, totalInUse);
-}
diff --git a/src/client/snd_mix.c b/src/client/snd_mix.c
deleted file mode 100644
index 4d9e716..0000000
--- a/src/client/snd_mix.c
+++ /dev/null
@@ -1,752 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-// snd_mix.c -- portable code to mix sounds for snd_dma.c
-
-#include "client.h"
-#include "snd_local.h"
-#if idppc_altivec && !defined(MACOS_X)
-#include
-#endif
-
-static portable_samplepair_t paintbuffer[PAINTBUFFER_SIZE];
-static int snd_vol;
-
-// bk001119 - these not static, required by unix/snd_mixa.s
-int* snd_p;
-int snd_linear_count;
-short* snd_out;
-
-#if !id386 // if configured not to use asm
-
-void S_WriteLinearBlastStereo16 (void)
-{
- int i;
- int val;
-
- for (i=0 ; i>8;
- if (val > 0x7fff)
- snd_out[i] = 0x7fff;
- else if (val < -32768)
- snd_out[i] = -32768;
- else
- snd_out[i] = val;
-
- val = snd_p[i+1]>>8;
- if (val > 0x7fff)
- snd_out[i+1] = 0x7fff;
- else if (val < -32768)
- snd_out[i+1] = -32768;
- else
- snd_out[i+1] = val;
- }
-}
-#elif defined(__GNUC__)
-// uses snd_mixa.s
-void S_WriteLinearBlastStereo16 (void);
-#else
-
-__declspec( naked ) void S_WriteLinearBlastStereo16 (void)
-{
- __asm {
-
- push edi
- push ebx
- mov ecx,ds:dword ptr[snd_linear_count]
- mov ebx,ds:dword ptr[snd_p]
- mov edi,ds:dword ptr[snd_out]
-LWLBLoopTop:
- mov eax,ds:dword ptr[-8+ebx+ecx*4]
- sar eax,8
- cmp eax,07FFFh
- jg LClampHigh
- cmp eax,0FFFF8000h
- jnl LClampDone
- mov eax,0FFFF8000h
- jmp LClampDone
-LClampHigh:
- mov eax,07FFFh
-LClampDone:
- mov edx,ds:dword ptr[-4+ebx+ecx*4]
- sar edx,8
- cmp edx,07FFFh
- jg LClampHigh2
- cmp edx,0FFFF8000h
- jnl LClampDone2
- mov edx,0FFFF8000h
- jmp LClampDone2
-LClampHigh2:
- mov edx,07FFFh
-LClampDone2:
- shl edx,16
- and eax,0FFFFh
- or edx,eax
- mov ds:dword ptr[-4+edi+ecx*2],edx
- sub ecx,2
- jnz LWLBLoopTop
- pop ebx
- pop edi
- ret
- }
-}
-
-#endif
-
-void S_TransferStereo16 (unsigned long *pbuf, int endtime)
-{
- int lpos;
- int ls_paintedtime;
-
- snd_p = (int *) paintbuffer;
- ls_paintedtime = s_paintedtime;
-
- while (ls_paintedtime < endtime)
- {
- // handle recirculating buffer issues
- lpos = ls_paintedtime & ((dma.samples>>1)-1);
-
- snd_out = (short *) pbuf + (lpos<<1);
-
- snd_linear_count = (dma.samples>>1) - lpos;
- if (ls_paintedtime + snd_linear_count > endtime)
- snd_linear_count = endtime - ls_paintedtime;
-
- snd_linear_count <<= 1;
-
- // write a linear blast of samples
- S_WriteLinearBlastStereo16 ();
-
- snd_p += snd_linear_count;
- ls_paintedtime += (snd_linear_count>>1);
-
- if( CL_VideoRecording( ) )
- CL_WriteAVIAudioFrame( (byte *)snd_out, snd_linear_count << 1 );
- }
-}
-
-/*
-===================
-S_TransferPaintBuffer
-
-===================
-*/
-void S_TransferPaintBuffer(int endtime)
-{
- int out_idx;
- int count;
- int out_mask;
- int *p;
- int step;
- int val;
- unsigned long *pbuf;
-
- pbuf = (unsigned long *)dma.buffer;
-
-
- if ( s_testsound->integer ) {
- int i;
- int count;
-
- // write a fixed sine wave
- count = (endtime - s_paintedtime);
- for (i=0 ; i> 8;
- p+= step;
- if (val > 0x7fff)
- val = 0x7fff;
- else if (val < -32768)
- val = -32768;
- out[out_idx] = val;
- out_idx = (out_idx + 1) & out_mask;
- }
- }
- else if (dma.samplebits == 8)
- {
- unsigned char *out = (unsigned char *) pbuf;
- while (count--)
- {
- val = *p >> 8;
- p+= step;
- if (val > 0x7fff)
- val = 0x7fff;
- else if (val < -32768)
- val = -32768;
- out[out_idx] = (val>>8) + 128;
- out_idx = (out_idx + 1) & out_mask;
- }
- }
- }
-}
-
-
-/*
-===============================================================================
-
-CHANNEL MIXING
-
-===============================================================================
-*/
-
-#if idppc_altivec
-static void S_PaintChannelFrom16_altivec( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
- int data, aoff, boff;
- int leftvol, rightvol;
- int i, j;
- portable_samplepair_t *samp;
- sndBuffer *chunk;
- short *samples;
- float ooff, fdata, fdiv, fleftvol, frightvol;
-
- samp = &paintbuffer[ bufferOffset ];
-
- if (ch->doppler) {
- sampleOffset = sampleOffset*ch->oldDopplerScale;
- }
-
- chunk = sc->soundData;
- while (sampleOffset>=SND_CHUNK_SIZE) {
- chunk = chunk->next;
- sampleOffset -= SND_CHUNK_SIZE;
- if (!chunk) {
- chunk = sc->soundData;
- }
- }
-
- if (!ch->doppler || ch->dopplerScale==1.0f) {
- vector signed short volume_vec;
- vector unsigned int volume_shift;
- int vectorCount, samplesLeft, chunkSamplesLeft;
- leftvol = ch->leftvol*snd_vol;
- rightvol = ch->rightvol*snd_vol;
- samples = chunk->sndChunk;
- ((short *)&volume_vec)[0] = leftvol;
- ((short *)&volume_vec)[1] = leftvol;
- ((short *)&volume_vec)[4] = leftvol;
- ((short *)&volume_vec)[5] = leftvol;
- ((short *)&volume_vec)[2] = rightvol;
- ((short *)&volume_vec)[3] = rightvol;
- ((short *)&volume_vec)[6] = rightvol;
- ((short *)&volume_vec)[7] = rightvol;
- volume_shift = vec_splat_u32(8);
- i = 0;
-
- while(i < count) {
- /* Try to align destination to 16-byte boundary */
- while(i < count && (((unsigned long)&samp[i] & 0x1f) || ((count-i) < 8) || ((SND_CHUNK_SIZE - sampleOffset) < 8))) {
- data = samples[sampleOffset++];
- samp[i].left += (data * leftvol)>>8;
- samp[i].right += (data * rightvol)>>8;
-
- if (sampleOffset == SND_CHUNK_SIZE) {
- chunk = chunk->next;
- samples = chunk->sndChunk;
- sampleOffset = 0;
- }
- i++;
- }
- /* Destination is now aligned. Process as many 8-sample
- chunks as we can before we run out of room from the current
- sound chunk. We do 8 per loop to avoid extra source data reads. */
- samplesLeft = count - i;
- chunkSamplesLeft = SND_CHUNK_SIZE - sampleOffset;
- if(samplesLeft > chunkSamplesLeft)
- samplesLeft = chunkSamplesLeft;
-
- vectorCount = samplesLeft / 8;
-
- if(vectorCount)
- {
- vector unsigned char tmp;
- vector short s0, s1, sampleData0, sampleData1;
- vector signed int merge0, merge1;
- vector signed int d0, d1, d2, d3;
- vector unsigned char samplePermute0 =
- VECCONST_UINT8(0, 1, 4, 5, 0, 1, 4, 5, 2, 3, 6, 7, 2, 3, 6, 7);
- vector unsigned char samplePermute1 =
- VECCONST_UINT8(8, 9, 12, 13, 8, 9, 12, 13, 10, 11, 14, 15, 10, 11, 14, 15);
- vector unsigned char loadPermute0, loadPermute1;
-
- // Rather than permute the vectors after we load them to do the sample
- // replication and rearrangement, we permute the alignment vector so
- // we do everything in one step below and avoid data shuffling.
- tmp = vec_lvsl(0,&samples[sampleOffset]);
- loadPermute0 = vec_perm(tmp,tmp,samplePermute0);
- loadPermute1 = vec_perm(tmp,tmp,samplePermute1);
-
- s0 = *(vector short *)&samples[sampleOffset];
- while(vectorCount)
- {
- /* Load up source (16-bit) sample data */
- s1 = *(vector short *)&samples[sampleOffset+7];
-
- /* Load up destination sample data */
- d0 = *(vector signed int *)&samp[i];
- d1 = *(vector signed int *)&samp[i+2];
- d2 = *(vector signed int *)&samp[i+4];
- d3 = *(vector signed int *)&samp[i+6];
-
- sampleData0 = vec_perm(s0,s1,loadPermute0);
- sampleData1 = vec_perm(s0,s1,loadPermute1);
-
- merge0 = vec_mule(sampleData0,volume_vec);
- merge0 = vec_sra(merge0,volume_shift); /* Shift down to proper range */
-
- merge1 = vec_mulo(sampleData0,volume_vec);
- merge1 = vec_sra(merge1,volume_shift);
-
- d0 = vec_add(merge0,d0);
- d1 = vec_add(merge1,d1);
-
- merge0 = vec_mule(sampleData1,volume_vec);
- merge0 = vec_sra(merge0,volume_shift); /* Shift down to proper range */
-
- merge1 = vec_mulo(sampleData1,volume_vec);
- merge1 = vec_sra(merge1,volume_shift);
-
- d2 = vec_add(merge0,d2);
- d3 = vec_add(merge1,d3);
-
- /* Store destination sample data */
- *(vector signed int *)&samp[i] = d0;
- *(vector signed int *)&samp[i+2] = d1;
- *(vector signed int *)&samp[i+4] = d2;
- *(vector signed int *)&samp[i+6] = d3;
-
- i += 8;
- vectorCount--;
- s0 = s1;
- sampleOffset += 8;
- }
- if (sampleOffset == SND_CHUNK_SIZE) {
- chunk = chunk->next;
- samples = chunk->sndChunk;
- sampleOffset = 0;
- }
- }
- }
- } else {
- fleftvol = ch->leftvol*snd_vol;
- frightvol = ch->rightvol*snd_vol;
-
- ooff = sampleOffset;
- samples = chunk->sndChunk;
-
- for ( i=0 ; idopplerScale;
- boff = ooff;
- fdata = 0;
- for (j=aoff; jnext;
- if (!chunk) {
- chunk = sc->soundData;
- }
- samples = chunk->sndChunk;
- ooff -= SND_CHUNK_SIZE;
- }
- fdata += samples[j&(SND_CHUNK_SIZE-1)];
- }
- fdiv = 256 * (boff-aoff);
- samp[i].left += (fdata * fleftvol)/fdiv;
- samp[i].right += (fdata * frightvol)/fdiv;
- }
- }
-}
-#endif
-
-static void S_PaintChannelFrom16_scalar( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
- int data, aoff, boff;
- int leftvol, rightvol;
- int i, j;
- portable_samplepair_t *samp;
- sndBuffer *chunk;
- short *samples;
- float ooff, fdata, fdiv, fleftvol, frightvol;
-
- samp = &paintbuffer[ bufferOffset ];
-
- if (ch->doppler) {
- sampleOffset = sampleOffset*ch->oldDopplerScale;
- }
-
- chunk = sc->soundData;
- while (sampleOffset>=SND_CHUNK_SIZE) {
- chunk = chunk->next;
- sampleOffset -= SND_CHUNK_SIZE;
- if (!chunk) {
- chunk = sc->soundData;
- }
- }
-
- if (!ch->doppler || ch->dopplerScale==1.0f) {
- leftvol = ch->leftvol*snd_vol;
- rightvol = ch->rightvol*snd_vol;
- samples = chunk->sndChunk;
- for ( i=0 ; i>8;
- samp[i].right += (data * rightvol)>>8;
-
- if (sampleOffset == SND_CHUNK_SIZE) {
- chunk = chunk->next;
- samples = chunk->sndChunk;
- sampleOffset = 0;
- }
- }
- } else {
- fleftvol = ch->leftvol*snd_vol;
- frightvol = ch->rightvol*snd_vol;
-
- ooff = sampleOffset;
- samples = chunk->sndChunk;
-
-
-
-
- for ( i=0 ; idopplerScale;
- boff = ooff;
- fdata = 0;
- for (j=aoff; jnext;
- if (!chunk) {
- chunk = sc->soundData;
- }
- samples = chunk->sndChunk;
- ooff -= SND_CHUNK_SIZE;
- }
- fdata += samples[j&(SND_CHUNK_SIZE-1)];
- }
- fdiv = 256 * (boff-aoff);
- samp[i].left += (fdata * fleftvol)/fdiv;
- samp[i].right += (fdata * frightvol)/fdiv;
- }
- }
-}
-
-static void S_PaintChannelFrom16( channel_t *ch, const sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
-#if idppc_altivec
- if (com_altivec->integer) {
- // must be in a seperate function or G3 systems will crash.
- S_PaintChannelFrom16_altivec( ch, sc, count, sampleOffset, bufferOffset );
- return;
- }
-#endif
- S_PaintChannelFrom16_scalar( ch, sc, count, sampleOffset, bufferOffset );
-}
-
-void S_PaintChannelFromWavelet( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
- int data;
- int leftvol, rightvol;
- int i;
- portable_samplepair_t *samp;
- sndBuffer *chunk;
- short *samples;
-
- leftvol = ch->leftvol*snd_vol;
- rightvol = ch->rightvol*snd_vol;
-
- i = 0;
- samp = &paintbuffer[ bufferOffset ];
- chunk = sc->soundData;
- while (sampleOffset>=(SND_CHUNK_SIZE_FLOAT*4)) {
- chunk = chunk->next;
- sampleOffset -= (SND_CHUNK_SIZE_FLOAT*4);
- i++;
- }
-
- if (i!=sfxScratchIndex || sfxScratchPointer != sc) {
- S_AdpcmGetSamples( chunk, sfxScratchBuffer );
- sfxScratchIndex = i;
- sfxScratchPointer = sc;
- }
-
- samples = sfxScratchBuffer;
-
- for ( i=0 ; i>8;
- samp[i].right += (data * rightvol)>>8;
-
- if (sampleOffset == SND_CHUNK_SIZE*2) {
- chunk = chunk->next;
- decodeWavelet(chunk, sfxScratchBuffer);
- sfxScratchIndex++;
- sampleOffset = 0;
- }
- }
-}
-
-void S_PaintChannelFromADPCM( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
- int data;
- int leftvol, rightvol;
- int i;
- portable_samplepair_t *samp;
- sndBuffer *chunk;
- short *samples;
-
- leftvol = ch->leftvol*snd_vol;
- rightvol = ch->rightvol*snd_vol;
-
- i = 0;
- samp = &paintbuffer[ bufferOffset ];
- chunk = sc->soundData;
-
- if (ch->doppler) {
- sampleOffset = sampleOffset*ch->oldDopplerScale;
- }
-
- while (sampleOffset>=(SND_CHUNK_SIZE*4)) {
- chunk = chunk->next;
- sampleOffset -= (SND_CHUNK_SIZE*4);
- i++;
- }
-
- if (i!=sfxScratchIndex || sfxScratchPointer != sc) {
- S_AdpcmGetSamples( chunk, sfxScratchBuffer );
- sfxScratchIndex = i;
- sfxScratchPointer = sc;
- }
-
- samples = sfxScratchBuffer;
-
- for ( i=0 ; i>8;
- samp[i].right += (data * rightvol)>>8;
-
- if (sampleOffset == SND_CHUNK_SIZE*4) {
- chunk = chunk->next;
- S_AdpcmGetSamples( chunk, sfxScratchBuffer);
- sampleOffset = 0;
- sfxScratchIndex++;
- }
- }
-}
-
-void S_PaintChannelFromMuLaw( channel_t *ch, sfx_t *sc, int count, int sampleOffset, int bufferOffset ) {
- int data;
- int leftvol, rightvol;
- int i;
- portable_samplepair_t *samp;
- sndBuffer *chunk;
- byte *samples;
- float ooff;
-
- leftvol = ch->leftvol*snd_vol;
- rightvol = ch->rightvol*snd_vol;
-
- samp = &paintbuffer[ bufferOffset ];
- chunk = sc->soundData;
- while (sampleOffset>=(SND_CHUNK_SIZE*2)) {
- chunk = chunk->next;
- sampleOffset -= (SND_CHUNK_SIZE*2);
- if (!chunk) {
- chunk = sc->soundData;
- }
- }
-
- if (!ch->doppler) {
- samples = (byte *)chunk->sndChunk + sampleOffset;
- for ( i=0 ; i>8;
- samp[i].right += (data * rightvol)>>8;
- samples++;
- if (samples == (byte *)chunk->sndChunk+(SND_CHUNK_SIZE*2)) {
- chunk = chunk->next;
- samples = (byte *)chunk->sndChunk;
- }
- }
- } else {
- ooff = sampleOffset;
- samples = (byte *)chunk->sndChunk;
- for ( i=0 ; idopplerScale;
- samp[i].left += (data * leftvol)>>8;
- samp[i].right += (data * rightvol)>>8;
- if (ooff >= SND_CHUNK_SIZE*2) {
- chunk = chunk->next;
- if (!chunk) {
- chunk = sc->soundData;
- }
- samples = (byte *)chunk->sndChunk;
- ooff = 0.0;
- }
- }
- }
-}
-
-/*
-===================
-S_PaintChannels
-===================
-*/
-void S_PaintChannels( int endtime ) {
- int i;
- int end;
- channel_t *ch;
- sfx_t *sc;
- int ltime, count;
- int sampleOffset;
-
-
- snd_vol = s_volume->value*255;
-
-//Com_Printf ("%i to %i\n", s_paintedtime, endtime);
- while ( s_paintedtime < endtime ) {
- // if paintbuffer is smaller than DMA buffer
- // we may need to fill it multiple times
- end = endtime;
- if ( endtime - s_paintedtime > PAINTBUFFER_SIZE ) {
- end = s_paintedtime + PAINTBUFFER_SIZE;
- }
-
- // clear the paint buffer to either music or zeros
- if ( s_rawend < s_paintedtime ) {
- if ( s_rawend ) {
- //Com_DPrintf ("background sound underrun\n");
- }
- Com_Memset(paintbuffer, 0, (end - s_paintedtime) * sizeof(portable_samplepair_t));
- } else {
- // copy from the streaming sound source
- int s;
- int stop;
-
- stop = (end < s_rawend) ? end : s_rawend;
-
- for ( i = s_paintedtime ; i < stop ; i++ ) {
- s = i&(MAX_RAW_SAMPLES-1);
- paintbuffer[i-s_paintedtime] = s_rawsamples[s];
- }
-// if (i != end)
-// Com_Printf ("partial stream\n");
-// else
-// Com_Printf ("full stream\n");
- for ( ; i < end ; i++ ) {
- paintbuffer[i-s_paintedtime].left =
- paintbuffer[i-s_paintedtime].right = 0;
- }
- }
-
- // paint in the channels.
- ch = s_channels;
- for ( i = 0; i < MAX_CHANNELS ; i++, ch++ ) {
- if ( !ch->thesfx || (ch->leftvol<0.25 && ch->rightvol<0.25 )) {
- continue;
- }
-
- ltime = s_paintedtime;
- sc = ch->thesfx;
-
- sampleOffset = ltime - ch->startSample;
- count = end - ltime;
- if ( sampleOffset + count > sc->soundLength ) {
- count = sc->soundLength - sampleOffset;
- }
-
- if ( count > 0 ) {
- if( sc->soundCompressionMethod == 1) {
- S_PaintChannelFromADPCM (ch, sc, count, sampleOffset, ltime - s_paintedtime);
- } else if( sc->soundCompressionMethod == 2) {
- S_PaintChannelFromWavelet (ch, sc, count, sampleOffset, ltime - s_paintedtime);
- } else if( sc->soundCompressionMethod == 3) {
- S_PaintChannelFromMuLaw (ch, sc, count, sampleOffset, ltime - s_paintedtime);
- } else {
- S_PaintChannelFrom16 (ch, sc, count, sampleOffset, ltime - s_paintedtime);
- }
- }
- }
-
- // paint in the looped channels.
- ch = loop_channels;
- for ( i = 0; i < numLoopChannels ; i++, ch++ ) {
- if ( !ch->thesfx || (!ch->leftvol && !ch->rightvol )) {
- continue;
- }
-
- ltime = s_paintedtime;
- sc = ch->thesfx;
-
- if (sc->soundData==NULL || sc->soundLength==0) {
- continue;
- }
- // we might have to make two passes if it
- // is a looping sound effect and the end of
- // the sample is hit
- do {
- sampleOffset = (ltime % sc->soundLength);
-
- count = end - ltime;
- if ( sampleOffset + count > sc->soundLength ) {
- count = sc->soundLength - sampleOffset;
- }
-
- if ( count > 0 ) {
- if( sc->soundCompressionMethod == 1) {
- S_PaintChannelFromADPCM (ch, sc, count, sampleOffset, ltime - s_paintedtime);
- } else if( sc->soundCompressionMethod == 2) {
- S_PaintChannelFromWavelet (ch, sc, count, sampleOffset, ltime - s_paintedtime);
- } else if( sc->soundCompressionMethod == 3) {
- S_PaintChannelFromMuLaw (ch, sc, count, sampleOffset, ltime - s_paintedtime);
- } else {
- S_PaintChannelFrom16 (ch, sc, count, sampleOffset, ltime - s_paintedtime);
- }
- ltime += count;
- }
- } while ( ltime < end);
- }
-
- // transfer out according to DMA format
- S_TransferPaintBuffer( end );
- s_paintedtime = end;
- }
-}
diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c
deleted file mode 100644
index 61b250d..0000000
--- a/src/client/snd_openal.c
+++ /dev/null
@@ -1,2002 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-Copyright (C) 2005 Stuart Dalton (badcdev@gmail.com)
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "snd_local.h"
-#include "snd_codec.h"
-#include "client.h"
-
-#if USE_OPENAL
-
-#include "qal.h"
-
-// Console variables specific to OpenAL
-cvar_t *s_alPrecache;
-cvar_t *s_alGain;
-cvar_t *s_alSources;
-cvar_t *s_alDopplerFactor;
-cvar_t *s_alDopplerSpeed;
-cvar_t *s_alMinDistance;
-cvar_t *s_alMaxDistance;
-cvar_t *s_alRolloff;
-cvar_t *s_alGraceDistance;
-cvar_t *s_alDriver;
-cvar_t *s_alDevice;
-cvar_t *s_alAvailableDevices;
-
-/*
-=================
-S_AL_Format
-=================
-*/
-static
-ALuint S_AL_Format(int width, int channels)
-{
- ALuint format = AL_FORMAT_MONO16;
-
- // Work out format
- if(width == 1)
- {
- if(channels == 1)
- format = AL_FORMAT_MONO8;
- else if(channels == 2)
- format = AL_FORMAT_STEREO8;
- }
- else if(width == 2)
- {
- if(channels == 1)
- format = AL_FORMAT_MONO16;
- else if(channels == 2)
- format = AL_FORMAT_STEREO16;
- }
-
- return format;
-}
-
-/*
-=================
-S_AL_ErrorMsg
-=================
-*/
-static const char *S_AL_ErrorMsg(ALenum error)
-{
- switch(error)
- {
- case AL_NO_ERROR:
- return "No error";
- case AL_INVALID_NAME:
- return "Invalid name";
- case AL_INVALID_ENUM:
- return "Invalid enumerator";
- case AL_INVALID_VALUE:
- return "Invalid value";
- case AL_INVALID_OPERATION:
- return "Invalid operation";
- case AL_OUT_OF_MEMORY:
- return "Out of memory";
- default:
- return "Unknown error";
- }
-}
-
-
-//===========================================================================
-
-
-typedef struct alSfx_s
-{
- char filename[MAX_QPATH];
- ALuint buffer; // OpenAL buffer
- qboolean isDefault; // Couldn't be loaded - use default FX
- qboolean inMemory; // Sound is stored in memory
- qboolean isLocked; // Sound is locked (can not be unloaded)
- int lastUsedTime; // Time last used
-} alSfx_t;
-
-static qboolean alBuffersInitialised = qfalse;
-
-// Sound effect storage, data structures
-#define MAX_SFX 4096
-static alSfx_t knownSfx[MAX_SFX];
-static int numSfx = 0;
-
-static sfxHandle_t default_sfx;
-
-/*
-=================
-S_AL_BufferFindFree
-
-Find a free handle
-=================
-*/
-static sfxHandle_t S_AL_BufferFindFree( void )
-{
- int i;
-
- for(i = 0; i < MAX_SFX; i++)
- {
- // Got one
- if(knownSfx[i].filename[0] == '\0')
- {
- if(i >= numSfx)
- numSfx = i + 1;
- return i;
- }
- }
-
- // Shit...
- Com_Error(ERR_FATAL, "S_AL_BufferFindFree: No free sound handles");
- return -1;
-}
-
-/*
-=================
-S_AL_BufferFind
-
-Find a sound effect if loaded, set up a handle otherwise
-=================
-*/
-static sfxHandle_t S_AL_BufferFind(const char *filename)
-{
- // Look it up in the table
- sfxHandle_t sfx = -1;
- int i;
-
- for(i = 0; i < numSfx; i++)
- {
- if(!Q_stricmp(knownSfx[i].filename, filename))
- {
- sfx = i;
- break;
- }
- }
-
- // Not found in table?
- if(sfx == -1)
- {
- alSfx_t *ptr;
-
- sfx = S_AL_BufferFindFree();
-
- // Clear and copy the filename over
- ptr = &knownSfx[sfx];
- memset(ptr, 0, sizeof(*ptr));
- strcpy(ptr->filename, filename);
- }
-
- // Return the handle
- return sfx;
-}
-
-/*
-=================
-S_AL_BufferUseDefault
-=================
-*/
-static void S_AL_BufferUseDefault(sfxHandle_t sfx)
-{
- if(sfx == default_sfx)
- Com_Error(ERR_FATAL, "Can't load default sound effect %s\n", knownSfx[sfx].filename);
-
- Com_Printf( S_COLOR_YELLOW "WARNING: Using default sound for %s\n", knownSfx[sfx].filename);
- knownSfx[sfx].isDefault = qtrue;
- knownSfx[sfx].buffer = knownSfx[default_sfx].buffer;
-}
-
-/*
-=================
-S_AL_BufferUnload
-=================
-*/
-static void S_AL_BufferUnload(sfxHandle_t sfx)
-{
- ALenum error;
-
- if(knownSfx[sfx].filename[0] == '\0')
- return;
-
- if(!knownSfx[sfx].inMemory)
- return;
-
- // Delete it
- qalDeleteBuffers(1, &knownSfx[sfx].buffer);
- if((error = qalGetError()) != AL_NO_ERROR)
- Com_Printf( S_COLOR_RED "ERROR: Can't delete sound buffer for %s\n",
- knownSfx[sfx].filename);
-
- knownSfx[sfx].inMemory = qfalse;
-}
-
-/*
-=================
-S_AL_BufferEvict
-=================
-*/
-static qboolean S_AL_BufferEvict( void )
-{
- int i, oldestBuffer = -1;
- int oldestTime = Sys_Milliseconds( );
-
- for( i = 0; i < numSfx; i++ )
- {
- if( !knownSfx[ i ].filename[ 0 ] )
- continue;
-
- if( !knownSfx[ i ].inMemory )
- continue;
-
- if( knownSfx[ i ].lastUsedTime < oldestTime )
- {
- oldestTime = knownSfx[ i ].lastUsedTime;
- oldestBuffer = i;
- }
- }
-
- if( oldestBuffer >= 0 )
- {
- S_AL_BufferUnload( oldestBuffer );
- return qtrue;
- }
- else
- return qfalse;
-}
-
-/*
-=================
-S_AL_BufferLoad
-=================
-*/
-static void S_AL_BufferLoad(sfxHandle_t sfx)
-{
- ALenum error;
-
- void *data;
- snd_info_t info;
- ALuint format;
-
- // Nothing?
- if(knownSfx[sfx].filename[0] == '\0')
- return;
-
- // Player SFX
- if(knownSfx[sfx].filename[0] == '*')
- return;
-
- // Already done?
- if((knownSfx[sfx].inMemory) || (knownSfx[sfx].isDefault))
- return;
-
- // Try to load
- data = S_CodecLoad(knownSfx[sfx].filename, &info);
- if(!data)
- {
- S_AL_BufferUseDefault(sfx);
- return;
- }
-
- format = S_AL_Format(info.width, info.channels);
-
- // Create a buffer
- qalGenBuffers(1, &knownSfx[sfx].buffer);
- if((error = qalGetError()) != AL_NO_ERROR)
- {
- S_AL_BufferUseDefault(sfx);
- Z_Free(data);
- Com_Printf( S_COLOR_RED "ERROR: Can't create a sound buffer for %s - %s\n",
- knownSfx[sfx].filename, S_AL_ErrorMsg(error));
- return;
- }
-
- // Fill the buffer
- if( info.size == 0 )
- {
- // We have no data to buffer, so buffer silence
- byte dummyData[ 2 ] = { 0 };
-
- qalBufferData(knownSfx[sfx].buffer, AL_FORMAT_MONO16, (void *)dummyData, 2, 22050);
- }
- else
- qalBufferData(knownSfx[sfx].buffer, format, data, info.size, info.rate);
-
- error = qalGetError();
-
- // If we ran out of memory, start evicting the least recently used sounds
- while(error == AL_OUT_OF_MEMORY)
- {
- if( !S_AL_BufferEvict( ) )
- {
- S_AL_BufferUseDefault(sfx);
- Z_Free(data);
- Com_Printf( S_COLOR_RED "ERROR: Out of memory loading %s\n", knownSfx[sfx].filename);
- return;
- }
-
- // Try load it again
- qalBufferData(knownSfx[sfx].buffer, format, data, info.size, info.rate);
- error = qalGetError();
- }
-
- // Some other error condition
- if(error != AL_NO_ERROR)
- {
- S_AL_BufferUseDefault(sfx);
- Z_Free(data);
- Com_Printf( S_COLOR_RED "ERROR: Can't fill sound buffer for %s - %s\n",
- knownSfx[sfx].filename, S_AL_ErrorMsg(error));
- return;
- }
-
- // Free the memory
- Z_Free(data);
-
- // Woo!
- knownSfx[sfx].inMemory = qtrue;
-}
-
-/*
-=================
-S_AL_BufferUse
-=================
-*/
-static
-void S_AL_BufferUse(sfxHandle_t sfx)
-{
- if(knownSfx[sfx].filename[0] == '\0')
- return;
-
- if((!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
- S_AL_BufferLoad(sfx);
- knownSfx[sfx].lastUsedTime = Sys_Milliseconds();
-}
-
-/*
-=================
-S_AL_BufferInit
-=================
-*/
-static
-qboolean S_AL_BufferInit( void )
-{
- if(alBuffersInitialised)
- return qtrue;
-
- // Clear the hash table, and SFX table
- memset(knownSfx, 0, sizeof(knownSfx));
- numSfx = 0;
-
- // Load the default sound, and lock it
- default_sfx = S_AL_BufferFind("sound/feedback/hit.wav");
- S_AL_BufferUse(default_sfx);
- knownSfx[default_sfx].isLocked = qtrue;
-
- // All done
- alBuffersInitialised = qtrue;
- return qtrue;
-}
-
-/*
-=================
-S_AL_BufferShutdown
-=================
-*/
-static
-void S_AL_BufferShutdown( void )
-{
- int i;
-
- if(!alBuffersInitialised)
- return;
-
- // Unlock the default sound effect
- knownSfx[default_sfx].isLocked = qfalse;
-
- // Free all used effects
- for(i = 0; i < numSfx; i++)
- S_AL_BufferUnload(i);
-
- // Clear the tables
- memset(knownSfx, 0, sizeof(knownSfx));
-
- // All undone
- alBuffersInitialised = qfalse;
-}
-
-/*
-=================
-S_AL_RegisterSound
-=================
-*/
-static
-sfxHandle_t S_AL_RegisterSound( const char *sample, qboolean compressed )
-{
- sfxHandle_t sfx = S_AL_BufferFind(sample);
-
- if( s_alPrecache->integer && (!knownSfx[sfx].inMemory) && (!knownSfx[sfx].isDefault))
- S_AL_BufferLoad(sfx);
- knownSfx[sfx].lastUsedTime = Com_Milliseconds();
-
- return sfx;
-}
-
-/*
-=================
-S_AL_BufferGet
-
-Return's an sfx's buffer
-=================
-*/
-static
-ALuint S_AL_BufferGet(sfxHandle_t sfx)
-{
- return knownSfx[sfx].buffer;
-}
-
-
-//===========================================================================
-
-
-typedef struct src_s
-{
- ALuint alSource; // OpenAL source object
- sfxHandle_t sfx; // Sound effect in use
-
- int lastUsedTime; // Last time used
- alSrcPriority_t priority; // Priority
- int entity; // Owning entity (-1 if none)
- int channel; // Associated channel (-1 if none)
-
- int isActive; // Is this source currently in use?
- int isLocked; // This is locked (un-allocatable)
- int isLooping; // Is this a looping effect (attached to an entity)
- int isTracking; // Is this object tracking it's owner
-
- float curGain; // gain employed if source is within maxdistance.
- float scaleGain; // Last gain value for this source. 0 if muted.
-
- qboolean local; // Is this local (relative to the cam)
-} src_t;
-
-#ifdef MACOS_X
- #define MAX_SRC 64
-#else
- #define MAX_SRC 128
-#endif
-static src_t srcList[MAX_SRC];
-static int srcCount = 0;
-static qboolean alSourcesInitialised = qfalse;
-static vec3_t lastListenerOrigin = { 0.0f, 0.0f, 0.0f };
-
-typedef struct sentity_s
-{
- vec3_t origin;
-
- int srcAllocated; // If a src_t has been allocated to this entity
- int srcIndex;
-
- qboolean loopAddedThisFrame;
- alSrcPriority_t loopPriority;
- sfxHandle_t loopSfx;
- qboolean startLoopingSound;
-} sentity_t;
-
-static sentity_t entityList[MAX_GENTITIES];
-
-/*
-=================
-S_AL_SanitiseVector
-=================
-*/
-#define S_AL_SanitiseVector(v) _S_AL_SanitiseVector(v,__LINE__)
-static void _S_AL_SanitiseVector( vec3_t v, int line )
-{
- if( Q_isnan( v[ 0 ] ) || Q_isnan( v[ 1 ] ) || Q_isnan( v[ 2 ] ) )
- {
- Com_DPrintf( S_COLOR_YELLOW "WARNING: vector with one or more NaN components "
- "being passed to OpenAL at %s:%d -- zeroing\n", __FILE__, line );
- VectorClear( v );
- }
-}
-
-
-#define AL_THIRD_PERSON_THRESHOLD_SQ (48.0f*48.0f)
-
-/*
-=================
-S_AL_ScaleGain
-Adapt the gain if necessary to get a quicker fadeout when the source is too far away.
-=================
-*/
-
-static void S_AL_ScaleGain(src_t *chksrc, vec3_t origin)
-{
- float distance;
-
- if(!chksrc->local)
- distance = Distance(origin, lastListenerOrigin);
-
- // If we exceed a certain distance, scale the gain linearly until the sound
- // vanishes into nothingness.
- if(!chksrc->local && (distance -= s_alMaxDistance->value) > 0)
- {
- float scaleFactor;
-
- if(distance >= s_alGraceDistance->value)
- scaleFactor = 0.0f;
- else
- scaleFactor = 1.0f - distance / s_alGraceDistance->value;
-
- scaleFactor *= chksrc->curGain;
-
- if(chksrc->scaleGain != scaleFactor);
- {
- chksrc->scaleGain = scaleFactor;
- // if(scaleFactor > 0.0f)
- // Com_Printf("%f\n", scaleFactor);
- qalSourcef(chksrc->alSource, AL_GAIN, chksrc->scaleGain);
- }
- }
- else if(chksrc->scaleGain != chksrc->curGain)
- {
- chksrc->scaleGain = chksrc->curGain;
- qalSourcef(chksrc->alSource, AL_GAIN, chksrc->scaleGain);
- }
-}
-
-/*
-=================
-S_AL_HearingThroughEntity
-=================
-*/
-static qboolean S_AL_HearingThroughEntity( int entityNum )
-{
- float distanceSq;
-
- if( clc.clientNum == entityNum )
- {
- // FIXME: 28/02/06 This is an outrageous hack to detect
- // whether or not the player is rendering in third person or not. We can't
- // ask the renderer because the renderer has no notion of entities and we
- // can't ask cgame since that would involve changing the API and hence mod
- // compatibility. I don't think there is any way around this, but I'll leave
- // the FIXME just in case anyone has a bright idea.
- distanceSq = DistanceSquared(
- entityList[ entityNum ].origin,
- lastListenerOrigin );
-
- if( distanceSq > AL_THIRD_PERSON_THRESHOLD_SQ )
- return qfalse; //we're the player, but third person
- else
- return qtrue; //we're the player
- }
- else
- return qfalse; //not the player
-}
-
-/*
-=================
-S_AL_SrcInit
-=================
-*/
-static
-qboolean S_AL_SrcInit( void )
-{
- int i;
- int limit;
- ALenum error;
-
- // Clear the sources data structure
- memset(srcList, 0, sizeof(srcList));
- srcCount = 0;
-
- // Cap s_alSources to MAX_SRC
- limit = s_alSources->integer;
- if(limit > MAX_SRC)
- limit = MAX_SRC;
- else if(limit < 16)
- limit = 16;
-
- // Allocate as many sources as possible
- for(i = 0; i < limit; i++)
- {
- qalGenSources(1, &srcList[i].alSource);
- if((error = qalGetError()) != AL_NO_ERROR)
- break;
- srcCount++;
- }
-
- // All done. Print this for informational purposes
- Com_Printf( "Allocated %d sources.\n", srcCount);
- alSourcesInitialised = qtrue;
- return qtrue;
-}
-
-/*
-=================
-S_AL_SrcShutdown
-=================
-*/
-static
-void S_AL_SrcShutdown( void )
-{
- int i;
-
- if(!alSourcesInitialised)
- return;
-
- // Destroy all the sources
- for(i = 0; i < srcCount; i++)
- {
- if(srcList[i].isLocked)
- Com_DPrintf( S_COLOR_YELLOW "WARNING: Source %d is locked\n", i);
-
- qalSourceStop(srcList[i].alSource);
- qalDeleteSources(1, &srcList[i].alSource);
- }
-
- memset(srcList, 0, sizeof(srcList));
-
- alSourcesInitialised = qfalse;
-}
-
-/*
-=================
-S_AL_SrcSetup
-=================
-*/
-static void S_AL_SrcSetup(srcHandle_t src, sfxHandle_t sfx, alSrcPriority_t priority,
- int entity, int channel, qboolean local)
-{
- ALuint buffer;
- src_t *curSource;
-
- // Mark the SFX as used, and grab the raw AL buffer
- S_AL_BufferUse(sfx);
- buffer = S_AL_BufferGet(sfx);
-
- // Set up src struct
- curSource = &srcList[src];
-
- curSource->lastUsedTime = Sys_Milliseconds();
- curSource->sfx = sfx;
- curSource->priority = priority;
- curSource->entity = entity;
- curSource->channel = channel;
- curSource->isActive = qtrue;
- curSource->isLocked = qfalse;
- curSource->isLooping = qfalse;
- curSource->isTracking = qfalse;
- curSource->curGain = s_alGain->value * s_volume->value;
- curSource->scaleGain = curSource->curGain;
- curSource->local = local;
-
- // Set up OpenAL source
- qalSourcei(curSource->alSource, AL_BUFFER, buffer);
- qalSourcef(curSource->alSource, AL_PITCH, 1.0f);
- qalSourcef(curSource->alSource, AL_GAIN, curSource->curGain);
- qalSourcefv(curSource->alSource, AL_POSITION, vec3_origin);
- qalSourcefv(curSource->alSource, AL_VELOCITY, vec3_origin);
- qalSourcei(curSource->alSource, AL_LOOPING, AL_FALSE);
- qalSourcef(curSource->alSource, AL_REFERENCE_DISTANCE, s_alMinDistance->value);
-
- if(local)
- {
- qalSourcei(curSource->alSource, AL_SOURCE_RELATIVE, AL_TRUE);
- qalSourcef(curSource->alSource, AL_ROLLOFF_FACTOR, 0.0f);
- }
- else
- {
- qalSourcei(curSource->alSource, AL_SOURCE_RELATIVE, AL_FALSE);
- qalSourcef(curSource->alSource, AL_ROLLOFF_FACTOR, s_alRolloff->value);
- }
-}
-
-/*
-=================
-S_AL_SrcKill
-=================
-*/
-static void S_AL_SrcKill(srcHandle_t src)
-{
- // I'm not touching it. Unlock it first.
- if(srcList[src].isLocked)
- return;
-
- // Stop it if it's playing
- if(srcList[src].isActive)
- qalSourceStop(srcList[src].alSource);
-
- // Remove the entity association
- if((srcList[src].isLooping) && (srcList[src].entity != -1))
- {
- int ent = srcList[src].entity;
- entityList[ent].srcAllocated = qfalse;
- entityList[ent].srcIndex = -1;
- entityList[ent].loopAddedThisFrame = qfalse;
- entityList[ent].startLoopingSound = qfalse;
- }
-
- // Remove the buffer
- qalSourcei(srcList[src].alSource, AL_BUFFER, 0);
-
- srcList[src].sfx = 0;
- srcList[src].lastUsedTime = 0;
- srcList[src].priority = 0;
- srcList[src].entity = -1;
- srcList[src].channel = -1;
- srcList[src].isActive = qfalse;
- srcList[src].isLocked = qfalse;
- srcList[src].isLooping = qfalse;
- srcList[src].isTracking = qfalse;
- srcList[src].local = qfalse;
-}
-
-/*
-=================
-S_AL_SrcAlloc
-=================
-*/
-static
-srcHandle_t S_AL_SrcAlloc( alSrcPriority_t priority, int entnum, int channel )
-{
- int i;
- int empty = -1;
- int weakest = -1;
- int weakest_time = Sys_Milliseconds();
- int weakest_pri = 999;
-
- for(i = 0; i < srcCount; i++)
- {
- // If it's locked, we aren't even going to look at it
- if(srcList[i].isLocked)
- continue;
-
- // Is it empty or not?
- if((!srcList[i].isActive) && (empty == -1))
- empty = i;
- else if(srcList[i].priority < priority)
- {
- // If it's older or has lower priority, flag it as weak
- if((srcList[i].priority < weakest_pri) ||
- (srcList[i].lastUsedTime < weakest_time))
- {
- weakest_pri = srcList[i].priority;
- weakest_time = srcList[i].lastUsedTime;
- weakest = i;
- }
- }
-
- // The channel system is not actually adhered to by baseq3, and not
- // implemented in snd_dma.c, so while the following is strictly correct, it
- // causes incorrect behaviour versus defacto baseq3
-#if 0
- // Is it an exact match, and not on channel 0?
- if((srcList[i].entity == entnum) && (srcList[i].channel == channel) && (channel != 0))
- {
- S_AL_SrcKill(i);
- return i;
- }
-#endif
- }
-
- // Do we have an empty one?
- if(empty != -1)
- {
- S_AL_SrcKill( empty );
- return empty;
- }
-
- // No. How about an overridable one?
- if(weakest != -1)
- {
- S_AL_SrcKill(weakest);
- return weakest;
- }
-
- // Nothing. Return failure (cries...)
- return -1;
-}
-
-/*
-=================
-S_AL_SrcFind
-
-Finds an active source with matching entity and channel numbers
-Returns -1 if there isn't one
-=================
-*/
-#if 0
-static
-srcHandle_t S_AL_SrcFind(int entnum, int channel)
-{
- int i;
- for(i = 0; i < srcCount; i++)
- {
- if(!srcList[i].isActive)
- continue;
- if((srcList[i].entity == entnum) && (srcList[i].channel == channel))
- return i;
- }
- return -1;
-}
-#endif
-
-/*
-=================
-S_AL_SrcLock
-
-Locked sources will not be automatically reallocated or managed
-=================
-*/
-static
-void S_AL_SrcLock(srcHandle_t src)
-{
- srcList[src].isLocked = qtrue;
-}
-
-/*
-=================
-S_AL_SrcUnlock
-
-Once unlocked, the source may be reallocated again
-=================
-*/
-static
-void S_AL_SrcUnlock(srcHandle_t src)
-{
- srcList[src].isLocked = qfalse;
-}
-
-/*
-=================
-S_AL_UpdateEntityPosition
-=================
-*/
-static
-void S_AL_UpdateEntityPosition( int entityNum, const vec3_t origin )
-{
- S_AL_SanitiseVector( (vec_t *)origin );
- if ( entityNum < 0 || entityNum > MAX_GENTITIES )
- Com_Error( ERR_DROP, "S_UpdateEntityPosition: bad entitynum %i", entityNum );
- VectorCopy( origin, entityList[entityNum].origin );
-}
-
-/*
-=================
-S_AL_CheckInput
-Check whether input values from mods are out of range.
-Necessary for i.g. Western Quake3 mod which is buggy.
-=================
-*/
-static qboolean S_AL_CheckInput(int entityNum, sfxHandle_t sfx)
-{
- if (entityNum < 0 || entityNum > MAX_GENTITIES)
- Com_Error(ERR_DROP, "S_StartSound: bad entitynum %i", entityNum);
-
- if (sfx < 0 || sfx >= numSfx)
- {
- Com_Printf(S_COLOR_RED "ERROR: S_AL_CheckInput: handle %i out of range\n", sfx);
- return qtrue;
- }
-
- return qfalse;
-}
-
-/*
-=================
-S_AL_StartLocalSound
-
-Play a local (non-spatialized) sound effect
-=================
-*/
-static
-void S_AL_StartLocalSound(sfxHandle_t sfx, int channel)
-{
- srcHandle_t src;
-
- if(S_AL_CheckInput(0, sfx))
- return;
-
- // Try to grab a source
- src = S_AL_SrcAlloc(SRCPRI_LOCAL, -1, channel);
-
- if(src == -1)
- return;
-
- // Set up the effect
- S_AL_SrcSetup(src, sfx, SRCPRI_LOCAL, -1, channel, qtrue);
-
- // Start it playing
- qalSourcePlay(srcList[src].alSource);
-}
-
-/*
-=================
-S_AL_StartSound
-
-Play a one-shot sound effect
-=================
-*/
-static
-void S_AL_StartSound( vec3_t origin, int entnum, int entchannel, sfxHandle_t sfx )
-{
- vec3_t sorigin;
- srcHandle_t src;
-
- if(S_AL_CheckInput(origin ? 0 : entnum, sfx))
- return;
-
- // Try to grab a source
- src = S_AL_SrcAlloc(SRCPRI_ONESHOT, entnum, entchannel);
- if(src == -1)
- return;
-
- // Set up the effect
- if( origin == NULL )
- {
- if( S_AL_HearingThroughEntity( entnum ) )
- {
- // Where the entity is the local player, play a local sound
- S_AL_SrcSetup( src, sfx, SRCPRI_ONESHOT, entnum, entchannel, qtrue );
- VectorClear( sorigin );
- }
- else
- {
- S_AL_SrcSetup( src, sfx, SRCPRI_ONESHOT, entnum, entchannel, qfalse );
- VectorCopy( entityList[ entnum ].origin, sorigin );
- }
- srcList[ src ].isTracking = qtrue;
- }
- else
- {
- S_AL_SrcSetup( src, sfx, SRCPRI_ONESHOT, entnum, entchannel, qfalse );
- VectorCopy( origin, sorigin );
- }
-
- S_AL_SanitiseVector( sorigin );
- qalSourcefv( srcList[ src ].alSource, AL_POSITION, sorigin );
- S_AL_ScaleGain(&srcList[src], sorigin);
-
- // Start it playing
- qalSourcePlay(srcList[src].alSource);
-}
-
-/*
-=================
-S_AL_ClearLoopingSounds
-=================
-*/
-static
-void S_AL_ClearLoopingSounds( qboolean killall )
-{
- int i;
- for(i = 0; i < srcCount; i++)
- {
- if((srcList[i].isLooping) && (srcList[i].entity != -1))
- entityList[srcList[i].entity].loopAddedThisFrame = qfalse;
- }
-}
-
-/*
-=================
-S_AL_SrcLoop
-=================
-*/
-static void S_AL_SrcLoop( alSrcPriority_t priority, sfxHandle_t sfx,
- const vec3_t origin, const vec3_t velocity, int entityNum )
-{
- int src;
- sentity_t *sent = &entityList[ entityNum ];
- src_t *curSource;
-
- // Do we need to allocate a new source for this entity
- if( !sent->srcAllocated )
- {
- // Try to get a channel
- src = S_AL_SrcAlloc( priority, entityNum, -1 );
- if( src == -1 )
- {
- Com_DPrintf( S_COLOR_YELLOW "WARNING: Failed to allocate source "
- "for loop sfx %d on entity %d\n", sfx, entityNum );
- return;
- }
-
- sent->startLoopingSound = qtrue;
- }
- else
- src = sent->srcIndex;
-
- sent->srcAllocated = qtrue;
- sent->srcIndex = src;
-
- sent->loopPriority = priority;
- sent->loopSfx = sfx;
-
- // If this is not set then the looping sound is removed
- sent->loopAddedThisFrame = qtrue;
-
- curSource = &srcList[src];
-
- // UGH
- // These lines should be called via S_AL_SrcSetup, but we
- // can't call that yet as it buffers sfxes that may change
- // with subsequent calls to S_AL_SrcLoop
- curSource->entity = entityNum;
- curSource->isLooping = qtrue;
- curSource->isActive = qtrue;
-
- if( S_AL_HearingThroughEntity( entityNum ) )
- {
- curSource->local = qtrue;
-
- qalSourcefv( curSource->alSource, AL_POSITION, vec3_origin );
- qalSourcefv( curSource->alSource, AL_VELOCITY, vec3_origin );
- }
- else
- {
- curSource->local = qfalse;
-
- qalSourcefv( curSource->alSource, AL_POSITION, (ALfloat *)sent->origin );
- qalSourcefv( curSource->alSource, AL_VELOCITY, (ALfloat *)velocity );
-
- }
-
- S_AL_ScaleGain(curSource, sent->origin);
-}
-
-/*
-=================
-S_AL_AddLoopingSound
-=================
-*/
-static
-void S_AL_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx )
-{
- if(S_AL_CheckInput(entityNum, sfx))
- return;
-
- S_AL_SanitiseVector( (vec_t *)origin );
- S_AL_SanitiseVector( (vec_t *)velocity );
- S_AL_SrcLoop(SRCPRI_ENTITY, sfx, origin, velocity, entityNum);
-}
-
-/*
-=================
-S_AL_AddRealLoopingSound
-=================
-*/
-static
-void S_AL_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx )
-{
- if(S_AL_CheckInput(entityNum, sfx))
- return;
-
- S_AL_SanitiseVector( (vec_t *)origin );
- S_AL_SanitiseVector( (vec_t *)velocity );
-
- // There are certain maps (*cough* Q3:TA mpterra*) that have large quantities
- // of ET_SPEAKERS in the PVS at any given time. OpenAL can't cope with mixing
- // large numbers of sounds, so this culls them by distance
- if( DistanceSquared( origin, lastListenerOrigin ) > (s_alMaxDistance->value + s_alGraceDistance->value) *
- (s_alMaxDistance->value + s_alGraceDistance->value) )
- return;
-
- S_AL_SrcLoop(SRCPRI_AMBIENT, sfx, origin, velocity, entityNum);
-}
-
-/*
-=================
-S_AL_StopLoopingSound
-=================
-*/
-static
-void S_AL_StopLoopingSound(int entityNum )
-{
- if(entityList[entityNum].srcAllocated)
- S_AL_SrcKill(entityList[entityNum].srcIndex);
-}
-
-/*
-=================
-S_AL_SrcUpdate
-
-Update state (move things around, manage sources, and so on)
-=================
-*/
-static
-void S_AL_SrcUpdate( void )
-{
- int i;
- int entityNum;
- ALint state;
- src_t *curSource;
-
- for(i = 0; i < srcCount; i++)
- {
- entityNum = srcList[i].entity;
- curSource = &srcList[i];
-
- if(curSource->isLocked)
- continue;
-
- if(!curSource->isActive)
- continue;
-
- // Update source parameters
- if((s_alGain->modified)||(s_volume->modified))
- curSource->curGain = s_alGain->value * s_volume->value;
- if((s_alRolloff->modified)&&(!curSource->local))
- qalSourcef(curSource->alSource, AL_ROLLOFF_FACTOR, s_alRolloff->value);
- if(s_alMinDistance->modified)
- qalSourcef(curSource->alSource, AL_REFERENCE_DISTANCE, s_alMinDistance->value);
-
- if(curSource->isLooping)
- {
- sentity_t *sent = &entityList[ entityNum ];
-
- // If a looping effect hasn't been touched this frame, kill it
- if(sent->loopAddedThisFrame)
- {
- // The sound has changed without an intervening removal
- if(curSource->isActive && !sent->startLoopingSound &&
- curSource->sfx != sent->loopSfx)
- {
- qalSourceStop(curSource->alSource);
- qalSourcei(curSource->alSource, AL_BUFFER, 0);
- sent->startLoopingSound = qtrue;
- }
-
- // The sound hasn't been started yet
- if(sent->startLoopingSound)
- {
- S_AL_SrcSetup(i, sent->loopSfx, sent->loopPriority,
- entityNum, -1, curSource->local);
- curSource->isLooping = qtrue;
- qalSourcei(curSource->alSource, AL_LOOPING, AL_TRUE);
- qalSourcePlay(curSource->alSource);
-
- sent->startLoopingSound = qfalse;
- }
-
- // Update locality
- if(curSource->local)
- {
- qalSourcei(curSource->alSource, AL_SOURCE_RELATIVE, AL_TRUE);
- qalSourcef(curSource->alSource, AL_ROLLOFF_FACTOR, 0.0f);
- }
- else
- {
- qalSourcei(curSource->alSource, AL_SOURCE_RELATIVE, AL_FALSE);
- qalSourcef(curSource->alSource, AL_ROLLOFF_FACTOR, s_alRolloff->value);
- }
- }
- else
- S_AL_SrcKill( i );
-
- continue;
- }
-
- // Check if it's done, and flag it
- qalGetSourcei(curSource->alSource, AL_SOURCE_STATE, &state);
- if(state == AL_STOPPED)
- {
- S_AL_SrcKill(i);
- continue;
- }
-
- // Query relativity of source, don't move if it's true
- qalGetSourcei(curSource->alSource, AL_SOURCE_RELATIVE, &state);
-
- // See if it needs to be moved
- if(curSource->isTracking && !state)
- {
- qalSourcefv(curSource->alSource, AL_POSITION, entityList[entityNum].origin);
- S_AL_ScaleGain(curSource, entityList[entityNum].origin);
- }
- }
-}
-
-/*
-=================
-S_AL_SrcShutup
-=================
-*/
-static
-void S_AL_SrcShutup( void )
-{
- int i;
- for(i = 0; i < srcCount; i++)
- S_AL_SrcKill(i);
-}
-
-/*
-=================
-S_AL_SrcGet
-=================
-*/
-static
-ALuint S_AL_SrcGet(srcHandle_t src)
-{
- return srcList[src].alSource;
-}
-
-
-//===========================================================================
-
-
-static srcHandle_t streamSourceHandle = -1;
-static qboolean streamPlaying = qfalse;
-static ALuint streamSource;
-
-/*
-=================
-S_AL_AllocateStreamChannel
-=================
-*/
-static void S_AL_AllocateStreamChannel( void )
-{
- // Allocate a streamSource at high priority
- streamSourceHandle = S_AL_SrcAlloc(SRCPRI_STREAM, -2, 0);
- if(streamSourceHandle == -1)
- return;
-
- // Lock the streamSource so nobody else can use it, and get the raw streamSource
- S_AL_SrcLock(streamSourceHandle);
- streamSource = S_AL_SrcGet(streamSourceHandle);
-
- // Set some streamSource parameters
- qalSourcei (streamSource, AL_BUFFER, 0 );
- qalSourcei (streamSource, AL_LOOPING, AL_FALSE );
- qalSource3f(streamSource, AL_POSITION, 0.0, 0.0, 0.0);
- qalSource3f(streamSource, AL_VELOCITY, 0.0, 0.0, 0.0);
- qalSource3f(streamSource, AL_DIRECTION, 0.0, 0.0, 0.0);
- qalSourcef (streamSource, AL_ROLLOFF_FACTOR, 0.0 );
- qalSourcei (streamSource, AL_SOURCE_RELATIVE, AL_TRUE );
-}
-
-/*
-=================
-S_AL_FreeStreamChannel
-=================
-*/
-static void S_AL_FreeStreamChannel( void )
-{
- // Release the output streamSource
- S_AL_SrcUnlock(streamSourceHandle);
- streamSource = 0;
- streamSourceHandle = -1;
-}
-
-/*
-=================
-S_AL_RawSamples
-=================
-*/
-static
-void S_AL_RawSamples(int samples, int rate, int width, int channels, const byte *data, float volume)
-{
- ALuint buffer;
- ALuint format;
-
- format = S_AL_Format( width, channels );
-
- // Create the streamSource if necessary
- if(streamSourceHandle == -1)
- {
- S_AL_AllocateStreamChannel();
-
- // Failed?
- if(streamSourceHandle == -1)
- {
- Com_Printf( S_COLOR_RED "ERROR: Can't allocate streaming streamSource\n");
- return;
- }
- }
-
- // Create a buffer, and stuff the data into it
- qalGenBuffers(1, &buffer);
- qalBufferData(buffer, format, (ALvoid *)data, (samples * width * channels), rate);
-
- // Shove the data onto the streamSource
- qalSourceQueueBuffers(streamSource, 1, &buffer);
-
- // Volume
- qalSourcef (streamSource, AL_GAIN, volume * s_volume->value * s_alGain->value);
-}
-
-/*
-=================
-S_AL_StreamUpdate
-=================
-*/
-static
-void S_AL_StreamUpdate( void )
-{
- int numBuffers;
- ALint state;
-
- if(streamSourceHandle == -1)
- return;
-
- // Un-queue any buffers, and delete them
- qalGetSourcei( streamSource, AL_BUFFERS_PROCESSED, &numBuffers );
- while( numBuffers-- )
- {
- ALuint buffer;
- qalSourceUnqueueBuffers(streamSource, 1, &buffer);
- qalDeleteBuffers(1, &buffer);
- }
-
- // Start the streamSource playing if necessary
- qalGetSourcei( streamSource, AL_BUFFERS_QUEUED, &numBuffers );
-
- qalGetSourcei(streamSource, AL_SOURCE_STATE, &state);
- if(state == AL_STOPPED)
- {
- streamPlaying = qfalse;
-
- // If there are no buffers queued up, release the streamSource
- if( !numBuffers )
- S_AL_FreeStreamChannel( );
- }
-
- if( !streamPlaying && numBuffers )
- {
- qalSourcePlay( streamSource );
- streamPlaying = qtrue;
- }
-}
-
-/*
-=================
-S_AL_StreamDie
-=================
-*/
-static
-void S_AL_StreamDie( void )
-{
- if(streamSourceHandle == -1)
- return;
-
- streamPlaying = qfalse;
- qalSourceStop(streamSource);
- S_AL_FreeStreamChannel();
-}
-
-
-//===========================================================================
-
-
-#define NUM_MUSIC_BUFFERS 4
-#define MUSIC_BUFFER_SIZE 4096
-
-static qboolean musicPlaying = qfalse;
-static srcHandle_t musicSourceHandle = -1;
-static ALuint musicSource;
-static ALuint musicBuffers[NUM_MUSIC_BUFFERS];
-
-static snd_stream_t *mus_stream;
-static snd_stream_t *intro_stream;
-static char s_backgroundLoop[MAX_QPATH];
-
-static byte decode_buffer[MUSIC_BUFFER_SIZE];
-
-/*
-=================
-S_AL_MusicSourceGet
-=================
-*/
-static void S_AL_MusicSourceGet( void )
-{
- // Allocate a musicSource at high priority
- musicSourceHandle = S_AL_SrcAlloc(SRCPRI_STREAM, -2, 0);
- if(musicSourceHandle == -1)
- return;
-
- // Lock the musicSource so nobody else can use it, and get the raw musicSource
- S_AL_SrcLock(musicSourceHandle);
- musicSource = S_AL_SrcGet(musicSourceHandle);
-
- // Set some musicSource parameters
- qalSource3f(musicSource, AL_POSITION, 0.0, 0.0, 0.0);
- qalSource3f(musicSource, AL_VELOCITY, 0.0, 0.0, 0.0);
- qalSource3f(musicSource, AL_DIRECTION, 0.0, 0.0, 0.0);
- qalSourcef (musicSource, AL_ROLLOFF_FACTOR, 0.0 );
- qalSourcei (musicSource, AL_SOURCE_RELATIVE, AL_TRUE );
-}
-
-/*
-=================
-S_AL_MusicSourceFree
-=================
-*/
-static void S_AL_MusicSourceFree( void )
-{
- // Release the output musicSource
- S_AL_SrcUnlock(musicSourceHandle);
- musicSource = 0;
- musicSourceHandle = -1;
-}
-
-/*
-=================
-S_AL_CloseMusicFiles
-=================
-*/
-static void S_AL_CloseMusicFiles(void)
-{
- if(intro_stream)
- {
- S_CodecCloseStream(intro_stream);
- intro_stream = NULL;
- }
-
- if(mus_stream)
- {
- S_CodecCloseStream(mus_stream);
- mus_stream = NULL;
- }
-}
-
-/*
-=================
-S_AL_StopBackgroundTrack
-=================
-*/
-static
-void S_AL_StopBackgroundTrack( void )
-{
- if(!musicPlaying)
- return;
-
- // Stop playing
- qalSourceStop(musicSource);
-
- // De-queue the musicBuffers
- qalSourceUnqueueBuffers(musicSource, NUM_MUSIC_BUFFERS, musicBuffers);
-
- // Destroy the musicBuffers
- qalDeleteBuffers(NUM_MUSIC_BUFFERS, musicBuffers);
-
- // Free the musicSource
- S_AL_MusicSourceFree();
-
- // Unload the stream
- S_AL_CloseMusicFiles();
-
- musicPlaying = qfalse;
-}
-
-/*
-=================
-S_AL_MusicProcess
-=================
-*/
-static
-void S_AL_MusicProcess(ALuint b)
-{
- ALenum error;
- int l;
- ALuint format;
- snd_stream_t *curstream;
-
- if(intro_stream)
- curstream = intro_stream;
- else
- curstream = mus_stream;
-
- if(!curstream)
- return;
-
- l = S_CodecReadStream(curstream, MUSIC_BUFFER_SIZE, decode_buffer);
-
- // Run out data to read, start at the beginning again
- if(l == 0)
- {
- S_CodecCloseStream(curstream);
-
- // the intro stream just finished playing so we don't need to reopen
- // the music stream.
- if(intro_stream)
- intro_stream = NULL;
- else
- mus_stream = S_CodecOpenStream(s_backgroundLoop);
-
- curstream = mus_stream;
-
- if(!curstream)
- {
- S_AL_StopBackgroundTrack();
- return;
- }
-
- l = S_CodecReadStream(curstream, MUSIC_BUFFER_SIZE, decode_buffer);
- }
-
- format = S_AL_Format(curstream->info.width, curstream->info.channels);
-
- if( l == 0 )
- {
- // We have no data to buffer, so buffer silence
- byte dummyData[ 2 ] = { 0 };
-
- qalBufferData( b, AL_FORMAT_MONO16, (void *)dummyData, 2, 22050 );
- }
- else
- qalBufferData(b, format, decode_buffer, l, curstream->info.rate);
-
- if( ( error = qalGetError( ) ) != AL_NO_ERROR )
- {
- S_AL_StopBackgroundTrack( );
- Com_Printf( S_COLOR_RED "ERROR: while buffering data for music stream - %s\n",
- S_AL_ErrorMsg( error ) );
- return;
- }
-}
-
-/*
-=================
-S_AL_StartBackgroundTrack
-=================
-*/
-static
-void S_AL_StartBackgroundTrack( const char *intro, const char *loop )
-{
- int i;
- qboolean issame;
-
- // Stop any existing music that might be playing
- S_AL_StopBackgroundTrack();
-
- if((!intro || !*intro) && (!loop || !*loop))
- return;
-
- // Allocate a musicSource
- S_AL_MusicSourceGet();
- if(musicSourceHandle == -1)
- return;
-
- if (!loop || !*loop)
- {
- loop = intro;
- issame = qtrue;
- }
- else if(intro && *intro && !strcmp(intro, loop))
- issame = qtrue;
- else
- issame = qfalse;
-
- // Copy the loop over
- strncpy( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) );
-
- if(!issame)
- {
- // Open the intro and don't mind whether it succeeds.
- // The important part is the loop.
- intro_stream = S_CodecOpenStream(intro);
- }
- else
- intro_stream = NULL;
-
- mus_stream = S_CodecOpenStream(s_backgroundLoop);
- if(!mus_stream)
- {
- S_AL_CloseMusicFiles();
- S_AL_MusicSourceFree();
- return;
- }
-
- // Generate the musicBuffers
- qalGenBuffers(NUM_MUSIC_BUFFERS, musicBuffers);
-
- // Queue the musicBuffers up
- for(i = 0; i < NUM_MUSIC_BUFFERS; i++)
- {
- S_AL_MusicProcess(musicBuffers[i]);
- }
-
- qalSourceQueueBuffers(musicSource, NUM_MUSIC_BUFFERS, musicBuffers);
-
- // Set the initial gain property
- qalSourcef(musicSource, AL_GAIN, s_alGain->value * s_musicVolume->value);
-
- // Start playing
- qalSourcePlay(musicSource);
-
- musicPlaying = qtrue;
-}
-
-/*
-=================
-S_AL_MusicUpdate
-=================
-*/
-static
-void S_AL_MusicUpdate( void )
-{
- int numBuffers;
- ALint state;
-
- if(!musicPlaying)
- return;
-
- qalGetSourcei( musicSource, AL_BUFFERS_PROCESSED, &numBuffers );
- while( numBuffers-- )
- {
- ALuint b;
- qalSourceUnqueueBuffers(musicSource, 1, &b);
- S_AL_MusicProcess(b);
- qalSourceQueueBuffers(musicSource, 1, &b);
- }
-
- // Hitches can cause OpenAL to be starved of buffers when streaming.
- // If this happens, it will stop playback. This restarts the source if
- // it is no longer playing, and if there are buffers available
- qalGetSourcei( musicSource, AL_SOURCE_STATE, &state );
- qalGetSourcei( musicSource, AL_BUFFERS_QUEUED, &numBuffers );
- if( state == AL_STOPPED && numBuffers )
- {
- Com_DPrintf( S_COLOR_YELLOW "Restarted OpenAL music\n" );
- qalSourcePlay(musicSource);
- }
-
- // Set the gain property
- qalSourcef(musicSource, AL_GAIN, s_alGain->value * s_musicVolume->value);
-}
-
-
-//===========================================================================
-
-
-// Local state variables
-static ALCdevice *alDevice;
-static ALCcontext *alContext;
-
-#ifdef _WIN32
-#define ALDRIVER_DEFAULT "OpenAL32.dll"
-#define ALDEVICE_DEFAULT "Generic Software"
-#elif defined(MACOS_X)
-#define ALDRIVER_DEFAULT "/System/Library/Frameworks/OpenAL.framework/OpenAL"
-#else
-#define ALDRIVER_DEFAULT "libopenal.so.0"
-#endif
-
-/*
-=================
-S_AL_StopAllSounds
-=================
-*/
-static
-void S_AL_StopAllSounds( void )
-{
- S_AL_SrcShutup();
- S_AL_StopBackgroundTrack();
- S_AL_StreamDie();
-}
-
-/*
-=================
-S_AL_Respatialize
-=================
-*/
-static
-void S_AL_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater )
-{
- float velocity[3] = {0.0f, 0.0f, 0.0f};
- float orientation[6];
- vec3_t sorigin;
-
- VectorCopy( origin, sorigin );
- S_AL_SanitiseVector( sorigin );
-
- S_AL_SanitiseVector( axis[ 0 ] );
- S_AL_SanitiseVector( axis[ 1 ] );
- S_AL_SanitiseVector( axis[ 2 ] );
-
- orientation[0] = axis[0][0]; orientation[1] = axis[0][1]; orientation[2] = axis[0][2];
- orientation[3] = axis[2][0]; orientation[4] = axis[2][1]; orientation[5] = axis[2][2];
-
- VectorCopy( sorigin, lastListenerOrigin );
-
- // Set OpenAL listener paramaters
- qalListenerfv(AL_POSITION, (ALfloat *)sorigin);
- qalListenerfv(AL_VELOCITY, velocity);
- qalListenerfv(AL_ORIENTATION, orientation);
-}
-
-/*
-=================
-S_AL_Update
-=================
-*/
-static
-void S_AL_Update( void )
-{
- // Update SFX channels
- S_AL_SrcUpdate();
-
- // Update streams
- S_AL_StreamUpdate();
- S_AL_MusicUpdate();
-
- // Doppler
- if(s_doppler->modified)
- {
- s_alDopplerFactor->modified = qtrue;
- s_doppler->modified = qfalse;
- }
-
- // Doppler parameters
- if(s_alDopplerFactor->modified)
- {
- if(s_doppler->integer)
- qalDopplerFactor(s_alDopplerFactor->value);
- else
- qalDopplerFactor(0.0f);
- s_alDopplerFactor->modified = qfalse;
- }
- if(s_alDopplerSpeed->modified)
- {
- qalDopplerVelocity(s_alDopplerSpeed->value);
- s_alDopplerSpeed->modified = qfalse;
- }
-
- // Clear the modified flags on the other cvars
- s_alGain->modified = qfalse;
- s_volume->modified = qfalse;
- s_musicVolume->modified = qfalse;
- s_alMinDistance->modified = qfalse;
- s_alRolloff->modified = qfalse;
-}
-
-/*
-=================
-S_AL_DisableSounds
-=================
-*/
-static
-void S_AL_DisableSounds( void )
-{
- S_AL_StopAllSounds();
-}
-
-/*
-=================
-S_AL_BeginRegistration
-=================
-*/
-static
-void S_AL_BeginRegistration( void )
-{
-}
-
-/*
-=================
-S_AL_ClearSoundBuffer
-=================
-*/
-static
-void S_AL_ClearSoundBuffer( void )
-{
-}
-
-/*
-=================
-S_AL_SoundList
-=================
-*/
-static
-void S_AL_SoundList( void )
-{
-}
-
-/*
-=================
-S_AL_SoundInfo
-=================
-*/
-static
-void S_AL_SoundInfo( void )
-{
- Com_Printf( "OpenAL info:\n" );
- Com_Printf( " Vendor: %s\n", qalGetString( AL_VENDOR ) );
- Com_Printf( " Version: %s\n", qalGetString( AL_VERSION ) );
- Com_Printf( " Renderer: %s\n", qalGetString( AL_RENDERER ) );
- Com_Printf( " Extensions: %s\n", qalGetString( AL_EXTENSIONS ) );
- if(qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
- {
- Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER));
- Com_Printf("Available Devices:\n%s", s_alAvailableDevices->string);
- }
-}
-
-/*
-=================
-S_AL_Shutdown
-=================
-*/
-static
-void S_AL_Shutdown( void )
-{
- // Shut down everything
- S_AL_StreamDie( );
- S_AL_StopBackgroundTrack( );
- S_AL_SrcShutdown( );
- S_AL_BufferShutdown( );
-
- // Check for Linux shutdown race condition
- // FIXME: this will probably not be necessary once OpenAL CVS
- // from 11/11/05 is released and prevelant
- if( Q_stricmp((const char*)qalGetString( AL_VENDOR ), "J. Valenzuela" ) ) {
- qalcMakeContextCurrent( NULL );
- }
-
- qalcDestroyContext(alContext);
- qalcCloseDevice(alDevice);
-
- QAL_Shutdown();
-}
-
-#endif
-
-/*
-=================
-S_AL_Init
-=================
-*/
-qboolean S_AL_Init( soundInterface_t *si )
-{
-#if USE_OPENAL
-
- qboolean enumsupport, founddev = qfalse;
-
- if( !si ) {
- return qfalse;
- }
-
- // New console variables
- s_alPrecache = Cvar_Get( "s_alPrecache", "1", CVAR_ARCHIVE );
- s_alGain = Cvar_Get( "s_alGain", "0.4", CVAR_ARCHIVE );
- s_alSources = Cvar_Get( "s_alSources", "96", CVAR_ARCHIVE );
- s_alDopplerFactor = Cvar_Get( "s_alDopplerFactor", "1.0", CVAR_ARCHIVE );
- s_alDopplerSpeed = Cvar_Get( "s_alDopplerSpeed", "2200", CVAR_ARCHIVE );
- s_alMinDistance = Cvar_Get( "s_alMinDistance", "120", CVAR_CHEAT );
- s_alMaxDistance = Cvar_Get("s_alMaxDistance", "1024", CVAR_CHEAT);
- s_alRolloff = Cvar_Get( "s_alRolloff", "2", CVAR_CHEAT);
- s_alGraceDistance = Cvar_Get("s_alGraceDistance", "512", CVAR_CHEAT);
-
- s_alDriver = Cvar_Get( "s_alDriver", ALDRIVER_DEFAULT, CVAR_ARCHIVE );
-
- // Load QAL
- if( !QAL_Init( s_alDriver->string ) )
- {
- Com_Printf( "Failed to load library: \"%s\".\n", s_alDriver->string );
- return qfalse;
- }
-
- // Device enumeration support (extension is implemented reasonably only on Windows right now).
- if((enumsupport = qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")))
- {
- char devicenames[1024] = "";
- const char *devicelist;
- const char *defaultdevice;
- int curlen;
-
- // get all available devices + the default device name.
- devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER);
- defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
-
-#ifdef _WIN32
- // check whether the default device is generic hardware. If it is, change to
- // Generic Software as that one works more reliably with various sound systems.
- // If it's not, use OpenAL's default selection as we don't want to ignore
- // native hardware acceleration.
- if(!strcmp(defaultdevice, "Generic Hardware"))
- s_alDevice = Cvar_Get("s_alDevice", ALDEVICE_DEFAULT, CVAR_ARCHIVE | CVAR_LATCH);
- else
-#endif
- s_alDevice = Cvar_Get("s_alDevice", defaultdevice, CVAR_ARCHIVE | CVAR_LATCH);
-
- // dump a list of available devices to a cvar for the user to see.
- while((curlen = strlen(devicelist)))
- {
- Q_strcat(devicenames, sizeof(devicenames), devicelist);
- Q_strcat(devicenames, sizeof(devicenames), "\n");
-
- // check whether the device we want to load is available at all.
- if(!strcmp(s_alDevice->string, devicelist))
- founddev = qtrue;
-
- devicelist += curlen + 1;
- }
-
- s_alAvailableDevices = Cvar_Get("s_alAvailableDevices", devicenames, CVAR_ROM | CVAR_NORESTART);
-
- if(!founddev)
- {
- Cvar_ForceReset("s_alDevice");
- founddev = 1;
- }
- }
-
- if(founddev)
- alDevice = qalcOpenDevice(s_alDevice->string);
- else
- alDevice = qalcOpenDevice(NULL);
-
- if( !alDevice )
- {
- QAL_Shutdown( );
- Com_Printf( "Failed to open OpenAL device.\n" );
- return qfalse;
- }
-
- if(enumsupport)
- Cvar_Set("s_alDevice", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER));
-
- // Create OpenAL context
- alContext = qalcCreateContext( alDevice, NULL );
- if( !alContext )
- {
- QAL_Shutdown( );
- qalcCloseDevice( alDevice );
- Com_Printf( "Failed to create OpenAL context.\n" );
- return qfalse;
- }
- qalcMakeContextCurrent( alContext );
-
- // Initialize sources, buffers, music
- S_AL_BufferInit( );
- S_AL_SrcInit( );
-
- // Set up OpenAL parameters (doppler, etc)
- qalDistanceModel(AL_INVERSE_DISTANCE_CLAMPED);
- qalDopplerFactor( s_alDopplerFactor->value );
- qalDopplerVelocity( s_alDopplerSpeed->value );
-
- si->Shutdown = S_AL_Shutdown;
- si->StartSound = S_AL_StartSound;
- si->StartLocalSound = S_AL_StartLocalSound;
- si->StartBackgroundTrack = S_AL_StartBackgroundTrack;
- si->StopBackgroundTrack = S_AL_StopBackgroundTrack;
- si->RawSamples = S_AL_RawSamples;
- si->StopAllSounds = S_AL_StopAllSounds;
- si->ClearLoopingSounds = S_AL_ClearLoopingSounds;
- si->AddLoopingSound = S_AL_AddLoopingSound;
- si->AddRealLoopingSound = S_AL_AddRealLoopingSound;
- si->StopLoopingSound = S_AL_StopLoopingSound;
- si->Respatialize = S_AL_Respatialize;
- si->UpdateEntityPosition = S_AL_UpdateEntityPosition;
- si->Update = S_AL_Update;
- si->DisableSounds = S_AL_DisableSounds;
- si->BeginRegistration = S_AL_BeginRegistration;
- si->RegisterSound = S_AL_RegisterSound;
- si->ClearSoundBuffer = S_AL_ClearSoundBuffer;
- si->SoundInfo = S_AL_SoundInfo;
- si->SoundList = S_AL_SoundList;
-
- return qtrue;
-#else
- return qfalse;
-#endif
-}
-
diff --git a/src/client/snd_public.h b/src/client/snd_public.h
deleted file mode 100644
index c85f414..0000000
--- a/src/client/snd_public.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-
-void S_Init( void );
-void S_Shutdown( void );
-
-// if origin is NULL, the sound will be dynamically sourced from the entity
-void S_StartSound( vec3_t origin, int entnum, int entchannel, sfxHandle_t sfx );
-void S_StartLocalSound( sfxHandle_t sfx, int channelNum );
-
-void S_StartBackgroundTrack( const char *intro, const char *loop );
-void S_StopBackgroundTrack( void );
-
-// cinematics and voice-over-network will send raw samples
-// 1.0 volume will be direct output of source samples
-void S_RawSamples (int samples, int rate, int width, int channels,
- const byte *data, float volume);
-
-// stop all sounds and the background track
-void S_StopAllSounds( void );
-
-// all continuous looping sounds must be added before calling S_Update
-void S_ClearLoopingSounds( qboolean killall );
-void S_AddLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
-void S_AddRealLoopingSound( int entityNum, const vec3_t origin, const vec3_t velocity, sfxHandle_t sfx );
-void S_StopLoopingSound(int entityNum );
-
-// recompute the reletive volumes for all running sounds
-// reletive to the given entityNum / orientation
-void S_Respatialize( int entityNum, const vec3_t origin, vec3_t axis[3], int inwater );
-
-// let the sound system know where an entity currently is
-void S_UpdateEntityPosition( int entityNum, const vec3_t origin );
-
-void S_Update( void );
-
-void S_DisableSounds( void );
-
-void S_BeginRegistration( void );
-
-// RegisterSound will allways return a valid sample, even if it
-// has to create a placeholder. This prevents continuous filesystem
-// checks for missing files
-sfxHandle_t S_RegisterSound( const char *sample, qboolean compressed );
-
-void S_DisplayFreeMemory(void);
-
-void S_ClearSoundBuffer( void );
-
-void SNDDMA_Activate( void );
-
-void S_UpdateBackgroundTrack( void );
diff --git a/src/client/snd_wavelet.c b/src/client/snd_wavelet.c
deleted file mode 100644
index 690ad3a..0000000
--- a/src/client/snd_wavelet.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
-===========================================================================
-Copyright (C) 1999-2005 Id Software, Inc.
-Copyright (C) 2000-2006 Tim Angus
-
-This file is part of Tremulous.
-
-Tremulous is free software; you can redistribute it
-and/or modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; either version 2 of the License,
-or (at your option) any later version.
-
-Tremulous is distributed in the hope that it will be
-useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Tremulous; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-===========================================================================
-*/
-
-#include "snd_local.h"
-
-long myftol( float f );
-
-#define C0 0.4829629131445341
-#define C1 0.8365163037378079
-#define C2 0.2241438680420134
-#define C3 -0.1294095225512604
-
-void daub4(float b[], unsigned long n, int isign)
-{
- float wksp[4097];
- float *a=b-1; // numerical recipies so a[1] = b[0]
-
- unsigned long nh,nh1,i,j;
-
- if (n < 4) return;
-
- nh1=(nh=n >> 1)+1;
- if (isign >= 0) {
- for (i=1,j=1;j<=n-3;j+=2,i++) {
- wksp[i] = C0*a[j]+C1*a[j+1]+C2*a[j+2]+C3*a[j+3];
- wksp[i+nh] = C3*a[j]-C2*a[j+1]+C1*a[j+2]-C0*a[j+3];
- }
- wksp[i ] = C0*a[n-1]+C1*a[n]+C2*a[1]+C3*a[2];
- wksp[i+nh] = C3*a[n-1]-C2*a[n]+C1*a[1]-C0*a[2];
- } else {
- wksp[1] = C2*a[nh]+C1*a[n]+C0*a[1]+C3*a[nh1];
- wksp[2] = C3*a[nh]-C0*a[n]+C1*a[1]-C2*a[nh1];
- for (i=1,j=3;i= 0) {
- for (nn=n;nn>=inverseStartLength;nn>>=1) daub4(a,nn,isign);
- } else {
- for (nn=inverseStartLength;nn<=n;nn<<=1) daub4(a,nn,isign);
- }
-}
-
-/* The number of bits required by each value */
-static unsigned char numBits[] = {
- 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
- 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-};
-
-byte MuLawEncode(short s) {
- unsigned long adjusted;
- byte sign, exponent, mantissa;
-
- sign = (s<0)?0:0x80;
-
- if (s<0) s=-s;
- adjusted = (long)s << (16-sizeof(short)*8);
- adjusted += 128L + 4L;
- if (adjusted > 32767) adjusted = 32767;
- exponent = numBits[(adjusted>>7)&0xff] - 1;
- mantissa = (adjusted>>(exponent+3))&0xf;
- return ~(sign | (exponent<<4) | mantissa);
-}
-
-short MuLawDecode(byte uLaw) {
- signed long adjusted;
- byte exponent, mantissa;
-
- uLaw = ~uLaw;
- exponent = (uLaw>>4) & 0x7;
- mantissa = (uLaw&0xf) + 16;
- adjusted = (mantissa << (exponent +3)) - 128 - 4;
-
- return (uLaw & 0x80)? adjusted : -adjusted;
-}
-
-short mulawToShort[256];
-static qboolean madeTable = qfalse;
-
-static int NXStreamCount;
-
-void NXPutc(NXStream *stream, char out) {
- stream[NXStreamCount++] = out;
-}
-
-
-void encodeWavelet( sfx_t *sfx, short *packets) {
- float wksp[4097], temp;
- int i, samples, size;
- sndBuffer *newchunk, *chunk;
- byte *out;
-
- if (!madeTable) {
- for (i=0;i<256;i++) {
- mulawToShort[i] = (float)MuLawDecode((byte)i);
- }
- madeTable = qtrue;
- }
- chunk = NULL;
-
- samples = sfx->soundLength;
- while(samples>0) {
- size = samples;
- if (size>(SND_CHUNK_SIZE*2)) {
- size = (SND_CHUNK_SIZE*2);
- }
-
- if (size<4) {
- size = 4;
- }
-
- newchunk = SND_malloc();
- if (sfx->soundData == NULL) {
- sfx->soundData = newchunk;
- } else {
- chunk->next = newchunk;
- }
- chunk = newchunk;
- for(i=0; isndChunk;
-
- for(i=0;i 32767) temp = 32767; else if (temp<-32768) temp = -32768;
- out[i] = MuLawEncode((short)temp);
- }
-
- chunk->size = size;
- samples -= size;
- }
-}
-
-void decodeWavelet(sndBuffer *chunk, short *to) {
- float wksp[4097];
- int i;
- byte *out;
-
- int size = chunk->size;
-
- out = (byte *)chunk->sndChunk;
- for(i=0;isoundLength;
- grade = 0;
-
- while(samples>0) {
- size = samples;
- if (size>(SND_CHUNK_SIZE*2)) {
- size = (SND_CHUNK_SIZE*2);
- }
-
- newchunk = SND_malloc();
- if (sfx->soundData == NULL) {
- sfx->soundData = newchunk;
- } else {
- chunk->next = newchunk;
- }
- chunk = newchunk;
- out = (byte *)chunk->sndChunk;
- for(i=0; i32767) {
- poop = 32767;
- } else if (poop<-32768) {
- poop = -32768;
- }
- out[i] = MuLawEncode((short)poop);
- grade = poop - mulawToShort[out[i]];
- packets++;
- }
- chunk->size = size;
- samples -= size;
- }
-}
-
-void decodeMuLaw(sndBuffer *chunk, short *to) {
- int i;
- byte *out;
-
- int size = chunk->size;
-
- out = (byte *)chunk->sndChunk;
- for(i=0;ierr;
- MEMZERO(cinfo, SIZEOF(struct jpeg_compress_struct));
- cinfo->err = err;
- }
- cinfo->is_decompressor = FALSE;
-
- /* Initialize a memory manager instance for this object */
- jinit_memory_mgr((j_common_ptr) cinfo);
-
- /* Zero out pointers to permanent structures. */
- cinfo->progress = NULL;
- cinfo->dest = NULL;
-
- cinfo->comp_info = NULL;
-
- for (i = 0; i < NUM_QUANT_TBLS; i++)
- cinfo->quant_tbl_ptrs[i] = NULL;
-
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- cinfo->dc_huff_tbl_ptrs[i] = NULL;
- cinfo->ac_huff_tbl_ptrs[i] = NULL;
- }
-
- cinfo->input_gamma = 1.0; /* in case application forgets */
-
- /* OK, I'm ready */
- cinfo->global_state = CSTATE_START;
-}
-
-
-/*
- * Destruction of a JPEG compression object
- */
-
-GLOBAL void
-jpeg_destroy_compress (j_compress_ptr cinfo)
-{
- jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
-}
-
-
-/*
- * Abort processing of a JPEG compression operation,
- * but don't destroy the object itself.
- */
-
-GLOBAL void
-jpeg_abort_compress (j_compress_ptr cinfo)
-{
- jpeg_abort((j_common_ptr) cinfo); /* use common routine */
-}
-
-
-/*
- * Forcibly suppress or un-suppress all quantization and Huffman tables.
- * Marks all currently defined tables as already written (if suppress)
- * or not written (if !suppress). This will control whether they get emitted
- * by a subsequent jpeg_start_compress call.
- *
- * This routine is exported for use by applications that want to produce
- * abbreviated JPEG datastreams. It logically belongs in jcparam.c, but
- * since it is called by jpeg_start_compress, we put it here --- otherwise
- * jcparam.o would be linked whether the application used it or not.
- */
-
-GLOBAL void
-jpeg_suppress_tables (j_compress_ptr cinfo, boolean suppress)
-{
- int i;
- JQUANT_TBL * qtbl;
- JHUFF_TBL * htbl;
-
- for (i = 0; i < NUM_QUANT_TBLS; i++) {
- if ((qtbl = cinfo->quant_tbl_ptrs[i]) != NULL)
- qtbl->sent_table = suppress;
- }
-
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- if ((htbl = cinfo->dc_huff_tbl_ptrs[i]) != NULL)
- htbl->sent_table = suppress;
- if ((htbl = cinfo->ac_huff_tbl_ptrs[i]) != NULL)
- htbl->sent_table = suppress;
- }
-}
-
-
-/*
- * Finish JPEG compression.
- *
- * If a multipass operating mode was selected, this may do a great deal of
- * work including most of the actual output.
- */
-
-GLOBAL void
-jpeg_finish_compress (j_compress_ptr cinfo)
-{
- JDIMENSION iMCU_row;
-
- if (cinfo->global_state == CSTATE_SCANNING ||
- cinfo->global_state == CSTATE_RAW_OK) {
- /* Terminate first pass */
- if (cinfo->next_scanline < cinfo->image_height)
- ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
- (*cinfo->master->finish_pass) (cinfo);
- } else if (cinfo->global_state != CSTATE_WRCOEFS)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- /* Perform any remaining passes */
- while (! cinfo->master->is_last_pass) {
- (*cinfo->master->prepare_for_pass) (cinfo);
- for (iMCU_row = 0; iMCU_row < cinfo->total_iMCU_rows; iMCU_row++) {
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) iMCU_row;
- cinfo->progress->pass_limit = (long) cinfo->total_iMCU_rows;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
- /* We bypass the main controller and invoke coef controller directly;
- * all work is being done from the coefficient buffer.
- */
- if (! (*cinfo->coef->compress_data) (cinfo, (JSAMPIMAGE) NULL))
- ERREXIT(cinfo, JERR_CANT_SUSPEND);
- }
- (*cinfo->master->finish_pass) (cinfo);
- }
- /* Write EOI, do final cleanup */
- (*cinfo->marker->write_file_trailer) (cinfo);
- (*cinfo->dest->term_destination) (cinfo);
- /* We can use jpeg_abort to release memory and reset global_state */
- jpeg_abort((j_common_ptr) cinfo);
-}
-
-
-/*
- * Write a special marker.
- * This is only recommended for writing COM or APPn markers.
- * Must be called after jpeg_start_compress() and before
- * first call to jpeg_write_scanlines() or jpeg_write_raw_data().
- */
-
-GLOBAL void
-jpeg_write_marker (j_compress_ptr cinfo, int marker,
- const JOCTET *dataptr, unsigned int datalen)
-{
- if (cinfo->next_scanline != 0 ||
- (cinfo->global_state != CSTATE_SCANNING &&
- cinfo->global_state != CSTATE_RAW_OK &&
- cinfo->global_state != CSTATE_WRCOEFS))
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- (*cinfo->marker->write_any_marker) (cinfo, marker, dataptr, datalen);
-}
-
-
-/*
- * Alternate compression function: just write an abbreviated table file.
- * Before calling this, all parameters and a data destination must be set up.
- *
- * To produce a pair of files containing abbreviated tables and abbreviated
- * image data, one would proceed as follows:
- *
- * initialize JPEG object
- * set JPEG parameters
- * set destination to table file
- * jpeg_write_tables(cinfo);
- * set destination to image file
- * jpeg_start_compress(cinfo, FALSE);
- * write data...
- * jpeg_finish_compress(cinfo);
- *
- * jpeg_write_tables has the side effect of marking all tables written
- * (same as jpeg_suppress_tables(..., TRUE)). Thus a subsequent start_compress
- * will not re-emit the tables unless it is passed write_all_tables=TRUE.
- */
-
-GLOBAL void
-jpeg_write_tables (j_compress_ptr cinfo)
-{
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- /* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
- (*cinfo->dest->init_destination) (cinfo);
- /* Initialize the marker writer ... bit of a crock to do it here. */
- jinit_marker_writer(cinfo);
- /* Write them tables! */
- (*cinfo->marker->write_tables_only) (cinfo);
- /* And clean up. */
- (*cinfo->dest->term_destination) (cinfo);
- /* We can use jpeg_abort to release memory. */
- jpeg_abort((j_common_ptr) cinfo);
-}
diff --git a/src/jpeg-6/jcapistd.c b/src/jpeg-6/jcapistd.c
deleted file mode 100644
index b99e560..0000000
--- a/src/jpeg-6/jcapistd.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * jcapistd.c
- *
- * Copyright (C) 1994-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface code for the compression half
- * of the JPEG library. These are the "standard" API routines that are
- * used in the normal full-compression case. They are not used by a
- * transcoding-only application. Note that if an application links in
- * jpeg_start_compress, it will end up linking in the entire compressor.
- * We thus must separate this file from jcapimin.c to avoid linking the
- * whole compression library into a transcoder.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Compression initialization.
- * Before calling this, all parameters and a data destination must be set up.
- *
- * We require a write_all_tables parameter as a failsafe check when writing
- * multiple datastreams from the same compression object. Since prior runs
- * will have left all the tables marked sent_table=TRUE, a subsequent run
- * would emit an abbreviated stream (no tables) by default. This may be what
- * is wanted, but for safety's sake it should not be the default behavior:
- * programmers should have to make a deliberate choice to emit abbreviated
- * images. Therefore the documentation and examples should encourage people
- * to pass write_all_tables=TRUE; then it will take active thought to do the
- * wrong thing.
- */
-
-GLOBAL void
-jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
-{
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- if (write_all_tables)
- jpeg_suppress_tables(cinfo, FALSE); /* mark all tables to be written */
-
- /* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
- (*cinfo->dest->init_destination) (cinfo);
- /* Perform master selection of active modules */
- jinit_compress_master(cinfo);
- /* Set up for the first pass */
- (*cinfo->master->prepare_for_pass) (cinfo);
- /* Ready for application to drive first pass through jpeg_write_scanlines
- * or jpeg_write_raw_data.
- */
- cinfo->next_scanline = 0;
- cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
-}
-
-
-/*
- * Write some scanlines of data to the JPEG compressor.
- *
- * The return value will be the number of lines actually written.
- * This should be less than the supplied num_lines only in case that
- * the data destination module has requested suspension of the compressor,
- * or if more than image_height scanlines are passed in.
- *
- * Note: we warn about excess calls to jpeg_write_scanlines() since
- * this likely signals an application programmer error. However,
- * excess scanlines passed in the last valid call are *silently* ignored,
- * so that the application need not adjust num_lines for end-of-image
- * when using a multiple-scanline buffer.
- */
-
-GLOBAL JDIMENSION
-jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
- JDIMENSION num_lines)
-{
- JDIMENSION row_ctr, rows_left;
-
- if (cinfo->global_state != CSTATE_SCANNING)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- if (cinfo->next_scanline >= cinfo->image_height)
- WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
-
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->next_scanline;
- cinfo->progress->pass_limit = (long) cinfo->image_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
-
- /* Give master control module another chance if this is first call to
- * jpeg_write_scanlines. This lets output of the frame/scan headers be
- * delayed so that application can write COM, etc, markers between
- * jpeg_start_compress and jpeg_write_scanlines.
- */
- if (cinfo->master->call_pass_startup)
- (*cinfo->master->pass_startup) (cinfo);
-
- /* Ignore any extra scanlines at bottom of image. */
- rows_left = cinfo->image_height - cinfo->next_scanline;
- if (num_lines > rows_left)
- num_lines = rows_left;
-
- row_ctr = 0;
- (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);
- cinfo->next_scanline += row_ctr;
- return row_ctr;
-}
-
-
-/*
- * Alternate entry point to write raw data.
- * Processes exactly one iMCU row per call, unless suspended.
- */
-
-GLOBAL JDIMENSION
-jpeg_write_raw_data (j_compress_ptr cinfo, JSAMPIMAGE data,
- JDIMENSION num_lines)
-{
- JDIMENSION lines_per_iMCU_row;
-
- if (cinfo->global_state != CSTATE_RAW_OK)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- if (cinfo->next_scanline >= cinfo->image_height) {
- WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
- return 0;
- }
-
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->next_scanline;
- cinfo->progress->pass_limit = (long) cinfo->image_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
-
- /* Give master control module another chance if this is first call to
- * jpeg_write_raw_data. This lets output of the frame/scan headers be
- * delayed so that application can write COM, etc, markers between
- * jpeg_start_compress and jpeg_write_raw_data.
- */
- if (cinfo->master->call_pass_startup)
- (*cinfo->master->pass_startup) (cinfo);
-
- /* Verify that at least one iMCU row has been passed. */
- lines_per_iMCU_row = cinfo->max_v_samp_factor * DCTSIZE;
- if (num_lines < lines_per_iMCU_row)
- ERREXIT(cinfo, JERR_BUFFER_SIZE);
-
- /* Directly compress the row. */
- if (! (*cinfo->coef->compress_data) (cinfo, data)) {
- /* If compressor did not consume the whole row, suspend processing. */
- return 0;
- }
-
- /* OK, we processed one iMCU row. */
- cinfo->next_scanline += lines_per_iMCU_row;
- return lines_per_iMCU_row;
-}
diff --git a/src/jpeg-6/jccoefct.c b/src/jpeg-6/jccoefct.c
deleted file mode 100644
index ea3169b..0000000
--- a/src/jpeg-6/jccoefct.c
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * jccoefct.c
- *
- * Copyright (C) 1994-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the coefficient buffer controller for compression.
- * This controller is the top level of the JPEG compressor proper.
- * The coefficient buffer lies between forward-DCT and entropy encoding steps.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* We use a full-image coefficient buffer when doing Huffman optimization,
- * and also for writing multiple-scan JPEG files. In all cases, the DCT
- * step is run during the first pass, and subsequent passes need only read
- * the buffered coefficients.
- */
-#ifdef ENTROPY_OPT_SUPPORTED
-#define FULL_COEF_BUFFER_SUPPORTED
-#else
-#ifdef C_MULTISCAN_FILES_SUPPORTED
-#define FULL_COEF_BUFFER_SUPPORTED
-#endif
-#endif
-
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_c_coef_controller pub; /* public fields */
-
- JDIMENSION iMCU_row_num; /* iMCU row # within image */
- JDIMENSION mcu_ctr; /* counts MCUs processed in current row */
- int MCU_vert_offset; /* counts MCU rows within iMCU row */
- int MCU_rows_per_iMCU_row; /* number of such rows needed */
-
- /* For single-pass compression, it's sufficient to buffer just one MCU
- * (although this may prove a bit slow in practice). We allocate a
- * workspace of C_MAX_BLOCKS_IN_MCU coefficient blocks, and reuse it for each
- * MCU constructed and sent. (On 80x86, the workspace is FAR even though
- * it's not really very big; this is to keep the module interfaces unchanged
- * when a large coefficient buffer is necessary.)
- * In multi-pass modes, this array points to the current MCU's blocks
- * within the virtual arrays.
- */
- JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
-
- /* In multi-pass modes, we need a virtual block array for each component. */
- jvirt_barray_ptr whole_image[MAX_COMPONENTS];
-} my_coef_controller;
-
-typedef my_coef_controller * my_coef_ptr;
-
-
-/* Forward declarations */
-METHODDEF boolean compress_data
- JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
-#ifdef FULL_COEF_BUFFER_SUPPORTED
-METHODDEF boolean compress_first_pass
- JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
-METHODDEF boolean compress_output
- JPP((j_compress_ptr cinfo, JSAMPIMAGE input_buf));
-#endif
-
-
-LOCAL void
-start_iMCU_row (j_compress_ptr cinfo)
-/* Reset within-iMCU-row counters for a new row */
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- /* In an interleaved scan, an MCU row is the same as an iMCU row.
- * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
- * But at the bottom of the image, process only what's left.
- */
- if (cinfo->comps_in_scan > 1) {
- coef->MCU_rows_per_iMCU_row = 1;
- } else {
- if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
- else
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
- }
-
- coef->mcu_ctr = 0;
- coef->MCU_vert_offset = 0;
-}
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF void
-start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- coef->iMCU_row_num = 0;
- start_iMCU_row(cinfo);
-
- switch (pass_mode) {
- case JBUF_PASS_THRU:
- if (coef->whole_image[0] != NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- coef->pub.compress_data = compress_data;
- break;
-#ifdef FULL_COEF_BUFFER_SUPPORTED
- case JBUF_SAVE_AND_PASS:
- if (coef->whole_image[0] == NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- coef->pub.compress_data = compress_first_pass;
- break;
- case JBUF_CRANK_DEST:
- if (coef->whole_image[0] == NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- coef->pub.compress_data = compress_output;
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- break;
- }
-}
-
-
-/*
- * Process some data in the single-pass case.
- * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
- * per call, ie, v_samp_factor block rows for each component in the image.
- * Returns TRUE if the iMCU row is completed, FALSE if suspended.
- *
- * NB: input_buf contains a plane for each component in image.
- * For single pass, this is the same as the components in the scan.
- */
-
-METHODDEF boolean
-compress_data (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- int blkn, bi, ci, yindex, yoffset, blockcnt;
- JDIMENSION ypos, xpos;
- jpeg_component_info *compptr;
-
- /* Loop to write as much as one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->mcu_ctr; MCU_col_num <= last_MCU_col;
- MCU_col_num++) {
- /* Determine where data comes from in input_buf and do the DCT thing.
- * Each call on forward_DCT processes a horizontal row of DCT blocks
- * as wide as an MCU; we rely on having allocated the MCU_buffer[] blocks
- * sequentially. Dummy blocks at the right or bottom edge are filled in
- * specially. The data in them does not matter for image reconstruction,
- * so we fill them with values that will encode to the smallest amount of
- * data, viz: all zeroes in the AC entries, DC entries equal to previous
- * block's DC value. (Thanks to Thomas Kinsman for this idea.)
- */
- blkn = 0;
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
- xpos = MCU_col_num * compptr->MCU_sample_width;
- ypos = yoffset * DCTSIZE; /* ypos == (yoffset+yindex) * DCTSIZE */
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- if (coef->iMCU_row_num < last_iMCU_row ||
- yoffset+yindex < compptr->last_row_height) {
- (*cinfo->fdct->forward_DCT) (cinfo, compptr,
- input_buf[ci], coef->MCU_buffer[blkn],
- ypos, xpos, (JDIMENSION) blockcnt);
- if (blockcnt < compptr->MCU_width) {
- /* Create some dummy blocks at the right edge of the image. */
- jzero_far((void FAR *) coef->MCU_buffer[blkn + blockcnt],
- (compptr->MCU_width - blockcnt) * SIZEOF(JBLOCK));
- for (bi = blockcnt; bi < compptr->MCU_width; bi++) {
- coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn+bi-1][0][0];
- }
- }
- } else {
- /* Create a row of dummy blocks at the bottom of the image. */
- jzero_far((void FAR *) coef->MCU_buffer[blkn],
- compptr->MCU_width * SIZEOF(JBLOCK));
- for (bi = 0; bi < compptr->MCU_width; bi++) {
- coef->MCU_buffer[blkn+bi][0][0] = coef->MCU_buffer[blkn-1][0][0];
- }
- }
- blkn += compptr->MCU_width;
- ypos += DCTSIZE;
- }
- }
- /* Try to write the MCU. In event of a suspension failure, we will
- * re-DCT the MCU on restart (a bit inefficient, could be fixed...)
- */
- if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->mcu_ctr = MCU_col_num;
- return FALSE;
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->mcu_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- coef->iMCU_row_num++;
- start_iMCU_row(cinfo);
- return TRUE;
-}
-
-
-#ifdef FULL_COEF_BUFFER_SUPPORTED
-
-/*
- * Process some data in the first pass of a multi-pass case.
- * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
- * per call, ie, v_samp_factor block rows for each component in the image.
- * This amount of data is read from the source buffer, DCT'd and quantized,
- * and saved into the virtual arrays. We also generate suitable dummy blocks
- * as needed at the right and lower edges. (The dummy blocks are constructed
- * in the virtual arrays, which have been padded appropriately.) This makes
- * it possible for subsequent passes not to worry about real vs. dummy blocks.
- *
- * We must also emit the data to the entropy encoder. This is conveniently
- * done by calling compress_output() after we've loaded the current strip
- * of the virtual arrays.
- *
- * NB: input_buf contains a plane for each component in image. All
- * components are DCT'd and loaded into the virtual arrays in this pass.
- * However, it may be that only a subset of the components are emitted to
- * the entropy encoder during this first pass; be careful about looking
- * at the scan-dependent variables (MCU dimensions, etc).
- */
-
-METHODDEF boolean
-compress_first_pass (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- JDIMENSION blocks_across, MCUs_across, MCUindex;
- int bi, ci, h_samp_factor, block_row, block_rows, ndummy;
- JCOEF lastDC;
- jpeg_component_info *compptr;
- JBLOCKARRAY buffer;
- JBLOCKROW thisblockrow, lastblockrow;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Align the virtual buffer for this component. */
- buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, TRUE);
- /* Count non-dummy DCT block rows in this iMCU row. */
- if (coef->iMCU_row_num < last_iMCU_row)
- block_rows = compptr->v_samp_factor;
- else {
- /* NB: can't use last_row_height here, since may not be set! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (block_rows == 0) block_rows = compptr->v_samp_factor;
- }
- blocks_across = compptr->width_in_blocks;
- h_samp_factor = compptr->h_samp_factor;
- /* Count number of dummy blocks to be added at the right margin. */
- ndummy = (int) (blocks_across % h_samp_factor);
- if (ndummy > 0)
- ndummy = h_samp_factor - ndummy;
- /* Perform DCT for all non-dummy blocks in this iMCU row. Each call
- * on forward_DCT processes a complete horizontal row of DCT blocks.
- */
- for (block_row = 0; block_row < block_rows; block_row++) {
- thisblockrow = buffer[block_row];
- (*cinfo->fdct->forward_DCT) (cinfo, compptr,
- input_buf[ci], thisblockrow,
- (JDIMENSION) (block_row * DCTSIZE),
- (JDIMENSION) 0, blocks_across);
- if (ndummy > 0) {
- /* Create dummy blocks at the right edge of the image. */
- thisblockrow += blocks_across; /* => first dummy block */
- jzero_far((void FAR *) thisblockrow, ndummy * SIZEOF(JBLOCK));
- lastDC = thisblockrow[-1][0];
- for (bi = 0; bi < ndummy; bi++) {
- thisblockrow[bi][0] = lastDC;
- }
- }
- }
- /* If at end of image, create dummy block rows as needed.
- * The tricky part here is that within each MCU, we want the DC values
- * of the dummy blocks to match the last real block's DC value.
- * This squeezes a few more bytes out of the resulting file...
- */
- if (coef->iMCU_row_num == last_iMCU_row) {
- blocks_across += ndummy; /* include lower right corner */
- MCUs_across = blocks_across / h_samp_factor;
- for (block_row = block_rows; block_row < compptr->v_samp_factor;
- block_row++) {
- thisblockrow = buffer[block_row];
- lastblockrow = buffer[block_row-1];
- jzero_far((void FAR *) thisblockrow,
- (size_t) (blocks_across * SIZEOF(JBLOCK)));
- for (MCUindex = 0; MCUindex < MCUs_across; MCUindex++) {
- lastDC = lastblockrow[h_samp_factor-1][0];
- for (bi = 0; bi < h_samp_factor; bi++) {
- thisblockrow[bi][0] = lastDC;
- }
- thisblockrow += h_samp_factor; /* advance to next MCU in row */
- lastblockrow += h_samp_factor;
- }
- }
- }
- }
- /* NB: compress_output will increment iMCU_row_num if successful.
- * A suspension return will result in redoing all the work above next time.
- */
-
- /* Emit data to the entropy encoder, sharing code with subsequent passes */
- return compress_output(cinfo, input_buf);
-}
-
-
-/*
- * Process some data in subsequent passes of a multi-pass case.
- * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
- * per call, ie, v_samp_factor block rows for each component in the scan.
- * The data is obtained from the virtual arrays and fed to the entropy coder.
- * Returns TRUE if the iMCU row is completed, FALSE if suspended.
- *
- * NB: input_buf is ignored; it is likely to be a NULL pointer.
- */
-
-METHODDEF boolean
-compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- int blkn, ci, xindex, yindex, yoffset;
- JDIMENSION start_col;
- JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
- JBLOCKROW buffer_ptr;
- jpeg_component_info *compptr;
-
- /* Align the virtual buffers for the components used in this scan.
- * NB: during first pass, this is safe only because the buffers will
- * already be aligned properly, so jmemmgr.c won't need to do any I/O.
- */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
- coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
- }
-
- /* Loop to process one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
- MCU_col_num++) {
- /* Construct list of pointers to DCT blocks belonging to this MCU */
- blkn = 0; /* index of current DCT block within MCU */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- start_col = MCU_col_num * compptr->MCU_width;
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
- for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
- coef->MCU_buffer[blkn++] = buffer_ptr++;
- }
- }
- }
- /* Try to write the MCU. */
- if (! (*cinfo->entropy->encode_mcu) (cinfo, coef->MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->mcu_ctr = MCU_col_num;
- return FALSE;
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->mcu_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- coef->iMCU_row_num++;
- start_iMCU_row(cinfo);
- return TRUE;
-}
-
-#endif /* FULL_COEF_BUFFER_SUPPORTED */
-
-
-/*
- * Initialize coefficient buffer controller.
- */
-
-GLOBAL void
-jinit_c_coef_controller (j_compress_ptr cinfo, boolean need_full_buffer)
-{
- my_coef_ptr coef;
-
- coef = (my_coef_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_coef_controller));
- cinfo->coef = (struct jpeg_c_coef_controller *) coef;
- coef->pub.start_pass = start_pass_coef;
-
- /* Create the coefficient buffer. */
- if (need_full_buffer) {
-#ifdef FULL_COEF_BUFFER_SUPPORTED
- /* Allocate a full-image virtual array for each component, */
- /* padded to a multiple of samp_factor DCT blocks in each direction. */
- int ci;
- jpeg_component_info *compptr;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- coef->whole_image[ci] = (*cinfo->mem->request_virt_barray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
- (JDIMENSION) jround_up((long) compptr->width_in_blocks,
- (long) compptr->h_samp_factor),
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor),
- (JDIMENSION) compptr->v_samp_factor);
- }
-#else
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-#endif
- } else {
- /* We only need a single-MCU buffer. */
- JBLOCKROW buffer;
- int i;
-
- buffer = (JBLOCKROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
- for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
- coef->MCU_buffer[i] = buffer + i;
- }
- coef->whole_image[0] = NULL; /* flag for no virtual arrays */
- }
-}
diff --git a/src/jpeg-6/jccolor.c b/src/jpeg-6/jccolor.c
deleted file mode 100644
index 6707911..0000000
--- a/src/jpeg-6/jccolor.c
+++ /dev/null
@@ -1,459 +0,0 @@
-/*
- * jccolor.c
- *
- * Copyright (C) 1991-1994, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains input colorspace conversion routines.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Private subobject */
-
-typedef struct {
- struct jpeg_color_converter pub; /* public fields */
-
- /* Private state for RGB->YCC conversion */
- INT32 * rgb_ycc_tab; /* => table for RGB to YCbCr conversion */
-} my_color_converter;
-
-typedef my_color_converter * my_cconvert_ptr;
-
-
-/**************** RGB -> YCbCr conversion: most common case **************/
-
-/*
- * YCbCr is defined per CCIR 601-1, except that Cb and Cr are
- * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5.
- * The conversion equations to be implemented are therefore
- * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B
- * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE
- * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE
- * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.)
- * Note: older versions of the IJG code used a zero offset of MAXJSAMPLE/2,
- * rather than CENTERJSAMPLE, for Cb and Cr. This gave equal positive and
- * negative swings for Cb/Cr, but meant that grayscale values (Cb=Cr=0)
- * were not represented exactly. Now we sacrifice exact representation of
- * maximum red and maximum blue in order to get exact grayscales.
- *
- * To avoid floating-point arithmetic, we represent the fractional constants
- * as integers scaled up by 2^16 (about 4 digits precision); we have to divide
- * the products by 2^16, with appropriate rounding, to get the correct answer.
- *
- * For even more speed, we avoid doing any multiplications in the inner loop
- * by precalculating the constants times R,G,B for all possible values.
- * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table);
- * for 12-bit samples it is still acceptable. It's not very reasonable for
- * 16-bit samples, but if you want lossless storage you shouldn't be changing
- * colorspace anyway.
- * The CENTERJSAMPLE offsets and the rounding fudge-factor of 0.5 are included
- * in the tables to save adding them separately in the inner loop.
- */
-
-#define SCALEBITS 16 /* speediest right-shift on some machines */
-#define CBCR_OFFSET ((INT32) CENTERJSAMPLE << SCALEBITS)
-#define ONE_HALF ((INT32) 1 << (SCALEBITS-1))
-#define FIX(x) ((INT32) ((x) * (1L< Y section */
-#define G_Y_OFF (1*(MAXJSAMPLE+1)) /* offset to G => Y section */
-#define B_Y_OFF (2*(MAXJSAMPLE+1)) /* etc. */
-#define R_CB_OFF (3*(MAXJSAMPLE+1))
-#define G_CB_OFF (4*(MAXJSAMPLE+1))
-#define B_CB_OFF (5*(MAXJSAMPLE+1))
-#define R_CR_OFF B_CB_OFF /* B=>Cb, R=>Cr are the same */
-#define G_CR_OFF (6*(MAXJSAMPLE+1))
-#define B_CR_OFF (7*(MAXJSAMPLE+1))
-#define TABLE_SIZE (8*(MAXJSAMPLE+1))
-
-
-/*
- * Initialize for RGB->YCC colorspace conversion.
- */
-
-METHODDEF void
-rgb_ycc_start (j_compress_ptr cinfo)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- INT32 * rgb_ycc_tab;
- INT32 i;
-
- /* Allocate and fill in the conversion tables. */
- cconvert->rgb_ycc_tab = rgb_ycc_tab = (INT32 *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (TABLE_SIZE * SIZEOF(INT32)));
-
- for (i = 0; i <= MAXJSAMPLE; i++) {
- rgb_ycc_tab[i+R_Y_OFF] = FIX(0.29900) * i;
- rgb_ycc_tab[i+G_Y_OFF] = FIX(0.58700) * i;
- rgb_ycc_tab[i+B_Y_OFF] = FIX(0.11400) * i + ONE_HALF;
- rgb_ycc_tab[i+R_CB_OFF] = (-FIX(0.16874)) * i;
- rgb_ycc_tab[i+G_CB_OFF] = (-FIX(0.33126)) * i;
- /* We use a rounding fudge-factor of 0.5-epsilon for Cb and Cr.
- * This ensures that the maximum output will round to MAXJSAMPLE
- * not MAXJSAMPLE+1, and thus that we don't have to range-limit.
- */
- rgb_ycc_tab[i+B_CB_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1;
-/* B=>Cb and R=>Cr tables are the same
- rgb_ycc_tab[i+R_CR_OFF] = FIX(0.50000) * i + CBCR_OFFSET + ONE_HALF-1;
-*/
- rgb_ycc_tab[i+G_CR_OFF] = (-FIX(0.41869)) * i;
- rgb_ycc_tab[i+B_CR_OFF] = (-FIX(0.08131)) * i;
- }
-}
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- *
- * Note that we change from the application's interleaved-pixel format
- * to our internal noninterleaved, one-plane-per-component format.
- * The input buffer is therefore three times as wide as the output buffer.
- *
- * A starting row offset is provided only for the output buffer. The caller
- * can easily adjust the passed input_buf value to accommodate any row
- * offset required on that side.
- */
-
-METHODDEF void
-rgb_ycc_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int r, g, b;
- register INT32 * ctab = cconvert->rgb_ycc_tab;
- register JSAMPROW inptr;
- register JSAMPROW outptr0, outptr1, outptr2;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr0 = output_buf[0][output_row];
- outptr1 = output_buf[1][output_row];
- outptr2 = output_buf[2][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- r = GETJSAMPLE(inptr[RGB_RED]);
- g = GETJSAMPLE(inptr[RGB_GREEN]);
- b = GETJSAMPLE(inptr[RGB_BLUE]);
- inptr += RGB_PIXELSIZE;
- /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
- * must be too; we do not need an explicit range-limiting operation.
- * Hence the value being shifted is never negative, and we don't
- * need the general RIGHT_SHIFT macro.
- */
- /* Y */
- outptr0[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
- /* Cb */
- outptr1[col] = (JSAMPLE)
- ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
- >> SCALEBITS);
- /* Cr */
- outptr2[col] = (JSAMPLE)
- ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
- >> SCALEBITS);
- }
- }
-}
-
-
-/**************** Cases other than RGB -> YCbCr **************/
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- * This version handles RGB->grayscale conversion, which is the same
- * as the RGB->Y portion of RGB->YCbCr.
- * We assume rgb_ycc_start has been called (we only use the Y tables).
- */
-
-METHODDEF void
-rgb_gray_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int r, g, b;
- register INT32 * ctab = cconvert->rgb_ycc_tab;
- register JSAMPROW inptr;
- register JSAMPROW outptr;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr = output_buf[0][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- r = GETJSAMPLE(inptr[RGB_RED]);
- g = GETJSAMPLE(inptr[RGB_GREEN]);
- b = GETJSAMPLE(inptr[RGB_BLUE]);
- inptr += RGB_PIXELSIZE;
- /* Y */
- outptr[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
- }
- }
-}
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- * This version handles Adobe-style CMYK->YCCK conversion,
- * where we convert R=1-C, G=1-M, and B=1-Y to YCbCr using the same
- * conversion as above, while passing K (black) unchanged.
- * We assume rgb_ycc_start has been called.
- */
-
-METHODDEF void
-cmyk_ycck_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- my_cconvert_ptr cconvert = (my_cconvert_ptr) cinfo->cconvert;
- register int r, g, b;
- register INT32 * ctab = cconvert->rgb_ycc_tab;
- register JSAMPROW inptr;
- register JSAMPROW outptr0, outptr1, outptr2, outptr3;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr0 = output_buf[0][output_row];
- outptr1 = output_buf[1][output_row];
- outptr2 = output_buf[2][output_row];
- outptr3 = output_buf[3][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- r = MAXJSAMPLE - GETJSAMPLE(inptr[0]);
- g = MAXJSAMPLE - GETJSAMPLE(inptr[1]);
- b = MAXJSAMPLE - GETJSAMPLE(inptr[2]);
- /* K passes through as-is */
- outptr3[col] = inptr[3]; /* don't need GETJSAMPLE here */
- inptr += 4;
- /* If the inputs are 0..MAXJSAMPLE, the outputs of these equations
- * must be too; we do not need an explicit range-limiting operation.
- * Hence the value being shifted is never negative, and we don't
- * need the general RIGHT_SHIFT macro.
- */
- /* Y */
- outptr0[col] = (JSAMPLE)
- ((ctab[r+R_Y_OFF] + ctab[g+G_Y_OFF] + ctab[b+B_Y_OFF])
- >> SCALEBITS);
- /* Cb */
- outptr1[col] = (JSAMPLE)
- ((ctab[r+R_CB_OFF] + ctab[g+G_CB_OFF] + ctab[b+B_CB_OFF])
- >> SCALEBITS);
- /* Cr */
- outptr2[col] = (JSAMPLE)
- ((ctab[r+R_CR_OFF] + ctab[g+G_CR_OFF] + ctab[b+B_CR_OFF])
- >> SCALEBITS);
- }
- }
-}
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- * This version handles grayscale output with no conversion.
- * The source can be either plain grayscale or YCbCr (since Y == gray).
- */
-
-METHODDEF void
-grayscale_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- register JSAMPROW inptr;
- register JSAMPROW outptr;
- register JDIMENSION col;
- JDIMENSION num_cols = cinfo->image_width;
- int instride = cinfo->input_components;
-
- while (--num_rows >= 0) {
- inptr = *input_buf++;
- outptr = output_buf[0][output_row];
- output_row++;
- for (col = 0; col < num_cols; col++) {
- outptr[col] = inptr[0]; /* don't need GETJSAMPLE() here */
- inptr += instride;
- }
- }
-}
-
-
-/*
- * Convert some rows of samples to the JPEG colorspace.
- * This version handles multi-component colorspaces without conversion.
- * We assume input_components == num_components.
- */
-
-METHODDEF void
-null_convert (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JSAMPIMAGE output_buf,
- JDIMENSION output_row, int num_rows)
-{
- register JSAMPROW inptr;
- register JSAMPROW outptr;
- register JDIMENSION col;
- register int ci;
- int nc = cinfo->num_components;
- JDIMENSION num_cols = cinfo->image_width;
-
- while (--num_rows >= 0) {
- /* It seems fastest to make a separate pass for each component. */
- for (ci = 0; ci < nc; ci++) {
- inptr = *input_buf;
- outptr = output_buf[ci][output_row];
- for (col = 0; col < num_cols; col++) {
- outptr[col] = inptr[ci]; /* don't need GETJSAMPLE() here */
- inptr += nc;
- }
- }
- input_buf++;
- output_row++;
- }
-}
-
-
-/*
- * Empty method for start_pass.
- */
-
-METHODDEF void
-null_method (j_compress_ptr cinfo)
-{
- /* no work needed */
-}
-
-
-/*
- * Module initialization routine for input colorspace conversion.
- */
-
-GLOBAL void
-jinit_color_converter (j_compress_ptr cinfo)
-{
- my_cconvert_ptr cconvert;
-
- cconvert = (my_cconvert_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_color_converter));
- cinfo->cconvert = (struct jpeg_color_converter *) cconvert;
- /* set start_pass to null method until we find out differently */
- cconvert->pub.start_pass = null_method;
-
- /* Make sure input_components agrees with in_color_space */
- switch (cinfo->in_color_space) {
- case JCS_GRAYSCALE:
- if (cinfo->input_components != 1)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
-
- case JCS_RGB:
-#if RGB_PIXELSIZE != 3
- if (cinfo->input_components != RGB_PIXELSIZE)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
-#endif /* else share code with YCbCr */
-
- case JCS_YCbCr:
- if (cinfo->input_components != 3)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
-
- case JCS_CMYK:
- case JCS_YCCK:
- if (cinfo->input_components != 4)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
-
- default: /* JCS_UNKNOWN can be anything */
- if (cinfo->input_components < 1)
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- break;
- }
-
- /* Check num_components, set conversion method based on requested space */
- switch (cinfo->jpeg_color_space) {
- case JCS_GRAYSCALE:
- if (cinfo->num_components != 1)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_GRAYSCALE)
- cconvert->pub.color_convert = grayscale_convert;
- else if (cinfo->in_color_space == JCS_RGB) {
- cconvert->pub.start_pass = rgb_ycc_start;
- cconvert->pub.color_convert = rgb_gray_convert;
- } else if (cinfo->in_color_space == JCS_YCbCr)
- cconvert->pub.color_convert = grayscale_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_RGB:
- if (cinfo->num_components != 3)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_RGB && RGB_PIXELSIZE == 3)
- cconvert->pub.color_convert = null_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_YCbCr:
- if (cinfo->num_components != 3)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_RGB) {
- cconvert->pub.start_pass = rgb_ycc_start;
- cconvert->pub.color_convert = rgb_ycc_convert;
- } else if (cinfo->in_color_space == JCS_YCbCr)
- cconvert->pub.color_convert = null_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_CMYK:
- if (cinfo->num_components != 4)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_CMYK)
- cconvert->pub.color_convert = null_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- case JCS_YCCK:
- if (cinfo->num_components != 4)
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- if (cinfo->in_color_space == JCS_CMYK) {
- cconvert->pub.start_pass = rgb_ycc_start;
- cconvert->pub.color_convert = cmyk_ycck_convert;
- } else if (cinfo->in_color_space == JCS_YCCK)
- cconvert->pub.color_convert = null_convert;
- else
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- break;
-
- default: /* allow null conversion of JCS_UNKNOWN */
- if (cinfo->jpeg_color_space != cinfo->in_color_space ||
- cinfo->num_components != cinfo->input_components)
- ERREXIT(cinfo, JERR_CONVERSION_NOTIMPL);
- cconvert->pub.color_convert = null_convert;
- break;
- }
-}
diff --git a/src/jpeg-6/jcdctmgr.c b/src/jpeg-6/jcdctmgr.c
deleted file mode 100644
index f31a96f..0000000
--- a/src/jpeg-6/jcdctmgr.c
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- * jcdctmgr.c
- *
- * Copyright (C) 1994-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the forward-DCT management logic.
- * This code selects a particular DCT implementation to be used,
- * and it performs related housekeeping chores including coefficient
- * quantization.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jdct.h" /* Private declarations for DCT subsystem */
-
-
-/* Private subobject for this module */
-
-typedef struct {
- struct jpeg_forward_dct pub; /* public fields */
-
- /* Pointer to the DCT routine actually in use */
- forward_DCT_method_ptr do_dct;
-
- /* The actual post-DCT divisors --- not identical to the quant table
- * entries, because of scaling (especially for an unnormalized DCT).
- * Each table is given in normal array order; note that this must
- * be converted from the zigzag order of the quantization tables.
- */
- DCTELEM * divisors[NUM_QUANT_TBLS];
-
-#ifdef DCT_FLOAT_SUPPORTED
- /* Same as above for the floating-point case. */
- float_DCT_method_ptr do_float_dct;
- FAST_FLOAT * float_divisors[NUM_QUANT_TBLS];
-#endif
-} my_fdct_controller;
-
-typedef my_fdct_controller * my_fdct_ptr;
-
-
-/*
- * Initialize for a processing pass.
- * Verify that all referenced Q-tables are present, and set up
- * the divisor table for each one.
- * In the current implementation, DCT of all components is done during
- * the first pass, even if only some components will be output in the
- * first scan. Hence all components should be examined here.
- */
-
-METHODDEF void
-start_pass_fdctmgr (j_compress_ptr cinfo)
-{
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
- int ci, qtblno, i;
- jpeg_component_info *compptr;
- JQUANT_TBL * qtbl;
-#ifdef DCT_ISLOW_SUPPORTED
- DCTELEM * dtbl;
-#endif
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- qtblno = compptr->quant_tbl_no;
- /* Make sure specified quantization table is present */
- if (qtblno < 0 || qtblno >= NUM_QUANT_TBLS ||
- cinfo->quant_tbl_ptrs[qtblno] == NULL)
- ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, qtblno);
- qtbl = cinfo->quant_tbl_ptrs[qtblno];
- /* Compute divisors for this quant table */
- /* We may do this more than once for same table, but it's not a big deal */
- switch (cinfo->dct_method) {
-#ifdef DCT_ISLOW_SUPPORTED
- case JDCT_ISLOW:
- /* For LL&M IDCT method, divisors are equal to raw quantization
- * coefficients multiplied by 8 (to counteract scaling).
- */
- if (fdct->divisors[qtblno] == NULL) {
- fdct->divisors[qtblno] = (DCTELEM *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- DCTSIZE2 * SIZEOF(DCTELEM));
- }
- dtbl = fdct->divisors[qtblno];
- for (i = 0; i < DCTSIZE2; i++) {
- dtbl[i] = ((DCTELEM) qtbl->quantval[jpeg_zigzag_order[i]]) << 3;
- }
- break;
-#endif
-#ifdef DCT_IFAST_SUPPORTED
- case JDCT_IFAST:
- {
- /* For AA&N IDCT method, divisors are equal to quantization
- * coefficients scaled by scalefactor[row]*scalefactor[col], where
- * scalefactor[0] = 1
- * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
- * We apply a further scale factor of 8.
- */
-#define CONST_BITS 14
- static const INT16 aanscales[DCTSIZE2] = {
- /* precomputed values scaled up by 14 bits: in natural order */
- 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
- 22725, 31521, 29692, 26722, 22725, 17855, 12299, 6270,
- 21407, 29692, 27969, 25172, 21407, 16819, 11585, 5906,
- 19266, 26722, 25172, 22654, 19266, 15137, 10426, 5315,
- 16384, 22725, 21407, 19266, 16384, 12873, 8867, 4520,
- 12873, 17855, 16819, 15137, 12873, 10114, 6967, 3552,
- 8867, 12299, 11585, 10426, 8867, 6967, 4799, 2446,
- 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247
- };
- SHIFT_TEMPS
-
- if (fdct->divisors[qtblno] == NULL) {
- fdct->divisors[qtblno] = (DCTELEM *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- DCTSIZE2 * SIZEOF(DCTELEM));
- }
- dtbl = fdct->divisors[qtblno];
- for (i = 0; i < DCTSIZE2; i++) {
- dtbl[i] = (DCTELEM)
- DESCALE(MULTIPLY16V16((INT32) qtbl->quantval[jpeg_zigzag_order[i]],
- (INT32) aanscales[i]),
- CONST_BITS-3);
- }
- }
- break;
-#endif
-#ifdef DCT_FLOAT_SUPPORTED
- case JDCT_FLOAT:
- {
- /* For float AA&N IDCT method, divisors are equal to quantization
- * coefficients scaled by scalefactor[row]*scalefactor[col], where
- * scalefactor[0] = 1
- * scalefactor[k] = cos(k*PI/16) * sqrt(2) for k=1..7
- * We apply a further scale factor of 8.
- * What's actually stored is 1/divisor so that the inner loop can
- * use a multiplication rather than a division.
- */
- FAST_FLOAT * fdtbl;
- int row, col;
- static const double aanscalefactor[DCTSIZE] = {
- 1.0, 1.387039845, 1.306562965, 1.175875602,
- 1.0, 0.785694958, 0.541196100, 0.275899379
- };
-
- if (fdct->float_divisors[qtblno] == NULL) {
- fdct->float_divisors[qtblno] = (FAST_FLOAT *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- DCTSIZE2 * SIZEOF(FAST_FLOAT));
- }
- fdtbl = fdct->float_divisors[qtblno];
- i = 0;
- for (row = 0; row < DCTSIZE; row++) {
- for (col = 0; col < DCTSIZE; col++) {
- fdtbl[i] = (FAST_FLOAT)
- (1.0 / (((double) qtbl->quantval[jpeg_zigzag_order[i]] *
- aanscalefactor[row] * aanscalefactor[col] * 8.0)));
- i++;
- }
- }
- }
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_NOT_COMPILED);
- break;
- }
- }
-}
-
-
-/*
- * Perform forward DCT on one or more blocks of a component.
- *
- * The input samples are taken from the sample_data[] array starting at
- * position start_row/start_col, and moving to the right for any additional
- * blocks. The quantized coefficients are returned in coef_blocks[].
- */
-
-#if 0 // bk001204
-METHODDEF void
-forward_DCT (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
- JDIMENSION start_row, JDIMENSION start_col,
- JDIMENSION num_blocks)
-/* This version is used for integer DCT implementations. */
-{
- /* This routine is heavily used, so it's worth coding it tightly. */
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
- forward_DCT_method_ptr do_dct = fdct->do_dct;
- DCTELEM * divisors = fdct->divisors[compptr->quant_tbl_no];
- DCTELEM workspace[DCTSIZE2]; /* work area for FDCT subroutine */
- JDIMENSION bi;
-
- sample_data += start_row; /* fold in the vertical offset once */
-
- for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
- /* Load data into workspace, applying unsigned->signed conversion */
- { register DCTELEM *workspaceptr;
- register JSAMPROW elemptr;
- register int elemr;
-
- workspaceptr = workspace;
- for (elemr = 0; elemr < DCTSIZE; elemr++) {
- elemptr = sample_data[elemr] + start_col;
-#if DCTSIZE == 8 /* unroll the inner loop */
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
-#else
- { register int elemc;
- for (elemc = DCTSIZE; elemc > 0; elemc--) {
- *workspaceptr++ = GETJSAMPLE(*elemptr++) - CENTERJSAMPLE;
- }
- }
-#endif
- }
- }
-
- /* Perform the DCT */
- (*do_dct) (workspace);
-
- /* Quantize/descale the coefficients, and store into coef_blocks[] */
- { register DCTELEM temp, qval;
- register int i;
- register JCOEFPTR output_ptr = coef_blocks[bi];
-
- for (i = 0; i < DCTSIZE2; i++) {
- qval = divisors[i];
- temp = workspace[i];
- /* Divide the coefficient value by qval, ensuring proper rounding.
- * Since C does not specify the direction of rounding for negative
- * quotients, we have to force the dividend positive for portability.
- *
- * In most files, at least half of the output values will be zero
- * (at default quantization settings, more like three-quarters...)
- * so we should ensure that this case is fast. On many machines,
- * a comparison is enough cheaper than a divide to make a special test
- * a win. Since both inputs will be nonnegative, we need only test
- * for a < b to discover whether a/b is 0.
- * If your machine's division is fast enough, define FAST_DIVIDE.
- */
-#ifdef FAST_DIVIDE
-#define DIVIDE_BY(a,b) a /= b
-#else
-#define DIVIDE_BY(a,b) if (a >= b) a /= b; else a = 0
-#endif
- if (temp < 0) {
- temp = -temp;
- temp += qval>>1; /* for rounding */
- DIVIDE_BY(temp, qval);
- temp = -temp;
- } else {
- temp += qval>>1; /* for rounding */
- DIVIDE_BY(temp, qval);
- }
- output_ptr[i] = (JCOEF) temp;
- }
- }
- }
-}
-#endif // 0
-
-#ifdef DCT_FLOAT_SUPPORTED
-
-METHODDEF void
-forward_DCT_float (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY sample_data, JBLOCKROW coef_blocks,
- JDIMENSION start_row, JDIMENSION start_col,
- JDIMENSION num_blocks)
-/* This version is used for floating-point DCT implementations. */
-{
- /* This routine is heavily used, so it's worth coding it tightly. */
- my_fdct_ptr fdct = (my_fdct_ptr) cinfo->fdct;
- float_DCT_method_ptr do_dct = fdct->do_float_dct;
- FAST_FLOAT * divisors = fdct->float_divisors[compptr->quant_tbl_no];
- FAST_FLOAT workspace[DCTSIZE2]; /* work area for FDCT subroutine */
- JDIMENSION bi;
-
- sample_data += start_row; /* fold in the vertical offset once */
-
- for (bi = 0; bi < num_blocks; bi++, start_col += DCTSIZE) {
- /* Load data into workspace, applying unsigned->signed conversion */
- { register FAST_FLOAT *workspaceptr;
- register JSAMPROW elemptr;
- register int elemr;
-
- workspaceptr = workspace;
- for (elemr = 0; elemr < DCTSIZE; elemr++) {
- elemptr = sample_data[elemr] + start_col;
-#if DCTSIZE == 8 /* unroll the inner loop */
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- *workspaceptr++ = (FAST_FLOAT)(GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
-#else
- { register int elemc;
- for (elemc = DCTSIZE; elemc > 0; elemc--) {
- *workspaceptr++ = (FAST_FLOAT)
- (GETJSAMPLE(*elemptr++) - CENTERJSAMPLE);
- }
- }
-#endif
- }
- }
-
- /* Perform the DCT */
- (*do_dct) (workspace);
-
- /* Quantize/descale the coefficients, and store into coef_blocks[] */
- { register FAST_FLOAT temp;
- register int i;
- register JCOEFPTR output_ptr = coef_blocks[bi];
-
- for (i = 0; i < DCTSIZE2; i++) {
- /* Apply the quantization and scaling factor */
- temp = workspace[i] * divisors[i];
- /* Round to nearest integer.
- * Since C does not specify the direction of rounding for negative
- * quotients, we have to force the dividend positive for portability.
- * The maximum coefficient size is +-16K (for 12-bit data), so this
- * code should work for either 16-bit or 32-bit ints.
- */
- output_ptr[i] = (JCOEF) ((int) (temp + (FAST_FLOAT) 16384.5) - 16384);
- }
- }
- }
-}
-
-#endif /* DCT_FLOAT_SUPPORTED */
-
-
-/*
- * Initialize FDCT manager.
- */
-
-GLOBAL void
-jinit_forward_dct (j_compress_ptr cinfo)
-{
- my_fdct_ptr fdct;
- int i;
-
- fdct = (my_fdct_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_fdct_controller));
- cinfo->fdct = (struct jpeg_forward_dct *) fdct;
- fdct->pub.start_pass = start_pass_fdctmgr;
-
- switch (cinfo->dct_method) {
-#ifdef DCT_ISLOW_SUPPORTED
- case JDCT_ISLOW:
- fdct->pub.forward_DCT = forward_DCT;
- fdct->do_dct = jpeg_fdct_islow;
- break;
-#endif
-#ifdef DCT_IFAST_SUPPORTED
- case JDCT_IFAST:
- fdct->pub.forward_DCT = forward_DCT;
- fdct->do_dct = jpeg_fdct_ifast;
- break;
-#endif
-#ifdef DCT_FLOAT_SUPPORTED
- case JDCT_FLOAT:
- fdct->pub.forward_DCT = forward_DCT_float;
- fdct->do_float_dct = jpeg_fdct_float;
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_NOT_COMPILED);
- break;
- }
-
- /* Mark divisor tables unallocated */
- for (i = 0; i < NUM_QUANT_TBLS; i++) {
- fdct->divisors[i] = NULL;
-#ifdef DCT_FLOAT_SUPPORTED
- fdct->float_divisors[i] = NULL;
-#endif
- }
-}
diff --git a/src/jpeg-6/jchuff.c b/src/jpeg-6/jchuff.c
deleted file mode 100644
index 59f7865..0000000
--- a/src/jpeg-6/jchuff.c
+++ /dev/null
@@ -1,846 +0,0 @@
-/*
- * jchuff.c
- *
- * Copyright (C) 1991-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains Huffman entropy encoding routines.
- *
- * Much of the complexity here has to do with supporting output suspension.
- * If the data destination module demands suspension, we want to be able to
- * back up to the start of the current MCU. To do this, we copy state
- * variables into local working storage, and update them back to the
- * permanent JPEG objects only upon successful completion of an MCU.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jchuff.h" /* Declarations shared with jcphuff.c */
-
-
-/* Expanded entropy encoder object for Huffman encoding.
- *
- * The savable_state subrecord contains fields that change within an MCU,
- * but must not be updated permanently until we complete the MCU.
- */
-
-typedef struct {
- INT32 put_buffer; /* current bit-accumulation buffer */
- int put_bits; /* # of bits now in it */
- int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
-} savable_state;
-
-/* This macro is to work around compilers with missing or broken
- * structure assignment. You'll need to fix this code if you have
- * such a compiler and you change MAX_COMPS_IN_SCAN.
- */
-
-#ifndef NO_STRUCT_ASSIGN
-#define ASSIGN_STATE(dest,src) ((dest) = (src))
-#else
-#if MAX_COMPS_IN_SCAN == 4
-#define ASSIGN_STATE(dest,src) \
- ((dest).put_buffer = (src).put_buffer, \
- (dest).put_bits = (src).put_bits, \
- (dest).last_dc_val[0] = (src).last_dc_val[0], \
- (dest).last_dc_val[1] = (src).last_dc_val[1], \
- (dest).last_dc_val[2] = (src).last_dc_val[2], \
- (dest).last_dc_val[3] = (src).last_dc_val[3])
-#endif
-#endif
-
-
-typedef struct {
- struct jpeg_entropy_encoder pub; /* public fields */
-
- savable_state saved; /* Bit buffer & DC state at start of MCU */
-
- /* These fields are NOT loaded into local working state. */
- unsigned int restarts_to_go; /* MCUs left in this restart interval */
- int next_restart_num; /* next restart number to write (0-7) */
-
- /* Pointers to derived tables (these workspaces have image lifespan) */
- c_derived_tbl * dc_derived_tbls[NUM_HUFF_TBLS];
- c_derived_tbl * ac_derived_tbls[NUM_HUFF_TBLS];
-
-#ifdef ENTROPY_OPT_SUPPORTED /* Statistics tables for optimization */
- long * dc_count_ptrs[NUM_HUFF_TBLS];
- long * ac_count_ptrs[NUM_HUFF_TBLS];
-#endif
-} huff_entropy_encoder;
-
-typedef huff_entropy_encoder * huff_entropy_ptr;
-
-/* Working state while writing an MCU.
- * This struct contains all the fields that are needed by subroutines.
- */
-
-typedef struct {
- JOCTET * next_output_byte; /* => next byte to write in buffer */
- size_t free_in_buffer; /* # of byte spaces remaining in buffer */
- savable_state cur; /* Current bit buffer & DC state */
- j_compress_ptr cinfo; /* dump_buffer needs access to this */
-} working_state;
-
-
-/* Forward declarations */
-METHODDEF boolean encode_mcu_huff JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF void finish_pass_huff JPP((j_compress_ptr cinfo));
-#ifdef ENTROPY_OPT_SUPPORTED
-METHODDEF boolean encode_mcu_gather JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF void finish_pass_gather JPP((j_compress_ptr cinfo));
-#endif
-
-
-/*
- * Initialize for a Huffman-compressed scan.
- * If gather_statistics is TRUE, we do not output anything during the scan,
- * just count the Huffman symbols used and generate Huffman code tables.
- */
-
-METHODDEF void
-start_pass_huff (j_compress_ptr cinfo, boolean gather_statistics)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int ci, dctbl, actbl;
- jpeg_component_info * compptr;
-
- if (gather_statistics) {
-#ifdef ENTROPY_OPT_SUPPORTED
- entropy->pub.encode_mcu = encode_mcu_gather;
- entropy->pub.finish_pass = finish_pass_gather;
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- entropy->pub.encode_mcu = encode_mcu_huff;
- entropy->pub.finish_pass = finish_pass_huff;
- }
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- dctbl = compptr->dc_tbl_no;
- actbl = compptr->ac_tbl_no;
- /* Make sure requested tables are present */
- /* (In gather mode, tables need not be allocated yet) */
- if (dctbl < 0 || dctbl >= NUM_HUFF_TBLS ||
- (cinfo->dc_huff_tbl_ptrs[dctbl] == NULL && !gather_statistics))
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, dctbl);
- if (actbl < 0 || actbl >= NUM_HUFF_TBLS ||
- (cinfo->ac_huff_tbl_ptrs[actbl] == NULL && !gather_statistics))
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, actbl);
- if (gather_statistics) {
-#ifdef ENTROPY_OPT_SUPPORTED
- /* Allocate and zero the statistics tables */
- /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
- if (entropy->dc_count_ptrs[dctbl] == NULL)
- entropy->dc_count_ptrs[dctbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- 257 * SIZEOF(long));
- MEMZERO(entropy->dc_count_ptrs[dctbl], 257 * SIZEOF(long));
- if (entropy->ac_count_ptrs[actbl] == NULL)
- entropy->ac_count_ptrs[actbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- 257 * SIZEOF(long));
- MEMZERO(entropy->ac_count_ptrs[actbl], 257 * SIZEOF(long));
-#endif
- } else {
- /* Compute derived values for Huffman tables */
- /* We may do this more than once for a table, but it's not expensive */
- jpeg_make_c_derived_tbl(cinfo, cinfo->dc_huff_tbl_ptrs[dctbl],
- & entropy->dc_derived_tbls[dctbl]);
- jpeg_make_c_derived_tbl(cinfo, cinfo->ac_huff_tbl_ptrs[actbl],
- & entropy->ac_derived_tbls[actbl]);
- }
- /* Initialize DC predictions to 0 */
- entropy->saved.last_dc_val[ci] = 0;
- }
-
- /* Initialize bit buffer to empty */
- entropy->saved.put_buffer = 0;
- entropy->saved.put_bits = 0;
-
- /* Initialize restart stuff */
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num = 0;
-}
-
-
-/*
- * Compute the derived values for a Huffman table.
- * Note this is also used by jcphuff.c.
- */
-
-GLOBAL void
-jpeg_make_c_derived_tbl (j_compress_ptr cinfo, JHUFF_TBL * htbl,
- c_derived_tbl ** pdtbl)
-{
- c_derived_tbl *dtbl;
- int p, i, l, lastp, si;
- char huffsize[257];
- unsigned int huffcode[257];
- unsigned int code;
-
- /* Allocate a workspace if we haven't already done so. */
- if (*pdtbl == NULL)
- *pdtbl = (c_derived_tbl *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(c_derived_tbl));
- dtbl = *pdtbl;
-
- /* Figure C.1: make table of Huffman code length for each symbol */
- /* Note that this is in code-length order. */
-
- p = 0;
- for (l = 1; l <= 16; l++) {
- for (i = 1; i <= (int) htbl->bits[l]; i++)
- huffsize[p++] = (char) l;
- }
- huffsize[p] = 0;
- lastp = p;
-
- /* Figure C.2: generate the codes themselves */
- /* Note that this is in code-length order. */
-
- code = 0;
- si = huffsize[0];
- p = 0;
- while (huffsize[p]) {
- while (((int) huffsize[p]) == si) {
- huffcode[p++] = code;
- code++;
- }
- code <<= 1;
- si++;
- }
-
- /* Figure C.3: generate encoding tables */
- /* These are code and size indexed by symbol value */
-
- /* Set any codeless symbols to have code length 0;
- * this allows emit_bits to detect any attempt to emit such symbols.
- */
- MEMZERO(dtbl->ehufsi, SIZEOF(dtbl->ehufsi));
-
- for (p = 0; p < lastp; p++) {
- dtbl->ehufco[htbl->huffval[p]] = huffcode[p];
- dtbl->ehufsi[htbl->huffval[p]] = huffsize[p];
- }
-}
-
-
-/* Outputting bytes to the file */
-
-/* Emit a byte, taking 'action' if must suspend. */
-#define emit_byte(state,val,action) \
- { *(state)->next_output_byte++ = (JOCTET) (val); \
- if (--(state)->free_in_buffer == 0) \
- if (! dump_buffer(state)) \
- { action; } }
-
-
-LOCAL boolean
-dump_buffer (working_state * state)
-/* Empty the output buffer; return TRUE if successful, FALSE if must suspend */
-{
- struct jpeg_destination_mgr * dest = state->cinfo->dest;
-
- if (! (*dest->empty_output_buffer) (state->cinfo))
- return FALSE;
- /* After a successful buffer dump, must reset buffer pointers */
- state->next_output_byte = dest->next_output_byte;
- state->free_in_buffer = dest->free_in_buffer;
- return TRUE;
-}
-
-
-/* Outputting bits to the file */
-
-/* Only the right 24 bits of put_buffer are used; the valid bits are
- * left-justified in this part. At most 16 bits can be passed to emit_bits
- * in one call, and we never retain more than 7 bits in put_buffer
- * between calls, so 24 bits are sufficient.
- */
-
-INLINE
-LOCAL boolean
-emit_bits (working_state * state, unsigned int code, int size)
-/* Emit some bits; return TRUE if successful, FALSE if must suspend */
-{
- /* This routine is heavily used, so it's worth coding tightly. */
- register INT32 put_buffer = (INT32) code;
- register int put_bits = state->cur.put_bits;
-
- /* if size is 0, caller used an invalid Huffman table entry */
- if (size == 0)
- ERREXIT(state->cinfo, JERR_HUFF_MISSING_CODE);
-
- put_buffer &= (((INT32) 1)<cur.put_buffer; /* and merge with old buffer contents */
-
- while (put_bits >= 8) {
- int c = (int) ((put_buffer >> 16) & 0xFF);
-
- emit_byte(state, c, return FALSE);
- if (c == 0xFF) { /* need to stuff a zero byte? */
- emit_byte(state, 0, return FALSE);
- }
- put_buffer <<= 8;
- put_bits -= 8;
- }
-
- state->cur.put_buffer = put_buffer; /* update state variables */
- state->cur.put_bits = put_bits;
-
- return TRUE;
-}
-
-
-LOCAL boolean
-flush_bits (working_state * state)
-{
- if (! emit_bits(state, 0x7F, 7)) /* fill any partial byte with ones */
- return FALSE;
- state->cur.put_buffer = 0; /* and reset bit-buffer to empty */
- state->cur.put_bits = 0;
- return TRUE;
-}
-
-
-/* Encode a single block's worth of coefficients */
-
-LOCAL boolean
-encode_one_block (working_state * state, JCOEFPTR block, int last_dc_val,
- c_derived_tbl *dctbl, c_derived_tbl *actbl)
-{
- register int temp, temp2;
- register int nbits;
- register int k, r, i;
-
- /* Encode the DC coefficient difference per section F.1.2.1 */
-
- temp = temp2 = block[0] - last_dc_val;
-
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- /* For a negative input, want temp2 = bitwise complement of abs(input) */
- /* This code assumes we are on a two's complement machine */
- temp2--;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 0;
- while (temp) {
- nbits++;
- temp >>= 1;
- }
-
- /* Emit the Huffman-coded symbol for the number of bits */
- if (! emit_bits(state, dctbl->ehufco[nbits], dctbl->ehufsi[nbits]))
- return FALSE;
-
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- if (nbits) /* emit_bits rejects calls with size 0 */
- if (! emit_bits(state, (unsigned int) temp2, nbits))
- return FALSE;
-
- /* Encode the AC coefficients per section F.1.2.2 */
-
- r = 0; /* r = run length of zeros */
-
- for (k = 1; k < DCTSIZE2; k++) {
- if ((temp = block[jpeg_natural_order[k]]) == 0) {
- r++;
- } else {
- /* if run length > 15, must emit special run-length-16 codes (0xF0) */
- while (r > 15) {
- if (! emit_bits(state, actbl->ehufco[0xF0], actbl->ehufsi[0xF0]))
- return FALSE;
- r -= 16;
- }
-
- temp2 = temp;
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- /* This code assumes we are on a two's complement machine */
- temp2--;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 1; /* there must be at least one 1 bit */
- while ((temp >>= 1))
- nbits++;
-
- /* Emit Huffman symbol for run length / number of bits */
- i = (r << 4) + nbits;
- if (! emit_bits(state, actbl->ehufco[i], actbl->ehufsi[i]))
- return FALSE;
-
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- if (! emit_bits(state, (unsigned int) temp2, nbits))
- return FALSE;
-
- r = 0;
- }
- }
-
- /* If the last coef(s) were zero, emit an end-of-block code */
- if (r > 0)
- if (! emit_bits(state, actbl->ehufco[0], actbl->ehufsi[0]))
- return FALSE;
-
- return TRUE;
-}
-
-
-/*
- * Emit a restart marker & resynchronize predictions.
- */
-
-LOCAL boolean
-emit_restart (working_state * state, int restart_num)
-{
- int ci;
-
- if (! flush_bits(state))
- return FALSE;
-
- emit_byte(state, 0xFF, return FALSE);
- emit_byte(state, JPEG_RST0 + restart_num, return FALSE);
-
- /* Re-initialize DC predictions to 0 */
- for (ci = 0; ci < state->cinfo->comps_in_scan; ci++)
- state->cur.last_dc_val[ci] = 0;
-
- /* The restart counter is not updated until we successfully write the MCU. */
-
- return TRUE;
-}
-
-
-/*
- * Encode and output one MCU's worth of Huffman-compressed coefficients.
- */
-
-METHODDEF boolean
-encode_mcu_huff (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- working_state state;
- int blkn, ci;
- jpeg_component_info * compptr;
-
- /* Load up working state */
- state.next_output_byte = cinfo->dest->next_output_byte;
- state.free_in_buffer = cinfo->dest->free_in_buffer;
- ASSIGN_STATE(state.cur, entropy->saved);
- state.cinfo = cinfo;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0)
- if (! emit_restart(&state, entropy->next_restart_num))
- return FALSE;
- }
-
- /* Encode the MCU data blocks */
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- ci = cinfo->MCU_membership[blkn];
- compptr = cinfo->cur_comp_info[ci];
- if (! encode_one_block(&state,
- MCU_data[blkn][0], state.cur.last_dc_val[ci],
- entropy->dc_derived_tbls[compptr->dc_tbl_no],
- entropy->ac_derived_tbls[compptr->ac_tbl_no]))
- return FALSE;
- /* Update last_dc_val */
- state.cur.last_dc_val[ci] = MCU_data[blkn][0][0];
- }
-
- /* Completed MCU, so update state */
- cinfo->dest->next_output_byte = state.next_output_byte;
- cinfo->dest->free_in_buffer = state.free_in_buffer;
- ASSIGN_STATE(entropy->saved, state.cur);
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * Finish up at the end of a Huffman-compressed scan.
- */
-
-METHODDEF void
-finish_pass_huff (j_compress_ptr cinfo)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- working_state state;
-
- /* Load up working state ... flush_bits needs it */
- state.next_output_byte = cinfo->dest->next_output_byte;
- state.free_in_buffer = cinfo->dest->free_in_buffer;
- ASSIGN_STATE(state.cur, entropy->saved);
- state.cinfo = cinfo;
-
- /* Flush out the last data */
- if (! flush_bits(&state))
- ERREXIT(cinfo, JERR_CANT_SUSPEND);
-
- /* Update state */
- cinfo->dest->next_output_byte = state.next_output_byte;
- cinfo->dest->free_in_buffer = state.free_in_buffer;
- ASSIGN_STATE(entropy->saved, state.cur);
-}
-
-
-/*
- * Huffman coding optimization.
- *
- * This actually is optimization, in the sense that we find the best possible
- * Huffman table(s) for the given data. We first scan the supplied data and
- * count the number of uses of each symbol that is to be Huffman-coded.
- * (This process must agree with the code above.) Then we build an
- * optimal Huffman coding tree for the observed counts.
- *
- * The JPEG standard requires Huffman codes to be no more than 16 bits long.
- * If some symbols have a very small but nonzero probability, the Huffman tree
- * must be adjusted to meet the code length restriction. We currently use
- * the adjustment method suggested in the JPEG spec. This method is *not*
- * optimal; it may not choose the best possible limited-length code. But
- * since the symbols involved are infrequently used, it's not clear that
- * going to extra trouble is worthwhile.
- */
-
-#ifdef ENTROPY_OPT_SUPPORTED
-
-
-/* Process a single block's worth of coefficients */
-
-LOCAL void
-htest_one_block (JCOEFPTR block, int last_dc_val,
- long dc_counts[], long ac_counts[])
-{
- register int temp;
- register int nbits;
- register int k, r;
-
- /* Encode the DC coefficient difference per section F.1.2.1 */
-
- temp = block[0] - last_dc_val;
- if (temp < 0)
- temp = -temp;
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 0;
- while (temp) {
- nbits++;
- temp >>= 1;
- }
-
- /* Count the Huffman symbol for the number of bits */
- dc_counts[nbits]++;
-
- /* Encode the AC coefficients per section F.1.2.2 */
-
- r = 0; /* r = run length of zeros */
-
- for (k = 1; k < DCTSIZE2; k++) {
- if ((temp = block[jpeg_natural_order[k]]) == 0) {
- r++;
- } else {
- /* if run length > 15, must emit special run-length-16 codes (0xF0) */
- while (r > 15) {
- ac_counts[0xF0]++;
- r -= 16;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- if (temp < 0)
- temp = -temp;
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 1; /* there must be at least one 1 bit */
- while ((temp >>= 1))
- nbits++;
-
- /* Count Huffman symbol for run length / number of bits */
- ac_counts[(r << 4) + nbits]++;
-
- r = 0;
- }
- }
-
- /* If the last coef(s) were zero, emit an end-of-block code */
- if (r > 0)
- ac_counts[0]++;
-}
-
-
-/*
- * Trial-encode one MCU's worth of Huffman-compressed coefficients.
- * No data is actually output, so no suspension return is possible.
- */
-
-METHODDEF boolean
-encode_mcu_gather (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int blkn, ci;
- jpeg_component_info * compptr;
-
- /* Take care of restart intervals if needed */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- /* Re-initialize DC predictions to 0 */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++)
- entropy->saved.last_dc_val[ci] = 0;
- /* Update restart state */
- entropy->restarts_to_go = cinfo->restart_interval;
- }
- entropy->restarts_to_go--;
- }
-
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- ci = cinfo->MCU_membership[blkn];
- compptr = cinfo->cur_comp_info[ci];
- htest_one_block(MCU_data[blkn][0], entropy->saved.last_dc_val[ci],
- entropy->dc_count_ptrs[compptr->dc_tbl_no],
- entropy->ac_count_ptrs[compptr->ac_tbl_no]);
- entropy->saved.last_dc_val[ci] = MCU_data[blkn][0][0];
- }
-
- return TRUE;
-}
-
-
-/*
- * Generate the optimal coding for the given counts, fill htbl.
- * Note this is also used by jcphuff.c.
- */
-
-GLOBAL void
-jpeg_gen_optimal_table (j_compress_ptr cinfo, JHUFF_TBL * htbl, long freq[])
-{
-#define MAX_CLEN 32 /* assumed maximum initial code length */
- UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */
- int codesize[257]; /* codesize[k] = code length of symbol k */
- int others[257]; /* next symbol in current branch of tree */
- int c1, c2;
- int p, i, j;
- long v;
-
- /* This algorithm is explained in section K.2 of the JPEG standard */
-
- MEMZERO(bits, SIZEOF(bits));
- MEMZERO(codesize, SIZEOF(codesize));
- for (i = 0; i < 257; i++)
- others[i] = -1; /* init links to empty */
-
- freq[256] = 1; /* make sure there is a nonzero count */
- /* Including the pseudo-symbol 256 in the Huffman procedure guarantees
- * that no real symbol is given code-value of all ones, because 256
- * will be placed in the largest codeword category.
- */
-
- /* Huffman's basic algorithm to assign optimal code lengths to symbols */
-
- for (;;) {
- /* Find the smallest nonzero frequency, set c1 = its symbol */
- /* In case of ties, take the larger symbol number */
- c1 = -1;
- v = 1000000000L;
- for (i = 0; i <= 256; i++) {
- if (freq[i] && freq[i] <= v) {
- v = freq[i];
- c1 = i;
- }
- }
-
- /* Find the next smallest nonzero frequency, set c2 = its symbol */
- /* In case of ties, take the larger symbol number */
- c2 = -1;
- v = 1000000000L;
- for (i = 0; i <= 256; i++) {
- if (freq[i] && freq[i] <= v && i != c1) {
- v = freq[i];
- c2 = i;
- }
- }
-
- /* Done if we've merged everything into one frequency */
- if (c2 < 0)
- break;
-
- /* Else merge the two counts/trees */
- freq[c1] += freq[c2];
- freq[c2] = 0;
-
- /* Increment the codesize of everything in c1's tree branch */
- codesize[c1]++;
- while (others[c1] >= 0) {
- c1 = others[c1];
- codesize[c1]++;
- }
-
- others[c1] = c2; /* chain c2 onto c1's tree branch */
-
- /* Increment the codesize of everything in c2's tree branch */
- codesize[c2]++;
- while (others[c2] >= 0) {
- c2 = others[c2];
- codesize[c2]++;
- }
- }
-
- /* Now count the number of symbols of each code length */
- for (i = 0; i <= 256; i++) {
- if (codesize[i]) {
- /* The JPEG standard seems to think that this can't happen, */
- /* but I'm paranoid... */
- if (codesize[i] > MAX_CLEN)
- ERREXIT(cinfo, JERR_HUFF_CLEN_OVERFLOW);
-
- bits[codesize[i]]++;
- }
- }
-
- /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
- * Huffman procedure assigned any such lengths, we must adjust the coding.
- * Here is what the JPEG spec says about how this next bit works:
- * Since symbols are paired for the longest Huffman code, the symbols are
- * removed from this length category two at a time. The prefix for the pair
- * (which is one bit shorter) is allocated to one of the pair; then,
- * skipping the BITS entry for that prefix length, a code word from the next
- * shortest nonzero BITS entry is converted into a prefix for two code words
- * one bit longer.
- */
-
- for (i = MAX_CLEN; i > 16; i--) {
- while (bits[i] > 0) {
- j = i - 2; /* find length of new prefix to be used */
- while (bits[j] == 0)
- j--;
-
- bits[i] -= 2; /* remove two symbols */
- bits[i-1]++; /* one goes in this length */
- bits[j+1] += 2; /* two new symbols in this length */
- bits[j]--; /* symbol of this length is now a prefix */
- }
- }
-
- /* Remove the count for the pseudo-symbol 256 from the largest codelength */
- while (bits[i] == 0) /* find largest codelength still in use */
- i--;
- bits[i]--;
-
- /* Return final symbol counts (only for lengths 0..16) */
- MEMCOPY(htbl->bits, bits, SIZEOF(htbl->bits));
-
- /* Return a list of the symbols sorted by code length */
- /* It's not real clear to me why we don't need to consider the codelength
- * changes made above, but the JPEG spec seems to think this works.
- */
- p = 0;
- for (i = 1; i <= MAX_CLEN; i++) {
- for (j = 0; j <= 255; j++) {
- if (codesize[j] == i) {
- htbl->huffval[p] = (UINT8) j;
- p++;
- }
- }
- }
-
- /* Set sent_table FALSE so updated table will be written to JPEG file. */
- htbl->sent_table = FALSE;
-}
-
-
-/*
- * Finish up a statistics-gathering pass and create the new Huffman tables.
- */
-
-METHODDEF void
-finish_pass_gather (j_compress_ptr cinfo)
-{
- huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
- int ci, dctbl, actbl;
- jpeg_component_info * compptr;
- JHUFF_TBL **htblptr;
- boolean did_dc[NUM_HUFF_TBLS];
- boolean did_ac[NUM_HUFF_TBLS];
-
- /* It's important not to apply jpeg_gen_optimal_table more than once
- * per table, because it clobbers the input frequency counts!
- */
- MEMZERO(did_dc, SIZEOF(did_dc));
- MEMZERO(did_ac, SIZEOF(did_ac));
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- dctbl = compptr->dc_tbl_no;
- actbl = compptr->ac_tbl_no;
- if (! did_dc[dctbl]) {
- htblptr = & cinfo->dc_huff_tbl_ptrs[dctbl];
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
- jpeg_gen_optimal_table(cinfo, *htblptr, entropy->dc_count_ptrs[dctbl]);
- did_dc[dctbl] = TRUE;
- }
- if (! did_ac[actbl]) {
- htblptr = & cinfo->ac_huff_tbl_ptrs[actbl];
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
- jpeg_gen_optimal_table(cinfo, *htblptr, entropy->ac_count_ptrs[actbl]);
- did_ac[actbl] = TRUE;
- }
- }
-}
-
-
-#endif /* ENTROPY_OPT_SUPPORTED */
-
-
-/*
- * Module initialization routine for Huffman entropy encoding.
- */
-
-GLOBAL void
-jinit_huff_encoder (j_compress_ptr cinfo)
-{
- huff_entropy_ptr entropy;
- int i;
-
- entropy = (huff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(huff_entropy_encoder));
- cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
- entropy->pub.start_pass = start_pass_huff;
-
- /* Mark tables unallocated */
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL;
-#ifdef ENTROPY_OPT_SUPPORTED
- entropy->dc_count_ptrs[i] = entropy->ac_count_ptrs[i] = NULL;
-#endif
- }
-}
diff --git a/src/jpeg-6/jchuff.h b/src/jpeg-6/jchuff.h
deleted file mode 100644
index f43d571..0000000
--- a/src/jpeg-6/jchuff.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * jchuff.h
- *
- * Copyright (C) 1991-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains declarations for Huffman entropy encoding routines
- * that are shared between the sequential encoder (jchuff.c) and the
- * progressive encoder (jcphuff.c). No other modules need to see these.
- */
-
-/* Derived data constructed for each Huffman table */
-
-typedef struct {
- unsigned int ehufco[256]; /* code for each symbol */
- char ehufsi[256]; /* length of code for each symbol */
- /* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */
-} c_derived_tbl;
-
-/* Short forms of external names for systems with brain-damaged linkers. */
-
-#ifdef NEED_SHORT_EXTERNAL_NAMES
-#define jpeg_make_c_derived_tbl jMkCDerived
-#define jpeg_gen_optimal_table jGenOptTbl
-#endif /* NEED_SHORT_EXTERNAL_NAMES */
-
-/* Expand a Huffman table definition into the derived format */
-EXTERN void jpeg_make_c_derived_tbl JPP((j_compress_ptr cinfo,
- JHUFF_TBL * htbl, c_derived_tbl ** pdtbl));
-
-/* Generate an optimal table definition given the specified counts */
-EXTERN void jpeg_gen_optimal_table JPP((j_compress_ptr cinfo,
- JHUFF_TBL * htbl, long freq[]));
diff --git a/src/jpeg-6/jcinit.c b/src/jpeg-6/jcinit.c
deleted file mode 100644
index 2cc82b2..0000000
--- a/src/jpeg-6/jcinit.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * jcinit.c
- *
- * Copyright (C) 1991-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains initialization logic for the JPEG compressor.
- * This routine is in charge of selecting the modules to be executed and
- * making an initialization call to each one.
- *
- * Logically, this code belongs in jcmaster.c. It's split out because
- * linking this routine implies linking the entire compression library.
- * For a transcoding-only application, we want to be able to use jcmaster.c
- * without linking in the whole library.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Master selection of compression modules.
- * This is done once at the start of processing an image. We determine
- * which modules will be used and give them appropriate initialization calls.
- */
-
-GLOBAL void
-jinit_compress_master (j_compress_ptr cinfo)
-{
- /* Initialize master control (includes parameter checking/processing) */
- jinit_c_master_control(cinfo, FALSE /* full compression */);
-
- /* Preprocessing */
- if (! cinfo->raw_data_in) {
- jinit_color_converter(cinfo);
- jinit_downsampler(cinfo);
- jinit_c_prep_controller(cinfo, FALSE /* never need full buffer here */);
- }
- /* Forward DCT */
- jinit_forward_dct(cinfo);
- /* Entropy encoding: either Huffman or arithmetic coding. */
- if (cinfo->arith_code) {
- ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
- } else {
- if (cinfo->progressive_mode) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- jinit_phuff_encoder(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else
- jinit_huff_encoder(cinfo);
- }
-
- /* Need a full-image coefficient buffer in any multi-pass mode. */
- jinit_c_coef_controller(cinfo,
- (cinfo->num_scans > 1 || cinfo->optimize_coding));
- jinit_c_main_controller(cinfo, FALSE /* never need full buffer here */);
-
- jinit_marker_writer(cinfo);
-
- /* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
-
- /* Write the datastream header (SOI) immediately.
- * Frame and scan headers are postponed till later.
- * This lets application insert special markers after the SOI.
- */
- (*cinfo->marker->write_file_header) (cinfo);
-}
diff --git a/src/jpeg-6/jcmainct.c b/src/jpeg-6/jcmainct.c
deleted file mode 100644
index 42a02d0..0000000
--- a/src/jpeg-6/jcmainct.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * jcmainct.c
- *
- * Copyright (C) 1994-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the main buffer controller for compression.
- * The main buffer lies between the pre-processor and the JPEG
- * compressor proper; it holds downsampled data in the JPEG colorspace.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Note: currently, there is no operating mode in which a full-image buffer
- * is needed at this step. If there were, that mode could not be used with
- * "raw data" input, since this module is bypassed in that case. However,
- * we've left the code here for possible use in special applications.
- */
-#undef FULL_MAIN_BUFFER_SUPPORTED
-
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_c_main_controller pub; /* public fields */
-
- JDIMENSION cur_iMCU_row; /* number of current iMCU row */
- JDIMENSION rowgroup_ctr; /* counts row groups received in iMCU row */
- boolean suspended; /* remember if we suspended output */
- J_BUF_MODE pass_mode; /* current operating mode */
-
- /* If using just a strip buffer, this points to the entire set of buffers
- * (we allocate one for each component). In the full-image case, this
- * points to the currently accessible strips of the virtual arrays.
- */
- JSAMPARRAY buffer[MAX_COMPONENTS];
-
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- /* If using full-image storage, this array holds pointers to virtual-array
- * control blocks for each component. Unused if not full-image storage.
- */
- jvirt_sarray_ptr whole_image[MAX_COMPONENTS];
-#endif
-} my_main_controller;
-
-typedef my_main_controller * my_main_ptr;
-
-
-/* Forward declarations */
-METHODDEF void process_data_simple_main
- JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
- JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
-METHODDEF void process_data_buffer_main
- JPP((j_compress_ptr cinfo, JSAMPARRAY input_buf,
- JDIMENSION *in_row_ctr, JDIMENSION in_rows_avail));
-#endif
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF void
-start_pass_main (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- // bk001204 - don't use main...
- my_main_ptr jmain = (my_main_ptr) cinfo->main;
-
- /* Do nothing in raw-data mode. */
- if (cinfo->raw_data_in)
- return;
-
- jmain->cur_iMCU_row = 0; /* initialize counters */
- jmain->rowgroup_ctr = 0;
- jmain->suspended = FALSE;
- jmain->pass_mode = pass_mode; /* save mode for use by process_data */
-
- switch (pass_mode) {
- case JBUF_PASS_THRU:
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- if (jmain->whole_image[0] != NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-#endif
- jmain->pub.process_data = process_data_simple_main;
- break;
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- case JBUF_SAVE_SOURCE:
- case JBUF_CRANK_DEST:
- case JBUF_SAVE_AND_PASS:
- if (jmain->whole_image[0] == NULL)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- jmain->pub.process_data = process_data_buffer_main;
- break;
-#endif
- default:
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
- break;
- }
-}
-
-
-/*
- * Process some data.
- * This routine handles the simple pass-through mode,
- * where we have only a strip buffer.
- */
-
-METHODDEF void
-process_data_simple_main (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail)
-{
- // bk001204 - don't use main
- my_main_ptr jmain = (my_main_ptr) cinfo->main;
-
- while (jmain->cur_iMCU_row < cinfo->total_iMCU_rows) {
- /* Read input data if we haven't filled the main buffer yet */
- if (jmain->rowgroup_ctr < DCTSIZE)
- (*cinfo->prep->pre_process_data) (cinfo,
- input_buf, in_row_ctr, in_rows_avail,
- jmain->buffer, &jmain->rowgroup_ctr,
- (JDIMENSION) DCTSIZE);
-
- /* If we don't have a full iMCU row buffered, return to application for
- * more data. Note that preprocessor will always pad to fill the iMCU row
- * at the bottom of the image.
- */
- if (jmain->rowgroup_ctr != DCTSIZE)
- return;
-
- /* Send the completed row to the compressor */
- if (! (*cinfo->coef->compress_data) (cinfo, jmain->buffer)) {
- /* If compressor did not consume the whole row, then we must need to
- * suspend processing and return to the application. In this situation
- * we pretend we didn't yet consume the last input row; otherwise, if
- * it happened to be the last row of the image, the application would
- * think we were done.
- */
- if (! jmain->suspended) {
- (*in_row_ctr)--;
- jmain->suspended = TRUE;
- }
- return;
- }
- /* We did finish the row. Undo our little suspension hack if a previous
- * call suspended; then mark the main buffer empty.
- */
- if (jmain->suspended) {
- (*in_row_ctr)++;
- jmain->suspended = FALSE;
- }
- jmain->rowgroup_ctr = 0;
- jmain->cur_iMCU_row++;
- }
-}
-
-
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
-
-/*
- * Process some data.
- * This routine handles all of the modes that use a full-size buffer.
- */
-
-METHODDEF void
-process_data_buffer_main (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail)
-{
- my_main_ptr main = (my_main_ptr) cinfo->main;
- int ci;
- jpeg_component_info *compptr;
- boolean writing = (main->pass_mode != JBUF_CRANK_DEST);
-
- while (main->cur_iMCU_row < cinfo->total_iMCU_rows) {
- /* Realign the virtual buffers if at the start of an iMCU row. */
- if (main->rowgroup_ctr == 0) {
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- main->buffer[ci] = (*cinfo->mem->access_virt_sarray)
- ((j_common_ptr) cinfo, main->whole_image[ci],
- main->cur_iMCU_row * (compptr->v_samp_factor * DCTSIZE),
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE), writing);
- }
- /* In a read pass, pretend we just read some source data. */
- if (! writing) {
- *in_row_ctr += cinfo->max_v_samp_factor * DCTSIZE;
- main->rowgroup_ctr = DCTSIZE;
- }
- }
-
- /* If a write pass, read input data until the current iMCU row is full. */
- /* Note: preprocessor will pad if necessary to fill the last iMCU row. */
- if (writing) {
- (*cinfo->prep->pre_process_data) (cinfo,
- input_buf, in_row_ctr, in_rows_avail,
- main->buffer, &main->rowgroup_ctr,
- (JDIMENSION) DCTSIZE);
- /* Return to application if we need more data to fill the iMCU row. */
- if (main->rowgroup_ctr < DCTSIZE)
- return;
- }
-
- /* Emit data, unless this is a sink-only pass. */
- if (main->pass_mode != JBUF_SAVE_SOURCE) {
- if (! (*cinfo->coef->compress_data) (cinfo, main->buffer)) {
- /* If compressor did not consume the whole row, then we must need to
- * suspend processing and return to the application. In this situation
- * we pretend we didn't yet consume the last input row; otherwise, if
- * it happened to be the last row of the image, the application would
- * think we were done.
- */
- if (! main->suspended) {
- (*in_row_ctr)--;
- main->suspended = TRUE;
- }
- return;
- }
- /* We did finish the row. Undo our little suspension hack if a previous
- * call suspended; then mark the main buffer empty.
- */
- if (main->suspended) {
- (*in_row_ctr)++;
- main->suspended = FALSE;
- }
- }
-
- /* If get here, we are done with this iMCU row. Mark buffer empty. */
- main->rowgroup_ctr = 0;
- main->cur_iMCU_row++;
- }
-}
-
-#endif /* FULL_MAIN_BUFFER_SUPPORTED */
-
-
-/*
- * Initialize main buffer controller.
- */
-
-GLOBAL void
-jinit_c_main_controller (j_compress_ptr cinfo, boolean need_full_buffer)
-{
- // bk001204 - don't use main
- my_main_ptr jmain;
- int ci;
- jpeg_component_info *compptr;
-
- jmain = (my_main_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_main_controller));
- cinfo->main = (struct jpeg_c_main_controller *) jmain;
- jmain->pub.start_pass = start_pass_main;
-
- /* We don't need to create a buffer in raw-data mode. */
- if (cinfo->raw_data_in)
- return;
-
- /* Create the buffer. It holds downsampled data, so each component
- * may be of a different size.
- */
- if (need_full_buffer) {
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- /* Allocate a full-image virtual array for each component */
- /* Note we pad the bottom to a multiple of the iMCU height */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- jmain->whole_image[ci] = (*cinfo->mem->request_virt_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE, FALSE,
- compptr->width_in_blocks * DCTSIZE,
- (JDIMENSION) jround_up((long) compptr->height_in_blocks,
- (long) compptr->v_samp_factor) * DCTSIZE,
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
- }
-#else
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-#endif
- } else {
-#ifdef FULL_MAIN_BUFFER_SUPPORTED
- jmain->whole_image[0] = NULL; /* flag for no virtual arrays */
-#endif
- /* Allocate a strip buffer for each component */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- jmain->buffer[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- compptr->width_in_blocks * DCTSIZE,
- (JDIMENSION) (compptr->v_samp_factor * DCTSIZE));
- }
- }
-}
diff --git a/src/jpeg-6/jcmarker.c b/src/jpeg-6/jcmarker.c
deleted file mode 100644
index f4d290b..0000000
--- a/src/jpeg-6/jcmarker.c
+++ /dev/null
@@ -1,639 +0,0 @@
-/*
- * jcmarker.c
- *
- * Copyright (C) 1991-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains routines to write JPEG datastream markers.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-typedef enum { /* JPEG marker codes */
- M_SOF0 = 0xc0,
- M_SOF1 = 0xc1,
- M_SOF2 = 0xc2,
- M_SOF3 = 0xc3,
-
- M_SOF5 = 0xc5,
- M_SOF6 = 0xc6,
- M_SOF7 = 0xc7,
-
- M_JPG = 0xc8,
- M_SOF9 = 0xc9,
- M_SOF10 = 0xca,
- M_SOF11 = 0xcb,
-
- M_SOF13 = 0xcd,
- M_SOF14 = 0xce,
- M_SOF15 = 0xcf,
-
- M_DHT = 0xc4,
-
- M_DAC = 0xcc,
-
- M_RST0 = 0xd0,
- M_RST1 = 0xd1,
- M_RST2 = 0xd2,
- M_RST3 = 0xd3,
- M_RST4 = 0xd4,
- M_RST5 = 0xd5,
- M_RST6 = 0xd6,
- M_RST7 = 0xd7,
-
- M_SOI = 0xd8,
- M_EOI = 0xd9,
- M_SOS = 0xda,
- M_DQT = 0xdb,
- M_DNL = 0xdc,
- M_DRI = 0xdd,
- M_DHP = 0xde,
- M_EXP = 0xdf,
-
- M_APP0 = 0xe0,
- M_APP1 = 0xe1,
- M_APP2 = 0xe2,
- M_APP3 = 0xe3,
- M_APP4 = 0xe4,
- M_APP5 = 0xe5,
- M_APP6 = 0xe6,
- M_APP7 = 0xe7,
- M_APP8 = 0xe8,
- M_APP9 = 0xe9,
- M_APP10 = 0xea,
- M_APP11 = 0xeb,
- M_APP12 = 0xec,
- M_APP13 = 0xed,
- M_APP14 = 0xee,
- M_APP15 = 0xef,
-
- M_JPG0 = 0xf0,
- M_JPG13 = 0xfd,
- M_COM = 0xfe,
-
- M_TEM = 0x01,
-
- M_ERROR = 0x100
-} JPEG_MARKER;
-
-
-/*
- * Basic output routines.
- *
- * Note that we do not support suspension while writing a marker.
- * Therefore, an application using suspension must ensure that there is
- * enough buffer space for the initial markers (typ. 600-700 bytes) before
- * calling jpeg_start_compress, and enough space to write the trailing EOI
- * (a few bytes) before calling jpeg_finish_compress. Multipass compression
- * modes are not supported at all with suspension, so those two are the only
- * points where markers will be written.
- */
-
-LOCAL void
-emit_byte (j_compress_ptr cinfo, int val)
-/* Emit a byte */
-{
- struct jpeg_destination_mgr * dest = cinfo->dest;
-
- *(dest->next_output_byte)++ = (JOCTET) val;
- if (--dest->free_in_buffer == 0) {
- if (! (*dest->empty_output_buffer) (cinfo))
- ERREXIT(cinfo, JERR_CANT_SUSPEND);
- }
-}
-
-
-LOCAL void
-emit_marker (j_compress_ptr cinfo, JPEG_MARKER mark)
-/* Emit a marker code */
-{
- emit_byte(cinfo, 0xFF);
- emit_byte(cinfo, (int) mark);
-}
-
-
-LOCAL void
-emit_2bytes (j_compress_ptr cinfo, int value)
-/* Emit a 2-byte integer; these are always MSB first in JPEG files */
-{
- emit_byte(cinfo, (value >> 8) & 0xFF);
- emit_byte(cinfo, value & 0xFF);
-}
-
-
-/*
- * Routines to write specific marker types.
- */
-
-LOCAL int
-emit_dqt (j_compress_ptr cinfo, int index)
-/* Emit a DQT marker */
-/* Returns the precision used (0 = 8bits, 1 = 16bits) for baseline checking */
-{
- JQUANT_TBL * qtbl = cinfo->quant_tbl_ptrs[index];
- int prec;
- int i;
-
- if (qtbl == NULL)
- ERREXIT1(cinfo, JERR_NO_QUANT_TABLE, index);
-
- prec = 0;
- for (i = 0; i < DCTSIZE2; i++) {
- if (qtbl->quantval[i] > 255)
- prec = 1;
- }
-
- if (! qtbl->sent_table) {
- emit_marker(cinfo, M_DQT);
-
- emit_2bytes(cinfo, prec ? DCTSIZE2*2 + 1 + 2 : DCTSIZE2 + 1 + 2);
-
- emit_byte(cinfo, index + (prec<<4));
-
- for (i = 0; i < DCTSIZE2; i++) {
- if (prec)
- emit_byte(cinfo, qtbl->quantval[i] >> 8);
- emit_byte(cinfo, qtbl->quantval[i] & 0xFF);
- }
-
- qtbl->sent_table = TRUE;
- }
-
- return prec;
-}
-
-
-LOCAL void
-emit_dht (j_compress_ptr cinfo, int index, boolean is_ac)
-/* Emit a DHT marker */
-{
- JHUFF_TBL * htbl;
- int length, i;
-
- if (is_ac) {
- htbl = cinfo->ac_huff_tbl_ptrs[index];
- index += 0x10; /* output index has AC bit set */
- } else {
- htbl = cinfo->dc_huff_tbl_ptrs[index];
- }
-
- if (htbl == NULL)
- ERREXIT1(cinfo, JERR_NO_HUFF_TABLE, index);
-
- if (! htbl->sent_table) {
- emit_marker(cinfo, M_DHT);
-
- length = 0;
- for (i = 1; i <= 16; i++)
- length += htbl->bits[i];
-
- emit_2bytes(cinfo, length + 2 + 1 + 16);
- emit_byte(cinfo, index);
-
- for (i = 1; i <= 16; i++)
- emit_byte(cinfo, htbl->bits[i]);
-
- for (i = 0; i < length; i++)
- emit_byte(cinfo, htbl->huffval[i]);
-
- htbl->sent_table = TRUE;
- }
-}
-
-
-LOCAL void
-emit_dac (j_compress_ptr cinfo)
-/* Emit a DAC marker */
-/* Since the useful info is so small, we want to emit all the tables in */
-/* one DAC marker. Therefore this routine does its own scan of the table. */
-{
-#ifdef C_ARITH_CODING_SUPPORTED
- char dc_in_use[NUM_ARITH_TBLS];
- char ac_in_use[NUM_ARITH_TBLS];
- int length, i;
- jpeg_component_info *compptr;
-
- for (i = 0; i < NUM_ARITH_TBLS; i++)
- dc_in_use[i] = ac_in_use[i] = 0;
-
- for (i = 0; i < cinfo->comps_in_scan; i++) {
- compptr = cinfo->cur_comp_info[i];
- dc_in_use[compptr->dc_tbl_no] = 1;
- ac_in_use[compptr->ac_tbl_no] = 1;
- }
-
- length = 0;
- for (i = 0; i < NUM_ARITH_TBLS; i++)
- length += dc_in_use[i] + ac_in_use[i];
-
- emit_marker(cinfo, M_DAC);
-
- emit_2bytes(cinfo, length*2 + 2);
-
- for (i = 0; i < NUM_ARITH_TBLS; i++) {
- if (dc_in_use[i]) {
- emit_byte(cinfo, i);
- emit_byte(cinfo, cinfo->arith_dc_L[i] + (cinfo->arith_dc_U[i]<<4));
- }
- if (ac_in_use[i]) {
- emit_byte(cinfo, i + 0x10);
- emit_byte(cinfo, cinfo->arith_ac_K[i]);
- }
- }
-#endif /* C_ARITH_CODING_SUPPORTED */
-}
-
-
-LOCAL void
-emit_dri (j_compress_ptr cinfo)
-/* Emit a DRI marker */
-{
- emit_marker(cinfo, M_DRI);
-
- emit_2bytes(cinfo, 4); /* fixed length */
-
- emit_2bytes(cinfo, (int) cinfo->restart_interval);
-}
-
-
-LOCAL void
-emit_sof (j_compress_ptr cinfo, JPEG_MARKER code)
-/* Emit a SOF marker */
-{
- int ci;
- jpeg_component_info *compptr;
-
- emit_marker(cinfo, code);
-
- emit_2bytes(cinfo, 3 * cinfo->num_components + 2 + 5 + 1); /* length */
-
- /* Make sure image isn't bigger than SOF field can handle */
- if ((long) cinfo->image_height > 65535L ||
- (long) cinfo->image_width > 65535L)
- ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) 65535);
-
- emit_byte(cinfo, cinfo->data_precision);
- emit_2bytes(cinfo, (int) cinfo->image_height);
- emit_2bytes(cinfo, (int) cinfo->image_width);
-
- emit_byte(cinfo, cinfo->num_components);
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- emit_byte(cinfo, compptr->component_id);
- emit_byte(cinfo, (compptr->h_samp_factor << 4) + compptr->v_samp_factor);
- emit_byte(cinfo, compptr->quant_tbl_no);
- }
-}
-
-
-LOCAL void
-emit_sos (j_compress_ptr cinfo)
-/* Emit a SOS marker */
-{
- int i, td, ta;
- jpeg_component_info *compptr;
-
- emit_marker(cinfo, M_SOS);
-
- emit_2bytes(cinfo, 2 * cinfo->comps_in_scan + 2 + 1 + 3); /* length */
-
- emit_byte(cinfo, cinfo->comps_in_scan);
-
- for (i = 0; i < cinfo->comps_in_scan; i++) {
- compptr = cinfo->cur_comp_info[i];
- emit_byte(cinfo, compptr->component_id);
- td = compptr->dc_tbl_no;
- ta = compptr->ac_tbl_no;
- if (cinfo->progressive_mode) {
- /* Progressive mode: only DC or only AC tables are used in one scan;
- * furthermore, Huffman coding of DC refinement uses no table at all.
- * We emit 0 for unused field(s); this is recommended by the P&M text
- * but does not seem to be specified in the standard.
- */
- if (cinfo->Ss == 0) {
- ta = 0; /* DC scan */
- if (cinfo->Ah != 0 && !cinfo->arith_code)
- td = 0; /* no DC table either */
- } else {
- td = 0; /* AC scan */
- }
- }
- emit_byte(cinfo, (td << 4) + ta);
- }
-
- emit_byte(cinfo, cinfo->Ss);
- emit_byte(cinfo, cinfo->Se);
- emit_byte(cinfo, (cinfo->Ah << 4) + cinfo->Al);
-}
-
-
-LOCAL void
-emit_jfif_app0 (j_compress_ptr cinfo)
-/* Emit a JFIF-compliant APP0 marker */
-{
- /*
- * Length of APP0 block (2 bytes)
- * Block ID (4 bytes - ASCII "JFIF")
- * Zero byte (1 byte to terminate the ID string)
- * Version Major, Minor (2 bytes - 0x01, 0x01)
- * Units (1 byte - 0x00 = none, 0x01 = inch, 0x02 = cm)
- * Xdpu (2 bytes - dots per unit horizontal)
- * Ydpu (2 bytes - dots per unit vertical)
- * Thumbnail X size (1 byte)
- * Thumbnail Y size (1 byte)
- */
-
- emit_marker(cinfo, M_APP0);
-
- emit_2bytes(cinfo, 2 + 4 + 1 + 2 + 1 + 2 + 2 + 1 + 1); /* length */
-
- emit_byte(cinfo, 0x4A); /* Identifier: ASCII "JFIF" */
- emit_byte(cinfo, 0x46);
- emit_byte(cinfo, 0x49);
- emit_byte(cinfo, 0x46);
- emit_byte(cinfo, 0);
- /* We currently emit version code 1.01 since we use no 1.02 features.
- * This may avoid complaints from some older decoders.
- */
- emit_byte(cinfo, 1); /* Major version */
- emit_byte(cinfo, 1); /* Minor version */
- emit_byte(cinfo, cinfo->density_unit); /* Pixel size information */
- emit_2bytes(cinfo, (int) cinfo->X_density);
- emit_2bytes(cinfo, (int) cinfo->Y_density);
- emit_byte(cinfo, 0); /* No thumbnail image */
- emit_byte(cinfo, 0);
-}
-
-
-LOCAL void
-emit_adobe_app14 (j_compress_ptr cinfo)
-/* Emit an Adobe APP14 marker */
-{
- /*
- * Length of APP14 block (2 bytes)
- * Block ID (5 bytes - ASCII "Adobe")
- * Version Number (2 bytes - currently 100)
- * Flags0 (2 bytes - currently 0)
- * Flags1 (2 bytes - currently 0)
- * Color transform (1 byte)
- *
- * Although Adobe TN 5116 mentions Version = 101, all the Adobe files
- * now in circulation seem to use Version = 100, so that's what we write.
- *
- * We write the color transform byte as 1 if the JPEG color space is
- * YCbCr, 2 if it's YCCK, 0 otherwise. Adobe's definition has to do with
- * whether the encoder performed a transformation, which is pretty useless.
- */
-
- emit_marker(cinfo, M_APP14);
-
- emit_2bytes(cinfo, 2 + 5 + 2 + 2 + 2 + 1); /* length */
-
- emit_byte(cinfo, 0x41); /* Identifier: ASCII "Adobe" */
- emit_byte(cinfo, 0x64);
- emit_byte(cinfo, 0x6F);
- emit_byte(cinfo, 0x62);
- emit_byte(cinfo, 0x65);
- emit_2bytes(cinfo, 100); /* Version */
- emit_2bytes(cinfo, 0); /* Flags0 */
- emit_2bytes(cinfo, 0); /* Flags1 */
- switch (cinfo->jpeg_color_space) {
- case JCS_YCbCr:
- emit_byte(cinfo, 1); /* Color transform = 1 */
- break;
- case JCS_YCCK:
- emit_byte(cinfo, 2); /* Color transform = 2 */
- break;
- default:
- emit_byte(cinfo, 0); /* Color transform = 0 */
- break;
- }
-}
-
-
-/*
- * This routine is exported for possible use by applications.
- * The intended use is to emit COM or APPn markers after calling
- * jpeg_start_compress() and before the first jpeg_write_scanlines() call
- * (hence, after write_file_header but before write_frame_header).
- * Other uses are not guaranteed to produce desirable results.
- */
-
-METHODDEF void
-write_any_marker (j_compress_ptr cinfo, int marker,
- const JOCTET *dataptr, unsigned int datalen)
-/* Emit an arbitrary marker with parameters */
-{
- if (datalen <= (unsigned int) 65533) { /* safety check */
- emit_marker(cinfo, (JPEG_MARKER) marker);
-
- emit_2bytes(cinfo, (int) (datalen + 2)); /* total length */
-
- while (datalen--) {
- emit_byte(cinfo, *dataptr);
- dataptr++;
- }
- }
-}
-
-
-/*
- * Write datastream header.
- * This consists of an SOI and optional APPn markers.
- * We recommend use of the JFIF marker, but not the Adobe marker,
- * when using YCbCr or grayscale data. The JFIF marker should NOT
- * be used for any other JPEG colorspace. The Adobe marker is helpful
- * to distinguish RGB, CMYK, and YCCK colorspaces.
- * Note that an application can write additional header markers after
- * jpeg_start_compress returns.
- */
-
-METHODDEF void
-write_file_header (j_compress_ptr cinfo)
-{
- emit_marker(cinfo, M_SOI); /* first the SOI */
-
- if (cinfo->write_JFIF_header) /* next an optional JFIF APP0 */
- emit_jfif_app0(cinfo);
- if (cinfo->write_Adobe_marker) /* next an optional Adobe APP14 */
- emit_adobe_app14(cinfo);
-}
-
-
-/*
- * Write frame header.
- * This consists of DQT and SOFn markers.
- * Note that we do not emit the SOF until we have emitted the DQT(s).
- * This avoids compatibility problems with incorrect implementations that
- * try to error-check the quant table numbers as soon as they see the SOF.
- */
-
-METHODDEF void
-write_frame_header (j_compress_ptr cinfo)
-{
- int ci, prec;
- boolean is_baseline;
- jpeg_component_info *compptr;
-
- /* Emit DQT for each quantization table.
- * Note that emit_dqt() suppresses any duplicate tables.
- */
- prec = 0;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- prec += emit_dqt(cinfo, compptr->quant_tbl_no);
- }
- /* now prec is nonzero iff there are any 16-bit quant tables. */
-
- /* Check for a non-baseline specification.
- * Note we assume that Huffman table numbers won't be changed later.
- */
- if (cinfo->arith_code || cinfo->progressive_mode ||
- cinfo->data_precision != 8) {
- is_baseline = FALSE;
- } else {
- is_baseline = TRUE;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- if (compptr->dc_tbl_no > 1 || compptr->ac_tbl_no > 1)
- is_baseline = FALSE;
- }
- if (prec && is_baseline) {
- is_baseline = FALSE;
- /* If it's baseline except for quantizer size, warn the user */
- TRACEMS(cinfo, 0, JTRC_16BIT_TABLES);
- }
- }
-
- /* Emit the proper SOF marker */
- if (cinfo->arith_code) {
- emit_sof(cinfo, M_SOF9); /* SOF code for arithmetic coding */
- } else {
- if (cinfo->progressive_mode)
- emit_sof(cinfo, M_SOF2); /* SOF code for progressive Huffman */
- else if (is_baseline)
- emit_sof(cinfo, M_SOF0); /* SOF code for baseline implementation */
- else
- emit_sof(cinfo, M_SOF1); /* SOF code for non-baseline Huffman file */
- }
-}
-
-
-/*
- * Write scan header.
- * This consists of DHT or DAC markers, optional DRI, and SOS.
- * Compressed data will be written following the SOS.
- */
-
-METHODDEF void
-write_scan_header (j_compress_ptr cinfo)
-{
- int i;
- jpeg_component_info *compptr;
-
- if (cinfo->arith_code) {
- /* Emit arith conditioning info. We may have some duplication
- * if the file has multiple scans, but it's so small it's hardly
- * worth worrying about.
- */
- emit_dac(cinfo);
- } else {
- /* Emit Huffman tables.
- * Note that emit_dht() suppresses any duplicate tables.
- */
- for (i = 0; i < cinfo->comps_in_scan; i++) {
- compptr = cinfo->cur_comp_info[i];
- if (cinfo->progressive_mode) {
- /* Progressive mode: only DC or only AC tables are used in one scan */
- if (cinfo->Ss == 0) {
- if (cinfo->Ah == 0) /* DC needs no table for refinement scan */
- emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
- } else {
- emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
- }
- } else {
- /* Sequential mode: need both DC and AC tables */
- emit_dht(cinfo, compptr->dc_tbl_no, FALSE);
- emit_dht(cinfo, compptr->ac_tbl_no, TRUE);
- }
- }
- }
-
- /* Emit DRI if required --- note that DRI value could change for each scan.
- * If it doesn't, a tiny amount of space is wasted in multiple-scan files.
- * We assume DRI will never be nonzero for one scan and zero for a later one.
- */
- if (cinfo->restart_interval)
- emit_dri(cinfo);
-
- emit_sos(cinfo);
-}
-
-
-/*
- * Write datastream trailer.
- */
-
-METHODDEF void
-write_file_trailer (j_compress_ptr cinfo)
-{
- emit_marker(cinfo, M_EOI);
-}
-
-
-/*
- * Write an abbreviated table-specification datastream.
- * This consists of SOI, DQT and DHT tables, and EOI.
- * Any table that is defined and not marked sent_table = TRUE will be
- * emitted. Note that all tables will be marked sent_table = TRUE at exit.
- */
-
-METHODDEF void
-write_tables_only (j_compress_ptr cinfo)
-{
- int i;
-
- emit_marker(cinfo, M_SOI);
-
- for (i = 0; i < NUM_QUANT_TBLS; i++) {
- if (cinfo->quant_tbl_ptrs[i] != NULL)
- (void) emit_dqt(cinfo, i);
- }
-
- if (! cinfo->arith_code) {
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- if (cinfo->dc_huff_tbl_ptrs[i] != NULL)
- emit_dht(cinfo, i, FALSE);
- if (cinfo->ac_huff_tbl_ptrs[i] != NULL)
- emit_dht(cinfo, i, TRUE);
- }
- }
-
- emit_marker(cinfo, M_EOI);
-}
-
-
-/*
- * Initialize the marker writer module.
- */
-
-GLOBAL void
-jinit_marker_writer (j_compress_ptr cinfo)
-{
- /* Create the subobject */
- cinfo->marker = (struct jpeg_marker_writer *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(struct jpeg_marker_writer));
- /* Initialize method pointers */
- cinfo->marker->write_any_marker = write_any_marker;
- cinfo->marker->write_file_header = write_file_header;
- cinfo->marker->write_frame_header = write_frame_header;
- cinfo->marker->write_scan_header = write_scan_header;
- cinfo->marker->write_file_trailer = write_file_trailer;
- cinfo->marker->write_tables_only = write_tables_only;
-}
diff --git a/src/jpeg-6/jcmaster.c b/src/jpeg-6/jcmaster.c
deleted file mode 100644
index 84494e6..0000000
--- a/src/jpeg-6/jcmaster.c
+++ /dev/null
@@ -1,578 +0,0 @@
-/*
- * jcmaster.c
- *
- * Copyright (C) 1991-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains master control logic for the JPEG compressor.
- * These routines are concerned with parameter validation, initial setup,
- * and inter-pass control (determining the number of passes and the work
- * to be done in each pass).
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Private state */
-
-typedef enum {
- main_pass, /* input data, also do first output step */
- huff_opt_pass, /* Huffman code optimization pass */
- output_pass /* data output pass */
-} c_pass_type;
-
-typedef struct {
- struct jpeg_comp_master pub; /* public fields */
-
- c_pass_type pass_type; /* the type of the current pass */
-
- int pass_number; /* # of passes completed */
- int total_passes; /* total # of passes needed */
-
- int scan_number; /* current index in scan_info[] */
-} my_comp_master;
-
-typedef my_comp_master * my_master_ptr;
-
-
-/*
- * Support routines that do various essential calculations.
- */
-
-LOCAL void
-initial_setup (j_compress_ptr cinfo)
-/* Do computations that are needed before master selection phase */
-{
- int ci;
- jpeg_component_info *compptr;
- long samplesperrow;
- JDIMENSION jd_samplesperrow;
-
- /* Sanity check on image dimensions */
- if (cinfo->image_height <= 0 || cinfo->image_width <= 0
- || cinfo->num_components <= 0 || cinfo->input_components <= 0)
- ERREXIT(cinfo, JERR_EMPTY_IMAGE);
-
- /* Make sure image isn't bigger than I can handle */
- if ((long) cinfo->image_height > (long) JPEG_MAX_DIMENSION ||
- (long) cinfo->image_width > (long) JPEG_MAX_DIMENSION)
- ERREXIT1(cinfo, JERR_IMAGE_TOO_BIG, (unsigned int) JPEG_MAX_DIMENSION);
-
- /* Width of an input scanline must be representable as JDIMENSION. */
- samplesperrow = (long) cinfo->image_width * (long) cinfo->input_components;
- jd_samplesperrow = (JDIMENSION) samplesperrow;
- if ((long) jd_samplesperrow != samplesperrow)
- ERREXIT(cinfo, JERR_WIDTH_OVERFLOW);
-
- /* For now, precision must match compiled-in value... */
- if (cinfo->data_precision != BITS_IN_JSAMPLE)
- ERREXIT1(cinfo, JERR_BAD_PRECISION, cinfo->data_precision);
-
- /* Check that number of components won't exceed internal array sizes */
- if (cinfo->num_components > MAX_COMPONENTS)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
- MAX_COMPONENTS);
-
- /* Compute maximum sampling factors; check factor validity */
- cinfo->max_h_samp_factor = 1;
- cinfo->max_v_samp_factor = 1;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- if (compptr->h_samp_factor<=0 || compptr->h_samp_factor>MAX_SAMP_FACTOR ||
- compptr->v_samp_factor<=0 || compptr->v_samp_factor>MAX_SAMP_FACTOR)
- ERREXIT(cinfo, JERR_BAD_SAMPLING);
- cinfo->max_h_samp_factor = MAX(cinfo->max_h_samp_factor,
- compptr->h_samp_factor);
- cinfo->max_v_samp_factor = MAX(cinfo->max_v_samp_factor,
- compptr->v_samp_factor);
- }
-
- /* Compute dimensions of components */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Fill in the correct component_index value; don't rely on application */
- compptr->component_index = ci;
- /* For compression, we never do DCT scaling. */
- compptr->DCT_scaled_size = DCTSIZE;
- /* Size in DCT blocks */
- compptr->width_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
- (long) (cinfo->max_h_samp_factor * DCTSIZE));
- compptr->height_in_blocks = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
- (long) (cinfo->max_v_samp_factor * DCTSIZE));
- /* Size in samples */
- compptr->downsampled_width = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width * (long) compptr->h_samp_factor,
- (long) cinfo->max_h_samp_factor);
- compptr->downsampled_height = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height * (long) compptr->v_samp_factor,
- (long) cinfo->max_v_samp_factor);
- /* Mark component needed (this flag isn't actually used for compression) */
- compptr->component_needed = TRUE;
- }
-
- /* Compute number of fully interleaved MCU rows (number of times that
- * main controller will call coefficient controller).
- */
- cinfo->total_iMCU_rows = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
-}
-
-
-#ifdef C_MULTISCAN_FILES_SUPPORTED
-
-LOCAL void
-validate_script (j_compress_ptr cinfo)
-/* Verify that the scan script in cinfo->scan_info[] is valid; also
- * determine whether it uses progressive JPEG, and set cinfo->progressive_mode.
- */
-{
- const jpeg_scan_info * scanptr;
- int scanno, ncomps, ci, coefi, thisi;
- int Ss, Se, Ah, Al;
- boolean component_sent[MAX_COMPONENTS];
-#ifdef C_PROGRESSIVE_SUPPORTED
- int * last_bitpos_ptr;
- int last_bitpos[MAX_COMPONENTS][DCTSIZE2];
- /* -1 until that coefficient has been seen; then last Al for it */
-#endif
-
- if (cinfo->num_scans <= 0)
- ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, 0);
-
- /* For sequential JPEG, all scans must have Ss=0, Se=DCTSIZE2-1;
- * for progressive JPEG, no scan can have this.
- */
- scanptr = cinfo->scan_info;
- if (scanptr->Ss != 0 || scanptr->Se != DCTSIZE2-1) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- cinfo->progressive_mode = TRUE;
- last_bitpos_ptr = & last_bitpos[0][0];
- for (ci = 0; ci < cinfo->num_components; ci++)
- for (coefi = 0; coefi < DCTSIZE2; coefi++)
- *last_bitpos_ptr++ = -1;
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- cinfo->progressive_mode = FALSE;
- for (ci = 0; ci < cinfo->num_components; ci++)
- component_sent[ci] = FALSE;
- }
-
- for (scanno = 1; scanno <= cinfo->num_scans; scanptr++, scanno++) {
- /* Validate component indexes */
- ncomps = scanptr->comps_in_scan;
- if (ncomps <= 0 || ncomps > MAX_COMPS_IN_SCAN)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, ncomps, MAX_COMPS_IN_SCAN);
- for (ci = 0; ci < ncomps; ci++) {
- thisi = scanptr->component_index[ci];
- if (thisi < 0 || thisi >= cinfo->num_components)
- ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
- /* Components must appear in SOF order within each scan */
- if (ci > 0 && thisi <= scanptr->component_index[ci-1])
- ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
- }
- /* Validate progression parameters */
- Ss = scanptr->Ss;
- Se = scanptr->Se;
- Ah = scanptr->Ah;
- Al = scanptr->Al;
- if (cinfo->progressive_mode) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- if (Ss < 0 || Ss >= DCTSIZE2 || Se < Ss || Se >= DCTSIZE2 ||
- Ah < 0 || Ah > 13 || Al < 0 || Al > 13)
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- if (Ss == 0) {
- if (Se != 0) /* DC and AC together not OK */
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- } else {
- if (ncomps != 1) /* AC scans must be for only one component */
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- }
- for (ci = 0; ci < ncomps; ci++) {
- last_bitpos_ptr = & last_bitpos[scanptr->component_index[ci]][0];
- if (Ss != 0 && last_bitpos_ptr[0] < 0) /* AC without prior DC scan */
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- for (coefi = Ss; coefi <= Se; coefi++) {
- if (last_bitpos_ptr[coefi] < 0) {
- /* first scan of this coefficient */
- if (Ah != 0)
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- } else {
- /* not first scan */
- if (Ah != last_bitpos_ptr[coefi] || Al != Ah-1)
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- }
- last_bitpos_ptr[coefi] = Al;
- }
- }
-#endif
- } else {
- /* For sequential JPEG, all progression parameters must be these: */
- if (Ss != 0 || Se != DCTSIZE2-1 || Ah != 0 || Al != 0)
- ERREXIT1(cinfo, JERR_BAD_PROG_SCRIPT, scanno);
- /* Make sure components are not sent twice */
- for (ci = 0; ci < ncomps; ci++) {
- thisi = scanptr->component_index[ci];
- if (component_sent[thisi])
- ERREXIT1(cinfo, JERR_BAD_SCAN_SCRIPT, scanno);
- component_sent[thisi] = TRUE;
- }
- }
- }
-
- /* Now verify that everything got sent. */
- if (cinfo->progressive_mode) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- /* For progressive mode, we only check that at least some DC data
- * got sent for each component; the spec does not require that all bits
- * of all coefficients be transmitted. Would it be wiser to enforce
- * transmission of all coefficient bits??
- */
- for (ci = 0; ci < cinfo->num_components; ci++) {
- if (last_bitpos[ci][0] < 0)
- ERREXIT(cinfo, JERR_MISSING_DATA);
- }
-#endif
- } else {
- for (ci = 0; ci < cinfo->num_components; ci++) {
- if (! component_sent[ci])
- ERREXIT(cinfo, JERR_MISSING_DATA);
- }
- }
-}
-
-#endif /* C_MULTISCAN_FILES_SUPPORTED */
-
-
-LOCAL void
-select_scan_parameters (j_compress_ptr cinfo)
-/* Set up the scan parameters for the current scan */
-{
- int ci;
-
-#ifdef C_MULTISCAN_FILES_SUPPORTED
- if (cinfo->scan_info != NULL) {
- /* Prepare for current scan --- the script is already validated */
- my_master_ptr master = (my_master_ptr) cinfo->master;
- const jpeg_scan_info * scanptr = cinfo->scan_info + master->scan_number;
-
- cinfo->comps_in_scan = scanptr->comps_in_scan;
- for (ci = 0; ci < scanptr->comps_in_scan; ci++) {
- cinfo->cur_comp_info[ci] =
- &cinfo->comp_info[scanptr->component_index[ci]];
- }
- cinfo->Ss = scanptr->Ss;
- cinfo->Se = scanptr->Se;
- cinfo->Ah = scanptr->Ah;
- cinfo->Al = scanptr->Al;
- }
- else
-#endif
- {
- /* Prepare for single sequential-JPEG scan containing all components */
- if (cinfo->num_components > MAX_COMPS_IN_SCAN)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
- MAX_COMPS_IN_SCAN);
- cinfo->comps_in_scan = cinfo->num_components;
- for (ci = 0; ci < cinfo->num_components; ci++) {
- cinfo->cur_comp_info[ci] = &cinfo->comp_info[ci];
- }
- cinfo->Ss = 0;
- cinfo->Se = DCTSIZE2-1;
- cinfo->Ah = 0;
- cinfo->Al = 0;
- }
-}
-
-
-LOCAL void
-per_scan_setup (j_compress_ptr cinfo)
-/* Do computations that are needed before processing a JPEG scan */
-/* cinfo->comps_in_scan and cinfo->cur_comp_info[] are already set */
-{
- int ci, mcublks, tmp;
- jpeg_component_info *compptr;
-
- if (cinfo->comps_in_scan == 1) {
-
- /* Noninterleaved (single-component) scan */
- compptr = cinfo->cur_comp_info[0];
-
- /* Overall image size in MCUs */
- cinfo->MCUs_per_row = compptr->width_in_blocks;
- cinfo->MCU_rows_in_scan = compptr->height_in_blocks;
-
- /* For noninterleaved scan, always one block per MCU */
- compptr->MCU_width = 1;
- compptr->MCU_height = 1;
- compptr->MCU_blocks = 1;
- compptr->MCU_sample_width = DCTSIZE;
- compptr->last_col_width = 1;
- /* For noninterleaved scans, it is convenient to define last_row_height
- * as the number of block rows present in the last iMCU row.
- */
- tmp = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (tmp == 0) tmp = compptr->v_samp_factor;
- compptr->last_row_height = tmp;
-
- /* Prepare array describing MCU composition */
- cinfo->blocks_in_MCU = 1;
- cinfo->MCU_membership[0] = 0;
-
- } else {
-
- /* Interleaved (multi-component) scan */
- if (cinfo->comps_in_scan <= 0 || cinfo->comps_in_scan > MAX_COMPS_IN_SCAN)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->comps_in_scan,
- MAX_COMPS_IN_SCAN);
-
- /* Overall image size in MCUs */
- cinfo->MCUs_per_row = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_width,
- (long) (cinfo->max_h_samp_factor*DCTSIZE));
- cinfo->MCU_rows_in_scan = (JDIMENSION)
- jdiv_round_up((long) cinfo->image_height,
- (long) (cinfo->max_v_samp_factor*DCTSIZE));
-
- cinfo->blocks_in_MCU = 0;
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* Sampling factors give # of blocks of component in each MCU */
- compptr->MCU_width = compptr->h_samp_factor;
- compptr->MCU_height = compptr->v_samp_factor;
- compptr->MCU_blocks = compptr->MCU_width * compptr->MCU_height;
- compptr->MCU_sample_width = compptr->MCU_width * DCTSIZE;
- /* Figure number of non-dummy blocks in last MCU column & row */
- tmp = (int) (compptr->width_in_blocks % compptr->MCU_width);
- if (tmp == 0) tmp = compptr->MCU_width;
- compptr->last_col_width = tmp;
- tmp = (int) (compptr->height_in_blocks % compptr->MCU_height);
- if (tmp == 0) tmp = compptr->MCU_height;
- compptr->last_row_height = tmp;
- /* Prepare array describing MCU composition */
- mcublks = compptr->MCU_blocks;
- if (cinfo->blocks_in_MCU + mcublks > C_MAX_BLOCKS_IN_MCU)
- ERREXIT(cinfo, JERR_BAD_MCU_SIZE);
- while (mcublks-- > 0) {
- cinfo->MCU_membership[cinfo->blocks_in_MCU++] = ci;
- }
- }
-
- }
-
- /* Convert restart specified in rows to actual MCU count. */
- /* Note that count must fit in 16 bits, so we provide limiting. */
- if (cinfo->restart_in_rows > 0) {
- long nominal = (long) cinfo->restart_in_rows * (long) cinfo->MCUs_per_row;
- cinfo->restart_interval = (unsigned int) MIN(nominal, 65535L);
- }
-}
-
-
-/*
- * Per-pass setup.
- * This is called at the beginning of each pass. We determine which modules
- * will be active during this pass and give them appropriate start_pass calls.
- * We also set is_last_pass to indicate whether any more passes will be
- * required.
- */
-
-METHODDEF void
-prepare_for_pass (j_compress_ptr cinfo)
-{
- my_master_ptr master = (my_master_ptr) cinfo->master;
-
- switch (master->pass_type) {
- case main_pass:
- /* Initial pass: will collect input data, and do either Huffman
- * optimization or data output for the first scan.
- */
- select_scan_parameters(cinfo);
- per_scan_setup(cinfo);
- if (! cinfo->raw_data_in) {
- (*cinfo->cconvert->start_pass) (cinfo);
- (*cinfo->downsample->start_pass) (cinfo);
- (*cinfo->prep->start_pass) (cinfo, JBUF_PASS_THRU);
- }
- (*cinfo->fdct->start_pass) (cinfo);
- (*cinfo->entropy->start_pass) (cinfo, cinfo->optimize_coding);
- (*cinfo->coef->start_pass) (cinfo,
- (master->total_passes > 1 ?
- JBUF_SAVE_AND_PASS : JBUF_PASS_THRU));
- (*cinfo->main->start_pass) (cinfo, JBUF_PASS_THRU);
- if (cinfo->optimize_coding) {
- /* No immediate data output; postpone writing frame/scan headers */
- master->pub.call_pass_startup = FALSE;
- } else {
- /* Will write frame/scan headers at first jpeg_write_scanlines call */
- master->pub.call_pass_startup = TRUE;
- }
- break;
-#ifdef ENTROPY_OPT_SUPPORTED
- case huff_opt_pass:
- /* Do Huffman optimization for a scan after the first one. */
- select_scan_parameters(cinfo);
- per_scan_setup(cinfo);
- if (cinfo->Ss != 0 || cinfo->Ah == 0 || cinfo->arith_code) {
- (*cinfo->entropy->start_pass) (cinfo, TRUE);
- (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
- master->pub.call_pass_startup = FALSE;
- break;
- }
- /* Special case: Huffman DC refinement scans need no Huffman table
- * and therefore we can skip the optimization pass for them.
- */
- master->pass_type = output_pass;
- master->pass_number++;
- /*FALLTHROUGH*/
-#endif
- case output_pass:
- /* Do a data-output pass. */
- /* We need not repeat per-scan setup if prior optimization pass did it. */
- if (! cinfo->optimize_coding) {
- select_scan_parameters(cinfo);
- per_scan_setup(cinfo);
- }
- (*cinfo->entropy->start_pass) (cinfo, FALSE);
- (*cinfo->coef->start_pass) (cinfo, JBUF_CRANK_DEST);
- /* We emit frame/scan headers now */
- if (master->scan_number == 0)
- (*cinfo->marker->write_frame_header) (cinfo);
- (*cinfo->marker->write_scan_header) (cinfo);
- master->pub.call_pass_startup = FALSE;
- break;
- default:
- ERREXIT(cinfo, JERR_NOT_COMPILED);
- }
-
- master->pub.is_last_pass = (master->pass_number == master->total_passes-1);
-
- /* Set up progress monitor's pass info if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->completed_passes = master->pass_number;
- cinfo->progress->total_passes = master->total_passes;
- }
-}
-
-
-/*
- * Special start-of-pass hook.
- * This is called by jpeg_write_scanlines if call_pass_startup is TRUE.
- * In single-pass processing, we need this hook because we don't want to
- * write frame/scan headers during jpeg_start_compress; we want to let the
- * application write COM markers etc. between jpeg_start_compress and the
- * jpeg_write_scanlines loop.
- * In multi-pass processing, this routine is not used.
- */
-
-METHODDEF void
-pass_startup (j_compress_ptr cinfo)
-{
- cinfo->master->call_pass_startup = FALSE; /* reset flag so call only once */
-
- (*cinfo->marker->write_frame_header) (cinfo);
- (*cinfo->marker->write_scan_header) (cinfo);
-}
-
-
-/*
- * Finish up at end of pass.
- */
-
-METHODDEF void
-finish_pass_master (j_compress_ptr cinfo)
-{
- my_master_ptr master = (my_master_ptr) cinfo->master;
-
- /* The entropy coder always needs an end-of-pass call,
- * either to analyze statistics or to flush its output buffer.
- */
- (*cinfo->entropy->finish_pass) (cinfo);
-
- /* Update state for next pass */
- switch (master->pass_type) {
- case main_pass:
- /* next pass is either output of scan 0 (after optimization)
- * or output of scan 1 (if no optimization).
- */
- master->pass_type = output_pass;
- if (! cinfo->optimize_coding)
- master->scan_number++;
- break;
- case huff_opt_pass:
- /* next pass is always output of current scan */
- master->pass_type = output_pass;
- break;
- case output_pass:
- /* next pass is either optimization or output of next scan */
- if (cinfo->optimize_coding)
- master->pass_type = huff_opt_pass;
- master->scan_number++;
- break;
- }
-
- master->pass_number++;
-}
-
-
-/*
- * Initialize master compression control.
- */
-
-GLOBAL void
-jinit_c_master_control (j_compress_ptr cinfo, boolean transcode_only)
-{
- my_master_ptr master;
-
- master = (my_master_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_comp_master));
- cinfo->master = (struct jpeg_comp_master *) master;
- master->pub.prepare_for_pass = prepare_for_pass;
- master->pub.pass_startup = pass_startup;
- master->pub.finish_pass = finish_pass_master;
- master->pub.is_last_pass = FALSE;
-
- /* Validate parameters, determine derived values */
- initial_setup(cinfo);
-
- if (cinfo->scan_info != NULL) {
-#ifdef C_MULTISCAN_FILES_SUPPORTED
- validate_script(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- cinfo->progressive_mode = FALSE;
- cinfo->num_scans = 1;
- }
-
- if (cinfo->progressive_mode) /* TEMPORARY HACK ??? */
- cinfo->optimize_coding = TRUE; /* assume default tables no good for progressive mode */
-
- /* Initialize my private state */
- if (transcode_only) {
- /* no main pass in transcoding */
- if (cinfo->optimize_coding)
- master->pass_type = huff_opt_pass;
- else
- master->pass_type = output_pass;
- } else {
- /* for normal compression, first pass is always this type: */
- master->pass_type = main_pass;
- }
- master->scan_number = 0;
- master->pass_number = 0;
- if (cinfo->optimize_coding)
- master->total_passes = cinfo->num_scans * 2;
- else
- master->total_passes = cinfo->num_scans;
-}
diff --git a/src/jpeg-6/jcomapi.c b/src/jpeg-6/jcomapi.c
deleted file mode 100644
index c10903f..0000000
--- a/src/jpeg-6/jcomapi.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * jcomapi.c
- *
- * Copyright (C) 1994, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface routines that are used for both
- * compression and decompression.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Abort processing of a JPEG compression or decompression operation,
- * but don't destroy the object itself.
- *
- * For this, we merely clean up all the nonpermanent memory pools.
- * Note that temp files (virtual arrays) are not allowed to belong to
- * the permanent pool, so we will be able to close all temp files here.
- * Closing a data source or destination, if necessary, is the application's
- * responsibility.
- */
-
-GLOBAL void
-jpeg_abort (j_common_ptr cinfo)
-{
- int pool;
-
- /* Releasing pools in reverse order might help avoid fragmentation
- * with some (brain-damaged) malloc libraries.
- */
- for (pool = JPOOL_NUMPOOLS-1; pool > JPOOL_PERMANENT; pool--) {
- (*cinfo->mem->free_pool) (cinfo, pool);
- }
-
- /* Reset overall state for possible reuse of object */
- cinfo->global_state = (cinfo->is_decompressor ? DSTATE_START : CSTATE_START);
-}
-
-
-/*
- * Destruction of a JPEG object.
- *
- * Everything gets deallocated except the master jpeg_compress_struct itself
- * and the error manager struct. Both of these are supplied by the application
- * and must be freed, if necessary, by the application. (Often they are on
- * the stack and so don't need to be freed anyway.)
- * Closing a data source or destination, if necessary, is the application's
- * responsibility.
- */
-
-GLOBAL void
-jpeg_destroy (j_common_ptr cinfo)
-{
- /* We need only tell the memory manager to release everything. */
- /* NB: mem pointer is NULL if memory mgr failed to initialize. */
- if (cinfo->mem != NULL)
- (*cinfo->mem->self_destruct) (cinfo);
- cinfo->mem = NULL; /* be safe if jpeg_destroy is called twice */
- cinfo->global_state = 0; /* mark it destroyed */
-}
-
-
-/*
- * Convenience routines for allocating quantization and Huffman tables.
- * (Would jutils.c be a more reasonable place to put these?)
- */
-
-GLOBAL JQUANT_TBL *
-jpeg_alloc_quant_table (j_common_ptr cinfo)
-{
- JQUANT_TBL *tbl;
-
- tbl = (JQUANT_TBL *)
- (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JQUANT_TBL));
- tbl->sent_table = FALSE; /* make sure this is false in any new table */
- return tbl;
-}
-
-
-GLOBAL JHUFF_TBL *
-jpeg_alloc_huff_table (j_common_ptr cinfo)
-{
- JHUFF_TBL *tbl;
-
- tbl = (JHUFF_TBL *)
- (*cinfo->mem->alloc_small) (cinfo, JPOOL_PERMANENT, SIZEOF(JHUFF_TBL));
- tbl->sent_table = FALSE; /* make sure this is false in any new table */
- return tbl;
-}
diff --git a/src/jpeg-6/jconfig.h b/src/jpeg-6/jconfig.h
deleted file mode 100644
index 7d2f733..0000000
--- a/src/jpeg-6/jconfig.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* jconfig.wat --- jconfig.h for Watcom C/C++ on MS-DOS or OS/2. */
-/* see jconfig.doc for explanations */
-
-#define HAVE_PROTOTYPES
-#define HAVE_UNSIGNED_CHAR
-#define HAVE_UNSIGNED_SHORT
-/* #define void char */
-/* #define const */
-#define CHAR_IS_UNSIGNED
-#define HAVE_STDDEF_H
-#define HAVE_STDLIB_H
-#undef NEED_BSD_STRINGS
-#undef NEED_SYS_TYPES_H
-#undef NEED_FAR_POINTERS /* Watcom uses flat 32-bit addressing */
-#undef NEED_SHORT_EXTERNAL_NAMES
-#undef INCOMPLETE_TYPES_BROKEN
-
-#define JDCT_DEFAULT JDCT_FLOAT
-#define JDCT_FASTEST JDCT_FLOAT
-
-#ifdef JPEG_INTERNALS
-
-#undef RIGHT_SHIFT_IS_UNSIGNED
-
-#endif /* JPEG_INTERNALS */
-
-#ifdef JPEG_CJPEG_DJPEG
-
-#define BMP_SUPPORTED /* BMP image file format */
-#define GIF_SUPPORTED /* GIF image file format */
-#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
-#undef RLE_SUPPORTED /* Utah RLE image file format */
-#define TARGA_SUPPORTED /* Targa image file format */
-
-#undef TWO_FILE_COMMANDLINE /* optional */
-#define USE_SETMODE /* Needed to make one-file style work in Watcom */
-#undef NEED_SIGNAL_CATCHER /* Define this if you use jmemname.c */
-#undef DONT_USE_B_MODE
-#undef PROGRESS_REPORT /* optional */
-
-#endif /* JPEG_CJPEG_DJPEG */
diff --git a/src/jpeg-6/jcparam.c b/src/jpeg-6/jcparam.c
deleted file mode 100644
index 29862d3..0000000
--- a/src/jpeg-6/jcparam.c
+++ /dev/null
@@ -1,575 +0,0 @@
-/*
- * jcparam.c
- *
- * Copyright (C) 1991-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains optional default-setting code for the JPEG compressor.
- * Applications do not have to use this file, but those that don't use it
- * must know a lot more about the innards of the JPEG code.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Quantization table setup routines
- */
-
-GLOBAL void
-jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
- const unsigned int *basic_table,
- int scale_factor, boolean force_baseline)
-/* Define a quantization table equal to the basic_table times
- * a scale factor (given as a percentage).
- * If force_baseline is TRUE, the computed quantization table entries
- * are limited to 1..255 for JPEG baseline compatibility.
- */
-{
- JQUANT_TBL ** qtblptr = & cinfo->quant_tbl_ptrs[which_tbl];
- int i;
- long temp;
-
- /* Safety check to ensure start_compress not called yet. */
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- if (*qtblptr == NULL)
- *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo);
-
- for (i = 0; i < DCTSIZE2; i++) {
- temp = ((long) basic_table[i] * scale_factor + 50L) / 100L;
- /* limit the values to the valid range */
- if (temp <= 0L) temp = 1L;
- if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
- if (force_baseline && temp > 255L)
- temp = 255L; /* limit to baseline range if requested */
- (*qtblptr)->quantval[i] = (UINT16) temp;
- }
-
- /* Initialize sent_table FALSE so table will be written to JPEG file. */
- (*qtblptr)->sent_table = FALSE;
-}
-
-
-GLOBAL void
-jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
- boolean force_baseline)
-/* Set or change the 'quality' (quantization) setting, using default tables
- * and a straight percentage-scaling quality scale. In most cases it's better
- * to use jpeg_set_quality (below); this entry point is provided for
- * applications that insist on a linear percentage scaling.
- */
-{
- /* This is the sample quantization table given in the JPEG spec section K.1,
- * but expressed in zigzag order (as are all of our quant. tables).
- * The spec says that the values given produce "good" quality, and
- * when divided by 2, "very good" quality.
- */
- static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = {
- 16, 11, 12, 14, 12, 10, 16, 14,
- 13, 14, 18, 17, 16, 19, 24, 40,
- 26, 24, 22, 22, 24, 49, 35, 37,
- 29, 40, 58, 51, 61, 60, 57, 51,
- 56, 55, 64, 72, 92, 78, 64, 68,
- 87, 69, 55, 56, 80, 109, 81, 87,
- 95, 98, 103, 104, 103, 62, 77, 113,
- 121, 112, 100, 120, 92, 101, 103, 99
- };
- static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
- 17, 18, 18, 24, 21, 24, 47, 26,
- 26, 47, 99, 66, 56, 66, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99
- };
-
- /* Set up two quantization tables using the specified scaling */
- jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
- scale_factor, force_baseline);
- jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
- scale_factor, force_baseline);
-}
-
-
-GLOBAL int
-jpeg_quality_scaling (int quality)
-/* Convert a user-specified quality rating to a percentage scaling factor
- * for an underlying quantization table, using our recommended scaling curve.
- * The input 'quality' factor should be 0 (terrible) to 100 (very good).
- */
-{
- /* Safety limit on quality factor. Convert 0 to 1 to avoid zero divide. */
- if (quality <= 0) quality = 1;
- if (quality > 100) quality = 100;
-
- /* The basic table is used as-is (scaling 100) for a quality of 50.
- * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
- * note that at Q=100 the scaling is 0, which will cause j_add_quant_table
- * to make all the table entries 1 (hence, no quantization loss).
- * Qualities 1..50 are converted to scaling percentage 5000/Q.
- */
- if (quality < 50)
- quality = 5000 / quality;
- else
- quality = 200 - quality*2;
-
- return quality;
-}
-
-
-GLOBAL void
-jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
-/* Set or change the 'quality' (quantization) setting, using default tables.
- * This is the standard quality-adjusting entry point for typical user
- * interfaces; only those who want detailed control over quantization tables
- * would use the preceding three routines directly.
- */
-{
- /* Convert user 0-100 rating to percentage scaling */
- quality = jpeg_quality_scaling(quality);
-
- /* Set up standard quality tables */
- jpeg_set_linear_quality(cinfo, quality, force_baseline);
-}
-
-
-/*
- * Huffman table setup routines
- */
-
-LOCAL void
-add_huff_table (j_compress_ptr cinfo,
- JHUFF_TBL **htblptr, const UINT8 *bits, const UINT8 *val)
-/* Define a Huffman table */
-{
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
-
- MEMCOPY((*htblptr)->bits, bits, SIZEOF((*htblptr)->bits));
- MEMCOPY((*htblptr)->huffval, val, SIZEOF((*htblptr)->huffval));
-
- /* Initialize sent_table FALSE so table will be written to JPEG file. */
- (*htblptr)->sent_table = FALSE;
-}
-
-
-LOCAL void
-std_huff_tables (j_compress_ptr cinfo)
-/* Set up the standard Huffman tables (cf. JPEG standard section K.3) */
-/* IMPORTANT: these are only valid for 8-bit data precision! */
-{
- static const UINT8 bits_dc_luminance[17] =
- { /* 0-base */ 0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 };
- static const UINT8 val_dc_luminance[] =
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
-
- static const UINT8 bits_dc_chrominance[17] =
- { /* 0-base */ 0, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
- static const UINT8 val_dc_chrominance[] =
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
-
- static const UINT8 bits_ac_luminance[17] =
- { /* 0-base */ 0, 0, 2, 1, 3, 3, 2, 4, 3, 5, 5, 4, 4, 0, 0, 1, 0x7d };
- static const UINT8 val_ac_luminance[] =
- { 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
- 0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
- 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
- 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
- 0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
- 0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
- 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
- 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
- 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
- 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
- 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
- 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
- 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
- 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
- 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
- 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
- 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
- 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
- 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
- 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa };
-
- static const UINT8 bits_ac_chrominance[17] =
- { /* 0-base */ 0, 0, 2, 1, 2, 4, 4, 3, 4, 7, 5, 4, 4, 0, 1, 2, 0x77 };
- static const UINT8 val_ac_chrominance[] =
- { 0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
- 0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
- 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
- 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
- 0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
- 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
- 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
- 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
- 0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
- 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
- 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
- 0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
- 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
- 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
- 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
- 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
- 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
- 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
- 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
- 0xf9, 0xfa };
-
- add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[0],
- bits_dc_luminance, val_dc_luminance);
- add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[0],
- bits_ac_luminance, val_ac_luminance);
- add_huff_table(cinfo, &cinfo->dc_huff_tbl_ptrs[1],
- bits_dc_chrominance, val_dc_chrominance);
- add_huff_table(cinfo, &cinfo->ac_huff_tbl_ptrs[1],
- bits_ac_chrominance, val_ac_chrominance);
-}
-
-
-/*
- * Default parameter setup for compression.
- *
- * Applications that don't choose to use this routine must do their
- * own setup of all these parameters. Alternately, you can call this
- * to establish defaults and then alter parameters selectively. This
- * is the recommended approach since, if we add any new parameters,
- * your code will still work (they'll be set to reasonable defaults).
- */
-
-GLOBAL void
-jpeg_set_defaults (j_compress_ptr cinfo)
-{
- int i;
-
- /* Safety check to ensure start_compress not called yet. */
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- /* Allocate comp_info array large enough for maximum component count.
- * Array is made permanent in case application wants to compress
- * multiple images at same param settings.
- */
- if (cinfo->comp_info == NULL)
- cinfo->comp_info = (jpeg_component_info *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- MAX_COMPONENTS * SIZEOF(jpeg_component_info));
-
- /* Initialize everything not dependent on the color space */
-
- cinfo->data_precision = BITS_IN_JSAMPLE;
- /* Set up two quantization tables using default quality of 75 */
- jpeg_set_quality(cinfo, 75, TRUE);
- /* Set up two Huffman tables */
- std_huff_tables(cinfo);
-
- /* Initialize default arithmetic coding conditioning */
- for (i = 0; i < NUM_ARITH_TBLS; i++) {
- cinfo->arith_dc_L[i] = 0;
- cinfo->arith_dc_U[i] = 1;
- cinfo->arith_ac_K[i] = 5;
- }
-
- /* Default is no multiple-scan output */
- cinfo->scan_info = NULL;
- cinfo->num_scans = 0;
-
- /* Expect normal source image, not raw downsampled data */
- cinfo->raw_data_in = FALSE;
-
- /* Use Huffman coding, not arithmetic coding, by default */
- cinfo->arith_code = FALSE;
-
- /* By default, don't do extra passes to optimize entropy coding */
- cinfo->optimize_coding = FALSE;
- /* The standard Huffman tables are only valid for 8-bit data precision.
- * If the precision is higher, force optimization on so that usable
- * tables will be computed. This test can be removed if default tables
- * are supplied that are valid for the desired precision.
- */
- if (cinfo->data_precision > 8)
- cinfo->optimize_coding = TRUE;
-
- /* By default, use the simpler non-cosited sampling alignment */
- cinfo->CCIR601_sampling = FALSE;
-
- /* No input smoothing */
- cinfo->smoothing_factor = 0;
-
- /* DCT algorithm preference */
- cinfo->dct_method = JDCT_DEFAULT;
-
- /* No restart markers */
- cinfo->restart_interval = 0;
- cinfo->restart_in_rows = 0;
-
- /* Fill in default JFIF marker parameters. Note that whether the marker
- * will actually be written is determined by jpeg_set_colorspace.
- */
- cinfo->density_unit = 0; /* Pixel size is unknown by default */
- cinfo->X_density = 1; /* Pixel aspect ratio is square by default */
- cinfo->Y_density = 1;
-
- /* Choose JPEG colorspace based on input space, set defaults accordingly */
-
- jpeg_default_colorspace(cinfo);
-}
-
-
-/*
- * Select an appropriate JPEG colorspace for in_color_space.
- */
-
-GLOBAL void
-jpeg_default_colorspace (j_compress_ptr cinfo)
-{
- switch (cinfo->in_color_space) {
- case JCS_GRAYSCALE:
- jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
- break;
- case JCS_RGB:
- jpeg_set_colorspace(cinfo, JCS_YCbCr);
- break;
- case JCS_YCbCr:
- jpeg_set_colorspace(cinfo, JCS_YCbCr);
- break;
- case JCS_CMYK:
- jpeg_set_colorspace(cinfo, JCS_CMYK); /* By default, no translation */
- break;
- case JCS_YCCK:
- jpeg_set_colorspace(cinfo, JCS_YCCK);
- break;
- case JCS_UNKNOWN:
- jpeg_set_colorspace(cinfo, JCS_UNKNOWN);
- break;
- default:
- ERREXIT(cinfo, JERR_BAD_IN_COLORSPACE);
- }
-}
-
-
-/*
- * Set the JPEG colorspace, and choose colorspace-dependent default values.
- */
-
-GLOBAL void
-jpeg_set_colorspace (j_compress_ptr cinfo, J_COLOR_SPACE colorspace)
-{
- jpeg_component_info * compptr;
- int ci;
-
-#define SET_COMP(index,id,hsamp,vsamp,quant,dctbl,actbl) \
- (compptr = &cinfo->comp_info[index], \
- compptr->component_id = (id), \
- compptr->h_samp_factor = (hsamp), \
- compptr->v_samp_factor = (vsamp), \
- compptr->quant_tbl_no = (quant), \
- compptr->dc_tbl_no = (dctbl), \
- compptr->ac_tbl_no = (actbl) )
-
- /* Safety check to ensure start_compress not called yet. */
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- /* For all colorspaces, we use Q and Huff tables 0 for luminance components,
- * tables 1 for chrominance components.
- */
-
- cinfo->jpeg_color_space = colorspace;
-
- cinfo->write_JFIF_header = FALSE; /* No marker for non-JFIF colorspaces */
- cinfo->write_Adobe_marker = FALSE; /* write no Adobe marker by default */
-
- switch (colorspace) {
- case JCS_GRAYSCALE:
- cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
- cinfo->num_components = 1;
- /* JFIF specifies component ID 1 */
- SET_COMP(0, 1, 1,1, 0, 0,0);
- break;
- case JCS_RGB:
- cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag RGB */
- cinfo->num_components = 3;
- SET_COMP(0, 0x52 /* 'R' */, 1,1, 0, 0,0);
- SET_COMP(1, 0x47 /* 'G' */, 1,1, 0, 0,0);
- SET_COMP(2, 0x42 /* 'B' */, 1,1, 0, 0,0);
- break;
- case JCS_YCbCr:
- cinfo->write_JFIF_header = TRUE; /* Write a JFIF marker */
- cinfo->num_components = 3;
- /* JFIF specifies component IDs 1,2,3 */
- /* We default to 2x2 subsamples of chrominance */
- SET_COMP(0, 1, 2,2, 0, 0,0);
- SET_COMP(1, 2, 1,1, 1, 1,1);
- SET_COMP(2, 3, 1,1, 1, 1,1);
- break;
- case JCS_CMYK:
- cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag CMYK */
- cinfo->num_components = 4;
- SET_COMP(0, 0x43 /* 'C' */, 1,1, 0, 0,0);
- SET_COMP(1, 0x4D /* 'M' */, 1,1, 0, 0,0);
- SET_COMP(2, 0x59 /* 'Y' */, 1,1, 0, 0,0);
- SET_COMP(3, 0x4B /* 'K' */, 1,1, 0, 0,0);
- break;
- case JCS_YCCK:
- cinfo->write_Adobe_marker = TRUE; /* write Adobe marker to flag YCCK */
- cinfo->num_components = 4;
- SET_COMP(0, 1, 2,2, 0, 0,0);
- SET_COMP(1, 2, 1,1, 1, 1,1);
- SET_COMP(2, 3, 1,1, 1, 1,1);
- SET_COMP(3, 4, 2,2, 0, 0,0);
- break;
- case JCS_UNKNOWN:
- cinfo->num_components = cinfo->input_components;
- if (cinfo->num_components < 1 || cinfo->num_components > MAX_COMPONENTS)
- ERREXIT2(cinfo, JERR_COMPONENT_COUNT, cinfo->num_components,
- MAX_COMPONENTS);
- for (ci = 0; ci < cinfo->num_components; ci++) {
- SET_COMP(ci, ci, 1,1, 0, 0,0);
- }
- break;
- default:
- ERREXIT(cinfo, JERR_BAD_J_COLORSPACE);
- }
-}
-
-
-#ifdef C_PROGRESSIVE_SUPPORTED
-
-LOCAL jpeg_scan_info *
-fill_a_scan (jpeg_scan_info * scanptr, int ci,
- int Ss, int Se, int Ah, int Al)
-/* Support routine: generate one scan for specified component */
-{
- scanptr->comps_in_scan = 1;
- scanptr->component_index[0] = ci;
- scanptr->Ss = Ss;
- scanptr->Se = Se;
- scanptr->Ah = Ah;
- scanptr->Al = Al;
- scanptr++;
- return scanptr;
-}
-
-LOCAL jpeg_scan_info *
-fill_scans (jpeg_scan_info * scanptr, int ncomps,
- int Ss, int Se, int Ah, int Al)
-/* Support routine: generate one scan for each component */
-{
- int ci;
-
- for (ci = 0; ci < ncomps; ci++) {
- scanptr->comps_in_scan = 1;
- scanptr->component_index[0] = ci;
- scanptr->Ss = Ss;
- scanptr->Se = Se;
- scanptr->Ah = Ah;
- scanptr->Al = Al;
- scanptr++;
- }
- return scanptr;
-}
-
-LOCAL jpeg_scan_info *
-fill_dc_scans (jpeg_scan_info * scanptr, int ncomps, int Ah, int Al)
-/* Support routine: generate interleaved DC scan if possible, else N scans */
-{
- int ci;
-
- if (ncomps <= MAX_COMPS_IN_SCAN) {
- /* Single interleaved DC scan */
- scanptr->comps_in_scan = ncomps;
- for (ci = 0; ci < ncomps; ci++)
- scanptr->component_index[ci] = ci;
- scanptr->Ss = scanptr->Se = 0;
- scanptr->Ah = Ah;
- scanptr->Al = Al;
- scanptr++;
- } else {
- /* Noninterleaved DC scan for each component */
- scanptr = fill_scans(scanptr, ncomps, 0, 0, Ah, Al);
- }
- return scanptr;
-}
-
-
-/*
- * Create a recommended progressive-JPEG script.
- * cinfo->num_components and cinfo->jpeg_color_space must be correct.
- */
-
-GLOBAL void
-jpeg_simple_progression (j_compress_ptr cinfo)
-{
- int ncomps = cinfo->num_components;
- int nscans;
- jpeg_scan_info * scanptr;
-
- /* Safety check to ensure start_compress not called yet. */
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- /* Figure space needed for script. Calculation must match code below! */
- if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
- /* Custom script for YCbCr color images. */
- nscans = 10;
- } else {
- /* All-purpose script for other color spaces. */
- if (ncomps > MAX_COMPS_IN_SCAN)
- nscans = 6 * ncomps; /* 2 DC + 4 AC scans per component */
- else
- nscans = 2 + 4 * ncomps; /* 2 DC scans; 4 AC scans per component */
- }
-
- /* Allocate space for script. */
- /* We use permanent pool just in case application re-uses script. */
- scanptr = (jpeg_scan_info *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- nscans * SIZEOF(jpeg_scan_info));
- cinfo->scan_info = scanptr;
- cinfo->num_scans = nscans;
-
- if (ncomps == 3 && cinfo->jpeg_color_space == JCS_YCbCr) {
- /* Custom script for YCbCr color images. */
- /* Initial DC scan */
- scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
- /* Initial AC scan: get some luma data out in a hurry */
- scanptr = fill_a_scan(scanptr, 0, 1, 5, 0, 2);
- /* Chroma data is too small to be worth expending many scans on */
- scanptr = fill_a_scan(scanptr, 2, 1, 63, 0, 1);
- scanptr = fill_a_scan(scanptr, 1, 1, 63, 0, 1);
- /* Complete spectral selection for luma AC */
- scanptr = fill_a_scan(scanptr, 0, 6, 63, 0, 2);
- /* Refine next bit of luma AC */
- scanptr = fill_a_scan(scanptr, 0, 1, 63, 2, 1);
- /* Finish DC successive approximation */
- scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
- /* Finish AC successive approximation */
- scanptr = fill_a_scan(scanptr, 2, 1, 63, 1, 0);
- scanptr = fill_a_scan(scanptr, 1, 1, 63, 1, 0);
- /* Luma bottom bit comes last since it's usually largest scan */
- scanptr = fill_a_scan(scanptr, 0, 1, 63, 1, 0);
- } else {
- /* All-purpose script for other color spaces. */
- /* Successive approximation first pass */
- scanptr = fill_dc_scans(scanptr, ncomps, 0, 1);
- scanptr = fill_scans(scanptr, ncomps, 1, 5, 0, 2);
- scanptr = fill_scans(scanptr, ncomps, 6, 63, 0, 2);
- /* Successive approximation second pass */
- scanptr = fill_scans(scanptr, ncomps, 1, 63, 2, 1);
- /* Successive approximation final pass */
- scanptr = fill_dc_scans(scanptr, ncomps, 1, 0);
- scanptr = fill_scans(scanptr, ncomps, 1, 63, 1, 0);
- }
-}
-
-#endif /* C_PROGRESSIVE_SUPPORTED */
diff --git a/src/jpeg-6/jcphuff.c b/src/jpeg-6/jcphuff.c
deleted file mode 100644
index 922c17c..0000000
--- a/src/jpeg-6/jcphuff.c
+++ /dev/null
@@ -1,829 +0,0 @@
-/*
- * jcphuff.c
- *
- * Copyright (C) 1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains Huffman entropy encoding routines for progressive JPEG.
- *
- * We do not support output suspension in this module, since the library
- * currently does not allow multiple-scan files to be written with output
- * suspension.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jchuff.h" /* Declarations shared with jchuff.c */
-
-#ifdef C_PROGRESSIVE_SUPPORTED
-
-/* Expanded entropy encoder object for progressive Huffman encoding. */
-
-typedef struct {
- struct jpeg_entropy_encoder pub; /* public fields */
-
- /* Mode flag: TRUE for optimization, FALSE for actual data output */
- boolean gather_statistics;
-
- /* Bit-level coding status.
- * next_output_byte/free_in_buffer are local copies of cinfo->dest fields.
- */
- JOCTET * next_output_byte; /* => next byte to write in buffer */
- size_t free_in_buffer; /* # of byte spaces remaining in buffer */
- INT32 put_buffer; /* current bit-accumulation buffer */
- int put_bits; /* # of bits now in it */
- j_compress_ptr cinfo; /* link to cinfo (needed for dump_buffer) */
-
- /* Coding status for DC components */
- int last_dc_val[MAX_COMPS_IN_SCAN]; /* last DC coef for each component */
-
- /* Coding status for AC components */
- int ac_tbl_no; /* the table number of the single component */
- unsigned int EOBRUN; /* run length of EOBs */
- unsigned int BE; /* # of buffered correction bits before MCU */
- char * bit_buffer; /* buffer for correction bits (1 per char) */
- /* packing correction bits tightly would save some space but cost time... */
-
- unsigned int restarts_to_go; /* MCUs left in this restart interval */
- int next_restart_num; /* next restart number to write (0-7) */
-
- /* Pointers to derived tables (these workspaces have image lifespan).
- * Since any one scan codes only DC or only AC, we only need one set
- * of tables, not one for DC and one for AC.
- */
- c_derived_tbl * derived_tbls[NUM_HUFF_TBLS];
-
- /* Statistics tables for optimization; again, one set is enough */
- long * count_ptrs[NUM_HUFF_TBLS];
-} phuff_entropy_encoder;
-
-typedef phuff_entropy_encoder * phuff_entropy_ptr;
-
-/* MAX_CORR_BITS is the number of bits the AC refinement correction-bit
- * buffer can hold. Larger sizes may slightly improve compression, but
- * 1000 is already well into the realm of overkill.
- * The minimum safe size is 64 bits.
- */
-
-#define MAX_CORR_BITS 1000 /* Max # of correction bits I can buffer */
-
-/* IRIGHT_SHIFT is like RIGHT_SHIFT, but works on int rather than INT32.
- * We assume that int right shift is unsigned if INT32 right shift is,
- * which should be safe.
- */
-
-#ifdef RIGHT_SHIFT_IS_UNSIGNED
-#define ISHIFT_TEMPS int ishift_temp;
-#define IRIGHT_SHIFT(x,shft) \
- ((ishift_temp = (x)) < 0 ? \
- (ishift_temp >> (shft)) | ((~0) << (16-(shft))) : \
- (ishift_temp >> (shft)))
-#else
-#define ISHIFT_TEMPS
-#define IRIGHT_SHIFT(x,shft) ((x) >> (shft))
-#endif
-
-/* Forward declarations */
-METHODDEF boolean encode_mcu_DC_first JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF boolean encode_mcu_AC_first JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF boolean encode_mcu_DC_refine JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF boolean encode_mcu_AC_refine JPP((j_compress_ptr cinfo,
- JBLOCKROW *MCU_data));
-METHODDEF void finish_pass_phuff JPP((j_compress_ptr cinfo));
-METHODDEF void finish_pass_gather_phuff JPP((j_compress_ptr cinfo));
-
-
-/*
- * Initialize for a Huffman-compressed scan using progressive JPEG.
- */
-
-METHODDEF void
-start_pass_phuff (j_compress_ptr cinfo, boolean gather_statistics)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- boolean is_DC_band;
- int ci, tbl;
- jpeg_component_info * compptr;
-
- entropy->cinfo = cinfo;
- entropy->gather_statistics = gather_statistics;
-
- is_DC_band = (cinfo->Ss == 0);
-
- /* We assume jcmaster.c already validated the scan parameters. */
-
- /* Select execution routines */
- if (cinfo->Ah == 0) {
- if (is_DC_band)
- entropy->pub.encode_mcu = encode_mcu_DC_first;
- else
- entropy->pub.encode_mcu = encode_mcu_AC_first;
- } else {
- if (is_DC_band)
- entropy->pub.encode_mcu = encode_mcu_DC_refine;
- else {
- entropy->pub.encode_mcu = encode_mcu_AC_refine;
- /* AC refinement needs a correction bit buffer */
- if (entropy->bit_buffer == NULL)
- entropy->bit_buffer = (char *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- MAX_CORR_BITS * SIZEOF(char));
- }
- }
- if (gather_statistics)
- entropy->pub.finish_pass = finish_pass_gather_phuff;
- else
- entropy->pub.finish_pass = finish_pass_phuff;
-
- /* Only DC coefficients may be interleaved, so cinfo->comps_in_scan = 1
- * for AC coefficients.
- */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* Initialize DC predictions to 0 */
- entropy->last_dc_val[ci] = 0;
- /* Make sure requested tables are present */
- /* (In gather mode, tables need not be allocated yet) */
- if (is_DC_band) {
- if (cinfo->Ah != 0) /* DC refinement needs no table */
- continue;
- tbl = compptr->dc_tbl_no;
- if (tbl < 0 || tbl >= NUM_HUFF_TBLS ||
- (cinfo->dc_huff_tbl_ptrs[tbl] == NULL && !gather_statistics))
- ERREXIT1(cinfo,JERR_NO_HUFF_TABLE, tbl);
- } else {
- entropy->ac_tbl_no = tbl = compptr->ac_tbl_no;
- if (tbl < 0 || tbl >= NUM_HUFF_TBLS ||
- (cinfo->ac_huff_tbl_ptrs[tbl] == NULL && !gather_statistics))
- ERREXIT1(cinfo,JERR_NO_HUFF_TABLE, tbl);
- }
- if (gather_statistics) {
- /* Allocate and zero the statistics tables */
- /* Note that jpeg_gen_optimal_table expects 257 entries in each table! */
- if (entropy->count_ptrs[tbl] == NULL)
- entropy->count_ptrs[tbl] = (long *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- 257 * SIZEOF(long));
- MEMZERO(entropy->count_ptrs[tbl], 257 * SIZEOF(long));
- } else {
- /* Compute derived values for Huffman tables */
- /* We may do this more than once for a table, but it's not expensive */
- if (is_DC_band)
- jpeg_make_c_derived_tbl(cinfo, cinfo->dc_huff_tbl_ptrs[tbl],
- & entropy->derived_tbls[tbl]);
- else
- jpeg_make_c_derived_tbl(cinfo, cinfo->ac_huff_tbl_ptrs[tbl],
- & entropy->derived_tbls[tbl]);
- }
- }
-
- /* Initialize AC stuff */
- entropy->EOBRUN = 0;
- entropy->BE = 0;
-
- /* Initialize bit buffer to empty */
- entropy->put_buffer = 0;
- entropy->put_bits = 0;
-
- /* Initialize restart stuff */
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num = 0;
-}
-
-
-/* Outputting bytes to the file.
- * NB: these must be called only when actually outputting,
- * that is, entropy->gather_statistics == FALSE.
- */
-
-/* Emit a byte */
-#define emit_byte(entropy,val) \
- { *(entropy)->next_output_byte++ = (JOCTET) (val); \
- if (--(entropy)->free_in_buffer == 0) \
- dump_buffer(entropy); }
-
-
-LOCAL void
-dump_buffer (phuff_entropy_ptr entropy)
-/* Empty the output buffer; we do not support suspension in this module. */
-{
- struct jpeg_destination_mgr * dest = entropy->cinfo->dest;
-
- if (! (*dest->empty_output_buffer) (entropy->cinfo))
- ERREXIT(entropy->cinfo, JERR_CANT_SUSPEND);
- /* After a successful buffer dump, must reset buffer pointers */
- entropy->next_output_byte = dest->next_output_byte;
- entropy->free_in_buffer = dest->free_in_buffer;
-}
-
-
-/* Outputting bits to the file */
-
-/* Only the right 24 bits of put_buffer are used; the valid bits are
- * left-justified in this part. At most 16 bits can be passed to emit_bits
- * in one call, and we never retain more than 7 bits in put_buffer
- * between calls, so 24 bits are sufficient.
- */
-
-INLINE
-LOCAL void
-emit_bits (phuff_entropy_ptr entropy, unsigned int code, int size)
-/* Emit some bits, unless we are in gather mode */
-{
- /* This routine is heavily used, so it's worth coding tightly. */
- register INT32 put_buffer = (INT32) code;
- register int put_bits = entropy->put_bits;
-
- /* if size is 0, caller used an invalid Huffman table entry */
- if (size == 0)
- ERREXIT(entropy->cinfo, JERR_HUFF_MISSING_CODE);
-
- if (entropy->gather_statistics)
- return; /* do nothing if we're only getting stats */
-
- put_buffer &= (((INT32) 1)<put_buffer; /* and merge with old buffer contents */
-
- while (put_bits >= 8) {
- int c = (int) ((put_buffer >> 16) & 0xFF);
-
- emit_byte(entropy, c);
- if (c == 0xFF) { /* need to stuff a zero byte? */
- emit_byte(entropy, 0);
- }
- put_buffer <<= 8;
- put_bits -= 8;
- }
-
- entropy->put_buffer = put_buffer; /* update variables */
- entropy->put_bits = put_bits;
-}
-
-
-LOCAL void
-flush_bits (phuff_entropy_ptr entropy)
-{
- emit_bits(entropy, 0x7F, 7); /* fill any partial byte with ones */
- entropy->put_buffer = 0; /* and reset bit-buffer to empty */
- entropy->put_bits = 0;
-}
-
-
-/*
- * Emit (or just count) a Huffman symbol.
- */
-
-INLINE
-LOCAL void
-emit_symbol (phuff_entropy_ptr entropy, int tbl_no, int symbol)
-{
- if (entropy->gather_statistics)
- entropy->count_ptrs[tbl_no][symbol]++;
- else {
- c_derived_tbl * tbl = entropy->derived_tbls[tbl_no];
- emit_bits(entropy, tbl->ehufco[symbol], tbl->ehufsi[symbol]);
- }
-}
-
-
-/*
- * Emit bits from a correction bit buffer.
- */
-
-LOCAL void
-emit_buffered_bits (phuff_entropy_ptr entropy, char * bufstart,
- unsigned int nbits)
-{
- if (entropy->gather_statistics)
- return; /* no real work */
-
- while (nbits > 0) {
- emit_bits(entropy, (unsigned int) (*bufstart), 1);
- bufstart++;
- nbits--;
- }
-}
-
-
-/*
- * Emit any pending EOBRUN symbol.
- */
-
-LOCAL void
-emit_eobrun (phuff_entropy_ptr entropy)
-{
- register int temp, nbits;
-
- if (entropy->EOBRUN > 0) { /* if there is any pending EOBRUN */
- temp = entropy->EOBRUN;
- nbits = 0;
- while ((temp >>= 1))
- nbits++;
-
- emit_symbol(entropy, entropy->ac_tbl_no, nbits << 4);
- if (nbits)
- emit_bits(entropy, entropy->EOBRUN, nbits);
-
- entropy->EOBRUN = 0;
-
- /* Emit any buffered correction bits */
- emit_buffered_bits(entropy, entropy->bit_buffer, entropy->BE);
- entropy->BE = 0;
- }
-}
-
-
-/*
- * Emit a restart marker & resynchronize predictions.
- */
-
-LOCAL void
-emit_restart (phuff_entropy_ptr entropy, int restart_num)
-{
- int ci;
-
- emit_eobrun(entropy);
-
- if (! entropy->gather_statistics) {
- flush_bits(entropy);
- emit_byte(entropy, 0xFF);
- emit_byte(entropy, JPEG_RST0 + restart_num);
- }
-
- if (entropy->cinfo->Ss == 0) {
- /* Re-initialize DC predictions to 0 */
- for (ci = 0; ci < entropy->cinfo->comps_in_scan; ci++)
- entropy->last_dc_val[ci] = 0;
- } else {
- /* Re-initialize all AC-related fields to 0 */
- entropy->EOBRUN = 0;
- entropy->BE = 0;
- }
-}
-
-
-/*
- * MCU encoding for DC initial scan (either spectral selection,
- * or first pass of successive approximation).
- */
-
-METHODDEF boolean
-encode_mcu_DC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp, temp2;
- register int nbits;
- int blkn, ci;
- int Al = cinfo->Al;
- JBLOCKROW block;
- jpeg_component_info * compptr;
- ISHIFT_TEMPS
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval)
- if (entropy->restarts_to_go == 0)
- emit_restart(entropy, entropy->next_restart_num);
-
- /* Encode the MCU data blocks */
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- block = MCU_data[blkn];
- ci = cinfo->MCU_membership[blkn];
- compptr = cinfo->cur_comp_info[ci];
-
- /* Compute the DC value after the required point transform by Al.
- * This is simply an arithmetic right shift.
- */
- temp2 = IRIGHT_SHIFT((int) ((*block)[0]), Al);
-
- /* DC differences are figured on the point-transformed values. */
- temp = temp2 - entropy->last_dc_val[ci];
- entropy->last_dc_val[ci] = temp2;
-
- /* Encode the DC coefficient difference per section G.1.2.1 */
- temp2 = temp;
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- /* For a negative input, want temp2 = bitwise complement of abs(input) */
- /* This code assumes we are on a two's complement machine */
- temp2--;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 0;
- while (temp) {
- nbits++;
- temp >>= 1;
- }
-
- /* Count/emit the Huffman-coded symbol for the number of bits */
- emit_symbol(entropy, compptr->dc_tbl_no, nbits);
-
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- if (nbits) /* emit_bits rejects calls with size 0 */
- emit_bits(entropy, (unsigned int) temp2, nbits);
- }
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * MCU encoding for AC initial scan (either spectral selection,
- * or first pass of successive approximation).
- */
-
-METHODDEF boolean
-encode_mcu_AC_first (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp, temp2;
- register int nbits;
- register int r, k;
- int Se = cinfo->Se;
- int Al = cinfo->Al;
- JBLOCKROW block;
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval)
- if (entropy->restarts_to_go == 0)
- emit_restart(entropy, entropy->next_restart_num);
-
- /* Encode the MCU data block */
- block = MCU_data[0];
-
- /* Encode the AC coefficients per section G.1.2.2, fig. G.3 */
-
- r = 0; /* r = run length of zeros */
-
- for (k = cinfo->Ss; k <= Se; k++) {
- if ((temp = (*block)[jpeg_natural_order[k]]) == 0) {
- r++;
- continue;
- }
- /* We must apply the point transform by Al. For AC coefficients this
- * is an integer division with rounding towards 0. To do this portably
- * in C, we shift after obtaining the absolute value; so the code is
- * interwoven with finding the abs value (temp) and output bits (temp2).
- */
- if (temp < 0) {
- temp = -temp; /* temp is abs value of input */
- temp >>= Al; /* apply the point transform */
- /* For a negative coef, want temp2 = bitwise complement of abs(coef) */
- temp2 = ~temp;
- } else {
- temp >>= Al; /* apply the point transform */
- temp2 = temp;
- }
- /* Watch out for case that nonzero coef is zero after point transform */
- if (temp == 0) {
- r++;
- continue;
- }
-
- /* Emit any pending EOBRUN */
- if (entropy->EOBRUN > 0)
- emit_eobrun(entropy);
- /* if run length > 15, must emit special run-length-16 codes (0xF0) */
- while (r > 15) {
- emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
- r -= 16;
- }
-
- /* Find the number of bits needed for the magnitude of the coefficient */
- nbits = 1; /* there must be at least one 1 bit */
- while ((temp >>= 1))
- nbits++;
-
- /* Count/emit Huffman symbol for run length / number of bits */
- emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + nbits);
-
- /* Emit that number of bits of the value, if positive, */
- /* or the complement of its magnitude, if negative. */
- emit_bits(entropy, (unsigned int) temp2, nbits);
-
- r = 0; /* reset zero run length */
- }
-
- if (r > 0) { /* If there are trailing zeroes, */
- entropy->EOBRUN++; /* count an EOB */
- if (entropy->EOBRUN == 0x7FFF)
- emit_eobrun(entropy); /* force it out to avoid overflow */
- }
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * MCU encoding for DC successive approximation refinement scan.
- * Note: we assume such scans can be multi-component, although the spec
- * is not very clear on the point.
- */
-
-METHODDEF boolean
-encode_mcu_DC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp;
- int blkn;
- int Al = cinfo->Al;
- JBLOCKROW block;
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval)
- if (entropy->restarts_to_go == 0)
- emit_restart(entropy, entropy->next_restart_num);
-
- /* Encode the MCU data blocks */
- for (blkn = 0; blkn < cinfo->blocks_in_MCU; blkn++) {
- block = MCU_data[blkn];
-
- /* We simply emit the Al'th bit of the DC coefficient value. */
- temp = (*block)[0];
- emit_bits(entropy, (unsigned int) (temp >> Al), 1);
- }
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * MCU encoding for AC successive approximation refinement scan.
- */
-
-METHODDEF boolean
-encode_mcu_AC_refine (j_compress_ptr cinfo, JBLOCKROW *MCU_data)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- register int temp;
- register int r, k;
- int EOB;
- char *BR_buffer;
- unsigned int BR;
- int Se = cinfo->Se;
- int Al = cinfo->Al;
- JBLOCKROW block;
- int absvalues[DCTSIZE2];
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Emit restart marker if needed */
- if (cinfo->restart_interval)
- if (entropy->restarts_to_go == 0)
- emit_restart(entropy, entropy->next_restart_num);
-
- /* Encode the MCU data block */
- block = MCU_data[0];
-
- /* It is convenient to make a pre-pass to determine the transformed
- * coefficients' absolute values and the EOB position.
- */
- EOB = 0;
- for (k = cinfo->Ss; k <= Se; k++) {
- temp = (*block)[jpeg_natural_order[k]];
- /* We must apply the point transform by Al. For AC coefficients this
- * is an integer division with rounding towards 0. To do this portably
- * in C, we shift after obtaining the absolute value.
- */
- if (temp < 0)
- temp = -temp; /* temp is abs value of input */
- temp >>= Al; /* apply the point transform */
- absvalues[k] = temp; /* save abs value for main pass */
- if (temp == 1)
- EOB = k; /* EOB = index of last newly-nonzero coef */
- }
-
- /* Encode the AC coefficients per section G.1.2.3, fig. G.7 */
-
- r = 0; /* r = run length of zeros */
- BR = 0; /* BR = count of buffered bits added now */
- BR_buffer = entropy->bit_buffer + entropy->BE; /* Append bits to buffer */
-
- for (k = cinfo->Ss; k <= Se; k++) {
- if ((temp = absvalues[k]) == 0) {
- r++;
- continue;
- }
-
- /* Emit any required ZRLs, but not if they can be folded into EOB */
- while (r > 15 && k <= EOB) {
- /* emit any pending EOBRUN and the BE correction bits */
- emit_eobrun(entropy);
- /* Emit ZRL */
- emit_symbol(entropy, entropy->ac_tbl_no, 0xF0);
- r -= 16;
- /* Emit buffered correction bits that must be associated with ZRL */
- emit_buffered_bits(entropy, BR_buffer, BR);
- BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
- BR = 0;
- }
-
- /* If the coef was previously nonzero, it only needs a correction bit.
- * NOTE: a straight translation of the spec's figure G.7 would suggest
- * that we also need to test r > 15. But if r > 15, we can only get here
- * if k > EOB, which implies that this coefficient is not 1.
- */
- if (temp > 1) {
- /* The correction bit is the next bit of the absolute value. */
- BR_buffer[BR++] = (char) (temp & 1);
- continue;
- }
-
- /* Emit any pending EOBRUN and the BE correction bits */
- emit_eobrun(entropy);
-
- /* Count/emit Huffman symbol for run length / number of bits */
- emit_symbol(entropy, entropy->ac_tbl_no, (r << 4) + 1);
-
- /* Emit output bit for newly-nonzero coef */
- temp = ((*block)[jpeg_natural_order[k]] < 0) ? 0 : 1;
- emit_bits(entropy, (unsigned int) temp, 1);
-
- /* Emit buffered correction bits that must be associated with this code */
- emit_buffered_bits(entropy, BR_buffer, BR);
- BR_buffer = entropy->bit_buffer; /* BE bits are gone now */
- BR = 0;
- r = 0; /* reset zero run length */
- }
-
- if (r > 0 || BR > 0) { /* If there are trailing zeroes, */
- entropy->EOBRUN++; /* count an EOB */
- entropy->BE += BR; /* concat my correction bits to older ones */
- /* We force out the EOB if we risk either:
- * 1. overflow of the EOB counter;
- * 2. overflow of the correction bit buffer during the next MCU.
- */
- if (entropy->EOBRUN == 0x7FFF || entropy->BE > (MAX_CORR_BITS-DCTSIZE2+1))
- emit_eobrun(entropy);
- }
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-
- /* Update restart-interval state too */
- if (cinfo->restart_interval) {
- if (entropy->restarts_to_go == 0) {
- entropy->restarts_to_go = cinfo->restart_interval;
- entropy->next_restart_num++;
- entropy->next_restart_num &= 7;
- }
- entropy->restarts_to_go--;
- }
-
- return TRUE;
-}
-
-
-/*
- * Finish up at the end of a Huffman-compressed progressive scan.
- */
-
-METHODDEF void
-finish_pass_phuff (j_compress_ptr cinfo)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
-
- entropy->next_output_byte = cinfo->dest->next_output_byte;
- entropy->free_in_buffer = cinfo->dest->free_in_buffer;
-
- /* Flush out any buffered data */
- emit_eobrun(entropy);
- flush_bits(entropy);
-
- cinfo->dest->next_output_byte = entropy->next_output_byte;
- cinfo->dest->free_in_buffer = entropy->free_in_buffer;
-}
-
-
-/*
- * Finish up a statistics-gathering pass and create the new Huffman tables.
- */
-
-METHODDEF void
-finish_pass_gather_phuff (j_compress_ptr cinfo)
-{
- phuff_entropy_ptr entropy = (phuff_entropy_ptr) cinfo->entropy;
- boolean is_DC_band;
- int ci, tbl;
- jpeg_component_info * compptr;
- JHUFF_TBL **htblptr;
- boolean did[NUM_HUFF_TBLS];
-
- /* Flush out buffered data (all we care about is counting the EOB symbol) */
- emit_eobrun(entropy);
-
- is_DC_band = (cinfo->Ss == 0);
-
- /* It's important not to apply jpeg_gen_optimal_table more than once
- * per table, because it clobbers the input frequency counts!
- */
- MEMZERO(did, SIZEOF(did));
-
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- if (is_DC_band) {
- if (cinfo->Ah != 0) /* DC refinement needs no table */
- continue;
- tbl = compptr->dc_tbl_no;
- } else {
- tbl = compptr->ac_tbl_no;
- }
- if (! did[tbl]) {
- if (is_DC_band)
- htblptr = & cinfo->dc_huff_tbl_ptrs[tbl];
- else
- htblptr = & cinfo->ac_huff_tbl_ptrs[tbl];
- if (*htblptr == NULL)
- *htblptr = jpeg_alloc_huff_table((j_common_ptr) cinfo);
- jpeg_gen_optimal_table(cinfo, *htblptr, entropy->count_ptrs[tbl]);
- did[tbl] = TRUE;
- }
- }
-}
-
-
-/*
- * Module initialization routine for progressive Huffman entropy encoding.
- */
-
-GLOBAL void
-jinit_phuff_encoder (j_compress_ptr cinfo)
-{
- phuff_entropy_ptr entropy;
- int i;
-
- entropy = (phuff_entropy_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(phuff_entropy_encoder));
- cinfo->entropy = (struct jpeg_entropy_encoder *) entropy;
- entropy->pub.start_pass = start_pass_phuff;
-
- /* Mark tables unallocated */
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- entropy->derived_tbls[i] = NULL;
- entropy->count_ptrs[i] = NULL;
- }
- entropy->bit_buffer = NULL; /* needed only in AC refinement scan */
-}
-
-#endif /* C_PROGRESSIVE_SUPPORTED */
diff --git a/src/jpeg-6/jcprepct.c b/src/jpeg-6/jcprepct.c
deleted file mode 100644
index 7e60946..0000000
--- a/src/jpeg-6/jcprepct.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * jcprepct.c
- *
- * Copyright (C) 1994, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the compression preprocessing controller.
- * This controller manages the color conversion, downsampling,
- * and edge expansion steps.
- *
- * Most of the complexity here is associated with buffering input rows
- * as required by the downsampler. See the comments at the head of
- * jcsample.c for the downsampler's needs.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* At present, jcsample.c can request context rows only for smoothing.
- * In the future, we might also need context rows for CCIR601 sampling
- * or other more-complex downsampling procedures. The code to support
- * context rows should be compiled only if needed.
- */
-#ifdef INPUT_SMOOTHING_SUPPORTED
-#define CONTEXT_ROWS_SUPPORTED
-#endif
-
-
-/*
- * For the simple (no-context-row) case, we just need to buffer one
- * row group's worth of pixels for the downsampling step. At the bottom of
- * the image, we pad to a full row group by replicating the last pixel row.
- * The downsampler's last output row is then replicated if needed to pad
- * out to a full iMCU row.
- *
- * When providing context rows, we must buffer three row groups' worth of
- * pixels. Three row groups are physically allocated, but the row pointer
- * arrays are made five row groups high, with the extra pointers above and
- * below "wrapping around" to point to the last and first real row groups.
- * This allows the downsampler to access the proper context rows.
- * At the top and bottom of the image, we create dummy context rows by
- * copying the first or last real pixel row. This copying could be avoided
- * by pointer hacking as is done in jdmainct.c, but it doesn't seem worth the
- * trouble on the compression side.
- */
-
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_c_prep_controller pub; /* public fields */
-
- /* Downsampling input buffer. This buffer holds color-converted data
- * until we have enough to do a downsample step.
- */
- JSAMPARRAY color_buf[MAX_COMPONENTS];
-
- JDIMENSION rows_to_go; /* counts rows remaining in source image */
- int next_buf_row; /* index of next row to store in color_buf */
-
-#ifdef CONTEXT_ROWS_SUPPORTED /* only needed for context case */
- int this_row_group; /* starting row index of group to process */
- int next_buf_stop; /* downsample when we reach this index */
-#endif
-} my_prep_controller;
-
-typedef my_prep_controller * my_prep_ptr;
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF void
-start_pass_prep (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
-
- if (pass_mode != JBUF_PASS_THRU)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-
- /* Initialize total-height counter for detecting bottom of image */
- prep->rows_to_go = cinfo->image_height;
- /* Mark the conversion buffer empty */
- prep->next_buf_row = 0;
-#ifdef CONTEXT_ROWS_SUPPORTED
- /* Preset additional state variables for context mode.
- * These aren't used in non-context mode, so we needn't test which mode.
- */
- prep->this_row_group = 0;
- /* Set next_buf_stop to stop after two row groups have been read in. */
- prep->next_buf_stop = 2 * cinfo->max_v_samp_factor;
-#endif
-}
-
-
-/*
- * Expand an image vertically from height input_rows to height output_rows,
- * by duplicating the bottom row.
- */
-
-LOCAL void
-expand_bottom_edge (JSAMPARRAY image_data, JDIMENSION num_cols,
- int input_rows, int output_rows)
-{
- register int row;
-
- for (row = input_rows; row < output_rows; row++) {
- jcopy_sample_rows(image_data, input_rows-1, image_data, row,
- 1, num_cols);
- }
-}
-
-
-/*
- * Process some data in the simple no-context case.
- *
- * Preprocessor output data is counted in "row groups". A row group
- * is defined to be v_samp_factor sample rows of each component.
- * Downsampling will produce this much data from each max_v_samp_factor
- * input rows.
- */
-
-METHODDEF void
-pre_process_data (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail,
- JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
- JDIMENSION out_row_groups_avail)
-{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
- int numrows, ci;
- JDIMENSION inrows;
- jpeg_component_info * compptr;
-
- while (*in_row_ctr < in_rows_avail &&
- *out_row_group_ctr < out_row_groups_avail) {
- /* Do color conversion to fill the conversion buffer. */
- inrows = in_rows_avail - *in_row_ctr;
- numrows = cinfo->max_v_samp_factor - prep->next_buf_row;
- numrows = (int) MIN((JDIMENSION) numrows, inrows);
- (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
- prep->color_buf,
- (JDIMENSION) prep->next_buf_row,
- numrows);
- *in_row_ctr += numrows;
- prep->next_buf_row += numrows;
- prep->rows_to_go -= numrows;
- /* If at bottom of image, pad to fill the conversion buffer. */
- if (prep->rows_to_go == 0 &&
- prep->next_buf_row < cinfo->max_v_samp_factor) {
- for (ci = 0; ci < cinfo->num_components; ci++) {
- expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
- prep->next_buf_row, cinfo->max_v_samp_factor);
- }
- prep->next_buf_row = cinfo->max_v_samp_factor;
- }
- /* If we've filled the conversion buffer, empty it. */
- if (prep->next_buf_row == cinfo->max_v_samp_factor) {
- (*cinfo->downsample->downsample) (cinfo,
- prep->color_buf, (JDIMENSION) 0,
- output_buf, *out_row_group_ctr);
- prep->next_buf_row = 0;
- (*out_row_group_ctr)++;
- }
- /* If at bottom of image, pad the output to a full iMCU height.
- * Note we assume the caller is providing a one-iMCU-height output buffer!
- */
- if (prep->rows_to_go == 0 &&
- *out_row_group_ctr < out_row_groups_avail) {
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- expand_bottom_edge(output_buf[ci],
- compptr->width_in_blocks * DCTSIZE,
- (int) (*out_row_group_ctr * compptr->v_samp_factor),
- (int) (out_row_groups_avail * compptr->v_samp_factor));
- }
- *out_row_group_ctr = out_row_groups_avail;
- break; /* can exit outer loop without test */
- }
- }
-}
-
-
-#ifdef CONTEXT_ROWS_SUPPORTED
-
-/*
- * Process some data in the context case.
- */
-
-METHODDEF void
-pre_process_context (j_compress_ptr cinfo,
- JSAMPARRAY input_buf, JDIMENSION *in_row_ctr,
- JDIMENSION in_rows_avail,
- JSAMPIMAGE output_buf, JDIMENSION *out_row_group_ctr,
- JDIMENSION out_row_groups_avail)
-{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
- int numrows, ci;
- int buf_height = cinfo->max_v_samp_factor * 3;
- JDIMENSION inrows;
- jpeg_component_info * compptr;
-
- while (*out_row_group_ctr < out_row_groups_avail) {
- if (*in_row_ctr < in_rows_avail) {
- /* Do color conversion to fill the conversion buffer. */
- inrows = in_rows_avail - *in_row_ctr;
- numrows = prep->next_buf_stop - prep->next_buf_row;
- numrows = (int) MIN((JDIMENSION) numrows, inrows);
- (*cinfo->cconvert->color_convert) (cinfo, input_buf + *in_row_ctr,
- prep->color_buf,
- (JDIMENSION) prep->next_buf_row,
- numrows);
- /* Pad at top of image, if first time through */
- if (prep->rows_to_go == cinfo->image_height) {
- for (ci = 0; ci < cinfo->num_components; ci++) {
- int row;
- for (row = 1; row <= cinfo->max_v_samp_factor; row++) {
- jcopy_sample_rows(prep->color_buf[ci], 0,
- prep->color_buf[ci], -row,
- 1, cinfo->image_width);
- }
- }
- }
- *in_row_ctr += numrows;
- prep->next_buf_row += numrows;
- prep->rows_to_go -= numrows;
- } else {
- /* Return for more data, unless we are at the bottom of the image. */
- if (prep->rows_to_go != 0)
- break;
- }
- /* If at bottom of image, pad to fill the conversion buffer. */
- if (prep->rows_to_go == 0 &&
- prep->next_buf_row < prep->next_buf_stop) {
- for (ci = 0; ci < cinfo->num_components; ci++) {
- expand_bottom_edge(prep->color_buf[ci], cinfo->image_width,
- prep->next_buf_row, prep->next_buf_stop);
- }
- prep->next_buf_row = prep->next_buf_stop;
- }
- /* If we've gotten enough data, downsample a row group. */
- if (prep->next_buf_row == prep->next_buf_stop) {
- (*cinfo->downsample->downsample) (cinfo,
- prep->color_buf,
- (JDIMENSION) prep->this_row_group,
- output_buf, *out_row_group_ctr);
- (*out_row_group_ctr)++;
- /* Advance pointers with wraparound as necessary. */
- prep->this_row_group += cinfo->max_v_samp_factor;
- if (prep->this_row_group >= buf_height)
- prep->this_row_group = 0;
- if (prep->next_buf_row >= buf_height)
- prep->next_buf_row = 0;
- prep->next_buf_stop = prep->next_buf_row + cinfo->max_v_samp_factor;
- }
- /* If at bottom of image, pad the output to a full iMCU height.
- * Note we assume the caller is providing a one-iMCU-height output buffer!
- */
- if (prep->rows_to_go == 0 &&
- *out_row_group_ctr < out_row_groups_avail) {
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- expand_bottom_edge(output_buf[ci],
- compptr->width_in_blocks * DCTSIZE,
- (int) (*out_row_group_ctr * compptr->v_samp_factor),
- (int) (out_row_groups_avail * compptr->v_samp_factor));
- }
- *out_row_group_ctr = out_row_groups_avail;
- break; /* can exit outer loop without test */
- }
- }
-}
-
-
-/*
- * Create the wrapped-around downsampling input buffer needed for context mode.
- */
-
-LOCAL void
-create_context_buffer (j_compress_ptr cinfo)
-{
- my_prep_ptr prep = (my_prep_ptr) cinfo->prep;
- int rgroup_height = cinfo->max_v_samp_factor;
- int ci, i;
- jpeg_component_info * compptr;
- JSAMPARRAY true_buffer, fake_buffer;
-
- /* Grab enough space for fake row pointers for all the components;
- * we need five row groups' worth of pointers for each component.
- */
- fake_buffer = (JSAMPARRAY)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (cinfo->num_components * 5 * rgroup_height) *
- SIZEOF(JSAMPROW));
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Allocate the actual buffer space (3 row groups) for this component.
- * We make the buffer wide enough to allow the downsampler to edge-expand
- * horizontally within the buffer, if it so chooses.
- */
- true_buffer = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
- cinfo->max_h_samp_factor) / compptr->h_samp_factor),
- (JDIMENSION) (3 * rgroup_height));
- /* Copy true buffer row pointers into the middle of the fake row array */
- MEMCOPY(fake_buffer + rgroup_height, true_buffer,
- 3 * rgroup_height * SIZEOF(JSAMPROW));
- /* Fill in the above and below wraparound pointers */
- for (i = 0; i < rgroup_height; i++) {
- fake_buffer[i] = true_buffer[2 * rgroup_height + i];
- fake_buffer[4 * rgroup_height + i] = true_buffer[i];
- }
- prep->color_buf[ci] = fake_buffer + rgroup_height;
- fake_buffer += 5 * rgroup_height; /* point to space for next component */
- }
-}
-
-#endif /* CONTEXT_ROWS_SUPPORTED */
-
-
-/*
- * Initialize preprocessing controller.
- */
-
-GLOBAL void
-jinit_c_prep_controller (j_compress_ptr cinfo, boolean need_full_buffer)
-{
- my_prep_ptr prep;
- int ci;
- jpeg_component_info * compptr;
-
- if (need_full_buffer) /* safety check */
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-
- prep = (my_prep_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_prep_controller));
- cinfo->prep = (struct jpeg_c_prep_controller *) prep;
- prep->pub.start_pass = start_pass_prep;
-
- /* Allocate the color conversion buffer.
- * We make the buffer wide enough to allow the downsampler to edge-expand
- * horizontally within the buffer, if it so chooses.
- */
- if (cinfo->downsample->need_context_rows) {
- /* Set up to provide context rows */
-#ifdef CONTEXT_ROWS_SUPPORTED
- prep->pub.pre_process_data = pre_process_context;
- create_context_buffer(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else {
- /* No context, just make it tall enough for one row group */
- prep->pub.pre_process_data = pre_process_data;
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- prep->color_buf[ci] = (*cinfo->mem->alloc_sarray)
- ((j_common_ptr) cinfo, JPOOL_IMAGE,
- (JDIMENSION) (((long) compptr->width_in_blocks * DCTSIZE *
- cinfo->max_h_samp_factor) / compptr->h_samp_factor),
- (JDIMENSION) cinfo->max_v_samp_factor);
- }
- }
-}
diff --git a/src/jpeg-6/jcsample.c b/src/jpeg-6/jcsample.c
deleted file mode 100644
index bf0fb46..0000000
--- a/src/jpeg-6/jcsample.c
+++ /dev/null
@@ -1,519 +0,0 @@
-/*
- * jcsample.c
- *
- * Copyright (C) 1991-1994, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains downsampling routines.
- *
- * Downsampling input data is counted in "row groups". A row group
- * is defined to be max_v_samp_factor pixel rows of each component,
- * from which the downsampler produces v_samp_factor sample rows.
- * A single row group is processed in each call to the downsampler module.
- *
- * The downsampler is responsible for edge-expansion of its output data
- * to fill an integral number of DCT blocks horizontally. The source buffer
- * may be modified if it is helpful for this purpose (the source buffer is
- * allocated wide enough to correspond to the desired output width).
- * The caller (the prep controller) is responsible for vertical padding.
- *
- * The downsampler may request "context rows" by setting need_context_rows
- * during startup. In this case, the input arrays will contain at least
- * one row group's worth of pixels above and below the passed-in data;
- * the caller will create dummy rows at image top and bottom by replicating
- * the first or last real pixel row.
- *
- * An excellent reference for image resampling is
- * Digital Image Warping, George Wolberg, 1990.
- * Pub. by IEEE Computer Society Press, Los Alamitos, CA. ISBN 0-8186-8944-7.
- *
- * The downsampling algorithm used here is a simple average of the source
- * pixels covered by the output pixel. The hi-falutin sampling literature
- * refers to this as a "box filter". In general the characteristics of a box
- * filter are not very good, but for the specific cases we normally use (1:1
- * and 2:1 ratios) the box is equivalent to a "triangle filter" which is not
- * nearly so bad. If you intend to use other sampling ratios, you'd be well
- * advised to improve this code.
- *
- * A simple input-smoothing capability is provided. This is mainly intended
- * for cleaning up color-dithered GIF input files (if you find it inadequate,
- * we suggest using an external filtering program such as pnmconvol). When
- * enabled, each input pixel P is replaced by a weighted sum of itself and its
- * eight neighbors. P's weight is 1-8*SF and each neighbor's weight is SF,
- * where SF = (smoothing_factor / 1024).
- * Currently, smoothing is only supported for 2h2v sampling factors.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Pointer to routine to downsample a single component */
-typedef JMETHOD(void, downsample1_ptr,
- (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data));
-
-/* Private subobject */
-
-typedef struct {
- struct jpeg_downsampler pub; /* public fields */
-
- /* Downsampling method pointers, one per component */
- downsample1_ptr methods[MAX_COMPONENTS];
-} my_downsampler;
-
-typedef my_downsampler * my_downsample_ptr;
-
-
-/*
- * Initialize for a downsampling pass.
- */
-
-METHODDEF void
-start_pass_downsample (j_compress_ptr cinfo)
-{
- /* no work for now */
-}
-
-
-/*
- * Expand a component horizontally from width input_cols to width output_cols,
- * by duplicating the rightmost samples.
- */
-
-LOCAL void
-expand_right_edge (JSAMPARRAY image_data, int num_rows,
- JDIMENSION input_cols, JDIMENSION output_cols)
-{
- register JSAMPROW ptr;
- register JSAMPLE pixval;
- register int count;
- int row;
- int numcols = (int) (output_cols - input_cols);
-
- if (numcols > 0) {
- for (row = 0; row < num_rows; row++) {
- ptr = image_data[row] + input_cols;
- pixval = ptr[-1]; /* don't need GETJSAMPLE() here */
- for (count = numcols; count > 0; count--)
- *ptr++ = pixval;
- }
- }
-}
-
-
-/*
- * Do downsampling for a whole row group (all components).
- *
- * In this version we simply downsample each component independently.
- */
-
-METHODDEF void
-sep_downsample (j_compress_ptr cinfo,
- JSAMPIMAGE input_buf, JDIMENSION in_row_index,
- JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
-{
- my_downsample_ptr downsample = (my_downsample_ptr) cinfo->downsample;
- int ci;
- jpeg_component_info * compptr;
- JSAMPARRAY in_ptr, out_ptr;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- in_ptr = input_buf[ci] + in_row_index;
- out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor);
- (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr);
- }
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * One row group is processed per call.
- * This version handles arbitrary integral sampling ratios, without smoothing.
- * Note that this version is not actually used for customary sampling ratios.
- */
-
-METHODDEF void
-int_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int inrow, outrow, h_expand, v_expand, numpix, numpix2, h, v;
- JDIMENSION outcol, outcol_h; /* outcol_h == outcol*h_expand */
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- JSAMPROW inptr, outptr;
- INT32 outvalue;
-
- h_expand = cinfo->max_h_samp_factor / compptr->h_samp_factor;
- v_expand = cinfo->max_v_samp_factor / compptr->v_samp_factor;
- numpix = h_expand * v_expand;
- numpix2 = numpix/2;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * h_expand);
-
- inrow = 0;
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- for (outcol = 0, outcol_h = 0; outcol < output_cols;
- outcol++, outcol_h += h_expand) {
- outvalue = 0;
- for (v = 0; v < v_expand; v++) {
- inptr = input_data[inrow+v] + outcol_h;
- for (h = 0; h < h_expand; h++) {
- outvalue += (INT32) GETJSAMPLE(*inptr++);
- }
- }
- *outptr++ = (JSAMPLE) ((outvalue + numpix2) / numpix);
- }
- inrow += v_expand;
- }
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the special case of a full-size component,
- * without smoothing.
- */
-
-METHODDEF void
-fullsize_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- /* Copy the data */
- jcopy_sample_rows(input_data, 0, output_data, 0,
- cinfo->max_v_samp_factor, cinfo->image_width);
- /* Edge-expand */
- expand_right_edge(output_data, cinfo->max_v_samp_factor,
- cinfo->image_width, compptr->width_in_blocks * DCTSIZE);
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the common case of 2:1 horizontal and 1:1 vertical,
- * without smoothing.
- *
- * A note about the "bias" calculations: when rounding fractional values to
- * integer, we do not want to always round 0.5 up to the next integer.
- * If we did that, we'd introduce a noticeable bias towards larger values.
- * Instead, this code is arranged so that 0.5 will be rounded up or down at
- * alternate pixel locations (a simple ordered dither pattern).
- */
-
-METHODDEF void
-h2v1_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int outrow;
- JDIMENSION outcol;
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- register JSAMPROW inptr, outptr;
- register int bias;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * 2);
-
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- inptr = input_data[outrow];
- bias = 0; /* bias = 0,1,0,1,... for successive samples */
- for (outcol = 0; outcol < output_cols; outcol++) {
- *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr) + GETJSAMPLE(inptr[1])
- + bias) >> 1);
- bias ^= 1; /* 0=>1, 1=>0 */
- inptr += 2;
- }
- }
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
- * without smoothing.
- */
-
-METHODDEF void
-h2v2_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int inrow, outrow;
- JDIMENSION outcol;
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- register JSAMPROW inptr0, inptr1, outptr;
- register int bias;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data, cinfo->max_v_samp_factor,
- cinfo->image_width, output_cols * 2);
-
- inrow = 0;
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- inptr0 = input_data[inrow];
- inptr1 = input_data[inrow+1];
- bias = 1; /* bias = 1,2,1,2,... for successive samples */
- for (outcol = 0; outcol < output_cols; outcol++) {
- *outptr++ = (JSAMPLE) ((GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1])
- + bias) >> 2);
- bias ^= 3; /* 1=>2, 2=>1 */
- inptr0 += 2; inptr1 += 2;
- }
- inrow += 2;
- }
-}
-
-
-#ifdef INPUT_SMOOTHING_SUPPORTED
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the standard case of 2:1 horizontal and 2:1 vertical,
- * with smoothing. One row of context is required.
- */
-
-METHODDEF void
-h2v2_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info * compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int inrow, outrow;
- JDIMENSION colctr;
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- register JSAMPROW inptr0, inptr1, above_ptr, below_ptr, outptr;
- INT32 membersum, neighsum, memberscale, neighscale;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
- cinfo->image_width, output_cols * 2);
-
- /* We don't bother to form the individual "smoothed" input pixel values;
- * we can directly compute the output which is the average of the four
- * smoothed values. Each of the four member pixels contributes a fraction
- * (1-8*SF) to its own smoothed image and a fraction SF to each of the three
- * other smoothed pixels, therefore a total fraction (1-5*SF)/4 to the final
- * output. The four corner-adjacent neighbor pixels contribute a fraction
- * SF to just one smoothed pixel, or SF/4 to the final output; while the
- * eight edge-adjacent neighbors contribute SF to each of two smoothed
- * pixels, or SF/2 overall. In order to use integer arithmetic, these
- * factors are scaled by 2^16 = 65536.
- * Also recall that SF = smoothing_factor / 1024.
- */
-
- memberscale = 16384 - cinfo->smoothing_factor * 80; /* scaled (1-5*SF)/4 */
- neighscale = cinfo->smoothing_factor * 16; /* scaled SF/4 */
-
- inrow = 0;
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- inptr0 = input_data[inrow];
- inptr1 = input_data[inrow+1];
- above_ptr = input_data[inrow-1];
- below_ptr = input_data[inrow+2];
-
- /* Special case for first column: pretend column -1 is same as column 0 */
- membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
- neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
- GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
- GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[2]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[2]);
- neighsum += neighsum;
- neighsum += GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[2]) +
- GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[2]);
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
-
- for (colctr = output_cols - 2; colctr > 0; colctr--) {
- /* sum of pixels directly mapped to this output element */
- membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
- /* sum of edge-neighbor pixels */
- neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
- GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
- GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[2]) +
- GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[2]);
- /* The edge-neighbors count twice as much as corner-neighbors */
- neighsum += neighsum;
- /* Add in the corner-neighbors */
- neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[2]) +
- GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[2]);
- /* form final output scaled up by 2^16 */
- membersum = membersum * memberscale + neighsum * neighscale;
- /* round, descale and output it */
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- inptr0 += 2; inptr1 += 2; above_ptr += 2; below_ptr += 2;
- }
-
- /* Special case for last column */
- membersum = GETJSAMPLE(*inptr0) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(*inptr1) + GETJSAMPLE(inptr1[1]);
- neighsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(above_ptr[1]) +
- GETJSAMPLE(*below_ptr) + GETJSAMPLE(below_ptr[1]) +
- GETJSAMPLE(inptr0[-1]) + GETJSAMPLE(inptr0[1]) +
- GETJSAMPLE(inptr1[-1]) + GETJSAMPLE(inptr1[1]);
- neighsum += neighsum;
- neighsum += GETJSAMPLE(above_ptr[-1]) + GETJSAMPLE(above_ptr[1]) +
- GETJSAMPLE(below_ptr[-1]) + GETJSAMPLE(below_ptr[1]);
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
-
- inrow += 2;
- }
-}
-
-
-/*
- * Downsample pixel values of a single component.
- * This version handles the special case of a full-size component,
- * with smoothing. One row of context is required.
- */
-
-METHODDEF void
-fullsize_smooth_downsample (j_compress_ptr cinfo, jpeg_component_info *compptr,
- JSAMPARRAY input_data, JSAMPARRAY output_data)
-{
- int outrow;
- JDIMENSION colctr;
- JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
- register JSAMPROW inptr, above_ptr, below_ptr, outptr;
- INT32 membersum, neighsum, memberscale, neighscale;
- int colsum, lastcolsum, nextcolsum;
-
- /* Expand input data enough to let all the output samples be generated
- * by the standard loop. Special-casing padded output would be more
- * efficient.
- */
- expand_right_edge(input_data - 1, cinfo->max_v_samp_factor + 2,
- cinfo->image_width, output_cols);
-
- /* Each of the eight neighbor pixels contributes a fraction SF to the
- * smoothed pixel, while the main pixel contributes (1-8*SF). In order
- * to use integer arithmetic, these factors are multiplied by 2^16 = 65536.
- * Also recall that SF = smoothing_factor / 1024.
- */
-
- memberscale = 65536L - cinfo->smoothing_factor * 512L; /* scaled 1-8*SF */
- neighscale = cinfo->smoothing_factor * 64; /* scaled SF */
-
- for (outrow = 0; outrow < compptr->v_samp_factor; outrow++) {
- outptr = output_data[outrow];
- inptr = input_data[outrow];
- above_ptr = input_data[outrow-1];
- below_ptr = input_data[outrow+1];
-
- /* Special case for first column */
- colsum = GETJSAMPLE(*above_ptr++) + GETJSAMPLE(*below_ptr++) +
- GETJSAMPLE(*inptr);
- membersum = GETJSAMPLE(*inptr++);
- nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
- GETJSAMPLE(*inptr);
- neighsum = colsum + (colsum - membersum) + nextcolsum;
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- lastcolsum = colsum; colsum = nextcolsum;
-
- for (colctr = output_cols - 2; colctr > 0; colctr--) {
- membersum = GETJSAMPLE(*inptr++);
- above_ptr++; below_ptr++;
- nextcolsum = GETJSAMPLE(*above_ptr) + GETJSAMPLE(*below_ptr) +
- GETJSAMPLE(*inptr);
- neighsum = lastcolsum + (colsum - membersum) + nextcolsum;
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr++ = (JSAMPLE) ((membersum + 32768) >> 16);
- lastcolsum = colsum; colsum = nextcolsum;
- }
-
- /* Special case for last column */
- membersum = GETJSAMPLE(*inptr);
- neighsum = lastcolsum + (colsum - membersum) + colsum;
- membersum = membersum * memberscale + neighsum * neighscale;
- *outptr = (JSAMPLE) ((membersum + 32768) >> 16);
-
- }
-}
-
-#endif /* INPUT_SMOOTHING_SUPPORTED */
-
-
-/*
- * Module initialization routine for downsampling.
- * Note that we must select a routine for each component.
- */
-
-GLOBAL void
-jinit_downsampler (j_compress_ptr cinfo)
-{
- my_downsample_ptr downsample;
- int ci;
- jpeg_component_info * compptr;
- boolean smoothok = TRUE;
-
- downsample = (my_downsample_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_downsampler));
- cinfo->downsample = (struct jpeg_downsampler *) downsample;
- downsample->pub.start_pass = start_pass_downsample;
- downsample->pub.downsample = sep_downsample;
- downsample->pub.need_context_rows = FALSE;
-
- if (cinfo->CCIR601_sampling)
- ERREXIT(cinfo, JERR_CCIR601_NOTIMPL);
-
- /* Verify we can handle the sampling factors, and set up method pointers */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- if (compptr->h_samp_factor == cinfo->max_h_samp_factor &&
- compptr->v_samp_factor == cinfo->max_v_samp_factor) {
-#ifdef INPUT_SMOOTHING_SUPPORTED
- if (cinfo->smoothing_factor) {
- downsample->methods[ci] = fullsize_smooth_downsample;
- downsample->pub.need_context_rows = TRUE;
- } else
-#endif
- downsample->methods[ci] = fullsize_downsample;
- } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
- compptr->v_samp_factor == cinfo->max_v_samp_factor) {
- smoothok = FALSE;
- downsample->methods[ci] = h2v1_downsample;
- } else if (compptr->h_samp_factor * 2 == cinfo->max_h_samp_factor &&
- compptr->v_samp_factor * 2 == cinfo->max_v_samp_factor) {
-#ifdef INPUT_SMOOTHING_SUPPORTED
- if (cinfo->smoothing_factor) {
- downsample->methods[ci] = h2v2_smooth_downsample;
- downsample->pub.need_context_rows = TRUE;
- } else
-#endif
- downsample->methods[ci] = h2v2_downsample;
- } else if ((cinfo->max_h_samp_factor % compptr->h_samp_factor) == 0 &&
- (cinfo->max_v_samp_factor % compptr->v_samp_factor) == 0) {
- smoothok = FALSE;
- downsample->methods[ci] = int_downsample;
- } else
- ERREXIT(cinfo, JERR_FRACT_SAMPLE_NOTIMPL);
- }
-
-#ifdef INPUT_SMOOTHING_SUPPORTED
- if (cinfo->smoothing_factor && !smoothok)
- TRACEMS(cinfo, 0, JTRC_SMOOTH_NOTIMPL);
-#endif
-}
diff --git a/src/jpeg-6/jctrans.c b/src/jpeg-6/jctrans.c
deleted file mode 100644
index 8fc53b1..0000000
--- a/src/jpeg-6/jctrans.c
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * jctrans.c
- *
- * Copyright (C) 1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains library routines for transcoding compression,
- * that is, writing raw DCT coefficient arrays to an output JPEG file.
- * The routines in jcapimin.c will also be needed by a transcoder.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Forward declarations */
-LOCAL void transencode_master_selection
- JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
-LOCAL void transencode_coef_controller
- JPP((j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays));
-
-
-/*
- * Compression initialization for writing raw-coefficient data.
- * Before calling this, all parameters and a data destination must be set up.
- * Call jpeg_finish_compress() to actually write the data.
- *
- * The number of passed virtual arrays must match cinfo->num_components.
- * Note that the virtual arrays need not be filled or even realized at
- * the time write_coefficients is called; indeed, if the virtual arrays
- * were requested from this compression object's memory manager, they
- * typically will be realized during this routine and filled afterwards.
- */
-
-GLOBAL void
-jpeg_write_coefficients (j_compress_ptr cinfo, jvirt_barray_ptr * coef_arrays)
-{
- if (cinfo->global_state != CSTATE_START)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- /* Mark all tables to be written */
- jpeg_suppress_tables(cinfo, FALSE);
- /* (Re)initialize error mgr and destination modules */
- (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
- (*cinfo->dest->init_destination) (cinfo);
- /* Perform master selection of active modules */
- transencode_master_selection(cinfo, coef_arrays);
- /* Wait for jpeg_finish_compress() call */
- cinfo->next_scanline = 0; /* so jpeg_write_marker works */
- cinfo->global_state = CSTATE_WRCOEFS;
-}
-
-
-/*
- * Initialize the compression object with default parameters,
- * then copy from the source object all parameters needed for lossless
- * transcoding. Parameters that can be varied without loss (such as
- * scan script and Huffman optimization) are left in their default states.
- */
-
-GLOBAL void
-jpeg_copy_critical_parameters (j_decompress_ptr srcinfo,
- j_compress_ptr dstinfo)
-{
- JQUANT_TBL ** qtblptr;
- jpeg_component_info *incomp, *outcomp;
- JQUANT_TBL *c_quant, *slot_quant;
- int tblno, ci, coefi;
-
- /* Safety check to ensure start_compress not called yet. */
- if (dstinfo->global_state != CSTATE_START)
- ERREXIT1(dstinfo, JERR_BAD_STATE, dstinfo->global_state);
- /* Copy fundamental image dimensions */
- dstinfo->image_width = srcinfo->image_width;
- dstinfo->image_height = srcinfo->image_height;
- dstinfo->input_components = srcinfo->num_components;
- dstinfo->in_color_space = srcinfo->jpeg_color_space;
- /* Initialize all parameters to default values */
- jpeg_set_defaults(dstinfo);
- /* jpeg_set_defaults may choose wrong colorspace, eg YCbCr if input is RGB.
- * Fix it to get the right header markers for the image colorspace.
- */
- jpeg_set_colorspace(dstinfo, srcinfo->jpeg_color_space);
- dstinfo->data_precision = srcinfo->data_precision;
- dstinfo->CCIR601_sampling = srcinfo->CCIR601_sampling;
- /* Copy the source's quantization tables. */
- for (tblno = 0; tblno < NUM_QUANT_TBLS; tblno++) {
- if (srcinfo->quant_tbl_ptrs[tblno] != NULL) {
- qtblptr = & dstinfo->quant_tbl_ptrs[tblno];
- if (*qtblptr == NULL)
- *qtblptr = jpeg_alloc_quant_table((j_common_ptr) dstinfo);
- MEMCOPY((*qtblptr)->quantval,
- srcinfo->quant_tbl_ptrs[tblno]->quantval,
- SIZEOF((*qtblptr)->quantval));
- (*qtblptr)->sent_table = FALSE;
- }
- }
- /* Copy the source's per-component info.
- * Note we assume jpeg_set_defaults has allocated the dest comp_info array.
- */
- dstinfo->num_components = srcinfo->num_components;
- if (dstinfo->num_components < 1 || dstinfo->num_components > MAX_COMPONENTS)
- ERREXIT2(dstinfo, JERR_COMPONENT_COUNT, dstinfo->num_components,
- MAX_COMPONENTS);
- for (ci = 0, incomp = srcinfo->comp_info, outcomp = dstinfo->comp_info;
- ci < dstinfo->num_components; ci++, incomp++, outcomp++) {
- outcomp->component_id = incomp->component_id;
- outcomp->h_samp_factor = incomp->h_samp_factor;
- outcomp->v_samp_factor = incomp->v_samp_factor;
- outcomp->quant_tbl_no = incomp->quant_tbl_no;
- /* Make sure saved quantization table for component matches the qtable
- * slot. If not, the input file re-used this qtable slot.
- * IJG encoder currently cannot duplicate this.
- */
- tblno = outcomp->quant_tbl_no;
- if (tblno < 0 || tblno >= NUM_QUANT_TBLS ||
- srcinfo->quant_tbl_ptrs[tblno] == NULL)
- ERREXIT1(dstinfo, JERR_NO_QUANT_TABLE, tblno);
- slot_quant = srcinfo->quant_tbl_ptrs[tblno];
- c_quant = incomp->quant_table;
- if (c_quant != NULL) {
- for (coefi = 0; coefi < DCTSIZE2; coefi++) {
- if (c_quant->quantval[coefi] != slot_quant->quantval[coefi])
- ERREXIT1(dstinfo, JERR_MISMATCHED_QUANT_TABLE, tblno);
- }
- }
- /* Note: we do not copy the source's Huffman table assignments;
- * instead we rely on jpeg_set_colorspace to have made a suitable choice.
- */
- }
-}
-
-
-/*
- * Master selection of compression modules for transcoding.
- * This substitutes for jcinit.c's initialization of the full compressor.
- */
-
-LOCAL void
-transencode_master_selection (j_compress_ptr cinfo,
- jvirt_barray_ptr * coef_arrays)
-{
- /* Although we don't actually use input_components for transcoding,
- * jcmaster.c's initial_setup will complain if input_components is 0.
- */
- cinfo->input_components = 1;
- /* Initialize master control (includes parameter checking/processing) */
- jinit_c_master_control(cinfo, TRUE /* transcode only */);
-
- /* Entropy encoding: either Huffman or arithmetic coding. */
- if (cinfo->arith_code) {
- ERREXIT(cinfo, JERR_ARITH_NOTIMPL);
- } else {
- if (cinfo->progressive_mode) {
-#ifdef C_PROGRESSIVE_SUPPORTED
- jinit_phuff_encoder(cinfo);
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif
- } else
- jinit_huff_encoder(cinfo);
- }
-
- /* We need a special coefficient buffer controller. */
- transencode_coef_controller(cinfo, coef_arrays);
-
- jinit_marker_writer(cinfo);
-
- /* We can now tell the memory manager to allocate virtual arrays. */
- (*cinfo->mem->realize_virt_arrays) ((j_common_ptr) cinfo);
-
- /* Write the datastream header (SOI) immediately.
- * Frame and scan headers are postponed till later.
- * This lets application insert special markers after the SOI.
- */
- (*cinfo->marker->write_file_header) (cinfo);
-}
-
-
-/*
- * The rest of this file is a special implementation of the coefficient
- * buffer controller. This is similar to jccoefct.c, but it handles only
- * output from presupplied virtual arrays. Furthermore, we generate any
- * dummy padding blocks on-the-fly rather than expecting them to be present
- * in the arrays.
- */
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_c_coef_controller pub; /* public fields */
-
- JDIMENSION iMCU_row_num; /* iMCU row # within image */
- JDIMENSION mcu_ctr; /* counts MCUs processed in current row */
- int MCU_vert_offset; /* counts MCU rows within iMCU row */
- int MCU_rows_per_iMCU_row; /* number of such rows needed */
-
- /* Virtual block array for each component. */
- jvirt_barray_ptr * whole_image;
-
- /* Workspace for constructing dummy blocks at right/bottom edges. */
- JBLOCKROW dummy_buffer[C_MAX_BLOCKS_IN_MCU];
-} my_coef_controller;
-
-typedef my_coef_controller * my_coef_ptr;
-
-
-LOCAL void
-start_iMCU_row (j_compress_ptr cinfo)
-/* Reset within-iMCU-row counters for a new row */
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- /* In an interleaved scan, an MCU row is the same as an iMCU row.
- * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
- * But at the bottom of the image, process only what's left.
- */
- if (cinfo->comps_in_scan > 1) {
- coef->MCU_rows_per_iMCU_row = 1;
- } else {
- if (coef->iMCU_row_num < (cinfo->total_iMCU_rows-1))
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
- else
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
- }
-
- coef->mcu_ctr = 0;
- coef->MCU_vert_offset = 0;
-}
-
-
-/*
- * Initialize for a processing pass.
- */
-
-METHODDEF void
-start_pass_coef (j_compress_ptr cinfo, J_BUF_MODE pass_mode)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- if (pass_mode != JBUF_CRANK_DEST)
- ERREXIT(cinfo, JERR_BAD_BUFFER_MODE);
-
- coef->iMCU_row_num = 0;
- start_iMCU_row(cinfo);
-}
-
-
-/*
- * Process some data.
- * We process the equivalent of one fully interleaved MCU row ("iMCU" row)
- * per call, ie, v_samp_factor block rows for each component in the scan.
- * The data is obtained from the virtual arrays and fed to the entropy coder.
- * Returns TRUE if the iMCU row is completed, FALSE if suspended.
- *
- * NB: input_buf is ignored; it is likely to be a NULL pointer.
- */
-
-METHODDEF boolean
-compress_output (j_compress_ptr cinfo, JSAMPIMAGE input_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- int blkn, ci, xindex, yindex, yoffset, blockcnt;
- JDIMENSION start_col;
- JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
- JBLOCKROW MCU_buffer[C_MAX_BLOCKS_IN_MCU];
- JBLOCKROW buffer_ptr;
- jpeg_component_info *compptr;
-
- /* Align the virtual buffers for the components used in this scan. */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
- coef->iMCU_row_num * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
- }
-
- /* Loop to process one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->mcu_ctr; MCU_col_num < cinfo->MCUs_per_row;
- MCU_col_num++) {
- /* Construct list of pointers to DCT blocks belonging to this MCU */
- blkn = 0; /* index of current DCT block within MCU */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- start_col = MCU_col_num * compptr->MCU_width;
- blockcnt = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- if (coef->iMCU_row_num < last_iMCU_row ||
- yindex+yoffset < compptr->last_row_height) {
- /* Fill in pointers to real blocks in this row */
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
- for (xindex = 0; xindex < blockcnt; xindex++)
- MCU_buffer[blkn++] = buffer_ptr++;
- } else {
- /* At bottom of image, need a whole row of dummy blocks */
- xindex = 0;
- }
- /* Fill in any dummy blocks needed in this row.
- * Dummy blocks are filled in the same way as in jccoefct.c:
- * all zeroes in the AC entries, DC entries equal to previous
- * block's DC value. The init routine has already zeroed the
- * AC entries, so we need only set the DC entries correctly.
- */
- for (; xindex < compptr->MCU_width; xindex++) {
- MCU_buffer[blkn] = coef->dummy_buffer[blkn];
- MCU_buffer[blkn][0][0] = MCU_buffer[blkn-1][0][0];
- blkn++;
- }
- }
- }
- /* Try to write the MCU. */
- if (! (*cinfo->entropy->encode_mcu) (cinfo, MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->mcu_ctr = MCU_col_num;
- return FALSE;
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->mcu_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- coef->iMCU_row_num++;
- start_iMCU_row(cinfo);
- return TRUE;
-}
-
-
-/*
- * Initialize coefficient buffer controller.
- *
- * Each passed coefficient array must be the right size for that
- * coefficient: width_in_blocks wide and height_in_blocks high,
- * with unitheight at least v_samp_factor.
- */
-
-LOCAL void
-transencode_coef_controller (j_compress_ptr cinfo,
- jvirt_barray_ptr * coef_arrays)
-{
- my_coef_ptr coef;
- JBLOCKROW buffer;
- int i;
-
- coef = (my_coef_ptr)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- SIZEOF(my_coef_controller));
- cinfo->coef = (struct jpeg_c_coef_controller *) coef;
- coef->pub.start_pass = start_pass_coef;
- coef->pub.compress_data = compress_output;
-
- /* Save pointer to virtual arrays */
- coef->whole_image = coef_arrays;
-
- /* Allocate and pre-zero space for dummy DCT blocks. */
- buffer = (JBLOCKROW)
- (*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
- jzero_far((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
- for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
- coef->dummy_buffer[i] = buffer + i;
- }
-}
diff --git a/src/jpeg-6/jdapimin.c b/src/jpeg-6/jdapimin.c
deleted file mode 100644
index d568187..0000000
--- a/src/jpeg-6/jdapimin.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/*
- * jdapimin.c
- *
- * Copyright (C) 1994-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface code for the decompression half
- * of the JPEG library. These are the "minimum" API routines that may be
- * needed in either the normal full-decompression case or the
- * transcoding-only case.
- *
- * Most of the routines intended to be called directly by an application
- * are in this file or in jdapistd.c. But also see jcomapi.c for routines
- * shared by compression and decompression, and jdtrans.c for the transcoding
- * case.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/*
- * Initialization of a JPEG decompression object.
- * The error manager must already be set up (in case memory manager fails).
- */
-
-GLOBAL void
-jpeg_create_decompress (j_decompress_ptr cinfo)
-{
- int i;
-
- /* For debugging purposes, zero the whole master structure.
- * But error manager pointer is already there, so save and restore it.
- */
- {
- struct jpeg_error_mgr * err = cinfo->err;
- MEMZERO(cinfo, SIZEOF(struct jpeg_decompress_struct));
- cinfo->err = err;
- }
- cinfo->is_decompressor = TRUE;
-
- /* Initialize a memory manager instance for this object */
- jinit_memory_mgr((j_common_ptr) cinfo);
-
- /* Zero out pointers to permanent structures. */
- cinfo->progress = NULL;
- cinfo->src = NULL;
-
- for (i = 0; i < NUM_QUANT_TBLS; i++)
- cinfo->quant_tbl_ptrs[i] = NULL;
-
- for (i = 0; i < NUM_HUFF_TBLS; i++) {
- cinfo->dc_huff_tbl_ptrs[i] = NULL;
- cinfo->ac_huff_tbl_ptrs[i] = NULL;
- }
-
- /* Initialize marker processor so application can override methods
- * for COM, APPn markers before calling jpeg_read_header.
- */
- jinit_marker_reader(cinfo);
-
- /* And initialize the overall input controller. */
- jinit_input_controller(cinfo);
-
- /* OK, I'm ready */
- cinfo->global_state = DSTATE_START;
-}
-
-
-/*
- * Destruction of a JPEG decompression object
- */
-
-GLOBAL void
-jpeg_destroy_decompress (j_decompress_ptr cinfo)
-{
- jpeg_destroy((j_common_ptr) cinfo); /* use common routine */
-}
-
-
-/*
- * Abort processing of a JPEG decompression operation,
- * but don't destroy the object itself.
- */
-
-GLOBAL void
-jpeg_abort_decompress (j_decompress_ptr cinfo)
-{
- jpeg_abort((j_common_ptr) cinfo); /* use common routine */
-}
-
-
-/*
- * Install a special processing method for COM or APPn markers.
- */
-
-GLOBAL void
-jpeg_set_marker_processor (j_decompress_ptr cinfo, int marker_code,
- jpeg_marker_parser_method routine)
-{
- if (marker_code == JPEG_COM)
- cinfo->marker->process_COM = routine;
- else if (marker_code >= JPEG_APP0 && marker_code <= JPEG_APP0+15)
- cinfo->marker->process_APPn[marker_code-JPEG_APP0] = routine;
- else
- ERREXIT1(cinfo, JERR_UNKNOWN_MARKER, marker_code);
-}
-
-
-/*
- * Set default decompression parameters.
- */
-
-LOCAL void
-default_decompress_parms (j_decompress_ptr cinfo)
-{
- /* Guess the input colorspace, and set output colorspace accordingly. */
- /* (Wish JPEG committee had provided a real way to specify this...) */
- /* Note application may override our guesses. */
- switch (cinfo->num_components) {
- case 1:
- cinfo->jpeg_color_space = JCS_GRAYSCALE;
- cinfo->out_color_space = JCS_GRAYSCALE;
- break;
-
- case 3:
- if (cinfo->saw_JFIF_marker) {
- cinfo->jpeg_color_space = JCS_YCbCr; /* JFIF implies YCbCr */
- } else if (cinfo->saw_Adobe_marker) {
- switch (cinfo->Adobe_transform) {
- case 0:
- cinfo->jpeg_color_space = JCS_RGB;
- break;
- case 1:
- cinfo->jpeg_color_space = JCS_YCbCr;
- break;
- default:
- WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
- cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
- break;
- }
- } else {
- /* Saw no special markers, try to guess from the component IDs */
- int cid0 = cinfo->comp_info[0].component_id;
- int cid1 = cinfo->comp_info[1].component_id;
- int cid2 = cinfo->comp_info[2].component_id;
-
- if (cid0 == 1 && cid1 == 2 && cid2 == 3)
- cinfo->jpeg_color_space = JCS_YCbCr; /* assume JFIF w/out marker */
- else if (cid0 == 82 && cid1 == 71 && cid2 == 66)
- cinfo->jpeg_color_space = JCS_RGB; /* ASCII 'R', 'G', 'B' */
- else {
- TRACEMS3(cinfo, 1, JTRC_UNKNOWN_IDS, cid0, cid1, cid2);
- cinfo->jpeg_color_space = JCS_YCbCr; /* assume it's YCbCr */
- }
- }
- /* Always guess RGB is proper output colorspace. */
- cinfo->out_color_space = JCS_RGB;
- break;
-
- case 4:
- if (cinfo->saw_Adobe_marker) {
- switch (cinfo->Adobe_transform) {
- case 0:
- cinfo->jpeg_color_space = JCS_CMYK;
- break;
- case 2:
- cinfo->jpeg_color_space = JCS_YCCK;
- break;
- default:
- WARNMS1(cinfo, JWRN_ADOBE_XFORM, cinfo->Adobe_transform);
- cinfo->jpeg_color_space = JCS_YCCK; /* assume it's YCCK */
- break;
- }
- } else {
- /* No special markers, assume straight CMYK. */
- cinfo->jpeg_color_space = JCS_CMYK;
- }
- cinfo->out_color_space = JCS_CMYK;
- break;
-
- default:
- cinfo->jpeg_color_space = JCS_UNKNOWN;
- cinfo->out_color_space = JCS_UNKNOWN;
- break;
- }
-
- /* Set defaults for other decompression parameters. */
- cinfo->scale_num = 1; /* 1:1 scaling */
- cinfo->scale_denom = 1;
- cinfo->output_gamma = 1.0;
- cinfo->buffered_image = FALSE;
- cinfo->raw_data_out = FALSE;
- cinfo->dct_method = JDCT_DEFAULT;
- cinfo->do_fancy_upsampling = TRUE;
- cinfo->do_block_smoothing = TRUE;
- cinfo->quantize_colors = FALSE;
- /* We set these in case application only sets quantize_colors. */
- cinfo->dither_mode = JDITHER_FS;
-#ifdef QUANT_2PASS_SUPPORTED
- cinfo->two_pass_quantize = TRUE;
-#else
- cinfo->two_pass_quantize = FALSE;
-#endif
- cinfo->desired_number_of_colors = 256;
- cinfo->colormap = NULL;
- /* Initialize for no mode change in buffered-image mode. */
- cinfo->enable_1pass_quant = FALSE;
- cinfo->enable_external_quant = FALSE;
- cinfo->enable_2pass_quant = FALSE;
-}
-
-
-/*
- * Decompression startup: read start of JPEG datastream to see what's there.
- * Need only initialize JPEG object and supply a data source before calling.
- *
- * This routine will read as far as the first SOS marker (ie, actual start of
- * compressed data), and will save all tables and parameters in the JPEG
- * object. It will also initialize the decompression parameters to default
- * values, and finally return JPEG_HEADER_OK. On return, the application may
- * adjust the decompression parameters and then call jpeg_start_decompress.
- * (Or, if the application only wanted to determine the image parameters,
- * the data need not be decompressed. In that case, call jpeg_abort or
- * jpeg_destroy to release any temporary space.)
- * If an abbreviated (tables only) datastream is presented, the routine will
- * return JPEG_HEADER_TABLES_ONLY upon reaching EOI. The application may then
- * re-use the JPEG object to read the abbreviated image datastream(s).
- * It is unnecessary (but OK) to call jpeg_abort in this case.
- * The JPEG_SUSPENDED return code only occurs if the data source module
- * requests suspension of the decompressor. In this case the application
- * should load more source data and then re-call jpeg_read_header to resume
- * processing.
- * If a non-suspending data source is used and require_image is TRUE, then the
- * return code need not be inspected since only JPEG_HEADER_OK is possible.
- *
- * This routine is now just a front end to jpeg_consume_input, with some
- * extra error checking.
- */
-
-GLOBAL int
-jpeg_read_header (j_decompress_ptr cinfo, boolean require_image)
-{
- int retcode;
-
- if (cinfo->global_state != DSTATE_START &&
- cinfo->global_state != DSTATE_INHEADER)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
- retcode = jpeg_consume_input(cinfo);
-
- switch (retcode) {
- case JPEG_REACHED_SOS:
- retcode = JPEG_HEADER_OK;
- break;
- case JPEG_REACHED_EOI:
- if (require_image) /* Complain if application wanted an image */
- ERREXIT(cinfo, JERR_NO_IMAGE);
- /* Reset to start state; it would be safer to require the application to
- * call jpeg_abort, but we can't change it now for compatibility reasons.
- * A side effect is to free any temporary memory (there shouldn't be any).
- */
- jpeg_abort((j_common_ptr) cinfo); /* sets state = DSTATE_START */
- retcode = JPEG_HEADER_TABLES_ONLY;
- break;
- case JPEG_SUSPENDED:
- /* no work */
- break;
- }
-
- return retcode;
-}
-
-
-/*
- * Consume data in advance of what the decompressor requires.
- * This can be called at any time once the decompressor object has
- * been created and a data source has been set up.
- *
- * This routine is essentially a state machine that handles a couple
- * of critical state-transition actions, namely initial setup and
- * transition from header scanning to ready-for-start_decompress.
- * All the actual input is done via the input controller's consume_input
- * method.
- */
-
-GLOBAL int
-jpeg_consume_input (j_decompress_ptr cinfo)
-{
- int retcode = JPEG_SUSPENDED;
-
- /* NB: every possible DSTATE value should be listed in this switch */
- switch (cinfo->global_state) {
- case DSTATE_START:
- /* Start-of-datastream actions: reset appropriate modules */
- (*cinfo->inputctl->reset_input_controller) (cinfo);
- /* Initialize application's data source module */
- (*cinfo->src->init_source) (cinfo);
- cinfo->global_state = DSTATE_INHEADER;
- /*FALLTHROUGH*/
- case DSTATE_INHEADER:
- retcode = (*cinfo->inputctl->consume_input) (cinfo);
- if (retcode == JPEG_REACHED_SOS) { /* Found SOS, prepare to decompress */
- /* Set up default parameters based on header data */
- default_decompress_parms(cinfo);
- /* Set global state: ready for start_decompress */
- cinfo->global_state = DSTATE_READY;
- }
- break;
- case DSTATE_READY:
- /* Can't advance past first SOS until start_decompress is called */
- retcode = JPEG_REACHED_SOS;
- break;
- case DSTATE_PRELOAD:
- case DSTATE_PRESCAN:
- case DSTATE_SCANNING:
- case DSTATE_RAW_OK:
- case DSTATE_BUFIMAGE:
- case DSTATE_BUFPOST:
- case DSTATE_STOPPING:
- retcode = (*cinfo->inputctl->consume_input) (cinfo);
- break;
- default:
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- }
- return retcode;
-}
-
-
-/*
- * Have we finished reading the input file?
- */
-
-GLOBAL boolean
-jpeg_input_complete (j_decompress_ptr cinfo)
-{
- /* Check for valid jpeg object */
- if (cinfo->global_state < DSTATE_START ||
- cinfo->global_state > DSTATE_STOPPING)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- return cinfo->inputctl->eoi_reached;
-}
-
-
-/*
- * Is there more than one scan?
- */
-
-GLOBAL boolean
-jpeg_has_multiple_scans (j_decompress_ptr cinfo)
-{
- /* Only valid after jpeg_read_header completes */
- if (cinfo->global_state < DSTATE_READY ||
- cinfo->global_state > DSTATE_STOPPING)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- return cinfo->inputctl->has_multiple_scans;
-}
-
-
-/*
- * Finish JPEG decompression.
- *
- * This will normally just verify the file trailer and release temp storage.
- *
- * Returns FALSE if suspended. The return value need be inspected only if
- * a suspending data source is used.
- */
-
-GLOBAL boolean
-jpeg_finish_decompress (j_decompress_ptr cinfo)
-{
- if ((cinfo->global_state == DSTATE_SCANNING ||
- cinfo->global_state == DSTATE_RAW_OK) && ! cinfo->buffered_image) {
- /* Terminate final pass of non-buffered mode */
- if (cinfo->output_scanline < cinfo->output_height)
- ERREXIT(cinfo, JERR_TOO_LITTLE_DATA);
- (*cinfo->master->finish_output_pass) (cinfo);
- cinfo->global_state = DSTATE_STOPPING;
- } else if (cinfo->global_state == DSTATE_BUFIMAGE) {
- /* Finishing after a buffered-image operation */
- cinfo->global_state = DSTATE_STOPPING;
- } else if (cinfo->global_state != DSTATE_STOPPING) {
- /* STOPPING = repeat call after a suspension, anything else is error */
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- }
- /* Read until EOI */
- while (! cinfo->inputctl->eoi_reached) {
- if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
- return FALSE; /* Suspend, come back later */
- }
- /* Do final cleanup */
- (*cinfo->src->term_source) (cinfo);
- /* We can use jpeg_abort to release memory and reset global_state */
- jpeg_abort((j_common_ptr) cinfo);
- return TRUE;
-}
diff --git a/src/jpeg-6/jdapistd.c b/src/jpeg-6/jdapistd.c
deleted file mode 100644
index e36f25c..0000000
--- a/src/jpeg-6/jdapistd.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * jdapistd.c
- *
- * Copyright (C) 1994-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains application interface code for the decompression half
- * of the JPEG library. These are the "standard" API routines that are
- * used in the normal full-decompression case. They are not used by a
- * transcoding-only application. Note that if an application links in
- * jpeg_start_decompress, it will end up linking in the entire decompressor.
- * We thus must separate this file from jdapimin.c to avoid linking the
- * whole decompression library into a transcoder.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-
-/* Forward declarations */
-LOCAL boolean output_pass_setup JPP((j_decompress_ptr cinfo));
-
-
-/*
- * Decompression initialization.
- * jpeg_read_header must be completed before calling this.
- *
- * If a multipass operating mode was selected, this will do all but the
- * last pass, and thus may take a great deal of time.
- *
- * Returns FALSE if suspended. The return value need be inspected only if
- * a suspending data source is used.
- */
-
-GLOBAL boolean
-jpeg_start_decompress (j_decompress_ptr cinfo)
-{
- if (cinfo->global_state == DSTATE_READY) {
- /* First call: initialize master control, select active modules */
- jinit_master_decompress(cinfo);
- if (cinfo->buffered_image) {
- /* No more work here; expecting jpeg_start_output next */
- cinfo->global_state = DSTATE_BUFIMAGE;
- return TRUE;
- }
- cinfo->global_state = DSTATE_PRELOAD;
- }
- if (cinfo->global_state == DSTATE_PRELOAD) {
- /* If file has multiple scans, absorb them all into the coef buffer */
- if (cinfo->inputctl->has_multiple_scans) {
-#ifdef D_MULTISCAN_FILES_SUPPORTED
- for (;;) {
- int retcode;
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL)
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- /* Absorb some more input */
- retcode = (*cinfo->inputctl->consume_input) (cinfo);
- if (retcode == JPEG_SUSPENDED)
- return FALSE;
- if (retcode == JPEG_REACHED_EOI)
- break;
- /* Advance progress counter if appropriate */
- if (cinfo->progress != NULL &&
- (retcode == JPEG_ROW_COMPLETED || retcode == JPEG_REACHED_SOS)) {
- if (++cinfo->progress->pass_counter >= cinfo->progress->pass_limit) {
- /* jdmaster underestimated number of scans; ratchet up one scan */
- cinfo->progress->pass_limit += (long) cinfo->total_iMCU_rows;
- }
- }
- }
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif /* D_MULTISCAN_FILES_SUPPORTED */
- }
- cinfo->output_scan_number = cinfo->input_scan_number;
- } else if (cinfo->global_state != DSTATE_PRESCAN)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- /* Perform any dummy output passes, and set up for the final pass */
- return output_pass_setup(cinfo);
-}
-
-
-/*
- * Set up for an output pass, and perform any dummy pass(es) needed.
- * Common subroutine for jpeg_start_decompress and jpeg_start_output.
- * Entry: global_state = DSTATE_PRESCAN only if previously suspended.
- * Exit: If done, returns TRUE and sets global_state for proper output mode.
- * If suspended, returns FALSE and sets global_state = DSTATE_PRESCAN.
- */
-
-LOCAL boolean
-output_pass_setup (j_decompress_ptr cinfo)
-{
- if (cinfo->global_state != DSTATE_PRESCAN) {
- /* First call: do pass setup */
- (*cinfo->master->prepare_for_output_pass) (cinfo);
- cinfo->output_scanline = 0;
- cinfo->global_state = DSTATE_PRESCAN;
- }
- /* Loop over any required dummy passes */
- while (cinfo->master->is_dummy_pass) {
-#ifdef QUANT_2PASS_SUPPORTED
- /* Crank through the dummy pass */
- while (cinfo->output_scanline < cinfo->output_height) {
- JDIMENSION last_scanline;
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
- /* Process some data */
- last_scanline = cinfo->output_scanline;
- (*cinfo->main->process_data) (cinfo, (JSAMPARRAY) NULL,
- &cinfo->output_scanline, (JDIMENSION) 0);
- if (cinfo->output_scanline == last_scanline)
- return FALSE; /* No progress made, must suspend */
- }
- /* Finish up dummy pass, and set up for another one */
- (*cinfo->master->finish_output_pass) (cinfo);
- (*cinfo->master->prepare_for_output_pass) (cinfo);
- cinfo->output_scanline = 0;
-#else
- ERREXIT(cinfo, JERR_NOT_COMPILED);
-#endif /* QUANT_2PASS_SUPPORTED */
- }
- /* Ready for application to drive output pass through
- * jpeg_read_scanlines or jpeg_read_raw_data.
- */
- cinfo->global_state = cinfo->raw_data_out ? DSTATE_RAW_OK : DSTATE_SCANNING;
- return TRUE;
-}
-
-
-/*
- * Read some scanlines of data from the JPEG decompressor.
- *
- * The return value will be the number of lines actually read.
- * This may be less than the number requested in several cases,
- * including bottom of image, data source suspension, and operating
- * modes that emit multiple scanlines at a time.
- *
- * Note: we warn about excess calls to jpeg_read_scanlines() since
- * this likely signals an application programmer error. However,
- * an oversize buffer (max_lines > scanlines remaining) is not an error.
- */
-
-GLOBAL JDIMENSION
-jpeg_read_scanlines (j_decompress_ptr cinfo, JSAMPARRAY scanlines,
- JDIMENSION max_lines)
-{
- JDIMENSION row_ctr;
-
- if (cinfo->global_state != DSTATE_SCANNING)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- if (cinfo->output_scanline >= cinfo->output_height) {
- WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
- return 0;
- }
-
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
-
- /* Process some data */
- row_ctr = 0;
- (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, max_lines);
- cinfo->output_scanline += row_ctr;
- return row_ctr;
-}
-
-
-/*
- * Alternate entry point to read raw data.
- * Processes exactly one iMCU row per call, unless suspended.
- */
-
-GLOBAL JDIMENSION
-jpeg_read_raw_data (j_decompress_ptr cinfo, JSAMPIMAGE data,
- JDIMENSION max_lines)
-{
- JDIMENSION lines_per_iMCU_row;
-
- if (cinfo->global_state != DSTATE_RAW_OK)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- if (cinfo->output_scanline >= cinfo->output_height) {
- WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
- return 0;
- }
-
- /* Call progress monitor hook if present */
- if (cinfo->progress != NULL) {
- cinfo->progress->pass_counter = (long) cinfo->output_scanline;
- cinfo->progress->pass_limit = (long) cinfo->output_height;
- (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
- }
-
- /* Verify that at least one iMCU row can be returned. */
- lines_per_iMCU_row = cinfo->max_v_samp_factor * cinfo->min_DCT_scaled_size;
- if (max_lines < lines_per_iMCU_row)
- ERREXIT(cinfo, JERR_BUFFER_SIZE);
-
- /* Decompress directly into user's buffer. */
- if (! (*cinfo->coef->decompress_data) (cinfo, data))
- return 0; /* suspension forced, can do nothing more */
-
- /* OK, we processed one iMCU row. */
- cinfo->output_scanline += lines_per_iMCU_row;
- return lines_per_iMCU_row;
-}
-
-
-/* Additional entry points for buffered-image mode. */
-
-#ifdef D_MULTISCAN_FILES_SUPPORTED
-
-/*
- * Initialize for an output pass in buffered-image mode.
- */
-
-GLOBAL boolean
-jpeg_start_output (j_decompress_ptr cinfo, int scan_number)
-{
- if (cinfo->global_state != DSTATE_BUFIMAGE &&
- cinfo->global_state != DSTATE_PRESCAN)
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- /* Limit scan number to valid range */
- if (scan_number <= 0)
- scan_number = 1;
- if (cinfo->inputctl->eoi_reached &&
- scan_number > cinfo->input_scan_number)
- scan_number = cinfo->input_scan_number;
- cinfo->output_scan_number = scan_number;
- /* Perform any dummy output passes, and set up for the real pass */
- return output_pass_setup(cinfo);
-}
-
-
-/*
- * Finish up after an output pass in buffered-image mode.
- *
- * Returns FALSE if suspended. The return value need be inspected only if
- * a suspending data source is used.
- */
-
-GLOBAL boolean
-jpeg_finish_output (j_decompress_ptr cinfo)
-{
- if ((cinfo->global_state == DSTATE_SCANNING ||
- cinfo->global_state == DSTATE_RAW_OK) && cinfo->buffered_image) {
- /* Terminate this pass. */
- /* We do not require the whole pass to have been completed. */
- (*cinfo->master->finish_output_pass) (cinfo);
- cinfo->global_state = DSTATE_BUFPOST;
- } else if (cinfo->global_state != DSTATE_BUFPOST) {
- /* BUFPOST = repeat call after a suspension, anything else is error */
- ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
- }
- /* Read markers looking for SOS or EOI */
- while (cinfo->input_scan_number <= cinfo->output_scan_number &&
- ! cinfo->inputctl->eoi_reached) {
- if ((*cinfo->inputctl->consume_input) (cinfo) == JPEG_SUSPENDED)
- return FALSE; /* Suspend, come back later */
- }
- cinfo->global_state = DSTATE_BUFIMAGE;
- return TRUE;
-}
-
-#endif /* D_MULTISCAN_FILES_SUPPORTED */
diff --git a/src/jpeg-6/jdatadst.c b/src/jpeg-6/jdatadst.c
deleted file mode 100644
index 08c4daf..0000000
--- a/src/jpeg-6/jdatadst.c
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * jdatadst.c
- *
- * Copyright (C) 1994, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains compression data destination routines for the case of
- * emitting JPEG data to a file (or any stdio stream). While these routines
- * are sufficient for most applications, some will want to use a different
- * destination manager.
- * IMPORTANT: we assume that fwrite() will correctly transcribe an array of
- * JOCTETs into 8-bit-wide elements on external storage. If char is wider
- * than 8 bits on your machine, you may need to do some tweaking.
- */
-
-/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jerror.h"
-
-
-/* Expanded data destination object for stdio output */
-
-typedef struct {
- struct jpeg_destination_mgr pub; /* public fields */
-
- FILE * outfile; /* target stream */
- JOCTET * buffer; /* start of buffer */
-} my_destination_mgr;
-
-typedef my_destination_mgr * my_dest_ptr;
-
-#define OUTPUT_BUF_SIZE 4096 /* choose an efficiently fwrite'able size */
-
-
-/*
- * Initialize destination --- called by jpeg_start_compress
- * before any data is actually written.
- */
-
-METHODDEF void
-init_destination (j_compress_ptr cinfo)
-{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
-
- /* Allocate the output buffer --- it will be released when done with image */
- dest->buffer = (JOCTET *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- OUTPUT_BUF_SIZE * SIZEOF(JOCTET));
-
- dest->pub.next_output_byte = dest->buffer;
- dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
-}
-
-
-/*
- * Empty the output buffer --- called whenever buffer fills up.
- *
- * In typical applications, this should write the entire output buffer
- * (ignoring the current state of next_output_byte & free_in_buffer),
- * reset the pointer & count to the start of the buffer, and return TRUE
- * indicating that the buffer has been dumped.
- *
- * In applications that need to be able to suspend compression due to output
- * overrun, a FALSE return indicates that the buffer cannot be emptied now.
- * In this situation, the compressor will return to its caller (possibly with
- * an indication that it has not accepted all the supplied scanlines). The
- * application should resume compression after it has made more room in the
- * output buffer. Note that there are substantial restrictions on the use of
- * suspension --- see the documentation.
- *
- * When suspending, the compressor will back up to a convenient restart point
- * (typically the start of the current MCU). next_output_byte & free_in_buffer
- * indicate where the restart point will be if the current call returns FALSE.
- * Data beyond this point will be regenerated after resumption, so do not
- * write it out when emptying the buffer externally.
- */
-
-METHODDEF boolean
-empty_output_buffer (j_compress_ptr cinfo)
-{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
-
- if (JFWRITE(dest->outfile, dest->buffer, OUTPUT_BUF_SIZE) !=
- (size_t) OUTPUT_BUF_SIZE)
- ERREXIT(cinfo, JERR_FILE_WRITE);
-
- dest->pub.next_output_byte = dest->buffer;
- dest->pub.free_in_buffer = OUTPUT_BUF_SIZE;
-
- return TRUE;
-}
-
-
-/*
- * Terminate destination --- called by jpeg_finish_compress
- * after all data has been written. Usually needs to flush buffer.
- *
- * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
- * application must deal with any cleanup that should happen even
- * for error exit.
- */
-
-METHODDEF void
-term_destination (j_compress_ptr cinfo)
-{
- my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
- size_t datacount = OUTPUT_BUF_SIZE - dest->pub.free_in_buffer;
-
- /* Write any data remaining in the buffer */
- if (datacount > 0) {
- if (JFWRITE(dest->outfile, dest->buffer, datacount) != datacount)
- ERREXIT(cinfo, JERR_FILE_WRITE);
- }
- fflush(dest->outfile);
- /* Make sure we wrote the output file OK */
- if (ferror(dest->outfile))
- ERREXIT(cinfo, JERR_FILE_WRITE);
-}
-
-
-/*
- * Prepare for output to a stdio stream.
- * The caller must have already opened the stream, and is responsible
- * for closing it after finishing compression.
- */
-
-GLOBAL void
-jpeg_stdio_dest (j_compress_ptr cinfo, FILE * outfile)
-{
- my_dest_ptr dest;
-
- /* The destination object is made permanent so that multiple JPEG images
- * can be written to the same file without re-executing jpeg_stdio_dest.
- * This makes it dangerous to use this manager and a different destination
- * manager serially with the same JPEG object, because their private object
- * sizes may be different. Caveat programmer.
- */
- if (cinfo->dest == NULL) { /* first time for this JPEG object? */
- cinfo->dest = (struct jpeg_destination_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- SIZEOF(my_destination_mgr));
- }
-
- dest = (my_dest_ptr) cinfo->dest;
- dest->pub.init_destination = init_destination;
- dest->pub.empty_output_buffer = empty_output_buffer;
- dest->pub.term_destination = term_destination;
- dest->outfile = outfile;
-}
diff --git a/src/jpeg-6/jdatasrc.c b/src/jpeg-6/jdatasrc.c
deleted file mode 100644
index 0bf7866..0000000
--- a/src/jpeg-6/jdatasrc.c
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * jdatasrc.c
- *
- * Copyright (C) 1994, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains decompression data source routines for the case of
- * reading JPEG data from a file (or any stdio stream). While these routines
- * are sufficient for most applications, some will want to use a different
- * source manager.
- * IMPORTANT: we assume that fread() will correctly transcribe an array of
- * JOCTETs from 8-bit-wide elements on external storage. If char is wider
- * than 8 bits on your machine, you may need to do some tweaking.
- */
-
-
-/* this is not a core library module, so it doesn't define JPEG_INTERNALS */
-#include "jinclude.h"
-#include "jpeglib.h"
-#include "jerror.h"
-
-
-/* Expanded data source object for stdio input */
-
-typedef struct {
- struct jpeg_source_mgr pub; /* public fields */
-
- unsigned char *infile; /* source stream */
- JOCTET * buffer; /* start of buffer */
- boolean start_of_file; /* have we gotten any data yet? */
-} my_source_mgr;
-
-typedef my_source_mgr * my_src_ptr;
-
-#define INPUT_BUF_SIZE 4096 /* choose an efficiently fread'able size */
-
-
-/*
- * Initialize source --- called by jpeg_read_header
- * before any data is actually read.
- */
-
-METHODDEF void
-init_source (j_decompress_ptr cinfo)
-{
- my_src_ptr src = (my_src_ptr) cinfo->src;
-
- /* We reset the empty-input-file flag for each image,
- * but we don't clear the input buffer.
- * This is correct behavior for reading a series of images from one source.
- */
- src->start_of_file = TRUE;
-}
-
-
-/*
- * Fill the input buffer --- called whenever buffer is emptied.
- *
- * In typical applications, this should read fresh data into the buffer
- * (ignoring the current state of next_input_byte & bytes_in_buffer),
- * reset the pointer & count to the start of the buffer, and return TRUE
- * indicating that the buffer has been reloaded. It is not necessary to
- * fill the buffer entirely, only to obtain at least one more byte.
- *
- * There is no such thing as an EOF return. If the end of the file has been
- * reached, the routine has a choice of ERREXIT() or inserting fake data into
- * the buffer. In most cases, generating a warning message and inserting a
- * fake EOI marker is the best course of action --- this will allow the
- * decompressor to output however much of the image is there. However,
- * the resulting error message is misleading if the real problem is an empty
- * input file, so we handle that case specially.
- *
- * In applications that need to be able to suspend compression due to input
- * not being available yet, a FALSE return indicates that no more data can be
- * obtained right now, but more may be forthcoming later. In this situation,
- * the decompressor will return to its caller (with an indication of the
- * number of scanlines it has read, if any). The application should resume
- * decompression after it has loaded more data into the input buffer. Note
- * that there are substantial restrictions on the use of suspension --- see
- * the documentation.
- *
- * When suspending, the decompressor will back up to a convenient restart point
- * (typically the start of the current MCU). next_input_byte & bytes_in_buffer
- * indicate where the restart point will be if the current call returns FALSE.
- * Data beyond this point must be rescanned after resumption, so move it to
- * the front of the buffer rather than discarding it.
- */
-
-METHODDEF boolean
-fill_input_buffer (j_decompress_ptr cinfo)
-{
- my_src_ptr src = (my_src_ptr) cinfo->src;
-
- memcpy( src->buffer, src->infile, INPUT_BUF_SIZE );
-
- src->infile += INPUT_BUF_SIZE;
-
- src->pub.next_input_byte = src->buffer;
- src->pub.bytes_in_buffer = INPUT_BUF_SIZE;
- src->start_of_file = FALSE;
-
- return TRUE;
-}
-
-
-/*
- * Skip data --- used to skip over a potentially large amount of
- * uninteresting data (such as an APPn marker).
- *
- * Writers of suspendable-input applications must note that skip_input_data
- * is not granted the right to give a suspension return. If the skip extends
- * beyond the data currently in the buffer, the buffer can be marked empty so
- * that the next read will cause a fill_input_buffer call that can suspend.
- * Arranging for additional bytes to be discarded before reloading the input
- * buffer is the application writer's problem.
- */
-
-METHODDEF void
-skip_input_data (j_decompress_ptr cinfo, long num_bytes)
-{
- my_src_ptr src = (my_src_ptr) cinfo->src;
-
- /* Just a dumb implementation for now. Could use fseek() except
- * it doesn't work on pipes. Not clear that being smart is worth
- * any trouble anyway --- large skips are infrequent.
- */
- if (num_bytes > 0) {
- while (num_bytes > (long) src->pub.bytes_in_buffer) {
- num_bytes -= (long) src->pub.bytes_in_buffer;
- (void) fill_input_buffer(cinfo);
- /* note we assume that fill_input_buffer will never return FALSE,
- * so suspension need not be handled.
- */
- }
- src->pub.next_input_byte += (size_t) num_bytes;
- src->pub.bytes_in_buffer -= (size_t) num_bytes;
- }
-}
-
-
-/*
- * An additional method that can be provided by data source modules is the
- * resync_to_restart method for error recovery in the presence of RST markers.
- * For the moment, this source module just uses the default resync method
- * provided by the JPEG library. That method assumes that no backtracking
- * is possible.
- */
-
-
-/*
- * Terminate source --- called by jpeg_finish_decompress
- * after all data has been read. Often a no-op.
- *
- * NB: *not* called by jpeg_abort or jpeg_destroy; surrounding
- * application must deal with any cleanup that should happen even
- * for error exit.
- */
-
-METHODDEF void
-term_source (j_decompress_ptr cinfo)
-{
- /* no work necessary here */
-}
-
-
-/*
- * Prepare for input from a stdio stream.
- * The caller must have already opened the stream, and is responsible
- * for closing it after finishing decompression.
- */
-
-GLOBAL void
-jpeg_stdio_src (j_decompress_ptr cinfo, unsigned char *infile)
-{
- my_src_ptr src;
-
- /* The source object and input buffer are made permanent so that a series
- * of JPEG images can be read from the same file by calling jpeg_stdio_src
- * only before the first one. (If we discarded the buffer at the end of
- * one image, we'd likely lose the start of the next one.)
- * This makes it unsafe to use this manager and a different source
- * manager serially with the same JPEG object. Caveat programmer.
- */
- if (cinfo->src == NULL) { /* first time for this JPEG object? */
- cinfo->src = (struct jpeg_source_mgr *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- SIZEOF(my_source_mgr));
- src = (my_src_ptr) cinfo->src;
- src->buffer = (JOCTET *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
- INPUT_BUF_SIZE * SIZEOF(JOCTET));
- }
-
- src = (my_src_ptr) cinfo->src;
- src->pub.init_source = init_source;
- src->pub.fill_input_buffer = fill_input_buffer;
- src->pub.skip_input_data = skip_input_data;
- src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
- src->pub.term_source = term_source;
- src->infile = infile;
- src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
- src->pub.next_input_byte = NULL; /* until buffer loaded */
-}
diff --git a/src/jpeg-6/jdcoefct.c b/src/jpeg-6/jdcoefct.c
deleted file mode 100644
index ba153f5..0000000
--- a/src/jpeg-6/jdcoefct.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/*
- * jdcoefct.c
- *
- * Copyright (C) 1994-1995, Thomas G. Lane.
- * This file is part of the Independent JPEG Group's software.
- * For conditions of distribution and use, see the accompanying README file.
- *
- * This file contains the coefficient buffer controller for decompression.
- * This controller is the top level of the JPEG decompressor proper.
- * The coefficient buffer lies between entropy decoding and inverse-DCT steps.
- *
- * In buffered-image mode, this controller is the interface between
- * input-oriented processing and output-oriented processing.
- * Also, the input side (only) is used when reading a file for transcoding.
- */
-
-#define JPEG_INTERNALS
-#include "jinclude.h"
-#include "jpeglib.h"
-
-/* Block smoothing is only applicable for progressive JPEG, so: */
-#ifndef D_PROGRESSIVE_SUPPORTED
-#undef BLOCK_SMOOTHING_SUPPORTED
-#endif
-
-/* Private buffer controller object */
-
-typedef struct {
- struct jpeg_d_coef_controller pub; /* public fields */
-
- /* These variables keep track of the current location of the input side. */
- /* cinfo->input_iMCU_row is also used for this. */
- JDIMENSION MCU_ctr; /* counts MCUs processed in current row */
- int MCU_vert_offset; /* counts MCU rows within iMCU row */
- int MCU_rows_per_iMCU_row; /* number of such rows needed */
-
- /* The output side's location is represented by cinfo->output_iMCU_row. */
-
- /* In single-pass modes, it's sufficient to buffer just one MCU.
- * We allocate a workspace of D_MAX_BLOCKS_IN_MCU coefficient blocks,
- * and let the entropy decoder write into that workspace each time.
- * (On 80x86, the workspace is FAR even though it's not really very big;
- * this is to keep the module interfaces unchanged when a large coefficient
- * buffer is necessary.)
- * In multi-pass modes, this array points to the current MCU's blocks
- * within the virtual arrays; it is used only by the input side.
- */
- JBLOCKROW MCU_buffer[D_MAX_BLOCKS_IN_MCU];
-
-#ifdef D_MULTISCAN_FILES_SUPPORTED
- /* In multi-pass modes, we need a virtual block array for each component. */
- jvirt_barray_ptr whole_image[MAX_COMPONENTS];
-#endif
-
-#ifdef BLOCK_SMOOTHING_SUPPORTED
- /* When doing block smoothing, we latch coefficient Al values here */
- int * coef_bits_latch;
-#define SAVED_COEFS 6 /* we save coef_bits[0..5] */
-#endif
-} my_coef_controller;
-
-typedef my_coef_controller * my_coef_ptr;
-
-/* Forward declarations */
-METHODDEF int decompress_onepass
- JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
-#ifdef D_MULTISCAN_FILES_SUPPORTED
-METHODDEF int decompress_data
- JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
-#endif
-#ifdef BLOCK_SMOOTHING_SUPPORTED
-LOCAL boolean smoothing_ok JPP((j_decompress_ptr cinfo));
-METHODDEF int decompress_smooth_data
- JPP((j_decompress_ptr cinfo, JSAMPIMAGE output_buf));
-#endif
-
-
-LOCAL void
-start_iMCU_row (j_decompress_ptr cinfo)
-/* Reset within-iMCU-row counters for a new row (input side) */
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- /* In an interleaved scan, an MCU row is the same as an iMCU row.
- * In a noninterleaved scan, an iMCU row has v_samp_factor MCU rows.
- * But at the bottom of the image, process only what's left.
- */
- if (cinfo->comps_in_scan > 1) {
- coef->MCU_rows_per_iMCU_row = 1;
- } else {
- if (cinfo->input_iMCU_row < (cinfo->total_iMCU_rows-1))
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->v_samp_factor;
- else
- coef->MCU_rows_per_iMCU_row = cinfo->cur_comp_info[0]->last_row_height;
- }
-
- coef->MCU_ctr = 0;
- coef->MCU_vert_offset = 0;
-}
-
-
-/*
- * Initialize for an input processing pass.
- */
-
-METHODDEF void
-start_input_pass (j_decompress_ptr cinfo)
-{
- cinfo->input_iMCU_row = 0;
- start_iMCU_row(cinfo);
-}
-
-
-/*
- * Initialize for an output processing pass.
- */
-
-METHODDEF void
-start_output_pass (j_decompress_ptr cinfo)
-{
-#ifdef BLOCK_SMOOTHING_SUPPORTED
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
-
- /* If multipass, check to see whether to use block smoothing on this pass */
- if (coef->pub.coef_arrays != NULL) {
- if (cinfo->do_block_smoothing && smoothing_ok(cinfo))
- coef->pub.decompress_data = decompress_smooth_data;
- else
- coef->pub.decompress_data = decompress_data;
- }
-#endif
- cinfo->output_iMCU_row = 0;
-}
-
-
-/*
- * Decompress and return some data in the single-pass case.
- * Always attempts to emit one fully interleaved MCU row ("iMCU" row).
- * Input and output must run in lockstep since we have only a one-MCU buffer.
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
- *
- * NB: output_buf contains a plane for each component in image.
- * For single pass, this is the same as the components in the scan.
- */
-
-METHODDEF int
-decompress_onepass (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- JDIMENSION last_MCU_col = cinfo->MCUs_per_row - 1;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- int blkn, ci, xindex, yindex, yoffset, useful_width;
- JSAMPARRAY output_ptr;
- JDIMENSION start_col, output_col;
- jpeg_component_info *compptr;
- inverse_DCT_method_ptr inverse_DCT;
-
- /* Loop to process as much as one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->MCU_ctr; MCU_col_num <= last_MCU_col;
- MCU_col_num++) {
- /* Try to fetch an MCU. Entropy decoder expects buffer to be zeroed. */
- jzero_far((void FAR *) coef->MCU_buffer[0],
- (size_t) (cinfo->blocks_in_MCU * SIZEOF(JBLOCK)));
- if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->MCU_ctr = MCU_col_num;
- return JPEG_SUSPENDED;
- }
- /* Determine where data should go in output_buf and do the IDCT thing.
- * We skip dummy blocks at the right and bottom edges (but blkn gets
- * incremented past them!). Note the inner loop relies on having
- * allocated the MCU_buffer[] blocks sequentially.
- */
- blkn = 0; /* index of current DCT block within MCU */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- /* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed) {
- blkn += compptr->MCU_blocks;
- continue;
- }
- inverse_DCT = cinfo->idct->inverse_DCT[compptr->component_index];
- useful_width = (MCU_col_num < last_MCU_col) ? compptr->MCU_width
- : compptr->last_col_width;
- output_ptr = output_buf[ci] + yoffset * compptr->DCT_scaled_size;
- start_col = MCU_col_num * compptr->MCU_sample_width;
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- if (cinfo->input_iMCU_row < last_iMCU_row ||
- yoffset+yindex < compptr->last_row_height) {
- output_col = start_col;
- for (xindex = 0; xindex < useful_width; xindex++) {
- (*inverse_DCT) (cinfo, compptr,
- (JCOEFPTR) coef->MCU_buffer[blkn+xindex],
- output_ptr, output_col);
- output_col += compptr->DCT_scaled_size;
- }
- }
- blkn += compptr->MCU_width;
- output_ptr += compptr->DCT_scaled_size;
- }
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->MCU_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- cinfo->output_iMCU_row++;
- if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
- start_iMCU_row(cinfo);
- return JPEG_ROW_COMPLETED;
- }
- /* Completed the scan */
- (*cinfo->inputctl->finish_input_pass) (cinfo);
- return JPEG_SCAN_COMPLETED;
-}
-
-
-/*
- * Dummy consume-input routine for single-pass operation.
- */
-
-METHODDEF int
-dummy_consume_data (j_decompress_ptr cinfo)
-{
- return JPEG_SUSPENDED; /* Always indicate nothing was done */
-}
-
-
-#ifdef D_MULTISCAN_FILES_SUPPORTED
-
-/*
- * Consume input data and store it in the full-image coefficient buffer.
- * We read as much as one fully interleaved MCU row ("iMCU" row) per call,
- * ie, v_samp_factor block rows for each component in the scan.
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
- */
-
-METHODDEF int
-consume_data (j_decompress_ptr cinfo)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION MCU_col_num; /* index of current MCU within row */
- int blkn, ci, xindex, yindex, yoffset;
- JDIMENSION start_col;
- JBLOCKARRAY buffer[MAX_COMPS_IN_SCAN];
- JBLOCKROW buffer_ptr;
- jpeg_component_info *compptr;
-
- /* Align the virtual buffers for the components used in this scan. */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- buffer[ci] = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[compptr->component_index],
- cinfo->input_iMCU_row * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, TRUE);
- /* Note: entropy decoder expects buffer to be zeroed,
- * but this is handled automatically by the memory manager
- * because we requested a pre-zeroed array.
- */
- }
-
- /* Loop to process one whole iMCU row */
- for (yoffset = coef->MCU_vert_offset; yoffset < coef->MCU_rows_per_iMCU_row;
- yoffset++) {
- for (MCU_col_num = coef->MCU_ctr; MCU_col_num < cinfo->MCUs_per_row;
- MCU_col_num++) {
- /* Construct list of pointers to DCT blocks belonging to this MCU */
- blkn = 0; /* index of current DCT block within MCU */
- for (ci = 0; ci < cinfo->comps_in_scan; ci++) {
- compptr = cinfo->cur_comp_info[ci];
- start_col = MCU_col_num * compptr->MCU_width;
- for (yindex = 0; yindex < compptr->MCU_height; yindex++) {
- buffer_ptr = buffer[ci][yindex+yoffset] + start_col;
- for (xindex = 0; xindex < compptr->MCU_width; xindex++) {
- coef->MCU_buffer[blkn++] = buffer_ptr++;
- }
- }
- }
- /* Try to fetch the MCU. */
- if (! (*cinfo->entropy->decode_mcu) (cinfo, coef->MCU_buffer)) {
- /* Suspension forced; update state counters and exit */
- coef->MCU_vert_offset = yoffset;
- coef->MCU_ctr = MCU_col_num;
- return JPEG_SUSPENDED;
- }
- }
- /* Completed an MCU row, but perhaps not an iMCU row */
- coef->MCU_ctr = 0;
- }
- /* Completed the iMCU row, advance counters for next one */
- if (++(cinfo->input_iMCU_row) < cinfo->total_iMCU_rows) {
- start_iMCU_row(cinfo);
- return JPEG_ROW_COMPLETED;
- }
- /* Completed the scan */
- (*cinfo->inputctl->finish_input_pass) (cinfo);
- return JPEG_SCAN_COMPLETED;
-}
-
-
-/*
- * Decompress and return some data in the multi-pass case.
- * Always attempts to emit one fully interleaved MCU row ("iMCU" row).
- * Return value is JPEG_ROW_COMPLETED, JPEG_SCAN_COMPLETED, or JPEG_SUSPENDED.
- *
- * NB: output_buf contains a plane for each component in image.
- */
-
-METHODDEF int
-decompress_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- JDIMENSION block_num;
- int ci, block_row, block_rows;
- JBLOCKARRAY buffer;
- JBLOCKROW buffer_ptr;
- JSAMPARRAY output_ptr;
- JDIMENSION output_col;
- jpeg_component_info *compptr;
- inverse_DCT_method_ptr inverse_DCT;
-
- /* Force some input to be done if we are getting ahead of the input. */
- while (cinfo->input_scan_number < cinfo->output_scan_number ||
- (cinfo->input_scan_number == cinfo->output_scan_number &&
- cinfo->input_iMCU_row <= cinfo->output_iMCU_row)) {
- if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
- return JPEG_SUSPENDED;
- }
-
- /* OK, output from the virtual arrays. */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed)
- continue;
- /* Align the virtual buffer for this component. */
- buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- cinfo->output_iMCU_row * compptr->v_samp_factor,
- (JDIMENSION) compptr->v_samp_factor, FALSE);
- /* Count non-dummy DCT block rows in this iMCU row. */
- if (cinfo->output_iMCU_row < last_iMCU_row)
- block_rows = compptr->v_samp_factor;
- else {
- /* NB: can't use last_row_height here; it is input-side-dependent! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (block_rows == 0) block_rows = compptr->v_samp_factor;
- }
- inverse_DCT = cinfo->idct->inverse_DCT[ci];
- output_ptr = output_buf[ci];
- /* Loop over all DCT blocks to be processed. */
- for (block_row = 0; block_row < block_rows; block_row++) {
- buffer_ptr = buffer[block_row];
- output_col = 0;
- for (block_num = 0; block_num < compptr->width_in_blocks; block_num++) {
- (*inverse_DCT) (cinfo, compptr, (JCOEFPTR) buffer_ptr,
- output_ptr, output_col);
- buffer_ptr++;
- output_col += compptr->DCT_scaled_size;
- }
- output_ptr += compptr->DCT_scaled_size;
- }
- }
-
- if (++(cinfo->output_iMCU_row) < cinfo->total_iMCU_rows)
- return JPEG_ROW_COMPLETED;
- return JPEG_SCAN_COMPLETED;
-}
-
-#endif /* D_MULTISCAN_FILES_SUPPORTED */
-
-
-#ifdef BLOCK_SMOOTHING_SUPPORTED
-
-/*
- * This code applies interblock smoothing as described by section K.8
- * of the JPEG standard: the first 5 AC coefficients are estimated from
- * the DC values of a DCT block and its 8 neighboring blocks.
- * We apply smoothing only for progressive JPEG decoding, and only if
- * the coefficients it can estimate are not yet known to full precision.
- */
-
-/*
- * Determine whether block smoothing is applicable and safe.
- * We also latch the current states of the coef_bits[] entries for the
- * AC coefficients; otherwise, if the input side of the decompressor
- * advances into a new scan, we might think the coefficients are known
- * more accurately than they really are.
- */
-
-LOCAL boolean
-smoothing_ok (j_decompress_ptr cinfo)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- boolean smoothing_useful = FALSE;
- int ci, coefi;
- jpeg_component_info *compptr;
- JQUANT_TBL * qtable;
- int * coef_bits;
- int * coef_bits_latch;
-
- if (! cinfo->progressive_mode || cinfo->coef_bits == NULL)
- return FALSE;
-
- /* Allocate latch area if not already done */
- if (coef->coef_bits_latch == NULL)
- coef->coef_bits_latch = (int *)
- (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
- cinfo->num_components *
- (SAVED_COEFS * SIZEOF(int)));
- coef_bits_latch = coef->coef_bits_latch;
-
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* All components' quantization values must already be latched. */
- if ((qtable = compptr->quant_table) == NULL)
- return FALSE;
- /* Verify DC & first 5 AC quantizers are nonzero to avoid zero-divide. */
- for (coefi = 0; coefi <= 5; coefi++) {
- if (qtable->quantval[coefi] == 0)
- return FALSE;
- }
- /* DC values must be at least partly known for all components. */
- coef_bits = cinfo->coef_bits[ci];
- if (coef_bits[0] < 0)
- return FALSE;
- /* Block smoothing is helpful if some AC coefficients remain inaccurate. */
- for (coefi = 1; coefi <= 5; coefi++) {
- coef_bits_latch[coefi] = coef_bits[coefi];
- if (coef_bits[coefi] != 0)
- smoothing_useful = TRUE;
- }
- coef_bits_latch += SAVED_COEFS;
- }
-
- return smoothing_useful;
-}
-
-
-/*
- * Variant of decompress_data for use when doing block smoothing.
- */
-
-METHODDEF int
-decompress_smooth_data (j_decompress_ptr cinfo, JSAMPIMAGE output_buf)
-{
- my_coef_ptr coef = (my_coef_ptr) cinfo->coef;
- JDIMENSION last_iMCU_row = cinfo->total_iMCU_rows - 1;
- JDIMENSION block_num, last_block_column;
- int ci, block_row, block_rows, access_rows;
- JBLOCKARRAY buffer;
- JBLOCKROW buffer_ptr, prev_block_row, next_block_row;
- JSAMPARRAY output_ptr;
- JDIMENSION output_col;
- jpeg_component_info *compptr;
- inverse_DCT_method_ptr inverse_DCT;
- boolean first_row, last_row;
- JBLOCK workspace;
- int *coef_bits;
- JQUANT_TBL *quanttbl;
- INT32 Q00,Q01,Q02,Q10,Q11,Q20, num;
- int DC1,DC2,DC3,DC4,DC5,DC6,DC7,DC8,DC9;
- int Al, pred;
-
- /* Force some input to be done if we are getting ahead of the input. */
- while (cinfo->input_scan_number <= cinfo->output_scan_number &&
- ! cinfo->inputctl->eoi_reached) {
- if (cinfo->input_scan_number == cinfo->output_scan_number) {
- /* If input is working on current scan, we ordinarily want it to
- * have completed the current row. But if input scan is DC,
- * we want it to keep one row ahead so that next block row's DC
- * values are up to date.
- */
- JDIMENSION delta = (cinfo->Ss == 0) ? 1 : 0;
- if (cinfo->input_iMCU_row > cinfo->output_iMCU_row+delta)
- break;
- }
- if ((*cinfo->inputctl->consume_input)(cinfo) == JPEG_SUSPENDED)
- return JPEG_SUSPENDED;
- }
-
- /* OK, output from the virtual arrays. */
- for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components;
- ci++, compptr++) {
- /* Don't bother to IDCT an uninteresting component. */
- if (! compptr->component_needed)
- continue;
- /* Count non-dummy DCT block rows in this iMCU row. */
- if (cinfo->output_iMCU_row < last_iMCU_row) {
- block_rows = compptr->v_samp_factor;
- access_rows = block_rows * 2; /* this and next iMCU row */
- last_row = FALSE;
- } else {
- /* NB: can't use last_row_height here; it is input-side-dependent! */
- block_rows = (int) (compptr->height_in_blocks % compptr->v_samp_factor);
- if (block_rows == 0) block_rows = compptr->v_samp_factor;
- access_rows = block_rows; /* this iMCU row only */
- last_row = TRUE;
- }
- /* Align the virtual buffer for this component. */
- if (cinfo->output_iMCU_row > 0) {
- access_rows += compptr->v_samp_factor; /* prior iMCU row too */
- buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- (cinfo->output_iMCU_row - 1) * compptr->v_samp_factor,
- (JDIMENSION) access_rows, FALSE);
- buffer += compptr->v_samp_factor; /* point to current iMCU row */
- first_row = FALSE;
- } else {
- buffer = (*cinfo->mem->access_virt_barray)
- ((j_common_ptr) cinfo, coef->whole_image[ci],
- (JDIMENSION) 0, (JDIMENSION) access_rows, FALSE);
- first_row = TRUE;
- }
- /* Fetch component-dependent info */
- coef_bits = coef->coef_bits_latch + (ci * SAVED_COEFS);
- quanttbl = compptr->quant_table;
- Q00 = quanttbl->quantval[0];
- Q01 = quanttbl->quantval[1];
- Q10 = quanttbl->quantval[2];
- Q20 = quanttbl->quantval[3];
- Q11 = quanttbl->quantval[4];
- Q02 = quanttbl->quantval[5];
- inverse_DCT = cinfo->idct->inverse_DCT[ci];
- output_ptr = output_buf[ci];
- /* Loop over all DCT blocks to be processed. */
- for (block_row = 0; block_row < block_rows; block_row++) {
- buffer_ptr = buffer[block_row];
- if (first_row && block_row == 0)
- prev_block_row = buffer_ptr;
- else
- prev_block_row = buffer[block_row-1];
- if (last_row && block_row == block_rows-1)
- next_block_row = buffer_ptr;
- else
- next_block_row = buffer[block_row+1];
- /* We fetch the surrounding DC values using a sliding-register approach.
- * Initialize all nine here so as to do the right thing on narrow pics.
- */
- DC1 = DC2 = DC3 = (int) prev_block_row[0][0];
- DC4 = DC5 = DC6 = (int) buffer_ptr[0][0];
- DC7 = DC8 = DC9 = (int) next_block_row[0][0];
- output_col = 0;
- last_block_column = compptr->width_in_blocks - 1;
- for (block_num = 0; block_num <= last_block_column; block_num++) {
- /* Fetch current DCT block into workspace so we can modify it. */
- jcopy_block_row(buffer_ptr, (JBLOCKROW) workspace, (JDIMENSION) 1);
- /* Update DC values */
- if (block_num < last_block_column) {
- DC3 = (int) prev_block_row[1][0];
- DC6 = (int) buffer_ptr[1][0];
- DC9 = (int) next_block_row[1][0];
- }
- /* Compute coefficient estimates per K.8.
- * An estimate is applied only if coefficient is still zero,
- * and is not known to be fully accurate.
- */
- /* AC01 */
- if ((Al=coef_bits[1]) != 0 && workspace[1] == 0) {
- num = 36 * Q00 * (DC4 - DC6);
- if (num >= 0) {
- pred = (int) (((Q01<<7) + num) / (Q01<<8));
- if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) {
- pred = (int) (((Q10<<7) + num) / (Q10<<8));
- if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) {
- pred = (int) (((Q20<<7) + num) / (Q20<<8));
- if (Al > 0 && pred >= (1< 0 && pred >= (1<= 0) {
- pred = (int) (((Q11<<7) + num) / (Q11<<8));
- if (Al > 0 && pred >= (1< 0 && pred >= (1<