diff --git a/TODO b/TODO index b3de9bb0..d0b1414f 100644 --- a/TODO +++ b/TODO @@ -7,6 +7,7 @@ game.so: - Integrate knightmares savegame system - Merge CTF with baseq2 (most other sourceports have done this) - No bodyqueue in single player +- Move q_shared.* into src/common? client: - Integrate a signalhandler and print an backtrace with Maxims diff --git a/src/game/baseq2/q_shared.c b/src/game/baseq2/q_shared.c index 65b8ba77..ec84aa0c 100644 --- a/src/game/baseq2/q_shared.c +++ b/src/game/baseq2/q_shared.c @@ -1,46 +1,55 @@ /* -Copyright (C) 1997-2001 Id Software, Inc. + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * Support functions, linked into client, server, renderer and game. + * + * ======================================================================= + */ -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ #include "q_shared.h" -#define DEG2RAD( a ) ( a * M_PI ) / 180.0F +#define DEG2RAD(a) (a * M_PI) / 180.0F -vec3_t vec3_origin = {0,0,0}; +vec3_t vec3_origin = {0, 0, 0}; -//============================================================================ +/* ============================================================================ */ -void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ) +void +RotatePointAroundVector(vec3_t dst, const vec3_t dir, + const vec3_t point, float degrees) { - float m[3][3]; - float im[3][3]; - float zrot[3][3]; - float tmpmat[3][3]; - float rot[3][3]; - int i; + float m[3][3]; + float im[3][3]; + float zrot[3][3]; + float tmpmat[3][3]; + float rot[3][3]; + int i; vec3_t vr, vup, vf; vf[0] = dir[0]; vf[1] = dir[1]; vf[2] = dir[2]; - PerpendicularVector( vr, dir ); - CrossProduct( vr, vf, vup ); + PerpendicularVector(vr, dir); + CrossProduct(vr, vf, vup); m[0][0] = vr[0]; m[1][0] = vr[1]; @@ -54,7 +63,7 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, m[1][2] = vf[1]; m[2][2] = vf[2]; - memcpy( im, m, sizeof( im ) ); + memcpy(im, m, sizeof(im)); im[0][1] = m[1][0]; im[0][2] = m[2][0]; @@ -63,90 +72,111 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, im[2][0] = m[0][2]; im[2][1] = m[1][2]; - memset( zrot, 0, sizeof( zrot ) ); + memset(zrot, 0, sizeof(zrot)); zrot[0][0] = zrot[1][1] = zrot[2][2] = 1.0F; - zrot[0][0] = (float)cos( DEG2RAD( degrees ) ); - zrot[0][1] = (float)sin( DEG2RAD( degrees ) ); - zrot[1][0] = (float)-sin( DEG2RAD( degrees ) ); - zrot[1][1] = (float)cos( DEG2RAD( degrees ) ); + zrot[0][0] = (float)cos(DEG2RAD(degrees)); + zrot[0][1] = (float)sin(DEG2RAD(degrees)); + zrot[1][0] = (float)-sin(DEG2RAD(degrees)); + zrot[1][1] = (float)cos(DEG2RAD(degrees)); - R_ConcatRotations( m, zrot, tmpmat ); - R_ConcatRotations( tmpmat, im, rot ); + R_ConcatRotations(m, zrot, tmpmat); + R_ConcatRotations(tmpmat, im, rot); - for ( i = 0; i < 3; i++ ) + for (i = 0; i < 3; i++) { - dst[i] = rot[i][0] * point[0] + rot[i][1] * point[1] + rot[i][2] * point[2]; + dst[i] = rot[i][0] * point[0] + rot[i][1] * point[1] + rot[i][2] * + point[2]; } } -void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) +void +AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) { - float angle; - static float sr, sp, sy, cr, cp, cy; - // static to help MS compiler fp bugs + float angle; + static float sr, sp, sy, cr, cp, cy; - angle = angles[YAW] * (M_PI*2 / 360); + angle = angles[YAW] * (M_PI * 2 / 360); sy = (float)sin(angle); cy = (float)cos(angle); - angle = angles[PITCH] * (M_PI*2 / 360); + angle = angles[PITCH] * (M_PI * 2 / 360); sp = (float)sin(angle); cp = (float)cos(angle); - angle = angles[ROLL] * (M_PI*2 / 360); + angle = angles[ROLL] * (M_PI * 2 / 360); sr = (float)sin(angle); cr = (float)cos(angle); if (forward) { - forward[0] = cp*cy; - forward[1] = cp*sy; + forward[0] = cp * cy; + forward[1] = cp * sy; forward[2] = -sp; } + if (right) { - right[0] = (-1*sr*sp*cy+-1*cr*-sy); - right[1] = (-1*sr*sp*sy+-1*cr*cy); - right[2] = -1*sr*cp; + right[0] = (-1 * sr * sp * cy + - 1 * cr * -sy); + right[1] = (-1 * sr * sp * sy + - 1 * cr * cy); + right[2] = -1 * sr * cp; } + if (up) { - up[0] = (cr*sp*cy+-sr*-sy); - up[1] = (cr*sp*sy+-sr*cy); - up[2] = cr*cp; + up[0] = (cr * sp * cy + - sr * -sy); + up[1] = (cr * sp * sy + - sr * cy); + up[2] = cr * cp; } } -void AngleVectors2 (vec3_t value1, vec3_t angles) { - float forward; - float yaw, pitch; +void +AngleVectors2(vec3_t value1, vec3_t angles) +{ + float forward; + float yaw, pitch; - if (value1[1] == 0 && value1[0] == 0) { + if ((value1[1] == 0) && (value1[0] == 0)) + { yaw = 0; if (value1[2] > 0) + { pitch = 90; + } else + { pitch = 270; - - } else { + } + } + else + { if (value1[0]) + { yaw = ((float)atan2(value1[1], value1[0]) * 180 / M_PI); + } else if (value1[1] > 0) + { yaw = 90; + } else + { yaw = 270; + } if (yaw < 0) + { yaw += 360; + } - forward = (float)sqrt (value1[0]*value1[0] + value1[1]*value1[1]); + forward = (float)sqrt(value1[0] * value1[0] + value1[1] * value1[1]); pitch = ((float)atan2(value1[2], forward) * 180 / M_PI); if (pitch < 0) + { pitch += 360; + } } angles[PITCH] = -pitch; @@ -154,15 +184,16 @@ void AngleVectors2 (vec3_t value1, vec3_t angles) { angles[ROLL] = 0; } -void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ) +void +ProjectPointOnPlane(vec3_t dst, const vec3_t p, const vec3_t normal) { float d; vec3_t n; float inv_denom; - inv_denom = 1.0F / DotProduct( normal, normal ); + inv_denom = 1.0F / DotProduct(normal, normal); - d = DotProduct( normal, p ) * inv_denom; + d = DotProduct(normal, p) * inv_denom; n[0] = normal[0] * inv_denom; n[1] = normal[1] * inv_denom; @@ -173,49 +204,37 @@ void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ) dst[2] = p[2] - d * n[2]; } -/* -** assumes "src" is normalized -*/ -void PerpendicularVector( vec3_t dst, const vec3_t src ) +/* assumes "src" is normalized */ +void +PerpendicularVector(vec3_t dst, const vec3_t src) { - int pos; + int pos; int i; float minelem = 1.0F; vec3_t tempvec; - /* - ** find the smallest magnitude axially aligned vector - */ - for ( pos = 0, i = 0; i < 3; i++ ) + /* find the smallest magnitude axially aligned vector */ + for (pos = 0, i = 0; i < 3; i++) { - if ( fabs( src[i] ) < minelem ) + if (fabs(src[i]) < minelem) { pos = i; - minelem = (float)fabs( src[i] ); + minelem = (float)fabs(src[i]); } } + tempvec[0] = tempvec[1] = tempvec[2] = 0.0F; tempvec[pos] = 1.0F; - /* - ** project the point onto the plane defined by src - */ - ProjectPointOnPlane( dst, tempvec, src ); + /* project the point onto the plane defined by src */ + ProjectPointOnPlane(dst, tempvec, src); - /* - ** normalize the result - */ - VectorNormalize( dst ); + /* normalize the result */ + VectorNormalize(dst); } - - -/* -================ -R_ConcatRotations -================ -*/ -void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]) +void +R_ConcatRotations(float in1[3][3], float in2[3][3], float out[3][3]) { out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0]; @@ -237,13 +256,8 @@ void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]) in1[2][2] * in2[2][2]; } - -/* -================ -R_ConcatTransforms -================ -*/ -void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]) +void +R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]) { out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0]; @@ -271,52 +285,55 @@ void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]) in1[2][2] * in2[2][3] + in1[2][3]; } +/* ============================================================================ */ -//============================================================================ - - -float Q_fabs (float f) +float +Q_fabs(float f) { - int tmp = * ( int * ) &f; + int tmp = *(int *)&f; + tmp &= 0x7FFFFFFF; - return * ( float * ) &tmp; + return *(float *)&tmp; } -/* -=============== -LerpAngle - -=============== -*/ -float LerpAngle (float a2, float a1, float frac) +float +LerpAngle(float a2, float a1, float frac) { if (a1 - a2 > 180) + { a1 -= 360; + } + if (a1 - a2 < -180) + { a1 += 360; + } + return a2 + frac * (a1 - a2); } - -float anglemod(float a) +float +anglemod(float a) { - a = (360.0/65536) * ((int)(a*(65536/360.0)) & 65535); + a = (360.0 / 65536) * ((int)(a * (65536 / 360.0)) & 65535); return a; } - int i; - vec3_t corners[2]; +int i; +vec3_t corners[2]; - -// this is the slow, general version -int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p) +/* + * This is the slow, general version + */ +int +BoxOnPlaneSide2(vec3_t emins, vec3_t emaxs, struct cplane_s *p) { - int i; - float dist1, dist2; - int sides; - vec3_t corners[2]; + int i; + float dist1, dist2; + int sides; + vec3_t corners[2]; - for (i=0 ; i<3 ; i++) + for (i = 0; i < 3; i++) { if (p->normal[i] < 0) { @@ -329,429 +346,524 @@ int BoxOnPlaneSide2 (vec3_t emins, vec3_t emaxs, struct cplane_s *p) corners[0][i] = emaxs[i]; } } - dist1 = DotProduct (p->normal, corners[0]) - p->dist; - dist2 = DotProduct (p->normal, corners[1]) - p->dist; + + dist1 = DotProduct(p->normal, corners[0]) - p->dist; + dist2 = DotProduct(p->normal, corners[1]) - p->dist; sides = 0; + if (dist1 >= 0) + { sides = 1; + } + if (dist2 < 0) + { sides |= 2; + } return sides; } /* -================== -BoxOnPlaneSide - -Returns 1, 2, or 1 + 2 -================== -*/ -int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *p) + * Returns 1, 2, or 1 + 2 + */ +int +BoxOnPlaneSide(vec3_t emins, vec3_t emaxs, struct cplane_s *p) { - float dist1, dist2; - int sides; + float dist1, dist2; + int sides; - // fast axial cases + /* fast axial cases */ if (p->type < 3) { if (p->dist <= emins[p->type]) + { return 1; + } + if (p->dist >= emaxs[p->type]) + { return 2; + } + return 3; } - - // general case + + /* general case */ switch (p->signbits) { - case 0: - dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; - dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; - break; - case 1: - dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; - dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; - break; - case 2: - dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; - dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; - break; - case 3: - dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; - dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; - break; - case 4: - dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; - dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; - break; - case 5: - dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2]; - dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2]; - break; - case 6: - dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; - dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; - break; - case 7: - dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2]; - dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2]; - break; - default: - dist1 = dist2 = 0; // shut up compiler - break; + case 0: + dist1 = p->normal[0] * emaxs[0] + p->normal[1] * emaxs[1] + + p->normal[2] * emaxs[2]; + dist2 = p->normal[0] * emins[0] + p->normal[1] * emins[1] + + p->normal[2] * emins[2]; + break; + case 1: + dist1 = p->normal[0] * emins[0] + p->normal[1] * emaxs[1] + + p->normal[2] * emaxs[2]; + dist2 = p->normal[0] * emaxs[0] + p->normal[1] * emins[1] + + p->normal[2] * emins[2]; + break; + case 2: + dist1 = p->normal[0] * emaxs[0] + p->normal[1] * emins[1] + + p->normal[2] * emaxs[2]; + dist2 = p->normal[0] * emins[0] + p->normal[1] * emaxs[1] + + p->normal[2] * emins[2]; + break; + case 3: + dist1 = p->normal[0] * emins[0] + p->normal[1] * emins[1] + + p->normal[2] * emaxs[2]; + dist2 = p->normal[0] * emaxs[0] + p->normal[1] * emaxs[1] + + p->normal[2] * emins[2]; + break; + case 4: + dist1 = p->normal[0] * emaxs[0] + p->normal[1] * emaxs[1] + + p->normal[2] * emins[2]; + dist2 = p->normal[0] * emins[0] + p->normal[1] * emins[1] + + p->normal[2] * emaxs[2]; + break; + case 5: + dist1 = p->normal[0] * emins[0] + p->normal[1] * emaxs[1] + + p->normal[2] * emins[2]; + dist2 = p->normal[0] * emaxs[0] + p->normal[1] * emins[1] + + p->normal[2] * emaxs[2]; + break; + case 6: + dist1 = p->normal[0] * emaxs[0] + p->normal[1] * emins[1] + + p->normal[2] * emins[2]; + dist2 = p->normal[0] * emins[0] + p->normal[1] * emaxs[1] + + p->normal[2] * emaxs[2]; + break; + case 7: + dist1 = p->normal[0] * emins[0] + p->normal[1] * emins[1] + + p->normal[2] * emins[2]; + dist2 = p->normal[0] * emaxs[0] + p->normal[1] * emaxs[1] + + p->normal[2] * emaxs[2]; + break; + default: + dist1 = dist2 = 0; + break; } sides = 0; + if (dist1 >= p->dist) + { sides = 1; + } + if (dist2 < p->dist) + { sides |= 2; + } return sides; } -void ClearBounds (vec3_t mins, vec3_t maxs) - { - mins[0] = mins[1] = mins[2] = 99999; - maxs[0] = maxs[1] = maxs[2] = -99999; - } - -void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs) +void +ClearBounds(vec3_t mins, vec3_t maxs) { - int i; - vec_t val; + mins[0] = mins[1] = mins[2] = 99999; + maxs[0] = maxs[1] = maxs[2] = -99999; +} - for (i=0 ; i<3 ; i++) +void +AddPointToBounds(vec3_t v, vec3_t mins, vec3_t maxs) +{ + int i; + vec_t val; + + for (i = 0; i < 3; i++) { val = v[i]; + if (val < mins[i]) + { mins[i] = val; + } + if (val > maxs[i]) + { maxs[i] = val; + } } } - -int VectorCompare (vec3_t v1, vec3_t v2) +int +VectorCompare(vec3_t v1, vec3_t v2) { - if (v1[0] != v2[0] || v1[1] != v2[1] || v1[2] != v2[2]) - return 0; - + if ((v1[0] != v2[0]) || (v1[1] != v2[1]) || (v1[2] != v2[2])) + { + return 0; + } + return 1; } - -vec_t VectorNormalize (vec3_t v) +vec_t +VectorNormalize(vec3_t v) { - float length, ilength; + float length, ilength; - length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - length = (float)sqrt (length); // FIXME + length = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; + length = (float)sqrt(length); if (length) { - ilength = 1/length; + ilength = 1 / length; v[0] *= ilength; v[1] *= ilength; v[2] *= ilength; } - - return length; + return length; } -vec_t VectorNormalize2 (vec3_t v, vec3_t out) +vec_t +VectorNormalize2(vec3_t v, vec3_t out) { - float length, ilength; + float length, ilength; - length = v[0]*v[0] + v[1]*v[1] + v[2]*v[2]; - length = (float)sqrt (length); // FIXME + length = v[0] * v[0] + v[1] * v[1] + v[2] * v[2]; + length = (float)sqrt(length); if (length) { - ilength = 1/length; - out[0] = v[0]*ilength; - out[1] = v[1]*ilength; - out[2] = v[2]*ilength; + ilength = 1 / length; + out[0] = v[0] * ilength; + out[1] = v[1] * ilength; + out[2] = v[2] * ilength; } - + return length; - } -void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc) +void +VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc) { - vecc[0] = veca[0] + scale*vecb[0]; - vecc[1] = veca[1] + scale*vecb[1]; - vecc[2] = veca[2] + scale*vecb[2]; -} - -vec_t _DotProduct (vec3_t v1, vec3_t v2) -{ - return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2]; + vecc[0] = veca[0] + scale * vecb[0]; + vecc[1] = veca[1] + scale * vecb[1]; + vecc[2] = veca[2] + scale * vecb[2]; } -void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out) +vec_t +_DotProduct(vec3_t v1, vec3_t v2) { - out[0] = veca[0]-vecb[0]; - out[1] = veca[1]-vecb[1]; - out[2] = veca[2]-vecb[2]; + return v1[0] * v2[0] + v1[1] * v2[1] + v1[2] * v2[2]; } -void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out) +void +_VectorSubtract(vec3_t veca, vec3_t vecb, vec3_t out) { - out[0] = veca[0]+vecb[0]; - out[1] = veca[1]+vecb[1]; - out[2] = veca[2]+vecb[2]; + out[0] = veca[0] - vecb[0]; + out[1] = veca[1] - vecb[1]; + out[2] = veca[2] - vecb[2]; } -void _VectorCopy (vec3_t in, vec3_t out) +void +_VectorAdd(vec3_t veca, vec3_t vecb, vec3_t out) +{ + out[0] = veca[0] + vecb[0]; + out[1] = veca[1] + vecb[1]; + out[2] = veca[2] + vecb[2]; +} + +void +_VectorCopy(vec3_t in, vec3_t out) { out[0] = in[0]; out[1] = in[1]; out[2] = in[2]; } -void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross) +void +CrossProduct(vec3_t v1, vec3_t v2, vec3_t cross) { - cross[0] = v1[1]*v2[2] - v1[2]*v2[1]; - cross[1] = v1[2]*v2[0] - v1[0]*v2[2]; - cross[2] = v1[0]*v2[1] - v1[1]*v2[0]; -} + cross[0] = v1[1] * v2[2] - v1[2] * v2[1]; + cross[1] = v1[2] * v2[0] - v1[0] * v2[2]; + cross[2] = v1[0] * v2[1] - v1[1] * v2[0]; +} double sqrt(double x); -vec_t VectorLength(vec3_t v) +vec_t +VectorLength(vec3_t v) { - int i; - float length; - + int i; + float length; + length = 0; - for (i=0 ; i< 3 ; i++) - length += v[i]*v[i]; - length = (float)sqrt (length); // FIXME + + for (i = 0; i < 3; i++) + { + length += v[i] * v[i]; + } + + length = (float)sqrt(length); return length; } -void VectorInverse (vec3_t v) +void +VectorInverse(vec3_t v) { v[0] = -v[0]; v[1] = -v[1]; v[2] = -v[2]; } -void VectorScale (vec3_t in, vec_t scale, vec3_t out) +void +VectorScale(vec3_t in, vec_t scale, vec3_t out) { - out[0] = in[0]*scale; - out[1] = in[1]*scale; - out[2] = in[2]*scale; + out[0] = in[0] * scale; + out[1] = in[1] * scale; + out[2] = in[2] * scale; } -int Q_log2(int val) +int +Q_log2(int val) { - int answer=0; - while (val>>=1) + int answer = 0; + + while (val >>= 1) + { answer++; + } + return answer; } +/* ==================================================================================== */ - -//==================================================================================== - -/* -============ -COM_SkipPath -============ -*/ -char *COM_SkipPath (char *pathname) +char * +COM_SkipPath(char *pathname) { - char *last; - + char *last; + last = pathname; + while (*pathname) { - if (*pathname=='/') - last = pathname+1; + if (*pathname == '/') + { + last = pathname + 1; + } + pathname++; } + return last; } -/* -============ -COM_StripExtension -============ -*/ -void COM_StripExtension (char *in, char *out) +void +COM_StripExtension(char *in, char *out) { while (*in && *in != '.') + { *out++ = *in++; + } + *out = 0; } -/* -============ -COM_FileExtension -============ -*/ -char *COM_FileExtension (char *in) +char * +COM_FileExtension(char *in) { static char exten[8]; - int i; + int i; while (*in && *in != '.') + { in++; + } + if (!*in) + { return ""; + } + in++; - for (i=0 ; i<7 && *in ; i++,in++) + + for (i = 0; i < 7 && *in; i++, in++) + { exten[i] = *in; + } + exten[i] = 0; return exten; } -/* -============ -COM_FileBase -============ -*/ -void COM_FileBase (char *in, char *out) +void +COM_FileBase(char *in, char *out) { char *s, *s2; - + s = in + strlen(in) - 1; - + while (s != in && *s != '.') + { s--; - - for (s2 = s ; s2 != in && *s2 != '/' ; s2--) - ; - - if (s-s2 < 2) + } + + for (s2 = s; s2 != in && *s2 != '/'; s2--) + { + } + + if (s - s2 < 2) + { out[0] = 0; + } else { s--; - strncpy (out,s2+1, s-s2); - out[s-s2] = 0; + strncpy(out, s2 + 1, s - s2); + out[s - s2] = 0; } } /* -============ -COM_FilePath - -Returns the path up to, but not including the last / -============ -*/ -void COM_FilePath (const char *in, char *out) + * Returns the path up to, but not including the last / + */ +void +COM_FilePath(const char *in, char *out) { const char *s; - - s = in + strlen(in) - 1; - - while (s != in && *s != '/') - s--; - strncpy (out,in, s-in); - out[s-in] = 0; + s = in + strlen(in) - 1; + + while (s != in && *s != '/') + { + s--; + } + + strncpy(out, in, s - in); + out[s - in] = 0; } - -/* -================== -COM_DefaultExtension -================== -*/ -void COM_DefaultExtension (char *path, const char *extension) +void +COM_DefaultExtension(char *path, const char *extension) { - char *src; - // - // if path doesn't have a .EXT, append extension - // (extension should include the .) - // + char *src; + + /* */ + /* if path doesn't have a .EXT, append extension */ + /* (extension should include the .) */ + /* */ src = path + strlen(path) - 1; while (*src != '/' && src != path) { if (*src == '.') - return; // it has an extension + { + return; /* it has an extension */ + } + src--; } - strcat (path, extension); + strcat(path, extension); } /* -============================================================================ + * ============================================================================ + * + * BYTE ORDER FUNCTIONS + * + * ============================================================================ + */ - BYTE ORDER FUNCTIONS +qboolean bigendien; -============================================================================ -*/ +/* can't just use function pointers, or dll linkage can + mess up when qcommon is included in multiple places */ +short (*_BigShort)(short l); +short (*_LittleShort)(short l); +int (*_BigLong)(int l); +int (*_LittleLong)(int l); +float (*_BigFloat)(float l); +float (*_LittleFloat)(float l); -qboolean bigendien; - -// can't just use function pointers, or dll linkage can -// mess up when qcommon is included in multiple places -short (*_BigShort) (short l); -short (*_LittleShort) (short l); -int (*_BigLong) (int l); -int (*_LittleLong) (int l); -float (*_BigFloat) (float l); -float (*_LittleFloat) (float l); - -short BigShort(short l){return _BigShort(l);} -short LittleShort(short l) {return _LittleShort(l);} -int BigLong (int l) {return _BigLong(l);} -int LittleLong (int l) {return _LittleLong(l);} -float BigFloat (float l) {return _BigFloat(l);} -float LittleFloat (float l) {return _LittleFloat(l);} - -short ShortSwap (short l) +short +BigShort(short l) { - byte b1,b2; - - b1 = l&255; - b2 = (l>>8)&255; - - return (b1<<8) + b2; + return _BigShort(l); } -short ShortNoSwap (short l) +short +LittleShort(short l) +{return + _LittleShort(l); +} + +int +BigLong(int l) +{ + return _BigLong(l); +} + +int +LittleLong(int l) +{ + return _LittleLong(l); +} + +float +BigFloat(float l) +{ + return _BigFloat(l); +} + +float +LittleFloat(float l) +{ + return _LittleFloat(l); +} + +short +ShortSwap(short l) +{ + byte b1, b2; + + b1 = l & 255; + b2 = (l >> 8) & 255; + + return (b1 << 8) + b2; +} + +short +ShortNoSwap(short l) { return l; } -int LongSwap (int l) +int +LongSwap(int l) { - byte b1,b2,b3,b4; + byte b1, b2, b3, b4; - b1 = l&255; - b2 = (l>>8)&255; - b3 = (l>>16)&255; - b4 = (l>>24)&255; + b1 = l & 255; + b2 = (l >> 8) & 255; + b3 = (l >> 16) & 255; + b4 = (l >> 24) & 255; - return ((int)b1<<24) + ((int)b2<<16) + ((int)b3<<8) + b4; + return ((int)b1 << 24) + ((int)b2 << 16) + ((int)b3 << 8) + b4; } -int LongNoSwap (int l) +int +LongNoSwap(int l) { return l; } -float FloatSwap (float f) +float +FloatSwap(float f) { union { - float f; - byte b[4]; + float f; + byte b[4]; } dat1, dat2; - - + dat1.f = f; dat2.b[0] = dat1.b[3]; dat2.b[1] = dat1.b[2]; @@ -760,22 +872,19 @@ float FloatSwap (float f) return dat2.f; } -float FloatNoSwap (float f) +float +FloatNoSwap(float f) { return f; } -/* -================ -Swap_Init -================ -*/ -void Swap_Init (void) +void +Swap_Init(void) { - byte swaptest[2] = {1,0}; + byte swaptest[2] = {1, 0}; - // set the byte swapping variables in a portable manner - if ( *(short *)swaptest == 1) + /* set the byte swapping variables in a portable manner */ + if (*(short *)swaptest == 1) { bigendien = false; _BigShort = ShortSwap; @@ -795,91 +904,87 @@ void Swap_Init (void) _BigFloat = FloatNoSwap; _LittleFloat = FloatSwap; } - } - - /* -============ -va - -does a varargs printf into a temp buffer, so I don't need to have -varargs versions of all text functions. -FIXME: make this buffer size safe someday -============ -*/ -char *va(char *format, ...) + * does a varargs printf into a temp buffer, so I don't + * need to have varargs versions of all text functions. + */ +char * +va(char *format, ...) { - va_list argptr; - static char string[1024]; - - va_start (argptr, format); - vsnprintf (string, 1024, format, argptr); - va_end (argptr); + va_list argptr; + static char string[1024]; - return string; + va_start(argptr, format); + vsnprintf(string, 1024, format, argptr); + va_end(argptr); + + return string; } - -char com_token[MAX_TOKEN_CHARS]; +char com_token[MAX_TOKEN_CHARS]; /* -============== -COM_Parse - -Parse a token out of a string -============== -*/ -char *COM_Parse (char **data_p) + * Parse a token out of a string + */ +char * +COM_Parse(char **data_p) { - int c; - int len; - char *data; + int c; + int len; + char *data; data = *data_p; len = 0; com_token[0] = 0; - + if (!data) { *data_p = NULL; return ""; } - - // skip whitespace + skipwhite: - while ( (c = *data) <= ' ') + + while ((c = *data) <= ' ') { if (c == 0) { *data_p = NULL; return ""; } + data++; } - - // skip // comments - if (c=='/' && data[1] == '/') + + /* skip // comments */ + if ((c == '/') && (data[1] == '/')) { while (*data && *data != '\n') + { data++; + } + goto skipwhite; } - // handle quoted strings specially + /* handle quoted strings specially */ if (c == '\"') { data++; + while (1) { c = *data++; - if (c=='\"' || !c) + + if ((c == '\"') || !c) { com_token[len] = 0; *data_p = data; return com_token; } + if (len < MAX_TOKEN_CHARS) { com_token[len] = c; @@ -888,7 +993,7 @@ skipwhite: } } - // parse a regular word + /* parse a regular word */ do { if (len < MAX_TOKEN_CHARS) @@ -896,143 +1001,158 @@ skipwhite: com_token[len] = c; len++; } + data++; c = *data; - } while (c>32); + } + while (c > 32); if (len == MAX_TOKEN_CHARS) { len = 0; } + com_token[len] = 0; *data_p = data; return com_token; } +int paged_total; -/* -=============== -Com_PageInMemory - -=============== -*/ -int paged_total; - -void Com_PageInMemory (byte *buffer, int size) +void +Com_PageInMemory(byte *buffer, int size) { - int i; + int i; - for (i=size-1 ; i>0 ; i-=4096) + for (i = size - 1; i > 0; i -= 4096) + { paged_total += buffer[i]; + } } - - /* -============================================================================ + * ============================================================================ + * + * LIBRARY REPLACEMENT FUNCTIONS + * + * ============================================================================ + */ - LIBRARY REPLACEMENT FUNCTIONS - -============================================================================ -*/ - -/* PATCH: matt */ -/* use our own strncasecmp instead of this implementation */ -// FIXME: replace all Q_stricmp with Q_strcasecmp -int Q_stricmp (const char *s1, const char *s2) +int +Q_stricmp(const char *s1, const char *s2) { - return strcasecmp (s1, s2); + return strcasecmp(s1, s2); } - -int Q_strncasecmp (char *s1, char *s2, int n) +int +Q_strncasecmp(char *s1, char *s2, int n) { - int c1, c2; - + int c1, c2; + do { c1 = *s1++; c2 = *s2++; if (!n--) - return 0; // strings are equal until end point - + { + return 0; /* strings are equal until end point */ + } + if (c1 != c2) { - if (c1 >= 'a' && c1 <= 'z') + if ((c1 >= 'a') && (c1 <= 'z')) + { c1 -= ('a' - 'A'); - if (c2 >= 'a' && c2 <= 'z') + } + + if ((c2 >= 'a') && (c2 <= 'z')) + { c2 -= ('a' - 'A'); + } + if (c1 != c2) - return -1; // strings not equal + { + return -1; /* strings not equal */ + } } - } while (c1); - - return 0; // strings are equal -} - -int Q_strcasecmp (char *s1, char *s2) -{ - return Q_strncasecmp (s1, s2, 99999); -} - - - -void Com_sprintf (char *dest, int size, char *fmt, ...) -{ - int len; - va_list argptr; - static char bigbuffer[0x10000]; - - va_start (argptr,fmt); - len = vsnprintf (bigbuffer,0x10000,fmt,argptr); - va_end (argptr); - if (len >= size || len == size) - { - Com_Printf ("Com_sprintf: overflow\n"); - len = size-1; } - bigbuffer[size-1] = '\0'; - strcpy (dest, bigbuffer); + while (c1); + + return 0; /* strings are equal */ +} + +int +Q_strcasecmp(char *s1, char *s2) +{ + return Q_strncasecmp(s1, s2, 99999); +} + +void +Com_sprintf(char *dest, int size, char *fmt, ...) +{ + int len; + va_list argptr; + static char bigbuffer[0x10000]; + + va_start(argptr, fmt); + len = vsnprintf(bigbuffer, 0x10000, fmt, argptr); + va_end(argptr); + + if ((len >= size) || (len == size)) + { + Com_Printf("Com_sprintf: overflow\n"); + len = size - 1; + } + + bigbuffer[size - 1] = '\0'; + strcpy(dest, bigbuffer); } /* -===================================================================== - - INFO STRINGS - -===================================================================== -*/ + * ===================================================================== + * + * INFO STRINGS + * + * ===================================================================== + */ /* -=============== -Info_ValueForKey - -Searches the string for the given -key and returns the associated value, or an empty string. -=============== -*/ -char *Info_ValueForKey (char *s, char *key) + * Searches the string for the given + * key and returns the associated value, + * or an empty string. + */ +char * +Info_ValueForKey(char *s, char *key) { - char pkey[512]; - static char value[2][512]; // use two buffers so compares - // work without stomping on each other - static int valueindex; - char *o; - + char pkey[512]; + static char value[2][512]; /* use two buffers so compares + work without stomping on each other */ + static int valueindex; + char *o; + valueindex ^= 1; + if (*s == '\\') + { s++; + } + while (1) { o = pkey; + while (*s != '\\') { if (!*s) + { return ""; + } + *o++ = *s++; } + *o = 0; s++; @@ -1041,28 +1161,38 @@ char *Info_ValueForKey (char *s, char *key) while (*s != '\\' && *s) { if (!*s) + { return ""; + } + *o++ = *s++; } + *o = 0; - if (!strcmp (key, pkey) ) + if (!strcmp(key, pkey)) + { return value[valueindex]; + } if (!*s) + { return ""; + } + s++; } } -void Info_RemoveKey (char *s, char *key) +void +Info_RemoveKey(char *s, char *key) { - char *start; - char pkey[512]; - char value[512]; - char *o; + char *start; + char pkey[512]; + char value[512]; + char *o; - if (strstr (key, "\\")) + if (strstr(key, "\\")) { return; } @@ -1070,108 +1200,135 @@ void Info_RemoveKey (char *s, char *key) while (1) { start = s; + if (*s == '\\') + { s++; + } + o = pkey; + while (*s != '\\') { if (!*s) + { return; + } + *o++ = *s++; } + *o = 0; s++; o = value; + while (*s != '\\' && *s) { if (!*s) + { return; + } + *o++ = *s++; } + *o = 0; - if (!strcmp (key, pkey) ) + if (!strcmp(key, pkey)) { - strcpy (start, s); // remove this part + strcpy(start, s); /* remove this part */ return; } if (!*s) + { return; + } } - } - /* -================== -Info_Validate - -Some characters are illegal in info strings because they -can mess up the server's parsing -================== -*/ -qboolean Info_Validate (char *s) + * Some characters are illegal in info strings + * because they can mess up the server's parsing + */ +qboolean +Info_Validate(char *s) { - if (strstr (s, "\"")) + if (strstr(s, "\"")) + { return false; - if (strstr (s, ";")) + } + + if (strstr(s, ";")) + { return false; + } + return true; } -void Info_SetValueForKey (char *s, char *key, char *value) +void +Info_SetValueForKey(char *s, char *key, char *value) { - char newi[MAX_INFO_STRING], *v; - int c; - int maxsize = MAX_INFO_STRING; + char newi[MAX_INFO_STRING], *v; + int c; + int maxsize = MAX_INFO_STRING; - if (strstr (key, "\\") || strstr (value, "\\") ) + if (strstr(key, "\\") || strstr(value, "\\")) { - Com_Printf ("Can't use keys or values with a \\\n"); + Com_Printf("Can't use keys or values with a \\\n"); return; } - if (strstr (key, ";") ) + if (strstr(key, ";")) { - Com_Printf ("Can't use keys or values with a semicolon\n"); + Com_Printf("Can't use keys or values with a semicolon\n"); return; } - if (strstr (key, "\"") || strstr (value, "\"") ) + if (strstr(key, "\"") || strstr(value, "\"")) { - Com_Printf ("Can't use keys or values with a \"\n"); + Com_Printf("Can't use keys or values with a \"\n"); return; } - if (strlen(key) > MAX_INFO_KEY-1 || strlen(value) > MAX_INFO_KEY-1) + if ((strlen(key) > MAX_INFO_KEY - 1) || (strlen(value) > MAX_INFO_KEY - 1)) { - Com_Printf ("Keys and values must be < 64 characters.\n"); + Com_Printf("Keys and values must be < 64 characters.\n"); return; } - Info_RemoveKey (s, key); + + Info_RemoveKey(s, key); + if (!value || !strlen(value)) + { return; + } - Com_sprintf (newi, sizeof(newi), "\\%s\\%s", key, value); + Com_sprintf(newi, sizeof(newi), "\\%s\\%s", key, value); if (strlen(newi) + strlen(s) > maxsize) { - Com_Printf ("Info string length exceeded\n"); + Com_Printf("Info string length exceeded\n"); return; } - // only copy ascii values + /* only copy ascii values */ s += strlen(s); v = newi; + while (*v) { c = *v++; - c &= 127; // strip high bits - if (c >= 32 && c < 127) + c &= 127; /* strip high bits */ + + if ((c >= 32) && (c < 127)) + { *s++ = c; + } } + *s = 0; } diff --git a/src/game/baseq2/q_shared.h b/src/game/baseq2/q_shared.h index e4f94809..c744ab10 100644 --- a/src/game/baseq2/q_shared.h +++ b/src/game/baseq2/q_shared.h @@ -1,24 +1,29 @@ /* -Copyright (C) 1997-2001 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ - -// q_shared.h -- included first by ALL program modules + * Copyright (C) 1997-2001 Id Software, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * ======================================================================= + * + * This is the main header file shared between client, renderer, server + * and the game. + * + * ======================================================================= + */ #include #include @@ -28,851 +33,803 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -typedef unsigned char byte; -typedef enum {false, true} qboolean; - +typedef unsigned char byte; +typedef enum {false, true} qboolean; #ifndef NULL -#define NULL ((void *)0) + #define NULL ((void *)0) #endif +/* angle indexes */ +#define PITCH 0 /* up / down */ +#define YAW 1 /* left / right */ +#define ROLL 2 /* fall over */ -// angle indexes -#define PITCH 0 // up / down -#define YAW 1 // left / right -#define ROLL 2 // fall over +#define MAX_STRING_CHARS 1024 /* max length of a string passed to Cmd_TokenizeString */ +#define MAX_STRING_TOKENS 80 /* max tokens resulting from Cmd_TokenizeString */ +#define MAX_TOKEN_CHARS 128 /* max length of an individual token */ -#define MAX_STRING_CHARS 1024 // max length of a string passed to Cmd_TokenizeString -#define MAX_STRING_TOKENS 80 // max tokens resulting from Cmd_TokenizeString -#define MAX_TOKEN_CHARS 128 // max length of an individual token +#define MAX_QPATH 64 /* max length of a quake game pathname */ +#define MAX_OSPATH 128 /* max length of a filesystem pathname */ -#define MAX_QPATH 64 // max length of a quake game pathname -#define MAX_OSPATH 128 // max length of a filesystem pathname +/* */ +/* per-level limits */ +/* */ +#define MAX_CLIENTS 256 /* absolute limit */ +#define MAX_EDICTS 1024 /* must change protocol to increase more */ +#define MAX_LIGHTSTYLES 256 +#define MAX_MODELS 256 /* these are sent over the net as bytes */ +#define MAX_SOUNDS 256 /* so they cannot be blindly increased */ +#define MAX_IMAGES 256 +#define MAX_ITEMS 256 +#define MAX_GENERAL (MAX_CLIENTS * 2) /* general config strings */ -// -// per-level limits -// -#define MAX_CLIENTS 256 // absolute limit -#define MAX_EDICTS 1024 // must change protocol to increase more -#define MAX_LIGHTSTYLES 256 -#define MAX_MODELS 256 // these are sent over the net as bytes -#define MAX_SOUNDS 256 // so they cannot be blindly increased -#define MAX_IMAGES 256 -#define MAX_ITEMS 256 -#define MAX_GENERAL (MAX_CLIENTS*2) // general config strings +/* game print flags */ +#define PRINT_LOW 0 /* pickup messages */ +#define PRINT_MEDIUM 1 /* death messages */ +#define PRINT_HIGH 2 /* critical messages */ +#define PRINT_CHAT 3 /* chat messages */ +#define ERR_FATAL 0 /* exit the entire game with a popup window */ +#define ERR_DROP 1 /* print to console and disconnect from game */ +#define ERR_DISCONNECT 2 /* don't kill server */ -// game print flags -#define PRINT_LOW 0 // pickup messages -#define PRINT_MEDIUM 1 // death messages -#define PRINT_HIGH 2 // critical messages -#define PRINT_CHAT 3 // chat messages +#define PRINT_ALL 0 +#define PRINT_DEVELOPER 1 /* only print when "developer 1" */ +#define PRINT_ALERT 2 - - -#define ERR_FATAL 0 // exit the entire game with a popup window -#define ERR_DROP 1 // print to console and disconnect from game -#define ERR_DISCONNECT 2 // don't kill server - -#define PRINT_ALL 0 -#define PRINT_DEVELOPER 1 // only print when "developer 1" -#define PRINT_ALERT 2 - - -// destination class for gi.multicast() +/* destination class for gi.multicast() */ typedef enum { -MULTICAST_ALL, -MULTICAST_PHS, -MULTICAST_PVS, -MULTICAST_ALL_R, -MULTICAST_PHS_R, -MULTICAST_PVS_R + MULTICAST_ALL, + MULTICAST_PHS, + MULTICAST_PVS, + MULTICAST_ALL_R, + MULTICAST_PHS_R, + MULTICAST_PVS_R } multicast_t; - /* -============================================================== - -MATHLIB - -============================================================== -*/ + * ============================================================== + * + * MATHLIB + * + * ============================================================== + */ typedef float vec_t; typedef vec_t vec3_t[3]; typedef vec_t vec5_t[5]; -typedef int fixed4_t; -typedef int fixed8_t; -typedef int fixed16_t; +typedef int fixed4_t; +typedef int fixed8_t; +typedef int fixed16_t; #ifndef M_PI -#define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h + #define M_PI 3.14159265358979323846 /* matches value in gcc v2 math.h */ #endif struct cplane_s; extern vec3_t vec3_origin; -#define nanmask (255<<23) +#define nanmask (255 << 23) -#define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) +#define IS_NAN(x) (((*(int *)&x) & nanmask) == nanmask) -// microsoft's fabs seems to be ungodly slow... -//float Q_fabs (float f); -//#define fabs(f) Q_fabs(f) -#define Q_ftol( f ) ( long ) (f) +#define Q_ftol(f) (long)(f) -#define DotProduct(x,y) (x[0]*y[0]+x[1]*y[1]+x[2]*y[2]) -#define VectorSubtract(a,b,c) (c[0]=a[0]-b[0],c[1]=a[1]-b[1],c[2]=a[2]-b[2]) -#define VectorAdd(a,b,c) (c[0]=a[0]+b[0],c[1]=a[1]+b[1],c[2]=a[2]+b[2]) -#define VectorCopy(a,b) (b[0]=a[0],b[1]=a[1],b[2]=a[2]) -#define VectorClear(a) (a[0]=a[1]=a[2]=0) -#define VectorNegate(a,b) (b[0]=-a[0],b[1]=-a[1],b[2]=-a[2]) -#define VectorSet(v, x, y, z) (v[0]=(x), v[1]=(y), v[2]=(z)) +#define DotProduct(x, y) (x[0] * y[0] + x[1] * y[1] + x[2] * y[2]) +#define VectorSubtract(a, b, c) (c[0] = a[0] - b[0], c[1] = a[1] - b[1], c[2] = \ + a[2] - b[2]) +#define VectorAdd(a, b, c) (c[0] = a[0] + b[0], c[1] = a[1] + b[1], c[2] = \ + a[2] + b[2]) +#define VectorCopy(a, b) (b[0] = a[0], b[1] = a[1], b[2] = a[2]) +#define VectorClear(a) (a[0] = a[1] = a[2] = 0) +#define VectorNegate(a, b) (b[0] = -a[0], b[1] = -a[1], b[2] = -a[2]) +#define VectorSet(v, x, y, z) (v[0] = (x), v[1] = (y), v[2] = (z)) -void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc); +void VectorMA(vec3_t veca, float scale, vec3_t vecb, vec3_t vecc); -// just in case you do't want to use the macros -vec_t _DotProduct (vec3_t v1, vec3_t v2); -void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); -void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); -void _VectorCopy (vec3_t in, vec3_t out); +/* just in case you do't want to use the macros */ +vec_t _DotProduct(vec3_t v1, vec3_t v2); +void _VectorSubtract(vec3_t veca, vec3_t vecb, vec3_t out); +void _VectorAdd(vec3_t veca, vec3_t vecb, vec3_t out); +void _VectorCopy(vec3_t in, vec3_t out); -void ClearBounds (vec3_t mins, vec3_t maxs); -void AddPointToBounds (vec3_t v, vec3_t mins, vec3_t maxs); -int VectorCompare (vec3_t v1, vec3_t v2); -vec_t VectorLength (vec3_t v); -void CrossProduct (vec3_t v1, vec3_t v2, vec3_t cross); -vec_t VectorNormalize (vec3_t v); // returns vector length -vec_t VectorNormalize2 (vec3_t v, vec3_t out); -void VectorInverse (vec3_t v); -void VectorScale (vec3_t in, vec_t scale, vec3_t out); +void ClearBounds(vec3_t mins, vec3_t maxs); +void AddPointToBounds(vec3_t v, vec3_t mins, vec3_t maxs); +int VectorCompare(vec3_t v1, vec3_t v2); +vec_t VectorLength(vec3_t v); +void CrossProduct(vec3_t v1, vec3_t v2, vec3_t cross); +vec_t VectorNormalize(vec3_t v); /* returns vector length */ +vec_t VectorNormalize2(vec3_t v, vec3_t out); +void VectorInverse(vec3_t v); +void VectorScale(vec3_t in, vec_t scale, vec3_t out); int Q_log2(int val); -void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); -void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); +void R_ConcatRotations(float in1[3][3], float in2[3][3], float out[3][3]); +void R_ConcatTransforms(float in1[3][4], float in2[3][4], float out[3][4]); -void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); -void AngleVectors2 (vec3_t value1, vec3_t angles); -int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct cplane_s *plane); -float anglemod(float a); -float LerpAngle (float a1, float a2, float frac); +void AngleVectors(vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); +void AngleVectors2(vec3_t value1, vec3_t angles); +int BoxOnPlaneSide(vec3_t emins, vec3_t emaxs, struct cplane_s *plane); +float anglemod(float a); +float LerpAngle(float a1, float a2, float frac); -#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ - (((p)->type < 3)? \ - ( \ - ((p)->dist <= (emins)[(p)->type])? \ - 1 \ - : \ - ( \ - ((p)->dist >= (emaxs)[(p)->type])?\ - 2 \ - : \ - 3 \ - ) \ - ) \ - : \ - BoxOnPlaneSide( (emins), (emaxs), (p))) +#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ + (((p)->type < 3) ? \ + ( \ + ((p)->dist <= (emins)[(p)->type]) ? \ + 1 \ + : \ + ( \ + ((p)->dist >= (emaxs)[(p)->type]) ? \ + 2 \ + : \ + 3 \ + ) \ + ) \ + : \ + BoxOnPlaneSide((emins), (emaxs), (p))) -void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal ); -void PerpendicularVector( vec3_t dst, const vec3_t src ); -void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point, float degrees ); +void ProjectPointOnPlane(vec3_t dst, const vec3_t p, const vec3_t normal); +void PerpendicularVector(vec3_t dst, const vec3_t src); +void RotatePointAroundVector(vec3_t dst, const vec3_t dir, + const vec3_t point, float degrees); +/* ============================================= */ -//============================================= +char *COM_SkipPath(char *pathname); +void COM_StripExtension(char *in, char *out); +void COM_FileBase(char *in, char *out); +void COM_FilePath(const char *in, char *out); +void COM_DefaultExtension(char *path, const char *extension); -char *COM_SkipPath (char *pathname); -void COM_StripExtension (char *in, char *out); -void COM_FileBase (char *in, char *out); -void COM_FilePath (const char *in, char *out); -void COM_DefaultExtension (char *path, const char *extension); +char *COM_Parse(char **data_p); -char *COM_Parse (char **data_p); -// data is an in/out parm, returns a parsed out token +/* data is an in/out parm, returns a parsed out token */ +void Com_sprintf(char *dest, int size, char *fmt, ...); -void Com_sprintf (char *dest, int size, char *fmt, ...); +void Com_PageInMemory(byte *buffer, int size); -void Com_PageInMemory (byte *buffer, int size); +/* ============================================= */ -//============================================= +/* portable case insensitive compare */ +int Q_stricmp(const char *s1, const char *s2); +int Q_strcasecmp(char *s1, char *s2); +int Q_strncasecmp(char *s1, char *s2, int n); -// portable case insensitive compare -int Q_stricmp (const char *s1, const char *s2); -int Q_strcasecmp (char *s1, char *s2); -int Q_strncasecmp (char *s1, char *s2, int n); +/* ============================================= */ -//============================================= +short BigShort(short l); +short LittleShort(short l); +int BigLong(int l); +int LittleLong(int l); +float BigFloat(float l); +float LittleFloat(float l); -short BigShort(short l); -short LittleShort(short l); -int BigLong (int l); -int LittleLong (int l); -float BigFloat (float l); -float LittleFloat (float l); +void Swap_Init(void); +char *va(char *format, ...); -void Swap_Init (void); -char *va(char *format, ...); +/* ============================================= */ -//============================================= +/* key / value info strings */ +#define MAX_INFO_KEY 64 +#define MAX_INFO_VALUE 64 +#define MAX_INFO_STRING 512 -// -// key / value info strings -// -#define MAX_INFO_KEY 64 -#define MAX_INFO_VALUE 64 -#define MAX_INFO_STRING 512 - -char *Info_ValueForKey (char *s, char *key); -void Info_RemoveKey (char *s, char *key); -void Info_SetValueForKey (char *s, char *key, char *value); -qboolean Info_Validate (char *s); +char *Info_ValueForKey(char *s, char *key); +void Info_RemoveKey(char *s, char *key); +void Info_SetValueForKey(char *s, char *key, char *value); +qboolean Info_Validate(char *s); /* -============================================================== + * ============================================================== + * + * SYSTEM SPECIFIC + * + * ============================================================== + */ -SYSTEM SPECIFIC +extern int curtime; /* time returned by last Sys_Milliseconds */ -============================================================== -*/ +int Sys_Milliseconds(void); +void Sys_Mkdir(char *path); +void Sys_Rmdir(char *path); +char *strlwr(char *s); -extern int curtime; // time returned by last Sys_Milliseconds +/* large block stack allocation routines */ +void *Hunk_Begin(int maxsize); +void *Hunk_Alloc(int size); +void Hunk_Free(void *buf); +int Hunk_End(void); -int Sys_Milliseconds (void); -void Sys_Mkdir (char *path); -void Sys_Rmdir(char *path); -char *strlwr (char *s); +/* directory searching */ +#define SFF_ARCH 0x01 +#define SFF_HIDDEN 0x02 +#define SFF_RDONLY 0x04 +#define SFF_SUBDIR 0x08 +#define SFF_SYSTEM 0x10 -// large block stack allocation routines -void *Hunk_Begin (int maxsize); -void *Hunk_Alloc (int size); -void Hunk_Free (void *buf); -int Hunk_End (void); +/* pass in an attribute mask of things you wish to REJECT */ +char *Sys_FindFirst(char *path, unsigned musthave, unsigned canthave); +char *Sys_FindNext(unsigned musthave, unsigned canthave); +void Sys_FindClose(void); -// directory searching -#define SFF_ARCH 0x01 -#define SFF_HIDDEN 0x02 -#define SFF_RDONLY 0x04 -#define SFF_SUBDIR 0x08 -#define SFF_SYSTEM 0x10 +/* this is only here so the functions in q_shared.c and q_shwin.c can link */ +void Sys_Error(char *error, ...); +void Com_Printf(char *msg, ...); /* -** pass in an attribute mask of things you wish to REJECT -*/ -char *Sys_FindFirst (char *path, unsigned musthave, unsigned canthave ); -char *Sys_FindNext ( unsigned musthave, unsigned canthave ); -void Sys_FindClose (void); - - -// this is only here so the functions in q_shared.c and q_shwin.c can link -void Sys_Error (char *error, ...); -void Com_Printf (char *msg, ...); - - -/* -========================================================== - -CVARS (console variables) - -========================================================== -*/ + * ========================================================== + * + * CVARS (console variables) + * + * ========================================================== + */ #ifndef CVAR -#define CVAR + #define CVAR -#define CVAR_ARCHIVE 1 // set to cause it to be saved to vars.rc -#define CVAR_USERINFO 2 // added to userinfo when changed -#define CVAR_SERVERINFO 4 // added to serverinfo when changed -#define CVAR_NOSET 8 // don't allow change from console at all, - // but can be set from the command line -#define CVAR_LATCH 16 // save changes until server restart + #define CVAR_ARCHIVE 1 /* set to cause it to be saved to vars.rc */ + #define CVAR_USERINFO 2 /* added to userinfo when changed */ + #define CVAR_SERVERINFO 4 /* added to serverinfo when changed */ + #define CVAR_NOSET 8 /* don't allow change from console at all, */ + /* but can be set from the command line */ + #define CVAR_LATCH 16 /* save changes until server restart */ -// nothing outside the Cvar_*() functions should modify these fields! +/* nothing outside the Cvar_*() functions should modify these fields! */ typedef struct cvar_s { - char *name; - char *string; - char *latched_string; // for CVAR_LATCH vars - int flags; - qboolean modified; // set each time the cvar is changed - float value; + char *name; + char *string; + char *latched_string; /* for CVAR_LATCH vars */ + int flags; + qboolean modified; /* set each time the cvar is changed */ + float value; struct cvar_s *next; } cvar_t; -#endif // CVAR +#endif /* CVAR */ /* -============================================================== + * ============================================================== + * + * COLLISION DETECTION + * + * ============================================================== + */ -COLLISION DETECTION +/* lower bits are stronger, and will eat weaker brushes completely */ +#define CONTENTS_SOLID 1 /* an eye is never valid in a solid */ +#define CONTENTS_WINDOW 2 /* translucent, but not watery */ +#define CONTENTS_AUX 4 +#define CONTENTS_LAVA 8 +#define CONTENTS_SLIME 16 +#define CONTENTS_WATER 32 +#define CONTENTS_MIST 64 +#define LAST_VISIBLE_CONTENTS 64 -============================================================== -*/ +/* remaining contents are non-visible, and don't eat brushes */ +#define CONTENTS_AREAPORTAL 0x8000 -// lower bits are stronger, and will eat weaker brushes completely -#define CONTENTS_SOLID 1 // an eye is never valid in a solid -#define CONTENTS_WINDOW 2 // translucent, but not watery -#define CONTENTS_AUX 4 -#define CONTENTS_LAVA 8 -#define CONTENTS_SLIME 16 -#define CONTENTS_WATER 32 -#define CONTENTS_MIST 64 -#define LAST_VISIBLE_CONTENTS 64 +#define CONTENTS_PLAYERCLIP 0x10000 +#define CONTENTS_MONSTERCLIP 0x20000 -// remaining contents are non-visible, and don't eat brushes +/* currents can be added to any other contents, and may be mixed */ +#define CONTENTS_CURRENT_0 0x40000 +#define CONTENTS_CURRENT_90 0x80000 +#define CONTENTS_CURRENT_180 0x100000 +#define CONTENTS_CURRENT_270 0x200000 +#define CONTENTS_CURRENT_UP 0x400000 +#define CONTENTS_CURRENT_DOWN 0x800000 -#define CONTENTS_AREAPORTAL 0x8000 +#define CONTENTS_ORIGIN 0x1000000 /* removed before bsping an entity */ -#define CONTENTS_PLAYERCLIP 0x10000 -#define CONTENTS_MONSTERCLIP 0x20000 +#define CONTENTS_MONSTER 0x2000000 /* should never be on a brush, only in game */ +#define CONTENTS_DEADMONSTER 0x4000000 +#define CONTENTS_DETAIL 0x8000000 /* brushes to be added after vis leafs */ +#define CONTENTS_TRANSLUCENT 0x10000000 /* auto set if any surface has trans */ +#define CONTENTS_LADDER 0x20000000 -// currents can be added to any other contents, and may be mixed -#define CONTENTS_CURRENT_0 0x40000 -#define CONTENTS_CURRENT_90 0x80000 -#define CONTENTS_CURRENT_180 0x100000 -#define CONTENTS_CURRENT_270 0x200000 -#define CONTENTS_CURRENT_UP 0x400000 -#define CONTENTS_CURRENT_DOWN 0x800000 +#define SURF_LIGHT 0x1 /* value will hold the light strength */ -#define CONTENTS_ORIGIN 0x1000000 // removed before bsping an entity +#define SURF_SLICK 0x2 /* effects game physics */ -#define CONTENTS_MONSTER 0x2000000 // should never be on a brush, only in game -#define CONTENTS_DEADMONSTER 0x4000000 -#define CONTENTS_DETAIL 0x8000000 // brushes to be added after vis leafs -#define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans -#define CONTENTS_LADDER 0x20000000 +#define SURF_SKY 0x4 /* don't draw, but add to skybox */ +#define SURF_WARP 0x8 /* turbulent water warp */ +#define SURF_TRANS33 0x10 +#define SURF_TRANS66 0x20 +#define SURF_FLOWING 0x40 /* scroll towards angle */ +#define SURF_NODRAW 0x80 /* don't bother referencing the texture */ +/* content masks */ +#define MASK_ALL (-1) +#define MASK_SOLID (CONTENTS_SOLID | CONTENTS_WINDOW) +#define MASK_PLAYERSOLID (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | \ + CONTENTS_WINDOW | CONTENTS_MONSTER) +#define MASK_DEADSOLID (CONTENTS_SOLID | CONTENTS_PLAYERCLIP | CONTENTS_WINDOW) +#define MASK_MONSTERSOLID (CONTENTS_SOLID | CONTENTS_MONSTERCLIP | \ + CONTENTS_WINDOW | CONTENTS_MONSTER) +#define MASK_WATER (CONTENTS_WATER | CONTENTS_LAVA | CONTENTS_SLIME) +#define MASK_OPAQUE (CONTENTS_SOLID | CONTENTS_SLIME | CONTENTS_LAVA) +#define MASK_SHOT (CONTENTS_SOLID | CONTENTS_MONSTER | CONTENTS_WINDOW | \ + CONTENTS_DEADMONSTER) +#define MASK_CURRENT (CONTENTS_CURRENT_0 | CONTENTS_CURRENT_90 | \ + CONTENTS_CURRENT_180 | CONTENTS_CURRENT_270 | \ + CONTENTS_CURRENT_UP | \ + CONTENTS_CURRENT_DOWN) +/* gi.BoxEdicts() can return a list of either solid or trigger entities */ +#define AREA_SOLID 1 +#define AREA_TRIGGERS 2 -#define SURF_LIGHT 0x1 // value will hold the light strength - -#define SURF_SLICK 0x2 // effects game physics - -#define SURF_SKY 0x4 // don't draw, but add to skybox -#define SURF_WARP 0x8 // turbulent water warp -#define SURF_TRANS33 0x10 -#define SURF_TRANS66 0x20 -#define SURF_FLOWING 0x40 // scroll towards angle -#define SURF_NODRAW 0x80 // don't bother referencing the texture - -// content masks -#define MASK_ALL (-1) -#define MASK_SOLID (CONTENTS_SOLID|CONTENTS_WINDOW) -#define MASK_PLAYERSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER) -#define MASK_DEADSOLID (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW) -#define MASK_MONSTERSOLID (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_MONSTER) -#define MASK_WATER (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME) -#define MASK_OPAQUE (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA) -#define MASK_SHOT (CONTENTS_SOLID|CONTENTS_MONSTER|CONTENTS_WINDOW|CONTENTS_DEADMONSTER) -#define MASK_CURRENT (CONTENTS_CURRENT_0|CONTENTS_CURRENT_90|CONTENTS_CURRENT_180|CONTENTS_CURRENT_270|CONTENTS_CURRENT_UP|CONTENTS_CURRENT_DOWN) - - -// gi.BoxEdicts() can return a list of either solid or trigger entities -// FIXME: eliminate AREA_ distinction? -#define AREA_SOLID 1 -#define AREA_TRIGGERS 2 - - -// plane_t structure -// !!! if this is changed, it must be changed in asm code too !!! +/* plane_t structure */ typedef struct cplane_s { - vec3_t normal; - float dist; - byte type; // for fast side tests - byte signbits; // signx + (signy<<1) + (signz<<1) - byte pad[2]; + vec3_t normal; + float dist; + byte type; /* for fast side tests */ + byte signbits; /* signx + (signy<<1) + (signz<<1) */ + byte pad[2]; } cplane_t; -// structure offset for asm code -#define CPLANE_NORMAL_X 0 -#define CPLANE_NORMAL_Y 4 -#define CPLANE_NORMAL_Z 8 -#define CPLANE_DIST 12 -#define CPLANE_TYPE 16 -#define CPLANE_SIGNBITS 17 -#define CPLANE_PAD0 18 -#define CPLANE_PAD1 19 +/* structure offset for asm code */ +#define CPLANE_NORMAL_X 0 +#define CPLANE_NORMAL_Y 4 +#define CPLANE_NORMAL_Z 8 +#define CPLANE_DIST 12 +#define CPLANE_TYPE 16 +#define CPLANE_SIGNBITS 17 +#define CPLANE_PAD0 18 +#define CPLANE_PAD1 19 typedef struct cmodel_s { - vec3_t mins, maxs; - vec3_t origin; // for sounds or lights - int headnode; + vec3_t mins, maxs; + vec3_t origin; /* for sounds or lights */ + int headnode; } cmodel_t; typedef struct csurface_s { - char name[16]; - int flags; - int value; + char name[16]; + int flags; + int value; } csurface_t; -typedef struct mapsurface_s // used internally due to name len probs //ZOID +typedef struct mapsurface_s /* used internally due to name len probs */ { - csurface_t c; - char rname[32]; + csurface_t c; + char rname[32]; } mapsurface_t; -// a trace is returned when a box is swept through the world +/* a trace is returned when a box is swept through the world */ typedef struct { - qboolean allsolid; // if true, plane is not valid - qboolean startsolid; // if true, the initial point was in a solid area - float fraction; // time completed, 1.0 = didn't hit anything - vec3_t endpos; // final position - cplane_t plane; // surface normal at impact - csurface_t *surface; // surface hit - int contents; // contents on other side of surface hit - struct edict_s *ent; // not set by CM_*() functions + qboolean allsolid; /* if true, plane is not valid */ + qboolean startsolid; /* if true, the initial point was in a solid area */ + float fraction; /* time completed, 1.0 = didn't hit anything */ + vec3_t endpos; /* final position */ + cplane_t plane; /* surface normal at impact */ + csurface_t *surface; /* surface hit */ + int contents; /* contents on other side of surface hit */ + struct edict_s *ent; /* not set by CM_*() functions */ } trace_t; - - -// pmove_state_t is the information necessary for client side movement -// prediction -typedef enum +/* pmove_state_t is the information necessary for client side movement */ +/* prediction */ +typedef enum { - // can accelerate and turn + /* can accelerate and turn */ PM_NORMAL, PM_SPECTATOR, - // no acceleration or turning + /* no acceleration or turning */ PM_DEAD, - PM_GIB, // different bounding box + PM_GIB, /* different bounding box */ PM_FREEZE } pmtype_t; -// pmove->pm_flags -#define PMF_DUCKED 1 -#define PMF_JUMP_HELD 2 -#define PMF_ON_GROUND 4 -#define PMF_TIME_WATERJUMP 8 // pm_time is waterjump -#define PMF_TIME_LAND 16 // pm_time is time before rejump -#define PMF_TIME_TELEPORT 32 // pm_time is non-moving time -#define PMF_NO_PREDICTION 64 // temporarily disables prediction (used for grappling hook) +/* pmove->pm_flags */ +#define PMF_DUCKED 1 +#define PMF_JUMP_HELD 2 +#define PMF_ON_GROUND 4 +#define PMF_TIME_WATERJUMP 8 /* pm_time is waterjump */ +#define PMF_TIME_LAND 16 /* pm_time is time before rejump */ +#define PMF_TIME_TELEPORT 32 /* pm_time is non-moving time */ +#define PMF_NO_PREDICTION 64 /* temporarily disables prediction (used for grappling hook) */ -// this structure needs to be communicated bit-accurate -// from the server to the client to guarantee that -// prediction stays in sync, so no floats are used. -// if any part of the game code modifies this struct, it -// will result in a prediction error of some degree. +/* this structure needs to be communicated bit-accurate/ + from the server to the client to guarantee that + prediction stays in sync, so no floats are used. + if any part of the game code modifies this struct, it + will result in a prediction error of some degree. */ typedef struct { - pmtype_t pm_type; + pmtype_t pm_type; - short origin[3]; // 12.3 - short velocity[3]; // 12.3 - byte pm_flags; // ducked, jump_held, etc - byte pm_time; // each unit = 8 ms - short gravity; - short delta_angles[3]; // add to command angles to get view direction - // changed by spawns, rotating objects, and teleporters + short origin[3]; /* 12.3 */ + short velocity[3]; /* 12.3 */ + byte pm_flags; /* ducked, jump_held, etc */ + byte pm_time; /* each unit = 8 ms */ + short gravity; + short delta_angles[3]; /* add to command angles to get view direction + changed by spawns, rotating objects, and teleporters */ } pmove_state_t; +/* button bits */ +#define BUTTON_ATTACK 1 +#define BUTTON_USE 2 +#define BUTTON_ANY 128 /* any key whatsoever */ -// -// button bits -// -#define BUTTON_ATTACK 1 -#define BUTTON_USE 2 -#define BUTTON_ANY 128 // any key whatsoever - - -// usercmd_t is sent to the server each client frame +/* usercmd_t is sent to the server each client frame */ typedef struct usercmd_s { - byte msec; - byte buttons; - short angles[3]; - short forwardmove, sidemove, upmove; - byte impulse; // remove? - byte lightlevel; // light level the player is standing on + byte msec; + byte buttons; + short angles[3]; + short forwardmove, sidemove, upmove; + byte impulse; /* remove? */ + byte lightlevel; /* light level the player is standing on */ } usercmd_t; - -#define MAXTOUCH 32 +#define MAXTOUCH 32 typedef struct { - // state (in / out) - pmove_state_t s; + /* state (in / out) */ + pmove_state_t s; - // command (in) - usercmd_t cmd; - qboolean snapinitial; // if s has been changed outside pmove + /* command (in) */ + usercmd_t cmd; + qboolean snapinitial; /* if s has been changed outside pmove */ - // results (out) - int numtouch; - struct edict_s *touchents[MAXTOUCH]; + /* results (out) */ + int numtouch; + struct edict_s *touchents[MAXTOUCH]; - vec3_t viewangles; // clamped - float viewheight; + vec3_t viewangles; /* clamped */ + float viewheight; - vec3_t mins, maxs; // bounding box size + vec3_t mins, maxs; /* bounding box size */ - struct edict_s *groundentity; - int watertype; - int waterlevel; + struct edict_s *groundentity; + int watertype; + int waterlevel; - // callbacks to test the world - trace_t (*trace) (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end); - int (*pointcontents) (vec3_t point); + /* callbacks to test the world */ + trace_t (*trace)(vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end); + int (*pointcontents)(vec3_t point); } pmove_t; +/* entity_state_t->effects + Effects are things handled on the client side (lights, particles, + frame animations) that happen constantly on the given entity. + An entity that has effects will be sent to the client even if + it has a zero index model. */ +#define EF_ROTATE 0x00000001 /* rotate (bonus items) */ +#define EF_GIB 0x00000002 /* leave a trail */ +#define EF_BLASTER 0x00000008 /* redlight + trail */ +#define EF_ROCKET 0x00000010 /* redlight + trail */ +#define EF_GRENADE 0x00000020 +#define EF_HYPERBLASTER 0x00000040 +#define EF_BFG 0x00000080 +#define EF_COLOR_SHELL 0x00000100 +#define EF_POWERSCREEN 0x00000200 +#define EF_ANIM01 0x00000400 /* automatically cycle between frames 0 and 1 at 2 hz */ +#define EF_ANIM23 0x00000800 /* automatically cycle between frames 2 and 3 at 2 hz */ +#define EF_ANIM_ALL 0x00001000 /* automatically cycle through all frames at 2hz */ +#define EF_ANIM_ALLFAST 0x00002000 /* automatically cycle through all frames at 10hz */ +#define EF_FLIES 0x00004000 +#define EF_QUAD 0x00008000 +#define EF_PENT 0x00010000 +#define EF_TELEPORTER 0x00020000 /* particle fountain */ +#define EF_FLAG1 0x00040000 +#define EF_FLAG2 0x00080000 +#define EF_IONRIPPER 0x00100000 +#define EF_GREENGIB 0x00200000 +#define EF_BLUEHYPERBLASTER 0x00400000 +#define EF_SPINNINGLIGHTS 0x00800000 +#define EF_PLASMA 0x01000000 +#define EF_TRAP 0x02000000 +#define EF_TRACKER 0x04000000 +#define EF_DOUBLE 0x08000000 +#define EF_SPHERETRANS 0x10000000 +#define EF_TAGTRAIL 0x20000000 +#define EF_HALF_DAMAGE 0x40000000 +#define EF_TRACKERTRAIL 0x80000000 -// entity_state_t->effects -// Effects are things handled on the client side (lights, particles, frame animations) -// that happen constantly on the given entity. -// An entity that has effects will be sent to the client -// even if it has a zero index model. -#define EF_ROTATE 0x00000001 // rotate (bonus items) -#define EF_GIB 0x00000002 // leave a trail -#define EF_BLASTER 0x00000008 // redlight + trail -#define EF_ROCKET 0x00000010 // redlight + trail -#define EF_GRENADE 0x00000020 -#define EF_HYPERBLASTER 0x00000040 -#define EF_BFG 0x00000080 -#define EF_COLOR_SHELL 0x00000100 -#define EF_POWERSCREEN 0x00000200 -#define EF_ANIM01 0x00000400 // automatically cycle between frames 0 and 1 at 2 hz -#define EF_ANIM23 0x00000800 // automatically cycle between frames 2 and 3 at 2 hz -#define EF_ANIM_ALL 0x00001000 // automatically cycle through all frames at 2hz -#define EF_ANIM_ALLFAST 0x00002000 // automatically cycle through all frames at 10hz -#define EF_FLIES 0x00004000 -#define EF_QUAD 0x00008000 -#define EF_PENT 0x00010000 -#define EF_TELEPORTER 0x00020000 // particle fountain -#define EF_FLAG1 0x00040000 -#define EF_FLAG2 0x00080000 -// RAFAEL -#define EF_IONRIPPER 0x00100000 -#define EF_GREENGIB 0x00200000 -#define EF_BLUEHYPERBLASTER 0x00400000 -#define EF_SPINNINGLIGHTS 0x00800000 -#define EF_PLASMA 0x01000000 -#define EF_TRAP 0x02000000 +/* entity_state_t->renderfx flags */ +#define RF_MINLIGHT 1 /* allways have some light (viewmodel) */ +#define RF_VIEWERMODEL 2 /* don't draw through eyes, only mirrors */ +#define RF_WEAPONMODEL 4 /* only draw through eyes */ +#define RF_FULLBRIGHT 8 /* allways draw full intensity */ +#define RF_DEPTHHACK 16 /* for view weapon Z crunching */ +#define RF_TRANSLUCENT 32 +#define RF_FRAMELERP 64 +#define RF_BEAM 128 +#define RF_CUSTOMSKIN 256 /* skin is an index in image_precache */ +#define RF_GLOW 512 /* pulse lighting for bonus items */ +#define RF_SHELL_RED 1024 +#define RF_SHELL_GREEN 2048 +#define RF_SHELL_BLUE 4096 +#define RF_NOSHADOW 8192 /* don't draw a shadow */ +#define RF_IR_VISIBLE 0x00008000 /* 32768 */ +#define RF_SHELL_DOUBLE 0x00010000 /* 65536 */ +#define RF_SHELL_HALF_DAM 0x00020000 +#define RF_USE_DISGUISE 0x00040000 -//ROGUE -#define EF_TRACKER 0x04000000 -#define EF_DOUBLE 0x08000000 -#define EF_SPHERETRANS 0x10000000 -#define EF_TAGTRAIL 0x20000000 -#define EF_HALF_DAMAGE 0x40000000 -#define EF_TRACKERTRAIL 0x80000000 -//ROGUE +/* player_state_t->refdef flags */ +#define RDF_UNDERWATER 1 /* warp the screen as apropriate */ +#define RDF_NOWORLDMODEL 2 /* used for player configuration screen */ +#define RDF_IRGOGGLES 4 +#define RDF_UVGOGGLES 8 -// entity_state_t->renderfx flags -#define RF_MINLIGHT 1 // allways have some light (viewmodel) -#define RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors -#define RF_WEAPONMODEL 4 // only draw through eyes -#define RF_FULLBRIGHT 8 // allways draw full intensity -#define RF_DEPTHHACK 16 // for view weapon Z crunching -#define RF_TRANSLUCENT 32 -#define RF_FRAMELERP 64 -#define RF_BEAM 128 -#define RF_CUSTOMSKIN 256 // skin is an index in image_precache -#define RF_GLOW 512 // pulse lighting for bonus items -#define RF_SHELL_RED 1024 -#define RF_SHELL_GREEN 2048 -#define RF_SHELL_BLUE 4096 -#define RF_NOSHADOW 8192 /* don't draw a shadow */ - -//ROGUE -#define RF_IR_VISIBLE 0x00008000 // 32768 -#define RF_SHELL_DOUBLE 0x00010000 // 65536 -#define RF_SHELL_HALF_DAM 0x00020000 -#define RF_USE_DISGUISE 0x00040000 -//ROGUE - -// player_state_t->refdef flags -#define RDF_UNDERWATER 1 // warp the screen as apropriate -#define RDF_NOWORLDMODEL 2 // used for player configuration screen - -//ROGUE -#define RDF_IRGOGGLES 4 -#define RDF_UVGOGGLES 8 -//ROGUE - -// -// muzzle flashes / player effects -// -#define MZ_BLASTER 0 -#define MZ_MACHINEGUN 1 -#define MZ_SHOTGUN 2 -#define MZ_CHAINGUN1 3 -#define MZ_CHAINGUN2 4 -#define MZ_CHAINGUN3 5 -#define MZ_RAILGUN 6 -#define MZ_ROCKET 7 -#define MZ_GRENADE 8 -#define MZ_LOGIN 9 -#define MZ_LOGOUT 10 -#define MZ_RESPAWN 11 -#define MZ_BFG 12 -#define MZ_SSHOTGUN 13 -#define MZ_HYPERBLASTER 14 -#define MZ_ITEMRESPAWN 15 -// RAFAEL -#define MZ_IONRIPPER 16 +/* muzzle flashes / player effects */ +#define MZ_BLASTER 0 +#define MZ_MACHINEGUN 1 +#define MZ_SHOTGUN 2 +#define MZ_CHAINGUN1 3 +#define MZ_CHAINGUN2 4 +#define MZ_CHAINGUN3 5 +#define MZ_RAILGUN 6 +#define MZ_ROCKET 7 +#define MZ_GRENADE 8 +#define MZ_LOGIN 9 +#define MZ_LOGOUT 10 +#define MZ_RESPAWN 11 +#define MZ_BFG 12 +#define MZ_SSHOTGUN 13 +#define MZ_HYPERBLASTER 14 +#define MZ_ITEMRESPAWN 15 +#define MZ_IONRIPPER 16 #define MZ_BLUEHYPERBLASTER 17 -#define MZ_PHALANX 18 -#define MZ_SILENCED 128 // bit flag ORed with one of the above numbers +#define MZ_PHALANX 18 +#define MZ_SILENCED 128 /* bit flag ORed with one of the above numbers */ +#define MZ_ETF_RIFLE 30 +#define MZ_UNUSED 31 +#define MZ_SHOTGUN2 32 +#define MZ_HEATBEAM 33 +#define MZ_BLASTER2 34 +#define MZ_TRACKER 35 +#define MZ_NUKE1 36 +#define MZ_NUKE2 37 +#define MZ_NUKE4 38 +#define MZ_NUKE8 39 -//ROGUE -#define MZ_ETF_RIFLE 30 -#define MZ_UNUSED 31 -#define MZ_SHOTGUN2 32 -#define MZ_HEATBEAM 33 -#define MZ_BLASTER2 34 -#define MZ_TRACKER 35 -#define MZ_NUKE1 36 -#define MZ_NUKE2 37 -#define MZ_NUKE4 38 -#define MZ_NUKE8 39 -//ROGUE +/* monster muzzle flashes */ +#define MZ2_TANK_BLASTER_1 1 +#define MZ2_TANK_BLASTER_2 2 +#define MZ2_TANK_BLASTER_3 3 +#define MZ2_TANK_MACHINEGUN_1 4 +#define MZ2_TANK_MACHINEGUN_2 5 +#define MZ2_TANK_MACHINEGUN_3 6 +#define MZ2_TANK_MACHINEGUN_4 7 +#define MZ2_TANK_MACHINEGUN_5 8 +#define MZ2_TANK_MACHINEGUN_6 9 +#define MZ2_TANK_MACHINEGUN_7 10 +#define MZ2_TANK_MACHINEGUN_8 11 +#define MZ2_TANK_MACHINEGUN_9 12 +#define MZ2_TANK_MACHINEGUN_10 13 +#define MZ2_TANK_MACHINEGUN_11 14 +#define MZ2_TANK_MACHINEGUN_12 15 +#define MZ2_TANK_MACHINEGUN_13 16 +#define MZ2_TANK_MACHINEGUN_14 17 +#define MZ2_TANK_MACHINEGUN_15 18 +#define MZ2_TANK_MACHINEGUN_16 19 +#define MZ2_TANK_MACHINEGUN_17 20 +#define MZ2_TANK_MACHINEGUN_18 21 +#define MZ2_TANK_MACHINEGUN_19 22 +#define MZ2_TANK_ROCKET_1 23 +#define MZ2_TANK_ROCKET_2 24 +#define MZ2_TANK_ROCKET_3 25 -// -// monster muzzle flashes -// -#define MZ2_TANK_BLASTER_1 1 -#define MZ2_TANK_BLASTER_2 2 -#define MZ2_TANK_BLASTER_3 3 -#define MZ2_TANK_MACHINEGUN_1 4 -#define MZ2_TANK_MACHINEGUN_2 5 -#define MZ2_TANK_MACHINEGUN_3 6 -#define MZ2_TANK_MACHINEGUN_4 7 -#define MZ2_TANK_MACHINEGUN_5 8 -#define MZ2_TANK_MACHINEGUN_6 9 -#define MZ2_TANK_MACHINEGUN_7 10 -#define MZ2_TANK_MACHINEGUN_8 11 -#define MZ2_TANK_MACHINEGUN_9 12 -#define MZ2_TANK_MACHINEGUN_10 13 -#define MZ2_TANK_MACHINEGUN_11 14 -#define MZ2_TANK_MACHINEGUN_12 15 -#define MZ2_TANK_MACHINEGUN_13 16 -#define MZ2_TANK_MACHINEGUN_14 17 -#define MZ2_TANK_MACHINEGUN_15 18 -#define MZ2_TANK_MACHINEGUN_16 19 -#define MZ2_TANK_MACHINEGUN_17 20 -#define MZ2_TANK_MACHINEGUN_18 21 -#define MZ2_TANK_MACHINEGUN_19 22 -#define MZ2_TANK_ROCKET_1 23 -#define MZ2_TANK_ROCKET_2 24 -#define MZ2_TANK_ROCKET_3 25 +#define MZ2_INFANTRY_MACHINEGUN_1 26 +#define MZ2_INFANTRY_MACHINEGUN_2 27 +#define MZ2_INFANTRY_MACHINEGUN_3 28 +#define MZ2_INFANTRY_MACHINEGUN_4 29 +#define MZ2_INFANTRY_MACHINEGUN_5 30 +#define MZ2_INFANTRY_MACHINEGUN_6 31 +#define MZ2_INFANTRY_MACHINEGUN_7 32 +#define MZ2_INFANTRY_MACHINEGUN_8 33 +#define MZ2_INFANTRY_MACHINEGUN_9 34 +#define MZ2_INFANTRY_MACHINEGUN_10 35 +#define MZ2_INFANTRY_MACHINEGUN_11 36 +#define MZ2_INFANTRY_MACHINEGUN_12 37 +#define MZ2_INFANTRY_MACHINEGUN_13 38 -#define MZ2_INFANTRY_MACHINEGUN_1 26 -#define MZ2_INFANTRY_MACHINEGUN_2 27 -#define MZ2_INFANTRY_MACHINEGUN_3 28 -#define MZ2_INFANTRY_MACHINEGUN_4 29 -#define MZ2_INFANTRY_MACHINEGUN_5 30 -#define MZ2_INFANTRY_MACHINEGUN_6 31 -#define MZ2_INFANTRY_MACHINEGUN_7 32 -#define MZ2_INFANTRY_MACHINEGUN_8 33 -#define MZ2_INFANTRY_MACHINEGUN_9 34 -#define MZ2_INFANTRY_MACHINEGUN_10 35 -#define MZ2_INFANTRY_MACHINEGUN_11 36 -#define MZ2_INFANTRY_MACHINEGUN_12 37 -#define MZ2_INFANTRY_MACHINEGUN_13 38 +#define MZ2_SOLDIER_BLASTER_1 39 +#define MZ2_SOLDIER_BLASTER_2 40 +#define MZ2_SOLDIER_SHOTGUN_1 41 +#define MZ2_SOLDIER_SHOTGUN_2 42 +#define MZ2_SOLDIER_MACHINEGUN_1 43 +#define MZ2_SOLDIER_MACHINEGUN_2 44 -#define MZ2_SOLDIER_BLASTER_1 39 -#define MZ2_SOLDIER_BLASTER_2 40 -#define MZ2_SOLDIER_SHOTGUN_1 41 -#define MZ2_SOLDIER_SHOTGUN_2 42 -#define MZ2_SOLDIER_MACHINEGUN_1 43 -#define MZ2_SOLDIER_MACHINEGUN_2 44 +#define MZ2_GUNNER_MACHINEGUN_1 45 +#define MZ2_GUNNER_MACHINEGUN_2 46 +#define MZ2_GUNNER_MACHINEGUN_3 47 +#define MZ2_GUNNER_MACHINEGUN_4 48 +#define MZ2_GUNNER_MACHINEGUN_5 49 +#define MZ2_GUNNER_MACHINEGUN_6 50 +#define MZ2_GUNNER_MACHINEGUN_7 51 +#define MZ2_GUNNER_MACHINEGUN_8 52 +#define MZ2_GUNNER_GRENADE_1 53 +#define MZ2_GUNNER_GRENADE_2 54 +#define MZ2_GUNNER_GRENADE_3 55 +#define MZ2_GUNNER_GRENADE_4 56 -#define MZ2_GUNNER_MACHINEGUN_1 45 -#define MZ2_GUNNER_MACHINEGUN_2 46 -#define MZ2_GUNNER_MACHINEGUN_3 47 -#define MZ2_GUNNER_MACHINEGUN_4 48 -#define MZ2_GUNNER_MACHINEGUN_5 49 -#define MZ2_GUNNER_MACHINEGUN_6 50 -#define MZ2_GUNNER_MACHINEGUN_7 51 -#define MZ2_GUNNER_MACHINEGUN_8 52 -#define MZ2_GUNNER_GRENADE_1 53 -#define MZ2_GUNNER_GRENADE_2 54 -#define MZ2_GUNNER_GRENADE_3 55 -#define MZ2_GUNNER_GRENADE_4 56 +#define MZ2_CHICK_ROCKET_1 57 -#define MZ2_CHICK_ROCKET_1 57 +#define MZ2_FLYER_BLASTER_1 58 +#define MZ2_FLYER_BLASTER_2 59 -#define MZ2_FLYER_BLASTER_1 58 -#define MZ2_FLYER_BLASTER_2 59 +#define MZ2_MEDIC_BLASTER_1 60 -#define MZ2_MEDIC_BLASTER_1 60 +#define MZ2_GLADIATOR_RAILGUN_1 61 -#define MZ2_GLADIATOR_RAILGUN_1 61 +#define MZ2_HOVER_BLASTER_1 62 -#define MZ2_HOVER_BLASTER_1 62 +#define MZ2_ACTOR_MACHINEGUN_1 63 -#define MZ2_ACTOR_MACHINEGUN_1 63 +#define MZ2_SUPERTANK_MACHINEGUN_1 64 +#define MZ2_SUPERTANK_MACHINEGUN_2 65 +#define MZ2_SUPERTANK_MACHINEGUN_3 66 +#define MZ2_SUPERTANK_MACHINEGUN_4 67 +#define MZ2_SUPERTANK_MACHINEGUN_5 68 +#define MZ2_SUPERTANK_MACHINEGUN_6 69 +#define MZ2_SUPERTANK_ROCKET_1 70 +#define MZ2_SUPERTANK_ROCKET_2 71 +#define MZ2_SUPERTANK_ROCKET_3 72 -#define MZ2_SUPERTANK_MACHINEGUN_1 64 -#define MZ2_SUPERTANK_MACHINEGUN_2 65 -#define MZ2_SUPERTANK_MACHINEGUN_3 66 -#define MZ2_SUPERTANK_MACHINEGUN_4 67 -#define MZ2_SUPERTANK_MACHINEGUN_5 68 -#define MZ2_SUPERTANK_MACHINEGUN_6 69 -#define MZ2_SUPERTANK_ROCKET_1 70 -#define MZ2_SUPERTANK_ROCKET_2 71 -#define MZ2_SUPERTANK_ROCKET_3 72 +#define MZ2_BOSS2_MACHINEGUN_L1 73 +#define MZ2_BOSS2_MACHINEGUN_L2 74 +#define MZ2_BOSS2_MACHINEGUN_L3 75 +#define MZ2_BOSS2_MACHINEGUN_L4 76 +#define MZ2_BOSS2_MACHINEGUN_L5 77 +#define MZ2_BOSS2_ROCKET_1 78 +#define MZ2_BOSS2_ROCKET_2 79 +#define MZ2_BOSS2_ROCKET_3 80 +#define MZ2_BOSS2_ROCKET_4 81 -#define MZ2_BOSS2_MACHINEGUN_L1 73 -#define MZ2_BOSS2_MACHINEGUN_L2 74 -#define MZ2_BOSS2_MACHINEGUN_L3 75 -#define MZ2_BOSS2_MACHINEGUN_L4 76 -#define MZ2_BOSS2_MACHINEGUN_L5 77 -#define MZ2_BOSS2_ROCKET_1 78 -#define MZ2_BOSS2_ROCKET_2 79 -#define MZ2_BOSS2_ROCKET_3 80 -#define MZ2_BOSS2_ROCKET_4 81 +#define MZ2_FLOAT_BLASTER_1 82 -#define MZ2_FLOAT_BLASTER_1 82 +#define MZ2_SOLDIER_BLASTER_3 83 +#define MZ2_SOLDIER_SHOTGUN_3 84 +#define MZ2_SOLDIER_MACHINEGUN_3 85 +#define MZ2_SOLDIER_BLASTER_4 86 +#define MZ2_SOLDIER_SHOTGUN_4 87 +#define MZ2_SOLDIER_MACHINEGUN_4 88 +#define MZ2_SOLDIER_BLASTER_5 89 +#define MZ2_SOLDIER_SHOTGUN_5 90 +#define MZ2_SOLDIER_MACHINEGUN_5 91 +#define MZ2_SOLDIER_BLASTER_6 92 +#define MZ2_SOLDIER_SHOTGUN_6 93 +#define MZ2_SOLDIER_MACHINEGUN_6 94 +#define MZ2_SOLDIER_BLASTER_7 95 +#define MZ2_SOLDIER_SHOTGUN_7 96 +#define MZ2_SOLDIER_MACHINEGUN_7 97 +#define MZ2_SOLDIER_BLASTER_8 98 +#define MZ2_SOLDIER_SHOTGUN_8 99 +#define MZ2_SOLDIER_MACHINEGUN_8 100 -#define MZ2_SOLDIER_BLASTER_3 83 -#define MZ2_SOLDIER_SHOTGUN_3 84 -#define MZ2_SOLDIER_MACHINEGUN_3 85 -#define MZ2_SOLDIER_BLASTER_4 86 -#define MZ2_SOLDIER_SHOTGUN_4 87 -#define MZ2_SOLDIER_MACHINEGUN_4 88 -#define MZ2_SOLDIER_BLASTER_5 89 -#define MZ2_SOLDIER_SHOTGUN_5 90 -#define MZ2_SOLDIER_MACHINEGUN_5 91 -#define MZ2_SOLDIER_BLASTER_6 92 -#define MZ2_SOLDIER_SHOTGUN_6 93 -#define MZ2_SOLDIER_MACHINEGUN_6 94 -#define MZ2_SOLDIER_BLASTER_7 95 -#define MZ2_SOLDIER_SHOTGUN_7 96 -#define MZ2_SOLDIER_MACHINEGUN_7 97 -#define MZ2_SOLDIER_BLASTER_8 98 -#define MZ2_SOLDIER_SHOTGUN_8 99 -#define MZ2_SOLDIER_MACHINEGUN_8 100 +#define MZ2_MAKRON_BFG 101 +#define MZ2_MAKRON_BLASTER_1 102 +#define MZ2_MAKRON_BLASTER_2 103 +#define MZ2_MAKRON_BLASTER_3 104 +#define MZ2_MAKRON_BLASTER_4 105 +#define MZ2_MAKRON_BLASTER_5 106 +#define MZ2_MAKRON_BLASTER_6 107 +#define MZ2_MAKRON_BLASTER_7 108 +#define MZ2_MAKRON_BLASTER_8 109 +#define MZ2_MAKRON_BLASTER_9 110 +#define MZ2_MAKRON_BLASTER_10 111 +#define MZ2_MAKRON_BLASTER_11 112 +#define MZ2_MAKRON_BLASTER_12 113 +#define MZ2_MAKRON_BLASTER_13 114 +#define MZ2_MAKRON_BLASTER_14 115 +#define MZ2_MAKRON_BLASTER_15 116 +#define MZ2_MAKRON_BLASTER_16 117 +#define MZ2_MAKRON_BLASTER_17 118 +#define MZ2_MAKRON_RAILGUN_1 119 +#define MZ2_JORG_MACHINEGUN_L1 120 +#define MZ2_JORG_MACHINEGUN_L2 121 +#define MZ2_JORG_MACHINEGUN_L3 122 +#define MZ2_JORG_MACHINEGUN_L4 123 +#define MZ2_JORG_MACHINEGUN_L5 124 +#define MZ2_JORG_MACHINEGUN_L6 125 +#define MZ2_JORG_MACHINEGUN_R1 126 +#define MZ2_JORG_MACHINEGUN_R2 127 +#define MZ2_JORG_MACHINEGUN_R3 128 +#define MZ2_JORG_MACHINEGUN_R4 129 +#define MZ2_JORG_MACHINEGUN_R5 130 +#define MZ2_JORG_MACHINEGUN_R6 131 +#define MZ2_JORG_BFG_1 132 +#define MZ2_BOSS2_MACHINEGUN_R1 133 +#define MZ2_BOSS2_MACHINEGUN_R2 134 +#define MZ2_BOSS2_MACHINEGUN_R3 135 +#define MZ2_BOSS2_MACHINEGUN_R4 136 +#define MZ2_BOSS2_MACHINEGUN_R5 137 -// --- Xian shit below --- -#define MZ2_MAKRON_BFG 101 -#define MZ2_MAKRON_BLASTER_1 102 -#define MZ2_MAKRON_BLASTER_2 103 -#define MZ2_MAKRON_BLASTER_3 104 -#define MZ2_MAKRON_BLASTER_4 105 -#define MZ2_MAKRON_BLASTER_5 106 -#define MZ2_MAKRON_BLASTER_6 107 -#define MZ2_MAKRON_BLASTER_7 108 -#define MZ2_MAKRON_BLASTER_8 109 -#define MZ2_MAKRON_BLASTER_9 110 -#define MZ2_MAKRON_BLASTER_10 111 -#define MZ2_MAKRON_BLASTER_11 112 -#define MZ2_MAKRON_BLASTER_12 113 -#define MZ2_MAKRON_BLASTER_13 114 -#define MZ2_MAKRON_BLASTER_14 115 -#define MZ2_MAKRON_BLASTER_15 116 -#define MZ2_MAKRON_BLASTER_16 117 -#define MZ2_MAKRON_BLASTER_17 118 -#define MZ2_MAKRON_RAILGUN_1 119 -#define MZ2_JORG_MACHINEGUN_L1 120 -#define MZ2_JORG_MACHINEGUN_L2 121 -#define MZ2_JORG_MACHINEGUN_L3 122 -#define MZ2_JORG_MACHINEGUN_L4 123 -#define MZ2_JORG_MACHINEGUN_L5 124 -#define MZ2_JORG_MACHINEGUN_L6 125 -#define MZ2_JORG_MACHINEGUN_R1 126 -#define MZ2_JORG_MACHINEGUN_R2 127 -#define MZ2_JORG_MACHINEGUN_R3 128 -#define MZ2_JORG_MACHINEGUN_R4 129 -#define MZ2_JORG_MACHINEGUN_R5 130 -#define MZ2_JORG_MACHINEGUN_R6 131 -#define MZ2_JORG_BFG_1 132 -#define MZ2_BOSS2_MACHINEGUN_R1 133 -#define MZ2_BOSS2_MACHINEGUN_R2 134 -#define MZ2_BOSS2_MACHINEGUN_R3 135 -#define MZ2_BOSS2_MACHINEGUN_R4 136 -#define MZ2_BOSS2_MACHINEGUN_R5 137 +#define MZ2_CARRIER_MACHINEGUN_L1 138 +#define MZ2_CARRIER_MACHINEGUN_R1 139 +#define MZ2_CARRIER_GRENADE 140 +#define MZ2_TURRET_MACHINEGUN 141 +#define MZ2_TURRET_ROCKET 142 +#define MZ2_TURRET_BLASTER 143 +#define MZ2_STALKER_BLASTER 144 +#define MZ2_DAEDALUS_BLASTER 145 +#define MZ2_MEDIC_BLASTER_2 146 +#define MZ2_CARRIER_RAILGUN 147 +#define MZ2_WIDOW_DISRUPTOR 148 +#define MZ2_WIDOW_BLASTER 149 +#define MZ2_WIDOW_RAIL 150 +#define MZ2_WIDOW_PLASMABEAM 151 +#define MZ2_CARRIER_MACHINEGUN_L2 152 +#define MZ2_CARRIER_MACHINEGUN_R2 153 +#define MZ2_WIDOW_RAIL_LEFT 154 +#define MZ2_WIDOW_RAIL_RIGHT 155 +#define MZ2_WIDOW_BLASTER_SWEEP1 156 +#define MZ2_WIDOW_BLASTER_SWEEP2 157 +#define MZ2_WIDOW_BLASTER_SWEEP3 158 +#define MZ2_WIDOW_BLASTER_SWEEP4 159 +#define MZ2_WIDOW_BLASTER_SWEEP5 160 +#define MZ2_WIDOW_BLASTER_SWEEP6 161 +#define MZ2_WIDOW_BLASTER_SWEEP7 162 +#define MZ2_WIDOW_BLASTER_SWEEP8 163 +#define MZ2_WIDOW_BLASTER_SWEEP9 164 +#define MZ2_WIDOW_BLASTER_100 165 +#define MZ2_WIDOW_BLASTER_90 166 +#define MZ2_WIDOW_BLASTER_80 167 +#define MZ2_WIDOW_BLASTER_70 168 +#define MZ2_WIDOW_BLASTER_60 169 +#define MZ2_WIDOW_BLASTER_50 170 +#define MZ2_WIDOW_BLASTER_40 171 +#define MZ2_WIDOW_BLASTER_30 172 +#define MZ2_WIDOW_BLASTER_20 173 +#define MZ2_WIDOW_BLASTER_10 174 +#define MZ2_WIDOW_BLASTER_0 175 +#define MZ2_WIDOW_BLASTER_10L 176 +#define MZ2_WIDOW_BLASTER_20L 177 +#define MZ2_WIDOW_BLASTER_30L 178 +#define MZ2_WIDOW_BLASTER_40L 179 +#define MZ2_WIDOW_BLASTER_50L 180 +#define MZ2_WIDOW_BLASTER_60L 181 +#define MZ2_WIDOW_BLASTER_70L 182 +#define MZ2_WIDOW_RUN_1 183 +#define MZ2_WIDOW_RUN_2 184 +#define MZ2_WIDOW_RUN_3 185 +#define MZ2_WIDOW_RUN_4 186 +#define MZ2_WIDOW_RUN_5 187 +#define MZ2_WIDOW_RUN_6 188 +#define MZ2_WIDOW_RUN_7 189 +#define MZ2_WIDOW_RUN_8 190 +#define MZ2_CARRIER_ROCKET_1 191 +#define MZ2_CARRIER_ROCKET_2 192 +#define MZ2_CARRIER_ROCKET_3 193 +#define MZ2_CARRIER_ROCKET_4 194 +#define MZ2_WIDOW2_BEAMER_1 195 +#define MZ2_WIDOW2_BEAMER_2 196 +#define MZ2_WIDOW2_BEAMER_3 197 +#define MZ2_WIDOW2_BEAMER_4 198 +#define MZ2_WIDOW2_BEAMER_5 199 +#define MZ2_WIDOW2_BEAM_SWEEP_1 200 +#define MZ2_WIDOW2_BEAM_SWEEP_2 201 +#define MZ2_WIDOW2_BEAM_SWEEP_3 202 +#define MZ2_WIDOW2_BEAM_SWEEP_4 203 +#define MZ2_WIDOW2_BEAM_SWEEP_5 204 +#define MZ2_WIDOW2_BEAM_SWEEP_6 205 +#define MZ2_WIDOW2_BEAM_SWEEP_7 206 +#define MZ2_WIDOW2_BEAM_SWEEP_8 207 +#define MZ2_WIDOW2_BEAM_SWEEP_9 208 +#define MZ2_WIDOW2_BEAM_SWEEP_10 209 +#define MZ2_WIDOW2_BEAM_SWEEP_11 210 -//ROGUE -#define MZ2_CARRIER_MACHINEGUN_L1 138 -#define MZ2_CARRIER_MACHINEGUN_R1 139 -#define MZ2_CARRIER_GRENADE 140 -#define MZ2_TURRET_MACHINEGUN 141 -#define MZ2_TURRET_ROCKET 142 -#define MZ2_TURRET_BLASTER 143 -#define MZ2_STALKER_BLASTER 144 -#define MZ2_DAEDALUS_BLASTER 145 -#define MZ2_MEDIC_BLASTER_2 146 -#define MZ2_CARRIER_RAILGUN 147 -#define MZ2_WIDOW_DISRUPTOR 148 -#define MZ2_WIDOW_BLASTER 149 -#define MZ2_WIDOW_RAIL 150 -#define MZ2_WIDOW_PLASMABEAM 151 // PMM - not used -#define MZ2_CARRIER_MACHINEGUN_L2 152 -#define MZ2_CARRIER_MACHINEGUN_R2 153 -#define MZ2_WIDOW_RAIL_LEFT 154 -#define MZ2_WIDOW_RAIL_RIGHT 155 -#define MZ2_WIDOW_BLASTER_SWEEP1 156 -#define MZ2_WIDOW_BLASTER_SWEEP2 157 -#define MZ2_WIDOW_BLASTER_SWEEP3 158 -#define MZ2_WIDOW_BLASTER_SWEEP4 159 -#define MZ2_WIDOW_BLASTER_SWEEP5 160 -#define MZ2_WIDOW_BLASTER_SWEEP6 161 -#define MZ2_WIDOW_BLASTER_SWEEP7 162 -#define MZ2_WIDOW_BLASTER_SWEEP8 163 -#define MZ2_WIDOW_BLASTER_SWEEP9 164 -#define MZ2_WIDOW_BLASTER_100 165 -#define MZ2_WIDOW_BLASTER_90 166 -#define MZ2_WIDOW_BLASTER_80 167 -#define MZ2_WIDOW_BLASTER_70 168 -#define MZ2_WIDOW_BLASTER_60 169 -#define MZ2_WIDOW_BLASTER_50 170 -#define MZ2_WIDOW_BLASTER_40 171 -#define MZ2_WIDOW_BLASTER_30 172 -#define MZ2_WIDOW_BLASTER_20 173 -#define MZ2_WIDOW_BLASTER_10 174 -#define MZ2_WIDOW_BLASTER_0 175 -#define MZ2_WIDOW_BLASTER_10L 176 -#define MZ2_WIDOW_BLASTER_20L 177 -#define MZ2_WIDOW_BLASTER_30L 178 -#define MZ2_WIDOW_BLASTER_40L 179 -#define MZ2_WIDOW_BLASTER_50L 180 -#define MZ2_WIDOW_BLASTER_60L 181 -#define MZ2_WIDOW_BLASTER_70L 182 -#define MZ2_WIDOW_RUN_1 183 -#define MZ2_WIDOW_RUN_2 184 -#define MZ2_WIDOW_RUN_3 185 -#define MZ2_WIDOW_RUN_4 186 -#define MZ2_WIDOW_RUN_5 187 -#define MZ2_WIDOW_RUN_6 188 -#define MZ2_WIDOW_RUN_7 189 -#define MZ2_WIDOW_RUN_8 190 -#define MZ2_CARRIER_ROCKET_1 191 -#define MZ2_CARRIER_ROCKET_2 192 -#define MZ2_CARRIER_ROCKET_3 193 -#define MZ2_CARRIER_ROCKET_4 194 -#define MZ2_WIDOW2_BEAMER_1 195 -#define MZ2_WIDOW2_BEAMER_2 196 -#define MZ2_WIDOW2_BEAMER_3 197 -#define MZ2_WIDOW2_BEAMER_4 198 -#define MZ2_WIDOW2_BEAMER_5 199 -#define MZ2_WIDOW2_BEAM_SWEEP_1 200 -#define MZ2_WIDOW2_BEAM_SWEEP_2 201 -#define MZ2_WIDOW2_BEAM_SWEEP_3 202 -#define MZ2_WIDOW2_BEAM_SWEEP_4 203 -#define MZ2_WIDOW2_BEAM_SWEEP_5 204 -#define MZ2_WIDOW2_BEAM_SWEEP_6 205 -#define MZ2_WIDOW2_BEAM_SWEEP_7 206 -#define MZ2_WIDOW2_BEAM_SWEEP_8 207 -#define MZ2_WIDOW2_BEAM_SWEEP_9 208 -#define MZ2_WIDOW2_BEAM_SWEEP_10 209 -#define MZ2_WIDOW2_BEAM_SWEEP_11 210 +extern vec3_t monster_flash_offset[]; -// ROGUE - -extern vec3_t monster_flash_offset []; - - -// temp entity events -// -// Temp entity events are for things that happen -// at a location seperate from any existing entity. -// Temporary entity messages are explicitly constructed -// and broadcast. +/* Temp entity events are for things that happen + at a location seperate from any existing entity. + Temporary entity messages are explicitly constructed + and broadcast. */ typedef enum { TE_GUNSHOT, @@ -897,7 +854,7 @@ typedef enum TE_MEDIC_CABLE_ATTACK, TE_BFG_EXPLOSION, TE_BFG_BIGEXPLOSION, - TE_BOSSTPORT, // used as '22' in a map, so DON'T RENUMBER!!! + TE_BOSSTPORT, /* used as '22' in a map, so DON'T RENUMBER!!! */ TE_BFG_LASER, TE_GRAPPLE_CABLE, TE_WELDING_SPARKS, @@ -905,7 +862,6 @@ typedef enum TE_BLUEHYPERBLASTER, TE_PLASMA_EXPLOSION, TE_TUNNEL_SPARKS, - //ROGUE TE_BLASTER2, TE_RAILTRAIL2, TE_FLAME, @@ -932,137 +888,122 @@ typedef enum TE_EXPLOSION1_BIG, TE_EXPLOSION1_NP, TE_FLECHETTE - //ROGUE } temp_event_t; -#define SPLASH_UNKNOWN 0 -#define SPLASH_SPARKS 1 -#define SPLASH_BLUE_WATER 2 -#define SPLASH_BROWN_WATER 3 -#define SPLASH_SLIME 4 -#define SPLASH_LAVA 5 -#define SPLASH_BLOOD 6 +#define SPLASH_UNKNOWN 0 +#define SPLASH_SPARKS 1 +#define SPLASH_BLUE_WATER 2 +#define SPLASH_BROWN_WATER 3 +#define SPLASH_SLIME 4 +#define SPLASH_LAVA 5 +#define SPLASH_BLOOD 6 +/* sound channels: + channel 0 never willingly overrides + other channels (1-7) allways override + a playing sound on that channel */ +#define CHAN_AUTO 0 +#define CHAN_WEAPON 1 +#define CHAN_VOICE 2 +#define CHAN_ITEM 3 +#define CHAN_BODY 4 +/* modifier flags */ +#define CHAN_NO_PHS_ADD 8 /* send to all clients, not just ones in PHS (ATTN 0 will also do this) */ +#define CHAN_RELIABLE 16 /* send by reliable message, not datagram */ -// sound channels -// channel 0 never willingly overrides -// other channels (1-7) allways override a playing sound on that channel -#define CHAN_AUTO 0 -#define CHAN_WEAPON 1 -#define CHAN_VOICE 2 -#define CHAN_ITEM 3 -#define CHAN_BODY 4 -// modifier flags -#define CHAN_NO_PHS_ADD 8 // send to all clients, not just ones in PHS (ATTN 0 will also do this) -#define CHAN_RELIABLE 16 // send by reliable message, not datagram +/* sound attenuation values */ +#define ATTN_NONE 0 /* full volume the entire level */ +#define ATTN_NORM 1 +#define ATTN_IDLE 2 +#define ATTN_STATIC 3 /* diminish very rapidly with distance */ +/* player_state->stats[] indexes */ +#define STAT_HEALTH_ICON 0 +#define STAT_HEALTH 1 +#define STAT_AMMO_ICON 2 +#define STAT_AMMO 3 +#define STAT_ARMOR_ICON 4 +#define STAT_ARMOR 5 +#define STAT_SELECTED_ICON 6 +#define STAT_PICKUP_ICON 7 +#define STAT_PICKUP_STRING 8 +#define STAT_TIMER_ICON 9 +#define STAT_TIMER 10 +#define STAT_HELPICON 11 +#define STAT_SELECTED_ITEM 12 +#define STAT_LAYOUTS 13 +#define STAT_FRAGS 14 +#define STAT_FLASHES 15 /* cleared each frame, 1 = health, 2 = armor */ +#define STAT_CHASE 16 +#define STAT_SPECTATOR 17 -// sound attenuation values -#define ATTN_NONE 0 // full volume the entire level -#define ATTN_NORM 1 -#define ATTN_IDLE 2 -#define ATTN_STATIC 3 // diminish very rapidly with distance +#define MAX_STATS 32 +/* dmflags->value flags */ +#define DF_NO_HEALTH 0x00000001 /* 1 */ +#define DF_NO_ITEMS 0x00000002 /* 2 */ +#define DF_WEAPONS_STAY 0x00000004 /* 4 */ +#define DF_NO_FALLING 0x00000008 /* 8 */ +#define DF_INSTANT_ITEMS 0x00000010 /* 16 */ +#define DF_SAME_LEVEL 0x00000020 /* 32 */ +#define DF_SKINTEAMS 0x00000040 /* 64 */ +#define DF_MODELTEAMS 0x00000080 /* 128 */ +#define DF_NO_FRIENDLY_FIRE 0x00000100 /* 256 */ +#define DF_SPAWN_FARTHEST 0x00000200 /* 512 */ +#define DF_FORCE_RESPAWN 0x00000400 /* 1024 */ +#define DF_NO_ARMOR 0x00000800 /* 2048 */ +#define DF_ALLOW_EXIT 0x00001000 /* 4096 */ +#define DF_INFINITE_AMMO 0x00002000 /* 8192 */ +#define DF_QUAD_DROP 0x00004000 /* 16384 */ +#define DF_FIXED_FOV 0x00008000 /* 32768 */ +#define DF_QUADFIRE_DROP 0x00010000 /* 65536 */ +#define DF_NO_MINES 0x00020000 +#define DF_NO_STACK_DOUBLE 0x00040000 +#define DF_NO_NUKES 0x00080000 +#define DF_NO_SPHERES 0x00100000 -// player_state->stats[] indexes -#define STAT_HEALTH_ICON 0 -#define STAT_HEALTH 1 -#define STAT_AMMO_ICON 2 -#define STAT_AMMO 3 -#define STAT_ARMOR_ICON 4 -#define STAT_ARMOR 5 -#define STAT_SELECTED_ICON 6 -#define STAT_PICKUP_ICON 7 -#define STAT_PICKUP_STRING 8 -#define STAT_TIMER_ICON 9 -#define STAT_TIMER 10 -#define STAT_HELPICON 11 -#define STAT_SELECTED_ITEM 12 -#define STAT_LAYOUTS 13 -#define STAT_FRAGS 14 -#define STAT_FLASHES 15 // cleared each frame, 1 = health, 2 = armor -#define STAT_CHASE 16 -#define STAT_SPECTATOR 17 +#define ROGUE_VERSION_STRING "08/21/1998 Beta 2 for Ensemble" -#define MAX_STATS 32 - - -// dmflags->value flags -#define DF_NO_HEALTH 0x00000001 // 1 -#define DF_NO_ITEMS 0x00000002 // 2 -#define DF_WEAPONS_STAY 0x00000004 // 4 -#define DF_NO_FALLING 0x00000008 // 8 -#define DF_INSTANT_ITEMS 0x00000010 // 16 -#define DF_SAME_LEVEL 0x00000020 // 32 -#define DF_SKINTEAMS 0x00000040 // 64 -#define DF_MODELTEAMS 0x00000080 // 128 -#define DF_NO_FRIENDLY_FIRE 0x00000100 // 256 -#define DF_SPAWN_FARTHEST 0x00000200 // 512 -#define DF_FORCE_RESPAWN 0x00000400 // 1024 -#define DF_NO_ARMOR 0x00000800 // 2048 -#define DF_ALLOW_EXIT 0x00001000 // 4096 -#define DF_INFINITE_AMMO 0x00002000 // 8192 -#define DF_QUAD_DROP 0x00004000 // 16384 -#define DF_FIXED_FOV 0x00008000 // 32768 - -// RAFAEL -#define DF_QUADFIRE_DROP 0x00010000 // 65536 - -//ROGUE -#define DF_NO_MINES 0x00020000 -#define DF_NO_STACK_DOUBLE 0x00040000 -#define DF_NO_NUKES 0x00080000 -#define DF_NO_SPHERES 0x00100000 -//ROGUE - -#define ROGUE_VERSION_STRING "08/21/1998 Beta 2 for Ensemble" - -// ROGUE /* -========================================================== + * ========================================================== + * + * ELEMENTS COMMUNICATED ACROSS THE NET + * + * ========================================================== + */ - ELEMENTS COMMUNICATED ACROSS THE NET +#define ANGLE2SHORT(x) ((int)((x) * 65536 / 360) & 65535) +#define SHORT2ANGLE(x) ((x) * (360.0 / 65536)) -========================================================== -*/ +/* config strings are a general means of communication from + the server to all connected clients. Each config string + can be at most MAX_QPATH characters. */ +#define CS_NAME 0 +#define CS_CDTRACK 1 +#define CS_SKY 2 +#define CS_SKYAXIS 3 /* %f %f %f format */ +#define CS_SKYROTATE 4 +#define CS_STATUSBAR 5 /* display program string */ -#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535) -#define SHORT2ANGLE(x) ((x)*(360.0/65536)) +#define CS_AIRACCEL 29 /* air acceleration control */ +#define CS_MAXCLIENTS 30 +#define CS_MAPCHECKSUM 31 /* for catching cheater maps */ +#define CS_MODELS 32 +#define CS_SOUNDS (CS_MODELS + MAX_MODELS) +#define CS_IMAGES (CS_SOUNDS + MAX_SOUNDS) +#define CS_LIGHTS (CS_IMAGES + MAX_IMAGES) +#define CS_ITEMS (CS_LIGHTS + MAX_LIGHTSTYLES) +#define CS_PLAYERSKINS (CS_ITEMS + MAX_ITEMS) +#define CS_GENERAL (CS_PLAYERSKINS + MAX_CLIENTS) +#define MAX_CONFIGSTRINGS (CS_GENERAL + MAX_GENERAL) -// -// config strings are a general means of communication from -// the server to all connected clients. -// Each config string can be at most MAX_QPATH characters. -// -#define CS_NAME 0 -#define CS_CDTRACK 1 -#define CS_SKY 2 -#define CS_SKYAXIS 3 // %f %f %f format -#define CS_SKYROTATE 4 -#define CS_STATUSBAR 5 // display program string +/* ============================================== */ -#define CS_AIRACCEL 29 // air acceleration control -#define CS_MAXCLIENTS 30 -#define CS_MAPCHECKSUM 31 // for catching cheater maps - -#define CS_MODELS 32 -#define CS_SOUNDS (CS_MODELS+MAX_MODELS) -#define CS_IMAGES (CS_SOUNDS+MAX_SOUNDS) -#define CS_LIGHTS (CS_IMAGES+MAX_IMAGES) -#define CS_ITEMS (CS_LIGHTS+MAX_LIGHTSTYLES) -#define CS_PLAYERSKINS (CS_ITEMS+MAX_ITEMS) -#define CS_GENERAL (CS_PLAYERSKINS+MAX_CLIENTS) -#define MAX_CONFIGSTRINGS (CS_GENERAL+MAX_GENERAL) - - -//============================================== - - -// entity_state_t->event values -// ertity events are for effects that take place reletive -// to an existing entities origin. Very network efficient. -// All muzzle flashes really should be converted to events... +/* entity_state_t->event values + entity events are for effects that take place reletive + to an existing entities origin. Very network efficient. + All muzzle flashes really should be converted to events... */ typedef enum { EV_NONE, @@ -1075,81 +1016,64 @@ typedef enum EV_OTHER_TELEPORT } entity_event_t; - -// entity_state_t is the information conveyed from the server -// in an update message about entities that the client will -// need to render in some way +/* entity_state_t is the information conveyed from the server + in an update message about entities that the client will + need to render in some way */ typedef struct entity_state_s { - int number; // edict index + int number; /* edict index */ - vec3_t origin; - vec3_t angles; - vec3_t old_origin; // for lerping - int modelindex; - int modelindex2, modelindex3, modelindex4; // weapons, CTF flags, etc - int frame; - int skinnum; - unsigned int effects; // PGM - we're filling it, so it needs to be unsigned - int renderfx; - int solid; // for client side prediction, 8*(bits 0-4) is x/y radius - // 8*(bits 5-9) is z down distance, 8(bits10-15) is z up - // gi.linkentity sets this properly - int sound; // for looping sounds, to guarantee shutoff - int event; // impulse events -- muzzle flashes, footsteps, etc - // events only go out for a single frame, they - // are automatically cleared each frame + vec3_t origin; + vec3_t angles; + vec3_t old_origin; /* for lerping */ + int modelindex; + int modelindex2, modelindex3, modelindex4; /* weapons, CTF flags, etc */ + int frame; + int skinnum; + unsigned int effects; + int renderfx; + int solid; /* for client side prediction, 8*(bits 0-4) is x/y radius */ + /* 8*(bits 5-9) is z down distance, 8(bits10-15) is z up */ + /* gi.linkentity sets this properly */ + int sound; /* for looping sounds, to guarantee shutoff */ + int event; /* impulse events -- muzzle flashes, footsteps, etc */ + /* events only go out for a single frame, they */ + /* are automatically cleared each frame */ } entity_state_t; -//============================================== +/* ============================================== */ - -// player_state_t is the information needed in addition to pmove_state_t -// to rendered a view. There will only be 10 player_state_t sent each second, -// but the number of pmove_state_t changes will be reletive to client -// frame rates +/* player_state_t is the information needed in addition to pmove_state_t + to rendered a view. There will only be 10 player_state_t sent each second, + but the number of pmove_state_t changes will be reletive to client + frame rates */ typedef struct { - pmove_state_t pmove; // for prediction + pmove_state_t pmove; /* for prediction */ - // these fields do not need to be communicated bit-precise + vec3_t viewangles; /* for fixed views */ + vec3_t viewoffset; /* add to pmovestate->origin */ + vec3_t kick_angles; /* add to view direction to get render angles */ + /* set by weapon kicks, pain effects, etc */ - vec3_t viewangles; // for fixed views - vec3_t viewoffset; // add to pmovestate->origin - vec3_t kick_angles; // add to view direction to get render angles - // set by weapon kicks, pain effects, etc + vec3_t gunangles; + vec3_t gunoffset; + int gunindex; + int gunframe; - vec3_t gunangles; - vec3_t gunoffset; - int gunindex; - int gunframe; + float blend[4]; /* rgba full screen effect */ + float fov; /* horizontal field of view */ + int rdflags; /* refdef flags */ - float blend[4]; // rgba full screen effect - - float fov; // horizontal field of view - - int rdflags; // refdef flags - - short stats[MAX_STATS]; // fast status bar updates + short stats[MAX_STATS]; /* fast status bar updates */ } player_state_t; - -// ================== -// PGM -#define VIDREF_GL 1 -#define VIDREF_SOFT 2 -#define VIDREF_OTHER 3 +#define VIDREF_GL 1 +#define VIDREF_SOFT 2 +#define VIDREF_OTHER 3 extern int vidref_val; -// PGM -// ================== - -/* - * PATCH: eliasm - * - * Error-safe versions of fread and fwrite - */ -size_t verify_fread( void *, size_t, size_t, FILE * ); -size_t verify_fwrite( void *, size_t, size_t, FILE * ); +size_t verify_fread(void *, size_t, size_t, FILE *); +size_t verify_fwrite(void *, size_t, size_t, FILE *);