diff --git a/common/beamdef.h b/common/beamdef.h index 1dc271f8..b2904df4 100644 --- a/common/beamdef.h +++ b/common/beamdef.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/bspfile.h b/common/bspfile.h index dbc3dadb..8087f2dc 100644 --- a/common/bspfile.h +++ b/common/bspfile.h @@ -48,7 +48,7 @@ BRUSH MODELS #define SURF_PLANEBACK BIT( 1 ) // plane should be negated #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_DRAWTILED BIT( 5 ) // face without lighmap #define SURF_CONVEYOR BIT( 6 ) // scrolled texture (was SURF_DRAWBACKGROUND) @@ -166,7 +166,7 @@ typedef struct { int id; // must be little endian XASH int version; - dlump_t lumps[EXTRA_LUMPS]; + dlump_t lumps[EXTRA_LUMPS]; } dextrahdr_t; typedef struct diff --git a/common/cl_entity.h b/common/cl_entity.h index 6235a0a3..9f4cdc14 100644 --- a/common/cl_entity.h +++ b/common/cl_entity.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -33,7 +33,7 @@ typedef struct typedef struct { - float prevanimtime; + float prevanimtime; float sequencetime; byte prevseqblending[2]; vec3_t prevorigin; diff --git a/common/com_model.h b/common/com_model.h index b9d48931..0a914555 100644 --- a/common/com_model.h +++ b/common/com_model.h @@ -40,9 +40,9 @@ GNU General Public License for more details. typedef enum { mod_bad = -1, - mod_brush, - mod_sprite, - mod_alias, + mod_brush, + mod_sprite, + mod_alias, mod_studio } modtype_t; @@ -93,7 +93,7 @@ typedef struct texture_s struct texture_s *alternate_anims; // bmodels in frame 1 use these unsigned short fb_texturenum; // auto-luma texturenum unsigned short dt_texturenum; // detail-texture binding - unsigned int unused[3]; // reserved + unsigned int unused[3]; // reserved } texture_t; typedef struct @@ -147,7 +147,7 @@ typedef struct mnode_s // node specific mplane_t *plane; - struct mnode_s *children[2]; + struct mnode_s *children[2]; #ifdef SUPPORT_BSP2_FORMAT int firstsurface; int numsurfaces; @@ -166,7 +166,7 @@ struct decal_s decal_t *pnext; // linked list for each surface msurface_t *psurface; // Surface id for persistence / unlinking float dx; // local texture coordinates - float dy; // + float dy; // float scale; // Pixel scale short texture; // Decal texture short flags; // Decal flags FDECAL_* @@ -299,7 +299,7 @@ typedef struct model_s // vec3_t mins, maxs; // bounding box at angles '0 0 0' float radius; - + // brush model int firstmodelsurface; int nummodelsurfaces; @@ -386,7 +386,7 @@ typedef struct player_info_s int bottomcolor; // last frame rendered - int renderframe; + int renderframe; // Gait frame estimation int gaitsequence; diff --git a/common/con_nprint.h b/common/con_nprint.h index 96582776..64fe72c4 100644 --- a/common/con_nprint.h +++ b/common/con_nprint.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/const.h b/common/const.h index e76a9de6..7fa83a44 100644 --- a/common/const.h +++ b/common/const.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -123,41 +123,41 @@ // entity flags #define EFLAG_SLERP 1 // do studio interpolation of this entity - + // // temp entity events // #define TE_BEAMPOINTS 0 // beam effect between two points -// coord coord coord (start position) -// coord coord coord (end position) -// short (sprite index) -// byte (starting frame) -// byte (frame rate in 0.1's) -// byte (life in 0.1's) -// byte (line width in 0.1's) -// byte (noise amplitude in 0.01's) +// coord coord coord (start position) +// coord coord coord (end position) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define TE_BEAMENTPOINT 1 // beam effect between point and entity -// short (start entity) -// coord coord coord (end position) -// short (sprite index) -// byte (starting frame) -// byte (frame rate in 0.1's) -// byte (life in 0.1's) -// byte (line width in 0.1's) -// byte (noise amplitude in 0.01's) +// short (start entity) +// coord coord coord (end position) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #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 -// coord coord coord (position) +// coord coord coord (position) // short (sprite index) // byte (scale in 0.1's) // byte (framerate) @@ -173,54 +173,54 @@ #define TE_EXPLFLAG_ROTATE 32 // rotate the sprite randomly #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 -// coord coord coord (position) +// coord coord coord (position) // short (sprite index) // byte (scale in 0.1's) // byte (framerate) #define TE_TRACER 6 // tracer effect from point to point -// coord, coord, coord (start) +// coord, coord, coord (start) // coord, coord, coord (end) #define TE_LIGHTNING 7 // TE_BEAMPOINTS with simplified parameters -// coord, coord, coord (start) -// coord, coord, coord (end) -// byte (life in 0.1's) -// byte (width in 0.1's) +// coord, coord, coord (start) +// coord, coord, coord (end) +// byte (life in 0.1's) +// byte (width in 0.1's) // byte (amplitude in 0.01's) // short (sprite model index) -#define TE_BEAMENTS 8 -// short (start entity) -// short (end entity) -// short (sprite index) -// byte (starting frame) -// byte (frame rate in 0.1's) -// byte (life in 0.1's) -// byte (line width in 0.1's) -// byte (noise amplitude in 0.01's) +#define TE_BEAMENTS 8 +// short (start entity) +// short (end entity) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #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 -// coord coord coord (position) +// coord coord coord (position) #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 -// coord coord coord (position) +// coord coord coord (position) // byte (starting color) // 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) // short (texture index of precached decal texture name) // short (entity index) @@ -230,67 +230,67 @@ // coord, coord, coord (position) // byte (radius) // 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 -// coord, coord, coord (start) -// coord, coord, coord (end) +// coord, coord, coord (start) +// coord, coord, coord (end) // short (sprite index) // byte (count) -// byte (life in 0.1's) -// byte (scale in 0.1's) +// byte (life in 0.1's) +// byte (scale in 0.1's) // byte (velocity along vector in 10's) // byte (randomness of velocity in 10's) #define TE_BEAM 16 // obsolete #define TE_SPRITE 17 // additive sprite, plays 1 cycle -// coord, coord, coord (position) -// short (sprite index) -// byte (scale in 0.1's) +// coord, coord, coord (position) +// short (sprite index) +// byte (scale in 0.1's) // byte (brightness) #define TE_BEAMSPRITE 18 // A beam with a sprite at the end -// coord, coord, coord (start position) -// coord, coord, coord (end position) -// short (beam sprite index) -// short (end sprite index) +// coord, coord, coord (start position) +// coord, coord, coord (end position) +// short (beam sprite index) +// short (end sprite index) #define TE_BEAMTORUS 19 // screen aligned beam ring, expands to max radius over lifetime -// coord coord coord (center position) -// coord coord coord (axis and radius) -// short (sprite index) -// byte (starting frame) -// byte (frame rate in 0.1's) -// byte (life in 0.1's) -// byte (line width in 0.1's) -// byte (noise amplitude in 0.01's) +// coord coord coord (center position) +// coord coord coord (axis and radius) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define TE_BEAMDISK 20 // disk that expands to max radius over lifetime -// coord coord coord (center position) -// coord coord coord (axis and radius) -// short (sprite index) -// byte (starting frame) -// byte (frame rate in 0.1's) -// byte (life in 0.1's) -// byte (line width in 0.1's) -// byte (noise amplitude in 0.01's) +// coord coord coord (center position) +// coord coord coord (axis and radius) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define TE_BEAMCYLINDER 21 // cylinder that expands to max radius over lifetime -// coord coord coord (center position) -// coord coord coord (axis and radius) -// short (sprite index) -// byte (starting frame) -// byte (frame rate in 0.1's) -// byte (life in 0.1's) -// byte (line width in 0.1's) -// byte (noise amplitude in 0.01's) +// coord coord coord (center position) +// coord coord coord (axis and radius) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // 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 // short (entity:attachment to follow) // short (sprite index) -// byte (life in 0.1's) -// byte (line width in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) // byte,byte,byte (color) // byte (brightness) -#define TE_GLOWSPRITE 23 +#define TE_GLOWSPRITE 23 // coord, coord, coord (pos) short (model index) byte (scale / 10) #define TE_BEAMRING 24 // connect a beam ring to two entities -// short (start entity) -// short (end entity) -// short (sprite index) -// byte (starting frame) -// byte (frame rate in 0.1's) -// byte (life in 0.1's) -// byte (line width in 0.1's) -// byte (noise amplitude in 0.01's) +// short (start entity) +// short (end entity) +// short (sprite index) +// byte (starting frame) +// byte (frame rate in 0.1's) +// byte (life in 0.1's) +// byte (line width in 0.1's) +// byte (noise amplitude in 0.01's) // byte,byte,byte (color) // byte (brightness) // byte (scroll speed in 0.1's) #define TE_STREAK_SPLASH 25 // oriented shower of tracers -// coord coord coord (start position) -// coord coord coord (direction vector) +// coord coord coord (start position) +// coord coord coord (direction vector) // byte (color) // short (count) // short (base speed) @@ -330,15 +330,15 @@ #define TE_BEAMHOSE 26 // obsolete #define TE_DLIGHT 27 // dynamic light, effect world, minor entity effect -// coord, coord, coord (pos) -// byte (radius in 10's) +// coord, coord, coord (pos) +// byte (radius in 10's) // byte byte byte (color) // byte (life in 10's) // byte (decay rate in 10's) #define TE_ELIGHT 28 // point entity light, no world effect // short (entity:attachment to follow) -// coord coord coord (initial position) +// coord coord coord (initial position) // coord (radius) // byte byte byte (color) // byte (life in 0.1's) @@ -374,8 +374,8 @@ #define TE_LARGEFUNNEL 100 // coord coord coord (funnel position) -// short (sprite index) -// short (flags) +// short (sprite index) +// short (flags) #define TE_BLOODSTREAM 101 // particle spray // coord coord coord (start position) @@ -404,7 +404,7 @@ // byte (density) #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) // angle (initial yaw) // short (model index) @@ -441,7 +441,7 @@ // byte (speed) // 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) // 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_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_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 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_BODY 4 #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_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END). @@ -628,7 +628,7 @@ #define ATTN_NONE 0 #define ATTN_NORM (float)0.8 #define ATTN_IDLE (float)2 -#define ATTN_STATIC (float)1.25 +#define ATTN_STATIC (float)1.25 // pitch values #define PITCH_NORM 100 // non-pitch shifted @@ -691,8 +691,8 @@ #define TE_BOUNCE_SHOTSHELL 2 // Rendering constants -enum -{ +enum +{ kRenderNormal, // src kRenderTransColor, // c*a+dest*(1-a) kRenderTransTexture, // src*a+dest*(1-a) @@ -701,21 +701,21 @@ enum kRenderTransAdd, // src*a+dest }; -enum -{ - kRenderFxNone = 0, - kRenderFxPulseSlow, - kRenderFxPulseFast, - kRenderFxPulseSlowWide, - kRenderFxPulseFastWide, - kRenderFxFadeSlow, - kRenderFxFadeFast, - kRenderFxSolidSlow, - kRenderFxSolidFast, - kRenderFxStrobeSlow, - kRenderFxStrobeFast, - kRenderFxStrobeFaster, - kRenderFxFlickerSlow, +enum +{ + kRenderFxNone = 0, + kRenderFxPulseSlow, + kRenderFxPulseFast, + kRenderFxPulseSlowWide, + kRenderFxPulseFastWide, + kRenderFxFadeSlow, + kRenderFxFadeFast, + kRenderFxSolidSlow, + kRenderFxSolidFast, + kRenderFxStrobeSlow, + kRenderFxStrobeFast, + kRenderFxStrobeFaster, + kRenderFxFlickerSlow, kRenderFxFlickerFast, kRenderFxNoDissipation, kRenderFxDistort, // Distort/scale/translate flicker diff --git a/common/cvardef.h b/common/cvardef.h index 732bf735..e5542fbc 100644 --- a/common/cvardef.h +++ b/common/cvardef.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * 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_GAMEUIDLL (1<<14) // defined by the menu DLL #define FCVAR_CHEAT (1<<15) // can not be changed if cheats are disabled - + typedef struct cvar_s { char *name; diff --git a/common/demo_api.h b/common/demo_api.h index 3e3c6556..e38acab5 100644 --- a/common/demo_api.h +++ b/common/demo_api.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/dlight.h b/common/dlight.h index b8a520b3..5847e8a2 100644 --- a/common/dlight.h +++ b/common/dlight.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/enginefeatures.h b/common/enginefeatures.h index 1739c956..03999a82 100644 --- a/common/enginefeatures.h +++ b/common/enginefeatures.h @@ -17,7 +17,7 @@ GNU General Public License for more details. #define FEATURES_H // 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_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 diff --git a/common/entity_state.h b/common/entity_state.h index 7601558e..0b601f15 100644 --- a/common/entity_state.h +++ b/common/entity_state.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -19,7 +19,7 @@ #define ENTITY_NORMAL (1<<0) #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. typedef struct entity_state_s entity_state_t; @@ -63,36 +63,36 @@ struct entity_state_s vec3_t velocity; // Send bbox down to client for use during prediction. - vec3_t mins; + vec3_t mins; vec3_t maxs; int aiment; // If owned by a player, the index of that player ( for projectiles ). - int owner; + int owner; // Friction, for prediction. float friction; // Gravity multiplier - float gravity; + float gravity; // PLAYER SPECIFIC int team; int playerclass; int health; - qboolean spectator; + qboolean spectator; int weaponmodel; int gaitsequence; // If standing on conveyor, e.g. - vec3_t basevelocity; + vec3_t basevelocity; // Use the crouched hull, or the regular player hull. - int usehull; + int usehull; // Latched buttons last time state updated. int oldbuttons; // -1 = in air, else pmove entity number - int onground; + int onground; int iStepLeft; // How fast we are falling - float flFallVelocity; + float flFallVelocity; float fov; int weaponanim; @@ -135,7 +135,7 @@ typedef struct clientdata_s int bInDuck; int weapons; // remove? - + int flTimeStepSound; int flDuckTime; int flSwimTime; @@ -152,7 +152,7 @@ typedef struct clientdata_s int ammo_cells; int ammo_rockets; float m_flNextAttack; - + int tfstate; int pushmsec; int deadflag; diff --git a/common/entity_types.h b/common/entity_types.h index 32b501b8..b6d1f64d 100644 --- a/common/entity_types.h +++ b/common/entity_types.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/event_api.h b/common/event_api.h index 8b7ae640..b4c941d7 100644 --- a/common/event_api.h +++ b/common/event_api.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/event_args.h b/common/event_args.h index b4be77f4..f44fec46 100644 --- a/common/event_args.h +++ b/common/event_args.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/event_flags.h b/common/event_flags.h index d10ddace..4e647547 100644 --- a/common/event_flags.h +++ b/common/event_flags.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -17,13 +17,13 @@ #define EVENT_FLAGS_H // 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 // 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 // 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 // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). diff --git a/common/hltv.h b/common/hltv.h index 60adb020..b09c6001 100644 --- a/common/hltv.h +++ b/common/hltv.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -23,7 +23,7 @@ // sub commands of svc_hltv: #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 // sub commands of svc_director: @@ -45,7 +45,7 @@ // HLTV_EVENT event flags #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_SLOWMOTION (1<<6) // would look good in SloMo #define DRC_FLAG_FACEPLAYER (1<<7) // player is doning something (reload/defuse bomb etc) diff --git a/common/ivoicetweak.h b/common/ivoicetweak.h index e7802855..792f092b 100644 --- a/common/ivoicetweak.h +++ b/common/ivoicetweak.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -26,10 +26,10 @@ typedef enum typedef struct IVoiceTweak_s { // 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. void (*EndVoiceTweakMode)( void ); - + // Get/set control values. void (*SetControlFloat)( VoiceTweakControl iControl, float value ); float (*GetControlFloat)( VoiceTweakControl iControl ); diff --git a/common/kbutton.h b/common/kbutton.h index 820e2d9b..504e2345 100644 --- a/common/kbutton.h +++ b/common/kbutton.h @@ -1,6 +1,6 @@ //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ // -// Purpose: +// Purpose: // // $NoKeywords: $ //============================================================================= diff --git a/common/mathlib.h b/common/mathlib.h index fadb97fb..fc388599 100644 --- a/common/mathlib.h +++ b/common/mathlib.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/net_api.h b/common/net_api.h index 956b16ef..3e8b3c36 100644 --- a/common/net_api.h +++ b/common/net_api.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * 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 { // Connected to remote server? 1 == yes, 0 otherwise - int connected; + int connected; // Client's IP address netadr_t local_address; // Address of remote server diff --git a/common/netadr.h b/common/netadr.h index 21075819..4dc00011 100644 --- a/common/netadr.h +++ b/common/netadr.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/particledef.h b/common/particledef.h index 700815c0..3b8db9d7 100644 --- a/common/particledef.h +++ b/common/particledef.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -18,7 +18,7 @@ typedef enum { - pt_static, + pt_static, pt_grav, pt_slowgrav, pt_fire, @@ -45,7 +45,7 @@ typedef struct particle_s // for pt_clientcusttom, we'll call this function each frame void (*callback)( struct particle_s *particle, float frametime ); - + // For deathfunc, etc. unsigned char context; } particle_t; diff --git a/common/pmtrace.h b/common/pmtrace.h index 89995d10..fb7fc26e 100644 --- a/common/pmtrace.h +++ b/common/pmtrace.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -33,7 +33,7 @@ struct pmtrace_s vec3_t endpos; // final position pmplane_t plane; // surface normal 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. int hitgroup; }; diff --git a/common/qfont.h b/common/qfont.h index 468ee134..1259f8a3 100644 --- a/common/qfont.h +++ b/common/qfont.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/r_efx.h b/common/r_efx.h index b921e383..366b7c6b 100644 --- a/common/r_efx.h +++ b/common/r_efx.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -17,7 +17,7 @@ #define R_EFX_H // particle_t -#if !defined( PARTICLEDEFH ) +#if !defined( PARTICLEDEFH ) #include "particledef.h" #endif @@ -75,7 +75,7 @@ color24 gTracerColors[] = #define FTENT_SPIRAL 0x00000400 #define FTENT_SPRCYCLE 0x00000800 #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_PLYRATTACHMENT 0x00008000 // tent is attached to a player (owner) #define FTENT_SPRANIMATELOOP 0x00010000 // animating sprite doesn't die when last frame is displayed @@ -102,7 +102,7 @@ typedef struct tempent_s int priority; 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 - // 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. cl_entity_t entity; diff --git a/common/r_studioint.h b/common/r_studioint.h index bb07bf00..95831c15 100644 --- a/common/r_studioint.h +++ b/common/r_studioint.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * 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 int ( *IsHardware )( void ); - + // Only called by hardware interface void ( *GL_StudioDrawShadow )( void ); void ( *GL_SetRenderMode )( int mode ); @@ -140,7 +140,7 @@ typedef struct sv_blending_interface_s { int version; - void ( *SV_StudioSetupBones )( struct model_s *pModel, + void ( *SV_StudioSetupBones )( struct model_s *pModel, float frame, int sequence, const vec3_t angles, diff --git a/common/ref_params.h b/common/ref_params.h index 6a0226dc..a4d3d60d 100644 --- a/common/ref_params.h +++ b/common/ref_params.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * 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 right; vec3_t up; - + // Client frametime; float frametime; // Client time @@ -54,7 +54,7 @@ typedef struct ref_params_s int viewentity; int playernum; int max_entities; - int demoplayback; + int demoplayback; int hardware; int smoothing; diff --git a/common/render_api.h b/common/render_api.h index 5ba549f8..49b51fb3 100644 --- a/common/render_api.h +++ b/common/render_api.h @@ -132,7 +132,7 @@ typedef struct modelstate_s short frame; // 10 bits multiple by 4, should be enough byte blending[2]; byte controller[4]; - byte poseparam[16]; + byte poseparam[16]; byte body; byte skin; short scale; // model scale (multiplied by 16) @@ -163,7 +163,7 @@ typedef struct render_api_s int (*RenderGetParm)( int parm, int arg ); // generic void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale ); 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* (*GetEntityLight)( int number ); byte (*LightToTexGamma)( byte color ); // software gamma support diff --git a/common/screenfade.h b/common/screenfade.h index e4169251..0ac0161d 100644 --- a/common/screenfade.h +++ b/common/screenfade.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/studio_event.h b/common/studio_event.h index dd4bc5ad..67506d63 100644 --- a/common/studio_event.h +++ b/common/studio_event.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/triangleapi.h b/common/triangleapi.h index a3a1d83c..900b89ca 100644 --- a/common/triangleapi.h +++ b/common/triangleapi.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -16,7 +16,7 @@ #ifndef TRIANGLEAPI_H #define TRIANGLEAPI_H -typedef enum +typedef enum { TRI_FRONT = 0, TRI_NONE = 1, @@ -47,7 +47,7 @@ typedef struct triangleapi_s void (*Vertex3fv)( const float *worldPnt ); void (*Vertex3f)( float x, float y, float z ); void (*Brightness)( float brightness ); - void (*CullFace)( TRICULLSTYLE style ); + void (*CullFace)( TRICULLSTYLE style ); int (*SpriteTexture)( struct model_s *pSpriteModel, int frame ); 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. diff --git a/common/usercmd.h b/common/usercmd.h index 4420b71f..0034576b 100644 --- a/common/usercmd.h +++ b/common/usercmd.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/wadfile.h b/common/wadfile.h index 7c02dee8..9dafd13d 100644 --- a/common/wadfile.h +++ b/common/wadfile.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/common/weaponinfo.h b/common/weaponinfo.h index 73a2f8dc..66e47fac 100644 --- a/common/weaponinfo.h +++ b/common/weaponinfo.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/engine/alias.h b/engine/alias.h index 29905450..fda0ba0b 100644 --- a/engine/alias.h +++ b/engine/alias.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/engine/anorms.h b/engine/anorms.h index d147aea0..6efb35ba 100644 --- a/engine/anorms.h +++ b/engine/anorms.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -13,165 +13,165 @@ * ****/ -{-0.525731, 0.000000, 0.850651}, -{-0.442863, 0.238856, 0.864188}, -{-0.295242, 0.000000, 0.955423}, -{-0.309017, 0.500000, 0.809017}, -{-0.162460, 0.262866, 0.951056}, -{0.000000, 0.000000, 1.000000}, -{0.000000, 0.850651, 0.525731}, -{-0.147621, 0.716567, 0.681718}, -{0.147621, 0.716567, 0.681718}, -{0.000000, 0.525731, 0.850651}, -{0.309017, 0.500000, 0.809017}, -{0.525731, 0.000000, 0.850651}, -{0.295242, 0.000000, 0.955423}, -{0.442863, 0.238856, 0.864188}, -{0.162460, 0.262866, 0.951056}, -{-0.681718, 0.147621, 0.716567}, -{-0.809017, 0.309017, 0.500000}, -{-0.587785, 0.425325, 0.688191}, -{-0.850651, 0.525731, 0.000000}, -{-0.864188, 0.442863, 0.238856}, -{-0.716567, 0.681718, 0.147621}, -{-0.688191, 0.587785, 0.425325}, -{-0.500000, 0.809017, 0.309017}, -{-0.238856, 0.864188, 0.442863}, -{-0.425325, 0.688191, 0.587785}, -{-0.716567, 0.681718, -0.147621}, -{-0.500000, 0.809017, -0.309017}, -{-0.525731, 0.850651, 0.000000}, -{0.000000, 0.850651, -0.525731}, -{-0.238856, 0.864188, -0.442863}, -{0.000000, 0.955423, -0.295242}, -{-0.262866, 0.951056, -0.162460}, -{0.000000, 1.000000, 0.000000}, -{0.000000, 0.955423, 0.295242}, -{-0.262866, 0.951056, 0.162460}, -{0.238856, 0.864188, 0.442863}, -{0.262866, 0.951056, 0.162460}, -{0.500000, 0.809017, 0.309017}, -{0.238856, 0.864188, -0.442863}, -{0.262866, 0.951056, -0.162460}, -{0.500000, 0.809017, -0.309017}, -{0.850651, 0.525731, 0.000000}, -{0.716567, 0.681718, 0.147621}, -{0.716567, 0.681718, -0.147621}, -{0.525731, 0.850651, 0.000000}, -{0.425325, 0.688191, 0.587785}, -{0.864188, 0.442863, 0.238856}, -{0.688191, 0.587785, 0.425325}, -{0.809017, 0.309017, 0.500000}, -{0.681718, 0.147621, 0.716567}, -{0.587785, 0.425325, 0.688191}, -{0.955423, 0.295242, 0.000000}, -{1.000000, 0.000000, 0.000000}, -{0.951056, 0.162460, 0.262866}, -{0.850651, -0.525731, 0.000000}, -{0.955423, -0.295242, 0.000000}, -{0.864188, -0.442863, 0.238856}, -{0.951056, -0.162460, 0.262866}, -{0.809017, -0.309017, 0.500000}, -{0.681718, -0.147621, 0.716567}, -{0.850651, 0.000000, 0.525731}, -{0.864188, 0.442863, -0.238856}, -{0.809017, 0.309017, -0.500000}, -{0.951056, 0.162460, -0.262866}, -{0.525731, 0.000000, -0.850651}, -{0.681718, 0.147621, -0.716567}, -{0.681718, -0.147621, -0.716567}, -{0.850651, 0.000000, -0.525731}, -{0.809017, -0.309017, -0.500000}, -{0.864188, -0.442863, -0.238856}, -{0.951056, -0.162460, -0.262866}, -{0.147621, 0.716567, -0.681718}, -{0.309017, 0.500000, -0.809017}, -{0.425325, 0.688191, -0.587785}, -{0.442863, 0.238856, -0.864188}, -{0.587785, 0.425325, -0.688191}, -{0.688191, 0.587785, -0.425325}, -{-0.147621, 0.716567, -0.681718}, -{-0.309017, 0.500000, -0.809017}, -{0.000000, 0.525731, -0.850651}, -{-0.525731, 0.000000, -0.850651}, -{-0.442863, 0.238856, -0.864188}, -{-0.295242, 0.000000, -0.955423}, -{-0.162460, 0.262866, -0.951056}, -{0.000000, 0.000000, -1.000000}, -{0.295242, 0.000000, -0.955423}, -{0.162460, 0.262866, -0.951056}, -{-0.442863, -0.238856, -0.864188}, -{-0.309017, -0.500000, -0.809017}, -{-0.162460, -0.262866, -0.951056}, -{0.000000, -0.850651, -0.525731}, -{-0.147621, -0.716567, -0.681718}, -{0.147621, -0.716567, -0.681718}, -{0.000000, -0.525731, -0.850651}, -{0.309017, -0.500000, -0.809017}, -{0.442863, -0.238856, -0.864188}, -{0.162460, -0.262866, -0.951056}, -{0.238856, -0.864188, -0.442863}, -{0.500000, -0.809017, -0.309017}, -{0.425325, -0.688191, -0.587785}, -{0.716567, -0.681718, -0.147621}, -{0.688191, -0.587785, -0.425325}, -{0.587785, -0.425325, -0.688191}, -{0.000000, -0.955423, -0.295242}, -{0.000000, -1.000000, 0.000000}, -{0.262866, -0.951056, -0.162460}, -{0.000000, -0.850651, 0.525731}, -{0.000000, -0.955423, 0.295242}, -{0.238856, -0.864188, 0.442863}, -{0.262866, -0.951056, 0.162460}, -{0.500000, -0.809017, 0.309017}, -{0.716567, -0.681718, 0.147621}, -{0.525731, -0.850651, 0.000000}, -{-0.238856, -0.864188, -0.442863}, -{-0.500000, -0.809017, -0.309017}, -{-0.262866, -0.951056, -0.162460}, -{-0.850651, -0.525731, 0.000000}, -{-0.716567, -0.681718, -0.147621}, -{-0.716567, -0.681718, 0.147621}, -{-0.525731, -0.850651, 0.000000}, -{-0.500000, -0.809017, 0.309017}, -{-0.238856, -0.864188, 0.442863}, -{-0.262866, -0.951056, 0.162460}, -{-0.864188, -0.442863, 0.238856}, -{-0.809017, -0.309017, 0.500000}, -{-0.688191, -0.587785, 0.425325}, -{-0.681718, -0.147621, 0.716567}, -{-0.442863, -0.238856, 0.864188}, -{-0.587785, -0.425325, 0.688191}, -{-0.309017, -0.500000, 0.809017}, -{-0.147621, -0.716567, 0.681718}, -{-0.425325, -0.688191, 0.587785}, -{-0.162460, -0.262866, 0.951056}, -{0.442863, -0.238856, 0.864188}, -{0.162460, -0.262866, 0.951056}, -{0.309017, -0.500000, 0.809017}, -{0.147621, -0.716567, 0.681718}, -{0.000000, -0.525731, 0.850651}, -{0.425325, -0.688191, 0.587785}, -{0.587785, -0.425325, 0.688191}, -{0.688191, -0.587785, 0.425325}, -{-0.955423, 0.295242, 0.000000}, -{-0.951056, 0.162460, 0.262866}, -{-1.000000, 0.000000, 0.000000}, -{-0.850651, 0.000000, 0.525731}, -{-0.955423, -0.295242, 0.000000}, -{-0.951056, -0.162460, 0.262866}, -{-0.864188, 0.442863, -0.238856}, -{-0.951056, 0.162460, -0.262866}, -{-0.809017, 0.309017, -0.500000}, -{-0.864188, -0.442863, -0.238856}, -{-0.951056, -0.162460, -0.262866}, -{-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.688191, 0.587785, -0.425325}, -{-0.587785, 0.425325, -0.688191}, -{-0.425325, 0.688191, -0.587785}, -{-0.425325, -0.688191, -0.587785}, -{-0.587785, -0.425325, -0.688191}, -{-0.688191, -0.587785, -0.425325}, +{-0.525731, 0.000000, 0.850651}, +{-0.442863, 0.238856, 0.864188}, +{-0.295242, 0.000000, 0.955423}, +{-0.309017, 0.500000, 0.809017}, +{-0.162460, 0.262866, 0.951056}, +{0.000000, 0.000000, 1.000000}, +{0.000000, 0.850651, 0.525731}, +{-0.147621, 0.716567, 0.681718}, +{0.147621, 0.716567, 0.681718}, +{0.000000, 0.525731, 0.850651}, +{0.309017, 0.500000, 0.809017}, +{0.525731, 0.000000, 0.850651}, +{0.295242, 0.000000, 0.955423}, +{0.442863, 0.238856, 0.864188}, +{0.162460, 0.262866, 0.951056}, +{-0.681718, 0.147621, 0.716567}, +{-0.809017, 0.309017, 0.500000}, +{-0.587785, 0.425325, 0.688191}, +{-0.850651, 0.525731, 0.000000}, +{-0.864188, 0.442863, 0.238856}, +{-0.716567, 0.681718, 0.147621}, +{-0.688191, 0.587785, 0.425325}, +{-0.500000, 0.809017, 0.309017}, +{-0.238856, 0.864188, 0.442863}, +{-0.425325, 0.688191, 0.587785}, +{-0.716567, 0.681718, -0.147621}, +{-0.500000, 0.809017, -0.309017}, +{-0.525731, 0.850651, 0.000000}, +{0.000000, 0.850651, -0.525731}, +{-0.238856, 0.864188, -0.442863}, +{0.000000, 0.955423, -0.295242}, +{-0.262866, 0.951056, -0.162460}, +{0.000000, 1.000000, 0.000000}, +{0.000000, 0.955423, 0.295242}, +{-0.262866, 0.951056, 0.162460}, +{0.238856, 0.864188, 0.442863}, +{0.262866, 0.951056, 0.162460}, +{0.500000, 0.809017, 0.309017}, +{0.238856, 0.864188, -0.442863}, +{0.262866, 0.951056, -0.162460}, +{0.500000, 0.809017, -0.309017}, +{0.850651, 0.525731, 0.000000}, +{0.716567, 0.681718, 0.147621}, +{0.716567, 0.681718, -0.147621}, +{0.525731, 0.850651, 0.000000}, +{0.425325, 0.688191, 0.587785}, +{0.864188, 0.442863, 0.238856}, +{0.688191, 0.587785, 0.425325}, +{0.809017, 0.309017, 0.500000}, +{0.681718, 0.147621, 0.716567}, +{0.587785, 0.425325, 0.688191}, +{0.955423, 0.295242, 0.000000}, +{1.000000, 0.000000, 0.000000}, +{0.951056, 0.162460, 0.262866}, +{0.850651, -0.525731, 0.000000}, +{0.955423, -0.295242, 0.000000}, +{0.864188, -0.442863, 0.238856}, +{0.951056, -0.162460, 0.262866}, +{0.809017, -0.309017, 0.500000}, +{0.681718, -0.147621, 0.716567}, +{0.850651, 0.000000, 0.525731}, +{0.864188, 0.442863, -0.238856}, +{0.809017, 0.309017, -0.500000}, +{0.951056, 0.162460, -0.262866}, +{0.525731, 0.000000, -0.850651}, +{0.681718, 0.147621, -0.716567}, +{0.681718, -0.147621, -0.716567}, +{0.850651, 0.000000, -0.525731}, +{0.809017, -0.309017, -0.500000}, +{0.864188, -0.442863, -0.238856}, +{0.951056, -0.162460, -0.262866}, +{0.147621, 0.716567, -0.681718}, +{0.309017, 0.500000, -0.809017}, +{0.425325, 0.688191, -0.587785}, +{0.442863, 0.238856, -0.864188}, +{0.587785, 0.425325, -0.688191}, +{0.688191, 0.587785, -0.425325}, +{-0.147621, 0.716567, -0.681718}, +{-0.309017, 0.500000, -0.809017}, +{0.000000, 0.525731, -0.850651}, +{-0.525731, 0.000000, -0.850651}, +{-0.442863, 0.238856, -0.864188}, +{-0.295242, 0.000000, -0.955423}, +{-0.162460, 0.262866, -0.951056}, +{0.000000, 0.000000, -1.000000}, +{0.295242, 0.000000, -0.955423}, +{0.162460, 0.262866, -0.951056}, +{-0.442863, -0.238856, -0.864188}, +{-0.309017, -0.500000, -0.809017}, +{-0.162460, -0.262866, -0.951056}, +{0.000000, -0.850651, -0.525731}, +{-0.147621, -0.716567, -0.681718}, +{0.147621, -0.716567, -0.681718}, +{0.000000, -0.525731, -0.850651}, +{0.309017, -0.500000, -0.809017}, +{0.442863, -0.238856, -0.864188}, +{0.162460, -0.262866, -0.951056}, +{0.238856, -0.864188, -0.442863}, +{0.500000, -0.809017, -0.309017}, +{0.425325, -0.688191, -0.587785}, +{0.716567, -0.681718, -0.147621}, +{0.688191, -0.587785, -0.425325}, +{0.587785, -0.425325, -0.688191}, +{0.000000, -0.955423, -0.295242}, +{0.000000, -1.000000, 0.000000}, +{0.262866, -0.951056, -0.162460}, +{0.000000, -0.850651, 0.525731}, +{0.000000, -0.955423, 0.295242}, +{0.238856, -0.864188, 0.442863}, +{0.262866, -0.951056, 0.162460}, +{0.500000, -0.809017, 0.309017}, +{0.716567, -0.681718, 0.147621}, +{0.525731, -0.850651, 0.000000}, +{-0.238856, -0.864188, -0.442863}, +{-0.500000, -0.809017, -0.309017}, +{-0.262866, -0.951056, -0.162460}, +{-0.850651, -0.525731, 0.000000}, +{-0.716567, -0.681718, -0.147621}, +{-0.716567, -0.681718, 0.147621}, +{-0.525731, -0.850651, 0.000000}, +{-0.500000, -0.809017, 0.309017}, +{-0.238856, -0.864188, 0.442863}, +{-0.262866, -0.951056, 0.162460}, +{-0.864188, -0.442863, 0.238856}, +{-0.809017, -0.309017, 0.500000}, +{-0.688191, -0.587785, 0.425325}, +{-0.681718, -0.147621, 0.716567}, +{-0.442863, -0.238856, 0.864188}, +{-0.587785, -0.425325, 0.688191}, +{-0.309017, -0.500000, 0.809017}, +{-0.147621, -0.716567, 0.681718}, +{-0.425325, -0.688191, 0.587785}, +{-0.162460, -0.262866, 0.951056}, +{0.442863, -0.238856, 0.864188}, +{0.162460, -0.262866, 0.951056}, +{0.309017, -0.500000, 0.809017}, +{0.147621, -0.716567, 0.681718}, +{0.000000, -0.525731, 0.850651}, +{0.425325, -0.688191, 0.587785}, +{0.587785, -0.425325, 0.688191}, +{0.688191, -0.587785, 0.425325}, +{-0.955423, 0.295242, 0.000000}, +{-0.951056, 0.162460, 0.262866}, +{-1.000000, 0.000000, 0.000000}, +{-0.850651, 0.000000, 0.525731}, +{-0.955423, -0.295242, 0.000000}, +{-0.951056, -0.162460, 0.262866}, +{-0.864188, 0.442863, -0.238856}, +{-0.951056, 0.162460, -0.262866}, +{-0.809017, 0.309017, -0.500000}, +{-0.864188, -0.442863, -0.238856}, +{-0.951056, -0.162460, -0.262866}, +{-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.688191, 0.587785, -0.425325}, +{-0.587785, 0.425325, -0.688191}, +{-0.425325, 0.688191, -0.587785}, +{-0.425325, -0.688191, -0.587785}, +{-0.587785, -0.425325, -0.688191}, +{-0.688191, -0.587785, -0.425325}, diff --git a/engine/cdll_int.h b/engine/cdll_int.h index e407cced..a748eef2 100644 --- a/engine/cdll_int.h +++ b/engine/cdll_int.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -15,7 +15,7 @@ // // cdll_int.h // -// 4-23-98 +// 4-23-98 // JOHN: client dll interface declarations // @@ -205,11 +205,11 @@ typedef struct cl_enginefuncs_s const struct model_s* (*GetSpritePointer)( HSPRITE hSprite ); void (*pfnPlaySoundByNameAtLocation)( char *szSound, float volume, float *origin ); - + 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 (*pfnWeaponAnim)( int iAnim, int body ); - float (*pfnRandomFloat)( float flLow, float flHigh ); + float (*pfnRandomFloat)( float flLow, float flHigh ); int (*pfnRandomLong)( int lLow, int lHigh ); 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 efx_api_s *pEfxAPI; - struct event_api_s *pEventAPI; + struct event_api_s *pEventAPI; struct demo_api_s *pDemoAPI; struct net_api_s *pNetAPI; 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 ); struct model_s *(*LoadMapSprite)( const char *filename ); diff --git a/engine/client/avi/avi_win.c b/engine/client/avi/avi_win.c index d5fcc1e0..534b31ce 100644 --- a/engine/client/avi/avi_win.c +++ b/engine/client/avi/avi_win.c @@ -91,7 +91,7 @@ static dllfunc_t avifile_funcs[] = }; dll_info_t avifile_dll = { "avifil32.dll", avifile_funcs, false }; - + typedef struct movie_state_s { qboolean active; @@ -423,7 +423,7 @@ int AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, int offset, int leng result = 0; // 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 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; - // open the streams until a stream is not available. + // open the streams until a stream is not available. while( 1 ) { 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; Avi->audio_length *= Avi->audio_bytes_per_sample; - } + } else { pAVIStreamRelease( stream ); } } - // display error message-stream not found. + // display error message-stream not found. 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 ); if( !Avi->quiet ) 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.biPlanes = 1; + bmih.biPlanes = 1; bmih.biBitCount = 32; - bmih.biCompression = BI_RGB; + bmih.biCompression = BI_RGB; bmih.biWidth = Avi->video_xres; bmih.biHeight = -Avi->video_yres; // invert height to flip image upside down diff --git a/engine/client/cl_cmds.c b/engine/client/cl_cmds.c index e8b43e5c..1da66afa 100644 --- a/engine/client/cl_cmds.c +++ b/engine/client/cl_cmds.c @@ -127,7 +127,7 @@ void CL_PlayCDTrack_f( void ) for( maxTrack = i = 0; i < MAX_CDTRACKS; i++ ) if( COM_CheckStringEmpty( clgame.cdtracks[i] ) ) maxTrack++; - + Con_Printf( "%u tracks\n", maxTrack ); if( track ) { @@ -140,11 +140,11 @@ void CL_PlayCDTrack_f( void ) else Con_Printf( "%s: unknown command %s\n", Cmd_Argv( 0 ), command ); } -/* -================== +/* +================== CL_ScreenshotGetName -================== -*/ +================== +*/ qboolean CL_ScreenshotGetName( int lastnum, char *filename ) { if( lastnum < 0 || lastnum > 9999 ) @@ -158,11 +158,11 @@ qboolean CL_ScreenshotGetName( int lastnum, char *filename ) return true; } -/* -================== +/* +================== CL_SnapshotGetName -================== -*/ +================== +*/ qboolean CL_SnapshotGetName( int lastnum, char *filename ) { if( lastnum < 0 || lastnum > 9999 ) @@ -177,21 +177,21 @@ qboolean CL_SnapshotGetName( int lastnum, char *filename ) return true; } -/* -============================================================================== - - SCREEN SHOTS - -============================================================================== +/* +============================================================================== + + SCREEN SHOTS + +============================================================================== */ -/* -================== +/* +================== CL_ScreenShot_f normal screenshot -================== +================== */ -void CL_ScreenShot_f( void ) +void CL_ScreenShot_f( void ) { int i; string checkname; @@ -222,14 +222,14 @@ void CL_ScreenShot_f( void ) cls.envshot_viewsize = 0; } -/* -================== +/* +================== CL_SnapShot_f save screenshots into root dir -================== +================== */ -void CL_SnapShot_f( void ) +void CL_SnapShot_f( void ) { int i; string checkname; @@ -263,12 +263,12 @@ void CL_SnapShot_f( void ) cls.envshot_viewsize = 0; } -/* -================== +/* +================== CL_EnvShot_f cubemap view -================== +================== */ void CL_EnvShot_f( void ) { @@ -284,12 +284,12 @@ void CL_EnvShot_f( void ) cls.envshot_viewsize = 0; } -/* -================== +/* +================== CL_SkyShot_f skybox view -================== +================== */ void CL_SkyShot_f( void ) { @@ -305,13 +305,13 @@ void CL_SkyShot_f( void ) cls.envshot_viewsize = 0; } -/* -================== +/* +================== CL_LevelShot_f splash logo while map is loading -================== -*/ +================== +*/ void CL_LevelShot_f( void ) { size_t ft1, ft2; @@ -345,13 +345,13 @@ void CL_LevelShot_f( void ) else cls.scrshot_action = scrshot_inactive; // disable - not needs } -/* -================== +/* +================== CL_SaveShot_f mini-pic in loadgame menu -================== -*/ +================== +*/ void CL_SaveShot_f( void ) { if( Cmd_Argc() < 2 ) diff --git a/engine/client/cl_custom.c b/engine/client/cl_custom.c index ee96e91e..e1baee8f 100644 --- a/engine/client/cl_custom.c +++ b/engine/client/cl_custom.c @@ -41,7 +41,7 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource ) if( pResource->type == t_sound ) Q_snprintf( filepath, sizeof( filepath ), DEFAULT_SOUNDPATH "%s", pResource->szFileName ); else Q_strncpy( filepath, pResource->szFileName, sizeof( filepath )); - + if( !COM_IsSafeFileToDownload( filepath )) { Con_Reportf( "refusing to download %s\n", filepath ); diff --git a/engine/client/cl_debug.c b/engine/client/cl_debug.c index e483cb23..dcff1263 100644 --- a/engine/client/cl_debug.c +++ b/engine/client/cl_debug.c @@ -97,7 +97,7 @@ typedef struct typedef struct { - oldcmd_t oldcmd[MSG_COUNT]; + oldcmd_t oldcmd[MSG_COUNT]; int currentcmd; qboolean parsing; } msg_debug_t; @@ -155,7 +155,7 @@ void CL_Parse_RecordCommand( int cmd, int startoffset ) int slot; if( cmd == svc_nop ) return; - + slot = ( cls_message_debug.currentcmd++ & MSG_MASK ); cls_message_debug.oldcmd[slot].command = cmd; 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 ) { const char *buffer_file = "buffer.dat"; - file_t *fp; + file_t *fp; fp = FS_Open( buffer_file, "wb", false ); if( !fp ) return; diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index 84dc9a5b..79f50ca8 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -156,7 +156,7 @@ CL_GetDemoRecordClock write time while demo is recording ==================== */ -float CL_GetDemoRecordClock( void ) +float CL_GetDemoRecordClock( void ) { return cl.mtime[0]; } @@ -168,7 +168,7 @@ CL_GetDemoPlaybackClock overwrite host.realtime ==================== */ -float CL_GetDemoPlaybackClock( void ) +float CL_GetDemoPlaybackClock( void ) { return host.realtime + host.frametime; } @@ -353,7 +353,7 @@ void CL_WriteDemoHeader( const char *name ) int copysize; int savepos; int curpos; - + Con_Printf( "recording to %s.\n", name ); cls.demofile = FS_Open( name, "wb", false ); cls.demotime = 0.0; @@ -467,7 +467,7 @@ void CL_StopRecord( void ) demo.header.directory_offset = curpos; FS_Seek( cls.demofile, 0, SEEK_SET ); FS_Write( cls.demofile, &demo.header, sizeof( demo.header )); - + FS_Close( cls.demofile ); cls.demofile = NULL; cls.demorecording = false; @@ -726,9 +726,9 @@ qboolean CL_DemoMoveToNextSection( void ) // switch to next section, we got a dem_stop demo.entry = &demo.directory.entries[demo.entryIndex]; - + // 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. demo.starttime = CL_GetDemoPlaybackClock(); @@ -739,7 +739,7 @@ qboolean CL_DemoMoveToNextSection( void ) qboolean CL_ReadRawNetworkData( byte *buffer, size_t *length ) { - int msglen = 0; + int msglen = 0; Assert( buffer != NULL ); Assert( length != NULL ); @@ -795,8 +795,8 @@ qboolean CL_DemoReadMessageQuake( byte *buffer, size_t *length ) demoangle_t *a; *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.timedemo ) @@ -971,7 +971,7 @@ qboolean CL_DemoReadMessage( byte *buffer, size_t *length ) } } 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. 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. demo.starttime = CL_GetDemoPlaybackClock(); - } + } } demo.framecount++; @@ -1101,9 +1101,9 @@ void CL_FinishTimeDemo( void ) { int frames; double time; - + cls.timedemo = false; - + // the first frame didn't count frames = (host.framecount - cls.td_startframe) - 1; time = host.realtime - cls.td_starttime; @@ -1151,7 +1151,7 @@ void CL_StopPlayback( void ) } else { - // let game known about demo state + // let game known about demo state Cvar_FullSet( "cl_background", "0", FCVAR_READ_ONLY ); cls.state = ca_disconnected; memset( &cls.serveradr, 0, sizeof( cls.serveradr ) ); @@ -1166,11 +1166,11 @@ void CL_StopPlayback( void ) } } -/* -================== +/* +================== CL_GetDemoComment -================== -*/ +================== +*/ int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment ) { file_t *demfile; @@ -1179,7 +1179,7 @@ int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment ) demoentry_t entry; float playtime = 0.0f; int i; - + if( !comment ) return false; demfile = FS_Open( demoname, "rb", false ); @@ -1230,7 +1230,7 @@ int GAME_EXPORT CL_GetDemoComment( const char *demoname, char *comment ) // all done FS_Close( demfile ); - + return true; } @@ -1267,12 +1267,12 @@ qboolean CL_NextDemo( void ) return true; } -/* -================== +/* +================== CL_CheckStartupDemos queue demos loop after movie playing -================== +================== */ void CL_CheckStartupDemos( void ) { @@ -1297,11 +1297,11 @@ void CL_CheckStartupDemos( void ) CL_NextDemo (); } -/* -================== +/* +================== CL_DemoGetName -================== -*/ +================== +*/ static void CL_DemoGetName( int lastnum, char *filename ) { if( lastnum < 0 || lastnum > 9999 ) @@ -1387,7 +1387,7 @@ void CL_Record_f( void ) Q_strncpy( cls.demoname, demoname, sizeof( cls.demoname )); Q_strncpy( gameui.globals->demoname, demoname, sizeof( gameui.globals->demoname )); - + CL_WriteDemoHeader( demopath ); } diff --git a/engine/client/cl_efrag.c b/engine/client/cl_efrag.c index cabe26bd..5df1b6bd 100644 --- a/engine/client/cl_efrag.c +++ b/engine/client/cl_efrag.c @@ -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 ) { efrag_t *ef, *old, *walk, **prev; - + ef = ent->efrag; - + while( ef ) { prev = &ef->leaf->efrags; @@ -55,22 +55,22 @@ void R_RemoveEfrags( cl_entity_t *ent ) if( !walk ) break; if( walk == ef ) - { + { // remove this fragment *prev = ef->leafnext; break; } else prev = &walk->leafnext; } - + old = ef; ef = ef->entnext; - + // put it on the free list old->entnext = clgame.free_efrags; clgame.free_efrags = old; } - ent->efrag = NULL; + ent->efrag = NULL; } /* @@ -83,10 +83,10 @@ static void R_SplitEntityOnNode( mnode_t *node ) efrag_t *ef; mleaf_t *leaf; int sides; - + if( node->contents == CONTENTS_SOLID ) return; - + // add an efrag if the node is a leaf if( node->contents < 0 ) { @@ -105,29 +105,29 @@ static void R_SplitEntityOnNode( mnode_t *node ) clgame.free_efrags = ef->entnext; ef->entity = r_addent; - - // add the entity link + + // add the entity link *lastlink = ef; lastlink = &ef->entnext; ef->entnext = NULL; - + // set the leaf links ef->leaf = leaf; ef->leafnext = leaf->efrags; leaf->efrags = ef; return; } - + // NODE_MIXED sides = BOX_ON_PLANE_SIDE( r_emins, r_emaxs, node->plane ); - + if( sides == 3 ) { // split on this plane // if this is the first splitter of this bmodel, remember it if( !r_pefragtopnode ) r_pefragtopnode = node; } - + // recurse down the contacted sides if( sides & 1 ) R_SplitEntityOnNode( node->children[0] ); if( sides & 2 ) R_SplitEntityOnNode( node->children[1] ); @@ -143,7 +143,7 @@ void R_AddEfrags( cl_entity_t *ent ) matrix3x4 transform; vec3_t outmins, outmaxs; int i; - + if( !ent->model ) return; @@ -202,7 +202,7 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount ) ppefrag = &pefrag->leafnext; break; - default: + default: break; } } diff --git a/engine/client/cl_events.c b/engine/client/cl_events.c index 085405f4..fd1fe7ec 100644 --- a/engine/client/cl_events.c +++ b/engine/client/cl_events.c @@ -134,7 +134,7 @@ CL_EventIndex word CL_EventIndex( const char *name ) { int i; - + if( !COM_CheckString( name )) return 0; @@ -189,7 +189,7 @@ qboolean CL_FireEvent( event_info_t *ei, int slot ) // get the func pointer for( i = 0; i < MAX_EVENTS; i++ ) { - ev = clgame.events[i]; + ev = clgame.events[i]; if( !ev ) { @@ -209,7 +209,7 @@ qboolean CL_FireEvent( event_info_t *ei, int slot ) name = cl.event_precache[ei->index]; 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; } } - + // Place event on queue 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] )) { Con_DPrintf( S_ERROR "CL_PlaybackEvent: event %i was not precached\n", eventindex ); - return; + return; } SetBits( flags, FEV_CLIENT ); // it's a client event diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index 625f193d..e16eaea1 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -323,7 +323,7 @@ void CL_ProcessEntityUpdate( cl_entity_t *ent ) } // 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; VectorCopy( ent->curstate.origin, ent->origin ); @@ -782,7 +782,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta ) } if( subtracted >= CL_UPDATE_MASK ) - { + { // we can't use this, it is too old Con_NPrintf( 2, "^3Warning:^1 delta frame is too old^7\n" ); CL_FlushEntityPacket( msg ); @@ -850,7 +850,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta ) player = CL_IsPlayerIndex( newnum ); while( oldnum < newnum ) - { + { // one or more entities from the old packet are unchanged CL_DeltaEntity( msg, newframe, oldnum, oldent, false ); oldindex++; @@ -867,7 +867,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta ) } if( oldnum == newnum ) - { + { // delta from previous state bufStart = MSG_GetNumBytesRead( msg ); CL_DeltaEntity( msg, newframe, newnum, oldent, true ); @@ -887,7 +887,7 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta ) } if( oldnum > newnum ) - { + { // delta from baseline ? bufStart = MSG_GetNumBytesRead( msg ); 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 while( oldnum != MAX_ENTNUMBER ) - { + { // one or more entities from the old packet are unchanged CL_DeltaEntity( msg, newframe, oldnum, oldent, false ); 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) if( cls.signon == ( SIGNONS - 1 )) - { + { // we are done with signon sequence. cls.signon = SIGNONS; - + // Clear loading plaque. CL_SignonReply (); } @@ -1224,7 +1224,7 @@ void CL_LinkPacketEntities( frame_t *frame ) 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 ); } } diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 707bc27b..da0c3ed7 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -365,7 +365,7 @@ void CL_CenterPrint( const char *text, float y ) 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 ); } @@ -503,7 +503,7 @@ static void SPR_DrawGeneric( int frame, float x, float y, float width, float hei 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.top <= 0 || rc.top >= height ) rc.top = 0; if( rc.right <= 0 || rc.right > width ) rc.right = width; @@ -563,7 +563,7 @@ void CL_DrawCenterPrint( void ) colorDefault = g_color_table[7]; pText = clgame.centerPrint.message; Con_DrawCharacterLen( 0, NULL, &charHeight ); - + for( i = 0; i < clgame.centerPrint.lines; i++ ) { lineLength = 0; @@ -612,7 +612,7 @@ void CL_DrawScreenFade( void ) // keep pushing reset time out indefinitely if( sf->fadeFlags & FFADE_STAYOUT ) sf->fadeReset = cl.time + 0.1f; - + if( sf->fadeReset == 0.0f && sf->fadeEnd == 0.0f ) return; // inactive @@ -652,7 +652,7 @@ void CL_DrawScreenFade( void ) CL_InitTitles 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 ) @@ -714,7 +714,7 @@ void CL_ParseTextMessage( sizebuf_t *msg ) { channel = msgindex; msgindex = (msgindex + 1) & (MAX_TEXTCHANNELS - 1); - } + } // grab message channel text = &cl_textmessage[channel]; @@ -739,7 +739,7 @@ void CL_ParseTextMessage( sizebuf_t *msg ) else text->fxtime = 0.0f; // 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 ); } @@ -784,7 +784,7 @@ void CL_ParseFinaleCutscene( sizebuf_t *msg, int level ) text->fxtime = 0.0f; // 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' ) return; // no real text @@ -978,7 +978,7 @@ static void CL_DrawLoadingOrPaused( qboolean paused, float percent ) right = (int)ceil( percent * step ); s2 = (float)right / width; width = right; - + ref.dllFuncs.Color4ub( 208, 152, 0, 255 ); ref.dllFuncs.GL_SetRenderMode( kRenderTransTexture ); 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" ); 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 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" ); return; @@ -1116,7 +1116,7 @@ void CL_InitEdicts( void ) if(( clgame.maxRemapInfos - 1 ) != clgame.maxEntities ) { 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 ); } @@ -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++ ) 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 ); return NULL; @@ -1689,7 +1689,7 @@ static int GAME_EXPORT pfnHookUserMsg( const char *pszName, pfnUserMsgHook pfn ) // ignore blank names or invalid callbacks if( !pszName || !*pszName || !pfn ) - return 0; + return 0; 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; } - if( i == MAX_USER_MESSAGES ) + if( i == MAX_USER_MESSAGES ) { Host_Error( "HookUserMsg: MAX_USER_MESSAGES hit!\n" ); return 0; @@ -1750,7 +1750,7 @@ static int GAME_EXPORT pfnClientCmd( const char *szCmdString ) else { // 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; @@ -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->name = player->name; pinfo->model = player->model; - pinfo->spectator = player->spectator; + pinfo->spectator = player->spectator; pinfo->ping = player->ping; pinfo->packetloss = player->packet_loss; pinfo->topcolor = player->topcolor; @@ -1876,7 +1876,7 @@ static int GAME_EXPORT pfnDrawCharacter( int x, int y, int number, int r, int g, ============= pfnDrawConsoleString -drawing string like a console string +drawing string like a console 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 fraction = fraction * sin( cl.time * freq ); - + // add to view origin 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( angles ) angles[ROLL] += clgame.shake.applied_angle * factor; } - + /* ============= pfnIsSpectateOnly @@ -2208,7 +2208,7 @@ static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull int old_usehull; old_usehull = clgame.pmove->usehull; - clgame.pmove->usehull = usehull; + clgame.pmove->usehull = usehull; switch( flags ) { @@ -2256,7 +2256,7 @@ static void GAME_EXPORT pfnHookEvent( const char *filename, pfnEventHook pfn ) // ignore blank names if( !filename || !*filename ) - return; + return; Q_strncpy( name, filename, sizeof( name )); COM_FixSlashes( name ); @@ -2264,7 +2264,7 @@ static void GAME_EXPORT pfnHookEvent( const char *filename, pfnEventHook pfn ) // find an empty slot for( i = 0; i < MAX_EVENTS; i++ ) { - ev = clgame.events[i]; + ev = clgame.events[i]; if( !ev ) break; if( !Q_stricmp( name, ev->name ) && ev->func != NULL ) @@ -2391,7 +2391,7 @@ pfnLocalPlayerViewheight */ 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; } - + /* ============= pfnStopAllSounds @@ -3393,8 +3393,8 @@ void GAME_EXPORT NetAPI_SendRequest( int context, int request, int flags, double nr->timeout = nr->timesend + timeout; nr->pfnFunc = response; nr->resp.context = context; - nr->resp.type = request; - nr->resp.remote_address = *remote_address; + nr->resp.type = request; + nr->resp.remote_address = *remote_address; nr->flags = flags; if( request == NETAPI_REQUEST_SERVERLIST ) @@ -3583,7 +3583,7 @@ void GAME_EXPORT Voice_EndVoiceTweakMode( void ) Voice_SetControlFloat ================= -*/ +*/ void GAME_EXPORT Voice_SetControlFloat( VoiceTweakControl iControl, float value ) { } @@ -3604,7 +3604,7 @@ static void GAME_EXPORT VGui_ViewportPaintBackground( int extents[4] ) // stub } -// shared between client and server +// shared between client and server triangleapi_t gTriApi; static efx_api_t gEfxApi = @@ -3752,7 +3752,7 @@ static IVoiceTweak gVoiceApi = }; // engine callbacks -static cl_enginefunc_t gEngfuncs = +static cl_enginefunc_t gEngfuncs = { pfnSPR_Load, pfnSPR_Frames, @@ -3970,7 +3970,7 @@ qboolean CL_LoadProgs( const char *name ) // trying to get single export 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 GetClientAPI( &clgame.dllFuncs ); diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index b806ce26..1e64b0b5 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -306,7 +306,7 @@ static void GAME_EXPORT UI_DrawLogo( const char *filename, float x, float y, flo { string path; const char *fullpath; - + // run cinematic if not Q_snprintf( path, sizeof( path ), "media/%s", filename ); COM_DefaultExtension( path, ".avi" ); @@ -390,7 +390,7 @@ static void UI_UpdateUserinfo( void ) player->bottomcolor = Q_atoi( Info_ValueForKey( player->userinfo, "bottomcolor" )); host.userinfo_changed = false; // we got it } - + void Host_Credits( void ) { if( !gameui.hInstance ) return; @@ -776,7 +776,7 @@ static void GAME_EXPORT pfnDrawCharacter( int ix, int iy, int iwidth, int iheigh ============= 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 ) @@ -1108,7 +1108,7 @@ static void GAME_EXPORT UI_ShellExecute( const char *path, const char *parms, in // engine callbacks -static ui_enginefuncs_t gEngfuncs = +static ui_enginefuncs_t gEngfuncs = { pfnPIC_Load, GL_FreeImage, @@ -1149,7 +1149,7 @@ static ui_enginefuncs_t gEngfuncs = Con_DefaultColor, pfnGetPlayerModel, pfnSetPlayerModel, - pfnClearScene, + pfnClearScene, pfnRenderScene, pfnAddEntity, Host_Error, diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 8c654ea7..999864b3 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -184,17 +184,17 @@ void CL_CheckClientState( void ) { // first update is the pre-final signon stage if(( cls.state == ca_connected || cls.state == ca_validate ) && ( cls.signon == SIGNONS )) - { + { cls.state = ca_active; cls.changelevel = false; // changelevel is done cls.changedemo = false; // changedemo is done cl.first_frame = true; // first rendering frame 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 ); - 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 ) SCR_EndLoadingPlaque(); // get rid of loading plaque } @@ -254,7 +254,7 @@ static float CL_LerpPoint( void ) float f, frac = 1.0f; f = cl_serverframetime(); - + if( f == 0.0f || cls.timedemo ) { cl.time = cl.mtime[0]; @@ -262,7 +262,7 @@ static float CL_LerpPoint( void ) } if( f > 0.1f ) - { + { // dropped packet, or start of demo cl.mtime[1] = cl.mtime[0] - 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 ); - 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 ); } @@ -637,7 +637,7 @@ void CL_CreateCmd( void ) CL_SetSolidPlayers( cl.playernum ); // 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->processedfuncs = false; @@ -723,7 +723,7 @@ void CL_WritePacket( void ) int numcmds; int newcmds; int cmdnumber; - + // don't send anything if playing back a demo if( cls.demoplayback || cls.state < ca_connected || cls.state == ca_cinematic ) return; @@ -778,7 +778,7 @@ void CL_WritePacket( void ) if( send_command ) { int outgoing_sequence; - + 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 ); 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 newcmds = bound( 0, newcmds, cls.legacymode?MAX_LEGACY_TOTAL_CMDS:MAX_TOTAL_CMDS ); if( cls.state == ca_connected ) newcmds = 0; - + MSG_WriteByte( &buf, newcmds ); numcmds = newcmds + numbackup; @@ -833,7 +833,7 @@ void CL_WritePacket( void ) // message we are constructing. i = cls.netchan.outgoing_sequence & CL_UPDATE_MASK; - + // determine if we need to ask for a new set of delta's. 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 ) { Con_Printf( S_USAGE "connect \n" ); - return; + return; } Q_strncpy( server, Cmd_Argv( 1 ), sizeof( server )); @@ -1319,7 +1319,7 @@ void CL_Rcon_f( void ) NET_StringToAdr( rcon_address->string, &to ); if( to.port == 0 ) to.port = MSG_BigShort( PORT_SERVER ); } - + 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 dataoffset = 0; netadr_t servadr; - + MSG_Clear( msg ); MSG_ReadLong( msg ); // skip the -1 @@ -2218,7 +2218,7 @@ void CL_ReadNetMessage( void ) continue; } - // can't be a valid sequenced packet + // can't be a valid sequenced packet if( cls.state < ca_connected ) continue; 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 ); CL_ParseServerMessage( &net_message, false ); } - + if( Netchan_CopyFileFragments( &cls.netchan, &net_message )) { // remove from resource request stuff. @@ -2333,7 +2333,7 @@ void CL_ReadPackets( void ) return; } } - + } /* @@ -2672,7 +2672,7 @@ qboolean CL_PrecacheResources( void ) } 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 ); 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_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_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_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" ); @@ -2874,7 +2874,7 @@ void CL_InitLocal( void ) Cmd_AddCommand ("god", NULL, "enable godmode" ); Cmd_AddCommand ("fov", NULL, "set client field of view" ); Cmd_AddCommand ("log", NULL, "logging server events" ); - + // register our commands Cmd_AddCommand ("pause", NULL, "pause the game (if the server allows pausing)" ); 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 ("fullserverinfo", CL_FullServerinfo_f, "sent by server when serverinfo changes" ); Cmd_AddCommand ("upload", CL_BeginUpload_f, "uploading file to the server" ); - + Cmd_AddCommand ("quit", CL_Quit_f, "quit from game" ); Cmd_AddCommand ("exit", CL_Quit_f, "quit from game" ); diff --git a/engine/client/cl_netgraph.c b/engine/client/cl_netgraph.c index ed40ed5a..23f40916 100644 --- a/engine/client/cl_netgraph.c +++ b/engine/client/cl_netgraph.c @@ -116,33 +116,33 @@ void NetGraph_InitColors( void ) byte mincolor[2][3]; byte maxcolor[2][3]; float dc[2][3]; - int i, hfrac; + int i, hfrac; float f; - + mincolor[0][0] = 63; mincolor[0][1] = 0; mincolor[0][2] = 100; - + maxcolor[0][0] = 0; maxcolor[0][1] = 63; maxcolor[0][2] = 255; - + mincolor[1][0] = 255; mincolor[1][1] = 127; mincolor[1][2] = 0; - + maxcolor[1][0] = 250; maxcolor[1][1] = 0; maxcolor[1][2] = 0; - + for( i = 0; i < 3; i++ ) { dc[0][i] = (float)(maxcolor[0][i] - mincolor[0][i]); dc[1][i] = (float)(maxcolor[1][i] - mincolor[1][i]); } - + hfrac = NETGRAPH_LERP_HEIGHT / 3; - + for( i = 0; i < NETGRAPH_LERP_HEIGHT; i++ ) { if( i < hfrac ) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index dce0d2a7..6294f91b 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -61,7 +61,7 @@ void CL_ParseSoundPacket( sizebuf_t *msg ) { vec3_t pos; int chan, sound; - float volume, attn; + float volume, attn; int flags, pitch, entnum; sound_t handle = 0; @@ -75,14 +75,14 @@ void CL_ParseSoundPacket( sizebuf_t *msg ) if( FBitSet( flags, SND_ATTENUATION )) attn = (float)MSG_ReadByte( msg ) / 64.0f; - else attn = ATTN_NONE; + else attn = ATTN_NONE; if( FBitSet( flags, SND_PITCH )) pitch = MSG_ReadByte( msg ); else pitch = PITCH_NORM; // entity reletive - entnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS ); + entnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS ); // positioned in space MSG_ReadVec3Coord( msg, pos ); @@ -123,7 +123,7 @@ void CL_ParseRestoreSoundPacket( sizebuf_t *msg ) { vec3_t pos; int chan, sound; - float volume, attn; + float volume, attn; int flags, pitch, entnum; double samplePos, forcedEnd; int wordIndex; @@ -139,7 +139,7 @@ void CL_ParseRestoreSoundPacket( sizebuf_t *msg ) if( flags & SND_ATTENUATION ) attn = (float)MSG_ReadByte( msg ) / 64.0f; - else attn = ATTN_NONE; + else attn = ATTN_NONE; if( flags & SND_PITCH ) pitch = MSG_ReadByte( msg ); @@ -269,8 +269,8 @@ void CL_ParseParticles( sizebuf_t *msg ) vec3_t org, dir; int i, count, color; float life; - - MSG_ReadVec3Coord( msg, org ); + + MSG_ReadVec3Coord( msg, org ); for( i = 0; i < 3; i++ ) dir[i] = MSG_ReadChar( msg ) * 0.0625f; @@ -907,7 +907,7 @@ void CL_ParseServerData( sizebuf_t *msg ) } // multiplayer game? - if( cl.maxclients > 1 ) + if( cl.maxclients > 1 ) { // allow console in multiplayer games host.allow_console = true; @@ -933,7 +933,7 @@ void CL_ParseServerData( sizebuf_t *msg ) Cvar_FullSet( "cl_background", "1", 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 S_StopBackgroundTrack (); @@ -964,7 +964,7 @@ void CL_ParseServerData( sizebuf_t *msg ) 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 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->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 )); @@ -1032,7 +1032,7 @@ void CL_ParseClientData( sizebuf_t *msg ) parsecounttime = cl.commands[command_ack & CL_UPDATE_MASK].senttime; // 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 ) { @@ -1088,8 +1088,8 @@ void CL_ParseClientData( sizebuf_t *msg ) // otherwise, move in 1 ms steps toward observed channel latency. if( latency < cls.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 { @@ -1101,7 +1101,7 @@ void CL_ParseClientData( sizebuf_t *msg ) { cl.local.health = 1; return; - } + } to_cd = &frame->clientdata; to_wd = frame->weapondata; @@ -1228,13 +1228,13 @@ void CL_ParseAddAngle( sizebuf_t *msg ) { pred_viewangle_t *a; float delta_yaw; - + delta_yaw = MSG_ReadBitAngle( msg, 16 ); #if 0 cl.viewangles[YAW] += delta_yaw; return; #endif - // update running counter + // update running counter cl.addangletotal += delta_yaw; // select entry into circular buffer @@ -1298,7 +1298,7 @@ void CL_RegisterUserMessage( sizebuf_t *msg ) { char *pszName; int svc_num, size, bits; - + svc_num = MSG_ReadByte( msg ); if( cls.legacymode ) @@ -1452,7 +1452,7 @@ void CL_UpdateUserPings( sizebuf_t *msg ) { int i, slot; player_info_t *player; - + for( i = 0; i < MAX_CLIENTS; i++ ) { 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 )) 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, "Not Found" ); @@ -2081,7 +2081,7 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message ) // assume no entity/player update this packet 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; } 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] ); } } - + // parse the message while( 1 ) { @@ -2104,7 +2104,7 @@ void CL_ParseServerMessage( sizebuf_t *msg, qboolean normal_message ) // end of message (align bits) if( MSG_GetNumBitsLeft( msg ) < 8 ) - break; + break; cmd = MSG_ReadServerCmd( msg ); diff --git a/engine/client/cl_pmove.c b/engine/client/cl_pmove.c index 28453c6a..35e61937 100644 --- a/engine/client/cl_pmove.c +++ b/engine/client/cl_pmove.c @@ -159,7 +159,7 @@ void CL_SetIdealPitch( void ) top[0] = cl.simorg[0] + cosval * (i + 3.0f) * 12.0f; top[1] = cl.simorg[1] + sinval * (i + 3.0f) * 12.0f; top[2] = cl.simorg[2] + cl.viewheight[2]; - + bottom[0] = top[0]; bottom[1] = top[1]; bottom[2] = top[2] - 160.0f; @@ -170,10 +170,10 @@ void CL_SetIdealPitch( void ) if( tr.fraction == 1.0f ) return; // near a dropoff - + z[i] = top[2] + tr.fraction * (bottom[2] - top[2]); } - + dir = 0; steps = 0; @@ -186,16 +186,16 @@ void CL_SetIdealPitch( void ) if( dir && ( step-dir > ON_EPSILON || step-dir < -ON_EPSILON )) return; // mixed changes - steps++; + steps++; dir = step; } - + if( !dir ) { cl.local.idealpitch = 0.0f; return; } - + if( steps < 2 ) return; 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 )) { matrix4x4 matrix; - + Matrix4x4_CreateFromEntity( matrix, pe->angles, offset, 1.0f ); Matrix4x4_VectorITransform( matrix, rgflPos, test ); } @@ -655,7 +655,7 @@ pmtrace_t CL_TraceLine( vec3_t start, vec3_t end, int flags ) pmtrace_t tr; 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 ); 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; 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 ); 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; old_usehull = clgame.pmove->usehull; - clgame.pmove->usehull = usehull; + clgame.pmove->usehull = usehull; switch( flags ) { @@ -838,7 +838,7 @@ static const char *pfnTraceTexture( int ground, float *vstart, float *vend ) pe = &clgame.pmove->physents[ground]; return PM_TraceTexture( pe, vstart, vend ); -} +} 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; old_usehull = clgame.pmove->usehull; - clgame.pmove->usehull = usehull; + clgame.pmove->usehull = usehull; switch( flags ) { @@ -926,13 +926,13 @@ void CL_InitClientMove( void ) clgame.pmove->PM_StuckTouch = pfnStuckTouch; clgame.pmove->PM_PointContents = pfnPointContents; clgame.pmove->PM_TruePointContents = pfnTruePointContents; - clgame.pmove->PM_HullPointContents = pfnHullPointContents; + clgame.pmove->PM_HullPointContents = pfnHullPointContents; clgame.pmove->PM_PlayerTrace = pfnPlayerTrace; clgame.pmove->PM_TraceLine = PM_TraceLine; clgame.pmove->RandomLong = COM_RandomLong; clgame.pmove->RandomFloat = COM_RandomFloat; clgame.pmove->PM_GetModelType = pfnGetModelType; - clgame.pmove->PM_GetModelBounds = pfnGetModelBounds; + clgame.pmove->PM_GetModelBounds = pfnGetModelBounds; clgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp; clgame.pmove->PM_TraceModel = pfnTraceModel; 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->vuser3, pmove->vuser3 ); 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 ); } diff --git a/engine/client/cl_qparse.c b/engine/client/cl_qparse.c index 07f537a5..37b94930 100644 --- a/engine/client/cl_qparse.c +++ b/engine/client/cl_qparse.c @@ -224,7 +224,7 @@ static void CL_ParseQuakeServerInfo( sizebuf_t *msg ) } // multiplayer game? - if( cl.maxclients > 1 ) + if( cl.maxclients > 1 ) { // allow console in multiplayer games 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( !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 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. frame = &cl.frames[cl.parsecountmod]; // frame at index. 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->flags, 0, sizeof( frame->flags )); frame->first_entity = cls.next_client_entities; @@ -448,7 +448,7 @@ void CL_ParseQuakeEntityData( sizebuf_t *msg, int bits ) SetBits( bits, i << 8 ); } - if( FBitSet( bits, U_LONGENTITY )) + if( FBitSet( bits, U_LONGENTITY )) newnum = MSG_ReadWord( 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] ) forcelink = true; // no previous frame to lerp from else forcelink = false; - + if( FBitSet( bits, U_MODEL )) state->modelindex = MSG_ReadByte( msg ); else state->modelindex = ent->baseline.modelindex; @@ -573,8 +573,8 @@ void CL_ParseQuakeParticle( sizebuf_t *msg ) { int count, color; vec3_t org, dir; - - MSG_ReadVec3Coord( msg, org ); + + MSG_ReadVec3Coord( msg, org ); dir[0] = MSG_ReadChar( msg ) * 0.0625f; dir[1] = 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; vec3_t org; - MSG_ReadVec3Coord( msg, org ); + MSG_ReadVec3Coord( msg, org ); sound_num = MSG_ReadByte( msg ); vol = (float)MSG_ReadByte( msg ) / 255.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 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; } else @@ -931,7 +931,7 @@ void CL_ParseQuakeMessage( sizebuf_t *msg, qboolean normal_message ) // end of message (align bits) if( MSG_GetNumBitsLeft( msg ) < 8 ) - break; + break; cmd = MSG_ReadServerCmd( msg ); diff --git a/engine/client/cl_remap.c b/engine/client/cl_remap.c index 10ac23ed..fd6350df 100644 --- a/engine/client/cl_remap.c +++ b/engine/client/cl_remap.c @@ -54,7 +54,7 @@ qboolean CL_CmpStudioTextures( int numtexs, mstudiotexture_t *p1, mstudiotexture if( p1->index != p2->index ) return false; - } + } return true; } @@ -282,7 +282,7 @@ void CL_AllocRemapInfo( cl_entity_t *entity, int topcolor, int bottomcolor ) if( !phdr ) return; // bad model? 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 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' if( clgame.remap_info[i] ) CL_FreeRemapInfo( clgame.remap_info[i] ); // free old info 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 } 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 // e.g. playermodel 'barney' with playermodel 'gordon' 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 { @@ -409,7 +409,7 @@ void CL_FreeRemapInfo( remap_info_t *info ) 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++ ) { if( clgame.remap_info[i] ) - CL_FreeRemapInfo( clgame.remap_info[i] ); + CL_FreeRemapInfo( clgame.remap_info[i] ); } Mem_Free( clgame.remap_info ); } diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 4981a545..6c9aeb47 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -265,7 +265,7 @@ void CL_PrepareTEnt( TEMPENTITY *pTemp, model_t *pmodel ) // use these to set per-frame and termination conditions / actions pTemp->entity.trivial_accept = modelHandle; // keep unchanged - pTemp->flags = FTENT_NONE; + pTemp->flags = FTENT_NONE; pTemp->die = cl.time + 0.75f; if( pmodel ) frameCount = pmodel->numframes; @@ -341,17 +341,17 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp ) } zvel = abs( pTemp->entity.baseline.origin[2] ); - + // only play one out of every n 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 )) return; } else { - if( COM_RandomLong( 0, 5 )) + if( COM_RandomLong( 0, 5 )) return; } @@ -359,11 +359,11 @@ void CL_TempEntPlaySound( TEMPENTITY *pTemp, float damp ) { int pitch; sound_t handle; - + if( isshellcasing ) - fvol *= min ( 1.0f, ((float)zvel) / 350.0f ); - else fvol *= min ( 1.0f, ((float)zvel) / 450.0f ); - + fvol *= min ( 1.0f, ((float)zvel) / 350.0f ); + else fvol *= min ( 1.0f, ((float)zvel) / 450.0f ); + if( !COM_RandomLong( 0, 3 ) && !isshellcasing ) pitch = COM_RandomLong( 95, 105 ); else pitch = PITCH_NORM; @@ -399,7 +399,7 @@ int CL_TempEntAddEntity( cl_entity_t *pEntity ) VectorCopy( pEntity->origin, pEntity->curstate.origin ); VectorCopy( pEntity->angles, pEntity->latched.prevangles ); VectorCopy( pEntity->origin, pEntity->latched.prevorigin ); - + // add to list CL_AddVisibleEntity( pEntity, ET_TEMPENTITY ); @@ -503,7 +503,7 @@ TEMPENTITY *CL_TempEntAllocHigh( const vec3_t org, model_t *pmodel ) 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. CL_FreeLowPriorityTempEnt(); } @@ -511,7 +511,7 @@ TEMPENTITY *CL_TempEntAllocHigh( const vec3_t org, model_t *pmodel ) if( !cl_free_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" ); 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]; angle = COM_RandomFloat( -M_PI, M_PI ); SinCos( angle, &sine, &cosine ); - + zspeed = COM_RandomLong( 80, 140 ); VectorSet( pTemp->entity.baseline.origin, speed * cosine, speed * sine, zspeed ); pTemp->die = cl.time + ((height - (origin[2] - mins[2])) / zspeed) - 0.1f; pTemp->entity.curstate.frame = COM_RandomLong( 0, pTemp->frameMax ); - + // Set sprite scale pTemp->entity.curstate.scale = 1.0f / COM_RandomFloat( 2.0f, 5.0f ); 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.framerate = 1; - + pTemp->clientIndex = client; pTemp->tentOffset[0] = 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( 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; } } @@ -1026,7 +1026,7 @@ void GAME_EXPORT R_BreakModel( const vec3_t pos, const vec3_t size, const vec3_t // limit to 100 pieces if( count > 100 ) count = 100; - for( i = 0; i < count; i++ ) + for( i = 0; i < count; i++ ) { 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 pTemp->hitSound = type; - + if( pmodel->type == mod_sprite ) pTemp->entity.curstate.frame = COM_RandomLong( 0, pTemp->frameMax ); 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; - if( COM_RandomLong( 0, 255 ) < 200 ) + if( COM_RandomLong( 0, 255 ) < 200 ) { pTemp->flags |= FTENT_ROTATE; 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 -Create an animated moving sprite +Create an animated moving sprite =============== */ void GAME_EXPORT R_SparkShower( const vec3_t pos ) @@ -1202,7 +1202,7 @@ void GAME_EXPORT R_SparkShower( const vec3_t pos ) =============== 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 ) @@ -1251,7 +1251,7 @@ void GAME_EXPORT R_Sprite_Explode( TEMPENTITY *pTemp, float scale, int flags ) { // solid sprite pTemp->entity.curstate.rendermode = kRenderNormal; - pTemp->entity.curstate.renderamt = 255; + pTemp->entity.curstate.renderamt = 255; } 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) - + /* ================ CL_ClearLightStyles @@ -2576,7 +2576,7 @@ void CL_DecayLights( void ) dlight_t *dl; float time; int i; - + time = cl.time - cl.oldtime; for( i = 0, dl = cl_dlights; i < MAX_DLIGHTS; i++, dl++ ) @@ -2586,7 +2586,7 @@ void CL_DecayLights( void ) dl->radius -= time * dl->decay; 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 )); } @@ -2597,7 +2597,7 @@ void CL_DecayLights( void ) dl->radius -= time * dl->decay; 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 )); } } @@ -2675,7 +2675,7 @@ void CL_UpdateFlashlight( cl_entity_t *ent ) else falloff = 500.0f / falloff; falloff *= falloff; - // apply brigthness to dlight + // apply brigthness to dlight dl->color.r = bound( 0, falloff * 255, 255 ); dl->color.g = 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 ); dl->die = cl.time + 0.001; } - } + } if( FBitSet( ent->curstate.effects, EF_BRIGHTLIGHT )) - { + { dlight_t *dl = CL_AllocDlight( ent->index ); dl->color.r = dl->color.g = dl->color.b = 250; 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 ) { - int id = bound( 0, textureIndex, MAX_DECALS - 1 ); + int id = bound( 0, textureIndex, MAX_DECALS - 1 ); ref.dllFuncs.R_DecalRemoveAll( cl.decal_index[id] ); } @@ -3032,7 +3032,7 @@ void CL_ClearStaticEntities( void ) CL_ClearEfrags (); } - + /* ============== CL_ClearEffects diff --git a/engine/client/cl_video.c b/engine/client/cl_video.c index dbe4cca5..7884871e 100644 --- a/engine/client/cl_video.c +++ b/engine/client/cl_video.c @@ -87,7 +87,7 @@ void SCR_CheckStartupVids( void ) byte *afile; char *pfile; string token; - + if( Sys_CheckParm( "-nointro" ) || host_developer.value || cls.demonum != -1 || GameState->nextstate != STATE_RUNFRAME ) { // don't run movies where we in developer-mode @@ -122,7 +122,7 @@ void SCR_CheckStartupVids( void ) SCR_NextMovie (); Cbuf_Execute(); } - + /* ================== SCR_RunCinematic @@ -152,7 +152,7 @@ void SCR_RunCinematic( void ) return; } - // advances cinematic time (ignores maxfps and host_framerate settings) + // advances cinematic time (ignores maxfps and host_framerate settings) cin_time += host.realframetime; // stop the video after it finishes @@ -194,7 +194,7 @@ qboolean SCR_DrawCinematic( void ) return true; } - + /* ================== SCR_PlayCinematic @@ -238,7 +238,7 @@ qboolean SCR_PlayCinematic( const char *arg ) Con_FastClose(); cin_time = 0.0f; cls.signon = 0; - + return true; } @@ -258,7 +258,7 @@ wavdata_t *SCR_GetMovieInfo( void ) return &cin_audio; return NULL; } - + /* ================== SCR_StopCinematic diff --git a/engine/client/cl_view.c b/engine/client/cl_view.c index 050bdaaf..f349eb72 100644 --- a/engine/client/cl_view.c +++ b/engine/client/cl_view.c @@ -35,7 +35,7 @@ void V_CalcViewRect( void ) int sb_lines; float size; - // intermission is always full screen + // intermission is always full screen if( cl.intermission ) size = 120.0f; else size = scr_viewsize->value; diff --git a/engine/client/client.h b/engine/client/client.h index c219f70b..cde2c275 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -110,7 +110,7 @@ extern int CL_UPDATE_BACKUP; #define MIN_EX_INTERP 50.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_serverframetime() (cl.mtime[0] - cl.mtime[1]) @@ -180,7 +180,7 @@ typedef struct // render a frame yet int parsecount; // server message counter int parsecountmod; // modulo with network window - + 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 paused; @@ -306,7 +306,7 @@ typedef struct char name[32]; int number; // svc_ number 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; typedef void (*pfnEventHook)( event_args_t *args ); @@ -538,7 +538,7 @@ typedef struct 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 // to work around address translating routers // 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; Host_Error( "CL_EDICT_NUM: bad number %i\n", n ); - return NULL; + return NULL; } // diff --git a/engine/client/in_touch.c b/engine/client/in_touch.c index 915adc49..dec3a20b 100644 --- a/engine/client/in_touch.c +++ b/engine/client/in_touch.c @@ -252,7 +252,7 @@ void Touch_WriteConfig( void ) 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(x1), B(y1), B(x2), B(y2), 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 ); 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(x1), B(y1), B(x2), B(y2), 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; } } - + } void Touch_ToggleSelection_f( void ) @@ -737,13 +737,13 @@ void Touch_LoadDefaults_f( void ) for( i = 0; i < g_LastDefaultButton; i++ ) { touch_button_t *button; - float x1 = g_DefaultButtons[i].x1, + float x1 = g_DefaultButtons[i].x1, y1 = g_DefaultButtons[i].y1, x2 = g_DefaultButtons[i].x2, - y2 = g_DefaultButtons[i].y2; - + y2 = g_DefaultButtons[i].y2; + IN_TouchCheckCoords( &x1, &y1, &x2, &y2 ); - + if( g_DefaultButtons[i].aspect && g_DefaultButtons[i].round == round_aspect ) { if( g_DefaultButtons[i].texturefile[0] == '#' ) @@ -751,7 +751,7 @@ void Touch_LoadDefaults_f( void ) else y2 = y1 + ( x2 - x1 ) * (SCR_W/SCR_H) * g_DefaultButtons[i].aspect; } - + 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->flags |= g_DefaultButtons[i].flags; @@ -792,10 +792,10 @@ void Touch_AddButton_f( void ) if( argc >= 12 ) { 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) ) ); 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) ) , color ); if( argc >= 13 ) @@ -812,14 +812,14 @@ void Touch_AddButton_f( void ) B(aspect) = aspect; } } - + return; - } + } if( argc == 8 ) { MakeRGBA( color, 255, 255, 255, 255 ); 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) ), color ); 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( "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_removebutton", IN_TouchRemoveButton_f, "remove native touch button" ); 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 ( !touch.clientonly || ( button->flags & TOUCH_FL_CLIENT) ) && - ( + return ( !touch.clientonly || ( button->flags & TOUCH_FL_CLIENT) ) && + ( ( touch.state >= state_edit ) - ||( !( button->flags & TOUCH_FL_HIDE ) - && ( !(button->flags & TOUCH_FL_SP) || ( CL_GetMaxClients() == 1 ) ) - && ( !(button->flags & TOUCH_FL_MP) || ( CL_GetMaxClients() != 1 ) ) ) + ||( !( button->flags & TOUCH_FL_HIDE ) + && ( !(button->flags & TOUCH_FL_SP) || ( 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; else maxx = 1; - + if( !cls.creditsFont.valid ) return GRID_X * 2; 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 ) { touch_button_t *button; - + for( button = list->first; button; button = button->next ) { 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 ); } } - + } void Touch_Draw( void ) @@ -1403,7 +1403,7 @@ static void Touch_EditMove( touchEventType type, int fingerID, float x, float y, touch.edit->x2 += dx; } } - else + else { 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 ) dx *= touch_precise_amount->value, dy *= touch_precise_amount->value; - + if( CVAR_TO_BOOL(touch_nonlinear_look) ) { float dabs, dcos, dsin; @@ -1502,7 +1502,7 @@ static void Touch_Motion( touchEventType type, int fingerID, float x, float y, f dcos = dx / dabs; dsin = dy / dabs; - + if( touch_exp_mult->value > 1 ) 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 ) ) { button->finger = fingerID; - + // do not edit NOEDIT buttons if( button->flags & TOUCH_FL_NOEDIT ) continue; @@ -1785,7 +1785,7 @@ static qboolean Touch_ButtonEdit( touchEventType type, int fingerID, float x, fl { if( button->prev ) button->prev->next = button->next; - else + else touch.list_user.first = button->next; button->next->prev = button->prev; @@ -1946,7 +1946,7 @@ void Touch_KeyEvent( int key, int down ) void Touch_Shutdown( void ) { - if( !touch.initialized ) + if( !touch.initialized ) return; Touch_RemoveAll_f(); Cmd_RemoveCommand( "touch_addbutton" ); diff --git a/engine/client/input.c b/engine/client/input.c index 744ba6e0..79d94ee3 100644 --- a/engine/client/input.c +++ b/engine/client/input.c @@ -260,12 +260,12 @@ void IN_ActivateMouse( qboolean force ) { int width, height; static int oldstate; - + if( !in_mouseinitialized ) return; if( CL_Active() && host.mouse_visible && !force ) - return; // VGUI controls + return; // VGUI controls if( cls.key_dest == key_menu && !Cvar_VariableInteger( "fullscreen" )) { @@ -341,7 +341,7 @@ IN_MouseMove void IN_MouseMove( void ) { POINT current_pos; - + if( !in_mouseinitialized || !in_mouseactive || !UI_IsVisible( )) return; @@ -588,10 +588,10 @@ void IN_CollectInput( float *forward, float *side, float *pitch, float *yaw, qbo IN_EvdevMove( yaw, pitch ); #endif } - + Joy_FinalizeMove( forward, side, yaw, pitch ); Touch_GetMove( forward, side, yaw, pitch ); - + if( look_filter->value ) { *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 ); IN_CollectInput( &forward, &side, &pitch, &yaw, in_mouseinitialized && !CVAR_TO_BOOL( m_ignore ), m_enginemouse->value ); - + IN_JoyAppendMove( cmd, forward, side ); if( pitch || yaw ) @@ -683,7 +683,7 @@ void Host_InputFrame( void ) // release mouse during pause or console typeing if( cl.paused && cls.key_dest == key_game ) shutdownMouse = true; - + if( shutdownMouse && !Cvar_VariableInteger( "fullscreen" )) { IN_DeactivateMouse(); diff --git a/engine/client/keys.c b/engine/client/keys.c index 044cddda..3e501a2b 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -185,7 +185,7 @@ to be configured even if they don't have defined names. int Key_StringToKeynum( const char *str ) { keyname_t *kn; - + if( !str || !str[0] ) return -1; 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 ) { int n1, n2; - + n1 = str[2]; if( n1 >= '0' && n1 <= '9' ) { @@ -239,7 +239,7 @@ given keynum. */ const char *Key_KeynumToString( int keynum ) { - keyname_t *kn; + keyname_t *kn; static char tinystr[5]; int i, j; @@ -289,7 +289,7 @@ void GAME_EXPORT Key_SetBinding( int keynum, const char *binding ) Mem_Free((char *)keys[keynum].binding ); keys[keynum].binding = NULL; } - + // allocate memory for new binding keys[keynum].binding = copystring( binding ); } @@ -306,7 +306,7 @@ const char *Key_GetBinding( int keynum ) return keys[keynum].binding; } -/* +/* =================== Key_GetKey =================== @@ -351,7 +351,7 @@ void Key_Unbind_f( void ) Con_Printf( S_USAGE "unbind : remove commands from a key\n" ); return; } - + b = Key_StringToKeynum( Cmd_Argv( 1 )); if( b == -1 ) @@ -371,7 +371,7 @@ Key_Unbindall_f void Key_Unbindall_f( void ) { int i; - + for( i = 0; i < 256; i++ ) { if( keys[i].binding ) @@ -392,7 +392,7 @@ void Key_Reset_f( void ) keyname_t *kn; int i; - // clear all keys first + // clear all keys first for( i = 0; i < 256; i++ ) { if( keys[i].binding ) @@ -401,7 +401,7 @@ void Key_Reset_f( void ) // apply default values 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]; int i, c, b; - + c = Cmd_Argc(); if( c < 2 ) @@ -437,7 +437,7 @@ void Key_Bind_f( void ) else Con_Printf( "\"%s\" is not bound\n", Cmd_Argv( 1 )); return; } - + // copy the rest of the command line cmd[0] = 0; // start out with a null string @@ -515,10 +515,10 @@ void Key_Init( void ) 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( "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 - 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" ); 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; default: return false; - } + } } 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 // 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. if( !down ) { @@ -892,7 +892,7 @@ void CL_CharEvent( int key ) if( cls.key_dest == key_console && !Con_Visible( )) { 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 diff --git a/engine/client/s_load.c b/engine/client/s_load.c index 89348ca6..8f3a0d36 100644 --- a/engine/client/s_load.c +++ b/engine/client/s_load.c @@ -211,7 +211,7 @@ sfx_t *S_FindName( const char *pname, int *pfInCache ) return NULL; s_numSfx++; } - + sfx = &s_knownSfx[i]; memset( sfx, 0, sizeof( *sfx )); if( pfInCache ) *pfInCache = false; @@ -222,7 +222,7 @@ sfx_t *S_FindName( const char *pname, int *pfInCache ) // link it in sfx->hashNext = s_sfxHashList[sfx->hashValue]; s_sfxHashList[sfx->hashValue] = sfx; - + return sfx; } @@ -299,7 +299,7 @@ void S_EndRegistration( void ) if( !s_registering || !dma.initialized ) return; - + // free any sounds not from this registration sequence for( i = 0, sfx = s_knownSfx; i < s_numSfx; i++, sfx++ ) { diff --git a/engine/client/s_main.c b/engine/client/s_main.c index 361924af..05354a34 100644 --- a/engine/client/s_main.c +++ b/engine/client/s_main.c @@ -80,8 +80,8 @@ void S_FadeClientVolume( float fadePercent, float fadeOutSeconds, float holdTime { soundfade.starttime = cl.mtime[0]; soundfade.initial_percent = fadePercent; - soundfade.fadeouttime = fadeOutSeconds; - soundfade.holdtime = holdTime; + soundfade.fadeouttime = fadeOutSeconds; + soundfade.holdtime = holdTime; soundfade.fadeintime = fadeInSeconds; } @@ -97,7 +97,7 @@ qboolean S_IsClient( int entnum ) // 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. // Works for static, dynamic, sentence and stream sounds /* @@ -129,7 +129,7 @@ void S_UpdateSoundFade( void ) // determine current fade value. // assume no fading remains - soundfade.percent = 0; + soundfade.percent = 0; totaltime = soundfade.fadeouttime + soundfade.fadeintime + soundfade.holdtime; @@ -178,7 +178,7 @@ void S_UpdateSoundFade( void ) ================= 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 exceptions). ================= @@ -200,7 +200,7 @@ qboolean SND_FStreamIsPlaying( sfx_t *sfx ) ================= 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 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++ ) { channel_t *ch = &channels[ch_idx]; - + // Never override a streaming sound that is currently playing or // voice over IP data that is playing or any sound on CHAN_VOICE( acting ) 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 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 -we're trying to allocate a channel for a stream sound that is +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 already playing. ===================== */ @@ -310,7 +310,7 @@ channel_t *SND_PickStaticChannel( const vec3_t pos, sfx_t *sfx ) break; } - if( i < total_channels ) + if( i < total_channels ) { // reuse an empty static sound channel 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 ) { channel_t *ch; - int i; + int i; 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 ) ch->basePitch = pitch; - + if( flags & SND_CHANGE_VOL ) ch->master_vol = vol; - + if( flags & SND_STOP ) 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 ) ch->basePitch = pitch; - + if( flags & SND_CHANGE_VOL ) ch->master_vol = vol; @@ -476,7 +476,7 @@ void SND_Spatialize( channel_t *ch ) ==================== 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. 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. @@ -509,7 +509,7 @@ void S_StartSound( const vec3_t pos, int ent, int chan, sound_t handle, float fv 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 } @@ -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 // NOTE: sentence names stored in the cache lookup are // 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 )); Q_strncpy( target_chan->name, sfx->name, sizeof( target_chan->name )); 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 ); // 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. 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 // NOTE: sentence names stored in the cache lookup are // 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 )); 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 target_chan->pMixer.sample = sample; - target_chan->pMixer.forcedEndSample = end; + target_chan->pMixer.forcedEndSample = end; // Init client entity mouth movement vars 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. // NOTE: sentence names stored in the cache lookup are // 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 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( !dma.initialized ) return; + if( !dma.initialized ) return; sfxHandle = S_RegisterSound( name ); 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 ); 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] ) 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++ ) { - chan = &channels[ambient_channel]; + chan = &channels[ambient_channel]; chan->staticsound = true; chan->use_loop = true; @@ -954,7 +954,7 @@ void S_UpdateAmbientSounds( void ) 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] ); // ambient is unused @@ -979,7 +979,7 @@ void S_UpdateAmbientSounds( void ) chan->master_vol -= s_listener.frametime * s_ambient_fade->value; if( chan->master_vol < vol ) chan->master_vol = 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 =================== */ -uint S_GetRawSamplesLength( int entnum ) +uint S_GetRawSamplesLength( int entnum ) { rawchan_t *ch; @@ -1255,7 +1255,7 @@ uint S_GetRawSamplesLength( int entnum ) S_ClearRawChannel =================== */ -void S_ClearRawChannel( int entnum ) +void S_ClearRawChannel( int entnum ) { rawchan_t *ch; @@ -1320,7 +1320,7 @@ S_SpatializeRawChannels static void S_SpatializeRawChannels( void ) { int i; - + for( i = 0; i < MAX_RAW_CHANNELS; i++ ) { rawchan_t *ch = raw_channels[i]; @@ -1430,7 +1430,7 @@ void S_StopAllSounds( qboolean ambient ) if( !dma.initialized ) return; 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; S_FreeChannel( &channels[i] ); @@ -1471,10 +1471,10 @@ void S_UpdateChannels( void ) if((int)(endtime - soundtime) > samps ) endtime = soundtime + samps; - + 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. endtime -= ( endtime - paintedtime ) & 0x3; } @@ -1507,7 +1507,7 @@ update listener position void S_UpdateFrame( struct ref_viewpass_s *rvp ) { if( !FBitSet( rvp->flags, RF_DRAW_WORLD ) || FBitSet( rvp->flags, RF_ONLY_CLIENTDRAW )) - return; + return; VectorCopy( rvp->vieworigin, s_listener.origin ); AngleVectors( rvp->viewangles, s_listener.forward, s_listener.right, s_listener.up ); @@ -1550,7 +1550,7 @@ void SND_UpdateSound( void ) 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++ ) { 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_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_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" ); 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)" ); diff --git a/engine/client/s_mix.c b/engine/client/s_mix.c index 263af5cc..87aa09d7 100644 --- a/engine/client/s_mix.c +++ b/engine/client/s_mix.c @@ -109,7 +109,7 @@ void S_TransferPaintBuffer( int endtime ) //=============================================================================== // 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 _inline void MIX_ActivatePaintbuffer( int ipaintbuffer ) { @@ -146,7 +146,7 @@ _inline int MIX_GetCurrentPaintbufferIndex( void ) _inline paintbuffer_t *MIX_GetCurrentPaintbufferPtr( void ) { int ipaint = MIX_GetCurrentPaintbufferIndex(); - + Assert( ipaint < CPAINTBUFFERS ); return &paintbuffers[ipaint]; } @@ -183,7 +183,7 @@ _inline portable_samplepair_t *MIX_GetPFrontFromIPaint( int ipaintbuffer ) } _inline paintbuffer_t *MIX_GetPPaintFromIPaint( int ipaint ) -{ +{ Assert( ipaint < CPAINTBUFFERS ); return &paintbuffers[ipaint]; } @@ -203,7 +203,7 @@ void MIX_InitAllPaintbuffers( void ) paintbuffers[IPAINTBUFFER].pbuf = paintbuffer; paintbuffers[IROOMBUFFER].pbuf = roombuffer; paintbuffers[ISTREAMBUFFER].pbuf = streambuffer; - + MIX_SetCurrentPaintbuffer( IPAINTBUFFER ); } @@ -218,7 +218,7 @@ void S_PaintMonoFrom8( portable_samplepair_t *pbuf, int *volume, byte *pData, in { int *lscale, *rscale; int i, data; - + lscale = snd_scaletable[volume[0] >> 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; data = (uint *)pData; - + for( i = 0; i < outCount; i++, data++ ) { left = (signed short)((*data & 0x0000FFFF)); @@ -425,7 +425,7 @@ int S_MixDataToDevice( channel_t *pChannel, int sampleCount, int outRate, int ou int startingOffset = outOffset; float inputRate = ( pChannel->pitch * pChannel->sfx->cache->rate ); float rate = inputRate / outRate; - + // shouldn't be playing this if finished, but return if we are if( pChannel->pMixer.finished ) 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' // 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. -// 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! 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 ch = channels; - + // validate parameters Assert( outputRate <= SOUND_DMA_SPEED ); // make sure we're not discarding data Assert( !(( endtime - paintedtime ) & 0x3 ) || ( outputRate == SOUND_DMA_SPEED )); - + // 44k: try to mix this many samples at outputRate sampleCount = ( endtime - paintedtime ) / ( SOUND_DMA_SPEED / outputRate ); - + if( sampleCount <= 0 ) return; 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 ); - // 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. bZeroVolume = !ch->leftvol && !ch->rightvol; - + if( !bZeroVolume ) { // 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 == 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. return (&(pbuffer[(i-2) * 2 + 1])); } @@ -708,32 +708,32 @@ void S_Interpolate2xCubic( portable_samplepair_t *pbuffer, portable_samplepair_t x0 = psamp1->left; x1 = psamp2->left; x2 = psamp3->left; - + // interpolate a = (3 * (x0-x1) - xm1 + x2) / 2; b = 2*x1 + xm1 - (5*x0 + x2) / 2; c = (x1 - xm1) / 2; - + // write out interpolated sample temppaintbuffer[outpos].left = a/8 + b/4 + c/2 + x0; - + // get all right samples for window xm1 = psamp0->right; x0 = psamp1->right; x1 = psamp2->right; x2 = psamp3->right; - + // interpolate a = (3 * (x0-x1) - xm1 + x2) / 2; b = 2*x1 + xm1 - (5*x0 + x2) / 2; c = (x1 - xm1) / 2; - + // write out interpolated sample, increment output counter temppaintbuffer[outpos++].right = a/8 + b/4 + c/2 + x0; - + Assert( outpos <= ( sizeof( temppaintbuffer ) / sizeof( temppaintbuffer[0] ))); } - + Assert( cfltmem >= 3 ); // 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 - *pfiltermem = pbuffer[upCount - 1]; + *pfiltermem = pbuffer[upCount - 1]; } // 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 ) { int upCount = count<<1; - int i, j; + int i, j; // reverse through buffer, duplicating contents for 'count' samples for( i = upCount - 1, j = count - 1; j >= 0; i-=2, j-- ) - { + { pbuffer[i] = 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; gain = 256 * fgain; - + Assert( count <= PAINTBUFFER_SIZE ); Assert( ibuf1 < 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; pbuf2 = paintbuffers[ibuf2].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: // pb1 2ch + pb2 2ch -> pb3 2ch @@ -874,7 +874,7 @@ void MIX_CompressPaintbuffer( int ipaint, int count ) ppaint = MIX_GetPPaintFromIPaint( ipaint ); pbuf = ppaint->pbuf; - + for( i = 0; i < count; i++, pbuf++ ) { pbuf->left = CLIP( pbuf->left ); @@ -909,7 +909,7 @@ void MIX_MixStreamBuffer( int end ) memset( pbuf, 0, (end - paintedtime) * sizeof( portable_samplepair_t )); } else - { + { int i, stop; // 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].right = ( ch->rawsamples[i & ( ch->max_samples - 1 )].right * ch->rightvol ) >> 8; - } + } for( ; i < end; i++ ) 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 MIX_ActivatePaintbuffer( IROOMBUFFER ); // operates on MIX_MixChannelsToPaintbuffer - // mix 11khz sounds: + // mix 11khz sounds: MIX_MixChannelsToPaintbuffer( end, SOUND_11k, SOUND_11k ); // upsample all 11khz buffers by 2x @@ -993,9 +993,9 @@ void MIX_UpsampleAllPaintbuffers( int end, int count ) MIX_SetCurrentPaintbuffer( IROOMBUFFER ); // operates on MixUpSample S_MixUpsample( count / ( SOUND_DMA_SPEED / SOUND_11k ), s_lerping->value ); - // mix 22khz sounds: + // mix 22khz sounds: MIX_MixChannelsToPaintbuffer( end, SOUND_22k, SOUND_22k ); - + // upsample all 22khz buffers by 2x // only upsample roombuffer if dsp fx are on KDB: perf MIX_SetCurrentPaintbuffer( IROOMBUFFER ); @@ -1040,7 +1040,7 @@ void MIX_PaintChannels( int endtime ) MIX_MixPaintbuffers( IPAINTBUFFER, IROOMBUFFER, IPAINTBUFFER, count, S_GetMasterVolume() ); // 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 MIX_CompressPaintbuffer( IPAINTBUFFER, count ); diff --git a/engine/client/s_utils.c b/engine/client/s_utils.c index 73b543e7..0026334a 100644 --- a/engine/client/s_utils.c +++ b/engine/client/s_utils.c @@ -36,10 +36,10 @@ int S_ZeroCrossingBefore( wavdata_t *pWaveData, int sample ) 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 if( sampleSize <= 0 ) sampleSize = 1; - + if( pWaveData->width == 1 ) { 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; - // 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 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 samplePosition -= pSource->loopStart; - + if( loopSize ) { // "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; - // 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 if( sampleSize <= 0 ) sampleSize = 1; diff --git a/engine/client/s_vox.c b/engine/client/s_vox.c index 327b0f33..4f7d5f81 100644 --- a/engine/client/s_vox.c +++ b/engine/client/s_vox.c @@ -115,7 +115,7 @@ char *VOX_LookupString( const char *pSentenceName, int *psentencenum ) if( Q_isdigit( pSentenceName ) && (i = Q_atoi( pSentenceName )) < g_numSentences ) { 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++ ) @@ -133,7 +133,7 @@ char *VOX_LookupString( const char *pSentenceName, int *psentencenum ) // parse a null terminated string of text into component words, with // pointers to each word stored in rgpparseword // note: this code actually alters the passed in string! -char **VOX_ParseString( char *psz ) +char **VOX_ParseString( char *psz ) { int i, fdone = 0; char c, *p = psz; @@ -151,7 +151,7 @@ char **VOX_ParseString( char *psz ) c = *p; while( c && !IsNextWord( c )) c = *(++p); - + // if '(' then scan for matching ')' if( c == '(' ) { @@ -165,7 +165,7 @@ char **VOX_ParseString( char *psz ) fdone = 1; } else - { + { // if . or , insert pause into rgpparseword, // unless this is the last character 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 // and null out trailing format characters -// Format: +// Format: // someword(v100 p110 s10 e20) -// +// // v is volume, 0% to n% // p is pitch shift up 0% to n% // 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 // 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 // for all following words. Default parameter values are reset // by another 'default' parameter block. Default parameter values // 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 c, ct, sznum[8]; static voxword_t voxwordDefault; int i; - + // init to defaults if this is the first word in string. if( fFirst ) { @@ -276,12 +276,12 @@ int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst ) *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: c = *( psz + Q_strlen( psz ) - 1 ); // no formatting, return - if( c != ')' ) return 1; + if( c != ')' ) return 1; // scan forward to first '(' c = *psz; @@ -290,7 +290,7 @@ int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst ) // bogus formatting if( c == ')' ) return 0; - + // null terminate *psz = 0; 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 while( ct && !IsCommandChar( ct )) ct = *(++psz); - + if( ct == ')' ) break; @@ -308,7 +308,7 @@ int VOX_ParseWordParams( char *psz, voxword_t *pvoxword, int fFirst ) i = 0; c = *(++psz); - + if( !isdigit( c )) break; @@ -359,8 +359,8 @@ void VOX_LoadWord( channel_t *pchan ) // apply mixer pchan->currentWord = &pchan->pMixer; - pchan->currentWord->pData = pSource; - + pchan->currentWord->pData = pSource; + // don't allow overlapped ranges if( end <= start ) end = 0; @@ -411,7 +411,7 @@ void VOX_LoadFirstWord( channel_t *pchan, voxword_t *pwords ) { pchan->words[i] = pwords[i]; i++; - } + } pchan->words[i].sfx = NULL; pchan->wordIndex = 0; @@ -467,7 +467,7 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin ) memset( rgvoxword, 0, sizeof( voxword_t ) * CVOXWORDMAX ); memset( buffer, 0, sizeof( buffer )); - // lookup actual string in g_Sentences, + // lookup actual string in g_Sentences, // set pointer to string data psz = VOX_LookupString( pszin, NULL ); @@ -494,7 +494,7 @@ void VOX_LoadSound( channel_t *pchan, const char *pszin ) VOX_ParseString( psz ); // 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; 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. // // 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 //----------------------------------------------------------------------------- void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex ) @@ -555,15 +555,15 @@ void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex ) // Copy good string to temp buffer memcpy( tempBuffer + tempBufferPos, pSentenceData, length ); - + // move the copy position tempBufferPos += length; pSentenceData = pNext; - + // skip ahead of the opening brace if( *pSentenceData ) pSentenceData++; - + // skip whitespace while( *pSentenceData && *pSentenceData <= 32 ) pSentenceData++; @@ -584,7 +584,7 @@ void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex ) } pSentenceData = ScanForwardUntil( pSentenceData, '}' ); - + // skip the closing brace if( *pSentenceData ) pSentenceData++; @@ -597,7 +597,7 @@ void VOX_ParseLineCommands( char *pSentenceData, int sentenceIndex ) { // terminate cleaned up copy tempBuffer[tempBufferPos] = 0; - + // copy it over the original data Q_strcpy( pStart, tempBuffer ); } @@ -661,7 +661,7 @@ void VOX_ReadSentenceFile( const char *psentenceFileName ) // scan forward to end of sentence or eof while( pch < pchlast && pch[0] != '\n' && pch[0] != '\r' ) pch++; - + // insert null terminator if( pch < pchlast ) *pch++ = 0; diff --git a/engine/client/sound.h b/engine/client/sound.h index fba869f7..9ae1232b 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -155,7 +155,7 @@ typedef struct channel_s int rightvol; // 0-255 right volume 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 float dist_mult; // distance multiplier (attenuation/clipK) int master_vol; // 0-255 master volume diff --git a/engine/client/titles.c b/engine/client/titles.c index 5b860c18..4442ef76 100644 --- a/engine/client/titles.c +++ b/engine/client/titles.c @@ -32,7 +32,7 @@ static int IsComment( const char *pText ) if( length >= 2 && pText[0] == '/' && pText[1] == '/' ) return 1; - + // no text? if( length > 0 ) return 0; @@ -213,7 +213,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize ) char buf[512], trim[512], currentName[512]; char *pCurrentText = NULL, *pNameHeap; 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; client_textmessage_t textMessages[MAX_MESSAGES]; 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 clgame.titles = (client_textmessage_t *)Mem_Calloc( cls.mempool, textHeapSize + nameHeapSize + messageSize ); - + // copy table over memcpy( clgame.titles, textMessages, messageSize ); - + // copy Name heap pNameHeap = ((char *)clgame.titles) + messageSize; memcpy( pNameHeap, nameHeap, nameHeapSize ); diff --git a/engine/client/vgui/vgui_draw.c b/engine/client/vgui/vgui_draw.c index e5dc7488..cbf495af 100644 --- a/engine/client/vgui/vgui_draw.c +++ b/engine/client/vgui/vgui_draw.c @@ -93,7 +93,7 @@ void GAME_EXPORT VGUI_CursorSelect(enum VGUI_DefaultCursor cursor ) qboolean visible; if( cls.key_dest != key_game || cl.paused ) return; - + switch( cursor ) { case dc_user: diff --git a/engine/common/cmd.c b/engine/common/cmd.c index c51f3bc5..7d058910 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -75,7 +75,7 @@ Cbuf_GetSpace void *Cbuf_GetSpace( cmdbuf_t *buf, int length ) { void *data; - + if(( buf->cursize + length ) > buf->maxsize ) { buf->cursize = 0; @@ -84,7 +84,7 @@ void *Cbuf_GetSpace( cmdbuf_t *buf, int length ) data = buf->data + buf->cursize; buf->cursize += length; - + return data; } @@ -249,13 +249,13 @@ void Cbuf_ExecStuffCmds( void ) if( l + Q_strlen( host.argv[i] ) + 4 > sizeof( build ) - 1 ) break; build[l++] = ' '; - + if( Q_strchr( host.argv[i], ' ' )) build[l++] = '\"'; - + for( j = 0; host.argv[i][j]; j++ ) build[l++] = host.argv[i][j]; - + if( Q_strchr( host.argv[i], ' ' )) build[l++] = '\"'; } @@ -321,7 +321,7 @@ Just prints the rest of the line to the console void Cmd_Echo_f( void ) { int i; - + for( i = 1; i < Cmd_Argc(); i++ ) Con_Printf( "%s", Cmd_Argv( i )); Con_Printf( "\n" ); @@ -487,7 +487,7 @@ const char *Cmd_Argv( int arg ) { if((uint)arg >= cmd_argc ) 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 ? if( !callback ) return; - + for( cmd = cmd_functions; cmd; cmd = cmd->next ) { 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 )) // >, >= cmd_condition |= BIT( cmd_condlevel ); - + if(( cmd_argv[2][0] == '<' ) && ( f1 < f2 )) // <, <= 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 ) -{ +{ cmd_t *cmd = NULL; cmdalias_t *a = NULL; convar_t *cvar = NULL; @@ -940,7 +940,7 @@ void Cmd_ExecuteString( char *text ) } // execute the command line - Cmd_TokenizeString( text ); + Cmd_TokenizeString( text ); 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 ) { char str[MAX_CMD_BUFFER]; - + if( cls.demoplayback ) { if( !Q_stricmp( Cmd_Argv( 0 ), "pause" )) @@ -1049,7 +1049,7 @@ void Cmd_ForwardToServer( void ) Q_strcat( str, Cmd_Argv( 0 )); Q_strcat( str, " " ); } - + if( Cmd_Argc() > 1 ) Q_strcat( str, Cmd_Args( )); else Q_strcat( str, "\n" ); diff --git a/engine/common/common.c b/engine/common/common.c index c5bb1563..40096a41 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -125,7 +125,7 @@ float GAME_EXPORT COM_RandomFloat( float flLow, float flHigh ) int GAME_EXPORT COM_RandomLong( int lLow, int lHigh ) { dword maxAcceptable; - dword n, x = lHigh - lLow + 1; + dword n, x = lHigh - lLow + 1; if( idum == 0 ) COM_SetRandomSeed( 0 ); @@ -184,7 +184,7 @@ typedef struct typedef struct { - lzss_list_t *hash_table; + lzss_list_t *hash_table; lzss_node_t *hash_node; int window_size; } 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; byte *pOutput = pStart + sizeof( lzss_header_t ); const byte *pEncodedPosition = NULL; - byte *pLookAhead = pInput; + byte *pLookAhead = pInput; byte *pWindow = pInput; int i, putCmdByte = 0; byte *pCmdByte = NULL; @@ -309,9 +309,9 @@ byte *LZSS_CompressNoAlloc( lzss_state_t *state, byte *pInput, int input_length, *pCmdByte = (*pCmdByte >> 1) | 0x80; *pOutput++ = (( pLookAhead - pEncodedPosition - 1 ) >> LZSS_LOOKSHIFT ); *pOutput++ = (( pLookAhead - pEncodedPosition - 1 ) << LZSS_LOOKSHIFT ) | ( encoded_length - 1 ); - } - else - { + } + else + { *pCmdByte = ( *pCmdByte >> 1 ); *pOutput++ = *pLookAhead; encoded_length = 1; @@ -392,7 +392,7 @@ uint LZSS_Decompress( const byte *pInput, byte *pOutput ) while( 1 ) { - if( !getCmdByte ) + if( !getCmdByte ) cmdByte = *pInput++; getCmdByte = ( getCmdByte + 1 ) & 0x07; @@ -405,15 +405,15 @@ uint LZSS_Decompress( const byte *pInput, byte *pOutput ) position |= ( *pInput >> LZSS_LOOKSHIFT ); count = ( *pInput++ & 0x0F ) + 1; - if( count == 1 ) + if( count == 1 ) break; pSource = pOutput - position - 1; for( i = 0; i < count; i++ ) *pOutput++ = *pSource++; totalBytes += count; - } - else + } + else { *pOutput++ = *pInput++; totalBytes++; @@ -482,10 +482,10 @@ char *COM_ParseFile( char *data, char *token ) if( !token ) return NULL; - + len = 0; token[0] = 0; - + if( !data ) return NULL; // skip whitespace @@ -496,7 +496,7 @@ skipwhite: return NULL; // end of file; data++; } - + // skip // comments if( c=='/' && data[1] == '/' ) { @@ -551,7 +551,7 @@ skipwhite: if( COM_IsSingleChar( c )) break; } while( c > 32 ); - + token[len] = 0; 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 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 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 ) { pIn = &pszInput[i]; - *p = COM_Nibble( pIn[0] ) << 4 | COM_Nibble( pIn[1] ); + *p = COM_Nibble( pIn[0] ) << 4 | COM_Nibble( pIn[1] ); p++; } } @@ -817,7 +817,7 @@ char *COM_MemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, i // copy it out memcpy( pBuffer, pMemFile + *filePos, size ); - + // If the buffer isn't full, terminate (this is always true) if( size < bufferSize ) pBuffer[size] = 0; @@ -925,7 +925,7 @@ COM_FreeFile */ void GAME_EXPORT COM_FreeFile( void *buffer ) { - free( buffer ); + free( buffer ); } /* diff --git a/engine/common/common.h b/engine/common/common.h index b23e3147..8cb859f6 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -94,13 +94,13 @@ enum { D_INFO = 1, // "-dev 1", shows various system messages 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_NOTE // "-dev 5", show system notifications for engine developers }; typedef enum -{ +{ HOST_NORMAL, // listen server, singleplayer HOST_DEDICATED, } instance_t; @@ -205,7 +205,7 @@ typedef struct gameinfo_s // filesystem info 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 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 trainmap[MAX_QPATH];// map to start hazard course (if specified) char title[64]; // Game Main Title @@ -270,14 +270,14 @@ typedef enum { HOST_INIT = 0, // initalize operations HOST_FRAME, // host running - HOST_SHUTDOWN, // shutdown operations + HOST_SHUTDOWN, // shutdown operations HOST_ERR_FATAL, // sys error HOST_SLEEP, // sleeped by different reason, e.g. minimize window HOST_NOFOCUS, // same as HOST_FRAME, but disable mouse HOST_CRASHED // an exception handler called } host_status_t; -typedef enum +typedef enum { STATE_RUNFRAME = 0, STATE_LOAD_LEVEL, @@ -385,7 +385,7 @@ typedef struct host_parm_s { HINSTANCE hInst; HANDLE hMutex; - + host_status_t status; // global host state game_status_t game; // game manager uint type; // running at @@ -444,7 +444,7 @@ typedef struct host_parm_s char rootdir[MAX_OSPATH]; // member root directory 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 *soundpool; // soundlib mempool diff --git a/engine/common/con_utils.c b/engine/common/con_utils.c index 529407b5..e09fae3c 100644 --- a/engine/common/con_utils.c +++ b/engine/common/con_utils.c @@ -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 ); if( !t ) return false; - COM_FileBase( t->filenames[0], matchbuf ); - if( completedname && length ) + COM_FileBase( t->filenames[0], matchbuf ); + if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); if( t->numfilenames == 1 ) return true; for( i = 0, nummaps = 0; i < t->numfilenames; i++ ) { 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; char *ents = NULL, *pfile; qboolean validmap = false; @@ -89,7 +89,7 @@ qboolean Cmd_GetMapList( const char *s, char *completedname, int length ) generator[0] = '\0'; f = FS_Open( t->filenames[i], "rb", con_gamemaps->value ); - + if( f ) { 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 ); if( !t ) return false; - COM_FileBase( t->filenames[0], matchbuf ); + COM_FileBase( t->filenames[0], matchbuf ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); 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 ); if( !t ) return false; - COM_FileBase( t->filenames[0], matchbuf ); + COM_FileBase( t->filenames[0], matchbuf ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); 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 ); if( !t ) return false; - COM_FileBase( t->filenames[0], matchbuf ); + COM_FileBase( t->filenames[0], matchbuf ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); if( t->numfilenames == 1 ) return true; 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" )) 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 if( !t ) return false; - COM_FileBase( t->filenames[0], matchbuf ); + COM_FileBase( t->filenames[0], matchbuf ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); 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 ); if( !t ) return false; - COM_FileBase( t->filenames[0], matchbuf ); + COM_FileBase( t->filenames[0], matchbuf ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); 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 ); if( !t ) return false; - Q_strncpy( matchbuf, t->filenames[0] + sizeof( DEFAULT_SOUNDPATH ) - 1, MAX_STRING ); - COM_StripExtension( matchbuf ); + Q_strncpy( matchbuf, t->filenames[0] + sizeof( DEFAULT_SOUNDPATH ) - 1, MAX_STRING ); + COM_StripExtension( matchbuf ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); if( t->numfilenames == 1 ) return true; 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" )) 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 ); Con_Printf( "%16s\n", matchbuf ); 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 ); if( !t ) return false; - COM_FileBase( t->filenames[0], matchbuf ); + COM_FileBase( t->filenames[0], matchbuf ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); 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 ); if( !t ) return false; - COM_FileBase( t->filenames[0], matchbuf ); + COM_FileBase( t->filenames[0], matchbuf ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); 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++ ) { 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; - Q_strncpy( matchbuf, gamedirs[0], MAX_STRING ); + Q_strncpy( matchbuf, gamedirs[0], MAX_STRING ); if( completedname && length ) Q_strncpy( completedname, matchbuf, length ); if( numgamedirs == 1 ) return true; 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 ); } @@ -848,7 +848,7 @@ qboolean Cmd_CheckMapsList_R( qboolean fRefresh, qboolean onlyingamedir ) file_t *f; if( FS_FileSize( "maps.lst", onlyingamedir ) > 0 && !fRefresh ) - return true; // exist + return true; // exist // setup mpfilter 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++ ) { if( list->arg == arg && Cmd_CheckName( list->name )) - return list->func( source, buffer, bufsize ); + return list->func( source, buffer, bufsize ); } return false; @@ -1309,7 +1309,7 @@ static void Cmd_WriteHelp(const char *name, const char *unused, const char *desc if( !desc || !Q_strcmp( desc, "" )) return; // ignore fantom cmds if( name[0] == '+' || name[0] == '-' ) - return; // key bindings + return; // key bindings 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" ); } - if( mlook && ( mlook->state & 1 )) + if( mlook && ( mlook->state & 1 )) FS_Printf( f, "+mlook\n" ); 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 CSCR_LoadDefaultCVars( "settings.scr" ); - + if(( f = FS_Open( newconfigfile, "w", false )) != NULL ) { FS_Printf( f, "//=======================================================================\n" ); diff --git a/engine/common/cvar.c b/engine/common/cvar.c index f0a64e4b..1d765037 100644 --- a/engine/common/cvar.c +++ b/engine/common/cvar.c @@ -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 *cur, *find, *var; - + ASSERT( name && *name ); // check for command coexisting @@ -463,13 +463,13 @@ void Cvar_RegisterVariable( convar_t *var ) if( FBitSet( var->flags, FCVAR_EXTENDED )) var->def_string = var->string; // just swap pointers - var->string = copystring( var->string ); + var->string = copystring( var->string ); var->value = Q_atof( var->string ); // 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 ); - // now link variable + // now link variable if( cur ) cur->next = var; else cvar_vars = var; var->next = find; @@ -496,7 +496,7 @@ way to change value for many cvars void Cvar_DirectSet( convar_t *var, const char *value ) { const char *pszValue; - + if( !var ) return; // ??? // 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 ); return; } - + if( FBitSet( var->flags, FCVAR_CHEAT ) && !host.allow_cheats ) { 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 ) { char val[32]; - + if( fabs( value - (int)value ) < 0.000001 ) Q_snprintf( val, sizeof( val ), "%d", (int)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 ) { convar_t *var; - + for( var = cvar_vars; var; var = var->next ) { if( FBitSet( var->flags, group )) @@ -954,7 +954,7 @@ void Cvar_Init( void ) { cvar_vars = NULL; 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( "toggle", Cvar_Toggle_f, "toggles a console variable's values (use for more info)" ); diff --git a/engine/common/dedicated.c b/engine/common/dedicated.c index 7d018a01..ab541af3 100644 --- a/engine/common/dedicated.c +++ b/engine/common/dedicated.c @@ -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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. -*/ +*/ #if XASH_DEDICATED #include "common.h" #include "xash3d_mathlib.h" @@ -205,12 +205,12 @@ void Host_InputFrame( void ) void VID_InitDefaultResolution( void ) { - + } void Con_Init( void ) { - + } void R_ClearAllDecals( void ) diff --git a/engine/common/filesystem.c b/engine/common/filesystem.c index fb2cca15..a444153a 100644 --- a/engine/common/filesystem.c +++ b/engine/common/filesystem.c @@ -1058,7 +1058,7 @@ static qboolean FS_AddPak_Fullpath( const char *pakfile, qboolean *already_loade pack_t *pak = NULL; const char *ext = COM_FileExtension( pakfile ); int i, errorcode = PAK_LOAD_COULDNT_OPEN; - + for( search = fs_searchpaths; search; search = search->next ) { 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; const char *ext = COM_FileExtension( zipfile ); int errorcode = ZIP_LOAD_COULDNT_OPEN; - + for( search = fs_searchpaths; search; search = search->next ) { 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 } } - + if( already_loaded ) *already_loaded = false; - + if( !Q_stricmp( ext, "pk3" ) ) zip = FS_LoadZip( zipfile, &errorcode ); - + if( zip ) { string fullpath; @@ -1300,7 +1300,7 @@ void FS_ClearSearchPath( void ) if( search->pack ) { - if( search->pack->files ) + if( search->pack->files ) Mem_Free( search->pack->files ); if( search->pack->handle >= 0 ) 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 ); 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 ) ) 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; - if( !GameInfo ) return false; + if( !GameInfo ) return false; afile = (char *)FS_LoadFile( filename, NULL, false ); if( !afile ) return false; @@ -2002,7 +2002,7 @@ void FS_LoadGameInfo( const char *rootfolder ) { SI.clientlib[0] = 0; } - + FS_Rescan(); // create new filesystem Image_CheckPaletteQ1 (); @@ -2020,7 +2020,7 @@ void FS_Init( void ) qboolean hasBaseDir = false; qboolean hasGameDir = false; int i; - + FS_InitMemory(); Cmd_AddCommand( "fs_rescan", FS_Rescan_f, "rescan filesystem search pathes" ); @@ -2051,7 +2051,7 @@ void FS_Init( void ) SI.numgames = 0; Q_strncpy( fs_basedir, SI.basedirName, sizeof( fs_basedir )); // default dir - + if( !Sys_GetParmFromCmdLine( "-game", fs_gamedir )) 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 ) { struct stat buf; - + if( stat( filename, &buf ) == -1 ) return -1; @@ -2457,7 +2457,7 @@ static searchpath_t *FS_FindFile( const char *name, int *index, qboolean gamedir } else if( search->wad ) { - dlumpinfo_t *lump; + dlumpinfo_t *lump; signed char type = W_TypeFromExt( name ); qboolean anywadname = true; string wadname, wadfolder; @@ -2588,7 +2588,7 @@ file_t *FS_OpenReadFile( const char *filename, const char *mode, qboolean gamedi // not found? if( search == NULL ) - return NULL; + return NULL; if( search->pack ) 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? Q_sprintf( path, "%s%s", search->filename, filename ); return FS_SysOpen( path, mode ); - } + } 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 return FS_SysOpen( real_path, mode ); } - + // else, we look at the various search paths and open the file in read-only mode 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: offset += file->real_length; break; - default: + default: return -1; } - + if( offset < 0 || offset > file->real_length ) 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 // 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 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; } fs_ext_path = false; // always reset direct paths - + return hInst; } @@ -3322,7 +3322,7 @@ return size of file in bytes fs_offset_t FS_FileSize( const char *filename, qboolean gamedironly ) { int length = -1; // in case file was missed - file_t *fp; + file_t *fp; fp = FS_Open( filename, "rb", gamedironly ); @@ -3361,7 +3361,7 @@ int FS_FileTime( const char *filename, qboolean gamedironly ) { searchpath_t *search; int pack_ind; - + search = FS_FindFile( filename, &pack_ind, gamedironly ); 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 ) { - fs_mempool = Mem_AllocPool( "FileSystem Pool" ); + fs_mempool = Mem_AllocPool( "FileSystem Pool" ); 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 if( !Q_strcmp( ext, "*" ) || !Q_strcmp( ext, "" )) return TYP_ANY; - + for( type = wad_types; type->ext; type++ ) { 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) left = 0; right = wad->numlumps - 1; - + while( left <= right ) { int middle = (left + right) / 2; @@ -3921,7 +3921,7 @@ wfile_t *W_Open( const char *filename, int *error ) wad->handle = FS_SysOpen( filename, "rb" ); if( wad->handle == NULL ) - { + { Con_Reportf( S_ERROR "W_Open: couldn't open %s\n", filename ); if( error ) *error = WAD_LOAD_COULDNT_OPEN; 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) 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] ); } @@ -4033,7 +4033,7 @@ void W_Close( wfile_t *wad ) Mem_FreePool( &wad->mempool ); if( wad->handle != NULL ) - FS_Close( wad->handle ); + FS_Close( wad->handle ); 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 ); 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; } diff --git a/engine/common/gamma.c b/engine/common/gamma.c index 59b12059..7440def4 100644 --- a/engine/common/gamma.c +++ b/engine/common/gamma.c @@ -39,7 +39,7 @@ void BuildGammaTable( float lightgamma, float brightness ) else g3 = 0.125f - (brightness * brightness) * 0.075f; g = 1.0f / lightgamma; - g1 = GAMMA * g; + g1 = GAMMA * g; for( i = 0; i < 256; i++ ) { diff --git a/engine/common/host.c b/engine/common/host.c index fd6326b1..2465bbb0 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -225,21 +225,21 @@ void Host_EndGame( qboolean abort, const char *message, ... ) { va_list argptr; static char string[MAX_SYSPATH]; - + va_start( argptr, message ); Q_vsnprintf( string, sizeof( string ), message, argptr ); va_end( argptr ); Con_Printf( "Host_EndGame: %s\n", string ); - SV_Shutdown( "\n" ); + SV_Shutdown( "\n" ); #if !XASH_DEDICATED CL_Disconnect(); // recreate world if needs CL_ClearEdicts (); #endif - + // release all models Mod_FreeAll(); @@ -331,7 +331,7 @@ void Host_ChangeGame_f( void ) } 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 { @@ -367,7 +367,7 @@ void Host_Exec_f( void ) return; } - Q_strncpy( cfgpath, Cmd_Argv( 1 ), sizeof( cfgpath )); + Q_strncpy( cfgpath, Cmd_Argv( 1 ), sizeof( cfgpath )); COM_DefaultExtension( cfgpath, ".cfg" ); // append as default f = FS_LoadFile( cfgpath, &len, false ); @@ -606,7 +606,7 @@ qboolean Host_FilterTime( float time ) else { 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( recursive ) - { + { Con_Printf( "Host_RecursiveError: %s", hosterror2 ); Sys_Error( "%s", hosterror1 ); 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_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_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" ); @@ -1074,7 +1074,7 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa Cbuf_AddText( "exec config.cfg\n" ); Cbuf_Execute(); } - // exec all files from userconfig.d + // exec all files from userconfig.d Host_Userconfigd_f(); break; case HOST_DEDICATED: diff --git a/engine/common/hpak.c b/engine/common/hpak.c index 2c486931..2aa4ea4b 100644 --- a/engine/common/hpak.c +++ b/engine/common/hpak.c @@ -44,7 +44,7 @@ const char *HPAK_TypeFromIndex( int type ) case t_decal: return "decal"; case t_generic: return "generic"; case t_eventscript: return "event"; - case t_world: return "map"; + case t_world: return "map"; } return "?"; } @@ -439,7 +439,7 @@ static qboolean HPAK_Validate( const char *filename, qboolean quiet ) pRes = &dataDir[i].resource; 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 )) { @@ -518,7 +518,7 @@ qboolean HPAK_ResourceForHash( const char *filename, byte *hash, resource_t *pRe if( !COM_CheckString( filename )) return false; - + for( p = gp_hpak_queue; p != NULL; p = p->next ) { if( !Q_stricmp( p->name, filename ) && !memcmp( p->resource.rgucMD5_hash, hash, 16 )) diff --git a/engine/common/identification.c b/engine/common/identification.c index 432b401a..dc9857f3 100644 --- a/engine/common/identification.c +++ b/engine/common/identification.c @@ -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 ) return 0; - + if( RegQueryValueEx( hKey, value, NULL, NULL, data, &cbData ) != ERROR_SUCCESS ) { RegCloseKey( hKey ); @@ -381,13 +381,13 @@ int ID_SetKeyData( HKEY hRootKey, char *subKey, DWORD dwType, char *value, LPBYT HKEY hKey; if( RegCreateKey( hRootKey, subKey, &hKey ) != ERROR_SUCCESS ) return 0; - + if( RegSetValueEx( hKey, value, 0, dwType, data, cbData ) != ERROR_SUCCESS ) { RegCloseKey( hKey ); return 0; } - + RegCloseKey( hKey ); return 1; } @@ -403,18 +403,18 @@ int ID_RunWMIC(char *buffer, const char *cmdline) DWORD dwRead; BOOL bSuccess = FALSE; SECURITY_ATTRIBUTES saAttr; - + STARTUPINFO si = {0}; - + PROCESS_INFORMATION pi = {0}; saAttr.nLength = sizeof(SECURITY_ATTRIBUTES); saAttr.bInheritHandle = TRUE; saAttr.lpSecurityDescriptor = NULL; - + CreatePipe( &g_IN_Rd, &g_IN_Wr, &saAttr, 0 ); CreatePipe( &g_OUT_Rd, &g_OUT_Wr, &saAttr, 0 ); SetHandleInformation( g_IN_Wr, HANDLE_FLAG_INHERIT, 0 ); - + si.cb = sizeof(STARTUPINFO); si.dwFlags = STARTF_USESTDHANDLES; si.hStdInput = g_IN_Rd; @@ -424,12 +424,12 @@ int ID_RunWMIC(char *buffer, const char *cmdline) si.dwFlags |= STARTF_USESTDHANDLES; CreateProcess( NULL, (char*)cmdline, NULL, NULL, true, CREATE_NO_WINDOW , NULL, NULL, &si, &pi ); - + CloseHandle( g_OUT_Wr ); CloseHandle( g_IN_Wr ); - + WaitForSingleObject( pi.hProcess, 500 ); - + bSuccess = ReadFile( g_OUT_Rd, buffer, BUFSIZE, &dwRead, NULL ); buffer[BUFSIZE-1] = 0; CloseHandle( g_IN_Rd ); @@ -541,7 +541,7 @@ uint ID_CheckRawId( bloomfilter_t filter ) if( ID_ProcessCPUInfo( &value ) ) count += (filter & value) == value; #endif - + #if XASH_WIN32 count += ID_CheckWMIC( filter, "wmic path win32_physicalmedia get SerialNumber" ); count += ID_CheckWMIC( filter, "wmic bios get serialnumber" ); @@ -627,12 +627,12 @@ void ID_Init( void ) id ^= SYSTEM_XOR_MASK; ID_Check(); } - + #elif XASH_WIN32 { CHAR szBuf[MAX_PATH]; ID_GetKeyData( HKEY_CURRENT_USER, "Software\\Xash3D\\", "xash_id", szBuf, MAX_PATH ); - + sscanf(szBuf, "%016llX", &id); id ^= SYSTEM_XOR_MASK; ID_Check(); diff --git a/engine/common/imagelib/imagelib.h b/engine/common/imagelib/imagelib.h index 233c05bc..376ac04d 100644 --- a/engine/common/imagelib/imagelib.h +++ b/engine/common/imagelib/imagelib.h @@ -80,7 +80,7 @@ typedef struct imglib_s int source_width; // locked cubemap dims (all wrong sides will be automatically resampled) int source_height; 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 // indexed images state diff --git a/engine/common/imagelib/img_bmp.c b/engine/common/imagelib/img_bmp.c index 12e9a7ce..74583716 100644 --- a/engine/common/imagelib/img_bmp.c +++ b/engine/common/imagelib/img_bmp.c @@ -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 ); return false; - } + } 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. - if( bhdr.compression != BI_RGB ) + if( bhdr.compression != BI_RGB ) { Con_DPrintf( S_ERROR "Image_LoadBMP: only uncompressed BMP files supported (%s)\n", name ); return false; @@ -352,7 +352,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) break; case PF_RGBA_32: pixel_size = 4; - break; + break; default: return false; } @@ -361,7 +361,7 @@ qboolean Image_SaveBMP( const char *name, rgbdata_t *pix ) if( !pfile ) return false; // 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); cbBmpBits = biTrueWidth * pix->height * pixel_size; cbPalBytes = ( pixel_size == 1 ) ? 256 * sizeof( rgba_t ) : 0; diff --git a/engine/common/imagelib/img_dds.c b/engine/common/imagelib/img_dds.c index f9e248b0..845813c6 100644 --- a/engine/common/imagelib/img_dds.c +++ b/engine/common/imagelib/img_dds.c @@ -20,8 +20,8 @@ GNU General Public License for more details. qboolean Image_CheckDXT3Alpha( dds_t *hdr, byte *fin ) { word sAlpha; - byte *alpha; - int x, y, i, j; + byte *alpha; + int x, y, i, j; 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 ) { uint bits, bitmask; - byte *alphamask; - int x, y, i, j; + byte *alphamask; + int x, y, i, j; for( y = 0; y < hdr->dwHeight; y += 4 ) { @@ -90,7 +90,7 @@ qboolean Image_CheckDXT5Alpha( dds_t *hdr, byte *fin ) return false; } - + void Image_DXTGetPixelFormat( dds_t *hdr ) { uint bits = hdr->dsPixelFormat.dwRGBBitCount; @@ -102,7 +102,7 @@ void Image_DXTGetPixelFormat( dds_t *hdr ) { switch( hdr->dsPixelFormat.dwFourCC ) { - case TYPE_DXT1: + case TYPE_DXT1: image.type = PF_DXT1; break; case TYPE_DXT2: @@ -136,7 +136,7 @@ void Image_DXTGetPixelFormat( dds_t *hdr ) { image.type = PF_UNKNOWN; // assume error } - else + else { 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_BGRA_32: case PF_RGBA_32: return (width * height * depth * 4); - } + } return 0; } -size_t Image_DXTCalcMipmapSize( dds_t *hdr ) +size_t Image_DXTCalcMipmapSize( dds_t *hdr ) { size_t buffsize = 0; int i, width, height; - + // now correct buffer size for( i = 0; i < Q_max( 1, ( hdr->dwMipMapCount )); i++ ) { @@ -198,14 +198,14 @@ size_t Image_DXTCalcMipmapSize( dds_t *hdr ) 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; int w = image.width; int h = image.height; int d = image.depth; - if( hdr->dsCaps.dwCaps2 & DDS_CUBEMAP ) + if( hdr->dsCaps.dwCaps2 & DDS_CUBEMAP ) { // cubemap w*h always match for all sides 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) buffsize = hdr->dwLinearSize; } - else + else { // pretty solution for microsoft bug 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 )) 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 ); 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 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 - image.rgba = Mem_Malloc( host.imagepool, image.size ); + image.rgba = Mem_Malloc( host.imagepool, image.size ); memcpy( image.rgba, fin, image.size ); SetBits( image.flags, IMAGE_DDS_FORMAT ); diff --git a/engine/common/imagelib/img_main.c b/engine/common/imagelib/img_main.c index f86a0a22..9d9f60f0 100644 --- a/engine/common/imagelib/img_main.c +++ b/engine/common/imagelib/img_main.c @@ -69,7 +69,7 @@ static const cubepack_t load_cubemap[] = { NULL, NULL }, }; -// soul of ImageLib - table of image format constants +// soul of ImageLib - table of image format constants const bpc_desc_t PFDesc[] = { { PF_UNKNOWN, "raw", 0x1908, 0 }, @@ -123,7 +123,7 @@ rgbdata_t *ImagePack( void ) return NULL; } - if( image.cubemap ) + if( image.cubemap ) { image.flags |= IMAGE_CUBEMAP; pack->buffer = image.cubemap; @@ -132,7 +132,7 @@ rgbdata_t *ImagePack( void ) pack->type = image.source_type; pack->size = image.size * image.num_sides; } - else + else { pack->buffer = image.rgba; pack->width = image.width; @@ -152,7 +152,7 @@ rgbdata_t *ImagePack( void ) pack->numMips = image.num_mips; pack->palette = image.palette; pack->encode = image.encode; - + return pack; } @@ -166,7 +166,7 @@ qboolean FS_AddSideToPack( const char *name, int adjust_flags ) { byte *out, *flipped; qboolean resampled = false; - + // first side set average size for all cubemap sides! 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 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 ); 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 )) { 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 { // 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; // 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 ); @@ -386,7 +386,7 @@ qboolean FS_SaveImage( const char *filename, rgbdata_t *pix ) return false; // do not happens } - pix->size /= 6; // now set as side size + pix->size /= 6; // now set as side size picBuffer = pix->buffer; // save all sides seperately diff --git a/engine/common/imagelib/img_quant.c b/engine/common/imagelib/img_quant.c index 1de52670..eb5e2e50 100644 --- a/engine/common/imagelib/img_quant.c +++ b/engine/common/imagelib/img_quant.c @@ -42,7 +42,7 @@ GNU General Public License for more details. #define radiusbiasshift 6 // at 32.0 biased by 6 bits #define radiusbias (1<> radiusbiasshift; if( rad <= 1 ) rad = 0; - for( i = 0; i < rad; i++ ) - radpower[i] = alpha * ((( rad * rad - i * i ) * radbias ) / ( rad * rad )); + for( i = 0; i < rad; i++ ) + radpower[i] = alpha * ((( rad * rad - i * i ) * radbias ) / ( rad * rad )); if( delta <= 0 ) return; @@ -394,7 +394,7 @@ void learn( void ) { step = prime4 * image.bpp; } - + i = 0; while( i < samplepixels ) @@ -409,17 +409,17 @@ void learn( void ) p += step; if( p >= lim ) p -= lengthcount; - + i++; if( i % delta == 0 ) - { + { alpha -= alpha / alphadec; radius -= radius / radiusdec; rad = radius >> radiusbiasshift; 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 )); } } @@ -452,7 +452,7 @@ rgbdata_t *Image_Quantize( rgbdata_t *pic ) { pic->palette[i*3+0] = network[i][0]; // red 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(); diff --git a/engine/common/imagelib/img_tga.c b/engine/common/imagelib/img_tga.c index 4ece7e4b..59228bdf 100644 --- a/engine/common/imagelib/img_tga.c +++ b/engine/common/imagelib/img_tga.c @@ -326,7 +326,7 @@ qboolean Image_SaveTGA( const char *name, rgbdata_t *pix ) } } break; - } + } FS_WriteFile( name, buffer, outsize ); diff --git a/engine/common/imagelib/img_utils.c b/engine/common/imagelib/img_utils.c index 358de8e3..627cebad 100644 --- a/engine/common/imagelib/img_utils.c +++ b/engine/common/imagelib/img_utils.c @@ -80,14 +80,14 @@ static byte palette_hl[768] = 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.0f, 0.7f }, -{-0.7f, -0.7f, 0.0f, 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.7f, -0.7f, -0.7f, -0.7f, 0.0f }, +{-0.7f, -0.7f, -0.7f, 0.0f, 0.7f }, +{-0.7f, -0.7f, 0.0f, 0.7f, 0.7f }, +{-0.7f, 0.0f, 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 ) { 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.saveformats = save_game; break; @@ -180,7 +180,7 @@ byte *Image_Copy( size_t size ) out = Mem_Malloc( host.imagepool, size ); memcpy( out, image.tempbuffer, size ); - return out; + return out; } /* @@ -272,13 +272,13 @@ int Image_ComparePalette( const byte *pal ) return PAL_QUAKE1; else if( !memcmp( palette_hl, pal, 765 )) return PAL_HALFLIFE; - return PAL_CUSTOM; + return PAL_CUSTOM; } void Image_SetPalette( const byte *pal, uint *d_table ) { byte rgba[4]; - int i; + int i; // setup palette switch( image.d_rendermode ) @@ -323,7 +323,7 @@ void Image_SetPalette( const byte *pal, uint *d_table ) rgba[3] = pal[i*4+3]; 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]; g = palSrc[i*pal_size+1]; b = palSrc[i*pal_size+2]; - + maxcol = max( max( r, g ), b ) / 255.0f; mincol = min( min( r, g ), b ) / 255.0f; if( maxcol == 0 ) continue; - + val = 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 *resamplerow1; byte *resamplerow2; - + fstep = (int)(inheight * 65536.0f / outheight); 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: image.tempbuffer = (byte *)Mem_Realloc( host.imagepool, image.tempbuffer, outwidth * outheight ); Image_Resample8Nolerp( indata, inwidth, inheight, image.tempbuffer, outwidth, outheight ); - break; + break; case PF_RGB_24: case PF_BGR_24: 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; default: *resampled = false; - return (byte *)indata; + return (byte *)indata; } *resampled = true; @@ -1106,7 +1106,7 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t { int i, x, y; word width = *srcwidth; - word height = *srcheight; + word height = *srcheight; int samples = PFDesc[type].bpp; qboolean flip_x = FBitSet( flags, IMAGE_FLIP_X ) ? 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 ); break; default: - return (byte *)in; + return (byte *)in; } 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 )) { *srcwidth = height; - *srcheight = width; + *srcheight = width; } else { *srcwidth = width; - *srcheight = height; + *srcheight = height; } return image.tempbuffer; @@ -1174,7 +1174,7 @@ byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int int i; if( !FBitSet( flags, IMAGE_HAS_LUMA )) - return (byte *)fin; + return (byte *)fin; switch( type ) { @@ -1187,7 +1187,7 @@ byte *Image_CreateLumaInternal( byte *fin, int width, int height, int type, int default: // another formats does ugly result :( Con_Printf( S_ERROR "Image_MakeLuma: unsupported format %s\n", PFDesc[type].name ); - return (byte *)fin; + return (byte *)fin; } return image.tempbuffer; @@ -1206,10 +1206,10 @@ qboolean Image_AddIndexedImageToPack( const byte *in, int width, int height ) image.size = mipsize; if( expand_to_rgba ) image.size *= 4; - else Image_CopyPalette32bit(); + else Image_CopyPalette32bit(); // 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 ); else if( !Image_Copy8bitRGBA( in, image.rgba, mipsize )) 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 ) { byte *fin, *fout; - int i, size; + int i, size; if( !data ) return false; fin = (byte *)data; @@ -1242,8 +1242,8 @@ qboolean Image_Decompress( const byte *data ) if( image.flags & IMAGE_HAS_ALPHA ) { if( image.flags & IMAGE_COLORINDEX ) - Image_GetPaletteLMP( image.palette, LUMP_GRADIENT ); - else Image_GetPaletteLMP( image.palette, LUMP_MASKED ); + Image_GetPaletteLMP( image.palette, LUMP_GRADIENT ); + else Image_GetPaletteLMP( image.palette, LUMP_MASKED ); } else Image_GetPaletteLMP( image.palette, LUMP_NORMAL ); // intentionally fallthrough @@ -1363,22 +1363,22 @@ qboolean Image_RemapInternal( rgbdata_t *pic, int topColor, int bottomColor ) return true; } -/* -================== +/* +================== Image_ApplyFilter -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 -reasonable enough "fake bumpmapping" with this baby... +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 +reasonable enough "fake bumpmapping" with this baby... -Filtering algorithm from http://www.student.kuleuven.ac.be/~m0216922/CG/filtering.html -All credit due -================== +Filtering algorithm from http://www.student.kuleuven.ac.be/~m0216922/CG/filtering.html +All credit due +================== */ static void Image_ApplyFilter( rgbdata_t *pic, float factor ) -{ - int i, x, y; - uint *fin, *fout; +{ + int i, x, y; + uint *fin, *fout; size_t size; // don't waste time @@ -1392,72 +1392,72 @@ static void Image_ApplyFilter( rgbdata_t *pic, float factor ) fout = (uint *)image.tempbuffer; fin = (uint *)pic->buffer; - for( x = 0; x < image.width; x++ ) - { - for( y = 0; y < image.height; y++ ) - { - vec3_t vout = { 0.0f, 0.0f, 0.0f }; + for( x = 0; x < image.width; x++ ) + { + for( y = 0; y < image.height; y++ ) + { + vec3_t vout = { 0.0f, 0.0f, 0.0f }; int pos_x, pos_y; float avg; - for( pos_x = 0; pos_x < FILTER_SIZE; pos_x++ ) - { - 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_y = (y - (FILTER_SIZE / 2) + pos_y + image.height) % image.height; + for( pos_x = 0; pos_x < FILTER_SIZE; pos_x++ ) + { + 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_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 - // 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[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]; - } - } + // 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... + 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[2] += ((float)((byte *)&fin[img_y * image.width + img_x])[2]) * img_emboss[pos_x][pos_y]; + } + } - // multiply by factor, add bias, and clamp - for( i = 0; i < 3; i++ ) - { - vout[i] *= factor; - vout[i] += 128.0f; // base + // multiply by factor, add bias, and clamp + for( i = 0; i < 3; i++ ) + { + vout[i] *= factor; + vout[i] += 128.0f; // base vout[i] = bound( 0.0f, vout[i], 255.0f ); - } + } - // NTSC greyscale conversion standard - avg = (vout[0] * 30.0f + vout[1] * 59.0f + vout[2] * 11.0f) / 100.0f; + // NTSC greyscale conversion standard + avg = (vout[0] * 30.0f + vout[1] * 59.0f + vout[2] * 11.0f) / 100.0f; - // divide by 255 so GL operations work as expected - vout[0] = avg / 255.0f; - vout[1] = avg / 255.0f; - vout[2] = avg / 255.0f; + // divide by 255 so GL operations work as expected + vout[0] = avg / 255.0f; + vout[1] = avg / 255.0f; + vout[2] = avg / 255.0f; - // 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...!) - fout[y * image.width + x] = fin[y * image.width + x]; + // 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...!) + fout[y * image.width + x] = fin[y * image.width + x]; - // now write in each element, applying the blend operator. blend - // operators are based on standard OpenGL TexEnv modes, and the - // formulas are derived from the OpenGL specs (http://www.opengl.org). - for( i = 0; i < 3; i++ ) - { - // divide by 255 so GL operations work as expected - float src = ((float)((byte *)&fin[y * image.width + x])[i]) / 255.0f; + // now write in each element, applying the blend operator. blend + // operators are based on standard OpenGL TexEnv modes, and the + // formulas are derived from the OpenGL specs (http://www.opengl.org). + for( i = 0; i < 3; i++ ) + { + // divide by 255 so GL operations work as expected + float src = ((float)((byte *)&fin[y * image.width + x])[i]) / 255.0f; float tmp; - // default is GL_BLEND here - // CsS + CdD works out as Src * Dst * 2 - tmp = vout[i] * src * 2.0f; + // default is GL_BLEND here + // CsS + CdD works out as Src * Dst * 2 + tmp = vout[i] * src * 2.0f; - // multiply back by 255 to get the proper byte scale - tmp *= 255.0f; + // multiply back by 255 to get the proper byte scale + 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 ); - // and copy it in - ((byte *)&fout[y * image.width + x])[i] = (byte)tmp; - } - } - } + // and copy it in + ((byte *)&fout[y * image.width + x])[i] = (byte)tmp; + } + } + } // copy result back 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; qboolean result = true; byte *out; - + // check for buffers if( !pic || !pic->buffer ) { diff --git a/engine/common/imagelib/img_wad.c b/engine/common/imagelib/img_wad.c index fc171956..fcb22a35 100644 --- a/engine/common/imagelib/img_wad.c +++ b/engine/common/imagelib/img_wad.c @@ -27,7 +27,7 @@ Image_LoadPAL */ qboolean Image_LoadPAL( const char *name, const byte *buffer, fs_offset_t filesize ) { - int rendermode = LUMP_NORMAL; + int rendermode = LUMP_NORMAL; 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.width = image.height = 0; image.depth = 1; - + return true; } @@ -88,7 +88,7 @@ qboolean Image_LoadFNT( const char *name, const byte *buffer, fs_offset_t filesi return false; memcpy( &font, buffer, sizeof( font )); - + // last sixty four bytes - what the hell ???? 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.flags |= IMAGE_HAS_ALPHA; // fonts always have transparency } - else + else { 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.d_currentpal ) - return false; + return false; } 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 ); break; } - + fin = (byte *)(buffer + sizeof(dspriteframe_t)); 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); numcolors = *(short *)pal; if( numcolors != 256 ) pal = NULL; // corrupted mip ? - else pal += sizeof( short ); // skip colorsize + else pal += sizeof( short ); // skip colorsize hl_texture = true; @@ -474,7 +474,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, fs_offset_t filesi else { return false; // unknown or unsupported mode rejected - } + } // check for quake-sky texture 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[2] += pal[i*3+2]; } - + VectorDivide( reflectivity, 256, image.fogParams ); } - + image.type = PF_INDEXED_32; // 32-bit palete image.depth = 1; diff --git a/engine/common/infostring.c b/engine/common/infostring.c index 35167d95..220cc9e8 100644 --- a/engine/common/infostring.c +++ b/engine/common/infostring.c @@ -196,7 +196,7 @@ const char *Info_ValueForKey( const char *s, const char *key ) static int valueindex; int count; char *o; - + valueindex = (valueindex + 1) % 4; if( *s == '\\' ) s++; diff --git a/engine/common/miniz.h b/engine/common/miniz.h index fd8c02fd..cef9453d 100644 --- a/engine/common/miniz.h +++ b/engine/common/miniz.h @@ -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. */ /* 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_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 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. */ @@ -900,7 +900,7 @@ struct tinfl_decompressor_tag #ifdef __cplusplus } #endif - + #ifndef MINIZ_HEADER_FILE_ONLY /************************************************************************** * @@ -3849,5 +3849,5 @@ void tinfl_decompressor_free(tinfl_decompressor *pDecomp) #ifdef __cplusplus } #endif - + #endif // MINIZ_HEADER_FILE_ONLY diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index 10c27e7c..c6a4978c 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -459,7 +459,7 @@ byte *Mod_DecompressPVS( const byte *in, int visbytes ) out = g_visdata; if( !in ) - { + { // no vis info, so make all visible while( visbytes ) { @@ -641,7 +641,7 @@ static void Mod_BoxLeafnums_r( leaflist_t *ll, mnode_t *node ) ll->list[ll->count++] = leaf->cluster; return; } - + sides = BOX_ON_PLANE_SIDE( ll->mins, ll->maxs, node->plane ); if( sides == 1 ) @@ -756,7 +756,7 @@ void Mod_AmbientLevels( const vec3_t p, byte *pvolumes ) mleaf_t *leaf; if( !worldmodel || !p || !pvolumes ) - return; + return; leaf = Mod_PointInLeaf( p, worldmodel->nodes ); *(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 )); - // parse value - if(( pfile = COM_ParseFile( pfile, token )) == NULL ) + // parse value + if(( pfile = COM_ParseFile( pfile, token )) == NULL ) Host_Error( "Mod_FindModelOrigin: EOF without closing brace\n" ); if( token[0] == '}' ) @@ -820,7 +820,7 @@ static void Mod_FindModelOrigin( const char *entities, const char *modelname, ve } if( model_found ) break; - } + } } /* @@ -936,7 +936,7 @@ static mvertex_t *Mod_GetVertexByNumber( model_t *mod, int surfedge ) return &mod->vertexes[edge->v[1]]; } } - + /* ================== Mod_MakeNormalAxial @@ -1032,7 +1032,7 @@ static void Mod_CalcSurfaceExtents( msurface_t *surf ) sample_size = Mod_SampleSizeForFace( surf ); tex = surf->texinfo; - Mod_LightMatrixFromTexMatrix( tex, info->lmvecs ); + Mod_LightMatrixFromTexMatrix( tex, info->lmvecs ); mins[0] = lmmins[0] = mins[1] = lmmins[1] = 999999; maxs[0] = lmmaxs[0] = maxs[1] = lmmaxs[1] =-999999; @@ -1276,9 +1276,9 @@ static void Mod_MakeHull0( void ) mclipnode_t *out; hull_t *hull; int i, j; - - hull = &loadmodel->hulls[0]; - hull->clipnodes = out = Mem_Malloc( loadmodel->mempool, loadmodel->numnodes * sizeof( *out )); + + hull = &loadmodel->hulls[0]; + hull->clipnodes = out = Mem_Malloc( loadmodel->mempool, loadmodel->numnodes * sizeof( *out )); in = loadmodel->nodes; hull->firstclipnode = 0; @@ -1502,7 +1502,7 @@ static void Mod_SetupSubmodels( dbspmodel_t *bmod ) mod->firstmodelsurface = bm->firstface; mod->nummodelsurfaces = bm->numfaces; - VectorCopy( bm->mins, mod->mins ); + VectorCopy( bm->mins, mod->mins ); VectorCopy( bm->maxs, 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 ) in->mins[j] = 0.0f; if( in->maxs[j] == -999999.0f) - in->maxs[j] = 0.0f; + in->maxs[j] = 0.0f; // spread the mins / maxs by a unit out->mins[j] = in->mins[j] - 1.0f; @@ -1613,7 +1613,7 @@ static void Mod_LoadSubmodels( dbspmodel_t *bmod ) if( i == 0 && bmod->isworld ) 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 @@ -1693,8 +1693,8 @@ static void Mod_LoadEntities( dbspmodel_t *bmod ) Q_strncpy( keyname, token, sizeof( keyname )); - // parse value - if(( pfile = COM_ParseFile( pfile, token )) == NULL ) + // parse value + if(( pfile = COM_ParseFile( pfile, token )) == NULL ) Host_Error( "Mod_LoadEntities: EOF without closing brace\n" ); if( token[0] == '}' ) @@ -1908,7 +1908,7 @@ static void Mod_LoadTextures( dbspmodel_t *bmod ) qboolean custom_palette; char texname[64]; mip_t *mt; - int i, j; + int i, j; if( bmod->isworld ) { @@ -2574,7 +2574,7 @@ static void Mod_LoadClipnodes( dbspmodel_t *bmod ) dclipnode32_t *out; 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 )) { @@ -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 ); return false; // there were errors, we can't load this map - } + } else if( !bmod->isworld && 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 )) 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 - } + } else if( loadstat.numwarnings ) { if( !FBitSet( flags, LUMP_SILENT )) @@ -2932,7 +2932,7 @@ Mod_LoadBrushModel */ 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->type = mod_brush; diff --git a/engine/common/mod_studio.c b/engine/common/mod_studio.c index a20f4fa6..45a39c54 100644 --- a/engine/common/mod_studio.c +++ b/engine/common/mod_studio.c @@ -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 ) bSkipShield = 1; - + for( i = j = 0; i < mod_studiohdr->numhitboxes; i++, j += 6 ) { if( bSkipShield && i == 21 ) @@ -310,7 +310,7 @@ static void Mod_StudioCalcBoneAdj( float *adj, const byte *pcontroller ) int i, j; float value; mstudiobonecontroller_t *pbonecontroller; - + pbonecontroller = (mstudiobonecontroller_t *)((byte *)mod_studiohdr + mod_studiohdr->bonecontrollerindex); 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]); k = frame; - + // debug if( panimvalue->num.total < panimvalue->num.valid ) 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 ) { k -= panimvalue->num.total; @@ -734,7 +734,7 @@ static void SV_StudioSetupBones( model_t *pModel, float frame, int sequence, con i = boneused[j]; 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 ); 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 ); return NULL; - } + } return (studiohdr_t *)buffer; } @@ -1154,7 +1154,7 @@ static server_studio_api_t gStudioAPI = Mod_LoadCacheFile, Mod_StudioExtradata, }; - + /* =============== Mod_InitStudioAPI diff --git a/engine/common/net_buffer.c b/engine/common/net_buffer.c index 53a2f981..067d6047 100644 --- a/engine/common/net_buffer.c +++ b/engine/common/net_buffer.c @@ -51,7 +51,7 @@ void MSG_InitMasks( void ) for( maskBit = 0; maskBit < 32; maskBit++ ) ExtraMasks[maskBit] = (uint)BIT( maskBit ) - 1; } - + void MSG_InitExt( sizebuf_t *sb, const char *pDebugName, void *pData, int nBytes, int 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: bitPos += sb->nDataBits; break; - default: + default: return -1; } @@ -252,7 +252,7 @@ qboolean MSG_WriteBits( sizebuf_t *sb, const void *pData, int nBits ) nBitsLeft -= 8; ++pOut; } - + // Read the remaining bits. if( nBitsLeft ) { @@ -391,7 +391,7 @@ qboolean MSG_WriteString( sizebuf_t *sb, const char *pStr ) } while( *( pStr - 1 )); } else MSG_WriteChar( sb, 0 ); - + return !sb->bOverflow; } @@ -446,7 +446,7 @@ uint MSG_ReadUBitLong( sizebuf_t *sb, int numbits ) { int nExtraBits = sb->iCurBit & 31; uint dword2 = ((uint *)sb->pData)[idword1+1] & ExtraMasks[nExtraBits]; - + // no need to mask since we hit the end of the dword. // shift the second dword's part into the high bits. ret |= (dword2 << ( numbits - nExtraBits )); @@ -484,7 +484,7 @@ qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits ) { byte *pOut = (byte *)pOutData; int nBitsLeft = nBits; - + // get output dword-aligned. while((( dword )pOut & 3) != 0 && nBitsLeft >= 8 ) { @@ -508,7 +508,7 @@ qboolean MSG_ReadBits( sizebuf_t *sb, void *pOutData, int nBits ) ++pOut; nBitsLeft -= 8; } - + // read the remaining bits. if( nBitsLeft ) { @@ -529,7 +529,7 @@ float MSG_ReadBitAngle( sizebuf_t *sb, int numbits ) fReturn = (float)i * ( 360.0f / shift ); // 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; return fReturn; @@ -646,7 +646,7 @@ char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine ) { static char string[4096]; int l = 0, c; - + do { // use MSG_ReadByte so -1 is out of bounds diff --git a/engine/common/net_buffer.h b/engine/common/net_buffer.h index 0d0af632..1d662da2 100644 --- a/engine/common/net_buffer.h +++ b/engine/common/net_buffer.h @@ -131,5 +131,5 @@ void MSG_ReadVec3Coord( 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 ); char *MSG_ReadStringExt( sizebuf_t *sb, qboolean bLine ); - + #endif//NET_BUFFER_H diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 93fd8acb..8b097959 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -26,7 +26,7 @@ GNU General Public License for more details. #define UDP_HEADER_SIZE 28 #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 // forward declarations @@ -307,7 +307,7 @@ void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport, voi Netchan_Clear( chan ); memset( chan, 0, sizeof( *chan )); - + chan->sock = sock; chan->remote_address = adr; chan->last_received = host.realtime; @@ -377,7 +377,7 @@ void Netchan_UnlinkFragment( fragbuf_t *buf, fragbuf_t **list ) { // remove first element *list = buf->next; - + // destroy remnant Mem_Free( buf ); return; @@ -501,7 +501,7 @@ void Netchan_OutOfBand( int net_socket, netadr_t adr, int length, byte *data ) // write the packet header MSG_Init( &send, "SequencePacket", send_buf, sizeof( send_buf )); - + MSG_WriteLong( &send, NET_HEADER_OUTOFBANDPACKET ); // -1 sequence means out of band MSG_WriteBytes( &send, data, length ); @@ -705,7 +705,7 @@ static void Netchan_CreateFragments_( netchan_t *chan, sizebuf_t *msg ) int bytes, pos; int bufferid = 1; fragbufwaiting_t *wait, *p; - + if( MSG_GetNumBytesWritten( msg ) == 0 ) return; @@ -737,7 +737,7 @@ static void Netchan_CreateFragments_( netchan_t *chan, sizebuf_t *msg ) { bytes = Q_min( remaining, chunksize ); remaining -= bytes; - + buf = Netchan_AllocFragbuf(); buf->bufferid = bufferid++; @@ -917,7 +917,7 @@ void Netchan_CreateFileFragmentsFromBuffer( netchan_t *chan, const char *filenam buf->isfile = true; buf->size = send; buf->foffset = pos; - + MSG_WriteBits( &buf->frag_message, pbuf + pos, send << 3 ); remaining -= send; @@ -961,7 +961,7 @@ int Netchan_CreateFileFragments( netchan_t *chan, const char *filename ) qboolean bCompressed = false; fragbufwaiting_t *wait, *p; fragbuf_t *buf; - + if(( filesize = FS_FileSize( filename, false )) <= 0 ) { 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 ) { n = p->next; - + // copy it in MSG_WriteBytes( msg, MSG_GetData( &p->frag_message ), 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; } } - + chan->incomingbufs[FRAG_NORMAL_STREAM] = NULL; // reset flag @@ -1218,12 +1218,12 @@ qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg ) int cursize; n = p->next; - + cursize = MSG_GetNumBytesWritten( &p->frag_message ); // first message has the file name, don't write that into the data stream, // 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 cursize -= MSG_GetNumBytesRead( msg ); @@ -1353,7 +1353,7 @@ void Netchan_UpdateProgress( netchan_t *chan ) p = chan->incomingbufs[i]; - if( i == FRAG_FILE_STREAM ) + if( i == FRAG_FILE_STREAM ) { char sz[MAX_SYSPATH]; 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_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) Netchan_FragSend( chan ); @@ -1519,7 +1519,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data ) if( pbuf ) { fragment_size = MSG_GetNumBytesWritten( &pbuf->frag_message ); - + // files set size a bit differently. if( pbuf->isfile && !pbuf->isbuffer ) { @@ -1536,7 +1536,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data ) // which buffer are we sending ? 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( 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 ); // unlink pbuf - Netchan_UnlinkFragment( pbuf, &chan->fragbufs[i] ); + Netchan_UnlinkFragment( pbuf, &chan->fragbufs[i] ); chan->reliable_fragment[i] = 1; @@ -1607,7 +1607,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data ) if( chan->sock == NS_CLIENT ) { MSG_WriteWord( &send, Cvar_VariableInteger( "net_qport" )); - } + } 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_length[i] ); } - else + else { 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 { // 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 ) MSG_BeginClientCmd( &send, clc_nop ); else if( chan->sock == NS_SERVER ) - MSG_BeginServerCmd( &send, svc_nop ); + MSG_BeginServerCmd( &send, svc_nop ); else break; } } @@ -1778,7 +1778,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg ) , ns_strings[chan->sock] , MSG_GetMaxBytes( msg ) , sequence & 63 - , sequence_ack & 63 + , sequence_ack & 63 , reliable_message , host.realtime ); } @@ -1812,8 +1812,8 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg ) 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_acknowledged = sequence_ack; chan->incoming_reliable_acknowledged = reliable_ack; @@ -1847,7 +1847,7 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg ) if( !frag_message[i] ) continue; - + inbufferid = FRAG_GETID( 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]; bits = frag_length[i]; - + // copy in data MSG_Clear( &pbuf->frag_message ); diff --git a/engine/common/net_encode.c b/engine/common/net_encode.c index b5ad8ed4..47deff99 100644 --- a/engine/common/net_encode.c +++ b/engine/common/net_encode.c @@ -29,7 +29,7 @@ GNU General Public License for more details. #define DELTA_PATH "delta.lst" static qboolean delta_init = false; - + // list of all the struct names 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 ) { if( !fieldName || !*fieldName ) - return NULL; + return NULL; for( ; pInfo->name; pInfo++ ) { @@ -405,7 +405,7 @@ int Delta_IndexForFieldInfo( const delta_field_t *pInfo, const char *fieldName ) int i; if( !fieldName || !*fieldName ) - return -1; + return -1; 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 - 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++ ); // copy info to new field @@ -475,7 +475,7 @@ void Delta_WriteTableField( sizebuf_t *msg, int tableIndex, const delta_t *pFiel { int nameIndex; delta_info_t *dt; - + Assert( pField != NULL ); if( !COM_CheckString( pField->name )) @@ -523,7 +523,7 @@ void Delta_ParseTableField( sizebuf_t *msg ) if( !dt ) 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 ) ) { 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 ); - *delta_script = COM_ParseFile( *delta_script, token ); + *delta_script = COM_ParseFile( *delta_script, token ); if( Q_strcmp( token, "," )) { Con_DPrintf( S_ERROR "Delta_ReadField: expected ',', found '%s' instead\n", token ); @@ -753,7 +753,7 @@ void Delta_InitFields( void ) { byte *afile; char *pfile; - string encodeDll, encodeFunc, token; + string encodeDll, encodeFunc, token; delta_info_t *dt; afile = FS_LoadFile( DELTA_PATH, NULL, false ); @@ -778,7 +778,7 @@ void Delta_InitFields( void ) // jump to '{' pfile = COM_ParseFile( pfile, token ); - + if( token[0] != '{' ) { 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 ); 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", "rollangle", DT_FLOAT|DT_SIGNED, 16, 32.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; -} +} /* ===================== @@ -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; float flValue, flAngle, flTime; qboolean bChanged; - uint iValue; + uint iValue; const char *pStr; char *pOut; - + bChanged = MSG_ReadOneBit( msg ); 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 - + ============================================================================= */ /* @@ -1441,7 +1441,7 @@ void MSG_ReadDeltaEvent( sizebuf_t *msg, event_args_t *from, event_args_t *to ) ============================================================================= movevars_t communication - + ============================================================================= */ 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. ================== */ -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_t *pField; @@ -1715,7 +1715,7 @@ void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t * MSG_WriteOneBit( msg, 1 ); MSG_WriteSBitLong( msg, baseline, 7 ); } - else MSG_WriteOneBit( msg, 0 ); + else MSG_WriteOneBit( msg, 0 ); 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 ); - + pField = dt->pFields; Assert( pField != NULL ); @@ -1802,7 +1802,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state } if( fRemoveType & 2 ) - { + { // entity was removed from server to->number = -1; return false; @@ -1875,7 +1875,7 @@ qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state ============================================================================= game.dll interface - + ============================================================================= */ 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 - dt->userCallback = encodeFunc; + dt->userCallback = encodeFunc; } int GAME_EXPORT Delta_FindField( delta_t *pFields, const char *fieldname ) diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c index e7793061..ba94b444 100644 --- a/engine/common/net_ws.c +++ b/engine/common/net_ws.c @@ -452,7 +452,7 @@ static int NET_StringToSockaddr( const char *s, struct sockaddr *sadr, qboolean if( !net.initialized ) return false; - + memset( sadr, 0, sizeof( *sadr )); ((struct sockaddr_in *)sadr)->sin_family = AF_INET; @@ -1584,7 +1584,7 @@ void NET_Config( qboolean multiplayer ) old_config = multiplayer; if( multiplayer ) - { + { // open sockets if( net.allow_ip ) NET_OpenIP(); @@ -1596,7 +1596,7 @@ void NET_Config( qboolean multiplayer ) } } else - { + { int i; // shut down any existing sockets diff --git a/engine/common/netchan.h b/engine/common/netchan.h index cd42257d..3980090e 100644 --- a/engine/common/netchan.h +++ b/engine/common/netchan.h @@ -27,10 +27,10 @@ GNU General Public License for more details. #include "net_buffer.h" // 0 == regular, 1 == file stream -#define MAX_STREAMS 2 +#define MAX_STREAMS 2 // flow control bytes per second limits -#define MAX_RATE 100000.0f +#define MAX_RATE 100000.0f #define MIN_RATE 1000.0f // default data rate @@ -191,7 +191,7 @@ typedef struct fragbuf_s qboolean isbuffer; // is this file buffer from memory ( custom decal, etc. ). qboolean iscompressed; // is compressed file, we should using filename.ztmp 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 } fragbuf_t; @@ -214,7 +214,7 @@ typedef enum fragsize_e typedef struct netchan_s { 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 double last_received; // for timeouts @@ -246,7 +246,7 @@ typedef struct netchan_s // Waiting list of buffered fragments to go onto queue. // 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? uint reliable_fragid[MAX_STREAMS]; // buffer id for each waiting fragment @@ -267,7 +267,7 @@ typedef struct netchan_s int tempbuffersize; // current size // incoming and outgoing flow metrics - flow_t flow[MAX_FLOWS]; + flow_t flow[MAX_FLOWS]; // added for net_speeds size_t total_sended; diff --git a/engine/common/pm_debug.c b/engine/common/pm_debug.c index 54aa1e45..6dab417a 100644 --- a/engine/common/pm_debug.c +++ b/engine/common/pm_debug.c @@ -21,7 +21,7 @@ GNU General Public License for more details. #endif // expand debugging BBOX particle hulls by this many units. -#define BOX_GAP 0.0f +#define BOX_GAP 0.0f /* =============== diff --git a/engine/common/pm_surface.c b/engine/common/pm_surface.c index 552f273c..6ba55a55 100644 --- a/engine/common/pm_surface.c +++ b/engine/common/pm_surface.c @@ -62,7 +62,7 @@ int PM_SampleMiptex( const msurface_t *surf, const vec3_t point ) if( fb ) contents = fb->contents; else contents = CONTENTS_SOLID; - if( !surf->texinfo || !surf->texinfo->texture ) + if( !surf->texinfo || !surf->texinfo->texture ) return contents; tx = surf->texinfo; diff --git a/engine/common/pm_trace.c b/engine/common/pm_trace.c index c5154a66..c60a55eb 100644 --- a/engine/common/pm_trace.c +++ b/engine/common/pm_trace.c @@ -75,18 +75,18 @@ void PM_InitBoxHull( void ) for( i = 0; i < 6; i++ ) { pm_boxclipnodes[i].planenum = i; - + side = i & 1; - + pm_boxclipnodes[i].children[side] = CONTENTS_EMPTY; if( i != 5 ) pm_boxclipnodes[i].children[side^1] = i + 1; else pm_boxclipnodes[i].children[side^1] = CONTENTS_SOLID; - + pm_boxplanes[i].type = i>>1; pm_boxplanes[i].normal[i>>1] = 1.0f; pm_boxplanes[i].signbits = 0; } - + } /* @@ -231,7 +231,7 @@ loc0: if( num < hull->firstclipnode || num > hull->lastclipnode ) Host_Error( "PM_RecursiveHullCheck: bad node number %i\n", num ); - + // find the point distances node = hull->clipnodes + num; plane = hull->planes + node->planenum; @@ -259,7 +259,7 @@ loc0: if( frac < 0.0f ) frac = 0.0f; if( frac > 1.0f ) frac = 1.0f; - + midf = p1f + ( p2f - p1f ) * frac; VectorLerp( p1, frac, p2, mid ); @@ -272,12 +272,12 @@ loc0: { // go past the node return PM_RecursiveHullCheck( hull, node->children[side^1], midf, p2f, mid, p2, trace ); - } + } // never got out of the solid area if( trace->allsolid ) return false; - + // the other side of the node is solid, this is the impact point 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 ); VectorCopy( pe->origin, offset ); } - } + } else { 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 )) { matrix4x4 matrix; - + Matrix4x4_CreateFromEntity( matrix, pe->angles, pe->origin, 1.0f ); Matrix4x4_VectorITransform( matrix, p, test ); } diff --git a/engine/common/protocol.h b/engine/common/protocol.h index d43e6aec..ea63d8f1 100644 --- a/engine/common/protocol.h +++ b/engine/common/protocol.h @@ -60,7 +60,7 @@ GNU General Public License for more details. #define svc_addangle 38 // [angle] add angles when client turn on mover #define svc_usermessage 39 // [byte][byte][string] REG_USER_MSG stuff #define svc_packetentities 40 // [short][...] -#define svc_deltapacketentities 41 // [short][byte][...] +#define svc_deltapacketentities 41 // [short][byte][...] #define svc_choke 42 // just event #define svc_resourcelist 43 // [short][...] #define svc_deltamovevars 44 // [movevars_t] @@ -73,7 +73,7 @@ GNU General Public License for more details. #define svc_director 51 // #define svc_voiceinit 52 // #define svc_voicedata 53 // [byte][short][...] -#define svc_deltapacketbones 54 // [short][byte][...] +#define svc_deltapacketbones 54 // [short][byte][...] // reserved #define svc_resourcelocation 56 // [string] #define svc_querycvarvalue 57 // [string] @@ -82,7 +82,7 @@ GNU General Public License for more details. // client to server #define clc_bad 0 // immediately drop client when received -#define clc_nop 1 +#define clc_nop 1 #define clc_move 2 // [[usercmd_t] #define clc_stringcmd 3 // [string] message #define clc_delta 4 // [byte] sequence number, requests delta compression of message diff --git a/engine/common/soundlib/libmpg/dct36.c b/engine/common/soundlib/libmpg/dct36.c index 936ed136..6470d272 100644 --- a/engine/common/soundlib/libmpg/dct36.c +++ b/engine/common/soundlib/libmpg/dct36.c @@ -1,4 +1,4 @@ -/* +/* This is an optimized DCT from Jeff Tsay's maplay 1.2+ package. Saved one multiplication by doing the 'twiddle factor' stuff together with the window mul. (MH) @@ -221,7 +221,7 @@ void dct12( float *in, float *rawout1, float *rawout2, register float *wi, regis register float *out1 = rawout1; ts[SBLIMIT*0] = out1[0]; ts[SBLIMIT*1] = out1[1]; ts[SBLIMIT*2] = out1[2]; ts[SBLIMIT*3] = out1[3]; ts[SBLIMIT*4] = out1[4]; ts[SBLIMIT*5] = out1[5]; - + DCT12_PART1 { @@ -255,7 +255,7 @@ void dct12( float *in, float *rawout1, float *rawout2, register float *wi, regis { float in0,in1,in2,in3,in4,in5; register float *out2 = rawout2; - + DCT12_PART1 { @@ -284,7 +284,7 @@ void dct12( float *in, float *rawout1, float *rawout2, register float *wi, regis ts[(17-2)*SBLIMIT] += REAL_MUL(in4, wi[5-2]); } - in++; + in++; { float in0,in1,in2,in3,in4,in5; diff --git a/engine/common/soundlib/libmpg/dct64.c b/engine/common/soundlib/libmpg/dct64.c index f4814d31..6f742cb5 100644 --- a/engine/common/soundlib/libmpg/dct64.c +++ b/engine/common/soundlib/libmpg/dct64.c @@ -31,7 +31,7 @@ void dct64( float *out0, float *out1, float *samples ) b2 = b1 + 32; for( i = 15; i >= 0; i-- ) - *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); for( i = 15; i >= 0; i-- ) *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); @@ -42,7 +42,7 @@ void dct64( float *out0, float *out1, float *samples ) { for( i = 7; i >= 0; i-- ) - *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); for( i = 7; i >= 0; i-- ) *bs++ = REAL_MUL((*--b2 - *b1++), *--costab); @@ -50,7 +50,7 @@ void dct64( float *out0, float *out1, float *samples ) costab += 8; for( i = 7; i >= 0; i-- ) - *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); for( i = 7; i >= 0; i-- ) *bs++ = REAL_MUL((*b1++ - *--b2), *--costab); b2 += 32; @@ -63,13 +63,13 @@ void dct64( float *out0, float *out1, float *samples ) for( j = 2; j; j-- ) { for( i = 3; i >= 0; i-- ) - *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); for( i = 3;i >= 0; i-- ) *bs++ = REAL_MUL((*--b2 - *b1++), costab[i]); b2 += 16; for( i = 3; i >= 0; i-- ) - *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); for( i = 3;i >= 0; i-- ) *bs++ = REAL_MUL((*b1++ - *--b2), costab[i]); b2 += 16; @@ -81,13 +81,13 @@ void dct64( float *out0, float *out1, float *samples ) for( j = 4; j; j-- ) { - *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); *bs++ = (*b1++ + *--b2); *bs++ = REAL_MUL((*--b2 - *b1++), costab[1]); *bs++ = REAL_MUL((*--b2 - *b1++), costab[0]); b2 += 8; - *bs++ = (*b1++ + *--b2); + *bs++ = (*b1++ + *--b2); *bs++ = (*b1++ + *--b2); *bs++ = REAL_MUL((*b1++ - *--b2), costab[1]); *bs++ = REAL_MUL((*b1++ - *--b2), costab[0]); diff --git a/engine/common/soundlib/libmpg/fmt123.h b/engine/common/soundlib/libmpg/fmt123.h index 1b7f1107..0caa5686 100644 --- a/engine/common/soundlib/libmpg/fmt123.h +++ b/engine/common/soundlib/libmpg/fmt123.h @@ -26,7 +26,7 @@ enum mpg123_enc_enum // 0000 0000 0100 0000 Some 16 bit integer encoding. MPG123_ENC_16 = 0x040, // 0000 0000 1000 0000 Some signed integer encoding. - MPG123_ENC_SIGNED = 0x080, + MPG123_ENC_SIGNED = 0x080, // 0000 0000 1101 0000 signed 16 bit MPG123_ENC_SIGNED_16 = (MPG123_ENC_16|MPG123_ENC_SIGNED|0x10), // 0000 0000 0110 0000 unsigned 16 bit diff --git a/engine/common/soundlib/libmpg/format.c b/engine/common/soundlib/libmpg/format.c index 3f89c0c2..75e3c204 100644 --- a/engine/common/soundlib/libmpg/format.c +++ b/engine/common/soundlib/libmpg/format.c @@ -22,9 +22,9 @@ enum mpg123_channelcount }; // only the standard rates -static const long my_rates[MPG123_RATES] = +static const long my_rates[MPG123_RATES] = { - 8000, 11025, 12000, + 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, }; @@ -180,7 +180,7 @@ int frame_output_format( mpg123_handle_t *fr ) fr->err = MPG123_BAD_OUTFORMAT; return -1; -end: +end: // here is the _good_ end. // we had a successful match, now see if there's a change if( nf.rate == fr->af.rate && nf.channels == fr->af.channels && nf.encoding == fr->af.encoding ) diff --git a/engine/common/soundlib/libmpg/frame.c b/engine/common/soundlib/libmpg/frame.c index fa2890aa..6344b6d6 100644 --- a/engine/common/soundlib/libmpg/frame.c +++ b/engine/common/soundlib/libmpg/frame.c @@ -50,7 +50,7 @@ static void frame_default_parm( mpg123_parm_t *mp ) // default of keeping some 4K buffers at hand, should cover the "usual" use case // (using 16K pipe buffers as role model). - mp->feedpool = 5; + mp->feedpool = 5; mp->feedbuffer = 4096; } @@ -75,7 +75,7 @@ static void frame_fixed_reset( mpg123_handle_t *fr ) fr->abr_rate = 0; fr->track_frames = 0; fr->track_samples = -1; - fr->framesize=0; + fr->framesize=0; fr->mean_frames = 0; fr->mean_framesize = 0; fr->freesize = 0; @@ -447,7 +447,7 @@ static mpg_off_t frame_fuzzy_find( mpg123_handle_t *fr, mpg_off_t want_frame, mp ret = (mpg_off_t)((double)fr->xing_toc[toc_entry] / 256.0 * fr->rdat.filelen); } else if( fr->mean_framesize > 0 ) - { + { // just guess with mean framesize (may be exact with CBR files). // query filelen here or not? fr->state_flags &= ~FRAME_ACCURATE; // fuzzy! @@ -513,7 +513,7 @@ mpg_off_t frame_index_find( mpg123_handle_t *fr, mpg_off_t want_frame, mpg_off_t } mpg_off_t frame_ins2outs( mpg123_handle_t *fr, mpg_off_t ins ) -{ +{ mpg_off_t outs = 0; switch( fr->down_sample ) diff --git a/engine/common/soundlib/libmpg/getbits.h b/engine/common/soundlib/libmpg/getbits.h index 43103f4c..350d5ab1 100644 --- a/engine/common/soundlib/libmpg/getbits.h +++ b/engine/common/soundlib/libmpg/getbits.h @@ -64,5 +64,5 @@ static uint getbits( mpg123_handle_t *fr, int number_of_bits ) return rval; } - + #endif//GETBITS_H diff --git a/engine/common/soundlib/libmpg/huffman.h b/engine/common/soundlib/libmpg/huffman.h index 446d669c..cd0f57da 100644 --- a/engine/common/soundlib/libmpg/huffman.h +++ b/engine/common/soundlib/libmpg/huffman.h @@ -5,7 +5,7 @@ see COPYING and AUTHORS files in distribution or http://mpg123.org initially written by Michael Hipp - probably we could save a few bytes of memory, because the + probably we could save a few bytes of memory, because the smaller tables are often the part of a bigger table */ @@ -13,14 +13,14 @@ #ifndef HUFFMAN_H_ #define HUFFMAN_H_ -struct newhuff +struct newhuff { uint linbits; const short *table; }; -static const short tab0[] = -{ +static const short tab0[] = +{ 0 }; @@ -291,7 +291,7 @@ static const short tab_c1[] = 0 }; -static const struct newhuff ht[] = +static const struct newhuff ht[] = { { 0 , tab0 }, { 0 , tab1 }, @@ -328,7 +328,7 @@ static const struct newhuff ht[] = { 13, tab24 } }; -static const struct newhuff htc[] = +static const struct newhuff htc[] = { { 0 , tab_c0 }, { 0 , tab_c1 } diff --git a/engine/common/soundlib/libmpg/index.h b/engine/common/soundlib/libmpg/index.h index 195f8627..e75c9038 100644 --- a/engine/common/soundlib/libmpg/index.h +++ b/engine/common/soundlib/libmpg/index.h @@ -26,7 +26,7 @@ typedef struct frame_index_s size_t grow_size;// if > 0: index allowed to grow on need with these steps, instead of lowering resolution } frame_index_t; -// the condition for a framenum to be appended to the index. +// the condition for a framenum to be appended to the index. #define FI_NEXT( fi, framenum ) ((fi).size && framenum == (fi).next) // initialize stuff, set things to zero and NULL... diff --git a/engine/common/soundlib/libmpg/layer3.c b/engine/common/soundlib/libmpg/layer3.c index 49abc4bc..e4e1228c 100644 --- a/engine/common/soundlib/libmpg/layer3.c +++ b/engine/common/soundlib/libmpg/layer3.c @@ -17,7 +17,7 @@ GNU General Public License for more details. #include "huffman.h" #include "getbits.h" #include - + // static one-time calculated tables... or so float COS6_1; // dct12 wants to use that float COS6_2; // dct12 wants to use that @@ -72,7 +72,7 @@ typedef struct gr_info_s float *pow2gain; } gr_info_t; -typedef struct +typedef struct { uint main_data_begin; uint private_bits; @@ -84,7 +84,7 @@ typedef struct } ch[2]; } III_sideinfo; -typedef struct +typedef struct { word longIdx[23]; byte longDiff[22]; @@ -495,7 +495,7 @@ static int III_get_side_info( mpg123_handle_t *fr, III_sideinfo *si, int stereo, else { if( fr->mpeg25 ) - { + { int r0c, r1c; if(( gr_info->block_type == 2 ) && ( !gr_info->mixed_block_flag )) @@ -505,13 +505,13 @@ static int III_get_side_info( mpg123_handle_t *fr, III_sideinfo *si, int stereo, // r0c + 1 + r1c + 1 == 22, always. r1c = 20 - r0c; gr_info->region1start = bandInfo[sfreq].longIdx[r0c+1] >> 1 ; - gr_info->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1; + gr_info->region2start = bandInfo[sfreq].longIdx[r0c+1+r1c+1] >> 1; } else { gr_info->region1start = 54 >> 1; - gr_info->region2start = 576 >> 1; - } + gr_info->region2start = 576 >> 1; + } } } else @@ -609,7 +609,7 @@ static int III_get_scale_factors_1( mpg123_handle_t *fr, int *scf, gr_info_t *gr numbits += num0 * 6; } - else scf += 6; + else scf += 6; if(!( scfsi & 0x4 )) { @@ -667,7 +667,7 @@ static int III_get_scale_factors_2( mpg123_handle_t *fr, int *scf, gr_info_t *gr { 6, 9, 9,9 } , { 6, 9,12,6 } , { 15,18,0,0}, { 6,15,12,0 } , { 6,12, 9,6 } , { 6,18,9,0} } - }; + }; // i_stereo AND second channel -> do_layer3() checks this if( i_stereo ) slen = i_slen2[gr_info->scalefac_compress>>1]; @@ -675,7 +675,7 @@ static int III_get_scale_factors_2( mpg123_handle_t *fr, int *scf, gr_info_t *gr gr_info->preflag = (slen >> 15) & 0x1; n = 0; - + if( gr_info->block_type == 2 ) { if( gr_info->mixed_block_flag ) @@ -702,7 +702,7 @@ static int III_get_scale_factors_2( mpg123_handle_t *fr, int *scf, gr_info_t *gr *scf++ = 0; } } - + n = (n << 1) + 1; for( i = 0; i < n; i++ ) @@ -757,7 +757,7 @@ static int III_dequantize_sample( mpg123_handle_t *fr, float xr[SBLIMIT][SSLIMIT mask <<= 8 - num; part2remain -= num; - l3 = ((576>>1)-bv)>>1; + l3 = ((576>>1)-bv)>>1; // we may lose the 'odd' bit here !! check this later again if( bv <= region1 ) @@ -781,7 +781,7 @@ static int III_dequantize_sample( mpg123_handle_t *fr, float xr[SBLIMIT][SSLIMIT l[2] = bv - region2; } } - + if( gr_info->block_type == 2 ) { int i, max[4]; @@ -1177,7 +1177,7 @@ static int III_dequantize_sample( mpg123_handle_t *fr, float xr[SBLIMIT][SSLIMIT backbits( fr, num ); num = 0; - while( xrpnt < &xr[SBLIMIT][0] ) + while( xrpnt < &xr[SBLIMIT][0] ) *xrpnt++ = DOUBLE_TO_REAL( 0.0 ); while( part2remain > 16 ) @@ -1206,10 +1206,10 @@ static void III_i_stereo( float xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac, gr_i const bandInfoStruct *bi = &bandInfo[sfreq]; const float *tab1, *tab2; int tab; - + // TODO: optimize as static const float *tabs[3][2][2] = - { + { { { tan1_1,tan2_1 } , { tan1_2,tan2_2 } }, { { pow1_1[0],pow2_1[0] } , { pow1_2[0],pow2_2[0] } }, { { pow1_1[1],pow2_1[1] } , { pow1_2[1],pow2_2[1] } } @@ -1257,7 +1257,7 @@ static void III_i_stereo( float xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac, gr_i } } - // in the original: copy 10 to 11 , here: copy 11 to 12 + // in the original: copy 10 to 11 , here: copy 11 to 12 // maybe still wrong??? (copy 12 to 13?) is_p = scalefac[11 * 3 + lwin - gr_info->mixed_block_flag]; // scale: 0-15 sb = bi->shortDiff[12]; @@ -1271,7 +1271,7 @@ static void III_i_stereo( float xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac, gr_i t2 = tab2[is_p]; for( ; sb > 0; sb--, idx += 3 ) - { + { float v = xr[0][idx]; xr[0][idx] = REAL_MUL_15( v, t1 ); xr[1][idx] = REAL_MUL_15( v, t2 ); @@ -1309,8 +1309,8 @@ static void III_i_stereo( float xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac, gr_i } else idx += sb; } - } - } + } + } else { int sfb = gr_info->maxbandl; @@ -1351,7 +1351,7 @@ static void III_i_stereo( float xr_buf[2][SBLIMIT][SSLIMIT], int *scalefac, gr_i int sb; t1 = tab1[is_p], - t2 = tab2[is_p]; + t2 = tab2[is_p]; // copy l-band 20 to l-band 21 for( sb = bi->longDiff[21]; sb > 0; sb--, idx++ ) @@ -1373,7 +1373,7 @@ static void III_antialias( float xr[SBLIMIT][SSLIMIT], gr_info_t *gr_info ) { if( !gr_info->mixed_block_flag ) return; - sblim = 1; + sblim = 1; } else { @@ -1417,7 +1417,7 @@ static void III_hybrid( float fsIn[SBLIMIT][SSLIMIT], float tsOut[SSLIMIT][SBLIM b=-b + 1; rawout2 = block[b][ch]; blc[ch] = b; - + if( gr_info->mixed_block_flag ) { sb = 2; @@ -1425,7 +1425,7 @@ static void III_hybrid( float fsIn[SBLIMIT][SSLIMIT], float tsOut[SSLIMIT][SBLIM dct36( fsIn[1], rawout1+18, rawout2+18, win1[0], tspnt + 1 ); rawout1 += 36; rawout2 += 36; tspnt += 2; } - + bt = gr_info->block_type; if( bt == 2 ) @@ -1550,7 +1550,7 @@ int do_layer3( mpg123_handle_t *fr ) if( ms_stereo || i_stereo || ( single == SINGLE_MIX )) { - if( gr_info->maxb > sideinfo.ch[0].gr[gr].maxb ) + if( gr_info->maxb > sideinfo.ch[0].gr[gr].maxb ) sideinfo.ch[0].gr[gr].maxb = gr_info->maxb; else gr_info->maxb = sideinfo.ch[0].gr[gr].maxb; } @@ -1589,6 +1589,6 @@ int do_layer3( mpg123_handle_t *fr ) } } - + return clip; } diff --git a/engine/common/soundlib/libmpg/libmpg.c b/engine/common/soundlib/libmpg/libmpg.c index 3574457b..3397dc0d 100644 --- a/engine/common/soundlib/libmpg/libmpg.c +++ b/engine/common/soundlib/libmpg/libmpg.c @@ -23,7 +23,7 @@ void *create_decoder( int *error ) if( error ) *error = 0; mpg123_init(); - + mpg = mpg123_new( &ret ); if( !mpg ) return NULL; diff --git a/engine/common/soundlib/libmpg/mpg123.c b/engine/common/soundlib/libmpg/mpg123.c index 26b9042a..03968d48 100644 --- a/engine/common/soundlib/libmpg/mpg123.c +++ b/engine/common/soundlib/libmpg/mpg123.c @@ -174,7 +174,7 @@ int mpg123_param( mpg123_handle_t *mh, enum mpg123_parms key, long val ) { // special treatment for some settings. if( key == MPG123_INDEX_SIZE ) - { + { // apply frame index size and grow property on the fly. r = frame_index_setup( mh ); if( r != MPG123_OK ) diff --git a/engine/common/soundlib/libmpg/mpg123.h b/engine/common/soundlib/libmpg/mpg123.h index 80667780..6db8b3f7 100644 --- a/engine/common/soundlib/libmpg/mpg123.h +++ b/engine/common/soundlib/libmpg/mpg123.h @@ -172,7 +172,7 @@ enum mpg123_parms MPG123_RVA, /**< one of the RVA choices above (integer) */ MPG123_DOWNSPEED, /**< play a frame N times (integer) */ MPG123_UPSPEED, /**< play every Nth frame (integer) */ - MPG123_START_FRAME, /**< start with this frame (skip frames before that, integer) */ + MPG123_START_FRAME, /**< start with this frame (skip frames before that, integer) */ MPG123_DECODE_FRAMES, /**< decode only this number of frames (integer) */ MPG123_OUTSCALE, /**< the scale for output samples (amplitude - integer according to mpg123 output format) */ MPG123_TIMEOUT, /**< timeout for reading from a stream (not supported on win32, integer) */ @@ -258,7 +258,7 @@ struct mpg123_handle_s int rawbuffss; int bo; // just have it always here. byte *rawdecwin; // the block with all decwins - + int rawdecwins; // size of rawdecwin memory float *decwin; // _the_ decode table diff --git a/engine/common/soundlib/libmpg/parse.c b/engine/common/soundlib/libmpg/parse.c index 69bd36d0..8ef2db2d 100644 --- a/engine/common/soundlib/libmpg/parse.c +++ b/engine/common/soundlib/libmpg/parse.c @@ -65,7 +65,7 @@ void set_pointer( mpg123_handle_t *fr, long backstep ) if( backstep ) memcpy( fr->wordpointer, fr->bsbufold + fr->fsizeold - backstep, backstep ); - fr->bitindex = 0; + fr->bitindex = 0; } int frame_bitrate( mpg123_handle_t *fr ) @@ -82,7 +82,7 @@ double compute_bpf( mpg123_handle_t *fr ) { double bpf; - switch( fr->lay ) + switch( fr->lay ) { case 1: bpf = tabsel_123[fr->lsf][0][fr->bitrate_index]; @@ -127,9 +127,9 @@ double mpg123_tpf( mpg123_handle_t *fr ) int get_songlen( mpg123_handle_t *fr, int no ) { double tpf; - + if( !fr ) return 0; - + if( no < 0 ) { if( !fr->rd || fr->rdat.filelen < 0 ) @@ -220,7 +220,7 @@ static int check_lame_tag( mpg123_handle_t *fr ) } else goto check_lame_tag_no; - lame_offset += 4; + lame_offset += 4; xing_flags = bit_read_long( fr->bsbuf, &lame_offset ); // from now on, I have to carefully check if the announced data is actually @@ -258,7 +258,7 @@ static int check_lame_tag( mpg123_handle_t *fr ) { // the Xing bitstream length, at least as interpreted by the Lame // encoder, encompasses all data from the Xing header frame on, - // ignoring leading ID3v2 data. Trailing tags (ID3v1) seem to be + // ignoring leading ID3v2 data. Trailing tags (ID3v1) seem to be // included, though. if( fr->rdat.filelen < 1 ) { @@ -287,10 +287,10 @@ static int check_lame_tag( mpg123_handle_t *fr ) // 10: lowpass // 11-18: ReplayGain // 19: encoder flags - // 20: ABR + // 20: ABR // 21-23: encoder delays check_bytes_left( 24 ); // I'm interested in 24 B of extra info. - + if( fr->bsbuf[lame_offset] != 0 ) { byte lame_vbr; @@ -322,7 +322,7 @@ static int check_lame_tag( mpg123_handle_t *fr ) } } - lame_offset += 9; // 9 in + lame_offset += 9; // 9 in // the 4 big bits are tag revision, the small bits vbr method. lame_vbr = fr->bsbuf[lame_offset] & 15; @@ -381,7 +381,7 @@ static int check_lame_tag( mpg123_handle_t *fr ) if( fr->vbr == MPG123_ABR ) fr->abr_rate = fr->bsbuf[lame_offset]; lame_offset += 1; // 21 in - + // Encoder delay and padding, two 12 bit values // ... lame does write them from int. pad_in = ((((int) fr->bsbuf[lame_offset]) << 4) | (((int) fr->bsbuf[lame_offset+1]) >> 4)); @@ -455,7 +455,7 @@ static void halfspeed_prepare( mpg123_handle_t *fr ) static int halfspeed_do( mpg123_handle_t *fr ) { // speed-down hack: Play it again, Sam (the frame, I mean). - if( fr->p.halfspeed ) + if( fr->p.halfspeed ) { if( fr->halfphase ) // repeat last frame { @@ -614,7 +614,7 @@ static int decode_header( mpg123_handle_t *fr, ulong newhead, int *freeformat_co return PARSE_GOOD; } -// advance a byte in stream to get next possible header and forget +// advance a byte in stream to get next possible header and forget // buffered data if possible (for feed reader). static int forget_head_shift( mpg123_handle_t *fr, ulong *newheadp, int forget ) { @@ -743,7 +743,7 @@ static int skip_junk( mpg123_handle_t *fr, ulong *newheadp, long *headcount ) { ++(*headcount); if( limit >= 0 && *headcount >= limit ) - break; + break; if( ++forgetcount > FORGET_INTERVAL ) forgetcount = 0; @@ -814,7 +814,7 @@ static int wetwork( mpg123_handle_t *fr, ulong *newheadp ) try++; if( limit >= 0 && try >= limit ) - break; + break; if( ++forgetcount > FORGET_INTERVAL ) forgetcount = 0; diff --git a/engine/common/soundlib/libmpg/reader.c b/engine/common/soundlib/libmpg/reader.c index 848db1a9..db8d825f 100644 --- a/engine/common/soundlib/libmpg/reader.c +++ b/engine/common/soundlib/libmpg/reader.c @@ -80,7 +80,7 @@ static buffy_t* bc_alloc( bufferchain_t *bc, size_t size ) buffy_t *buf = bc->pool; bc->pool = buf->next; - buf->next = NULL; // that shall be set to a sensible value later. + buf->next = NULL; // that shall be set to a sensible value later. buf->size = 0; bc->pool_fill--; @@ -749,7 +749,7 @@ static int bad_back_bytes( mpg123_handle_t *mh, mpg_off_t bytes ) { mh->err = MP static int bad_seek_frame( mpg123_handle_t *mh, mpg_off_t num ) { mh->err = MPG123_NO_READER; return MPG123_ERR; } static mpg_off_t bad_tell( mpg123_handle_t *mh ) { mh->err = MPG123_NO_READER; return MPG123_ERR; } static void bad_rewind( mpg123_handle_t *mh ) { } -static void bad_close( mpg123_handle_t *mh ) { } +static void bad_close( mpg123_handle_t *mh ) { } static reader_t bad_reader = { diff --git a/engine/common/soundlib/libmpg/reader.h b/engine/common/soundlib/libmpg/reader.h index fc8fc015..c044d7df 100644 --- a/engine/common/soundlib/libmpg/reader.h +++ b/engine/common/soundlib/libmpg/reader.h @@ -91,7 +91,7 @@ typedef struct reader_data_s // buffered readers want that abstracted, set internally. mpg_ssize_t (*fullread)( mpg123_handle_t*, byte*, mpg_ssize_t ); - + bufferchain_t buffer; // not dynamically allocated, these few struct bytes aren't worth the trouble. } reader_data_t; diff --git a/engine/common/soundlib/libmpg/synth.c b/engine/common/soundlib/libmpg/synth.c index 9c294544..bf1ca981 100644 --- a/engine/common/soundlib/libmpg/synth.c +++ b/engine/common/soundlib/libmpg/synth.c @@ -23,14 +23,14 @@ GNU General Public License for more details. if(( sum ) > 32767.0f ) { *(samples) = 0x7fff; (clip)++; } \ else if(( sum ) < -32768.0f ) { *(samples) = -0x8000; (clip)++; } \ else { *(samples) = REAL_TO_SHORT( sum ); } - + // main synth function, uses the plain dct64 int synth_1to1( float *bandPtr, int channel, mpg123_handle_t *fr, int final ) { static const int step = 2; short *samples = (short *) (fr->buffer.data + fr->buffer.fill); float *b0, **buf; // (*buf)[0x110]; - int clip = 0; + int clip = 0; int bo1; if( !channel ) diff --git a/engine/common/soundlib/libmpg/tabinit.c b/engine/common/soundlib/libmpg/tabinit.c index 42ea89ed..fc66bfa9 100644 --- a/engine/common/soundlib/libmpg/tabinit.c +++ b/engine/common/soundlib/libmpg/tabinit.c @@ -49,7 +49,7 @@ static long intwinbase[] = { 48390, 50137, 51853, 53534, 55178, 56778, 58333, 59838, 61289, 62684, 64019, 65290, 66494, 67629, 68692, 69679, 70590, 71420, 72169, 72835, 73415, 73908, 74313, 74630, 74856, 74992, 75038 }; - + float *pnts[] = { cos64, cos32, cos16, cos8, cos4 }; void prepare_decode_tables( void ) diff --git a/engine/common/soundlib/snd_main.c b/engine/common/soundlib/snd_main.c index c68c14a1..265395a5 100644 --- a/engine/common/soundlib/snd_main.c +++ b/engine/common/soundlib/snd_main.c @@ -99,7 +99,7 @@ wavdata_t *FS_LoadSound( const char *filename, const byte *buffer, size_t size ) Mem_Free(f); // release buffer return SoundPack(); // loaded } - else Mem_Free(f); // release buffer + else Mem_Free(f); // release buffer } } } @@ -141,7 +141,7 @@ void FS_FreeSound( wavdata_t *pack ) ================ FS_OpenStream -open and reading basic info from sound stream +open and reading basic info from sound stream ================ */ stream_t *FS_OpenStream( const char *filename ) @@ -207,7 +207,7 @@ wavdata_t *FS_StreamInfo( stream_t *stream ) info.rate = stream->rate; info.width = stream->width; info.channels = stream->channels; - info.flags = SOUND_STREAM; + info.flags = SOUND_STREAM; info.size = stream->size; info.buffer = NULL; info.samples = 0; // not actual for streams diff --git a/engine/common/soundlib/snd_mp3.c b/engine/common/soundlib/snd_mp3.c index e8f44661..4b66664d 100644 --- a/engine/common/soundlib/snd_mp3.c +++ b/engine/common/soundlib/snd_mp3.c @@ -186,7 +186,7 @@ int Stream_ReadMPG( stream_t *stream, int needBytes, void *buffer ) // check remaining size if( bytesWritten + stream->pos > needBytes ) - outsize = ( needBytes - bytesWritten ); + outsize = ( needBytes - bytesWritten ); else outsize = stream->pos; // copy raw sample to output buffer diff --git a/engine/common/soundlib/snd_utils.c b/engine/common/soundlib/snd_utils.c index 97124192..5c9d53b6 100644 --- a/engine/common/soundlib/snd_utils.c +++ b/engine/common/soundlib/snd_utils.c @@ -67,7 +67,7 @@ void Sound_Init( void ) { case HOST_NORMAL: sound.loadformats = load_game; - sound.streamformat = stream_game; + sound.streamformat = stream_game; break; default: // all other instances not using soundlib or will be reinstalling later sound.loadformats = load_null; @@ -90,7 +90,7 @@ byte *Sound_Copy( size_t size ) out = Mem_Malloc( host.soundpool, size ); memcpy( out, sound.tempbuffer, size ); - return out; + return out; } uint GAME_EXPORT Sound_GetApproxWavePlayLen( const char *filepath ) @@ -256,7 +256,7 @@ qboolean Sound_Process( wavdata_t **wav, int rate, int width, uint flags ) { wavdata_t *snd = *wav; qboolean result = true; - + // check for buffers if( !snd || !snd->buffer ) return false; diff --git a/engine/common/soundlib/snd_wav.c b/engine/common/soundlib/snd_wav.c index 7b53d460..97c268e3 100644 --- a/engine/common/soundlib/snd_wav.c +++ b/engine/common/soundlib/snd_wav.c @@ -72,7 +72,7 @@ static void FindNextChunk( const char *name ) iff_dataPtr = NULL; return; } - + iff_dataPtr += 4; iff_chunkLen = GetLittleLong(); @@ -217,14 +217,14 @@ qboolean Sound_LoadWAV( const char *name, const byte *buffer, fs_offset_t filesi if( iff_dataPtr ) { if( !Q_strncmp( (const char *)iff_dataPtr + 28, "mark", 4 )) - { + { // this is not a proper parse, but it works with CoolEdit... iff_dataPtr += 24; sound.samples = sound.loopstart + GetLittleLong(); // samples in loop } } } - else + else { sound.loopstart = -1; sound.samples = 0; @@ -321,7 +321,7 @@ stream_t *Stream_OpenWAV( const char *filename ) // open file = FS_Open( filename, "rb", false ); - if( !file ) return NULL; + if( !file ) return NULL; // find "RIFF" chunk if( !StreamFindNextChunk( file, "RIFF", &last_chunk )) @@ -392,7 +392,7 @@ stream_t *Stream_OpenWAV( const char *filename ) stream->width = sound.width; stream->rate = sound.rate; stream->type = WF_PCMDATA; - + return stream; } diff --git a/engine/common/soundlib/soundlib.h b/engine/common/soundlib/soundlib.h index 686d50b1..bcdcbf60 100644 --- a/engine/common/soundlib/soundlib.h +++ b/engine/common/soundlib/soundlib.h @@ -94,13 +94,13 @@ struct stream_s typedef struct { - int riff_id; // 'RIFF' + int riff_id; // 'RIFF' int rLen; - int wave_id; // 'WAVE' - int fmt_id; // 'fmt ' + int wave_id; // 'WAVE' + int fmt_id; // 'fmt ' int pcm_header_len; // varies... short wFormatTag; - short nChannels; // 1,2 for stereo data is (l,r) pairs + short nChannels; // 1,2 for stereo data is (l,r) pairs int nSamplesPerSec; int nAvgBytesPerSec; short nBlockAlign; @@ -109,7 +109,7 @@ typedef struct typedef struct { - int data_id; // 'data' or 'fact' + int data_id; // 'data' or 'fact' int dLen; } chunkhdr_t; diff --git a/engine/common/system.c b/engine/common/system.c index 87cc83f2..7d42ded7 100644 --- a/engine/common/system.c +++ b/engine/common/system.c @@ -277,7 +277,7 @@ qboolean Sys_LoadLibrary( dll_info_t *dll ) Con_Reportf( "Sys_LoadLibrary: Loading %s", dll->name ); - if( dll->fcts ) + if( dll->fcts ) { // lookup export table for( func = dll->fcts; func && func->name != NULL; func++ ) @@ -287,7 +287,7 @@ qboolean Sys_LoadLibrary( dll_info_t *dll ) if( !dll->link ) dll->link = LoadLibrary ( dll->name ); // environment pathes // no DLL found - if( !dll->link ) + if( !dll->link ) { Q_snprintf( errorstring, sizeof( errorstring ), "Sys_LoadLibrary: couldn't load %s\n", dll->name ); goto error; @@ -307,7 +307,7 @@ qboolean Sys_LoadLibrary( dll_info_t *dll ) return true; error: Con_Reportf( " - failed\n" ); - Sys_FreeLibrary( dll ); // trying to free + Sys_FreeLibrary( dll ); // trying to free if( dll->crash ) Sys_Error( "%s", errorstring ); else Con_Reportf( S_ERROR "%s", errorstring ); @@ -354,7 +354,7 @@ void Sys_WaitForQuit( void ) #if XASH_WIN32 MSG msg; - Wcon_RegisterHotkeys(); + Wcon_RegisterHotkeys(); msg.message = 0; @@ -365,7 +365,7 @@ void Sys_WaitForQuit( void ) { TranslateMessage( &msg ); DispatchMessage( &msg ); - } + } else Sys_Sleep( 20 ); } #endif @@ -415,7 +415,7 @@ void Sys_Error( const char *error, ... ) if( host.change_game ) Sys_Sleep( 200 ); error_on_exit = true; - host.status = HOST_ERR_FATAL; + host.status = HOST_ERR_FATAL; va_start( argptr, error ); Q_vsnprintf( text, MAX_PRINT_MSG, error, argptr ); va_end( argptr ); diff --git a/engine/common/world.c b/engine/common/world.c index 09ed0749..592c39db 100644 --- a/engine/common/world.c +++ b/engine/common/world.c @@ -85,7 +85,7 @@ World_MoveBounds void World_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs ) { int i; - + for( i = 0; i < 3; i++ ) { if( end[i] > start[i] ) @@ -106,7 +106,7 @@ trace_t World_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch if( trace->allsolid || trace->startsolid || trace->fraction < cliptrace->fraction ) { trace->ent = touch; - + if( cliptrace->startsolid ) { *cliptrace = *trace; diff --git a/engine/common/world.h b/engine/common/world.h index bfcdc8c4..d3a10ce5 100644 --- a/engine/common/world.h +++ b/engine/common/world.h @@ -79,5 +79,5 @@ typedef struct event_state_s { event_info_t ei[MAX_EVENT_QUEUE]; } event_state_t; - + #endif//WORLD_H diff --git a/engine/common/zone.c b/engine/common/zone.c index 15cd915e..03d70fb5 100644 --- a/engine/common/zone.c +++ b/engine/common/zone.c @@ -118,7 +118,7 @@ static void Mem_FreeBlock( memheader_t *mem, const char *filename, int fileline } if( *((byte *)mem + sizeof( memheader_t ) + mem->size ) != MEMHEADER_SENTINEL2 ) - { + { mem->filename = Mem_CheckFilename( mem->filename ); // make sure what we don't crash var_args Sys_Error( "Mem_Free: trashed header sentinel 2 (alloc at %s:%i, free at %s:%i)\n", mem->filename, mem->fileline, filename, fileline ); } @@ -163,7 +163,7 @@ void *_Mem_Realloc( byte *poolptr, void *memptr, size_t size, qboolean clear, co nb = _Mem_Alloc( poolptr, size, clear, filename, fileline ); if( memptr ) // first allocate? - { + { size_t newsize = memhdr->size < size ? memhdr->size : size; // upper data can be trucnated! memcpy( nb, memptr, newsize ); _Mem_Free( memptr, filename, fileline ); // free unused old block @@ -280,7 +280,7 @@ void Mem_CheckHeaderSentinels( void *data, const char *filename, int fileline ) } if( *((byte *)mem + sizeof(memheader_t) + mem->size) != MEMHEADER_SENTINEL2 ) - { + { mem->filename = Mem_CheckFilename( mem->filename ); // make sure what we don't crash var_args Sys_Error( "Mem_CheckSentinels: trashed header sentinel 2 (block allocated at %s:%i, sentinel check at %s:%i)\n", mem->filename, mem->fileline, filename, fileline ); } diff --git a/engine/custom.h b/engine/custom.h index e8eaab01..da01f745 100644 --- a/engine/custom.h +++ b/engine/custom.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -75,7 +75,7 @@ typedef struct customization_s { qboolean bInUse; // Is this customization in use; resource_t resource; // The resource_t for this customization - qboolean bTranslated; // Has the raw data been translated into a useable format? + qboolean bTranslated; // Has the raw data been translated into a useable format? // (e.g., raw decal .wad make into texture_t *) int nUserData1; // Customization specific data int nUserData2; // Customization specific data diff --git a/engine/customentity.h b/engine/customentity.h index 9443da9c..d5632376 100644 --- a/engine/customentity.h +++ b/engine/customentity.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -23,7 +23,7 @@ #define BEAMENT_ATTACHMENT( x ) (((x)>>12) & 0xF) // Beam types, encoded as a byte -enum +enum { BEAM_POINTS = 0, BEAM_ENTPOINT, diff --git a/engine/edict.h b/engine/edict.h index 820190e1..d74d08b1 100644 --- a/engine/edict.h +++ b/engine/edict.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -39,7 +39,7 @@ struct edict_s short leafnums[MAX_ENT_LEAFS]; #endif float freetime; // sv.time when the object was freed - + void* pvPrivateData; // Alloced and freed by engine, used by DLLs entvars_t v; // C exported fields from progs diff --git a/engine/eiface.h b/engine/eiface.h index a7798927..932a42ff 100644 --- a/engine/eiface.h +++ b/engine/eiface.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -82,7 +82,7 @@ typedef struct } TraceResult; // CD audio status -typedef struct +typedef struct { int fPlaying;// is sound playing right now? int fWasPlaying;// if not, CD is paused if WasPlaying is true. @@ -93,7 +93,7 @@ typedef struct int fCDRom; int fPlayTrack; } CDStatus; - + typedef unsigned int CRC32_t; typedef struct delta_s delta_t; @@ -184,8 +184,8 @@ typedef struct enginefuncs_s const char *(*pfnNameForFunction)( unsigned long function ); void (*pfnClientPrintf)( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients void (*pfnServerPrint)( const char *szMsg ); - const char *(*pfnCmd_Args)( void ); // these 3 added - const char *(*pfnCmd_Argv)( int argc ); // so game DLL can easily + const char *(*pfnCmd_Args)( void ); // these 3 added + const char *(*pfnCmd_Argv)( int argc ); // so game DLL can easily int (*pfnCmd_Argc)( void ); // access client 'cmd' strings void (*pfnGetAttachment)( const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles ); void (*pfnCRC32_Init)( CRC32_t *pulCRC ); @@ -228,7 +228,7 @@ typedef struct enginefuncs_s const char *(*pfnGetPhysicsInfoString)( const edict_t *pClient ); unsigned short (*pfnPrecacheEvent)( int type, const char*psz ); void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); - + unsigned char *(*pfnSetFatPVS)( const float *org ); unsigned char *(*pfnSetFatPAS)( const float *org ); @@ -280,7 +280,7 @@ typedef struct enginefuncs_s int (*pfnCheckParm)( char *parm, char **ppnext ); } enginefuncs_t; // ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138 - + // Passed to pfnKeyValue typedef struct KeyValueData_s { @@ -299,7 +299,7 @@ typedef struct vec3_t vecLandmarkOrigin; } LEVELLIST; -typedef struct +typedef struct { int id; // Ordinal ID of this entity (used for entity <--> pointer conversions) edict_t *pent; // Pointer to the in-game entity @@ -381,7 +381,7 @@ typedef enum _fieldtypes #define FTYPEDESC_KEY 0x0004 // This field can be requested and written to by string name at load time #define FTYPEDESC_FUNCTIONTABLE 0x0008 // This is a table entry for a member function pointer -typedef struct +typedef struct { FIELDTYPE fieldType; char *fieldName; @@ -400,10 +400,10 @@ struct usercmd_s; struct edict_s; struct netadr_s; -typedef struct +typedef struct { // Initialize/shutdown the game (one-time call after loading of game .dll ) - void (*pfnGameInit)( void ); + void (*pfnGameInit)( void ); int (*pfnSpawn)( edict_t *pent ); void (*pfnThink)( edict_t *pent ); void (*pfnUse)( edict_t *pentUsed, edict_t *pentOther ); @@ -421,7 +421,7 @@ typedef struct void (*pfnResetGlobalState)( void ); qboolean (*pfnClientConnect)( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128] ); - + void (*pfnClientDisconnect)( edict_t *pEntity ); void (*pfnClientKill)( edict_t *pEntity ); void (*pfnClientPutInServer)( edict_t *pEntity ); @@ -491,12 +491,12 @@ extern DLL_FUNCTIONS gEntityInterface; typedef struct { - // Called right before the object's memory is freed. + // Called right before the object's memory is freed. // Calls its destructor. void (*pfnOnFreeEntPrivateData)( edict_t *pEnt ); void (*pfnGameShutdown)(void); int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther ); - void (*pfnCvarValue)( const edict_t *pEnt, const char *value ); + void (*pfnCvarValue)( const edict_t *pEnt, const char *value ); void (*pfnCvarValue2)( const edict_t *pEnt, int requestID, const char *cvarName, const char *value ); } NEW_DLL_FUNCTIONS; typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion ); diff --git a/engine/keydefs.h b/engine/keydefs.h index 577cc35f..951d3cf4 100644 --- a/engine/keydefs.h +++ b/engine/keydefs.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -73,7 +73,7 @@ #define K_CAPSLOCK 175 #define K_KP_NUMLOCK 176 #define K_WIN 177 - + // // joystick buttons // diff --git a/engine/menu_int.h b/engine/menu_int.h index d97d3685..ccace287 100644 --- a/engine/menu_int.h +++ b/engine/menu_int.h @@ -32,7 +32,7 @@ typedef int HIMAGE; // handle to a graphic #define PIC_NOFLIP_TGA (1<<2) // Steam background completely ignore tga attribute 0x20 typedef struct ui_globalvars_s -{ +{ float time; // unclamped host.realtime float frametime; @@ -82,7 +82,7 @@ typedef struct ui_enginefuncs_s const char* (*pfnCmdArgv)( int argc ); const char* (*pfnCmd_Args)( void ); - // debug messages (in-menu shows only notify) + // debug messages (in-menu shows only notify) void (*Con_Printf)( const char *fmt, ... ); void (*Con_DPrintf)( const char *fmt, ... ); void (*Con_NPrintf)( int pos, const char *fmt, ... ); @@ -120,7 +120,7 @@ typedef struct ui_enginefuncs_s int (*pfnCreateMapsList)( int fRefresh ); int (*pfnClientInGame)( void ); void (*pfnClientJoin)( const struct netadr_s adr ); - + // parse txt files byte* (*COM_LoadFile)( const char *filename, int *pLength ); char* (*COM_ParseFile)( char *data, char *token ); @@ -158,8 +158,8 @@ typedef struct ui_enginefuncs_s void (*pfnHostEndGame)( const char *szFinalMessage ); // menu interface is freezed at version 0.75 - // new functions starts here - float (*pfnRandomFloat)( float flLow, float flHigh ); + // new functions starts here + float (*pfnRandomFloat)( float flLow, float flHigh ); int (*pfnRandomLong)( int lLow, int lHigh ); void (*pfnSetCursor)( void *hCursor ); // change cursor @@ -204,7 +204,7 @@ typedef struct ui_extendedfuncs_s { // new engine extended api start here // returns 1 if there are more in list, otherwise 0 int (*pfnGetRenderers)( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 ); - + double (*pfnDoubleTime)( void ); } ui_extendedfuncs_t; diff --git a/engine/platform/android/vid_android.c b/engine/platform/android/vid_android.c index d0119201..f17c195e 100644 --- a/engine/platform/android/vid_android.c +++ b/engine/platform/android/vid_android.c @@ -167,7 +167,7 @@ void Android_UpdateSurface( qboolean active ) nw.release( vid_android.window ); vid_android.window = NULL; } - + if( active ) { jobject surf; diff --git a/engine/platform/apple/lib_ios.c b/engine/platform/apple/lib_ios.c index 8a3e317a..8e4518c5 100644 --- a/engine/platform/apple/lib_ios.c +++ b/engine/platform/apple/lib_ios.c @@ -25,7 +25,7 @@ static void *IOS_LoadLibraryInternal( const char *dllname ) void *pHandle; string errorstring = ""; char path[MAX_SYSPATH]; - + // load frameworks from Documents directory // frameworks should be signed with same key with application // Useful for debug to prevent rebuilding app on every library update @@ -36,7 +36,7 @@ static void *IOS_LoadLibraryInternal( const char *dllname ) return pHandle; Q_snprintf( errorstring, MAX_STRING, dlerror() ); #endif - + #ifdef DLOPEN_FRAMEWORKS // load frameworks as it should be located in Xcode builds Q_snprintf( path, MAX_SYSPATH, "%s%s.framework/lib", SDL_GetBasePath(), dllname ); diff --git a/engine/platform/dos/in_dos.c b/engine/platform/dos/in_dos.c index e3be06c5..3e2f30cc 100644 --- a/engine/platform/dos/in_dos.c +++ b/engine/platform/dos/in_dos.c @@ -26,27 +26,27 @@ qboolean chars; //============================================================================= -byte scantokey[128] = - { -// 0 1 2 3 4 5 6 7 -// 8 9 A B C D E F - 0 , 27, '1', '2', '3', '4', '5', '6', - '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', - 'o', 'p', '[', ']', 13 , K_CTRL,'a', 's', // 1 - 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', - '\'' , '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 - 'b', 'n', 'm', ',', '.', '/', K_SHIFT,'*', - K_ALT,' ', 0 , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 - K_F6, K_F7, K_F8, K_F9, K_F10,0 , 0 , K_HOME, - K_UPARROW,K_PGUP,'-',K_LEFTARROW,'5',K_RIGHTARROW,'+',K_END, //4 - K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, - K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, - 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 - }; +byte scantokey[128] = + { +// 0 1 2 3 4 5 6 7 +// 8 9 A B C D E F + 0 , 27, '1', '2', '3', '4', '5', '6', + '7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0 + 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', + 'o', 'p', '[', ']', 13 , K_CTRL,'a', 's', // 1 + 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', + '\'' , '`', K_SHIFT,'\\', 'z', 'x', 'c', 'v', // 2 + 'b', 'n', 'm', ',', '.', '/', K_SHIFT,'*', + K_ALT,' ', 0 , K_F1, K_F2, K_F3, K_F4, K_F5, // 3 + K_F6, K_F7, K_F8, K_F9, K_F10,0 , 0 , K_HOME, + K_UPARROW,K_PGUP,'-',K_LEFTARROW,'5',K_RIGHTARROW,'+',K_END, //4 + K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11, + K_F12,0 , 0 , 0 , 0 , 0 , 0 , 0, // 5 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6 + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, + 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7 + }; // will be implemented later diff --git a/engine/platform/emscripten/lib_em.c b/engine/platform/emscripten/lib_em.c index 9c78a850..b239056f 100644 --- a/engine/platform/emscripten/lib_em.c +++ b/engine/platform/emscripten/lib_em.c @@ -22,7 +22,7 @@ GNU General Public License for more details. void *EMSCRIPTEN_LoadLibrary( const char *dllname ) { void *pHandle = NULL; - + #ifdef EMSCRIPTEN_LIB_FS char path[MAX_SYSPATH]; string prefix; diff --git a/engine/platform/linux/in_evdev.c b/engine/platform/linux/in_evdev.c index 05501363..11a2ce43 100644 --- a/engine/platform/linux/in_evdev.c +++ b/engine/platform/linux/in_evdev.c @@ -129,7 +129,7 @@ static int KeycodeFromEvdev(int keycode, int value) break; } - return 0; + return 0; } static void Evdev_CheckPermissions( void ) { @@ -396,7 +396,7 @@ void IN_EvdevFrame ( void ) if( CVAR_TO_BOOL(m_ignore) ) continue; - + evdev.x += -dx * m_yaw->value; evdev.y += dy * m_pitch->value; } diff --git a/engine/platform/misc/kmalloc.c b/engine/platform/misc/kmalloc.c index 6e205b4f..76b82e66 100644 --- a/engine/platform/misc/kmalloc.c +++ b/engine/platform/misc/kmalloc.c @@ -45,9 +45,9 @@ static char *rcsid = "$NetBSD: malloc.c,v 1.8 1997/04/07 03:12:14 christos Exp $ * malloc.c (Caltech) 2/21/82 * Chris Kingsley, kingsley@cit-20. * - * This is a very fast storage allocator. It allocates blocks of a small + * This is a very fast storage allocator. It allocates blocks of a small * number of different sizes, and keeps free lists of each size. Blocks that - * don't exactly fit are passed up to the next larger size. In this + * don't exactly fit are passed up to the next larger size. In this * implementation, the available sizes are 2^n-4 (or 2^n-10) bytes long. * This is designed for use in a virtual memory environment. */ @@ -291,7 +291,7 @@ morecore(int bucket) /* free */ void SWAP_Free( void *cp) -{ +{ register long size; register union overhead *op; @@ -363,7 +363,7 @@ void * SWAP_Realloc( void *cp, size_t nbytes) -{ +{ register u_long onb; register long i; union overhead *op; @@ -456,7 +456,7 @@ int srchlen) #ifdef MSTATS /* * mstats - print out statistics about malloc - * + * * Prints two lines of numbers, one showing the length of the free list * for each size category, the second showing the number of mallocs - * frees for each size category. diff --git a/engine/platform/platform.h b/engine/platform/platform.h index 134a2563..a8d903ea 100644 --- a/engine/platform/platform.h +++ b/engine/platform/platform.h @@ -45,22 +45,22 @@ const char *Android_LoadID( void ); void Android_SaveID( const char *id ); #endif -/* -============================================================================== - - MOBILE API - -============================================================================== +/* +============================================================================== + + MOBILE API + +============================================================================== */ void Platform_Vibrate( float life, char flags ); void*Platform_GetNativeObject( const char *name ); -/* -============================================================================== - - INPUT - -============================================================================== +/* +============================================================================== + + INPUT + +============================================================================== */ // Gamepad support int Platform_JoyInit( int numjoy ); // returns number of connected gamepads, negative if error @@ -92,12 +92,12 @@ void Android_ShowMouse( qboolean show ); void Android_MouseMove( float *x, float *y ); #endif -/* -============================================================================== - - WINDOW MANAGEMENT - -============================================================================== +/* +============================================================================== + + WINDOW MANAGEMENT + +============================================================================== */ typedef enum { diff --git a/engine/platform/sdl/s_sdl.c b/engine/platform/sdl/s_sdl.c index 4f88efb7..6a260489 100644 --- a/engine/platform/sdl/s_sdl.c +++ b/engine/platform/sdl/s_sdl.c @@ -26,7 +26,7 @@ GNU General Public License for more details. #if ! SDL_VERSION_ATLEAST( 2, 0, 0 ) #include -#define SDL_setenv setenv +#define SDL_setenv setenv #define SDL_GetCurrentAudioDriver() "legacysdl" #define SDL_OpenAudioDevice( a, b, c, d, e ) SDL_OpenAudio( ( c ), ( d ) ) #define SDL_CloseAudioDevice( a ) SDL_CloseAudio() diff --git a/engine/platform/sdl/vid_sdl.c b/engine/platform/sdl/vid_sdl.c index 8d7ba673..30e0dcc1 100644 --- a/engine/platform/sdl/vid_sdl.c +++ b/engine/platform/sdl/vid_sdl.c @@ -335,7 +335,7 @@ static void R_InitVideoModes( void ) num_vidmodes++; } #endif // SDL_VERSION_ATLEAST( 2, 0, 0 ) - + } static void R_FreeVideoModes( void ) @@ -1159,7 +1159,7 @@ R_Free_Video ================== */ void R_Free_Video( void ) -{ +{ GL_DeleteContext (); VID_DestroyWindow (); diff --git a/engine/platform/win32/con_win.c b/engine/platform/win32/con_win.c index 6f4985f5..3b63c368 100644 --- a/engine/platform/win32/con_win.c +++ b/engine/platform/win32/con_win.c @@ -241,7 +241,7 @@ void Wcon_WinPrint( const char *pMsg ) { SendMessage( s_wcd.hwndBuffer, EM_SETSEL, 0, -1 ); s_wcd.outLen = len; - } + } SendMessage( s_wcd.hwndBuffer, EM_REPLACESEL, 0, (LPARAM)pMsg ); @@ -312,7 +312,7 @@ void Wcon_CreateConsole( void ) // print into log Con_Reportf( S_ERROR "Can't register window class '%s'\n", SYSCONSOLE ); return; - } + } AdjustWindowRect( &rect, DEDSTYLE, FALSE ); @@ -396,7 +396,7 @@ destroy win32 console */ void Wcon_DestroyConsole( void ) { - // last text message into console or log + // last text message into console or log Con_Reportf( "Sys_FreeLibrary: Unloading xash.dll\n" ); Sys_CloseLog(); @@ -436,17 +436,17 @@ void Wcon_DestroyConsole( void ) ================ Con_Input -returned input text +returned input text ================ */ char *Wcon_Input( void ) { if( s_wcd.consoleText[0] == 0 ) return NULL; - + Q_strncpy( s_wcd.returnedText, s_wcd.consoleText, sizeof( s_wcd.returnedText )); s_wcd.consoleText[0] = 0; - + return s_wcd.returnedText; } @@ -454,7 +454,7 @@ char *Wcon_Input( void ) ================ Con_SetFocus -change focus to console hwnd +change focus to console hwnd ================ */ void Wcon_RegisterHotkeys( void ) diff --git a/engine/platform/win32/lib_win.c b/engine/platform/win32/lib_win.c index 8f32d2d2..5e7e2ac8 100644 --- a/engine/platform/win32/lib_win.c +++ b/engine/platform/win32/lib_win.c @@ -301,7 +301,7 @@ static void FinalizeSections( MEMORYMODULE *module ) { PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION( module->headers ); int i; - + // loop through all sections and change access flags for( i = 0; i < module->headers->FileHeader.NumberOfSections; i++, section++ ) { @@ -365,7 +365,7 @@ static void PerformBaseRelocation( MEMORYMODULE *module, DWORD delta ) type = *relInfo >> 12; // the lower 12 bits define the offset offset = *relInfo & 0xfff; - + switch( type ) { case IMAGE_REL_BASED_ABSOLUTE: @@ -518,7 +518,7 @@ static void MemoryFreeLibrary( void *hInstance ) if( module != NULL ) { int i; - + if( module->initialized != 0 ) { // notify library about detaching from process @@ -611,7 +611,7 @@ void *MemoryLoadLibrary( const char *name ) // commit memory for headers headers = (byte *)VirtualAlloc( code, old_header->OptionalHeader.SizeOfHeaders, MEM_COMMIT, PAGE_READWRITE ); - + // copy PE header to code memcpy( headers, dos_header, dos_header->e_lfanew + old_header->OptionalHeader.SizeOfHeaders ); result->headers = (PIMAGE_NT_HEADERS)&((const byte *)(headers))[dos_header->e_lfanew]; @@ -820,7 +820,7 @@ qboolean LibraryLoadSymbols( dll_user_t *hInst ) goto table_error; } - if((( optional_header.DataDirectory[0].VirtualAddress >= section_header.VirtualAddress ) && + if((( optional_header.DataDirectory[0].VirtualAddress >= section_header.VirtualAddress ) && (optional_header.DataDirectory[0].VirtualAddress < (section_header.VirtualAddress + section_header.Misc.VirtualSize)))) { rdata_found = true; @@ -830,7 +830,7 @@ qboolean LibraryLoadSymbols( dll_user_t *hInst ) if( rdata_found ) { - rdata_delta = section_header.VirtualAddress - section_header.PointerToRawData; + rdata_delta = section_header.VirtualAddress - section_header.PointerToRawData; } exports_offset = optional_header.DataDirectory[0].VirtualAddress - rdata_delta; @@ -989,7 +989,7 @@ qboolean COM_CheckLibraryDirectDependency( const char *name, const char *depname } directory = &old_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]; - + if( directory->Size <= 0 ) { Q_snprintf( errorstring, sizeof( errorstring ), "%s has no dependencies. Is this dll valid?\n", name ); @@ -1091,7 +1091,7 @@ void COM_FreeLibrary( void *hInstance ) return; } else Con_Reportf( "Sys_FreeLibrary: Unloading %s\n", hInst->dllName ); - + if( hInst->custom_loader ) MemoryFreeLibrary( hInst->hInstance ); else FreeLibrary( hInst->hInstance ); diff --git a/engine/progdefs.h b/engine/progdefs.h index 5e540439..2a0e133b 100644 --- a/engine/progdefs.h +++ b/engine/progdefs.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -17,7 +17,7 @@ #define PROGDEFS_H typedef struct -{ +{ float time; float frametime; float force_retouch; @@ -56,12 +56,12 @@ typedef struct entvars_s { string_t classname; string_t globalname; - + vec3_t origin; vec3_t oldorigin; vec3_t velocity; vec3_t basevelocity; - vec3_t clbasevelocity; // Base velocity that was passed in to server physics so + vec3_t clbasevelocity; // Base velocity that was passed in to server physics so // client can predict conveyors correctly. Server zeroes it, so we need to store here, too. vec3_t movedir; @@ -142,7 +142,7 @@ typedef struct entvars_s int spawnflags; int flags; - + int colormap; // lowbyte topcolor, highbyte bottomcolor int team; diff --git a/engine/sequence.h b/engine/sequence.h index dd1cbc41..84854fa0 100644 --- a/engine/sequence.h +++ b/engine/sequence.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- -// +// // S c r i p t e d S e q u e n c e s -// +// //--------------------------------------------------------------------------- #ifndef _INCLUDE_SEQUENCE_H_ #define _INCLUDE_SEQUENCE_H_ @@ -34,7 +34,7 @@ typedef struct client_textmessage_s //--------------------------------------------------------------------------- // sequenceCommandEnum_e -// +// // Enumerated sequence command types. //--------------------------------------------------------------------------- enum sequenceCommandEnum_ @@ -92,7 +92,7 @@ typedef enum sequenceModifierBits sequenceModifierBits_e ; //--------------------------------------------------------------------------- // sequenceCommandType_e -// +// // Typeerated sequence command types. //--------------------------------------------------------------------------- enum sequenceCommandType_ @@ -105,7 +105,7 @@ typedef enum sequenceCommandType_ sequenceCommandType_e; //--------------------------------------------------------------------------- // sequenceCommandMapping_s -// +// // A mapping of a command enumerated-value to its name. //--------------------------------------------------------------------------- typedef struct sequenceCommandMapping_ sequenceCommandMapping_s; @@ -119,7 +119,7 @@ struct sequenceCommandMapping_ //--------------------------------------------------------------------------- // sequenceCommandLine_s -// +// // Structure representing a single command (usually 1 line) from a // .SEQ file entry. //--------------------------------------------------------------------------- @@ -144,7 +144,7 @@ struct sequenceCommandLine_ //--------------------------------------------------------------------------- // sequenceEntry_s -// +// // Structure representing a single command (usually 1 line) from a // .SEQ file entry. //--------------------------------------------------------------------------- diff --git a/engine/server/server.h b/engine/server/server.h index 47fbf173..f8fb8def 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -131,7 +131,7 @@ typedef struct server_s int hostflags; // misc server flags: predicting etc CRC32_t worldmapCRC; // check crc for catch cheater maps - int progsCRC; // this is used with feature ENGINE_QUAKE_COMPATIBLE + int progsCRC; // this is used with feature ENGINE_QUAKE_COMPATIBLE char name[MAX_QPATH]; // map name char startspot[MAX_QPATH]; @@ -216,7 +216,7 @@ typedef struct sv_client_s int chokecount; // number of messages rate supressed int delta_sequence; // -1 = no compression. - double next_messagetime; // time when we should send next world state update + double next_messagetime; // time when we should send next world state update double next_checkpingtime; // time to send all players pings to client double next_sendinfotime; // time to send info about all players double cl_updaterate; // client requested updaterate diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index 243bf860..0fc3fd60 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -522,7 +522,7 @@ edict_t *SV_FakeConnect( const char *netname ) if( count == 1 || count == svs.maxclients ) svs.last_heartbeat = MAX_HEARTBEAT; - + return cl->edict; } @@ -538,7 +538,7 @@ or crashing. void SV_DropClient( sv_client_t *cl, qboolean crash ) { int i; - + if( cl->state == cs_zombie ) return; // already dropped @@ -882,7 +882,7 @@ void SV_BuildNetAnswer( netadr_t from ) { edict_t *ed = svs.clients[i].edict; float time = host.realtime - svs.clients[i].connection_started; - Q_strncat( string, va( "%c\\%s\\%i\\%f\\", count, svs.clients[i].name, (int)ed->v.frags, time ), sizeof( string )); + Q_strncat( string, va( "%c\\%s\\%i\\%f\\", count, svs.clients[i].name, (int)ed->v.frags, time ), sizeof( string )); count++; } } @@ -1024,7 +1024,7 @@ int SV_CalcPing( sv_client_t *cl ) =================== SV_EstablishTimeBase -Finangles latency and the like. +Finangles latency and the like. =================== */ void SV_EstablishTimeBase( sv_client_t *cl, usercmd_t *cmds, int dropped, int numbackup, int numcmds ) @@ -1045,7 +1045,7 @@ void SV_EstablishTimeBase( sv_client_t *cl, usercmd_t *cmds, int dropped, int nu cmdnum = dropped + numcmds - 1; runcmd_time += (double)cmds[cmdnum].msec / 1000.0; dropped--; - } + } } for( i = numcmds - 1; i >= 0; i-- ) @@ -1092,7 +1092,7 @@ float SV_CalcClientTime( sv_client_t *cl ) minping = 9999.0f; maxping = -9999.0f; ping /= count; - + for( i = 0; i < ( SV_UPDATE_BACKUP <= 4 ? SV_UPDATE_BACKUP : 4 ); i++ ) { client_frame_t *frame = &cl->frames[SV_UPDATE_MASK & (cl->netchan.incoming_acknowledged - i)]; @@ -1124,7 +1124,7 @@ void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg ) char info[MAX_INFO_STRING]; char digest[16]; MD5Context_t ctx; - int i; + int i; // process userinfo before updating SV_UserinfoChanged( cl ); @@ -1309,7 +1309,7 @@ void SV_PutClientInServer( sv_client_t *cl ) sv.paused = false; } else - { + { if( Q_atoi( Info_ValueForKey( cl->userinfo, "hltv" ))) SetBits( cl->flags, FCL_HLTV_PROXY ); @@ -1603,7 +1603,7 @@ The client is going to disconnect, so remove the connection immediately */ static qboolean SV_Disconnect_f( sv_client_t *cl ) { - SV_DropClient( cl, false ); + SV_DropClient( cl, false ); return true; } @@ -1664,7 +1664,7 @@ void SV_UserinfoChanged( sv_client_t *cl ) { int i, dupc = 1; edict_t *ent = cl->edict; - string name1, name2; + string name1, name2; sv_client_t *current; const char *val; @@ -1728,7 +1728,7 @@ void SV_UserinfoChanged( sv_client_t *cl ) cl->netchan.rate = bound( MIN_RATE, Q_atoi( val ), MAX_RATE ); else cl->netchan.rate = DEFAULT_RATE; - // movement prediction + // movement prediction if( Q_atoi( Info_ValueForKey( cl->userinfo, "cl_nopred" ))) ClearBits( cl->flags, FCL_PREDICT_MOVEMENT ); else SetBits( cl->flags, FCL_PREDICT_MOVEMENT ); @@ -2241,7 +2241,7 @@ void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg ) ================== SV_ParseClientMove -The message usually contains all the movement commands +The message usually contains all the movement commands that were in the last three packets, so that the information in dropped packets can be recovered. @@ -2467,7 +2467,7 @@ void SV_ParseResourceList( sv_client_t *cl, sizebuf_t *msg ) =================== SV_ParseCvarValue -Parse a requested value from client cvar +Parse a requested value from client cvar =================== */ void SV_ParseCvarValue( sv_client_t *cl, sizebuf_t *msg ) @@ -2483,7 +2483,7 @@ void SV_ParseCvarValue( sv_client_t *cl, sizebuf_t *msg ) =================== SV_ParseCvarValue2 -Parse a requested value from client cvar +Parse a requested value from client cvar =================== */ void SV_ParseCvarValue2( sv_client_t *cl, sizebuf_t *msg ) @@ -2529,7 +2529,7 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg ) cl->latency = SV_CalcClientTime( cl ); cl->delta_sequence = -1; // no delta unless requested - + // read optional clientCommand strings while( cl->state != cs_zombie ) { @@ -2558,7 +2558,7 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg ) move_issued = true; SV_ParseClientMove( cl, msg ); break; - case clc_stringcmd: + case clc_stringcmd: SV_ExecuteClientCommand( cl, MSG_ReadString( msg )); if( cl->state == cs_zombie ) return; // disconnect command diff --git a/engine/server/sv_cmds.c b/engine/server/sv_cmds.c index 3305b471..a1be19b3 100644 --- a/engine/server/sv_cmds.c +++ b/engine/server/sv_cmds.c @@ -32,11 +32,11 @@ void SV_ClientPrintf( sv_client_t *cl, char *fmt, ... ) if( FBitSet( cl->flags, FCL_FAKECLIENT )) return; - + va_start( argptr, fmt ); Q_vsprintf( string, fmt, argptr ); va_end( argptr ); - + MSG_BeginServerCmd( &cl->netchan.message, svc_print ); MSG_WriteString( &cl->netchan.message, string ); } @@ -91,7 +91,7 @@ Sends text to all active clients void SV_BroadcastCommand( const char *fmt, ... ) { char string[MAX_SYSPATH]; - va_list argptr; + va_list argptr; if( sv.state == ss_dead ) return; @@ -302,7 +302,7 @@ void SV_NextMap_f( void ) COM_FileBase( t->filenames[i], nextmap ); if( Q_stricmp( sv_hostmap->string, nextmap )) - continue; + continue; next = ( i + 1 ) % t->numfilenames; COM_FileBase( t->filenames[next], nextmap ); @@ -742,11 +742,11 @@ void SV_ServerInfo_f( void ) return; } - // if this is a cvar, change it too + // if this is a cvar, change it too var = Cvar_FindVar( Cmd_Argv( 1 )); if( var ) { - freestring( var->string ); // free the old value string + freestring( var->string ); // free the old value string var->string = copystring( Cmd_Argv( 2 )); var->value = Q_atof( var->string ); } @@ -882,7 +882,7 @@ void SV_EdictUsage_f( void ) return; } - active = pfnNumberOfEntities(); + active = pfnNumberOfEntities(); Con_Printf( "%5i edicts is used\n", active ); Con_Printf( "%5i edicts is free\n", GI->max_edicts - active ); Con_Printf( "%5i total\n", GI->max_edicts ); diff --git a/engine/server/sv_custom.c b/engine/server/sv_custom.c index 7fbb3bf5..112d74e1 100644 --- a/engine/server/sv_custom.c +++ b/engine/server/sv_custom.c @@ -551,7 +551,7 @@ void SV_SendResource( resource_t *pResource, sizebuf_t *msg ) } else MSG_WriteOneBit( msg, 0 ); } - + void SV_SendResources( sv_client_t *cl, sizebuf_t *msg ) { int i; diff --git a/engine/server/sv_filter.c b/engine/server/sv_filter.c index ef8ccd1d..b2b5355c 100644 --- a/engine/server/sv_filter.c +++ b/engine/server/sv_filter.c @@ -289,7 +289,7 @@ static void SV_WriteID_f( void ) FS_Close( f ); } -static qboolean StringToIP( const char *str, const char *maskstr, uint *outip, uint *outmask ) +static qboolean StringToIP( const char *str, const char *maskstr, uint *outip, uint *outmask ) { byte ip[4] = {0}; byte mask[4] = {0}; diff --git a/engine/server/sv_frame.c b/engine/server/sv_frame.c index 2b3b7c98..8c8d1406 100644 --- a/engine/server/sv_frame.c +++ b/engine/server/sv_frame.c @@ -21,7 +21,7 @@ GNU General Public License for more details. typedef struct { int num_entities; - entity_state_t entities[MAX_VISIBLE_PACKET]; + entity_state_t entities[MAX_VISIBLE_PACKET]; byte sended[MAX_EDICTS_BYTES]; } sv_ents_t; @@ -143,7 +143,7 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_ { ents->num_entities++; // entity accepted c_fullsend++; // debug counter - + } else { @@ -328,7 +328,7 @@ static void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_ } if( newnum == oldnum ) - { + { // delta update from old position // because the force parm is false, this will not result // in any bytes being emited if the entity has not changed at all @@ -339,7 +339,7 @@ static void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_ } if( newnum < oldnum ) - { + { entity_state_t *baseline = &svs.baselines[newnum]; const char *classname = SV_ClassName( EDICT_NUM( newnum )); int offset = 0; @@ -369,7 +369,7 @@ static void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_ } if( newnum > oldnum ) - { + { edict_t *ed = EDICT_NUM( oldent->number ); qboolean force = false; @@ -736,7 +736,7 @@ void SV_SendClientDatagram( sv_client_t *cl ) MSG_Clear( &cl->datagram ); if( MSG_CheckOverflow( &msg )) - { + { // must have room left for the packet header Con_Printf( S_ERROR "%s overflowed for %s\n", MSG_GetName( &msg ), cl->name ); MSG_Clear( &msg ); @@ -934,7 +934,7 @@ void SV_SendMessagesToAll( void ) { if( cl->state >= cs_connected ) SetBits( cl->flags, FCL_SEND_NET_MESSAGE ); - } + } SV_SendClientMessages(); } @@ -983,7 +983,7 @@ void SV_InactivateClients( void ) { if( !cl->state || !cl->edict ) continue; - + if( !cl->edict ) continue; diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index c77003fe..d19b903a 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -40,7 +40,7 @@ edict_t *SV_EdictNum( int n ) { if(( n >= 0 ) && ( n < GI->max_edicts )) return svgame.edicts + n; - return NULL; + return NULL; } #ifndef NDEBUG @@ -56,7 +56,7 @@ qboolean SV_CheckEdict( const edict_t *e, const char *file, const int line ) return !e->free; Con_Printf( "bad entity %i (called at %s:%i)\n", n, file, line ); - return false; + return false; } #endif @@ -67,7 +67,7 @@ EntvarsDescription entavrs table for FindEntityByString ============= */ -static TYPEDESCRIPTION gEntvarsDescription[] = +static TYPEDESCRIPTION gEntvarsDescription[] = { DEFINE_ENTITY_FIELD( classname, FIELD_STRING ), DEFINE_ENTITY_FIELD( globalname, FIELD_STRING ), @@ -151,7 +151,7 @@ float SV_AngleMod( float ideal, float current, float speed ) current = anglemod( current ); if( current == ideal ) // already there? - return current; + return current; move = ideal - current; @@ -244,7 +244,7 @@ convert trace_t to TraceResult */ void SV_ConvertTrace( TraceResult *dst, trace_t *src ) { - if( !src || !dst ) return; + if( !src || !dst ) return; dst->fAllSolid = src->allsolid; dst->fStartSolid = src->startsolid; @@ -352,7 +352,7 @@ static int SV_Multicast( int dest, const vec3_t origin, const edict_t *ent, qboo reliable = true; // intentional fallthrough case MSG_BROADCAST: - // nothing to sort + // nothing to sort break; case MSG_PAS_R: reliable = true; @@ -500,7 +500,7 @@ NOTE: static entities only accepted when game is loading */ qboolean SV_CreateStaticEntity( sizebuf_t *msg, int index ) { - entity_state_t nullstate, *baseline; + entity_state_t nullstate, *baseline; entity_state_t *state; int offset; @@ -577,7 +577,7 @@ void SV_RestartAmbientSounds( void ) if( !SV_Active( )) return; nSounds = S_GetCurrentStaticSounds( soundInfo, 256 ); - + for( i = 0; i < nSounds; i++ ) { soundlist_t *si = &soundInfo[i]; @@ -704,7 +704,7 @@ void SV_QueueChangeLevel( const char *level, const char *landname ) Con_Printf( S_ERROR "changelevel: %s is invalid or not supported\n", mapname ); return; } - + if( !FBitSet( flags, MAP_IS_EXIST )) { Con_Printf( S_ERROR "changelevel: map %s doesn't exist\n", mapname ); @@ -728,7 +728,7 @@ void SV_QueueChangeLevel( const char *level, const char *landname ) if( smooth && !Q_stricmp( sv.name, level )) { Con_Printf( S_ERROR "can't changelevel with same map. Ignored.\n" ); - return; + return; } if( !smooth && !FBitSet( flags, MAP_HAS_SPAWNPOINT )) @@ -736,7 +736,7 @@ void SV_QueueChangeLevel( const char *level, const char *landname ) if( sv_validate_changelevel->value ) { Con_Printf( S_ERROR "changelevel: %s doesn't have a valid spawnpoint. Ignored.\n", mapname ); - return; + return; } } @@ -794,7 +794,7 @@ void SV_WriteEntityPatch( const char *filename ) if( lumplen >= 10 ) { char *entities = NULL; - + FS_Seek( f, lumpofs, SEEK_SET ); entities = (char *)Z_Calloc( lumplen + 1 ); FS_Read( f, entities, lumplen ); @@ -899,7 +899,7 @@ int SV_MapIsValid( const char *filename, const char *spawn_entity, const char *l // g-cont. in-dev mode we can entering on map even without "info_player_start" if( !need_landmark && host_developer.value ) { - // not transition + // not transition Mem_Free( ents ); // skip spawnpoint checks in devmode @@ -1098,7 +1098,7 @@ edict_t* SV_AllocPrivateData( edict_t *ent, string_t className ) ent->v.classname = className; ent->v.pContainingEntity = ent; // re-link - + // allocate edict private memory (passed by dlls) SpawnEdict = SV_GetEntityClass( pszClassName ); @@ -1138,7 +1138,7 @@ create specified entity, alloc private data edict_t* SV_CreateNamedEntity( edict_t *ent, string_t className ) { edict_t *ed = SV_AllocPrivateData( ent, className ); - + // for some reasons this flag should be immediately cleared if( ed ) ClearBits( ed->v.flags, FL_CUSTOMENTITY ); @@ -1521,7 +1521,7 @@ void GAME_EXPORT pfnChangePitch( edict_t* ent ) if( !SV_IsValidEdict( ent )) return; - ent->v.angles[PITCH] = SV_AngleMod( ent->v.idealpitch, ent->v.angles[PITCH], ent->v.pitch_speed ); + ent->v.angles[PITCH] = SV_AngleMod( ent->v.idealpitch, ent->v.angles[PITCH], ent->v.pitch_speed ); } /* @@ -1553,7 +1553,7 @@ edict_t *SV_FindEntityByString( edict_t *pStartEdict, const char *pszField, cons Con_Printf( S_ERROR "FindEntityByString: field %s not a string\n", pszField ); return svgame.edicts; } - + for( e++; e < svgame.numEntities; e++ ) { ed = EDICT_NUM( e ); @@ -1765,7 +1765,7 @@ edict_t* GAME_EXPORT pfnFindClientInPVS( edict_t *pEdict ) sv.lastchecktime = sv.time; } - // return check if it might be visible + // return check if it might be visible pClient = EDICT_NUM( sv.lastcheck ); if( !SV_ClientFromEdict( pClient, true )) @@ -1811,7 +1811,7 @@ edict_t *pfnEntitiesInPVS( edict_t *pview ) return NULL; VectorAdd( pview->v.origin, pview->v.view_ofs, viewpoint ); - pchain = EDICT_NUM( 0 ); + pchain = EDICT_NUM( 0 ); for( i = 1; i < svgame.numEntities; i++ ) { @@ -1918,7 +1918,7 @@ static int GAME_EXPORT pfnEntIsOnFloor( edict_t *e ) return SV_CheckBottom( e, MOVE_NORMAL ); } - + /* =============== pfnDropToFloor @@ -2393,7 +2393,7 @@ void GAME_EXPORT pfnGetAimVector( edict_t* ent, float speed, float *rgflReturn ) tr = SV_Move( start, vec3_origin, vec3_origin, end, MOVE_NORMAL, ent, false ); if( tr.ent == check ) - { + { // can shoot at this one VectorCopy( dir, bestdir ); bestdist = dist; @@ -2542,7 +2542,7 @@ int GAME_EXPORT pfnDecalIndex( const char *m ) return i; } - return -1; + return -1; } /* @@ -2658,7 +2658,7 @@ void GAME_EXPORT pfnMessageEnd( void ) { int expsize = svgame.msg[svgame.msg_index].size; int realsize = svgame.msg_realsize; - + // compare sizes if( expsize != realsize ) { @@ -2716,7 +2716,7 @@ pfnWriteByte */ void GAME_EXPORT pfnWriteByte( int iValue ) { - if( iValue == -1 ) iValue = 0xFF; // convert char to byte + if( iValue == -1 ) iValue = 0xFF; // convert char to byte MSG_WriteByte( &sv.multicast, (byte)iValue ); svgame.msg_realsize++; } @@ -2812,7 +2812,7 @@ void GAME_EXPORT pfnWriteString( const char *src ) if( len == 1 ) { MSG_WriteChar( &sv.multicast, 0 ); - svgame.msg_realsize += 1; + svgame.msg_realsize += 1; return; // fast exit } @@ -2937,7 +2937,7 @@ static void pfnEngineFprintf( FILE *pfile, char *szFmt, ... ) _format( 2 ); static void GAME_EXPORT pfnEngineFprintf( FILE *pfile, char *szFmt, ... ) { } - + /* ============= pfnBuildSoundMsg @@ -3418,7 +3418,7 @@ pfnRegUserMsg int GAME_EXPORT pfnRegUserMsg( const char *pszName, int iSize ) { int i; - + if( !COM_CheckString( pszName )) return svc_bad; @@ -3445,7 +3445,7 @@ int GAME_EXPORT pfnRegUserMsg( const char *pszName, int iSize ) return svc_lastmsg + i; // offset } - if( i == MAX_USER_MESSAGES ) + if( i == MAX_USER_MESSAGES ) { Con_Printf( S_ERROR "REG_USER_MSG: user messages limit exceeded\n" ); return svc_bad; @@ -3850,7 +3850,7 @@ void GAME_EXPORT pfnSetClientKeyValue( int clientIndex, char *infobuffer, char * if( !Q_strcmp( Info_ValueForKey( infobuffer, key ), value )) return; - cl = &svs.clients[clientIndex]; + cl = &svs.clients[clientIndex]; Info_SetValueForStarKey( infobuffer, key, value, MAX_INFO_STRING ); SetBits( cl->flags, FCL_RESEND_USERINFO ); @@ -3962,7 +3962,7 @@ void GAME_EXPORT SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word if( !COM_CheckString( sv.event_precache[eventindex] )) { Con_Printf( S_ERROR "EV_Playback: event %i was not precached\n", eventindex ); - return; + return; } memset( &args, 0, sizeof( args )); @@ -4110,7 +4110,7 @@ void GAME_EXPORT SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word for( j = 0; j < MAX_EVENT_QUEUE; j++ ) { ei = &es->ei[j]; - + if( ei->index == 0 ) { // found an empty slot @@ -4119,7 +4119,7 @@ void GAME_EXPORT SV_PlaybackEventFull( int flags, const edict_t *pInvoker, word } } } - + // no slot found for this player, oh well if( bestslot == -1 ) continue; @@ -4393,7 +4393,7 @@ void GAME_EXPORT pfnGetPlayerStats( const edict_t *pClient, int *ping, int *pack if( packet_loss ) *packet_loss = cl->packet_loss; if( ping ) *ping = cl->latency * 1000; } - + /* ============= pfnForceUnmodified @@ -4568,14 +4568,14 @@ static int GAME_EXPORT pfnGetLocalizedStringLength(const char *label) } // engine callbacks -static enginefuncs_t gEngfuncs = +static enginefuncs_t gEngfuncs = { pfnPrecacheModel, - SV_SoundIndex, + SV_SoundIndex, pfnSetModel, pfnModelIndex, pfnModelFrames, - pfnSetSize, + pfnSetSize, pfnChangeLevel, pfnGetSpawnParms, pfnSaveSpawnParms, @@ -4651,7 +4651,7 @@ static enginefuncs_t gEngfuncs = (void*)pfnFunctionFromName, (void*)pfnNameForFunction, pfnClientPrintf, - pfnServerPrint, + pfnServerPrint, Cmd_Args, Cmd_Argv, (void*)Cmd_Argc, @@ -4705,7 +4705,7 @@ static enginefuncs_t gEngfuncs = Delta_FindField, Delta_SetFieldByIndex, Delta_UnsetFieldByIndex, - pfnSetGroupMask, + pfnSetGroupMask, pfnCreateInstancedBaseline, pfnCVarDirectSet, pfnForceUnmodified, @@ -4749,7 +4749,7 @@ qboolean SV_ParseEdict( char **pfile, edict_t *ent ) // go through all the dictionary pairs while( 1 ) - { + { string keyname; // parse key @@ -4759,8 +4759,8 @@ qboolean SV_ParseEdict( char **pfile, edict_t *ent ) Q_strncpy( keyname, token, sizeof( keyname )); - // parse value - if(( *pfile = COM_ParseFile( *pfile, token )) == NULL ) + // parse value + if(( *pfile = COM_ParseFile( *pfile, token )) == NULL ) Host_Error( "ED_ParseEdict: EOF without closing brace\n" ); if( token[0] == '}' ) @@ -4785,13 +4785,13 @@ qboolean SV_ParseEdict( char **pfile, edict_t *ent ) pkvd[numpairs].szClassName = ""; // unknown at this moment pkvd[numpairs].szKeyName = copystring( keyname ); pkvd[numpairs].szValue = copystring( token ); - pkvd[numpairs].fHandled = false; + pkvd[numpairs].fHandled = false; if( !Q_strcmp( keyname, "classname" ) && classname == NULL ) classname = copystring( pkvd[numpairs].szValue ); if( ++numpairs >= 256 ) break; } - + ent = SV_AllocPrivateData( ent, ALLOC_STRING( classname )); if( !SV_IsValidEdict( ent ) || FBitSet( ent->v.flags, FL_KILLME )) @@ -4962,7 +4962,7 @@ void SV_SpawnEntities( const char *mapname ) Cvar_Reset( "sv_wateramp" ); Cvar_Reset( "sv_wateralpha" ); - // reset sky parms + // reset sky parms Cvar_Reset( "sv_skycolor_r" ); Cvar_Reset( "sv_skycolor_g" ); Cvar_Reset( "sv_skycolor_b" ); @@ -5093,7 +5093,7 @@ qboolean SV_LoadProgs( const char *name ) if( GiveNewDllFuncs ) { version = NEW_DLL_FUNCTIONS_VERSION; - + if( !GiveNewDllFuncs( &svgame.dllFuncs2, &version )) { if( version != NEW_DLL_FUNCTIONS_VERSION ) diff --git a/engine/server/sv_init.c b/engine/server/sv_init.c index 0e92bdba..4d691074 100644 --- a/engine/server/sv_init.c +++ b/engine/server/sv_init.c @@ -115,7 +115,7 @@ int SV_ModelIndex( const char *filename ) Q_strncpy( sv.model_precache[i], name, sizeof( sv.model_precache[i] )); if( sv.state != ss_loading ) - { + { // send the update to everyone SV_SendSingleResource( name, t_model, i, sv.model_precache_flags[i] ); Con_Printf( S_WARN "late precache of %s\n", name ); @@ -166,7 +166,7 @@ int GAME_EXPORT SV_SoundIndex( const char *filename ) Q_strncpy( sv.sound_precache[i], name, sizeof( sv.sound_precache[i] )); if( sv.state != ss_loading ) - { + { // send the update to everyone SV_SendSingleResource( name, t_sound, i, 0 ); Con_Printf( S_WARN "late precache of %s\n", name ); @@ -494,7 +494,7 @@ void SV_FreeOldEntities( void ) edict_t *ent; int i; - // at end of frame kill all entities which supposed to it + // at end of frame kill all entities which supposed to it for( i = svs.maxclients + 1; i < svgame.numEntities; i++ ) { ent = EDICT_NUM( i ); @@ -885,7 +885,7 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot, qboolean ba memset( &sv, 0, sizeof( sv )); // wipe the entire per-level structure sv.time = svgame.globals->time = 1.0f; // server spawn time it's always 1.0 second sv.background = background; - + // initialize buffers MSG_Init( &sv.signon, "Signon", sv.signon_buf, sizeof( sv.signon_buf )); MSG_Init( &sv.multicast, "Multicast", sv.multicast_buf, sizeof( sv.multicast_buf )); diff --git a/engine/server/sv_log.c b/engine/server/sv_log.c index 0b2653cb..d882a683 100644 --- a/engine/server/sv_log.c +++ b/engine/server/sv_log.c @@ -124,7 +124,7 @@ void Log_Printf( const char *fmt, ... ) if( svs.log.active && svs.maxclients > 1 ) { // echo to server console - if( mp_logecho.value ) + if( mp_logecho.value ) Con_Printf( "%s", string ); // echo to log file diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 60aa39a0..f46a7b46 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -405,7 +405,7 @@ void SV_ReadPackets( void ) cl->netchan.remote_address.port = net_from.port; if( Netchan_Process( &cl->netchan, &net_message )) - { + { if(( svs.maxclients == 1 && !host_limitlocal->value ) || ( cl->state != cs_spawned )) SetBits( cl->flags, FCL_SEND_NET_MESSAGE ); // reply at end of frame @@ -497,7 +497,7 @@ void SV_CheckTimeouts( void ) if( !NET_IsLocalAddress( cl->netchan.remote_address )) { SV_BroadcastPrintf( NULL, "%s timed out\n", cl->name ); - SV_DropClient( cl, false ); + SV_DropClient( cl, false ); cl->state = cs_free; // don't bother with zombie state } } @@ -638,7 +638,7 @@ void Host_ServerFrame( void ) // let everything in the world think and move if( !SV_RunGameFrame ()) return; - + // send messages back to the clients that had packets read this frame SV_SendClientMessages (); @@ -967,7 +967,7 @@ void SV_FinalMessage( const char *message, qboolean reconnect ) sv_client_t *cl; sizebuf_t msg; int i; - + MSG_Init( &msg, "FinalMessage", msg_buf, sizeof( msg_buf )); if( COM_CheckString( message )) @@ -983,7 +983,7 @@ void SV_FinalMessage( const char *message, qboolean reconnect ) MSG_BeginServerCmd( &msg, svc_changing ); MSG_WriteOneBit( &msg, GameState->loadGame ); } - else SV_BuildReconnect( &msg ); + else SV_BuildReconnect( &msg ); } else { diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 62efc1de..069ad1c1 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -202,7 +202,7 @@ qboolean SV_RunThink( edict_t *ent ) thinktime = ent->v.nextthink; if( thinktime <= 0.0f || thinktime > (sv.time + sv.frametime)) return true; - + if( thinktime < sv.time ) thinktime = sv.time; // don't let things stay in the past. // it is possible to start that way @@ -523,7 +523,7 @@ int SV_ClipVelocity( vec3_t in, vec3_t normal, vec3_t out, float overbounce ) blocked = 0; if( normal[2] > 0.0f ) blocked |= 1; // floor if( !normal[2] ) blocked |= 2; // step - + backoff = DotProduct( in, normal ) * overbounce; for( i = 0; i < 3; i++ ) @@ -586,14 +586,14 @@ int SV_FlyMove( edict_t *ent, float time, trace_t *steptrace ) allFraction += trace.fraction; if( trace.allsolid ) - { + { // entity is trapped in another solid VectorClear( ent->v.velocity ); return 4; } if( trace.fraction > 0.0f ) - { + { // actually covered some distance VectorCopy( trace.endpos, ent->v.origin ); VectorCopy( ent->v.velocity, original_velocity ); @@ -736,7 +736,7 @@ void SV_AddHalfGravity( edict_t *ent, float timestep ) ent->v.velocity[2] -= ( 0.5f * ent_gravity * sv_gravity.value * timestep ); ent->v.velocity[2] += ( ent->v.basevelocity[2] * sv.frametime ); ent->v.basevelocity[2] = 0.0f; - + // bound velocity SV_CheckVelocity( ent ); } @@ -892,7 +892,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime ) int num_moved, oldsolid; vec3_t mins, maxs, lmove; sv_pushed_t *p, *pushed_p; - edict_t *check; + edict_t *check; if( svgame.globals->changelevel || VectorIsNull( pusher->v.velocity )) { @@ -914,7 +914,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime ) VectorCopy( pusher->v.origin, pushed_p->origin ); VectorCopy( pusher->v.angles, pushed_p->angles ); pushed_p++; - + // move the pusher to it's final position SV_LinearMove( pusher, movetime, 0.0f ); SV_LinkEdict( pusher, false ); @@ -968,14 +968,14 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime ) VectorCopy( check->v.angles, pushed_p->angles ); pushed_p++; - // try moving the contacted entity + // try moving the contacted entity pusher->v.solid = SOLID_NOT; SV_PushEntity( check, lmove, vec3_origin, &block, pusher->v.dmg ); pusher->v.solid = oldsolid; // if it is still inside the pusher, block if( SV_TestEntityPosition( check, NULL ) && block ) - { + { if( !SV_CanBlock( check )) continue; @@ -991,7 +991,7 @@ static edict_t *SV_PushMove( edict_t *pusher, float movetime ) SV_LinkEdict( p->ent, (p->ent == check) ? true : false ); } return check; - } + } } return NULL; @@ -1031,7 +1031,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime ) VectorCopy( pusher->v.origin, pushed_p->origin ); VectorCopy( pusher->v.angles, pushed_p->angles ); pushed_p++; - + // move the pusher to it's final position SV_AngularMove( pusher, movetime, pusher->v.friction ); SV_LinkEdict( pusher, false ); @@ -1101,7 +1101,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime ) lmove[2] = 0.0f; // let's the free falling } - // try moving the contacted entity + // try moving the contacted entity pusher->v.solid = SOLID_NOT; SV_PushEntity( check, lmove, amove, &block, pusher->v.dmg ); pusher->v.solid = oldsolid; @@ -1112,7 +1112,7 @@ static edict_t *SV_PushRotate( edict_t *pusher, float movetime ) // if it is still inside the pusher, block if( SV_TestEntityPosition( check, NULL ) && block ) - { + { if( !SV_CanBlock( check )) continue; @@ -1183,7 +1183,7 @@ void SV_Physics_Pusher( edict_t *ent ) pBlocker = SV_PushRotate( ent, movetime ); } } - else + else { pBlocker = SV_PushMove( ent, movetime ); } @@ -1246,7 +1246,7 @@ a glue two entities together void SV_Physics_Compound( edict_t *ent ) { edict_t *parent; - + // regular thinking if( !SV_RunThink( ent )) return; @@ -1328,7 +1328,7 @@ void SV_Physics_Noclip( edict_t *ent ) // regular thinking if( !SV_RunThink( ent )) return; - SV_CheckWater( ent ); + SV_CheckWater( ent ); VectorMA( ent->v.origin, sv.frametime, ent->v.velocity, ent->v.origin ); VectorMA( ent->v.angles, sv.frametime, ent->v.avelocity, ent->v.angles ); @@ -1373,11 +1373,11 @@ void SV_CheckWaterTransition( edict_t *ent ) if( cont <= CONTENTS_WATER && cont > CONTENTS_TRANSLUCENT ) { if( ent->v.watertype == CONTENTS_EMPTY ) - { + { // just crossed into water SV_StartSound( ent, CHAN_AUTO, "player/pl_wade1.wav", 1.0f, ATTN_NORM, 0, 100 ); ent->v.velocity[2] *= 0.5f; - } + } ent->v.watertype = cont; ent->v.waterlevel = 1; @@ -1407,10 +1407,10 @@ void SV_CheckWaterTransition( edict_t *ent ) else { if( ent->v.watertype != CONTENTS_EMPTY ) - { + { // just crossed into water SV_StartSound( ent, CHAN_AUTO, "player/pl_wade2.wav", 1.0f, ATTN_NORM, 0, 100 ); - } + } ent->v.watertype = CONTENTS_EMPTY; ent->v.waterlevel = 0; } @@ -1517,7 +1517,7 @@ void SV_Physics_Toss( edict_t *ent ) // stop if on ground if( trace.plane.normal[2] > 0.7f ) - { + { float vel; VectorAdd( ent->v.velocity, ent->v.basevelocity, move ); @@ -1546,7 +1546,7 @@ void SV_Physics_Toss( edict_t *ent ) if( ent->free ) return; } } - + // check for in water SV_CheckWaterTransition( ent ); } @@ -1779,7 +1779,7 @@ void SV_Physics( void ) { edict_t *ent; int i; - + SV_CheckAllEnts (); svgame.globals->time = sv.time; diff --git a/engine/server/sv_pmove.c b/engine/server/sv_pmove.c index d5a7673f..df8bf71d 100644 --- a/engine/server/sv_pmove.c +++ b/engine/server/sv_pmove.c @@ -284,7 +284,7 @@ void SV_AddLinksToPmove( areanode_t *node, const vec3_t pmove_mins, const vec3_t svgame.pmove->numphysent++; } } - + // recurse down both sides if( node->axis == -1 ) return; @@ -305,7 +305,7 @@ void SV_AddLaddersToPmove( areanode_t *node, const vec3_t pmove_mins, const vec3 edict_t *check; model_t *mod; physent_t *pe; - + // get ladder edicts for( l = node->solid_edicts.next; l != &node->solid_edicts; l = next ) { @@ -331,10 +331,10 @@ void SV_AddLaddersToPmove( areanode_t *node, const vec3_t pmove_mins, const vec3 if( SV_CopyEdictToPhysEnt( pe, check )) svgame.pmove->nummoveent++; } - + // recurse down both sides if( node->axis == -1 ) return; - + if( pmove_maxs[node->axis] > node->dist ) SV_AddLaddersToPmove( node->children[0], pmove_mins, pmove_maxs ); if( pmove_mins[node->axis] < node->dist ) @@ -424,7 +424,7 @@ static pmtrace_t *pfnTraceLine( float *start, float *end, int flags, int usehull int old_usehull; old_usehull = svgame.pmove->usehull; - svgame.pmove->usehull = usehull; + svgame.pmove->usehull = usehull; switch( flags ) { @@ -501,7 +501,7 @@ static const char *pfnTraceTexture( int ground, float *vstart, float *vend ) pe = &svgame.pmove->physents[ground]; return PM_TraceTexture( pe, vstart, vend ); -} +} static void GAME_EXPORT pfnPlaySound( int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ) { @@ -547,7 +547,7 @@ static pmtrace_t *pfnTraceLineEx( float *start, float *end, int flags, int usehu int old_usehull; old_usehull = svgame.pmove->usehull; - svgame.pmove->usehull = usehull; + svgame.pmove->usehull = usehull; switch( flags ) { @@ -614,13 +614,13 @@ void SV_InitClientMove( void ) svgame.pmove->PM_StuckTouch = pfnStuckTouch; svgame.pmove->PM_PointContents = pfnPointContents; svgame.pmove->PM_TruePointContents = pfnTruePointContents; - svgame.pmove->PM_HullPointContents = pfnHullPointContents; + svgame.pmove->PM_HullPointContents = pfnHullPointContents; svgame.pmove->PM_PlayerTrace = pfnPlayerTrace; svgame.pmove->PM_TraceLine = pfnTraceLine; svgame.pmove->RandomLong = COM_RandomLong; svgame.pmove->RandomFloat = COM_RandomFloat; svgame.pmove->PM_GetModelType = pfnGetModelType; - svgame.pmove->PM_GetModelBounds = pfnGetModelBounds; + svgame.pmove->PM_GetModelBounds = pfnGetModelBounds; svgame.pmove->PM_HullForBsp = (void*)pfnHullForBsp; svgame.pmove->PM_TraceModel = pfnTraceModel; svgame.pmove->COM_FileSize = COM_FileSize; @@ -715,9 +715,9 @@ static void SV_SetupPMove( playermove_t *pmove, sv_client_t *cl, usercmd_t *ucmd VectorCopy( clent->v.vuser2, pmove->vuser2 ); VectorCopy( clent->v.vuser3, pmove->vuser3 ); VectorCopy( clent->v.vuser4, pmove->vuser4 ); - pmove->cmd = *ucmd; // setup current cmds + pmove->cmd = *ucmd; // setup current cmds pmove->runfuncs = true; - + Q_strncpy( pmove->physinfo, physinfo, MAX_INFO_STRING ); // setup physents @@ -792,7 +792,7 @@ static void SV_FinishPMove( playermove_t *pmove, sv_client_t *cl ) } // angles - // show 1/3 the pitch angle and all the roll angle + // show 1/3 the pitch angle and all the roll angle if( !clent->v.fixangle ) { VectorCopy( pmove->angles, clent->v.v_angle ); @@ -810,7 +810,7 @@ static void SV_FinishPMove( playermove_t *pmove, sv_client_t *cl ) entity_state_t *SV_FindEntInPack( int index, client_frame_t *frame ) { entity_state_t *state; - int i; + int i; for( i = 0; i < frame->num_entities; i++ ) { @@ -1034,7 +1034,7 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed ) trace_t trace; vec3_t oldvel; usercmd_t cmd; - + clent = cl->edict; cmd = *ucmd; diff --git a/engine/server/sv_save.c b/engine/server/sv_save.c index 71d19d22..96dcde3f 100644 --- a/engine/server/sv_save.c +++ b/engine/server/sv_save.c @@ -108,7 +108,7 @@ static TYPEDESCRIPTION gSaveHeader[] = DEFINE_FIELD( SAVE_HEADER, skyVec_y, FIELD_FLOAT ), DEFINE_FIELD( SAVE_HEADER, skyVec_z, FIELD_FLOAT ), }; - + static TYPEDESCRIPTION gAdjacency[] = { DEFINE_ARRAY( LEVELLIST, mapName, FIELD_CHARACTER, 32 ), @@ -212,7 +212,7 @@ static TYPEDESCRIPTION gSoundEntry[] = DEFINE_ARRAY( soundlist_t, forcedEnd, FIELD_CHARACTER, sizeof( double )), }; -static TYPEDESCRIPTION gTempEntvars[] = +static TYPEDESCRIPTION gTempEntvars[] = { DEFINE_ENTITY_FIELD( classname, FIELD_STRING ), DEFINE_ENTITY_GLOBAL_FIELD( globalname, FIELD_STRING ), @@ -456,13 +456,13 @@ static int IsValidSave( void ) if( svs.clients && svs.clients[0].state == cs_spawned ) { edict_t *pl = svs.clients[0].edict; - + if( !pl ) { Con_Printf( "Can't savegame without a player!\n" ); return 0; } - + if( pl->v.deadflag || pl->v.health <= 0.0f ) { Con_Printf( "Can't savegame with a dead player\n" ); @@ -506,13 +506,13 @@ static void AgeSaveList( const char *pName, int count ) while( count > 0 ) { if( count == 1 ) - { + { // quick.sav Q_snprintf( oldName, sizeof( oldName ), DEFAULT_SAVE_DIRECTORY "%s.sav", pName ); Q_snprintf( oldShot, sizeof( oldShot ), DEFAULT_SAVE_DIRECTORY "%s.bmp", pName ); } else - { + { // quick04.sav, etc. Q_snprintf( oldName, sizeof( oldName ), DEFAULT_SAVE_DIRECTORY "%s%02d.sav", pName, count - 1 ); Q_snprintf( oldShot, sizeof( oldShot ), DEFAULT_SAVE_DIRECTORY "%s%02d.bmp", pName, count - 1 ); @@ -556,7 +556,7 @@ static void DirectoryCopy( const char *pPath, file_t *pFile ) fileSize = FS_FileLength( pCopy ); memset( szName, 0, sizeof( szName )); // clearing the string to prevent garbage in output file - Q_strncpy( szName, COM_FileWithoutPath( t->filenames[i] ), MAX_OSPATH ); + Q_strncpy( szName, COM_FileWithoutPath( t->filenames[i] ), MAX_OSPATH ); FS_Write( pFile, szName, MAX_OSPATH ); FS_Write( pFile, &fileSize, sizeof( int )); FS_FileCopy( pFile, pCopy, fileSize ); @@ -614,7 +614,7 @@ static SAVERESTOREDATA *SaveInit( int size, int tokenCount ) pSaveData->time = svgame.globals->time; // Use DLL time - // shared with dlls + // shared with dlls svgame.globals->pSaveData = pSaveData; return pSaveData; @@ -637,7 +637,7 @@ static void SaveClear( SAVERESTOREDATA *pSaveData ) pSaveData->tokenSize = 0; // reset the hashtable pSaveData->size = 0; // reset the pointer - // shared with dlls + // shared with dlls svgame.globals->pSaveData = pSaveData; } @@ -784,7 +784,7 @@ static int GetClientDataSize( const char *level ) FS_Close( pFile ); return 0; } - + FS_Read( pFile, &version, sizeof( version )); if( version != CLIENT_SAVEGAME_VERSION ) { @@ -818,7 +818,7 @@ static SAVERESTOREDATA *LoadSaveData( const char *level ) SAVERESTOREDATA *pSaveData; int totalSize; file_t *pFile; - + Q_snprintf( name, sizeof( name ), DEFAULT_SAVE_DIRECTORY "%s.HL1", level ); Con_Printf( "Loading game from %s...\n", name ); @@ -1216,7 +1216,7 @@ static void LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboo FS_Close( pFile ); return; } - + FS_Read( pFile, &version, sizeof( version )); if( version != CLIENT_SAVEGAME_VERSION ) { @@ -1260,7 +1260,7 @@ static void LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboo if( !adjacent ) { memset( svs.static_entities, 0, sizeof( entity_state_t ) * MAX_STATIC_ENTITIES ); - sv.num_static_entities = 0; + sv.num_static_entities = 0; } // restore client entities @@ -1477,7 +1477,7 @@ static SAVERESTOREDATA *SaveGameState( int changelevel ) svgame.dllFuncs.pfnSaveWriteFields( pSaveData, "ETABLE", &pSaveData->pTable[i], gEntityTable, ARRAYSIZE( gEntityTable )); tableSize = pSaveData->size - dataSize; - + // Write entity string token table pTokenData = StoreHashTable( pSaveData ); @@ -1585,7 +1585,7 @@ static int LoadGameState( char const *level, qboolean changelevel ) // restore server time sv.time = header.time; - + return 1; } @@ -1684,7 +1684,7 @@ static int SaveReadHeader( file_t *pFile, GAME_HEADER *pHeader ) FS_Close( pFile ); return 0; } - + FS_Read( pFile, &version, sizeof( version )); if( version != SAVEGAME_VERSION ) { @@ -1709,7 +1709,7 @@ static int SaveReadHeader( file_t *pFile, GAME_HEADER *pHeader ) FS_Read( pFile, pSaveData->pBaseData, size ); - svgame.dllFuncs.pfnSaveReadFields( pSaveData, "GameHeader", pHeader, gGameHeader, ARRAYSIZE( gGameHeader )); + svgame.dllFuncs.pfnSaveReadFields( pSaveData, "GameHeader", pHeader, gGameHeader, ARRAYSIZE( gGameHeader )); svgame.dllFuncs.pfnRestoreGlobalState( pSaveData ); @@ -1779,7 +1779,7 @@ static int CreateEntityTransitionList( SAVERESTOREDATA *pSaveData, int levelMask SetBits( pent->v.flags, FL_KILLME ); } } - else + else { Con_Reportf( "Transferring %s (%d)\n", STRING( pTable->classname ), NUM_FOR_EDICT( pent )); @@ -1827,7 +1827,7 @@ static void LoadAdjacentEnts( const char *pOldLevel, const char *pLandmarkName ) int i, test, flags, index, movedCount = 0; qboolean foundprevious = false; vec3_t landmarkOrigin; - + memset( ¤tLevelData, 0, sizeof( SAVERESTOREDATA )); svgame.globals->pSaveData = ¤tLevelData; sv.loadgame = sv.paused = true; @@ -1936,7 +1936,7 @@ void SV_ChangeLevel( qboolean loadfromsavedgame, const char *mapname, const char char _startspot[MAX_QPATH]; char *startspot = NULL; SAVERESTOREDATA *pSaveData = NULL; - + if( sv.state != ss_active ) { Con_Printf( S_ERROR "server not running\n"); @@ -2042,7 +2042,7 @@ qboolean SV_LoadGame( const char *pPath ) Con_Printf( S_ERROR "map %s is invalid or not supported\n", gameHeader.mapName ); validload = false; } - + if( !FBitSet( flags, MAP_IS_EXIST )) { Con_Printf( S_ERROR "map %s doesn't exist\n", gameHeader.mapName ); @@ -2067,10 +2067,10 @@ qboolean SV_LoadGame( const char *pPath ) } /* -================== +================== SV_SaveGame -================== -*/ +================== +*/ void SV_SaveGame( const char *pName ) { char comment[80]; @@ -2118,12 +2118,12 @@ void SV_SaveGame( const char *pName ) #endif // XASH_DEDICATED } -/* -================== +/* +================== SV_GetLatestSave used for reload game after player death -================== +================== */ const char *SV_GetLatestSave( void ) { @@ -2138,7 +2138,7 @@ const char *SV_GetLatestSave( void ) for( i = 0; i < t->numfilenames; i++ ) { ft = FS_FileTime( t->filenames[i], true ); - + // found a match? if( ft > 0 ) { @@ -2156,15 +2156,15 @@ const char *SV_GetLatestSave( void ) if( found ) return savename; - return NULL; + return NULL; } -/* -================== +/* +================== SV_GetSaveComment check savegame for valid -================== +================== */ int GAME_EXPORT SV_GetSaveComment( const char *savename, char *comment ) { @@ -2188,7 +2188,7 @@ int GAME_EXPORT SV_GetSaveComment( const char *savename, char *comment ) FS_Close( f ); return 0; } - + FS_Read( f, &tag, sizeof( int )); if( tag == 0x0065 ) @@ -2302,7 +2302,7 @@ int GAME_EXPORT SV_GetSaveComment( const char *savename, char *comment ) // delete the string table we allocated if( pTokenList ) Mem_Free( pTokenList ); if( pSaveData ) Mem_Free( pSaveData ); - FS_Close( f ); + FS_Close( f ); // at least mapname should be filled if( COM_CheckStringEmpty( mapName ) ) @@ -2320,13 +2320,13 @@ int GAME_EXPORT SV_GetSaveComment( const char *savename, char *comment ) Q_strncpy( comment, va( "", mapName ), MAX_STRING ); return 0; } - + if( !FBitSet( flags, MAP_IS_EXIST )) { Q_strncpy( comment, va( "", mapName ), MAX_STRING ); return 0; } - + fileTime = FS_FileTime( savename, true ); file_tm = localtime( &fileTime ); @@ -2343,7 +2343,7 @@ int GAME_EXPORT SV_GetSaveComment( const char *savename, char *comment ) Q_strncpy( comment + CS_SIZE + (CS_TIME * 2), description + CS_SIZE, CS_SIZE ); return 1; - } + } Q_strncpy( comment, "", MAX_STRING ); diff --git a/engine/server/sv_world.c b/engine/server/sv_world.c index 16fa46c4..ea823974 100644 --- a/engine/server/sv_world.c +++ b/engine/server/sv_world.c @@ -64,18 +64,18 @@ void SV_InitBoxHull( void ) for( i = 0; i < 6; i++ ) { box_clipnodes[i].planenum = i; - + side = i & 1; - + box_clipnodes[i].children[side] = CONTENTS_EMPTY; if( i != 5 ) box_clipnodes[i].children[side^1] = i + 1; else box_clipnodes[i].children[side^1] = CONTENTS_SOLID; - + box_planes[i].type = i>>1; box_planes[i].normal[i>>1] = 1; box_planes[i].signbits = 0; } - + } /* @@ -258,7 +258,7 @@ hull_t *SV_HullForBsp( edict_t *ent, const vec3_t mins, const vec3_t maxs, vec3_ if( size[0] <= 8.0f || ent->v.solid == SOLID_PORTAL ) { hull = &model->hulls[0]; - VectorCopy( hull->clip_mins, offset ); + VectorCopy( hull->clip_mins, offset ); } else { @@ -309,7 +309,7 @@ hull_t *SV_HullForEntity( edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset VectorSubtract( ent->v.mins, maxs, hullmins ); VectorSubtract( ent->v.maxs, mins, hullmaxs ); hull = SV_HullForBox( hullmins, hullmaxs ); - + VectorCopy( ent->v.origin, offset ); } @@ -428,25 +428,25 @@ areanode_t *SV_CreateAreaNode( int depth, vec3_t mins, vec3_t maxs ) ClearLink( &anode->trigger_edicts ); ClearLink( &anode->solid_edicts ); ClearLink( &anode->portal_edicts ); - + if( depth == AREA_DEPTH ) { anode->axis = -1; anode->children[0] = anode->children[1] = NULL; return anode; } - + VectorSubtract( maxs, mins, size ); if( size[0] > size[1] ) anode->axis = 0; else anode->axis = 1; - + anode->dist = 0.5f * ( maxs[anode->axis] + mins[anode->axis] ); - VectorCopy( mins, mins1 ); - VectorCopy( mins, mins2 ); - VectorCopy( maxs, maxs1 ); - VectorCopy( maxs, maxs2 ); - + VectorCopy( mins, mins1 ); + VectorCopy( mins, mins2 ); + VectorCopy( maxs, maxs1 ); + VectorCopy( maxs, maxs2 ); + maxs1[anode->axis] = mins2[anode->axis] = anode->dist; anode->children[0] = SV_CreateAreaNode( depth+1, mins2, maxs2 ); anode->children[1] = SV_CreateAreaNode( depth+1, mins1, maxs1 ); @@ -571,10 +571,10 @@ void SV_TouchLinks( edict_t *ent, areanode_t *node ) svgame.dllFuncs.pfnTouch( touch, ent ); } } - + // recurse down both sides if( node->axis == -1 ) return; - + if( ent->v.absmax[node->axis] > node->dist ) SV_TouchLinks( ent, node->children[0] ); if( ent->v.absmin[node->axis] < node->dist ) @@ -594,7 +594,7 @@ void SV_FindTouchedLeafs( edict_t *ent, mnode_t *node, int *headnode ) if( node->contents == CONTENTS_SOLID ) return; - + // add an efrag if the node is a leaf if( node->contents < 0 ) { @@ -608,17 +608,17 @@ void SV_FindTouchedLeafs( edict_t *ent, mnode_t *node, int *headnode ) { leaf = (mleaf_t *)node; ent->leafnums[ent->num_leafs] = leaf->cluster; - ent->num_leafs++; + ent->num_leafs++; } return; } - + // NODE_MIXED sides = BOX_ON_PLANE_SIDE( ent->v.absmin, ent->v.absmax, node->plane ); if(( sides == 3 ) && ( *headnode == -1 )) *headnode = node - sv.worldmodel->nodes; - + // recurse down the contacted sides if( sides & 1 ) SV_FindTouchedLeafs( ent, node->children[0], headnode ); if( sides & 2 ) SV_FindTouchedLeafs( ent, node->children[1], headnode ); @@ -681,8 +681,8 @@ void SV_LinkEdict( edict_t *ent, qboolean touch_triggers ) node = node->children[1]; else break; // crosses the node } - - // link it in + + // link it in if( ent->v.solid == SOLID_TRIGGER ) InsertLinkBefore( &ent->area, &node->trigger_edicts ); else if( ent->v.solid == SOLID_PORTAL ) @@ -763,10 +763,10 @@ void SV_WaterLinks( const vec3_t origin, int *pCont, areanode_t *node ) if( RankForContents( touch->v.skin ) > RankForContents( *pCont )) *pCont = touch->v.skin; // new content has more priority } - + // recurse down both sides if( node->axis == -1 ) return; - + if( origin[node->axis] > node->dist ) SV_WaterLinks( origin, pCont, node->children[0] ); if( origin[node->axis] < node->dist ) @@ -827,7 +827,7 @@ qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker ) if( FBitSet( ent->v.flags, FL_CLIENT|FL_FAKECLIENT )) { // to avoid falling through tracktrain update client mins\maxs here - if( FBitSet( ent->v.flags, FL_DUCKING )) + if( FBitSet( ent->v.flags, FL_DUCKING )) SV_SetMinMaxSize( ent, svgame.pmove->player_mins[1], svgame.pmove->player_maxs[1], true ); else SV_SetMinMaxSize( ent, svgame.pmove->player_mins[0], svgame.pmove->player_maxs[0], true ); } @@ -1007,7 +1007,7 @@ void SV_PortalCSG( edict_t *portal, const vec3_t trace_mins, const vec3_t trace_ int hitplane; model_t *model; float portalradius; - + // only run this code if we impacted on the portal's parent. if( trace->fraction == 1.0f && !trace->startsolid ) return; @@ -1049,7 +1049,7 @@ void SV_PortalCSG( edict_t *portal, const vec3_t trace_mins, const vec3_t trace_ if( !plane ) { planes[plane][3] -= DotProduct( nearest, planes[plane] ); - } + } else if( plane > 1 ) { // side planes get nearer with size @@ -1584,7 +1584,7 @@ static qboolean SV_RecursiveLightPoint( model_t *model, mnode_t *node, const vec VectorLerp( start, frac, end, mid ); - // co down front side + // co down front side if( SV_RecursiveLightPoint( model, node->children[side], start, mid )) return true; // hit something @@ -1612,7 +1612,7 @@ static qboolean SV_RecursiveLightPoint( model_t *model, mnode_t *node, const vec ds = s - info->lightmapmins[0]; dt = t - info->lightmapmins[1]; - + if ( ds > info->lightextents[0] || dt > info->lightextents[1] ) continue; diff --git a/engine/shake.h b/engine/shake.h index b2e88a33..3b631cdf 100644 --- a/engine/shake.h +++ b/engine/shake.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/engine/sprite.h b/engine/sprite.h index a62a14ed..1ff1d8b5 100644 --- a/engine/sprite.h +++ b/engine/sprite.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -63,7 +63,7 @@ typedef enum SPR_FWD_PARALLEL, SPR_ORIENTED, SPR_FWD_PARALLEL_ORIENTED, -} angletype_t; +} angletype_t; typedef enum { diff --git a/engine/studio.h b/engine/studio.h index 1bcaa38c..692a1d33 100644 --- a/engine/studio.h +++ b/engine/studio.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -93,7 +93,7 @@ Studio models are position independent, so the cache manager can move them. // motion flags #define STUDIO_X 0x0001 -#define STUDIO_Y 0x0002 +#define STUDIO_Y 0x0002 #define STUDIO_Z 0x0004 #define STUDIO_XR 0x0008 #define STUDIO_YR 0x0010 @@ -118,7 +118,7 @@ Studio models are position independent, so the cache manager can move them. #define STUDIO_SNAP 0x0002 // do not interpolate between previous animation and this one #define STUDIO_DELTA 0x0004 // this sequence "adds" to the base sequences, not slerp blends #define STUDIO_AUTOPLAY 0x0008 // temporary flag that forces the sequence to always play -#define STUDIO_POST 0x0010 // +#define STUDIO_POST 0x0010 // #define STUDIO_ALLZEROS 0x0020 // this animation/sequence has no real animation data #define STUDIO_BLENDPOSE 0x0040 // to differentiate GoldSrc style blending from Source style blending (with pose parameters) #define STUDIO_CYCLEPOSE 0x0080 // cycle index is taken from a pose parameter index @@ -132,7 +132,7 @@ Studio models are position independent, so the cache manager can move them. #define STUDIO_LIGHT_FROM_ROOT 0x8000 // get lighting point from root bonepos not from entity origin // autolayer flags -#define STUDIO_AL_POST 0x0001 // +#define STUDIO_AL_POST 0x0001 // #define STUDIO_AL_SPLINE 0x0002 // convert layer ramp in/out curve is a spline instead of linear #define STUDIO_AL_XFADE 0x0004 // pre-bias the ramp curve to compense for a non-1 weight, // assuming a second layer is also going to accumulate @@ -185,7 +185,7 @@ typedef struct studiohdr_s // offset to the first hitbox chunk int32_t hitboxindex; - + // the number of sequences int32_t numseq; @@ -217,7 +217,7 @@ typedef struct studiohdr_s int32_t skinindex; // the number of bodyparts - int32_t numbodyparts; + int32_t numbodyparts; // offset to the first bodypart int32_t bodypartindex; @@ -285,7 +285,7 @@ typedef struct } studiohdr2_t; // header for demand loaded sequence group data -typedef struct +typedef struct { // the model signature int32_t id; @@ -491,7 +491,7 @@ typedef struct } mstudioaimatbone_t; // bone controllers -typedef struct +typedef struct { // bone affected by this controller int32_t bone; @@ -521,7 +521,7 @@ typedef struct // the hitbox minimum and maximum extents vec3_t bbmin; - vec3_t bbmax; + vec3_t bbmax; } mstudiobbox_t; typedef struct @@ -847,7 +847,7 @@ typedef struct mstudioanim_s } mstudioanim_t; // animation frames -typedef union +typedef union { struct { @@ -917,7 +917,7 @@ typedef struct typedef struct { uint8_t weight[4]; - int8_t bone[4]; + int8_t bone[4]; } mstudioboneweight_t; // skin families @@ -969,7 +969,7 @@ typedef struct // vec3_t boundingbox[model][bone][2]; // complex intersection info // meshes -typedef struct +typedef struct { // can be interpreted as the number of triangles in the mesh int32_t numtris; @@ -988,7 +988,7 @@ typedef struct } mstudiomesh_t; // triangles -typedef struct +typedef struct { // index into vertex array int16_t vertindex; diff --git a/engine/warpsin.h b/engine/warpsin.h index e46b44d7..d539c3b4 100644 --- a/engine/warpsin.h +++ b/engine/warpsin.h @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -19,35 +19,35 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -0.000000, 0.098165, 0.196270, 0.294259, 0.392069, 0.489643, 0.586920, 0.683850, -0.780360, 0.876405, 0.971920, 1.066850, 1.161140, 1.254725, 1.347560, 1.439580, -1.530735, 1.620965, 1.710220, 1.798445, 1.885585, 1.971595, 2.056410, 2.139990, -2.222280, 2.303235, 2.382795, 2.460925, 2.537575, 2.612690, 2.686235, 2.758160, -2.828425, 2.896990, 2.963805, 3.028835, 3.092040, 3.153385, 3.212830, 3.270340, -3.325880, 3.379415, 3.430915, 3.480350, 3.527685, 3.572895, 3.615955, 3.656840, -3.695520, 3.731970, 3.766175, 3.798115, 3.827760, 3.855105, 3.880125, 3.902810, -3.923140, 3.941110, 3.956705, 3.969920, 3.980740, 3.989160, 3.995180, 3.998795, -4.000000, 3.998795, 3.995180, 3.989160, 3.980740, 3.969920, 3.956705, 3.941110, -3.923140, 3.902810, 3.880125, 3.855105, 3.827760, 3.798115, 3.766175, 3.731970, -3.695520, 3.656840, 3.615955, 3.572895, 3.527685, 3.480350, 3.430915, 3.379415, -3.325880, 3.270340, 3.212830, 3.153385, 3.092040, 3.028835, 2.963805, 2.896990, -2.828425, 2.758160, 2.686235, 2.612690, 2.537575, 2.460925, 2.382795, 2.303235, -2.222280, 2.139990, 2.056410, 1.971595, 1.885585, 1.798445, 1.710220, 1.620965, -1.530735, 1.439580, 1.347560, 1.254725, 1.161140, 1.066850, 0.971920, 0.876405, -0.780360, 0.683850, 0.586920, 0.489643, 0.392069, 0.294259, 0.196270, 0.098165, -0.000000, -0.098165, -0.196270, -0.294259, -0.392069, -0.489643, -0.586920, -0.683850, --0.780360, -0.876405, -0.971920, -1.066850, -1.161140, -1.254725, -1.347560, -1.439580, --1.530735, -1.620965, -1.710220, -1.798445, -1.885585, -1.971595, -2.056410, -2.139990, --2.222280, -2.303235, -2.382795, -2.460925, -2.537575, -2.612690, -2.686235, -2.758160, --2.828425, -2.896990, -2.963805, -3.028835, -3.092040, -3.153385, -3.212830, -3.270340, --3.325880, -3.379415, -3.430915, -3.480350, -3.527685, -3.572895, -3.615955, -3.656840, --3.695520, -3.731970, -3.766175, -3.798115, -3.827760, -3.855105, -3.880125, -3.902810, --3.923140, -3.941110, -3.956705, -3.969920, -3.980740, -3.989160, -3.995180, -3.998795, --4.000000, -3.998795, -3.995180, -3.989160, -3.980740, -3.969920, -3.956705, -3.941110, --3.923140, -3.902810, -3.880125, -3.855105, -3.827760, -3.798115, -3.766175, -3.731970, --3.695520, -3.656840, -3.615955, -3.572895, -3.527685, -3.480350, -3.430915, -3.379415, --3.325880, -3.270340, -3.212830, -3.153385, -3.092040, -3.028835, -2.963805, -2.896990, --2.828425, -2.758160, -2.686235, -2.612690, -2.537575, -2.460925, -2.382795, -2.303235, --2.222280, -2.139990, -2.056410, -1.971595, -1.885585, -1.798445, -1.710220, -1.620965, --1.530735, -1.439580, -1.347560, -1.254725, -1.161140, -1.066850, -0.971920, -0.876405, --0.780360, -0.683850, -0.586920, -0.489643, -0.392069, -0.294259, -0.196270, -0.098165, +0.000000, 0.098165, 0.196270, 0.294259, 0.392069, 0.489643, 0.586920, 0.683850, +0.780360, 0.876405, 0.971920, 1.066850, 1.161140, 1.254725, 1.347560, 1.439580, +1.530735, 1.620965, 1.710220, 1.798445, 1.885585, 1.971595, 2.056410, 2.139990, +2.222280, 2.303235, 2.382795, 2.460925, 2.537575, 2.612690, 2.686235, 2.758160, +2.828425, 2.896990, 2.963805, 3.028835, 3.092040, 3.153385, 3.212830, 3.270340, +3.325880, 3.379415, 3.430915, 3.480350, 3.527685, 3.572895, 3.615955, 3.656840, +3.695520, 3.731970, 3.766175, 3.798115, 3.827760, 3.855105, 3.880125, 3.902810, +3.923140, 3.941110, 3.956705, 3.969920, 3.980740, 3.989160, 3.995180, 3.998795, +4.000000, 3.998795, 3.995180, 3.989160, 3.980740, 3.969920, 3.956705, 3.941110, +3.923140, 3.902810, 3.880125, 3.855105, 3.827760, 3.798115, 3.766175, 3.731970, +3.695520, 3.656840, 3.615955, 3.572895, 3.527685, 3.480350, 3.430915, 3.379415, +3.325880, 3.270340, 3.212830, 3.153385, 3.092040, 3.028835, 2.963805, 2.896990, +2.828425, 2.758160, 2.686235, 2.612690, 2.537575, 2.460925, 2.382795, 2.303235, +2.222280, 2.139990, 2.056410, 1.971595, 1.885585, 1.798445, 1.710220, 1.620965, +1.530735, 1.439580, 1.347560, 1.254725, 1.161140, 1.066850, 0.971920, 0.876405, +0.780360, 0.683850, 0.586920, 0.489643, 0.392069, 0.294259, 0.196270, 0.098165, +0.000000, -0.098165, -0.196270, -0.294259, -0.392069, -0.489643, -0.586920, -0.683850, +-0.780360, -0.876405, -0.971920, -1.066850, -1.161140, -1.254725, -1.347560, -1.439580, +-1.530735, -1.620965, -1.710220, -1.798445, -1.885585, -1.971595, -2.056410, -2.139990, +-2.222280, -2.303235, -2.382795, -2.460925, -2.537575, -2.612690, -2.686235, -2.758160, +-2.828425, -2.896990, -2.963805, -3.028835, -3.092040, -3.153385, -3.212830, -3.270340, +-3.325880, -3.379415, -3.430915, -3.480350, -3.527685, -3.572895, -3.615955, -3.656840, +-3.695520, -3.731970, -3.766175, -3.798115, -3.827760, -3.855105, -3.880125, -3.902810, +-3.923140, -3.941110, -3.956705, -3.969920, -3.980740, -3.989160, -3.995180, -3.998795, +-4.000000, -3.998795, -3.995180, -3.989160, -3.980740, -3.969920, -3.956705, -3.941110, +-3.923140, -3.902810, -3.880125, -3.855105, -3.827760, -3.798115, -3.766175, -3.731970, +-3.695520, -3.656840, -3.615955, -3.572895, -3.527685, -3.480350, -3.430915, -3.379415, +-3.325880, -3.270340, -3.212830, -3.153385, -3.092040, -3.028835, -2.963805, -2.896990, +-2.828425, -2.758160, -2.686235, -2.612690, -2.537575, -2.460925, -2.382795, -2.303235, +-2.222280, -2.139990, -2.056410, -1.971595, -1.885585, -1.798445, -1.710220, -1.620965, +-1.530735, -1.439580, -1.347560, -1.254725, -1.161140, -1.066850, -0.971920, -0.876405, +-0.780360, -0.683850, -0.586920, -0.489643, -0.392069, -0.294259, -0.196270, -0.098165, diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index 08b808f6..ce0727f6 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting @@ -100,12 +100,12 @@ typedef struct playermove_s vec3_t velocity; // Current movement direction. vec3_t movedir; // For waterjumping, a forced forward velocity so we can fly over lip of ledge. vec3_t basevelocity; // Velocity of the conveyor we are standing, e.g. - + // For ducking/dead vec3_t view_ofs; // Our eye position. float flDuckTime; // Time we started duck qboolean bInDuck; // In process of ducking or ducked already? - + // For walking/falling int flTimeStepSound; // Next time we can play a step sound int iStepLeft; @@ -157,13 +157,13 @@ typedef struct playermove_s // world state // Number of entities to clip against. - int numphysent; + int numphysent; physent_t physents[MAX_PHYSENTS]; // Number of momvement entities (ladders) int nummoveent; // just a list of ladders - physent_t moveents[MAX_MOVEENTS]; + physent_t moveents[MAX_MOVEENTS]; // All things being rendered, for tracing against things you don't actually collide with int numvisent; @@ -181,7 +181,7 @@ typedef struct playermove_s struct movevars_s *movevars; vec3_t player_mins[4]; vec3_t player_maxs[4]; - + // Common functions const char *(*PM_Info_ValueForKey) ( const char *s, const char *key ); void (*PM_Particle)( const float *origin, int color, float life, int zpos, int zvel ); @@ -193,7 +193,7 @@ typedef struct playermove_s void (*PM_StuckTouch)( int hitent, pmtrace_t *ptraceresult ); int (*PM_PointContents)( float *p, int *truecontents /*filled in if this is non-null*/ ); int (*PM_TruePointContents)( float *p ); - int (*PM_HullPointContents)( struct hull_s *hull, int num, float *p ); + int (*PM_HullPointContents)( struct hull_s *hull, int num, float *p ); pmtrace_t (*PM_PlayerTrace)( float *start, float *end, int traceFlags, int ignore_pe ); struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehulll, int ignore_pe ); int (*RandomLong)( int lLow, int lHigh ); diff --git a/pm_shared/pm_info.h b/pm_shared/pm_info.h index 1bb32e46..24b81057 100644 --- a/pm_shared/pm_info.h +++ b/pm_shared/pm_info.h @@ -1,9 +1,9 @@ /*** * * Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. +* +* This product contains software technology licensed from Id +* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * All Rights Reserved. * * Use, distribution, and modification of this source code and/or resulting diff --git a/pm_shared/pm_movevars.h b/pm_shared/pm_movevars.h index 713a7f89..0efaae44 100644 --- a/pm_shared/pm_movevars.h +++ b/pm_shared/pm_movevars.h @@ -1,6 +1,6 @@ //========= Copyright (C) 1996-2002, Valve LLC, All rights reserved. ============ // -// Purpose: +// Purpose: // // $NoKeywords: $ //============================================================================= @@ -21,8 +21,8 @@ struct movevars_s float accelerate; // Acceleration factor float airaccelerate; // Same for when in open air float wateraccelerate; // Same for when in water - float friction; - float edgefriction; // Extra friction near dropofs + float friction; + float edgefriction; // Extra friction near dropofs float waterfriction; // Less in water float entgravity; // 1.0 float bounce; // Wall bounce value. 1.0 @@ -35,13 +35,13 @@ struct movevars_s float rollangle; float rollspeed; float skycolor_r; // Sky color - float skycolor_g; // + float skycolor_g; // float skycolor_b; // float skyvec_x; // Sky vector - float skyvec_y; // - float skyvec_z; // + float skyvec_y; // + float skyvec_z; // int features; // engine features that shared across network - int fog_settings; // Global fog settings (packed color+density) + int fog_settings; // Global fog settings (packed color+density) float wateralpha; // World water alpha 1.0 - solid 0.0 - transparent float skydir_x; // skybox rotate direction float skydir_y; // diff --git a/public/build.h b/public/build.h index 043a11cd..f94ffce9 100644 --- a/public/build.h +++ b/public/build.h @@ -35,10 +35,10 @@ For more information, please refer to // Any new define must be undefined at first // You can generate #undef list below with this oneliner: // $ cat build.h | sed 's/\t//g' | grep '^#define XASH' | awk '{ print $2 }' | sort | uniq | awk '{ print "#undef " $1 }' -// +// // So in various buildscripts you can grep for ^#undef XASH and select only second word // or in another oneliner: -// $ cat build.h | grep '^#undef XASH' | awk '{ print $2 }' +// $ cat build.h | grep '^#undef XASH' | awk '{ print $2 }' #undef XASH_64BIT #undef XASH_AMD64 diff --git a/public/crclib.c b/public/crclib.c index 3c306a86..95013b58 100644 --- a/public/crclib.c +++ b/public/crclib.c @@ -281,7 +281,7 @@ void MD5Update( MD5Context_t *ctx, const byte *buf, uint len ) =============== MD5Final -Final wrapup - pad to 64-byte boundary with the bit pattern +Final wrapup - pad to 64-byte boundary with the bit pattern 1 0* (64-bit count of bits processed, MSB-first) =============== */ diff --git a/public/crtlib.c b/public/crtlib.c index 6affcb93..281d11fe 100644 --- a/public/crtlib.c +++ b/public/crtlib.c @@ -194,14 +194,14 @@ int Q_atoi( const char *str ) str++; if( !str ) return 0; - + if( *str == '-' ) { sign = -1; str++; } else sign = 1; - + // check for hex if( str[0] == '0' && ( str[1] == 'x' || str[1] == 'X' )) { @@ -215,11 +215,11 @@ int Q_atoi( const char *str ) else return val * sign; } } - + // check for character if( str[0] == '\'' ) return sign * str[1]; - + // assume decimal while( 1 ) { @@ -243,14 +243,14 @@ float Q_atof( const char *str ) str++; if( !str ) return 0.0f; - + if( *str == '-' ) { sign = -1; str++; } else sign = 1; - + // check for hex if( str[0] == '0' && ( str[1] == 'x' || str[1] == 'X' )) { @@ -264,10 +264,10 @@ float Q_atof( const char *str ) else return val * sign; } } - + // check for character if( str[0] == '\'' ) return sign * str[1]; - + // assume decimal decimal = -1; total = 0; @@ -295,7 +295,7 @@ float Q_atof( const char *str ) val /= 10; total--; } - + return val * sign; } @@ -369,7 +369,7 @@ int Q_strnicmp( const char *s1, const char *s2, int n ) c2 = *s2++; if( !n-- ) return 0; // strings are equal until end point - + if( c1 != c2 ) { if( c1 >= 'a' && c1 <= 'z' ) c1 -= ('a' - 'A'); @@ -395,7 +395,7 @@ int Q_strncmp( const char *s1, const char *s2, int n ) else if( s2 == NULL ) { return 1; - } + } do { c1 = *s1++; @@ -406,7 +406,7 @@ int Q_strncmp( const char *s1, const char *s2, int n ) if( c1 != c2 ) return c1 < c2 ? -1 : 1; } while( c1 ); - + // strings are equal return 0; } diff --git a/public/matrixlib.c b/public/matrixlib.c index f536e4f9..435474d5 100644 --- a/public/matrixlib.c +++ b/public/matrixlib.c @@ -635,7 +635,7 @@ qboolean Matrix4x4_Invert_Full( matrix4x4 out, const matrix4x4 in1 ) r[3][4] = 0.0f; r[3][5] = 0.0f; r[3][6] = 0.0f; - r[3][7] = 1.0f; + r[3][7] = 1.0f; if( fabs( r[3][0] ) > fabs( r[2][0] )) { diff --git a/public/pstdint.h b/public/pstdint.h index f4a30815..88383b05 100644 --- a/public/pstdint.h +++ b/public/pstdint.h @@ -1,919 +1,919 @@ -/* A portable stdint.h - **************************************************************************** - * BSD License: - **************************************************************************** - * - * Copyright (c) 2005-2016 Paul Hsieh - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - **************************************************************************** - * - * Version 0.1.16.0 - * - * The ANSI C standard committee, for the C99 standard, specified the - * inclusion of a new standard include file called stdint.h. This is - * a very useful and long desired include file which contains several - * very precise definitions for integer scalar types that is critically - * important for making several classes of applications portable - * including cryptography, hashing, variable length integer libraries - * and so on. But for most developers its likely useful just for - * programming sanity. - * - * The problem is that some compiler vendors chose to ignore the C99 - * standard and some older compilers have no opportunity to be updated. - * Because of this situation, simply including stdint.h in your code - * makes it unportable. - * - * So that's what this file is all about. It's an attempt to build a - * single universal include file that works on as many platforms as - * possible to deliver what stdint.h is supposed to. Even compilers - * that already come with stdint.h can use this file instead without - * any loss of functionality. A few things that should be noted about - * this file: - * - * 1) It is not guaranteed to be portable and/or present an identical - * interface on all platforms. The extreme variability of the - * ANSI C standard makes this an impossibility right from the - * very get go. Its really only meant to be useful for the vast - * majority of platforms that possess the capability of - * implementing usefully and precisely defined, standard sized - * integer scalars. Systems which are not intrinsically 2s - * complement may produce invalid constants. - * - * 2) There is an unavoidable use of non-reserved symbols. - * - * 3) Other standard include files are invoked. - * - * 4) This file may come in conflict with future platforms that do - * include stdint.h. The hope is that one or the other can be - * used with no real difference. - * - * 5) In the current version, if your platform can't represent - * int32_t, int16_t and int8_t, it just dumps out with a compiler - * error. - * - * 6) 64 bit integers may or may not be defined. Test for their - * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX. - * Note that this is different from the C99 specification which - * requires the existence of 64 bit support in the compiler. If - * this is not defined for your platform, yet it is capable of - * dealing with 64 bits then it is because this file has not yet - * been extended to cover all of your system's capabilities. - * - * 7) (u)intptr_t may or may not be defined. Test for its presence - * with the test: #ifdef PTRDIFF_MAX. If this is not defined - * for your platform, then it is because this file has not yet - * been extended to cover all of your system's capabilities, not - * because its optional. - * - * 8) The following might not been defined even if your platform is - * capable of defining it: - * - * WCHAR_MIN - * WCHAR_MAX - * (u)int64_t - * PTRDIFF_MIN - * PTRDIFF_MAX - * (u)intptr_t - * - * 9) The following have not been defined: - * - * WINT_MIN - * WINT_MAX - * - * 10) The criteria for defining (u)int_least(*)_t isn't clear, - * except for systems which don't have a type that precisely - * defined 8, 16, or 32 bit types (which this include file does - * not support anyways). Default definitions have been given. - * - * 11) The criteria for defining (u)int_fast(*)_t isn't something I - * would trust to any particular compiler vendor or the ANSI C - * committee. It is well known that "compatible systems" are - * commonly created that have very different performance - * characteristics from the systems they are compatible with, - * especially those whose vendors make both the compiler and the - * system. Default definitions have been given, but its strongly - * recommended that users never use these definitions for any - * reason (they do *NOT* deliver any serious guarantee of - * improved performance -- not in this file, nor any vendor's - * stdint.h). - * - * 12) The following macros: - * - * PRINTF_INTMAX_MODIFIER - * PRINTF_INT64_MODIFIER - * PRINTF_INT32_MODIFIER - * PRINTF_INT16_MODIFIER - * PRINTF_LEAST64_MODIFIER - * PRINTF_LEAST32_MODIFIER - * PRINTF_LEAST16_MODIFIER - * PRINTF_INTPTR_MODIFIER - * - * are strings which have been defined as the modifiers required - * for the "d", "u" and "x" printf formats to correctly output - * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t, - * (u)least32_t, (u)least16_t and (u)intptr_t types respectively. - * PRINTF_INTPTR_MODIFIER is not defined for some systems which - * provide their own stdint.h. PRINTF_INT64_MODIFIER is not - * defined if INT64_MAX is not defined. These are an extension - * beyond what C99 specifies must be in stdint.h. - * - * In addition, the following macros are defined: - * - * PRINTF_INTMAX_HEX_WIDTH - * PRINTF_INT64_HEX_WIDTH - * PRINTF_INT32_HEX_WIDTH - * PRINTF_INT16_HEX_WIDTH - * PRINTF_INT8_HEX_WIDTH - * PRINTF_INTMAX_DEC_WIDTH - * PRINTF_INT64_DEC_WIDTH - * PRINTF_INT32_DEC_WIDTH - * PRINTF_INT16_DEC_WIDTH - * PRINTF_UINT8_DEC_WIDTH - * PRINTF_UINTMAX_DEC_WIDTH - * PRINTF_UINT64_DEC_WIDTH - * PRINTF_UINT32_DEC_WIDTH - * PRINTF_UINT16_DEC_WIDTH - * PRINTF_UINT8_DEC_WIDTH - * - * Which specifies the maximum number of characters required to - * print the number of that type in either hexadecimal or decimal. - * These are an extension beyond what C99 specifies must be in - * stdint.h. - * - * Compilers tested (all with 0 warnings at their highest respective - * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32 - * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio - * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3 - * - * This file should be considered a work in progress. Suggestions for - * improvements, especially those which increase coverage are strongly - * encouraged. - * - * Acknowledgements - * - * The following people have made significant contributions to the - * development and testing of this file: - * - * Chris Howie - * John Steele Scott - * Dave Thorup - * John Dill - * Florian Wobbe - * Christopher Sean Morrison - * Mikkel Fahnoe Jorgensen - * - */ - -#include -#include -#include - -/* - * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and - * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. - */ - -#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED) -#include -#define _PSTDINT_H_INCLUDED -# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__)) -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "l" -# endif -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -# else -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# ifndef PRINTF_INT32_MODIFIER -# if (UINT_MAX == UINT32_MAX) -# define PRINTF_INT32_MODIFIER "" -# else -# define PRINTF_INT32_MODIFIER "l" -# endif -# endif -# endif -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER -# endif -# ifndef PRINTF_INT64_HEX_WIDTH -# define PRINTF_INT64_HEX_WIDTH "16" -# endif -# ifndef PRINTF_UINT64_HEX_WIDTH -# define PRINTF_UINT64_HEX_WIDTH "16" -# endif -# ifndef PRINTF_INT32_HEX_WIDTH -# define PRINTF_INT32_HEX_WIDTH "8" -# endif -# ifndef PRINTF_UINT32_HEX_WIDTH -# define PRINTF_UINT32_HEX_WIDTH "8" -# endif -# ifndef PRINTF_INT16_HEX_WIDTH -# define PRINTF_INT16_HEX_WIDTH "4" -# endif -# ifndef PRINTF_UINT16_HEX_WIDTH -# define PRINTF_UINT16_HEX_WIDTH "4" -# endif -# ifndef PRINTF_INT8_HEX_WIDTH -# define PRINTF_INT8_HEX_WIDTH "2" -# endif -# ifndef PRINTF_UINT8_HEX_WIDTH -# define PRINTF_UINT8_HEX_WIDTH "2" -# endif -# ifndef PRINTF_INT64_DEC_WIDTH -# define PRINTF_INT64_DEC_WIDTH "19" -# endif -# ifndef PRINTF_UINT64_DEC_WIDTH -# define PRINTF_UINT64_DEC_WIDTH "20" -# endif -# ifndef PRINTF_INT32_DEC_WIDTH -# define PRINTF_INT32_DEC_WIDTH "10" -# endif -# ifndef PRINTF_UINT32_DEC_WIDTH -# define PRINTF_UINT32_DEC_WIDTH "10" -# endif -# ifndef PRINTF_INT16_DEC_WIDTH -# define PRINTF_INT16_DEC_WIDTH "5" -# endif -# ifndef PRINTF_UINT16_DEC_WIDTH -# define PRINTF_UINT16_DEC_WIDTH "5" -# endif -# ifndef PRINTF_INT8_DEC_WIDTH -# define PRINTF_INT8_DEC_WIDTH "3" -# endif -# ifndef PRINTF_UINT8_DEC_WIDTH -# define PRINTF_UINT8_DEC_WIDTH "3" -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH -# endif -# ifndef PRINTF_UINTMAX_HEX_WIDTH -# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH -# endif -# ifndef PRINTF_UINTMAX_DEC_WIDTH -# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH -# endif - -/* - * Something really weird is going on with Open Watcom. Just pull some of - * these duplicated definitions from Open Watcom's stdint.h file for now. - */ - -# if defined (__WATCOMC__) && __WATCOMC__ >= 1250 -# if !defined (INT64_C) -# define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) -# endif -# if !defined (UINT64_C) -# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) -# endif -# if !defined (INT32_C) -# define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) -# endif -# if !defined (UINT32_C) -# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) -# endif -# if !defined (INT16_C) -# define INT16_C(x) (x) -# endif -# if !defined (UINT16_C) -# define UINT16_C(x) (x) -# endif -# if !defined (INT8_C) -# define INT8_C(x) (x) -# endif -# if !defined (UINT8_C) -# define UINT8_C(x) (x) -# endif -# if !defined (UINT64_MAX) -# define UINT64_MAX 18446744073709551615ULL -# endif -# if !defined (INT64_MAX) -# define INT64_MAX 9223372036854775807LL -# endif -# if !defined (UINT32_MAX) -# define UINT32_MAX 4294967295UL -# endif -# if !defined (INT32_MAX) -# define INT32_MAX 2147483647L -# endif -# if !defined (INTMAX_MAX) -# define INTMAX_MAX INT64_MAX -# endif -# if !defined (INTMAX_MIN) -# define INTMAX_MIN INT64_MIN -# endif -# endif -#endif - -/* - * I have no idea what is the truly correct thing to do on older Solaris. - * From some online discussions, this seems to be what is being - * recommended. For people who actually are developing on older Solaris, - * what I would like to know is, does this define all of the relevant - * macros of a complete stdint.h? Remember, in pstdint.h 64 bit is - * considered optional. - */ - -#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED) -#include -#define _PSTDINT_H_INCLUDED -#endif - -#ifndef _PSTDINT_H_INCLUDED -#define _PSTDINT_H_INCLUDED - -#ifndef SIZE_MAX -# define SIZE_MAX ((size_t)-1) -#endif - -/* - * Deduce the type assignments from limits.h under the assumption that - * integer sizes in bits are powers of 2, and follow the ANSI - * definitions. - */ - -#ifndef UINT8_MAX -# define UINT8_MAX 0xff -#endif -#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks) -# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) - typedef unsigned char uint8_t; -# define UINT8_C(v) ((uint8_t) v) -# else -# error "Platform not supported" -# endif -#endif - -#ifndef INT8_MAX -# define INT8_MAX 0x7f -#endif -#ifndef INT8_MIN -# define INT8_MIN INT8_C(0x80) -#endif -#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks) -# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) - typedef signed char int8_t; -# define INT8_C(v) ((int8_t) v) -# else -# error "Platform not supported" -# endif -#endif - -#ifndef UINT16_MAX -# define UINT16_MAX 0xffff -#endif -#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks) -#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) - typedef unsigned int uint16_t; -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "" -# endif -# define UINT16_C(v) ((uint16_t) (v)) -#elif (USHRT_MAX == UINT16_MAX) - typedef unsigned short uint16_t; -# define UINT16_C(v) ((uint16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef INT16_MAX -# define INT16_MAX 0x7fff -#endif -#ifndef INT16_MIN -# define INT16_MIN INT16_C(0x8000) -#endif -#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks) -#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) - typedef signed int int16_t; -# define INT16_C(v) ((int16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "" -# endif -#elif (SHRT_MAX == INT16_MAX) - typedef signed short int16_t; -# define INT16_C(v) ((int16_t) (v)) -# ifndef PRINTF_INT16_MODIFIER -# define PRINTF_INT16_MODIFIER "h" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef UINT32_MAX -# define UINT32_MAX (0xffffffffUL) -#endif -#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks) -#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) - typedef unsigned long uint32_t; -# define UINT32_C(v) v ## UL -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (UINT_MAX == UINT32_MAX) - typedef unsigned int uint32_t; -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -# define UINT32_C(v) v ## U -#elif (USHRT_MAX == UINT32_MAX) - typedef unsigned short uint32_t; -# define UINT32_C(v) ((unsigned short) (v)) -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#else -#error "Platform not supported" -#endif -#endif - -#ifndef INT32_MAX -# define INT32_MAX (0x7fffffffL) -#endif -#ifndef INT32_MIN -# define INT32_MIN INT32_C(0x80000000) -#endif -#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks) -#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) - typedef signed long int32_t; -# define INT32_C(v) v ## L -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "l" -# endif -#elif (INT_MAX == INT32_MAX) - typedef signed int int32_t; -# define INT32_C(v) v -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#elif (SHRT_MAX == INT32_MAX) - typedef signed short int32_t; -# define INT32_C(v) ((short) (v)) -# ifndef PRINTF_INT32_MODIFIER -# define PRINTF_INT32_MODIFIER "" -# endif -#else -#error "Platform not supported" -#endif -#endif - -/* - * The macro stdint_int64_defined is temporarily used to record - * whether or not 64 integer support is available. It must be - * defined for any 64 integer extensions for new platforms that are - * added. - */ - -#undef stdint_int64_defined -#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) -# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) -# define stdint_int64_defined - typedef long long int64_t; - typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# endif -#endif - -#if !defined (stdint_int64_defined) -# if defined(__GNUC__) && !defined(vxWorks) -# define stdint_int64_defined - __extension__ typedef long long int64_t; - __extension__ typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) -# define stdint_int64_defined - typedef long long int64_t; - typedef unsigned long long uint64_t; -# define UINT64_C(v) v ## ULL -# define INT64_C(v) v ## LL -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "ll" -# endif -# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) -# define stdint_int64_defined - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; -# define UINT64_C(v) v ## UI64 -# define INT64_C(v) v ## I64 -# ifndef PRINTF_INT64_MODIFIER -# define PRINTF_INT64_MODIFIER "I64" -# endif -# endif -#endif - -#if !defined (LONG_LONG_MAX) && defined (INT64_C) -# define LONG_LONG_MAX INT64_C (9223372036854775807) -#endif -#ifndef ULONG_LONG_MAX -# define ULONG_LONG_MAX UINT64_C (18446744073709551615) -#endif - -#if !defined (INT64_MAX) && defined (INT64_C) -# define INT64_MAX INT64_C (9223372036854775807) -#endif -#if !defined (INT64_MIN) && defined (INT64_C) -# define INT64_MIN INT64_C (-9223372036854775808) -#endif -#if !defined (UINT64_MAX) && defined (INT64_C) -# define UINT64_MAX UINT64_C (18446744073709551615) -#endif - -/* - * Width of hexadecimal for number field. - */ - -#ifndef PRINTF_INT64_HEX_WIDTH -# define PRINTF_INT64_HEX_WIDTH "16" -#endif -#ifndef PRINTF_INT32_HEX_WIDTH -# define PRINTF_INT32_HEX_WIDTH "8" -#endif -#ifndef PRINTF_INT16_HEX_WIDTH -# define PRINTF_INT16_HEX_WIDTH "4" -#endif -#ifndef PRINTF_INT8_HEX_WIDTH -# define PRINTF_INT8_HEX_WIDTH "2" -#endif -#ifndef PRINTF_INT64_DEC_WIDTH -# define PRINTF_INT64_DEC_WIDTH "19" -#endif -#ifndef PRINTF_INT32_DEC_WIDTH -# define PRINTF_INT32_DEC_WIDTH "10" -#endif -#ifndef PRINTF_INT16_DEC_WIDTH -# define PRINTF_INT16_DEC_WIDTH "5" -#endif -#ifndef PRINTF_INT8_DEC_WIDTH -# define PRINTF_INT8_DEC_WIDTH "3" -#endif -#ifndef PRINTF_UINT64_DEC_WIDTH -# define PRINTF_UINT64_DEC_WIDTH "20" -#endif -#ifndef PRINTF_UINT32_DEC_WIDTH -# define PRINTF_UINT32_DEC_WIDTH "10" -#endif -#ifndef PRINTF_UINT16_DEC_WIDTH -# define PRINTF_UINT16_DEC_WIDTH "5" -#endif -#ifndef PRINTF_UINT8_DEC_WIDTH -# define PRINTF_UINT8_DEC_WIDTH "3" -#endif - -/* - * Ok, lets not worry about 128 bit integers for now. Moore's law says - * we don't need to worry about that until about 2040 at which point - * we'll have bigger things to worry about. - */ - -#ifdef stdint_int64_defined - typedef int64_t intmax_t; - typedef uint64_t uintmax_t; -# define INTMAX_MAX INT64_MAX -# define INTMAX_MIN INT64_MIN -# define UINTMAX_MAX UINT64_MAX -# define UINTMAX_C(v) UINT64_C(v) -# define INTMAX_C(v) INT64_C(v) -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH -# endif -#else - typedef int32_t intmax_t; - typedef uint32_t uintmax_t; -# define INTMAX_MAX INT32_MAX -# define UINTMAX_MAX UINT32_MAX -# define UINTMAX_C(v) UINT32_C(v) -# define INTMAX_C(v) INT32_C(v) -# ifndef PRINTF_INTMAX_MODIFIER -# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER -# endif -# ifndef PRINTF_INTMAX_HEX_WIDTH -# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH -# endif -# ifndef PRINTF_INTMAX_DEC_WIDTH -# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH -# endif -#endif - -/* - * Because this file currently only supports platforms which have - * precise powers of 2 as bit sizes for the default integers, the - * least definitions are all trivial. Its possible that a future - * version of this file could have different definitions. - */ - -#ifndef stdint_least_defined - typedef int8_t int_least8_t; - typedef uint8_t uint_least8_t; - typedef int16_t int_least16_t; - typedef uint16_t uint_least16_t; - typedef int32_t int_least32_t; - typedef uint32_t uint_least32_t; -# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER -# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER -# define UINT_LEAST8_MAX UINT8_MAX -# define INT_LEAST8_MAX INT8_MAX -# define UINT_LEAST16_MAX UINT16_MAX -# define INT_LEAST16_MAX INT16_MAX -# define UINT_LEAST32_MAX UINT32_MAX -# define INT_LEAST32_MAX INT32_MAX -# define INT_LEAST8_MIN INT8_MIN -# define INT_LEAST16_MIN INT16_MIN -# define INT_LEAST32_MIN INT32_MIN -# ifdef stdint_int64_defined - typedef int64_t int_least64_t; - typedef uint64_t uint_least64_t; -# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER -# define UINT_LEAST64_MAX UINT64_MAX -# define INT_LEAST64_MAX INT64_MAX -# define INT_LEAST64_MIN INT64_MIN -# endif -#endif -#undef stdint_least_defined - -/* - * The ANSI C committee has defined *int*_fast*_t types as well. This, - * of course, defies rationality -- you can't know what will be fast - * just from the type itself. Even for a given architecture, compatible - * implementations might have different performance characteristics. - * Developers are warned to stay away from these types when using this - * or any other stdint.h. - */ - -typedef int_least8_t int_fast8_t; -typedef uint_least8_t uint_fast8_t; -typedef int_least16_t int_fast16_t; -typedef uint_least16_t uint_fast16_t; -typedef int_least32_t int_fast32_t; -typedef uint_least32_t uint_fast32_t; -#define UINT_FAST8_MAX UINT_LEAST8_MAX -#define INT_FAST8_MAX INT_LEAST8_MAX -#define UINT_FAST16_MAX UINT_LEAST16_MAX -#define INT_FAST16_MAX INT_LEAST16_MAX -#define UINT_FAST32_MAX UINT_LEAST32_MAX -#define INT_FAST32_MAX INT_LEAST32_MAX -#define INT_FAST8_MIN INT_LEAST8_MIN -#define INT_FAST16_MIN INT_LEAST16_MIN -#define INT_FAST32_MIN INT_LEAST32_MIN -#ifdef stdint_int64_defined - typedef int_least64_t int_fast64_t; - typedef uint_least64_t uint_fast64_t; -# define UINT_FAST64_MAX UINT_LEAST64_MAX -# define INT_FAST64_MAX INT_LEAST64_MAX -# define INT_FAST64_MIN INT_LEAST64_MIN -#endif - -#undef stdint_int64_defined - -/* - * Whatever piecemeal, per compiler thing we can do about the wchar_t - * type limits. - */ - -#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks) -# include -# ifndef WCHAR_MIN -# define WCHAR_MIN 0 -# endif -# ifndef WCHAR_MAX -# define WCHAR_MAX ((wchar_t)-1) -# endif -#endif - -/* - * Whatever piecemeal, per compiler/platform thing we can do about the - * (u)intptr_t types and limits. - */ - -#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T) -# define STDINT_H_UINTPTR_T_DEFINED -#endif - -#ifndef STDINT_H_UINTPTR_T_DEFINED -# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__) -# define stdint_intptr_bits 64 -# elif defined (__WATCOMC__) || defined (__TURBOC__) -# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) -# define stdint_intptr_bits 16 -# else -# define stdint_intptr_bits 32 -# endif -# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__) -# define stdint_intptr_bits 32 -# elif defined (__INTEL_COMPILER) -/* TODO -- what did Intel do about x86-64? */ -# else -/* #error "This platform might not be supported yet" */ -# endif - -# ifdef stdint_intptr_bits -# define stdint_intptr_glue3_i(a,b,c) a##b##c -# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) -# ifndef PRINTF_INTPTR_MODIFIER -# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) -# endif -# ifndef PTRDIFF_MAX -# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) -# endif -# ifndef PTRDIFF_MIN -# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) -# endif -# ifndef UINTPTR_MAX -# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) -# endif -# ifndef INTPTR_MAX -# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) -# endif -# ifndef INTPTR_MIN -# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) -# endif -# ifndef INTPTR_C -# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) -# endif -# ifndef UINTPTR_C -# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) -# endif - typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t; - typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t; -# else -/* TODO -- This following is likely wrong for some platforms, and does - nothing for the definition of uintptr_t. */ - typedef ptrdiff_t intptr_t; -# endif -# define STDINT_H_UINTPTR_T_DEFINED -#endif - -/* - * Assumes sig_atomic_t is signed and we have a 2s complement machine. - */ - -#ifndef SIG_ATOMIC_MAX -# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) -#endif - -#endif - -#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) - -/* - * Please compile with the maximum warning settings to make sure macros are - * not defined more than once. - */ - -#include -#include -#include - -#define glue3_aux(x,y,z) x ## y ## z -#define glue3(x,y,z) glue3_aux(x,y,z) - -#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0); -#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0); - -#define DECL(us,bits) glue3(DECL,us,) (bits) - -#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits) - -#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; } - -#define X_SIZE_MAX ((size_t)-1) - -int main () { - int err_n = 0; - int err_first = 0; - DECL(I,8) - DECL(U,8) - DECL(I,16) - DECL(U,16) - DECL(I,32) - DECL(U,32) -#ifdef INT64_MAX - DECL(I,64) - DECL(U,64) -#endif - intmax_t imax = INTMAX_C(0); - uintmax_t umax = UINTMAX_C(0); - char str0[256], str1[256]; - - sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647)); - if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); - if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH)); - sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295)); - if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); - if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH)); -#ifdef INT64_MAX - sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807)); - if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); - if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1))); - sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591)); - if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); - if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1))); -#endif - - sprintf (str0, "%d %x\n", 0, ~0); - - sprintf (str1, "%d %x\n", i8, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1)); - sprintf (str1, "%u %x\n", u8, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1)); - sprintf (str1, "%d %x\n", i16, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1)); - sprintf (str1, "%u %x\n", u16, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1)); - sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1)); - sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1)); -#ifdef INT64_MAX - sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1)); -#endif - sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1)); - sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); - if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1)); - - TESTUMAX(8); - TESTUMAX(16); - TESTUMAX(32); -#ifdef INT64_MAX - TESTUMAX(64); -#endif - -#define STR(v) #v -#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v)); - if (err_n) { - printf ("pstdint.h is not correct. Please use sizes below to correct it:\n"); - } - - Q(int) - Q(unsigned) - Q(long int) - Q(short int) - Q(int8_t) - Q(int16_t) - Q(int32_t) -#ifdef INT64_MAX - Q(int64_t) -#endif - -#if UINT_MAX < X_SIZE_MAX - printf ("UINT_MAX < X_SIZE_MAX\n"); -#else - printf ("UINT_MAX >= X_SIZE_MAX\n"); -#endif - printf ("%" PRINTF_INT64_MODIFIER "u vs %" PRINTF_INT64_MODIFIER "u\n", UINT_MAX, X_SIZE_MAX); - - return EXIT_SUCCESS; -} - -#endif +/* A portable stdint.h + **************************************************************************** + * BSD License: + **************************************************************************** + * + * Copyright (c) 2005-2016 Paul Hsieh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + **************************************************************************** + * + * Version 0.1.16.0 + * + * The ANSI C standard committee, for the C99 standard, specified the + * inclusion of a new standard include file called stdint.h. This is + * a very useful and long desired include file which contains several + * very precise definitions for integer scalar types that is critically + * important for making several classes of applications portable + * including cryptography, hashing, variable length integer libraries + * and so on. But for most developers its likely useful just for + * programming sanity. + * + * The problem is that some compiler vendors chose to ignore the C99 + * standard and some older compilers have no opportunity to be updated. + * Because of this situation, simply including stdint.h in your code + * makes it unportable. + * + * So that's what this file is all about. It's an attempt to build a + * single universal include file that works on as many platforms as + * possible to deliver what stdint.h is supposed to. Even compilers + * that already come with stdint.h can use this file instead without + * any loss of functionality. A few things that should be noted about + * this file: + * + * 1) It is not guaranteed to be portable and/or present an identical + * interface on all platforms. The extreme variability of the + * ANSI C standard makes this an impossibility right from the + * very get go. Its really only meant to be useful for the vast + * majority of platforms that possess the capability of + * implementing usefully and precisely defined, standard sized + * integer scalars. Systems which are not intrinsically 2s + * complement may produce invalid constants. + * + * 2) There is an unavoidable use of non-reserved symbols. + * + * 3) Other standard include files are invoked. + * + * 4) This file may come in conflict with future platforms that do + * include stdint.h. The hope is that one or the other can be + * used with no real difference. + * + * 5) In the current version, if your platform can't represent + * int32_t, int16_t and int8_t, it just dumps out with a compiler + * error. + * + * 6) 64 bit integers may or may not be defined. Test for their + * presence with the test: #ifdef INT64_MAX or #ifdef UINT64_MAX. + * Note that this is different from the C99 specification which + * requires the existence of 64 bit support in the compiler. If + * this is not defined for your platform, yet it is capable of + * dealing with 64 bits then it is because this file has not yet + * been extended to cover all of your system's capabilities. + * + * 7) (u)intptr_t may or may not be defined. Test for its presence + * with the test: #ifdef PTRDIFF_MAX. If this is not defined + * for your platform, then it is because this file has not yet + * been extended to cover all of your system's capabilities, not + * because its optional. + * + * 8) The following might not been defined even if your platform is + * capable of defining it: + * + * WCHAR_MIN + * WCHAR_MAX + * (u)int64_t + * PTRDIFF_MIN + * PTRDIFF_MAX + * (u)intptr_t + * + * 9) The following have not been defined: + * + * WINT_MIN + * WINT_MAX + * + * 10) The criteria for defining (u)int_least(*)_t isn't clear, + * except for systems which don't have a type that precisely + * defined 8, 16, or 32 bit types (which this include file does + * not support anyways). Default definitions have been given. + * + * 11) The criteria for defining (u)int_fast(*)_t isn't something I + * would trust to any particular compiler vendor or the ANSI C + * committee. It is well known that "compatible systems" are + * commonly created that have very different performance + * characteristics from the systems they are compatible with, + * especially those whose vendors make both the compiler and the + * system. Default definitions have been given, but its strongly + * recommended that users never use these definitions for any + * reason (they do *NOT* deliver any serious guarantee of + * improved performance -- not in this file, nor any vendor's + * stdint.h). + * + * 12) The following macros: + * + * PRINTF_INTMAX_MODIFIER + * PRINTF_INT64_MODIFIER + * PRINTF_INT32_MODIFIER + * PRINTF_INT16_MODIFIER + * PRINTF_LEAST64_MODIFIER + * PRINTF_LEAST32_MODIFIER + * PRINTF_LEAST16_MODIFIER + * PRINTF_INTPTR_MODIFIER + * + * are strings which have been defined as the modifiers required + * for the "d", "u" and "x" printf formats to correctly output + * (u)intmax_t, (u)int64_t, (u)int32_t, (u)int16_t, (u)least64_t, + * (u)least32_t, (u)least16_t and (u)intptr_t types respectively. + * PRINTF_INTPTR_MODIFIER is not defined for some systems which + * provide their own stdint.h. PRINTF_INT64_MODIFIER is not + * defined if INT64_MAX is not defined. These are an extension + * beyond what C99 specifies must be in stdint.h. + * + * In addition, the following macros are defined: + * + * PRINTF_INTMAX_HEX_WIDTH + * PRINTF_INT64_HEX_WIDTH + * PRINTF_INT32_HEX_WIDTH + * PRINTF_INT16_HEX_WIDTH + * PRINTF_INT8_HEX_WIDTH + * PRINTF_INTMAX_DEC_WIDTH + * PRINTF_INT64_DEC_WIDTH + * PRINTF_INT32_DEC_WIDTH + * PRINTF_INT16_DEC_WIDTH + * PRINTF_UINT8_DEC_WIDTH + * PRINTF_UINTMAX_DEC_WIDTH + * PRINTF_UINT64_DEC_WIDTH + * PRINTF_UINT32_DEC_WIDTH + * PRINTF_UINT16_DEC_WIDTH + * PRINTF_UINT8_DEC_WIDTH + * + * Which specifies the maximum number of characters required to + * print the number of that type in either hexadecimal or decimal. + * These are an extension beyond what C99 specifies must be in + * stdint.h. + * + * Compilers tested (all with 0 warnings at their highest respective + * settings): Borland Turbo C 2.0, WATCOM C/C++ 11.0 (16 bits and 32 + * bits), Microsoft Visual C++ 6.0 (32 bit), Microsoft Visual Studio + * .net (VC7), Intel C++ 4.0, GNU gcc v3.3.3 + * + * This file should be considered a work in progress. Suggestions for + * improvements, especially those which increase coverage are strongly + * encouraged. + * + * Acknowledgements + * + * The following people have made significant contributions to the + * development and testing of this file: + * + * Chris Howie + * John Steele Scott + * Dave Thorup + * John Dill + * Florian Wobbe + * Christopher Sean Morrison + * Mikkel Fahnoe Jorgensen + * + */ + +#include +#include +#include + +/* + * For gcc with _STDINT_H, fill in the PRINTF_INT*_MODIFIER macros, and + * do nothing else. On the Mac OS X version of gcc this is _STDINT_H_. + */ + +#if ((defined(__SUNPRO_C) && __SUNPRO_C >= 0x570) || (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined (__WATCOMC__) && (defined (_STDINT_H_INCLUDED) || __WATCOMC__ >= 1250)) || (defined(__GNUC__) && (__GNUC__ > 3 || defined(_STDINT_H) || defined(_STDINT_H_) || defined (__UINT_FAST64_TYPE__)) )) && !defined (_PSTDINT_H_INCLUDED) +#include +#define _PSTDINT_H_INCLUDED +# if defined(__GNUC__) && (defined(__x86_64__) || defined(__ppc64__)) && !(defined(__APPLE__) && defined(__MACH__)) +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "l" +# endif +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +# else +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "ll" +# endif +# ifndef PRINTF_INT32_MODIFIER +# if (UINT_MAX == UINT32_MAX) +# define PRINTF_INT32_MODIFIER "" +# else +# define PRINTF_INT32_MODIFIER "l" +# endif +# endif +# endif +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "h" +# endif +# ifndef PRINTF_INTMAX_MODIFIER +# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER +# endif +# ifndef PRINTF_INT64_HEX_WIDTH +# define PRINTF_INT64_HEX_WIDTH "16" +# endif +# ifndef PRINTF_UINT64_HEX_WIDTH +# define PRINTF_UINT64_HEX_WIDTH "16" +# endif +# ifndef PRINTF_INT32_HEX_WIDTH +# define PRINTF_INT32_HEX_WIDTH "8" +# endif +# ifndef PRINTF_UINT32_HEX_WIDTH +# define PRINTF_UINT32_HEX_WIDTH "8" +# endif +# ifndef PRINTF_INT16_HEX_WIDTH +# define PRINTF_INT16_HEX_WIDTH "4" +# endif +# ifndef PRINTF_UINT16_HEX_WIDTH +# define PRINTF_UINT16_HEX_WIDTH "4" +# endif +# ifndef PRINTF_INT8_HEX_WIDTH +# define PRINTF_INT8_HEX_WIDTH "2" +# endif +# ifndef PRINTF_UINT8_HEX_WIDTH +# define PRINTF_UINT8_HEX_WIDTH "2" +# endif +# ifndef PRINTF_INT64_DEC_WIDTH +# define PRINTF_INT64_DEC_WIDTH "19" +# endif +# ifndef PRINTF_UINT64_DEC_WIDTH +# define PRINTF_UINT64_DEC_WIDTH "20" +# endif +# ifndef PRINTF_INT32_DEC_WIDTH +# define PRINTF_INT32_DEC_WIDTH "10" +# endif +# ifndef PRINTF_UINT32_DEC_WIDTH +# define PRINTF_UINT32_DEC_WIDTH "10" +# endif +# ifndef PRINTF_INT16_DEC_WIDTH +# define PRINTF_INT16_DEC_WIDTH "5" +# endif +# ifndef PRINTF_UINT16_DEC_WIDTH +# define PRINTF_UINT16_DEC_WIDTH "5" +# endif +# ifndef PRINTF_INT8_DEC_WIDTH +# define PRINTF_INT8_DEC_WIDTH "3" +# endif +# ifndef PRINTF_UINT8_DEC_WIDTH +# define PRINTF_UINT8_DEC_WIDTH "3" +# endif +# ifndef PRINTF_INTMAX_HEX_WIDTH +# define PRINTF_INTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH +# endif +# ifndef PRINTF_UINTMAX_HEX_WIDTH +# define PRINTF_UINTMAX_HEX_WIDTH PRINTF_UINT64_HEX_WIDTH +# endif +# ifndef PRINTF_INTMAX_DEC_WIDTH +# define PRINTF_INTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH +# endif +# ifndef PRINTF_UINTMAX_DEC_WIDTH +# define PRINTF_UINTMAX_DEC_WIDTH PRINTF_UINT64_DEC_WIDTH +# endif + +/* + * Something really weird is going on with Open Watcom. Just pull some of + * these duplicated definitions from Open Watcom's stdint.h file for now. + */ + +# if defined (__WATCOMC__) && __WATCOMC__ >= 1250 +# if !defined (INT64_C) +# define INT64_C(x) (x + (INT64_MAX - INT64_MAX)) +# endif +# if !defined (UINT64_C) +# define UINT64_C(x) (x + (UINT64_MAX - UINT64_MAX)) +# endif +# if !defined (INT32_C) +# define INT32_C(x) (x + (INT32_MAX - INT32_MAX)) +# endif +# if !defined (UINT32_C) +# define UINT32_C(x) (x + (UINT32_MAX - UINT32_MAX)) +# endif +# if !defined (INT16_C) +# define INT16_C(x) (x) +# endif +# if !defined (UINT16_C) +# define UINT16_C(x) (x) +# endif +# if !defined (INT8_C) +# define INT8_C(x) (x) +# endif +# if !defined (UINT8_C) +# define UINT8_C(x) (x) +# endif +# if !defined (UINT64_MAX) +# define UINT64_MAX 18446744073709551615ULL +# endif +# if !defined (INT64_MAX) +# define INT64_MAX 9223372036854775807LL +# endif +# if !defined (UINT32_MAX) +# define UINT32_MAX 4294967295UL +# endif +# if !defined (INT32_MAX) +# define INT32_MAX 2147483647L +# endif +# if !defined (INTMAX_MAX) +# define INTMAX_MAX INT64_MAX +# endif +# if !defined (INTMAX_MIN) +# define INTMAX_MIN INT64_MIN +# endif +# endif +#endif + +/* + * I have no idea what is the truly correct thing to do on older Solaris. + * From some online discussions, this seems to be what is being + * recommended. For people who actually are developing on older Solaris, + * what I would like to know is, does this define all of the relevant + * macros of a complete stdint.h? Remember, in pstdint.h 64 bit is + * considered optional. + */ + +#if (defined(__SUNPRO_C) && __SUNPRO_C >= 0x420) && !defined(_PSTDINT_H_INCLUDED) +#include +#define _PSTDINT_H_INCLUDED +#endif + +#ifndef _PSTDINT_H_INCLUDED +#define _PSTDINT_H_INCLUDED + +#ifndef SIZE_MAX +# define SIZE_MAX ((size_t)-1) +#endif + +/* + * Deduce the type assignments from limits.h under the assumption that + * integer sizes in bits are powers of 2, and follow the ANSI + * definitions. + */ + +#ifndef UINT8_MAX +# define UINT8_MAX 0xff +#endif +#if !defined(uint8_t) && !defined(_UINT8_T) && !defined(vxWorks) +# if (UCHAR_MAX == UINT8_MAX) || defined (S_SPLINT_S) + typedef unsigned char uint8_t; +# define UINT8_C(v) ((uint8_t) v) +# else +# error "Platform not supported" +# endif +#endif + +#ifndef INT8_MAX +# define INT8_MAX 0x7f +#endif +#ifndef INT8_MIN +# define INT8_MIN INT8_C(0x80) +#endif +#if !defined(int8_t) && !defined(_INT8_T) && !defined(vxWorks) +# if (SCHAR_MAX == INT8_MAX) || defined (S_SPLINT_S) + typedef signed char int8_t; +# define INT8_C(v) ((int8_t) v) +# else +# error "Platform not supported" +# endif +#endif + +#ifndef UINT16_MAX +# define UINT16_MAX 0xffff +#endif +#if !defined(uint16_t) && !defined(_UINT16_T) && !defined(vxWorks) +#if (UINT_MAX == UINT16_MAX) || defined (S_SPLINT_S) + typedef unsigned int uint16_t; +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "" +# endif +# define UINT16_C(v) ((uint16_t) (v)) +#elif (USHRT_MAX == UINT16_MAX) + typedef unsigned short uint16_t; +# define UINT16_C(v) ((uint16_t) (v)) +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "h" +# endif +#else +#error "Platform not supported" +#endif +#endif + +#ifndef INT16_MAX +# define INT16_MAX 0x7fff +#endif +#ifndef INT16_MIN +# define INT16_MIN INT16_C(0x8000) +#endif +#if !defined(int16_t) && !defined(_INT16_T) && !defined(vxWorks) +#if (INT_MAX == INT16_MAX) || defined (S_SPLINT_S) + typedef signed int int16_t; +# define INT16_C(v) ((int16_t) (v)) +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "" +# endif +#elif (SHRT_MAX == INT16_MAX) + typedef signed short int16_t; +# define INT16_C(v) ((int16_t) (v)) +# ifndef PRINTF_INT16_MODIFIER +# define PRINTF_INT16_MODIFIER "h" +# endif +#else +#error "Platform not supported" +#endif +#endif + +#ifndef UINT32_MAX +# define UINT32_MAX (0xffffffffUL) +#endif +#if !defined(uint32_t) && !defined(_UINT32_T) && !defined(vxWorks) +#if (ULONG_MAX == UINT32_MAX) || defined (S_SPLINT_S) + typedef unsigned long uint32_t; +# define UINT32_C(v) v ## UL +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "l" +# endif +#elif (UINT_MAX == UINT32_MAX) + typedef unsigned int uint32_t; +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +# define UINT32_C(v) v ## U +#elif (USHRT_MAX == UINT32_MAX) + typedef unsigned short uint32_t; +# define UINT32_C(v) ((unsigned short) (v)) +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +#else +#error "Platform not supported" +#endif +#endif + +#ifndef INT32_MAX +# define INT32_MAX (0x7fffffffL) +#endif +#ifndef INT32_MIN +# define INT32_MIN INT32_C(0x80000000) +#endif +#if !defined(int32_t) && !defined(_INT32_T) && !defined(vxWorks) +#if (LONG_MAX == INT32_MAX) || defined (S_SPLINT_S) + typedef signed long int32_t; +# define INT32_C(v) v ## L +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "l" +# endif +#elif (INT_MAX == INT32_MAX) + typedef signed int int32_t; +# define INT32_C(v) v +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +#elif (SHRT_MAX == INT32_MAX) + typedef signed short int32_t; +# define INT32_C(v) ((short) (v)) +# ifndef PRINTF_INT32_MODIFIER +# define PRINTF_INT32_MODIFIER "" +# endif +#else +#error "Platform not supported" +#endif +#endif + +/* + * The macro stdint_int64_defined is temporarily used to record + * whether or not 64 integer support is available. It must be + * defined for any 64 integer extensions for new platforms that are + * added. + */ + +#undef stdint_int64_defined +#if (defined(__STDC__) && defined(__STDC_VERSION__)) || defined (S_SPLINT_S) +# if (__STDC__ && __STDC_VERSION__ >= 199901L) || defined (S_SPLINT_S) +# define stdint_int64_defined + typedef long long int64_t; + typedef unsigned long long uint64_t; +# define UINT64_C(v) v ## ULL +# define INT64_C(v) v ## LL +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "ll" +# endif +# endif +#endif + +#if !defined (stdint_int64_defined) +# if defined(__GNUC__) && !defined(vxWorks) +# define stdint_int64_defined + __extension__ typedef long long int64_t; + __extension__ typedef unsigned long long uint64_t; +# define UINT64_C(v) v ## ULL +# define INT64_C(v) v ## LL +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "ll" +# endif +# elif defined(__MWERKS__) || defined (__SUNPRO_C) || defined (__SUNPRO_CC) || defined (__APPLE_CC__) || defined (_LONG_LONG) || defined (_CRAYC) || defined (S_SPLINT_S) +# define stdint_int64_defined + typedef long long int64_t; + typedef unsigned long long uint64_t; +# define UINT64_C(v) v ## ULL +# define INT64_C(v) v ## LL +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "ll" +# endif +# elif (defined(__WATCOMC__) && defined(__WATCOM_INT64__)) || (defined(_MSC_VER) && _INTEGRAL_MAX_BITS >= 64) || (defined (__BORLANDC__) && __BORLANDC__ > 0x460) || defined (__alpha) || defined (__DECC) +# define stdint_int64_defined + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; +# define UINT64_C(v) v ## UI64 +# define INT64_C(v) v ## I64 +# ifndef PRINTF_INT64_MODIFIER +# define PRINTF_INT64_MODIFIER "I64" +# endif +# endif +#endif + +#if !defined (LONG_LONG_MAX) && defined (INT64_C) +# define LONG_LONG_MAX INT64_C (9223372036854775807) +#endif +#ifndef ULONG_LONG_MAX +# define ULONG_LONG_MAX UINT64_C (18446744073709551615) +#endif + +#if !defined (INT64_MAX) && defined (INT64_C) +# define INT64_MAX INT64_C (9223372036854775807) +#endif +#if !defined (INT64_MIN) && defined (INT64_C) +# define INT64_MIN INT64_C (-9223372036854775808) +#endif +#if !defined (UINT64_MAX) && defined (INT64_C) +# define UINT64_MAX UINT64_C (18446744073709551615) +#endif + +/* + * Width of hexadecimal for number field. + */ + +#ifndef PRINTF_INT64_HEX_WIDTH +# define PRINTF_INT64_HEX_WIDTH "16" +#endif +#ifndef PRINTF_INT32_HEX_WIDTH +# define PRINTF_INT32_HEX_WIDTH "8" +#endif +#ifndef PRINTF_INT16_HEX_WIDTH +# define PRINTF_INT16_HEX_WIDTH "4" +#endif +#ifndef PRINTF_INT8_HEX_WIDTH +# define PRINTF_INT8_HEX_WIDTH "2" +#endif +#ifndef PRINTF_INT64_DEC_WIDTH +# define PRINTF_INT64_DEC_WIDTH "19" +#endif +#ifndef PRINTF_INT32_DEC_WIDTH +# define PRINTF_INT32_DEC_WIDTH "10" +#endif +#ifndef PRINTF_INT16_DEC_WIDTH +# define PRINTF_INT16_DEC_WIDTH "5" +#endif +#ifndef PRINTF_INT8_DEC_WIDTH +# define PRINTF_INT8_DEC_WIDTH "3" +#endif +#ifndef PRINTF_UINT64_DEC_WIDTH +# define PRINTF_UINT64_DEC_WIDTH "20" +#endif +#ifndef PRINTF_UINT32_DEC_WIDTH +# define PRINTF_UINT32_DEC_WIDTH "10" +#endif +#ifndef PRINTF_UINT16_DEC_WIDTH +# define PRINTF_UINT16_DEC_WIDTH "5" +#endif +#ifndef PRINTF_UINT8_DEC_WIDTH +# define PRINTF_UINT8_DEC_WIDTH "3" +#endif + +/* + * Ok, lets not worry about 128 bit integers for now. Moore's law says + * we don't need to worry about that until about 2040 at which point + * we'll have bigger things to worry about. + */ + +#ifdef stdint_int64_defined + typedef int64_t intmax_t; + typedef uint64_t uintmax_t; +# define INTMAX_MAX INT64_MAX +# define INTMAX_MIN INT64_MIN +# define UINTMAX_MAX UINT64_MAX +# define UINTMAX_C(v) UINT64_C(v) +# define INTMAX_C(v) INT64_C(v) +# ifndef PRINTF_INTMAX_MODIFIER +# define PRINTF_INTMAX_MODIFIER PRINTF_INT64_MODIFIER +# endif +# ifndef PRINTF_INTMAX_HEX_WIDTH +# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT64_HEX_WIDTH +# endif +# ifndef PRINTF_INTMAX_DEC_WIDTH +# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT64_DEC_WIDTH +# endif +#else + typedef int32_t intmax_t; + typedef uint32_t uintmax_t; +# define INTMAX_MAX INT32_MAX +# define UINTMAX_MAX UINT32_MAX +# define UINTMAX_C(v) UINT32_C(v) +# define INTMAX_C(v) INT32_C(v) +# ifndef PRINTF_INTMAX_MODIFIER +# define PRINTF_INTMAX_MODIFIER PRINTF_INT32_MODIFIER +# endif +# ifndef PRINTF_INTMAX_HEX_WIDTH +# define PRINTF_INTMAX_HEX_WIDTH PRINTF_INT32_HEX_WIDTH +# endif +# ifndef PRINTF_INTMAX_DEC_WIDTH +# define PRINTF_INTMAX_DEC_WIDTH PRINTF_INT32_DEC_WIDTH +# endif +#endif + +/* + * Because this file currently only supports platforms which have + * precise powers of 2 as bit sizes for the default integers, the + * least definitions are all trivial. Its possible that a future + * version of this file could have different definitions. + */ + +#ifndef stdint_least_defined + typedef int8_t int_least8_t; + typedef uint8_t uint_least8_t; + typedef int16_t int_least16_t; + typedef uint16_t uint_least16_t; + typedef int32_t int_least32_t; + typedef uint32_t uint_least32_t; +# define PRINTF_LEAST32_MODIFIER PRINTF_INT32_MODIFIER +# define PRINTF_LEAST16_MODIFIER PRINTF_INT16_MODIFIER +# define UINT_LEAST8_MAX UINT8_MAX +# define INT_LEAST8_MAX INT8_MAX +# define UINT_LEAST16_MAX UINT16_MAX +# define INT_LEAST16_MAX INT16_MAX +# define UINT_LEAST32_MAX UINT32_MAX +# define INT_LEAST32_MAX INT32_MAX +# define INT_LEAST8_MIN INT8_MIN +# define INT_LEAST16_MIN INT16_MIN +# define INT_LEAST32_MIN INT32_MIN +# ifdef stdint_int64_defined + typedef int64_t int_least64_t; + typedef uint64_t uint_least64_t; +# define PRINTF_LEAST64_MODIFIER PRINTF_INT64_MODIFIER +# define UINT_LEAST64_MAX UINT64_MAX +# define INT_LEAST64_MAX INT64_MAX +# define INT_LEAST64_MIN INT64_MIN +# endif +#endif +#undef stdint_least_defined + +/* + * The ANSI C committee has defined *int*_fast*_t types as well. This, + * of course, defies rationality -- you can't know what will be fast + * just from the type itself. Even for a given architecture, compatible + * implementations might have different performance characteristics. + * Developers are warned to stay away from these types when using this + * or any other stdint.h. + */ + +typedef int_least8_t int_fast8_t; +typedef uint_least8_t uint_fast8_t; +typedef int_least16_t int_fast16_t; +typedef uint_least16_t uint_fast16_t; +typedef int_least32_t int_fast32_t; +typedef uint_least32_t uint_fast32_t; +#define UINT_FAST8_MAX UINT_LEAST8_MAX +#define INT_FAST8_MAX INT_LEAST8_MAX +#define UINT_FAST16_MAX UINT_LEAST16_MAX +#define INT_FAST16_MAX INT_LEAST16_MAX +#define UINT_FAST32_MAX UINT_LEAST32_MAX +#define INT_FAST32_MAX INT_LEAST32_MAX +#define INT_FAST8_MIN INT_LEAST8_MIN +#define INT_FAST16_MIN INT_LEAST16_MIN +#define INT_FAST32_MIN INT_LEAST32_MIN +#ifdef stdint_int64_defined + typedef int_least64_t int_fast64_t; + typedef uint_least64_t uint_fast64_t; +# define UINT_FAST64_MAX UINT_LEAST64_MAX +# define INT_FAST64_MAX INT_LEAST64_MAX +# define INT_FAST64_MIN INT_LEAST64_MIN +#endif + +#undef stdint_int64_defined + +/* + * Whatever piecemeal, per compiler thing we can do about the wchar_t + * type limits. + */ + +#if defined(__WATCOMC__) || defined(_MSC_VER) || defined (__GNUC__) && !defined(vxWorks) +# include +# ifndef WCHAR_MIN +# define WCHAR_MIN 0 +# endif +# ifndef WCHAR_MAX +# define WCHAR_MAX ((wchar_t)-1) +# endif +#endif + +/* + * Whatever piecemeal, per compiler/platform thing we can do about the + * (u)intptr_t types and limits. + */ + +#if (defined (_MSC_VER) && defined (_UINTPTR_T_DEFINED)) || defined (_UINTPTR_T) +# define STDINT_H_UINTPTR_T_DEFINED +#endif + +#ifndef STDINT_H_UINTPTR_T_DEFINED +# if defined (__alpha__) || defined (__ia64__) || defined (__x86_64__) || defined (_WIN64) || defined (__ppc64__) +# define stdint_intptr_bits 64 +# elif defined (__WATCOMC__) || defined (__TURBOC__) +# if defined(__TINY__) || defined(__SMALL__) || defined(__MEDIUM__) +# define stdint_intptr_bits 16 +# else +# define stdint_intptr_bits 32 +# endif +# elif defined (__i386__) || defined (_WIN32) || defined (WIN32) || defined (__ppc64__) +# define stdint_intptr_bits 32 +# elif defined (__INTEL_COMPILER) +/* TODO -- what did Intel do about x86-64? */ +# else +/* #error "This platform might not be supported yet" */ +# endif + +# ifdef stdint_intptr_bits +# define stdint_intptr_glue3_i(a,b,c) a##b##c +# define stdint_intptr_glue3(a,b,c) stdint_intptr_glue3_i(a,b,c) +# ifndef PRINTF_INTPTR_MODIFIER +# define PRINTF_INTPTR_MODIFIER stdint_intptr_glue3(PRINTF_INT,stdint_intptr_bits,_MODIFIER) +# endif +# ifndef PTRDIFF_MAX +# define PTRDIFF_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) +# endif +# ifndef PTRDIFF_MIN +# define PTRDIFF_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) +# endif +# ifndef UINTPTR_MAX +# define UINTPTR_MAX stdint_intptr_glue3(UINT,stdint_intptr_bits,_MAX) +# endif +# ifndef INTPTR_MAX +# define INTPTR_MAX stdint_intptr_glue3(INT,stdint_intptr_bits,_MAX) +# endif +# ifndef INTPTR_MIN +# define INTPTR_MIN stdint_intptr_glue3(INT,stdint_intptr_bits,_MIN) +# endif +# ifndef INTPTR_C +# define INTPTR_C(x) stdint_intptr_glue3(INT,stdint_intptr_bits,_C)(x) +# endif +# ifndef UINTPTR_C +# define UINTPTR_C(x) stdint_intptr_glue3(UINT,stdint_intptr_bits,_C)(x) +# endif + typedef stdint_intptr_glue3(uint,stdint_intptr_bits,_t) uintptr_t; + typedef stdint_intptr_glue3( int,stdint_intptr_bits,_t) intptr_t; +# else +/* TODO -- This following is likely wrong for some platforms, and does + nothing for the definition of uintptr_t. */ + typedef ptrdiff_t intptr_t; +# endif +# define STDINT_H_UINTPTR_T_DEFINED +#endif + +/* + * Assumes sig_atomic_t is signed and we have a 2s complement machine. + */ + +#ifndef SIG_ATOMIC_MAX +# define SIG_ATOMIC_MAX ((((sig_atomic_t) 1) << (sizeof (sig_atomic_t)*CHAR_BIT-1)) - 1) +#endif + +#endif + +#if defined (__TEST_PSTDINT_FOR_CORRECTNESS) + +/* + * Please compile with the maximum warning settings to make sure macros are + * not defined more than once. + */ + +#include +#include +#include + +#define glue3_aux(x,y,z) x ## y ## z +#define glue3(x,y,z) glue3_aux(x,y,z) + +#define DECLU(bits) glue3(uint,bits,_t) glue3(u,bits,) = glue3(UINT,bits,_C) (0); +#define DECLI(bits) glue3(int,bits,_t) glue3(i,bits,) = glue3(INT,bits,_C) (0); + +#define DECL(us,bits) glue3(DECL,us,) (bits) + +#define TESTUMAX(bits) glue3(u,bits,) = ~glue3(u,bits,); if (glue3(UINT,bits,_MAX) != glue3(u,bits,)) printf ("Something wrong with UINT%d_MAX\n", bits) + +#define REPORTERROR(msg) { err_n++; if (err_first <= 0) err_first = __LINE__; printf msg; } + +#define X_SIZE_MAX ((size_t)-1) + +int main () { + int err_n = 0; + int err_first = 0; + DECL(I,8) + DECL(U,8) + DECL(I,16) + DECL(U,16) + DECL(I,32) + DECL(U,32) +#ifdef INT64_MAX + DECL(I,64) + DECL(U,64) +#endif + intmax_t imax = INTMAX_C(0); + uintmax_t umax = UINTMAX_C(0); + char str0[256], str1[256]; + + sprintf (str0, "%" PRINTF_INT32_MODIFIER "d", INT32_C(2147483647)); + if (0 != strcmp (str0, "2147483647")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); + if (atoi(PRINTF_INT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_INT32_DEC_WIDTH : %s\n", PRINTF_INT32_DEC_WIDTH)); + sprintf (str0, "%" PRINTF_INT32_MODIFIER "u", UINT32_C(4294967295)); + if (0 != strcmp (str0, "4294967295")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str0)); + if (atoi(PRINTF_UINT32_DEC_WIDTH) != (int) strlen(str0)) REPORTERROR (("Something wrong with PRINTF_UINT32_DEC_WIDTH : %s\n", PRINTF_UINT32_DEC_WIDTH)); +#ifdef INT64_MAX + sprintf (str1, "%" PRINTF_INT64_MODIFIER "d", INT64_C(9223372036854775807)); + if (0 != strcmp (str1, "9223372036854775807")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); + if (atoi(PRINTF_INT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_INT64_DEC_WIDTH : %s, %d\n", PRINTF_INT64_DEC_WIDTH, (int) strlen(str1))); + sprintf (str1, "%" PRINTF_INT64_MODIFIER "u", UINT64_C(18446744073709550591)); + if (0 != strcmp (str1, "18446744073709550591")) REPORTERROR (("Something wrong with PRINTF_INT32_MODIFIER : %s\n", str1)); + if (atoi(PRINTF_UINT64_DEC_WIDTH) != (int) strlen(str1)) REPORTERROR (("Something wrong with PRINTF_UINT64_DEC_WIDTH : %s, %d\n", PRINTF_UINT64_DEC_WIDTH, (int) strlen(str1))); +#endif + + sprintf (str0, "%d %x\n", 0, ~0); + + sprintf (str1, "%d %x\n", i8, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i8 : %s\n", str1)); + sprintf (str1, "%u %x\n", u8, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u8 : %s\n", str1)); + sprintf (str1, "%d %x\n", i16, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i16 : %s\n", str1)); + sprintf (str1, "%u %x\n", u16, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u16 : %s\n", str1)); + sprintf (str1, "%" PRINTF_INT32_MODIFIER "d %x\n", i32, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i32 : %s\n", str1)); + sprintf (str1, "%" PRINTF_INT32_MODIFIER "u %x\n", u32, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with u32 : %s\n", str1)); +#ifdef INT64_MAX + sprintf (str1, "%" PRINTF_INT64_MODIFIER "d %x\n", i64, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with i64 : %s\n", str1)); +#endif + sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "d %x\n", imax, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with imax : %s\n", str1)); + sprintf (str1, "%" PRINTF_INTMAX_MODIFIER "u %x\n", umax, ~0); + if (0 != strcmp (str0, str1)) REPORTERROR (("Something wrong with umax : %s\n", str1)); + + TESTUMAX(8); + TESTUMAX(16); + TESTUMAX(32); +#ifdef INT64_MAX + TESTUMAX(64); +#endif + +#define STR(v) #v +#define Q(v) printf ("sizeof " STR(v) " = %u\n", (unsigned) sizeof (v)); + if (err_n) { + printf ("pstdint.h is not correct. Please use sizes below to correct it:\n"); + } + + Q(int) + Q(unsigned) + Q(long int) + Q(short int) + Q(int8_t) + Q(int16_t) + Q(int32_t) +#ifdef INT64_MAX + Q(int64_t) +#endif + +#if UINT_MAX < X_SIZE_MAX + printf ("UINT_MAX < X_SIZE_MAX\n"); +#else + printf ("UINT_MAX >= X_SIZE_MAX\n"); +#endif + printf ("%" PRINTF_INT64_MODIFIER "u vs %" PRINTF_INT64_MODIFIER "u\n", UINT_MAX, X_SIZE_MAX); + + return EXIT_SUCCESS; +} + +#endif diff --git a/public/xash3d_mathlib.c b/public/xash3d_mathlib.c index 39f5d1ba..2fd8f705 100644 --- a/public/xash3d_mathlib.c +++ b/public/xash3d_mathlib.c @@ -34,7 +34,7 @@ int boxpnt[6][4] = { 7, 5, 1, 3 }, // -X { 7, 3, 2, 6 }, // -Y { 7, 6, 4, 5 }, // -Z -}; +}; // pre-quantized table normals from Quake1 const float m_bytenormals[NUMVERTEXNORMALS][3] = @@ -128,7 +128,7 @@ round the hullsize to nearest 'right' value void RoundUpHullSize( vec3_t size ) { int i, j; - + for( i = 0; i < 3; i++) { qboolean negative = false; @@ -149,7 +149,7 @@ void RoundUpHullSize( vec3_t size ) { result = ( value - hull_table[j] ); if( result <= HULL_PRECISION ) - { + { result = -hull_table[j]; break; } @@ -158,7 +158,7 @@ void RoundUpHullSize( vec3_t size ) { result = ( value - hull_table[j] ); if( result <= HULL_PRECISION ) - { + { result = hull_table[j]; break; } @@ -451,7 +451,7 @@ void GAME_EXPORT VectorAngles( const float *forward, float *angles ) if( pitch < 0 ) pitch += 360; } - VectorSet( angles, pitch, yaw, 0 ); + VectorSet( angles, pitch, yaw, 0 ); } /* @@ -679,20 +679,20 @@ void QuaternionAlign( const vec4_t p, const vec4_t q, vec4_t qt ) float b = 0.0f; int i; - for( i = 0; i < 4; i++ ) + for( i = 0; i < 4; i++ ) { a += (p[i] - q[i]) * (p[i] - q[i]); b += (p[i] + q[i]) * (p[i] + q[i]); } - if( a > b ) + if( a > b ) { - for( i = 0; i < 4; i++ ) + for( i = 0; i < 4; i++ ) qt[i] = -q[i]; } else { - for( i = 0; i < 4; i++ ) + for( i = 0; i < 4; i++ ) qt[i] = q[i]; } } diff --git a/public/xash3d_mathlib.h b/public/xash3d_mathlib.h index 34a1e16b..45bed2ee 100644 --- a/public/xash3d_mathlib.h +++ b/public/xash3d_mathlib.h @@ -87,7 +87,7 @@ GNU General Public License for more details. #define ALIGN( x, a ) ((( x ) + (( size_t )( a ) - 1 )) & ~(( size_t )( a ) - 1 )) -#define VectorIsNAN(v) (IS_NAN(v[0]) || IS_NAN(v[1]) || IS_NAN(v[2])) +#define VectorIsNAN(v) (IS_NAN(v[0]) || IS_NAN(v[1]) || IS_NAN(v[2])) #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) #define DotProductAbs(x,y) (abs((x)[0]*(y)[0])+abs((x)[1]*(y)[1])+abs((x)[2]*(y)[2])) #define DotProductFabs(x,y) (fabs((x)[0]*(y)[0])+fabs((x)[1]*(y)[1])+fabs((x)[2]*(y)[2])) diff --git a/ref_gl/gl_alias.c b/ref_gl/gl_alias.c index 89bcf672..dada8092 100644 --- a/ref_gl/gl_alias.c +++ b/ref_gl/gl_alias.c @@ -543,8 +543,8 @@ void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size ) for( j = i; i < 4; i++ ) { - m_pAliasHeader->gl_texturenum[skinnum][i & 3] = m_pAliasHeader->gl_texturenum[skinnum][i - j]; - m_pAliasHeader->fb_texturenum[skinnum][i & 3] = m_pAliasHeader->fb_texturenum[skinnum][i - j]; + m_pAliasHeader->gl_texturenum[skinnum][i & 3] = m_pAliasHeader->gl_texturenum[skinnum][i - j]; + m_pAliasHeader->fb_texturenum[skinnum][i & 3] = m_pAliasHeader->fb_texturenum[skinnum][i - j]; } return pskintype; @@ -818,7 +818,7 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight ) trace = gEngfuncs.CL_TraceLine( vecSrc, vecEnd, PM_STUDIO_IGNORE ); if( trace.ent > 0 ) psurf = gEngfuncs.EV_TraceSurface( trace.ent, vecSrc, vecEnd ); else psurf = gEngfuncs.EV_TraceSurface( 0, vecSrc, vecEnd ); - + if( psurf && FBitSet( psurf->flags, SURF_DRAWSKY )) { VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z ); @@ -982,14 +982,14 @@ void R_AliasLighting( float *lv, const vec3_t normal ) { r += 1.0f; lightcos = (( r - 1.0f ) - lightcos) / r; - if( lightcos > 0.0f ) - illum += g_alias.shadelight * lightcos; + if( lightcos > 0.0f ) + illum += g_alias.shadelight * lightcos; } else { lightcos = (lightcos + ( r - 1.0f )) / r; if( lightcos > 0.0f ) - illum -= g_alias.shadelight * lightcos; + illum -= g_alias.shadelight * lightcos; } illum = Q_max( illum, 0.0f ); @@ -1147,7 +1147,7 @@ void GL_DrawAliasShadow( aliashdr_t *paliashdr ) } while( --count ); pglEnd(); - } + } if( glState.stencilEnabled ) pglDisable( GL_STENCIL_TEST ); diff --git a/ref_gl/gl_backend.c b/ref_gl/gl_backend.c index 297f7ca4..2706c145 100644 --- a/ref_gl/gl_backend.c +++ b/ref_gl/gl_backend.c @@ -94,7 +94,7 @@ void GL_BackendEndFrame( void ) case 1: Q_snprintf( r_speeds_msg, sizeof( r_speeds_msg ), "%3i wpoly, %3i apoly\n%3i epoly, %3i spoly", r_stats.c_world_polys, r_stats.c_alias_polys, r_stats.c_studio_polys, r_stats.c_sprite_polys ); - break; + break; case 2: R_Speeds_Printf( "visible leafs:\n%3i leafs\ncurrent leaf %3i\n", r_stats.c_world_leafs, curleaf - WORLDMODEL->leafs ); R_Speeds_Printf( "ReciusiveWorldNode: %3lf secs\nDrawTextureChains %lf\n", r_stats.t_world_node, r_stats.t_world_draw ); @@ -185,7 +185,7 @@ void GL_SelectTexture( GLint tmu ) if( tmu >= GL_MaxTextureUnits( )) { gEngfuncs.Con_Reportf( S_ERROR "GL_SelectTexture: bad tmu state %i\n", tmu ); - return; + return; } if( glState.activeTMU == tmu ) @@ -280,7 +280,7 @@ void GL_TextureTarget( uint target ) if( glState.activeTMU < 0 || glState.activeTMU >= GL_MaxTextureUnits( )) { gEngfuncs.Con_Reportf( S_ERROR "GL_TextureTarget: bad tmu state %i\n", glState.activeTMU ); - return; + return; } if( glState.currentTextureTargets[glState.activeTMU] != target ) diff --git a/ref_gl/gl_beams.c b/ref_gl/gl_beams.c index c2b8830e..215eb890 100644 --- a/ref_gl/gl_beams.c +++ b/ref_gl/gl_beams.c @@ -46,7 +46,7 @@ static float rgNoise[NOISE_DIVISIONS+1]; // global noise array static void FracNoise( float *noise, int divs ) { int div2; - + div2 = divs >> 1; if( divs < 2 ) return; @@ -197,7 +197,7 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f float flMaxWidth, vLast, vStep, brightness; vec3_t perp1, vLastNormal; beamseg_t curSeg; - + if( segments < 2 ) return; length = VectorLength( delta ); @@ -255,7 +255,7 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f { beamseg_t nextSeg; vec3_t vPoint1, vPoint2; - + Assert( noiseIndex < ( NOISE_DIVISIONS << 16 )); fraction = i * div; @@ -422,7 +422,7 @@ void R_DrawTorus( vec3_t source, vec3_t delta, float width, float scale, float f VectorMA( point, factor, RI.vright, point ); } } - + // Transform point into screen space TriWorldToScreen( point, screen ); @@ -436,7 +436,7 @@ void R_DrawTorus( vec3_t source, vec3_t delta, float width, float scale, float f VectorNormalize( tmp ); VectorScale( RI.vup, -tmp[0], normal ); // Build point along noraml line (normal is -y, x) VectorMA( normal, tmp[1], RI.vright, normal ); - + // Make a wide line VectorMA( point, width, normal, last1 ); VectorMA( point, -width, normal, last2 ); @@ -475,10 +475,10 @@ void R_DrawDisk( vec3_t source, vec3_t delta, float width, float scale, float fr length = VectorLength( delta ) * 0.01f; if( length < 0.5f ) length = 0.5f; // don't lose all of the noise/texture on short beams - + div = 1.0f / (segments - 1); vStep = length * div; // Texture length texels per space pixel - + // scroll speed 3.5 -- initial texture position, scrolls 3.5/sec (1.0 is entire texture) vLast = fmod( freq * speed, 1 ); scale = scale * length; @@ -533,14 +533,14 @@ void R_DrawCylinder( vec3_t source, vec3_t delta, float width, float scale, floa length = VectorLength( delta ) * 0.01f; if( length < 0.5f ) length = 0.5f; // don't lose all of the noise/texture on short beams - + div = 1.0f / (segments - 1); vStep = length * div; // texture length texels per space pixel - + // Scroll speed 3.5 -- initial texture position, scrolls 3.5/sec (1.0 is entire texture) vLast = fmod( freq * speed, 1 ); scale = scale * length; - + for ( i = 0; i < segments; i++ ) { float s, c; @@ -650,7 +650,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime ) // Build point along noraml line (normal is -y, x) VectorScale( RI.vup, tmp[0], normal ); // Build point along normal line (normal is -y, x) VectorMA( normal, tmp[1], RI.vright, normal ); - + // Make a wide line VectorMA( delta, pbeam->width, normal, last1 ); VectorMA( delta, -pbeam->width, normal, last2 ); @@ -684,7 +684,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime ) // Make a wide line VectorMA( particles->org, pbeam->width, normal, last1 ); VectorMA( particles->org, -pbeam->width, normal, last2 ); - + vLast += vStep; // Advance texture scroll (v axis only) if( particles->next != NULL ) @@ -738,13 +738,13 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa VectorClear( screenLast ); segments = segments * M_PI_F; - + if( segments > NOISE_DIVISIONS * 8 ) segments = NOISE_DIVISIONS * 8; length = VectorLength( delta ) * 0.01f * M_PI_F; if( length < 0.5f ) length = 0.5f; // Don't lose all of the noise/texture on short beams - + div = 1.0f / ( segments - 1 ); vStep = length * div / 8.0f; // texture length texels per space pixel @@ -762,7 +762,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa VectorCopy( delta, xaxis ); radius = VectorLength( xaxis ); - + // cull beamring // -------------------------------- // Compute box center +/- radius @@ -779,7 +779,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa return; } - VectorSet( yaxis, xaxis[1], -xaxis[0], 0.0f ); + VectorSet( yaxis, xaxis[1], -xaxis[0], 0.0f ); VectorNormalize( yaxis ); VectorScale( yaxis, radius, yaxis ); @@ -790,7 +790,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa fraction = i * div; SinCos( fraction * M_PI2_F, &x, &y ); - VectorMAMAM( x, xaxis, y, yaxis, 1.0f, center, point ); + VectorMAMAM( x, xaxis, y, yaxis, 1.0f, center, point ); // distort using noise factor = rgNoise[(noiseIndex >> 16) & (NOISE_DIVISIONS - 1)] * scale; @@ -800,7 +800,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa factor = rgNoise[(noiseIndex >> 16) & (NOISE_DIVISIONS - 1)] * scale; factor *= cos( fraction * M_PI_F * 24 + freq ); VectorMA( point, factor, RI.vright, point ); - + // Transform point into screen space TriWorldToScreen( point, screen ); @@ -816,7 +816,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa // Build point along normal line (normal is -y, x) VectorScale( RI.vup, tmp[0], normal ); VectorMA( normal, tmp[1], RI.vright, normal ); - + // Make a wide line VectorMA( point, width, normal, last1 ); VectorMA( point, -width, normal, last2 ); @@ -1263,7 +1263,7 @@ void CL_DrawBeams( int fTrans, BEAM *active_beams ) pglShadeModel( GL_SMOOTH ); pglDepthMask( fTrans ? GL_FALSE : GL_TRUE ); - + // server beams don't allocate beam chains // all params are stored in cl_entity_t for( i = 0; i < tr.draw_list->num_beam_entities; i++ ) diff --git a/ref_gl/gl_decals.c b/ref_gl/gl_decals.c index 93d758d8..2266df1e 100644 --- a/ref_gl/gl_decals.c +++ b/ref_gl/gl_decals.c @@ -33,7 +33,7 @@ GNU General Public License for more details. #define RIGHT_EDGE 1 #define TOP_EDGE 2 #define BOTTOM_EDGE 3 - + // This structure contains the information used to create new decals typedef struct { @@ -72,14 +72,14 @@ static void R_DecalUnlink( decal_t *pdecal ) { pdecal->psurface->pdecals = pdecal->pnext; } - else + else { tmp = pdecal->psurface->pdecals; if( !tmp ) gEngfuncs.Host_Error( "R_DecalUnlink: bad decal list\n" ); - while( tmp->pnext ) + while( tmp->pnext ) { - if( tmp->pnext == pdecal ) + if( tmp->pnext == pdecal ) { tmp->pnext = pdecal->pnext; break; @@ -105,15 +105,15 @@ static decal_t *R_DecalAlloc( decal_t *pdecal ) if( r_decals->value < limit ) limit = r_decals->value; - + if( !limit ) return NULL; - if( !pdecal ) + if( !pdecal ) { int count = 0; // check for the odd possiblity of infinte loop - do + do { if( gDecalCount >= limit ) gDecalCount = 0; @@ -123,11 +123,11 @@ static decal_t *R_DecalAlloc( decal_t *pdecal ) count++; } while( FBitSet( pdecal->flags, FDECAL_PERMANENT ) && count < limit ); } - + // if decal is already linked to a surface, unlink it. R_DecalUnlink( pdecal ); - return pdecal; + return pdecal; } //----------------------------------------------------------------------------- @@ -194,7 +194,7 @@ void R_SetupDecalTextureSpaceBasis( decal_t *pDecal, msurface_t *surf, int textu // OPTIMIZE: Get rid of these divides decalWorldScale[0] = (float)pDecal->scale / width; decalWorldScale[1] = (float)pDecal->scale / height; - + VectorScale( textureSpaceBasis[0], decalWorldScale[0], textureSpaceBasis[0] ); VectorScale( textureSpaceBasis[1], decalWorldScale[1], textureSpaceBasis[1] ); } @@ -275,7 +275,7 @@ void R_ClipIntersect( float *one, float *two, float *out, int edge ) out[3] = out[5] = 0.0f; } else - { + { // right t = ((one[3] - 1.0f) / (one[3] - two[3])); out[3] = out[5] = 1.0f; @@ -293,7 +293,7 @@ void R_ClipIntersect( float *one, float *two, float *out, int edge ) out[4] = out[6] = 0.0f; } else - { + { // bottom t = ((one[4] - 1.0f) / (one[4] - two[4])); out[4] = out[6] = 1.0f; @@ -378,7 +378,7 @@ float *R_DoDecalSHClip( float *pInVerts, decal_t *pDecal, int nStartVerts, int * float *R_DecalVertsClip( decal_t *pDecal, msurface_t *surf, int texture, int *pVertCount ) { float decalWorldScale[2]; - vec3_t textureSpaceBasis[3]; + vec3_t textureSpaceBasis[3]; // figure out where the decal maps onto the surface. R_SetupDecalClip( pDecal, surf, texture, textureSpaceBasis, decalWorldScale ); @@ -433,7 +433,7 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int // (Same as R_SetupDecalClip). texture = decalinfo->m_iTexture; - + // precalculate the extents of decalinfo's decal in world space. R_GetDecalDimensions( texture, &mapSize[0], &mapSize[1] ); VectorScale( decalinfo->m_Basis[0], ((mapSize[0] / decalinfo->m_scale) * 0.5f), decalExtents[0] ); @@ -441,7 +441,7 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int pDecal = surf->pdecals; - while( pDecal ) + while( pDecal ) { texture = pDecal->texture; @@ -472,7 +472,7 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int Vector2Set( vDecalMax, DotProduct( testPosition[0], testBasis[0] ) - pDecal->dx + 0.5f, - DotProduct( testPosition[1], testBasis[1] ) - pDecal->dy + 0.5f ); + DotProduct( testPosition[1], testBasis[1] ) - pDecal->dy + 0.5f ); // Now figure out the part of the projection that intersects pDecal's // clip box [0,0,1,1]. @@ -481,14 +481,14 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int if( vUnionMin[0] < 1 && vUnionMin[1] < 1 && vUnionMax[0] > 0 && vUnionMax[1] > 0 ) { - // Figure out how much of this intersects the (0,0) - (1,1) bbox. + // Figure out how much of this intersects the (0,0) - (1,1) bbox. float flArea = (vUnionMax[0] - vUnionMin[1]) * (vUnionMax[1] - vUnionMin[1]); if( flArea > 0.6f ) { *pcount += 1; - if( !plast || flArea <= lastArea ) + if( !plast || flArea <= lastArea ) { plast = pDecal; lastArea = flArea; @@ -549,9 +549,9 @@ static void R_AddDecalToSurface( decal_t *pdecal, msurface_t *surf, decalinfo_t pdecal->pnext = NULL; pold = surf->pdecals; - if( pold ) + if( pold ) { - while( pold->pnext ) + while( pold->pnext ) pold = pold->pnext; pold->pnext = pdecal; } @@ -578,7 +578,7 @@ static void R_DecalCreate( decalinfo_t *decalinfo, msurface_t *surf, float x, fl int count, vertCount; if( !surf ) return; // ??? - + pold = R_DecalIntersect( decalinfo, surf, &count ); if( count < MAX_OVERLAP_DECALS ) pold = NULL; @@ -600,7 +600,7 @@ static void R_DecalCreate( decalinfo_t *decalinfo, msurface_t *surf, float x, fl // check to see if the decal actually intersects the surface // if not, then remove the decal R_DecalVertsClip( pdecal, surf, decalinfo->m_iTexture, &vertCount ); - + if( !vertCount ) { R_DecalUnlink( pdecal ); @@ -647,9 +647,9 @@ void R_DecalSurface( msurface_t *surf, decalinfo_t *decalinfo ) // Compute an effective width and height (axis aligned) in the parent texture space // How does this work? decalBasis[0] represents the u-direction (width) - // of the decal measured in world space, decalBasis[1] represents the + // of the decal measured in world space, decalBasis[1] represents the // v-direction (height) measured in world space. - // textureVecsTexelsPerWorldUnits[0] represents the u direction of + // textureVecsTexelsPerWorldUnits[0] represents the u direction of // the surface's texture space measured in world space (with the appropriate // scale factor folded in), and textureVecsTexelsPerWorldUnits[1] // represents the texture space v direction. We want to find the dimensions (w,h) @@ -660,7 +660,7 @@ void R_DecalSurface( msurface_t *surf, decalinfo_t *decalinfo ) w = fabs( decalinfo->m_decalWidth * DotProduct( textureU, decalinfo->m_Basis[0] )) + fabs( decalinfo->m_decalHeight * DotProduct( textureU, decalinfo->m_Basis[1] )); - + h = fabs( decalinfo->m_decalWidth * DotProduct( textureV, decalinfo->m_Basis[0] )) + fabs( decalinfo->m_decalHeight * DotProduct( textureV, decalinfo->m_Basis[1] )); @@ -689,7 +689,7 @@ static void R_DecalNodeSurfaces( model_t *model, mnode_t *node, decalinfo_t *dec surf = model->surfaces + node->firstsurface; - for( i = 0; i < node->numsurfaces; i++, surf++ ) + for( i = 0; i < node->numsurfaces; i++, surf++ ) { // never apply decals on the water or sky surfaces if( surf->flags & (SURF_DRAWTURB|SURF_DRAWSKY|SURF_CONVEYOR)) @@ -703,15 +703,15 @@ static void R_DecalNodeSurfaces( model_t *model, mnode_t *node, decalinfo_t *dec } //----------------------------------------------------------------------------- -// Recursive routine to find surface to apply a decal to. World coordinates of -// the decal are passed in r_recalpos like the rest of the engine. This should +// Recursive routine to find surface to apply a decal to. World coordinates of +// the decal are passed in r_recalpos like the rest of the engine. This should // be called through R_DecalShoot() //----------------------------------------------------------------------------- static void R_DecalNode( model_t *model, mnode_t *node, decalinfo_t *decalinfo ) { mplane_t *splitplane; float dist; - + Assert( node != NULL ); if( node->contents < 0 ) @@ -723,13 +723,13 @@ static void R_DecalNode( model_t *model, mnode_t *node, decalinfo_t *decalinfo ) splitplane = node->plane; dist = DotProduct( decalinfo->m_Position, splitplane->normal ) - splitplane->dist; - // This is arbitrarily set to 10 right now. In an ideal world we'd have the - // exact surface but we don't so, this tells me which planes are "sort of - // close" to the gunshot -- the gunshot is actually 4 units in front of the - // wall (see dlls\weapons.cpp). We also need to check to see if the decal + // This is arbitrarily set to 10 right now. In an ideal world we'd have the + // exact surface but we don't so, this tells me which planes are "sort of + // close" to the gunshot -- the gunshot is actually 4 units in front of the + // wall (see dlls\weapons.cpp). We also need to check to see if the decal // actually intersects the texture space of the surface, as this method tags // parallel surfaces in the same node always. - // JAY: This still tags faces that aren't correct at edges because we don't + // JAY: This still tags faces that aren't correct at edges because we don't // have a surface normal if( dist > decalinfo->m_Size ) { @@ -739,7 +739,7 @@ static void R_DecalNode( model_t *model, mnode_t *node, decalinfo_t *decalinfo ) { R_DecalNode( model, node->children[1], decalinfo ); } - else + else { if( dist < DECAL_DISTANCE && dist > -DECAL_DISTANCE ) R_DecalNodeSurfaces( model, node, decalinfo ); @@ -777,7 +777,7 @@ void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos else model = WORLDMODEL; if( !model ) return; - + if( model->type != mod_brush ) { gEngfuncs.Con_Printf( S_ERROR "Decals must hit mod_brush!\n" ); @@ -841,7 +841,7 @@ void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos } // Build the vertex list for a decal on a surface and clip it to the surface. -// This is a template so it can work on world surfaces and dynamic displacement +// This is a template so it can work on world surfaces and dynamic displacement // triangles the same way. float *R_DecalSetupVerts( decal_t *pDecal, msurface_t *surf, int texture, int *outCount ) { @@ -902,7 +902,7 @@ void DrawSingleDecal( decal_t *pDecal, msurface_t *fa ) } void DrawSurfaceDecals( msurface_t *fa, qboolean single, qboolean reverse ) -{ +{ decal_t *p; cl_entity_t *e; @@ -1039,7 +1039,7 @@ void DrawSurfaceDecals( msurface_t *fa, qboolean single, qboolean reverse ) } void DrawDecalsBatch( void ) -{ +{ cl_entity_t *e; int i; @@ -1110,9 +1110,9 @@ static qboolean R_DecalUnProject( decal_t *pdecal, decallist_t *entry ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : *pList - -// count - +// Purpose: +// Input : *pList - +// count - // Output : static int //----------------------------------------------------------------------------- static int DecalListAdd( decallist_t *pList, int count ) @@ -1155,7 +1155,7 @@ static int DecalDepthCompare( const void *a, const void *b ) //----------------------------------------------------------------------------- // Purpose: Called by CSaveRestore::SaveClientState -// Input : *pList - +// Input : *pList - // Output : int //----------------------------------------------------------------------------- int R_CreateDecalList( decallist_t *pList ) @@ -1169,7 +1169,7 @@ int R_CreateDecalList( decallist_t *pList ) { decal_t *decal = &gDecalPool[i]; decal_t *pdecals; - + // decal is in use and is not a custom decal if( decal->psurface == NULL || FBitSet( decal->flags, FDECAL_DONTSAVE )) continue; @@ -1187,7 +1187,7 @@ int R_CreateDecalList( decallist_t *pList ) pList[total].depth = depth; pList[total].flags = decal->flags; pList[total].scale = decal->scale; - + R_DecalUnProject( decal, &pList[total] ); COM_FileBase( R_GetTexture( decal->texture )->name, pList[total].name ); @@ -1264,7 +1264,7 @@ void R_EntityRemoveDecals( model_t *mod ) R_ClearAllDecals remove all decals from anything -used for full decals restart +used for full decals restart =============== */ void R_ClearAllDecals( void ) diff --git a/ref_gl/gl_draw.c b/ref_gl/gl_draw.c index d2494343..ad383f35 100644 --- a/ref_gl/gl_draw.c +++ b/ref_gl/gl_draw.c @@ -127,7 +127,7 @@ void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, c if( !GL_Support( GL_ARB_TEXTURE_NPOT_EXT )) { int width = 1, height = 1; - + // check the dimensions width = NearestPOW( cols, true ); height = NearestPOW( rows, false ); diff --git a/ref_gl/gl_export.h b/ref_gl/gl_export.h index 20817fa3..491cc908 100644 --- a/ref_gl/gl_export.h +++ b/ref_gl/gl_export.h @@ -396,7 +396,7 @@ typedef float GLmatrix[16]; #define GL_DEPTH_COMPONENT32F 0x8CAC #define GL_DEPTH32F_STENCIL8 0x8CAD #define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD - + #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 diff --git a/ref_gl/gl_frustum.c b/ref_gl/gl_frustum.c index 786d1b12..92e995f0 100644 --- a/ref_gl/gl_frustum.c +++ b/ref_gl/gl_frustum.c @@ -71,17 +71,17 @@ void GL_FrustumInitProj( gl_frustum_t *out, float flZNear, float flZFar, float f { float xs, xc; vec3_t farpoint, nearpoint; - vec3_t normal, iforward; + vec3_t normal, iforward; // horizontal fov used for left and right planes SinCos( DEG2RAD( flFovX ) * 0.5f, &xs, &xc ); // setup left plane - VectorMAM( xs, RI.cull_vforward, -xc, RI.cull_vright, normal ); + VectorMAM( xs, RI.cull_vforward, -xc, RI.cull_vright, normal ); GL_FrustumSetPlane( out, FRUSTUM_LEFT, normal, DotProduct( RI.cullorigin, normal )); // setup right plane - VectorMAM( xs, RI.cull_vforward, xc, RI.cull_vright, normal ); + VectorMAM( xs, RI.cull_vforward, xc, RI.cull_vright, normal ); GL_FrustumSetPlane( out, FRUSTUM_RIGHT, normal, DotProduct( RI.cullorigin, normal )); // vertical fov used for top and bottom planes @@ -89,11 +89,11 @@ void GL_FrustumInitProj( gl_frustum_t *out, float flZNear, float flZFar, float f VectorNegate( RI.cull_vforward, iforward ); // setup bottom plane - VectorMAM( xs, RI.cull_vforward, -xc, RI.cull_vup, normal ); + VectorMAM( xs, RI.cull_vforward, -xc, RI.cull_vup, normal ); GL_FrustumSetPlane( out, FRUSTUM_BOTTOM, normal, DotProduct( RI.cullorigin, normal )); // setup top plane - VectorMAM( xs, RI.cull_vforward, xc, RI.cull_vup, normal ); + VectorMAM( xs, RI.cull_vforward, xc, RI.cull_vup, normal ); GL_FrustumSetPlane( out, FRUSTUM_TOP, normal, DotProduct( RI.cullorigin, normal )); // setup far plane diff --git a/ref_gl/gl_frustum.h b/ref_gl/gl_frustum.h index f48793b5..0b310a80 100644 --- a/ref_gl/gl_frustum.h +++ b/ref_gl/gl_frustum.h @@ -48,5 +48,5 @@ qboolean GL_FrustumCullSphere( gl_frustum_t *out, const vec3_t centre, float rad // plane manipulating void GL_FrustumEnablePlane( gl_frustum_t *out, int side ); void GL_FrustumDisablePlane( gl_frustum_t *out, int side ); - + #endif//GL_FRUSTUM_H diff --git a/ref_gl/gl_local.h b/ref_gl/gl_local.h index 7f80268a..38145dd7 100644 --- a/ref_gl/gl_local.h +++ b/ref_gl/gl_local.h @@ -132,7 +132,7 @@ typedef struct qboolean drawWorld; // ignore world for drawing PlayerModel qboolean isSkyVisible; // sky is visible qboolean onlyClientDraw; // disabled by client request - qboolean drawOrtho; // draw world as orthogonal projection + qboolean drawOrtho; // draw world as orthogonal projection float fov_x, fov_y; // current view fov diff --git a/ref_gl/gl_opengl.c b/ref_gl/gl_opengl.c index 5843aa19..11d0123b 100644 --- a/ref_gl/gl_opengl.c +++ b/ref_gl/gl_opengl.c @@ -649,7 +649,7 @@ void GL_InitExtensionsBigGL( void ) const char *version = pglGetString( GL_VERSION | 0x10000 ); const char *extensions = pglGetString( GL_EXTENSIONS | 0x10000 ); glConfig.wrapper = GLES_WRAPPER_GL4ES; - + } // multitexture diff --git a/ref_gl/gl_rlight.c b/ref_gl/gl_rlight.c index 9a8b37e6..c0c0c5fc 100644 --- a/ref_gl/gl_rlight.c +++ b/ref_gl/gl_rlight.c @@ -103,7 +103,7 @@ void R_MarkLights( dlight_t *light, int bit, mnode_t *node ) float dist; msurface_t *surf; int i; - + if( !node || node->contents < 0 ) return; @@ -119,7 +119,7 @@ void R_MarkLights( dlight_t *light, int bit, mnode_t *node ) R_MarkLights( light, bit, node->children[1] ); return; } - + // mark the polygons surf = RI.currentmodel->surfaces + node->firstsurface; @@ -261,7 +261,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, VectorLerp( start, frac, end, mid ); midf = p1f + ( p2f - p1f ) * frac; - // co down front side + // co down front side if( R_RecursiveLightPoint( model, node->children[side], p1f, midf, cv, start, mid )) return true; // hit something @@ -293,7 +293,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, ds = s - info->lightmapmins[0]; dt = t - info->lightmapmins[1]; - + if ( ds > info->lightextents[0] || dt > info->lightextents[1] ) continue; diff --git a/ref_gl/gl_rmain.c b/ref_gl/gl_rmain.c index cc0d953e..664bbcc0 100644 --- a/ref_gl/gl_rmain.c +++ b/ref_gl/gl_rmain.c @@ -594,7 +594,7 @@ static gl_texture_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mno gl_texture_t *tex = NULL; // assure the initial node is not null - // we could check it here, but we would rather check it + // we could check it here, but we would rather check it // outside the call to get rid of one additional recursion level Assert( node != NULL ); @@ -615,7 +615,7 @@ static gl_texture_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mno // find texture pleaf = (mleaf_t *)node; mark = pleaf->firstmarksurface; - c = pleaf->nummarksurfaces; + c = pleaf->nummarksurfaces; for( i = 0; i < c; i++, mark++ ) { @@ -724,7 +724,7 @@ static void R_CheckFog( void ) if( ent && ent->model && ent->model->type == mod_brush ) { msurface_t *surf; - + count = ent->model->nummodelsurfaces; for( i = 0, surf = &ent->model->surfaces[ent->model->firstmodelsurface]; i < count; i++, surf++ ) @@ -890,7 +890,7 @@ void R_DrawEntitiesOnList( void ) else tr.blend = 1.0f; // draw as solid but sorted by distance if( tr.blend <= 0.0f ) continue; - + Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL ); @@ -971,7 +971,7 @@ void R_RenderScene( void ) R_MarkLeaves(); R_DrawFog (); - R_CheckGLFog(); + R_CheckGLFog(); R_DrawWorld(); R_CheckFog(); diff --git a/ref_gl/gl_rmisc.c b/ref_gl/gl_rmisc.c index 0514206e..f687d15e 100644 --- a/ref_gl/gl_rmisc.c +++ b/ref_gl/gl_rmisc.c @@ -70,7 +70,7 @@ static void R_ParseDetailTextures( const char *filename ) Q_snprintf( detail_path, sizeof( detail_path ), "gfx/%s", detail_texname ); // read scales - xScale = Q_atof( token ); + xScale = Q_atof( token ); pfile = gEngfuncs.COM_ParseFile( pfile, token ); yScale = Q_atof( token ); @@ -142,7 +142,7 @@ void R_NewMap( void ) sf->fadeReset = title->fadeout; } else sf->fadeEnd = sf->fadeReset = fadetime; - + sf->fadeFlags = FFADE_IN; sf->fader = sf->fadeg = sf->fadeb = 0; sf->fadealpha = 255; diff --git a/ref_gl/gl_rpart.c b/ref_gl/gl_rpart.c index 9ecf71a7..fb4f6cac 100644 --- a/ref_gl/gl_rpart.c +++ b/ref_gl/gl_rpart.c @@ -139,7 +139,7 @@ static qboolean CL_CullTracer( particle_t *p, const vec3_t start, const vec3_t e mins[i] = end[i]; maxs[i] = start[i]; } - + // don't let it be zero sized if( mins[i] == maxs[i] ) { @@ -225,10 +225,10 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers ) VectorSubtract( normal, tmp2, normal ); // compute four vertexes - VectorSubtract( start, normal, verts[0] ); - VectorAdd( start, normal, verts[1] ); - VectorAdd( verts[0], delta, verts[2] ); - VectorAdd( verts[1], delta, verts[3] ); + VectorSubtract( start, normal, verts[0] ); + VectorAdd( start, normal, verts[1] ); + VectorAdd( verts[0], delta, verts[2] ); + VectorAdd( verts[1], delta, verts[3] ); if( p->color > sizeof( gTracerColors ) / sizeof( color24 ) ) { diff --git a/ref_gl/gl_rsurf.c b/ref_gl/gl_rsurf.c index 5b081af5..b1d01499 100644 --- a/ref_gl/gl_rsurf.c +++ b/ref_gl/gl_rsurf.c @@ -16,7 +16,7 @@ GNU General Public License for more details. #include "gl_local.h" #include "xash3d_mathlib.h" #include "mod_local.h" - + typedef struct { int allocated[BLOCK_SIZE_MAX]; @@ -149,7 +149,7 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts } if( numverts != 4 ) - ClearBits( warpface->flags, SURF_DRAWTURB_QUADS ); + ClearBits( warpface->flags, SURF_DRAWTURB_QUADS ); // add a point in the center to help keep warp valid poly = Mem_Calloc( loadmodel->mempool, sizeof( glpoly_t ) + (numverts - 4) * VERTEXSIZE * sizeof( float )); @@ -171,8 +171,8 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts { s = DotProduct( verts, warpface->texinfo->vecs[0] ) + warpface->texinfo->vecs[0][3]; t = DotProduct( verts, warpface->texinfo->vecs[1] ) + warpface->texinfo->vecs[1][3]; - s /= warpface->texinfo->texture->width; - t /= warpface->texinfo->texture->height; + s /= warpface->texinfo->texture->width; + t /= warpface->texinfo->texture->height; } poly->verts[i][3] = s; @@ -461,7 +461,7 @@ texture_t *R_TextureAnimation( msurface_t *s ) if( base->alternate_anims ) base = base->alternate_anims; } - + if( !base->anim_total ) return base; @@ -637,7 +637,7 @@ static int LM_AllocBlock( int w, int h, int *x, int *y ) } if( j == w ) - { + { // this is a valid spot *x = i; *y = best = best2; @@ -811,7 +811,7 @@ void DrawGLPoly( glpoly_t *p, float xScale, float yScale ) SinCos( flAngle * ( M_PI_F / 180.0f ), &sy, &cy ); sOffset = gpGlobals->time * cy * flRate; tOffset = gpGlobals->time * sy * flRate; - + // make sure that we are positive if( sOffset < 0.0f ) sOffset += 1.0f + -(int)sOffset; if( tOffset < 0.0f ) tOffset += 1.0f + -(int)tOffset; @@ -981,7 +981,7 @@ void R_BlendLightmaps( void ) if( drawsurf->polys ) { DrawGLPolyChain( drawsurf->polys, - ( drawsurf->light_s - drawsurf->info->dlight_s ) * ( 1.0f / (float)BLOCK_SIZE ), + ( drawsurf->light_s - drawsurf->info->dlight_s ) * ( 1.0f / (float)BLOCK_SIZE ), ( drawsurf->light_t - drawsurf->info->dlight_t ) * ( 1.0f / (float)BLOCK_SIZE )); } } @@ -1106,7 +1106,7 @@ void R_RenderDetails( void ) } detail_surfaces[i] = NULL; - es->detailchain = NULL; + es->detailchain = NULL; } pglDisable( GL_BLEND ); @@ -1140,7 +1140,7 @@ void R_RenderBrushPoly( msurface_t *fa, int cull_type ) GL_Bind( XASH_TEXTURE0, t->gl_texturenum ); if( FBitSet( fa->flags, SURF_DRAWTURB )) - { + { // warp texture, no lightmaps EmitWaterPolys( fa, (cull_type == CULL_BACKSIDE)); return; @@ -1417,7 +1417,7 @@ void R_DrawWaterSurfaces( void ) for( ; s; s = s->texturechain ) EmitWaterPolys( s, false ); - + t->texturechain = NULL; } @@ -3103,7 +3103,7 @@ loc0: skychain = surf; } else if( !R_AddSurfToVBO( surf, true ) ) - { + { surf->texturechain = surf->texinfo->texture->texturechain; surf->texinfo->texture->texturechain = surf; } @@ -3161,7 +3161,7 @@ static void R_DrawTopViewLeaf( mleaf_t *pleaf, uint clipflags ) continue; if(!( surf->flags & SURF_DRAWSKY )) - { + { surf->texturechain = surf->texinfo->texture->texturechain; surf->texinfo->texture->texturechain = surf; } @@ -3231,7 +3231,7 @@ void R_DrawWorldTopView( mnode_t *node, uint clipflags ) continue; if(!( surf->flags & SURF_DRAWSKY )) - { + { surf->texturechain = surf->texinfo->texture->texturechain; surf->texinfo->texture->texturechain = surf; } @@ -3255,7 +3255,7 @@ void R_DrawTriangleOutlines( void ) msurface_t *surf; glpoly_t *p; float *v; - + if( !gl_wireframe->value ) return; @@ -3516,7 +3516,7 @@ void GL_RebuildLightmaps( void ) // setup all the lightstyles CL_RunLightStyles(); - LM_InitBlock(); + LM_InitBlock(); for( i = 0; i < ENGINE_GET_PARM( PARM_NUMMODELS ); i++ ) { @@ -3565,7 +3565,7 @@ void GL_BuildLightmaps( void ) if( FBitSet( ENGINE_GET_PARM( PARM_FEATURES ), ENGINE_LARGE_LIGHTMAPS )) tr.block_size = BLOCK_SIZE_MAX; else tr.block_size = BLOCK_SIZE_DEFAULT; - + skychain = NULL; tr.framecount = tr.visframecount = 1; // no dlight cache @@ -3580,7 +3580,7 @@ void GL_BuildLightmaps( void ) // setup all the lightstyles CL_RunLightStyles(); - LM_InitBlock(); + LM_InitBlock(); for( i = 0; i < ENGINE_GET_PARM( PARM_NUMMODELS ); i++ ) { diff --git a/ref_gl/gl_studio.c b/ref_gl/gl_studio.c index 81c78bf9..8029e930 100644 --- a/ref_gl/gl_studio.c +++ b/ref_gl/gl_studio.c @@ -38,7 +38,7 @@ cvar_t *r_glowshellfreq; cvar_t r_shadows = { "r_shadows", "0", 0 }; -static vec3_t hullcolor[8] = +static vec3_t hullcolor[8] = { { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.5f, 0.5f }, @@ -123,7 +123,7 @@ typedef struct uint numelems; } studio_draw_state_t; -// studio-related cvars +// studio-related cvars static cvar_t *r_studio_sort_textures; static cvar_t *r_drawviewmodel; cvar_t *cl_righthand = NULL; @@ -642,16 +642,16 @@ float R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqdesc ) if( pseqdesc->numframes <= 1 ) f = 0.0; else f = (e->curstate.frame * (pseqdesc->numframes - 1)) / 256.0f; - + f += dfdt; - if( pseqdesc->flags & STUDIO_LOOPING ) + if( pseqdesc->flags & STUDIO_LOOPING ) { if( pseqdesc->numframes > 1 ) f -= (int)(f / (pseqdesc->numframes - 1)) * (pseqdesc->numframes - 1); if( f < 0 ) f += (pseqdesc->numframes - 1); } - else + else { if( f >= pseqdesc->numframes - 1.001 ) f = pseqdesc->numframes - 1.001; @@ -761,7 +761,7 @@ StudioCalcBoneAdj void R_StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen ) { mstudiobonecontroller_t *pbonecontroller; - float value = 0.0f; + float value = 0.0f; int i, j; pbonecontroller = (mstudiobonecontroller_t *)((byte *)m_pStudioHeader + m_pStudioHeader->bonecontrollerindex); @@ -774,7 +774,7 @@ void R_StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, cons { // mouth hardcoded at controller 4 value = (float)mouthopen / 64.0f; - value = bound( 0.0f, value, 1.0f ); + value = bound( 0.0f, value, 1.0f ); value = (1.0f - value) * pbonecontroller[j].start + value * pbonecontroller[j].end; } else if( i < 4 ) @@ -788,12 +788,12 @@ void R_StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, cons int b = (pcontroller2[i] + 128) % 256; value = (( a * dadt ) + ( b * ( 1.0f - dadt )) - 128) * (360.0f / 256.0f) + pbonecontroller[j].start; } - else + else { value = ((pcontroller1[i] * dadt + (pcontroller2[i]) * (1.0f - dadt))) * (360.0f / 256.0f) + pbonecontroller[j].start; } } - else + else { value = (pcontroller1[i] * dadt + pcontroller2[i] * (1.0f - dadt)) / 255.0f; value = bound( 0.0f, value, 1.0f ); @@ -853,7 +853,7 @@ void R_StudioCalcRotations( cl_entity_t *e, float pos[][3], vec4_t *q, mstudiose R_StudioCalcBoneAdj( dadt, adj, e->curstate.controller, e->latched.prevcontroller, e->mouth.mouthopen ); - for( i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++ ) + for( i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++ ) { gEngfuncs.R_StudioCalcBoneQuaternion( frame, s, pbone, panim, adj, q[i] ); gEngfuncs.R_StudioCalcBonePosition( frame, s, pbone, panim, adj, pos[i] ); @@ -892,7 +892,7 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel ) R_StudioCalcRotations( e, pos, q, pseqdesc, panim, f ); pbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex); - for( i = 0; i < m_pStudioHeader->numbones; i++ ) + for( i = 0; i < m_pStudioHeader->numbones; i++ ) { for( j = 0; j < g_studio.cached_numbones; j++ ) { @@ -907,15 +907,15 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel ) if( j >= g_studio.cached_numbones ) { Matrix3x4_FromOriginQuat( bonematrix, q[i], pos[i] ); - if( pbones[i].parent == -1 ) + if( pbones[i].parent == -1 ) { Matrix3x4_ConcatTransforms( g_studio.bonestransform[i], g_studio.rotationmatrix, bonematrix ); Matrix3x4_Copy( g_studio.lighttransform[i], g_studio.bonestransform[i] ); // apply client-side effects to the transformation matrix R_StudioFxTransform( e, g_studio.bonestransform[i] ); - } - else + } + else { Matrix3x4_ConcatTransforms( g_studio.bonestransform[i], g_studio.bonestransform[pbones[i].parent], bonematrix ); Matrix3x4_ConcatTransforms( g_studio.lighttransform[i], g_studio.lighttransform[pbones[i].parent], bonematrix ); @@ -1039,7 +1039,7 @@ void R_StudioSetupBones( cl_entity_t *e ) { qboolean copy_bones = true; - if( m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq ) + if( m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq ) m_pPlayerInfo->gaitsequence = 0; pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pPlayerInfo->gaitsequence; @@ -1061,18 +1061,18 @@ void R_StudioSetupBones( cl_entity_t *e ) } } - for( i = 0; i < m_pStudioHeader->numbones; i++ ) + for( i = 0; i < m_pStudioHeader->numbones; i++ ) { Matrix3x4_FromOriginQuat( bonematrix, q[i], pos[i] ); - if( pbones[i].parent == -1 ) + if( pbones[i].parent == -1 ) { Matrix3x4_ConcatTransforms( g_studio.bonestransform[i], g_studio.rotationmatrix, bonematrix ); Matrix3x4_Copy( g_studio.lighttransform[i], g_studio.bonestransform[i] ); // apply client-side effects to the transformation matrix R_StudioFxTransform( e, g_studio.bonestransform[i] ); - } + } else { Matrix3x4_ConcatTransforms( g_studio.bonestransform[i], g_studio.bonestransform[pbones[i].parent], bonematrix ); @@ -1095,7 +1095,7 @@ static void R_StudioSaveBones( void ) pbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex); g_studio.cached_numbones = m_pStudioHeader->numbones; - for( i = 0; i < m_pStudioHeader->numbones; i++ ) + for( i = 0; i < m_pStudioHeader->numbones; i++ ) { Matrix3x4_Copy( g_studio.cached_bonestransform[i], g_studio.bonestransform[i] ); Matrix3x4_Copy( g_studio.cached_lighttransform[i], g_studio.lighttransform[i] ); @@ -1125,7 +1125,7 @@ void R_StudioBuildNormalTable( void ) for( i = 0; i < m_pSubModel->numverts; i++ ) g_studio.normaltable[i] = -1; - for( j = 0; j < m_pSubModel->nummesh; j++ ) + for( j = 0; j < m_pSubModel->nummesh; j++ ) { short *ptricmds; @@ -1173,7 +1173,7 @@ void R_StudioGenerateNormals( void ) for( i = 0; i < m_pSubModel->numverts; i++ ) VectorClear( g_studio.norms[i] ); - for( j = 0; j < m_pSubModel->nummesh; j++ ) + for( j = 0; j < m_pSubModel->nummesh; j++ ) { short *ptricmds; @@ -1668,8 +1668,8 @@ void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal ) if( FBitSet( flags, STUDIO_NF_FLATSHADE )) { illum += g_studio.shadelight * 0.8f; - } - else + } + else { float r, lightcos; @@ -1686,14 +1686,14 @@ void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal ) { r += 1.0f; lightcos = (( r - 1.0f ) - lightcos) / r; - if( lightcos > 0.0f ) - illum += g_studio.shadelight * lightcos; + if( lightcos > 0.0f ) + illum += g_studio.shadelight * lightcos; } else { lightcos = (lightcos + ( r - 1.0f )) / r; if( lightcos > 0.0f ) - illum -= g_studio.shadelight * lightcos; + illum -= g_studio.shadelight * lightcos; } illum = Q_max( illum, 0.0f ); @@ -2299,7 +2299,7 @@ static void R_StudioDrawPoints( void ) g_studio.numverts = g_studio.numelems = 0; // safety bounding the skinnum - m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 )); + m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 )); ptexture = (mstudiotexture_t *)((byte *)m_pStudioHeader + m_pStudioHeader->textureindex); pvertbone = ((byte *)m_pStudioHeader + m_pSubModel->vertinfoindex); pnormbone = ((byte *)m_pStudioHeader + m_pSubModel->norminfoindex); @@ -2348,7 +2348,7 @@ static void R_StudioDrawPoints( void ) R_StudioGenerateNormals(); } - for( j = k = 0; j < m_pSubModel->nummesh; j++ ) + for( j = k = 0; j < m_pSubModel->nummesh; j++ ) { g_nFaceFlags = ptexture[pskinref[pmesh[j].skinref]].flags | g_nForceFaceFlags; @@ -2392,7 +2392,7 @@ static void R_StudioDrawPoints( void ) // NOTE: rewind normals at start pstudionorms = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->normindex); - for( j = 0; j < m_pSubModel->nummesh; j++ ) + for( j = 0; j < m_pSubModel->nummesh; j++ ) { float oldblend = tr.blend; uint startArrayVerts = g_studio.numverts; @@ -2580,12 +2580,12 @@ static void R_StudioDrawBones( void ) pglPointSize( 3.0f ); pglColor3f( 1, 0.7f, 0 ); pglBegin( GL_LINES ); - + Matrix3x4_OriginFromMatrix( g_studio.bonestransform[pbones[i].parent], point ); pglVertex3fv( point ); Matrix3x4_OriginFromMatrix( g_studio.bonestransform[i], point ); pglVertex3fv( point ); - + pglEnd(); pglColor3f( 0, 0, 0.8f ); @@ -2618,21 +2618,21 @@ static void R_StudioDrawBones( void ) static void R_StudioDrawAttachments( void ) { int i; - + pglDisable( GL_TEXTURE_2D ); pglDisable( GL_DEPTH_TEST ); - + for( i = 0; i < m_pStudioHeader->numattachments; i++ ) { mstudioattachment_t *pattachments; vec3_t v[4]; - pattachments = (mstudioattachment_t *)((byte *)m_pStudioHeader + m_pStudioHeader->attachmentindex); + pattachments = (mstudioattachment_t *)((byte *)m_pStudioHeader + m_pStudioHeader->attachmentindex); Matrix3x4_VectorTransform( g_studio.bonestransform[pattachments[i].bone], pattachments[i].org, v[0] ); Matrix3x4_VectorTransform( g_studio.bonestransform[pattachments[i].bone], pattachments[i].vectors[0], v[1] ); Matrix3x4_VectorTransform( g_studio.bonestransform[pattachments[i].bone], pattachments[i].vectors[1], v[2] ); Matrix3x4_VectorTransform( g_studio.bonestransform[pattachments[i].bone], pattachments[i].vectors[2], v[3] ); - + pglBegin( GL_LINES ); pglColor3f( 1, 0, 0 ); pglVertex3fv( v[0] ); @@ -3010,7 +3010,7 @@ static void R_StudioDrawPointsShadow( void ) pglVertex3fv( point ); } - pglEnd(); + pglEnd(); } } @@ -3052,7 +3052,7 @@ void GL_StudioSetRenderMode( int rendermode ) break; } } - + /* =============== GL_StudioDrawShadow @@ -3098,7 +3098,7 @@ void R_StudioRenderFinal( void ) rendermode = R_StudioGetForceFaceFlags() ? kRenderTransAdd : RI.currententity->curstate.rendermode; R_StudioSetupRenderer( rendermode ); - + if( r_drawentities->value == 2 ) { R_StudioDrawBones(); @@ -3269,7 +3269,7 @@ void R_StudioProcessGait( entity_state_t *pplayer ) int iBlend; float dt, flYaw; // view direction relative to movement - if( RI.currententity->curstate.sequence >= m_pStudioHeader->numseq ) + if( RI.currententity->curstate.sequence >= m_pStudioHeader->numseq ) RI.currententity->curstate.sequence = 0; dt = bound( 0.0f, g_studio.frametime, 1.0f ); @@ -3317,7 +3317,7 @@ void R_StudioProcessGait( entity_state_t *pplayer ) if( RI.currententity->angles[YAW] < -0 ) RI.currententity->angles[YAW] += 360.0f; RI.currententity->latched.prevangles[YAW] = RI.currententity->angles[YAW]; - if( pplayer->gaitsequence >= m_pStudioHeader->numseq ) + if( pplayer->gaitsequence >= m_pStudioHeader->numseq ) pplayer->gaitsequence = 0; pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + pplayer->gaitsequence; @@ -3361,7 +3361,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer ) m_pPlayerInfo = pfnPlayerInfo( m_nPlayerIndex ); VectorCopy( RI.currententity->angles, orig_angles ); - + R_StudioProcessGait( pplayer ); m_pPlayerInfo->gaitsequence = pplayer->gaitsequence; @@ -3380,7 +3380,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer ) RI.currententity->latched.prevcontroller[1] = RI.currententity->curstate.controller[1]; RI.currententity->latched.prevcontroller[2] = RI.currententity->curstate.controller[2]; RI.currententity->latched.prevcontroller[3] = RI.currententity->curstate.controller[3]; - + m_pPlayerInfo = pfnPlayerInfo( m_nPlayerIndex ); m_pPlayerInfo->gaitsequence = 0; @@ -3756,7 +3756,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture int flags = 0; char texname[128], name[128], mdlname[128]; texture_t *tx = NULL; - + if( ptexture->flags & STUDIO_NF_NORMALMAP ) flags |= (TF_NORMALMAP); @@ -3780,17 +3780,17 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture tx->anim_min = PLATE_HUE_START; // topcolor start tx->anim_max = PLATE_HUE_END; // topcolor end // bottomcolor start always equal is (topcolor end + 1) - tx->anim_total = SUIT_HUE_END;// bottomcolor end + tx->anim_total = SUIT_HUE_END;// bottomcolor end } else { Q_strncpy( tx->name, "DM_User", sizeof( tx->name )); // custom remapped - Q_strncpy( val, ptexture->name + 7, 4 ); + Q_strncpy( val, ptexture->name + 7, 4 ); tx->anim_min = bound( 0, Q_atoi( val ), 255 ); // topcolor start - Q_strncpy( val, ptexture->name + 11, 4 ); + Q_strncpy( val, ptexture->name + 11, 4 ); tx->anim_max = bound( 0, Q_atoi( val ), 255 ); // topcolor end // bottomcolor start always equal is (topcolor end + 1) - Q_strncpy( val, ptexture->name + 15, 4 ); + Q_strncpy( val, ptexture->name + 15, 4 ); tx->anim_total = bound( 0, Q_atoi( val ), 255 ); // bottomcolor end } @@ -3832,7 +3832,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture } else if( tx ) { - // duplicate texnum for easy acess + // duplicate texnum for easy acess tx->gl_texturenum = ptexture->index; } } diff --git a/ref_gl/gl_warp.c b/ref_gl/gl_warp.c index ecfbebfe..32359d89 100644 --- a/ref_gl/gl_warp.c +++ b/ref_gl/gl_warp.c @@ -70,9 +70,9 @@ static int CheckSkybox( const char *name ) int i, j, num_checked_sides; const char *sidename; - // search for skybox images + // search for skybox images for( i = 0; i < 3; i++ ) - { + { num_checked_sides = 0; for( j = 0; j < 6; j++ ) { @@ -164,7 +164,7 @@ void ClipSkyPolygon( int nump, vec3_t vecs, int stage ) gEngfuncs.Host_Error( "ClipSkyPolygon: MAX_CLIP_VERTS\n" ); loc1: if( stage == 6 ) - { + { // fully clipped, so draw it DrawSkyPolygon( nump, vecs ); return; @@ -193,7 +193,7 @@ loc1: } if( !front || !back ) - { + { // not clipped stage++; goto loc1; @@ -435,7 +435,7 @@ void R_SetupSky( const char *skyboxname ) { gEngfuncs.Con_Reportf( S_WARN "missed or incomplete skybox '%s'\n", skyboxname ); R_SetupSky( "desert" ); // force to default - return; + return; } // release old skybox diff --git a/ref_soft/adivtab.h b/ref_soft/adivtab.h index aad0c562..9b7be2ce 100644 --- a/ref_soft/adivtab.h +++ b/ref_soft/adivtab.h @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/ref_soft/r_aclip.c b/ref_soft/r_aclip.c index c1f19611..93e2d8e0 100644 --- a/ref_soft/r_aclip.c +++ b/ref_soft/r_aclip.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -188,7 +188,7 @@ int R_AliasClip (finalvert_t *in, finalvert_t *out, int flag, int count, { int i,j,k; int flags, oldflags; - + j = count-1; k = 0; for (i=0 ; i RI.aliasvrectright) out[k].flags |= ALIAS_RIGHT_CLIP; if (out[k].v > RI.aliasvrectbottom) - out[k].flags |= ALIAS_BOTTOM_CLIP; + out[k].flags |= ALIAS_BOTTOM_CLIP; k++; } if (!flags) @@ -218,7 +218,7 @@ int R_AliasClip (finalvert_t *in, finalvert_t *out, int flag, int count, k++; } } - + return k; } diff --git a/ref_soft/r_beams.c b/ref_soft/r_beams.c index 4accd721..0e69868d 100644 --- a/ref_soft/r_beams.c +++ b/ref_soft/r_beams.c @@ -47,7 +47,7 @@ static float rgNoise[NOISE_DIVISIONS+1]; // global noise array static void FracNoise( float *noise, int divs ) { int div2; - + div2 = divs >> 1; if( divs < 2 ) return; @@ -200,7 +200,7 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f float flMaxWidth, vLast, vStep, brightness; vec3_t perp1, vLastNormal = { 0.0f }; beamseg_t curSeg; - + if( segments < 2 ) return; length = VectorLength( delta ); @@ -258,7 +258,7 @@ static void R_DrawSegs( vec3_t source, vec3_t delta, float width, float scale, f { beamseg_t nextSeg; vec3_t vPoint1, vPoint2; - + Assert( noiseIndex < ( NOISE_DIVISIONS << 16 )); fraction = i * div; @@ -425,7 +425,7 @@ void R_DrawTorus( vec3_t source, vec3_t delta, float width, float scale, float f VectorMA( point, factor, RI.vright, point ); } } - + // Transform point into screen space TriWorldToScreen( point, screen ); @@ -439,7 +439,7 @@ void R_DrawTorus( vec3_t source, vec3_t delta, float width, float scale, float f VectorNormalize( tmp ); VectorScale( RI.vup, -tmp[0], normal ); // Build point along noraml line (normal is -y, x) VectorMA( normal, tmp[1], RI.vright, normal ); - + // Make a wide line VectorMA( point, width, normal, last1 ); VectorMA( point, -width, normal, last2 ); @@ -478,10 +478,10 @@ void R_DrawDisk( vec3_t source, vec3_t delta, float width, float scale, float fr length = VectorLength( delta ) * 0.01f; if( length < 0.5f ) length = 0.5f; // don't lose all of the noise/texture on short beams - + div = 1.0f / (segments - 1); vStep = length * div; // Texture length texels per space pixel - + // scroll speed 3.5 -- initial texture position, scrolls 3.5/sec (1.0 is entire texture) vLast = fmod( freq * speed, 1 ); scale = scale * length; @@ -536,14 +536,14 @@ void R_DrawCylinder( vec3_t source, vec3_t delta, float width, float scale, floa length = VectorLength( delta ) * 0.01f; if( length < 0.5f ) length = 0.5f; // don't lose all of the noise/texture on short beams - + div = 1.0f / (segments - 1); vStep = length * div; // texture length texels per space pixel - + // Scroll speed 3.5 -- initial texture position, scrolls 3.5/sec (1.0 is entire texture) vLast = fmod( freq * speed, 1 ); scale = scale * length; - + for ( i = 0; i < segments; i++ ) { float s, c; @@ -653,7 +653,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime ) // Build point along noraml line (normal is -y, x) VectorScale( RI.vup, tmp[0], normal ); // Build point along normal line (normal is -y, x) VectorMA( normal, tmp[1], RI.vright, normal ); - + // Make a wide line VectorMA( delta, pbeam->width, normal, last1 ); VectorMA( delta, -pbeam->width, normal, last2 ); @@ -690,7 +690,7 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime ) // Make a wide line VectorMA( particles->org, pbeam->width, normal, last1 ); VectorMA( particles->org, -pbeam->width, normal, last2 ); - + vLast += vStep; // Advance texture scroll (v axis only) if( particles->next != NULL ) @@ -751,13 +751,13 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa VectorClear( screenLast ); segments = segments * M_PI; - + if( segments > NOISE_DIVISIONS * 8 ) segments = NOISE_DIVISIONS * 8; length = VectorLength( delta ) * 0.01f * M_PI_F; if( length < 0.5f ) length = 0.5f; // Don't lose all of the noise/texture on short beams - + div = 1.0f / ( segments - 1 ); vStep = length * div / 8.0f; // texture length texels per space pixel @@ -775,7 +775,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa VectorCopy( delta, xaxis ); radius = VectorLength( xaxis ); - + // cull beamring // -------------------------------- // Compute box center +/- radius @@ -792,7 +792,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa return; } - VectorSet( yaxis, xaxis[1], -xaxis[0], 0.0f ); + VectorSet( yaxis, xaxis[1], -xaxis[0], 0.0f ); VectorNormalize( yaxis ); VectorScale( yaxis, radius, yaxis ); @@ -803,7 +803,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa fraction = i * div; SinCos( fraction * M_PI2, &x, &y ); - VectorMAMAM( x, xaxis, y, yaxis, 1.0f, center, point ); + VectorMAMAM( x, xaxis, y, yaxis, 1.0f, center, point ); // distort using noise factor = rgNoise[(noiseIndex >> 16) & (NOISE_DIVISIONS - 1)] * scale; @@ -813,7 +813,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa factor = rgNoise[(noiseIndex >> 16) & (NOISE_DIVISIONS - 1)] * scale; factor *= cos( fraction * M_PI_F * 24 + freq ); VectorMA( point, factor, RI.vright, point ); - + // Transform point into screen space TriWorldToScreen( point, screen ); @@ -829,7 +829,7 @@ void R_DrawRing( vec3_t source, vec3_t delta, float width, float amplitude, floa // Build point along normal line (normal is -y, x) VectorScale( RI.vup, tmp[0], normal ); VectorMA( normal, tmp[1], RI.vright, normal ); - + // Make a wide line VectorMA( point, width, normal, last1 ); VectorMA( point, -width, normal, last2 ); @@ -1276,7 +1276,7 @@ void GAME_EXPORT CL_DrawBeams( int fTrans, BEAM *active_beams ) //pglShadeModel( GL_SMOOTH ); //pglDepthMask( fTrans ? GL_FALSE : GL_TRUE ); - + // server beams don't allocate beam chains // all params are stored in cl_entity_t for( i = 0; i < tr.draw_list->num_beam_entities; i++ ) diff --git a/ref_soft/r_bsp.c b/ref_soft/r_bsp.c index 1f67242f..79ad14c8 100644 --- a/ref_soft/r_bsp.c +++ b/ref_soft/r_bsp.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. diff --git a/ref_soft/r_decals.c b/ref_soft/r_decals.c index 436d9fbb..04370cd8 100644 --- a/ref_soft/r_decals.c +++ b/ref_soft/r_decals.c @@ -33,7 +33,7 @@ GNU General Public License for more details. #define RIGHT_EDGE 1 #define TOP_EDGE 2 #define BOTTOM_EDGE 3 - + // This structure contains the information used to create new decals typedef struct { @@ -72,14 +72,14 @@ static void R_DecalUnlink( decal_t *pdecal ) { pdecal->psurface->pdecals = pdecal->pnext; } - else + else { tmp = pdecal->psurface->pdecals; if( !tmp ) gEngfuncs.Host_Error( "D_DecalUnlink: bad decal list\n" ); - while( tmp->pnext ) + while( tmp->pnext ) { - if( tmp->pnext == pdecal ) + if( tmp->pnext == pdecal ) { tmp->pnext = pdecal->pnext; break; @@ -105,15 +105,15 @@ static decal_t *R_DecalAlloc( decal_t *pdecal ) if( r_decals->value < limit ) limit = r_decals->value; - + if( !limit ) return NULL; - if( !pdecal ) + if( !pdecal ) { int count = 0; // check for the odd possiblity of infinte loop - do + do { if( gDecalCount >= limit ) gDecalCount = 0; @@ -123,11 +123,11 @@ static decal_t *R_DecalAlloc( decal_t *pdecal ) count++; } while( FBitSet( pdecal->flags, FDECAL_PERMANENT ) && count < limit ); } - + // if decal is already linked to a surface, unlink it. R_DecalUnlink( pdecal ); - return pdecal; + return pdecal; } //----------------------------------------------------------------------------- @@ -194,7 +194,7 @@ void R_SetupDecalTextureSpaceBasis( decal_t *pDecal, msurface_t *surf, int textu // OPTIMIZE: Get rid of these divides decalWorldScale[0] = (float)pDecal->scale / width; decalWorldScale[1] = (float)pDecal->scale / height; - + VectorScale( textureSpaceBasis[0], decalWorldScale[0], textureSpaceBasis[0] ); VectorScale( textureSpaceBasis[1], decalWorldScale[1], textureSpaceBasis[1] ); } @@ -277,7 +277,7 @@ void R_ClipIntersect( float *one, float *two, float *out, int edge ) out[3] = out[5] = 0.0f; } else - { + { // right t = ((one[3] - 1.0f) / (one[3] - two[3])); out[3] = out[5] = 1.0f; @@ -295,7 +295,7 @@ void R_ClipIntersect( float *one, float *two, float *out, int edge ) out[4] = out[6] = 0.0f; } else - { + { // bottom t = ((one[4] - 1.0f) / (one[4] - two[4])); out[4] = out[6] = 1.0f; @@ -380,7 +380,7 @@ float *R_DoDecalSHClip( float *pInVerts, decal_t *pDecal, int nStartVerts, int * float *R_DecalVertsClip( decal_t *pDecal, msurface_t *surf, int texture, int *pVertCount ) { float decalWorldScale[2]; - vec3_t textureSpaceBasis[3]; + vec3_t textureSpaceBasis[3]; // figure out where the decal maps onto the surface. R_SetupDecalClip( pDecal, surf, texture, textureSpaceBasis, decalWorldScale ); @@ -437,7 +437,7 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int // (Same as R_SetupDecalClip). texture = decalinfo->m_iTexture; - + // precalculate the extents of decalinfo's decal in world space. R_GetDecalDimensions( texture, &mapSize[0], &mapSize[1] ); VectorScale( decalinfo->m_Basis[0], ((mapSize[0] / decalinfo->m_scale) * 0.5f), decalExtents[0] ); @@ -445,7 +445,7 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int pDecal = surf->pdecals; - while( pDecal ) + while( pDecal ) { texture = pDecal->texture; @@ -476,7 +476,7 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int Vector2Set( vDecalMax, DotProduct( testPosition[0], testBasis[0] ) - pDecal->dx + 0.5f, - DotProduct( testPosition[1], testBasis[1] ) - pDecal->dy + 0.5f ); + DotProduct( testPosition[1], testBasis[1] ) - pDecal->dy + 0.5f ); // Now figure out the part of the projection that intersects pDecal's // clip box [0,0,1,1]. @@ -485,14 +485,14 @@ static decal_t *R_DecalIntersect( decalinfo_t *decalinfo, msurface_t *surf, int if( vUnionMin[0] < 1 && vUnionMin[1] < 1 && vUnionMax[0] > 0 && vUnionMax[1] > 0 ) { - // Figure out how much of this intersects the (0,0) - (1,1) bbox. + // Figure out how much of this intersects the (0,0) - (1,1) bbox. float flArea = (vUnionMax[0] - vUnionMin[1]) * (vUnionMax[1] - vUnionMin[1]); if( flArea > 0.6f ) { *pcount += 1; - if( !plast || flArea <= lastArea ) + if( !plast || flArea <= lastArea ) { plast = pDecal; lastArea = flArea; @@ -554,9 +554,9 @@ static void R_AddDecalToSurface( decal_t *pdecal, msurface_t *surf, decalinfo_t pdecal->pnext = NULL; pold = surf->pdecals; - if( pold ) + if( pold ) { - while( pold->pnext ) + while( pold->pnext ) pold = pold->pnext; pold->pnext = pdecal; } @@ -586,7 +586,7 @@ static void R_DecalCreate( decalinfo_t *decalinfo, msurface_t *surf, float x, fl int count, vertCount; if( !surf ) return; // ??? - + pold = R_DecalIntersect( decalinfo, surf, &count ); if( count < MAX_OVERLAP_DECALS ) pold = NULL; @@ -608,7 +608,7 @@ static void R_DecalCreate( decalinfo_t *decalinfo, msurface_t *surf, float x, fl // check to see if the decal actually intersects the surface // if not, then remove the decal R_DecalVertsClip( pdecal, surf, decalinfo->m_iTexture, &vertCount ); - + if( !vertCount ) { R_DecalUnlink( pdecal ); @@ -655,9 +655,9 @@ void R_DecalSurface( msurface_t *surf, decalinfo_t *decalinfo ) // Compute an effective width and height (axis aligned) in the parent texture space // How does this work? decalBasis[0] represents the u-direction (width) - // of the decal measured in world space, decalBasis[1] represents the + // of the decal measured in world space, decalBasis[1] represents the // v-direction (height) measured in world space. - // textureVecsTexelsPerWorldUnits[0] represents the u direction of + // textureVecsTexelsPerWorldUnits[0] represents the u direction of // the surface's texture space measured in world space (with the appropriate // scale factor folded in), and textureVecsTexelsPerWorldUnits[1] // represents the texture space v direction. We want to find the dimensions (w,h) @@ -668,7 +668,7 @@ void R_DecalSurface( msurface_t *surf, decalinfo_t *decalinfo ) w = fabs( decalinfo->m_decalWidth * DotProduct( textureU, decalinfo->m_Basis[0] )) + fabs( decalinfo->m_decalHeight * DotProduct( textureU, decalinfo->m_Basis[1] )); - + h = fabs( decalinfo->m_decalWidth * DotProduct( textureV, decalinfo->m_Basis[0] )) + fabs( decalinfo->m_decalHeight * DotProduct( textureV, decalinfo->m_Basis[1] )); @@ -697,7 +697,7 @@ static void R_DecalNodeSurfaces( model_t *model, mnode_t *node, decalinfo_t *dec surf = model->surfaces + node->firstsurface; - for( i = 0; i < node->numsurfaces; i++, surf++ ) + for( i = 0; i < node->numsurfaces; i++, surf++ ) { // never apply decals on the water or sky surfaces if( surf->flags & (SURF_DRAWTURB|SURF_DRAWSKY|SURF_CONVEYOR)) @@ -712,15 +712,15 @@ static void R_DecalNodeSurfaces( model_t *model, mnode_t *node, decalinfo_t *dec } //----------------------------------------------------------------------------- -// Recursive routine to find surface to apply a decal to. World coordinates of -// the decal are passed in r_recalpos like the rest of the engine. This should +// Recursive routine to find surface to apply a decal to. World coordinates of +// the decal are passed in r_recalpos like the rest of the engine. This should // be called through R_DecalShoot() //----------------------------------------------------------------------------- static void R_DecalNode( model_t *model, mnode_t *node, decalinfo_t *decalinfo ) { mplane_t *splitplane; float dist; - + Assert( node != NULL ); if( node->contents < 0 ) @@ -732,13 +732,13 @@ static void R_DecalNode( model_t *model, mnode_t *node, decalinfo_t *decalinfo ) splitplane = node->plane; dist = DotProduct( decalinfo->m_Position, splitplane->normal ) - splitplane->dist; - // This is arbitrarily set to 10 right now. In an ideal world we'd have the - // exact surface but we don't so, this tells me which planes are "sort of - // close" to the gunshot -- the gunshot is actually 4 units in front of the - // wall (see dlls\weapons.cpp). We also need to check to see if the decal + // This is arbitrarily set to 10 right now. In an ideal world we'd have the + // exact surface but we don't so, this tells me which planes are "sort of + // close" to the gunshot -- the gunshot is actually 4 units in front of the + // wall (see dlls\weapons.cpp). We also need to check to see if the decal // actually intersects the texture space of the surface, as this method tags // parallel surfaces in the same node always. - // JAY: This still tags faces that aren't correct at edges because we don't + // JAY: This still tags faces that aren't correct at edges because we don't // have a surface normal if( dist > decalinfo->m_Size ) { @@ -748,7 +748,7 @@ static void R_DecalNode( model_t *model, mnode_t *node, decalinfo_t *decalinfo ) { R_DecalNode( model, node->children[1], decalinfo ); } - else + else { if( dist < DECAL_DISTANCE && dist > -DECAL_DISTANCE ) R_DecalNodeSurfaces( model, node, decalinfo ); @@ -786,7 +786,7 @@ void GAME_EXPORT R_DecalShoot( int textureIndex, int entityIndex, int modelIndex else model = WORLDMODEL; if( !model ) return; - + if( model->type != mod_brush ) { gEngfuncs.Con_Printf( S_ERROR "Decals must hit mod_brush!\n" ); @@ -850,7 +850,7 @@ void GAME_EXPORT R_DecalShoot( int textureIndex, int entityIndex, int modelIndex } // Build the vertex list for a decal on a surface and clip it to the surface. -// This is a template so it can work on world surfaces and dynamic displacement +// This is a template so it can work on world surfaces and dynamic displacement // triangles the same way. float * GAME_EXPORT R_DecalSetupVerts( decal_t *pDecal, msurface_t *surf, int texture, int *outCount ) { @@ -912,7 +912,7 @@ void DrawSingleDecal( decal_t *pDecal, msurface_t *fa ) } void DrawSurfaceDecals( msurface_t *fa, qboolean single, qboolean reverse ) -{ +{ decal_t *p; cl_entity_t *e; @@ -1049,7 +1049,7 @@ void DrawSurfaceDecals( msurface_t *fa, qboolean single, qboolean reverse ) } void DrawDecalsBatch( void ) -{ +{ cl_entity_t *e; int i; @@ -1120,9 +1120,9 @@ static qboolean R_DecalUnProject( decal_t *pdecal, decallist_t *entry ) } //----------------------------------------------------------------------------- -// Purpose: -// Input : *pList - -// count - +// Purpose: +// Input : *pList - +// count - // Output : static int //----------------------------------------------------------------------------- static int DecalListAdd( decallist_t *pList, int count ) @@ -1165,7 +1165,7 @@ static int DecalDepthCompare( const void *a, const void *b ) //----------------------------------------------------------------------------- // Purpose: Called by CSaveRestore::SaveClientState -// Input : *pList - +// Input : *pList - // Output : int //----------------------------------------------------------------------------- int GAME_EXPORT R_CreateDecalList( decallist_t *pList ) @@ -1181,7 +1181,7 @@ int GAME_EXPORT R_CreateDecalList( decallist_t *pList ) { decal_t *decal = &gDecalPool[i]; decal_t *pdecals; - + // decal is in use and is not a custom decal if( decal->psurface == NULL || FBitSet( decal->flags, FDECAL_DONTSAVE )) continue; @@ -1199,7 +1199,7 @@ int GAME_EXPORT R_CreateDecalList( decallist_t *pList ) pList[total].depth = depth; pList[total].flags = decal->flags; pList[total].scale = decal->scale; - + R_DecalUnProject( decal, &pList[total] ); COM_FileBase( R_GetTexture( decal->texture )->name, pList[total].name ); @@ -1276,7 +1276,7 @@ void GAME_EXPORT R_EntityRemoveDecals( model_t *mod ) R_ClearAllDecals remove all decals from anything -used for full decals restart +used for full decals restart =============== */ void GAME_EXPORT R_ClearAllDecals( void ) diff --git a/ref_soft/r_edge.c b/ref_soft/r_edge.c index 6a3ac3fe..aebabecf 100644 --- a/ref_soft/r_edge.c +++ b/ref_soft/r_edge.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -191,7 +191,7 @@ addedge: } #endif // !id386 - + #if !id386 @@ -231,29 +231,29 @@ nextedge: if (pedge->u < pedge->prev->u) goto pushback; pedge = pedge->next; - + pedge->u += pedge->u_step; if (pedge->u < pedge->prev->u) goto pushback; pedge = pedge->next; - + pedge->u += pedge->u_step; if (pedge->u < pedge->prev->u) goto pushback; pedge = pedge->next; - + pedge->u += pedge->u_step; if (pedge->u < pedge->prev->u) goto pushback; pedge = pedge->next; - - goto nextedge; - + + goto nextedge; + pushback: if (pedge == &edge_aftertail) return; - - // push it back to keep it sorted + + // push it back to keep it sorted pnext_edge = pedge->next; // pull the edge out of the edge list @@ -390,7 +390,7 @@ newtop: // set last_u on the new span surf->last_u = iu; - + gotposition: // insert before surf2 surf->next = surf2; @@ -555,7 +555,7 @@ newtop: // set last_u on the new span surf->last_u = iu; - + gotposition: // insert before surf2 surf->next = surf2; @@ -583,7 +583,7 @@ void R_GenerateSpans (void) // generate spans for (edge=edge_head.next ; edge != &edge_tail; edge=edge->next) - { + { if (edge->surfs[0]) { // it has a left surface, so a surface is going away for this span @@ -619,7 +619,7 @@ void R_GenerateSpansBackward (void) // generate spans for (edge=edge_head.next ; edge != &edge_tail; edge=edge->next) - { + { if (edge->surfs[0]) R_TrailingEdge (&surfaces[edge->surfs[0]], edge); @@ -635,7 +635,7 @@ void R_GenerateSpansBackward (void) ============== R_ScanEdges -Input: +Input: newedges[] array this has links to edges, which have links to surfaces @@ -665,7 +665,7 @@ void R_ScanEdges (void) edge_head.next = &edge_tail; edge_head.surfs[0] = 0; edge_head.surfs[1] = 1; - + edge_tail.u =(RI.vrectright << 20) + 0xFFFFF; // (r_refdef.vrectright << 20) + 0xFFFFF; edge_tail_u_shift20 = edge_tail.u >> 20; edge_tail.u_step = 0; @@ -673,7 +673,7 @@ void R_ScanEdges (void) edge_tail.next = &edge_aftertail; edge_tail.surfs[0] = 1; edge_tail.surfs[1] = 0; - + edge_aftertail.u = -1; // force a move edge_aftertail.u_step = 0; edge_aftertail.next = &edge_sentinel; @@ -683,7 +683,7 @@ void R_ScanEdges (void) edge_sentinel.u = 2000 << 20; // make sure nothing sorts past this edge_sentinel.prev = &edge_aftertail; -// +// // process all scan lines // bottom = RI.vrectbottom - 1; @@ -792,7 +792,7 @@ void D_FlatFillSurface (surf_t *surf, int color) espan_t *span; pixel_t *pdest; int u, u2; - + for (span=surf->spans ; span ; span=span->pnext) { pdest = d_viewbuffer + r_screenwidth*span->v; diff --git a/ref_soft/r_image.c b/ref_soft/r_image.c index 09623325..4867a73a 100644 --- a/ref_soft/r_image.c +++ b/ref_soft/r_image.c @@ -185,7 +185,7 @@ static int GL_CalcMipmapCount( image_t *tex, qboolean haveBuffer ) // generate mip-levels by user request if( FBitSet( tex->flags, TF_NOMIPMAP )) return 1; - + // mip-maps can't exceeds 4 for( mipcount = 0; mipcount < 4; mipcount++ ) { @@ -580,7 +580,7 @@ static qboolean GL_UploadTexture( image_t *tex, rgbdata_t *pic ) if( j == 0 && tex->flags & TF_HAS_ALPHA ) tex->alpha_pixels = (pixel_t*)Mem_Calloc( r_temppool, width * height * sizeof(pixel_t) ); - + for(i = 0; i < height * width; i++ ) { unsigned int r, g, b, major, minor; @@ -747,7 +747,7 @@ do specified actions on pixels */ static void GL_ProcessImage( image_t *tex, rgbdata_t *pic ) { - uint img_flags = 0; + uint img_flags = 0; // force upload texture as RGB or RGBA (detail textures requires this) if( tex->flags & TF_FORCE_COLOR ) pic->flags |= IMAGE_HAS_COLOR; @@ -986,7 +986,7 @@ int GAME_EXPORT GL_LoadTexture( const char *name, const byte *buf, size_t size, SetBits( picFlags, IL_DONTFLIP_TGA ); if( FBitSet( flags, TF_KEEP_SOURCE ) && !FBitSet( flags, TF_EXPAND_SOURCE )) - SetBits( picFlags, IL_KEEP_8BIT ); + SetBits( picFlags, IL_KEEP_8BIT ); // set some image flags gEngfuncs.Image_SetForceFlags( picFlags ); @@ -1252,7 +1252,7 @@ void R_InitDlightTexture( void ) return; // already initialized memset( &r_image, 0, sizeof( r_image )); - r_image.width = BLOCK_SIZE; + r_image.width = BLOCK_SIZE; r_image.height = BLOCK_SIZE; r_image.flags = IMAGE_HAS_COLOR; r_image.type = PF_RGBA_32; diff --git a/ref_soft/r_light.c b/ref_soft/r_light.c index 4d4f9c84..8ca462de 100644 --- a/ref_soft/r_light.c +++ b/ref_soft/r_light.c @@ -106,7 +106,7 @@ void R_MarkLights( dlight_t *light, int bit, mnode_t *node ) float dist; msurface_t *surf; int i; - + if( !node || node->contents < 0 ) return; @@ -122,7 +122,7 @@ void R_MarkLights( dlight_t *light, int bit, mnode_t *node ) R_MarkLights( light, bit, node->children[1] ); return; } - + // mark the polygons surf = RI.currentmodel->surfaces + node->firstsurface; @@ -264,7 +264,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, VectorLerp( start, frac, end, mid ); midf = p1f + ( p2f - p1f ) * frac; - // co down front side + // co down front side if( R_RecursiveLightPoint( model, node->children[side], p1f, midf, cv, start, mid )) return true; // hit something @@ -296,7 +296,7 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f, ds = s - info->lightmapmins[0]; dt = t - info->lightmapmins[1]; - + if ( ds > info->lightextents[0] || dt > info->lightextents[1] ) continue; diff --git a/ref_soft/r_local.h b/ref_soft/r_local.h index 99cb2635..b5d5f250 100644 --- a/ref_soft/r_local.h +++ b/ref_soft/r_local.h @@ -176,7 +176,7 @@ typedef struct qboolean drawWorld; // ignore world for drawing PlayerModel qboolean isSkyVisible; // sky is visible qboolean onlyClientDraw; // disabled by client request - qboolean drawOrtho; // draw world as orthogonal projection + qboolean drawOrtho; // draw world as orthogonal projection float fov_x, fov_y; // current view fov @@ -274,7 +274,7 @@ typedef struct msurface_t *draw_decals[MAX_DECAL_SURFS]; int num_draw_decals; - + // OpenGL matrix states qboolean modelviewIdentity; diff --git a/ref_soft/r_main.c b/ref_soft/r_main.c index a67d039d..64c3b461 100644 --- a/ref_soft/r_main.c +++ b/ref_soft/r_main.c @@ -737,7 +737,7 @@ static image_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mnode_t image_t *tex = NULL; // assure the initial node is not null - // we could check it here, but we would rather check it + // we could check it here, but we would rather check it // outside the call to get rid of one additional recursion level Assert( node != NULL ); @@ -758,7 +758,7 @@ static image_t *R_RecursiveFindWaterTexture( const mnode_t *node, const mnode_t // find texture pleaf = (mleaf_t *)node; mark = pleaf->firstmarksurface; - c = pleaf->nummarksurfaces; + c = pleaf->nummarksurfaces; for( i = 0; i < c; i++, mark++ ) { @@ -914,7 +914,7 @@ void R_DrawEntitiesOnList( void ) else tr.blend = 1.0f; // draw as solid but sorted by distance if( tr.blend <= 0.0f ) continue; - + Assert( RI.currententity != NULL ); Assert( RI.currentmodel != NULL ); diff --git a/ref_soft/r_misc.c b/ref_soft/r_misc.c index cd2c5653..e984a27e 100644 --- a/ref_soft/r_misc.c +++ b/ref_soft/r_misc.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -39,7 +39,7 @@ static float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8}; //int d_pix_min, d_pix_max, d_pix_shift; int d_scantable[MAXHEIGHT]; -short *zspantable[MAXHEIGHT]; +short *zspantable[MAXHEIGHT]; struct qfrustum_s qfrustum; /* ================ @@ -127,7 +127,7 @@ void R_TransformFrustum (void) { int i; vec3_t v, v2; - + for (i=0 ; i<4 ; i++) { v[0] = qfrustum.screenedge[i].normal[2]; @@ -165,7 +165,7 @@ R_TransformPlane void R_TransformPlane (mplane_t *p, float *normal, float *dist) { float d; - + d = DotProduct (RI.vieworg, p->normal); *dist = p->dist - d; // TODO: when we have rotating entities, this will need to use the view matrix @@ -320,7 +320,7 @@ void R_SetupFrameQ (void) r_fullbright->flags &= ~FCVAR_CHANGED; D_FlushCaches( ); // so all lighting changes } - + //tr.framecount++; diff --git a/ref_soft/r_part.c b/ref_soft/r_part.c index 6fcb7ba7..c71cb7bf 100644 --- a/ref_soft/r_part.c +++ b/ref_soft/r_part.c @@ -143,7 +143,7 @@ static qboolean CL_CullTracer( particle_t *p, const vec3_t start, const vec3_t e mins[i] = end[i]; maxs[i] = start[i]; } - + // don't let it be zero sized if( mins[i] == maxs[i] ) { @@ -232,10 +232,10 @@ void GAME_EXPORT CL_DrawTracers( double frametime, particle_t *cl_active_tracers VectorSubtract( normal, tmp2, normal ); // compute four vertexes - VectorSubtract( start, normal, verts[0] ); - VectorAdd( start, normal, verts[1] ); - VectorAdd( verts[0], delta, verts[2] ); - VectorAdd( verts[1], delta, verts[3] ); + VectorSubtract( start, normal, verts[0] ); + VectorAdd( start, normal, verts[1] ); + VectorAdd( verts[0], delta, verts[2] ); + VectorAdd( verts[1], delta, verts[3] ); if( p->color > sizeof( gTracerColors ) / sizeof( color24 ) ) { diff --git a/ref_soft/r_polyse.c b/ref_soft/r_polyse.c index 0f2f2ca5..0d36d386 100644 --- a/ref_soft/r_polyse.c +++ b/ref_soft/r_polyse.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // TODO: put in span spilling to shrink list size // !!! if this is changed, it must be changed in d_polysa.s too !!! -#define DPS_MAXSPANS MAXHEIGHT+1 +#define DPS_MAXSPANS MAXHEIGHT+1 // 1 extra for spanpackage that marks end // !!! if this is changed, it must be changed in asm_draw.h too !!! @@ -132,7 +132,7 @@ void R_PolysetUpdateTables (void) { int i; byte *s; - + if (r_affinetridesc.skinwidth != skinwidth || r_affinetridesc.pskin != skinstart) { @@ -508,7 +508,7 @@ void R_PolysetCalcGradients( int skinwidth ) __asm fild dword ptr d_xdenom ; d_xdenom __asm fdivr one ; 1 / d_xdenom - __asm fst xstepdenominv ; + __asm fst xstepdenominv ; __asm fmul negative_one ; -( 1 / d_xdenom ) // ceil () for light so positive steps are exaggerated, negative steps diff --git a/ref_soft/r_rast.c b/ref_soft/r_rast.c index 5e6590a4..70993daa 100644 --- a/ref_soft/r_rast.c +++ b/ref_soft/r_rast.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -236,16 +236,16 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1) else { world = &pv0->position[0]; - + // transform and project VectorSubtract (world, tr.modelorg, local); TransformVector (local, transformed); - + if (transformed[2] < NEAR_CLIP) transformed[2] = NEAR_CLIP; - + lzi0 = 1.0f / transformed[2]; - + // FIXME: build x/yscale into transform? scale = xscale * lzi0; u0 = (xcenter + scale*transformed[0]); @@ -253,14 +253,14 @@ void R_EmitEdge (mvertex_t *pv0, mvertex_t *pv1) u0 = RI.fvrectx_adj; if (u0 > RI.fvrectright_adj) u0 = RI.fvrectright_adj; - + scale = yscale * lzi0; v0 = (ycenter - scale*transformed[1]); if (v0 < RI.fvrecty_adj) v0 = RI.fvrecty_adj; if (v0 > RI.fvrectbottom_adj) v0 = RI.fvrectbottom_adj; - + ceilv0 = (int) ceil(v0); } diff --git a/ref_soft/r_studio.c b/ref_soft/r_studio.c index 6510fd85..3037e28b 100644 --- a/ref_soft/r_studio.c +++ b/ref_soft/r_studio.c @@ -38,7 +38,7 @@ cvar_t *r_glowshellfreq; cvar_t r_shadows = { "r_shadows", "0", 0 }; -static vec3_t hullcolor[8] = +static vec3_t hullcolor[8] = { { 1.0f, 1.0f, 1.0f }, { 1.0f, 0.5f, 0.5f }, @@ -120,7 +120,7 @@ typedef struct player_model_t player_models[MAX_CLIENTS]; } studio_draw_state_t; -// studio-related cvars +// studio-related cvars static cvar_t *r_studio_sort_textures; static cvar_t *r_drawviewmodel; cvar_t *cl_righthand = NULL; @@ -639,16 +639,16 @@ float GAME_EXPORT R_StudioEstimateFrame( cl_entity_t *e, mstudioseqdesc_t *pseqd if( pseqdesc->numframes <= 1 ) f = 0.0; else f = (e->curstate.frame * (pseqdesc->numframes - 1)) / 256.0; - + f += dfdt; - if( pseqdesc->flags & STUDIO_LOOPING ) + if( pseqdesc->flags & STUDIO_LOOPING ) { if( pseqdesc->numframes > 1 ) f -= (int)(f / (pseqdesc->numframes - 1)) * (pseqdesc->numframes - 1); if( f < 0 ) f += (pseqdesc->numframes - 1); } - else + else { if( f >= pseqdesc->numframes - 1.001 ) f = pseqdesc->numframes - 1.001; @@ -758,7 +758,7 @@ StudioCalcBoneAdj void R_StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, const byte *pcontroller2, byte mouthopen ) { mstudiobonecontroller_t *pbonecontroller; - float value = 0.0f; + float value = 0.0f; int i, j; pbonecontroller = (mstudiobonecontroller_t *)((byte *)m_pStudioHeader + m_pStudioHeader->bonecontrollerindex); @@ -771,7 +771,7 @@ void R_StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, cons { // mouth hardcoded at controller 4 value = (float)mouthopen / 64.0f; - value = bound( 0.0f, value, 1.0f ); + value = bound( 0.0f, value, 1.0f ); value = (1.0f - value) * pbonecontroller[j].start + value * pbonecontroller[j].end; } else if( i < 4 ) @@ -785,12 +785,12 @@ void R_StudioCalcBoneAdj( float dadt, float *adj, const byte *pcontroller1, cons int b = (pcontroller2[i] + 128) % 256; value = (( a * dadt ) + ( b * ( 1.0f - dadt )) - 128) * (360.0f / 256.0f) + pbonecontroller[j].start; } - else + else { value = ((pcontroller1[i] * dadt + (pcontroller2[i]) * (1.0f - dadt))) * (360.0f / 256.0f) + pbonecontroller[j].start; } } - else + else { value = (pcontroller1[i] * dadt + pcontroller2[i] * (1.0f - dadt)) / 255.0f; value = bound( 0.0f, value, 1.0f ); @@ -850,7 +850,7 @@ void R_StudioCalcRotations( cl_entity_t *e, float pos[][3], vec4_t *q, mstudiose R_StudioCalcBoneAdj( dadt, adj, e->curstate.controller, e->latched.prevcontroller, e->mouth.mouthopen ); - for( i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++ ) + for( i = 0; i < m_pStudioHeader->numbones; i++, pbone++, panim++ ) { gEngfuncs.R_StudioCalcBoneQuaternion( frame, s, pbone, panim, adj, q[i] ); gEngfuncs.R_StudioCalcBonePosition( frame, s, pbone, panim, adj, pos[i] ); @@ -889,7 +889,7 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel ) R_StudioCalcRotations( e, pos, q, pseqdesc, panim, f ); pbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex); - for( i = 0; i < m_pStudioHeader->numbones; i++ ) + for( i = 0; i < m_pStudioHeader->numbones; i++ ) { for( j = 0; j < g_studio.cached_numbones; j++ ) { @@ -904,15 +904,15 @@ void R_StudioMergeBones( cl_entity_t *e, model_t *m_pSubModel ) if( j >= g_studio.cached_numbones ) { Matrix3x4_FromOriginQuat( bonematrix, q[i], pos[i] ); - if( pbones[i].parent == -1 ) + if( pbones[i].parent == -1 ) { Matrix3x4_ConcatTransforms( g_studio.bonestransform[i], g_studio.rotationmatrix, bonematrix ); Matrix3x4_Copy( g_studio.lighttransform[i], g_studio.bonestransform[i] ); // apply client-side effects to the transformation matrix R_StudioFxTransform( e, g_studio.bonestransform[i] ); - } - else + } + else { Matrix3x4_ConcatTransforms( g_studio.bonestransform[i], g_studio.bonestransform[pbones[i].parent], bonematrix ); Matrix3x4_ConcatTransforms( g_studio.lighttransform[i], g_studio.lighttransform[pbones[i].parent], bonematrix ); @@ -1036,7 +1036,7 @@ void R_StudioSetupBones( cl_entity_t *e ) { qboolean copy_bones = true; - if( m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq ) + if( m_pPlayerInfo->gaitsequence >= m_pStudioHeader->numseq ) m_pPlayerInfo->gaitsequence = 0; pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + m_pPlayerInfo->gaitsequence; @@ -1058,18 +1058,18 @@ void R_StudioSetupBones( cl_entity_t *e ) } } - for( i = 0; i < m_pStudioHeader->numbones; i++ ) + for( i = 0; i < m_pStudioHeader->numbones; i++ ) { Matrix3x4_FromOriginQuat( bonematrix, q[i], pos[i] ); - if( pbones[i].parent == -1 ) + if( pbones[i].parent == -1 ) { Matrix3x4_ConcatTransforms( g_studio.bonestransform[i], g_studio.rotationmatrix, bonematrix ); Matrix3x4_Copy( g_studio.lighttransform[i], g_studio.bonestransform[i] ); // apply client-side effects to the transformation matrix R_StudioFxTransform( e, g_studio.bonestransform[i] ); - } + } else { Matrix3x4_ConcatTransforms( g_studio.bonestransform[i], g_studio.bonestransform[pbones[i].parent], bonematrix ); @@ -1092,7 +1092,7 @@ static void R_StudioSaveBones( void ) pbones = (mstudiobone_t *)((byte *)m_pStudioHeader + m_pStudioHeader->boneindex); g_studio.cached_numbones = m_pStudioHeader->numbones; - for( i = 0; i < m_pStudioHeader->numbones; i++ ) + for( i = 0; i < m_pStudioHeader->numbones; i++ ) { Matrix3x4_Copy( g_studio.cached_bonestransform[i], g_studio.bonestransform[i] ); Matrix3x4_Copy( g_studio.cached_lighttransform[i], g_studio.lighttransform[i] ); @@ -1122,7 +1122,7 @@ void R_StudioBuildNormalTable( void ) for( i = 0; i < m_pSubModel->numverts; i++ ) g_studio.normaltable[i] = -1; - for( j = 0; j < m_pSubModel->nummesh; j++ ) + for( j = 0; j < m_pSubModel->nummesh; j++ ) { short *ptricmds; @@ -1170,7 +1170,7 @@ void R_StudioGenerateNormals( void ) for( i = 0; i < m_pSubModel->numverts; i++ ) VectorClear( g_studio.norms[i] ); - for( j = 0; j < m_pSubModel->nummesh; j++ ) + for( j = 0; j < m_pSubModel->nummesh; j++ ) { short *ptricmds; @@ -1672,8 +1672,8 @@ void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal ) if( FBitSet( flags, STUDIO_NF_FLATSHADE )) { illum += g_studio.shadelight * 0.8f; - } - else + } + else { float r, lightcos; @@ -1690,14 +1690,14 @@ void R_StudioLighting( float *lv, int bone, int flags, vec3_t normal ) { r += 1.0f; lightcos = (( r - 1.0f ) - lightcos) / r; - if( lightcos > 0.0f ) - illum += g_studio.shadelight * lightcos; + if( lightcos > 0.0f ) + illum += g_studio.shadelight * lightcos; } else { lightcos = (lightcos + ( r - 1.0f )) / r; if( lightcos > 0.0f ) - illum -= g_studio.shadelight * lightcos; + illum -= g_studio.shadelight * lightcos; } illum = Q_max( illum, 0.0f ); @@ -2072,7 +2072,7 @@ static void R_StudioDrawPoints( void ) if( !m_pStudioHeader ) return; // safety bounding the skinnum - m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 )); + m_skinnum = bound( 0, RI.currententity->curstate.skin, ( m_pStudioHeader->numskinfamilies - 1 )); ptexture = (mstudiotexture_t *)((byte *)m_pStudioHeader + m_pStudioHeader->textureindex); pvertbone = ((byte *)m_pStudioHeader + m_pSubModel->vertinfoindex); pnormbone = ((byte *)m_pStudioHeader + m_pSubModel->norminfoindex); @@ -2121,7 +2121,7 @@ static void R_StudioDrawPoints( void ) R_StudioGenerateNormals(); } - for( j = k = 0; j < m_pSubModel->nummesh; j++ ) + for( j = k = 0; j < m_pSubModel->nummesh; j++ ) { g_nFaceFlags = ptexture[pskinref[pmesh[j].skinref]].flags | g_nForceFaceFlags; @@ -2165,7 +2165,7 @@ static void R_StudioDrawPoints( void ) // NOTE: rewind normals at start pstudionorms = (vec3_t *)((byte *)m_pStudioHeader + m_pSubModel->normindex); - for( j = 0; j < m_pSubModel->nummesh; j++ ) + for( j = 0; j < m_pSubModel->nummesh; j++ ) { float oldblend = tr.blend; short *ptricmds; @@ -2342,12 +2342,12 @@ static void R_StudioDrawBones( void ) pglPointSize( 3.0f ); pglColor3f( 1, 0.7f, 0 ); pglBegin( GL_LINES ); - + Matrix3x4_OriginFromMatrix( g_studio.bonestransform[pbones[i].parent], point ); pglVertex3fv( point ); Matrix3x4_OriginFromMatrix( g_studio.bonestransform[i], point ); pglVertex3fv( point ); - + pglEnd(); pglColor3f( 0, 0, 0.8f ); @@ -2384,18 +2384,18 @@ static void R_StudioDrawAttachments( void ) #if 0 pglDisable( GL_TEXTURE_2D ); pglDisable( GL_DEPTH_TEST ); - + for( i = 0; i < m_pStudioHeader->numattachments; i++ ) { mstudioattachment_t *pattachments; vec3_t v[4]; - pattachments = (mstudioattachment_t *)((byte *)m_pStudioHeader + m_pStudioHeader->attachmentindex); + pattachments = (mstudioattachment_t *)((byte *)m_pStudioHeader + m_pStudioHeader->attachmentindex); Matrix3x4_VectorTransform( g_studio.bonestransform[pattachments[i].bone], pattachments[i].org, v[0] ); Matrix3x4_VectorTransform( g_studio.bonestransform[pattachments[i].bone], pattachments[i].vectors[0], v[1] ); Matrix3x4_VectorTransform( g_studio.bonestransform[pattachments[i].bone], pattachments[i].vectors[1], v[2] ); Matrix3x4_VectorTransform( g_studio.bonestransform[pattachments[i].bone], pattachments[i].vectors[2], v[3] ); - + pglBegin( GL_LINES ); pglColor3f( 1, 0, 0 ); pglVertex3fv( v[0] ); @@ -2819,7 +2819,7 @@ void GL_StudioSetRenderMode( int rendermode ) } #endif } - + /* =============== GL_StudioDrawShadow @@ -2867,7 +2867,7 @@ void R_StudioRenderFinal( void ) rendermode = R_StudioGetForceFaceFlags() ? kRenderTransAdd : RI.currententity->curstate.rendermode; R_StudioSetupRenderer( rendermode ); - + if( r_drawentities->value == 2 ) { R_StudioDrawBones(); @@ -3039,7 +3039,7 @@ void R_StudioProcessGait( entity_state_t *pplayer ) int iBlend; float dt, flYaw; // view direction relative to movement - if( RI.currententity->curstate.sequence >= m_pStudioHeader->numseq ) + if( RI.currententity->curstate.sequence >= m_pStudioHeader->numseq ) RI.currententity->curstate.sequence = 0; dt = bound( 0.0f, g_studio.frametime, 1.0f ); @@ -3087,7 +3087,7 @@ void R_StudioProcessGait( entity_state_t *pplayer ) if( RI.currententity->angles[YAW] < -0 ) RI.currententity->angles[YAW] += 360.0f; RI.currententity->latched.prevangles[YAW] = RI.currententity->angles[YAW]; - if( pplayer->gaitsequence >= m_pStudioHeader->numseq ) + if( pplayer->gaitsequence >= m_pStudioHeader->numseq ) pplayer->gaitsequence = 0; pseqdesc = (mstudioseqdesc_t *)((byte *)m_pStudioHeader + m_pStudioHeader->seqindex) + pplayer->gaitsequence; @@ -3131,7 +3131,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer ) m_pPlayerInfo = pfnPlayerInfo( m_nPlayerIndex ); VectorCopy( RI.currententity->angles, orig_angles ); - + R_StudioProcessGait( pplayer ); m_pPlayerInfo->gaitsequence = pplayer->gaitsequence; @@ -3150,7 +3150,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer ) RI.currententity->latched.prevcontroller[1] = RI.currententity->curstate.controller[1]; RI.currententity->latched.prevcontroller[2] = RI.currententity->curstate.controller[2]; RI.currententity->latched.prevcontroller[3] = RI.currententity->curstate.controller[3]; - + m_pPlayerInfo = pfnPlayerInfo( m_nPlayerIndex ); m_pPlayerInfo->gaitsequence = 0; diff --git a/ref_soft/r_surf.c b/ref_soft/r_surf.c index 2257bd2a..d42db305 100644 --- a/ref_soft/r_surf.c +++ b/ref_soft/r_surf.c @@ -8,7 +8,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -509,18 +509,18 @@ void R_DrawSurface (void) sample_pot = 1 << sample_bits; } mt = r_drawsurf.image; - + r_source = mt->pixels[r_drawsurf.surfmip]; - + // the fractional light values should range from 0 to (VID_GRADES - 1) << 16 // from a source range of 0 - 255 - + texwidth = mt->width >> r_drawsurf.surfmip; blocksize = sample_pot >> r_drawsurf.surfmip; blockdivshift = sample_bits - r_drawsurf.surfmip; blockdivmask = (1 << blockdivshift) - 1; - + if( sample_size == 16 ) r_lightwidth = ( r_drawsurf.surf->info->lightextents[0]>>4)+1; else @@ -593,7 +593,7 @@ void R_DrawSurface (void) // << 16 components are to guarantee positive values for % soffset = ((soffset >> r_drawsurf.surfmip) + (smax << 16)) % smax; - basetptr = &r_source[((((basetoffset >> r_drawsurf.surfmip) + basetptr = &r_source[((((basetoffset >> r_drawsurf.surfmip) + (tmax << 16)) % tmax) * twidth)]; pcolumndest = r_drawsurf.surfdat; @@ -779,7 +779,7 @@ void R_DrawSurfaceBlock8_mip0 (void) //[(light & 0xFF00) + pix]; light += lightstep; } - + psource += sourcetstep; lightright += lightrightstep; lightleft += lightleftstep; @@ -831,7 +831,7 @@ void R_DrawSurfaceBlock8_mip1 (void) //[(light & 0xFF00) + pix]; light += lightstep; } - + psource += sourcetstep; lightright += lightrightstep; lightleft += lightleftstep; @@ -883,7 +883,7 @@ void R_DrawSurfaceBlock8_mip2 (void) //[(light & 0xFF00) + pix]; light += lightstep; } - + psource += sourcetstep; lightright += lightrightstep; lightleft += lightleftstep; @@ -935,7 +935,7 @@ void R_DrawSurfaceBlock8_mip3 (void) //[(light & 0xFF00) + pix]; light += lightstep; } - + psource += sourcetstep; lightright += lightrightstep; lightleft += lightleftstep; @@ -976,7 +976,7 @@ void R_InitCaches (void) pix = vid.width * vid.height * 2; if (pix > 64000) size += (pix-64000)*3; - } + } // round up to page size size = (size + 8191) & ~8191; @@ -991,7 +991,7 @@ void R_InitCaches (void) } sc_base = (surfcache_t *)Mem_Calloc(r_temppool,size); sc_rover = sc_base; - + sc_base->next = NULL; sc_base->owner = NULL; sc_base->size = sc_size; @@ -1016,7 +1016,7 @@ void D_FlushCaches( void ) *c->owner = NULL; } } - + sc_rover = sc_base; sc_base->next = NULL; sc_base->owner = NULL; @@ -1038,7 +1038,7 @@ surfcache_t *D_SCAlloc (int width, int size) if ((size <= 0) || (size > 0x10000000)) gEngfuncs.Host_Error ("D_SCAlloc: bad cache size %d\n", size); - + size = (int)&((surfcache_t *)0)->data[size]; size = (size + 3) & ~3; if (size > sc_size) @@ -1055,12 +1055,12 @@ surfcache_t *D_SCAlloc (int width, int size) } sc_rover = sc_base; } - + // colect and free surfcache_t blocks until the rover block is large enough new = sc_rover; if (sc_rover->owner) *sc_rover->owner = NULL; - + while (new->size < size) { // free another @@ -1069,7 +1069,7 @@ surfcache_t *D_SCAlloc (int width, int size) gEngfuncs.Host_Error ("D_SCAlloc: hit the end of memory"); if (sc_rover->owner) *sc_rover->owner = NULL; - + new->size += sc_rover->size; new->next = sc_rover->next; } @@ -1087,7 +1087,7 @@ surfcache_t *D_SCAlloc (int width, int size) } else sc_rover = new->next; - + new->width = width; // DEBUG if (width > 0) @@ -1101,7 +1101,7 @@ surfcache_t *D_SCAlloc (int width, int size) r_cache_thrash = true; } else if (wrapped_this_time) - { + { d_roverwrapped = true; } @@ -1146,9 +1146,9 @@ int MaskForNum (int num) int D_log2 (int num) { int c; - + c = 0; - + while (num>>=1) c++; return c; @@ -1328,7 +1328,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) //r_drawsurf.lightadj[1] = r_newrefdef.lightstyles[surface->styles[1]].white*128; //r_drawsurf.lightadj[2] = r_newrefdef.lightstyles[surface->styles[2]].white*128; //r_drawsurf.lightadj[3] = r_newrefdef.lightstyles[surface->styles[3]].white*128; - + // // see if the cache holds apropriate data // @@ -1382,7 +1382,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) r_drawsurf.surfheight = surface->extents[1] >> miplevel; } - + // // allocate memory if needed // @@ -1394,14 +1394,14 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) cache->owner = &CACHESPOT(surface)[miplevel]; cache->mipscale = surfscale; } - + if (surface->dlightframe == tr.framecount) cache->dlight = 1; else cache->dlight = 0; r_drawsurf.surfdat = (pixel_t *)cache->data; - + cache->image = r_drawsurf.image; cache->lightadj[0] = r_drawsurf.lightadj[0]; cache->lightadj[1] = r_drawsurf.lightadj[1]; @@ -1420,7 +1420,7 @@ surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel) // calculate the lightings R_BuildLightMap ( ); - + // rasterize the surface into the cache R_DrawSurface (); R_DrawSurfaceDecals(); diff --git a/utils/mdldec/mdldec.c b/utils/mdldec/mdldec.c index 295c35b4..f1778383 100644 --- a/utils/mdldec/mdldec.c +++ b/utils/mdldec/mdldec.c @@ -161,7 +161,7 @@ static qboolean LoadMDL( const char *modelname ) fprintf( stderr, "ERROR: %s is not a main HL model file.\n", modelname ); return false; } - + if( destdir[0] != '\0' ) { if( !IsFileExists( destdir ) ) diff --git a/utils/mdldec/smd.c b/utils/mdldec/smd.c index 332ca9ea..4a4f9884 100644 --- a/utils/mdldec/smd.c +++ b/utils/mdldec/smd.c @@ -28,7 +28,7 @@ static matrix3x4 *bonetransform; /* ============ -CreateBoneTransformMatrices +CreateBoneTransformMatrices ============ */ static qboolean CreateBoneTransformMatrices( void ) @@ -46,7 +46,7 @@ static qboolean CreateBoneTransformMatrices( void ) /* ============ -FillBoneTransformMatrices +FillBoneTransformMatrices ============ */ static void FillBoneTransformMatrices( void ) @@ -223,7 +223,7 @@ static void WriteTriangleInfo( FILE *fp, mstudiomodel_t *model, mstudiotexture_t int i, indices[3]; int vert_index; int norm_index; - int bone_index; + int bone_index; float s, t, u, v; byte *vertbone; vec3_t *studioverts; @@ -260,7 +260,7 @@ static void WriteTriangleInfo( FILE *fp, mstudiomodel_t *model, mstudiotexture_t Matrix3x4_VectorTransform( bonetransform[bone_index], studioverts[vert_index], vert ); Matrix3x4_VectorRotate( bonetransform[bone_index], studionorms[norm_index], norm ); - VectorNormalize( norm ); + VectorNormalize( norm ); u = ( triverts[indices[i]]->s + 1.0f ) * s; v = 1.0f - triverts[indices[i]]->t * t; diff --git a/utils/mdldec/texture.c b/utils/mdldec/texture.c index 77232bea..d38062f0 100644 --- a/utils/mdldec/texture.c +++ b/utils/mdldec/texture.c @@ -57,7 +57,7 @@ static void WriteBMP( mstudiotexture_t *texture ) } texture_size = texture->height * texture->width; - pic = (byte *)texture_hdr + texture->index; + pic = (byte *)texture_hdr + texture->index; palette = pic + texture_size; bmp_hdr.id[0] = 'B'; diff --git a/utils/mdldec/utils.c b/utils/mdldec/utils.c index 89f923b1..739390d9 100644 --- a/utils/mdldec/utils.c +++ b/utils/mdldec/utils.c @@ -41,7 +41,7 @@ qboolean IsFileExists( const char *filename ) /* ============ -GetFileSize +GetFileSize ============ */ off_t GetFileSize( FILE *fp ) @@ -70,7 +70,7 @@ byte *LoadFile( const char *filename ) if( !fp ) return NULL; - + size = GetFileSize( fp ); buf = malloc( size ); diff --git a/vgui_support/vgui_main.h b/vgui_support/vgui_main.h index 89fc69e8..454ecbae 100644 --- a/vgui_support/vgui_main.h +++ b/vgui_support/vgui_main.h @@ -77,7 +77,7 @@ private: void InitVertex( vpoint_t &vertex, int x, int y, float u, float v ); public: CEngineSurface( Panel *embeddedPanel ); - ~CEngineSurface(); + ~CEngineSurface(); public: virtual Panel *getEmbeddedPanel( void ); virtual bool setFullscreenMode( int wide, int tall, int bpp );