Trim all trailing whitespace

The `.editorconfig` file in this repo is configured to trim all trailing
whitespace regardless of whether the line is modified.

Trims all trailing whitespace in the repository to make the codebase easier
to work with in editors that respect `.editorconfig`.

`git blame` becomes less useful on these lines but it already isn't very useful.

Commands:

```
find . -type f -name '*.h' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
find . -type f -name '*.c' -exec sed --in-place 's/[[:space:]]\+$//' {} \+
```
This commit is contained in:
Gleb Mazovetskiy 2021-01-03 01:28:45 +00:00 committed by Alibek Omarov
parent 3af742f103
commit 5e0a0765ce
212 changed files with 3055 additions and 3055 deletions

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -48,7 +48,7 @@ BRUSH MODELS
#define SURF_PLANEBACK BIT( 1 ) // plane should be negated #define SURF_PLANEBACK BIT( 1 ) // plane should be negated
#define SURF_DRAWSKY BIT( 2 ) // sky surface #define SURF_DRAWSKY BIT( 2 ) // sky surface
#define SURF_DRAWTURB_QUADS BIT( 3 ) // all subidivided polygons are quads #define SURF_DRAWTURB_QUADS BIT( 3 ) // all subidivided polygons are quads
#define SURF_DRAWTURB BIT( 4 ) // warp surface #define SURF_DRAWTURB BIT( 4 ) // warp surface
#define SURF_DRAWTILED BIT( 5 ) // face without lighmap #define SURF_DRAWTILED BIT( 5 ) // face without lighmap
#define SURF_CONVEYOR BIT( 6 ) // scrolled texture (was SURF_DRAWBACKGROUND) #define SURF_CONVEYOR BIT( 6 ) // scrolled texture (was SURF_DRAWBACKGROUND)
@ -166,7 +166,7 @@ typedef struct
{ {
int id; // must be little endian XASH int id; // must be little endian XASH
int version; int version;
dlump_t lumps[EXTRA_LUMPS]; dlump_t lumps[EXTRA_LUMPS];
} dextrahdr_t; } dextrahdr_t;
typedef struct typedef struct

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -33,7 +33,7 @@ typedef struct
typedef struct typedef struct
{ {
float prevanimtime; float prevanimtime;
float sequencetime; float sequencetime;
byte prevseqblending[2]; byte prevseqblending[2];
vec3_t prevorigin; vec3_t prevorigin;

View File

@ -40,9 +40,9 @@ GNU General Public License for more details.
typedef enum typedef enum
{ {
mod_bad = -1, mod_bad = -1,
mod_brush, mod_brush,
mod_sprite, mod_sprite,
mod_alias, mod_alias,
mod_studio mod_studio
} modtype_t; } modtype_t;
@ -93,7 +93,7 @@ typedef struct texture_s
struct texture_s *alternate_anims; // bmodels in frame 1 use these struct texture_s *alternate_anims; // bmodels in frame 1 use these
unsigned short fb_texturenum; // auto-luma texturenum unsigned short fb_texturenum; // auto-luma texturenum
unsigned short dt_texturenum; // detail-texture binding unsigned short dt_texturenum; // detail-texture binding
unsigned int unused[3]; // reserved unsigned int unused[3]; // reserved
} texture_t; } texture_t;
typedef struct typedef struct
@ -147,7 +147,7 @@ typedef struct mnode_s
// node specific // node specific
mplane_t *plane; mplane_t *plane;
struct mnode_s *children[2]; struct mnode_s *children[2];
#ifdef SUPPORT_BSP2_FORMAT #ifdef SUPPORT_BSP2_FORMAT
int firstsurface; int firstsurface;
int numsurfaces; int numsurfaces;
@ -166,7 +166,7 @@ struct decal_s
decal_t *pnext; // linked list for each surface decal_t *pnext; // linked list for each surface
msurface_t *psurface; // Surface id for persistence / unlinking msurface_t *psurface; // Surface id for persistence / unlinking
float dx; // local texture coordinates float dx; // local texture coordinates
float dy; // float dy; //
float scale; // Pixel scale float scale; // Pixel scale
short texture; // Decal texture short texture; // Decal texture
short flags; // Decal flags FDECAL_* short flags; // Decal flags FDECAL_*
@ -299,7 +299,7 @@ typedef struct model_s
// //
vec3_t mins, maxs; // bounding box at angles '0 0 0' vec3_t mins, maxs; // bounding box at angles '0 0 0'
float radius; float radius;
// brush model // brush model
int firstmodelsurface; int firstmodelsurface;
int nummodelsurfaces; int nummodelsurfaces;
@ -386,7 +386,7 @@ typedef struct player_info_s
int bottomcolor; int bottomcolor;
// last frame rendered // last frame rendered
int renderframe; int renderframe;
// Gait frame estimation // Gait frame estimation
int gaitsequence; int gaitsequence;

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -123,41 +123,41 @@
// entity flags // entity flags
#define EFLAG_SLERP 1 // do studio interpolation of this entity #define EFLAG_SLERP 1 // do studio interpolation of this entity
// //
// temp entity events // temp entity events
// //
#define TE_BEAMPOINTS 0 // beam effect between two points #define TE_BEAMPOINTS 0 // beam effect between two points
// coord coord coord (start position) // coord coord coord (start position)
// coord coord coord (end position) // coord coord coord (end position)
// short (sprite index) // short (sprite index)
// byte (starting frame) // byte (starting frame)
// byte (frame rate in 0.1's) // byte (frame rate in 0.1's)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (line width in 0.1's) // byte (line width in 0.1's)
// byte (noise amplitude in 0.01's) // byte (noise amplitude in 0.01's)
// byte,byte,byte (color) // byte,byte,byte (color)
// byte (brightness) // byte (brightness)
// byte (scroll speed in 0.1's) // byte (scroll speed in 0.1's)
#define TE_BEAMENTPOINT 1 // beam effect between point and entity #define TE_BEAMENTPOINT 1 // beam effect between point and entity
// short (start entity) // short (start entity)
// coord coord coord (end position) // coord coord coord (end position)
// short (sprite index) // short (sprite index)
// byte (starting frame) // byte (starting frame)
// byte (frame rate in 0.1's) // byte (frame rate in 0.1's)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (line width in 0.1's) // byte (line width in 0.1's)
// byte (noise amplitude in 0.01's) // byte (noise amplitude in 0.01's)
// byte,byte,byte (color) // byte,byte,byte (color)
// byte (brightness) // byte (brightness)
// byte (scroll speed in 0.1's) // byte (scroll speed in 0.1's)
#define TE_GUNSHOT 2 // particle effect plus ricochet sound #define TE_GUNSHOT 2 // particle effect plus ricochet sound
// coord coord coord (position) // coord coord coord (position)
#define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps #define TE_EXPLOSION 3 // additive sprite, 2 dynamic lights, flickering particles, explosion sound, move vertically 8 pps
// coord coord coord (position) // coord coord coord (position)
// short (sprite index) // short (sprite index)
// byte (scale in 0.1's) // byte (scale in 0.1's)
// byte (framerate) // byte (framerate)
@ -173,54 +173,54 @@
#define TE_EXPLFLAG_ROTATE 32 // rotate the sprite randomly #define TE_EXPLFLAG_ROTATE 32 // rotate the sprite randomly
#define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound #define TE_TAREXPLOSION 4 // Quake1 "tarbaby" explosion with sound
// coord coord coord (position) // coord coord coord (position)
#define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps #define TE_SMOKE 5 // alphablend sprite, move vertically 30 pps
// coord coord coord (position) // coord coord coord (position)
// short (sprite index) // short (sprite index)
// byte (scale in 0.1's) // byte (scale in 0.1's)
// byte (framerate) // byte (framerate)
#define TE_TRACER 6 // tracer effect from point to point #define TE_TRACER 6 // tracer effect from point to point
// coord, coord, coord (start) // coord, coord, coord (start)
// coord, coord, coord (end) // coord, coord, coord (end)
#define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters #define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters
// coord, coord, coord (start) // coord, coord, coord (start)
// coord, coord, coord (end) // coord, coord, coord (end)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (width in 0.1's) // byte (width in 0.1's)
// byte (amplitude in 0.01's) // byte (amplitude in 0.01's)
// short (sprite model index) // short (sprite model index)
#define TE_BEAMENTS 8 #define TE_BEAMENTS 8
// short (start entity) // short (start entity)
// short (end entity) // short (end entity)
// short (sprite index) // short (sprite index)
// byte (starting frame) // byte (starting frame)
// byte (frame rate in 0.1's) // byte (frame rate in 0.1's)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (line width in 0.1's) // byte (line width in 0.1's)
// byte (noise amplitude in 0.01's) // byte (noise amplitude in 0.01's)
// byte,byte,byte (color) // byte,byte,byte (color)
// byte (brightness) // byte (brightness)
// byte (scroll speed in 0.1's) // byte (scroll speed in 0.1's)
#define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite #define TE_SPARKS 9 // 8 random tracers with gravity, ricochet sprite
// coord coord coord (position) // coord coord coord (position)
#define TE_LAVASPLASH 10 // Quake1 lava splash #define TE_LAVASPLASH 10 // Quake1 lava splash
// coord coord coord (position) // coord coord coord (position)
#define TE_TELEPORT 11 // Quake1 teleport splash #define TE_TELEPORT 11 // Quake1 teleport splash
// coord coord coord (position) // coord coord coord (position)
#define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound #define TE_EXPLOSION2 12 // Quake1 colormaped (base palette) particle explosion with sound
// coord coord coord (position) // coord coord coord (position)
// byte (starting color) // byte (starting color)
// byte (num colors) // byte (num colors)
#define TE_BSPDECAL 13 // Decal from the .BSP file #define TE_BSPDECAL 13 // Decal from the .BSP file
// coord, coord, coord (x,y,z), decal position (center of texture in world) // coord, coord, coord (x,y,z), decal position (center of texture in world)
// short (texture index of precached decal texture name) // short (texture index of precached decal texture name)
// short (entity index) // short (entity index)
@ -230,67 +230,67 @@
// coord, coord, coord (position) // coord, coord, coord (position)
// byte (radius) // byte (radius)
// byte (count) // byte (count)
// byte (life in 0.1's) // byte (life in 0.1's)
#define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions #define TE_SPRITETRAIL 15 // line of moving glow sprites with gravity, fadeout, and collisions
// coord, coord, coord (start) // coord, coord, coord (start)
// coord, coord, coord (end) // coord, coord, coord (end)
// short (sprite index) // short (sprite index)
// byte (count) // byte (count)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (scale in 0.1's) // byte (scale in 0.1's)
// byte (velocity along vector in 10's) // byte (velocity along vector in 10's)
// byte (randomness of velocity in 10's) // byte (randomness of velocity in 10's)
#define TE_BEAM 16 // obsolete #define TE_BEAM 16 // obsolete
#define TE_SPRITE 17 // additive sprite, plays 1 cycle #define TE_SPRITE 17 // additive sprite, plays 1 cycle
// coord, coord, coord (position) // coord, coord, coord (position)
// short (sprite index) // short (sprite index)
// byte (scale in 0.1's) // byte (scale in 0.1's)
// byte (brightness) // byte (brightness)
#define TE_BEAMSPRITE 18 // A beam with a sprite at the end #define TE_BEAMSPRITE 18 // A beam with a sprite at the end
// coord, coord, coord (start position) // coord, coord, coord (start position)
// coord, coord, coord (end position) // coord, coord, coord (end position)
// short (beam sprite index) // short (beam sprite index)
// short (end sprite index) // short (end sprite index)
#define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime #define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime
// coord coord coord (center position) // coord coord coord (center position)
// coord coord coord (axis and radius) // coord coord coord (axis and radius)
// short (sprite index) // short (sprite index)
// byte (starting frame) // byte (starting frame)
// byte (frame rate in 0.1's) // byte (frame rate in 0.1's)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (line width in 0.1's) // byte (line width in 0.1's)
// byte (noise amplitude in 0.01's) // byte (noise amplitude in 0.01's)
// byte,byte,byte (color) // byte,byte,byte (color)
// byte (brightness) // byte (brightness)
// byte (scroll speed in 0.1's) // byte (scroll speed in 0.1's)
#define TE_BEAMDISK 20 // disk that expands to max radius over lifetime #define TE_BEAMDISK 20 // disk that expands to max radius over lifetime
// coord coord coord (center position) // coord coord coord (center position)
// coord coord coord (axis and radius) // coord coord coord (axis and radius)
// short (sprite index) // short (sprite index)
// byte (starting frame) // byte (starting frame)
// byte (frame rate in 0.1's) // byte (frame rate in 0.1's)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (line width in 0.1's) // byte (line width in 0.1's)
// byte (noise amplitude in 0.01's) // byte (noise amplitude in 0.01's)
// byte,byte,byte (color) // byte,byte,byte (color)
// byte (brightness) // byte (brightness)
// byte (scroll speed in 0.1's) // byte (scroll speed in 0.1's)
#define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime #define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime
// coord coord coord (center position) // coord coord coord (center position)
// coord coord coord (axis and radius) // coord coord coord (axis and radius)
// short (sprite index) // short (sprite index)
// byte (starting frame) // byte (starting frame)
// byte (frame rate in 0.1's) // byte (frame rate in 0.1's)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (line width in 0.1's) // byte (line width in 0.1's)
// byte (noise amplitude in 0.01's) // byte (noise amplitude in 0.01's)
// byte,byte,byte (color) // byte,byte,byte (color)
// byte (brightness) // byte (brightness)
// byte (scroll speed in 0.1's) // byte (scroll speed in 0.1's)
@ -298,30 +298,30 @@
#define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving #define TE_BEAMFOLLOW 22 // create a line of decaying beam segments until entity stops moving
// short (entity:attachment to follow) // short (entity:attachment to follow)
// short (sprite index) // short (sprite index)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (line width in 0.1's) // byte (line width in 0.1's)
// byte,byte,byte (color) // byte,byte,byte (color)
// byte (brightness) // byte (brightness)
#define TE_GLOWSPRITE 23 #define TE_GLOWSPRITE 23
// coord, coord, coord (pos) short (model index) byte (scale / 10) // coord, coord, coord (pos) short (model index) byte (scale / 10)
#define TE_BEAMRING 24 // connect a beam ring to two entities #define TE_BEAMRING 24 // connect a beam ring to two entities
// short (start entity) // short (start entity)
// short (end entity) // short (end entity)
// short (sprite index) // short (sprite index)
// byte (starting frame) // byte (starting frame)
// byte (frame rate in 0.1's) // byte (frame rate in 0.1's)
// byte (life in 0.1's) // byte (life in 0.1's)
// byte (line width in 0.1's) // byte (line width in 0.1's)
// byte (noise amplitude in 0.01's) // byte (noise amplitude in 0.01's)
// byte,byte,byte (color) // byte,byte,byte (color)
// byte (brightness) // byte (brightness)
// byte (scroll speed in 0.1's) // byte (scroll speed in 0.1's)
#define TE_STREAK_SPLASH 25 // oriented shower of tracers #define TE_STREAK_SPLASH 25 // oriented shower of tracers
// coord coord coord (start position) // coord coord coord (start position)
// coord coord coord (direction vector) // coord coord coord (direction vector)
// byte (color) // byte (color)
// short (count) // short (count)
// short (base speed) // short (base speed)
@ -330,15 +330,15 @@
#define TE_BEAMHOSE 26 // obsolete #define TE_BEAMHOSE 26 // obsolete
#define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect #define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect
// coord, coord, coord (pos) // coord, coord, coord (pos)
// byte (radius in 10's) // byte (radius in 10's)
// byte byte byte (color) // byte byte byte (color)
// byte (life in 10's) // byte (life in 10's)
// byte (decay rate in 10's) // byte (decay rate in 10's)
#define TE_ELIGHT 28 // point entity light, no world effect #define TE_ELIGHT 28 // point entity light, no world effect
// short (entity:attachment to follow) // short (entity:attachment to follow)
// coord coord coord (initial position) // coord coord coord (initial position)
// coord (radius) // coord (radius)
// byte byte byte (color) // byte byte byte (color)
// byte (life in 0.1's) // byte (life in 0.1's)
@ -374,8 +374,8 @@
#define TE_LARGEFUNNEL 100 #define TE_LARGEFUNNEL 100
// coord coord coord (funnel position) // coord coord coord (funnel position)
// short (sprite index) // short (sprite index)
// short (flags) // short (flags)
#define TE_BLOODSTREAM 101 // particle spray #define TE_BLOODSTREAM 101 // particle spray
// coord coord coord (start position) // coord coord coord (start position)
@ -404,7 +404,7 @@
// byte (density) // byte (density)
#define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits #define TE_MODEL 106 // create a moving model that bounces and makes a sound when it hits
// coord, coord, coord (position) // coord, coord, coord (position)
// coord, coord, coord (velocity) // coord, coord, coord (velocity)
// angle (initial yaw) // angle (initial yaw)
// short (model index) // short (model index)
@ -441,7 +441,7 @@
// byte (speed) // byte (speed)
// byte (noise) // byte (noise)
#define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound. #define TE_ARMOR_RICOCHET 111 // quick spark sprite, client ricochet sound.
// coord, coord, coord (position) // coord, coord, coord (position)
// byte (scale in 0.1's) // byte (scale in 0.1's)
@ -529,7 +529,7 @@
#define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance) #define TEFIRE_FLAG_SOMEFLOAT 2 // some of the sprites will drift upwards. (50% chance)
#define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration. #define TEFIRE_FLAG_LOOP 4 // if set, sprite plays at 15 fps, otherwise plays at whatever rate stretches the animation over the sprite's duration.
#define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque #define TEFIRE_FLAG_ALPHA 8 // if set, sprite is rendered alpha blended at 50% else, opaque
#define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube. #define TEFIRE_FLAG_PLANAR 16 // if set, all fire sprites have same initial Z instead of randomly filling a cube.
#define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered as additive #define TEFIRE_FLAG_ADDITIVE 32 // if set, sprite is rendered as additive
#define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent) #define TE_PLAYERATTACHMENT 124 // attaches a TENT to a player (this is a high-priority tent)
@ -620,7 +620,7 @@
#define CHAN_ITEM 3 #define CHAN_ITEM 3
#define CHAN_BODY 4 #define CHAN_BODY 4
#define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area #define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area
#define CHAN_STATIC 6 // allocate channel from the static area #define CHAN_STATIC 6 // allocate channel from the static area
#define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network #define CHAN_NETWORKVOICE_BASE 7 // voice data coming across the network
#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). #define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
@ -628,7 +628,7 @@
#define ATTN_NONE 0 #define ATTN_NONE 0
#define ATTN_NORM (float)0.8 #define ATTN_NORM (float)0.8
#define ATTN_IDLE (float)2 #define ATTN_IDLE (float)2
#define ATTN_STATIC (float)1.25 #define ATTN_STATIC (float)1.25
// pitch values // pitch values
#define PITCH_NORM 100 // non-pitch shifted #define PITCH_NORM 100 // non-pitch shifted
@ -691,8 +691,8 @@
#define TE_BOUNCE_SHOTSHELL 2 #define TE_BOUNCE_SHOTSHELL 2
// Rendering constants // Rendering constants
enum enum
{ {
kRenderNormal, // src kRenderNormal, // src
kRenderTransColor, // c*a+dest*(1-a) kRenderTransColor, // c*a+dest*(1-a)
kRenderTransTexture, // src*a+dest*(1-a) kRenderTransTexture, // src*a+dest*(1-a)
@ -701,21 +701,21 @@ enum
kRenderTransAdd, // src*a+dest kRenderTransAdd, // src*a+dest
}; };
enum enum
{ {
kRenderFxNone = 0, kRenderFxNone = 0,
kRenderFxPulseSlow, kRenderFxPulseSlow,
kRenderFxPulseFast, kRenderFxPulseFast,
kRenderFxPulseSlowWide, kRenderFxPulseSlowWide,
kRenderFxPulseFastWide, kRenderFxPulseFastWide,
kRenderFxFadeSlow, kRenderFxFadeSlow,
kRenderFxFadeFast, kRenderFxFadeFast,
kRenderFxSolidSlow, kRenderFxSolidSlow,
kRenderFxSolidFast, kRenderFxSolidFast,
kRenderFxStrobeSlow, kRenderFxStrobeSlow,
kRenderFxStrobeFast, kRenderFxStrobeFast,
kRenderFxStrobeFaster, kRenderFxStrobeFaster,
kRenderFxFlickerSlow, kRenderFxFlickerSlow,
kRenderFxFlickerFast, kRenderFxFlickerFast,
kRenderFxNoDissipation, kRenderFxNoDissipation,
kRenderFxDistort, // Distort/scale/translate flicker kRenderFxDistort, // Distort/scale/translate flicker

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -32,7 +32,7 @@
#define FCVAR_CHANGED (1<<13) // set each time the cvar is changed #define FCVAR_CHANGED (1<<13) // set each time the cvar is changed
#define FCVAR_GAMEUIDLL (1<<14) // defined by the menu DLL #define FCVAR_GAMEUIDLL (1<<14) // defined by the menu DLL
#define FCVAR_CHEAT (1<<15) // can not be changed if cheats are disabled #define FCVAR_CHEAT (1<<15) // can not be changed if cheats are disabled
typedef struct cvar_s typedef struct cvar_s
{ {
char *name; char *name;

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -17,7 +17,7 @@ GNU General Public License for more details.
#define FEATURES_H #define FEATURES_H
// list of engine features that can be enabled through callback SV_CheckFeatures // list of engine features that can be enabled through callback SV_CheckFeatures
#define ENGINE_WRITE_LARGE_COORD (1<<0) // replace standard message WRITE_COORD with big message for support more than 8192 units in world #define ENGINE_WRITE_LARGE_COORD (1<<0) // replace standard message WRITE_COORD with big message for support more than 8192 units in world
#define ENGINE_QUAKE_COMPATIBLE (1<<1) // make engine compatible with quake (flags and effects) #define ENGINE_QUAKE_COMPATIBLE (1<<1) // make engine compatible with quake (flags and effects)
#define ENGINE_LOAD_DELUXEDATA (1<<2) // loading deluxemap for map (if present) #define ENGINE_LOAD_DELUXEDATA (1<<2) // loading deluxemap for map (if present)
#define ENGINE_PHYSICS_PUSHER_EXT (1<<3) // enable sets of improvements for MOVETYPE_PUSH physics #define ENGINE_PHYSICS_PUSHER_EXT (1<<3) // enable sets of improvements for MOVETYPE_PUSH physics

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -19,7 +19,7 @@
#define ENTITY_NORMAL (1<<0) #define ENTITY_NORMAL (1<<0)
#define ENTITY_BEAM (1<<1) #define ENTITY_BEAM (1<<1)
// Entity state is used for the baseline and for delta compression of a packet of // Entity state is used for the baseline and for delta compression of a packet of
// entities that is sent to a client. // entities that is sent to a client.
typedef struct entity_state_s entity_state_t; typedef struct entity_state_s entity_state_t;
@ -63,36 +63,36 @@ struct entity_state_s
vec3_t velocity; vec3_t velocity;
// Send bbox down to client for use during prediction. // Send bbox down to client for use during prediction.
vec3_t mins; vec3_t mins;
vec3_t maxs; vec3_t maxs;
int aiment; int aiment;
// If owned by a player, the index of that player ( for projectiles ). // If owned by a player, the index of that player ( for projectiles ).
int owner; int owner;
// Friction, for prediction. // Friction, for prediction.
float friction; float friction;
// Gravity multiplier // Gravity multiplier
float gravity; float gravity;
// PLAYER SPECIFIC // PLAYER SPECIFIC
int team; int team;
int playerclass; int playerclass;
int health; int health;
qboolean spectator; qboolean spectator;
int weaponmodel; int weaponmodel;
int gaitsequence; int gaitsequence;
// If standing on conveyor, e.g. // If standing on conveyor, e.g.
vec3_t basevelocity; vec3_t basevelocity;
// Use the crouched hull, or the regular player hull. // Use the crouched hull, or the regular player hull.
int usehull; int usehull;
// Latched buttons last time state updated. // Latched buttons last time state updated.
int oldbuttons; int oldbuttons;
// -1 = in air, else pmove entity number // -1 = in air, else pmove entity number
int onground; int onground;
int iStepLeft; int iStepLeft;
// How fast we are falling // How fast we are falling
float flFallVelocity; float flFallVelocity;
float fov; float fov;
int weaponanim; int weaponanim;
@ -135,7 +135,7 @@ typedef struct clientdata_s
int bInDuck; int bInDuck;
int weapons; // remove? int weapons; // remove?
int flTimeStepSound; int flTimeStepSound;
int flDuckTime; int flDuckTime;
int flSwimTime; int flSwimTime;
@ -152,7 +152,7 @@ typedef struct clientdata_s
int ammo_cells; int ammo_cells;
int ammo_rockets; int ammo_rockets;
float m_flNextAttack; float m_flNextAttack;
int tfstate; int tfstate;
int pushmsec; int pushmsec;
int deadflag; int deadflag;

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -17,13 +17,13 @@
#define EVENT_FLAGS_H #define EVENT_FLAGS_H
// Skip local host for event send. // Skip local host for event send.
#define FEV_NOTHOST (1<<0) #define FEV_NOTHOST (1<<0)
// Send the event reliably. You must specify the origin and angles and use // Send the event reliably. You must specify the origin and angles and use
// PLAYBACK_EVENT_FULL for this to work correctly on the server for anything // PLAYBACK_EVENT_FULL for this to work correctly on the server for anything
// that depends on the event origin/angles. I.e., the origin/angles are not // that depends on the event origin/angles. I.e., the origin/angles are not
// taken from the invoking edict for reliable events. // taken from the invoking edict for reliable events.
#define FEV_RELIABLE (1<<1) #define FEV_RELIABLE (1<<1)
// Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC
// sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ).

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -23,7 +23,7 @@
// sub commands of svc_hltv: // sub commands of svc_hltv:
#define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands #define HLTV_ACTIVE 0 // tells client that he's an spectator and will get director commands
#define HLTV_STATUS 1 // send status infos about proxy #define HLTV_STATUS 1 // send status infos about proxy
#define HLTV_LISTEN 2 // tell client to listen to a multicast stream #define HLTV_LISTEN 2 // tell client to listen to a multicast stream
// sub commands of svc_director: // sub commands of svc_director:
@ -45,7 +45,7 @@
// HLTV_EVENT event flags // HLTV_EVENT event flags
#define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important) #define DRC_FLAG_PRIO_MASK 0x0F // priorities between 0 and 15 (15 most important)
#define DRC_FLAG_SIDE (1<<4) // #define DRC_FLAG_SIDE (1<<4) //
#define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene #define DRC_FLAG_DRAMATIC (1<<5) // is a dramatic scene
#define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo #define DRC_FLAG_SLOWMOTION (1<<6) // would look good in SloMo
#define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc) #define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc)

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -26,10 +26,10 @@ typedef enum
typedef struct IVoiceTweak_s typedef struct IVoiceTweak_s
{ {
// These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back // These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back
// without sending to the server. // without sending to the server.
int (*StartVoiceTweakMode)( void ); // Returns 0 on error. int (*StartVoiceTweakMode)( void ); // Returns 0 on error.
void (*EndVoiceTweakMode)( void ); void (*EndVoiceTweakMode)( void );
// Get/set control values. // Get/set control values.
void (*SetControlFloat)( VoiceTweakControl iControl, float value ); void (*SetControlFloat)( VoiceTweakControl iControl, float value );
float (*GetControlFloat)( VoiceTweakControl iControl ); float (*GetControlFloat)( VoiceTweakControl iControl );

View File

@ -1,6 +1,6 @@
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
// //
// Purpose: // Purpose:
// //
// $NoKeywords: $ // $NoKeywords: $
//============================================================================= //=============================================================================

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -64,7 +64,7 @@ typedef struct net_response_s
typedef struct net_status_s typedef struct net_status_s
{ {
// Connected to remote server? 1 == yes, 0 otherwise // Connected to remote server? 1 == yes, 0 otherwise
int connected; int connected;
// Client's IP address // Client's IP address
netadr_t local_address; netadr_t local_address;
// Address of remote server // Address of remote server

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -18,7 +18,7 @@
typedef enum typedef enum
{ {
pt_static, pt_static,
pt_grav, pt_grav,
pt_slowgrav, pt_slowgrav,
pt_fire, pt_fire,
@ -45,7 +45,7 @@ typedef struct particle_s
// for pt_clientcusttom, we'll call this function each frame // for pt_clientcusttom, we'll call this function each frame
void (*callback)( struct particle_s *particle, float frametime ); void (*callback)( struct particle_s *particle, float frametime );
// For deathfunc, etc. // For deathfunc, etc.
unsigned char context; unsigned char context;
} particle_t; } particle_t;

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -33,7 +33,7 @@ struct pmtrace_s
vec3_t endpos; // final position vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact pmplane_t plane; // surface normal at impact
int ent; // entity at impact int ent; // entity at impact
vec3_t deltavelocity; // Change in player's velocity caused by impact. vec3_t deltavelocity; // Change in player's velocity caused by impact.
// Only run on server. // Only run on server.
int hitgroup; int hitgroup;
}; };

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -17,7 +17,7 @@
#define R_EFX_H #define R_EFX_H
// particle_t // particle_t
#if !defined( PARTICLEDEFH ) #if !defined( PARTICLEDEFH )
#include "particledef.h" #include "particledef.h"
#endif #endif
@ -75,7 +75,7 @@ color24 gTracerColors[] =
#define FTENT_SPIRAL 0x00000400 #define FTENT_SPIRAL 0x00000400
#define FTENT_SPRCYCLE 0x00000800 #define FTENT_SPRCYCLE 0x00000800
#define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes #define FTENT_COLLIDEALL 0x00001000 // will collide with world and slideboxes
#define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw #define FTENT_PERSIST 0x00002000 // tent is not removed when unable to draw
#define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything #define FTENT_COLLIDEKILL 0x00004000 // tent is removed upon collision with anything
#define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner) #define FTENT_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner)
#define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed #define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed
@ -102,7 +102,7 @@ typedef struct tempent_s
int priority; int priority;
short clientIndex; // if attached, this is the index of the client to stick to short clientIndex; // if attached, this is the index of the client to stick to
// if COLLIDEALL, this is the index of the client to ignore // if COLLIDEALL, this is the index of the client to ignore
// TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex! // TENTS with FTENT_PLYRATTACHMENT MUST set the clientindex!
vec3_t tentOffset; // if attached, client origin + tentOffset = tent origin. vec3_t tentOffset; // if attached, client origin + tentOffset = tent origin.
cl_entity_t entity; cl_entity_t entity;

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -103,7 +103,7 @@ typedef struct engine_studio_api_s
// True if using D3D/OpenGL // True if using D3D/OpenGL
int ( *IsHardware )( void ); int ( *IsHardware )( void );
// Only called by hardware interface // Only called by hardware interface
void ( *GL_StudioDrawShadow )( void ); void ( *GL_StudioDrawShadow )( void );
void ( *GL_SetRenderMode )( int mode ); void ( *GL_SetRenderMode )( int mode );
@ -140,7 +140,7 @@ typedef struct sv_blending_interface_s
{ {
int version; int version;
void ( *SV_StudioSetupBones )( struct model_s *pModel, void ( *SV_StudioSetupBones )( struct model_s *pModel,
float frame, float frame,
int sequence, int sequence,
const vec3_t angles, const vec3_t angles,

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -25,7 +25,7 @@ typedef struct ref_params_s
vec3_t forward; vec3_t forward;
vec3_t right; vec3_t right;
vec3_t up; vec3_t up;
// Client frametime; // Client frametime;
float frametime; float frametime;
// Client time // Client time
@ -54,7 +54,7 @@ typedef struct ref_params_s
int viewentity; int viewentity;
int playernum; int playernum;
int max_entities; int max_entities;
int demoplayback; int demoplayback;
int hardware; int hardware;
int smoothing; int smoothing;

View File

@ -132,7 +132,7 @@ typedef struct modelstate_s
short frame; // 10 bits multiple by 4, should be enough short frame; // 10 bits multiple by 4, should be enough
byte blending[2]; byte blending[2];
byte controller[4]; byte controller[4];
byte poseparam[16]; byte poseparam[16];
byte body; byte body;
byte skin; byte skin;
short scale; // model scale (multiplied by 16) short scale; // model scale (multiplied by 16)
@ -163,7 +163,7 @@ typedef struct render_api_s
int (*RenderGetParm)( int parm, int arg ); // generic int (*RenderGetParm)( int parm, int arg ); // generic
void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale ); void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale );
void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha ); void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha );
lightstyle_t* (*GetLightStyle)( int number ); lightstyle_t* (*GetLightStyle)( int number );
dlight_t* (*GetDynamicLight)( int number ); dlight_t* (*GetDynamicLight)( int number );
dlight_t* (*GetEntityLight)( int number ); dlight_t* (*GetEntityLight)( int number );
byte (*LightToTexGamma)( byte color ); // software gamma support byte (*LightToTexGamma)( byte color ); // software gamma support

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -16,7 +16,7 @@
#ifndef TRIANGLEAPI_H #ifndef TRIANGLEAPI_H
#define TRIANGLEAPI_H #define TRIANGLEAPI_H
typedef enum typedef enum
{ {
TRI_FRONT = 0, TRI_FRONT = 0,
TRI_NONE = 1, TRI_NONE = 1,
@ -47,7 +47,7 @@ typedef struct triangleapi_s
void (*Vertex3fv)( const float *worldPnt ); void (*Vertex3fv)( const float *worldPnt );
void (*Vertex3f)( float x, float y, float z ); void (*Vertex3f)( float x, float y, float z );
void (*Brightness)( float brightness ); void (*Brightness)( float brightness );
void (*CullFace)( TRICULLSTYLE style ); void (*CullFace)( TRICULLSTYLE style );
int (*SpriteTexture)( struct model_s *pSpriteModel, int frame ); int (*SpriteTexture)( struct model_s *pSpriteModel, int frame );
int (*WorldToScreen)( const float *world, float *screen ); // Returns 1 if it's z clipped int (*WorldToScreen)( const float *world, float *screen ); // Returns 1 if it's z clipped
void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b. void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b.

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -13,165 +13,165 @@
* *
****/ ****/
{-0.525731, 0.000000, 0.850651}, {-0.525731, 0.000000, 0.850651},
{-0.442863, 0.238856, 0.864188}, {-0.442863, 0.238856, 0.864188},
{-0.295242, 0.000000, 0.955423}, {-0.295242, 0.000000, 0.955423},
{-0.309017, 0.500000, 0.809017}, {-0.309017, 0.500000, 0.809017},
{-0.162460, 0.262866, 0.951056}, {-0.162460, 0.262866, 0.951056},
{0.000000, 0.000000, 1.000000}, {0.000000, 0.000000, 1.000000},
{0.000000, 0.850651, 0.525731}, {0.000000, 0.850651, 0.525731},
{-0.147621, 0.716567, 0.681718}, {-0.147621, 0.716567, 0.681718},
{0.147621, 0.716567, 0.681718}, {0.147621, 0.716567, 0.681718},
{0.000000, 0.525731, 0.850651}, {0.000000, 0.525731, 0.850651},
{0.309017, 0.500000, 0.809017}, {0.309017, 0.500000, 0.809017},
{0.525731, 0.000000, 0.850651}, {0.525731, 0.000000, 0.850651},
{0.295242, 0.000000, 0.955423}, {0.295242, 0.000000, 0.955423},
{0.442863, 0.238856, 0.864188}, {0.442863, 0.238856, 0.864188},
{0.162460, 0.262866, 0.951056}, {0.162460, 0.262866, 0.951056},
{-0.681718, 0.147621, 0.716567}, {-0.681718, 0.147621, 0.716567},
{-0.809017, 0.309017, 0.500000}, {-0.809017, 0.309017, 0.500000},
{-0.587785, 0.425325, 0.688191}, {-0.587785, 0.425325, 0.688191},
{-0.850651, 0.525731, 0.000000}, {-0.850651, 0.525731, 0.000000},
{-0.864188, 0.442863, 0.238856}, {-0.864188, 0.442863, 0.238856},
{-0.716567, 0.681718, 0.147621}, {-0.716567, 0.681718, 0.147621},
{-0.688191, 0.587785, 0.425325}, {-0.688191, 0.587785, 0.425325},
{-0.500000, 0.809017, 0.309017}, {-0.500000, 0.809017, 0.309017},
{-0.238856, 0.864188, 0.442863}, {-0.238856, 0.864188, 0.442863},
{-0.425325, 0.688191, 0.587785}, {-0.425325, 0.688191, 0.587785},
{-0.716567, 0.681718, -0.147621}, {-0.716567, 0.681718, -0.147621},
{-0.500000, 0.809017, -0.309017}, {-0.500000, 0.809017, -0.309017},
{-0.525731, 0.850651, 0.000000}, {-0.525731, 0.850651, 0.000000},
{0.000000, 0.850651, -0.525731}, {0.000000, 0.850651, -0.525731},
{-0.238856, 0.864188, -0.442863}, {-0.238856, 0.864188, -0.442863},
{0.000000, 0.955423, -0.295242}, {0.000000, 0.955423, -0.295242},
{-0.262866, 0.951056, -0.162460}, {-0.262866, 0.951056, -0.162460},
{0.000000, 1.000000, 0.000000}, {0.000000, 1.000000, 0.000000},
{0.000000, 0.955423, 0.295242}, {0.000000, 0.955423, 0.295242},
{-0.262866, 0.951056, 0.162460}, {-0.262866, 0.951056, 0.162460},
{0.238856, 0.864188, 0.442863}, {0.238856, 0.864188, 0.442863},
{0.262866, 0.951056, 0.162460}, {0.262866, 0.951056, 0.162460},
{0.500000, 0.809017, 0.309017}, {0.500000, 0.809017, 0.309017},
{0.238856, 0.864188, -0.442863}, {0.238856, 0.864188, -0.442863},
{0.262866, 0.951056, -0.162460}, {0.262866, 0.951056, -0.162460},
{0.500000, 0.809017, -0.309017}, {0.500000, 0.809017, -0.309017},
{0.850651, 0.525731, 0.000000}, {0.850651, 0.525731, 0.000000},
{0.716567, 0.681718, 0.147621}, {0.716567, 0.681718, 0.147621},
{0.716567, 0.681718, -0.147621}, {0.716567, 0.681718, -0.147621},
{0.525731, 0.850651, 0.000000}, {0.525731, 0.850651, 0.000000},
{0.425325, 0.688191, 0.587785}, {0.425325, 0.688191, 0.587785},
{0.864188, 0.442863, 0.238856}, {0.864188, 0.442863, 0.238856},
{0.688191, 0.587785, 0.425325}, {0.688191, 0.587785, 0.425325},
{0.809017, 0.309017, 0.500000}, {0.809017, 0.309017, 0.500000},
{0.681718, 0.147621, 0.716567}, {0.681718, 0.147621, 0.716567},
{0.587785, 0.425325, 0.688191}, {0.587785, 0.425325, 0.688191},
{0.955423, 0.295242, 0.000000}, {0.955423, 0.295242, 0.000000},
{1.000000, 0.000000, 0.000000}, {1.000000, 0.000000, 0.000000},
{0.951056, 0.162460, 0.262866}, {0.951056, 0.162460, 0.262866},
{0.850651, -0.525731, 0.000000}, {0.850651, -0.525731, 0.000000},
{0.955423, -0.295242, 0.000000}, {0.955423, -0.295242, 0.000000},
{0.864188, -0.442863, 0.238856}, {0.864188, -0.442863, 0.238856},
{0.951056, -0.162460, 0.262866}, {0.951056, -0.162460, 0.262866},
{0.809017, -0.309017, 0.500000}, {0.809017, -0.309017, 0.500000},
{0.681718, -0.147621, 0.716567}, {0.681718, -0.147621, 0.716567},
{0.850651, 0.000000, 0.525731}, {0.850651, 0.000000, 0.525731},
{0.864188, 0.442863, -0.238856}, {0.864188, 0.442863, -0.238856},
{0.809017, 0.309017, -0.500000}, {0.809017, 0.309017, -0.500000},
{0.951056, 0.162460, -0.262866}, {0.951056, 0.162460, -0.262866},
{0.525731, 0.000000, -0.850651}, {0.525731, 0.000000, -0.850651},
{0.681718, 0.147621, -0.716567}, {0.681718, 0.147621, -0.716567},
{0.681718, -0.147621, -0.716567}, {0.681718, -0.147621, -0.716567},
{0.850651, 0.000000, -0.525731}, {0.850651, 0.000000, -0.525731},
{0.809017, -0.309017, -0.500000}, {0.809017, -0.309017, -0.500000},
{0.864188, -0.442863, -0.238856}, {0.864188, -0.442863, -0.238856},
{0.951056, -0.162460, -0.262866}, {0.951056, -0.162460, -0.262866},
{0.147621, 0.716567, -0.681718}, {0.147621, 0.716567, -0.681718},
{0.309017, 0.500000, -0.809017}, {0.309017, 0.500000, -0.809017},
{0.425325, 0.688191, -0.587785}, {0.425325, 0.688191, -0.587785},
{0.442863, 0.238856, -0.864188}, {0.442863, 0.238856, -0.864188},
{0.587785, 0.425325, -0.688191}, {0.587785, 0.425325, -0.688191},
{0.688191, 0.587785, -0.425325}, {0.688191, 0.587785, -0.425325},
{-0.147621, 0.716567, -0.681718}, {-0.147621, 0.716567, -0.681718},
{-0.309017, 0.500000, -0.809017}, {-0.309017, 0.500000, -0.809017},
{0.000000, 0.525731, -0.850651}, {0.000000, 0.525731, -0.850651},
{-0.525731, 0.000000, -0.850651}, {-0.525731, 0.000000, -0.850651},
{-0.442863, 0.238856, -0.864188}, {-0.442863, 0.238856, -0.864188},
{-0.295242, 0.000000, -0.955423}, {-0.295242, 0.000000, -0.955423},
{-0.162460, 0.262866, -0.951056}, {-0.162460, 0.262866, -0.951056},
{0.000000, 0.000000, -1.000000}, {0.000000, 0.000000, -1.000000},
{0.295242, 0.000000, -0.955423}, {0.295242, 0.000000, -0.955423},
{0.162460, 0.262866, -0.951056}, {0.162460, 0.262866, -0.951056},
{-0.442863, -0.238856, -0.864188}, {-0.442863, -0.238856, -0.864188},
{-0.309017, -0.500000, -0.809017}, {-0.309017, -0.500000, -0.809017},
{-0.162460, -0.262866, -0.951056}, {-0.162460, -0.262866, -0.951056},
{0.000000, -0.850651, -0.525731}, {0.000000, -0.850651, -0.525731},
{-0.147621, -0.716567, -0.681718}, {-0.147621, -0.716567, -0.681718},
{0.147621, -0.716567, -0.681718}, {0.147621, -0.716567, -0.681718},
{0.000000, -0.525731, -0.850651}, {0.000000, -0.525731, -0.850651},
{0.309017, -0.500000, -0.809017}, {0.309017, -0.500000, -0.809017},
{0.442863, -0.238856, -0.864188}, {0.442863, -0.238856, -0.864188},
{0.162460, -0.262866, -0.951056}, {0.162460, -0.262866, -0.951056},
{0.238856, -0.864188, -0.442863}, {0.238856, -0.864188, -0.442863},
{0.500000, -0.809017, -0.309017}, {0.500000, -0.809017, -0.309017},
{0.425325, -0.688191, -0.587785}, {0.425325, -0.688191, -0.587785},
{0.716567, -0.681718, -0.147621}, {0.716567, -0.681718, -0.147621},
{0.688191, -0.587785, -0.425325}, {0.688191, -0.587785, -0.425325},
{0.587785, -0.425325, -0.688191}, {0.587785, -0.425325, -0.688191},
{0.000000, -0.955423, -0.295242}, {0.000000, -0.955423, -0.295242},
{0.000000, -1.000000, 0.000000}, {0.000000, -1.000000, 0.000000},
{0.262866, -0.951056, -0.162460}, {0.262866, -0.951056, -0.162460},
{0.000000, -0.850651, 0.525731}, {0.000000, -0.850651, 0.525731},
{0.000000, -0.955423, 0.295242}, {0.000000, -0.955423, 0.295242},
{0.238856, -0.864188, 0.442863}, {0.238856, -0.864188, 0.442863},
{0.262866, -0.951056, 0.162460}, {0.262866, -0.951056, 0.162460},
{0.500000, -0.809017, 0.309017}, {0.500000, -0.809017, 0.309017},
{0.716567, -0.681718, 0.147621}, {0.716567, -0.681718, 0.147621},
{0.525731, -0.850651, 0.000000}, {0.525731, -0.850651, 0.000000},
{-0.238856, -0.864188, -0.442863}, {-0.238856, -0.864188, -0.442863},
{-0.500000, -0.809017, -0.309017}, {-0.500000, -0.809017, -0.309017},
{-0.262866, -0.951056, -0.162460}, {-0.262866, -0.951056, -0.162460},
{-0.850651, -0.525731, 0.000000}, {-0.850651, -0.525731, 0.000000},
{-0.716567, -0.681718, -0.147621}, {-0.716567, -0.681718, -0.147621},
{-0.716567, -0.681718, 0.147621}, {-0.716567, -0.681718, 0.147621},
{-0.525731, -0.850651, 0.000000}, {-0.525731, -0.850651, 0.000000},
{-0.500000, -0.809017, 0.309017}, {-0.500000, -0.809017, 0.309017},
{-0.238856, -0.864188, 0.442863}, {-0.238856, -0.864188, 0.442863},
{-0.262866, -0.951056, 0.162460}, {-0.262866, -0.951056, 0.162460},
{-0.864188, -0.442863, 0.238856}, {-0.864188, -0.442863, 0.238856},
{-0.809017, -0.309017, 0.500000}, {-0.809017, -0.309017, 0.500000},
{-0.688191, -0.587785, 0.425325}, {-0.688191, -0.587785, 0.425325},
{-0.681718, -0.147621, 0.716567}, {-0.681718, -0.147621, 0.716567},
{-0.442863, -0.238856, 0.864188}, {-0.442863, -0.238856, 0.864188},
{-0.587785, -0.425325, 0.688191}, {-0.587785, -0.425325, 0.688191},
{-0.309017, -0.500000, 0.809017}, {-0.309017, -0.500000, 0.809017},
{-0.147621, -0.716567, 0.681718}, {-0.147621, -0.716567, 0.681718},
{-0.425325, -0.688191, 0.587785}, {-0.425325, -0.688191, 0.587785},
{-0.162460, -0.262866, 0.951056}, {-0.162460, -0.262866, 0.951056},
{0.442863, -0.238856, 0.864188}, {0.442863, -0.238856, 0.864188},
{0.162460, -0.262866, 0.951056}, {0.162460, -0.262866, 0.951056},
{0.309017, -0.500000, 0.809017}, {0.309017, -0.500000, 0.809017},
{0.147621, -0.716567, 0.681718}, {0.147621, -0.716567, 0.681718},
{0.000000, -0.525731, 0.850651}, {0.000000, -0.525731, 0.850651},
{0.425325, -0.688191, 0.587785}, {0.425325, -0.688191, 0.587785},
{0.587785, -0.425325, 0.688191}, {0.587785, -0.425325, 0.688191},
{0.688191, -0.587785, 0.425325}, {0.688191, -0.587785, 0.425325},
{-0.955423, 0.295242, 0.000000}, {-0.955423, 0.295242, 0.000000},
{-0.951056, 0.162460, 0.262866}, {-0.951056, 0.162460, 0.262866},
{-1.000000, 0.000000, 0.000000}, {-1.000000, 0.000000, 0.000000},
{-0.850651, 0.000000, 0.525731}, {-0.850651, 0.000000, 0.525731},
{-0.955423, -0.295242, 0.000000}, {-0.955423, -0.295242, 0.000000},
{-0.951056, -0.162460, 0.262866}, {-0.951056, -0.162460, 0.262866},
{-0.864188, 0.442863, -0.238856}, {-0.864188, 0.442863, -0.238856},
{-0.951056, 0.162460, -0.262866}, {-0.951056, 0.162460, -0.262866},
{-0.809017, 0.309017, -0.500000}, {-0.809017, 0.309017, -0.500000},
{-0.864188, -0.442863, -0.238856}, {-0.864188, -0.442863, -0.238856},
{-0.951056, -0.162460, -0.262866}, {-0.951056, -0.162460, -0.262866},
{-0.809017, -0.309017, -0.500000}, {-0.809017, -0.309017, -0.500000},
{-0.681718, 0.147621, -0.716567}, {-0.681718, 0.147621, -0.716567},
{-0.681718, -0.147621, -0.716567}, {-0.681718, -0.147621, -0.716567},
{-0.850651, 0.000000, -0.525731}, {-0.850651, 0.000000, -0.525731},
{-0.688191, 0.587785, -0.425325}, {-0.688191, 0.587785, -0.425325},
{-0.587785, 0.425325, -0.688191}, {-0.587785, 0.425325, -0.688191},
{-0.425325, 0.688191, -0.587785}, {-0.425325, 0.688191, -0.587785},
{-0.425325, -0.688191, -0.587785}, {-0.425325, -0.688191, -0.587785},
{-0.587785, -0.425325, -0.688191}, {-0.587785, -0.425325, -0.688191},
{-0.688191, -0.587785, -0.425325}, {-0.688191, -0.587785, -0.425325},

View File

@ -1,9 +1,9 @@
/*** /***
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * Copyright (c) 1996-2002, Valve LLC. All rights reserved.
* *
* This product contains software technology licensed from Id * This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved. * All Rights Reserved.
* *
* Use, distribution, and modification of this source code and/or resulting * Use, distribution, and modification of this source code and/or resulting
@ -15,7 +15,7 @@
// //
// cdll_int.h // cdll_int.h
// //
// 4-23-98 // 4-23-98
// JOHN: client dll interface declarations // JOHN: client dll interface declarations
// //
@ -205,11 +205,11 @@ typedef struct cl_enginefuncs_s
const struct model_s* (*GetSpritePointer)( HSPRITE hSprite ); const struct model_s* (*GetSpritePointer)( HSPRITE hSprite );
void (*pfnPlaySoundByNameAtLocation)( char *szSound, float volume, float *origin ); void (*pfnPlaySoundByNameAtLocation)( char *szSound, float volume, float *origin );
unsigned short (*pfnPrecacheEvent)( int type, const char* psz ); unsigned short (*pfnPrecacheEvent)( int type, const char* psz );
void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void (*pfnWeaponAnim)( int iAnim, int body ); void (*pfnWeaponAnim)( int iAnim, int body );
float (*pfnRandomFloat)( float flLow, float flHigh ); float (*pfnRandomFloat)( float flLow, float flHigh );
int (*pfnRandomLong)( int lLow, int lHigh ); int (*pfnRandomLong)( int lLow, int lHigh );
void (*pfnHookEvent)( const char *name, void ( *pfnEvent )( struct event_args_s *args )); void (*pfnHookEvent)( const char *name, void ( *pfnEvent )( struct event_args_s *args ));
@ -229,12 +229,12 @@ typedef struct cl_enginefuncs_s
struct triangleapi_s *pTriAPI; struct triangleapi_s *pTriAPI;
struct efx_api_s *pEfxAPI; struct efx_api_s *pEfxAPI;
struct event_api_s *pEventAPI; struct event_api_s *pEventAPI;
struct demo_api_s *pDemoAPI; struct demo_api_s *pDemoAPI;
struct net_api_s *pNetAPI; struct net_api_s *pNetAPI;
struct IVoiceTweak_s *pVoiceTweak; struct IVoiceTweak_s *pVoiceTweak;
// returns 1 if the client is a spectator only (connected to a proxy), 0 otherwise or 2 if in dev_overview mode // returns 1 if the client is a spectator only (connected to a proxy), 0 otherwise or 2 if in dev_overview mode
int (*IsSpectateOnly)( void ); int (*IsSpectateOnly)( void );
struct model_s *(*LoadMapSprite)( const char *filename ); struct model_s *(*LoadMapSprite)( const char *filename );

View File

@ -91,7 +91,7 @@ static dllfunc_t avifile_funcs[] =
}; };
dll_info_t avifile_dll = { "avifil32.dll", avifile_funcs, false }; dll_info_t avifile_dll = { "avifil32.dll", avifile_funcs, false };
typedef struct movie_state_s typedef struct movie_state_s
{ {
qboolean active; qboolean active;
@ -423,7 +423,7 @@ int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int leng
result = 0; result = 0;
// seek to correct chunk and all that stuff // seek to correct chunk and all that stuff
if( !AVI_SeekPosition( Avi, offset )) if( !AVI_SeekPosition( Avi, offset ))
return 0; // don't continue if we're waiting for the play pointer to catch up return 0; // don't continue if we're waiting for the play pointer to catch up
while( length > 0 ) while( length > 0 )
@ -535,7 +535,7 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audi
Avi->video_stream = Avi->audio_stream = NULL; Avi->video_stream = Avi->audio_stream = NULL;
// open the streams until a stream is not available. // open the streams until a stream is not available.
while( 1 ) while( 1 )
{ {
PAVISTREAM stream = NULL; PAVISTREAM stream = NULL;
@ -585,17 +585,17 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audi
} }
else Avi->audio_bytes_per_sample = Avi->audio_header->nBlockAlign; else Avi->audio_bytes_per_sample = Avi->audio_header->nBlockAlign;
Avi->audio_length *= Avi->audio_bytes_per_sample; Avi->audio_length *= Avi->audio_bytes_per_sample;
} }
else else
{ {
pAVIStreamRelease( stream ); pAVIStreamRelease( stream );
} }
} }
// display error message-stream not found. // display error message-stream not found.
if( Avi->video_stream == NULL ) if( Avi->video_stream == NULL )
{ {
if( Avi->pfile ) // if file is open, close it if( Avi->pfile ) // if file is open, close it
pAVIFileRelease( Avi->pfile ); pAVIFileRelease( Avi->pfile );
if( !Avi->quiet ) if( !Avi->quiet )
Con_DPrintf( S_ERROR "couldn't find a valid video stream.\n" ); Con_DPrintf( S_ERROR "couldn't find a valid video stream.\n" );
@ -613,9 +613,9 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audi
} }
bmih.biSize = sizeof( BITMAPINFOHEADER ); bmih.biSize = sizeof( BITMAPINFOHEADER );
bmih.biPlanes = 1; bmih.biPlanes = 1;
bmih.biBitCount = 32; bmih.biBitCount = 32;
bmih.biCompression = BI_RGB; bmih.biCompression = BI_RGB;
bmih.biWidth = Avi->video_xres; bmih.biWidth = Avi->video_xres;
bmih.biHeight = -Avi->video_yres; // invert height to flip image upside down bmih.biHeight = -Avi->video_yres; // invert height to flip image upside down

View File

@ -127,7 +127,7 @@ void CL_PlayCDTrack_f( void )
for( maxTrack = i = 0; i < MAX_CDTRACKS; i++ ) for( maxTrack = i = 0; i < MAX_CDTRACKS; i++ )
if( COM_CheckStringEmpty( clgame.cdtracks[i] ) ) maxTrack++; if( COM_CheckStringEmpty( clgame.cdtracks[i] ) ) maxTrack++;
Con_Printf( "%u tracks\n", maxTrack ); Con_Printf( "%u tracks\n", maxTrack );
if( track ) if( track )
{ {
@ -140,11 +140,11 @@ void CL_PlayCDTrack_f( void )
else Con_Printf( "%s: unknown command %s\n", Cmd_Argv( 0 ), command ); else Con_Printf( "%s: unknown command %s\n", Cmd_Argv( 0 ), command );
} }
/* /*
================== ==================
CL_ScreenshotGetName CL_ScreenshotGetName
================== ==================
*/ */
qboolean CL_ScreenshotGetName( int lastnum, char *filename ) qboolean CL_ScreenshotGetName( int lastnum, char *filename )
{ {
if( lastnum < 0 || lastnum > 9999 ) if( lastnum < 0 || lastnum > 9999 )
@ -158,11 +158,11 @@ qboolean CL_ScreenshotGetName( int lastnum, char *filename )
return true; return true;
} }
/* /*
================== ==================
CL_SnapshotGetName CL_SnapshotGetName
================== ==================
*/ */
qboolean CL_SnapshotGetName( int lastnum, char *filename ) qboolean CL_SnapshotGetName( int lastnum, char *filename )
{ {
if( lastnum < 0 || lastnum > 9999 ) if( lastnum < 0 || lastnum > 9999 )
@ -177,21 +177,21 @@ qboolean CL_SnapshotGetName( int lastnum, char *filename )
return true; return true;
} }
/* /*
============================================================================== ==============================================================================
SCREEN SHOTS SCREEN SHOTS
============================================================================== ==============================================================================
*/ */
/* /*
================== ==================
CL_ScreenShot_f CL_ScreenShot_f
normal screenshot normal screenshot
================== ==================
*/ */
void CL_ScreenShot_f( void ) void CL_ScreenShot_f( void )
{ {
int i; int i;
string checkname; string checkname;
@ -222,14 +222,14 @@ void CL_ScreenShot_f( void )
cls.envshot_viewsize = 0; cls.envshot_viewsize = 0;
} }
/* /*
================== ==================
CL_SnapShot_f CL_SnapShot_f
save screenshots into root dir save screenshots into root dir
================== ==================
*/ */
void CL_SnapShot_f( void ) void CL_SnapShot_f( void )
{ {
int i; int i;
string checkname; string checkname;
@ -263,12 +263,12 @@ void CL_SnapShot_f( void )
cls.envshot_viewsize = 0; cls.envshot_viewsize = 0;
} }
/* /*
================== ==================
CL_EnvShot_f CL_EnvShot_f
cubemap view cubemap view
================== ==================
*/ */
void CL_EnvShot_f( void ) void CL_EnvShot_f( void )
{ {
@ -284,12 +284,12 @@ void CL_EnvShot_f( void )
cls.envshot_viewsize = 0; cls.envshot_viewsize = 0;
} }
/* /*
================== ==================
CL_SkyShot_f CL_SkyShot_f
skybox view skybox view
================== ==================
*/ */
void CL_SkyShot_f( void ) void CL_SkyShot_f( void )
{ {
@ -305,13 +305,13 @@ void CL_SkyShot_f( void )
cls.envshot_viewsize = 0; cls.envshot_viewsize = 0;
} }
/* /*
================== ==================
CL_LevelShot_f CL_LevelShot_f
splash logo while map is loading splash logo while map is loading
================== ==================
*/ */
void CL_LevelShot_f( void ) void CL_LevelShot_f( void )
{ {
size_t ft1, ft2; size_t ft1, ft2;
@ -345,13 +345,13 @@ void CL_LevelShot_f( void )
else cls.scrshot_action = scrshot_inactive; // disable - not needs else cls.scrshot_action = scrshot_inactive; // disable - not needs
} }
/* /*
================== ==================
CL_SaveShot_f CL_SaveShot_f
mini-pic in loadgame menu mini-pic in loadgame menu
================== ==================
*/ */
void CL_SaveShot_f( void ) void CL_SaveShot_f( void )
{ {
if( Cmd_Argc() < 2 ) if( Cmd_Argc() < 2 )

View File

@ -41,7 +41,7 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
if( pResource->type == t_sound ) if( pResource->type == t_sound )
Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", pResource->szFileName ); Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", pResource->szFileName );
else Q_strncpy( filepath, pResource->szFileName, sizeof( filepath )); else Q_strncpy( filepath, pResource->szFileName, sizeof( filepath ));
if( !COM_IsSafeFileToDownload( filepath )) if( !COM_IsSafeFileToDownload( filepath ))
{ {
Con_Reportf( "refusing to download %s\n", filepath ); Con_Reportf( "refusing to download %s\n", filepath );

View File

@ -97,7 +97,7 @@ typedef struct
typedef struct typedef struct
{ {
oldcmd_t oldcmd[MSG_COUNT]; oldcmd_t oldcmd[MSG_COUNT];
int currentcmd; int currentcmd;
qboolean parsing; qboolean parsing;
} msg_debug_t; } msg_debug_t;
@ -155,7 +155,7 @@ void CL_Parse_RecordCommand( int cmd, int startoffset )
int slot; int slot;
if( cmd == svc_nop ) return; if( cmd == svc_nop ) return;
slot = ( cls_message_debug.currentcmd++ & MSG_MASK ); slot = ( cls_message_debug.currentcmd++ & MSG_MASK );
cls_message_debug.oldcmd[slot].command = cmd; cls_message_debug.oldcmd[slot].command = cmd;
cls_message_debug.oldcmd[slot].starting_offset = startoffset; cls_message_debug.oldcmd[slot].starting_offset = startoffset;
@ -187,7 +187,7 @@ write net_message into buffer.dat for debugging
static void CL_WriteErrorMessage( int current_count, sizebuf_t *msg ) static void CL_WriteErrorMessage( int current_count, sizebuf_t *msg )
{ {
const char *buffer_file = "buffer.dat"; const char *buffer_file = "buffer.dat";
file_t *fp; file_t *fp;
fp = FS_Open( buffer_file, "wb", false ); fp = FS_Open( buffer_file, "wb", false );
if( !fp ) return; if( !fp ) return;

View File

@ -156,7 +156,7 @@ CL_GetDemoRecordClock
write time while demo is recording write time while demo is recording
==================== ====================
*/ */
float CL_GetDemoRecordClock( void ) float CL_GetDemoRecordClock( void )
{ {
return cl.mtime[0]; return cl.mtime[0];
} }
@ -168,7 +168,7 @@ CL_GetDemoPlaybackClock
overwrite host.realtime overwrite host.realtime
==================== ====================
*/ */
float CL_GetDemoPlaybackClock( void ) float CL_GetDemoPlaybackClock( void )
{ {
return host.realtime + host.frametime; return host.realtime + host.frametime;
} }
@ -353,7 +353,7 @@ void CL_WriteDemoHeader( const char *name )
int copysize; int copysize;
int savepos; int savepos;
int curpos; int curpos;
Con_Printf( "recording to %s.\n", name ); Con_Printf( "recording to %s.\n", name );
cls.demofile = FS_Open( name, "wb", false ); cls.demofile = FS_Open( name, "wb", false );
cls.demotime = 0.0; cls.demotime = 0.0;
@ -467,7 +467,7 @@ void CL_StopRecord( void )
demo.header.directory_offset = curpos; demo.header.directory_offset = curpos;
FS_Seek( cls.demofile, 0, SEEK_SET ); FS_Seek( cls.demofile, 0, SEEK_SET );
FS_Write( cls.demofile, &demo.header, sizeof( demo.header )); FS_Write( cls.demofile, &demo.header, sizeof( demo.header ));
FS_Close( cls.demofile ); FS_Close( cls.demofile );
cls.demofile = NULL; cls.demofile = NULL;
cls.demorecording = false; cls.demorecording = false;
@ -726,9 +726,9 @@ qboolean CL_DemoMoveToNextSection( void )
// switch to next section, we got a dem_stop // switch to next section, we got a dem_stop
demo.entry = &demo.directory.entries[demo.entryIndex]; demo.entry = &demo.directory.entries[demo.entryIndex];
// ready to continue reading, reset clock. // ready to continue reading, reset clock.
FS_Seek( cls.demofile, demo.entry->offset, SEEK_SET ); FS_Seek( cls.demofile, demo.entry->offset, SEEK_SET );
// time is now relative to this chunk's clock. // time is now relative to this chunk's clock.
demo.starttime = CL_GetDemoPlaybackClock(); demo.starttime = CL_GetDemoPlaybackClock();
@ -739,7 +739,7 @@ qboolean CL_DemoMoveToNextSection( void )
qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length ) qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length )
{ {
int msglen = 0; int msglen = 0;
Assert( buffer != NULL ); Assert( buffer != NULL );
Assert( length != NULL ); Assert( length != NULL );
@ -795,8 +795,8 @@ qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length )
demoangle_t *a; demoangle_t *a;
*length = 0; // assume we fail *length = 0; // assume we fail
// decide if it is time to grab the next message // decide if it is time to grab the next message
if( cls.signon == SIGNONS ) // allways grab until fully connected if( cls.signon == SIGNONS ) // allways grab until fully connected
{ {
if( cls.timedemo ) if( cls.timedemo )
@ -971,7 +971,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
} }
} while( swallowmessages ); } while( swallowmessages );
// If we are playing back a timedemo, and we've already passed on a // If we are playing back a timedemo, and we've already passed on a
// frame update for this host_frame tag, then we'll just skip this message. // frame update for this host_frame tag, then we'll just skip this message.
if( cls.timedemo && ( tdlastdemoframe == host.framecount )) if( cls.timedemo && ( tdlastdemoframe == host.framecount ))
{ {
@ -993,7 +993,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length )
{ {
// cheat by moving the relative start time forward. // cheat by moving the relative start time forward.
demo.starttime = CL_GetDemoPlaybackClock(); demo.starttime = CL_GetDemoPlaybackClock();
} }
} }
demo.framecount++; demo.framecount++;
@ -1101,9 +1101,9 @@ void CL_FinishTimeDemo( void )
{ {
int frames; int frames;
double time; double time;
cls.timedemo = false; cls.timedemo = false;
// the first frame didn't count // the first frame didn't count
frames = (host.framecount - cls.td_startframe) - 1; frames = (host.framecount - cls.td_startframe) - 1;
time = host.realtime - cls.td_starttime; time = host.realtime - cls.td_starttime;
@ -1151,7 +1151,7 @@ void CL_StopPlayback( void )
} }
else else
{ {
// let game known about demo state // let game known about demo state
Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY ); Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
cls.state = ca_disconnected; cls.state = ca_disconnected;
memset( &cls.serveradr, 0, sizeof( cls.serveradr ) ); memset( &cls.serveradr, 0, sizeof( cls.serveradr ) );
@ -1166,11 +1166,11 @@ void CL_StopPlayback( void )
} }
} }
/* /*
================== ==================
CL_GetDemoComment CL_GetDemoComment
================== ==================
*/ */
int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment ) int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment )
{ {
file_t *demfile; file_t *demfile;
@ -1179,7 +1179,7 @@ int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment )
demoentry_t entry; demoentry_t entry;
float playtime = 0.0f; float playtime = 0.0f;
int i; int i;
if( !comment ) return false; if( !comment ) return false;
demfile = FS_Open( demoname, "rb", false ); demfile = FS_Open( demoname, "rb", false );
@ -1230,7 +1230,7 @@ int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment )
// all done // all done
FS_Close( demfile ); FS_Close( demfile );
return true; return true;
} }
@ -1267,12 +1267,12 @@ qboolean CL_NextDemo( void )
return true; return true;
} }
/* /*
================== ==================
CL_CheckStartupDemos CL_CheckStartupDemos
queue demos loop after movie playing queue demos loop after movie playing
================== ==================
*/ */
void CL_CheckStartupDemos( void ) void CL_CheckStartupDemos( void )
{ {
@ -1297,11 +1297,11 @@ void CL_CheckStartupDemos( void )
CL_NextDemo (); CL_NextDemo ();
} }
/* /*
================== ==================
CL_DemoGetName CL_DemoGetName
================== ==================
*/ */
static void CL_DemoGetName( int lastnum, char *filename ) static void CL_DemoGetName( int lastnum, char *filename )
{ {
if( lastnum < 0 || lastnum > 9999 ) if( lastnum < 0 || lastnum > 9999 )
@ -1387,7 +1387,7 @@ void CL_Record_f( void )
Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname )); Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname ));
Q_strncpy( gameui.globals->demoname, demoname, sizeof( gameui.globals->demoname )); Q_strncpy( gameui.globals->demoname, demoname, sizeof( gameui.globals->demoname ));
CL_WriteDemoHeader( demopath ); CL_WriteDemoHeader( demopath );
} }

View File

@ -43,9 +43,9 @@ Call when removing an object from the world or moving it to another position
void R_RemoveEfrags( cl_entity_t *ent ) void R_RemoveEfrags( cl_entity_t *ent )
{ {
efrag_t *ef, *old, *walk, **prev; efrag_t *ef, *old, *walk, **prev;
ef = ent->efrag; ef = ent->efrag;
while( ef ) while( ef )
{ {
prev = &ef->leaf->efrags; prev = &ef->leaf->efrags;
@ -55,22 +55,22 @@ void R_RemoveEfrags( cl_entity_t *ent )
if( !walk ) break; if( !walk ) break;
if( walk == ef ) if( walk == ef )
{ {
// remove this fragment // remove this fragment
*prev = ef->leafnext; *prev = ef->leafnext;
break; break;
} }
else prev = &walk->leafnext; else prev = &walk->leafnext;
} }
old = ef; old = ef;
ef = ef->entnext; ef = ef->entnext;
// put it on the free list // put it on the free list
old->entnext = clgame.free_efrags; old->entnext = clgame.free_efrags;
clgame.free_efrags = old; clgame.free_efrags = old;
} }
ent->efrag = NULL; ent->efrag = NULL;
} }
/* /*
@ -83,10 +83,10 @@ static void R_SplitEntityOnNode( mnode_t *node )
efrag_t *ef; efrag_t *ef;
mleaf_t *leaf; mleaf_t *leaf;
int sides; int sides;
if( node->contents == CONTENTS_SOLID ) if( node->contents == CONTENTS_SOLID )
return; return;
// add an efrag if the node is a leaf // add an efrag if the node is a leaf
if( node->contents < 0 ) if( node->contents < 0 )
{ {
@ -105,29 +105,29 @@ static void R_SplitEntityOnNode( mnode_t *node )
clgame.free_efrags = ef->entnext; clgame.free_efrags = ef->entnext;
ef->entity = r_addent; ef->entity = r_addent;
// add the entity link // add the entity link
*lastlink = ef; *lastlink = ef;
lastlink = &ef->entnext; lastlink = &ef->entnext;
ef->entnext = NULL; ef->entnext = NULL;
// set the leaf links // set the leaf links
ef->leaf = leaf; ef->leaf = leaf;
ef->leafnext = leaf->efrags; ef->leafnext = leaf->efrags;
leaf->efrags = ef; leaf->efrags = ef;
return; return;
} }
// NODE_MIXED // NODE_MIXED
sides = BOX_ON_PLANE_SIDE( r_emins, r_emaxs, node->plane ); sides = BOX_ON_PLANE_SIDE( r_emins, r_emaxs, node->plane );
if( sides == 3 ) if( sides == 3 )
{ {
// split on this plane // split on this plane
// if this is the first splitter of this bmodel, remember it // if this is the first splitter of this bmodel, remember it
if( !r_pefragtopnode ) r_pefragtopnode = node; if( !r_pefragtopnode ) r_pefragtopnode = node;
} }
// recurse down the contacted sides // recurse down the contacted sides
if( sides & 1 ) R_SplitEntityOnNode( node->children[0] ); if( sides & 1 ) R_SplitEntityOnNode( node->children[0] );
if( sides & 2 ) R_SplitEntityOnNode( node->children[1] ); if( sides & 2 ) R_SplitEntityOnNode( node->children[1] );
@ -143,7 +143,7 @@ void R_AddEfrags( cl_entity_t *ent )
matrix3x4 transform; matrix3x4 transform;
vec3_t outmins, outmaxs; vec3_t outmins, outmaxs;
int i; int i;
if( !ent->model ) if( !ent->model )
return; return;
@ -202,7 +202,7 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount )
ppefrag = &pefrag->leafnext; ppefrag = &pefrag->leafnext;
break; break;
default: default:
break; break;
} }
} }

View File

@ -134,7 +134,7 @@ CL_EventIndex
word CL_EventIndex( const char *name ) word CL_EventIndex( const char *name )
{ {
int i; int i;
if( !COM_CheckString( name )) if( !COM_CheckString( name ))
return 0; return 0;
@ -189,7 +189,7 @@ qboolean CL_FireEvent( event_info_t *ei, int slot )
// get the func pointer // get the func pointer
for( i = 0; i < MAX_EVENTS; i++ ) for( i = 0; i < MAX_EVENTS; i++ )
{ {
ev = clgame.events[i]; ev = clgame.events[i];
if( !ev ) if( !ev )
{ {
@ -209,7 +209,7 @@ qboolean CL_FireEvent( event_info_t *ei, int slot )
name = cl.event_precache[ei->index]; name = cl.event_precache[ei->index];
Con_Reportf( S_ERROR "CL_FireEvent: %s not hooked\n", name ); Con_Reportf( S_ERROR "CL_FireEvent: %s not hooked\n", name );
break; break;
} }
} }
@ -437,7 +437,7 @@ void CL_ParseEvent( sizebuf_t *msg )
args.angles[PITCH] /= -3.0f; args.angles[PITCH] /= -3.0f;
} }
} }
// Place event on queue // Place event on queue
CL_QueueEvent( FEV_SERVER, event_index, delay, &args ); CL_QueueEvent( FEV_SERVER, event_index, delay, &args );
} }
@ -469,7 +469,7 @@ void GAME_EXPORT CL_PlaybackEvent( int flags, const edict_t *pInvoker, word even
if( !CL_EventIndex( cl.event_precache[eventindex] )) if( !CL_EventIndex( cl.event_precache[eventindex] ))
{ {
Con_DPrintf( S_ERROR "CL_PlaybackEvent: event %i was not precached\n", eventindex ); Con_DPrintf( S_ERROR "CL_PlaybackEvent: event %i was not precached\n", eventindex );
return; return;
} }
SetBits( flags, FEV_CLIENT ); // it's a client event SetBits( flags, FEV_CLIENT ); // it's a client event

View File

@ -323,7 +323,7 @@ void CL_ProcessEntityUpdate( cl_entity_t *ent )
} }
// g-cont. it should be done for all the players? // g-cont. it should be done for all the players?
if( ent->player && !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP )) if( ent->player && !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
ent->curstate.angles[PITCH] /= -3.0f; ent->curstate.angles[PITCH] /= -3.0f;
VectorCopy( ent->curstate.origin, ent->origin ); VectorCopy( ent->curstate.origin, ent->origin );
@ -782,7 +782,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
} }
if( subtracted >= CL_UPDATE_MASK ) if( subtracted >= CL_UPDATE_MASK )
{ {
// we can't use this, it is too old // we can't use this, it is too old
Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" ); Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" );
CL_FlushEntityPacket( msg ); CL_FlushEntityPacket( msg );
@ -850,7 +850,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
player = CL_IsPlayerIndex( newnum ); player = CL_IsPlayerIndex( newnum );
while( oldnum < newnum ) while( oldnum < newnum )
{ {
// one or more entities from the old packet are unchanged // one or more entities from the old packet are unchanged
CL_DeltaEntity( msg, newframe, oldnum, oldent, false ); CL_DeltaEntity( msg, newframe, oldnum, oldent, false );
oldindex++; oldindex++;
@ -867,7 +867,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
} }
if( oldnum == newnum ) if( oldnum == newnum )
{ {
// delta from previous state // delta from previous state
bufStart = MSG_GetNumBytesRead( msg ); bufStart = MSG_GetNumBytesRead( msg );
CL_DeltaEntity( msg, newframe, newnum, oldent, true ); CL_DeltaEntity( msg, newframe, newnum, oldent, true );
@ -887,7 +887,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
} }
if( oldnum > newnum ) if( oldnum > newnum )
{ {
// delta from baseline ? // delta from baseline ?
bufStart = MSG_GetNumBytesRead( msg ); bufStart = MSG_GetNumBytesRead( msg );
CL_DeltaEntity( msg, newframe, newnum, NULL, true ); CL_DeltaEntity( msg, newframe, newnum, NULL, true );
@ -898,7 +898,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
// any remaining entities in the old frame are copied over // any remaining entities in the old frame are copied over
while( oldnum != MAX_ENTNUMBER ) while( oldnum != MAX_ENTNUMBER )
{ {
// one or more entities from the old packet are unchanged // one or more entities from the old packet are unchanged
CL_DeltaEntity( msg, newframe, oldnum, oldent, false ); CL_DeltaEntity( msg, newframe, oldnum, oldent, false );
oldindex++; oldindex++;
@ -928,10 +928,10 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
// first update is the final signon stage where we actually receive an entity (i.e., the world at least) // first update is the final signon stage where we actually receive an entity (i.e., the world at least)
if( cls.signon == ( SIGNONS - 1 )) if( cls.signon == ( SIGNONS - 1 ))
{ {
// we are done with signon sequence. // we are done with signon sequence.
cls.signon = SIGNONS; cls.signon = SIGNONS;
// Clear loading plaque. // Clear loading plaque.
CL_SignonReply (); CL_SignonReply ();
} }
@ -1224,7 +1224,7 @@ void CL_LinkPacketEntities( frame_t *frame )
if( ent->model->type == mod_studio ) if( ent->model->type == mod_studio )
{ {
if( interpolate && FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP )) if( interpolate && FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
ref.dllFuncs.R_StudioLerpMovement( ent, cl.time, ent->origin, ent->angles ); ref.dllFuncs.R_StudioLerpMovement( ent, cl.time, ent->origin, ent->angles );
} }
} }

View File

@ -365,7 +365,7 @@ void CL_CenterPrint( const char *text, float y )
length++; length++;
} }
clgame.centerPrint.totalHeight = ( clgame.centerPrint.lines * clgame.scrInfo.iCharHeight ); clgame.centerPrint.totalHeight = ( clgame.centerPrint.lines * clgame.scrInfo.iCharHeight );
clgame.centerPrint.y = CL_AdjustYPos( y, clgame.centerPrint.totalHeight ); clgame.centerPrint.y = CL_AdjustYPos( y, clgame.centerPrint.totalHeight );
} }
@ -503,7 +503,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei
rc = *prc; rc = *prc;
// Sigh! some stupid modmakers set wrong rectangles in hud.txt // Sigh! some stupid modmakers set wrong rectangles in hud.txt
if( rc.left <= 0 || rc.left >= width ) rc.left = 0; if( rc.left <= 0 || rc.left >= width ) rc.left = 0;
if( rc.top <= 0 || rc.top >= height ) rc.top = 0; if( rc.top <= 0 || rc.top >= height ) rc.top = 0;
if( rc.right <= 0 || rc.right > width ) rc.right = width; if( rc.right <= 0 || rc.right > width ) rc.right = width;
@ -563,7 +563,7 @@ void CL_DrawCenterPrint( void )
colorDefault = g_color_table[7]; colorDefault = g_color_table[7];
pText = clgame.centerPrint.message; pText = clgame.centerPrint.message;
Con_DrawCharacterLen( 0, NULL, &charHeight ); Con_DrawCharacterLen( 0, NULL, &charHeight );
for( i = 0; i < clgame.centerPrint.lines; i++ ) for( i = 0; i < clgame.centerPrint.lines; i++ )
{ {
lineLength = 0; lineLength = 0;
@ -612,7 +612,7 @@ void CL_DrawScreenFade( void )
// keep pushing reset time out indefinitely // keep pushing reset time out indefinitely
if( sf->fadeFlags & FFADE_STAYOUT ) if( sf->fadeFlags & FFADE_STAYOUT )
sf->fadeReset = cl.time + 0.1f; sf->fadeReset = cl.time + 0.1f;
if( sf->fadeReset == 0.0f && sf->fadeEnd == 0.0f ) if( sf->fadeReset == 0.0f && sf->fadeEnd == 0.0f )
return; // inactive return; // inactive
@ -652,7 +652,7 @@ void CL_DrawScreenFade( void )
CL_InitTitles CL_InitTitles
parse all messages that declared in titles.txt parse all messages that declared in titles.txt
and hold them into permament memory pool and hold them into permament memory pool
==================== ====================
*/ */
static void CL_InitTitles( const char *filename ) static void CL_InitTitles( const char *filename )
@ -714,7 +714,7 @@ void CL_ParseTextMessage( sizebuf_t *msg )
{ {
channel = msgindex; channel = msgindex;
msgindex = (msgindex + 1) & (MAX_TEXTCHANNELS - 1); msgindex = (msgindex + 1) & (MAX_TEXTCHANNELS - 1);
} }
// grab message channel // grab message channel
text = &cl_textmessage[channel]; text = &cl_textmessage[channel];
@ -739,7 +739,7 @@ void CL_ParseTextMessage( sizebuf_t *msg )
else text->fxtime = 0.0f; else text->fxtime = 0.0f;
// to prevent grab too long messages // to prevent grab too long messages
Q_strncpy( (char *)text->pMessage, MSG_ReadString( msg ), 2048 ); Q_strncpy( (char *)text->pMessage, MSG_ReadString( msg ), 2048 );
CL_HudMessage( text->pName ); CL_HudMessage( text->pName );
} }
@ -784,7 +784,7 @@ void CL_ParseFinaleCutscene( sizebuf_t *msg, int level )
text->fxtime = 0.0f; text->fxtime = 0.0f;
// to prevent grab too long messages // to prevent grab too long messages
Q_strncpy( (char *)text->pMessage, MSG_ReadString( msg ), 2048 ); Q_strncpy( (char *)text->pMessage, MSG_ReadString( msg ), 2048 );
if( *text->pMessage == '\0' ) if( *text->pMessage == '\0' )
return; // no real text return; // no real text
@ -978,7 +978,7 @@ static void CL_DrawLoadingOrPaused( qboolean paused, float percent )
right = (int)ceil( percent * step ); right = (int)ceil( percent * step );
s2 = (float)right / width; s2 = (float)right / width;
width = right; width = right;
ref.dllFuncs.Color4ub( 208, 152, 0, 255 ); ref.dllFuncs.Color4ub( 208, 152, 0, 255 );
ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture ); ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture );
ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, s2, 1, cls.loadingBar ); ref.dllFuncs.R_DrawStretchPic( x, y, width, height, 0, 0, s2, 1, cls.loadingBar );
@ -1047,7 +1047,7 @@ void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize )
Host_Error( "CL_LinkUserMessage: bad message name\n" ); Host_Error( "CL_LinkUserMessage: bad message name\n" );
if( svc_num <= svc_lastmsg ) if( svc_num <= svc_lastmsg )
Host_Error( "CL_LinkUserMessage: tried to hook a system message \"%s\"\n", svc_strings[svc_num] ); Host_Error( "CL_LinkUserMessage: tried to hook a system message \"%s\"\n", svc_strings[svc_num] );
// see if already hooked // see if already hooked
for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ ) for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ )
@ -1062,7 +1062,7 @@ void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize )
} }
} }
if( i == MAX_USER_MESSAGES ) if( i == MAX_USER_MESSAGES )
{ {
Host_Error( "CL_LinkUserMessage: MAX_USER_MESSAGES hit!\n" ); Host_Error( "CL_LinkUserMessage: MAX_USER_MESSAGES hit!\n" );
return; return;
@ -1116,7 +1116,7 @@ void CL_InitEdicts( void )
if(( clgame.maxRemapInfos - 1 ) != clgame.maxEntities ) if(( clgame.maxRemapInfos - 1 ) != clgame.maxEntities )
{ {
CL_ClearAllRemaps (); // purge old remap info CL_ClearAllRemaps (); // purge old remap info
clgame.maxRemapInfos = clgame.maxEntities + 1; clgame.maxRemapInfos = clgame.maxEntities + 1;
clgame.remap_info = (remap_info_t **)Mem_Calloc( clgame.mempool, sizeof( remap_info_t* ) * clgame.maxRemapInfos ); clgame.remap_info = (remap_info_t **)Mem_Calloc( clgame.mempool, sizeof( remap_info_t* ) * clgame.maxRemapInfos );
} }
@ -1277,7 +1277,7 @@ static model_t *CL_LoadSpriteModel( const char *filename, uint type, uint texFla
for( i = 1, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ ) for( i = 1, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ )
if( !mod->name[0] ) break; // this is a valid spot if( !mod->name[0] ) break; // this is a valid spot
if( i == MAX_CLIENT_SPRITES ) if( i == MAX_CLIENT_SPRITES )
{ {
Con_Printf( S_ERROR "MAX_CLIENT_SPRITES limit exceeded (%d)\n", MAX_CLIENT_SPRITES ); Con_Printf( S_ERROR "MAX_CLIENT_SPRITES limit exceeded (%d)\n", MAX_CLIENT_SPRITES );
return NULL; return NULL;
@ -1689,7 +1689,7 @@ static int GAME_EXPORT pfnHookUserMsg( const char *pszName, pfnUserMsgHook pfn )
// ignore blank names or invalid callbacks // ignore blank names or invalid callbacks
if( !pszName || !*pszName || !pfn ) if( !pszName || !*pszName || !pfn )
return 0; return 0;
for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ ) for( i = 0; i < MAX_USER_MESSAGES && clgame.msg[i].name[0]; i++ )
{ {
@ -1698,7 +1698,7 @@ static int GAME_EXPORT pfnHookUserMsg( const char *pszName, pfnUserMsgHook pfn )
return 1; return 1;
} }
if( i == MAX_USER_MESSAGES ) if( i == MAX_USER_MESSAGES )
{ {
Host_Error( "HookUserMsg: MAX_USER_MESSAGES hit!\n" ); Host_Error( "HookUserMsg: MAX_USER_MESSAGES hit!\n" );
return 0; return 0;
@ -1750,7 +1750,7 @@ static int GAME_EXPORT pfnClientCmd( const char *szCmdString )
else else
{ {
// will exec later // will exec later
Q_strncat( host.deferred_cmd, va( "%s\n", szCmdString ), sizeof( host.deferred_cmd )); Q_strncat( host.deferred_cmd, va( "%s\n", szCmdString ), sizeof( host.deferred_cmd ));
} }
return 1; return 1;
@ -1779,7 +1779,7 @@ static void GAME_EXPORT pfnGetPlayerInfo( int ent_num, hud_player_info_t *pinfo
pinfo->thisplayer = ( ent_num == cl.playernum ) ? true : false; pinfo->thisplayer = ( ent_num == cl.playernum ) ? true : false;
pinfo->name = player->name; pinfo->name = player->name;
pinfo->model = player->model; pinfo->model = player->model;
pinfo->spectator = player->spectator; pinfo->spectator = player->spectator;
pinfo->ping = player->ping; pinfo->ping = player->ping;
pinfo->packetloss = player->packet_loss; pinfo->packetloss = player->packet_loss;
pinfo->topcolor = player->topcolor; pinfo->topcolor = player->topcolor;
@ -1876,7 +1876,7 @@ static int GAME_EXPORT pfnDrawCharacter( int x, int y, int number, int r, int g,
============= =============
pfnDrawConsoleString pfnDrawConsoleString
drawing string like a console string drawing string like a console string
============= =============
*/ */
int GAME_EXPORT pfnDrawConsoleString( int x, int y, char *string ) int GAME_EXPORT pfnDrawConsoleString( int x, int y, char *string )
@ -2143,7 +2143,7 @@ void GAME_EXPORT pfnCalcShake( void )
// Sine wave that slowly settles to zero // Sine wave that slowly settles to zero
fraction = fraction * sin( cl.time * freq ); fraction = fraction * sin( cl.time * freq );
// add to view origin // add to view origin
VectorScale( clgame.shake.offset, fraction, clgame.shake.applied_offset ); VectorScale( clgame.shake.offset, fraction, clgame.shake.applied_offset );
@ -2166,7 +2166,7 @@ void GAME_EXPORT pfnApplyShake( float *origin, float *angles, float factor )
if( origin ) VectorMA( origin, factor, clgame.shake.applied_offset, origin ); if( origin ) VectorMA( origin, factor, clgame.shake.applied_offset, origin );
if( angles ) angles[ROLL] += clgame.shake.applied_angle * factor; if( angles ) angles[ROLL] += clgame.shake.applied_angle * factor;
} }
/* /*
============= =============
pfnIsSpectateOnly pfnIsSpectateOnly
@ -2208,7 +2208,7 @@ static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull
int old_usehull; int old_usehull;
old_usehull = clgame.pmove->usehull; old_usehull = clgame.pmove->usehull;
clgame.pmove->usehull = usehull; clgame.pmove->usehull = usehull;
switch( flags ) switch( flags )
{ {
@ -2256,7 +2256,7 @@ static void GAME_EXPORT pfnHookEvent( const char *filename, pfnEventHook pfn )
// ignore blank names // ignore blank names
if( !filename || !*filename ) if( !filename || !*filename )
return; return;
Q_strncpy( name, filename, sizeof( name )); Q_strncpy( name, filename, sizeof( name ));
COM_FixSlashes( name ); COM_FixSlashes( name );
@ -2264,7 +2264,7 @@ static void GAME_EXPORT pfnHookEvent( const char *filename, pfnEventHook pfn )
// find an empty slot // find an empty slot
for( i = 0; i < MAX_EVENTS; i++ ) for( i = 0; i < MAX_EVENTS; i++ )
{ {
ev = clgame.events[i]; ev = clgame.events[i];
if( !ev ) break; if( !ev ) break;
if( !Q_stricmp( name, ev->name ) && ev->func != NULL ) if( !Q_stricmp( name, ev->name ) && ev->func != NULL )
@ -2391,7 +2391,7 @@ pfnLocalPlayerViewheight
*/ */
void GAME_EXPORT pfnLocalPlayerViewheight( float *view_ofs ) void GAME_EXPORT pfnLocalPlayerViewheight( float *view_ofs )
{ {
if( view_ofs ) VectorCopy( cl.viewheight, view_ofs ); if( view_ofs ) VectorCopy( cl.viewheight, view_ofs );
} }
/* /*
@ -2537,7 +2537,7 @@ movevars_t *pfnGetMoveVars( void )
{ {
return &clgame.movevars; return &clgame.movevars;
} }
/* /*
============= =============
pfnStopAllSounds pfnStopAllSounds
@ -3393,8 +3393,8 @@ void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags, double
nr->timeout = nr->timesend + timeout; nr->timeout = nr->timesend + timeout;
nr->pfnFunc = response; nr->pfnFunc = response;
nr->resp.context = context; nr->resp.context = context;
nr->resp.type = request; nr->resp.type = request;
nr->resp.remote_address = *remote_address; nr->resp.remote_address = *remote_address;
nr->flags = flags; nr->flags = flags;
if( request == NETAPI_REQUEST_SERVERLIST ) if( request == NETAPI_REQUEST_SERVERLIST )
@ -3583,7 +3583,7 @@ void GAME_EXPORT Voice_EndVoiceTweakMode( void )
Voice_SetControlFloat Voice_SetControlFloat
================= =================
*/ */
void GAME_EXPORT Voice_SetControlFloat( VoiceTweakControl iControl, float value ) void GAME_EXPORT Voice_SetControlFloat( VoiceTweakControl iControl, float value )
{ {
} }
@ -3604,7 +3604,7 @@ static void GAME_EXPORT VGui_ViewportPaintBackground( int extents[4] )
// stub // stub
} }
// shared between client and server // shared between client and server
triangleapi_t gTriApi; triangleapi_t gTriApi;
static efx_api_t gEfxApi = static efx_api_t gEfxApi =
@ -3752,7 +3752,7 @@ static IVoiceTweak gVoiceApi =
}; };
// engine callbacks // engine callbacks
static cl_enginefunc_t gEngfuncs = static cl_enginefunc_t gEngfuncs =
{ {
pfnSPR_Load, pfnSPR_Load,
pfnSPR_Frames, pfnSPR_Frames,
@ -3970,7 +3970,7 @@ qboolean CL_LoadProgs( const char *name )
// trying to get single export // trying to get single export
if(( GetClientAPI = (void *)COM_GetProcAddress( clgame.hInstance, "GetClientAPI" )) != NULL ) if(( GetClientAPI = (void *)COM_GetProcAddress( clgame.hInstance, "GetClientAPI" )) != NULL )
{ {
Con_Reportf( "CL_LoadProgs: found single callback export\n" ); Con_Reportf( "CL_LoadProgs: found single callback export\n" );
// trying to fill interface now // trying to fill interface now
GetClientAPI( &clgame.dllFuncs ); GetClientAPI( &clgame.dllFuncs );

View File

@ -306,7 +306,7 @@ static void GAME_EXPORT UI_DrawLogo( const char *filename, float x, float y, flo
{ {
string path; string path;
const char *fullpath; const char *fullpath;
// run cinematic if not // run cinematic if not
Q_snprintf( path, sizeof( path ), "media/%s", filename ); Q_snprintf( path, sizeof( path ), "media/%s", filename );
COM_DefaultExtension( path, ".avi" ); COM_DefaultExtension( path, ".avi" );
@ -390,7 +390,7 @@ static void UI_UpdateUserinfo( void )
player->bottomcolor = Q_atoi( Info_ValueForKey( player->userinfo, "bottomcolor" )); player->bottomcolor = Q_atoi( Info_ValueForKey( player->userinfo, "bottomcolor" ));
host.userinfo_changed = false; // we got it host.userinfo_changed = false; // we got it
} }
void Host_Credits( void ) void Host_Credits( void )
{ {
if( !gameui.hInstance ) return; if( !gameui.hInstance ) return;
@ -776,7 +776,7 @@ static void GAME_EXPORT pfnDrawCharacter( int ix, int iy, int iwidth, int iheigh
============= =============
UI_DrawConsoleString UI_DrawConsoleString
drawing string like a console string drawing string like a console string
============= =============
*/ */
static int GAME_EXPORT UI_DrawConsoleString( int x, int y, const char *string ) static int GAME_EXPORT UI_DrawConsoleString( int x, int y, const char *string )
@ -1108,7 +1108,7 @@ static void GAME_EXPORT UI_ShellExecute( const char *path, const char *parms, in
// engine callbacks // engine callbacks
static ui_enginefuncs_t gEngfuncs = static ui_enginefuncs_t gEngfuncs =
{ {
pfnPIC_Load, pfnPIC_Load,
GL_FreeImage, GL_FreeImage,
@ -1149,7 +1149,7 @@ static ui_enginefuncs_t gEngfuncs =
Con_DefaultColor, Con_DefaultColor,
pfnGetPlayerModel, pfnGetPlayerModel,
pfnSetPlayerModel, pfnSetPlayerModel,
pfnClearScene, pfnClearScene,
pfnRenderScene, pfnRenderScene,
pfnAddEntity, pfnAddEntity,
Host_Error, Host_Error,

View File

@ -184,17 +184,17 @@ void CL_CheckClientState( void )
{ {
// first update is the pre-final signon stage // first update is the pre-final signon stage
if(( cls.state == ca_connected || cls.state == ca_validate ) && ( cls.signon == SIGNONS )) if(( cls.state == ca_connected || cls.state == ca_validate ) && ( cls.signon == SIGNONS ))
{ {
cls.state = ca_active; cls.state = ca_active;
cls.changelevel = false; // changelevel is done cls.changelevel = false; // changelevel is done
cls.changedemo = false; // changedemo is done cls.changedemo = false; // changedemo is done
cl.first_frame = true; // first rendering frame cl.first_frame = true; // first rendering frame
SCR_MakeLevelShot(); // make levelshot if needs SCR_MakeLevelShot(); // make levelshot if needs
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
Netchan_ReportFlow( &cls.netchan ); Netchan_ReportFlow( &cls.netchan );
Con_DPrintf( "client connected at %.2f sec\n", Sys_DoubleTime() - cls.timestart ); Con_DPrintf( "client connected at %.2f sec\n", Sys_DoubleTime() - cls.timestart );
if(( cls.demoplayback || cls.disable_servercount != cl.servercount ) && cl.video_prepped ) if(( cls.demoplayback || cls.disable_servercount != cl.servercount ) && cl.video_prepped )
SCR_EndLoadingPlaque(); // get rid of loading plaque SCR_EndLoadingPlaque(); // get rid of loading plaque
} }
@ -254,7 +254,7 @@ static float CL_LerpPoint( void )
float f, frac = 1.0f; float f, frac = 1.0f;
f = cl_serverframetime(); f = cl_serverframetime();
if( f == 0.0f || cls.timedemo ) if( f == 0.0f || cls.timedemo )
{ {
cl.time = cl.mtime[0]; cl.time = cl.mtime[0];
@ -262,7 +262,7 @@ static float CL_LerpPoint( void )
} }
if( f > 0.1f ) if( f > 0.1f )
{ {
// dropped packet, or start of demo // dropped packet, or start of demo
cl.mtime[1] = cl.mtime[0] - 0.1f; cl.mtime[1] = cl.mtime[0] - 0.1f;
f = 0.1f; f = 0.1f;
@ -372,7 +372,7 @@ void CL_ComputeClientInterpolationAmount( usercmd_t *cmd )
} }
if( forced ) Cvar_SetValue( "ex_interp", (float)interpolation_msec * 0.001f ); if( forced ) Cvar_SetValue( "ex_interp", (float)interpolation_msec * 0.001f );
interpolation_msec = bound( min_interp, interpolation_msec, max_interp ); interpolation_msec = bound( min_interp, interpolation_msec, max_interp );
cmd->lerp_msec = CL_DriftInterpolationAmount( interpolation_msec ); cmd->lerp_msec = CL_DriftInterpolationAmount( interpolation_msec );
} }
@ -637,7 +637,7 @@ void CL_CreateCmd( void )
CL_SetSolidPlayers( cl.playernum ); CL_SetSolidPlayers( cl.playernum );
// message we are constructing. // message we are constructing.
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK; i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
pcmd = &cl.commands[i]; pcmd = &cl.commands[i];
pcmd->processedfuncs = false; pcmd->processedfuncs = false;
@ -723,7 +723,7 @@ void CL_WritePacket( void )
int numcmds; int numcmds;
int newcmds; int newcmds;
int cmdnumber; int cmdnumber;
// don't send anything if playing back a demo // don't send anything if playing back a demo
if( cls.demoplayback || cls.state < ca_connected || cls.state == ca_cinematic ) if( cls.demoplayback || cls.state < ca_connected || cls.state == ca_cinematic )
return; return;
@ -778,7 +778,7 @@ void CL_WritePacket( void )
if( send_command ) if( send_command )
{ {
int outgoing_sequence; int outgoing_sequence;
if( cl_cmdrate->value > 0 ) // clamped between 10 and 100 fps if( cl_cmdrate->value > 0 ) // clamped between 10 and 100 fps
cls.nextcmdtime = host.realtime + bound( 0.1f, ( 1.0f / cl_cmdrate->value ), 0.01f ); cls.nextcmdtime = host.realtime + bound( 0.1f, ( 1.0f / cl_cmdrate->value ), 0.01f );
else cls.nextcmdtime = host.realtime; // always able to send right away else cls.nextcmdtime = host.realtime; // always able to send right away
@ -809,7 +809,7 @@ void CL_WritePacket( void )
// put an upper/lower bound on this // put an upper/lower bound on this
newcmds = bound( 0, newcmds, cls.legacymode?MAX_LEGACY_TOTAL_CMDS:MAX_TOTAL_CMDS ); newcmds = bound( 0, newcmds, cls.legacymode?MAX_LEGACY_TOTAL_CMDS:MAX_TOTAL_CMDS );
if( cls.state == ca_connected ) newcmds = 0; if( cls.state == ca_connected ) newcmds = 0;
MSG_WriteByte( &buf, newcmds ); MSG_WriteByte( &buf, newcmds );
numcmds = newcmds + numbackup; numcmds = newcmds + numbackup;
@ -833,7 +833,7 @@ void CL_WritePacket( void )
// message we are constructing. // message we are constructing.
i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK; i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK;
// determine if we need to ask for a new set of delta's. // determine if we need to ask for a new set of delta's.
if( cl.validsequence && (cls.state == ca_active) && !( cls.demorecording && cls.demowaiting )) if( cl.validsequence && (cls.state == ca_active) && !( cls.demorecording && cls.demowaiting ))
{ {
@ -1240,7 +1240,7 @@ void CL_Connect_f( void )
else if( Cmd_Argc() != 2 ) else if( Cmd_Argc() != 2 )
{ {
Con_Printf( S_USAGE "connect <server>\n" ); Con_Printf( S_USAGE "connect <server>\n" );
return; return;
} }
Q_strncpy( server, Cmd_Argv( 1 ), sizeof( server )); Q_strncpy( server, Cmd_Argv( 1 ), sizeof( server ));
@ -1319,7 +1319,7 @@ void CL_Rcon_f( void )
NET_StringToAdr( rcon_address->string, &to ); NET_StringToAdr( rcon_address->string, &to );
if( to.port == 0 ) to.port = MSG_BigShort( PORT_SERVER ); if( to.port == 0 ) to.port = MSG_BigShort( PORT_SERVER );
} }
NET_SendPacket( NS_CLIENT, Q_strlen( message ) + 1, message, to ); NET_SendPacket( NS_CLIENT, Q_strlen( message ) + 1, message, to );
} }
@ -1893,7 +1893,7 @@ void CL_ConnectionlessPacket( netadr_t from, sizebuf_t *msg )
int len = sizeof( buf ); int len = sizeof( buf );
int dataoffset = 0; int dataoffset = 0;
netadr_t servadr; netadr_t servadr;
MSG_Clear( msg ); MSG_Clear( msg );
MSG_ReadLong( msg ); // skip the -1 MSG_ReadLong( msg ); // skip the -1
@ -2218,7 +2218,7 @@ void CL_ReadNetMessage( void )
continue; continue;
} }
// can't be a valid sequenced packet // can't be a valid sequenced packet
if( cls.state < ca_connected ) continue; if( cls.state < ca_connected ) continue;
if( !cls.demoplayback && MSG_GetMaxBytes( &net_message ) < 8 ) if( !cls.demoplayback && MSG_GetMaxBytes( &net_message ) < 8 )
@ -2257,7 +2257,7 @@ void CL_ReadNetMessage( void )
MSG_Init( &net_message, "ServerData", net_message_buffer, curSize ); MSG_Init( &net_message, "ServerData", net_message_buffer, curSize );
CL_ParseServerMessage( &net_message, false ); CL_ParseServerMessage( &net_message, false );
} }
if( Netchan_CopyFileFragments( &cls.netchan, &net_message )) if( Netchan_CopyFileFragments( &cls.netchan, &net_message ))
{ {
// remove from resource request stuff. // remove from resource request stuff.
@ -2333,7 +2333,7 @@ void CL_ReadPackets( void )
return; return;
} }
} }
} }
/* /*
@ -2672,7 +2672,7 @@ qboolean CL_PrecacheResources( void )
} }
else else
{ {
Q_strncpy( cl.sound_precache[pRes->nIndex], pRes->szFileName, sizeof( cl.sound_precache[0] )); Q_strncpy( cl.sound_precache[pRes->nIndex], pRes->szFileName, sizeof( cl.sound_precache[0] ));
cl.sound_index[pRes->nIndex] = S_RegisterSound( pRes->szFileName ); cl.sound_index[pRes->nIndex] = S_RegisterSound( pRes->szFileName );
if( !cl.sound_index[pRes->nIndex] ) if( !cl.sound_index[pRes->nIndex] )
@ -2814,7 +2814,7 @@ void CL_InitLocal( void )
cl_nodelta = Cvar_Get ("cl_nodelta", "0", 0, "disable delta-compression for server messages" ); cl_nodelta = Cvar_Get ("cl_nodelta", "0", 0, "disable delta-compression for server messages" );
cl_idealpitchscale = Cvar_Get( "cl_idealpitchscale", "0.8", 0, "how much to look up/down slopes and stairs when not using freelook" ); cl_idealpitchscale = Cvar_Get( "cl_idealpitchscale", "0.8", 0, "how much to look up/down slopes and stairs when not using freelook" );
cl_solid_players = Cvar_Get( "cl_solid_players", "1", 0, "Make all players not solid (can't traceline them)" ); cl_solid_players = Cvar_Get( "cl_solid_players", "1", 0, "Make all players not solid (can't traceline them)" );
cl_interp = Cvar_Get( "ex_interp", "0.1", FCVAR_ARCHIVE, "Interpolate object positions starting this many seconds in past" ); cl_interp = Cvar_Get( "ex_interp", "0.1", FCVAR_ARCHIVE, "Interpolate object positions starting this many seconds in past" );
cl_timeout = Cvar_Get( "cl_timeout", "60", 0, "connect timeout (in-seconds)" ); cl_timeout = Cvar_Get( "cl_timeout", "60", 0, "connect timeout (in-seconds)" );
cl_charset = Cvar_Get( "cl_charset", "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" ); cl_charset = Cvar_Get( "cl_charset", "utf-8", FCVAR_ARCHIVE, "1-byte charset to use (iconv style)" );
hud_utf8 = Cvar_Get( "hud_utf8", "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" ); hud_utf8 = Cvar_Get( "hud_utf8", "0", FCVAR_ARCHIVE, "Use utf-8 encoding for hud text" );
@ -2874,7 +2874,7 @@ void CL_InitLocal( void )
Cmd_AddCommand ("god", NULL, "enable godmode" ); Cmd_AddCommand ("god", NULL, "enable godmode" );
Cmd_AddCommand ("fov", NULL, "set client field of view" ); Cmd_AddCommand ("fov", NULL, "set client field of view" );
Cmd_AddCommand ("log", NULL, "logging server events" ); Cmd_AddCommand ("log", NULL, "logging server events" );
// register our commands // register our commands
Cmd_AddCommand ("pause", NULL, "pause the game (if the server allows pausing)" ); Cmd_AddCommand ("pause", NULL, "pause the game (if the server allows pausing)" );
Cmd_AddCommand ("localservers", CL_LocalServers_f, "collect info about local servers" ); Cmd_AddCommand ("localservers", CL_LocalServers_f, "collect info about local servers" );
@ -2901,7 +2901,7 @@ void CL_InitLocal( void )
Cmd_AddCommand ("linefile", CL_ReadLineFile_f, "show leaks on a map (if present of course)" ); Cmd_AddCommand ("linefile", CL_ReadLineFile_f, "show leaks on a map (if present of course)" );
Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "sent by server when serverinfo changes" ); Cmd_AddCommand ("fullserverinfo", CL_FullServerinfo_f, "sent by server when serverinfo changes" );
Cmd_AddCommand ("upload", CL_BeginUpload_f, "uploading file to the server" ); Cmd_AddCommand ("upload", CL_BeginUpload_f, "uploading file to the server" );
Cmd_AddCommand ("quit", CL_Quit_f, "quit from game" ); Cmd_AddCommand ("quit", CL_Quit_f, "quit from game" );
Cmd_AddCommand ("exit", CL_Quit_f, "quit from game" ); Cmd_AddCommand ("exit", CL_Quit_f, "quit from game" );

View File

@ -116,33 +116,33 @@ void NetGraph_InitColors( void )
byte mincolor[2][3]; byte mincolor[2][3];
byte maxcolor[2][3]; byte maxcolor[2][3];
float dc[2][3]; float dc[2][3];
int i, hfrac; int i, hfrac;
float f; float f;
mincolor[0][0] = 63; mincolor[0][0] = 63;
mincolor[0][1] = 0; mincolor[0][1] = 0;
mincolor[0][2] = 100; mincolor[0][2] = 100;
maxcolor[0][0] = 0; maxcolor[0][0] = 0;
maxcolor[0][1] = 63; maxcolor[0][1] = 63;
maxcolor[0][2] = 255; maxcolor[0][2] = 255;
mincolor[1][0] = 255; mincolor[1][0] = 255;
mincolor[1][1] = 127; mincolor[1][1] = 127;
mincolor[1][2] = 0; mincolor[1][2] = 0;
maxcolor[1][0] = 250; maxcolor[1][0] = 250;
maxcolor[1][1] = 0; maxcolor[1][1] = 0;
maxcolor[1][2] = 0; maxcolor[1][2] = 0;
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
{ {
dc[0][i] = (float)(maxcolor[0][i] - mincolor[0][i]); dc[0][i] = (float)(maxcolor[0][i] - mincolor[0][i]);
dc[1][i] = (float)(maxcolor[1][i] - mincolor[1][i]); dc[1][i] = (float)(maxcolor[1][i] - mincolor[1][i]);
} }
hfrac = NETGRAPH_LERP_HEIGHT / 3; hfrac = NETGRAPH_LERP_HEIGHT / 3;
for( i = 0; i < NETGRAPH_LERP_HEIGHT; i++ ) for( i = 0; i < NETGRAPH_LERP_HEIGHT; i++ )
{ {
if( i < hfrac ) if( i < hfrac )

View File

@ -61,7 +61,7 @@ void CL_ParseSoundPacket( sizebuf_t *msg )
{ {
vec3_t pos; vec3_t pos;
int chan, sound; int chan, sound;
float volume, attn; float volume, attn;
int flags, pitch, entnum; int flags, pitch, entnum;
sound_t handle = 0; sound_t handle = 0;
@ -75,14 +75,14 @@ void CL_ParseSoundPacket( sizebuf_t *msg )
if( FBitSet( flags, SND_ATTENUATION )) if( FBitSet( flags, SND_ATTENUATION ))
attn = (float)MSG_ReadByte( msg ) / 64.0f; attn = (float)MSG_ReadByte( msg ) / 64.0f;
else attn = ATTN_NONE; else attn = ATTN_NONE;
if( FBitSet( flags, SND_PITCH )) if( FBitSet( flags, SND_PITCH ))
pitch = MSG_ReadByte( msg ); pitch = MSG_ReadByte( msg );
else pitch = PITCH_NORM; else pitch = PITCH_NORM;
// entity reletive // entity reletive
entnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS ); entnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
// positioned in space // positioned in space
MSG_ReadVec3Coord( msg, pos ); MSG_ReadVec3Coord( msg, pos );
@ -123,7 +123,7 @@ void CL_ParseRestoreSoundPacket( sizebuf_t *msg )
{ {
vec3_t pos; vec3_t pos;
int chan, sound; int chan, sound;
float volume, attn; float volume, attn;
int flags, pitch, entnum; int flags, pitch, entnum;
double samplePos, forcedEnd; double samplePos, forcedEnd;
int wordIndex; int wordIndex;
@ -139,7 +139,7 @@ void CL_ParseRestoreSoundPacket( sizebuf_t *msg )
if( flags & SND_ATTENUATION ) if( flags & SND_ATTENUATION )
attn = (float)MSG_ReadByte( msg ) / 64.0f; attn = (float)MSG_ReadByte( msg ) / 64.0f;
else attn = ATTN_NONE; else attn = ATTN_NONE;
if( flags & SND_PITCH ) if( flags & SND_PITCH )
pitch = MSG_ReadByte( msg ); pitch = MSG_ReadByte( msg );
@ -269,8 +269,8 @@ void CL_ParseParticles( sizebuf_t *msg )
vec3_t org, dir; vec3_t org, dir;
int i, count, color; int i, count, color;
float life; float life;
MSG_ReadVec3Coord( msg, org ); MSG_ReadVec3Coord( msg, org );
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
dir[i] = MSG_ReadChar( msg ) * 0.0625f; dir[i] = MSG_ReadChar( msg ) * 0.0625f;
@ -907,7 +907,7 @@ void CL_ParseServerData( sizebuf_t *msg )
} }
// multiplayer game? // multiplayer game?
if( cl.maxclients > 1 ) if( cl.maxclients > 1 )
{ {
// allow console in multiplayer games // allow console in multiplayer games
host.allow_console = true; host.allow_console = true;
@ -933,7 +933,7 @@ void CL_ParseServerData( sizebuf_t *msg )
Cvar_FullSet( "cl_background", "1", FCVAR_READ_ONLY ); Cvar_FullSet( "cl_background", "1", FCVAR_READ_ONLY );
else Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY ); else Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY );
if( !cls.changelevel ) if( !cls.changelevel )
{ {
// continue playing if we are changing level // continue playing if we are changing level
S_StopBackgroundTrack (); S_StopBackgroundTrack ();
@ -964,7 +964,7 @@ void CL_ParseServerData( sizebuf_t *msg )
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background ) if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
{ {
if( !FS_FileExists( va( "%s.bmp", cl_levelshot_name->string ), true )) if( !FS_FileExists( va( "%s.bmp", cl_levelshot_name->string ), true ))
Cvar_Set( "cl_levelshot_name", "*black" ); // render a black screen Cvar_Set( "cl_levelshot_name", "*black" ); // render a black screen
cls.scrshot_request = scrshot_plaque; // request levelshot even if exist (check filetime) cls.scrshot_request = scrshot_plaque; // request levelshot even if exist (check filetime)
} }
@ -1024,7 +1024,7 @@ void CL_ParseClientData( sizebuf_t *msg )
frame = &cl.frames[cl.parsecountmod]; // frame at index. frame = &cl.frames[cl.parsecountmod]; // frame at index.
frame->time = cl.mtime[0]; // mark network received time frame->time = cl.mtime[0]; // mark network received time
frame->receivedtime = host.realtime; // time now that we are parsing. frame->receivedtime = host.realtime; // time now that we are parsing.
memset( &frame->graphdata, 0, sizeof( netbandwidthgraph_t )); memset( &frame->graphdata, 0, sizeof( netbandwidthgraph_t ));
@ -1032,7 +1032,7 @@ void CL_ParseClientData( sizebuf_t *msg )
parsecounttime = cl.commands[command_ack & CL_UPDATE_MASK].senttime; parsecounttime = cl.commands[command_ack & CL_UPDATE_MASK].senttime;
// current time that we got a response to the command packet. // current time that we got a response to the command packet.
cl.commands[command_ack & CL_UPDATE_MASK].receivedtime = host.realtime; cl.commands[command_ack & CL_UPDATE_MASK].receivedtime = host.realtime;
if( cl.last_command_ack != -1 ) if( cl.last_command_ack != -1 )
{ {
@ -1088,8 +1088,8 @@ void CL_ParseClientData( sizebuf_t *msg )
// otherwise, move in 1 ms steps toward observed channel latency. // otherwise, move in 1 ms steps toward observed channel latency.
if( latency < cls.latency ) if( latency < cls.latency )
cls.latency = latency; cls.latency = latency;
else cls.latency += 0.001f; // drift up, so corrections are needed else cls.latency += 0.001f; // drift up, so corrections are needed
} }
} }
else else
{ {
@ -1101,7 +1101,7 @@ void CL_ParseClientData( sizebuf_t *msg )
{ {
cl.local.health = 1; cl.local.health = 1;
return; return;
} }
to_cd = &frame->clientdata; to_cd = &frame->clientdata;
to_wd = frame->weapondata; to_wd = frame->weapondata;
@ -1228,13 +1228,13 @@ void CL_ParseAddAngle( sizebuf_t *msg )
{ {
pred_viewangle_t *a; pred_viewangle_t *a;
float delta_yaw; float delta_yaw;
delta_yaw = MSG_ReadBitAngle( msg, 16 ); delta_yaw = MSG_ReadBitAngle( msg, 16 );
#if 0 #if 0
cl.viewangles[YAW] += delta_yaw; cl.viewangles[YAW] += delta_yaw;
return; return;
#endif #endif
// update running counter // update running counter
cl.addangletotal += delta_yaw; cl.addangletotal += delta_yaw;
// select entry into circular buffer // select entry into circular buffer
@ -1298,7 +1298,7 @@ void CL_RegisterUserMessage( sizebuf_t *msg )
{ {
char *pszName; char *pszName;
int svc_num, size, bits; int svc_num, size, bits;
svc_num = MSG_ReadByte( msg ); svc_num = MSG_ReadByte( msg );
if( cls.legacymode ) if( cls.legacymode )
@ -1452,7 +1452,7 @@ void CL_UpdateUserPings( sizebuf_t *msg )
{ {
int i, slot; int i, slot;
player_info_t *player; player_info_t *player;
for( i = 0; i < MAX_CLIENTS; i++ ) for( i = 0; i < MAX_CLIENTS; i++ )
{ {
if( !MSG_ReadOneBit( msg )) break; // end of message if( !MSG_ReadOneBit( msg )) break; // end of message
@ -1918,7 +1918,7 @@ void CL_ParseCvarValue2( sizebuf_t *msg )
if( cvar->value != Q_atof( cvar->string )) if( cvar->value != Q_atof( cvar->string ))
MSG_WriteString( &cls.netchan.message, va( "%s (%g)", cvar->string, cvar->value )); MSG_WriteString( &cls.netchan.message, va( "%s (%g)", cvar->string, cvar->value ));
else MSG_WriteString( &cls.netchan.message, cvar->string ); else MSG_WriteString( &cls.netchan.message, cvar->string );
} }
else else
{ {
MSG_WriteString( &cls.netchan.message, "Not Found" ); MSG_WriteString( &cls.netchan.message, "Not Found" );
@ -2081,7 +2081,7 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
// assume no entity/player update this packet // assume no entity/player update this packet
if( cls.state == ca_active ) if( cls.state == ca_active )
{ {
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].valid = false; cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].valid = false;
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = false; cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = false;
} }
else else
@ -2089,7 +2089,7 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
CL_ResetFrame( &cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK] ); CL_ResetFrame( &cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK] );
} }
} }
// parse the message // parse the message
while( 1 ) while( 1 )
{ {
@ -2104,7 +2104,7 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message )
// end of message (align bits) // end of message (align bits)
if( MSG_GetNumBitsLeft( msg ) < 8 ) if( MSG_GetNumBitsLeft( msg ) < 8 )
break; break;
cmd = MSG_ReadServerCmd( msg ); cmd = MSG_ReadServerCmd( msg );

View File

@ -159,7 +159,7 @@ void CL_SetIdealPitch( void )
top[0] = cl.simorg[0] + cosval * (i + 3.0f) * 12.0f; top[0] = cl.simorg[0] + cosval * (i + 3.0f) * 12.0f;
top[1] = cl.simorg[1] + sinval * (i + 3.0f) * 12.0f; top[1] = cl.simorg[1] + sinval * (i + 3.0f) * 12.0f;
top[2] = cl.simorg[2] + cl.viewheight[2]; top[2] = cl.simorg[2] + cl.viewheight[2];
bottom[0] = top[0]; bottom[0] = top[0];
bottom[1] = top[1]; bottom[1] = top[1];
bottom[2] = top[2] - 160.0f; bottom[2] = top[2] - 160.0f;
@ -170,10 +170,10 @@ void CL_SetIdealPitch( void )
if( tr.fraction == 1.0f ) if( tr.fraction == 1.0f )
return; // near a dropoff return; // near a dropoff
z[i] = top[2] + tr.fraction * (bottom[2] - top[2]); z[i] = top[2] + tr.fraction * (bottom[2] - top[2]);
} }
dir = 0; dir = 0;
steps = 0; steps = 0;
@ -186,16 +186,16 @@ void CL_SetIdealPitch( void )
if( dir && ( step-dir > ON_EPSILON || step-dir < -ON_EPSILON )) if( dir && ( step-dir > ON_EPSILON || step-dir < -ON_EPSILON ))
return; // mixed changes return; // mixed changes
steps++; steps++;
dir = step; dir = step;
} }
if( !dir ) if( !dir )
{ {
cl.local.idealpitch = 0.0f; cl.local.idealpitch = 0.0f;
return; return;
} }
if( steps < 2 ) return; if( steps < 2 ) return;
cl.local.idealpitch = -dir * cl_idealpitchscale->value; cl.local.idealpitch = -dir * cl_idealpitchscale->value;
} }
@ -627,7 +627,7 @@ int GAME_EXPORT CL_WaterEntity( const float *rgflPos )
if( FBitSet( pe->model->flags, MODEL_HAS_ORIGIN ) && !VectorIsNull( pe->angles )) if( FBitSet( pe->model->flags, MODEL_HAS_ORIGIN ) && !VectorIsNull( pe->angles ))
{ {
matrix4x4 matrix; matrix4x4 matrix;
Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f ); Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f );
Matrix4x4_VectorITransform( matrix, rgflPos, test ); Matrix4x4_VectorITransform( matrix, rgflPos, test );
} }
@ -655,7 +655,7 @@ pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags )
pmtrace_t tr; pmtrace_t tr;
old_usehull = clgame.pmove->usehull; old_usehull = clgame.pmove->usehull;
clgame.pmove->usehull = 2; clgame.pmove->usehull = 2;
tr = PM_PlayerTraceExt( clgame.pmove, start, end, flags, clgame.pmove->numphysent, clgame.pmove->physents, -1, NULL ); tr = PM_PlayerTraceExt( clgame.pmove, start, end, flags, clgame.pmove->numphysent, clgame.pmove->physents, -1, NULL );
clgame.pmove->usehull = old_usehull; clgame.pmove->usehull = old_usehull;
@ -675,7 +675,7 @@ pmtrace_t *CL_VisTraceLine( vec3_t start, vec3_t end, int flags )
static pmtrace_t tr; static pmtrace_t tr;
old_usehull = clgame.pmove->usehull; old_usehull = clgame.pmove->usehull;
clgame.pmove->usehull = 2; clgame.pmove->usehull = 2;
tr = PM_PlayerTraceExt( clgame.pmove, start, end, flags, clgame.pmove->numvisent, clgame.pmove->visents, -1, NULL ); tr = PM_PlayerTraceExt( clgame.pmove, start, end, flags, clgame.pmove->numvisent, clgame.pmove->visents, -1, NULL );
clgame.pmove->usehull = old_usehull; clgame.pmove->usehull = old_usehull;
@ -761,7 +761,7 @@ pmtrace_t *PM_TraceLine( float *start, float *end, int flags, int usehull, int i
int old_usehull; int old_usehull;
old_usehull = clgame.pmove->usehull; old_usehull = clgame.pmove->usehull;
clgame.pmove->usehull = usehull; clgame.pmove->usehull = usehull;
switch( flags ) switch( flags )
{ {
@ -838,7 +838,7 @@ static const char *pfnTraceTexture( int ground, float *vstart, float *vend )
pe = &clgame.pmove->physents[ground]; pe = &clgame.pmove->physents[ground];
return PM_TraceTexture( pe, vstart, vend ); return PM_TraceTexture( pe, vstart, vend );
} }
static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ) static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch )
{ {
@ -870,7 +870,7 @@ static pmtrace_t *pfnTraceLineEx( float *start, float *end, int flags, int usehu
int old_usehull; int old_usehull;
old_usehull = clgame.pmove->usehull; old_usehull = clgame.pmove->usehull;
clgame.pmove->usehull = usehull; clgame.pmove->usehull = usehull;
switch( flags ) switch( flags )
{ {
@ -926,13 +926,13 @@ void CL_InitClientMove( void )
clgame.pmove->PM_StuckTouch = pfnStuckTouch; clgame.pmove->PM_StuckTouch = pfnStuckTouch;
clgame.pmove->PM_PointContents = pfnPointContents; clgame.pmove->PM_PointContents = pfnPointContents;
clgame.pmove->PM_TruePointContents = pfnTruePointContents; clgame.pmove->PM_TruePointContents = pfnTruePointContents;
clgame.pmove->PM_HullPointContents = pfnHullPointContents; clgame.pmove->PM_HullPointContents = pfnHullPointContents;
clgame.pmove->PM_PlayerTrace = pfnPlayerTrace; clgame.pmove->PM_PlayerTrace = pfnPlayerTrace;
clgame.pmove->PM_TraceLine = PM_TraceLine; clgame.pmove->PM_TraceLine = PM_TraceLine;
clgame.pmove->RandomLong = COM_RandomLong; clgame.pmove->RandomLong = COM_RandomLong;
clgame.pmove->RandomFloat = COM_RandomFloat; clgame.pmove->RandomFloat = COM_RandomFloat;
clgame.pmove->PM_GetModelType = pfnGetModelType; clgame.pmove->PM_GetModelType = pfnGetModelType;
clgame.pmove->PM_GetModelBounds = pfnGetModelBounds; clgame.pmove->PM_GetModelBounds = pfnGetModelBounds;
clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp; clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp;
clgame.pmove->PM_TraceModel = pfnTraceModel; clgame.pmove->PM_TraceModel = pfnTraceModel;
clgame.pmove->COM_FileSize = COM_FileSize; clgame.pmove->COM_FileSize = COM_FileSize;
@ -1019,7 +1019,7 @@ void CL_SetupPMove( playermove_t *pmove, local_state_t *from, usercmd_t *ucmd, q
VectorCopy( cd->vuser2, pmove->vuser2 ); VectorCopy( cd->vuser2, pmove->vuser2 );
VectorCopy( cd->vuser3, pmove->vuser3 ); VectorCopy( cd->vuser3, pmove->vuser3 );
VectorCopy( cd->vuser4, pmove->vuser4 ); VectorCopy( cd->vuser4, pmove->vuser4 );
pmove->cmd = *ucmd; // copy current cmds pmove->cmd = *ucmd; // copy current cmds
Q_strncpy( pmove->physinfo, cls.physinfo, MAX_INFO_STRING ); Q_strncpy( pmove->physinfo, cls.physinfo, MAX_INFO_STRING );
} }

View File

@ -224,7 +224,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
} }
// multiplayer game? // multiplayer game?
if( cl.maxclients > 1 ) if( cl.maxclients > 1 )
{ {
// allow console in multiplayer games // allow console in multiplayer games
host.allow_console = true; host.allow_console = true;
@ -308,7 +308,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg )
if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background ) if(( cl_allow_levelshots->value && !cls.changelevel ) || cl.background )
{ {
if( !FS_FileExists( va( "%s.bmp", cl_levelshot_name->string ), true )) if( !FS_FileExists( va( "%s.bmp", cl_levelshot_name->string ), true ))
Cvar_Set( "cl_levelshot_name", "*black" ); // render a black screen Cvar_Set( "cl_levelshot_name", "*black" ); // render a black screen
cls.scrshot_request = scrshot_plaque; // request levelshot even if exist (check filetime) cls.scrshot_request = scrshot_plaque; // request levelshot even if exist (check filetime)
} }
@ -353,7 +353,7 @@ static void CL_ParseQuakeClientData( sizebuf_t *msg )
cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window. cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
frame = &cl.frames[cl.parsecountmod]; // frame at index. frame = &cl.frames[cl.parsecountmod]; // frame at index.
frame->time = cl.mtime[0]; // mark network received time frame->time = cl.mtime[0]; // mark network received time
frame->receivedtime = host.realtime; // time now that we are parsing. frame->receivedtime = host.realtime; // time now that we are parsing.
memset( &frame->graphdata, 0, sizeof( netbandwidthgraph_t )); memset( &frame->graphdata, 0, sizeof( netbandwidthgraph_t ));
memset( frame->flags, 0, sizeof( frame->flags )); memset( frame->flags, 0, sizeof( frame->flags ));
frame->first_entity = cls.next_client_entities; frame->first_entity = cls.next_client_entities;
@ -448,7 +448,7 @@ void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
SetBits( bits, i << 8 ); SetBits( bits, i << 8 );
} }
if( FBitSet( bits, U_LONGENTITY )) if( FBitSet( bits, U_LONGENTITY ))
newnum = MSG_ReadWord( msg ); newnum = MSG_ReadWord( msg );
else newnum = MSG_ReadByte( msg ); else newnum = MSG_ReadByte( msg );
@ -465,7 +465,7 @@ void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits )
if( ent->curstate.msg_time != cl.mtime[1] ) if( ent->curstate.msg_time != cl.mtime[1] )
forcelink = true; // no previous frame to lerp from forcelink = true; // no previous frame to lerp from
else forcelink = false; else forcelink = false;
if( FBitSet( bits, U_MODEL )) if( FBitSet( bits, U_MODEL ))
state->modelindex = MSG_ReadByte( msg ); state->modelindex = MSG_ReadByte( msg );
else state->modelindex = ent->baseline.modelindex; else state->modelindex = ent->baseline.modelindex;
@ -573,8 +573,8 @@ void CL_ParseQuakeParticle( sizebuf_t *msg )
{ {
int count, color; int count, color;
vec3_t org, dir; vec3_t org, dir;
MSG_ReadVec3Coord( msg, org ); MSG_ReadVec3Coord( msg, org );
dir[0] = MSG_ReadChar( msg ) * 0.0625f; dir[0] = MSG_ReadChar( msg ) * 0.0625f;
dir[1] = MSG_ReadChar( msg ) * 0.0625f; dir[1] = MSG_ReadChar( msg ) * 0.0625f;
dir[2] = MSG_ReadChar( msg ) * 0.0625f; dir[2] = MSG_ReadChar( msg ) * 0.0625f;
@ -597,12 +597,12 @@ void CL_ParseQuakeStaticSound( sizebuf_t *msg )
float vol, attn; float vol, attn;
vec3_t org; vec3_t org;
MSG_ReadVec3Coord( msg, org ); MSG_ReadVec3Coord( msg, org );
sound_num = MSG_ReadByte( msg ); sound_num = MSG_ReadByte( msg );
vol = (float)MSG_ReadByte( msg ) / 255.0f; vol = (float)MSG_ReadByte( msg ) / 255.0f;
attn = (float)MSG_ReadByte( msg ) / 64.0f; attn = (float)MSG_ReadByte( msg ) / 64.0f;
S_StartSound( org, 0, CHAN_STATIC, cl.sound_index[sound_num], vol, attn, PITCH_NORM, 0 ); S_StartSound( org, 0, CHAN_STATIC, cl.sound_index[sound_num], vol, attn, PITCH_NORM, 0 );
} }
/* /*
@ -908,7 +908,7 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
// assume no entity/player update this packet // assume no entity/player update this packet
if( cls.state == ca_active ) if( cls.state == ca_active )
{ {
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].valid = false; cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].valid = false;
cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = false; cl.frames[cls.netchan.incoming_sequence & CL_UPDATE_MASK].choked = false;
} }
else else
@ -931,7 +931,7 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message )
// end of message (align bits) // end of message (align bits)
if( MSG_GetNumBitsLeft( msg ) < 8 ) if( MSG_GetNumBitsLeft( msg ) < 8 )
break; break;
cmd = MSG_ReadServerCmd( msg ); cmd = MSG_ReadServerCmd( msg );

View File

@ -54,7 +54,7 @@ qboolean CL_CmpStudioTextures( int numtexs, mstudiotexture_t *p1, mstudiotexture
if( p1->index != p2->index ) if( p1->index != p2->index )
return false; return false;
} }
return true; return true;
} }
@ -282,7 +282,7 @@ void CL_AllocRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
if( !phdr ) return; // bad model? if( !phdr ) return; // bad model?
src = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex); src = (mstudiotexture_t *)(((byte *)phdr) + phdr->textureindex);
dst = (clgame.remap_info[i] ? clgame.remap_info[i]->ptexture : NULL); dst = (clgame.remap_info[i] ? clgame.remap_info[i]->ptexture : NULL);
// NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering // NOTE: we must copy all the structures 'mstudiotexture_t' for easy access when model is rendering
if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != entity->model ) if( !CL_CmpStudioTextures( phdr->numtextures, src, dst ) || clgame.remap_info[i]->model != entity->model )
@ -291,7 +291,7 @@ void CL_AllocRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
// e.g. playermodel 'barney' with playermodel 'gordon' // e.g. playermodel 'barney' with playermodel 'gordon'
if( clgame.remap_info[i] ) CL_FreeRemapInfo( clgame.remap_info[i] ); // free old info if( clgame.remap_info[i] ) CL_FreeRemapInfo( clgame.remap_info[i] ); // free old info
size = sizeof( remap_info_t ) + ( sizeof( mstudiotexture_t ) * phdr->numtextures ); size = sizeof( remap_info_t ) + ( sizeof( mstudiotexture_t ) * phdr->numtextures );
info = clgame.remap_info[i] = Mem_Calloc( clgame.mempool, size ); info = clgame.remap_info[i] = Mem_Calloc( clgame.mempool, size );
info->ptexture = (mstudiotexture_t *)(info + 1); // textures are immediately comes after remap_info info->ptexture = (mstudiotexture_t *)(info + 1); // textures are immediately comes after remap_info
} }
else else
@ -328,7 +328,7 @@ void CL_AllocRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor )
// this code catches studiomodel change with another studiomodel with remap textures // this code catches studiomodel change with another studiomodel with remap textures
// e.g. playermodel 'barney' with playermodel 'gordon' // e.g. playermodel 'barney' with playermodel 'gordon'
if( clgame.remap_info[i] ) CL_FreeRemapInfo( clgame.remap_info[i] ); // free old info if( clgame.remap_info[i] ) CL_FreeRemapInfo( clgame.remap_info[i] ); // free old info
info = clgame.remap_info[i] = Mem_Calloc( clgame.mempool, sizeof( remap_info_t )); info = clgame.remap_info[i] = Mem_Calloc( clgame.mempool, sizeof( remap_info_t ));
} }
else else
{ {
@ -409,7 +409,7 @@ void CL_FreeRemapInfo( remap_info_t *info )
ref.dllFuncs.GL_FreeTexture( info->textures[i] ); ref.dllFuncs.GL_FreeTexture( info->textures[i] );
} }
Mem_Free( info ); // release struct Mem_Free( info ); // release struct
} }
/* /*
@ -428,7 +428,7 @@ void CL_ClearAllRemaps( void )
for( i = 0; i < clgame.maxRemapInfos; i++ ) for( i = 0; i < clgame.maxRemapInfos; i++ )
{ {
if( clgame.remap_info[i] ) if( clgame.remap_info[i] )
CL_FreeRemapInfo( clgame.remap_info[i] ); CL_FreeRemapInfo( clgame.remap_info[i] );
} }
Mem_Free( clgame.remap_info ); Mem_Free( clgame.remap_info );
} }

View File

@ -265,7 +265,7 @@ void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel )
// use these to set per-frame and termination conditions / actions // use these to set per-frame and termination conditions / actions
pTemp->entity.trivial_accept = modelHandle; // keep unchanged pTemp->entity.trivial_accept = modelHandle; // keep unchanged
pTemp->flags = FTENT_NONE; pTemp->flags = FTENT_NONE;
pTemp->die = cl.time + 0.75f; pTemp->die = cl.time + 0.75f;
if( pmodel ) frameCount = pmodel->numframes; if( pmodel ) frameCount = pmodel->numframes;
@ -341,17 +341,17 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
} }
zvel = abs( pTemp->entity.baseline.origin[2] ); zvel = abs( pTemp->entity.baseline.origin[2] );
// only play one out of every n // only play one out of every n
if( isshellcasing ) if( isshellcasing )
{ {
// play first bounce, then 1 out of 3 // play first bounce, then 1 out of 3
if( zvel < 200 && COM_RandomLong( 0, 3 )) if( zvel < 200 && COM_RandomLong( 0, 3 ))
return; return;
} }
else else
{ {
if( COM_RandomLong( 0, 5 )) if( COM_RandomLong( 0, 5 ))
return; return;
} }
@ -359,11 +359,11 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp )
{ {
int pitch; int pitch;
sound_t handle; sound_t handle;
if( isshellcasing ) if( isshellcasing )
fvol *= min ( 1.0f, ((float)zvel) / 350.0f ); fvol *= min ( 1.0f, ((float)zvel) / 350.0f );
else fvol *= min ( 1.0f, ((float)zvel) / 450.0f ); else fvol *= min ( 1.0f, ((float)zvel) / 450.0f );
if( !COM_RandomLong( 0, 3 ) && !isshellcasing ) if( !COM_RandomLong( 0, 3 ) && !isshellcasing )
pitch = COM_RandomLong( 95, 105 ); pitch = COM_RandomLong( 95, 105 );
else pitch = PITCH_NORM; else pitch = PITCH_NORM;
@ -399,7 +399,7 @@ int CL_TempEntAddEntity( cl_entity_t *pEntity )
VectorCopy( pEntity->origin, pEntity->curstate.origin ); VectorCopy( pEntity->origin, pEntity->curstate.origin );
VectorCopy( pEntity->angles, pEntity->latched.prevangles ); VectorCopy( pEntity->angles, pEntity->latched.prevangles );
VectorCopy( pEntity->origin, pEntity->latched.prevorigin ); VectorCopy( pEntity->origin, pEntity->latched.prevorigin );
// add to list // add to list
CL_AddVisibleEntity( pEntity, ET_TEMPENTITY ); CL_AddVisibleEntity( pEntity, ET_TEMPENTITY );
@ -503,7 +503,7 @@ TEMPENTITY *CL_TempEntAllocHigh( const vec3_t org, model_t *pmodel )
if( !cl_free_tents ) if( !cl_free_tents )
{ {
// no temporary ents free, so find the first active low-priority temp ent // no temporary ents free, so find the first active low-priority temp ent
// and overwrite it. // and overwrite it.
CL_FreeLowPriorityTempEnt(); CL_FreeLowPriorityTempEnt();
} }
@ -511,7 +511,7 @@ TEMPENTITY *CL_TempEntAllocHigh( const vec3_t org, model_t *pmodel )
if( !cl_free_tents ) if( !cl_free_tents )
{ {
// didn't find anything? The tent list is either full of high-priority tents // didn't find anything? The tent list is either full of high-priority tents
// or all tents in the list are still due to live for > 10 seconds. // or all tents in the list are still due to live for > 10 seconds.
Con_DPrintf( "Couldn't alloc a high priority TENT!\n" ); Con_DPrintf( "Couldn't alloc a high priority TENT!\n" );
return NULL; return NULL;
} }
@ -676,12 +676,12 @@ void GAME_EXPORT R_Bubbles( const vec3_t mins, const vec3_t maxs, float height,
pTemp->y = origin[1]; pTemp->y = origin[1];
angle = COM_RandomFloat( -M_PI, M_PI ); angle = COM_RandomFloat( -M_PI, M_PI );
SinCos( angle, &sine, &cosine ); SinCos( angle, &sine, &cosine );
zspeed = COM_RandomLong( 80, 140 ); zspeed = COM_RandomLong( 80, 140 );
VectorSet( pTemp->entity.baseline.origin, speed * cosine, speed * sine, zspeed ); VectorSet( pTemp->entity.baseline.origin, speed * cosine, speed * sine, zspeed );
pTemp->die = cl.time + ((height - (origin[2] - mins[2])) / zspeed) - 0.1f; pTemp->die = cl.time + ((height - (origin[2] - mins[2])) / zspeed) - 0.1f;
pTemp->entity.curstate.frame = COM_RandomLong( 0, pTemp->frameMax ); pTemp->entity.curstate.frame = COM_RandomLong( 0, pTemp->frameMax );
// Set sprite scale // Set sprite scale
pTemp->entity.curstate.scale = 1.0f / COM_RandomFloat( 2.0f, 5.0f ); pTemp->entity.curstate.scale = 1.0f / COM_RandomFloat( 2.0f, 5.0f );
pTemp->entity.curstate.rendermode = kRenderTransAlpha; pTemp->entity.curstate.rendermode = kRenderTransAlpha;
@ -767,7 +767,7 @@ void GAME_EXPORT R_AttachTentToPlayer( int client, int modelIndex, float zoffset
pTemp->entity.curstate.renderfx = kRenderFxNoDissipation; pTemp->entity.curstate.renderfx = kRenderFxNoDissipation;
pTemp->entity.curstate.framerate = 1; pTemp->entity.curstate.framerate = 1;
pTemp->clientIndex = client; pTemp->clientIndex = client;
pTemp->tentOffset[0] = 0; pTemp->tentOffset[0] = 0;
pTemp->tentOffset[1] = 0; pTemp->tentOffset[1] = 0;
@ -815,7 +815,7 @@ void GAME_EXPORT R_KillAttachedTents( int client )
// if it is attached to this client, set it to die instantly. // if it is attached to this client, set it to die instantly.
if( pTemp->clientIndex == client ) if( pTemp->clientIndex == client )
{ {
// good enough, it will die on next tent update. // good enough, it will die on next tent update.
pTemp->die = cl.time; pTemp->die = cl.time;
} }
} }
@ -1026,7 +1026,7 @@ void GAME_EXPORT R_BreakModel( const vec3_t pos, const vec3_t size, const vec3_t
// limit to 100 pieces // limit to 100 pieces
if( count > 100 ) count = 100; if( count > 100 ) count = 100;
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
{ {
vec3_t vecSpot; vec3_t vecSpot;
@ -1048,7 +1048,7 @@ void GAME_EXPORT R_BreakModel( const vec3_t pos, const vec3_t size, const vec3_t
// keep track of break_type, so we know how to play sound on collision // keep track of break_type, so we know how to play sound on collision
pTemp->hitSound = type; pTemp->hitSound = type;
if( pmodel->type == mod_sprite ) if( pmodel->type == mod_sprite )
pTemp->entity.curstate.frame = COM_RandomLong( 0, pTemp->frameMax ); pTemp->entity.curstate.frame = COM_RandomLong( 0, pTemp->frameMax );
else if( pmodel->type == mod_studio ) else if( pmodel->type == mod_studio )
@ -1056,7 +1056,7 @@ void GAME_EXPORT R_BreakModel( const vec3_t pos, const vec3_t size, const vec3_t
pTemp->flags |= FTENT_COLLIDEWORLD | FTENT_FADEOUT | FTENT_SLOWGRAVITY; pTemp->flags |= FTENT_COLLIDEWORLD | FTENT_FADEOUT | FTENT_SLOWGRAVITY;
if( COM_RandomLong( 0, 255 ) < 200 ) if( COM_RandomLong( 0, 255 ) < 200 )
{ {
pTemp->flags |= FTENT_ROTATE; pTemp->flags |= FTENT_ROTATE;
pTemp->entity.baseline.angles[0] = COM_RandomFloat( -256, 255 ); pTemp->entity.baseline.angles[0] = COM_RandomFloat( -256, 255 );
@ -1177,7 +1177,7 @@ TEMPENTITY *R_DefaultSprite( const vec3_t pos, int spriteIndex, float framerate
=============== ===============
R_SparkShower R_SparkShower
Create an animated moving sprite Create an animated moving sprite
=============== ===============
*/ */
void GAME_EXPORT R_SparkShower( const vec3_t pos ) void GAME_EXPORT R_SparkShower( const vec3_t pos )
@ -1202,7 +1202,7 @@ void GAME_EXPORT R_SparkShower( const vec3_t pos )
=============== ===============
R_TempSprite R_TempSprite
Create an animated moving sprite Create an animated moving sprite
=============== ===============
*/ */
TEMPENTITY *R_TempSprite( vec3_t pos, const vec3_t dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags ) TEMPENTITY *R_TempSprite( vec3_t pos, const vec3_t dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags )
@ -1251,7 +1251,7 @@ void GAME_EXPORT R_Sprite_Explode( TEMPENTITY *pTemp, float scale, int flags )
{ {
// solid sprite // solid sprite
pTemp->entity.curstate.rendermode = kRenderNormal; pTemp->entity.curstate.rendermode = kRenderNormal;
pTemp->entity.curstate.renderamt = 255; pTemp->entity.curstate.renderamt = 255;
} }
else if( FBitSet( flags, TE_EXPLFLAG_DRAWALPHA )) else if( FBitSet( flags, TE_EXPLFLAG_DRAWALPHA ))
{ {
@ -2405,7 +2405,7 @@ LIGHT STYLE MANAGEMENT
============================================================== ==============================================================
*/ */
#define STYLE_LERPING_THRESHOLD 3.0f // because we wan't interpolate fast sequences (like on\off) #define STYLE_LERPING_THRESHOLD 3.0f // because we wan't interpolate fast sequences (like on\off)
/* /*
================ ================
CL_ClearLightStyles CL_ClearLightStyles
@ -2576,7 +2576,7 @@ void CL_DecayLights( void )
dlight_t *dl; dlight_t *dl;
float time; float time;
int i; int i;
time = cl.time - cl.oldtime; time = cl.time - cl.oldtime;
for( i = 0, dl = cl_dlights; i < MAX_DLIGHTS; i++, dl++ ) for( i = 0, dl = cl_dlights; i < MAX_DLIGHTS; i++, dl++ )
@ -2586,7 +2586,7 @@ void CL_DecayLights( void )
dl->radius -= time * dl->decay; dl->radius -= time * dl->decay;
if( dl->radius < 0 ) dl->radius = 0; if( dl->radius < 0 ) dl->radius = 0;
if( dl->die < cl.time || !dl->radius ) if( dl->die < cl.time || !dl->radius )
memset( dl, 0, sizeof( *dl )); memset( dl, 0, sizeof( *dl ));
} }
@ -2597,7 +2597,7 @@ void CL_DecayLights( void )
dl->radius -= time * dl->decay; dl->radius -= time * dl->decay;
if( dl->radius < 0 ) dl->radius = 0; if( dl->radius < 0 ) dl->radius = 0;
if( dl->die < cl.time || !dl->radius ) if( dl->die < cl.time || !dl->radius )
memset( dl, 0, sizeof( *dl )); memset( dl, 0, sizeof( *dl ));
} }
} }
@ -2675,7 +2675,7 @@ void CL_UpdateFlashlight( cl_entity_t *ent )
else falloff = 500.0f / falloff; else falloff = 500.0f / falloff;
falloff *= falloff; falloff *= falloff;
// apply brigthness to dlight // apply brigthness to dlight
dl->color.r = bound( 0, falloff * 255, 255 ); dl->color.r = bound( 0, falloff * 255, 255 );
dl->color.g = bound( 0, falloff * 255, 255 ); dl->color.g = bound( 0, falloff * 255, 255 );
dl->color.b = bound( 0, falloff * 255, 255 ); dl->color.b = bound( 0, falloff * 255, 255 );
@ -2710,10 +2710,10 @@ void CL_AddEntityEffects( cl_entity_t *ent )
VectorCopy( ent->origin, dl->origin ); VectorCopy( ent->origin, dl->origin );
dl->die = cl.time + 0.001; dl->die = cl.time + 0.001;
} }
} }
if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT )) if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT ))
{ {
dlight_t *dl = CL_AllocDlight( ent->index ); dlight_t *dl = CL_AllocDlight( ent->index );
dl->color.r = dl->color.g = dl->color.b = 250; dl->color.r = dl->color.g = dl->color.b = 250;
if( ent->player ) dl->radius = 400; // don't flickering if( ent->player ) dl->radius = 400; // don't flickering
@ -2979,7 +2979,7 @@ remove all decals with specified texture
*/ */
void GAME_EXPORT CL_DecalRemoveAll( int textureIndex ) void GAME_EXPORT CL_DecalRemoveAll( int textureIndex )
{ {
int id = bound( 0, textureIndex, MAX_DECALS - 1 ); int id = bound( 0, textureIndex, MAX_DECALS - 1 );
ref.dllFuncs.R_DecalRemoveAll( cl.decal_index[id] ); ref.dllFuncs.R_DecalRemoveAll( cl.decal_index[id] );
} }
@ -3032,7 +3032,7 @@ void CL_ClearStaticEntities( void )
CL_ClearEfrags (); CL_ClearEfrags ();
} }
/* /*
============== ==============
CL_ClearEffects CL_ClearEffects

View File

@ -87,7 +87,7 @@ void SCR_CheckStartupVids( void )
byte *afile; byte *afile;
char *pfile; char *pfile;
string token; string token;
if( Sys_CheckParm( "-nointro" ) || host_developer.value || cls.demonum != -1 || GameState->nextstate != STATE_RUNFRAME ) if( Sys_CheckParm( "-nointro" ) || host_developer.value || cls.demonum != -1 || GameState->nextstate != STATE_RUNFRAME )
{ {
// don't run movies where we in developer-mode // don't run movies where we in developer-mode
@ -122,7 +122,7 @@ void SCR_CheckStartupVids( void )
SCR_NextMovie (); SCR_NextMovie ();
Cbuf_Execute(); Cbuf_Execute();
} }
/* /*
================== ==================
SCR_RunCinematic SCR_RunCinematic
@ -152,7 +152,7 @@ void SCR_RunCinematic( void )
return; return;
} }
// advances cinematic time (ignores maxfps and host_framerate settings) // advances cinematic time (ignores maxfps and host_framerate settings)
cin_time += host.realframetime; cin_time += host.realframetime;
// stop the video after it finishes // stop the video after it finishes
@ -194,7 +194,7 @@ qboolean SCR_DrawCinematic( void )
return true; return true;
} }
/* /*
================== ==================
SCR_PlayCinematic SCR_PlayCinematic
@ -238,7 +238,7 @@ qboolean SCR_PlayCinematic( const char *arg )
Con_FastClose(); Con_FastClose();
cin_time = 0.0f; cin_time = 0.0f;
cls.signon = 0; cls.signon = 0;
return true; return true;
} }
@ -258,7 +258,7 @@ wavdata_t *SCR_GetMovieInfo( void )
return &cin_audio; return &cin_audio;
return NULL; return NULL;
} }
/* /*
================== ==================
SCR_StopCinematic SCR_StopCinematic

View File

@ -35,7 +35,7 @@ void V_CalcViewRect( void )
int sb_lines; int sb_lines;
float size; float size;
// intermission is always full screen // intermission is always full screen
if( cl.intermission ) size = 120.0f; if( cl.intermission ) size = 120.0f;
else size = scr_viewsize->value; else size = scr_viewsize->value;

View File

@ -110,7 +110,7 @@ extern int CL_UPDATE_BACKUP;
#define MIN_EX_INTERP 50.0f #define MIN_EX_INTERP 50.0f
#define MAX_EX_INTERP 100.0f #define MAX_EX_INTERP 100.0f
#define CL_MIN_RESEND_TIME 1.5f // mininum time gap (in seconds) before a subsequent connection request is sent. #define CL_MIN_RESEND_TIME 1.5f // mininum time gap (in seconds) before a subsequent connection request is sent.
#define CL_MAX_RESEND_TIME 20.0f // max time. The cvar cl_resend is bounded by these. #define CL_MAX_RESEND_TIME 20.0f // max time. The cvar cl_resend is bounded by these.
#define cl_serverframetime() (cl.mtime[0] - cl.mtime[1]) #define cl_serverframetime() (cl.mtime[0] - cl.mtime[1])
@ -180,7 +180,7 @@ typedef struct
// render a frame yet // render a frame yet
int parsecount; // server message counter int parsecount; // server message counter
int parsecountmod; // modulo with network window int parsecountmod; // modulo with network window
qboolean video_prepped; // false if on new level or new ref dll qboolean video_prepped; // false if on new level or new ref dll
qboolean audio_prepped; // false if on new level or new snd dll qboolean audio_prepped; // false if on new level or new snd dll
qboolean paused; qboolean paused;
@ -306,7 +306,7 @@ typedef struct
char name[32]; char name[32];
int number; // svc_ number int number; // svc_ number
int size; // if size == -1, size come from first byte after svcnum int size; // if size == -1, size come from first byte after svcnum
pfnUserMsgHook func; // user-defined function pfnUserMsgHook func; // user-defined function
} cl_user_message_t; } cl_user_message_t;
typedef void (*pfnEventHook)( event_args_t *args ); typedef void (*pfnEventHook)( event_args_t *args );
@ -538,7 +538,7 @@ typedef struct
netadr_t hltv_listen_address; netadr_t hltv_listen_address;
int signon; // 0 to SIGNONS, for the signon sequence. int signon; // 0 to SIGNONS, for the signon sequence.
int quakePort; // a 16 bit value that allows quake servers int quakePort; // a 16 bit value that allows quake servers
// to work around address translating routers // to work around address translating routers
// g-cont. this port allow many copies of engine in multiplayer game // g-cont. this port allow many copies of engine in multiplayer game
@ -848,7 +848,7 @@ _inline cl_entity_t *CL_EDICT_NUM( int n )
return clgame.entities + n; return clgame.entities + n;
Host_Error( "CL_EDICT_NUM: bad number %i\n", n ); Host_Error( "CL_EDICT_NUM: bad number %i\n", n );
return NULL; return NULL;
} }
// //

View File

@ -252,7 +252,7 @@ void Touch_WriteConfig( void )
Q_strncpy( newCommand, B(command), MAX_STRING ); Q_strncpy( newCommand, B(command), MAX_STRING );
FS_Printf( f, "touch_addbutton \"%s\" \"%s\" \"%s\" %f %f %f %f %d %d %d %d %d\n", FS_Printf( f, "touch_addbutton \"%s\" \"%s\" \"%s\" %f %f %f %f %d %d %d %d %d\n",
B(name), B(texturefile), newCommand, B(name), B(texturefile), newCommand,
B(x1), B(y1), B(x2), B(y2), B(x1), B(y1), B(x2), B(y2),
B(color[0]), B(color[1]), B(color[2]), B(color[3]), flags ); B(color[0]), B(color[1]), B(color[2]), B(color[3]), flags );
@ -351,7 +351,7 @@ void Touch_ExportConfig_f( void )
//Com_EscapeCommand( newCommand, B(command), MAX_STRING ); //Com_EscapeCommand( newCommand, B(command), MAX_STRING );
Q_strncpy( newCommand, B(command), MAX_STRING ); Q_strncpy( newCommand, B(command), MAX_STRING );
FS_Printf( f, "touch_addbutton \"%s\" \"%s\" \"%s\" %f %f %f %f %d %d %d %d %d %f\n", FS_Printf( f, "touch_addbutton \"%s\" \"%s\" \"%s\" %f %f %f %f %d %d %d %d %d %f\n",
B(name), B(texturefile), newCommand, B(name), B(texturefile), newCommand,
B(x1), B(y1), B(x2), B(y2), B(x1), B(y1), B(x2), B(y2),
B(color[0]), B(color[1]), B(color[2]), B(color[3]), flags, aspect ); B(color[0]), B(color[1]), B(color[2]), B(color[3]), flags, aspect );
@ -578,7 +578,7 @@ void Touch_HideButtons( const char *name, byte hide )
button->flags &= ~TOUCH_FL_HIDE; button->flags &= ~TOUCH_FL_HIDE;
} }
} }
} }
void Touch_ToggleSelection_f( void ) void Touch_ToggleSelection_f( void )
@ -737,13 +737,13 @@ void Touch_LoadDefaults_f( void )
for( i = 0; i < g_LastDefaultButton; i++ ) for( i = 0; i < g_LastDefaultButton; i++ )
{ {
touch_button_t *button; touch_button_t *button;
float x1 = g_DefaultButtons[i].x1, float x1 = g_DefaultButtons[i].x1,
y1 = g_DefaultButtons[i].y1, y1 = g_DefaultButtons[i].y1,
x2 = g_DefaultButtons[i].x2, x2 = g_DefaultButtons[i].x2,
y2 = g_DefaultButtons[i].y2; y2 = g_DefaultButtons[i].y2;
IN_TouchCheckCoords( &x1, &y1, &x2, &y2 ); IN_TouchCheckCoords( &x1, &y1, &x2, &y2 );
if( g_DefaultButtons[i].aspect && g_DefaultButtons[i].round == round_aspect ) if( g_DefaultButtons[i].aspect && g_DefaultButtons[i].round == round_aspect )
{ {
if( g_DefaultButtons[i].texturefile[0] == '#' ) if( g_DefaultButtons[i].texturefile[0] == '#' )
@ -751,7 +751,7 @@ void Touch_LoadDefaults_f( void )
else else
y2 = y1 + ( x2 - x1 ) * (SCR_W/SCR_H) * g_DefaultButtons[i].aspect; y2 = y1 + ( x2 - x1 ) * (SCR_W/SCR_H) * g_DefaultButtons[i].aspect;
} }
IN_TouchCheckCoords( &x1, &y1, &x2, &y2 ); IN_TouchCheckCoords( &x1, &y1, &x2, &y2 );
button = Touch_AddButton( &touch.list_user, g_DefaultButtons[i].name, g_DefaultButtons[i].texturefile, g_DefaultButtons[i].command, x1, y1, x2, y2, g_DefaultButtons[i].color ); button = Touch_AddButton( &touch.list_user, g_DefaultButtons[i].name, g_DefaultButtons[i].texturefile, g_DefaultButtons[i].command, x1, y1, x2, y2, g_DefaultButtons[i].color );
button->flags |= g_DefaultButtons[i].flags; button->flags |= g_DefaultButtons[i].flags;
@ -792,10 +792,10 @@ void Touch_AddButton_f( void )
if( argc >= 12 ) if( argc >= 12 )
{ {
touch_button_t *button; touch_button_t *button;
MakeRGBA( color, Q_atoi( Cmd_Argv(8) ), Q_atoi( Cmd_Argv(9) ), MakeRGBA( color, Q_atoi( Cmd_Argv(8) ), Q_atoi( Cmd_Argv(9) ),
Q_atoi( Cmd_Argv(10) ), Q_atoi( Cmd_Argv(11) ) ); Q_atoi( Cmd_Argv(10) ), Q_atoi( Cmd_Argv(11) ) );
button = Touch_AddButton( &touch.list_user, Cmd_Argv(1), Cmd_Argv(2), Cmd_Argv(3), button = Touch_AddButton( &touch.list_user, Cmd_Argv(1), Cmd_Argv(2), Cmd_Argv(3),
Q_atof( Cmd_Argv(4) ), Q_atof( Cmd_Argv(5) ), Q_atof( Cmd_Argv(4) ), Q_atof( Cmd_Argv(5) ),
Q_atof( Cmd_Argv(6) ), Q_atof( Cmd_Argv(7) ) , Q_atof( Cmd_Argv(6) ), Q_atof( Cmd_Argv(7) ) ,
color ); color );
if( argc >= 13 ) if( argc >= 13 )
@ -812,14 +812,14 @@ void Touch_AddButton_f( void )
B(aspect) = aspect; B(aspect) = aspect;
} }
} }
return; return;
} }
if( argc == 8 ) if( argc == 8 )
{ {
MakeRGBA( color, 255, 255, 255, 255 ); MakeRGBA( color, 255, 255, 255, 255 );
Touch_AddButton( &touch.list_user, Cmd_Argv(1), Cmd_Argv(2), Cmd_Argv(3), Touch_AddButton( &touch.list_user, Cmd_Argv(1), Cmd_Argv(2), Cmd_Argv(3),
Q_atof( Cmd_Argv(4) ), Q_atof( Cmd_Argv(5) ), Q_atof( Cmd_Argv(4) ), Q_atof( Cmd_Argv(5) ),
Q_atof( Cmd_Argv(6) ), Q_atof( Cmd_Argv(7) ), Q_atof( Cmd_Argv(6) ), Q_atof( Cmd_Argv(7) ),
color ); color );
return; return;
@ -931,7 +931,7 @@ void Touch_Init( void )
Touch_AddDefaultButton( "edit", "touch_default/settings.tga", "touch_enableedit", 0.420000, 0.000000, 0.500000, 0.151486, color, 2, 1, 32 ); Touch_AddDefaultButton( "edit", "touch_default/settings.tga", "touch_enableedit", 0.420000, 0.000000, 0.500000, 0.151486, color, 2, 1, 32 );
Touch_AddDefaultButton( "menu", "touch_default/menu.tga", "escape", 0.000000, 0.833171, 0.080000, 0.984656, color, 2, 1, 0 ); Touch_AddDefaultButton( "menu", "touch_default/menu.tga", "escape", 0.000000, 0.833171, 0.080000, 0.984656, color, 2, 1, 0 );
Cmd_AddCommand( "touch_addbutton", Touch_AddButton_f, "add native touch button" ); Cmd_AddCommand( "touch_addbutton", Touch_AddButton_f, "add native touch button" );
Cmd_AddCommand( "touch_removebutton", IN_TouchRemoveButton_f, "remove native touch button" ); Cmd_AddCommand( "touch_removebutton", IN_TouchRemoveButton_f, "remove native touch button" );
Cmd_AddCommand( "touch_enableedit", Touch_EnableEdit_f, "enable button editing mode" ); Cmd_AddCommand( "touch_enableedit", Touch_EnableEdit_f, "enable button editing mode" );
@ -1035,12 +1035,12 @@ qboolean Touch_IsVisible( touch_button_t *button )
return true; return true;
/* /*
return ( !touch.clientonly || ( button->flags & TOUCH_FL_CLIENT) ) && return ( !touch.clientonly || ( button->flags & TOUCH_FL_CLIENT) ) &&
( (
( touch.state >= state_edit ) ( touch.state >= state_edit )
||( !( button->flags & TOUCH_FL_HIDE ) ||( !( button->flags & TOUCH_FL_HIDE )
&& ( !(button->flags & TOUCH_FL_SP) || ( CL_GetMaxClients() == 1 ) ) && ( !(button->flags & TOUCH_FL_SP) || ( CL_GetMaxClients() == 1 ) )
&& ( !(button->flags & TOUCH_FL_MP) || ( CL_GetMaxClients() != 1 ) ) ) && ( !(button->flags & TOUCH_FL_MP) || ( CL_GetMaxClients() != 1 ) ) )
); );
*/ */
} }
@ -1128,7 +1128,7 @@ float Touch_DrawText( float x1, float y1, float x2, float y2, const char *s, byt
maxx = x2 - cls.creditsFont.charWidths['M'] / 1024.0f * size; maxx = x2 - cls.creditsFont.charWidths['M'] / 1024.0f * size;
else else
maxx = 1; maxx = 1;
if( !cls.creditsFont.valid ) if( !cls.creditsFont.valid )
return GRID_X * 2; return GRID_X * 2;
Con_UtfProcessChar( 0 ); Con_UtfProcessChar( 0 );
@ -1159,7 +1159,7 @@ float Touch_DrawText( float x1, float y1, float x2, float y2, const char *s, byt
void Touch_DrawButtons( touchbuttonlist_t *list ) void Touch_DrawButtons( touchbuttonlist_t *list )
{ {
touch_button_t *button; touch_button_t *button;
for( button = list->first; button; button = button->next ) for( button = list->first; button; button = button->next )
{ {
if( Touch_IsVisible( button ) ) if( Touch_IsVisible( button ) )
@ -1240,7 +1240,7 @@ void Touch_DrawButtons( touchbuttonlist_t *list )
Con_DrawString( TO_SCRN_X( B(x1) ), TO_SCRN_Y( B(y1) ), B(name), color ); Con_DrawString( TO_SCRN_X( B(x1) ), TO_SCRN_Y( B(y1) ), B(name), color );
} }
} }
} }
void Touch_Draw( void ) void Touch_Draw( void )
@ -1403,7 +1403,7 @@ static void Touch_EditMove( touchEventType type, int fingerID, float x, float y,
touch.edit->x2 += dx; touch.edit->x2 += dx;
} }
} }
else else
{ {
if( type == event_down ) // enable resizing if( type == event_down ) // enable resizing
{ {
@ -1489,7 +1489,7 @@ static void Touch_Motion( touchEventType type, int fingerID, float x, float y, f
{ {
if( touch.precision ) if( touch.precision )
dx *= touch_precise_amount->value, dy *= touch_precise_amount->value; dx *= touch_precise_amount->value, dy *= touch_precise_amount->value;
if( CVAR_TO_BOOL(touch_nonlinear_look) ) if( CVAR_TO_BOOL(touch_nonlinear_look) )
{ {
float dabs, dcos, dsin; float dabs, dcos, dsin;
@ -1502,7 +1502,7 @@ static void Touch_Motion( touchEventType type, int fingerID, float x, float y, f
dcos = dx / dabs; dcos = dx / dabs;
dsin = dy / dabs; dsin = dy / dabs;
if( touch_exp_mult->value > 1 ) if( touch_exp_mult->value > 1 )
dabs = ( exp( dabs * touch_exp_mult->value ) - 1 ) / touch_exp_mult->value; dabs = ( exp( dabs * touch_exp_mult->value ) - 1 ) / touch_exp_mult->value;
@ -1772,7 +1772,7 @@ static qboolean Touch_ButtonEdit( touchEventType type, int fingerID, float x, fl
y > button->y1 ) ) y > button->y1 ) )
{ {
button->finger = fingerID; button->finger = fingerID;
// do not edit NOEDIT buttons // do not edit NOEDIT buttons
if( button->flags & TOUCH_FL_NOEDIT ) if( button->flags & TOUCH_FL_NOEDIT )
continue; continue;
@ -1785,7 +1785,7 @@ static qboolean Touch_ButtonEdit( touchEventType type, int fingerID, float x, fl
{ {
if( button->prev ) if( button->prev )
button->prev->next = button->next; button->prev->next = button->next;
else else
touch.list_user.first = button->next; touch.list_user.first = button->next;
button->next->prev = button->prev; button->next->prev = button->prev;
@ -1946,7 +1946,7 @@ void Touch_KeyEvent( int key, int down )
void Touch_Shutdown( void ) void Touch_Shutdown( void )
{ {
if( !touch.initialized ) if( !touch.initialized )
return; return;
Touch_RemoveAll_f(); Touch_RemoveAll_f();
Cmd_RemoveCommand( "touch_addbutton" ); Cmd_RemoveCommand( "touch_addbutton" );

View File

@ -260,12 +260,12 @@ void IN_ActivateMouse( qboolean force )
{ {
int width, height; int width, height;
static int oldstate; static int oldstate;
if( !in_mouseinitialized ) if( !in_mouseinitialized )
return; return;
if( CL_Active() && host.mouse_visible && !force ) if( CL_Active() && host.mouse_visible && !force )
return; // VGUI controls return; // VGUI controls
if( cls.key_dest == key_menu && !Cvar_VariableInteger( "fullscreen" )) if( cls.key_dest == key_menu && !Cvar_VariableInteger( "fullscreen" ))
{ {
@ -341,7 +341,7 @@ IN_MouseMove
void IN_MouseMove( void ) void IN_MouseMove( void )
{ {
POINT current_pos; POINT current_pos;
if( !in_mouseinitialized || !in_mouseactive || !UI_IsVisible( )) if( !in_mouseinitialized || !in_mouseactive || !UI_IsVisible( ))
return; return;
@ -588,10 +588,10 @@ void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qbo
IN_EvdevMove( yaw, pitch ); IN_EvdevMove( yaw, pitch );
#endif #endif
} }
Joy_FinalizeMove( forward, side, yaw, pitch ); Joy_FinalizeMove( forward, side, yaw, pitch );
Touch_GetMove( forward, side, yaw, pitch ); Touch_GetMove( forward, side, yaw, pitch );
if( look_filter->value ) if( look_filter->value )
{ {
*pitch = ( inputstate.lastpitch + *pitch ) / 2; *pitch = ( inputstate.lastpitch + *pitch ) / 2;
@ -627,7 +627,7 @@ void IN_EngineAppendMove( float frametime, void *cmd1, qboolean active )
float sensitivity = 1;//( (float)cl.local.scr_fov / (float)90.0f ); float sensitivity = 1;//( (float)cl.local.scr_fov / (float)90.0f );
IN_CollectInput( &forward, &side, &pitch, &yaw, in_mouseinitialized && !CVAR_TO_BOOL( m_ignore ), m_enginemouse->value ); IN_CollectInput( &forward, &side, &pitch, &yaw, in_mouseinitialized && !CVAR_TO_BOOL( m_ignore ), m_enginemouse->value );
IN_JoyAppendMove( cmd, forward, side ); IN_JoyAppendMove( cmd, forward, side );
if( pitch || yaw ) if( pitch || yaw )
@ -683,7 +683,7 @@ void Host_InputFrame( void )
// release mouse during pause or console typeing // release mouse during pause or console typeing
if( cl.paused && cls.key_dest == key_game ) if( cl.paused && cls.key_dest == key_game )
shutdownMouse = true; shutdownMouse = true;
if( shutdownMouse && !Cvar_VariableInteger( "fullscreen" )) if( shutdownMouse && !Cvar_VariableInteger( "fullscreen" ))
{ {
IN_DeactivateMouse(); IN_DeactivateMouse();

View File

@ -185,7 +185,7 @@ to be configured even if they don't have defined names.
int Key_StringToKeynum( const char *str ) int Key_StringToKeynum( const char *str )
{ {
keyname_t *kn; keyname_t *kn;
if( !str || !str[0] ) return -1; if( !str || !str[0] ) return -1;
if( !str[1] ) return str[0]; if( !str[1] ) return str[0];
@ -193,7 +193,7 @@ int Key_StringToKeynum( const char *str )
if( str[0] == '0' && str[1] == 'x' && Q_strlen( str ) == 4 ) if( str[0] == '0' && str[1] == 'x' && Q_strlen( str ) == 4 )
{ {
int n1, n2; int n1, n2;
n1 = str[2]; n1 = str[2];
if( n1 >= '0' && n1 <= '9' ) if( n1 >= '0' && n1 <= '9' )
{ {
@ -239,7 +239,7 @@ given keynum.
*/ */
const char *Key_KeynumToString( int keynum ) const char *Key_KeynumToString( int keynum )
{ {
keyname_t *kn; keyname_t *kn;
static char tinystr[5]; static char tinystr[5];
int i, j; int i, j;
@ -289,7 +289,7 @@ void GAME_EXPORT Key_SetBinding( int keynum, const char *binding )
Mem_Free((char *)keys[keynum].binding ); Mem_Free((char *)keys[keynum].binding );
keys[keynum].binding = NULL; keys[keynum].binding = NULL;
} }
// allocate memory for new binding // allocate memory for new binding
keys[keynum].binding = copystring( binding ); keys[keynum].binding = copystring( binding );
} }
@ -306,7 +306,7 @@ const char *Key_GetBinding( int keynum )
return keys[keynum].binding; return keys[keynum].binding;
} }
/* /*
=================== ===================
Key_GetKey Key_GetKey
=================== ===================
@ -351,7 +351,7 @@ void Key_Unbind_f( void )
Con_Printf( S_USAGE "unbind <key> : remove commands from a key\n" ); Con_Printf( S_USAGE "unbind <key> : remove commands from a key\n" );
return; return;
} }
b = Key_StringToKeynum( Cmd_Argv( 1 )); b = Key_StringToKeynum( Cmd_Argv( 1 ));
if( b == -1 ) if( b == -1 )
@ -371,7 +371,7 @@ Key_Unbindall_f
void Key_Unbindall_f( void ) void Key_Unbindall_f( void )
{ {
int i; int i;
for( i = 0; i < 256; i++ ) for( i = 0; i < 256; i++ )
{ {
if( keys[i].binding ) if( keys[i].binding )
@ -392,7 +392,7 @@ void Key_Reset_f( void )
keyname_t *kn; keyname_t *kn;
int i; int i;
// clear all keys first // clear all keys first
for( i = 0; i < 256; i++ ) for( i = 0; i < 256; i++ )
{ {
if( keys[i].binding ) if( keys[i].binding )
@ -401,7 +401,7 @@ void Key_Reset_f( void )
// apply default values // apply default values
for( kn = keynames; kn->name; kn++ ) for( kn = keynames; kn->name; kn++ )
Key_SetBinding( kn->keynum, kn->binding ); Key_SetBinding( kn->keynum, kn->binding );
} }
/* /*
@ -413,7 +413,7 @@ void Key_Bind_f( void )
{ {
char cmd[1024]; char cmd[1024];
int i, c, b; int i, c, b;
c = Cmd_Argc(); c = Cmd_Argc();
if( c < 2 ) if( c < 2 )
@ -437,7 +437,7 @@ void Key_Bind_f( void )
else Con_Printf( "\"%s\" is not bound\n", Cmd_Argv( 1 )); else Con_Printf( "\"%s\" is not bound\n", Cmd_Argv( 1 ));
return; return;
} }
// copy the rest of the command line // copy the rest of the command line
cmd[0] = 0; // start out with a null string cmd[0] = 0; // start out with a null string
@ -515,10 +515,10 @@ void Key_Init( void )
Cmd_AddCommand( "unbindall", Key_Unbindall_f, "removes all commands from all keys in bindmap" ); Cmd_AddCommand( "unbindall", Key_Unbindall_f, "removes all commands from all keys in bindmap" );
Cmd_AddCommand( "resetkeys", Key_Reset_f, "reset all keys to their default values" ); Cmd_AddCommand( "resetkeys", Key_Reset_f, "reset all keys to their default values" );
Cmd_AddCommand( "bindlist", Key_Bindlist_f, "display current key bindings" ); Cmd_AddCommand( "bindlist", Key_Bindlist_f, "display current key bindings" );
Cmd_AddCommand( "makehelp", Key_EnumCmds_f, "write help.txt that contains all console cvars and cmds" ); Cmd_AddCommand( "makehelp", Key_EnumCmds_f, "write help.txt that contains all console cvars and cmds" );
// setup default binding. "unbindall" from config.cfg will be reset it // setup default binding. "unbindall" from config.cfg will be reset it
for( kn = keynames; kn->name; kn++ ) Key_SetBinding( kn->keynum, kn->binding ); for( kn = keynames; kn->name; kn++ ) Key_SetBinding( kn->keynum, kn->binding );
osk_enable = Cvar_Get( "osk_enable", "0", FCVAR_ARCHIVE, "enable built-in on-screen keyboard" ); osk_enable = Cvar_Get( "osk_enable", "0", FCVAR_ARCHIVE, "enable built-in on-screen keyboard" );
key_rotate = Cvar_Get( "key_rotate", "0", FCVAR_ARCHIVE, "rotate arrow keys (0-3)" ); key_rotate = Cvar_Get( "key_rotate", "0", FCVAR_ARCHIVE, "rotate arrow keys (0-3)" );
@ -592,7 +592,7 @@ static qboolean Key_IsAllowedAutoRepeat( int key )
return true; return true;
default: default:
return false; return false;
} }
} }
static int Key_Rotate( int key ) static int Key_Rotate( int key )
@ -774,7 +774,7 @@ void GAME_EXPORT Key_Event( int key, int down )
// key up events only perform actions if the game key binding is // key up events only perform actions if the game key binding is
// a button command (leading + sign). These will be processed even in // a button command (leading + sign). These will be processed even in
// console mode and menu mode, to keep the character from continuing // console mode and menu mode, to keep the character from continuing
// an action started before a mode switch. // an action started before a mode switch.
if( !down ) if( !down )
{ {
@ -892,7 +892,7 @@ void CL_CharEvent( int key )
if( cls.key_dest == key_console && !Con_Visible( )) if( cls.key_dest == key_console && !Con_Visible( ))
{ {
if((char)key == '`' || (char)key == '?' ) if((char)key == '`' || (char)key == '?' )
return; // don't pass '`' when we open the console return; // don't pass '`' when we open the console
} }
// distribute the key down event to the apropriate handler // distribute the key down event to the apropriate handler

View File

@ -211,7 +211,7 @@ sfx_t *S_FindName( const char *pname, int *pfInCache )
return NULL; return NULL;
s_numSfx++; s_numSfx++;
} }
sfx = &s_knownSfx[i]; sfx = &s_knownSfx[i];
memset( sfx, 0, sizeof( *sfx )); memset( sfx, 0, sizeof( *sfx ));
if( pfInCache ) *pfInCache = false; if( pfInCache ) *pfInCache = false;
@ -222,7 +222,7 @@ sfx_t *S_FindName( const char *pname, int *pfInCache )
// link it in // link it in
sfx->hashNext = s_sfxHashList[sfx->hashValue]; sfx->hashNext = s_sfxHashList[sfx->hashValue];
s_sfxHashList[sfx->hashValue] = sfx; s_sfxHashList[sfx->hashValue] = sfx;
return sfx; return sfx;
} }
@ -299,7 +299,7 @@ void S_EndRegistration( void )
if( !s_registering || !dma.initialized ) if( !s_registering || !dma.initialized )
return; return;
// free any sounds not from this registration sequence // free any sounds not from this registration sequence
for( i = 0, sfx = s_knownSfx; i < s_numSfx; i++, sfx++ ) for( i = 0, sfx = s_knownSfx; i < s_numSfx; i++, sfx++ )
{ {

View File

@ -80,8 +80,8 @@ void S_FadeClientVolume( float fadePercent, float fadeOutSeconds, float holdTime
{ {
soundfade.starttime = cl.mtime[0]; soundfade.starttime = cl.mtime[0];
soundfade.initial_percent = fadePercent; soundfade.initial_percent = fadePercent;
soundfade.fadeouttime = fadeOutSeconds; soundfade.fadeouttime = fadeOutSeconds;
soundfade.holdtime = holdTime; soundfade.holdtime = holdTime;
soundfade.fadeintime = fadeInSeconds; soundfade.fadeintime = fadeInSeconds;
} }
@ -97,7 +97,7 @@ qboolean S_IsClient( int entnum )
// free channel so that it may be allocated by the // free channel so that it may be allocated by the
// next request to play a sound. If sound is a // next request to play a sound. If sound is a
// word in a sentence, release the sentence. // word in a sentence, release the sentence.
// Works for static, dynamic, sentence and stream sounds // Works for static, dynamic, sentence and stream sounds
/* /*
@ -129,7 +129,7 @@ void S_UpdateSoundFade( void )
// determine current fade value. // determine current fade value.
// assume no fading remains // assume no fading remains
soundfade.percent = 0; soundfade.percent = 0;
totaltime = soundfade.fadeouttime + soundfade.fadeintime + soundfade.holdtime; totaltime = soundfade.fadeouttime + soundfade.fadeintime + soundfade.holdtime;
@ -178,7 +178,7 @@ void S_UpdateSoundFade( void )
================= =================
SND_FStreamIsPlaying SND_FStreamIsPlaying
Select a channel from the dynamic channel allocation area. For the given entity, Select a channel from the dynamic channel allocation area. For the given entity,
override any other sound playing on the same channel (see code comments below for override any other sound playing on the same channel (see code comments below for
exceptions). exceptions).
================= =================
@ -200,7 +200,7 @@ qboolean SND_FStreamIsPlaying( sfx_t *sfx )
================= =================
SND_PickDynamicChannel SND_PickDynamicChannel
Select a channel from the dynamic channel allocation area. For the given entity, Select a channel from the dynamic channel allocation area. For the given entity,
override any other sound playing on the same channel (see code comments below for override any other sound playing on the same channel (see code comments below for
exceptions). exceptions).
================= =================
@ -227,7 +227,7 @@ channel_t *SND_PickDynamicChannel( int entnum, int channel, sfx_t *sfx, qboolean
for( ch_idx = NUM_AMBIENTS; ch_idx < MAX_DYNAMIC_CHANNELS; ch_idx++ ) for( ch_idx = NUM_AMBIENTS; ch_idx < MAX_DYNAMIC_CHANNELS; ch_idx++ )
{ {
channel_t *ch = &channels[ch_idx]; channel_t *ch = &channels[ch_idx];
// Never override a streaming sound that is currently playing or // Never override a streaming sound that is currently playing or
// voice over IP data that is playing or any sound on CHAN_VOICE( acting ) // voice over IP data that is playing or any sound on CHAN_VOICE( acting )
if( ch->sfx && ( ch->entchannel == CHAN_STREAM )) if( ch->sfx && ( ch->entchannel == CHAN_STREAM ))
@ -290,8 +290,8 @@ channel_t *SND_PickDynamicChannel( int entnum, int channel, sfx_t *sfx, qboolean
SND_PickStaticChannel SND_PickStaticChannel
Pick an empty channel from the static sound area, or allocate a new Pick an empty channel from the static sound area, or allocate a new
channel. Only fails if we're at max_channels (128!!!) or if channel. Only fails if we're at max_channels (128!!!) or if
we're trying to allocate a channel for a stream sound that is we're trying to allocate a channel for a stream sound that is
already playing. already playing.
===================== =====================
*/ */
@ -310,7 +310,7 @@ channel_t *SND_PickStaticChannel( const vec3_t pos, sfx_t *sfx )
break; break;
} }
if( i < total_channels ) if( i < total_channels )
{ {
// reuse an empty static sound channel // reuse an empty static sound channel
ch = &channels[i]; ch = &channels[i];
@ -346,7 +346,7 @@ returns FALSE if sound was not found (sound is not playing)
int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int flags ) int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int flags )
{ {
channel_t *ch; channel_t *ch;
int i; int i;
if( S_TestSoundChar( sfx->name, '!' )) if( S_TestSoundChar( sfx->name, '!' ))
{ {
@ -361,10 +361,10 @@ int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int
{ {
if( flags & SND_CHANGE_PITCH ) if( flags & SND_CHANGE_PITCH )
ch->basePitch = pitch; ch->basePitch = pitch;
if( flags & SND_CHANGE_VOL ) if( flags & SND_CHANGE_VOL )
ch->master_vol = vol; ch->master_vol = vol;
if( flags & SND_STOP ) if( flags & SND_STOP )
S_FreeChannel( ch ); S_FreeChannel( ch );
@ -383,7 +383,7 @@ int S_AlterChannel( int entnum, int channel, sfx_t *sfx, int vol, int pitch, int
{ {
if( flags & SND_CHANGE_PITCH ) if( flags & SND_CHANGE_PITCH )
ch->basePitch = pitch; ch->basePitch = pitch;
if( flags & SND_CHANGE_VOL ) if( flags & SND_CHANGE_VOL )
ch->master_vol = vol; ch->master_vol = vol;
@ -476,7 +476,7 @@ void SND_Spatialize( channel_t *ch )
==================== ====================
S_StartSound S_StartSound
Start a sound effect for the given entity on the given channel (ie; voice, weapon etc). Start a sound effect for the given entity on the given channel (ie; voice, weapon etc).
Try to grab a channel out of the 8 dynamic spots available. Try to grab a channel out of the 8 dynamic spots available.
Currently used for looping sounds, streaming sounds, sentences, and regular entity sounds. Currently used for looping sounds, streaming sounds, sentences, and regular entity sounds.
NOTE: volume is 0.0 - 1.0 and attenuation is 0.0 - 1.0 when passed in. NOTE: volume is 0.0 - 1.0 and attenuation is 0.0 - 1.0 when passed in.
@ -509,7 +509,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
return; return;
if( flags & SND_STOP ) return; if( flags & SND_STOP ) return;
// fall through - if we're not trying to stop the sound, // fall through - if we're not trying to stop the sound,
// and we didn't find it (it's not playing), go ahead and start it up // and we didn't find it (it's not playing), go ahead and start it up
} }
@ -552,7 +552,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
// link all words and load the first word // link all words and load the first word
// NOTE: sentence names stored in the cache lookup are // NOTE: sentence names stored in the cache lookup are
// prepended with a '!'. Sentence names stored in the // prepended with a '!'. Sentence names stored in the
// sentence file do not have a leading '!'. // sentence file do not have a leading '!'.
VOX_LoadSound( target_chan, S_SkipSoundChar( sfx->name )); VOX_LoadSound( target_chan, S_SkipSoundChar( sfx->name ));
Q_strncpy( target_chan->name, sfx->name, sizeof( target_chan->name )); Q_strncpy( target_chan->name, sfx->name, sizeof( target_chan->name ));
sfx = target_chan->sfx; sfx = target_chan->sfx;
@ -574,7 +574,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv
SND_Spatialize( target_chan ); SND_Spatialize( target_chan );
// If a client can't hear a sound when they FIRST receive the StartSound message, // If a client can't hear a sound when they FIRST receive the StartSound message,
// the client will never be able to hear that sound. This is so that out of // the client will never be able to hear that sound. This is so that out of
// range sounds don't fill the playback buffer. For streaming sounds, we bypass this optimization. // range sounds don't fill the playback buffer. For streaming sounds, we bypass this optimization.
if( !target_chan->leftvol && !target_chan->rightvol ) if( !target_chan->leftvol && !target_chan->rightvol )
{ {
@ -664,7 +664,7 @@ void S_RestoreSound( const vec3_t pos, int ent, int chan, sound_t handle, float
// link all words and load the first word // link all words and load the first word
// NOTE: sentence names stored in the cache lookup are // NOTE: sentence names stored in the cache lookup are
// prepended with a '!'. Sentence names stored in the // prepended with a '!'. Sentence names stored in the
// sentence file do not have a leading '!'. // sentence file do not have a leading '!'.
VOX_LoadSound( target_chan, S_SkipSoundChar( sfx->name )); VOX_LoadSound( target_chan, S_SkipSoundChar( sfx->name ));
Q_strncpy( target_chan->name, sfx->name, sizeof( target_chan->name )); Q_strncpy( target_chan->name, sfx->name, sizeof( target_chan->name ));
@ -708,7 +708,7 @@ void S_RestoreSound( const vec3_t pos, int ent, int chan, sound_t handle, float
// apply the sample offests // apply the sample offests
target_chan->pMixer.sample = sample; target_chan->pMixer.sample = sample;
target_chan->pMixer.forcedEndSample = end; target_chan->pMixer.forcedEndSample = end;
// Init client entity mouth movement vars // Init client entity mouth movement vars
SND_InitMouth( ent, chan ); SND_InitMouth( ent, chan );
@ -763,7 +763,7 @@ void S_AmbientSound( const vec3_t pos, int ent, sound_t handle, float fvol, floa
// this is a sentence. link words to play in sequence. // this is a sentence. link words to play in sequence.
// NOTE: sentence names stored in the cache lookup are // NOTE: sentence names stored in the cache lookup are
// prepended with a '!'. Sentence names stored in the // prepended with a '!'. Sentence names stored in the
// sentence file do not have a leading '!'. // sentence file do not have a leading '!'.
// link all words and load the first word // link all words and load the first word
VOX_LoadSound( ch, S_SkipSoundChar( sfx->name )); VOX_LoadSound( ch, S_SkipSoundChar( sfx->name ));
@ -812,7 +812,7 @@ void S_StartLocalSound( const char *name, float volume, qboolean reliable )
if( reliable ) channel = CHAN_STATIC; if( reliable ) channel = CHAN_STATIC;
if( !dma.initialized ) return; if( !dma.initialized ) return;
sfxHandle = S_RegisterSound( name ); sfxHandle = S_RegisterSound( name );
S_StartSound( NULL, s_listener.entnum, channel, sfxHandle, volume, ATTN_NONE, PITCH_NORM, flags ); S_StartSound( NULL, s_listener.entnum, channel, sfxHandle, volume, ATTN_NONE, PITCH_NORM, flags );
} }
@ -881,7 +881,7 @@ int S_GetCurrentDynamicSounds( soundlist_t *pout, int size )
looped = ( channels[i].use_loop && channels[i].sfx->cache->loopStart != -1 ); looped = ( channels[i].use_loop && channels[i].sfx->cache->loopStart != -1 );
if( channels[i].entchannel == CHAN_STATIC && looped && !Host_IsQuakeCompatible()) if( channels[i].entchannel == CHAN_STATIC && looped && !Host_IsQuakeCompatible())
continue; // never serialize static looped sounds. It will be restoring in game code continue; // never serialize static looped sounds. It will be restoring in game code
if( channels[i].isSentence && channels[i].name[0] ) if( channels[i].isSentence && channels[i].name[0] )
Q_strncpy( pout->name, channels[i].name, sizeof( pout->name )); Q_strncpy( pout->name, channels[i].name, sizeof( pout->name ));
@ -916,7 +916,7 @@ void S_InitAmbientChannels( void )
for( ambient_channel = 0; ambient_channel < NUM_AMBIENTS; ambient_channel++ ) for( ambient_channel = 0; ambient_channel < NUM_AMBIENTS; ambient_channel++ )
{ {
chan = &channels[ambient_channel]; chan = &channels[ambient_channel];
chan->staticsound = true; chan->staticsound = true;
chan->use_loop = true; chan->use_loop = true;
@ -954,7 +954,7 @@ void S_UpdateAmbientSounds( void )
for( ambient_channel = 0; ambient_channel < NUM_AMBIENTS; ambient_channel++ ) for( ambient_channel = 0; ambient_channel < NUM_AMBIENTS; ambient_channel++ )
{ {
chan = &channels[ambient_channel]; chan = &channels[ambient_channel];
chan->sfx = S_GetSfxByHandle( ambient_sfx[ambient_channel] ); chan->sfx = S_GetSfxByHandle( ambient_sfx[ambient_channel] );
// ambient is unused // ambient is unused
@ -979,7 +979,7 @@ void S_UpdateAmbientSounds( void )
chan->master_vol -= s_listener.frametime * s_ambient_fade->value; chan->master_vol -= s_listener.frametime * s_ambient_fade->value;
if( chan->master_vol < vol ) chan->master_vol = vol; if( chan->master_vol < vol ) chan->master_vol = vol;
} }
chan->leftvol = chan->rightvol = chan->master_vol; chan->leftvol = chan->rightvol = chan->master_vol;
} }
} }
@ -1240,7 +1240,7 @@ void S_StreamAviSamples( void *Avi, int entnum, float fvol, float attn, float sy
S_GetRawSamplesLength S_GetRawSamplesLength
=================== ===================
*/ */
uint S_GetRawSamplesLength( int entnum ) uint S_GetRawSamplesLength( int entnum )
{ {
rawchan_t *ch; rawchan_t *ch;
@ -1255,7 +1255,7 @@ uint S_GetRawSamplesLength( int entnum )
S_ClearRawChannel S_ClearRawChannel
=================== ===================
*/ */
void S_ClearRawChannel( int entnum ) void S_ClearRawChannel( int entnum )
{ {
rawchan_t *ch; rawchan_t *ch;
@ -1320,7 +1320,7 @@ S_SpatializeRawChannels
static void S_SpatializeRawChannels( void ) static void S_SpatializeRawChannels( void )
{ {
int i; int i;
for( i = 0; i < MAX_RAW_CHANNELS; i++ ) for( i = 0; i < MAX_RAW_CHANNELS; i++ )
{ {
rawchan_t *ch = raw_channels[i]; rawchan_t *ch = raw_channels[i];
@ -1430,7 +1430,7 @@ void S_StopAllSounds( qboolean ambient )
if( !dma.initialized ) return; if( !dma.initialized ) return;
total_channels = MAX_DYNAMIC_CHANNELS; // no statics total_channels = MAX_DYNAMIC_CHANNELS; // no statics
for( i = 0; i < MAX_CHANNELS; i++ ) for( i = 0; i < MAX_CHANNELS; i++ )
{ {
if( !channels[i].sfx ) continue; if( !channels[i].sfx ) continue;
S_FreeChannel( &channels[i] ); S_FreeChannel( &channels[i] );
@ -1471,10 +1471,10 @@ void S_UpdateChannels( void )
if((int)(endtime - soundtime) > samps ) if((int)(endtime - soundtime) > samps )
endtime = soundtime + samps; endtime = soundtime + samps;
if(( endtime - paintedtime ) & 0x3 ) if(( endtime - paintedtime ) & 0x3 )
{ {
// the difference between endtime and painted time should align on // the difference between endtime and painted time should align on
// boundaries of 4 samples. this is important when upsampling from 11khz -> 44khz. // boundaries of 4 samples. this is important when upsampling from 11khz -> 44khz.
endtime -= ( endtime - paintedtime ) & 0x3; endtime -= ( endtime - paintedtime ) & 0x3;
} }
@ -1507,7 +1507,7 @@ update listener position
void S_UpdateFrame( struct ref_viewpass_s *rvp ) void S_UpdateFrame( struct ref_viewpass_s *rvp )
{ {
if( !FBitSet( rvp->flags, RF_DRAW_WORLD ) || FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW )) if( !FBitSet( rvp->flags, RF_DRAW_WORLD ) || FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW ))
return; return;
VectorCopy( rvp->vieworigin, s_listener.origin ); VectorCopy( rvp->vieworigin, s_listener.origin );
AngleVectors( rvp->viewangles, s_listener.forward, s_listener.right, s_listener.up ); AngleVectors( rvp->viewangles, s_listener.forward, s_listener.right, s_listener.up );
@ -1550,7 +1550,7 @@ void SND_UpdateSound( void )
combine = NULL; combine = NULL;
// update spatialization for static and dynamic sounds // update spatialization for static and dynamic sounds
for( i = NUM_AMBIENTS, ch = channels + NUM_AMBIENTS; i < total_channels; i++, ch++ ) for( i = NUM_AMBIENTS, ch = channels + NUM_AMBIENTS; i < total_channels; i++, ch++ )
{ {
if( !ch->sfx ) continue; if( !ch->sfx ) continue;
@ -1822,7 +1822,7 @@ qboolean S_Init( void )
s_lerping = Cvar_Get( "s_lerping", "0", FCVAR_ARCHIVE, "apply interpolation to sound output" ); s_lerping = Cvar_Get( "s_lerping", "0", FCVAR_ARCHIVE, "apply interpolation to sound output" );
s_ambient_level = Cvar_Get( "ambient_level", "0.3", FCVAR_ARCHIVE, "volume of environment noises (water and wind)" ); s_ambient_level = Cvar_Get( "ambient_level", "0.3", FCVAR_ARCHIVE, "volume of environment noises (water and wind)" );
s_ambient_fade = Cvar_Get( "ambient_fade", "1000", FCVAR_ARCHIVE, "rate of volume fading when client is moving" ); s_ambient_fade = Cvar_Get( "ambient_fade", "1000", FCVAR_ARCHIVE, "rate of volume fading when client is moving" );
s_combine_sounds = Cvar_Get( "s_combine_channels", "0", FCVAR_ARCHIVE, "combine channels with same sounds" ); s_combine_sounds = Cvar_Get( "s_combine_channels", "0", FCVAR_ARCHIVE, "combine channels with same sounds" );
snd_mute_losefocus = Cvar_Get( "snd_mute_losefocus", "1", FCVAR_ARCHIVE, "silence the audio when game window loses focus" ); snd_mute_losefocus = Cvar_Get( "snd_mute_losefocus", "1", FCVAR_ARCHIVE, "silence the audio when game window loses focus" );
s_test = Cvar_Get( "s_test", "0", 0, "engine developer cvar for quick testing new features" ); s_test = Cvar_Get( "s_test", "0", 0, "engine developer cvar for quick testing new features" );
s_samplecount = Cvar_Get( "s_samplecount", "0", FCVAR_ARCHIVE, "sample count (0 for default value)" ); s_samplecount = Cvar_Get( "s_samplecount", "0", FCVAR_ARCHIVE, "sample count (0 for default value)" );

View File

@ -109,7 +109,7 @@ void S_TransferPaintBuffer( int endtime )
//=============================================================================== //===============================================================================
// Mix buffer (paintbuffer) management routines // Mix buffer (paintbuffer) management routines
//=============================================================================== //===============================================================================
// Activate a paintbuffer. All active paintbuffers are mixed in parallel within // Activate a paintbuffer. All active paintbuffers are mixed in parallel within
// MIX_MixChannelsToPaintbuffer, according to flags // MIX_MixChannelsToPaintbuffer, according to flags
_inline void MIX_ActivatePaintbuffer( int ipaintbuffer ) _inline void MIX_ActivatePaintbuffer( int ipaintbuffer )
{ {
@ -146,7 +146,7 @@ _inline int MIX_GetCurrentPaintbufferIndex( void )
_inline paintbuffer_t *MIX_GetCurrentPaintbufferPtr( void ) _inline paintbuffer_t *MIX_GetCurrentPaintbufferPtr( void )
{ {
int ipaint = MIX_GetCurrentPaintbufferIndex(); int ipaint = MIX_GetCurrentPaintbufferIndex();
Assert( ipaint < CPAINTBUFFERS ); Assert( ipaint < CPAINTBUFFERS );
return &paintbuffers[ipaint]; return &paintbuffers[ipaint];
} }
@ -183,7 +183,7 @@ _inline portable_samplepair_t *MIX_GetPFrontFromIPaint( int ipaintbuffer )
} }
_inline paintbuffer_t *MIX_GetPPaintFromIPaint( int ipaint ) _inline paintbuffer_t *MIX_GetPPaintFromIPaint( int ipaint )
{ {
Assert( ipaint < CPAINTBUFFERS ); Assert( ipaint < CPAINTBUFFERS );
return &paintbuffers[ipaint]; return &paintbuffers[ipaint];
} }
@ -203,7 +203,7 @@ void MIX_InitAllPaintbuffers( void )
paintbuffers[IPAINTBUFFER].pbuf = paintbuffer; paintbuffers[IPAINTBUFFER].pbuf = paintbuffer;
paintbuffers[IROOMBUFFER].pbuf = roombuffer; paintbuffers[IROOMBUFFER].pbuf = roombuffer;
paintbuffers[ISTREAMBUFFER].pbuf = streambuffer; paintbuffers[ISTREAMBUFFER].pbuf = streambuffer;
MIX_SetCurrentPaintbuffer( IPAINTBUFFER ); MIX_SetCurrentPaintbuffer( IPAINTBUFFER );
} }
@ -218,7 +218,7 @@ void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, in
{ {
int *lscale, *rscale; int *lscale, *rscale;
int i, data; int i, data;
lscale = snd_scaletable[volume[0] >> SND_SCALE_SHIFT]; lscale = snd_scaletable[volume[0] >> SND_SCALE_SHIFT];
rscale = snd_scaletable[volume[1] >> SND_SCALE_SHIFT]; rscale = snd_scaletable[volume[1] >> SND_SCALE_SHIFT];
@ -272,7 +272,7 @@ void S_PaintStereoFrom16( portable_samplepair_t *pbuf, int *volume, short *pData
int i; int i;
data = (uint *)pData; data = (uint *)pData;
for( i = 0; i < outCount; i++, data++ ) for( i = 0; i < outCount; i++, data++ )
{ {
left = (signed short)((*data & 0x0000FFFF)); left = (signed short)((*data & 0x0000FFFF));
@ -425,7 +425,7 @@ int S_MixDataToDevice( channel_t *pChannel, int sampleCount, int outRate, int ou
int startingOffset = outOffset; int startingOffset = outOffset;
float inputRate = ( pChannel->pitch * pChannel->sfx->cache->rate ); float inputRate = ( pChannel->pitch * pChannel->sfx->cache->rate );
float rate = inputRate / outRate; float rate = inputRate / outRate;
// shouldn't be playing this if finished, but return if we are // shouldn't be playing this if finished, but return if we are
if( pChannel->pMixer.finished ) if( pChannel->pMixer.finished )
return 0; return 0;
@ -528,7 +528,7 @@ qboolean S_ShouldContinueMixing( channel_t *ch )
// flags: if SOUND_MIX_DRY, then mix only samples with channel flagged as 'dry' // flags: if SOUND_MIX_DRY, then mix only samples with channel flagged as 'dry'
// outputRate: target mix rate for all samples. Note, if outputRate = SOUND_DMA_SPEED, then // outputRate: target mix rate for all samples. Note, if outputRate = SOUND_DMA_SPEED, then
// this routine will fill the paintbuffer to endtime. Otherwise, fewer samples are mixed. // this routine will fill the paintbuffer to endtime. Otherwise, fewer samples are mixed.
// if( endtime - paintedtime ) is not aligned on boundaries of 4, // if( endtime - paintedtime ) is not aligned on boundaries of 4,
// we'll miss data if outputRate < SOUND_DMA_SPEED! // we'll miss data if outputRate < SOUND_DMA_SPEED!
void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate ) void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
{ {
@ -539,16 +539,16 @@ void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
// mix each channel into paintbuffer // mix each channel into paintbuffer
ch = channels; ch = channels;
// validate parameters // validate parameters
Assert( outputRate <= SOUND_DMA_SPEED ); Assert( outputRate <= SOUND_DMA_SPEED );
// make sure we're not discarding data // make sure we're not discarding data
Assert( !(( endtime - paintedtime ) & 0x3 ) || ( outputRate == SOUND_DMA_SPEED )); Assert( !(( endtime - paintedtime ) & 0x3 ) || ( outputRate == SOUND_DMA_SPEED ));
// 44k: try to mix this many samples at outputRate // 44k: try to mix this many samples at outputRate
sampleCount = ( endtime - paintedtime ) / ( SOUND_DMA_SPEED / outputRate ); sampleCount = ( endtime - paintedtime ) / ( SOUND_DMA_SPEED / outputRate );
if( sampleCount <= 0 ) return; if( sampleCount <= 0 ) return;
for( i = 0; i < total_channels; i++, ch++ ) for( i = 0; i < total_channels; i++, ch++ )
@ -578,10 +578,10 @@ void MIX_MixChannelsToPaintbuffer( int endtime, int rate, int outputRate )
pSource = S_LoadSound( ch->sfx ); pSource = S_LoadSound( ch->sfx );
// Don't mix sound data for sounds with zero volume. If it's a non-looping sound, // Don't mix sound data for sounds with zero volume. If it's a non-looping sound,
// just remove the sound when its volume goes to zero. // just remove the sound when its volume goes to zero.
bZeroVolume = !ch->leftvol && !ch->rightvol; bZeroVolume = !ch->leftvol && !ch->rightvol;
if( !bZeroVolume ) if( !bZeroVolume )
{ {
// this values matched with GoldSrc // this values matched with GoldSrc
@ -647,7 +647,7 @@ _inline portable_samplepair_t *S_GetNextpFilter( int i, portable_samplepair_t *p
if( i == 0 ) return (&(pfiltermem[1])); if( i == 0 ) return (&(pfiltermem[1]));
if( i == 1 ) return (&(pfiltermem[2])); if( i == 1 ) return (&(pfiltermem[2]));
// return from paintbuffer, where samples are doubled. // return from paintbuffer, where samples are doubled.
// even samples are to be replaced with interpolated value. // even samples are to be replaced with interpolated value.
return (&(pbuffer[(i-2) * 2 + 1])); return (&(pbuffer[(i-2) * 2 + 1]));
} }
@ -708,32 +708,32 @@ void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t
x0 = psamp1->left; x0 = psamp1->left;
x1 = psamp2->left; x1 = psamp2->left;
x2 = psamp3->left; x2 = psamp3->left;
// interpolate // interpolate
a = (3 * (x0-x1) - xm1 + x2) / 2; a = (3 * (x0-x1) - xm1 + x2) / 2;
b = 2*x1 + xm1 - (5*x0 + x2) / 2; b = 2*x1 + xm1 - (5*x0 + x2) / 2;
c = (x1 - xm1) / 2; c = (x1 - xm1) / 2;
// write out interpolated sample // write out interpolated sample
temppaintbuffer[outpos].left = a/8 + b/4 + c/2 + x0; temppaintbuffer[outpos].left = a/8 + b/4 + c/2 + x0;
// get all right samples for window // get all right samples for window
xm1 = psamp0->right; xm1 = psamp0->right;
x0 = psamp1->right; x0 = psamp1->right;
x1 = psamp2->right; x1 = psamp2->right;
x2 = psamp3->right; x2 = psamp3->right;
// interpolate // interpolate
a = (3 * (x0-x1) - xm1 + x2) / 2; a = (3 * (x0-x1) - xm1 + x2) / 2;
b = 2*x1 + xm1 - (5*x0 + x2) / 2; b = 2*x1 + xm1 - (5*x0 + x2) / 2;
c = (x1 - xm1) / 2; c = (x1 - xm1) / 2;
// write out interpolated sample, increment output counter // write out interpolated sample, increment output counter
temppaintbuffer[outpos++].right = a/8 + b/4 + c/2 + x0; temppaintbuffer[outpos++].right = a/8 + b/4 + c/2 + x0;
Assert( outpos <= ( sizeof( temppaintbuffer ) / sizeof( temppaintbuffer[0] ))); Assert( outpos <= ( sizeof( temppaintbuffer ) / sizeof( temppaintbuffer[0] )));
} }
Assert( cfltmem >= 3 ); Assert( cfltmem >= 3 );
// save last 3 samples from paintbuffer // save last 3 samples from paintbuffer
@ -770,7 +770,7 @@ void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_
} }
// save last value to be played out in buffer // save last value to be played out in buffer
*pfiltermem = pbuffer[upCount - 1]; *pfiltermem = pbuffer[upCount - 1];
} }
// upsample by 2x, optionally using interpolation // upsample by 2x, optionally using interpolation
@ -783,11 +783,11 @@ void S_Interpolate2xLinear( portable_samplepair_t *pbuffer, portable_samplepair_
void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype ) void S_MixBufferUpsample2x( int count, portable_samplepair_t *pbuffer, portable_samplepair_t *pfiltermem, int cfltmem, int filtertype )
{ {
int upCount = count<<1; int upCount = count<<1;
int i, j; int i, j;
// reverse through buffer, duplicating contents for 'count' samples // reverse through buffer, duplicating contents for 'count' samples
for( i = upCount - 1, j = count - 1; j >= 0; i-=2, j-- ) for( i = upCount - 1, j = count - 1; j >= 0; i-=2, j-- )
{ {
pbuffer[i] = pbuffer[j]; pbuffer[i] = pbuffer[j];
pbuffer[i-1] = pbuffer[j]; pbuffer[i-1] = pbuffer[j];
} }
@ -839,7 +839,7 @@ void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgai
int i, gain; int i, gain;
gain = 256 * fgain; gain = 256 * fgain;
Assert( count <= PAINTBUFFER_SIZE ); Assert( count <= PAINTBUFFER_SIZE );
Assert( ibuf1 < CPAINTBUFFERS ); Assert( ibuf1 < CPAINTBUFFERS );
Assert( ibuf2 < CPAINTBUFFERS ); Assert( ibuf2 < CPAINTBUFFERS );
@ -848,8 +848,8 @@ void MIX_MixPaintbuffers( int ibuf1, int ibuf2, int ibuf3, int count, float fgai
pbuf1 = paintbuffers[ibuf1].pbuf; pbuf1 = paintbuffers[ibuf1].pbuf;
pbuf2 = paintbuffers[ibuf2].pbuf; pbuf2 = paintbuffers[ibuf2].pbuf;
pbuf3 = paintbuffers[ibuf3].pbuf; pbuf3 = paintbuffers[ibuf3].pbuf;
// destination buffer stereo - average n chans down to stereo // destination buffer stereo - average n chans down to stereo
// destination 2ch: // destination 2ch:
// pb1 2ch + pb2 2ch -> pb3 2ch // pb1 2ch + pb2 2ch -> pb3 2ch
@ -874,7 +874,7 @@ void MIX_CompressPaintbuffer( int ipaint, int count )
ppaint = MIX_GetPPaintFromIPaint( ipaint ); ppaint = MIX_GetPPaintFromIPaint( ipaint );
pbuf = ppaint->pbuf; pbuf = ppaint->pbuf;
for( i = 0; i < count; i++, pbuf++ ) for( i = 0; i < count; i++, pbuf++ )
{ {
pbuf->left = CLIP( pbuf->left ); pbuf->left = CLIP( pbuf->left );
@ -909,7 +909,7 @@ void MIX_MixStreamBuffer( int end )
memset( pbuf, 0, (end - paintedtime) * sizeof( portable_samplepair_t )); memset( pbuf, 0, (end - paintedtime) * sizeof( portable_samplepair_t ));
} }
else else
{ {
int i, stop; int i, stop;
// copy from the streaming sound source // copy from the streaming sound source
@ -919,7 +919,7 @@ void MIX_MixStreamBuffer( int end )
{ {
pbuf[i-paintedtime].left = ( ch->rawsamples[i & ( ch->max_samples - 1 )].left * ch->leftvol ) >> 8; pbuf[i-paintedtime].left = ( ch->rawsamples[i & ( ch->max_samples - 1 )].left * ch->leftvol ) >> 8;
pbuf[i-paintedtime].right = ( ch->rawsamples[i & ( ch->max_samples - 1 )].right * ch->rightvol ) >> 8; pbuf[i-paintedtime].right = ( ch->rawsamples[i & ( ch->max_samples - 1 )].right * ch->rightvol ) >> 8;
} }
for( ; i < end; i++ ) for( ; i < end; i++ )
pbuf[i-paintedtime].left = pbuf[i-paintedtime].right = 0; pbuf[i-paintedtime].left = pbuf[i-paintedtime].right = 0;
@ -985,7 +985,7 @@ void MIX_UpsampleAllPaintbuffers( int end, int count )
// only mix to roombuffer if dsp fx are on KDB: perf // only mix to roombuffer if dsp fx are on KDB: perf
MIX_ActivatePaintbuffer( IROOMBUFFER ); // operates on MIX_MixChannelsToPaintbuffer MIX_ActivatePaintbuffer( IROOMBUFFER ); // operates on MIX_MixChannelsToPaintbuffer
// mix 11khz sounds: // mix 11khz sounds:
MIX_MixChannelsToPaintbuffer( end, SOUND_11k, SOUND_11k ); MIX_MixChannelsToPaintbuffer( end, SOUND_11k, SOUND_11k );
// upsample all 11khz buffers by 2x // upsample all 11khz buffers by 2x
@ -993,9 +993,9 @@ void MIX_UpsampleAllPaintbuffers( int end, int count )
MIX_SetCurrentPaintbuffer( IROOMBUFFER ); // operates on MixUpSample MIX_SetCurrentPaintbuffer( IROOMBUFFER ); // operates on MixUpSample
S_MixUpsample( count / ( SOUND_DMA_SPEED / SOUND_11k ), s_lerping->value ); S_MixUpsample( count / ( SOUND_DMA_SPEED / SOUND_11k ), s_lerping->value );
// mix 22khz sounds: // mix 22khz sounds:
MIX_MixChannelsToPaintbuffer( end, SOUND_22k, SOUND_22k ); MIX_MixChannelsToPaintbuffer( end, SOUND_22k, SOUND_22k );
// upsample all 22khz buffers by 2x // upsample all 22khz buffers by 2x
// only upsample roombuffer if dsp fx are on KDB: perf // only upsample roombuffer if dsp fx are on KDB: perf
MIX_SetCurrentPaintbuffer( IROOMBUFFER ); MIX_SetCurrentPaintbuffer( IROOMBUFFER );
@ -1040,7 +1040,7 @@ void MIX_PaintChannels( int endtime )
MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() ); MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() );
// add music or soundtrack from movie (no dsp) // add music or soundtrack from movie (no dsp)
MIX_MixPaintbuffers( IPAINTBUFFER, ISTREAMBUFFER, IPAINTBUFFER, count, S_GetMusicVolume() ); MIX_MixPaintbuffers( IPAINTBUFFER, ISTREAMBUFFER, IPAINTBUFFER, count, S_GetMusicVolume() );
// clip all values > 16 bit down to 16 bit // clip all values > 16 bit down to 16 bit
MIX_CompressPaintbuffer( IPAINTBUFFER, count ); MIX_CompressPaintbuffer( IPAINTBUFFER, count );

View File

@ -36,10 +36,10 @@ int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample )
sampleSize = pWaveData->width * pWaveData->channels; sampleSize = pWaveData->width * pWaveData->channels;
// this can never be zero -- other functions divide by this. // this can never be zero -- other functions divide by this.
// This should never happen, but avoid crashing // This should never happen, but avoid crashing
if( sampleSize <= 0 ) sampleSize = 1; if( sampleSize <= 0 ) sampleSize = 1;
if( pWaveData->width == 1 ) if( pWaveData->width == 1 )
{ {
signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize); signed char *pData = (signed char *)(pWaveData->buffer + sample * sampleSize);
@ -133,7 +133,7 @@ int S_ZeroCrossingAfter( wavdata_t *pWaveData, int sample )
sampleSize = pWaveData->width * pWaveData->channels; sampleSize = pWaveData->width * pWaveData->channels;
// this can never be zero -- other functions divide by this. // this can never be zero -- other functions divide by this.
// This should never happen, but avoid crashing // This should never happen, but avoid crashing
if( sampleSize <= 0 ) sampleSize = 1; if( sampleSize <= 0 ) sampleSize = 1;
@ -232,7 +232,7 @@ int S_ConvertLoopedPosition( wavdata_t *pSource, int samplePosition, qboolean us
// subtract off starting bit of the wave // subtract off starting bit of the wave
samplePosition -= pSource->loopStart; samplePosition -= pSource->loopStart;
if( loopSize ) if( loopSize )
{ {
// "real" position in memory (mod off extra loops) // "real" position in memory (mod off extra loops)
@ -264,7 +264,7 @@ int S_GetOutputData( wavdata_t *pSource, void **pData, int samplePosition, int s
sampleSize = pSource->width * pSource->channels; sampleSize = pSource->width * pSource->channels;
// this can never be zero -- other functions divide by this. // this can never be zero -- other functions divide by this.
// This should never happen, but avoid crashing // This should never happen, but avoid crashing
if( sampleSize <= 0 ) sampleSize = 1; if( sampleSize <= 0 ) sampleSize = 1;

View File

@ -115,7 +115,7 @@ char *VOX_LookupString( const char *pSentenceName, int *psentencenum )
if( Q_isdigit( pSentenceName ) && (i = Q_atoi( pSentenceName )) < g_numSentences ) if( Q_isdigit( pSentenceName ) && (i = Q_atoi( pSentenceName )) < g_numSentences )
{ {
if( psentencenum ) *psentencenum = i; if( psentencenum ) *psentencenum = i;
return (g_Sentences[i].pName + Q_strlen( g_Sentences[i].pName ) + 1 ); return (g_Sentences[i].pName + Q_strlen( g_Sentences[i].pName ) + 1 );
} }
for( i = 0; i < g_numSentences; i++ ) for( i = 0; i < g_numSentences; i++ )
@ -133,7 +133,7 @@ char *VOX_LookupString( const char *pSentenceName, int *psentencenum )
// parse a null terminated string of text into component words, with // parse a null terminated string of text into component words, with
// pointers to each word stored in rgpparseword // pointers to each word stored in rgpparseword
// note: this code actually alters the passed in string! // note: this code actually alters the passed in string!
char **VOX_ParseString( char *psz ) char **VOX_ParseString( char *psz )
{ {
int i, fdone = 0; int i, fdone = 0;
char c, *p = psz; char c, *p = psz;
@ -151,7 +151,7 @@ char **VOX_ParseString( char *psz )
c = *p; c = *p;
while( c && !IsNextWord( c )) while( c && !IsNextWord( c ))
c = *(++p); c = *(++p);
// if '(' then scan for matching ')' // if '(' then scan for matching ')'
if( c == '(' ) if( c == '(' )
{ {
@ -165,7 +165,7 @@ char **VOX_ParseString( char *psz )
fdone = 1; fdone = 1;
} }
else else
{ {
// if . or , insert pause into rgpparseword, // if . or , insert pause into rgpparseword,
// unless this is the last character // unless this is the last character
if(( c == '.' || c == ',' ) && *(p+1) != '\n' && *(p+1) != '\r' && *(p+1) != 0 ) if(( c == '.' || c == ',' ) && *(p+1) != '\n' && *(p+1) != '\r' && *(p+1) != 0 )
@ -237,9 +237,9 @@ float VOX_ModifyPitch( channel_t *ch, float pitch )
//=============================================================================== //===============================================================================
// Get any pitch, volume, start, end params into voxword // Get any pitch, volume, start, end params into voxword
// and null out trailing format characters // and null out trailing format characters
// Format: // Format:
// someword(v100 p110 s10 e20) // someword(v100 p110 s10 e20)
// //
// v is volume, 0% to n% // v is volume, 0% to n%
// p is pitch shift up 0% to n% // p is pitch shift up 0% to n%
// s is start wave offset % // s is start wave offset %
@ -249,20 +249,20 @@ float VOX_ModifyPitch( channel_t *ch, float pitch )
// pass fFirst == 1 if this is the first string in sentence // pass fFirst == 1 if this is the first string in sentence
// returns 1 if valid string, 0 if parameter block only. // returns 1 if valid string, 0 if parameter block only.
// //
// If a ( xxx ) parameter block does not directly follow a word, // If a ( xxx ) parameter block does not directly follow a word,
// then that 'default' parameter block will be used as the default value // then that 'default' parameter block will be used as the default value
// for all following words. Default parameter values are reset // for all following words. Default parameter values are reset
// by another 'default' parameter block. Default parameter values // by another 'default' parameter block. Default parameter values
// for a single word are overridden for that word if it has a parameter block. // for a single word are overridden for that word if it has a parameter block.
// //
//=============================================================================== //===============================================================================
int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst ) int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst )
{ {
char *pszsave = psz; char *pszsave = psz;
char c, ct, sznum[8]; char c, ct, sznum[8];
static voxword_t voxwordDefault; static voxword_t voxwordDefault;
int i; int i;
// init to defaults if this is the first word in string. // init to defaults if this is the first word in string.
if( fFirst ) if( fFirst )
{ {
@ -276,12 +276,12 @@ int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst )
*pvoxword = voxwordDefault; *pvoxword = voxwordDefault;
// look at next to last char to see if we have a // look at next to last char to see if we have a
// valid format: // valid format:
c = *( psz + Q_strlen( psz ) - 1 ); c = *( psz + Q_strlen( psz ) - 1 );
// no formatting, return // no formatting, return
if( c != ')' ) return 1; if( c != ')' ) return 1;
// scan forward to first '(' // scan forward to first '('
c = *psz; c = *psz;
@ -290,7 +290,7 @@ int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst )
// bogus formatting // bogus formatting
if( c == ')' ) return 0; if( c == ')' ) return 0;
// null terminate // null terminate
*psz = 0; *psz = 0;
ct = *(++psz); ct = *(++psz);
@ -300,7 +300,7 @@ int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst )
// scan until we hit a character in the commandSet // scan until we hit a character in the commandSet
while( ct && !IsCommandChar( ct )) while( ct && !IsCommandChar( ct ))
ct = *(++psz); ct = *(++psz);
if( ct == ')' ) if( ct == ')' )
break; break;
@ -308,7 +308,7 @@ int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst )
i = 0; i = 0;
c = *(++psz); c = *(++psz);
if( !isdigit( c )) if( !isdigit( c ))
break; break;
@ -359,8 +359,8 @@ void VOX_LoadWord( channel_t *pchan )
// apply mixer // apply mixer
pchan->currentWord = &pchan->pMixer; pchan->currentWord = &pchan->pMixer;
pchan->currentWord->pData = pSource; pchan->currentWord->pData = pSource;
// don't allow overlapped ranges // don't allow overlapped ranges
if( end <= start ) end = 0; if( end <= start ) end = 0;
@ -411,7 +411,7 @@ void VOX_LoadFirstWord( channel_t *pchan, voxword_t *pwords )
{ {
pchan->words[i] = pwords[i]; pchan->words[i] = pwords[i];
i++; i++;
} }
pchan->words[i].sfx = NULL; pchan->words[i].sfx = NULL;
pchan->wordIndex = 0; pchan->wordIndex = 0;
@ -467,7 +467,7 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin )
memset( rgvoxword, 0, sizeof( voxword_t ) * CVOXWORDMAX ); memset( rgvoxword, 0, sizeof( voxword_t ) * CVOXWORDMAX );
memset( buffer, 0, sizeof( buffer )); memset( buffer, 0, sizeof( buffer ));
// lookup actual string in g_Sentences, // lookup actual string in g_Sentences,
// set pointer to string data // set pointer to string data
psz = VOX_LookupString( pszin, NULL ); psz = VOX_LookupString( pszin, NULL );
@ -494,7 +494,7 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin )
VOX_ParseString( psz ); VOX_ParseString( psz );
// for each word in the sentence, construct the filename, // for each word in the sentence, construct the filename,
// lookup the sfx and save each pointer in a temp array // lookup the sfx and save each pointer in a temp array
i = 0; i = 0;
cword = 0; cword = 0;
@ -527,7 +527,7 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin )
// {}. The string is rewritten in place with those commands removed. // {}. The string is rewritten in place with those commands removed.
// //
// Input : *pSentenceData - sentence data to be modified in place // Input : *pSentenceData - sentence data to be modified in place
// sentenceIndex - global sentence table index for any data that is // sentenceIndex - global sentence table index for any data that is
// parsed out // parsed out
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex ) void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex )
@ -555,15 +555,15 @@ void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex )
// Copy good string to temp buffer // Copy good string to temp buffer
memcpy( tempBuffer + tempBufferPos, pSentenceData, length ); memcpy( tempBuffer + tempBufferPos, pSentenceData, length );
// move the copy position // move the copy position
tempBufferPos += length; tempBufferPos += length;
pSentenceData = pNext; pSentenceData = pNext;
// skip ahead of the opening brace // skip ahead of the opening brace
if( *pSentenceData ) pSentenceData++; if( *pSentenceData ) pSentenceData++;
// skip whitespace // skip whitespace
while( *pSentenceData && *pSentenceData <= 32 ) while( *pSentenceData && *pSentenceData <= 32 )
pSentenceData++; pSentenceData++;
@ -584,7 +584,7 @@ void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex )
} }
pSentenceData = ScanForwardUntil( pSentenceData, '}' ); pSentenceData = ScanForwardUntil( pSentenceData, '}' );
// skip the closing brace // skip the closing brace
if( *pSentenceData ) pSentenceData++; if( *pSentenceData ) pSentenceData++;
@ -597,7 +597,7 @@ void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex )
{ {
// terminate cleaned up copy // terminate cleaned up copy
tempBuffer[tempBufferPos] = 0; tempBuffer[tempBufferPos] = 0;
// copy it over the original data // copy it over the original data
Q_strcpy( pStart, tempBuffer ); Q_strcpy( pStart, tempBuffer );
} }
@ -661,7 +661,7 @@ void VOX_ReadSentenceFile( const char *psentenceFileName )
// scan forward to end of sentence or eof // scan forward to end of sentence or eof
while( pch < pchlast && pch[0] != '\n' && pch[0] != '\r' ) while( pch < pchlast && pch[0] != '\n' && pch[0] != '\r' )
pch++; pch++;
// insert null terminator // insert null terminator
if( pch < pchlast ) *pch++ = 0; if( pch < pchlast ) *pch++ = 0;

View File

@ -155,7 +155,7 @@ typedef struct channel_s
int rightvol; // 0-255 right volume int rightvol; // 0-255 right volume
int entnum; // entity soundsource int entnum; // entity soundsource
int entchannel; // sound channel (CHAN_STREAM, CHAN_VOICE, etc.) int entchannel; // sound channel (CHAN_STREAM, CHAN_VOICE, etc.)
vec3_t origin; // only use if fixed_origin is set vec3_t origin; // only use if fixed_origin is set
float dist_mult; // distance multiplier (attenuation/clipK) float dist_mult; // distance multiplier (attenuation/clipK)
int master_vol; // 0-255 master volume int master_vol; // 0-255 master volume

View File

@ -32,7 +32,7 @@ static int IsComment( const char *pText )
if( length >= 2 && pText[0] == '/' && pText[1] == '/' ) if( length >= 2 && pText[0] == '/' && pText[1] == '/' )
return 1; return 1;
// no text? // no text?
if( length > 0 ) if( length > 0 )
return 0; return 0;
@ -213,7 +213,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
char buf[512], trim[512], currentName[512]; char buf[512], trim[512], currentName[512];
char *pCurrentText = NULL, *pNameHeap; char *pCurrentText = NULL, *pNameHeap;
char nameHeap[32768]; // g-cont. i will scale up heap to handle all TFC messages char nameHeap[32768]; // g-cont. i will scale up heap to handle all TFC messages
int mode = MSGFILE_NAME; // searching for a message name int mode = MSGFILE_NAME; // searching for a message name
int lineNumber, filePos, lastLinePos; int lineNumber, filePos, lastLinePos;
client_textmessage_t textMessages[MAX_MESSAGES]; client_textmessage_t textMessages[MAX_MESSAGES];
int i, nameHeapSize, textHeapSize, messageSize, nameOffset; int i, nameHeapSize, textHeapSize, messageSize, nameOffset;
@ -318,10 +318,10 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
// must malloc because we need to be able to clear it after initialization // must malloc because we need to be able to clear it after initialization
clgame.titles = (client_textmessage_t *)Mem_Calloc( cls.mempool, textHeapSize + nameHeapSize + messageSize ); clgame.titles = (client_textmessage_t *)Mem_Calloc( cls.mempool, textHeapSize + nameHeapSize + messageSize );
// copy table over // copy table over
memcpy( clgame.titles, textMessages, messageSize ); memcpy( clgame.titles, textMessages, messageSize );
// copy Name heap // copy Name heap
pNameHeap = ((char *)clgame.titles) + messageSize; pNameHeap = ((char *)clgame.titles) + messageSize;
memcpy( pNameHeap, nameHeap, nameHeapSize ); memcpy( pNameHeap, nameHeap, nameHeapSize );

View File

@ -93,7 +93,7 @@ void GAME_EXPORT VGUI_CursorSelect(enum VGUI_DefaultCursor cursor )
qboolean visible; qboolean visible;
if( cls.key_dest != key_game || cl.paused ) if( cls.key_dest != key_game || cl.paused )
return; return;
switch( cursor ) switch( cursor )
{ {
case dc_user: case dc_user:

View File

@ -75,7 +75,7 @@ Cbuf_GetSpace
void *Cbuf_GetSpace( cmdbuf_t *buf, int length ) void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
{ {
void *data; void *data;
if(( buf->cursize + length ) > buf->maxsize ) if(( buf->cursize + length ) > buf->maxsize )
{ {
buf->cursize = 0; buf->cursize = 0;
@ -84,7 +84,7 @@ void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
data = buf->data + buf->cursize; data = buf->data + buf->cursize;
buf->cursize += length; buf->cursize += length;
return data; return data;
} }
@ -249,13 +249,13 @@ void Cbuf_ExecStuffCmds( void )
if( l + Q_strlen( host.argv[i] ) + 4 > sizeof( build ) - 1 ) if( l + Q_strlen( host.argv[i] ) + 4 > sizeof( build ) - 1 )
break; break;
build[l++] = ' '; build[l++] = ' ';
if( Q_strchr( host.argv[i], ' ' )) if( Q_strchr( host.argv[i], ' ' ))
build[l++] = '\"'; build[l++] = '\"';
for( j = 0; host.argv[i][j]; j++ ) for( j = 0; host.argv[i][j]; j++ )
build[l++] = host.argv[i][j]; build[l++] = host.argv[i][j];
if( Q_strchr( host.argv[i], ' ' )) if( Q_strchr( host.argv[i], ' ' ))
build[l++] = '\"'; build[l++] = '\"';
} }
@ -321,7 +321,7 @@ Just prints the rest of the line to the console
void Cmd_Echo_f( void ) void Cmd_Echo_f( void )
{ {
int i; int i;
for( i = 1; i < Cmd_Argc(); i++ ) for( i = 1; i < Cmd_Argc(); i++ )
Con_Printf( "%s", Cmd_Argv( i )); Con_Printf( "%s", Cmd_Argv( i ));
Con_Printf( "\n" ); Con_Printf( "\n" );
@ -487,7 +487,7 @@ const char *Cmd_Argv( int arg )
{ {
if((uint)arg >= cmd_argc ) if((uint)arg >= cmd_argc )
return ""; return "";
return cmd_argv[arg]; return cmd_argv[arg];
} }
/* /*
@ -772,7 +772,7 @@ void Cmd_LookupCmds( void *buffer, void *ptr, setpair_t callback )
// nothing to process ? // nothing to process ?
if( !callback ) return; if( !callback ) return;
for( cmd = cmd_functions; cmd; cmd = cmd->next ) for( cmd = cmd_functions; cmd; cmd = cmd->next )
{ {
if( !buffer ) callback( cmd->name, (char *)cmd->function, cmd->desc, ptr ); if( !buffer ) callback( cmd->name, (char *)cmd->function, cmd->desc, ptr );
@ -860,7 +860,7 @@ void Cmd_If_f( void )
if(( cmd_argv[2][0] == '>' ) && ( f1 > f2 )) // >, >= if(( cmd_argv[2][0] == '>' ) && ( f1 > f2 )) // >, >=
cmd_condition |= BIT( cmd_condlevel ); cmd_condition |= BIT( cmd_condlevel );
if(( cmd_argv[2][0] == '<' ) && ( f1 < f2 )) // <, <= if(( cmd_argv[2][0] == '<' ) && ( f1 < f2 )) // <, <=
cmd_condition |= BIT( cmd_condlevel ); cmd_condition |= BIT( cmd_condlevel );
} }
@ -886,7 +886,7 @@ A complete command line has been parsed, so try to execute it
============ ============
*/ */
void Cmd_ExecuteString( char *text ) void Cmd_ExecuteString( char *text )
{ {
cmd_t *cmd = NULL; cmd_t *cmd = NULL;
cmdalias_t *a = NULL; cmdalias_t *a = NULL;
convar_t *cvar = NULL; convar_t *cvar = NULL;
@ -940,7 +940,7 @@ void Cmd_ExecuteString( char *text )
} }
// execute the command line // execute the command line
Cmd_TokenizeString( text ); Cmd_TokenizeString( text );
if( !Cmd_Argc( )) return; // no tokens if( !Cmd_Argc( )) return; // no tokens
@ -1026,7 +1026,7 @@ so when they are typed in at the console, they will need to be forwarded.
void Cmd_ForwardToServer( void ) void Cmd_ForwardToServer( void )
{ {
char str[MAX_CMD_BUFFER]; char str[MAX_CMD_BUFFER];
if( cls.demoplayback ) if( cls.demoplayback )
{ {
if( !Q_stricmp( Cmd_Argv( 0 ), "pause" )) if( !Q_stricmp( Cmd_Argv( 0 ), "pause" ))
@ -1049,7 +1049,7 @@ void Cmd_ForwardToServer( void )
Q_strcat( str, Cmd_Argv( 0 )); Q_strcat( str, Cmd_Argv( 0 ));
Q_strcat( str, " " ); Q_strcat( str, " " );
} }
if( Cmd_Argc() > 1 ) if( Cmd_Argc() > 1 )
Q_strcat( str, Cmd_Args( )); Q_strcat( str, Cmd_Args( ));
else Q_strcat( str, "\n" ); else Q_strcat( str, "\n" );

View File

@ -125,7 +125,7 @@ float GAME_EXPORT COM_RandomFloat( float flLow, float flHigh )
int GAME_EXPORT COM_RandomLong( int lLow, int lHigh ) int GAME_EXPORT COM_RandomLong( int lLow, int lHigh )
{ {
dword maxAcceptable; dword maxAcceptable;
dword n, x = lHigh - lLow + 1; dword n, x = lHigh - lLow + 1;
if( idum == 0 ) COM_SetRandomSeed( 0 ); if( idum == 0 ) COM_SetRandomSeed( 0 );
@ -184,7 +184,7 @@ typedef struct
typedef struct typedef struct
{ {
lzss_list_t *hash_table; lzss_list_t *hash_table;
lzss_node_t *hash_node; lzss_node_t *hash_node;
int window_size; int window_size;
} lzss_state_t; } lzss_state_t;
@ -247,7 +247,7 @@ byte *LZSS_CompressNoAlloc( lzss_state_t *state, byte *pInput, int input_length,
lzss_header_t *header = (lzss_header_t *)pStart; lzss_header_t *header = (lzss_header_t *)pStart;
byte *pOutput = pStart + sizeof( lzss_header_t ); byte *pOutput = pStart + sizeof( lzss_header_t );
const byte *pEncodedPosition = NULL; const byte *pEncodedPosition = NULL;
byte *pLookAhead = pInput; byte *pLookAhead = pInput;
byte *pWindow = pInput; byte *pWindow = pInput;
int i, putCmdByte = 0; int i, putCmdByte = 0;
byte *pCmdByte = NULL; byte *pCmdByte = NULL;
@ -309,9 +309,9 @@ byte *LZSS_CompressNoAlloc( lzss_state_t *state, byte *pInput, int input_length,
*pCmdByte = (*pCmdByte >> 1) | 0x80; *pCmdByte = (*pCmdByte >> 1) | 0x80;
*pOutput++ = (( pLookAhead - pEncodedPosition - 1 ) >> LZSS_LOOKSHIFT ); *pOutput++ = (( pLookAhead - pEncodedPosition - 1 ) >> LZSS_LOOKSHIFT );
*pOutput++ = (( pLookAhead - pEncodedPosition - 1 ) << LZSS_LOOKSHIFT ) | ( encoded_length - 1 ); *pOutput++ = (( pLookAhead - pEncodedPosition - 1 ) << LZSS_LOOKSHIFT ) | ( encoded_length - 1 );
} }
else else
{ {
*pCmdByte = ( *pCmdByte >> 1 ); *pCmdByte = ( *pCmdByte >> 1 );
*pOutput++ = *pLookAhead; *pOutput++ = *pLookAhead;
encoded_length = 1; encoded_length = 1;
@ -392,7 +392,7 @@ uint LZSS_Decompress( const byte *pInput, byte *pOutput )
while( 1 ) while( 1 )
{ {
if( !getCmdByte ) if( !getCmdByte )
cmdByte = *pInput++; cmdByte = *pInput++;
getCmdByte = ( getCmdByte + 1 ) & 0x07; getCmdByte = ( getCmdByte + 1 ) & 0x07;
@ -405,15 +405,15 @@ uint LZSS_Decompress( const byte *pInput, byte *pOutput )
position |= ( *pInput >> LZSS_LOOKSHIFT ); position |= ( *pInput >> LZSS_LOOKSHIFT );
count = ( *pInput++ & 0x0F ) + 1; count = ( *pInput++ & 0x0F ) + 1;
if( count == 1 ) if( count == 1 )
break; break;
pSource = pOutput - position - 1; pSource = pOutput - position - 1;
for( i = 0; i < count; i++ ) for( i = 0; i < count; i++ )
*pOutput++ = *pSource++; *pOutput++ = *pSource++;
totalBytes += count; totalBytes += count;
} }
else else
{ {
*pOutput++ = *pInput++; *pOutput++ = *pInput++;
totalBytes++; totalBytes++;
@ -482,10 +482,10 @@ char *COM_ParseFile( char *data, char *token )
if( !token ) if( !token )
return NULL; return NULL;
len = 0; len = 0;
token[0] = 0; token[0] = 0;
if( !data ) if( !data )
return NULL; return NULL;
// skip whitespace // skip whitespace
@ -496,7 +496,7 @@ skipwhite:
return NULL; // end of file; return NULL; // end of file;
data++; data++;
} }
// skip // comments // skip // comments
if( c=='/' && data[1] == '/' ) if( c=='/' && data[1] == '/' )
{ {
@ -551,7 +551,7 @@ skipwhite:
if( COM_IsSingleChar( c )) if( COM_IsSingleChar( c ))
break; break;
} while( c > 32 ); } while( c > 32 );
token[len] = 0; token[len] = 0;
return data; return data;
@ -665,7 +665,7 @@ int GAME_EXPORT COM_ExpandFilename( const char *fileName, char *nameOutBuffer, i
// models\barney.mdl - D:\Xash3D\bshift\models\barney.mdl // models\barney.mdl - D:\Xash3D\bshift\models\barney.mdl
if(( path = FS_GetDiskPath( fileName, false )) != NULL ) if(( path = FS_GetDiskPath( fileName, false )) != NULL )
{ {
Q_sprintf( result, "%s/%s", host.rootdir, path ); Q_sprintf( result, "%s/%s", host.rootdir, path );
// check for enough room // check for enough room
if( Q_strlen( result ) > nameOutBufferSize ) if( Q_strlen( result ) > nameOutBufferSize )
@ -771,7 +771,7 @@ void COM_HexConvert( const char *pszInput, int nInputLength, byte *pOutput )
for( i = 0; i < nInputLength; i += 2 ) for( i = 0; i < nInputLength; i += 2 )
{ {
pIn = &pszInput[i]; pIn = &pszInput[i];
*p = COM_Nibble( pIn[0] ) << 4 | COM_Nibble( pIn[1] ); *p = COM_Nibble( pIn[0] ) << 4 | COM_Nibble( pIn[1] );
p++; p++;
} }
} }
@ -817,7 +817,7 @@ char *COM_MemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, i
// copy it out // copy it out
memcpy( pBuffer, pMemFile + *filePos, size ); memcpy( pBuffer, pMemFile + *filePos, size );
// If the buffer isn't full, terminate (this is always true) // If the buffer isn't full, terminate (this is always true)
if( size < bufferSize ) pBuffer[size] = 0; if( size < bufferSize ) pBuffer[size] = 0;
@ -925,7 +925,7 @@ COM_FreeFile
*/ */
void GAME_EXPORT COM_FreeFile( void *buffer ) void GAME_EXPORT COM_FreeFile( void *buffer )
{ {
free( buffer ); free( buffer );
} }
/* /*

View File

@ -94,13 +94,13 @@ enum
{ {
D_INFO = 1, // "-dev 1", shows various system messages D_INFO = 1, // "-dev 1", shows various system messages
D_WARN, // "-dev 2", shows not critical system warnings D_WARN, // "-dev 2", shows not critical system warnings
D_ERROR, // "-dev 3", shows critical warnings D_ERROR, // "-dev 3", shows critical warnings
D_REPORT, // "-dev 4", special case for game reports D_REPORT, // "-dev 4", special case for game reports
D_NOTE // "-dev 5", show system notifications for engine developers D_NOTE // "-dev 5", show system notifications for engine developers
}; };
typedef enum typedef enum
{ {
HOST_NORMAL, // listen server, singleplayer HOST_NORMAL, // listen server, singleplayer
HOST_DEDICATED, HOST_DEDICATED,
} instance_t; } instance_t;
@ -205,7 +205,7 @@ typedef struct gameinfo_s
// filesystem info // filesystem info
char gamefolder[MAX_QPATH]; // used for change game '-game x' char gamefolder[MAX_QPATH]; // used for change game '-game x'
char basedir[MAX_QPATH]; // base game directory (like 'id1' for Quake or 'valve' for Half-Life) char basedir[MAX_QPATH]; // base game directory (like 'id1' for Quake or 'valve' for Half-Life)
char falldir[MAX_QPATH]; // used as second basedir char falldir[MAX_QPATH]; // used as second basedir
char startmap[MAX_QPATH];// map to start singleplayer game char startmap[MAX_QPATH];// map to start singleplayer game
char trainmap[MAX_QPATH];// map to start hazard course (if specified) char trainmap[MAX_QPATH];// map to start hazard course (if specified)
char title[64]; // Game Main Title char title[64]; // Game Main Title
@ -270,14 +270,14 @@ typedef enum
{ {
HOST_INIT = 0, // initalize operations HOST_INIT = 0, // initalize operations
HOST_FRAME, // host running HOST_FRAME, // host running
HOST_SHUTDOWN, // shutdown operations HOST_SHUTDOWN, // shutdown operations
HOST_ERR_FATAL, // sys error HOST_ERR_FATAL, // sys error
HOST_SLEEP, // sleeped by different reason, e.g. minimize window HOST_SLEEP, // sleeped by different reason, e.g. minimize window
HOST_NOFOCUS, // same as HOST_FRAME, but disable mouse HOST_NOFOCUS, // same as HOST_FRAME, but disable mouse
HOST_CRASHED // an exception handler called HOST_CRASHED // an exception handler called
} host_status_t; } host_status_t;
typedef enum typedef enum
{ {
STATE_RUNFRAME = 0, STATE_RUNFRAME = 0,
STATE_LOAD_LEVEL, STATE_LOAD_LEVEL,
@ -385,7 +385,7 @@ typedef struct host_parm_s
{ {
HINSTANCE hInst; HINSTANCE hInst;
HANDLE hMutex; HANDLE hMutex;
host_status_t status; // global host state host_status_t status; // global host state
game_status_t game; // game manager game_status_t game; // game manager
uint type; // running at uint type; // running at
@ -444,7 +444,7 @@ typedef struct host_parm_s
char rootdir[MAX_OSPATH]; // member root directory char rootdir[MAX_OSPATH]; // member root directory
char rodir[MAX_OSPATH]; // readonly root char rodir[MAX_OSPATH]; // readonly root
char gamefolder[MAX_QPATH]; // it's a default gamefolder char gamefolder[MAX_QPATH]; // it's a default gamefolder
byte *imagepool; // imagelib mempool byte *imagepool; // imagelib mempool
byte *soundpool; // soundlib mempool byte *soundpool; // soundlib mempool

View File

@ -67,15 +67,15 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
t = FS_Search( va( "maps/%s*.bsp", s ), true, con_gamemaps->value ); t = FS_Search( va( "maps/%s*.bsp", s ), true, con_gamemaps->value );
if( !t ) return false; if( !t ) return false;
COM_FileBase( t->filenames[0], matchbuf ); COM_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
for( i = 0, nummaps = 0; i < t->numfilenames; i++ ) for( i = 0, nummaps = 0; i < t->numfilenames; i++ )
{ {
char entfilename[MAX_QPATH]; char entfilename[MAX_QPATH];
const char *ext = COM_FileExtension( t->filenames[i] ); const char *ext = COM_FileExtension( t->filenames[i] );
int ver = -1, lumpofs = 0, lumplen = 0; int ver = -1, lumpofs = 0, lumplen = 0;
char *ents = NULL, *pfile; char *ents = NULL, *pfile;
qboolean validmap = false; qboolean validmap = false;
@ -89,7 +89,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
generator[0] = '\0'; generator[0] = '\0';
f = FS_Open( t->filenames[i], "rb", con_gamemaps->value ); f = FS_Open( t->filenames[i], "rb", con_gamemaps->value );
if( f ) if( f )
{ {
dheader_t *header; dheader_t *header;
@ -212,7 +212,7 @@ qboolean Cmd_GetDemoList( const char *s, char *completedname, int length )
t = FS_Search( va( "%s*.dem", s ), true, true ); t = FS_Search( va( "%s*.dem", s ), true, true );
if( !t ) return false; if( !t ) return false;
COM_FileBase( t->filenames[0], matchbuf ); COM_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
@ -258,7 +258,7 @@ qboolean Cmd_GetMovieList( const char *s, char *completedname, int length )
t = FS_Search( va( "media/%s*.avi", s ), true, false ); t = FS_Search( va( "media/%s*.avi", s ), true, false );
if( !t ) return false; if( !t ) return false;
COM_FileBase( t->filenames[0], matchbuf ); COM_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
@ -305,14 +305,14 @@ qboolean Cmd_GetMusicList( const char *s, char *completedname, int length )
t = FS_Search( va( "media/%s*.*", s ), true, false ); t = FS_Search( va( "media/%s*.*", s ), true, false );
if( !t ) return false; if( !t ) return false;
COM_FileBase( t->filenames[0], matchbuf ); COM_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
for(i = 0, numtracks = 0; i < t->numfilenames; i++) for(i = 0, numtracks = 0; i < t->numfilenames; i++)
{ {
const char *ext = COM_FileExtension( t->filenames[i] ); const char *ext = COM_FileExtension( t->filenames[i] );
if( Q_stricmp( ext, "wav" ) && Q_stricmp( ext, "mp3" )) if( Q_stricmp( ext, "wav" ) && Q_stricmp( ext, "mp3" ))
continue; continue;
@ -353,7 +353,7 @@ qboolean Cmd_GetSavesList( const char *s, char *completedname, int length )
t = FS_Search( va( "%s%s*.sav", DEFAULT_SAVE_DIRECTORY, s ), true, true ); // lookup only in gamedir t = FS_Search( va( "%s%s*.sav", DEFAULT_SAVE_DIRECTORY, s ), true, true ); // lookup only in gamedir
if( !t ) return false; if( !t ) return false;
COM_FileBase( t->filenames[0], matchbuf ); COM_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
@ -400,7 +400,7 @@ qboolean Cmd_GetConfigList( const char *s, char *completedname, int length )
t = FS_Search( va( "%s*.cfg", s ), true, false ); t = FS_Search( va( "%s*.cfg", s ), true, false );
if( !t ) return false; if( !t ) return false;
COM_FileBase( t->filenames[0], matchbuf ); COM_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
@ -447,20 +447,20 @@ qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
t = FS_Search( va( "%s%s*.*", DEFAULT_SOUNDPATH, s ), true, false ); t = FS_Search( va( "%s%s*.*", DEFAULT_SOUNDPATH, s ), true, false );
if( !t ) return false; if( !t ) return false;
Q_strncpy( matchbuf, t->filenames[0] + sizeof( DEFAULT_SOUNDPATH ) - 1, MAX_STRING ); Q_strncpy( matchbuf, t->filenames[0] + sizeof( DEFAULT_SOUNDPATH ) - 1, MAX_STRING );
COM_StripExtension( matchbuf ); COM_StripExtension( matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
for(i = 0, numsounds = 0; i < t->numfilenames; i++) for(i = 0, numsounds = 0; i < t->numfilenames; i++)
{ {
const char *ext = COM_FileExtension( t->filenames[i] ); const char *ext = COM_FileExtension( t->filenames[i] );
if( Q_stricmp( ext, "wav" ) && Q_stricmp( ext, "mp3" )) if( Q_stricmp( ext, "wav" ) && Q_stricmp( ext, "mp3" ))
continue; continue;
Q_strncpy( matchbuf, t->filenames[i] + sizeof( DEFAULT_SOUNDPATH ) - 1, MAX_STRING ); Q_strncpy( matchbuf, t->filenames[i] + sizeof( DEFAULT_SOUNDPATH ) - 1, MAX_STRING );
COM_StripExtension( matchbuf ); COM_StripExtension( matchbuf );
Con_Printf( "%16s\n", matchbuf ); Con_Printf( "%16s\n", matchbuf );
numsounds++; numsounds++;
@ -500,7 +500,7 @@ qboolean Cmd_GetItemsList( const char *s, char *completedname, int length )
t = FS_Search( va( "%s/%s*.txt", clgame.itemspath, s ), true, false ); t = FS_Search( va( "%s/%s*.txt", clgame.itemspath, s ), true, false );
if( !t ) return false; if( !t ) return false;
COM_FileBase( t->filenames[0], matchbuf ); COM_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
@ -692,7 +692,7 @@ qboolean Cmd_GetCustomList( const char *s, char *completedname, int length )
t = FS_Search( va( "%s*.hpk", s ), true, false ); t = FS_Search( va( "%s*.hpk", s ), true, false );
if( !t ) return false; if( !t ) return false;
COM_FileBase( t->filenames[0], matchbuf ); COM_FileBase( t->filenames[0], matchbuf );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( t->numfilenames == 1 ) return true; if( t->numfilenames == 1 ) return true;
@ -746,18 +746,18 @@ qboolean Cmd_GetGamesList( const char *s, char *completedname, int length )
for( i = 0, numgamedirs = 0; i < SI.numgames; i++ ) for( i = 0, numgamedirs = 0; i < SI.numgames; i++ )
{ {
if(( *s == '*' ) || !Q_strnicmp( SI.games[i]->gamefolder, s, len)) if(( *s == '*' ) || !Q_strnicmp( SI.games[i]->gamefolder, s, len))
Q_strcpy( gamedirs[numgamedirs++], SI.games[i]->gamefolder ); Q_strcpy( gamedirs[numgamedirs++], SI.games[i]->gamefolder );
} }
if( !numgamedirs ) return false; if( !numgamedirs ) return false;
Q_strncpy( matchbuf, gamedirs[0], MAX_STRING ); Q_strncpy( matchbuf, gamedirs[0], MAX_STRING );
if( completedname && length ) if( completedname && length )
Q_strncpy( completedname, matchbuf, length ); Q_strncpy( completedname, matchbuf, length );
if( numgamedirs == 1 ) return true; if( numgamedirs == 1 ) return true;
for( i = 0; i < numgamedirs; i++ ) for( i = 0; i < numgamedirs; i++ )
{ {
Q_strncpy( matchbuf, gamedirs[i], MAX_STRING ); Q_strncpy( matchbuf, gamedirs[i], MAX_STRING );
Con_Printf( "%16s\n", matchbuf ); Con_Printf( "%16s\n", matchbuf );
} }
@ -848,7 +848,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir )
file_t *f; file_t *f;
if( FS_FileSize( "maps.lst", onlyingamedir ) > 0 && !fRefresh ) if( FS_FileSize( "maps.lst", onlyingamedir ) > 0 && !fRefresh )
return true; // exist return true; // exist
// setup mpfilter // setup mpfilter
size = Q_snprintf( mpfilter, sizeof( mpfilter ), "maps/%s", GI->mp_filter ); size = Q_snprintf( mpfilter, sizeof( mpfilter ), "maps/%s", GI->mp_filter );
@ -1043,7 +1043,7 @@ qboolean Cmd_AutocompleteName( const char *source, int arg, char *buffer, size_t
for( list = cmd_list; list->name; list++ ) for( list = cmd_list; list->name; list++ )
{ {
if( list->arg == arg && Cmd_CheckName( list->name )) if( list->arg == arg && Cmd_CheckName( list->name ))
return list->func( source, buffer, bufsize ); return list->func( source, buffer, bufsize );
} }
return false; return false;
@ -1309,7 +1309,7 @@ static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc
if( !desc || !Q_strcmp( desc, "" )) if( !desc || !Q_strcmp( desc, "" ))
return; // ignore fantom cmds return; // ignore fantom cmds
if( name[0] == '+' || name[0] == '-' ) if( name[0] == '+' || name[0] == '-' )
return; // key bindings return; // key bindings
length = 3 - (Q_strlen( name ) / 10); // Asm_Ed default tab stop is 10 length = 3 - (Q_strlen( name ) / 10); // Asm_Ed default tab stop is 10
@ -1374,7 +1374,7 @@ void Host_WriteConfig( void )
jlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_jlook" ); jlook = (kbutton_t *)clgame.dllFuncs.KB_Find( "in_jlook" );
} }
if( mlook && ( mlook->state & 1 )) if( mlook && ( mlook->state & 1 ))
FS_Printf( f, "+mlook\n" ); FS_Printf( f, "+mlook\n" );
if( jlook && ( jlook->state & 1 )) if( jlook && ( jlook->state & 1 ))
@ -1407,7 +1407,7 @@ void GAME_EXPORT Host_WriteServerConfig( const char *name )
// FIXME: move this out until menu parser is done // FIXME: move this out until menu parser is done
CSCR_LoadDefaultCVars( "settings.scr" ); CSCR_LoadDefaultCVars( "settings.scr" );
if(( f = FS_Open( newconfigfile, "w", false )) != NULL ) if(( f = FS_Open( newconfigfile, "w", false )) != NULL )
{ {
FS_Printf( f, "//=======================================================================\n" ); FS_Printf( f, "//=======================================================================\n" );

View File

@ -338,7 +338,7 @@ The flags will be or'ed in if the variable exists.
convar_t *Cvar_Get( const char *name, const char *value, int flags, const char *var_desc ) convar_t *Cvar_Get( const char *name, const char *value, int flags, const char *var_desc )
{ {
convar_t *cur, *find, *var; convar_t *cur, *find, *var;
ASSERT( name && *name ); ASSERT( name && *name );
// check for command coexisting // check for command coexisting
@ -463,13 +463,13 @@ void Cvar_RegisterVariable( convar_t *var )
if( FBitSet( var->flags, FCVAR_EXTENDED )) if( FBitSet( var->flags, FCVAR_EXTENDED ))
var->def_string = var->string; // just swap pointers var->def_string = var->string; // just swap pointers
var->string = copystring( var->string ); var->string = copystring( var->string );
var->value = Q_atof( var->string ); var->value = Q_atof( var->string );
// find the supposed position in chain (alphanumerical order) // find the supposed position in chain (alphanumerical order)
for( cur = NULL, find = cvar_vars; find && Q_strcmp( find->name, var->name ) < 0; cur = find, find = find->next ); for( cur = NULL, find = cvar_vars; find && Q_strcmp( find->name, var->name ) < 0; cur = find, find = find->next );
// now link variable // now link variable
if( cur ) cur->next = var; if( cur ) cur->next = var;
else cvar_vars = var; else cvar_vars = var;
var->next = find; var->next = find;
@ -496,7 +496,7 @@ way to change value for many cvars
void Cvar_DirectSet( convar_t *var, const char *value ) void Cvar_DirectSet( convar_t *var, const char *value )
{ {
const char *pszValue; const char *pszValue;
if( !var ) return; // ??? if( !var ) return; // ???
// lookup for registration // lookup for registration
@ -515,7 +515,7 @@ void Cvar_DirectSet( convar_t *var, const char *value )
Con_Printf( "%s is read-only.\n", var->name ); Con_Printf( "%s is read-only.\n", var->name );
return; return;
} }
if( FBitSet( var->flags, FCVAR_CHEAT ) && !host.allow_cheats ) if( FBitSet( var->flags, FCVAR_CHEAT ) && !host.allow_cheats )
{ {
Con_Printf( "%s is cheat protected.\n", var->name ); Con_Printf( "%s is cheat protected.\n", var->name );
@ -619,7 +619,7 @@ Cvar_SetValue
void GAME_EXPORT Cvar_SetValue( const char *var_name, float value ) void GAME_EXPORT Cvar_SetValue( const char *var_name, float value )
{ {
char val[32]; char val[32];
if( fabs( value - (int)value ) < 0.000001 ) if( fabs( value - (int)value ) < 0.000001 )
Q_snprintf( val, sizeof( val ), "%d", (int)value ); Q_snprintf( val, sizeof( val ), "%d", (int)value );
else Q_snprintf( val, sizeof( val ), "%f", value ); else Q_snprintf( val, sizeof( val ), "%f", value );
@ -816,7 +816,7 @@ with the specified flag set to true.
void Cvar_WriteVariables( file_t *f, int group ) void Cvar_WriteVariables( file_t *f, int group )
{ {
convar_t *var; convar_t *var;
for( var = cvar_vars; var; var = var->next ) for( var = cvar_vars; var; var = var->next )
{ {
if( FBitSet( var->flags, group )) if( FBitSet( var->flags, group ))
@ -954,7 +954,7 @@ void Cvar_Init( void )
{ {
cvar_vars = NULL; cvar_vars = NULL;
cmd_scripting = Cvar_Get( "cmd_scripting", "0", FCVAR_ARCHIVE, "enable simple condition checking and variable operations" ); cmd_scripting = Cvar_Get( "cmd_scripting", "0", FCVAR_ARCHIVE, "enable simple condition checking and variable operations" );
Cvar_RegisterVariable (&host_developer); // early registering for dev Cvar_RegisterVariable (&host_developer); // early registering for dev
Cmd_AddCommand( "setgl", Cvar_SetGL_f, "change the value of a opengl variable" ); // OBSOLETE Cmd_AddCommand( "setgl", Cvar_SetGL_f, "change the value of a opengl variable" ); // OBSOLETE
Cmd_AddCommand( "toggle", Cvar_Toggle_f, "toggles a console variable's values (use for more info)" ); Cmd_AddCommand( "toggle", Cvar_Toggle_f, "toggles a console variable's values (use for more info)" );

View File

@ -11,7 +11,7 @@ This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
*/ */
#if XASH_DEDICATED #if XASH_DEDICATED
#include "common.h" #include "common.h"
#include "xash3d_mathlib.h" #include "xash3d_mathlib.h"
@ -205,12 +205,12 @@ void Host_InputFrame( void )
void VID_InitDefaultResolution( void ) void VID_InitDefaultResolution( void )
{ {
} }
void Con_Init( void ) void Con_Init( void )
{ {
} }
void R_ClearAllDecals( void ) void R_ClearAllDecals( void )

View File

@ -1058,7 +1058,7 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade
pack_t *pak = NULL; pack_t *pak = NULL;
const char *ext = COM_FileExtension( pakfile ); const char *ext = COM_FileExtension( pakfile );
int i, errorcode = PAK_LOAD_COULDNT_OPEN; int i, errorcode = PAK_LOAD_COULDNT_OPEN;
for( search = fs_searchpaths; search; search = search->next ) for( search = fs_searchpaths; search; search = search->next )
{ {
if( search->pack && !Q_stricmp( search->pack->filename, pakfile )) if( search->pack && !Q_stricmp( search->pack->filename, pakfile ))
@ -1112,7 +1112,7 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int
zip_t *zip = NULL; zip_t *zip = NULL;
const char *ext = COM_FileExtension( zipfile ); const char *ext = COM_FileExtension( zipfile );
int errorcode = ZIP_LOAD_COULDNT_OPEN; int errorcode = ZIP_LOAD_COULDNT_OPEN;
for( search = fs_searchpaths; search; search = search->next ) for( search = fs_searchpaths; search; search = search->next )
{ {
if( search->pack && !Q_stricmp( search->pack->filename, zipfile )) if( search->pack && !Q_stricmp( search->pack->filename, zipfile ))
@ -1121,12 +1121,12 @@ qboolean FS_AddZip_Fullpath( const char *zipfile, qboolean *already_loaded, int
return true; // already loaded return true; // already loaded
} }
} }
if( already_loaded ) *already_loaded = false; if( already_loaded ) *already_loaded = false;
if( !Q_stricmp( ext, "pk3" ) ) if( !Q_stricmp( ext, "pk3" ) )
zip = FS_LoadZip( zipfile, &errorcode ); zip = FS_LoadZip( zipfile, &errorcode );
if( zip ) if( zip )
{ {
string fullpath; string fullpath;
@ -1300,7 +1300,7 @@ void FS_ClearSearchPath( void )
if( search->pack ) if( search->pack )
{ {
if( search->pack->files ) if( search->pack->files )
Mem_Free( search->pack->files ); Mem_Free( search->pack->files );
if( search->pack->handle >= 0 ) if( search->pack->handle >= 0 )
close( search->pack->handle ); close( search->pack->handle );
@ -1467,7 +1467,7 @@ static void FS_WriteGameInfo( const char *filepath, gameinfo_t *GameInfo )
FS_Printf( f, "date\t\t\"%s\"\n", GameInfo->date ); FS_Printf( f, "date\t\t\"%s\"\n", GameInfo->date );
if( COM_CheckStringEmpty( GameInfo->dll_path ) ) if( COM_CheckStringEmpty( GameInfo->dll_path ) )
FS_Printf( f, "dllpath\t\t\"%s\"\n", GameInfo->dll_path ); FS_Printf( f, "dllpath\t\t\"%s\"\n", GameInfo->dll_path );
if( COM_CheckStringEmpty( GameInfo->game_dll ) ) if( COM_CheckStringEmpty( GameInfo->game_dll ) )
FS_Printf( f, "gamedll\t\t\"%s\"\n", GameInfo->game_dll ); FS_Printf( f, "gamedll\t\t\"%s\"\n", GameInfo->game_dll );
@ -1803,7 +1803,7 @@ static qboolean FS_ParseLiblistGam( const char *filename, const char *gamedir, g
{ {
char *afile; char *afile;
if( !GameInfo ) return false; if( !GameInfo ) return false;
afile = (char *)FS_LoadFile( filename, NULL, false ); afile = (char *)FS_LoadFile( filename, NULL, false );
if( !afile ) return false; if( !afile ) return false;
@ -2002,7 +2002,7 @@ void FS_LoadGameInfo( const char *rootfolder )
{ {
SI.clientlib[0] = 0; SI.clientlib[0] = 0;
} }
FS_Rescan(); // create new filesystem FS_Rescan(); // create new filesystem
Image_CheckPaletteQ1 (); Image_CheckPaletteQ1 ();
@ -2020,7 +2020,7 @@ void FS_Init( void )
qboolean hasBaseDir = false; qboolean hasBaseDir = false;
qboolean hasGameDir = false; qboolean hasGameDir = false;
int i; int i;
FS_InitMemory(); FS_InitMemory();
Cmd_AddCommand( "fs_rescan", FS_Rescan_f, "rescan filesystem search pathes" ); Cmd_AddCommand( "fs_rescan", FS_Rescan_f, "rescan filesystem search pathes" );
@ -2051,7 +2051,7 @@ void FS_Init( void )
SI.numgames = 0; SI.numgames = 0;
Q_strncpy( fs_basedir, SI.basedirName, sizeof( fs_basedir )); // default dir Q_strncpy( fs_basedir, SI.basedirName, sizeof( fs_basedir )); // default dir
if( !Sys_GetParmFromCmdLine( "-game", fs_gamedir )) if( !Sys_GetParmFromCmdLine( "-game", fs_gamedir ))
Q_strncpy( fs_gamedir, fs_basedir, sizeof( fs_gamedir )); // gamedir == basedir Q_strncpy( fs_gamedir, fs_basedir, sizeof( fs_gamedir )); // gamedir == basedir
@ -2157,7 +2157,7 @@ Internal function used to determine filetime
static int FS_SysFileTime( const char *filename ) static int FS_SysFileTime( const char *filename )
{ {
struct stat buf; struct stat buf;
if( stat( filename, &buf ) == -1 ) if( stat( filename, &buf ) == -1 )
return -1; return -1;
@ -2457,7 +2457,7 @@ static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedir
} }
else if( search->wad ) else if( search->wad )
{ {
dlumpinfo_t *lump; dlumpinfo_t *lump;
signed char type = W_TypeFromExt( name ); signed char type = W_TypeFromExt( name );
qboolean anywadname = true; qboolean anywadname = true;
string wadname, wadfolder; string wadname, wadfolder;
@ -2588,7 +2588,7 @@ file_t *FS_OpenReadFile( const char *filename, const char *mode, qboolean gamedi
// not found? // not found?
if( search == NULL ) if( search == NULL )
return NULL; return NULL;
if( search->pack ) if( search->pack )
return FS_OpenPackedFile( search->pack, pack_ind ); return FS_OpenPackedFile( search->pack, pack_ind );
@ -2603,7 +2603,7 @@ file_t *FS_OpenReadFile( const char *filename, const char *mode, qboolean gamedi
// found in the filesystem? // found in the filesystem?
Q_sprintf( path, "%s%s", search->filename, filename ); Q_sprintf( path, "%s%s", search->filename, filename );
return FS_SysOpen( path, mode ); return FS_SysOpen( path, mode );
} }
return NULL; return NULL;
} }
@ -2644,7 +2644,7 @@ file_t *FS_Open( const char *filepath, const char *mode, qboolean gamedironly )
FS_CreatePath( real_path );// Create directories up to the file FS_CreatePath( real_path );// Create directories up to the file
return FS_SysOpen( real_path, mode ); return FS_SysOpen( real_path, mode );
} }
// else, we look at the various search paths and open the file in read-only mode // else, we look at the various search paths and open the file in read-only mode
return FS_OpenReadFile( filepath, mode, gamedironly ); return FS_OpenReadFile( filepath, mode, gamedironly );
} }
@ -2939,10 +2939,10 @@ int FS_Seek( file_t *file, fs_offset_t offset, int whence )
case SEEK_END: case SEEK_END:
offset += file->real_length; offset += file->real_length;
break; break;
default: default:
return -1; return -1;
} }
if( offset < 0 || offset > file->real_length ) if( offset < 0 || offset > file->real_length )
return -1; return -1;
@ -3286,7 +3286,7 @@ dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath )
// NOTE: for libraries we not fail even if search is NULL // NOTE: for libraries we not fail even if search is NULL
// let the OS find library himself // let the OS find library himself
hInst = Mem_Calloc( host.mempool, sizeof( dll_user_t )); hInst = Mem_Calloc( host.mempool, sizeof( dll_user_t ));
// save dllname for debug purposes // save dllname for debug purposes
Q_strncpy( hInst->dllName, dllname, sizeof( hInst->dllName )); Q_strncpy( hInst->dllName, dllname, sizeof( hInst->dllName ));
@ -3308,7 +3308,7 @@ dll_user_t *FS_FindLibrary( const char *dllname, qboolean directpath )
hInst->custom_loader = (search) ? true : false; hInst->custom_loader = (search) ? true : false;
} }
fs_ext_path = false; // always reset direct paths fs_ext_path = false; // always reset direct paths
return hInst; return hInst;
} }
@ -3322,7 +3322,7 @@ return size of file in bytes
fs_offset_t FS_FileSize( const char *filename, qboolean gamedironly ) fs_offset_t FS_FileSize( const char *filename, qboolean gamedironly )
{ {
int length = -1; // in case file was missed int length = -1; // in case file was missed
file_t *fp; file_t *fp;
fp = FS_Open( filename, "rb", gamedironly ); fp = FS_Open( filename, "rb", gamedironly );
@ -3361,7 +3361,7 @@ int FS_FileTime( const char *filename, qboolean gamedironly )
{ {
searchpath_t *search; searchpath_t *search;
int pack_ind; int pack_ind;
search = FS_FindFile( filename, &pack_ind, gamedironly ); search = FS_FindFile( filename, &pack_ind, gamedironly );
if( !search ) return -1; // doesn't exist if( !search ) return -1; // doesn't exist
@ -3684,7 +3684,7 @@ search_t *FS_Search( const char *pattern, int caseinsensitive, int gamedironly )
void FS_InitMemory( void ) void FS_InitMemory( void )
{ {
fs_mempool = Mem_AllocPool( "FileSystem Pool" ); fs_mempool = Mem_AllocPool( "FileSystem Pool" );
fs_searchpaths = NULL; fs_searchpaths = NULL;
} }
@ -3722,7 +3722,7 @@ static signed char W_TypeFromExt( const char *lumpname )
// we not known about filetype, so match only by filename // we not known about filetype, so match only by filename
if( !Q_strcmp( ext, "*" ) || !Q_strcmp( ext, "" )) if( !Q_strcmp( ext, "*" ) || !Q_strcmp( ext, "" ))
return TYP_ANY; return TYP_ANY;
for( type = wad_types; type->ext; type++ ) for( type = wad_types; type->ext; type++ )
{ {
if( !Q_stricmp( ext, type->ext )) if( !Q_stricmp( ext, type->ext ))
@ -3771,7 +3771,7 @@ static dlumpinfo_t *W_FindLump( wfile_t *wad, const char *name, const signed cha
// look for the file (binary search) // look for the file (binary search)
left = 0; left = 0;
right = wad->numlumps - 1; right = wad->numlumps - 1;
while( left <= right ) while( left <= right )
{ {
int middle = (left + right) / 2; int middle = (left + right) / 2;
@ -3921,7 +3921,7 @@ wfile_t *W_Open( const char *filename, int *error )
wad->handle = FS_SysOpen( filename, "rb" ); wad->handle = FS_SysOpen( filename, "rb" );
if( wad->handle == NULL ) if( wad->handle == NULL )
{ {
Con_Reportf( S_ERROR "W_Open: couldn't open %s\n", filename ); Con_Reportf( S_ERROR "W_Open: couldn't open %s\n", filename );
if( error ) *error = WAD_LOAD_COULDNT_OPEN; if( error ) *error = WAD_LOAD_COULDNT_OPEN;
W_Close( wad ); W_Close( wad );
@ -4008,7 +4008,7 @@ wfile_t *W_Open( const char *filename, int *error )
// check for Quake 'conchars' issues (only lmp loader really allows to read this lame pic) // check for Quake 'conchars' issues (only lmp loader really allows to read this lame pic)
if( srclumps[i].type == 68 && !Q_stricmp( srclumps[i].name, "conchars" )) if( srclumps[i].type == 68 && !Q_stricmp( srclumps[i].name, "conchars" ))
srclumps[i].type = TYP_GFXPIC; srclumps[i].type = TYP_GFXPIC;
W_AddFileToWad( name, wad, &srclumps[i] ); W_AddFileToWad( name, wad, &srclumps[i] );
} }
@ -4033,7 +4033,7 @@ void W_Close( wfile_t *wad )
Mem_FreePool( &wad->mempool ); Mem_FreePool( &wad->mempool );
if( wad->handle != NULL ) if( wad->handle != NULL )
FS_Close( wad->handle ); FS_Close( wad->handle );
Mem_Free( wad ); // free himself Mem_Free( wad ); // free himself
} }
@ -4058,6 +4058,6 @@ static byte *W_LoadFile( const char *path, fs_offset_t *lumpsizeptr, qboolean ga
search = FS_FindFile( path, &index, gamedironly ); search = FS_FindFile( path, &index, gamedironly );
if( search && search->wad ) if( search && search->wad )
return W_ReadLump( search->wad, &search->wad->lumps[index], lumpsizeptr ); return W_ReadLump( search->wad, &search->wad->lumps[index], lumpsizeptr );
return NULL; return NULL;
} }

View File

@ -39,7 +39,7 @@ void BuildGammaTable( float lightgamma, float brightness )
else g3 = 0.125f - (brightness * brightness) * 0.075f; else g3 = 0.125f - (brightness * brightness) * 0.075f;
g = 1.0f / lightgamma; g = 1.0f / lightgamma;
g1 = GAMMA * g; g1 = GAMMA * g;
for( i = 0; i < 256; i++ ) for( i = 0; i < 256; i++ )
{ {

View File

@ -225,21 +225,21 @@ void Host_EndGame( qboolean abort, const char *message, ... )
{ {
va_list argptr; va_list argptr;
static char string[MAX_SYSPATH]; static char string[MAX_SYSPATH];
va_start( argptr, message ); va_start( argptr, message );
Q_vsnprintf( string, sizeof( string ), message, argptr ); Q_vsnprintf( string, sizeof( string ), message, argptr );
va_end( argptr ); va_end( argptr );
Con_Printf( "Host_EndGame: %s\n", string ); Con_Printf( "Host_EndGame: %s\n", string );
SV_Shutdown( "\n" ); SV_Shutdown( "\n" );
#if !XASH_DEDICATED #if !XASH_DEDICATED
CL_Disconnect(); CL_Disconnect();
// recreate world if needs // recreate world if needs
CL_ClearEdicts (); CL_ClearEdicts ();
#endif #endif
// release all models // release all models
Mod_FreeAll(); Mod_FreeAll();
@ -331,7 +331,7 @@ void Host_ChangeGame_f( void )
} }
else if( !Q_stricmp( GI->gamefolder, Cmd_Argv( 1 ))) else if( !Q_stricmp( GI->gamefolder, Cmd_Argv( 1 )))
{ {
Con_Printf( "%s already active\n", Cmd_Argv( 1 )); Con_Printf( "%s already active\n", Cmd_Argv( 1 ));
} }
else else
{ {
@ -367,7 +367,7 @@ void Host_Exec_f( void )
return; return;
} }
Q_strncpy( cfgpath, Cmd_Argv( 1 ), sizeof( cfgpath )); Q_strncpy( cfgpath, Cmd_Argv( 1 ), sizeof( cfgpath ));
COM_DefaultExtension( cfgpath, ".cfg" ); // append as default COM_DefaultExtension( cfgpath, ".cfg" ); // append as default
f = FS_LoadFile( cfgpath, &len, false ); f = FS_LoadFile( cfgpath, &len, false );
@ -606,7 +606,7 @@ qboolean Host_FilterTime( float time )
else else
{ {
if(( host.realtime - oldtime ) < ( 1.0 / fps )) if(( host.realtime - oldtime ) < ( 1.0 / fps ))
return false; return false;
} }
} }
@ -696,7 +696,7 @@ void GAME_EXPORT Host_Error( const char *error, ... )
if( host.status == HOST_SHUTDOWN ) return; if( host.status == HOST_SHUTDOWN ) return;
if( recursive ) if( recursive )
{ {
Con_Printf( "Host_RecursiveError: %s", hosterror2 ); Con_Printf( "Host_RecursiveError: %s", hosterror2 );
Sys_Error( "%s", hosterror1 ); Sys_Error( "%s", hosterror1 );
return; // don't multiple executes return; // don't multiple executes
@ -1013,7 +1013,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
host_serverstate = Cvar_Get( "host_serverstate", "0", FCVAR_READ_ONLY, "displays current server state" ); host_serverstate = Cvar_Get( "host_serverstate", "0", FCVAR_READ_ONLY, "displays current server state" );
host_maxfps = Cvar_Get( "fps_max", "72", FCVAR_ARCHIVE, "host fps upper limit" ); host_maxfps = Cvar_Get( "fps_max", "72", FCVAR_ARCHIVE, "host fps upper limit" );
host_framerate = Cvar_Get( "host_framerate", "0", 0, "locks frame timing to this value in seconds" ); host_framerate = Cvar_Get( "host_framerate", "0", 0, "locks frame timing to this value in seconds" );
host_sleeptime = Cvar_Get( "sleeptime", "1", FCVAR_ARCHIVE, "milliseconds to sleep for each frame. higher values reduce fps accuracy" ); host_sleeptime = Cvar_Get( "sleeptime", "1", FCVAR_ARCHIVE, "milliseconds to sleep for each frame. higher values reduce fps accuracy" );
host_gameloaded = Cvar_Get( "host_gameloaded", "0", FCVAR_READ_ONLY, "inidcates a loaded game.dll" ); host_gameloaded = Cvar_Get( "host_gameloaded", "0", FCVAR_READ_ONLY, "inidcates a loaded game.dll" );
host_clientloaded = Cvar_Get( "host_clientloaded", "0", FCVAR_READ_ONLY, "inidcates a loaded client.dll" ); host_clientloaded = Cvar_Get( "host_clientloaded", "0", FCVAR_READ_ONLY, "inidcates a loaded client.dll" );
@ -1074,7 +1074,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa
Cbuf_AddText( "exec config.cfg\n" ); Cbuf_AddText( "exec config.cfg\n" );
Cbuf_Execute(); Cbuf_Execute();
} }
// exec all files from userconfig.d // exec all files from userconfig.d
Host_Userconfigd_f(); Host_Userconfigd_f();
break; break;
case HOST_DEDICATED: case HOST_DEDICATED:

View File

@ -44,7 +44,7 @@ const char *HPAK_TypeFromIndex( int type )
case t_decal: return "decal"; case t_decal: return "decal";
case t_generic: return "generic"; case t_generic: return "generic";
case t_eventscript: return "event"; case t_eventscript: return "event";
case t_world: return "map"; case t_world: return "map";
} }
return "?"; return "?";
} }
@ -439,7 +439,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet )
pRes = &dataDir[i].resource; pRes = &dataDir[i].resource;
Con_Printf( "%i: %s %s %s: ", i, HPAK_TypeFromIndex( pRes->type ), Con_Printf( "%i: %s %s %s: ", i, HPAK_TypeFromIndex( pRes->type ),
Q_pretifymem( pRes->nDownloadSize, 2 ), pRes->szFileName ); Q_pretifymem( pRes->nDownloadSize, 2 ), pRes->szFileName );
if( memcmp( md5, pRes->rgucMD5_hash, 0x10 )) if( memcmp( md5, pRes->rgucMD5_hash, 0x10 ))
{ {
@ -518,7 +518,7 @@ qboolean HPAK_ResourceForHash( const char *filename, byte *hash, resource_t *pRe
if( !COM_CheckString( filename )) if( !COM_CheckString( filename ))
return false; return false;
for( p = gp_hpak_queue; p != NULL; p = p->next ) for( p = gp_hpak_queue; p != NULL; p = p->next )
{ {
if( !Q_stricmp( p->name, filename ) && !memcmp( p->resource.rgucMD5_hash, hash, 16 )) if( !Q_stricmp( p->name, filename ) && !memcmp( p->resource.rgucMD5_hash, hash, 16 ))

View File

@ -366,7 +366,7 @@ int ID_GetKeyData( HKEY hRootKey, char *subKey, char *value, LPBYTE data, DWORD
if( RegOpenKeyEx( hRootKey, subKey, 0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS ) if( RegOpenKeyEx( hRootKey, subKey, 0, KEY_QUERY_VALUE, &hKey ) != ERROR_SUCCESS )
return 0; return 0;
if( RegQueryValueEx( hKey, value, NULL, NULL, data, &cbData ) != ERROR_SUCCESS ) if( RegQueryValueEx( hKey, value, NULL, NULL, data, &cbData ) != ERROR_SUCCESS )
{ {
RegCloseKey( hKey ); RegCloseKey( hKey );
@ -381,13 +381,13 @@ int ID_SetKeyData( HKEY hRootKey, char *subKey, DWORD dwType, char *value, LPBYT
HKEY hKey; HKEY hKey;
if( RegCreateKey( hRootKey, subKey, &hKey ) != ERROR_SUCCESS ) if( RegCreateKey( hRootKey, subKey, &hKey ) != ERROR_SUCCESS )
return 0; return 0;
if( RegSetValueEx( hKey, value, 0, dwType, data, cbData ) != ERROR_SUCCESS ) if( RegSetValueEx( hKey, value, 0, dwType, data, cbData ) != ERROR_SUCCESS )
{ {
RegCloseKey( hKey ); RegCloseKey( hKey );
return 0; return 0;
} }
RegCloseKey( hKey ); RegCloseKey( hKey );
return 1; return 1;
} }
@ -403,18 +403,18 @@ int ID_RunWMIC(char *buffer, const char *cmdline)
DWORD dwRead; DWORD dwRead;
BOOL bSuccess = FALSE; BOOL bSuccess = FALSE;
SECURITY_ATTRIBUTES saAttr; SECURITY_ATTRIBUTES saAttr;
STARTUPINFO si = {0}; STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0}; PROCESS_INFORMATION pi = {0};
saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
saAttr.bInheritHandle = TRUE; saAttr.bInheritHandle = TRUE;
saAttr.lpSecurityDescriptor = NULL; saAttr.lpSecurityDescriptor = NULL;
CreatePipe( &g_IN_Rd, &g_IN_Wr, &saAttr, 0 ); CreatePipe( &g_IN_Rd, &g_IN_Wr, &saAttr, 0 );
CreatePipe( &g_OUT_Rd, &g_OUT_Wr, &saAttr, 0 ); CreatePipe( &g_OUT_Rd, &g_OUT_Wr, &saAttr, 0 );
SetHandleInformation( g_IN_Wr, HANDLE_FLAG_INHERIT, 0 ); SetHandleInformation( g_IN_Wr, HANDLE_FLAG_INHERIT, 0 );
si.cb = sizeof(STARTUPINFO); si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES; si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = g_IN_Rd; si.hStdInput = g_IN_Rd;
@ -424,12 +424,12 @@ int ID_RunWMIC(char *buffer, const char *cmdline)
si.dwFlags |= STARTF_USESTDHANDLES; si.dwFlags |= STARTF_USESTDHANDLES;
CreateProcess( NULL, (char*)cmdline, NULL, NULL, true, CREATE_NO_WINDOW , NULL, NULL, &si, &pi ); CreateProcess( NULL, (char*)cmdline, NULL, NULL, true, CREATE_NO_WINDOW , NULL, NULL, &si, &pi );
CloseHandle( g_OUT_Wr ); CloseHandle( g_OUT_Wr );
CloseHandle( g_IN_Wr ); CloseHandle( g_IN_Wr );
WaitForSingleObject( pi.hProcess, 500 ); WaitForSingleObject( pi.hProcess, 500 );
bSuccess = ReadFile( g_OUT_Rd, buffer, BUFSIZE, &dwRead, NULL ); bSuccess = ReadFile( g_OUT_Rd, buffer, BUFSIZE, &dwRead, NULL );
buffer[BUFSIZE-1] = 0; buffer[BUFSIZE-1] = 0;
CloseHandle( g_IN_Rd ); CloseHandle( g_IN_Rd );
@ -541,7 +541,7 @@ uint ID_CheckRawId( bloomfilter_t filter )
if( ID_ProcessCPUInfo( &value ) ) if( ID_ProcessCPUInfo( &value ) )
count += (filter & value) == value; count += (filter & value) == value;
#endif #endif
#if XASH_WIN32 #if XASH_WIN32
count += ID_CheckWMIC( filter, "wmic path win32_physicalmedia get SerialNumber" ); count += ID_CheckWMIC( filter, "wmic path win32_physicalmedia get SerialNumber" );
count += ID_CheckWMIC( filter, "wmic bios get serialnumber" ); count += ID_CheckWMIC( filter, "wmic bios get serialnumber" );
@ -627,12 +627,12 @@ void ID_Init( void )
id ^= SYSTEM_XOR_MASK; id ^= SYSTEM_XOR_MASK;
ID_Check(); ID_Check();
} }
#elif XASH_WIN32 #elif XASH_WIN32
{ {
CHAR szBuf[MAX_PATH]; CHAR szBuf[MAX_PATH];
ID_GetKeyData( HKEY_CURRENT_USER, "Software\\Xash3D\\", "xash_id", szBuf, MAX_PATH ); ID_GetKeyData( HKEY_CURRENT_USER, "Software\\Xash3D\\", "xash_id", szBuf, MAX_PATH );
sscanf(szBuf, "%016llX", &id); sscanf(szBuf, "%016llX", &id);
id ^= SYSTEM_XOR_MASK; id ^= SYSTEM_XOR_MASK;
ID_Check(); ID_Check();

View File

@ -80,7 +80,7 @@ typedef struct imglib_s
int source_width; // locked cubemap dims (all wrong sides will be automatically resampled) int source_width; // locked cubemap dims (all wrong sides will be automatically resampled)
int source_height; int source_height;
uint source_type; // shared image type for all mipmaps or cubemap sides uint source_type; // shared image type for all mipmaps or cubemap sides
int num_sides; // how much sides is loaded int num_sides; // how much sides is loaded
byte *cubemap; // cubemap pack byte *cubemap; // cubemap pack
// indexed images state // indexed images state

View File

@ -51,7 +51,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
{ {
Con_DPrintf( S_ERROR "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name ); Con_DPrintf( S_ERROR "Image_LoadBMP: only Windows-style BMP files supported (%s)\n", name );
return false; return false;
} }
if( bhdr.bitmapHeaderSize != 0x28 ) if( bhdr.bitmapHeaderSize != 0x28 )
{ {
@ -67,7 +67,7 @@ qboolean Image_LoadBMP( const char *name, const byte *buffer, fs_offset_t filesi
} }
// bogus compression? Only non-compressed supported. // bogus compression? Only non-compressed supported.
if( bhdr.compression != BI_RGB ) if( bhdr.compression != BI_RGB )
{ {
Con_DPrintf( S_ERROR "Image_LoadBMP: only uncompressed BMP files supported (%s)\n", name ); Con_DPrintf( S_ERROR "Image_LoadBMP: only uncompressed BMP files supported (%s)\n", name );
return false; return false;
@ -352,7 +352,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
break; break;
case PF_RGBA_32: case PF_RGBA_32:
pixel_size = 4; pixel_size = 4;
break; break;
default: default:
return false; return false;
} }
@ -361,7 +361,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix )
if( !pfile ) return false; if( !pfile ) return false;
// NOTE: align transparency column will sucessfully removed // NOTE: align transparency column will sucessfully removed
// after create sprite or lump image, it's just standard requiriments // after create sprite or lump image, it's just standard requiriments
biTrueWidth = ((pix->width + 3) & ~3); biTrueWidth = ((pix->width + 3) & ~3);
cbBmpBits = biTrueWidth * pix->height * pixel_size; cbBmpBits = biTrueWidth * pix->height * pixel_size;
cbPalBytes = ( pixel_size == 1 ) ? 256 * sizeof( rgba_t ) : 0; cbPalBytes = ( pixel_size == 1 ) ? 256 * sizeof( rgba_t ) : 0;

View File

@ -20,8 +20,8 @@ GNU General Public License for more details.
qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin ) qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
{ {
word sAlpha; word sAlpha;
byte *alpha; byte *alpha;
int x, y, i, j; int x, y, i, j;
for( y = 0; y < hdr->dwHeight; y += 4 ) for( y = 0; y < hdr->dwHeight; y += 4 )
{ {
@ -53,8 +53,8 @@ qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin )
qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin ) qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
{ {
uint bits, bitmask; uint bits, bitmask;
byte *alphamask; byte *alphamask;
int x, y, i, j; int x, y, i, j;
for( y = 0; y < hdr->dwHeight; y += 4 ) for( y = 0; y < hdr->dwHeight; y += 4 )
{ {
@ -90,7 +90,7 @@ qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin )
return false; return false;
} }
void Image_DXTGetPixelFormat( dds_t *hdr ) void Image_DXTGetPixelFormat( dds_t *hdr )
{ {
uint bits = hdr->dsPixelFormat.dwRGBBitCount; uint bits = hdr->dsPixelFormat.dwRGBBitCount;
@ -102,7 +102,7 @@ void Image_DXTGetPixelFormat( dds_t *hdr )
{ {
switch( hdr->dsPixelFormat.dwFourCC ) switch( hdr->dsPixelFormat.dwFourCC )
{ {
case TYPE_DXT1: case TYPE_DXT1:
image.type = PF_DXT1; image.type = PF_DXT1;
break; break;
case TYPE_DXT2: case TYPE_DXT2:
@ -136,7 +136,7 @@ void Image_DXTGetPixelFormat( dds_t *hdr )
{ {
image.type = PF_UNKNOWN; // assume error image.type = PF_UNKNOWN; // assume error
} }
else else
{ {
switch( bits ) switch( bits )
{ {
@ -177,16 +177,16 @@ size_t Image_DXTGetLinearSize( int type, int width, int height, int depth )
case PF_RGB_24: return (width * height * depth * 3); case PF_RGB_24: return (width * height * depth * 3);
case PF_BGRA_32: case PF_BGRA_32:
case PF_RGBA_32: return (width * height * depth * 4); case PF_RGBA_32: return (width * height * depth * 4);
} }
return 0; return 0;
} }
size_t Image_DXTCalcMipmapSize( dds_t *hdr ) size_t Image_DXTCalcMipmapSize( dds_t *hdr )
{ {
size_t buffsize = 0; size_t buffsize = 0;
int i, width, height; int i, width, height;
// now correct buffer size // now correct buffer size
for( i = 0; i < Q_max( 1, ( hdr->dwMipMapCount )); i++ ) for( i = 0; i < Q_max( 1, ( hdr->dwMipMapCount )); i++ )
{ {
@ -198,14 +198,14 @@ size_t Image_DXTCalcMipmapSize( dds_t *hdr )
return buffsize; return buffsize;
} }
uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize ) uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
{ {
size_t buffsize = 0; size_t buffsize = 0;
int w = image.width; int w = image.width;
int h = image.height; int h = image.height;
int d = image.depth; int d = image.depth;
if( hdr->dsCaps.dwCaps2 & DDS_CUBEMAP ) if( hdr->dsCaps.dwCaps2 & DDS_CUBEMAP )
{ {
// cubemap w*h always match for all sides // cubemap w*h always match for all sides
buffsize = Image_DXTCalcMipmapSize( hdr ) * 6; buffsize = Image_DXTCalcMipmapSize( hdr ) * 6;
@ -220,7 +220,7 @@ uint Image_DXTCalcSize( const char *name, dds_t *hdr, size_t filesize )
// just in case (no need, really) // just in case (no need, really)
buffsize = hdr->dwLinearSize; buffsize = hdr->dwLinearSize;
} }
else else
{ {
// pretty solution for microsoft bug // pretty solution for microsoft bug
buffsize = Image_DXTCalcMipmapSize( hdr ); buffsize = Image_DXTCalcMipmapSize( hdr );
@ -290,13 +290,13 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi
if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ImageDXT( image.type )) if( !Image_CheckFlag( IL_DDS_HARDWARE ) && ImageDXT( image.type ))
return false; // silently rejected return false; // silently rejected
if( image.type == PF_UNKNOWN ) if( image.type == PF_UNKNOWN )
{ {
Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) has unrecognized type\n", name ); Con_DPrintf( S_ERROR "Image_LoadDDS: (%s) has unrecognized type\n", name );
return false; return false;
} }
image.size = Image_DXTCalcSize( name, &header, filesize - 128 ); image.size = Image_DXTCalcSize( name, &header, filesize - 128 );
if( image.size == 0 ) return false; // just in case if( image.size == 0 ) return false; // just in case
fin = (byte *)(buffer + sizeof( dds_t )); fin = (byte *)(buffer + sizeof( dds_t ));
@ -338,7 +338,7 @@ qboolean Image_LoadDDS( const char *name, const byte *buffer, fs_offset_t filesi
} }
// dds files will be uncompressed on a render. requires minimal of info for set this // dds files will be uncompressed on a render. requires minimal of info for set this
image.rgba = Mem_Malloc( host.imagepool, image.size ); image.rgba = Mem_Malloc( host.imagepool, image.size );
memcpy( image.rgba, fin, image.size ); memcpy( image.rgba, fin, image.size );
SetBits( image.flags, IMAGE_DDS_FORMAT ); SetBits( image.flags, IMAGE_DDS_FORMAT );

View File

@ -69,7 +69,7 @@ static const cubepack_t load_cubemap[] =
{ NULL, NULL }, { NULL, NULL },
}; };
// soul of ImageLib - table of image format constants // soul of ImageLib - table of image format constants
const bpc_desc_t PFDesc[] = const bpc_desc_t PFDesc[] =
{ {
{ PF_UNKNOWN, "raw", 0x1908, 0 }, { PF_UNKNOWN, "raw", 0x1908, 0 },
@ -123,7 +123,7 @@ rgbdata_t *ImagePack( void )
return NULL; return NULL;
} }
if( image.cubemap ) if( image.cubemap )
{ {
image.flags |= IMAGE_CUBEMAP; image.flags |= IMAGE_CUBEMAP;
pack->buffer = image.cubemap; pack->buffer = image.cubemap;
@ -132,7 +132,7 @@ rgbdata_t *ImagePack( void )
pack->type = image.source_type; pack->type = image.source_type;
pack->size = image.size * image.num_sides; pack->size = image.size * image.num_sides;
} }
else else
{ {
pack->buffer = image.rgba; pack->buffer = image.rgba;
pack->width = image.width; pack->width = image.width;
@ -152,7 +152,7 @@ rgbdata_t *ImagePack( void )
pack->numMips = image.num_mips; pack->numMips = image.num_mips;
pack->palette = image.palette; pack->palette = image.palette;
pack->encode = image.encode; pack->encode = image.encode;
return pack; return pack;
} }
@ -166,7 +166,7 @@ qboolean FS_AddSideToPack( const char *name, int adjust_flags )
{ {
byte *out, *flipped; byte *out, *flipped;
qboolean resampled = false; qboolean resampled = false;
// first side set average size for all cubemap sides! // first side set average size for all cubemap sides!
if( !image.cubemap ) if( !image.cubemap )
{ {
@ -258,7 +258,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
Mem_Free( f ); // release buffer Mem_Free( f ); // release buffer
return ImagePack(); // loaded return ImagePack(); // loaded
} }
else Mem_Free( f ); // release buffer else Mem_Free( f ); // release buffer
} }
} }
} }
@ -280,7 +280,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
f = FS_LoadFile( path, &filesize, false ); f = FS_LoadFile( path, &filesize, false );
if( f && filesize > 0 ) if( f && filesize > 0 )
{ {
// this name will be used only for tell user about problems // this name will be used only for tell user about problems
if( format->loadfunc( path, f, filesize )) if( format->loadfunc( path, f, filesize ))
{ {
Q_snprintf( sidename, sizeof( sidename ), "%s%s.%s", loadname, cmap->type[i].suf, format->ext ); Q_snprintf( sidename, sizeof( sidename ), "%s%s.%s", loadname, cmap->type[i].suf, format->ext );
@ -298,7 +298,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
if( image.num_sides != i + 1 ) // check side if( image.num_sides != i + 1 ) // check side
{ {
// first side not found, probably it's not cubemap // first side not found, probably it's not cubemap
// it contain info about image_type and dimensions, don't generate black cubemaps // it contain info about image_type and dimensions, don't generate black cubemaps
if( !image.cubemap ) break; if( !image.cubemap ) break;
// Mem_Alloc already filled memblock with 0x00, no need to do it again // Mem_Alloc already filled memblock with 0x00, no need to do it again
image.cubemap = Mem_Realloc( host.imagepool, image.cubemap, image.ptr + image.size ); image.cubemap = Mem_Realloc( host.imagepool, image.cubemap, image.ptr + image.size );
@ -386,7 +386,7 @@ qboolean FS_SaveImage( const char *filename, rgbdata_t *pix )
return false; // do not happens return false; // do not happens
} }
pix->size /= 6; // now set as side size pix->size /= 6; // now set as side size
picBuffer = pix->buffer; picBuffer = pix->buffer;
// save all sides seperately // save all sides seperately

View File

@ -42,7 +42,7 @@ GNU General Public License for more details.
#define radiusbiasshift 6 // at 32.0 biased by 6 bits #define radiusbiasshift 6 // at 32.0 biased by 6 bits
#define radiusbias (1<<radiusbiasshift) #define radiusbias (1<<radiusbiasshift)
#define initradius (initrad * radiusbias) // and decreases by a #define initradius (initrad * radiusbias) // and decreases by a
#define radiusdec 30 // factor of 1/30 each cycle #define radiusdec 30 // factor of 1/30 each cycle
// defs for decreasing alpha factor // defs for decreasing alpha factor
#define alphabiasshift 10 // alpha starts at 1.0 #define alphabiasshift 10 // alpha starts at 1.0
@ -65,14 +65,14 @@ static int bias[netsize]; // bias and freq arrays for learning
static int freq[netsize]; static int freq[netsize];
static int radpower[initrad]; // radpower for precomputation static int radpower[initrad]; // radpower for precomputation
void initnet( byte *thepic, int len, int sample ) void initnet( byte *thepic, int len, int sample )
{ {
register int i, *p; register int i, *p;
thepicture = thepic; thepicture = thepic;
lengthcount = len; lengthcount = len;
samplefac = sample; samplefac = sample;
for( i = 0; i < netsize; i++ ) for( i = 0; i < netsize; i++ )
{ {
p = network[i]; p = network[i];
@ -81,7 +81,7 @@ void initnet( byte *thepic, int len, int sample )
bias[i] = 0; bias[i] = 0;
} }
} }
// Unbias network to give byte values 0..255 and record position i to prepare for sort // Unbias network to give byte values 0..255 and record position i to prepare for sort
void unbiasnet( void ) void unbiasnet( void )
{ {
@ -369,12 +369,12 @@ void learn( void )
delta = samplepixels / ncycles; delta = samplepixels / ncycles;
alpha = initalpha; alpha = initalpha;
radius = initradius; radius = initradius;
rad = radius >> radiusbiasshift; rad = radius >> radiusbiasshift;
if( rad <= 1 ) rad = 0; if( rad <= 1 ) rad = 0;
for( i = 0; i < rad; i++ ) for( i = 0; i < rad; i++ )
radpower[i] = alpha * ((( rad * rad - i * i ) * radbias ) / ( rad * rad )); radpower[i] = alpha * ((( rad * rad - i * i ) * radbias ) / ( rad * rad ));
if( delta <= 0 ) return; if( delta <= 0 ) return;
@ -394,7 +394,7 @@ void learn( void )
{ {
step = prime4 * image.bpp; step = prime4 * image.bpp;
} }
i = 0; i = 0;
while( i < samplepixels ) while( i < samplepixels )
@ -409,17 +409,17 @@ void learn( void )
p += step; p += step;
if( p >= lim ) p -= lengthcount; if( p >= lim ) p -= lengthcount;
i++; i++;
if( i % delta == 0 ) if( i % delta == 0 )
{ {
alpha -= alpha / alphadec; alpha -= alpha / alphadec;
radius -= radius / radiusdec; radius -= radius / radiusdec;
rad = radius >> radiusbiasshift; rad = radius >> radiusbiasshift;
if( rad <= 1 ) rad = 0; if( rad <= 1 ) rad = 0;
for( j = 0; j < rad; j++ ) for( j = 0; j < rad; j++ )
radpower[j] = alpha * ((( rad * rad - j * j ) * radbias ) / ( rad * rad )); radpower[j] = alpha * ((( rad * rad - j * j ) * radbias ) / ( rad * rad ));
} }
} }
@ -452,7 +452,7 @@ rgbdata_t *Image_Quantize( rgbdata_t *pic )
{ {
pic->palette[i*3+0] = network[i][0]; // red pic->palette[i*3+0] = network[i][0]; // red
pic->palette[i*3+1] = network[i][1]; // green pic->palette[i*3+1] = network[i][1]; // green
pic->palette[i*3+2] = network[i][2]; // blue pic->palette[i*3+2] = network[i][2]; // blue
} }
inxbuild(); inxbuild();

View File

@ -326,7 +326,7 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix )
} }
} }
break; break;
} }
FS_WriteFile( name, buffer, outsize ); FS_WriteFile( name, buffer, outsize );

View File

@ -80,14 +80,14 @@ static byte palette_hl[768] =
147,255,247,199,255,255,255,159,91,83 147,255,247,199,255,255,255,159,91,83
}; };
static float img_emboss[FILTER_SIZE][FILTER_SIZE] = static float img_emboss[FILTER_SIZE][FILTER_SIZE] =
{ {
{-0.7f, -0.7f, -0.7f, -0.7f, 0.0f }, {-0.7f, -0.7f, -0.7f, -0.7f, 0.0f },
{-0.7f, -0.7f, -0.7f, 0.0f, 0.7f }, {-0.7f, -0.7f, -0.7f, 0.0f, 0.7f },
{-0.7f, -0.7f, 0.0f, 0.7f, 0.7f }, {-0.7f, -0.7f, 0.0f, 0.7f, 0.7f },
{-0.7f, 0.0f, 0.7f, 0.7f, 0.7f }, {-0.7f, 0.0f, 0.7f, 0.7f, 0.7f },
{ 0.0f, 0.7f, 0.7f, 0.7f, 0.7f }, { 0.0f, 0.7f, 0.7f, 0.7f, 0.7f },
}; };
/* /*
============================================================================= =============================================================================
@ -148,7 +148,7 @@ void Image_Init( void )
switch( host.type ) switch( host.type )
{ {
case HOST_NORMAL: case HOST_NORMAL:
image.cmd_flags = IL_USE_LERPING|IL_ALLOW_OVERWRITE; image.cmd_flags = IL_USE_LERPING|IL_ALLOW_OVERWRITE;
image.loadformats = load_game; image.loadformats = load_game;
image.saveformats = save_game; image.saveformats = save_game;
break; break;
@ -180,7 +180,7 @@ byte *Image_Copy( size_t size )
out = Mem_Malloc( host.imagepool, size ); out = Mem_Malloc( host.imagepool, size );
memcpy( out, image.tempbuffer, size ); memcpy( out, image.tempbuffer, size );
return out; return out;
} }
/* /*
@ -272,13 +272,13 @@ int Image_ComparePalette( const byte *pal )
return PAL_QUAKE1; return PAL_QUAKE1;
else if( !memcmp( palette_hl, pal, 765 )) else if( !memcmp( palette_hl, pal, 765 ))
return PAL_HALFLIFE; return PAL_HALFLIFE;
return PAL_CUSTOM; return PAL_CUSTOM;
} }
void Image_SetPalette( const byte *pal, uint *d_table ) void Image_SetPalette( const byte *pal, uint *d_table )
{ {
byte rgba[4]; byte rgba[4];
int i; int i;
// setup palette // setup palette
switch( image.d_rendermode ) switch( image.d_rendermode )
@ -323,7 +323,7 @@ void Image_SetPalette( const byte *pal, uint *d_table )
rgba[3] = pal[i*4+3]; rgba[3] = pal[i*4+3];
d_table[i] = *(uint *)rgba; d_table[i] = *(uint *)rgba;
} }
break; break;
} }
} }
@ -459,12 +459,12 @@ void Image_PaletteHueReplace( byte *palSrc, int newHue, int start, int end, int
r = palSrc[i*pal_size+0]; r = palSrc[i*pal_size+0];
g = palSrc[i*pal_size+1]; g = palSrc[i*pal_size+1];
b = palSrc[i*pal_size+2]; b = palSrc[i*pal_size+2];
maxcol = max( max( r, g ), b ) / 255.0f; maxcol = max( max( r, g ), b ) / 255.0f;
mincol = min( min( r, g ), b ) / 255.0f; mincol = min( min( r, g ), b ) / 255.0f;
if( maxcol == 0 ) continue; if( maxcol == 0 ) continue;
val = maxcol; val = maxcol;
sat = (maxcol - mincol) / maxcol; sat = (maxcol - mincol) / maxcol;
@ -871,7 +871,7 @@ void Image_Resample24Lerp( const void *indata, int inwidth, int inheight, void *
byte *out = (byte *)outdata; byte *out = (byte *)outdata;
byte *resamplerow1; byte *resamplerow1;
byte *resamplerow2; byte *resamplerow2;
fstep = (int)(inheight * 65536.0f / outheight); fstep = (int)(inheight * 65536.0f / outheight);
resamplerow1 = (byte *)Mem_Malloc( host.imagepool, outwidth * 3 * 2 ); resamplerow1 = (byte *)Mem_Malloc( host.imagepool, outwidth * 3 * 2 );
@ -1075,7 +1075,7 @@ byte *Image_ResampleInternal( const void *indata, int inwidth, int inheight, int
case PF_INDEXED_32: case PF_INDEXED_32:
image.tempbuffer = (byte *)Mem_Realloc( host.imagepool, image.tempbuffer, outwidth * outheight ); image.tempbuffer = (byte *)Mem_Realloc( host.imagepool, image.tempbuffer, outwidth * outheight );
Image_Resample8Nolerp( indata, inwidth, inheight, image.tempbuffer, outwidth, outheight ); Image_Resample8Nolerp( indata, inwidth, inheight, image.tempbuffer, outwidth, outheight );
break; break;
case PF_RGB_24: case PF_RGB_24:
case PF_BGR_24: case PF_BGR_24:
image.tempbuffer = (byte *)Mem_Realloc( host.imagepool, image.tempbuffer, outwidth * outheight * 3 ); image.tempbuffer = (byte *)Mem_Realloc( host.imagepool, image.tempbuffer, outwidth * outheight * 3 );
@ -1090,7 +1090,7 @@ byte *Image_ResampleInternal( const void *indata, int inwidth, int inheight, int
break; break;
default: default:
*resampled = false; *resampled = false;
return (byte *)indata; return (byte *)indata;
} }
*resampled = true; *resampled = true;
@ -1106,7 +1106,7 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t
{ {
int i, x, y; int i, x, y;
word width = *srcwidth; word width = *srcwidth;
word height = *srcheight; word height = *srcheight;
int samples = PFDesc[type].bpp; int samples = PFDesc[type].bpp;
qboolean flip_x = FBitSet( flags, IMAGE_FLIP_X ) ? true : false; qboolean flip_x = FBitSet( flags, IMAGE_FLIP_X ) ? true : false;
qboolean flip_y = FBitSet( flags, IMAGE_FLIP_Y ) ? true : false; qboolean flip_y = FBitSet( flags, IMAGE_FLIP_Y ) ? true : false;
@ -1133,7 +1133,7 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t
image.tempbuffer = Mem_Realloc( host.imagepool, image.tempbuffer, width * height * samples ); image.tempbuffer = Mem_Realloc( host.imagepool, image.tempbuffer, width * height * samples );
break; break;
default: default:
return (byte *)in; return (byte *)in;
} }
out = image.tempbuffer; out = image.tempbuffer;
@ -1157,12 +1157,12 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t
if( FBitSet( flags, IMAGE_ROT_90 )) if( FBitSet( flags, IMAGE_ROT_90 ))
{ {
*srcwidth = height; *srcwidth = height;
*srcheight = width; *srcheight = width;
} }
else else
{ {
*srcwidth = width; *srcwidth = width;
*srcheight = height; *srcheight = height;
} }
return image.tempbuffer; return image.tempbuffer;
@ -1174,7 +1174,7 @@ byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int
int i; int i;
if( !FBitSet( flags, IMAGE_HAS_LUMA )) if( !FBitSet( flags, IMAGE_HAS_LUMA ))
return (byte *)fin; return (byte *)fin;
switch( type ) switch( type )
{ {
@ -1187,7 +1187,7 @@ byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int
default: default:
// another formats does ugly result :( // another formats does ugly result :(
Con_Printf( S_ERROR "Image_MakeLuma: unsupported format %s\n", PFDesc[type].name ); Con_Printf( S_ERROR "Image_MakeLuma: unsupported format %s\n", PFDesc[type].name );
return (byte *)fin; return (byte *)fin;
} }
return image.tempbuffer; return image.tempbuffer;
@ -1206,10 +1206,10 @@ qboolean Image_AddIndexedImageToPack( const byte *in, int width, int height )
image.size = mipsize; image.size = mipsize;
if( expand_to_rgba ) image.size *= 4; if( expand_to_rgba ) image.size *= 4;
else Image_CopyPalette32bit(); else Image_CopyPalette32bit();
// reallocate image buffer // reallocate image buffer
image.rgba = Mem_Malloc( host.imagepool, image.size ); image.rgba = Mem_Malloc( host.imagepool, image.size );
if( !expand_to_rgba ) memcpy( image.rgba, in, image.size ); if( !expand_to_rgba ) memcpy( image.rgba, in, image.size );
else if( !Image_Copy8bitRGBA( in, image.rgba, mipsize )) else if( !Image_Copy8bitRGBA( in, image.rgba, mipsize ))
return false; // probably pallette not installed return false; // probably pallette not installed
@ -1227,7 +1227,7 @@ force to unpack any image to 32-bit buffer
qboolean Image_Decompress( const byte *data ) qboolean Image_Decompress( const byte *data )
{ {
byte *fin, *fout; byte *fin, *fout;
int i, size; int i, size;
if( !data ) return false; if( !data ) return false;
fin = (byte *)data; fin = (byte *)data;
@ -1242,8 +1242,8 @@ qboolean Image_Decompress( const byte *data )
if( image.flags & IMAGE_HAS_ALPHA ) if( image.flags & IMAGE_HAS_ALPHA )
{ {
if( image.flags & IMAGE_COLORINDEX ) if( image.flags & IMAGE_COLORINDEX )
Image_GetPaletteLMP( image.palette, LUMP_GRADIENT ); Image_GetPaletteLMP( image.palette, LUMP_GRADIENT );
else Image_GetPaletteLMP( image.palette, LUMP_MASKED ); else Image_GetPaletteLMP( image.palette, LUMP_MASKED );
} }
else Image_GetPaletteLMP( image.palette, LUMP_NORMAL ); else Image_GetPaletteLMP( image.palette, LUMP_NORMAL );
// intentionally fallthrough // intentionally fallthrough
@ -1363,22 +1363,22 @@ qboolean Image_RemapInternal( rgbdata_t *pic, int topColor, int bottomColor )
return true; return true;
} }
/* /*
================== ==================
Image_ApplyFilter Image_ApplyFilter
Applies a 5 x 5 filtering matrix to the texture, then runs it through a simulated OpenGL texture environment Applies a 5 x 5 filtering matrix to the texture, then runs it through a simulated OpenGL texture environment
blend with the original data to derive a new texture. Freaky, funky, and *f--king* *fantastic*. You can do blend with the original data to derive a new texture. Freaky, funky, and *f--king* *fantastic*. You can do
reasonable enough "fake bumpmapping" with this baby... reasonable enough "fake bumpmapping" with this baby...
Filtering algorithm from http://www.student.kuleuven.ac.be/~m0216922/CG/filtering.html Filtering algorithm from http://www.student.kuleuven.ac.be/~m0216922/CG/filtering.html
All credit due All credit due
================== ==================
*/ */
static void Image_ApplyFilter( rgbdata_t *pic, float factor ) static void Image_ApplyFilter( rgbdata_t *pic, float factor )
{ {
int i, x, y; int i, x, y;
uint *fin, *fout; uint *fin, *fout;
size_t size; size_t size;
// don't waste time // don't waste time
@ -1392,72 +1392,72 @@ static void Image_ApplyFilter( rgbdata_t *pic, float factor )
fout = (uint *)image.tempbuffer; fout = (uint *)image.tempbuffer;
fin = (uint *)pic->buffer; fin = (uint *)pic->buffer;
for( x = 0; x < image.width; x++ ) for( x = 0; x < image.width; x++ )
{ {
for( y = 0; y < image.height; y++ ) for( y = 0; y < image.height; y++ )
{ {
vec3_t vout = { 0.0f, 0.0f, 0.0f }; vec3_t vout = { 0.0f, 0.0f, 0.0f };
int pos_x, pos_y; int pos_x, pos_y;
float avg; float avg;
for( pos_x = 0; pos_x < FILTER_SIZE; pos_x++ ) for( pos_x = 0; pos_x < FILTER_SIZE; pos_x++ )
{ {
for( pos_y = 0; pos_y < FILTER_SIZE; pos_y++ ) for( pos_y = 0; pos_y < FILTER_SIZE; pos_y++ )
{ {
int img_x = (x - (FILTER_SIZE / 2) + pos_x + image.width) % image.width; int img_x = (x - (FILTER_SIZE / 2) + pos_x + image.width) % image.width;
int img_y = (y - (FILTER_SIZE / 2) + pos_y + image.height) % image.height; int img_y = (y - (FILTER_SIZE / 2) + pos_y + image.height) % image.height;
// casting's a unary operation anyway, so the othermost set of brackets in the left part // casting's a unary operation anyway, so the othermost set of brackets in the left part
// of the rvalue should not be necessary... but i'm paranoid when it comes to C... // of the rvalue should not be necessary... but i'm paranoid when it comes to C...
vout[0] += ((float)((byte *)&fin[img_y * image.width + img_x])[0]) * img_emboss[pos_x][pos_y]; vout[0] += ((float)((byte *)&fin[img_y * image.width + img_x])[0]) * img_emboss[pos_x][pos_y];
vout[1] += ((float)((byte *)&fin[img_y * image.width + img_x])[1]) * img_emboss[pos_x][pos_y]; vout[1] += ((float)((byte *)&fin[img_y * image.width + img_x])[1]) * img_emboss[pos_x][pos_y];
vout[2] += ((float)((byte *)&fin[img_y * image.width + img_x])[2]) * img_emboss[pos_x][pos_y]; vout[2] += ((float)((byte *)&fin[img_y * image.width + img_x])[2]) * img_emboss[pos_x][pos_y];
} }
} }
// multiply by factor, add bias, and clamp // multiply by factor, add bias, and clamp
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
{ {
vout[i] *= factor; vout[i] *= factor;
vout[i] += 128.0f; // base vout[i] += 128.0f; // base
vout[i] = bound( 0.0f, vout[i], 255.0f ); vout[i] = bound( 0.0f, vout[i], 255.0f );
} }
// NTSC greyscale conversion standard // NTSC greyscale conversion standard
avg = (vout[0] * 30.0f + vout[1] * 59.0f + vout[2] * 11.0f) / 100.0f; avg = (vout[0] * 30.0f + vout[1] * 59.0f + vout[2] * 11.0f) / 100.0f;
// divide by 255 so GL operations work as expected // divide by 255 so GL operations work as expected
vout[0] = avg / 255.0f; vout[0] = avg / 255.0f;
vout[1] = avg / 255.0f; vout[1] = avg / 255.0f;
vout[2] = avg / 255.0f; vout[2] = avg / 255.0f;
// write to temp - first, write data in (to get the alpha channel quickly and // write to temp - first, write data in (to get the alpha channel quickly and
// easily, which will be left well alone by this particular operation...!) // easily, which will be left well alone by this particular operation...!)
fout[y * image.width + x] = fin[y * image.width + x]; fout[y * image.width + x] = fin[y * image.width + x];
// now write in each element, applying the blend operator. blend // now write in each element, applying the blend operator. blend
// operators are based on standard OpenGL TexEnv modes, and the // operators are based on standard OpenGL TexEnv modes, and the
// formulas are derived from the OpenGL specs (http://www.opengl.org). // formulas are derived from the OpenGL specs (http://www.opengl.org).
for( i = 0; i < 3; i++ ) for( i = 0; i < 3; i++ )
{ {
// divide by 255 so GL operations work as expected // divide by 255 so GL operations work as expected
float src = ((float)((byte *)&fin[y * image.width + x])[i]) / 255.0f; float src = ((float)((byte *)&fin[y * image.width + x])[i]) / 255.0f;
float tmp; float tmp;
// default is GL_BLEND here // default is GL_BLEND here
// CsS + CdD works out as Src * Dst * 2 // CsS + CdD works out as Src * Dst * 2
tmp = vout[i] * src * 2.0f; tmp = vout[i] * src * 2.0f;
// multiply back by 255 to get the proper byte scale // multiply back by 255 to get the proper byte scale
tmp *= 255.0f; tmp *= 255.0f;
// bound the temp target again now, cos the operation may have thrown it out // bound the temp target again now, cos the operation may have thrown it out
tmp = bound( 0.0f, tmp, 255.0f ); tmp = bound( 0.0f, tmp, 255.0f );
// and copy it in // and copy it in
((byte *)&fout[y * image.width + x])[i] = (byte)tmp; ((byte *)&fout[y * image.width + x])[i] = (byte)tmp;
} }
} }
} }
// copy result back // copy result back
memcpy( fin, fout, size ); memcpy( fin, fout, size );
@ -1468,7 +1468,7 @@ qboolean Image_Process( rgbdata_t **pix, int width, int height, uint flags, floa
rgbdata_t *pic = *pix; rgbdata_t *pic = *pix;
qboolean result = true; qboolean result = true;
byte *out; byte *out;
// check for buffers // check for buffers
if( !pic || !pic->buffer ) if( !pic || !pic->buffer )
{ {

View File

@ -27,7 +27,7 @@ Image_LoadPAL
*/ */
qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesize ) qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesize )
{ {
int rendermode = LUMP_NORMAL; int rendermode = LUMP_NORMAL;
if( filesize != 768 ) if( filesize != 768 )
{ {
@ -65,7 +65,7 @@ qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesi
image.size = 1024; // expanded palette image.size = 1024; // expanded palette
image.width = image.height = 0; image.width = image.height = 0;
image.depth = 1; image.depth = 1;
return true; return true;
} }
@ -88,7 +88,7 @@ qboolean Image_LoadFNT( const char *name, const byte *buffer, fs_offset_t filesi
return false; return false;
memcpy( &font, buffer, sizeof( font )); memcpy( &font, buffer, sizeof( font ));
// last sixty four bytes - what the hell ???? // last sixty four bytes - what the hell ????
size = sizeof( qfont_t ) - 4 + ( font.height * font.width * QCHAR_WIDTH ) + sizeof( short ) + 768 + 64; size = sizeof( qfont_t ) - 4 + ( font.height * font.width * QCHAR_WIDTH ) + sizeof( short ) + 768 + 64;
@ -118,7 +118,7 @@ qboolean Image_LoadFNT( const char *name, const byte *buffer, fs_offset_t filesi
Image_GetPaletteLMP( pal, LUMP_MASKED ); Image_GetPaletteLMP( pal, LUMP_MASKED );
image.flags |= IMAGE_HAS_ALPHA; // fonts always have transparency image.flags |= IMAGE_HAS_ALPHA; // fonts always have transparency
} }
else else
{ {
return false; return false;
} }
@ -206,7 +206,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesi
if( image.hint == IL_HINT_HL ) if( image.hint == IL_HINT_HL )
{ {
if( !image.d_currentpal ) if( !image.d_currentpal )
return false; return false;
} }
else if( image.hint == IL_HINT_Q1 ) else if( image.hint == IL_HINT_Q1 )
{ {
@ -244,7 +244,7 @@ qboolean Image_LoadSPR( const char *name, const byte *buffer, fs_offset_t filesi
SetBits( image.flags, IMAGE_HAS_ALPHA ); SetBits( image.flags, IMAGE_HAS_ALPHA );
break; break;
} }
fin = (byte *)(buffer + sizeof(dspriteframe_t)); fin = (byte *)(buffer + sizeof(dspriteframe_t));
if( truecolor ) if( truecolor )
@ -378,7 +378,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
pal = (byte *)buffer + mip.offsets[0] + (((image.width * image.height) * 85)>>6); pal = (byte *)buffer + mip.offsets[0] + (((image.width * image.height) * 85)>>6);
numcolors = *(short *)pal; numcolors = *(short *)pal;
if( numcolors != 256 ) pal = NULL; // corrupted mip ? if( numcolors != 256 ) pal = NULL; // corrupted mip ?
else pal += sizeof( short ); // skip colorsize else pal += sizeof( short ); // skip colorsize
hl_texture = true; hl_texture = true;
@ -474,7 +474,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
else else
{ {
return false; // unknown or unsupported mode rejected return false; // unknown or unsupported mode rejected
} }
// check for quake-sky texture // check for quake-sky texture
if( !Q_strncmp( mip.name, "sky", 3 ) && image.width == ( image.height * 2 )) if( !Q_strncmp( mip.name, "sky", 3 ) && image.width == ( image.height * 2 ))
@ -513,10 +513,10 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi
reflectivity[1] += pal[i*3+1]; reflectivity[1] += pal[i*3+1];
reflectivity[2] += pal[i*3+2]; reflectivity[2] += pal[i*3+2];
} }
VectorDivide( reflectivity, 256, image.fogParams ); VectorDivide( reflectivity, 256, image.fogParams );
} }
image.type = PF_INDEXED_32; // 32-bit palete image.type = PF_INDEXED_32; // 32-bit palete
image.depth = 1; image.depth = 1;

View File

@ -196,7 +196,7 @@ const char *Info_ValueForKey( const char *s, const char *key )
static int valueindex; static int valueindex;
int count; int count;
char *o; char *o;
valueindex = (valueindex + 1) % 4; valueindex = (valueindex + 1) % 4;
if( *s == '\\' ) s++; if( *s == '\\' ) s++;

View File

@ -116,7 +116,7 @@
/* Defines to completely disable specific portions of miniz.c: /* Defines to completely disable specific portions of miniz.c:
If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. */ If all macros here are defined the only functionality remaining will be CRC-32, adler-32, tinfl, and tdefl. */
/* Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. */ /* Define MINIZ_NO_STDIO to disable all usage and any functions which rely on stdio for file I/O. */
@ -139,7 +139,7 @@
/* Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. */ /* Define MINIZ_NO_ZLIB_COMPATIBLE_NAME to disable zlib names, to prevent conflicts against stock zlib. */
/*#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES */ /*#define MINIZ_NO_ZLIB_COMPATIBLE_NAMES */
/* Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc. /* Define MINIZ_NO_MALLOC to disable all calls to malloc, free, and realloc.
Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc Note if MINIZ_NO_MALLOC is defined then the user must always provide custom user alloc/free/realloc
callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user callbacks to the zlib and archive API's, and a few stand-alone helper API's which don't provide custom user
functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. */ functions (such as tdefl_compress_mem_to_heap() and tinfl_decompress_mem_to_heap()) won't work. */
@ -900,7 +900,7 @@ struct tinfl_decompressor_tag
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#ifndef MINIZ_HEADER_FILE_ONLY #ifndef MINIZ_HEADER_FILE_ONLY
/************************************************************************** /**************************************************************************
* *
@ -3849,5 +3849,5 @@ void tinfl_decompressor_free(tinfl_decompressor *pDecomp)
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif // MINIZ_HEADER_FILE_ONLY #endif // MINIZ_HEADER_FILE_ONLY

View File

@ -459,7 +459,7 @@ byte *Mod_DecompressPVS( const byte *in, int visbytes )
out = g_visdata; out = g_visdata;
if( !in ) if( !in )
{ {
// no vis info, so make all visible // no vis info, so make all visible
while( visbytes ) while( visbytes )
{ {
@ -641,7 +641,7 @@ static void Mod_BoxLeafnums_r( leaflist_t *ll, mnode_t *node )
ll->list[ll->count++] = leaf->cluster; ll->list[ll->count++] = leaf->cluster;
return; return;
} }
sides = BOX_ON_PLANE_SIDE( ll->mins, ll->maxs, node->plane ); sides = BOX_ON_PLANE_SIDE( ll->mins, ll->maxs, node->plane );
if( sides == 1 ) if( sides == 1 )
@ -756,7 +756,7 @@ void Mod_AmbientLevels( const vec3_t p, byte *pvolumes )
mleaf_t *leaf; mleaf_t *leaf;
if( !worldmodel || !p || !pvolumes ) if( !worldmodel || !p || !pvolumes )
return; return;
leaf = Mod_PointInLeaf( p, worldmodel->nodes ); leaf = Mod_PointInLeaf( p, worldmodel->nodes );
*(int *)pvolumes = *(int *)leaf->ambient_sound_level; *(int *)pvolumes = *(int *)leaf->ambient_sound_level;
@ -802,8 +802,8 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve
Q_strncpy( keyname, token, sizeof( keyname )); Q_strncpy( keyname, token, sizeof( keyname ));
// parse value // parse value
if(( pfile = COM_ParseFile( pfile, token )) == NULL ) if(( pfile = COM_ParseFile( pfile, token )) == NULL )
Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" ); Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" );
if( token[0] == '}' ) if( token[0] == '}' )
@ -820,7 +820,7 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve
} }
if( model_found ) break; if( model_found ) break;
} }
} }
/* /*
@ -936,7 +936,7 @@ static mvertex_t *Mod_GetVertexByNumber( model_t *mod, int surfedge )
return &mod->vertexes[edge->v[1]]; return &mod->vertexes[edge->v[1]];
} }
} }
/* /*
================== ==================
Mod_MakeNormalAxial Mod_MakeNormalAxial
@ -1032,7 +1032,7 @@ static void Mod_CalcSurfaceExtents( msurface_t *surf )
sample_size = Mod_SampleSizeForFace( surf ); sample_size = Mod_SampleSizeForFace( surf );
tex = surf->texinfo; tex = surf->texinfo;
Mod_LightMatrixFromTexMatrix( tex, info->lmvecs ); Mod_LightMatrixFromTexMatrix( tex, info->lmvecs );
mins[0] = lmmins[0] = mins[1] = lmmins[1] = 999999; mins[0] = lmmins[0] = mins[1] = lmmins[1] = 999999;
maxs[0] = lmmaxs[0] = maxs[1] = lmmaxs[1] =-999999; maxs[0] = lmmaxs[0] = maxs[1] = lmmaxs[1] =-999999;
@ -1276,9 +1276,9 @@ static void Mod_MakeHull0( void )
mclipnode_t *out; mclipnode_t *out;
hull_t *hull; hull_t *hull;
int i, j; int i, j;
hull = &loadmodel->hulls[0]; hull = &loadmodel->hulls[0];
hull->clipnodes = out = Mem_Malloc( loadmodel->mempool, loadmodel->numnodes * sizeof( *out )); hull->clipnodes = out = Mem_Malloc( loadmodel->mempool, loadmodel->numnodes * sizeof( *out ));
in = loadmodel->nodes; in = loadmodel->nodes;
hull->firstclipnode = 0; hull->firstclipnode = 0;
@ -1502,7 +1502,7 @@ static void Mod_SetupSubmodels( dbspmodel_t *bmod )
mod->firstmodelsurface = bm->firstface; mod->firstmodelsurface = bm->firstface;
mod->nummodelsurfaces = bm->numfaces; mod->nummodelsurfaces = bm->numfaces;
VectorCopy( bm->mins, mod->mins ); VectorCopy( bm->mins, mod->mins );
VectorCopy( bm->maxs, mod->maxs ); VectorCopy( bm->maxs, mod->maxs );
mod->radius = RadiusFromBounds( mod->mins, mod->maxs ); mod->radius = RadiusFromBounds( mod->mins, mod->maxs );
@ -1596,7 +1596,7 @@ static void Mod_LoadSubmodels( dbspmodel_t *bmod )
if( in->mins[j] == 999999.0f ) if( in->mins[j] == 999999.0f )
in->mins[j] = 0.0f; in->mins[j] = 0.0f;
if( in->maxs[j] == -999999.0f) if( in->maxs[j] == -999999.0f)
in->maxs[j] = 0.0f; in->maxs[j] = 0.0f;
// spread the mins / maxs by a unit // spread the mins / maxs by a unit
out->mins[j] = in->mins[j] - 1.0f; out->mins[j] = in->mins[j] - 1.0f;
@ -1613,7 +1613,7 @@ static void Mod_LoadSubmodels( dbspmodel_t *bmod )
if( i == 0 && bmod->isworld ) if( i == 0 && bmod->isworld )
continue; // skip the world to save mem continue; // skip the world to save mem
oldmaxfaces = Q_max( oldmaxfaces, out->numfaces ); oldmaxfaces = Q_max( oldmaxfaces, out->numfaces );
} }
// these array used to sort translucent faces in bmodels // these array used to sort translucent faces in bmodels
@ -1693,8 +1693,8 @@ static void Mod_LoadEntities( dbspmodel_t *bmod )
Q_strncpy( keyname, token, sizeof( keyname )); Q_strncpy( keyname, token, sizeof( keyname ));
// parse value // parse value
if(( pfile = COM_ParseFile( pfile, token )) == NULL ) if(( pfile = COM_ParseFile( pfile, token )) == NULL )
Host_Error( "Mod_LoadEntities: EOF without closing brace\n" ); Host_Error( "Mod_LoadEntities: EOF without closing brace\n" );
if( token[0] == '}' ) if( token[0] == '}' )
@ -1908,7 +1908,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod )
qboolean custom_palette; qboolean custom_palette;
char texname[64]; char texname[64];
mip_t *mt; mip_t *mt;
int i, j; int i, j;
if( bmod->isworld ) if( bmod->isworld )
{ {
@ -2574,7 +2574,7 @@ static void Mod_LoadClipnodes( dbspmodel_t *bmod )
dclipnode32_t *out; dclipnode32_t *out;
int i; int i;
bmod->clipnodes_out = out = (dclipnode32_t *)Mem_Malloc( loadmodel->mempool, bmod->numclipnodes * sizeof( *out )); bmod->clipnodes_out = out = (dclipnode32_t *)Mem_Malloc( loadmodel->mempool, bmod->numclipnodes * sizeof( *out ));
if(( bmod->version == QBSP2_VERSION ) || ( bmod->version == HLBSP_VERSION && bmod->numclipnodes >= MAX_MAP_CLIPNODES )) if(( bmod->version == QBSP2_VERSION ) || ( bmod->version == HLBSP_VERSION && bmod->numclipnodes >= MAX_MAP_CLIPNODES ))
{ {
@ -2801,7 +2801,7 @@ qboolean Mod_LoadBmodelLumps( const byte *mod_base, qboolean isworld )
{ {
Con_DPrintf( "Mod_Load%s: %i error(s), %i warning(s)\n", isworld ? "World" : "Brush", loadstat.numerrors, loadstat.numwarnings ); Con_DPrintf( "Mod_Load%s: %i error(s), %i warning(s)\n", isworld ? "World" : "Brush", loadstat.numerrors, loadstat.numwarnings );
return false; // there were errors, we can't load this map return false; // there were errors, we can't load this map
} }
else if( !bmod->isworld && loadstat.numwarnings ) else if( !bmod->isworld && loadstat.numwarnings )
Con_DPrintf( "Mod_Load%s: %i warning(s)\n", isworld ? "World" : "Brush", loadstat.numwarnings ); Con_DPrintf( "Mod_Load%s: %i warning(s)\n", isworld ? "World" : "Brush", loadstat.numwarnings );
@ -2915,7 +2915,7 @@ qboolean Mod_TestBmodelLumps( const char *name, const byte *mod_base, qboolean s
if( !FBitSet( flags, LUMP_SILENT )) if( !FBitSet( flags, LUMP_SILENT ))
Con_Printf( "Mod_LoadWorld: %i error(s), %i warning(s)\n", loadstat.numerrors, loadstat.numwarnings ); Con_Printf( "Mod_LoadWorld: %i error(s), %i warning(s)\n", loadstat.numerrors, loadstat.numwarnings );
return false; // there were errors, we can't load this map return false; // there were errors, we can't load this map
} }
else if( loadstat.numwarnings ) else if( loadstat.numwarnings )
{ {
if( !FBitSet( flags, LUMP_SILENT )) if( !FBitSet( flags, LUMP_SILENT ))
@ -2932,7 +2932,7 @@ Mod_LoadBrushModel
*/ */
void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *loaded ) void Mod_LoadBrushModel( model_t *mod, const void *buffer, qboolean *loaded )
{ {
if( loaded ) *loaded = false; if( loaded ) *loaded = false;
loadmodel->mempool = Mem_AllocPool( va( "^2%s^7", loadmodel->name )); loadmodel->mempool = Mem_AllocPool( va( "^2%s^7", loadmodel->name ));
loadmodel->type = mod_brush; loadmodel->type = mod_brush;

View File

@ -267,7 +267,7 @@ hull_t *Mod_HullForStudio( model_t *model, float frame, int sequence, vec3_t ang
if( SV_IsValidEdict( pEdict ) && pEdict->v.gamestate == 1 ) if( SV_IsValidEdict( pEdict ) && pEdict->v.gamestate == 1 )
bSkipShield = 1; bSkipShield = 1;
for( i = j = 0; i < mod_studiohdr->numhitboxes; i++, j += 6 ) for( i = j = 0; i < mod_studiohdr->numhitboxes; i++, j += 6 )
{ {
if( bSkipShield && i == 21 ) if( bSkipShield && i == 21 )
@ -310,7 +310,7 @@ static void Mod_StudioCalcBoneAdj( float *adj, const byte *pcontroller )
int i, j; int i, j;
float value; float value;
mstudiobonecontroller_t *pbonecontroller; mstudiobonecontroller_t *pbonecontroller;
pbonecontroller = (mstudiobonecontroller_t *)((byte *)mod_studiohdr + mod_studiohdr->bonecontrollerindex); pbonecontroller = (mstudiobonecontroller_t *)((byte *)mod_studiohdr + mod_studiohdr->bonecontrollerindex);
for( j = 0; j < mod_studiohdr->numbonecontrollers; j++ ) for( j = 0; j < mod_studiohdr->numbonecontrollers; j++ )
@ -420,12 +420,12 @@ void R_StudioCalcBoneQuaternion( int frame, float s, mstudiobone_t *pbone, mstud
mstudioanimvalue_t *panimvalue = (mstudioanimvalue_t *)((byte *)panim + panim->offset[j+3]); mstudioanimvalue_t *panimvalue = (mstudioanimvalue_t *)((byte *)panim + panim->offset[j+3]);
k = frame; k = frame;
// debug // debug
if( panimvalue->num.total < panimvalue->num.valid ) if( panimvalue->num.total < panimvalue->num.valid )
k = 0; k = 0;
// find span of values that includes the frame we want // find span of values that includes the frame we want
while( panimvalue->num.total <= k ) while( panimvalue->num.total <= k )
{ {
k -= panimvalue->num.total; k -= panimvalue->num.total;
@ -734,7 +734,7 @@ static void SV_StudioSetupBones( model_t *pModel, float frame, int sequence, con
i = boneused[j]; i = boneused[j];
Matrix3x4_FromOriginQuat( bonematrix, q[i], pos[i] ); Matrix3x4_FromOriginQuat( bonematrix, q[i], pos[i] );
if( pbones[i].parent == -1 ) if( pbones[i].parent == -1 )
Matrix3x4_ConcatTransforms( studio_bones[i], studio_transform, bonematrix ); Matrix3x4_ConcatTransforms( studio_bones[i], studio_transform, bonematrix );
else Matrix3x4_ConcatTransforms( studio_bones[i], studio_bones[pbones[i].parent], bonematrix ); else Matrix3x4_ConcatTransforms( studio_bones[i], studio_bones[pbones[i].parent], bonematrix );
} }
@ -1025,7 +1025,7 @@ studiohdr_t *R_StudioLoadHeader( model_t *mod, const void *buffer )
{ {
Con_Printf( S_ERROR "%s has wrong version number (%i should be %i)\n", mod->name, i, STUDIO_VERSION ); Con_Printf( S_ERROR "%s has wrong version number (%i should be %i)\n", mod->name, i, STUDIO_VERSION );
return NULL; return NULL;
} }
return (studiohdr_t *)buffer; return (studiohdr_t *)buffer;
} }
@ -1154,7 +1154,7 @@ static server_studio_api_t gStudioAPI =
Mod_LoadCacheFile, Mod_LoadCacheFile,
Mod_StudioExtradata, Mod_StudioExtradata,
}; };
/* /*
=============== ===============
Mod_InitStudioAPI Mod_InitStudioAPI

View File

@ -51,7 +51,7 @@ void MSG_InitMasks( void )
for( maskBit = 0; maskBit < 32; maskBit++ ) for( maskBit = 0; maskBit < 32; maskBit++ )
ExtraMasks[maskBit] = (uint)BIT( maskBit ) - 1; ExtraMasks[maskBit] = (uint)BIT( maskBit ) - 1;
} }
void MSG_InitExt( sizebuf_t *sb, const char *pDebugName, void *pData, int nBytes, int nMaxBits ) void MSG_InitExt( sizebuf_t *sb, const char *pDebugName, void *pData, int nBytes, int nMaxBits )
{ {
MSG_StartWriting( sb, pData, nBytes, 0, nMaxBits ); MSG_StartWriting( sb, pData, nBytes, 0, nMaxBits );
@ -119,7 +119,7 @@ int MSG_SeekToBit( sizebuf_t *sb, int bitPos, int whence )
case SEEK_END: case SEEK_END:
bitPos += sb->nDataBits; bitPos += sb->nDataBits;
break; break;
default: default:
return -1; return -1;
} }
@ -252,7 +252,7 @@ qboolean MSG_WriteBits( sizebuf_t *sb, const void *pData, int nBits )
nBitsLeft -= 8; nBitsLeft -= 8;
++pOut; ++pOut;
} }
// Read the remaining bits. // Read the remaining bits.
if( nBitsLeft ) if( nBitsLeft )
{ {
@ -391,7 +391,7 @@ qboolean MSG_WriteString( sizebuf_t *sb, const char *pStr )
} while( *( pStr - 1 )); } while( *( pStr - 1 ));
} }
else MSG_WriteChar( sb, 0 ); else MSG_WriteChar( sb, 0 );
return !sb->bOverflow; return !sb->bOverflow;
} }
@ -446,7 +446,7 @@ uint MSG_ReadUBitLong( sizebuf_t *sb, int numbits )
{ {
int nExtraBits = sb->iCurBit & 31; int nExtraBits = sb->iCurBit & 31;
uint dword2 = ((uint *)sb->pData)[idword1+1] & ExtraMasks[nExtraBits]; uint dword2 = ((uint *)sb->pData)[idword1+1] & ExtraMasks[nExtraBits];
// no need to mask since we hit the end of the dword. // no need to mask since we hit the end of the dword.
// shift the second dword's part into the high bits. // shift the second dword's part into the high bits.
ret |= (dword2 << ( numbits - nExtraBits )); ret |= (dword2 << ( numbits - nExtraBits ));
@ -484,7 +484,7 @@ qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits )
{ {
byte *pOut = (byte *)pOutData; byte *pOut = (byte *)pOutData;
int nBitsLeft = nBits; int nBitsLeft = nBits;
// get output dword-aligned. // get output dword-aligned.
while((( dword )pOut & 3) != 0 && nBitsLeft >= 8 ) while((( dword )pOut & 3) != 0 && nBitsLeft >= 8 )
{ {
@ -508,7 +508,7 @@ qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits )
++pOut; ++pOut;
nBitsLeft -= 8; nBitsLeft -= 8;
} }
// read the remaining bits. // read the remaining bits.
if( nBitsLeft ) if( nBitsLeft )
{ {
@ -529,7 +529,7 @@ float MSG_ReadBitAngle( sizebuf_t *sb, int numbits )
fReturn = (float)i * ( 360.0f / shift ); fReturn = (float)i * ( 360.0f / shift );
// clamp the finale angle // clamp the finale angle
if( fReturn < -180.0f ) fReturn += 360.0f; if( fReturn < -180.0f ) fReturn += 360.0f;
else if( fReturn > 180.0f ) fReturn -= 360.0f; else if( fReturn > 180.0f ) fReturn -= 360.0f;
return fReturn; return fReturn;
@ -646,7 +646,7 @@ char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine )
{ {
static char string[4096]; static char string[4096];
int l = 0, c; int l = 0, c;
do do
{ {
// use MSG_ReadByte so -1 is out of bounds // use MSG_ReadByte so -1 is out of bounds

View File

@ -131,5 +131,5 @@ void MSG_ReadVec3Coord( sizebuf_t *sb, vec3_t fa );
void MSG_ReadVec3Angles( sizebuf_t *sb, vec3_t fa ); void MSG_ReadVec3Angles( sizebuf_t *sb, vec3_t fa );
qboolean MSG_ReadBytes( sizebuf_t *sb, void *pOut, int nBytes ); qboolean MSG_ReadBytes( sizebuf_t *sb, void *pOut, int nBytes );
char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine ); char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine );
#endif//NET_BUFFER_H #endif//NET_BUFFER_H

View File

@ -26,7 +26,7 @@ GNU General Public License for more details.
#define UDP_HEADER_SIZE 28 #define UDP_HEADER_SIZE 28
#define FLOW_AVG ( 2.0f / 3.0f ) // how fast to converge flow estimates #define FLOW_AVG ( 2.0f / 3.0f ) // how fast to converge flow estimates
#define FLOW_INTERVAL 0.1 // don't compute more often than this #define FLOW_INTERVAL 0.1 // don't compute more often than this
#define MAX_RELIABLE_PAYLOAD 1400 // biggest packet that has frag and or reliable data #define MAX_RELIABLE_PAYLOAD 1400 // biggest packet that has frag and or reliable data
// forward declarations // forward declarations
@ -307,7 +307,7 @@ void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport, voi
Netchan_Clear( chan ); Netchan_Clear( chan );
memset( chan, 0, sizeof( *chan )); memset( chan, 0, sizeof( *chan ));
chan->sock = sock; chan->sock = sock;
chan->remote_address = adr; chan->remote_address = adr;
chan->last_received = host.realtime; chan->last_received = host.realtime;
@ -377,7 +377,7 @@ void Netchan_UnlinkFragment( fragbuf_t *buf, fragbuf_t **list )
{ {
// remove first element // remove first element
*list = buf->next; *list = buf->next;
// destroy remnant // destroy remnant
Mem_Free( buf ); Mem_Free( buf );
return; return;
@ -501,7 +501,7 @@ void Netchan_OutOfBand( int net_socket, netadr_t adr, int length, byte *data )
// write the packet header // write the packet header
MSG_Init( &send, "SequencePacket", send_buf, sizeof( send_buf )); MSG_Init( &send, "SequencePacket", send_buf, sizeof( send_buf ));
MSG_WriteLong( &send, NET_HEADER_OUTOFBANDPACKET ); // -1 sequence means out of band MSG_WriteLong( &send, NET_HEADER_OUTOFBANDPACKET ); // -1 sequence means out of band
MSG_WriteBytes( &send, data, length ); MSG_WriteBytes( &send, data, length );
@ -705,7 +705,7 @@ static void Netchan_CreateFragments_( netchan_t *chan, sizebuf_t *msg )
int bytes, pos; int bytes, pos;
int bufferid = 1; int bufferid = 1;
fragbufwaiting_t *wait, *p; fragbufwaiting_t *wait, *p;
if( MSG_GetNumBytesWritten( msg ) == 0 ) if( MSG_GetNumBytesWritten( msg ) == 0 )
return; return;
@ -737,7 +737,7 @@ static void Netchan_CreateFragments_( netchan_t *chan, sizebuf_t *msg )
{ {
bytes = Q_min( remaining, chunksize ); bytes = Q_min( remaining, chunksize );
remaining -= bytes; remaining -= bytes;
buf = Netchan_AllocFragbuf(); buf = Netchan_AllocFragbuf();
buf->bufferid = bufferid++; buf->bufferid = bufferid++;
@ -917,7 +917,7 @@ void Netchan_CreateFileFragmentsFromBuffer( netchan_t *chan, const char *filenam
buf->isfile = true; buf->isfile = true;
buf->size = send; buf->size = send;
buf->foffset = pos; buf->foffset = pos;
MSG_WriteBits( &buf->frag_message, pbuf + pos, send << 3 ); MSG_WriteBits( &buf->frag_message, pbuf + pos, send << 3 );
remaining -= send; remaining -= send;
@ -961,7 +961,7 @@ int Netchan_CreateFileFragments( netchan_t *chan, const char *filename )
qboolean bCompressed = false; qboolean bCompressed = false;
fragbufwaiting_t *wait, *p; fragbufwaiting_t *wait, *p;
fragbuf_t *buf; fragbuf_t *buf;
if(( filesize = FS_FileSize( filename, false )) <= 0 ) if(( filesize = FS_FileSize( filename, false )) <= 0 )
{ {
Con_Printf( S_WARN "Unable to open %s for transfer\n", filename ); Con_Printf( S_WARN "Unable to open %s for transfer\n", filename );
@ -1107,7 +1107,7 @@ qboolean Netchan_CopyNormalFragments( netchan_t *chan, sizebuf_t *msg, size_t *l
while( p ) while( p )
{ {
n = p->next; n = p->next;
// copy it in // copy it in
MSG_WriteBytes( msg, MSG_GetData( &p->frag_message ), MSG_GetNumBytesWritten( &p->frag_message )); MSG_WriteBytes( msg, MSG_GetData( &p->frag_message ), MSG_GetNumBytesWritten( &p->frag_message ));
size += MSG_GetNumBytesWritten( &p->frag_message ); size += MSG_GetNumBytesWritten( &p->frag_message );
@ -1133,7 +1133,7 @@ qboolean Netchan_CopyNormalFragments( netchan_t *chan, sizebuf_t *msg, size_t *l
return false; return false;
} }
} }
chan->incomingbufs[FRAG_NORMAL_STREAM] = NULL; chan->incomingbufs[FRAG_NORMAL_STREAM] = NULL;
// reset flag // reset flag
@ -1218,12 +1218,12 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
int cursize; int cursize;
n = p->next; n = p->next;
cursize = MSG_GetNumBytesWritten( &p->frag_message ); cursize = MSG_GetNumBytesWritten( &p->frag_message );
// first message has the file name, don't write that into the data stream, // first message has the file name, don't write that into the data stream,
// just write the rest of the actual data // just write the rest of the actual data
if( p == chan->incomingbufs[FRAG_FILE_STREAM] ) if( p == chan->incomingbufs[FRAG_FILE_STREAM] )
{ {
// copy it in // copy it in
cursize -= MSG_GetNumBytesRead( msg ); cursize -= MSG_GetNumBytesRead( msg );
@ -1353,7 +1353,7 @@ void Netchan_UpdateProgress( netchan_t *chan )
p = chan->incomingbufs[i]; p = chan->incomingbufs[i];
if( i == FRAG_FILE_STREAM ) if( i == FRAG_FILE_STREAM )
{ {
char sz[MAX_SYSPATH]; char sz[MAX_SYSPATH];
char *in, *out; char *in, *out;
@ -1440,7 +1440,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
int send_from_frag[MAX_STREAMS] = { 0, 0 }; int send_from_frag[MAX_STREAMS] = { 0, 0 };
int send_from_regular = 0; int send_from_regular = 0;
// if we have data in the waiting list(s) and we have cleared the current queue(s), then // if we have data in the waiting list(s) and we have cleared the current queue(s), then
// push the waitlist(s) into the current queue(s) // push the waitlist(s) into the current queue(s)
Netchan_FragSend( chan ); Netchan_FragSend( chan );
@ -1519,7 +1519,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
if( pbuf ) if( pbuf )
{ {
fragment_size = MSG_GetNumBytesWritten( &pbuf->frag_message ); fragment_size = MSG_GetNumBytesWritten( &pbuf->frag_message );
// files set size a bit differently. // files set size a bit differently.
if( pbuf->isfile && !pbuf->isbuffer ) if( pbuf->isfile && !pbuf->isbuffer )
{ {
@ -1536,7 +1536,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
// which buffer are we sending ? // which buffer are we sending ?
chan->reliable_fragid[i] = MAKE_FRAGID( pbuf->bufferid, chan->fragbufcount[i] ); chan->reliable_fragid[i] = MAKE_FRAGID( pbuf->bufferid, chan->fragbufcount[i] );
// if it's not in-memory, then we'll need to copy it in frame the file handle. // if it's not in-memory, then we'll need to copy it in frame the file handle.
if( pbuf->isfile && !pbuf->isbuffer ) if( pbuf->isfile && !pbuf->isbuffer )
{ {
@ -1567,7 +1567,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
chan->frag_length[i] = MSG_GetNumBitsWritten( &pbuf->frag_message ); chan->frag_length[i] = MSG_GetNumBitsWritten( &pbuf->frag_message );
// unlink pbuf // unlink pbuf
Netchan_UnlinkFragment( pbuf, &chan->fragbufs[i] ); Netchan_UnlinkFragment( pbuf, &chan->fragbufs[i] );
chan->reliable_fragment[i] = 1; chan->reliable_fragment[i] = 1;
@ -1607,7 +1607,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
if( chan->sock == NS_CLIENT ) if( chan->sock == NS_CLIENT )
{ {
MSG_WriteWord( &send, Cvar_VariableInteger( "net_qport" )); MSG_WriteWord( &send, Cvar_VariableInteger( "net_qport" ));
} }
if( send_reliable && send_reliable_fragment ) if( send_reliable && send_reliable_fragment )
{ {
@ -1620,7 +1620,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
MSG_WriteLong( &send, chan->frag_startpos[i] ); MSG_WriteLong( &send, chan->frag_startpos[i] );
MSG_WriteLong( &send, chan->frag_length[i] ); MSG_WriteLong( &send, chan->frag_length[i] );
} }
else else
{ {
MSG_WriteByte( &send, 0 ); MSG_WriteByte( &send, 0 );
} }
@ -1649,12 +1649,12 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
if( MSG_GetNumBytesWritten( &send ) < 16 && !NET_IsLocalAddress( chan->remote_address )) // packet too small for some networks if( MSG_GetNumBytesWritten( &send ) < 16 && !NET_IsLocalAddress( chan->remote_address )) // packet too small for some networks
{ {
// go ahead and pad a full 16 extra bytes -- this only happens during authentication / signon // go ahead and pad a full 16 extra bytes -- this only happens during authentication / signon
for( i = MSG_GetNumBytesWritten( &send ); i < 16; i++ ) for( i = MSG_GetNumBytesWritten( &send ); i < 16; i++ )
{ {
if( chan->sock == NS_CLIENT ) if( chan->sock == NS_CLIENT )
MSG_BeginClientCmd( &send, clc_nop ); MSG_BeginClientCmd( &send, clc_nop );
else if( chan->sock == NS_SERVER ) else if( chan->sock == NS_SERVER )
MSG_BeginServerCmd( &send, svc_nop ); MSG_BeginServerCmd( &send, svc_nop );
else break; else break;
} }
} }
@ -1778,7 +1778,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
, ns_strings[chan->sock] , ns_strings[chan->sock]
, MSG_GetMaxBytes( msg ) , MSG_GetMaxBytes( msg )
, sequence & 63 , sequence & 63
, sequence_ack & 63 , sequence_ack & 63
, reliable_message , reliable_message
, host.realtime ); , host.realtime );
} }
@ -1812,8 +1812,8 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
chan->reliable_length = 0; // it has been received chan->reliable_length = 0; // it has been received
} }
} }
// if this message contains a reliable message, bump incoming_reliable_sequence // if this message contains a reliable message, bump incoming_reliable_sequence
chan->incoming_sequence = sequence; chan->incoming_sequence = sequence;
chan->incoming_acknowledged = sequence_ack; chan->incoming_acknowledged = sequence_ack;
chan->incoming_reliable_acknowledged = reliable_ack; chan->incoming_reliable_acknowledged = reliable_ack;
@ -1847,7 +1847,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
if( !frag_message[i] ) if( !frag_message[i] )
continue; continue;
inbufferid = FRAG_GETID( fragid[i] ); inbufferid = FRAG_GETID( fragid[i] );
intotalbuffers = FRAG_GETCOUNT( fragid[i] ); intotalbuffers = FRAG_GETCOUNT( fragid[i] );
@ -1863,7 +1863,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
size = MSG_GetNumBitsRead( msg ) + frag_offset[i]; size = MSG_GetNumBitsRead( msg ) + frag_offset[i];
bits = frag_length[i]; bits = frag_length[i];
// copy in data // copy in data
MSG_Clear( &pbuf->frag_message ); MSG_Clear( &pbuf->frag_message );

View File

@ -29,7 +29,7 @@ GNU General Public License for more details.
#define DELTA_PATH "delta.lst" #define DELTA_PATH "delta.lst"
static qboolean delta_init = false; static qboolean delta_init = false;
// list of all the struct names // list of all the struct names
static const delta_field_t cmd_fields[] = static const delta_field_t cmd_fields[] =
{ {
@ -390,7 +390,7 @@ void Delta_CustomEncode( delta_info_t *dt, const void *from, const void *to )
delta_field_t *Delta_FindFieldInfo( const delta_field_t *pInfo, const char *fieldName ) delta_field_t *Delta_FindFieldInfo( const delta_field_t *pInfo, const char *fieldName )
{ {
if( !fieldName || !*fieldName ) if( !fieldName || !*fieldName )
return NULL; return NULL;
for( ; pInfo->name; pInfo++ ) for( ; pInfo->name; pInfo++ )
{ {
@ -405,7 +405,7 @@ int Delta_IndexForFieldInfo( const delta_field_t *pInfo, const char *fieldName )
int i; int i;
if( !fieldName || !*fieldName ) if( !fieldName || !*fieldName )
return -1; return -1;
for( i = 0; pInfo->name; i++, pInfo++ ) for( i = 0; pInfo->name; i++, pInfo++ )
{ {
@ -455,7 +455,7 @@ qboolean Delta_AddField( const char *pStructName, const char *pName, int flags,
} }
// allocate a new one // allocate a new one
dt->pFields = Z_Realloc( dt->pFields, (dt->numFields + 1) * sizeof( delta_t )); dt->pFields = Z_Realloc( dt->pFields, (dt->numFields + 1) * sizeof( delta_t ));
for( i = 0, pField = dt->pFields; i < dt->numFields; i++, pField++ ); for( i = 0, pField = dt->pFields; i < dt->numFields; i++, pField++ );
// copy info to new field // copy info to new field
@ -475,7 +475,7 @@ void Delta_WriteTableField( sizebuf_t *msg, int tableIndex, const delta_t *pFiel
{ {
int nameIndex; int nameIndex;
delta_info_t *dt; delta_info_t *dt;
Assert( pField != NULL ); Assert( pField != NULL );
if( !COM_CheckString( pField->name )) if( !COM_CheckString( pField->name ))
@ -523,7 +523,7 @@ void Delta_ParseTableField( sizebuf_t *msg )
if( !dt ) if( !dt )
Host_Error( "Delta_ParseTableField: not initialized" ); Host_Error( "Delta_ParseTableField: not initialized" );
nameIndex = MSG_ReadUBitLong( msg, 8 ); // read field name index nameIndex = MSG_ReadUBitLong( msg, 8 ); // read field name index
if( ( nameIndex >= 0 && nameIndex < dt->maxFields ) ) if( ( nameIndex >= 0 && nameIndex < dt->maxFields ) )
{ {
pName = dt->pInfo[nameIndex].name; pName = dt->pInfo[nameIndex].name;
@ -639,7 +639,7 @@ qboolean Delta_ParseField( char **delta_script, const delta_field_t *pInfo, delt
pField->bits = Q_atoi( token ); pField->bits = Q_atoi( token );
*delta_script = COM_ParseFile( *delta_script, token ); *delta_script = COM_ParseFile( *delta_script, token );
if( Q_strcmp( token, "," )) if( Q_strcmp( token, "," ))
{ {
Con_DPrintf( S_ERROR "Delta_ReadField: expected ',', found '%s' instead\n", token ); Con_DPrintf( S_ERROR "Delta_ReadField: expected ',', found '%s' instead\n", token );
@ -753,7 +753,7 @@ void Delta_InitFields( void )
{ {
byte *afile; byte *afile;
char *pfile; char *pfile;
string encodeDll, encodeFunc, token; string encodeDll, encodeFunc, token;
delta_info_t *dt; delta_info_t *dt;
afile = FS_LoadFile( DELTA_PATH, NULL, false ); afile = FS_LoadFile( DELTA_PATH, NULL, false );
@ -778,7 +778,7 @@ void Delta_InitFields( void )
// jump to '{' // jump to '{'
pfile = COM_ParseFile( pfile, token ); pfile = COM_ParseFile( pfile, token );
if( token[0] != '{' ) if( token[0] != '{' )
{ {
Sys_Error( "%s: missing '{' in section %s\n", DELTA_PATH, dt->pName ); Sys_Error( "%s: missing '{' in section %s\n", DELTA_PATH, dt->pName );
@ -825,7 +825,7 @@ void Delta_Init( void )
else Delta_AddField( "movevars_t", "zmax", DT_FLOAT|DT_SIGNED, 16, 1.0f, 1.0f ); else Delta_AddField( "movevars_t", "zmax", DT_FLOAT|DT_SIGNED, 16, 1.0f, 1.0f );
Delta_AddField( "movevars_t", "waveHeight", DT_FLOAT|DT_SIGNED, 16, 16.0f, 1.0f ); Delta_AddField( "movevars_t", "waveHeight", DT_FLOAT|DT_SIGNED, 16, 16.0f, 1.0f );
Delta_AddField( "movevars_t", "skyName", DT_STRING, 1, 1.0f, 1.0f ); Delta_AddField( "movevars_t", "skyName", DT_STRING, 1, 1.0f, 1.0f );
Delta_AddField( "movevars_t", "footsteps", DT_INTEGER, 1, 1.0f, 1.0f ); Delta_AddField( "movevars_t", "footsteps", DT_INTEGER, 1, 1.0f, 1.0f );
Delta_AddField( "movevars_t", "rollangle", DT_FLOAT|DT_SIGNED, 16, 32.0f, 1.0f ); Delta_AddField( "movevars_t", "rollangle", DT_FLOAT|DT_SIGNED, 16, 32.0f, 1.0f );
Delta_AddField( "movevars_t", "rollspeed", DT_FLOAT|DT_SIGNED, 16, 8.0f, 1.0f ); Delta_AddField( "movevars_t", "rollspeed", DT_FLOAT|DT_SIGNED, 16, 8.0f, 1.0f );
@ -909,7 +909,7 @@ int Delta_ClampIntegerField( delta_t *pField, int iValue, qboolean bSigned, int
} }
return iValue; // clamped; return iValue; // clamped;
} }
/* /*
===================== =====================
@ -1197,10 +1197,10 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
qboolean bSigned = ( pField->flags & DT_SIGNED ) ? true : false; qboolean bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
float flValue, flAngle, flTime; float flValue, flAngle, flTime;
qboolean bChanged; qboolean bChanged;
uint iValue; uint iValue;
const char *pStr; const char *pStr;
char *pOut; char *pOut;
bChanged = MSG_ReadOneBit( msg ); bChanged = MSG_ReadOneBit( msg );
Assert( pField->multiplier != 0.0f ); Assert( pField->multiplier != 0.0f );
@ -1319,7 +1319,7 @@ qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to,
============================================================================= =============================================================================
usercmd_t communication usercmd_t communication
============================================================================= =============================================================================
*/ */
/* /*
@ -1441,7 +1441,7 @@ void MSG_ReadDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to )
============================================================================= =============================================================================
movevars_t communication movevars_t communication
============================================================================= =============================================================================
*/ */
qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to ) qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to )
@ -1675,7 +1675,7 @@ If force is not set, then nothing at all will be generated if the entity is
identical, under the assumption that the in-order delta code will catch it. identical, under the assumption that the in-order delta code will catch it.
================== ==================
*/ */
void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, int delta_type, float timebase, int baseline ) void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, int delta_type, float timebase, int baseline )
{ {
delta_info_t *dt = NULL; delta_info_t *dt = NULL;
delta_t *pField; delta_t *pField;
@ -1715,7 +1715,7 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
MSG_WriteOneBit( msg, 1 ); MSG_WriteOneBit( msg, 1 );
MSG_WriteSBitLong( msg, baseline, 7 ); MSG_WriteSBitLong( msg, baseline, 7 );
} }
else MSG_WriteOneBit( msg, 0 ); else MSG_WriteOneBit( msg, 0 );
if( force || ( to->entityType != from->entityType )) if( force || ( to->entityType != from->entityType ))
{ {
@ -1739,7 +1739,7 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *
} }
Assert( dt && dt->bInitialized ); Assert( dt && dt->bInitialized );
pField = dt->pFields; pField = dt->pFields;
Assert( pField != NULL ); Assert( pField != NULL );
@ -1802,7 +1802,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state
} }
if( fRemoveType & 2 ) if( fRemoveType & 2 )
{ {
// entity was removed from server // entity was removed from server
to->number = -1; to->number = -1;
return false; return false;
@ -1875,7 +1875,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state
============================================================================= =============================================================================
game.dll interface game.dll interface
============================================================================= =============================================================================
*/ */
void GAME_EXPORT Delta_AddEncoder( char *name, pfnDeltaEncode encodeFunc ) void GAME_EXPORT Delta_AddEncoder( char *name, pfnDeltaEncode encodeFunc )
@ -1897,7 +1897,7 @@ void GAME_EXPORT Delta_AddEncoder( char *name, pfnDeltaEncode encodeFunc )
} }
// register new encode func // register new encode func
dt->userCallback = encodeFunc; dt->userCallback = encodeFunc;
} }
int GAME_EXPORT Delta_FindField( delta_t *pFields, const char *fieldname ) int GAME_EXPORT Delta_FindField( delta_t *pFields, const char *fieldname )

View File

@ -452,7 +452,7 @@ static int NET_StringToSockaddr( const char *s, struct sockaddr *sadr, qboolean
if( !net.initialized ) if( !net.initialized )
return false; return false;
memset( sadr, 0, sizeof( *sadr )); memset( sadr, 0, sizeof( *sadr ));
((struct sockaddr_in *)sadr)->sin_family = AF_INET; ((struct sockaddr_in *)sadr)->sin_family = AF_INET;
@ -1584,7 +1584,7 @@ void NET_Config( qboolean multiplayer )
old_config = multiplayer; old_config = multiplayer;
if( multiplayer ) if( multiplayer )
{ {
// open sockets // open sockets
if( net.allow_ip ) NET_OpenIP(); if( net.allow_ip ) NET_OpenIP();
@ -1596,7 +1596,7 @@ void NET_Config( qboolean multiplayer )
} }
} }
else else
{ {
int i; int i;
// shut down any existing sockets // shut down any existing sockets

View File

@ -27,10 +27,10 @@ GNU General Public License for more details.
#include "net_buffer.h" #include "net_buffer.h"
// 0 == regular, 1 == file stream // 0 == regular, 1 == file stream
#define MAX_STREAMS 2 #define MAX_STREAMS 2
// flow control bytes per second limits // flow control bytes per second limits
#define MAX_RATE 100000.0f #define MAX_RATE 100000.0f
#define MIN_RATE 1000.0f #define MIN_RATE 1000.0f
// default data rate // default data rate
@ -191,7 +191,7 @@ typedef struct fragbuf_s
qboolean isbuffer; // is this file buffer from memory ( custom decal, etc. ). qboolean isbuffer; // is this file buffer from memory ( custom decal, etc. ).
qboolean iscompressed; // is compressed file, we should using filename.ztmp qboolean iscompressed; // is compressed file, we should using filename.ztmp
char filename[MAX_OSPATH]; // name of the file to save out on remote host char filename[MAX_OSPATH]; // name of the file to save out on remote host
int foffset; // offset in file from which to read data int foffset; // offset in file from which to read data
int size; // size of data to read at that offset int size; // size of data to read at that offset
} fragbuf_t; } fragbuf_t;
@ -214,7 +214,7 @@ typedef enum fragsize_e
typedef struct netchan_s typedef struct netchan_s
{ {
netsrc_t sock; // NS_SERVER or NS_CLIENT, depending on channel. netsrc_t sock; // NS_SERVER or NS_CLIENT, depending on channel.
netadr_t remote_address; // address this channel is talking to. netadr_t remote_address; // address this channel is talking to.
int qport; // qport value to write when transmitting int qport; // qport value to write when transmitting
double last_received; // for timeouts double last_received; // for timeouts
@ -246,7 +246,7 @@ typedef struct netchan_s
// Waiting list of buffered fragments to go onto queue. // Waiting list of buffered fragments to go onto queue.
// Multiple outgoing buffers can be queued in succession // Multiple outgoing buffers can be queued in succession
fragbufwaiting_t *waitlist[MAX_STREAMS]; fragbufwaiting_t *waitlist[MAX_STREAMS];
int reliable_fragment[MAX_STREAMS]; // is reliable waiting buf a fragment? int reliable_fragment[MAX_STREAMS]; // is reliable waiting buf a fragment?
uint reliable_fragid[MAX_STREAMS]; // buffer id for each waiting fragment uint reliable_fragid[MAX_STREAMS]; // buffer id for each waiting fragment
@ -267,7 +267,7 @@ typedef struct netchan_s
int tempbuffersize; // current size int tempbuffersize; // current size
// incoming and outgoing flow metrics // incoming and outgoing flow metrics
flow_t flow[MAX_FLOWS]; flow_t flow[MAX_FLOWS];
// added for net_speeds // added for net_speeds
size_t total_sended; size_t total_sended;

View File

@ -21,7 +21,7 @@ GNU General Public License for more details.
#endif #endif
// expand debugging BBOX particle hulls by this many units. // expand debugging BBOX particle hulls by this many units.
#define BOX_GAP 0.0f #define BOX_GAP 0.0f
/* /*
=============== ===============

View File

@ -62,7 +62,7 @@ int PM_SampleMiptex( const msurface_t *surf, const vec3_t point )
if( fb ) contents = fb->contents; if( fb ) contents = fb->contents;
else contents = CONTENTS_SOLID; else contents = CONTENTS_SOLID;
if( !surf->texinfo || !surf->texinfo->texture ) if( !surf->texinfo || !surf->texinfo->texture )
return contents; return contents;
tx = surf->texinfo; tx = surf->texinfo;

View File

@ -75,18 +75,18 @@ void PM_InitBoxHull( void )
for( i = 0; i < 6; i++ ) for( i = 0; i < 6; i++ )
{ {
pm_boxclipnodes[i].planenum = i; pm_boxclipnodes[i].planenum = i;
side = i & 1; side = i & 1;
pm_boxclipnodes[i].children[side] = CONTENTS_EMPTY; pm_boxclipnodes[i].children[side] = CONTENTS_EMPTY;
if( i != 5 ) pm_boxclipnodes[i].children[side^1] = i + 1; if( i != 5 ) pm_boxclipnodes[i].children[side^1] = i + 1;
else pm_boxclipnodes[i].children[side^1] = CONTENTS_SOLID; else pm_boxclipnodes[i].children[side^1] = CONTENTS_SOLID;
pm_boxplanes[i].type = i>>1; pm_boxplanes[i].type = i>>1;
pm_boxplanes[i].normal[i>>1] = 1.0f; pm_boxplanes[i].normal[i>>1] = 1.0f;
pm_boxplanes[i].signbits = 0; pm_boxplanes[i].signbits = 0;
} }
} }
/* /*
@ -231,7 +231,7 @@ loc0:
if( num < hull->firstclipnode || num > hull->lastclipnode ) if( num < hull->firstclipnode || num > hull->lastclipnode )
Host_Error( "PM_RecursiveHullCheck: bad node number %i\n", num ); Host_Error( "PM_RecursiveHullCheck: bad node number %i\n", num );
// find the point distances // find the point distances
node = hull->clipnodes + num; node = hull->clipnodes + num;
plane = hull->planes + node->planenum; plane = hull->planes + node->planenum;
@ -259,7 +259,7 @@ loc0:
if( frac < 0.0f ) frac = 0.0f; if( frac < 0.0f ) frac = 0.0f;
if( frac > 1.0f ) frac = 1.0f; if( frac > 1.0f ) frac = 1.0f;
midf = p1f + ( p2f - p1f ) * frac; midf = p1f + ( p2f - p1f ) * frac;
VectorLerp( p1, frac, p2, mid ); VectorLerp( p1, frac, p2, mid );
@ -272,12 +272,12 @@ loc0:
{ {
// go past the node // go past the node
return PM_RecursiveHullCheck( hull, node->children[side^1], midf, p2f, mid, p2, trace ); return PM_RecursiveHullCheck( hull, node->children[side^1], midf, p2f, mid, p2, trace );
} }
// never got out of the solid area // never got out of the solid area
if( trace->allsolid ) if( trace->allsolid )
return false; return false;
// the other side of the node is solid, this is the impact point // the other side of the node is solid, this is the impact point
if( !side ) if( !side )
{ {
@ -391,7 +391,7 @@ pmtrace_t PM_PlayerTraceExt( playermove_t *pmove, vec3_t start, vec3_t end, int
hull = PM_HullForBox( mins, maxs ); hull = PM_HullForBox( mins, maxs );
VectorCopy( pe->origin, offset ); VectorCopy( pe->origin, offset );
} }
} }
else else
{ {
VectorSubtract( pe->mins, pmove->player_maxs[pmove->usehull], mins ); VectorSubtract( pe->mins, pmove->player_maxs[pmove->usehull], mins );
@ -712,7 +712,7 @@ int PM_PointContents( playermove_t *pmove, const vec3_t p )
if( FBitSet( pe->model->flags, MODEL_HAS_ORIGIN ) && !VectorIsNull( pe->angles )) if( FBitSet( pe->model->flags, MODEL_HAS_ORIGIN ) && !VectorIsNull( pe->angles ))
{ {
matrix4x4 matrix; matrix4x4 matrix;
Matrix4x4_CreateFromEntity( matrix, pe->angles, pe->origin, 1.0f ); Matrix4x4_CreateFromEntity( matrix, pe->angles, pe->origin, 1.0f );
Matrix4x4_VectorITransform( matrix, p, test ); Matrix4x4_VectorITransform( matrix, p, test );
} }

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