ref: 02d16fad3aa65b08b6e947d4c2e8745d041638c4
parent: d64e9404b80b1428526be60cebc1987a12f65843
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Thu Nov 9 21:35:16 EST 2023
mostly just reformat a bit
--- a/Makefile
+++ b/Makefile
@@ -4,8 +4,10 @@
BIN=${DESTDIR}${PREFIX}/bin
SDL2_CFLAGS=$$(pkg-config --cflags sdl2)
SDL2_LDFLAGS=$$(pkg-config --libs sdl2)
-CFLAGS?=-O2 -g -Wall -Wextra -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-implicit-fallthrough
-CFLAGS+=-fms-extensions -I3rd/parg -Iunix -I. ${SDL2_CFLAGS}
+CFLAGS?=-O2 -g
+CFLAGS+=-Wall -Wextra -Wno-unknown-pragmas -Wno-missing-field-initializers -Wno-implicit-fallthrough
+CFLAGS+=-ffast-math -fms-extensions
+CFLAGS+=-I3rd/parg -Iunix -I. ${SDL2_CFLAGS}
LDFLAGS?=
LDFLAGS+=-lm ${SDL2_LDFLAGS}
--- a/anorms.h
+++ b/anorms.h
@@ -1,162 +1,162 @@
-{-0.525731, 0.000000, 0.850651},
-{-0.442863, 0.238856, 0.864188},
-{-0.295242, 0.000000, 0.955423},
-{-0.309017, 0.500000, 0.809017},
-{-0.162460, 0.262866, 0.951056},
-{0.000000, 0.000000, 1.000000},
-{0.000000, 0.850651, 0.525731},
-{-0.147621, 0.716567, 0.681718},
-{0.147621, 0.716567, 0.681718},
-{0.000000, 0.525731, 0.850651},
-{0.309017, 0.500000, 0.809017},
-{0.525731, 0.000000, 0.850651},
-{0.295242, 0.000000, 0.955423},
-{0.442863, 0.238856, 0.864188},
-{0.162460, 0.262866, 0.951056},
-{-0.681718, 0.147621, 0.716567},
-{-0.809017, 0.309017, 0.500000},
-{-0.587785, 0.425325, 0.688191},
-{-0.850651, 0.525731, 0.000000},
-{-0.864188, 0.442863, 0.238856},
-{-0.716567, 0.681718, 0.147621},
-{-0.688191, 0.587785, 0.425325},
-{-0.500000, 0.809017, 0.309017},
-{-0.238856, 0.864188, 0.442863},
-{-0.425325, 0.688191, 0.587785},
-{-0.716567, 0.681718, -0.147621},
-{-0.500000, 0.809017, -0.309017},
-{-0.525731, 0.850651, 0.000000},
-{0.000000, 0.850651, -0.525731},
-{-0.238856, 0.864188, -0.442863},
-{0.000000, 0.955423, -0.295242},
-{-0.262866, 0.951056, -0.162460},
-{0.000000, 1.000000, 0.000000},
-{0.000000, 0.955423, 0.295242},
-{-0.262866, 0.951056, 0.162460},
-{0.238856, 0.864188, 0.442863},
-{0.262866, 0.951056, 0.162460},
-{0.500000, 0.809017, 0.309017},
-{0.238856, 0.864188, -0.442863},
-{0.262866, 0.951056, -0.162460},
-{0.500000, 0.809017, -0.309017},
-{0.850651, 0.525731, 0.000000},
-{0.716567, 0.681718, 0.147621},
-{0.716567, 0.681718, -0.147621},
-{0.525731, 0.850651, 0.000000},
-{0.425325, 0.688191, 0.587785},
-{0.864188, 0.442863, 0.238856},
-{0.688191, 0.587785, 0.425325},
-{0.809017, 0.309017, 0.500000},
-{0.681718, 0.147621, 0.716567},
-{0.587785, 0.425325, 0.688191},
-{0.955423, 0.295242, 0.000000},
-{1.000000, 0.000000, 0.000000},
-{0.951056, 0.162460, 0.262866},
-{0.850651, -0.525731, 0.000000},
-{0.955423, -0.295242, 0.000000},
-{0.864188, -0.442863, 0.238856},
-{0.951056, -0.162460, 0.262866},
-{0.809017, -0.309017, 0.500000},
-{0.681718, -0.147621, 0.716567},
-{0.850651, 0.000000, 0.525731},
-{0.864188, 0.442863, -0.238856},
-{0.809017, 0.309017, -0.500000},
-{0.951056, 0.162460, -0.262866},
-{0.525731, 0.000000, -0.850651},
-{0.681718, 0.147621, -0.716567},
-{0.681718, -0.147621, -0.716567},
-{0.850651, 0.000000, -0.525731},
-{0.809017, -0.309017, -0.500000},
-{0.864188, -0.442863, -0.238856},
-{0.951056, -0.162460, -0.262866},
-{0.147621, 0.716567, -0.681718},
-{0.309017, 0.500000, -0.809017},
-{0.425325, 0.688191, -0.587785},
-{0.442863, 0.238856, -0.864188},
-{0.587785, 0.425325, -0.688191},
-{0.688191, 0.587785, -0.425325},
-{-0.147621, 0.716567, -0.681718},
-{-0.309017, 0.500000, -0.809017},
-{0.000000, 0.525731, -0.850651},
-{-0.525731, 0.000000, -0.850651},
-{-0.442863, 0.238856, -0.864188},
-{-0.295242, 0.000000, -0.955423},
-{-0.162460, 0.262866, -0.951056},
-{0.000000, 0.000000, -1.000000},
-{0.295242, 0.000000, -0.955423},
-{0.162460, 0.262866, -0.951056},
-{-0.442863, -0.238856, -0.864188},
-{-0.309017, -0.500000, -0.809017},
-{-0.162460, -0.262866, -0.951056},
-{0.000000, -0.850651, -0.525731},
-{-0.147621, -0.716567, -0.681718},
-{0.147621, -0.716567, -0.681718},
-{0.000000, -0.525731, -0.850651},
-{0.309017, -0.500000, -0.809017},
-{0.442863, -0.238856, -0.864188},
-{0.162460, -0.262866, -0.951056},
-{0.238856, -0.864188, -0.442863},
-{0.500000, -0.809017, -0.309017},
-{0.425325, -0.688191, -0.587785},
-{0.716567, -0.681718, -0.147621},
-{0.688191, -0.587785, -0.425325},
-{0.587785, -0.425325, -0.688191},
-{0.000000, -0.955423, -0.295242},
-{0.000000, -1.000000, 0.000000},
-{0.262866, -0.951056, -0.162460},
-{0.000000, -0.850651, 0.525731},
-{0.000000, -0.955423, 0.295242},
-{0.238856, -0.864188, 0.442863},
-{0.262866, -0.951056, 0.162460},
-{0.500000, -0.809017, 0.309017},
-{0.716567, -0.681718, 0.147621},
-{0.525731, -0.850651, 0.000000},
-{-0.238856, -0.864188, -0.442863},
-{-0.500000, -0.809017, -0.309017},
-{-0.262866, -0.951056, -0.162460},
-{-0.850651, -0.525731, 0.000000},
-{-0.716567, -0.681718, -0.147621},
-{-0.716567, -0.681718, 0.147621},
-{-0.525731, -0.850651, 0.000000},
-{-0.500000, -0.809017, 0.309017},
-{-0.238856, -0.864188, 0.442863},
-{-0.262866, -0.951056, 0.162460},
-{-0.864188, -0.442863, 0.238856},
-{-0.809017, -0.309017, 0.500000},
-{-0.688191, -0.587785, 0.425325},
-{-0.681718, -0.147621, 0.716567},
-{-0.442863, -0.238856, 0.864188},
-{-0.587785, -0.425325, 0.688191},
-{-0.309017, -0.500000, 0.809017},
-{-0.147621, -0.716567, 0.681718},
-{-0.425325, -0.688191, 0.587785},
-{-0.162460, -0.262866, 0.951056},
-{0.442863, -0.238856, 0.864188},
-{0.162460, -0.262866, 0.951056},
-{0.309017, -0.500000, 0.809017},
-{0.147621, -0.716567, 0.681718},
-{0.000000, -0.525731, 0.850651},
-{0.425325, -0.688191, 0.587785},
-{0.587785, -0.425325, 0.688191},
-{0.688191, -0.587785, 0.425325},
-{-0.955423, 0.295242, 0.000000},
-{-0.951056, 0.162460, 0.262866},
-{-1.000000, 0.000000, 0.000000},
-{-0.850651, 0.000000, 0.525731},
-{-0.955423, -0.295242, 0.000000},
-{-0.951056, -0.162460, 0.262866},
-{-0.864188, 0.442863, -0.238856},
-{-0.951056, 0.162460, -0.262866},
-{-0.809017, 0.309017, -0.500000},
-{-0.864188, -0.442863, -0.238856},
-{-0.951056, -0.162460, -0.262866},
-{-0.809017, -0.309017, -0.500000},
-{-0.681718, 0.147621, -0.716567},
-{-0.681718, -0.147621, -0.716567},
-{-0.850651, 0.000000, -0.525731},
-{-0.688191, 0.587785, -0.425325},
-{-0.587785, 0.425325, -0.688191},
-{-0.425325, 0.688191, -0.587785},
-{-0.425325, -0.688191, -0.587785},
-{-0.587785, -0.425325, -0.688191},
-{-0.688191, -0.587785, -0.425325},
+{-0.525731, 0.000000, 0.850651},
+{-0.442863, 0.238856, 0.864188},
+{-0.295242, 0.000000, 0.955423},
+{-0.309017, 0.500000, 0.809017},
+{-0.162460, 0.262866, 0.951056},
+{0.000000, 0.000000, 1.000000},
+{0.000000, 0.850651, 0.525731},
+{-0.147621, 0.716567, 0.681718},
+{0.147621, 0.716567, 0.681718},
+{0.000000, 0.525731, 0.850651},
+{0.309017, 0.500000, 0.809017},
+{0.525731, 0.000000, 0.850651},
+{0.295242, 0.000000, 0.955423},
+{0.442863, 0.238856, 0.864188},
+{0.162460, 0.262866, 0.951056},
+{-0.681718, 0.147621, 0.716567},
+{-0.809017, 0.309017, 0.500000},
+{-0.587785, 0.425325, 0.688191},
+{-0.850651, 0.525731, 0.000000},
+{-0.864188, 0.442863, 0.238856},
+{-0.716567, 0.681718, 0.147621},
+{-0.688191, 0.587785, 0.425325},
+{-0.500000, 0.809017, 0.309017},
+{-0.238856, 0.864188, 0.442863},
+{-0.425325, 0.688191, 0.587785},
+{-0.716567, 0.681718, -0.147621},
+{-0.500000, 0.809017, -0.309017},
+{-0.525731, 0.850651, 0.000000},
+{0.000000, 0.850651, -0.525731},
+{-0.238856, 0.864188, -0.442863},
+{0.000000, 0.955423, -0.295242},
+{-0.262866, 0.951056, -0.162460},
+{0.000000, 1.000000, 0.000000},
+{0.000000, 0.955423, 0.295242},
+{-0.262866, 0.951056, 0.162460},
+{0.238856, 0.864188, 0.442863},
+{0.262866, 0.951056, 0.162460},
+{0.500000, 0.809017, 0.309017},
+{0.238856, 0.864188, -0.442863},
+{0.262866, 0.951056, -0.162460},
+{0.500000, 0.809017, -0.309017},
+{0.850651, 0.525731, 0.000000},
+{0.716567, 0.681718, 0.147621},
+{0.716567, 0.681718, -0.147621},
+{0.525731, 0.850651, 0.000000},
+{0.425325, 0.688191, 0.587785},
+{0.864188, 0.442863, 0.238856},
+{0.688191, 0.587785, 0.425325},
+{0.809017, 0.309017, 0.500000},
+{0.681718, 0.147621, 0.716567},
+{0.587785, 0.425325, 0.688191},
+{0.955423, 0.295242, 0.000000},
+{1.000000, 0.000000, 0.000000},
+{0.951056, 0.162460, 0.262866},
+{0.850651, -0.525731, 0.000000},
+{0.955423, -0.295242, 0.000000},
+{0.864188, -0.442863, 0.238856},
+{0.951056, -0.162460, 0.262866},
+{0.809017, -0.309017, 0.500000},
+{0.681718, -0.147621, 0.716567},
+{0.850651, 0.000000, 0.525731},
+{0.864188, 0.442863, -0.238856},
+{0.809017, 0.309017, -0.500000},
+{0.951056, 0.162460, -0.262866},
+{0.525731, 0.000000, -0.850651},
+{0.681718, 0.147621, -0.716567},
+{0.681718, -0.147621, -0.716567},
+{0.850651, 0.000000, -0.525731},
+{0.809017, -0.309017, -0.500000},
+{0.864188, -0.442863, -0.238856},
+{0.951056, -0.162460, -0.262866},
+{0.147621, 0.716567, -0.681718},
+{0.309017, 0.500000, -0.809017},
+{0.425325, 0.688191, -0.587785},
+{0.442863, 0.238856, -0.864188},
+{0.587785, 0.425325, -0.688191},
+{0.688191, 0.587785, -0.425325},
+{-0.147621, 0.716567, -0.681718},
+{-0.309017, 0.500000, -0.809017},
+{0.000000, 0.525731, -0.850651},
+{-0.525731, 0.000000, -0.850651},
+{-0.442863, 0.238856, -0.864188},
+{-0.295242, 0.000000, -0.955423},
+{-0.162460, 0.262866, -0.951056},
+{0.000000, 0.000000, -1.000000},
+{0.295242, 0.000000, -0.955423},
+{0.162460, 0.262866, -0.951056},
+{-0.442863, -0.238856, -0.864188},
+{-0.309017, -0.500000, -0.809017},
+{-0.162460, -0.262866, -0.951056},
+{0.000000, -0.850651, -0.525731},
+{-0.147621, -0.716567, -0.681718},
+{0.147621, -0.716567, -0.681718},
+{0.000000, -0.525731, -0.850651},
+{0.309017, -0.500000, -0.809017},
+{0.442863, -0.238856, -0.864188},
+{0.162460, -0.262866, -0.951056},
+{0.238856, -0.864188, -0.442863},
+{0.500000, -0.809017, -0.309017},
+{0.425325, -0.688191, -0.587785},
+{0.716567, -0.681718, -0.147621},
+{0.688191, -0.587785, -0.425325},
+{0.587785, -0.425325, -0.688191},
+{0.000000, -0.955423, -0.295242},
+{0.000000, -1.000000, 0.000000},
+{0.262866, -0.951056, -0.162460},
+{0.000000, -0.850651, 0.525731},
+{0.000000, -0.955423, 0.295242},
+{0.238856, -0.864188, 0.442863},
+{0.262866, -0.951056, 0.162460},
+{0.500000, -0.809017, 0.309017},
+{0.716567, -0.681718, 0.147621},
+{0.525731, -0.850651, 0.000000},
+{-0.238856, -0.864188, -0.442863},
+{-0.500000, -0.809017, -0.309017},
+{-0.262866, -0.951056, -0.162460},
+{-0.850651, -0.525731, 0.000000},
+{-0.716567, -0.681718, -0.147621},
+{-0.716567, -0.681718, 0.147621},
+{-0.525731, -0.850651, 0.000000},
+{-0.500000, -0.809017, 0.309017},
+{-0.238856, -0.864188, 0.442863},
+{-0.262866, -0.951056, 0.162460},
+{-0.864188, -0.442863, 0.238856},
+{-0.809017, -0.309017, 0.500000},
+{-0.688191, -0.587785, 0.425325},
+{-0.681718, -0.147621, 0.716567},
+{-0.442863, -0.238856, 0.864188},
+{-0.587785, -0.425325, 0.688191},
+{-0.309017, -0.500000, 0.809017},
+{-0.147621, -0.716567, 0.681718},
+{-0.425325, -0.688191, 0.587785},
+{-0.162460, -0.262866, 0.951056},
+{0.442863, -0.238856, 0.864188},
+{0.162460, -0.262866, 0.951056},
+{0.309017, -0.500000, 0.809017},
+{0.147621, -0.716567, 0.681718},
+{0.000000, -0.525731, 0.850651},
+{0.425325, -0.688191, 0.587785},
+{0.587785, -0.425325, 0.688191},
+{0.688191, -0.587785, 0.425325},
+{-0.955423, 0.295242, 0.000000},
+{-0.951056, 0.162460, 0.262866},
+{-1.000000, 0.000000, 0.000000},
+{-0.850651, 0.000000, 0.525731},
+{-0.955423, -0.295242, 0.000000},
+{-0.951056, -0.162460, 0.262866},
+{-0.864188, 0.442863, -0.238856},
+{-0.951056, 0.162460, -0.262866},
+{-0.809017, 0.309017, -0.500000},
+{-0.864188, -0.442863, -0.238856},
+{-0.951056, -0.162460, -0.262866},
+{-0.809017, -0.309017, -0.500000},
+{-0.681718, 0.147621, -0.716567},
+{-0.681718, -0.147621, -0.716567},
+{-0.850651, 0.000000, -0.525731},
+{-0.688191, 0.587785, -0.425325},
+{-0.587785, 0.425325, -0.688191},
+{-0.425325, 0.688191, -0.587785},
+{-0.425325, -0.688191, -0.587785},
+{-0.587785, -0.425325, -0.688191},
+{-0.688191, -0.587785, -0.425325},
--- a/bspfile.h
+++ b/bspfile.h
@@ -73,7 +73,7 @@
typedef struct
{
- int version;
+ int version;
lump_t lumps[HEADER_LUMPS];
} dheader_t;
@@ -191,7 +191,7 @@
short side;
int firstedge; // we must support > 64k edges
- short numedges;
+ short numedges;
short texinfo;
// lighting info
@@ -205,7 +205,7 @@
int side;
int firstedge; // we must support > 64k edges
- int numedges;
+ int numedges;
int texinfo;
// lighting info
--- a/chase.c
+++ b/chase.c
@@ -23,7 +23,7 @@
void Chase_Reset (void)
{
// for respawning and teleporting
-// start position 12 units behind head
+ // start position 12 units behind head
}
void TraceLine (vec3_t start, vec3_t end, vec3_t impact)
@@ -49,7 +49,7 @@
// calc exact destination
for (i=0 ; i<3 ; i++)
- chase_dest[i] = r_refdef.vieworg[i]
+ chase_dest[i] = r_refdef.vieworg[i]
- forward[i]*chase_back.value
- right[i]*chase_right.value;
chase_dest[2] = r_refdef.vieworg[2] + chase_up.value;
--- a/cl_demo.c
+++ b/cl_demo.c
@@ -134,7 +134,7 @@
return;
}
cls.demorecording = 1;
- cls.forcetrack = trk;
+ cls.forcetrack = trk;
}
/* when a demo is playing back, all NET_SendMessages are skipped, and
--- a/cl_input.c
+++ b/cl_input.c
@@ -44,7 +44,7 @@
if (k == b->down[0] || k == b->down[1])
return; // repeating key
-
+
if (!b->down[0])
b->down[0] = k;
else if (!b->down[1])
@@ -54,7 +54,7 @@
Con_Printf ("Three keys down for a button!\n");
return;
}
-
+
if (b->state & 1)
return; // still down
b->state |= 1 + 2; // down + impulse down
@@ -64,7 +64,7 @@
{
int k;
char *c;
-
+
c = Cmd_Argv(1);
if (c[0])
k = atoi(c);
@@ -152,12 +152,12 @@
{
float val;
qboolean impulsedown, impulseup, down;
-
+
impulsedown = key->state & 2;
impulseup = key->state & 4;
down = key->state & 1;
val = 0;
-
+
if (impulsedown && !impulseup)
val = down ? 0.5 : 0;
else if (impulseup && !impulsedown)
@@ -168,7 +168,7 @@
val = down ? 0.75 : 0.25;
key->state &= 1; // clear impulses
-
+
return val;
}
@@ -201,7 +201,7 @@
{
float speed;
float up, down;
-
+
if (in_speed.state & 1)
speed = host_frametime * cl_anglespeedkey.value;
else
@@ -219,16 +219,16 @@
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * CL_KeyState (&in_forward);
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * CL_KeyState (&in_back);
}
-
+
up = CL_KeyState (&in_lookup);
down = CL_KeyState(&in_lookdown);
-
+
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up;
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * down;
if (up || down)
V_StopPitchDrift ();
-
+
if (cl.viewangles[PITCH] > 80)
cl.viewangles[PITCH] = 80;
if (cl.viewangles[PITCH] < -70)
@@ -238,7 +238,7 @@
cl.viewangles[ROLL] = 50;
if (cl.viewangles[ROLL] < -50)
cl.viewangles[ROLL] = -50;
-
+
}
/*
@@ -249,14 +249,14 @@
================
*/
void CL_BaseMove (usercmd_t *cmd)
-{
+{
if (cls.signon != SIGNONS)
return;
-
+
CL_AdjustAngles ();
-
+
memset(cmd, 0, sizeof *cmd);
-
+
if (in_strafe.state & 1)
{
cmd->sidemove += cl_sidespeed.value * CL_KeyState (&in_right);
@@ -270,14 +270,12 @@
cmd->upmove -= cl_upspeed.value * CL_KeyState (&in_down);
if (! (in_klook.state & 1) )
- {
+ {
cmd->forwardmove += cl_forwardspeed.value * CL_KeyState (&in_forward);
cmd->forwardmove -= cl_backspeed.value * CL_KeyState (&in_back);
- }
+ }
-//
-// adjust for speed key
-//
+ // adjust for speed key
if (in_speed.state & 1)
{
cmd->forwardmove *= cl_movespeedkey.value;
@@ -299,58 +297,50 @@
int bits;
sizebuf_t buf;
byte data[128];
-
+
buf.maxsize = 128;
buf.cursize = 0;
buf.data = data;
-
+
cl.cmd = *cmd;
-//
-// send the movement message
-//
- MSG_WriteByte (&buf, clc_move);
+ // send the movement message
+ MSG_WriteByte (&buf, clc_move);
MSG_WriteFloat (&buf, cl.mtime[0]); // so server can get ping times
for (i=0 ; i<3 ; i++)
cl.protocol.MSG_WriteAngle(&buf, cl.viewangles[i]);
-
- MSG_WriteShort (&buf, cmd->forwardmove);
- MSG_WriteShort (&buf, cmd->sidemove);
- MSG_WriteShort (&buf, cmd->upmove);
-//
-// send button bits
-//
+ MSG_WriteShort (&buf, cmd->forwardmove);
+ MSG_WriteShort (&buf, cmd->sidemove);
+ MSG_WriteShort (&buf, cmd->upmove);
+
+ // send button bits
bits = 0;
-
+
if ( in_attack.state & 3 )
bits |= 1;
in_attack.state &= ~2;
-
+
if (in_jump.state & 3)
bits |= 2;
in_jump.state &= ~2;
-
- MSG_WriteByte (&buf, bits);
- MSG_WriteByte (&buf, in_impulse);
+ MSG_WriteByte (&buf, bits);
+
+ MSG_WriteByte (&buf, in_impulse);
in_impulse = 0;
-//
-// deliver the message
-//
+ // deliver the message
if (cls.demoplayback)
return;
-//
-// allways dump the first two message, because it may contain leftover inputs
-// from the last level
-//
+ // allways dump the first two message, because it may contain leftover inputs
+ // from the last level
if (++cl.movemessages <= 2)
return;
-
+
if (NET_SendUnreliableMessage (cls.netcon, &buf) == -1)
{
Con_Printf ("CL_SendMove: lost server connection\n");
--- a/cl_main.c
+++ b/cl_main.c
@@ -43,7 +43,6 @@
if (!sv.active)
Host_ClearMemory ();
-// wipe the entire cl structure
memset(&cl, 0, sizeof cl);
if(cls.state == ca_connected)
@@ -58,9 +57,7 @@
memset(cl_beams, 0, sizeof cl_beams);
cl_numvisedicts = 0;
-//
-// allocate the efrags and chain together into a free list
-//
+ // allocate the efrags and chain together into a free list
cl.free_efrags = cl_efrags;
for (i=0 ; i<MAX_EFRAGS-1 ; i++)
cl.free_efrags[i].entnext = &cl.free_efrags[i+1];
@@ -77,13 +74,12 @@
*/
void CL_Disconnect (void)
{
-// stop sounds (especially looping!)
stopallsfx();
-
-// bring the console down and fade the colors back to normal
-// SCR_BringDownConsole ();
-// if running a local server, shut it down
+ // bring the console down and fade the colors back to normal
+ // SCR_BringDownConsole ();
+
+ // if running a local server, shut it down
if (cls.demoplayback)
abortdemo ();
else if (cls.state == ca_connected)
@@ -138,7 +134,7 @@
if (!cls.netcon)
Host_Error ("CL_Connect: connect failed\n");
Con_DPrintf("CL_EstablishConnection: connected to %s\n", host);
-
+
cls.demonum = -1; // not in the demo loop now
cls.state = ca_connected;
cls.signon = 0; // need all the signon messages before playing
@@ -153,7 +149,7 @@
*/
void CL_SignonReply (void)
{
- char str[8192];
+ char str[8192];
Con_DPrintf("CL_SignonReply: got %d\n", cls.signon);
@@ -163,24 +159,24 @@
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "prespawn");
break;
-
- case 2:
+
+ case 2:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, va("name \"%s\"\n", cl_name.string));
-
+
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, va("color %d %d\n", ((int)cl_color.value)>>4, ((int)cl_color.value)&15));
-
+
MSG_WriteByte (&cls.message, clc_stringcmd);
sprint (str, "spawn %s", cls.spawnparms);
MSG_WriteString (&cls.message, str);
break;
-
- case 3:
+
+ case 3:
MSG_WriteByte (&cls.message, clc_stringcmd);
MSG_WriteString (&cls.message, "begin");
break;
-
+
case 4:
SCR_EndLoadingPlaque (); // allow normal screen updates
break;
@@ -228,7 +224,7 @@
{
entity_t *ent;
int i;
-
+
for (i=0,ent=cl_entities ; i<cl.num_entities ; i++,ent++)
{
if (!ent->model)
@@ -251,38 +247,6 @@
*/
void SetPal (int /*i*/)
{
-/*
- static int old;
- byte pal[768];
- int c;
-
- if (i == old)
- return;
- old = i;
-
- if (i==0)
- VID_SetPalette (host_basepal);
- else if (i==1)
- {
- for (c=0 ; c<768 ; c+=3)
- {
- pal[c] = 0;
- pal[c+1] = 255;
- pal[c+2] = 0;
- }
- VID_SetPalette (pal);
- }
- else
- {
- for (c=0 ; c<768 ; c+=3)
- {
- pal[c] = 0;
- pal[c+1] = 0;
- pal[c+2] = 255;
- }
- VID_SetPalette (pal);
- }
-*/
}
/*
@@ -296,7 +260,7 @@
int i;
dlight_t *dl;
-// first look for an exact key match
+ // first look for an exact key match
if (key)
{
dl = cl_dlights;
@@ -311,7 +275,7 @@
}
}
-// then look for anything else
+ // then look for anything else
dl = cl_dlights;
for (i=0 ; i<MAX_DLIGHTS ; i++, dl++)
{
@@ -341,7 +305,7 @@
int i;
dlight_t *dl;
float time;
-
+
time = cl.time - cl.oldtime;
dl = cl_dlights;
@@ -349,7 +313,7 @@
{
if (dl->die < cl.time || !dl->radius)
continue;
-
+
dl->radius -= time*dl->decay;
if (dl->radius < 0)
dl->radius = 0;
@@ -370,13 +334,13 @@
float f, frac;
f = cl.mtime[0] - cl.mtime[1];
-
+
if (!f || cl_nolerp.value || cls.timedemo || sv.active)
{
cl.time = cl.mtime[0];
return 1;
}
-
+
if (f > 0.1)
{ // dropped packet, or start of demo
cl.mtime[1] = cl.mtime[0] - 0.1;
@@ -383,14 +347,14 @@
f = 0.1;
}
frac = (cl.time - cl.mtime[1]) / f;
-//Con_Printf ("frac: %f\n",frac);
+ //Con_Printf ("frac: %f\n",frac);
if (frac < 0)
{
if (frac < -0.01)
{
-SetPal(1);
+ SetPal(1);
cl.time = cl.mtime[1];
-// Con_Printf ("low frac\n");
+ //Con_Printf ("low frac\n");
}
frac = 0;
}
@@ -398,15 +362,15 @@
{
if (frac > 1.01)
{
-SetPal(2);
+ SetPal(2);
cl.time = cl.mtime[0];
-// Con_Printf ("high frac\n");
+ //Con_Printf ("high frac\n");
}
frac = 1;
}
else
SetPal(0);
-
+
return frac;
}
@@ -426,21 +390,19 @@
vec3_t oldorg;
dlight_t *dl;
-// determine partial update time
+ // determine partial update time
frac = CL_LerpPoint ();
cl_numvisedicts = 0;
-//
-// interpolate player info
-//
+ // interpolate player info
for (i=0 ; i<3 ; i++)
- cl.velocity[i] = cl.mvelocity[1][i] +
+ cl.velocity[i] = cl.mvelocity[1][i] +
frac * (cl.mvelocity[0][i] - cl.mvelocity[1][i]);
if (cls.demoplayback)
{
- // interpolate the angles
+ // interpolate the angles
for (j=0 ; j<3 ; j++)
{
d = cl.mviewangles[0][j] - cl.mviewangles[1][j];
@@ -451,10 +413,10 @@
cl.viewangles[j] = cl.mviewangles[1][j] + frac*d;
}
}
-
+
bobjrotate = anglemod(100*cl.time);
-
-// start on the entity after the world
+
+ // start on the entity after the world
for (i=1,ent=cl_entities+1 ; i<cl.num_entities ; i++,ent++)
{
if (!ent->model)
@@ -464,7 +426,7 @@
continue;
}
-// if the object wasn't included in the last packet, remove it
+ // if the object wasn't included in the last packet, remove it
if (ent->msgtime != cl.mtime[0])
{
ent->model = nil;
@@ -501,10 +463,10 @@
d += 360;
ent->angles[j] = ent->msg_angles[1][j] + f*d;
}
-
+
}
-// rotate binary objects locally
+ // rotate binary objects locally
if (ent->model->flags & EF_ROTATE)
ent->angles[1] = bobjrotate;
@@ -518,7 +480,7 @@
VectorCopy (ent->origin, dl->origin);
dl->origin[2] += 16;
AngleVectors (ent->angles, fv, rv, uv);
-
+
VectorMA (dl->origin, 18, fv, dl->origin);
dl->radius = 200 + (rand()&31);
dl->minlight = 32;
@@ -525,7 +487,7 @@
dl->die = cl.time + 0.1;
}
if (ent->effects & EF_BRIGHTLIGHT)
- {
+ {
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->origin[2] += 16;
@@ -533,7 +495,7 @@
dl->die = cl.time + 0.001;
}
if (ent->effects & EF_DIMLIGHT)
- {
+ {
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200 + (rand()&31);
@@ -589,7 +551,7 @@
cl.oldtime = cl.time;
cl.time += host_frametime;
-
+
do
{
ret = readcl ();
@@ -597,11 +559,11 @@
Host_Error ("CL_ReadFromServer: lost server connection");
if (!ret)
break;
-
+
cl.last_received_message = realtime;
CL_ParseServerMessage ();
} while (ret && cls.state == ca_connected);
-
+
if (cl_shownet.value)
Con_Printf ("\n");
@@ -608,9 +570,7 @@
CL_RelinkEntities ();
CL_UpdateTEnts ();
-//
-// bring the links up to date
-//
+ // bring the links up to date
return 0;
}
@@ -630,13 +590,13 @@
{
// get basic movement from keyboard
CL_BaseMove (&cmd);
-
+
// allow mice or other external controllers to add to the move
IN_Move (&cmd);
-
+
// send the unreliable message
CL_SendMove (&cmd);
-
+
}
if (cls.demoplayback)
@@ -644,11 +604,11 @@
SZ_Clear (&cls.message);
return;
}
-
-// send the reliable message
+
+ // send the reliable message
if (!cls.message.cursize)
return; // no message at all
-
+
if (!NET_CanSendMessage (cls.netcon))
{
Con_DPrintf("CL_WriteToServer: can't send\n");
@@ -667,7 +627,7 @@
=================
*/
void CL_Init (void)
-{
+{
SZ_Alloc (&cls.message, MAX_DATAGRAM);
cls.message.name = "cls.message";
@@ -678,10 +638,8 @@
CL_InitInput ();
CL_InitTEnts ();
-
-//
-// register our commands
-//
+
+ // register our commands
Cvar_RegisterVariable (&cl_name);
Cvar_RegisterVariable (&cl_color);
Cvar_RegisterVariable (&cl_upspeed);
@@ -702,7 +660,7 @@
Cvar_RegisterVariable (&m_yaw);
Cvar_RegisterVariable (&m_forward);
Cvar_RegisterVariable (&m_side);
-
+
Cmd_AddCommand ("entities", CL_PrintEntities_f);
Cmd_AddCommand ("disconnect", CL_Disconnect_f);
Cmd_AddCommand("stop", stopdemo);
--- a/cl_parse.c
+++ b/cl_parse.c
@@ -14,7 +14,7 @@
"svc_stufftext", // [string] stuffed into client's console buffer
// the string should be \n terminated
"svc_setangle", // [vec3] set the view angle to this absolute value
-
+
"svc_serverinfo", // [long] version
// [string] signon string
// [string]..[0]model cache [string]...[0]sounds cache
@@ -27,11 +27,11 @@
"svc_updatecolors", // [byte] [byte]
"svc_particle", // [vec3] <variable>
"svc_damage", // [byte] impact [byte] blood [vec3] from
-
+
"svc_spawnstatic",
"OBSOLETE svc_spawnbinary",
"svc_spawnbaseline",
-
+
"svc_temp_entity", // <variable>
"svc_setpause",
"svc_signonnum",
@@ -71,7 +71,7 @@
cl.num_entities++;
}
}
-
+
return &cl_entities[num];
}
@@ -83,15 +83,15 @@
*/
static void CL_ParseStartSoundPacket(void)
{
- vec3_t pos;
- int channel, ent;
- int sound_num;
- int volume;
- int field_mask;
- float attenuation;
-
- field_mask = MSG_ReadByte();
- volume = (field_mask & SND_VOLUME) ? MSG_ReadByte() : Spktvol;
+ vec3_t pos;
+ int channel, ent;
+ int sound_num;
+ int volume;
+ int field_mask;
+ float attenuation;
+
+ field_mask = MSG_ReadByte();
+ volume = (field_mask & SND_VOLUME) ? MSG_ReadByte() : Spktvol;
attenuation = (field_mask & SND_ATTENUATION) ? MSG_ReadByte()/64.0 : Spktatt;
if(field_mask & (cl.protocol.fl_large_entity | cl.protocol.fl_large_channel)){
ent = MSG_ReadShort();
@@ -107,8 +107,8 @@
Host_Error("CL_ParseStartSoundPacket: ent = %d", ent);
MSG_ReadVec(cl.protocol, pos);
- startsfx (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
-}
+ startsfx (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation);
+}
/*
==================
@@ -125,16 +125,16 @@
int ret;
sizebuf_t old;
static byte olddata[NET_MAXMESSAGE];
-
+
if (sv.active)
return; // no need if server is local
if (cls.demoplayback)
return;
-// read messages from server, should just be nops
+ // read messages from server, should just be nops
old = net_message;
memcpy (olddata, net_message.data, net_message.cursize);
-
+
do
{
ret = readcl ();
@@ -141,7 +141,7 @@
switch (ret)
{
default:
- Host_Error ("CL_KeepaliveMessage: readcl failed");
+ Host_Error ("CL_KeepaliveMessage: readcl failed");
case 0:
break; // nothing waiting
case 1:
@@ -157,13 +157,13 @@
net_message = old;
memcpy (net_message.data, olddata, net_message.cursize);
-// check time
+ // check time
time = dtime ();
if (time - lastmsg < 5)
return;
lastmsg = time;
-// write out a nop
+ // write out a nop
Con_Printf ("--> client to server keepalive\n");
MSG_WriteByte (&cls.message, clc_nop);
@@ -186,12 +186,9 @@
static char sound_precache[MAX_SOUNDS][Npath];
Con_DPrintf("CL_ParseServerInfo: parsing serverinfo pkt...\n");
-//
-// wipe the client_state_t struct
-//
CL_ClearState ();
-// parse protocol version number
+ // parse protocol version number
i = MSG_ReadLong ();
p = nil;
for(n = 0; n < nelem(protos); n++){
@@ -207,7 +204,7 @@
memmove(&cl.protocol, p, sizeof(cl.protocol));
cl.protocol.MSG_ReadProtocolInfo(&cl.protocol);
-// parse maxclients
+ // parse maxclients
cl.maxclients = MSG_ReadByte ();
if (cl.maxclients < 1 || cl.maxclients > MAX_SCOREBOARD)
{
@@ -216,24 +213,22 @@
}
cl.scores = Hunk_Alloc(cl.maxclients * sizeof *cl.scores);
-// parse gametype
+ // parse gametype
cl.gametype = MSG_ReadByte ();
-// parse signon message
+ // parse signon message
str = MSG_ReadString ();
strncpy (cl.levelname, str, sizeof(cl.levelname)-1);
-// seperate the printfs so the server message can have a color
+ // seperate the printfs so the server message can have a color
Con_Printf("\n\n\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n\n");
Con_Printf ("%c%s\n", 2, str);
-//
-// first we go through and touch all of the precache data that still
-// happens to be in the cache, so precaching something else doesn't
-// needlessly purge it
-//
+ // first we go through and touch all of the precache data that still
+ // happens to be in the cache, so precaching something else doesn't
+ // needlessly purge it
-// precache models
+ // precache models
memset(cl.model_precache, 0, sizeof cl.model_precache);
for (nummodels=1 ; ; nummodels++)
{
@@ -249,7 +244,7 @@
Mod_TouchModel (str);
}
-// precache sounds
+ // precache sounds
memset(cl.sound_precache, 0, sizeof cl.sound_precache);
sfxbegin();
for (numsounds=1 ; ; numsounds++)
@@ -266,10 +261,7 @@
touchsfx (str);
}
-//
-// now we try to load everything else until a cache allocation fails
-//
-
+ // now we try to load everything else until a cache allocation fails
for (i=1 ; i<nummodels ; i++)
{
cl.model_precache[i] = Mod_ForName (model_precache[i], false);
@@ -288,12 +280,12 @@
}
-// local state
+ // local state
cl_entities[0].model = cl.worldmodel = cl.model_precache[1];
-
+
R_NewMap ();
- noclip_anglehack = false; // noclip is turned off at start
+ noclip_anglehack = false; // noclip is turned off at start
}
@@ -344,7 +336,7 @@
forcelink = ent->msgtime != cl.mtime[1]; // no previous frame to lerp from
ent->msgtime = cl.mtime[0];
-// shift the known values for interpolation
+ // shift the known values for interpolation
VectorCopy (ent->msg_origins[0], ent->msg_origins[1]);
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
@@ -389,8 +381,8 @@
if (model != ent->model)
{
ent->model = model;
- // automatic animation (torches, etc) can be either all together
- // or randomized
+ // automatic animation (torches, etc) can be either all together
+ // or randomized
if (model)
{
if (model->synctype == ST_RAND)
@@ -482,7 +474,7 @@
}
weaponmodel = (bits & SU_WEAPON) ? MSG_ReadByte() : 0;
-
+
i = MSG_ReadShort();
if (cl.stats[STAT_HEALTH] != i){
cl.stats[STAT_HEALTH] = i;
@@ -540,7 +532,7 @@
int i, j;
int top, bottom;
byte *dest, *source;
-
+
if (slot > cl.maxclients)
fatal ("CL_NewTranslation: slot > cl.maxclients");
dest = cl.scores[slot].translations;
@@ -556,12 +548,12 @@
else
for (j=0 ; j<16 ; j++)
dest[TOP_RANGE+j] = source[top+15-j];
-
+
if (bottom < 128)
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
else
for (j=0 ; j<16 ; j++)
- dest[BOTTOM_RANGE+j] = source[bottom+15-j];
+ dest[BOTTOM_RANGE+j] = source[bottom+15-j];
}
}
@@ -574,7 +566,7 @@
{
entity_t *ent;
int i;
-
+
i = cl.num_statics;
if (i >= MAX_STATIC_ENTITIES)
Host_Error ("Too many static entities");
@@ -582,7 +574,7 @@
cl.num_statics++;
CL_ParseBaseline(withbits, ent);
-// copy it to the current state
+ // copy it to the current state
ent->model = cl.model_precache[ent->baseline.modelindex];
ent->alpha = ent->baseline.alpha;
ent->frame = ent->baseline.frame;
@@ -591,7 +583,7 @@
ent->effects = ent->baseline.effects;
VectorCopy (ent->baseline.origin, ent->origin);
- VectorCopy (ent->baseline.angles, ent->angles);
+ VectorCopy (ent->baseline.angles, ent->angles);
R_AddEfrags (ent);
}
@@ -609,7 +601,7 @@
sound_num = large_sound ? MSG_ReadShort() : MSG_ReadByte();
vol = MSG_ReadByte();
atten = MSG_ReadByte();
-
+
staticsfx(cl.sound_precache[sound_num], org, vol, atten);
}
@@ -625,21 +617,18 @@
{
int cmd, i, n;
protocol_t *p;
-
-//
-// if recording demos, copy the message out
-//
+
+ // if recording demos, copy the message out
if (cl_shownet.value == 1)
Con_Printf ("%d ",net_message.cursize);
else if (cl_shownet.value == 2)
Con_Printf ("------------------\n");
-
- cl.onground = false; // unless the server says otherwise
-//
-// parse the message
-//
+
+ cl.onground = false; // unless the server says otherwise
+
+ // parse the message
MSG_BeginReading ();
-
+
while (1)
{
if (msg_badread)
@@ -653,7 +642,7 @@
return; // end of message
}
- // if the high bit of the command byte is set, it is a fast update
+ // if the high bit of the command byte is set, it is a fast update
if (cmd & U_SIGNAL)
{
SHOWNET("fast update");
@@ -662,27 +651,26 @@
}
SHOWNET(svc_strings[cmd]);
-
- // other commands
+
+ // other commands
switch (cmd)
{
default:
Host_Error ("CL_ParseServerMessage: Illegible server message (cmd %d)\n", cmd);
break;
-
+
case svc_nop:
-// Con_Printf ("svc_nop\n");
break;
-
+
case svc_time:
cl.mtime[1] = cl.mtime[0];
- cl.mtime[0] = MSG_ReadFloat ();
+ cl.mtime[0] = MSG_ReadFloat ();
break;
-
+
case svc_clientdata:
CL_ParseClientdata((ushort)MSG_ReadShort());
break;
-
+
case svc_version:
i = MSG_ReadLong();
for(p = nil, n = 0; n < nelem(protos); n++){
@@ -696,7 +684,7 @@
if(p->version != cl.protocol.version)
Host_Error("CL_ParseServerMessage: server decided to switch protocol to %d mid-game?\n", i);
break;
-
+
case svc_disconnect:
Host_EndGame ("Server disconnected\n");
@@ -703,33 +691,33 @@
case svc_print:
Con_Printf ("%s", MSG_ReadString ());
break;
-
+
case svc_centerprint:
SCR_CenterPrint (MSG_ReadString ());
break;
-
+
case svc_stufftext:
Cbuf_AddText (MSG_ReadString ());
break;
-
+
case svc_damage:
V_ParseDamage ();
break;
-
+
case svc_serverinfo:
CL_ParseServerInfo ();
vid.recalc_refdef = true; // leave intermission full screen
break;
-
+
case svc_setangle:
for (i=0 ; i<3 ; i++)
cl.viewangles[i] = cl.protocol.MSG_ReadAngle ();
break;
-
+
case svc_setview:
cl.viewentity = MSG_ReadShort ();
break;
-
+
case svc_lightstyle:
i = MSG_ReadByte ();
if (i >= Nlights)
@@ -737,16 +725,16 @@
strcpy(cl_lightstyle[i].map, MSG_ReadString());
cl_lightstyle[i].length = strlen(cl_lightstyle[i].map);
break;
-
+
case svc_sound:
CL_ParseStartSoundPacket();
break;
-
+
case svc_stopsound:
i = MSG_ReadShort();
stopsfx(i>>3, i&7);
break;
-
+
case svc_updatename:
Sbar_Changed ();
i = MSG_ReadByte ();
@@ -754,7 +742,7 @@
Host_Error ("CL_ParseServerMessage: svc_updatename > MAX_SCOREBOARD");
strcpy (cl.scores[i].name, MSG_ReadString ());
break;
-
+
case svc_updatefrags:
Sbar_Changed ();
i = MSG_ReadByte ();
@@ -761,7 +749,7 @@
if (i >= cl.maxclients)
Host_Error ("CL_ParseServerMessage: svc_updatefrags > MAX_SCOREBOARD");
cl.scores[i].frags = MSG_ReadShort ();
- break;
+ break;
case svc_updatecolors:
Sbar_Changed ();
@@ -771,7 +759,7 @@
cl.scores[i].colors = MSG_ReadByte ();
CL_NewTranslation (i);
break;
-
+
case svc_particle:
R_ParseParticleEffect ();
break;
@@ -800,7 +788,7 @@
resumecd();
}
break;
-
+
case svc_signonnum:
i = MSG_ReadByte ();
if (i <= cls.signon)
@@ -823,7 +811,7 @@
fatal ("svc_updatestat: %d is invalid", i);
cl.stats[i] = MSG_ReadLong ();;
break;
-
+
case svc_spawnstaticsound:
case svc_spawnstaticsound2:
CL_ParseStaticSound(cmd == svc_spawnstaticsound2);
@@ -848,7 +836,7 @@
cl.intermission = 2;
cl.completed_time = cl.time;
vid.recalc_refdef = true; // go to full screen
- SCR_CenterPrint (MSG_ReadString ());
+ SCR_CenterPrint (MSG_ReadString ());
break;
case svc_cutscene:
@@ -855,7 +843,7 @@
cl.intermission = 3;
cl.completed_time = cl.time;
vid.recalc_refdef = true; // go to full screen
- SCR_CenterPrint (MSG_ReadString ());
+ SCR_CenterPrint (MSG_ReadString ());
break;
case svc_sellscreen:
--- a/cl_tent.c
+++ b/cl_tent.c
@@ -39,13 +39,13 @@
vec3_t start, end;
beam_t *b;
int i;
-
+
ent = MSG_ReadShort ();
MSG_ReadVec(cl.protocol, start);
MSG_ReadVec(cl.protocol, end);
-// override any beam with the same entity
+ // override any beam with the same entity
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
if (b->entity == ent)
{
@@ -57,7 +57,7 @@
return;
}
-// find a free beam
+ // find a free beam
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
{
if (!b->model || b->endtime < cl.time)
@@ -70,7 +70,7 @@
return;
}
}
- Con_Printf ("beam list overflow!\n");
+ Con_Printf ("beam list overflow!\n");
}
/*
@@ -94,13 +94,13 @@
R_RunParticleEffect (pos, vec3_origin, 20, 30);
startsfx (-1, 0, cl_sfx_wizhit, pos, 1, 1);
break;
-
+
case TE_KNIGHTSPIKE: // spike hitting wall
MSG_ReadVec(cl.protocol, pos);
R_RunParticleEffect (pos, vec3_origin, 226, 20);
startsfx (-1, 0, cl_sfx_knighthit, pos, 1, 1);
break;
-
+
case TE_SPIKE: // spike hitting wall
MSG_ReadVec(cl.protocol, pos);
R_RunParticleEffect (pos, vec3_origin, 0, 10);
@@ -134,12 +134,12 @@
startsfx (-1, 0, cl_sfx_ric3, pos, 1, 1);
}
break;
-
+
case TE_GUNSHOT: // bullet hitting wall
MSG_ReadVec(cl.protocol, pos);
R_RunParticleEffect (pos, vec3_origin, 0, 20);
break;
-
+
case TE_EXPLOSION: // rocket explosion
MSG_ReadVec(cl.protocol, pos);
R_ParticleExplosion (pos);
@@ -150,7 +150,7 @@
dl->decay = 300;
startsfx (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
break;
-
+
case TE_TAREXPLOSION: // tarbaby explosion
MSG_ReadVec(cl.protocol, pos);
R_BlobExplosion (pos);
@@ -161,31 +161,29 @@
case TE_LIGHTNING1: // lightning bolts
CL_ParseBeam (Mod_ForName("progs/bolt.mdl", true));
break;
-
+
case TE_LIGHTNING2: // lightning bolts
CL_ParseBeam (Mod_ForName("progs/bolt2.mdl", true));
break;
-
+
case TE_LIGHTNING3: // lightning bolts
CL_ParseBeam (Mod_ForName("progs/bolt3.mdl", true));
break;
-
-// PGM 01/21/97
+
case TE_BEAM: // grappling hook beam
CL_ParseBeam (Mod_ForName("progs/beam.mdl", true));
break;
-// PGM 01/21/97
- case TE_LAVASPLASH:
+ case TE_LAVASPLASH:
MSG_ReadVec(cl.protocol, pos);
R_LavaSplash (pos);
break;
-
+
case TE_TELEPORT:
MSG_ReadVec(cl.protocol, pos);
R_TeleportSplash (pos);
break;
-
+
case TE_EXPLOSION2: // color mapped explosion
MSG_ReadVec(cl.protocol, pos);
colorStart = MSG_ReadByte ();
@@ -252,19 +250,19 @@
num_temp_entities = 0;
-// update lightning
+ // update lightning
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
{
if (!b->model || b->endtime < cl.time)
continue;
- // if coming from the player, update the start position
+ // if coming from the player, update the start position
if (b->entity == cl.viewentity)
{
VectorCopy (cl_entities[cl.viewentity].origin, b->start);
}
- // calculate pitch and yaw
+ // calculate pitch and yaw
VectorSubtract (b->end, b->start, dist);
if (dist[1] == 0 && dist[0] == 0)
@@ -280,7 +278,7 @@
yaw = (int) (atan2(dist[1], dist[0]) * 180 / M_PI);
if (yaw < 0)
yaw += 360;
-
+
forward = sqrt (dist[0]*dist[0] + dist[1]*dist[1]);
pitch = (int) (atan2(dist[2], forward) * 180 / M_PI);
if (pitch < 0)
@@ -287,7 +285,7 @@
pitch += 360;
}
- // add new entities for the lightning
+ // add new entities for the lightning
VectorCopy (b->start, org);
d = VectorNormalize(dist);
while (d > 0)
@@ -306,7 +304,7 @@
d -= 30;
}
}
-
+
}
--- a/client.h
+++ b/client.h
@@ -85,7 +85,7 @@
{
cactive_t state;
-// personalization data sent to server
+// personalization data sent to server
char mapstring[Npath];
char spawnparms[MAX_MAPSTRING]; // to restart a level
@@ -108,7 +108,7 @@
int signon; // 0 to SIGNONS
struct qsocket_s *netcon;
sizebuf_t message; // writing buffer to send to server
-
+
} client_static_t;
extern client_static_t cls;
@@ -122,7 +122,7 @@
protocol_t protocol;
int movemessages; // since connecting to this server
// throw out the first couple, so the player
- // doesn't accidentally do something the
+ // doesn't accidentally do something the
// first frame
usercmd_t cmd; // last command sent to the server
@@ -142,13 +142,13 @@
vec3_t mviewangles[2]; // during demo playback viewangles is lerped
// between these
vec3_t viewangles;
-
+
vec3_t mvelocity[2]; // update by server, used for lean+bob
// (0 is newest)
vec3_t velocity; // lerped between mvelocity[0] and [1]
vec3_t punchangle; // temporary offset
-
+
// pitch drifting vars
float idealpitch;
float pitchvel;
@@ -162,17 +162,17 @@
qboolean paused; // send over by server
qboolean onground;
qboolean inwater;
-
+
int intermission; // don't change view angle, full screen, etc
int completed_time; // latched at intermission start
-
- double mtime[2]; // the timestamp of last two messages
+
+ double mtime[2]; // the timestamp of last two messages
double time; // clients view of time, should be between
// servertime and oldservertime to generate
// a lerp point for other data
double oldtime; // previous cl.time, time-oldtime is used
// to decay light values and smooth step ups
-
+
float last_received_message; // (realtime) for net trouble icon
--- a/cmd.c
+++ b/cmd.c
@@ -65,7 +65,7 @@
void Cbuf_AddText (char *text)
{
int l;
-
+
l = strlen(text);
if (cmd_text.cursize + l >= cmd_text.maxsize)
@@ -92,7 +92,7 @@
char *temp = nil;
int templen;
-// copy off any commands still remaining in the exec buffer
+ // copy off any commands still remaining in the exec buffer
templen = cmd_text.cursize;
if (templen)
{
@@ -100,11 +100,11 @@
memcpy(temp, cmd_text.data, templen);
SZ_Clear (&cmd_text);
}
-
-// add the entire text of the file
+
+ // add the entire text of the file
Cbuf_AddText (text);
-
-// add the copied off data
+
+ // add the copied off data
if (templen)
{
SZ_Write (&cmd_text, temp, templen);
@@ -126,7 +126,7 @@
while (cmd_text.cursize)
{
-// find a \n or ; line break
+ // find a \n or ; line break
text = (char *)cmd_text.data;
quotes = 0;
@@ -139,15 +139,15 @@
if (text[i] == '\n')
break;
}
-
-
+
+
memcpy (line, text, i);
line[i] = 0;
-
-// delete the text from the command buffer and move remaining commands down
-// this is necessary because commands (exec, alias) can insert data at the
-// beginning of the text buffer
+ // delete the text from the command buffer and move remaining commands down
+ // this is necessary because commands (exec, alias) can insert data at the
+ // beginning of the text buffer
+
if (i == cmd_text.cursize)
cmd_text.cursize = 0;
else
@@ -157,9 +157,9 @@
memcpy(text, text+i, cmd_text.cursize);
}
-// execute the command line
+ // execute the command line
Cmd_ExecuteString (line, src_command);
-
+
if (cmd_wait)
{ // skip out while text still remains in buffer, leaving it
// for next frame
@@ -192,7 +192,7 @@
int i, j;
int s;
char *text, *build, c;
-
+
if (Cmd_Argc () != 1)
{
Con_Printf ("stuffcmds : execute command line parameters\n");
@@ -199,7 +199,7 @@
return;
}
-// build the combined string to parse from
+ // build the combined string to parse from
s = 0;
for (i=1 ; i<com_argc ; i++)
{
@@ -209,7 +209,7 @@
}
if (!s)
return;
-
+
text = Z_Malloc (s+1);
text[0] = 0;
for (i=1 ; i<com_argc ; i++)
@@ -220,11 +220,11 @@
if (i != com_argc-1)
strcat(text, " ");
}
-
-// pull out the commands
+
+ // pull out the commands
build = Z_Malloc (s+1);
build[0] = 0;
-
+
for (i=0 ; i<s-1 ; i++)
{
if (text[i] == '+')
@@ -236,7 +236,7 @@
c = text[j];
text[j] = 0;
-
+
strcat(build, text+i);
strcat(build, "\n");
text[j] = c;
@@ -243,10 +243,10 @@
i = j-1;
}
}
-
+
if (build[0])
Cbuf_InsertText (build);
-
+
Z_Free (text);
Z_Free (build);
}
@@ -275,7 +275,7 @@
return;
}
Con_Printf ("execing %s\n",Cmd_Argv(1));
-
+
Cbuf_InsertText (f);
Hunk_FreeToMark (mark);
}
@@ -291,7 +291,7 @@
void Cmd_Echo_f (void)
{
int i;
-
+
for (i=1 ; i<Cmd_Argc() ; i++)
Con_Printf ("%s ",Cmd_Argv(i));
Con_Printf ("\n");
@@ -308,7 +308,7 @@
char *CopyString (char *in)
{
char *out;
-
+
out = Z_Malloc (strlen(in)+1);
strcpy (out, in);
return out;
@@ -352,9 +352,9 @@
a->next = cmd_alias;
cmd_alias = a;
}
- strcpy (a->name, s);
+ strcpy (a->name, s);
-// copy the rest of the command line
+ // copy the rest of the command line
cmd[0] = 0; // start out with a null string
c = Cmd_Argc();
for (i=2 ; i< c ; i++)
@@ -364,7 +364,7 @@
strcat (cmd, " ");
}
strcat (cmd, "\n");
-
+
a->value = CopyString (cmd);
}
@@ -403,9 +403,6 @@
*/
void Cmd_Init (void)
{
-//
-// register our commands
-//
Cmd_AddCommand ("stuffcmds",Cmd_StuffCmds_f);
Cmd_AddCommand ("exec",Cmd_Exec_f);
Cmd_AddCommand ("echo",Cmd_Echo_f);
@@ -433,7 +430,7 @@
{
if (arg >= cmd_argc)
return cmd_null_string;
- return cmd_argv[arg];
+ return cmd_argv[arg];
}
/*
@@ -457,31 +454,31 @@
void Cmd_TokenizeString (char *text)
{
int i;
-
-// clear the args from the last string
+
+ // clear the args from the last string
for (i=0 ; i<cmd_argc ; i++)
Z_Free (cmd_argv[i]);
-
+
cmd_argc = 0;
cmd_args = nil;
-
+
while (1)
{
-// skip whitespace up to a /n
+ // skip whitespace up to a /n
while (*text && *text <= ' ' && *text != '\n')
{
text++;
}
-
- if (*text == '\n') // a newline seperates commands in the buffer
+
+ if (*text == '\n') // a newline seperates commands in the buffer
return;
if (!*text)
return;
-
+
if (cmd_argc == 1)
cmd_args = text;
-
+
text = COM_Parse (text);
if (!text)
return;
@@ -504,18 +501,18 @@
void Cmd_AddCommand (char *cmd_name, xcommand_t function)
{
cmd_function_t *cmd;
-
+
if (host_initialized) // because hunk allocation would get stomped
fatal ("Cmd_AddCommand after host_initialized");
-
-// fail if the command is a variable name
+
+ // fail if the command is a variable name
if (Cvar_VariableString(cmd_name)[0])
{
Con_Printf ("Cmd_AddCommand: %s already defined as a var\n", cmd_name);
return;
}
-
-// fail if the command already exists
+
+ // fail if the command already exists
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
if(strcmp(cmd_name, cmd->name) == 0)
@@ -561,13 +558,13 @@
{
cmd_function_t *cmd;
int len;
-
+
len = strlen(partial);
-
+
if (!len)
return nil;
-
-// check functions
+
+ // check functions
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
if(strncmp(partial, cmd->name, len) == 0)
return cmd->name;
@@ -584,18 +581,18 @@
============
*/
void Cmd_ExecuteString (char *text, cmd_source_t src)
-{
+{
cmd_function_t *cmd;
cmdalias_t *a;
cmd_source = src;
Cmd_TokenizeString (text);
-
-// execute the command line
+
+ // execute the command line
if (!Cmd_Argc())
return; // no tokens
-// check functions
+ // check functions
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
{
if(cistrcmp(cmd_argv[0],cmd->name) == 0)
@@ -605,7 +602,7 @@
}
}
-// check alias
+ // check alias
for (a=cmd_alias ; a ; a=a->next)
{
if(cistrcmp(cmd_argv[0], a->name) == 0)
@@ -614,11 +611,11 @@
return;
}
}
-
-// check cvars
+
+ // check cvars
if (!Cvar_Command ())
Con_Printf ("Unknown command \"%s\": %s\n", Cmd_Argv(0), text);
-
+
}
@@ -636,7 +633,7 @@
Con_Printf ("Can't \"%s\", not connected\n", Cmd_Argv(0));
return;
}
-
+
if (cls.demoplayback)
return; // not really connected
--- a/common.c
+++ b/common.c
@@ -19,7 +19,7 @@
only used during filesystem initialization.
The "game directory" is the first tree on the search path and directory that all generated files (savegames, screenshots, demos, config files) will be saved to. This can be overridden with the "-game" command line parameter. The game directory can never be changed while quake is executing. This is a precacution against having a malicious server instruct clients to write files over areas they shouldn't.
-
+
*/
//============================================================================
@@ -62,8 +62,8 @@
short (*BigShort) (short l);
short (*LittleShort) (short l);
-int (*BigLong) (int l);
-int (*LittleLong) (int l);
+int (*BigLong) (int l);
+int (*LittleLong) (int l);
float (*BigFloat) (float l);
float (*LittleFloat) (float l);
@@ -82,8 +82,8 @@
void MSG_WriteChar (sizebuf_t *sb, int c)
{
- byte *buf;
-
+ byte *buf;
+
#ifdef PARANOID
if (c < -128 || c > 127)
fatal ("MSG_WriteChar: range error");
@@ -95,8 +95,8 @@
void MSG_WriteByte (sizebuf_t *sb, int c)
{
- byte *buf;
-
+ byte *buf;
+
#ifdef PARANOID
if (c < 0 || c > 255)
fatal ("MSG_WriteByte: range error");
@@ -108,8 +108,8 @@
void MSG_WriteShort (sizebuf_t *sb, int c)
{
- byte *buf;
-
+ byte *buf;
+
#ifdef PARANOID
if (c < ((short)0x8000) || c > (short)0x7fff)
fatal ("MSG_WriteShort: range error");
@@ -122,8 +122,8 @@
void MSG_WriteLong (sizebuf_t *sb, int c)
{
- byte *buf;
-
+ byte *buf;
+
buf = SZ_GetSpace (sb, 4);
buf[0] = c&0xff;
buf[1] = (c>>8)&0xff;
@@ -136,13 +136,13 @@
union
{
float f;
- int l;
+ int l;
} dat;
-
-
+
+
dat.f = f;
dat.l = LittleLong (dat.l);
-
+
SZ_Write (sb, &dat.l, 4);
}
@@ -177,8 +177,8 @@
//
// reading functions
//
-int msg_readcount;
-qboolean msg_badread;
+int msg_readcount;
+qboolean msg_badread;
void MSG_BeginReading (void)
{
@@ -189,71 +189,71 @@
// returns -1 and sets msg_badread if no more characters are available
int MSG_ReadChar (void)
{
- int c;
-
+ int c;
+
if (msg_readcount+1 > net_message.cursize)
{
msg_badread = true;
return -1;
}
-
+
c = (signed char)net_message.data[msg_readcount];
msg_readcount++;
-
+
return c;
}
int MSG_ReadByte (void)
{
- int c;
-
+ int c;
+
if (msg_readcount+1 > net_message.cursize)
{
msg_badread = true;
return -1;
}
-
+
c = (unsigned char)net_message.data[msg_readcount];
msg_readcount++;
-
+
return c;
}
int MSG_ReadShort (void)
{
- int c;
-
+ int c;
+
if (msg_readcount+2 > net_message.cursize)
{
msg_badread = true;
return -1;
}
-
+
c = (short)(net_message.data[msg_readcount]
+ (net_message.data[msg_readcount+1]<<8));
-
+
msg_readcount += 2;
-
+
return c;
}
int MSG_ReadLong (void)
{
- int c;
-
+ int c;
+
if (msg_readcount+4 > net_message.cursize)
{
msg_badread = true;
return -1;
}
-
+
c = net_message.data[msg_readcount]
+ (net_message.data[msg_readcount+1]<<8)
+ (net_message.data[msg_readcount+2]<<16)
+ (net_message.data[msg_readcount+3]<<24);
-
+
msg_readcount += 4;
-
+
return c;
}
@@ -261,26 +261,26 @@
{
union
{
- byte b[4];
+ byte b[4];
float f;
- int l;
+ int l;
} dat;
-
- dat.b[0] = net_message.data[msg_readcount];
- dat.b[1] = net_message.data[msg_readcount+1];
- dat.b[2] = net_message.data[msg_readcount+2];
- dat.b[3] = net_message.data[msg_readcount+3];
+
+ dat.b[0] = net_message.data[msg_readcount];
+ dat.b[1] = net_message.data[msg_readcount+1];
+ dat.b[2] = net_message.data[msg_readcount+2];
+ dat.b[3] = net_message.data[msg_readcount+3];
msg_readcount += 4;
-
+
dat.l = LittleLong (dat.l);
- return dat.f;
+ return dat.f;
}
char *MSG_ReadString (void)
{
- static char string[2048];
- int l,c;
+ static char string[2048];
+ int l,c;
for(l = 0; l < (int)sizeof(string)-1; l++){
if((c = MSG_ReadChar()) == -1 || c == 0)
@@ -340,9 +340,9 @@
void
SZ_Free(sizebuf_t *buf)
{
-// Z_Free (buf->data);
-// buf->data = nil;
-// buf->maxsize = 0;
+ //Z_Free (buf->data);
+ //buf->data = nil;
+ //buf->maxsize = 0;
buf->cursize = 0;
}
@@ -356,7 +356,7 @@
SZ_GetSpace(sizebuf_t *buf, int length)
{
void *data;
-
+
if(buf->cursize + length > buf->maxsize){
if(!buf->allowoverflow)
Host_Error("SZ_GetSpace: %s: overflow without allowoverflow set", buf->name);
@@ -364,7 +364,7 @@
Host_Error("SZ_GetSpace: %s: %d is > full buffer size", buf->name, length);
buf->overflowed = true;
Con_Printf("SZ_GetSpace: %s: overflow", buf->name);
- SZ_Clear(buf);
+ SZ_Clear(buf);
}
data = buf->data + buf->cursize;
buf->cursize += length;
@@ -400,25 +400,25 @@
*/
char *COM_Parse (char *data)
{
- int c;
- int len;
-
+ int c;
+ int len;
+
len = 0;
com_token[0] = 0;
-
+
if (data == nil)
return nil;
-
-// skip whitespace
+
+ // skip whitespace
skipwhite:
while ( (c = *data) <= ' ')
{
if (c == 0)
- return nil; // end of file;
+ return nil; // end of file;
data++;
}
-
-// skip // comments
+
+ // skip // comments
if (c=='/' && data[1] == '/')
{
while (*data && *data != '\n')
@@ -425,9 +425,8 @@
data++;
goto skipwhite;
}
-
-// handle quoted strings specially
+ // handle quoted strings specially
if (c == '\"')
{
data++;
@@ -444,7 +443,7 @@
}
}
-// parse single characters
+ // parse single characters
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
{
com_token[len] = c;
@@ -453,7 +452,7 @@
return data+1;
}
-// parse a regular word
+ // parse a regular word
do
{
com_token[len] = c;
@@ -463,7 +462,7 @@
if (c=='{' || c=='}'|| c==')'|| c=='(' || c=='\'' || c==':')
break;
} while (c>32);
-
+
com_token[len] = 0;
return data;
}
@@ -487,7 +486,7 @@
vsnprint(s, sizeof s, fmt, arg);
va_end(arg);
- return s;
+ return s;
}
float
--- a/console.c
+++ b/console.c
@@ -27,8 +27,8 @@
extern char key_lines[32][MAXCMDLINE];
extern int edit_line;
extern int key_linepos;
-
+
qboolean con_initialized;
int con_notifylines; // scan lines to clear for notify lines
@@ -62,7 +62,7 @@
if(con_text)
memset(con_text, ' ', CON_TEXTSIZE);
}
-
+
/*
================
Con_ClearNotify
@@ -71,12 +71,12 @@
void Con_ClearNotify (void)
{
int i;
-
+
for (i=0 ; i<NUM_CON_TIMES ; i++)
con_times[i] = 0;
}
-
+
/*
================
Con_MessageMode_f
@@ -90,7 +90,7 @@
team_message = false;
}
-
+
/*
================
Con_MessageMode2_f
@@ -102,7 +102,7 @@
team_message = true;
}
-
+
/*
================
Con_CheckResize
@@ -139,7 +139,7 @@
numlines = con_totallines;
numchars = oldwidth;
-
+
if (con_linewidth < numchars)
numchars = con_linewidth;
@@ -175,12 +175,9 @@
memset(con_text, ' ', CON_TEXTSIZE);
con_linewidth = -1;
Con_CheckResize ();
-
+
Con_Printf ("Console initialized.\n");
-//
-// register our commands
-//
Cvar_RegisterVariable (&con_notifytime);
Cmd_AddCommand ("toggleconsole", Con_ToggleConsole_f);
@@ -213,7 +210,7 @@
int c, l;
static int cr;
int mask;
-
+
con_backscroll = 0;
if (txt[0] == 1)
@@ -220,7 +217,7 @@
{
mask = 128; // go to colored text
localsfx ("misc/talk.wav");
- // play talk wav
+ // play talk wav
txt++;
}
else if (txt[0] == 2)
@@ -234,12 +231,12 @@
while ( (c = *txt) )
{
- // count word length
+ // count word length
for (l=0 ; l< con_linewidth ; l++)
if ( txt[l] <= ' ')
break;
- // word wrap
+ // word wrap
if (l != con_linewidth && (con_x + l > con_linewidth) )
con_x = 0;
@@ -251,11 +248,11 @@
cr = false;
}
-
+
if (!con_x)
{
Con_Linefeed ();
- // mark time for transparent overlay
+ // mark time for transparent overlay
if (con_current >= 0)
con_times[con_current % NUM_CON_TIMES] = realtime;
}
@@ -279,7 +276,7 @@
con_x = 0;
break;
}
-
+
}
}
@@ -301,10 +298,10 @@
if(cls.state == ca_dedicated)
return; // no graphics mode
-// write it to the scrollable buffer
+ // write it to the scrollable buffer
Con_Print(msg);
-// update the screen if the console is displayed
+ // update the screen if the console is displayed
if(cls.signon != SIGNONS && !scr_disabled_for_loading){
/* protect against infinite loop if something in
* SCR_UpdateScreen() calls Con_Printf() */
@@ -367,24 +364,24 @@
return; // don't draw anything
text = key_lines[edit_line];
-
-// add the cursor frame
+
+ // add the cursor frame
text[key_linepos] = 10+((int)(realtime*con_cursorspeed)&1);
-
-// fill out remainder with spaces
+
+ // fill out remainder with spaces
for (i=key_linepos+1 ; i< con_linewidth ; i++)
text[i] = ' ';
-
-// prestep if horizontally scrolling
+
+ // prestep if horizontally scrolling
if (key_linepos >= con_linewidth)
text += 1 + key_linepos - con_linewidth;
-
-// draw it
+
+ // draw it
y = con_vislines-16;
for (i=0 ; i<con_linewidth ; i++)
Draw_Character ( (i+1)<<3, y, text[i]);
-// remove cursor
+ // remove cursor
key_lines[edit_line][key_linepos] = 0;
}
@@ -416,7 +413,7 @@
if (time > con_notifytime.value)
continue;
text = con_text + (i % con_totallines)*con_linewidth;
-
+
clearnotify = 0;
scr_copytop = 1;
@@ -431,9 +428,9 @@
{
clearnotify = 0;
scr_copytop = 1;
-
+
x = 0;
-
+
Draw_String (8, v, "say:");
while(chat_buffer[x])
{
@@ -443,7 +440,7 @@
Draw_Character ( (x+5)<<3, v, 10+((int)(realtime*con_cursorspeed)&1));
v += 8;
}
-
+
if (v > con_notifylines)
con_notifylines = v;
}
@@ -462,14 +459,14 @@
int rows;
char *text;
int j;
-
+
if (lines <= 0)
return;
-// draw the background
+ // draw the background
Draw_ConsoleBackground (lines);
-// draw the text
+ // draw the text
con_vislines = lines;
rows = (lines-16)>>3; // rows of text to draw
@@ -486,7 +483,7 @@
Draw_Character ( (x+1)<<3, y, text[x]);
}
-// draw the input prompt, user text, and cursor if desired
+ // draw the input prompt, user text, and cursor if desired
if (drawinput)
Con_DrawInput ();
}
--- a/cvar.c
+++ b/cvar.c
@@ -11,7 +11,7 @@
cvar_t *Cvar_FindVar (char *var_name)
{
cvar_t *var;
-
+
for (var=cvar_vars ; var ; var=var->next)
if(strcmp(var_name, var->name) == 0)
return var;
@@ -26,7 +26,7 @@
float Cvar_VariableValue (char *var_name)
{
cvar_t *var;
-
+
var = Cvar_FindVar (var_name);
if (!var)
return 0;
@@ -42,7 +42,7 @@
char *Cvar_VariableString (char *var_name)
{
cvar_t *var;
-
+
var = Cvar_FindVar (var_name);
if (!var)
return cvar_null_string;
@@ -59,11 +59,11 @@
{
cvar_t *cvar;
int len;
-
+
len = strlen(partial);
if (!len)
return nil;
-// check functions
+ // check functions
for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
if(strncmp(partial, cvar->name, len) == 0)
return cvar->name;
@@ -80,28 +80,28 @@
void Cvar_RegisterVariable (cvar_t *variable)
{
char *oldstr;
-
-// first check to see if it has allready been defined
+
+ // first check to see if it has allready been defined
if (Cvar_FindVar (variable->name))
{
Con_Printf ("Can't register variable %s, allready defined\n", variable->name);
return;
}
-
-// check for overlap with a command
+
+ // check for overlap with a command
if (Cmd_Exists (variable->name))
{
Con_Printf ("Cvar_RegisterVariable: %s is a command\n", variable->name);
return;
}
-
-// copy the value off, because future sets will Z_Free it
+
+ // copy the value off, because future sets will Z_Free it
oldstr = variable->string;
- variable->string = Z_Malloc(strlen(variable->string)+1);
+ variable->string = Z_Malloc(strlen(variable->string)+1);
strcpy(variable->string, oldstr);
variable->value = atof(variable->string);
-
-// link the variable in
+
+ // link the variable in
variable->next = cvar_vars;
cvar_vars = variable;
}
@@ -117,12 +117,12 @@
{
cvar_t *v;
-// check variables
+ // check variables
v = Cvar_FindVar (Cmd_Argv(0));
if (!v)
return false;
-
-// perform a variable print or set
+
+ // perform a variable print or set
if (Cmd_Argc() == 1)
{
Con_Printf ("\"%s\" is \"%s\"\n", v->name, v->string);
--- a/d_edge.c
+++ b/d_edge.c
@@ -62,7 +62,7 @@
espan_t *span;
byte *pdest;
int u, u2, pix;
-
+
pix = (color<<24) | (color<<16) | (color<<8) | color;
for (span=surf->spans ; span ; span=span->pnext)
{
@@ -132,9 +132,7 @@
((pface->texturemins[1] << 16) >> miplevel)
+ pface->texinfo->vecs[1][3]*t;
-//
-// -1 (-epsilon) so we never wander off the edge of the texture
-//
+ // -1 (-epsilon) so we never wander off the edge of the texture
bbextents = ((pface->extents[0] << 16) >> miplevel) - 1;
bbextentt = ((pface->extents[1] << 16) >> miplevel) - 1;
}
@@ -157,7 +155,7 @@
TransformVector (modelorg, transformed_modelorg);
VectorCopy (transformed_modelorg, world_transformed_modelorg);
-// TODO: could preset a lot of this at mode set time
+ // TODO: could preset a lot of this at mode set time
for (s = &surfaces[1] ; s<surface_p ; s++)
{
if (!s->spans)
@@ -186,8 +184,8 @@
}
else if (s->flags & SURF_DRAWBACKGROUND)
{
- // set up a gradient for the background surface that places it
- // effectively at infinity distance from the viewpoint
+ // set up a gradient for the background surface that places it
+ // effectively at infinity distance from the viewpoint
d_zistepu = 0;
d_zistepv = 0;
d_ziorigin = -0.9;
@@ -206,8 +204,8 @@
if (s->insubmodel)
{
- // FIXME: we don't want to do all this for every polygon!
- // TODO: store once at start of frame
+ // FIXME: we don't want to do all this for every polygon!
+ // TODO: store once at start of frame
currententity = s->entity; //FIXME: make this passed in to
// R_RotateBmodel ()
VectorSubtract (r_origin, currententity->origin,
@@ -224,11 +222,9 @@
if (s->insubmodel)
{
- //
- // restore the old drawing state
- // FIXME: we don't want to do this every time!
- // TODO: speed up
- //
+ // restore the old drawing state
+ // FIXME: we don't want to do this every time!
+ // TODO: speed up
currententity = &cl_entities[0];
VectorCopy (world_transformed_modelorg,
transformed_modelorg);
@@ -243,8 +239,8 @@
{
if (s->insubmodel)
{
- // FIXME: we don't want to do all this for every polygon!
- // TODO: store once at start of frame
+ // FIXME: we don't want to do all this for every polygon!
+ // TODO: store once at start of frame
currententity = s->entity; //FIXME: make this passed in to
// R_RotateBmodel ()
VectorSubtract (r_origin, currententity->origin, local_modelorg);
@@ -261,7 +257,7 @@
miplevel = D_MipLevelForScale (s->nearzi * scale_for_mip
* pface->texinfo->mipadjust);
- // FIXME: make this passed in to D_CacheSurface
+ // FIXME: make this passed in to D_CacheSurface
pcurrentcache = D_CacheSurface (pface, miplevel);
cacheblock = (pixel_t *)pcurrentcache->data;
@@ -278,11 +274,11 @@
if (s->insubmodel)
{
- //
- // restore the old drawing state
- // FIXME: we don't want to do this every time!
- // TODO: speed up
- //
+ //
+ // restore the old drawing state
+ // FIXME: we don't want to do this every time!
+ // TODO: speed up
+ //
currententity = &cl_entities[0];
VectorCopy (world_transformed_modelorg,
transformed_modelorg);
--- a/d_fill.c
+++ b/d_fill.c
@@ -30,7 +30,7 @@
rwidth = vid.width - rx;
if (ry+rheight > vid.height)
rheight = vid.height - rx;
-
+
if (rwidth < 1 || rheight < 1)
return;
@@ -38,7 +38,7 @@
if (((rwidth & 0x03) == 0) && (((uintptr)dest & 0x03) == 0))
{
- // faster aligned dword clear
+ // faster aligned dword clear
ldest = (unsigned *)dest;
color += color << 16;
@@ -54,7 +54,7 @@
}
else
{
- // slower byte-by-byte clear for unaligned cases
+ // slower byte-by-byte clear for unaligned cases
for (ry=0 ; ry<rheight ; ry++)
{
for (rx=0 ; rx<rwidth ; rx++)
--- a/d_iface.h
+++ b/d_iface.h
@@ -19,10 +19,10 @@
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct particle_s
{
-// driver-usable fields
+ // driver-usable fields
vec3_t org;
float color;
-// drivers never touch the following fields
+ // drivers never touch the following fields
struct particle_s *next;
vec3_t vel;
float ramp;
@@ -73,7 +73,7 @@
typedef struct
{
int nump;
- emitpoint_t *pverts; // there's room for an extra element at [nump],
+ emitpoint_t *pverts; // there's room for an extra element at [nump],
// if the driver wants to duplicate element [0] at
// element [nump] to avoid dealing with wrapping
mspriteframe_t *pspriteframe;
@@ -95,7 +95,7 @@
// recursive triangular subdivison
// and vertex drawing via
// D_PolysetDrawFinalVerts() past
- // a certain distance (normally
+ // a certain distance (normally
// only used by the software
// driver)
extern float r_aliasuvscale; // scale-up factor for screen u and v
--- a/d_init.c
+++ b/d_init.c
@@ -75,9 +75,7 @@
*/
void D_UpdateRects (vrect_t *prect)
{
-
-// the software driver draws these directly to the vid buffer
-
+ // the software driver draws these directly to the vid buffer
USED(prect);
}
--- a/d_part.c
+++ b/d_part.c
@@ -7,7 +7,7 @@
*/
void D_EndParticles (void)
{
-// not used by software driver
+ // not used by software driver
}
@@ -18,7 +18,7 @@
*/
void D_StartParticles (void)
{
-// not used by software driver
+ // not used by software driver
}
@@ -35,23 +35,23 @@
uzint *pz;
int i, izi, pix, count, u, v;
-// transform point
+ // transform point
VectorSubtract (pparticle->org, r_origin, local);
transformed[0] = DotProduct(local, r_pright);
transformed[1] = DotProduct(local, r_pup);
- transformed[2] = DotProduct(local, r_ppn);
+ transformed[2] = DotProduct(local, r_ppn);
if (transformed[2] < PARTICLE_Z_CLIP)
return;
-// project the point
-// FIXME: preadjust xcenter and ycenter
+ // project the point
+ // FIXME: preadjust xcenter and ycenter
zi = 1.0 / transformed[2];
u = (int)(xcenter + zi * transformed[0] + 0.5);
v = (int)(ycenter - zi * transformed[1] + 0.5);
- if ((v > d_vrectbottom_particle) ||
+ if ((v > d_vrectbottom_particle) ||
(u > d_vrectright_particle) ||
(v < d_vrecty) ||
(u < d_vrectx))
--- a/d_polyse.c
+++ b/d_polyse.c
@@ -2,7 +2,7 @@
// TODO: put in span spilling to shrink list size
// !!! if this is changed, it must be changed in d_polysa.s too !!!
-#define DPS_MAXSPANS MAXHEIGHT+1
+#define DPS_MAXSPANS MAXHEIGHT+1
// 1 extra for spanpackage that marks end
// !!! if this is changed, it must be changed in asm_draw.h too !!!
@@ -124,8 +124,8 @@
for (i=0 ; i<numverts ; i++, fv++)
{
- // valid triangle coordinates for filling can include the bottom and
- // right clip edges, due to the fill rule; these shouldn't be drawn
+ // valid triangle coordinates for filling can include the bottom and
+ // right clip edges, due to the fill rule; these shouldn't be drawn
if ((fv->v[0] < r_refdef.vrectright) &&
(fv->v[1] < r_refdef.vrectbottom))
{
@@ -174,7 +174,7 @@
if (((index0->v[1]-index1->v[1]) *
(index0->v[0]-index2->v[0]) -
- (index0->v[0]-index1->v[0]) *
+ (index0->v[0]-index1->v[0]) *
(index0->v[1]-index2->v[1])) >= 0)
{
continue;
@@ -330,7 +330,7 @@
lp3 = temp;
split:
-// split this edge
+ // split this edge
new[0] = (lp1[0] + lp2[0]) >> 1;
new[1] = (lp1[1] + lp2[1]) >> 1;
new[2] = (lp1[2] + lp2[2]) >> 1;
@@ -337,7 +337,7 @@
new[3] = (lp1[3] + lp2[3]) >> 1;
new[5] = (lp1[5] + lp2[5]) >> 1;
-// draw the point if splitting a leading edge
+ // draw the point if splitting a leading edge
if (lp2[1] > lp1[1])
goto nodraw;
if ((lp2[1] == lp1[1]) && (lp2[0] < lp1[0]))
@@ -360,7 +360,7 @@
}
nodraw:
-// recursively continue
+ // recursively continue
D_PolysetRecursiveTriangle (lp3, lp1, new, alpha);
D_PolysetRecursiveTriangle (lp3, new, lp2, alpha);
}
@@ -375,7 +375,7 @@
{
int i;
byte *s;
-
+
if (r_affinetridesc.skinwidth != skinwidth ||
r_affinetridesc.pskin != skinstart)
{
@@ -405,7 +405,7 @@
d_pedgespanpackage->sfrac = d_sfrac;
d_pedgespanpackage->tfrac = d_tfrac;
- // FIXME: need to clamp l, s, t, at both ends?
+ // FIXME: need to clamp l, s, t, at both ends?
d_pedgespanpackage->light = d_light;
d_pedgespanpackage->zi = d_zi;
@@ -466,7 +466,7 @@
int tm, tn;
adivtab_t *ptemp;
-// TODO: implement x86 version
+ // TODO: implement x86 version
errorterm = -1;
@@ -512,9 +512,9 @@
ystepdenominv = -xstepdenominv;
-// ceil () for light so positive steps are exaggerated, negative steps
-// diminished, pushing us away from underflow toward overflow. Underflow is
-// very visible, overflow is very unlikely, because of ambient lighting
+ // ceil () for light so positive steps are exaggerated, negative steps
+ // diminished, pushing us away from underflow toward overflow. Underflow is
+ // very visible, overflow is very unlikely, because of ambient lighting
t0 = r_p0[4] - r_p2[4];
t1 = r_p1[4] - r_p2[4];
r_lstepx = (int)
@@ -599,7 +599,7 @@
);
}else{
*lpdest = ((byte *)acolormap)[*lptex + (llight & 0xFF00)];
- // gel mapping *lpdest = gelmap[*lpdest];
+ // gel mapping *lpdest = gelmap[*lpdest];
*lpz = lzi >> 16;
}
}
@@ -634,7 +634,7 @@
{
int color;
-// FIXME: do z buffering
+ // FIXME: do z buffering
color = d_aflatcolor++;
@@ -682,19 +682,12 @@
initialleftheight = pleftbottom[1] - plefttop[1];
initialrightheight = prightbottom[1] - prighttop[1];
-//
-// set the s, t, and light gradients, which are consistent across the triangle
-// because being a triangle, things are affine
-//
+ // set the s, t, and light gradients, which are consistent across the triangle
+ // because being a triangle, things are affine
D_PolysetCalcGradients (r_affinetridesc.skinwidth);
-//
-// rasterize the polygon
-//
-
-//
-// scan out the top (and possibly only) part of the left edge
-//
+ // rasterize the polygon
+ // scan out the top (and possibly only) part of the left edge
d_pedgespanpackage = a_spans;
ystart = plefttop[1];
@@ -721,7 +714,7 @@
d_pedgespanpackage->sfrac = d_sfrac;
d_pedgespanpackage->tfrac = d_tfrac;
- // FIXME: need to clamp l, s, t, at both ends?
+ // FIXME: need to clamp l, s, t, at both ends?
d_pedgespanpackage->light = d_light;
d_pedgespanpackage->zi = d_zi;
@@ -737,11 +730,11 @@
d_pdestbasestep = screenwidth + ubasestep;
d_pdestextrastep = d_pdestbasestep + 1;
- // TODO: can reuse partial expressions here
+ // TODO: can reuse partial expressions here
- // for negative steps in x along left edge, bias toward overflow rather than
- // underflow (sort of turning the floor () we did in the gradient calcs into
- // ceil (), but plus a little bit)
+ // for negative steps in x along left edge, bias toward overflow rather than
+ // underflow (sort of turning the floor () we did in the gradient calcs into
+ // ceil (), but plus a little bit)
if (ubasestep < 0)
working_lstepx = r_lstepx - 1;
else
@@ -767,9 +760,7 @@
D_PolysetScanLeftEdge (initialleftheight);
}
-//
-// scan out the bottom part of the left edge, if it exists
-//
+ // scan out the bottom part of the left edge, if it exists
if (pedgetable->numleftedges == 2)
{
int height;
@@ -779,7 +770,7 @@
height = pleftbottom[1] - plefttop[1];
-// TODO: make this a function; modularize this function in general
+ // TODO: make this a function; modularize this function in general
ystart = plefttop[1];
d_aspancount = plefttop[0] - prighttop[0];
@@ -803,7 +794,7 @@
d_pedgespanpackage->sfrac = d_sfrac;
d_pedgespanpackage->tfrac = d_tfrac;
- // FIXME: need to clamp l, s, t, at both ends?
+ // FIXME: need to clamp l, s, t, at both ends?
d_pedgespanpackage->light = d_light;
d_pedgespanpackage->zi = d_zi;
}
@@ -843,8 +834,8 @@
}
}
-// scan out the top (and possibly only) part of the right edge, updating the
-// count field
+ // scan out the top (and possibly only) part of the right edge, updating the
+ // count field
d_pedgespanpackage = a_spans;
D_PolysetSetUpForLineScan(prighttop[0], prighttop[1],
@@ -855,7 +846,7 @@
a_spans[initialrightheight].count = Q_MININT; // mark end of the spanpackages
D_PolysetDrawSpans8 (a_spans, currententity->alpha);
-// scan out the bottom part of the right edge, if it exists
+ // scan out the bottom part of the right edge, if it exists
if (pedgetable->numrightedges == 2)
{
int height;
@@ -894,10 +885,8 @@
edgetableindex = 0; // assume the vertices are already in
// top to bottom order
-//
-// determine which edges are right & left, and the order in which
-// to rasterize them
-//
+ // determine which edges are right & left, and the order in which
+ // to rasterize them
if (r_p0[1] >= r_p1[1])
{
if (r_p0[1] == r_p1[1])
--- a/d_scan.c
+++ b/d_scan.c
@@ -96,7 +96,7 @@
fixed16_t snext, tnext;
float sdivz, tdivz, zi, z, du, dv, spancountminus1;
float sdivz16stepu, tdivz16stepu, zi16stepu;
-
+
r_turb_turb = sintable + ((int)(cl.time*SPEED)&(CYCLE-1));
r_turb_sstep = 0; // keep compiler happy
@@ -116,7 +116,7 @@
count = pspan->count;
- // calculate the initial s/z, t/z, 1/z, s, and t and clamp
+ // calculate the initial s/z, t/z, 1/z, s, and t and clamp
du = (float)pspan->u;
dv = (float)pspan->v;
@@ -139,7 +139,7 @@
do
{
- // calculate s and t at the far end of the span
+ // calculate s and t at the far end of the span
if (count >= 16)
r_turb_spancount = 16;
else
@@ -149,8 +149,8 @@
if (count)
{
- // calculate s/z, t/z, zi->fixed s and t at far end of span,
- // calculate s and t steps across span by shifting
+ // calculate s/z, t/z, zi->fixed s and t at far end of span,
+ // calculate s and t steps across span by shifting
sdivz += sdivz16stepu;
tdivz += tdivz16stepu;
zi += zi16stepu;
@@ -175,10 +175,10 @@
}
else
{
- // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
- // can't step off polygon), clamp, calculate s and t steps across
- // span by division, biasing steps low so we don't run off the
- // texture
+ // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
+ // can't step off polygon), clamp, calculate s and t steps across
+ // span by division, biasing steps low so we don't run off the
+ // texture
spancountminus1 = (float)(r_turb_spancount - 1);
sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1;
@@ -408,7 +408,7 @@
count = pspan->count;
- // calculate the initial s/z, t/z, 1/z, s, and t and clamp
+ // calculate the initial s/z, t/z, 1/z, s, and t and clamp
du = (float)pspan->u;
dv = (float)pspan->v;
@@ -431,7 +431,7 @@
do
{
- // calculate s and t at the far end of the span
+ // calculate s and t at the far end of the span
if (count >= 16)
spancount = 16;
else
@@ -441,8 +441,8 @@
if (count)
{
- // calculate s/z, t/z, zi->fixed s and t at far end of span,
- // calculate s and t steps across span by shifting
+ // calculate s/z, t/z, zi->fixed s and t at far end of span,
+ // calculate s and t steps across span by shifting
sdivz += sdivzstepu;
tdivz += tdivzstepu;
zi += zistepu;
@@ -467,10 +467,10 @@
}
else
{
- // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
- // can't step off polygon), clamp, calculate s and t steps across
- // span by division, biasing steps low so we don't run off the
- // texture
+ // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
+ // can't step off polygon), clamp, calculate s and t steps across
+ // span by division, biasing steps low so we don't run off the
+ // texture
spancountminus1 = (float)(spancount - 1);
sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1;
@@ -532,8 +532,8 @@
if((r_drawflags & DRAW_BLEND) != 0)
return;
-// FIXME: check for clamping/range problems
-// we count on FP exceptions being turned off to avoid range problems
+ // FIXME: check for clamping/range problems
+ // we count on FP exceptions being turned off to avoid range problems
izistep = (int)(d_zistepu * 0x8000 * 0x10000);
do
@@ -542,12 +542,12 @@
count = pspan->count;
- // calculate the initial 1/z
+ // calculate the initial 1/z
du = (float)pspan->u;
dv = (float)pspan->v;
zi = d_ziorigin + dv*d_zistepv + du*d_zistepu;
- // we count on FP exceptions being turned off to avoid range problems
+ // we count on FP exceptions being turned off to avoid range problems
izi = (int)(zi * 0x8000 * 0x10000);
if ((uintptr)pdest & 0x02)
--- a/d_sky.c
+++ b/d_sky.c
@@ -55,7 +55,7 @@
count = pspan->count;
- // calculate the initial s & t
+ // calculate the initial s & t
u = pspan->u;
v = pspan->v;
D_Sky_uv_To_st (u, v, s, t, skydist);
@@ -73,8 +73,8 @@
{
u += spancount;
- // calculate s and t at far end of span,
- // calculate s and t steps across span by shifting
+ // calculate s and t at far end of span,
+ // calculate s and t steps across span by shifting
D_Sky_uv_To_st (u, v, snext, tnext, skydist);
sstep[0] = (snext[0] - s[0]) >> SKY_SPAN_SHIFT;
@@ -84,8 +84,8 @@
}
else
{
- // calculate s and t at last pixel in span,
- // calculate s and t steps across span by division
+ // calculate s and t at last pixel in span,
+ // calculate s and t steps across span by division
spancountminus1 = (float)(spancount - 1);
if (spancountminus1 > 0)
--- a/d_sprite.c
+++ b/d_sprite.c
@@ -29,7 +29,7 @@
tdivz8stepu = d_tdivzstepu * 8;
zi8stepu = d_zistepu * 8;
-// we count on FP exceptions being turned off to avoid range problems
+ // we count on FP exceptions being turned off to avoid range problems
izistep = (int)(d_zistepu * 0x8000 * 0x10000);
do
@@ -42,7 +42,7 @@
if (count <= 0)
goto NextSpan;
- // calculate the initial s/z, t/z, 1/z, s, and t and clamp
+ // calculate the initial s/z, t/z, 1/z, s, and t and clamp
du = (float)pspan->u;
dv = (float)pspan->v;
@@ -50,7 +50,7 @@
tdivz = d_tdivzorigin + dv*d_tdivzstepv + du*d_tdivzstepu;
zi = d_ziorigin + dv*d_zistepv + du*d_zistepu;
z = (float)0x10000 / zi; // prescale to 16.16 fixed-point
- // we count on FP exceptions being turned off to avoid range problems
+ // we count on FP exceptions being turned off to avoid range problems
izi = (int)(zi * 0x8000 * 0x10000);
s = (int)(sdivz * z) + sadjust;
@@ -67,7 +67,7 @@
do
{
- // calculate s and t at the far end of the span
+ // calculate s and t at the far end of the span
if (count >= 8)
spancount = 8;
else
@@ -77,8 +77,8 @@
if (count)
{
- // calculate s/z, t/z, zi->fixed s and t at far end of span,
- // calculate s and t steps across span by shifting
+ // calculate s/z, t/z, zi->fixed s and t at far end of span,
+ // calculate s and t steps across span by shifting
sdivz += sdivz8stepu;
tdivz += tdivz8stepu;
zi += zi8stepu;
@@ -103,10 +103,10 @@
}
else
{
- // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
- // can't step off polygon), clamp, calculate s and t steps across
- // span by division, biasing steps low so we don't run off the
- // texture
+ // calculate s/z, t/z, zi->fixed s and t at last pixel in span (so
+ // can't step off polygon), clamp, calculate s and t steps across
+ // span by division, biasing steps low so we don't run off the
+ // texture
spancountminus1 = (float)(spancount - 1);
sdivz += d_sdivzstepu * spancountminus1;
tdivz += d_tdivzstepu * spancountminus1;
@@ -204,7 +204,7 @@
dv = pnext->v - pvert->v;
slope = du / dv;
u_step = (int)(slope * 0x10000);
- // adjust u to ceil the integer portion
+ // adjust u to ceil the integer portion
u = (int)((pvert->u + (slope * (vtop - pvert->v))) * 0x10000) +
(0x10000 - 1);
itop = (int)vtop;
@@ -284,7 +284,7 @@
dv = vnext - vvert;
slope = du / dv;
u_step = (int)(slope * 0x10000);
- // adjust u to ceil the integer portion
+ // adjust u to ceil the integer portion
u = (int)((uvert + (slope * (vtop - vvert))) * 0x10000) +
(0x10000 - 1);
itop = (int)vtop;
@@ -307,7 +307,7 @@
} while (i != maxindex);
- pspan->count = DS_SPAN_LIST_END; // mark the end of the span list
+ pspan->count = DS_SPAN_LIST_END; // mark the end of the span list
}
@@ -351,7 +351,7 @@
tadjust = ((fixed16_t)(DotProduct (p_temp1, p_taxis) * 0x10000 + 0.5)) -
(-(sprite_height >> 1) << 16);
-// -1 (-epsilon) so we never wander off the edge of the texture
+ // -1 (-epsilon) so we never wander off the edge of the texture
bbextents = (cachewidth << 16) - 1;
bbextentt = (sprite_height << 16) - 1;
}
@@ -371,8 +371,8 @@
sprite_spans = spans;
-// find the top and bottom vertices, and make sure there's at least one scan to
-// draw
+ // find the top and bottom vertices, and make sure there's at least one scan to
+ // draw
ymin = Q_MAXFLOAT;
ymax = -Q_MAXFLOAT;
pverts = r_spritedesc.pverts;
@@ -404,8 +404,8 @@
sprite_height = r_spritedesc.pspriteframe->height;
cacheblock = (byte *)&r_spritedesc.pspriteframe->pixels[0];
-// copy the first vertex to the last vertex, so we don't have to deal with
-// wrapping
+ // copy the first vertex to the last vertex, so we don't have to deal with
+ // wrapping
nump = r_spritedesc.nump;
pverts = r_spritedesc.pverts;
pverts[nump] = pverts[0];
--- a/d_surf.c
+++ b/d_surf.c
@@ -1,32 +1,32 @@
#include "quakedef.h"
-float surfscale;
-qboolean r_cache_thrash; // set if surface cache is thrashing
+float surfscale;
+qboolean r_cache_thrash; // set if surface cache is thrashing
int sc_size;
surfcache_t *sc_rover, *sc_base;
-#define GUARDSIZE 4
+#define GUARDSIZE 4
-int D_SurfaceCacheForRes (int width, int height)
+int D_SurfaceCacheForRes (int width, int height)
{
- int size, pix;
-
+ int size, pix;
+
size = SURFCACHE_SIZE_AT_320X200;
pix = width*height;
if (pix > 64000)
size += (pix-64000)*3;
-
+
return size;
}
void D_CheckCacheGuard (void)
{
- byte *s;
- int i;
+ byte *s;
+ int i;
s = (byte *)sc_base + sc_size;
for (i=0 ; i<GUARDSIZE ; i++)
@@ -36,9 +36,9 @@
void D_ClearCacheGuard (void)
{
- byte *s;
- int i;
-
+ byte *s;
+ int i;
+
s = (byte *)sc_base + sc_size;
for (i=0 ; i<GUARDSIZE ; i++)
s[i] = (byte)i;
@@ -60,11 +60,11 @@
sc_size = size - GUARDSIZE;
sc_base = (surfcache_t *)buffer;
sc_rover = sc_base;
-
+
sc_base->next = nil;
sc_base->owner = nil;
sc_base->size = sc_size;
-
+
D_ClearCacheGuard ();
}
@@ -76,8 +76,8 @@
*/
void D_FlushCaches (void)
{
- surfcache_t *c;
-
+ surfcache_t *c;
+
if (!sc_base)
return;
@@ -86,7 +86,7 @@
if (c->owner)
*c->owner = nil;
}
-
+
sc_rover = sc_base;
sc_base->next = nil;
sc_base->owner = nil;
@@ -98,10 +98,10 @@
D_SCAlloc
=================
*/
-surfcache_t *D_SCAlloc (int width, uintptr size)
+surfcache_t *D_SCAlloc (int width, uintptr size)
{
- surfcache_t *new;
- qboolean wrapped_this_time;
+ surfcache_t *new;
+ qboolean wrapped_this_time;
if ((width < 0) || (width > 256))
Host_Error("D_SCAlloc: bad cache width %d\n", width);
@@ -108,13 +108,13 @@
if ((size <= 0) || (size > 0x10000))
Host_Error("D_SCAlloc: bad cache size %zud\n", size);
-
+
size = (uintptr)&((surfcache_t *)0)->data[size];
size = (size + 3) & ~3;
if (size > (uintptr)sc_size)
Host_Error("D_SCAlloc: %zud > cache size",size);
-// if there is not size bytes after the rover, reset to the start
+ // if there is not size bytes after the rover, reset to the start
wrapped_this_time = false;
if ( !sc_rover || (intptr)sc_rover-(intptr)sc_base > (intptr)sc_size-(intptr)size)
@@ -125,26 +125,26 @@
}
sc_rover = sc_base;
}
-
-// colect and free surfcache_t blocks until the rover block is large enough
+
+ // colect and free surfcache_t blocks until the rover block is large enough
new = sc_rover;
if (sc_rover->owner)
*sc_rover->owner = nil;
-
+
while ((uintptr)new->size < size)
{
- // free another
+ // free another
sc_rover = sc_rover->next;
if (!sc_rover)
fatal ("D_SCAlloc: hit the end of memory");
if (sc_rover->owner)
*sc_rover->owner = nil;
-
+
new->size += sc_rover->size;
new->next = sc_rover->next;
}
-// create a fragment out of any leftovers
+ // create a fragment out of any leftovers
if (new->size - size > 256)
{
sc_rover = (surfcache_t *)( (byte *)new + size);
@@ -157,13 +157,13 @@
}
else
sc_rover = new->next;
-
+
new->width = width;
-// DEBUG
+ // DEBUG
if (width > 0)
new->height = (size - sizeof(*new) + sizeof(new->data)) / width;
- new->owner = nil; // should be set properly after return
+ new->owner = nil; // should be set properly after return
if (d_roverwrapped)
{
@@ -171,7 +171,7 @@
r_cache_thrash = true;
}
else if (wrapped_this_time)
- {
+ {
d_roverwrapped = true;
}
@@ -187,7 +187,7 @@
for(s = sc_base; s != nil; s = s->next){
if(s == sc_rover)
Con_DPrintf("ROVER:\n");
- Con_DPrintf("%p : %d bytes %ud width\n", s, s->size, s->width);
+ Con_DPrintf("%p : %d bytes %ud width\n", s, s->size, s->width);
}
}
@@ -198,20 +198,16 @@
*/
surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel)
{
- surfcache_t *cache;
+ surfcache_t *cache;
-//
-// if the surface is animating or flashing, flush the cache
-//
+ // if the surface is animating or flashing, flush the cache
r_drawsurf.texture = R_TextureAnimation (surface->texinfo->texture);
r_drawsurf.lightadj[0] = d_lightstylevalue[surface->styles[0]];
r_drawsurf.lightadj[1] = d_lightstylevalue[surface->styles[1]];
r_drawsurf.lightadj[2] = d_lightstylevalue[surface->styles[2]];
r_drawsurf.lightadj[3] = d_lightstylevalue[surface->styles[3]];
-
-//
-// see if the cache holds apropriate data
-//
+
+ // see if the cache holds apropriate data
cache = surface->cachespots[miplevel];
if(currententity == cl_entities || currententity->model->name[0] == '*')
@@ -223,19 +219,15 @@
&& cache->lightadj[3] == r_drawsurf.lightadj[3] )
return cache;
-//
-// determine shape of surface
-//
+ // determine shape of surface
surfscale = 1.0 / (1<<miplevel);
r_drawsurf.surfmip = miplevel;
r_drawsurf.surfwidth = surface->extents[0] >> miplevel;
r_drawsurf.rowbytes = r_drawsurf.surfwidth;
r_drawsurf.surfheight = surface->extents[1] >> miplevel;
-
-//
-// allocate memory if needed
-//
- if (!cache) // if a texture just animated, don't reallocate it
+
+ // allocate memory if needed
+ if (!cache) // if a texture just animated, don't reallocate it
{
cache = D_SCAlloc (r_drawsurf.surfwidth,
r_drawsurf.surfwidth * r_drawsurf.surfheight);
@@ -243,7 +235,7 @@
cache->owner = &surface->cachespots[miplevel];
cache->mipscale = surfscale;
}
-
+
if (surface->dlightframe == r_framecount)
cache->dlight = 1;
else
@@ -250,7 +242,7 @@
cache->dlight = 0;
r_drawsurf.surfdat = (pixel_t *)cache->data;
-
+
cache->texture = r_drawsurf.texture;
cache->lightadj[0] = r_drawsurf.lightadj[0];
cache->lightadj[1] = r_drawsurf.lightadj[1];
@@ -257,9 +249,7 @@
cache->lightadj[2] = r_drawsurf.lightadj[2];
cache->lightadj[3] = r_drawsurf.lightadj[3];
-//
-// draw and light the surface texture
-//
+ // draw and light the surface texture
r_drawsurf.surf = surface;
c_surf++;
--- a/d_zpoint.c
+++ b/d_zpoint.c
@@ -10,7 +10,7 @@
byte *pdest;
uzint *pz;
int izi;
-
+
pz = d_pzbuffer + (d_zwidth * r_zpointdesc.v) + r_zpointdesc.u;
pdest = d_viewbuffer + d_scantable[r_zpointdesc.v] + r_zpointdesc.u;
izi = (int)(r_zpointdesc.zi * 0x8000);
--- a/draw.c
+++ b/draw.c
@@ -43,7 +43,7 @@
cachepic_t *pic;
int i;
qpic_t *dat;
-
+
for (pic=menu_cachepics, i=0 ; i<menu_numcachepics ; pic++, i++)
if (!strcmp (path, pic->name))
break;
@@ -61,9 +61,7 @@
if (dat)
return dat;
-//
-// load the pic from disk
-//
+ // load the pic from disk
dat = loadcachelmp(path, &pic->cache);
if(dat == nil)
fatal("Draw_CachePic: %s", lerr());
@@ -106,11 +104,11 @@
{
byte *dest;
byte *source;
- int drawline;
+ int drawline;
int row, col;
num &= 255;
-
+
if (y <= -8)
return; // totally off screen
@@ -176,7 +174,7 @@
{
byte *dest;
byte *source;
- int drawline;
+ int drawline;
extern byte *draw_chars;
int row, col;
@@ -373,7 +371,7 @@
conback = Draw_CachePic ("gfx/conback.lmp");
-// hack the version number directly into the pic
+ // hack the version number directly into the pic
sprint (ver, "(9)quake %4.2f", (float)VERSION);
dest = conback->data + 320*186 + 320 - 11 - 8*strlen(ver);
--- a/fs.c
+++ b/fs.c
@@ -915,7 +915,7 @@
static short
ShortSwap(short l)
{
- byte b1,b2;
+ byte b1,b2;
b1 = l&255;
b2 = (l>>8)&255;
@@ -929,7 +929,7 @@
static int
LongSwap(int l)
{
- byte b1,b2,b3,b4;
+ byte b1,b2,b3,b4;
b1 = l&255;
b2 = (l>>8)&255;
@@ -947,7 +947,7 @@
{
union{
float f;
- byte b[4];
+ byte b[4];
} dat1, dat2;
dat1.f = f;
--- a/host.c
+++ b/host.c
@@ -88,11 +88,11 @@
va_list arg;
char s[1024];
static qboolean inerror = false;
-
+
if(inerror)
fatal("Host_Error: recursively entered");
inerror = true;
-
+
SCR_EndLoadingPlaque(); // reenable screen updates
va_start(arg, fmt);
@@ -100,7 +100,7 @@
va_end(arg);
Con_Printf("Host_Error: %s\n", s);
-
+
if(sv.active)
Host_ShutdownServer(false);
if(cls.state == ca_dedicated)
@@ -151,7 +151,7 @@
void Host_InitLocal (void)
{
Host_InitCommands ();
-
+
Cvar_RegisterVariable (&host_framerate);
Cvar_RegisterVariable (&host_speeds);
@@ -172,7 +172,7 @@
Cvar_RegisterVariable (&temp1);
Host_FindMaxClients ();
-
+
host_time = 1.0; // so a think at time 0 won't get called
}
@@ -180,7 +180,7 @@
=================
SV_ClientPrintf
-Sends text across to be displayed
+Sends text across to be displayed
FIXME: make this just a stuffed echo?
=================
*/
@@ -209,7 +209,7 @@
va_list arg;
char s[1024];
int i;
-
+
va_start(arg, fmt);
vsnprint(s, sizeof s, fmt, arg);
va_end(arg);
@@ -263,11 +263,11 @@
MSG_WriteByte (&host_client->message, svc_disconnect);
NET_SendMessage (host_client->netconnection, &host_client->message);
}
-
+
if (host_client->edict && host_client->spawned)
{
- // call the prog function for removing a client
- // this will set the body to a dead frame, among other things
+ // call the prog function for removing a client
+ // this will set the body to a dead frame, among other things
saveSelf = pr_global_struct->self;
pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
PR_ExecuteProgram (pr_global_struct->ClientDisconnect);
@@ -277,17 +277,17 @@
Con_DPrintf("client %s removed\n", host_client->name);
}
-// break the net connection
+ // break the net connection
NET_Close (host_client->netconnection);
host_client->netconnection = nil;
-// free the client (the body stays around)
+ // free the client (the body stays around)
host_client->active = false;
host_client->name[0] = 0;
host_client->old_frags = Q_MININT;
net_activeconnections--;
-// send notification to all clients
+ // send notification to all clients
for (i=0, client = svs.clients ; i<svs.maxclients ; i++, client++)
{
if (!client->active)
@@ -324,11 +324,11 @@
UDP_Listen(0);
sv.active = false;
-// stop all client sounds immediately
+ // stop all client sounds immediately
if (cls.state == ca_connected)
CL_Disconnect ();
-// flush any pending messages - like the score!!!
+ // flush any pending messages - like the score!!!
start = dtime();
do
{
@@ -354,7 +354,7 @@
}
while (count);
-// make sure all the clients know we're disconnecting
+ // make sure all the clients know we're disconnecting
buf.data = (uchar *)message;
buf.maxsize = 4;
buf.cursize = 0;
@@ -367,9 +367,7 @@
if (host_client->active)
SV_DropClient(crash);
-//
-// clear structures
-//
+ // clear structures
memset(&sv, 0, sizeof sv);
memset(svs.clients, 0, svs.maxclientslimit * sizeof *svs.clients);
}
@@ -404,24 +402,24 @@
*/
void Host_ServerFrame (void)
{
-// run the world state
+ // run the world state
pr_global_struct->frametime = host_frametime;
-// set the time and clear the general datagram
+ // set the time and clear the general datagram
SV_ClearDatagram ();
-
-// check for new clients
+
+ // check for new clients
SV_CheckForNewClients ();
-// read client messages
+ // read client messages
SV_RunClients ();
-
-// move things around and think
-// always pause in single player if in console or menus
+
+ // move things around and think
+ // always pause in single player if in console or menus
if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) )
SV_Physics ();
-// send all messages to the clients
+ // send all messages to the clients
SV_SendClientMessages ();
}
@@ -450,66 +448,66 @@
if (setjmp (host_abortserver) )
return; // something bad happened, or the server disconnected
-// keep the random time dependent
+ // keep the random time dependent
rand ();
if(boundfps(time) < 0)
return;
-
-// get new key events
+
+ // get new key events
Sys_SendKeyEvents ();
-// allow mice or other external controllers to add commands
+ // allow mice or other external controllers to add commands
IN_Commands ();
-// process console commands
+ // process console commands
Cbuf_Execute ();
-// if running the server locally, make intentions now
+ // if running the server locally, make intentions now
if (sv.active)
CL_SendCmd ();
-
-//-------------------
-//
-// server operations
-//
-//-------------------
-// check for commands typed to the host
+ //-------------------
+ //
+ // server operations
+ //
+ //-------------------
+
+ // check for commands typed to the host
conscmd();
-
+
if (sv.active)
Host_ServerFrame ();
-//-------------------
-//
-// client operations
-//
-//-------------------
+ //-------------------
+ //
+ // client operations
+ //
+ //-------------------
-// if running the server remotely, send intentions now after
-// the incoming messages have been read
+ // if running the server remotely, send intentions now after
+ // the incoming messages have been read
if (!sv.active)
CL_SendCmd ();
host_time += host_frametime;
-// fetch results from server
+ // fetch results from server
if (cls.state == ca_connected)
{
CL_ReadFromServer ();
}
-// update video
+ // update video
if (host_speeds.value)
time1 = dtime ();
-
+
SCR_UpdateScreen ();
if (host_speeds.value)
time2 = dtime ();
-
-// update audio
+
+ // update audio
if (cls.signon == SIGNONS)
{
stepsnd (r_origin, vpn, vright, vup);
@@ -517,7 +515,7 @@
}
else
stepsnd (vec3_origin, vec3_origin, vec3_origin, vec3_origin);
-
+
stepcd();
if (host_speeds.value)
@@ -529,7 +527,7 @@
Con_Printf ("%3d tot %3d server %3d gfx %3d snd\n",
pass1+pass2+pass3, pass1, pass2, pass3);
}
-
+
host_framecount++;
}
@@ -545,14 +543,14 @@
_Host_Frame (time);
return;
}
-
+
time1 = dtime ();
_Host_Frame (time);
- time2 = dtime ();
-
+ time2 = dtime ();
+
timetotal += time2 - time1;
timecount++;
-
+
if (timecount < 1000)
return;
@@ -580,7 +578,7 @@
Memory_Init();
Cbuf_Init ();
- Cmd_Init ();
+ Cmd_Init ();
V_Init ();
Chase_Init ();
initfs(paths);
@@ -587,14 +585,14 @@
Host_InitLocal ();
W_LoadWadFile ("gfx.wad");
Key_Init ();
- Con_Init ();
- M_Init ();
+ Con_Init ();
+ M_Init ();
PR_Init ();
Mod_Init ();
NET_Init ();
SV_Init ();
R_InitTextures (); // needed even for dedicated servers
-
+
if (cls.state != ca_dedicated)
{
host_basepal = loadhunklmp("gfx/palette.lmp", nil);
@@ -634,7 +632,7 @@
Cbuf_AddText(argv[i++]);
}
Cbuf_AddText("\n");
- }
+ }
}
@@ -649,7 +647,7 @@
void Host_Shutdown(void)
{
static qboolean isdown = false;
-
+
if (isdown)
{
Con_DPrintf("Host_Shutdown: recursive shutdown\n");
@@ -657,10 +655,10 @@
}
isdown = true;
-// keep Con_Printf from trying to update the screen
+ // keep Con_Printf from trying to update the screen
scr_disabled_for_loading = true;
- dumpcfg();
+ dumpcfg();
NET_Shutdown ();
shutcd();
--- a/host_cmd.c
+++ b/host_cmd.c
@@ -18,7 +18,7 @@
return;
}
CL_Disconnect ();
- Host_ShutdownServer(false);
+ Host_ShutdownServer(false);
game_shutdown ();
}
@@ -37,7 +37,7 @@
int hours;
int j;
void (*print) (char *fmt, ...);
-
+
if (cmd_source == src_command)
{
if (!sv.active)
@@ -50,9 +50,9 @@
else
print = SV_ClientPrintf;
- print ("host: %s\n", Cvar_VariableString ("hostname"));
+ print ("host: %s\n", Cvar_VariableString ("hostname"));
print ("version: %4.2f\n", VERSION);
- print ("map: %s\n", sv.name);
+ print ("map: %s\n", sv.name);
print ("players: %d active (%d max)\n\n", net_activeconnections, svs.maxclients);
for (j=0, client = svs.clients ; j<svs.maxclients ; j++, client++)
{
@@ -187,7 +187,7 @@
int i, j;
float total;
client_t *client;
-
+
if (cmd_source == src_command)
{
Cmd_ForwardToServer ();
@@ -220,7 +220,7 @@
======================
Host_Map_f
-handle a
+handle a
map <servername>
command from the console. Active clients are kicked off.
======================
@@ -236,7 +236,7 @@
cls.demonum = -1; // stop demo loop in case this fails
CL_Disconnect ();
- Host_ShutdownServer(false);
+ Host_ShutdownServer(false);
key_dest = key_game; // remove console or menu
SCR_BeginLoadingPlaque ();
@@ -254,7 +254,7 @@
SV_SpawnServer (name);
if (!sv.active)
return;
-
+
if (cls.state != ca_dedicated)
{
strcpy (cls.spawnparms, "");
@@ -264,9 +264,9 @@
strcat (cls.spawnparms, Cmd_Argv(i));
strcat (cls.spawnparms, " ");
}
-
+
Cmd_ExecuteString ("connect local", src_command);
- }
+ }
}
/*
@@ -334,7 +334,7 @@
void Host_Connect_f (void)
{
char name[Npath];
-
+
cls.demonum = -1; // stop demo loop in case this fails
if (cls.demoplayback)
{
@@ -381,15 +381,15 @@
Con_Printf ("%s renamed to %s\n", host_client->name, newName);
strcpy(host_client->name, newName);
host_client->edict->v.netname = PR_SetStr(host_client->name);
-
-// send notification to all clients
-
+
+ // send notification to all clients
+
MSG_WriteByte (&sv.reliable_datagram, svc_updatename);
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteString (&sv.reliable_datagram, host_client->name);
}
-
+
void Host_Version_f (void)
{
Con_Printf ("Version %4.2f\n", VERSION);
@@ -426,7 +426,7 @@
save = host_client;
p = Cmd_Args();
-// remove quotes if present
+ // remove quotes if present
if (*p == '"')
{
p++;
@@ -433,7 +433,7 @@
p[strlen(p)-1] = 0;
}
-// turn on color set 1
+ // turn on color set 1
if (!fromServer)
sprint (text, "%c%s: ", 1, save->name);
else
@@ -495,7 +495,7 @@
p = Cmd_Args();
-// remove quotes if present
+ // remove quotes if present
if (*p == '"')
{
p++;
@@ -502,7 +502,7 @@
p[strlen(p)-1] = 0;
}
-// check length & truncate if necessary
+ // check length & truncate if necessary
j = sizeof(text) - 2 - strlen(text); // -2 for /n and null terminator
if(j < (int)strlen(p))
p[j] = 0;
@@ -534,7 +534,7 @@
{
int top, bottom;
int playercolor;
-
+
if (Cmd_Argc() == 1)
{
Con_Printf ("\"color\" is \"%d %d\"\n", ((int)cl_color.value) >> 4, ((int)cl_color.value) & 0x0f);
@@ -549,7 +549,7 @@
top = atoi(Cmd_Argv(1));
bottom = atoi(Cmd_Argv(2));
}
-
+
top &= 15;
if (top > 13)
top = 13;
@@ -556,7 +556,7 @@
bottom &= 15;
if (bottom > 13)
bottom = 13;
-
+
playercolor = top*16 + bottom;
if (cmd_source == src_command)
@@ -570,7 +570,7 @@
host_client->colors = playercolor;
host_client->edict->v.team = bottom + 1;
-// send notification to all clients
+ // send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_updatecolors);
MSG_WriteByte (&sv.reliable_datagram, host_client - svs.clients);
MSG_WriteByte (&sv.reliable_datagram, host_client->colors);
@@ -594,7 +594,7 @@
SV_ClientPrintf ("Can't suicide -- allready dead!\n");
return;
}
-
+
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(sv_player);
PR_ExecuteProgram (pr_global_struct->ClientKill);
@@ -608,7 +608,7 @@
*/
void Host_Pause_f (void)
{
-
+
if (cmd_source == src_command)
{
Cmd_ForwardToServer ();
@@ -629,7 +629,7 @@
SV_BroadcastPrintf ("%s unpaused the game\n", PR_Str(sv_player->v.netname));
}
- // send notification to all clients
+ // send notification to all clients
MSG_WriteByte (&sv.reliable_datagram, svc_setpause);
MSG_WriteByte (&sv.reliable_datagram, sv.paused);
}
@@ -656,7 +656,7 @@
Con_Printf ("prespawn not valid -- allready spawned\n");
return;
}
-
+
SZ_Write (&host_client->message, sv.signon.data, sv.signon.cursize);
MSG_WriteByte (&host_client->message, svc_signonnum);
MSG_WriteByte (&host_client->message, 2);
@@ -686,7 +686,7 @@
return;
}
-// run the entrance script
+ // run the entrance script
if (sv.loadgame)
{ // loaded games are fully inited allready
// if this is the last client to be connected, unpause
@@ -716,14 +716,14 @@
if ((dtime() - host_client->netconnection->connecttime) <= sv.time)
Con_DPrintf("%s entered the game\n", host_client->name);
- PR_ExecuteProgram (pr_global_struct->PutClientInServer);
+ PR_ExecuteProgram (pr_global_struct->PutClientInServer);
}
-// send all current names, colors, and frag counts
+ // send all current names, colors, and frag counts
SZ_Clear (&host_client->message);
-// send time of update
+ // send time of update
MSG_WriteByte (&host_client->message, svc_time);
MSG_WriteFloat (&host_client->message, sv.time);
@@ -739,8 +739,8 @@
MSG_WriteByte (&host_client->message, i);
MSG_WriteByte (&host_client->message, client->colors);
}
-
-// send all current light styles
+
+ // send all current light styles
for (i=0 ; i<Nlights ; i++)
{
MSG_WriteByte (&host_client->message, svc_lightstyle);
@@ -748,9 +748,7 @@
MSG_WriteString (&host_client->message, sv.lightstyles[i]);
}
-//
-// send some stats
-//
+ // send some stats
MSG_WriteByte (&host_client->message, svc_updatestat);
MSG_WriteByte (&host_client->message, STAT_TOTALSECRETS);
MSG_WriteLong (&host_client->message, pr_global_struct->total_secrets);
@@ -767,13 +765,12 @@
MSG_WriteByte (&host_client->message, STAT_MONSTERS);
MSG_WriteLong (&host_client->message, pr_global_struct->killed_monsters);
-
-//
-// send a fixangle
-// Never send a roll angle, because savegames can catch the server
-// in a state where it is expecting the client to correct the angle
-// and it won't happen if the game was just loaded, so you wind up
-// with a permanent head tilt
+
+ // send a fixangle
+ // Never send a roll angle, because savegames can catch the server
+ // in a state where it is expecting the client to correct the angle
+ // and it won't happen if the game was just loaded, so you wind up
+ // with a permanent head tilt
ent = EDICT_NUM( 1 + (host_client - svs.clients) );
MSG_WriteByte (&host_client->message, svc_setangle);
for (i=0 ; i < 2 ; i++)
@@ -1010,7 +1007,7 @@
t = Cmd_Argv(1);
v = atoi (Cmd_Argv(2));
-
+
switch (t[0])
{
case '0':
@@ -1023,41 +1020,41 @@
case '7':
case '8':
case '9':
- // MED 01/04/97 added hipnotic give stuff
- if (hipnotic)
- {
- if (t[0] == '6')
- {
- if (t[1] == 'a')
- sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN;
- else
- sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER;
- }
- else if (t[0] == '9')
- sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON;
- else if (t[0] == '0')
- sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR;
- else if (t[0] >= '2')
- sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
- }
- else
- {
- if (t[0] >= '2')
- sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
- }
+ // MED 01/04/97 added hipnotic give stuff
+ if (hipnotic)
+ {
+ if (t[0] == '6')
+ {
+ if (t[1] == 'a')
+ sv_player->v.items = (int)sv_player->v.items | HIT_PROXIMITY_GUN;
+ else
+ sv_player->v.items = (int)sv_player->v.items | IT_GRENADE_LAUNCHER;
+ }
+ else if (t[0] == '9')
+ sv_player->v.items = (int)sv_player->v.items | HIT_LASER_CANNON;
+ else if (t[0] == '0')
+ sv_player->v.items = (int)sv_player->v.items | HIT_MJOLNIR;
+ else if (t[0] >= '2')
+ sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
+ }
+ else
+ {
+ if (t[0] >= '2')
+ sv_player->v.items = (int)sv_player->v.items | (IT_SHOTGUN << (t[0] - '2'));
+ }
break;
-
- case 's':
+
+ case 's':
if (rogue)
{
- val = GetEdictFieldValue(sv_player, "ammo_shells1");
- if (val)
- val->_float = v;
+ val = GetEdictFieldValue(sv_player, "ammo_shells1");
+ if (val)
+ val->_float = v;
}
- sv_player->v.ammo_shells = v;
- break;
- case 'n':
+ sv_player->v.ammo_shells = v;
+ break;
+ case 'n':
if (rogue)
{
val = GetEdictFieldValue(sv_player, "ammo_nails1");
@@ -1072,8 +1069,8 @@
{
sv_player->v.ammo_nails = v;
}
- break;
- case 'l':
+ break;
+ case 'l':
if (rogue)
{
val = GetEdictFieldValue(sv_player, "ammo_lava_nails");
@@ -1084,8 +1081,8 @@
sv_player->v.ammo_nails = v;
}
}
- break;
- case 'r':
+ break;
+ case 'r':
if (rogue)
{
val = GetEdictFieldValue(sv_player, "ammo_rockets1");
@@ -1100,8 +1097,8 @@
{
sv_player->v.ammo_rockets = v;
}
- break;
- case 'm':
+ break;
+ case 'm':
if (rogue)
{
val = GetEdictFieldValue(sv_player, "ammo_multi_rockets");
@@ -1112,11 +1109,11 @@
sv_player->v.ammo_rockets = v;
}
}
- break;
- case 'h':
- sv_player->v.health = v;
- break;
- case 'c':
+ break;
+ case 'h':
+ sv_player->v.health = v;
+ break;
+ case 'c':
if (rogue)
{
val = GetEdictFieldValue(sv_player, "ammo_cells1");
@@ -1131,8 +1128,8 @@
{
sv_player->v.ammo_cells = v;
}
- break;
- case 'p':
+ break;
+ case 'p':
if (rogue)
{
val = GetEdictFieldValue(sv_player, "ammo_plasma");
@@ -1143,8 +1140,8 @@
sv_player->v.ammo_cells = v;
}
}
- break;
- }
+ break;
+ }
}
edict_t *FindViewthing (void)
@@ -1151,7 +1148,7 @@
{
int i;
edict_t *e;
-
+
for (i=0 ; i<sv.num_edicts ; i++)
{
e = EDICT_NUM(i);
@@ -1182,7 +1179,7 @@
Con_Printf ("Can't load %s\n", Cmd_Argv(1));
return;
}
-
+
e->v.frame = 0;
cl.model_precache[(int)e->v.modelindex] = m;
}
@@ -1207,7 +1204,7 @@
if (f >= m->numframes)
f = m->numframes-1;
- e->v.frame = f;
+ e->v.frame = f;
}
@@ -1220,7 +1217,7 @@
if (!hdr)
return;
pframedesc = &hdr->frames[frame];
-
+
Con_Printf ("frame %d: %s\n", frame, pframedesc->name);
}
@@ -1233,7 +1230,7 @@
{
edict_t *e;
model_t *m;
-
+
e = FindViewthing ();
if (!e)
return;
@@ -1243,7 +1240,7 @@
if (e->v.frame >= m->numframes)
e->v.frame = m->numframes - 1;
- PrintFrameName (m, e->v.frame);
+ PrintFrameName (m, e->v.frame);
}
/*
@@ -1266,7 +1263,7 @@
if (e->v.frame < 0)
e->v.frame = 0;
- PrintFrameName (m, e->v.frame);
+ PrintFrameName (m, e->v.frame);
}
/*
--- a/keys.c
+++ b/keys.c
@@ -47,7 +47,7 @@
{"ALT", K_ALT},
{"CTRL", K_CTRL},
{"SHIFT", K_SHIFT},
-
+
{"F1", K_F1},
{"F2", K_F2},
{"F3", K_F3},
@@ -139,7 +139,7 @@
void Key_Console (int key)
{
char *cmd;
-
+
if (key == K_ENTER)
{
Cbuf_AddText (key_lines[edit_line]+1); // skip the >
@@ -170,7 +170,7 @@
return;
}
}
-
+
if (key == K_BACKSPACE || key == K_LEFTARROW)
{
if (key_linepos > 1)
@@ -241,10 +241,10 @@
con_backscroll = 0;
return;
}
-
+
if (key < 32 || key > 127)
return; // non printable
-
+
if (key_linepos < MAXCMDLINE-1)
{
key_lines[edit_line][key_linepos] = key;
@@ -313,7 +313,7 @@
Key_StringToKeynum(char *s)
{
keyname_t *k;
-
+
if(s == nil || s[0] == 0)
return -1;
if(s[1] == 0)
@@ -336,9 +336,9 @@
*/
char *Key_KeynumToString (int keynum)
{
- keyname_t *kn;
+ keyname_t *kn;
static char tinystr[2];
-
+
if (keynum == -1)
return "<KEY NOT FOUND>";
if (keynum > 32 && keynum < 127)
@@ -347,7 +347,7 @@
tinystr[1] = 0;
return tinystr;
}
-
+
for (kn=keynames ; kn->name ; kn++)
if (keynum == kn->keynum)
return kn->name;
@@ -365,23 +365,23 @@
{
char *new;
int l;
-
+
if (keynum == -1)
return;
-// free old bindings
+ // free old bindings
if (keybindings[keynum])
{
Z_Free (keybindings[keynum]);
keybindings[keynum] = nil;
}
-
-// allocate memory for new binding
- l = strlen(binding);
+
+ // allocate memory for new binding
+ l = strlen(binding);
new = Z_Malloc (l+1);
strcpy(new, binding);
new[l] = 0;
- keybindings[keynum] = new;
+ keybindings[keynum] = new;
}
/*
@@ -398,7 +398,7 @@
Con_Printf ("unbind <key> : remove commands from a key\n");
return;
}
-
+
b = Key_StringToKeynum (Cmd_Argv(1));
if (b==-1)
{
@@ -412,7 +412,7 @@
void Key_Unbindall_f (void)
{
int i;
-
+
for (i=0 ; i<256 ; i++)
if (keybindings[i])
Key_SetBinding (i, "");
@@ -428,7 +428,7 @@
{
int i, c, b;
char cmd[1024];
-
+
c = Cmd_Argc();
if (c != 2 && c != 3)
@@ -451,8 +451,8 @@
Con_Printf ("\"%s\" is not bound\n", Cmd_Argv(1) );
return;
}
-
-// copy the rest of the command line
+
+ // copy the rest of the command line
cmd[0] = 0; // start out with a null string
for (i=2 ; i< c ; i++)
{
@@ -479,10 +479,8 @@
key_lines[i][1] = 0;
}
key_linepos = 1;
-
-//
-// init ascii characters in console mode
-//
+
+ // init ascii characters in console mode
for (i=32 ; i<128 ; i++)
consolekeys[i] = true;
consolekeys[K_ENTER] = true;
@@ -530,9 +528,7 @@
for (i=0 ; i<12 ; i++)
menubound[K_F1+i] = true;
-//
-// register our functions
-//
+ // register our functions
Cmd_AddCommand ("bind",Key_Bind_f);
Cmd_AddCommand ("unbind",Key_Unbind_f);
Cmd_AddCommand ("unbindall",Key_Unbindall_f);
@@ -561,7 +557,7 @@
if (key_count <= 0)
return;
-// update auto-repeat status
+ // update auto-repeat status
if (down)
{
if(key != K_MWHEELUP && key != K_MWHEELDOWN)
@@ -579,9 +575,7 @@
if (key == K_SHIFT)
shift_down = down;
-//
-// handle escape specialy, so the user can never unbind it
-//
+ // handle escape specialy, so the user can never unbind it
if (key == K_ESCAPE)
{
if (!down)
@@ -604,13 +598,11 @@
return;
}
-//
-// key up events only generate commands if the game key binding is
-// a button command (leading + sign). These will occur even in console mode,
-// to keep the character from continuing an action started before a console
-// switch. Button commands include the kenum as a parameter, so multiple
-// downs can be matched with ups
-//
+ // key up events only generate commands if the game key binding is
+ // a button command (leading + sign). These will occur even in console mode,
+ // to keep the character from continuing an action started before a console
+ // switch. Button commands include the kenum as a parameter, so multiple
+ // downs can be matched with ups
if (!down)
{
kb = keybindings[key];
@@ -631,9 +623,7 @@
return;
}
-//
-// during demo playback, most keys bring up the main menu
-//
+ // during demo playback, most keys bring up the main menu
if (cls.demoplayback && down && consolekeys[key] && key_dest == key_game)
{
M_ToggleMenu_f ();
@@ -640,9 +630,7 @@
return;
}
-//
-// if not a consolekey, send to the interpreter no matter what mode is
-//
+ // if not a consolekey, send to the interpreter no matter what mode is
if ( (key_dest == key_menu && menubound[key])
|| (key_dest == key_console && !consolekeys[key])
|| (key_dest == key_game && ( !con_forcedup || !consolekeys[key] ) ) )
--- a/mathlib.c
+++ b/mathlib.c
@@ -134,41 +134,41 @@
{
float dist1, dist2;
int sides;
-
-// 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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];
+ 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
@@ -183,8 +183,8 @@
sides |= 2;
#ifdef PARANOID
-if (sides == 0)
- fatal ("BoxOnPlaneSide: sides==0");
+ if (sides == 0)
+ fatal ("BoxOnPlaneSide: sides==0");
#endif
return sides;
@@ -220,11 +220,11 @@
int VectorCompare (vec3_t v1, vec3_t v2)
{
int i;
-
+
for (i=0 ; i<3 ; i++)
if (v1[i] != v2[i])
return 0;
-
+
return 1;
}
@@ -267,7 +267,7 @@
{
int i;
float length;
-
+
length = 0;
for (i=0 ; i< 3 ; i++)
length += v[i]*v[i];
@@ -290,7 +290,7 @@
v[1] *= ilength;
v[2] *= ilength;
}
-
+
return length;
}
@@ -316,24 +316,15 @@
*/
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];
- out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
- in1[0][2] * in2[2][1];
- out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
- in1[0][2] * in2[2][2];
- out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
- in1[1][2] * in2[2][0];
- out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
- in1[1][2] * in2[2][1];
- out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
- in1[1][2] * in2[2][2];
- out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
- in1[2][2] * in2[2][0];
- out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
- in1[2][2] * in2[2][1];
- out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
- in1[2][2] * in2[2][2];
+ out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0];
+ out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1];
+ out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2];
+ out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0];
+ out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1];
+ out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2];
+ out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0];
+ out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1];
+ out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2];
}
@@ -344,30 +335,18 @@
*/
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];
- out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] +
- in1[0][2] * in2[2][1];
- out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] +
- in1[0][2] * in2[2][2];
- out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] +
- in1[0][2] * in2[2][3] + in1[0][3];
- out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] +
- in1[1][2] * in2[2][0];
- out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] +
- in1[1][2] * in2[2][1];
- out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] +
- in1[1][2] * in2[2][2];
- out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] +
- in1[1][2] * in2[2][3] + in1[1][3];
- out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] +
- in1[2][2] * in2[2][0];
- out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] +
- in1[2][2] * in2[2][1];
- out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] +
- in1[2][2] * in2[2][2];
- out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] +
- in1[2][2] * in2[2][3] + in1[2][3];
+ out[0][0] = in1[0][0] * in2[0][0] + in1[0][1] * in2[1][0] + in1[0][2] * in2[2][0];
+ out[0][1] = in1[0][0] * in2[0][1] + in1[0][1] * in2[1][1] + in1[0][2] * in2[2][1];
+ out[0][2] = in1[0][0] * in2[0][2] + in1[0][1] * in2[1][2] + in1[0][2] * in2[2][2];
+ out[0][3] = in1[0][0] * in2[0][3] + in1[0][1] * in2[1][3] + in1[0][2] * in2[2][3] + in1[0][3];
+ out[1][0] = in1[1][0] * in2[0][0] + in1[1][1] * in2[1][0] + in1[1][2] * in2[2][0];
+ out[1][1] = in1[1][0] * in2[0][1] + in1[1][1] * in2[1][1] + in1[1][2] * in2[2][1];
+ out[1][2] = in1[1][0] * in2[0][2] + in1[1][1] * in2[1][2] + in1[1][2] * in2[2][2];
+ out[1][3] = in1[1][0] * in2[0][3] + in1[1][1] * in2[1][3] + in1[1][2] * in2[2][3] + in1[1][3];
+ out[2][0] = in1[2][0] * in2[0][0] + in1[2][1] * in2[1][0] + in1[2][2] * in2[2][0];
+ out[2][1] = in1[2][0] * in2[0][1] + in1[2][1] * in2[1][1] + in1[2][2] * in2[2][1];
+ out[2][2] = in1[2][0] * in2[0][2] + in1[2][1] * in2[1][2] + in1[2][2] * in2[2][2];
+ out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3];
}
@@ -403,9 +382,7 @@
}
else
{
- //
- // perform operations with positive values, and fix mod to make floor-based
- //
+ // perform operations with positive values, and fix mod to make floor-based
x = floor(-numer / denom);
q = -(int)x;
r = (int)floor(-numer - (x * denom));
@@ -442,7 +419,6 @@
}
}
-
// TODO: move to nonintel.c
/*
@@ -456,7 +432,7 @@
fixed16_t Invert24To16(fixed16_t val)
{
if (val < 256)
- return (0xFFFFFFFF);
+ return 0xFFFFFFFF;
return (fixed16_t)
(((double)0x10000 * (double)0x1000000 / (double)val) + 0.5);
--- a/menu.c
+++ b/menu.c
@@ -425,7 +425,7 @@
for (i=0 ; i< Nsav; i++)
M_Print (16, 32 + 8*i, savs[i]);
-// line cursor
+ // line cursor
M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
}
@@ -441,7 +441,7 @@
for (i=0 ; i<Nsav ; i++)
M_Print (16, 32 + 8*i, savs[i]);
-// line cursor
+ // line cursor
M_DrawCharacter (8, 32 + load_cursor*8, 12+((int)(realtime*4)&1));
}
@@ -461,11 +461,11 @@
m_state = m_none;
key_dest = key_game;
- // Host_Loadgame_f can't bring up the loading plaque because too much
- // stack space has been used, so do it now
+ // Host_Loadgame_f can't bring up the loading plaque because too much
+ // stack space has been used, so do it now
SCR_BeginLoadingPlaque ();
- // issue the load command
+ // issue the load command
Cbuf_AddText (va ("load s%d\n", load_cursor) );
return;
@@ -1050,7 +1050,7 @@
M_Print (16, 120, " Lookstrafe");
M_DrawCheckbox (220, 120, lookstrafe.value);
-// cursor
+ // cursor
M_DrawCharacter (200, 32 + options_cursor*8, 12+((int)(realtime*4)&1));
}
@@ -1119,24 +1119,24 @@
char *bindnames[][2] =
{
-{"+attack", "attack"},
-{"impulse 10", "change weapon"},
-{"+jump", "jump / swim up"},
-{"+forward", "walk forward"},
-{"+back", "backpedal"},
-{"+left", "turn left"},
-{"+right", "turn right"},
-{"+speed", "run"},
-{"+moveleft", "step left"},
-{"+moveright", "step right"},
-{"+strafe", "sidestep"},
-{"+lookup", "look up"},
-{"+lookdown", "look down"},
-{"centerview", "center view"},
-{"+mlook", "mouse look"},
-{"+klook", "keyboard look"},
-{"+moveup", "swim up"},
-{"+movedown", "swim down"}
+ {"+attack", "attack"},
+ {"impulse 10", "change weapon"},
+ {"+jump", "jump / swim up"},
+ {"+forward", "walk forward"},
+ {"+back", "backpedal"},
+ {"+left", "turn left"},
+ {"+right", "turn right"},
+ {"+speed", "run"},
+ {"+moveleft", "step left"},
+ {"+moveright", "step right"},
+ {"+strafe", "sidestep"},
+ {"+lookup", "look up"},
+ {"+lookdown", "look down"},
+ {"centerview", "center view"},
+ {"+mlook", "mouse look"},
+ {"+klook", "keyboard look"},
+ {"+moveup", "swim up"},
+ {"+movedown", "swim down"}
};
int keys_cursor;
@@ -1211,7 +1211,7 @@
else
M_Print (18, 32, "Enter to change, backspace to clear");
-// search for known bindings
+ // search for known bindings
for (i=0 ; i<nelem(bindnames) ; i++)
{
y = 48 + 8*i;
@@ -1355,7 +1355,7 @@
int m_quit_prevstate;
qboolean wasInMenus;
-char *quitMessage [] =
+char *quitMessage [] =
{
/* .........1.........2.... */
" Are you gonna quit ",
@@ -1362,7 +1362,7 @@
" this game just like ",
" everything else? ",
" ",
-
+
" Milord, methinks that ",
" thou art a lowly ",
" quitter. Is this true? ",
@@ -1377,22 +1377,22 @@
" for trying to quit! ",
" Press Y to get ",
" smacked out. ",
-
+
" Press Y to quit like a ",
" big loser in life. ",
" Press N to stay proud ",
" and successful! ",
-
+
" If you press Y to ",
" quit, I will summon ",
" Satan all over your ",
" hard drive! ",
-
+
" Um, Asmodeus dislikes ",
" his children trying to ",
" quit. Press Y to return",
" to your Tinkertoys. ",
-
+
" If you quit now, I'll ",
" throw a blanket-party ",
" for you next time! ",
@@ -1687,31 +1687,31 @@
};
//MED 01/06/97 added hipnotic levels
-level_t hipnoticlevels[] =
+level_t hipnoticlevels[] =
{
- {"start", "Command HQ"}, // 0
+ {"start", "Command HQ"}, // 0
- {"hip1m1", "The Pumping Station"}, // 1
- {"hip1m2", "Storage Facility"},
- {"hip1m3", "The Lost Mine"},
- {"hip1m4", "Research Facility"},
- {"hip1m5", "Military Complex"},
+ {"hip1m1", "The Pumping Station"}, // 1
+ {"hip1m2", "Storage Facility"},
+ {"hip1m3", "The Lost Mine"},
+ {"hip1m4", "Research Facility"},
+ {"hip1m5", "Military Complex"},
- {"hip2m1", "Ancient Realms"}, // 6
- {"hip2m2", "The Black Cathedral"},
- {"hip2m3", "The Catacombs"},
- {"hip2m4", "The Crypt"},
- {"hip2m5", "Mortum's Keep"},
- {"hip2m6", "The Gremlin's Domain"},
+ {"hip2m1", "Ancient Realms"}, // 6
+ {"hip2m2", "The Black Cathedral"},
+ {"hip2m3", "The Catacombs"},
+ {"hip2m4", "The Crypt"},
+ {"hip2m5", "Mortum's Keep"},
+ {"hip2m6", "The Gremlin's Domain"},
- {"hip3m1", "Tur Torment"}, // 12
- {"hip3m2", "Pandemonium"},
- {"hip3m3", "Limbo"},
- {"hip3m4", "The Gauntlet"},
+ {"hip3m1", "Tur Torment"}, // 12
+ {"hip3m2", "Pandemonium"},
+ {"hip3m3", "Limbo"},
+ {"hip3m4", "The Gauntlet"},
- {"hipend", "Armagon's Lair"}, // 16
+ {"hipend", "Armagon's Lair"}, // 16
- {"hipdm1", "The Edge of Oblivion"} // 17
+ {"hipdm1", "The Edge of Oblivion"} // 17
};
//PGM 01/07/97 added rogue levels
@@ -1758,12 +1758,12 @@
//MED 01/06/97 added hipnotic episodes
episode_t hipnoticepisodes[] =
{
- {"Scourge of Armagon", 0, 1},
- {"Fortress of the Dead", 1, 5},
- {"Dominion of Darkness", 6, 6},
- {"The Rift", 12, 4},
- {"Final Level", 16, 1},
- {"Deathmatch Arena", 17, 1}
+ {"Scourge of Armagon", 0, 1},
+ {"Fortress of the Dead", 1, 5},
+ {"Dominion of Darkness", 6, 6},
+ {"The Rift", 12, 4},
+ {"Final Level", 16, 1},
+ {"Deathmatch Arena", 17, 1}
};
//PGM 01/07/97 added rogue episodes
@@ -1872,35 +1872,35 @@
M_Print (160, 96, va("%d minutes", (int)timelimit.value));
M_Print (0, 112, " Episode");
- //MED 01/06/97 added hipnotic episodes
- if (hipnotic)
- M_Print (160, 112, hipnoticepisodes[startepisode].description);
- //PGM 01/07/97 added rogue episodes
- else if (rogue)
- M_Print (160, 112, rogueepisodes[startepisode].description);
- else
- M_Print (160, 112, episodes[startepisode].description);
+ //MED 01/06/97 added hipnotic episodes
+ if (hipnotic)
+ M_Print (160, 112, hipnoticepisodes[startepisode].description);
+ //PGM 01/07/97 added rogue episodes
+ else if (rogue)
+ M_Print (160, 112, rogueepisodes[startepisode].description);
+ else
+ M_Print (160, 112, episodes[startepisode].description);
M_Print (0, 120, " Level");
- //MED 01/06/97 added hipnotic episodes
- if (hipnotic)
- {
- M_Print (160, 120, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].description);
- M_Print (160, 128, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name);
- }
- //PGM 01/07/97 added rogue episodes
- else if (rogue)
- {
- M_Print (160, 120, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].description);
- M_Print (160, 128, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name);
- }
- else
- {
- M_Print (160, 120, levels[episodes[startepisode].firstLevel + startlevel].description);
- M_Print (160, 128, levels[episodes[startepisode].firstLevel + startlevel].name);
- }
+ //MED 01/06/97 added hipnotic episodes
+ if (hipnotic)
+ {
+ M_Print (160, 120, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].description);
+ M_Print (160, 128, hipnoticlevels[hipnoticepisodes[startepisode].firstLevel + startlevel].name);
+ }
+ //PGM 01/07/97 added rogue episodes
+ else if (rogue)
+ {
+ M_Print (160, 120, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].description);
+ M_Print (160, 128, roguelevels[rogueepisodes[startepisode].firstLevel + startlevel].name);
+ }
+ else
+ {
+ M_Print (160, 120, levels[episodes[startepisode].firstLevel + startlevel].description);
+ M_Print (160, 128, levels[episodes[startepisode].firstLevel + startlevel].name);
+ }
-// line cursor
+ // line cursor
M_DrawCharacter (144, gameoptions_cursor_table[gameoptions_cursor], 12+((int)(realtime*4)&1));
if (m_serverInfoMessage)
@@ -1984,11 +1984,11 @@
case 7:
startepisode += dir;
- //MED 01/06/97 added hipnotic count
+ //MED 01/06/97 added hipnotic count
if (hipnotic)
count = 6;
- //PGM 01/07/97 added rogue count
- //PGM 03/02/97 added 1 for dmatch episode
+ //PGM 01/07/97 added rogue count
+ //PGM 03/02/97 added 1 for dmatch episode
else if (rogue)
count = 4;
else if (registered.value)
@@ -2007,10 +2007,10 @@
case 8:
startlevel += dir;
- //MED 01/06/97 added hipnotic episodes
+ //MED 01/06/97 added hipnotic episodes
if (hipnotic)
count = hipnoticepisodes[startepisode].levels;
- //PGM 01/06/97 added hipnotic episodes
+ //PGM 01/06/97 added hipnotic episodes
else if (rogue)
count = rogueepisodes[startepisode].levels;
else
--- a/model.c
+++ b/model.c
@@ -33,7 +33,7 @@
void *Mod_Extradata (model_t *mod)
{
void *r;
-
+
r = Cache_Check (&mod->cache);
if (r)
return r;
@@ -55,21 +55,17 @@
mnode_t *node;
float d;
mplane_t *plane;
-
- if (!model || !model->nodes)
+
+ if(!model || !model->nodes)
Host_Error("Mod_PointInLeaf: bad model");
node = model->nodes;
- while (1)
- {
+ while(1){
if (node->contents < 0)
return (mleaf_t *)node;
plane = node->plane;
- d = DotProduct (p,plane->normal) - plane->dist;
- if (d > 0)
- node = node->children[0];
- else
- node = node->children[1];
+ d = DotProduct(p, plane->normal) - plane->dist;
+ node = node->children[d <= 0];
}
}
@@ -97,7 +93,7 @@
if(!in){ // no vis info, so make all visible
memset(out, 0xff, row);
- return decompressed;
+ return decompressed;
}
do{
@@ -113,7 +109,7 @@
c--;
}
}while(out - decompressed < row);
-
+
return decompressed;
}
@@ -149,8 +145,9 @@
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++) {
mod->needload = NL_UNREFERENCED;
-//FIX FOR CACHE_ALLOC ERRORS:
- if (mod->type == mod_sprite) mod->cache.data = nil;
+ //FIX FOR CACHE_ALLOC ERRORS:
+ if (mod->type == mod_sprite)
+ mod->cache.data = nil;
}
}
@@ -168,10 +165,8 @@
if (!name[0])
Host_Error("Mod_FindName: nil name");
-
-//
-// search the currently loaded models
-//
+
+ // search the currently loaded models
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{
if(strcmp(mod->name, name) == 0)
@@ -180,7 +175,7 @@
if (!avail || mod->type != mod_alias)
avail = mod;
}
-
+
if (i == mod_numknown)
{
if (mod_numknown == MAX_MOD_KNOWN)
@@ -213,9 +208,9 @@
void Mod_TouchModel (char *name)
{
model_t *mod;
-
+
mod = Mod_FindName (name);
-
+
if (mod->needload == NL_PRESENT)
{
if (mod->type == mod_alias)
@@ -250,10 +245,7 @@
}
}
-//
-// because the world is so huge, load it one piece at a time
-//
-
+ // because the world is so huge, load it one piece at a time
buf = loadstklmp(mod->name, stackbuf, sizeof stackbuf, nil);
if(buf == nil){
if(crash)
@@ -261,17 +253,13 @@
return nil;
}
-//
-// allocate a new model
-//
+ // allocate a new model
radix(mod->name, loadname);
loadmodel = mod;
-//
-// fill it in
-//
+ // fill it in
-// call the apropriate loader
+ // call the apropriate loader
mod->needload = NL_PRESENT;
switch (LittleLong(*(unsigned *)buf))
@@ -279,11 +267,11 @@
case IDPOLYHEADER:
Mod_LoadAliasModel (mod, buf);
break;
-
+
case IDSPRITEHEADER:
Mod_LoadSpriteModel (mod, buf);
break;
-
+
default:
Mod_LoadBrushModel (mod, buf);
break;
@@ -340,9 +328,9 @@
return;
}
m = (dmiptexlump_t *)(mod_base + l->fileofs);
-
+
m->nummiptex = LittleLong (m->nummiptex);
-
+
loadmodel->numtextures = m->nummiptex;
loadmodel->textures = Hunk_Alloc(m->nummiptex * sizeof *loadmodel->textures);
@@ -356,7 +344,7 @@
mt->height = LittleLong (mt->height);
for (j=0 ; j<MIPLEVELS ; j++)
mt->offsets[j] = LittleLong (mt->offsets[j]);
-
+
if ( (mt->width & 15) || (mt->height & 15) )
Con_DPrintf("Texture %s is not 16 aligned", mt->name);
pixels = mt->width*mt->height/64*85;
@@ -370,14 +358,12 @@
tx->offsets[j] = mt->offsets[j] + sizeof(texture_t) - sizeof(miptex_t);
// the pixels immediately follow the structures
memcpy(tx+1, mt+1, pixels);
-
- if(strncmp(mt->name, "sky", 3) == 0)
+
+ if(strncmp(mt->name, "sky", 3) == 0)
R_InitSky (tx);
}
-//
-// sequence the animations
-//
+ // sequence the animations
for (i=0 ; i<m->nummiptex ; i++)
{
tx = loadmodel->textures[i];
@@ -386,7 +372,7 @@
if (tx->anim_next)
continue; // allready sequenced
- // find the number of frames in the animation
+ // find the number of frames in the animation
memset(anims, 0, sizeof anims);
memset(altanims, 0, sizeof altanims);
@@ -439,9 +425,9 @@
else
Host_Error("Bad animating texture %s", tx->name);
}
-
+
#define ANIM_CYCLE 2
- // link them all together
+ // link them all together
for (j=0 ; j<max ; j++)
{
tx2 = anims[j];
@@ -660,7 +646,7 @@
miptex = LittleLong (in->miptex);
out->flags = LittleLong (in->flags);
-
+
if (!loadmodel->textures)
{
out->texture = r_notexture_mip; // checkerboard texture
@@ -706,10 +692,10 @@
v = &loadmodel->vertexes[loadmodel->edges[e].v[0]];
else
v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]];
-
+
for (j=0 ; j<2 ; j++)
{
- val = (double)v->position[0] * (double)tex->vecs[j][0] +
+ val = (double)v->position[0] * (double)tex->vecs[j][0] +
(double)v->position[1] * (double)tex->vecs[j][1] +
(double)v->position[2] * (double)tex->vecs[j][2] +
(double)tex->vecs[j][3];
@@ -721,7 +707,7 @@
}
for (i=0 ; i<2 ; i++)
- {
+ {
bmins[i] = floor(mins[i]/16.0);
bmaxs[i] = ceil(maxs[i]/16.0);
@@ -769,13 +755,13 @@
CalcSurfaceExtents (out);
- // lighting info
+ // lighting info
memmove(out->styles, in, MAXLIGHTMAPS);
in += MAXLIGHTMAPS;
out->samples = (i = le32(in)) < 0 ? nil : loadmodel->lightdata + i;
- // set the drawing flags flag
+ // set the drawing flags flag
if(strncmp(out->texinfo->texture->name, "sky", 3) == 0)
out->flags |= SURF_DRAWSKY | SURF_DRAWTILED;
@@ -901,7 +887,7 @@
memmove(out->ambient_sound_level, in, 4);
in += 4;
- }
+ }
}
/*
@@ -975,9 +961,9 @@
mclipnode_t *out;
int i, j, count;
hull_t *hull;
-
- hull = &loadmodel->hulls[0];
-
+
+ hull = &loadmodel->hulls[0];
+
in = loadmodel->nodes;
count = loadmodel->numnodes;
out = Hunk_Alloc(count * sizeof *out);
@@ -1007,7 +993,7 @@
=================
*/
void Mod_LoadMarksurfaces (lump_t *l, int ver)
-{
+{
int i, j, count, sz;
byte *in;
msurface_t **out;
@@ -1037,10 +1023,10 @@
=================
*/
void Mod_LoadSurfedges (lump_t *l)
-{
+{
int i, count;
int *in, *out;
-
+
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_LoadSurfedges: funny lump size in %s", loadmodel->name);
@@ -1066,7 +1052,7 @@
dplane_t *in;
int count;
int bits;
-
+
in = (void *)(mod_base + l->fileofs);
if (l->filelen % sizeof(*in))
Host_Error("Mod_LoadPlanes: funny lump size in %s", loadmodel->name);
@@ -1120,9 +1106,9 @@
int i, j, ver;
dheader_t *header;
dmodel_t *bm;
-
+
loadmodel->type = mod_brush;
-
+
header = (dheader_t *)buffer;
ver = LittleLong (header->version);
@@ -1129,14 +1115,14 @@
if (ver != BSPVERSION && ver != BSP2VERSION)
Host_Error("Mod_LoadBrushModel: %s has wrong version number (%ux should be %ux or %ux)", mod->name, ver, BSPVERSION, BSP2VERSION);
-// swap all the lumps
+ // swap all the lumps
mod_base = (byte *)header;
for (i=0 ; i<(int)sizeof(dheader_t)/4 ; i++)
((int *)header)[i] = LittleLong ( ((int *)header)[i]);
-// load into heap
-
+ // load into heap
+
Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]);
Mod_LoadEdges (&header->lumps[LUMP_EDGES], ver);
Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]);
@@ -1154,13 +1140,11 @@
Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]);
Mod_MakeHull0 ();
-
+
mod->numframes = 2; // regular and alternate animation
mod->flags = 0;
-
-//
-// set up the submodels (FIXME: this is confusing)
-//
+
+ // set up the submodels (FIXME: this is confusing)
for (i=0 ; i<mod->numsubmodels ; i++)
{
bm = &mod->submodels[i];
@@ -1171,7 +1155,7 @@
mod->hulls[j].firstclipnode = bm->headnode[j];
mod->hulls[j].lastclipnode = mod->numclipnodes-1;
}
-
+
mod->firstmodelsurface = bm->firstface;
mod->nummodelsurfaces = bm->numfaces;
mod->blend = false;
@@ -1185,7 +1169,7 @@
VectorCopy (bm->maxs, mod->maxs);
VectorCopy (bm->mins, mod->mins);
mod->radius = RadiusFromBounds (mod->mins, mod->maxs);
-
+
mod->numleafs = bm->visleafs;
if (i < mod->numsubmodels-1)
@@ -1227,8 +1211,8 @@
for (i=0 ; i<3 ; i++)
{
- // these are byte values, so we don't have to worry about
- // endianness
+ // these are byte values, so we don't have to worry about
+ // endianness
pbboxmin->v[i] = pdaliasframe->bboxmin.v[i];
pbboxmax->v[i] = pdaliasframe->bboxmax.v[i];
}
@@ -1241,7 +1225,7 @@
{
int k;
- // these are all byte values, so no need to deal with endianness
+ // these are all byte values, so no need to deal with endianness
pframe[j].lightnormalindex = pinframe[j].lightnormalindex;
for (k=0 ; k<3 ; k++)
@@ -1270,7 +1254,7 @@
daliasinterval_t *pin_intervals;
float *poutintervals;
void *ptemp;
-
+
pingroup = (daliasgroup_t *)pin;
numframes = LittleLong (pingroup->numframes);
@@ -1283,7 +1267,7 @@
for (i=0 ; i<3 ; i++)
{
- // these are byte values, so we don't have to worry about endianness
+ // these are byte values, so we don't have to worry about endianness
pbboxmin->v[i] = pingroup->bboxmin.v[i];
pbboxmax->v[i] = pingroup->bboxmax.v[i];
}
@@ -1411,10 +1395,8 @@
Host_Error("%s has wrong version number (%d should be %d)",
mod->name, version, ALIAS_VERSION);
-//
-// allocate space for a working header, plus all the data except the frames,
-// skin and group info
-//
+ // allocate space for a working header, plus all the data except the frames,
+ // skin and group info
size = sizeof (aliashdr_t) + (LittleLong (pinmodel->numframes) - 1) *
sizeof (pheader->frames[0]) +
sizeof (mdl_t) +
@@ -1430,9 +1412,7 @@
// mod->cache.data = pheader;
mod->flags = LittleLong (pinmodel->flags);
-//
-// endian-adjust and copy the data, starting with the alias model header
-//
+ // endian-adjust and copy the data, starting with the alias model header
pmodel->boundingradius = LittleFloat (pinmodel->boundingradius);
pmodel->numskins = LittleLong (pinmodel->numskins);
pmodel->skinwidth = LittleLong (pinmodel->skinwidth);
@@ -1473,9 +1453,7 @@
if (pmodel->skinwidth & 0x03)
Host_Error("Mod_LoadAliasModel: skinwidth not multiple of 4");
-//
-// load the skins
-//
+ // load the skins
skinsize = pmodel->skinheight * pmodel->skinwidth;
if (numskins < 1)
@@ -1509,9 +1487,7 @@
}
}
-//
-// set base s and t vertices
-//
+ // set base s and t vertices
pstverts = (stvert_t *)&pmodel[1];
pinstverts = (stvert_t *)pskintype;
@@ -1525,9 +1501,7 @@
pstverts[i].t = LittleLong (pinstverts[i].t) << 16;
}
-//
-// set up the triangles
-//
+ // set up the triangles
ptri = (mtriangle_t *)&pstverts[pmodel->numverts];
pintriangles = (dtriangle_t *)&pinstverts[pmodel->numverts];
@@ -1546,9 +1520,7 @@
}
}
-//
-// load the frames
-//
+ // load the frames
if (numframes < 1)
Host_Error("Mod_LoadAliasModel: Invalid # of frames: %d\n", numframes);
@@ -1585,13 +1557,11 @@
mod->type = mod_alias;
-// FIXME: do this right
+ // FIXME: do this right
mod->mins[0] = mod->mins[1] = mod->mins[2] = -16;
mod->maxs[0] = mod->maxs[1] = mod->maxs[2] = 16;
-//
-// move the complete, relocatable alias model to the cache
-//
+ // move the complete, relocatable alias model to the cache
Hunk_CacheFrom(&mod->cache, pheader);
}
@@ -1695,7 +1665,7 @@
int numframes;
int size;
dspriteframetype_t *pframetype;
-
+
pin = (dsprite_t *)buffer;
version = LittleLong (pin->version);
@@ -1722,10 +1692,8 @@
mod->maxs[0] = mod->maxs[1] = psprite->maxwidth/2;
mod->mins[2] = -psprite->maxheight/2;
mod->maxs[2] = psprite->maxheight/2;
-
-//
-// load the frames
-//
+
+ // load the frames
if (numframes < 1)
Host_Error("Mod_LoadSpriteModel: Invalid # of frames: %d\n", numframes);
--- a/model.h
+++ b/model.h
@@ -111,7 +111,7 @@
// common with leaf
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
-
+
float minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
@@ -118,7 +118,7 @@
// node specific
mplane_t *plane;
- struct mnode_s *children[2];
+ struct mnode_s *children[2];
unsigned int firstsurface;
unsigned int numsurfaces;
@@ -293,12 +293,12 @@
modtype_t type;
int numframes;
synctype_t synctype;
-
+
int flags;
//
// volume occupied by the model
-//
+//
vec3_t mins, maxs;
float radius;
--- a/net.h
+++ b/net.h
@@ -61,7 +61,7 @@
qboolean canSend;
qboolean sendNext;
qboolean local;
-
+
int driver;
int landriver;
int socket;
--- a/net_dgrm.c
+++ b/net_dgrm.c
@@ -347,9 +347,7 @@
{
int i;
-//
-// shutdown the lan drivers
-//
+ // shutdown the lan drivers
for (i = 0; i < net_numlandrivers; i++)
{
if (landrv[i].initialized)
@@ -416,7 +414,7 @@
int activeNumber;
int clientNumber;
client_t *client;
-
+
playerNumber = MSG_ReadByte();
activeNumber = -1;
for (clientNumber = 0, client = svs.clients; clientNumber < svs.maxclients; clientNumber++, client++)
@@ -557,7 +555,7 @@
// allocate a network socket
newsock = 1;
- // everything is allocated, just fill in the details
+ // everything is allocated, just fill in the details
sock->socket = newsock;
sock->landriver = net_landriverlevel;
memcpy(&sock->addr, &clientaddr, sizeof clientaddr);
--- a/net_loop.c
+++ b/net_loop.c
@@ -25,7 +25,7 @@
{
if(strcmp(host, "local") != 0)
return nil;
-
+
localconnectpending = true;
if (!loop_client)
@@ -59,7 +59,7 @@
loop_client->driverdata = (void *)loop_server;
loop_server->driverdata = (void *)loop_client;
- return loop_client;
+ return loop_client;
}
--- a/net_main.c
+++ b/net_main.c
@@ -243,7 +243,7 @@
if (ret)
return ret;
}
-
+
return nil;
}
@@ -362,7 +362,7 @@
int NET_SendMessage (qsocket_t *sock, sizebuf_t *data)
{
int r;
-
+
if (!sock)
return -1;
@@ -384,7 +384,7 @@
int NET_SendUnreliableMessage (qsocket_t *sock, sizebuf_t *data)
{
int r;
-
+
if (!sock)
return -1;
@@ -398,7 +398,7 @@
r = sfunc.SendUnreliableMessage(sock, data);
if (r == 1 && sock->driver)
unreliableMessagesSent++;
-
+
return r;
}
@@ -414,7 +414,7 @@
qboolean NET_CanSendMessage (qsocket_t *sock)
{
int r;
-
+
if (!sock)
return false;
@@ -562,9 +562,7 @@
for (sock = net_activeSockets; sock; sock = sock->next)
NET_Close(sock);
-//
-// shutdown the drivers
-//
+ // shutdown the drivers
for (net_driverlevel = 0; net_driverlevel < net_numdrivers; net_driverlevel++)
{
if (netdrv[net_driverlevel].initialized == true)
--- a/pr_cmds.c
+++ b/pr_cmds.c
@@ -14,7 +14,7 @@
{
int i;
static char out[256];
-
+
out[0] = 0;
for (i=first ; i<pr_argc ; i++)
{
@@ -38,7 +38,7 @@
{
char *s;
edict_t *ed;
-
+
s = PF_VarString(0);
Con_Printf ("======SERVER ERROR in %s:\n%s\n"
, PR_Str(pr_xfunction->s_name),s);
@@ -62,7 +62,7 @@
{
char *s;
edict_t *ed;
-
+
s = PF_VarString(0);
Con_Printf ("======OBJECT ERROR in %s:\n%s\n"
, PR_Str(pr_xfunction->s_name),s);
@@ -69,7 +69,7 @@
ed = PROG_TO_EDICT(pr_global_struct->self);
ED_Print (ed);
ED_Free (ed);
-
+
Host_Error ("Program error");
}
@@ -101,7 +101,7 @@
{
edict_t *e;
float *org;
-
+
e = G_EDICT(OFS_PARM0);
org = G_VECTOR(OFS_PARM1);
VectorCopy (org, e->v.origin);
@@ -118,7 +118,7 @@
float a;
vec3_t base, transformed;
int i, j, k, l;
-
+
for (i=0 ; i<3 ; i++)
if (min[i] > max[i])
PR_RunError ("backwards mins/maxs");
@@ -132,22 +132,22 @@
}
else
{
- // find min / max for rotations
+ // find min / max for rotations
angles = e->v.angles;
-
+
a = angles[1]/180 * M_PI;
-
+
xvector[0] = cos(a);
xvector[1] = sin(a);
yvector[0] = -sin(a);
yvector[1] = cos(a);
-
+
VectorCopy (min, bounds[0]);
VectorCopy (max, bounds[1]);
-
+
rmin[0] = rmin[1] = rmin[2] = Q_MAXFLOAT;
rmax[0] = rmax[1] = rmax[2] = -Q_MAXFLOAT;
-
+
for (i=0 ; i<= 1 ; i++)
{
base[0] = bounds[i][0];
@@ -157,12 +157,12 @@
for (k=0 ; k<= 1 ; k++)
{
base[2] = bounds[k][2];
-
- // transform the point
+
+ // transform the point
transformed[0] = xvector[0]*base[0] + yvector[0]*base[1];
transformed[1] = xvector[1]*base[0] + yvector[1]*base[1];
transformed[2] = base[2];
-
+
for (l=0 ; l<3 ; l++)
{
if (transformed[l] < rmin[l])
@@ -174,12 +174,12 @@
}
}
}
-
-// set derived values
+
+ // set derived values
VectorCopy (rmin, e->v.mins);
VectorCopy (rmax, e->v.maxs);
VectorSubtract (max, min, e->v.size);
-
+
SV_LinkEdict (e, false);
}
@@ -196,7 +196,7 @@
{
edict_t *e;
float *min, *max;
-
+
e = G_EDICT(OFS_PARM0);
min = G_VECTOR(OFS_PARM1);
max = G_VECTOR(OFS_PARM2);
@@ -221,7 +221,7 @@
e = G_EDICT(OFS_PARM0);
m = G_STRING(OFS_PARM1);
-// check to see if model was properly precached
+ // check to see if model was properly precached
for (i=0, check = sv.model_precache ; *check ; i++, check++)
if (!strcmp(*check, m))
break;
@@ -269,18 +269,18 @@
char *s;
client_t *client;
int entnum;
-
+
entnum = G_EDICTNUM(OFS_PARM0);
s = PF_VarString(1);
-
+
if (entnum < 1 || entnum > svs.maxclients)
{
Con_Printf ("tried to sprint to a non-client\n");
return;
}
-
+
client = &svs.clients[entnum-1];
-
+
MSG_WriteChar (&client->message,svc_print);
MSG_WriteString (&client->message, s );
}
@@ -300,18 +300,18 @@
char *s;
client_t *client;
int entnum;
-
+
entnum = G_EDICTNUM(OFS_PARM0);
s = PF_VarString(1);
-
+
if (entnum < 1 || entnum > svs.maxclients)
{
Con_Printf ("tried to sprint to a non-client\n");
return;
}
-
+
client = &svs.clients[entnum-1];
-
+
MSG_WriteChar (&client->message,svc_centerprint);
MSG_WriteString (&client->message, s );
}
@@ -329,13 +329,13 @@
float *v;
vec3_t newvalue;
double ln, a, b, c;
-
+
v = G_VECTOR(OFS_PARM0);
a = v[0];
b = v[1];
c = v[2];
ln = sqrt(a*a + b*b + c*c);
-
+
if(ln == 0)
newvalue[0] = newvalue[1] = newvalue[2] = 0;
else{
@@ -344,7 +344,7 @@
newvalue[2] = c / ln;
}
- VectorCopy(newvalue, G_VECTOR(OFS_RETURN));
+ VectorCopy(newvalue, G_VECTOR(OFS_RETURN));
}
/*
@@ -358,7 +358,7 @@
{
float *v;
double a, b, c;
-
+
v = G_VECTOR(OFS_PARM0);
a = v[0];
b = v[1];
@@ -377,7 +377,7 @@
{
float *value1;
float yaw;
-
+
value1 = G_VECTOR(OFS_PARM0);
if (value1[1] == 0 && value1[0] == 0)
@@ -405,7 +405,7 @@
float *value1;
double forward;
double yaw, pitch;
-
+
value1 = G_VECTOR(OFS_PARM0);
if (value1[1] == 0 && value1[0] == 0)
@@ -445,9 +445,9 @@
void PF_random (void)
{
float num;
-
+
num = (rand ()&0x7fff) / ((float)0x7fff);
-
+
G_FLOAT(OFS_RETURN) = num;
}
@@ -463,7 +463,7 @@
float *org, *dir;
float color;
float count;
-
+
org = G_VECTOR(OFS_PARM0);
dir = G_VECTOR(OFS_PARM1);
color = G_FLOAT(OFS_PARM2);
@@ -486,16 +486,16 @@
float vol, attenuation;
int i, soundnum;
- pos = G_VECTOR (OFS_PARM0);
+ pos = G_VECTOR (OFS_PARM0);
samp = G_STRING(OFS_PARM1);
vol = G_FLOAT(OFS_PARM2);
attenuation = G_FLOAT(OFS_PARM3);
-
-// check to see if samp was properly precached
+
+ // check to see if samp was properly precached
for (soundnum=0, check = sv.sound_precache ; *check ; check++, soundnum++)
if (!strcmp(*check,samp))
break;
-
+
if (!*check)
{
Con_Printf ("no precache: %s\n", samp);
@@ -502,7 +502,7 @@
return;
}
-// add an svc_spawnambient command to the level signon packet
+ // add an svc_spawnambient command to the level signon packet
if(soundnum >= sv.protocol->limit_sound)
return;
@@ -544,13 +544,13 @@
edict_t *entity;
int volume;
float attenuation;
-
+
entity = G_EDICT(OFS_PARM0);
channel = G_FLOAT(OFS_PARM1);
sample = G_STRING(OFS_PARM2);
volume = G_FLOAT(OFS_PARM3) * 255;
attenuation = G_FLOAT(OFS_PARM4);
-
+
if (volume < 0 || volume > 255)
fatal ("SV_StartSound: volume = %d", volume);
@@ -572,9 +572,9 @@
*/
void PF_break (void)
{
-Con_Printf ("break statement\n");
-*(int *)-4 = 0; // dump to debugger
-// PR_RunError ("break statement");
+ Con_Printf ("break statement\n");
+ assert(nil);
+ // PR_RunError ("break statement");
}
/*
@@ -609,7 +609,7 @@
pr_global_struct->trace_inopen = trace.inopen;
VectorCopy (trace.endpos, pr_global_struct->trace_endpos);
VectorCopy (trace.plane.normal, pr_global_struct->trace_plane_normal);
- pr_global_struct->trace_plane_dist = trace.plane.dist;
+ pr_global_struct->trace_plane_dist = trace.plane.dist;
if (trace.ent)
pr_global_struct->trace_ent = EDICT_TO_PROG(trace.ent);
else
@@ -644,7 +644,7 @@
mleaf_t *leaf;
vec3_t org;
-// cycle to the next one
+ // cycle to the next one
if (check < 1)
check = 1;
@@ -673,11 +673,11 @@
if ((int)ent->v.flags & FL_NOTARGET)
continue;
- // anything that is a client, or has a client as an enemy
+ // anything that is a client, or has a client as an enemy
break;
}
-// get the PVS for the entity
+ // get the PVS for the entity
VectorAdd (ent->v.origin, ent->v.view_ofs, org);
leaf = Mod_PointInLeaf (org, sv.worldmodel);
pvs = Mod_LeafPVS (leaf, sv.worldmodel, &size);
@@ -713,8 +713,8 @@
mleaf_t *leaf;
int l;
vec3_t view;
-
-// find a new check if on a new frame
+
+ // find a new check if on a new frame
if (sv.time - sv.lastchecktime >= 0.1)
{
sv.lastcheck = PF_newcheckclient (sv.lastcheck);
@@ -721,7 +721,7 @@
sv.lastchecktime = sv.time;
}
-// return check if it might be visible
+ // return check if it might be visible
ent = EDICT_NUM(sv.lastcheck);
if (ent->free || ent->v.health <= 0)
{
@@ -729,7 +729,7 @@
return;
}
-// if current entity can't possibly see the check entity, return 0
+ // if current entity can't possibly see the check entity, return 0
self = PROG_TO_EDICT(pr_global_struct->self);
VectorAdd (self->v.origin, self->v.view_ofs, view);
leaf = Mod_PointInLeaf (view, sv.worldmodel);
@@ -736,13 +736,13 @@
l = (leaf - sv.worldmodel->leafs) - 1;
if ( (l<0) || !(checkpvs[l>>3] & (1<<(l&7)) ) )
{
-c_notvis++;
+ c_notvis++;
RETURN_EDICT(sv.edicts);
return;
}
-// might be able to see it
-c_invis++;
+ // might be able to see it
+ c_invis++;
RETURN_EDICT(ent);
}
@@ -763,12 +763,12 @@
int entnum;
char *str;
client_t *old;
-
+
entnum = G_EDICTNUM(OFS_PARM0);
if (entnum < 1 || entnum > svs.maxclients)
PR_RunError ("Parm 0 not a client");
- str = G_STRING(OFS_PARM1);
-
+ str = G_STRING(OFS_PARM1);
+
old = host_client;
host_client = &svs.clients[entnum-1];
Host_ClientCommands ("%s", str);
@@ -787,8 +787,8 @@
void PF_localcmd (void)
{
char *str;
-
- str = G_STRING(OFS_PARM0);
+
+ str = G_STRING(OFS_PARM0);
Cbuf_AddText (str);
}
@@ -802,9 +802,9 @@
void PF_cvar (void)
{
char *str;
-
+
str = G_STRING(OFS_PARM0);
-
+
G_FLOAT(OFS_RETURN) = Cvar_VariableValue (str);
}
@@ -818,10 +818,10 @@
void PF_cvar_set (void)
{
char *var, *val;
-
+
var = G_STRING(OFS_PARM0);
val = G_STRING(OFS_PARM1);
-
+
setcvar (var, val);
}
@@ -843,7 +843,7 @@
int i, j;
chain = (edict_t *)sv.edicts;
-
+
org = G_VECTOR(OFS_PARM0);
rad = G_FLOAT(OFS_PARM1);
@@ -855,10 +855,10 @@
if (ent->v.solid == SOLID_NOT)
continue;
for (j=0 ; j<3 ; j++)
- eorg[j] = org[j] - (ent->v.origin[j] + (ent->v.mins[j] + ent->v.maxs[j])*0.5);
+ eorg[j] = org[j] - (ent->v.origin[j] + (ent->v.mins[j] + ent->v.maxs[j])*0.5);
if (Length(eorg) > rad)
continue;
-
+
ent->v.chain = EDICT_TO_PROG(chain);
chain = ent;
}
@@ -911,7 +911,7 @@
void PF_Remove (void)
{
edict_t *ed;
-
+
ed = G_EDICT(OFS_PARM0);
ED_Free (ed);
}
@@ -920,7 +920,7 @@
// entity (entity start, .string field, string match) find = #5;
void PF_Find (void)
{
- int e;
+ int e;
int f;
char *s, *t;
edict_t *ed;
@@ -930,7 +930,7 @@
s = G_STRING(OFS_PARM2);
if (!s)
PR_RunError ("PF_Find: bad search string");
-
+
for (e++ ; e < sv.num_edicts ; e++)
{
ed = EDICT_NUM(e);
@@ -964,14 +964,14 @@
{
char *s;
int i;
-
+
if (sv.state != ss_loading)
PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions");
-
+
s = G_STRING(OFS_PARM0);
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
PR_CheckEmptyString (s);
-
+
for (i=0 ; i<MAX_SOUNDS ; i++)
{
if (!sv.sound_precache[i])
@@ -989,7 +989,7 @@
{
char *s;
int i;
-
+
if (sv.state != ss_loading)
PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions");
@@ -1046,11 +1046,11 @@
vec3_t move;
dfunction_t *oldf;
int oldself;
-
+
ent = PROG_TO_EDICT(pr_global_struct->self);
yaw = G_FLOAT(OFS_PARM0);
dist = G_FLOAT(OFS_PARM1);
-
+
if ( !( (int)ent->v.flags & (FL_ONGROUND|FL_FLY|FL_SWIM) ) )
{
G_FLOAT(OFS_RETURN) = 0;
@@ -1058,19 +1058,19 @@
}
yaw = yaw*M_PI*2 / 360;
-
+
move[0] = cos(yaw)*dist;
move[1] = sin(yaw)*dist;
move[2] = 0;
-// save program state, because SV_movestep may call other progs
+ // save program state, because SV_movestep may call other progs
oldf = pr_xfunction;
oldself = pr_global_struct->self;
-
+
G_FLOAT(OFS_RETURN) = SV_movestep(ent, move, true);
-
-
-// restore program state
+
+
+ // restore program state
pr_xfunction = oldf;
pr_global_struct->self = oldself;
}
@@ -1087,12 +1087,12 @@
edict_t *ent;
vec3_t end;
trace_t trace;
-
+
ent = PROG_TO_EDICT(pr_global_struct->self);
VectorCopy (ent->v.origin, end);
end[2] -= 256;
-
+
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, false, ent);
if (trace.fraction == 1 || trace.allsolid)
@@ -1120,17 +1120,17 @@
char *val;
client_t *client;
int j;
-
+
style = G_FLOAT(OFS_PARM0);
val = G_STRING(OFS_PARM1);
-// change the string in sv
+ // change the string in sv
sv.lightstyles[style] = val;
-
-// send message to all clients on this server
+
+ // send message to all clients on this server
if (sv.state != ss_active)
return;
-
+
for (j=0, client = svs.clients ; j<svs.maxclients ; j++, client++)
if (client->active || client->spawned)
{
@@ -1146,16 +1146,17 @@
f = G_FLOAT(OFS_PARM0);
G_FLOAT(OFS_RETURN) = Qrint(f);
}
+
void PF_floor (void)
{
G_FLOAT(OFS_RETURN) = floor(G_FLOAT(OFS_PARM0));
}
+
void PF_ceil (void)
{
G_FLOAT(OFS_RETURN) = ceil(G_FLOAT(OFS_PARM0));
}
-
/*
=============
PF_checkbottom
@@ -1164,7 +1165,7 @@
void PF_checkbottom (void)
{
edict_t *ent;
-
+
ent = G_EDICT(OFS_PARM0);
G_FLOAT(OFS_RETURN) = SV_CheckBottom (ent);
@@ -1178,10 +1179,10 @@
void PF_pointcontents (void)
{
float *v;
-
+
v = G_VECTOR(OFS_PARM0);
- G_FLOAT(OFS_RETURN) = SV_PointContents (v);
+ G_FLOAT(OFS_RETURN) = SV_PointContents (v);
}
/*
@@ -1195,7 +1196,7 @@
{
int i;
edict_t *ent;
-
+
i = G_EDICTNUM(OFS_PARM0);
while (1)
{
@@ -1230,13 +1231,13 @@
int i, j;
trace_t tr;
float dist, bestdist;
-
+
ent = G_EDICT(OFS_PARM0);
VectorCopy (ent->v.origin, start);
start[2] += 20;
-// try sending a trace straight
+ // try sending a trace straight
VectorCopy (pr_global_struct->v_forward, dir);
VectorMA (start, 2048, dir, end);
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
@@ -1248,11 +1249,11 @@
}
-// try all possible entities
+ // try all possible entities
VectorCopy (dir, bestdir);
bestdist = sv_aim.value;
bestent = nil;
-
+
check = NEXT_EDICT(sv.edicts);
for (i=1 ; i<sv.num_edicts ; i++, check = NEXT_EDICT(check) )
{
@@ -1277,7 +1278,7 @@
bestent = check;
}
}
-
+
if (bestent)
{
VectorSubtract (bestent->v.origin, ent->v.origin, dir);
@@ -1285,7 +1286,7 @@
VectorScale (pr_global_struct->v_forward, dist, end);
end[2] = dir[2];
VectorNormalize (end);
- VectorCopy (end, G_VECTOR(OFS_RETURN));
+ VectorCopy (end, G_VECTOR(OFS_RETURN));
}
else
{
@@ -1304,12 +1305,12 @@
{
edict_t *ent;
float ideal, current, move, speed;
-
+
ent = PROG_TO_EDICT(pr_global_struct->self);
current = anglemod( ent->v.angles[1] );
ideal = ent->v.ideal_yaw;
speed = ent->v.yaw_speed;
-
+
if (current == ideal)
return;
move = ideal - current;
@@ -1333,7 +1334,7 @@
if (move < -speed)
move = -speed;
}
-
+
ent->v.angles[1] = anglemod (current + move);
}
@@ -1361,7 +1362,7 @@
{
case MSG_BROADCAST:
return &sv.datagram;
-
+
case MSG_ONE:
ent = PROG_TO_EDICT(pr_global_struct->msg_entity);
entnum = NUM_FOR_EDICT(ent);
@@ -1368,10 +1369,10 @@
if (entnum < 1 || entnum > svs.maxclients)
PR_RunError ("WriteDest: not a client");
return &svs.clients[entnum-1].message;
-
+
case MSG_ALL:
return &sv.reliable_datagram;
-
+
case MSG_INIT:
return &sv.signon;
@@ -1379,7 +1380,7 @@
PR_RunError ("WriteDest: bad destination");
break;
}
-
+
return nil;
}
@@ -1432,7 +1433,7 @@
{
edict_t *ent;
int i, model, frame, bits;
-
+
ent = G_EDICT(OFS_PARM0);
model = SV_ModelIndex(PR_Str(ent->v.model));
frame = ent->v.frame;
@@ -1470,7 +1471,7 @@
if(bits & sv.protocol->fl_baseline_alpha)
MSG_WriteByte(&sv.signon, ent->alpha);
-// throw the entity away now
+ // throw the entity away now
ED_Free (ent);
}
@@ -1508,11 +1509,11 @@
{
char *s;
-// make sure we don't issue two changelevels
+ // make sure we don't issue two changelevels
if (svs.changelevel_issued)
return;
svs.changelevel_issued = true;
-
+
s = G_STRING(OFS_PARM0);
Cbuf_AddText (va("changelevel %s\n",s));
}
--- a/pr_comp.h
+++ b/pr_comp.h
@@ -30,19 +30,19 @@
OP_ADD_V,
OP_SUB_F,
OP_SUB_V,
-
+
OP_EQ_F,
OP_EQ_V,
OP_EQ_S,
OP_EQ_E,
OP_EQ_FNC,
-
+
OP_NE_F,
OP_NE_V,
OP_NE_S,
OP_NE_E,
OP_NE_FNC,
-
+
OP_LE,
OP_GE,
OP_LT,
@@ -92,7 +92,7 @@
OP_GOTO,
OP_AND,
OP_OR,
-
+
OP_BITAND,
OP_BITOR
};
@@ -125,12 +125,12 @@
int first_statement; // negative numbers are builtins
int parm_start;
int locals; // total ints of parms + locals
-
+
int profile; // runtime
-
+
int s_name;
int s_file; // source file defined in
-
+
int numparms;
byte parm_size[MAX_PARMS];
} dfunction_t;
@@ -141,25 +141,25 @@
{
int version;
int crc; // check of header file
-
+
int ofs_statements;
int numstatements; // statement 0 is an error
int ofs_globaldefs;
int numglobaldefs;
-
+
int ofs_fielddefs;
int numfielddefs;
-
+
int ofs_functions;
int numfunctions; // function 0 is an empty
-
+
int ofs_strings;
int numstrings; // first string is a null string
int ofs_globals;
int numglobals;
-
+
int entityfields;
} dprograms_t;
--- a/pr_edict.c
+++ b/pr_edict.c
@@ -151,10 +151,10 @@
return e;
}
}
-
+
if (i == MAX_EDICTS)
fatal ("ED_Alloc: no free edicts");
-
+
sv.num_edicts++;
e = EDICT_NUM(i);
ED_ClearEdict (e);
@@ -200,7 +200,7 @@
{
ddef_t *def;
int i;
-
+
for (i=0 ; i<progs->numglobaldefs ; i++)
{
def = &pr_globaldefs[i];
@@ -219,7 +219,7 @@
{
ddef_t *def;
int i;
-
+
for (i=0 ; i<progs->numfielddefs ; i++)
{
def = &pr_fielddefs[i];
@@ -238,7 +238,7 @@
{
ddef_t *def;
int i;
-
+
for (i=0 ; i<progs->numfielddefs ; i++)
{
def = &pr_fielddefs[i];
@@ -258,7 +258,7 @@
{
ddef_t *def;
int i;
-
+
for (i=0 ; i<progs->numglobaldefs ; i++)
{
def = &pr_globaldefs[i];
@@ -278,7 +278,7 @@
{
dfunction_t *func;
int i;
-
+
for (i=0 ; i<progs->numfunctions ; i++)
{
func = &pr_functions[i];
@@ -333,7 +333,7 @@
static char line[256];
ddef_t *def;
dfunction_t *f;
-
+
type &= ~DEF_SAVEGLOBAL;
switch (type)
@@ -341,7 +341,7 @@
case ev_string:
sprint (line, "%s", PR_Str(val->string));
break;
- case ev_entity:
+ case ev_entity:
sprint (line, "entity %d", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)) );
break;
case ev_function:
@@ -368,7 +368,7 @@
sprint (line, "bad type %d", type);
break;
}
-
+
return line;
}
@@ -385,7 +385,7 @@
static char line[256];
ddef_t *def;
dfunction_t *f;
-
+
type &= ~DEF_SAVEGLOBAL;
switch (type)
@@ -393,7 +393,7 @@
case ev_string:
sprint (line, "%s", PR_Str(val->string));
break;
- case ev_entity:
+ case ev_entity:
sprint (line, "%d", NUM_FOR_EDICT(PROG_TO_EDICT(val->edict)));
break;
case ev_function:
@@ -417,7 +417,7 @@
sprint (line, "bad type %d", type);
break;
}
-
+
return line;
}
@@ -436,7 +436,7 @@
ddef_t *def;
void *val;
static char line[128];
-
+
val = (void *)&pr_globals[ofs];
def = ED_GlobalAtOfs(ofs);
if (!def)
@@ -446,12 +446,12 @@
s = PR_ValueString (def->type, val);
sprint (line,"%d(%s)%s", ofs, PR_Str(def->s_name), s);
}
-
+
i = strlen(line);
for ( ; i<20 ; i++)
strcat (line," ");
strcat (line," ");
-
+
return line;
}
@@ -460,18 +460,18 @@
int i;
ddef_t *def;
static char line[128];
-
+
def = ED_GlobalAtOfs(ofs);
if (!def)
sprint (line,"%d(?)", ofs);
else
sprint (line,"%d(%s)", ofs, PR_Str(def->s_name));
-
+
i = strlen(line);
for ( ; i<20 ; i++)
strcat (line," ");
strcat (line," ");
-
+
return line;
}
@@ -505,10 +505,10 @@
name = PR_Str(d->s_name);
if (name[strlen(name)-2] == '_')
continue; // skip _x, _y, _z vars
-
+
v = (int *)((char *)&ed->v + d->ofs*4);
- // if the value is still all 0, skip the field
+ // if the value is still all 0, skip the field
if((type = d->type & ~DEF_SAVEGLOBAL) >= nelem(type_size))
continue;
for (j=0 ; j<type_size[type] ; j++)
@@ -516,13 +516,13 @@
break;
if (j == type_size[type])
continue;
-
+
Con_Printf ("%s",name);
l = strlen (name);
while (l++ < 15)
Con_Printf (" ");
- Con_Printf ("%s\n", PR_ValueString(d->type, (eval_t *)v));
+ Con_Printf ("%s\n", PR_ValueString(d->type, (eval_t *)v));
}
}
@@ -541,7 +541,7 @@
void ED_PrintEdicts (void)
{
int i;
-
+
Con_Printf ("%d entities\n", sv.num_edicts);
for (i=0 ; i<sv.num_edicts ; i++)
ED_PrintNum (i);
@@ -557,7 +557,7 @@
void ED_PrintEdict_f (void)
{
int i;
-
+
i = atoi(Cmd_Argv(1));
if (i >= sv.num_edicts)
{
@@ -623,8 +623,8 @@
ddef_t *key;
while (1)
- {
- // parse key
+ {
+ // parse key
data = COM_Parse (data);
if (com_token[0] == '}')
break;
@@ -633,7 +633,7 @@
strcpy (keyname, com_token);
- // parse value
+ // parse value
data = COM_Parse (data);
if (!data)
fatal ("ED_ParseGlobals: EOF without closing brace");
@@ -665,7 +665,7 @@
{
char *new, *new_p;
int i,l, slot;
-
+
l = strlen(string) + 1;
new = Hunk_Alloc (l);
new_p = new;
@@ -685,7 +685,7 @@
*new_p++ = string[i];
}
prstr[slot] = new;
-
+
return -1-slot;
}
@@ -705,19 +705,19 @@
void *d;
dfunction_t *func;
int i;
-
+
d = (void *)((int *)base + key->ofs);
-
+
switch (key->type & ~DEF_SAVEGLOBAL)
{
case ev_string:
*(string_t *)d = ED_NewString(s);
break;
-
+
case ev_float:
*(float *)d = atof(s);
break;
-
+
case ev_vector:
memset(d, 0, sizeof(float)*3);
w = s;
@@ -731,11 +731,11 @@
for(; i < 3; i++)
((float*)d)[i] = 0;
break;
-
+
case ev_entity:
*(int *)d = EDICT_TO_PROG(EDICT_NUM(atoi (s)));
break;
-
+
case ev_field:
def = ED_FindField (s);
if (!def)
@@ -745,7 +745,7 @@
}
*(int *)d = G_INT(def->ofs);
break;
-
+
case ev_function:
func = ED_FindFunction (s);
if (!func)
@@ -755,7 +755,7 @@
}
*(func_t *)d = func - pr_functions;
break;
-
+
default:
break;
}
@@ -781,20 +781,20 @@
init = false;
-// clear it
+ // clear it
if (ent != sv.edicts) // hack
memset (&ent->v, 0, progs->entityfields * 4);
-// go through all the dictionary pairs
+ // go through all the dictionary pairs
while (1)
- {
- // parse key
+ {
+ // parse key
data = COM_Parse (data);
if (com_token[0] == '}')
break;
if (!data)
fatal ("ED_ParseEdict: EOF without closing brace");
-
+
// anglehack is to allow QuakeEd to write single scalar angles
// and allow them to be turned into vectors. (FIXME...)
if (!strcmp(com_token, "angle"))
@@ -819,7 +819,7 @@
n--;
}
- // parse value
+ // parse value
data = COM_Parse (data);
if (!data)
fatal ("ED_ParseEdict: EOF without closing brace");
@@ -827,13 +827,13 @@
if (com_token[0] == '}')
fatal ("ED_ParseEdict: closing brace without data");
- init = true;
+ init = true;
- // keynames with a leading underscore are used for utility comments,
- // and are immediately discarded by quake
+ // keynames with a leading underscore are used for utility comments,
+ // and are immediately discarded by quake
if (keyname[0] == '_')
continue;
-
+
key = ED_FindField (keyname);
if (!key)
{
@@ -877,18 +877,18 @@
================
*/
void ED_LoadFromFile (char *data)
-{
+{
edict_t *ent;
int inhibit;
dfunction_t *func;
-
+
ent = nil;
inhibit = 0;
pr_global_struct->time = sv.time;
-// parse ents
+ // parse ents
while (1)
{
-// parse the opening brace
+ // parse the opening brace
data = COM_Parse (data);
if (!data)
break;
@@ -901,12 +901,12 @@
ent = ED_Alloc ();
data = ED_ParseEdict (data, ent);
-// remove things from different skill levels or deathmatch
+ // remove things from different skill levels or deathmatch
if (deathmatch.value)
{
if (((int)ent->v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
{
- ED_Free (ent);
+ ED_Free (ent);
inhibit++;
continue;
}
@@ -915,14 +915,12 @@
|| (current_skill == 1 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_MEDIUM))
|| (current_skill >= 2 && ((int)ent->v.spawnflags & SPAWNFLAG_NOT_HARD)) )
{
- ED_Free (ent);
+ ED_Free (ent);
inhibit++;
continue;
}
-//
-// immediately call spawn function
-//
+ // immediately call spawn function
if (!ent->v.classname)
{
Con_Printf ("No classname for:\n");
@@ -931,7 +929,7 @@
continue;
}
- // look for the spawn function
+ // look for the spawn function
func = ED_FindFunction ( PR_Str(ent->v.classname) );
if (!func)
{
@@ -943,7 +941,7 @@
pr_global_struct->self = EDICT_TO_PROG(ent);
PR_ExecuteProgram (func - pr_functions);
- }
+ }
Con_DPrintf("%d entities inhibited\n", inhibit);
}
@@ -1014,7 +1012,7 @@
{
int i, n;
-// flush the non-C variable lookup cache
+ // flush the non-C variable lookup cache
for (i=0 ; i<GEFV_CACHESIZE ; i++)
gefvCache[i].field[0] = 0;
@@ -1041,9 +1039,9 @@
for (i=0 ; i<n ; i++)
crc (((byte *)progs)[i]);
-// byte swap the header
+ // byte swap the header
for (i=0 ; i<(int)sizeof(*progs)/4 ; i++)
- ((int *)progs)[i] = LittleLong ( ((int *)progs)[i] );
+ ((int *)progs)[i] = LittleLong ( ((int *)progs)[i] );
if (progs->version != PROG_VERSION)
fatal ("progs.dat has wrong version number (%d should be %d)", progs->version, PROG_VERSION);
@@ -1057,8 +1055,8 @@
pr_statements = (dstatement_t *)((byte *)progs + progs->ofs_statements);
pr_global_struct = (globalvars_t *)((byte *)progs + progs->ofs_globals);
pr_globals = (float *)pr_global_struct;
-
-// byte swap the lumps
+
+ // byte swap the lumps
for (i=0 ; i<progs->numstatements ; i++)
{
pr_statements[i].op = LittleShort(pr_statements[i].op);
@@ -1075,7 +1073,7 @@
pr_functions[i].s_file = LittleLong (pr_functions[i].s_file);
pr_functions[i].numparms = LittleLong (pr_functions[i].numparms);
pr_functions[i].locals = LittleLong (pr_functions[i].locals);
- }
+ }
for (i=0 ; i<progs->numglobaldefs ; i++)
{
@@ -1127,10 +1125,10 @@
int NUM_FOR_EDICT(edict_t *e)
{
int b;
-
+
b = (byte *)e - (byte *)sv.edicts;
b = b / pr_edict_size;
-
+
if (b < 0 || b >= sv.num_edicts)
fatal ("NUM_FOR_EDICT: bad pointer");
return b;
--- a/pr_exec.c
+++ b/pr_exec.c
@@ -27,43 +27,43 @@
"DONE",
"MUL_F",
-"MUL_V",
+"MUL_V",
"MUL_FV",
"MUL_VF",
-
+
"DIV",
"ADD_F",
-"ADD_V",
-
+"ADD_V",
+
"SUB_F",
"SUB_V",
"EQ_F",
"EQ_V",
-"EQ_S",
+"EQ_S",
"EQ_E",
"EQ_FNC",
-
+
"NE_F",
-"NE_V",
+"NE_V",
"NE_S",
-"NE_E",
+"NE_E",
"NE_FNC",
-
+
"LE",
"GE",
"LT",
-"GT",
+"GT",
"INDIRECT",
"INDIRECT",
-"INDIRECT",
-"INDIRECT",
"INDIRECT",
-"INDIRECT",
+"INDIRECT",
+"INDIRECT",
+"INDIRECT",
-"ADDRESS",
+"ADDRESS",
"STORE_F",
"STORE_V",
@@ -80,16 +80,16 @@
"STOREP_FNC",
"RETURN",
-
+
"NOT_F",
"NOT_V",
-"NOT_S",
-"NOT_ENT",
-"NOT_FNC",
-
+"NOT_S",
+"NOT_ENT",
+"NOT_FNC",
+
"IF",
"IFNOT",
-
+
"CALL0",
"CALL1",
"CALL2",
@@ -99,13 +99,13 @@
"CALL6",
"CALL7",
"CALL8",
-
+
"STATE",
-
-"GOTO",
-
+
+"GOTO",
+
"AND",
-"OR",
+"OR",
"BITAND",
"BITOR"
@@ -125,7 +125,7 @@
void PR_PrintStatement (dstatement_t *s)
{
int i;
-
+
if ( (unsigned)s->op < sizeof(pr_opnames)/sizeof(pr_opnames[0]))
{
Con_Printf ("%s ", pr_opnames[s->op]);
@@ -133,7 +133,7 @@
for ( ; i<10 ; i++)
Con_Printf (" ");
}
-
+
if (s->op == OP_IF || s->op == OP_IFNOT)
Con_Printf ("%sbranch %d",PR_GlobalString(s->a),s->b);
else if (s->op == OP_GOTO)
@@ -166,24 +166,24 @@
{
dfunction_t *f;
int i;
-
+
if (pr_depth == 0)
{
Con_Printf ("<NO STACK>\n");
return;
}
-
+
pr_stack[pr_depth].f = pr_xfunction;
for (i=pr_depth ; i>=0 ; i--)
{
f = pr_stack[i].f;
-
+
if (!f)
{
Con_Printf ("<NO FUNCTION>\n");
}
else
- Con_Printf ("%12s : %s\n", PR_Str(f->s_file), PR_Str(f->s_name));
+ Con_Printf ("%12s : %s\n", PR_Str(f->s_file), PR_Str(f->s_name));
}
}
@@ -204,7 +204,7 @@
if (!sv.active)
return;
- num = 0;
+ num = 0;
do
{
max = 0;
@@ -248,7 +248,7 @@
PR_PrintStatement(pr_statements + pr_xstatement);
PR_StackTrace();
Con_Printf("%s\n", s);
-
+
pr_depth = 0; // dump the stack so host_error can shutdown functions
Host_Error("Program error");
}
@@ -273,12 +273,12 @@
int i, j, c, o;
pr_stack[pr_depth].s = pr_xstatement;
- pr_stack[pr_depth].f = pr_xfunction;
+ pr_stack[pr_depth].f = pr_xfunction;
pr_depth++;
if (pr_depth >= MAX_STACK_DEPTH)
PR_RunError ("stack overflow");
-// save off any locals that the new function steps on
+ // save off any locals that the new function steps on
c = f->locals;
if (localstack_used + c > LOCALSTACK_SIZE)
PR_RunError ("PR_ExecuteProgram: locals stack overflow\n");
@@ -287,7 +287,7 @@
localstack[localstack_used+i] = ((int *)pr_globals)[f->parm_start + i];
localstack_used += c;
-// copy parameters
+ // copy parameters
o = f->parm_start;
for (i=0 ; i<f->numparms ; i++)
{
@@ -314,7 +314,7 @@
if (pr_depth <= 0)
fatal ("prog stack underflow");
-// restore locals from the stack
+ // restore locals from the stack
c = pr_xfunction->locals;
localstack_used -= c;
if (localstack_used < 0)
@@ -323,7 +323,7 @@
for (i=0 ; i < c ; i++)
((int *)pr_globals)[pr_xfunction->parm_start + i] = localstack[localstack_used+i];
-// up stack
+ // up stack
pr_depth--;
pr_xfunction = pr_stack[pr_depth].f;
return pr_stack[pr_depth].s;
@@ -353,289 +353,286 @@
ED_Print (PROG_TO_EDICT(pr_global_struct->self));
Host_Error ("PR_ExecuteProgram: NULL function");
}
-
+
f = &pr_functions[fnum];
runaway = 100000;
pr_trace = false;
-// make a stack frame
+ // make a stack frame
exitdepth = pr_depth;
s = PR_EnterFunction (f);
-
-while (1)
-{
- s++; // next statement
- st = &pr_statements[s];
- a = (eval_t *)&pr_globals[(unsigned short)st->a];
- b = (eval_t *)&pr_globals[(unsigned short)st->b];
- c = (eval_t *)&pr_globals[(unsigned short)st->c];
-
- if (!--runaway)
- PR_RunError ("runaway loop error");
-
- pr_xfunction->profile++;
- pr_xstatement = s;
-
- if (pr_trace)
- PR_PrintStatement (st);
-
- switch (st->op)
+ while (1)
{
- case OP_ADD_F:
- c->_float = a->_float + b->_float;
- break;
- case OP_ADD_V:
- c->vector[0] = a->vector[0] + b->vector[0];
- c->vector[1] = a->vector[1] + b->vector[1];
- c->vector[2] = a->vector[2] + b->vector[2];
- break;
-
- case OP_SUB_F:
- c->_float = a->_float - b->_float;
- break;
- case OP_SUB_V:
- c->vector[0] = a->vector[0] - b->vector[0];
- c->vector[1] = a->vector[1] - b->vector[1];
- c->vector[2] = a->vector[2] - b->vector[2];
- break;
+ s++; // next statement
- case OP_MUL_F:
- c->_float = a->_float * b->_float;
- break;
- case OP_MUL_V:
- c->_float = a->vector[0]*b->vector[0]
- + a->vector[1]*b->vector[1]
- + a->vector[2]*b->vector[2];
- break;
- case OP_MUL_FV:
- c->vector[0] = a->_float * b->vector[0];
- c->vector[1] = a->_float * b->vector[1];
- c->vector[2] = a->_float * b->vector[2];
- break;
- case OP_MUL_VF:
- c->vector[0] = b->_float * a->vector[0];
- c->vector[1] = b->_float * a->vector[1];
- c->vector[2] = b->_float * a->vector[2];
- break;
+ st = &pr_statements[s];
+ a = (eval_t *)&pr_globals[(unsigned short)st->a];
+ b = (eval_t *)&pr_globals[(unsigned short)st->b];
+ c = (eval_t *)&pr_globals[(unsigned short)st->c];
- case OP_DIV_F:
- c->_float = a->_float / b->_float;
- break;
-
- case OP_BITAND:
- c->_float = (int)a->_float & (int)b->_float;
- break;
-
- case OP_BITOR:
- c->_float = (int)a->_float | (int)b->_float;
- break;
-
-
- case OP_GE:
- c->_float = a->_float >= b->_float;
- break;
- case OP_LE:
- c->_float = a->_float <= b->_float;
- break;
- case OP_GT:
- c->_float = a->_float > b->_float;
- break;
- case OP_LT:
- c->_float = a->_float < b->_float;
- break;
- case OP_AND:
- c->_float = a->_float && b->_float;
- break;
- case OP_OR:
- c->_float = a->_float || b->_float;
- break;
-
- case OP_NOT_F:
- c->_float = !a->_float;
- break;
- case OP_NOT_V:
- c->_float = !a->vector[0] && !a->vector[1] && !a->vector[2];
- break;
- case OP_NOT_S:
- c->_float = !a->string || !*PR_Str(a->string);
- break;
- case OP_NOT_FNC:
- c->_float = !a->function;
- break;
- case OP_NOT_ENT:
- c->_float = (PROG_TO_EDICT(a->edict) == sv.edicts);
- break;
+ if (!--runaway)
+ PR_RunError ("runaway loop error");
- case OP_EQ_F:
- c->_float = a->_float == b->_float;
- break;
- case OP_EQ_V:
- c->_float = (a->vector[0] == b->vector[0]) &&
- (a->vector[1] == b->vector[1]) &&
- (a->vector[2] == b->vector[2]);
- break;
- case OP_EQ_S:
- c->_float = !strcmp(PR_Str(a->string),PR_Str(b->string));
- break;
- case OP_EQ_E:
- c->_float = a->_int == b->_int;
- break;
- case OP_EQ_FNC:
- c->_float = a->function == b->function;
- break;
+ pr_xfunction->profile++;
+ pr_xstatement = s;
+ if (pr_trace)
+ PR_PrintStatement (st);
- case OP_NE_F:
- c->_float = a->_float != b->_float;
- break;
- case OP_NE_V:
- c->_float = (a->vector[0] != b->vector[0]) ||
- (a->vector[1] != b->vector[1]) ||
- (a->vector[2] != b->vector[2]);
- break;
- case OP_NE_S:
- c->_float = strcmp(PR_Str(a->string),PR_Str(b->string));
- break;
- case OP_NE_E:
- c->_float = a->_int != b->_int;
- break;
- case OP_NE_FNC:
- c->_float = a->function != b->function;
- break;
+ switch (st->op)
+ {
+ case OP_ADD_F:
+ c->_float = a->_float + b->_float;
+ break;
+ case OP_ADD_V:
+ c->vector[0] = a->vector[0] + b->vector[0];
+ c->vector[1] = a->vector[1] + b->vector[1];
+ c->vector[2] = a->vector[2] + b->vector[2];
+ break;
+ case OP_SUB_F:
+ c->_float = a->_float - b->_float;
+ break;
+ case OP_SUB_V:
+ c->vector[0] = a->vector[0] - b->vector[0];
+ c->vector[1] = a->vector[1] - b->vector[1];
+ c->vector[2] = a->vector[2] - b->vector[2];
+ break;
+
+ case OP_MUL_F:
+ c->_float = a->_float * b->_float;
+ break;
+ case OP_MUL_V:
+ c->_float = a->vector[0]*b->vector[0]
+ + a->vector[1]*b->vector[1]
+ + a->vector[2]*b->vector[2];
+ break;
+ case OP_MUL_FV:
+ c->vector[0] = a->_float * b->vector[0];
+ c->vector[1] = a->_float * b->vector[1];
+ c->vector[2] = a->_float * b->vector[2];
+ break;
+ case OP_MUL_VF:
+ c->vector[0] = b->_float * a->vector[0];
+ c->vector[1] = b->_float * a->vector[1];
+ c->vector[2] = b->_float * a->vector[2];
+ break;
+
+ case OP_DIV_F:
+ c->_float = a->_float / b->_float;
+ break;
+
+ case OP_BITAND:
+ c->_float = (int)a->_float & (int)b->_float;
+ break;
+
+ case OP_BITOR:
+ c->_float = (int)a->_float | (int)b->_float;
+ break;
+
+ case OP_GE:
+ c->_float = a->_float >= b->_float;
+ break;
+ case OP_LE:
+ c->_float = a->_float <= b->_float;
+ break;
+ case OP_GT:
+ c->_float = a->_float > b->_float;
+ break;
+ case OP_LT:
+ c->_float = a->_float < b->_float;
+ break;
+ case OP_AND:
+ c->_float = a->_float && b->_float;
+ break;
+ case OP_OR:
+ c->_float = a->_float || b->_float;
+ break;
+
+ case OP_NOT_F:
+ c->_float = !a->_float;
+ break;
+ case OP_NOT_V:
+ c->_float = !a->vector[0] && !a->vector[1] && !a->vector[2];
+ break;
+ case OP_NOT_S:
+ c->_float = !a->string || !*PR_Str(a->string);
+ break;
+ case OP_NOT_FNC:
+ c->_float = !a->function;
+ break;
+ case OP_NOT_ENT:
+ c->_float = (PROG_TO_EDICT(a->edict) == sv.edicts);
+ break;
+
+ case OP_EQ_F:
+ c->_float = a->_float == b->_float;
+ break;
+ case OP_EQ_V:
+ c->_float = (a->vector[0] == b->vector[0]) &&
+ (a->vector[1] == b->vector[1]) &&
+ (a->vector[2] == b->vector[2]);
+ break;
+ case OP_EQ_S:
+ c->_float = !strcmp(PR_Str(a->string),PR_Str(b->string));
+ break;
+ case OP_EQ_E:
+ c->_float = a->_int == b->_int;
+ break;
+ case OP_EQ_FNC:
+ c->_float = a->function == b->function;
+ break;
+
+ case OP_NE_F:
+ c->_float = a->_float != b->_float;
+ break;
+ case OP_NE_V:
+ c->_float = (a->vector[0] != b->vector[0]) ||
+ (a->vector[1] != b->vector[1]) ||
+ (a->vector[2] != b->vector[2]);
+ break;
+ case OP_NE_S:
+ c->_float = strcmp(PR_Str(a->string),PR_Str(b->string));
+ break;
+ case OP_NE_E:
+ c->_float = a->_int != b->_int;
+ break;
+ case OP_NE_FNC:
+ c->_float = a->function != b->function;
+ break;
+
//==================
- case OP_STORE_F:
- case OP_STORE_ENT:
- case OP_STORE_FLD: // integers
- case OP_STORE_S:
- case OP_STORE_FNC: // pointers
- b->_int = a->_int;
- break;
- case OP_STORE_V:
- b->vector[0] = a->vector[0];
- b->vector[1] = a->vector[1];
- b->vector[2] = a->vector[2];
- break;
-
- case OP_STOREP_F:
- case OP_STOREP_ENT:
- case OP_STOREP_FLD: // integers
- case OP_STOREP_S:
- case OP_STOREP_FNC: // pointers
- ptr = (eval_t *)((byte *)sv.edicts + b->_int);
- ptr->_int = a->_int;
- break;
- case OP_STOREP_V:
- ptr = (eval_t *)((byte *)sv.edicts + b->_int);
- ptr->vector[0] = a->vector[0];
- ptr->vector[1] = a->vector[1];
- ptr->vector[2] = a->vector[2];
- break;
-
- case OP_ADDRESS:
- ed = PROG_TO_EDICT(a->edict);
+ case OP_STORE_F:
+ case OP_STORE_ENT:
+ case OP_STORE_FLD: // integers
+ case OP_STORE_S:
+ case OP_STORE_FNC: // pointers
+ b->_int = a->_int;
+ break;
+ case OP_STORE_V:
+ b->vector[0] = a->vector[0];
+ b->vector[1] = a->vector[1];
+ b->vector[2] = a->vector[2];
+ break;
+
+ case OP_STOREP_F:
+ case OP_STOREP_ENT:
+ case OP_STOREP_FLD: // integers
+ case OP_STOREP_S:
+ case OP_STOREP_FNC: // pointers
+ ptr = (eval_t *)((byte *)sv.edicts + b->_int);
+ ptr->_int = a->_int;
+ break;
+ case OP_STOREP_V:
+ ptr = (eval_t *)((byte *)sv.edicts + b->_int);
+ ptr->vector[0] = a->vector[0];
+ ptr->vector[1] = a->vector[1];
+ ptr->vector[2] = a->vector[2];
+ break;
+
+ case OP_ADDRESS:
+ ed = PROG_TO_EDICT(a->edict);
#ifdef PARANOID
- NUM_FOR_EDICT(ed); // make sure it's in range
+ NUM_FOR_EDICT(ed); // make sure it's in range
#endif
- if (ed == (edict_t *)sv.edicts && sv.state == ss_active)
- PR_RunError ("assignment to world entity");
- c->_int = (byte *)((int *)&ed->v + b->_int) - (byte *)sv.edicts;
- break;
-
- case OP_LOAD_F:
- case OP_LOAD_FLD:
- case OP_LOAD_ENT:
- case OP_LOAD_S:
- case OP_LOAD_FNC:
- ed = PROG_TO_EDICT(a->edict);
+ if (ed == (edict_t *)sv.edicts && sv.state == ss_active)
+ PR_RunError ("assignment to world entity");
+ c->_int = (byte *)((int *)&ed->v + b->_int) - (byte *)sv.edicts;
+ break;
+
+ case OP_LOAD_F:
+ case OP_LOAD_FLD:
+ case OP_LOAD_ENT:
+ case OP_LOAD_S:
+ case OP_LOAD_FNC:
+ ed = PROG_TO_EDICT(a->edict);
#ifdef PARANOID
- NUM_FOR_EDICT(ed); // make sure it's in range
+ NUM_FOR_EDICT(ed); // make sure it's in range
#endif
- a = (eval_t *)((int *)&ed->v + b->_int);
- c->_int = a->_int;
- break;
+ a = (eval_t *)((int *)&ed->v + b->_int);
+ c->_int = a->_int;
+ break;
- case OP_LOAD_V:
- ed = PROG_TO_EDICT(a->edict);
+ case OP_LOAD_V:
+ ed = PROG_TO_EDICT(a->edict);
#ifdef PARANOID
- NUM_FOR_EDICT(ed); // make sure it's in range
+ NUM_FOR_EDICT(ed); // make sure it's in range
#endif
- a = (eval_t *)((int *)&ed->v + b->_int);
- c->vector[0] = a->vector[0];
- c->vector[1] = a->vector[1];
- c->vector[2] = a->vector[2];
- break;
-
+ a = (eval_t *)((int *)&ed->v + b->_int);
+ c->vector[0] = a->vector[0];
+ c->vector[1] = a->vector[1];
+ c->vector[2] = a->vector[2];
+ break;
+
//==================
- case OP_IFNOT:
- if (!a->_int)
- s += st->b - 1; // offset the s++
- break;
-
- case OP_IF:
- if (a->_int)
- s += st->b - 1; // offset the s++
- break;
-
- case OP_GOTO:
- s += st->a - 1; // offset the s++
- break;
-
- case OP_CALL0:
- case OP_CALL1:
- case OP_CALL2:
- case OP_CALL3:
- case OP_CALL4:
- case OP_CALL5:
- case OP_CALL6:
- case OP_CALL7:
- case OP_CALL8:
- pr_argc = st->op - OP_CALL0;
- if (!a->function)
- PR_RunError ("NULL function");
+ case OP_IFNOT:
+ if (!a->_int)
+ s += st->b - 1; // offset the s++
+ break;
- newf = &pr_functions[a->function];
+ case OP_IF:
+ if (a->_int)
+ s += st->b - 1; // offset the s++
+ break;
- if (newf->first_statement < 0)
- { // negative statements are built in functions
- i = -newf->first_statement;
- if (i >= pr_numbuiltins)
- PR_RunError ("Bad builtin call number %d", i);
- pr_builtins[i] ();
+ case OP_GOTO:
+ s += st->a - 1; // offset the s++
break;
- }
- s = PR_EnterFunction (newf);
- break;
+ case OP_CALL0:
+ case OP_CALL1:
+ case OP_CALL2:
+ case OP_CALL3:
+ case OP_CALL4:
+ case OP_CALL5:
+ case OP_CALL6:
+ case OP_CALL7:
+ case OP_CALL8:
+ pr_argc = st->op - OP_CALL0;
+ if (!a->function)
+ PR_RunError ("NULL function");
- case OP_DONE:
- case OP_RETURN:
- pr_globals[OFS_RETURN] = pr_globals[(unsigned short)st->a];
- pr_globals[OFS_RETURN+1] = pr_globals[(unsigned short)st->a+1];
- pr_globals[OFS_RETURN+2] = pr_globals[(unsigned short)st->a+2];
-
- s = PR_LeaveFunction ();
- if (pr_depth == exitdepth)
- return; // all done
- break;
-
- case OP_STATE:
- ed = PROG_TO_EDICT(pr_global_struct->self);
- ed->v.nextthink = pr_global_struct->time + 0.1;
- if (a->_float != ed->v.frame)
- {
- ed->v.frame = a->_float;
+ newf = &pr_functions[a->function];
+
+ if (newf->first_statement < 0)
+ { // negative statements are built in functions
+ i = -newf->first_statement;
+ if (i >= pr_numbuiltins)
+ PR_RunError ("Bad builtin call number %d", i);
+ pr_builtins[i] ();
+ break;
+ }
+
+ s = PR_EnterFunction (newf);
+ break;
+
+ case OP_DONE:
+ case OP_RETURN:
+ pr_globals[OFS_RETURN] = pr_globals[(unsigned short)st->a];
+ pr_globals[OFS_RETURN+1] = pr_globals[(unsigned short)st->a+1];
+ pr_globals[OFS_RETURN+2] = pr_globals[(unsigned short)st->a+2];
+
+ s = PR_LeaveFunction ();
+ if (pr_depth == exitdepth)
+ return; // all done
+ break;
+
+ case OP_STATE:
+ ed = PROG_TO_EDICT(pr_global_struct->self);
+ ed->v.nextthink = pr_global_struct->time + 0.1;
+ if (a->_float != ed->v.frame)
+ {
+ ed->v.frame = a->_float;
+ }
+ ed->v.think = b->function;
+ break;
+
+ default:
+ PR_RunError ("Bad opcode %d", st->op);
}
- ed->v.think = b->function;
- break;
-
- default:
- PR_RunError ("Bad opcode %d", st->op);
}
-}
-
}
--- a/progs.h
+++ b/progs.h
@@ -9,7 +9,7 @@
func_t function;
int _int;
int edict;
-} eval_t;
+} eval_t;
#define MAX_ENT_LEAFS 32
typedef struct edict_s
@@ -17,12 +17,12 @@
qboolean free;
link_t area; // linked to a division node or leaf
byte alpha;
-
+
int num_leafs;
int leafnums[MAX_ENT_LEAFS];
entity_state_t baseline;
-
+
float freetime; // sv.time when the object was freed
entvars_t v; // C exported fields from progs
// other fields from progs come immediately after
--- a/qk1.c
+++ b/qk1.c
@@ -59,7 +59,7 @@
vlong l;
Dir *d;
- if((d = dirfstat(fd)) == nil) /* file assumed extant and readable */
+ if((d = dirfstat(fd)) == nil) /* file assumed extant and readable */
sysfatal("flen: %r");
l = d->length;
free(d);
--- a/r_aclip.c
+++ b/r_aclip.c
@@ -33,11 +33,11 @@
{
scale = (ALIAS_Z_CLIP_PLANE - pav0->fv[2]) /
(pav1->fv[2] - pav0->fv[2]);
-
+
avout.fv[0] = pav0->fv[0] + (pav1->fv[0] - pav0->fv[0]) * scale;
avout.fv[1] = pav0->fv[1] + (pav1->fv[1] - pav0->fv[1]) * scale;
avout.fv[2] = ALIAS_Z_CLIP_PLANE;
-
+
out->v[2] = pfv0->v[2] + (pfv1->v[2] - pfv0->v[2]) * scale;
out->v[3] = pfv0->v[3] + (pfv1->v[3] - pfv0->v[3]) * scale;
out->v[4] = pfv0->v[4] + (pfv1->v[4] - pfv0->v[4]) * scale;
@@ -46,11 +46,11 @@
{
scale = (ALIAS_Z_CLIP_PLANE - pav1->fv[2]) /
(pav0->fv[2] - pav1->fv[2]);
-
+
avout.fv[0] = pav1->fv[0] + (pav0->fv[0] - pav1->fv[0]) * scale;
avout.fv[1] = pav1->fv[1] + (pav0->fv[1] - pav1->fv[1]) * scale;
avout.fv[2] = ALIAS_Z_CLIP_PLANE;
-
+
out->v[2] = pfv1->v[2] + (pfv0->v[2] - pfv1->v[2]) * scale;
out->v[3] = pfv1->v[3] + (pfv0->v[3] - pfv1->v[3]) * scale;
out->v[4] = pfv1->v[4] + (pfv0->v[4] - pfv1->v[4]) * scale;
@@ -65,7 +65,7 @@
if (out->v[0] > r_refdef.aliasvrectright)
out->flags |= ALIAS_RIGHT_CLIP;
if (out->v[1] > r_refdef.aliasvrectbottom)
- out->flags |= ALIAS_BOTTOM_CLIP;
+ out->flags |= ALIAS_BOTTOM_CLIP;
}
@@ -166,7 +166,7 @@
{
int i,j,k;
int flags, oldflags;
-
+
j = count-1;
k = 0;
for (i=0 ; i<count ; j = i, i++)
@@ -187,7 +187,7 @@
if (out[k].v[0] > r_refdef.aliasvrectright)
out[k].flags |= ALIAS_RIGHT_CLIP;
if (out[k].v[1] > r_refdef.aliasvrectbottom)
- out[k].flags |= ALIAS_BOTTOM_CLIP;
+ out[k].flags |= ALIAS_BOTTOM_CLIP;
k++;
}
if (!flags)
@@ -196,7 +196,7 @@
k++;
}
}
-
+
return k;
}
@@ -214,7 +214,7 @@
memset(fv, 0, sizeof(fv));
-// copy vertexes and fix seam texture coordinates
+ // copy vertexes and fix seam texture coordinates
if (ptri->facesfront)
{
fv[0][0] = pfinalverts[ptri->vertindex[0]];
@@ -226,13 +226,13 @@
for (i=0 ; i<3 ; i++)
{
fv[0][i] = pfinalverts[ptri->vertindex[i]];
-
+
if (!ptri->facesfront && (fv[0][i].flags & ALIAS_ONSEAM) )
fv[0][i].v[2] += r_affinetridesc.seamfixupX16;
}
}
-// clip
+ // clip
clipflags = fv[0][0].flags | fv[0][1].flags | fv[0][2].flags;
if (clipflags & ALIAS_Z_CLIP)
@@ -308,12 +308,12 @@
fv[pingpong][i].flags = 0;
}
-// draw triangles
+ // draw triangles
mtri.facesfront = ptri->facesfront;
r_affinetridesc.ptriangles = &mtri;
r_affinetridesc.pfinalverts = fv[pingpong];
-// FIXME: do all at once as trifan?
+ // FIXME: do all at once as trifan?
mtri.vertindex[0] = 0;
for (i=1 ; i<k-1 ; i++)
{
--- a/r_alias.c
+++ b/r_alias.c
@@ -25,11 +25,10 @@
static maliasskindesc_t *pskindesc;
-int r_amodels_drawn;
-int a_skinwidth;
-int r_anumverts;
+static int a_skinwidth;
+static int r_anumverts;
-float aliastransform[3][4];
+static float aliastransform[3][4];
typedef struct {
int index0;
@@ -73,9 +72,9 @@
qboolean zclipped, zfullyclipped;
unsigned anyclip, allclip;
int minz;
-
-// expand, rotate, and translate points into worldspace
+ // expand, rotate, and translate points into worldspace
+
currententity->trivial_accept = 0;
pmodel = currententity->model;
pahdr = Mod_Extradata (pmodel);
@@ -83,9 +82,9 @@
R_AliasSetUpTransform (0);
-// construct the base bounding box for this frame
+ // construct the base bounding box for this frame
frame = currententity->frame;
-// TODO: don't repeat this check when drawing?
+ // TODO: don't repeat this check when drawing?
if ((frame >= pmdl->numframes) || (frame < 0))
{
Con_DPrintf("No such frame %d %s\n", frame, pmodel->name);
@@ -94,23 +93,21 @@
pframedesc = &pahdr->frames[frame];
-// x worldspace coordinates
+ // x worldspace coordinates
basepts[0][0] = basepts[1][0] = basepts[2][0] = basepts[3][0] =
(float)pframedesc->bboxmin.v[0];
basepts[4][0] = basepts[5][0] = basepts[6][0] = basepts[7][0] =
(float)pframedesc->bboxmax.v[0];
-// y worldspace coordinates
+ // y worldspace coordinates
basepts[0][1] = basepts[3][1] = basepts[5][1] = basepts[6][1] =
(float)pframedesc->bboxmin.v[1];
basepts[1][1] = basepts[2][1] = basepts[4][1] = basepts[7][1] =
(float)pframedesc->bboxmax.v[1];
-// z worldspace coordinates
- basepts[0][2] = basepts[1][2] = basepts[4][2] = basepts[5][2] =
- (float)pframedesc->bboxmin.v[2];
- basepts[2][2] = basepts[3][2] = basepts[6][2] = basepts[7][2] =
- (float)pframedesc->bboxmax.v[2];
+ // z worldspace coordinates
+ basepts[0][2] = basepts[1][2] = basepts[4][2] = basepts[5][2] = (float)pframedesc->bboxmin.v[2];
+ basepts[2][2] = basepts[3][2] = basepts[6][2] = basepts[7][2] = (float)pframedesc->bboxmax.v[2];
zclipped = false;
zfullyclipped = true;
@@ -122,7 +119,7 @@
if (viewaux[i].fv[2] < ALIAS_Z_CLIP_PLANE)
{
- // we must clip points that are closer than the near clip plane
+ // we must clip points that are closer than the near clip plane
viewpts[i].flags = ALIAS_Z_CLIP;
zclipped = true;
}
@@ -135,7 +132,7 @@
}
}
-
+
if (zfullyclipped)
{
return false; // everything was near-z-clipped
@@ -145,17 +142,16 @@
if (zclipped)
{
- // organize points by edges, use edges to get new points (possible trivial
- // reject)
+ // organize points by edges, use edges to get new points (possible trivial reject)
for (i=0 ; i<12 ; i++)
{
- // edge endpoints
+ // edge endpoints
pv0 = &viewpts[aedges[i].index0];
pv1 = &viewpts[aedges[i].index1];
pa0 = &viewaux[aedges[i].index0];
pa1 = &viewaux[aedges[i].index1];
- // if one end is clipped and the other isn't, make a new point
+ // if one end is clipped and the other isn't, make a new point
if (pv0->flags ^ pv1->flags)
{
frac = (ALIAS_Z_CLIP_PLANE - pa0->fv[2]) /
@@ -171,11 +167,11 @@
}
}
-// project the vertices that remain after clipping
+ // project the vertices that remain after clipping
anyclip = 0;
allclip = ALIAS_XY_CLIP_MASK;
-// TODO: probably should do this loop in ASM, especially if we use floats
+ // TODO: probably should do this loop in ASM, especially if we use floats
for (i=0 ; i<numv ; i++)
{
// we don't need to bother with vertices that were z-clipped
@@ -184,7 +180,7 @@
zi = 1.0 / viewaux[i].fv[2];
- // FIXME: do with chop mode in ASM, or convert to float
+ // FIXME: do with chop mode in ASM, or convert to float
v0 = (viewaux[i].fv[0] * xscale * zi) + xcenter;
v1 = (viewaux[i].fv[1] * yscale * zi) + ycenter;
@@ -270,13 +266,11 @@
if (fv->v[0] > r_refdef.aliasvrectright)
fv->flags |= ALIAS_RIGHT_CLIP;
if (fv->v[1] > r_refdef.aliasvrectbottom)
- fv->flags |= ALIAS_BOTTOM_CLIP;
+ fv->flags |= ALIAS_BOTTOM_CLIP;
}
}
-//
-// clip and draw all triangles
-//
+ // clip and draw all triangles
r_affinetridesc.numtriangles = 1;
ptri = (mtriangle_t *)((byte *)paliashdr + paliashdr->triangles);
@@ -288,7 +282,7 @@
if ( pfv[0]->flags & pfv[1]->flags & pfv[2]->flags & (ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) )
continue; // completely clipped
-
+
if ( ! ( (pfv[0]->flags | pfv[1]->flags | pfv[2]->flags) &
(ALIAS_XY_CLIP_MASK | ALIAS_Z_CLIP) ) )
{ // totally unclipped
@@ -296,7 +290,7 @@
r_affinetridesc.ptriangles = ptri;
D_PolysetDraw ();
}
- else
+ else
{ // partially clipped
R_AliasClipTriangle (ptri);
}
@@ -317,9 +311,9 @@
static float viewmatrix[3][4];
vec3_t angles;
-// TODO: should really be stored with the entity instead of being reconstructed
-// TODO: should use a look-up table
-// TODO: could cache lazily, stored in the entity
+ // TODO: should really be stored with the entity instead of being reconstructed
+ // TODO: should use a look-up table
+ // TODO: could cache lazily, stored in the entity
angles[ROLL] = currententity->angles[ROLL];
angles[PITCH] = -currententity->angles[PITCH];
@@ -347,26 +341,26 @@
t2matrix[1][3] = -modelorg[1];
t2matrix[2][3] = -modelorg[2];
-// FIXME: can do more efficiently than full concatenation
+ // FIXME: can do more efficiently than full concatenation
R_ConcatTransforms (t2matrix, tmatrix, rotationmatrix);
-// TODO: should be global, set when vright, etc., set
+ // TODO: should be global, set when vright, etc., set
VectorCopy (vright, viewmatrix[0]);
VectorCopy (vup, viewmatrix[1]);
VectorInverse (viewmatrix[1]);
VectorCopy (vpn, viewmatrix[2]);
-// viewmatrix[0][3] = 0;
-// viewmatrix[1][3] = 0;
-// viewmatrix[2][3] = 0;
+ // viewmatrix[0][3] = 0;
+ // viewmatrix[1][3] = 0;
+ // viewmatrix[2][3] = 0;
R_ConcatTransforms (viewmatrix, rotationmatrix, aliastransform);
-// do the scaling up of x and y to screen coordinates as part of the transform
-// for the unclipped case (it would mess up clipping in the clipped case).
-// Also scale down z, so 1/z is scaled 31 bits for free, and scale down x and y
-// correspondingly so the projected x and y come out right
-// FIXME: make this work for clipped case too?
+ // do the scaling up of x and y to screen coordinates as part of the transform
+ // for the unclipped case (it would mess up clipping in the clipped case).
+ // Also scale down z, so 1/z is scaled 31 bits for free, and scale down x and y
+ // correspondingly so the projected x and y come out right
+ // FIXME: make this work for clipped case too?
if (trivial_accept)
{
for (i=0 ; i<4 ; i++)
@@ -405,7 +399,7 @@
fv->flags = pstverts->onseam;
-// lighting
+ // lighting
plightnormal = r_avertexnormals[pverts->lightnormalindex];
lightcos = DotProduct (plightnormal, r_plightvec);
temp = r_ambientlight;
@@ -414,8 +408,8 @@
{
temp += (int)(r_shadelight * lightcos);
- // clamp; because we limited the minimum ambient and shading light, we
- // don't have to clamp low light, just bright
+ // clamp; because we limited the minimum ambient and shading light, we
+ // don't have to clamp low light, just bright
if (temp < 0)
temp = 0;
}
@@ -439,13 +433,13 @@
for (i=0 ; i<r_anumverts ; i++, fv++, pverts++, pstverts++)
{
- // transform and project
+ // transform and project
zi = 1.0 / (DotProduct_(pverts->v, aliastransform[2]) +
aliastransform[2][3]);
- // x, y, and z are scaled down by 1/2**31 in the transform, so 1/z is
- // scaled up by 1/2**31, and the scaling cancels out for x and y in the
- // projection
+ // x, y, and z are scaled down by 1/2**31 in the transform, so 1/z is
+ // scaled up by 1/2**31, and the scaling cancels out for x and y in the
+ // projection
fv->v[5] = zi;
fv->v[0] = ((DotProduct_(pverts->v, aliastransform[0]) +
@@ -457,7 +451,7 @@
fv->v[3] = pstverts->t;
fv->flags = pstverts->onseam;
- // lighting
+ // lighting
plightnormal = r_avertexnormals[pverts->lightnormalindex];
lightcos = DotProduct (plightnormal, r_plightvec);
temp = r_ambientlight;
@@ -466,8 +460,8 @@
{
temp += (int)(r_shadelight * lightcos);
- // clamp; because we limited the minimum ambient and shading light, we
- // don't have to clamp low light, just bright
+ // clamp; because we limited the minimum ambient and shading light, we
+ // don't have to clamp low light, just bright
if (temp < 0)
temp = 0;
}
@@ -486,7 +480,7 @@
{
float zi;
-// project points
+ // project points
zi = 1.0 / av->fv[2];
fv->v[5] = zi * ziscale;
@@ -508,7 +502,7 @@
pstverts = (stvert_t *)((byte *)paliashdr + paliashdr->stverts);
r_anumverts = pmdl->numverts;
-// FIXME: just use pfinalverts directly?
+ // FIXME: just use pfinalverts directly?
fv = pfinalverts;
R_AliasTransformAndProjectFinalVerts (fv, pstverts);
@@ -556,20 +550,20 @@
((byte *)paliashdr + paliasskingroup->intervals);
numskins = paliasskingroup->numskins;
fullskininterval = pskinintervals[numskins-1];
-
+
skintime = cl.time + currententity->syncbase;
-
- // when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval
- // values are positive, so we don't have to worry about division by 0
+
+ // when loading in Mod_LoadAliasSkinGroup, we guaranteed all interval
+ // values are positive, so we don't have to worry about division by 0
skintargettime = skintime -
((int)(skintime / fullskininterval)) * fullskininterval;
-
+
for (i=0 ; i<(numskins-1) ; i++)
{
if (pskinintervals[i] > skintargettime)
break;
}
-
+
pskindesc = &paliasskingroup->skindescs[i];
}
@@ -587,9 +581,8 @@
*/
void R_AliasSetupLighting (alight_t *plighting)
{
-
-// guarantee that no vertex will ever be lit below LIGHT_MIN, so we don't have
-// to clamp off the bottom
+ // guarantee that no vertex will ever be lit below LIGHT_MIN, so we don't have
+ // to clamp off the bottom
r_ambientlight = plighting->ambientlight;
if (r_ambientlight < LIGHT_MIN)
@@ -607,7 +600,7 @@
r_shadelight *= VID_GRADES;
-// rotate the lighting vector into the model's frame of reference
+ // rotate the lighting vector into the model's frame of reference
r_plightvec[0] = DotProduct (plighting->plightvec, alias_forward);
r_plightvec[1] = -DotProduct (plighting->plightvec, alias_right);
r_plightvec[2] = DotProduct (plighting->plightvec, alias_up);
@@ -640,7 +633,7 @@
((byte *)paliashdr + paliashdr->frames[frame].frame);
return;
}
-
+
paliasgroup = (maliasgroup_t *)
((byte *)paliashdr + paliashdr->frames[frame].frame);
pintervals = (float *)((byte *)paliashdr + paliasgroup->intervals);
@@ -649,10 +642,8 @@
time = cl.time + currententity->syncbase;
-//
-// when loading in Mod_LoadAliasGroup, we guaranteed all interval values
-// are positive, so we don't have to worry about division by 0
-//
+ // when loading in Mod_LoadAliasGroup, we guaranteed all interval values
+ // are positive, so we don't have to worry about division by 0
targettime = time - ((int)(time / fullinterval)) * fullinterval;
for (i=0 ; i<(numframes-1) ; i++)
@@ -676,9 +667,7 @@
static finalvert_t finalverts[MAXALIASVERTS];
static auxvert_t auxverts[MAXALIASVERTS];
- r_amodels_drawn++;
-
-// cache align
+ // cache align
pfinalverts = finalverts;
pauxverts = auxverts;
--- a/r_bsp.c
+++ b/r_bsp.c
@@ -70,13 +70,13 @@
{
float angle, s, c, temp1[3][3], temp2[3][3], temp3[3][3];
-// TODO: should use a look-up table
-// TODO: should really be stored with the entity instead of being reconstructed
-// TODO: could cache lazily, stored in the entity
-// TODO: share work with R_SetUpAliasTransform
+ // TODO: should use a look-up table
+ // TODO: should really be stored with the entity instead of being reconstructed
+ // TODO: could cache lazily, stored in the entity
+ // TODO: share work with R_SetUpAliasTransform
-// yaw
- angle = currententity->angles[YAW];
+ // yaw
+ angle = currententity->angles[YAW];
angle = angle * M_PI*2 / 360;
s = sin(angle);
c = cos(angle);
@@ -92,8 +92,8 @@
temp1[2][2] = 1;
-// pitch
- angle = currententity->angles[PITCH];
+ // pitch
+ angle = currententity->angles[PITCH];
angle = angle * M_PI*2 / 360;
s = sin(angle);
c = cos(angle);
@@ -110,8 +110,8 @@
R_ConcatRotations (temp2, temp1, temp3);
-// roll
- angle = currententity->angles[ROLL];
+ // roll
+ angle = currententity->angles[ROLL];
angle = angle * M_PI*2 / 360;
s = sin(angle);
c = cos(angle);
@@ -128,9 +128,7 @@
R_ConcatRotations (temp1, temp3, entity_rotation);
-//
-// rotate modelorg and the transformation matrix
-//
+ // rotate modelorg and the transformation matrix
R_EntityRotate (modelorg);
R_EntityRotate (vpn);
R_EntityRotate (vright);
@@ -159,8 +157,8 @@
makeclippededge = false;
-// transform the BSP plane into model space
-// FIXME: cache these?
+ // transform the BSP plane into model space
+ // FIXME: cache these?
splitplane = pnode->plane;
tplane.dist = splitplane->dist - DotProduct(r_entorigin, splitplane->normal);
tplane.normal[0] = DotProduct (entity_rotation[0], splitplane->normal);
@@ -167,13 +165,13 @@
tplane.normal[1] = DotProduct (entity_rotation[1], splitplane->normal);
tplane.normal[2] = DotProduct (entity_rotation[2], splitplane->normal);
-// clip edges to BSP plane
+ // clip edges to BSP plane
for ( ; pedges ; pedges = pnextedge)
{
pnextedge = pedges->pnext;
- // set the status for the last point as the previous point
- // FIXME: cache this stuff somehow?
+ // set the status for the last point as the previous point
+ // FIXME: cache this stuff somehow?
plastvert = pedges->v[0];
lastdist = DotProduct (plastvert->position, tplane.normal) -
tplane.dist;
@@ -182,15 +180,15 @@
pvert = pedges->v[1];
dist = DotProduct (pvert->position, tplane.normal) - tplane.dist;
side = dist <= 0;
-
+
if (side != lastside)
{
- // clipped
+ // clipped
if (numbverts >= MAX_BMODEL_VERTS)
return;
- // generate the clipped vertex
+ // generate the clipped vertex
frac = lastdist / (lastdist - dist);
ptvert = &pbverts[numbverts++];
ptvert->position[0] = plastvert->position[0] +
@@ -203,9 +201,9 @@
frac * (pvert->position[2] -
plastvert->position[2]);
- // split into two edges, one on each side, and remember entering
- // and exiting points
- // FIXME: share the clip edge by having a winding direction flag?
+ // split into two edges, one on each side, and remember entering
+ // and exiting points
+ // FIXME: share the clip edge by having a winding direction flag?
if (numbedges >= (MAX_BMODEL_EDGES - 1))
{
Con_Printf ("Out of edges for bmodel\n");
@@ -228,7 +226,7 @@
if (side == 0)
{
- // entering for front, exiting for back
+ // entering for front, exiting for back
pfrontenter = ptvert;
makeclippededge = true;
}
@@ -246,8 +244,8 @@
}
}
-// if anything was clipped, reconstitute and add the edges along the clip
-// plane to both sides (but in opposite directions)
+ // if anything was clipped, reconstitute and add the edges along the clip
+ // plane to both sides (but in opposite directions)
if (makeclippededge)
{
if (numbedges >= (MAX_BMODEL_EDGES - 2))
@@ -271,16 +269,16 @@
numbedges += 2;
}
-// draw or recurse further
+ // draw or recurse further
for (i=0 ; i<2 ; i++)
{
if (psideedges[i])
{
- // draw if we've reached a non-solid leaf, done if all that's left is a
- // solid leaf, and continue down the tree if it's not a leaf
+ // draw if we've reached a non-solid leaf, done if all that's left is a
+ // solid leaf, and continue down the tree if it's not a leaf
pn = pnode->children[i];
- // we're done with this branch if the node or leaf isn't in the PVS
+ // we're done with this branch if the node or leaf isn't in the PVS
if (pn->visframe == r_visframecount)
{
if (pn->contents < 0)
@@ -322,7 +320,7 @@
if(entdrawflags(currententity) ^ r_drawflags)
return;
-// FIXME: use bounding-box-based frustum clipping info?
+ // FIXME: use bounding-box-based frustum clipping info?
psurf = &pmodel->surfaces[pmodel->firstmodelsurface];
numsurfaces = pmodel->nummodelsurfaces;
@@ -330,20 +328,20 @@
for (i=0 ; i<numsurfaces ; i++, psurf++)
{
- // find which side of the node we are on
+ // find which side of the node we are on
pplane = psurf->plane;
dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
- // draw the polygon
+ // draw the polygon
if ((dot > 0) ^ !!(psurf->flags & SURF_PLANEBACK))
{
- // FIXME: use bounding-box-based frustum clipping info?
+ // FIXME: use bounding-box-based frustum clipping info?
- // copy the edges to bedges, flipping if necessary so always
- // clockwise winding
- // FIXME: if edges and vertices get caches, these assignments must move
- // outside the loop, and overflow checking must be done here
+ // copy the edges to bedges, flipping if necessary so always
+ // clockwise winding
+ // FIXME: if edges and vertices get caches, these assignments must move
+ // outside the loop, and overflow checking must be done here
pbverts = bverts;
pbedges = bedges;
numbverts = numbedges = 0;
@@ -391,7 +389,7 @@
int numsurfaces;
mplane_t *pplane;
-// FIXME: use bounding-box-based frustum clipping info?
+ // FIXME: use bounding-box-based frustum clipping info?
if(entdrawflags(currententity) ^ r_drawflags)
return;
@@ -401,17 +399,17 @@
for (i=0 ; i<numsurfaces ; i++, psurf++)
{
- // find which side of the node we are on
+ // find which side of the node we are on
pplane = psurf->plane;
dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
- // draw the polygon
+ // draw the polygon
if ((dot > 0) ^ !!(psurf->flags & SURF_PLANEBACK))
{
r_currentkey = ((mleaf_t *)currententity->topnode)->key;
- // FIXME: use bounding-box-based frustum clipping info?
+ // FIXME: use bounding-box-based frustum clipping info?
R_RenderFace (psurf, clipflags);
}
}
@@ -439,9 +437,9 @@
if (node->visframe != r_visframecount)
return;
-// cull the clipping planes if not trivial accept
-// FIXME: the compiler is doing a lousy job of optimizing here; it could be
-// twice as fast in ASM
+ // cull the clipping planes if not trivial accept
+ // FIXME: the compiler is doing a lousy job of optimizing here; it could be
+ // twice as fast in ASM
if (clipflags)
{
for (i=0 ; i<4 ; i++)
@@ -449,9 +447,9 @@
if (! (clipflags & (1<<i)) )
continue; // don't need to clip against it
- // generate accept and reject points
- // FIXME: do with fast look-ups or integer tests based on the sign bit
- // of the floating point values
+ // generate accept and reject points
+ // FIXME: do with fast look-ups or integer tests based on the sign bit
+ // of the floating point values
pindex = pfrustum_indexes[i];
@@ -458,7 +456,7 @@
rejectpt[0] = node->minmaxs[pindex[0]];
rejectpt[1] = node->minmaxs[pindex[1]];
rejectpt[2] = node->minmaxs[pindex[2]];
-
+
d = DotProduct (rejectpt, view_clipplanes[i].normal);
d -= view_clipplanes[i].dist;
@@ -476,8 +474,8 @@
clipflags &= ~(1<<i); // node is entirely on screen
}
}
-
-// if a leaf node, draw stuff
+
+ // if a leaf node, draw stuff
if (node->contents < 0)
{
pleaf = (mleaf_t *)node;
@@ -494,7 +492,7 @@
} while (--c);
}
- // deal with model fragments in this leaf
+ // deal with model fragments in this leaf
if (pleaf->efrags)
{
R_StoreEfrags (&pleaf->efrags);
@@ -505,18 +503,18 @@
}
else
{
- // node is just a decision point, so go down the apropriate sides
+ // node is just a decision point, so go down the apropriate sides
- // find which side of the node we are on
+ // find which side of the node we are on
plane = node->plane;
dot = plane->type <= PLANE_Z ? modelorg[plane->type] : DotProduct(modelorg, plane->normal);
dot -= plane->dist;
side = dot < 0;
- // recurse down the children, front side first
+ // recurse down the children, front side first
R_RecursiveWorldNode (node->children[side], clipflags);
- // draw stuff
+ // draw stuff
c = node->numsurfaces;
if(c){
@@ -546,11 +544,11 @@
node_rejects[num_node_rejects++].clipflags = clipflags;
}
- // all surfaces on the same node share the same sequence number
+ // all surfaces on the same node share the same sequence number
r_currentkey++;
}
- // recurse down the back side
+ // recurse down the back side
node = node->children[!side];
goto again;
}
--- a/r_draw.c
+++ b/r_draw.c
@@ -95,17 +95,17 @@
else
{
world = &pv0->position[0];
-
- // transform and project
+
+ // transform and project
VectorSubtract (world, modelorg, local);
TransformVector (local, transformed);
-
+
if (transformed[2] < NEAR_CLIP)
transformed[2] = NEAR_CLIP;
-
+
lzi0 = 1.0 / transformed[2];
-
- // FIXME: build x/yscale into transform?
+
+ // FIXME: build x/yscale into transform?
u0 = xcenter + xscale*lzi0*transformed[0];
u0 = clamp(u0, r_refdef.fvrectx_adj, r_refdef.fvrectright_adj);
v0 = ycenter - yscale*lzi0*transformed[1];
@@ -115,7 +115,7 @@
world = &pv1->position[0];
-// transform and project
+ // transform and project
VectorSubtract (world, modelorg, local);
TransformVector (local, transformed);
@@ -133,7 +133,7 @@
if (lzi0 > r_nearzi) // for mipmap finding
r_nearzi = lzi0;
-// for right edges, all we want is the effect on 1/z
+ // for right edges, all we want is the effect on 1/z
if (r_nearzionly)
return;
@@ -141,10 +141,10 @@
r_ceilv1 = (int)ceil(r_v1);
-// create the edge
+ // create the edge
if (ceilv0 == r_ceilv1)
{
- // we cache unclipped horizontal edges as fully clipped
+ // we cache unclipped horizontal edges as fully clipped
if (cacheoffset != 0x7FFFFFFF)
{
cacheoffset = FULLY_CLIPPED_CACHED |
@@ -160,7 +160,7 @@
if (ceilv0 <= r_ceilv1)
{
- // trailing edge (go from p1 to p2)
+ // trailing edge (go from p1 to p2)
v = ceilv0;
v2 = r_ceilv1 - 1;
@@ -172,7 +172,7 @@
}
else
{
- // leading edge (go from p2 to p1)
+ // leading edge (go from p2 to p1)
v2 = ceilv0 - 1;
v = r_ceilv1;
@@ -188,9 +188,7 @@
/* with all the clamping before this one shouldn't be needed but kept to be 100% sure */
edge->u = clamp(edge->u, r_refdef.vrect_x_adj_shift20, r_refdef.vrectright_adj_shift20);
-//
-// sort the edge in normally
-//
+ // sort the edge in normally
u_check = edge->u;
if (edge->surfs[0])
u_check++; // sort trailers after leaders
@@ -230,7 +228,7 @@
if (d0 >= 0)
{
- // point 0 is unclipped
+ // point 0 is unclipped
if (d1 >= 0)
{
// both points are unclipped
@@ -237,9 +235,9 @@
continue;
}
- // only point 1 is clipped
+ // only point 1 is clipped
- // we don't cache clipped edges
+ // we don't cache clipped edges
cacheoffset = 0x7FFFFFFF;
f = d0 / (d0 - d1);
@@ -266,11 +264,11 @@
}
else
{
- // point 0 is clipped
+ // point 0 is clipped
if (d1 < 0)
{
- // both points are clipped
- // we do cache fully clipped edges
+ // both points are clipped
+ // we do cache fully clipped edges
if (!r_leftclipped)
cacheoffset = FULLY_CLIPPED_CACHED |
(r_framecount & FRAMECOUNT_MASK);
@@ -277,10 +275,10 @@
return;
}
- // only point 0 is clipped
+ // only point 0 is clipped
r_lastvertvalid = false;
- // we don't cache partially clipped edges
+ // we don't cache partially clipped edges
cacheoffset = 0x7FFFFFFF;
f = d0 / (d0 - d1);
@@ -307,7 +305,7 @@
}
}
-// add the edge
+ // add the edge
R_EmitEdge (pv0, pv1);
}
@@ -354,13 +352,13 @@
if((surfdrawflags(fa->flags) | entdrawflags(currententity)) ^ r_drawflags)
return 0;
-// skip out if no more surfs
+ // skip out if no more surfs
if (surface_p >= surf_max){
r_outofsurfaces++;
return 1;
}
-// ditto if not enough edges left, or switch to auxedges if possible
+ // ditto if not enough edges left, or switch to auxedges if possible
if (edge_p + fa->numedges + 4 >= edge_max){
r_outofedges += fa->numedges;
return 1;
@@ -368,7 +366,7 @@
c_faceclip++;
-// set up clip planes
+ // set up clip planes
pclip = nil;
for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
@@ -380,7 +378,7 @@
}
}
-// push the edges through
+ // push the edges through
r_emitted = 0;
r_nearzi = 0;
r_nearzionly = false;
@@ -396,7 +394,7 @@
{
r_pedge = &pedges[lindex];
- // if the edge is cached, we can just reuse the edge
+ // if the edge is cached, we can just reuse the edge
if (!insubmodel)
{
if (r_pedge->cachededgeoffset & FULLY_CLIPPED_CACHED)
@@ -419,7 +417,7 @@
}
}
- // assume it's cacheable
+ // assume it's cacheable
cacheoffset = (byte *)edge_p - (byte *)r_edges;
r_leftclipped = r_rightclipped = false;
R_ClipEdge (&r_pcurrentvertbase[r_pedge->v[0]],
@@ -437,7 +435,7 @@
{
lindex = -lindex;
r_pedge = &pedges[lindex];
- // if the edge is cached, we can just reuse the edge
+ // if the edge is cached, we can just reuse the edge
if (!insubmodel)
{
if (r_pedge->cachededgeoffset & FULLY_CLIPPED_CACHED)
@@ -462,7 +460,7 @@
}
}
- // assume it's cacheable
+ // assume it's cacheable
cacheoffset = (byte *)edge_p - (byte *)r_edges;
r_leftclipped = r_rightclipped = false;
R_ClipEdge (&r_pcurrentvertbase[r_pedge->v[1]],
@@ -478,9 +476,9 @@
}
}
-// if there was a clip off the left edge, add that edge too
-// FIXME: faster to do in screen space?
-// FIXME: share clipped edges?
+ // if there was a clip off the left edge, add that edge too
+ // FIXME: faster to do in screen space?
+ // FIXME: share clipped edges?
if (makeleftedge)
{
r_pedge = &tedge;
@@ -488,7 +486,7 @@
R_ClipEdge (&r_leftexit, &r_leftenter, pclip->next);
}
-// if there was a clip off the right edge, get the right r_nearzi
+ // if there was a clip off the right edge, get the right r_nearzi
if (makerightedge)
{
r_pedge = &tedge;
@@ -497,7 +495,7 @@
R_ClipEdge (&r_rightexit, &r_rightenter, view_clipplanes[1].next);
}
-// if no edges made it out, return without posting the surface
+ // if no edges made it out, return without posting the surface
if (!r_emitted)
return 1;
@@ -513,9 +511,9 @@
surface_p->spans = nil;
pplane = fa->plane;
-// FIXME: cache this?
+ // FIXME: cache this?
TransformVector (pplane->normal, p_normal);
-// FIXME: cache this?
+ // FIXME: cache this?
distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal));
surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv;
@@ -524,7 +522,7 @@
xcenter * surface_p->d_zistepu -
ycenter * surface_p->d_zistepv;
-//JDC VectorCopy (r_worldmodelorg, surface_p->modelorg);
+ //JDC VectorCopy (r_worldmodelorg, surface_p->modelorg);
surface_p++;
return 1;
@@ -546,7 +544,7 @@
clipplane_t *pclip;
static medge_t tedge;
-// skip out if no more surfs
+ // skip out if no more surfs
if (surface_p >= surf_max)
{
r_outofsurfaces++;
@@ -553,7 +551,7 @@
return;
}
-// ditto if not enough edges left, or switch to auxedges if possible
+ // ditto if not enough edges left, or switch to auxedges if possible
if ((edge_p + psurf->numedges + 4) >= edge_max)
{
r_outofedges += psurf->numedges;
@@ -562,10 +560,10 @@
c_faceclip++;
-// this is a dummy to give the caching mechanism someplace to write to
+ // this is a dummy to give the caching mechanism someplace to write to
r_pedge = &tedge;
-// set up clip planes
+ // set up clip planes
pclip = nil;
for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
@@ -577,13 +575,13 @@
}
}
-// push the edges through
+ // push the edges through
r_emitted = 0;
r_nearzi = 0;
r_nearzionly = false;
makeleftedge = makerightedge = false;
-// FIXME: keep clipped bmodel edges in clockwise order so last vertex caching
-// can be used?
+ // FIXME: keep clipped bmodel edges in clockwise order so last vertex caching
+ // can be used?
r_lastvertvalid = false;
for ( ; pedges ; pedges = pedges->pnext)
@@ -597,9 +595,9 @@
makerightedge = true;
}
-// if there was a clip off the left edge, add that edge too
-// FIXME: faster to do in screen space?
-// FIXME: share clipped edges?
+ // if there was a clip off the left edge, add that edge too
+ // FIXME: faster to do in screen space?
+ // FIXME: share clipped edges?
if (makeleftedge)
{
r_pedge = &tedge;
@@ -606,7 +604,7 @@
R_ClipEdge (&r_leftexit, &r_leftenter, pclip->next);
}
-// if there was a clip off the right edge, get the right r_nearzi
+ // if there was a clip off the right edge, get the right r_nearzi
if (makerightedge)
{
r_pedge = &tedge;
@@ -614,7 +612,7 @@
R_ClipEdge (&r_rightexit, &r_rightenter, view_clipplanes[1].next);
}
-// if no edges made it out, return without posting the surface
+ // if no edges made it out, return without posting the surface
if (!r_emitted)
return;
@@ -630,9 +628,9 @@
surface_p->spans = nil;
pplane = psurf->plane;
-// FIXME: cache this?
+ // FIXME: cache this?
TransformVector (pplane->normal, p_normal);
-// FIXME: cache this?
+ // FIXME: cache this?
distinv = 1.0 / (pplane->dist - DotProduct (modelorg, pplane->normal));
surface_p->d_zistepu = p_normal[0] * xscaleinv * distinv;
@@ -641,7 +639,7 @@
xcenter * surface_p->d_zistepu -
ycenter * surface_p->d_zistepv;
-//JDC VectorCopy (r_worldmodelorg, surface_p->modelorg);
+ //JDC VectorCopy (r_worldmodelorg, surface_p->modelorg);
surface_p++;
}
@@ -665,12 +663,12 @@
int vertpage, newverts, newpage, lastvert;
qboolean visible;
-// FIXME: clean this up and make it faster
-// FIXME: guard against running out of vertices
+ // FIXME: clean this up and make it faster
+ // FIXME: guard against running out of vertices
s_axis = t_axis = 0; // keep compiler happy
-// set up clip planes
+ // set up clip planes
pclip = nil;
for (i=3, mask = 0x08 ; i>=0 ; i--, mask >>= 1)
@@ -684,8 +682,8 @@
memset(verts, 0, sizeof(verts));
-// reconstruct the polygon
-// FIXME: these should be precalculated and loaded off disk
+ // reconstruct the polygon
+ // FIXME: these should be precalculated and loaded off disk
pedges = currententity->model->edges;
lnumverts = fa->numedges;
vertpage = 0;
@@ -706,7 +704,7 @@
}
}
-// clip the polygon, done if not visible
+ // clip the polygon, done if not visible
while (pclip)
{
lastvert = lnumverts - 1;
@@ -761,8 +759,8 @@
pclip = pclip->next;
}
-// transform and project, remembering the z values at the vertices and
-// r_nearzi, and extract the s and t coordinates at the vertices
+ // transform and project, remembering the z values at the vertices and
+ // r_nearzi, and extract the s and t coordinates at the vertices
pplane = fa->plane;
switch (pplane->type)
{
@@ -787,7 +785,7 @@
for (i=0 ; i<lnumverts ; i++)
{
- // transform and project
+ // transform and project
VectorSubtract (verts[vertpage][i].position, modelorg, local);
TransformVector (local, transformed);
@@ -799,7 +797,7 @@
if (lzi > r_nearzi) // for mipmap finding
r_nearzi = lzi;
- // FIXME: build x/yscale into transform?
+ // FIXME: build x/yscale into transform?
scale = xscale * lzi;
u = (xcenter + scale*transformed[0]);
if (u < r_refdef.fvrectx_adj)
@@ -821,14 +819,14 @@
pverts[i].t = verts[vertpage][i].position[t_axis];
}
-// build the polygon descriptor, including fa, r_nearzi, and u, v, s, t, and z
-// for each vertex
+ // build the polygon descriptor, including fa, r_nearzi, and u, v, s, t, and z
+ // for each vertex
r_polydesc.numverts = lnumverts;
r_polydesc.nearzi = r_nearzi;
r_polydesc.pcurrentface = fa;
r_polydesc.pverts = pverts;
-// draw the polygon
+ // draw the polygon
D_DrawPoly ();
}
@@ -850,13 +848,13 @@
for (i=0 ; i<numsurfaces ; i++, psurf++)
{
- // find which side of the node we are on
+ // find which side of the node we are on
pplane = psurf->plane;
dot = DotProduct (modelorg, pplane->normal) - pplane->dist;
- // draw the polygon
- // FIXME: use bounding-box-based frustum clipping info?
+ // draw the polygon
+ // FIXME: use bounding-box-based frustum clipping info?
if ((dot > 0) ^ !!(psurf->flags & SURF_PLANEBACK))
R_RenderPoly (psurf, 15);
}
--- a/r_edge.c
+++ b/r_edge.c
@@ -110,7 +110,7 @@
edgelist=edgelist->next;
goto edgesearch;
- // insert edgestoadd before edgelist
+ // insert edgestoadd before edgelist
addedge:
edgestoadd->next = edgelist;
edgestoadd->prev = edgelist->prev;
@@ -151,36 +151,36 @@
if (pedge->u < pedge->prev->u)
goto pushback;
pedge = pedge->next;
-
+
pedge->u += pedge->u_step;
if (pedge->u < pedge->prev->u)
goto pushback;
pedge = pedge->next;
-
+
pedge->u += pedge->u_step;
if (pedge->u < pedge->prev->u)
goto pushback;
pedge = pedge->next;
-
+
pedge->u += pedge->u_step;
if (pedge->u < pedge->prev->u)
goto pushback;
pedge = pedge->next;
- goto nextedge;
-
+ goto nextedge;
+
pushback:
if (pedge == &edge_aftertail)
return;
-
- // push it back to keep it sorted
+
+ // push it back to keep it sorted
pnext_edge = pedge->next;
- // pull the edge out of the edge list
+ // pull the edge out of the edge list
pedge->next->prev = pedge->prev;
pedge->prev->next = pedge->next;
- // find out where the edge goes in the edge list
+ // find out where the edge goes in the edge list
pwedge = pedge->prev->prev;
while (pwedge->u > pedge->u)
@@ -188,7 +188,7 @@
pwedge = pwedge->prev;
}
- // put the edge back into the edge list
+ // put the edge back into the edge list
pedge->next = pwedge->next;
pedge->prev = pwedge;
pedge->next->prev = pedge;
@@ -212,8 +212,8 @@
int iu;
espan_t *span;
-// now that we've reached the right edge of the screen, we're done with any
-// unfinished surfaces, so emit a span for whatever's on top
+ // now that we've reached the right edge of the screen, we're done with any
+ // unfinished surfaces, so emit a span for whatever's on top
surf = surfaces[1].next;
iu = edge_tail_u_shift20;
if (iu > surf->last_u)
@@ -226,7 +226,7 @@
surf->spans = span;
}
-// reset spanstate for all surfaces in the surface stack
+ // reset spanstate for all surfaces in the surface stack
do
{
surf->spanstate = 0;
@@ -246,12 +246,12 @@
surf_t *surf, *surf2;
int iu;
-// it's adding a new surface in, so find the correct place
+ // it's adding a new surface in, so find the correct place
surf = &surfaces[edge->surfs[1]];
-// don't start a span if this is an inverted span, with the end
-// edge preceding the start edge (that is, we've already seen the
-// end edge)
+ // don't start a span if this is an inverted span, with the end
+ // edge preceding the start edge (that is, we've already seen the
+ // end edge)
if (++surf->spanstate == 1)
{
surf2 = surfaces[1].next;
@@ -259,12 +259,12 @@
if (surf->key > surf2->key)
goto newtop;
- // if it's two surfaces on the same plane, the one that's already
- // active is in front, so keep going unless it's a bmodel
+ // if it's two surfaces on the same plane, the one that's already
+ // active is in front, so keep going unless it's a bmodel
if (surf->insubmodel && (surf->key == surf2->key))
{
- // must be two bmodels in the same leaf; don't care, because they'll
- // never be farthest anyway
+ // must be two bmodels in the same leaf; don't care, because they'll
+ // never be farthest anyway
goto newtop;
}
@@ -277,19 +277,19 @@
if (surf->key == surf2->key)
{
- // if it's two surfaces on the same plane, the one that's already
- // active is in front, so keep going unless it's a bmodel
+ // if it's two surfaces on the same plane, the one that's already
+ // active is in front, so keep going unless it's a bmodel
if (!surf->insubmodel)
goto continue_search;
- // must be two bmodels in the same leaf; don't care which is really
- // in front, because they'll never be farthest anyway
+ // must be two bmodels in the same leaf; don't care which is really
+ // in front, because they'll never be farthest anyway
}
goto gotposition;
newtop:
- // emit a span (obscures current top)
+ // emit a span (obscures current top)
iu = edge->u >> 20;
if (iu > surf2->last_u)
@@ -304,9 +304,9 @@
// set last_u on the new span
surf->last_u = iu;
-
+
gotposition:
- // insert before surf2
+ // insert before surf2
surf->next = surf2;
surf->prev = surf2->prev;
surf2->prev->next = surf;
@@ -325,14 +325,14 @@
espan_t *span;
int iu;
-// don't generate a span if this is an inverted span, with the end
-// edge preceding the start edge (that is, we haven't seen the
-// start edge yet)
+ // don't generate a span if this is an inverted span, with the end
+ // edge preceding the start edge (that is, we haven't seen the
+ // start edge yet)
if (--surf->spanstate == 0)
{
if (surf == surfaces[1].next)
{
- // emit a span (current top going away)
+ // emit a span (current top going away)
iu = edge->u >> 20;
if (iu > surf->last_u)
{
@@ -344,7 +344,7 @@
surf->spans = span;
}
- // set last_u on the surface below
+ // set last_u on the surface below
surf->next->last_u = iu;
}
@@ -368,12 +368,12 @@
if (edge->surfs[1])
{
- // it's adding a new surface in, so find the correct place
+ // it's adding a new surface in, so find the correct place
surf = &surfaces[edge->surfs[1]];
- // don't start a span if this is an inverted span, with the end
- // edge preceding the start edge (that is, we've already seen the
- // end edge)
+ // don't start a span if this is an inverted span, with the end
+ // edge preceding the start edge (that is, we've already seen the
+ // end edge)
if (++surf->spanstate == 1)
{
surf2 = surfaces[1].next;
@@ -381,11 +381,11 @@
if (surf->key < surf2->key)
goto newtop;
- // if it's two surfaces on the same plane, the one that's already
- // active is in front, so keep going unless it's a bmodel
+ // if it's two surfaces on the same plane, the one that's already
+ // active is in front, so keep going unless it's a bmodel
if (surf->insubmodel && (surf->key == surf2->key))
{
- // must be two bmodels in the same leaf; sort on 1/z
+ // must be two bmodels in the same leaf; sort on 1/z
fu = (float)(edge->u - 0xFFFFF) * (1.0 / 0x100000);
newzi = surf->d_ziorigin + fv*surf->d_zistepv +
fu*surf->d_zistepu;
@@ -418,12 +418,12 @@
if (surf->key == surf2->key)
{
- // if it's two surfaces on the same plane, the one that's already
- // active is in front, so keep going unless it's a bmodel
+ // if it's two surfaces on the same plane, the one that's already
+ // active is in front, so keep going unless it's a bmodel
if (!surf->insubmodel)
goto continue_search;
- // must be two bmodels in the same leaf; sort on 1/z
+ // must be two bmodels in the same leaf; sort on 1/z
fu = (float)(edge->u - 0xFFFFF) * (1.0 / 0x100000);
newzi = surf->d_ziorigin + fv*surf->d_zistepv +
fu*surf->d_zistepu;
@@ -452,7 +452,7 @@
goto gotposition;
newtop:
- // emit a span (obscures current top)
+ // emit a span (obscures current top)
iu = edge->u >> 20;
if (iu > surf2->last_u)
@@ -467,9 +467,9 @@
// set last_u on the new span
surf->last_u = iu;
-
+
gotposition:
- // insert before surf2
+ // insert before surf2
surf->next = surf2;
surf->prev = surf2->prev;
surf2->prev->next = surf;
@@ -489,16 +489,16 @@
edge_t *edge;
surf_t *surf;
-// clear active surfaces to just the background surface
+ // clear active surfaces to just the background surface
surfaces[1].next = surfaces[1].prev = &surfaces[1];
surfaces[1].last_u = edge_head_u_shift20;
-// generate spans
+ // generate spans
for (edge=edge_head.next ; edge != &edge_tail; edge=edge->next)
- {
+ {
if (edge->surfs[0])
{
- // it has a left surface, so a surface is going away for this span
+ // it has a left surface, so a surface is going away for this span
surf = &surfaces[edge->surfs[0]];
R_TrailingEdge (surf, edge);
@@ -517,7 +517,7 @@
==============
R_ScanEdges
-Input:
+Input:
newedges[] array
this has links to edges, which have links to surfaces
@@ -538,8 +538,8 @@
span_p = basespan_p;
r_outofspans = 0;
-// clear active edges to just the background edges around the whole screen
-// FIXME: most of this only needs to be set up once
+ // clear active edges to just the background edges around the whole screen
+ // FIXME: most of this only needs to be set up once
edge_head.u = r_refdef.vrect.x << 20;
edge_head_u_shift20 = edge_head.u >> 20;
edge_head.u_step = 0;
@@ -547,7 +547,7 @@
edge_head.next = &edge_tail;
edge_head.surfs[0] = 0;
edge_head.surfs[1] = 1;
-
+
edge_tail.u = (r_refdef.vrectright << 20) + 0xFFFFF;
edge_tail_u_shift20 = edge_tail.u >> 20;
edge_tail.u_step = 0;
@@ -555,19 +555,17 @@
edge_tail.next = &edge_aftertail;
edge_tail.surfs[0] = 1;
edge_tail.surfs[1] = 0;
-
+
edge_aftertail.u = -1; // force a move
edge_aftertail.u_step = 0;
edge_aftertail.next = &edge_sentinel;
edge_aftertail.prev = &edge_tail;
-// FIXME: do we need this now that we clamp x in r_draw.c?
+ // FIXME: do we need this now that we clamp x in r_draw.c?
edge_sentinel.u = 0x7d << 24; // make sure nothing sorts past this
edge_sentinel.prev = &edge_aftertail;
-//
-// process all scan lines
-//
+ // process all scan lines
bottom = r_refdef.vrectbottom - 1;
for (iv=r_refdef.vrect.y ; iv<bottom ; iv++)
@@ -575,7 +573,7 @@
current_iv = iv;
fv = (float)iv;
- // mark that the head (background start) span is pre-included
+ // mark that the head (background start) span is pre-included
surfaces[1].spanstate = 1;
if (newedges[iv])
@@ -585,14 +583,14 @@
(*pdrawfunc) ();
- // flush the span list if we can't be sure we have enough spans left for
- // the next scan
+ // flush the span list if we can't be sure we have enough spans left for
+ // the next scan
if (span_p >= max_span_p)
{
r_outofspans++;
D_DrawSurfaces ();
- // clear the surface span pointers
+ // clear the surface span pointers
for (s = &surfaces[1] ; s<surface_p ; s++)
s->spans = nil;
@@ -606,12 +604,12 @@
R_StepActiveU (edge_head.next);
}
-// do the last scan (no need to step or sort or remove on the last scan)
+ // do the last scan (no need to step or sort or remove on the last scan)
current_iv = iv;
fv = (float)iv;
-// mark that the head (background start) span is pre-included
+ // mark that the head (background start) span is pre-included
surfaces[1].spanstate = 1;
if (newedges[iv])
@@ -619,7 +617,7 @@
(*pdrawfunc) ();
-// draw whatever's left in the span list
+ // draw whatever's left in the span list
D_DrawSurfaces ();
}
--- a/r_efrag.c
+++ b/r_efrag.c
@@ -30,9 +30,9 @@
void R_RemoveEfrags (entity_t *ent)
{
efrag_t *ef, *old, *walk, **prev;
-
+
ef = ent->efrag;
-
+
while (ef)
{
prev = &ef->leaf->efrags;
@@ -49,16 +49,16 @@
else
prev = &walk->leafnext;
}
-
+
old = ef;
ef = ef->entnext;
-
- // put it on the free list
+
+ // put it on the free list
old->entnext = cl.free_efrags;
cl.free_efrags = old;
}
-
- ent->efrag = nil;
+
+ ent->efrag = nil;
}
/*
@@ -72,14 +72,14 @@
mplane_t *splitplane;
mleaf_t *leaf;
int sides;
-
+
if (node->contents == CONTENTS_SOLID)
{
return;
}
-
-// add an efrag if the node is a leaf
+ // add an efrag if the node is a leaf
+
if ( node->contents < 0)
{
if (!r_pefragtopnode)
@@ -87,7 +87,7 @@
leaf = (mleaf_t *)node;
-// grab an efrag off the free list
+ // grab an efrag off the free list
ef = cl.free_efrags;
if (!ef)
{
@@ -97,25 +97,25 @@
cl.free_efrags = cl.free_efrags->entnext;
ef->entity = r_addent;
-
-// add the entity link
+
+ // add the entity link
*lastlink = ef;
lastlink = &ef->entnext;
ef->entnext = nil;
-
-// set the leaf links
+
+ // set the leaf links
ef->leaf = leaf;
ef->leafnext = leaf->efrags;
leaf->efrags = ef;
-
+
return;
}
-
-// NODE_MIXED
+ // NODE_MIXED
+
splitplane = node->plane;
sides = BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane);
-
+
if (sides == 3)
{
// split on this plane
@@ -123,11 +123,11 @@
if (!r_pefragtopnode)
r_pefragtopnode = node;
}
-
-// recurse down the contacted sides
+
+ // recurse down the contacted sides
if (sides & 1)
R_SplitEntityOnNode (node->children[0]);
-
+
if (sides & 2)
R_SplitEntityOnNode (node->children[1]);
}
@@ -145,7 +145,7 @@
if (node->visframe != r_visframecount)
return;
-
+
if (node->contents < 0)
{
if (node->contents != CONTENTS_SOLID)
@@ -153,18 +153,18 @@
// visible and not BSP clipped
return;
}
-
+
splitplane = node->plane;
sides = BOX_ON_PLANE_SIDE(r_emins, r_emaxs, splitplane);
-
+
if (sides == 3)
{
- // remember first splitter
+ // remember first splitter
r_pefragtopnode = node;
return;
}
-
-// not split yet; recurse down the contacted side
+
+ // not split yet; recurse down the contacted side
if (sides & 1)
R_SplitEntityOnNode2 (node->children[0]);
else
@@ -181,7 +181,7 @@
{
model_t *entmodel;
int i;
-
+
if (!ent->model)
return;
@@ -189,10 +189,10 @@
return; // never add the world
r_addent = ent;
-
+
lastlink = &ent->efrag;
r_pefragtopnode = nil;
-
+
entmodel = ent->model;
for (i=0 ; i<3 ; i++)
--- a/r_light.c
+++ b/r_light.c
@@ -11,10 +11,9 @@
void R_AnimateLight (void)
{
int i,j,k;
-
-//
-// light animations
-// 'm' is normal light, 'a' is no light, 'z' is double bright
+
+ // light animations
+ // 'm' is normal light, 'a' is no light, 'z' is double bright
i = (int)(cl.time*10);
for (j=0 ; j<Nlights ; j++)
{
@@ -27,7 +26,7 @@
k = cl_lightstyle[j].map[k] - 'a';
k = k*22;
d_lightstylevalue[j] = k;
- }
+ }
}
@@ -50,13 +49,13 @@
float dist;
msurface_t *surf;
unsigned i;
-
+
if (node->contents < 0)
return;
splitplane = node->plane;
dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist;
-
+
if (dist > light->radius)
{
R_MarkLights (light, bit, node->children[0]);
@@ -67,8 +66,8 @@
R_MarkLights (light, bit, node->children[1]);
return;
}
-
-// mark the polygons
+
+ // mark the polygons
surf = cl.worldmodel->surfaces + node->firstsurface;
for (i=0 ; i<node->numsurfaces ; i++, surf++)
{
@@ -133,33 +132,33 @@
if (node->contents < 0)
return -1; // didn't hit anything
-
-// calculate mid point
-// FIXME: optimize for axial
+ // calculate mid point
+
+ // FIXME: optimize for axial
plane = node->plane;
front = DotProduct (start, plane->normal) - plane->dist;
back = DotProduct (end, plane->normal) - plane->dist;
side = front < 0;
-
+
if ( (back < 0) == side)
return RecursiveLightPoint (node->children[side], start, end);
-
+
frac = front / (front-back);
mid[0] = start[0] + (end[0] - start[0])*frac;
mid[1] = start[1] + (end[1] - start[1])*frac;
mid[2] = start[2] + (end[2] - start[2])*frac;
-
-// go down front side
+
+ // go down front side
r = RecursiveLightPoint (node->children[side], start, mid);
if (r >= 0)
return r; // hit something
-
+
if ( (back < 0) == side )
return -1; // didn't hit anuthing
-
-// check for impact on this node
+ // check for impact on this node
+
surf = cl.worldmodel->surfaces + node->firstsurface;
for (i=0 ; i<node->numsurfaces ; i++, surf++)
{
@@ -167,7 +166,7 @@
continue; // no lightmaps
tex = surf->texinfo;
-
+
s = DotProductDouble (mid, tex->vecs[0]) + tex->vecs[0][3];
t = DotProductDouble (mid, tex->vecs[1]) + tex->vecs[1][3];;
@@ -174,10 +173,10 @@
if (s < surf->texturemins[0] ||
t < surf->texturemins[1])
continue;
-
+
ds = s - surf->texturemins[0];
dt = t - surf->texturemins[1];
-
+
if ( ds > surf->extents[0] || dt > surf->extents[1] )
continue;
@@ -202,14 +201,14 @@
lightmap += ((surf->extents[0]>>4)+1) *
((surf->extents[1]>>4)+1);
}
-
+
r >>= 8;
}
-
+
return r;
}
-// go down back side
+ // go down back side
return RecursiveLightPoint (node->children[!side], mid, end);
}
@@ -217,16 +216,16 @@
{
vec3_t end;
int r;
-
+
if (!cl.worldmodel->lightdata)
return 255;
-
+
end[0] = p[0];
end[1] = p[1];
end[2] = p[2] - 2048;
-
+
r = RecursiveLightPoint (cl.worldmodel->nodes, p, end);
-
+
if (r == -1)
r = 0;
--- a/r_local.h
+++ b/r_local.h
@@ -187,7 +187,6 @@
#define ALIAS_Z_CLIP_PLANE 5
extern int numverts;
-extern int a_skinwidth;
extern mtriangle_t *ptriangles;
extern int numtriangles;
extern aliashdr_t *paliashdr;
@@ -213,7 +212,6 @@
void R_InitParticles (void);
void R_ClearParticles (void);
-extern int r_amodels_drawn;
extern edge_t *auxedges;
extern int r_numallocatededges;
extern edge_t *r_edges, *edge_p, *edge_max;
--- a/r_main.c
+++ b/r_main.c
@@ -121,16 +121,16 @@
{
int x,y, m;
byte *dest;
-
-// create a simple checkerboard texture for the default
+
+ // create a simple checkerboard texture for the default
r_notexture_mip = Hunk_Alloc(16*16+8*8+4*4+2*2 + sizeof *r_notexture_mip);
-
+
r_notexture_mip->width = r_notexture_mip->height = 16;
r_notexture_mip->offsets[0] = sizeof *r_notexture_mip;
r_notexture_mip->offsets[1] = r_notexture_mip->offsets[0] + 16*16;
r_notexture_mip->offsets[2] = r_notexture_mip->offsets[1] + 8*8;
r_notexture_mip->offsets[3] = r_notexture_mip->offsets[2] + 4*4;
-
+
for (m=0 ; m<4 ; m++)
{
dest = (byte *)r_notexture_mip + r_notexture_mip->offsets[m];
@@ -142,7 +142,7 @@
else
*dest++ = 0xff;
}
- }
+ }
}
static void
@@ -159,10 +159,10 @@
void R_Init (void)
{
int dummy;
-
-// get stack position so we can guess if we are going to overflow
+
+ // get stack position so we can guess if we are going to overflow
r_stack_start = (byte *)&dummy;
-
+
R_InitTurb ();
Cmd_AddCommand("pointfile", loadpoints);
@@ -210,9 +210,9 @@
void R_NewMap (void)
{
int i;
-
-// clear out efrags in case the level hasn't been reloaded
-// FIXME: is this one short?
+
+ // clear out efrags in case the level hasn't been reloaded
+ // FIXME: is this one short?
for (i=0 ; i<cl.worldmodel->numleafs ; i++)
cl.worldmodel->leafs[i].efrags = nil;
@@ -320,21 +320,21 @@
pixelAspect = aspect;
xOrigin = r_refdef.xOrigin;
yOrigin = r_refdef.yOrigin;
-
+
screenAspect = r_refdef.vrect.width*pixelAspect /
r_refdef.vrect.height;
-// 320*200 1.0 pixelAspect = 1.6 screenAspect
-// 320*240 1.0 pixelAspect = 1.3333 screenAspect
-// proper 320*200 pixelAspect = 0.8333333
+ // 320*200 1.0 pixelAspect = 1.6 screenAspect
+ // 320*240 1.0 pixelAspect = 1.3333 screenAspect
+ // proper 320*200 pixelAspect = 0.8333333
verticalFieldOfView = r_refdef.horizontalFieldOfView / screenAspect;
-// values for perspective projection
-// if math were exact, the values would range from 0.5 to to range+0.5
-// hopefully they wll be in the 0.000001 to range+.999999 and truncate
-// the polygon rasterization will never render in the first row or column
-// but will definately render in the [range] row and column, so adjust the
-// buffer origin to get an exact edge to edge fill
+ // values for perspective projection
+ // if math were exact, the values would range from 0.5 to to range+0.5
+ // hopefully they wll be in the 0.000001 to range+.999999 and truncate
+ // the polygon rasterization will never render in the first row or column
+ // but will definately render in the [range] row and column, so adjust the
+ // buffer origin to get an exact edge to edge fill
xcenter = ((float)r_refdef.vrect.width * XCENTERING) +
r_refdef.vrect.x - 0.5;
aliasxcenter = xcenter * r_aliasuvscale;
@@ -351,31 +351,31 @@
xscaleshrink = (r_refdef.vrect.width-6)/r_refdef.horizontalFieldOfView;
yscaleshrink = xscaleshrink*pixelAspect;
-// left side clip
+ // left side clip
screenedge[0].normal[0] = -1.0 / (xOrigin*r_refdef.horizontalFieldOfView);
screenedge[0].normal[1] = 0;
screenedge[0].normal[2] = 1;
screenedge[0].type = PLANE_ANYZ;
-
-// right side clip
+
+ // right side clip
screenedge[1].normal[0] =
1.0 / ((1.0-xOrigin)*r_refdef.horizontalFieldOfView);
screenedge[1].normal[1] = 0;
screenedge[1].normal[2] = 1;
screenedge[1].type = PLANE_ANYZ;
-
-// top side clip
+
+ // top side clip
screenedge[2].normal[0] = 0;
screenedge[2].normal[1] = -1.0 / (yOrigin*verticalFieldOfView);
screenedge[2].normal[2] = 1;
screenedge[2].type = PLANE_ANYZ;
-
-// bottom side clip
+
+ // bottom side clip
screenedge[3].normal[0] = 0;
screenedge[3].normal[1] = 1.0 / ((1.0-yOrigin)*verticalFieldOfView);
- screenedge[3].normal[2] = 1;
+ screenedge[3].normal[2] = 1;
screenedge[3].type = PLANE_ANYZ;
-
+
for (i=0 ; i<4 ; i++)
VectorNormalize (screenedge[i].normal);
@@ -402,7 +402,7 @@
if (r_oldviewleaf == r_viewleaf)
return;
-
+
r_visframecount++;
r_oldviewleaf = r_viewleaf;
@@ -452,9 +452,9 @@
{
for (i=0 ; i<4 ; i++)
{
- // generate accept and reject points
- // FIXME: do with fast look-ups or integer tests based on the sign bit
- // of the floating point values
+ // generate accept and reject points
+ // FIXME: do with fast look-ups or integer tests based on the sign bit
+ // of the floating point values
pindex = pfrustum_indexes[i];
@@ -461,7 +461,7 @@
rejectpt[0] = minmaxs[pindex[0]];
rejectpt[1] = minmaxs[pindex[1]];
rejectpt[2] = minmaxs[pindex[2]];
-
+
d = DotProduct (rejectpt, view_clipplanes[i].normal);
d -= view_clipplanes[i].dist;
@@ -605,7 +605,7 @@
break;
}
- // put back world rotation and frustum clipping
+ // put back world rotation and frustum clipping
// FIXME: R_RotateBmodel should just work off base_vxx
VectorCopy(base_vpn, vpn);
VectorCopy(base_vup, vup);
@@ -624,7 +624,7 @@
*/
void R_DrawViewModel (void)
{
-// FIXME: remove and do real lighting
+ // FIXME: remove and do real lighting
float lightvec[3] = {-1, 0, 0};
int j;
int lnum;
@@ -631,7 +631,7 @@
vec3_t dist;
float add;
dlight_t *dl;
-
+
if (!r_drawviewmodel.value)
return;
@@ -658,7 +658,7 @@
r_viewlighting.ambientlight = j;
r_viewlighting.shadelight = j;
-// add dynamic lights
+ // add dynamic lights
for (lnum=0 ; lnum<MAX_DLIGHTS ; lnum++)
{
dl = &cl_dlights[lnum];
@@ -671,7 +671,7 @@
r_viewlighting.ambientlight += add;
}
-// clamp lighting so it doesn't overbright as much
+ // clamp lighting so it doesn't overbright as much
if (r_viewlighting.ambientlight > 128)
r_viewlighting.ambientlight = 128;
if (r_viewlighting.ambientlight + r_viewlighting.shadelight > 192)
@@ -778,7 +778,7 @@
void R_InitTurb (void)
{
int i;
-
+
for(i = 0; i < SIN_BUFFER_SIZE; i++){
sintable[i] = AMP + sin(i*M_PI*2/CYCLE)*AMP;
intsintable[i] = AMP2 + sin(i*M_PI*2/CYCLE)*AMP2; // AMP2, not 20
--- a/r_misc.c
+++ b/r_misc.c
@@ -21,12 +21,12 @@
int i,j;
byte newpalette[768];
int basecolor[3];
-
+
basecolor[0] = 130;
basecolor[1] = 80;
basecolor[2] = 50;
-// pull the colors halfway to bright brown
+ // pull the colors halfway to bright brown
for (i=0 ; i<256 ; i++)
{
for (j=0 ; j<3 ; j++)
@@ -34,7 +34,7 @@
newpalette[i*3+j] = (host_basepal[i*3+j] + basecolor[j])/2;
}
}
-
+
setpal(newpalette);
}
@@ -48,7 +48,7 @@
{
int i;
vec3_t v, v2;
-
+
for (i=0 ; i<4 ; i++)
{
v[0] = screenedge[i].normal[2];
@@ -75,7 +75,7 @@
{
out[0] = DotProduct(in,vright);
out[1] = DotProduct(in,vup);
- out[2] = DotProduct(in,vpn);
+ out[2] = DotProduct(in,vpn);
}
@@ -87,10 +87,10 @@
void R_TransformPlane (mplane_t *p, float *normal, float *dist)
{
float d;
-
+
d = DotProduct (r_origin, p->normal);
*dist = p->dist - d;
-// TODO: when we have rotating entities, this will need to use the view matrix
+ // TODO: when we have rotating entities, this will need to use the view matrix
TransformVector (p->normal, normal);
}
@@ -122,7 +122,7 @@
}
}
- // FIXME: do just once at start
+ // FIXME: do just once at start
pfrustum_indexes[i] = pindex;
pindex += 6;
}
@@ -140,7 +140,7 @@
vrect_t vrect;
float w, h;
-// don't allow cheats in multiplayer
+ // don't allow cheats in multiplayer
if (cl.maxclients > 1)
{
setcvar ("r_fullbright", "0");
@@ -173,7 +173,7 @@
r_refdef.ambientlight = 0;
R_CheckVariables ();
-
+
R_AnimateLight ();
r_framecount++;
@@ -187,13 +187,13 @@
r_refdef.viewangles[2]= 0;
*/
-// build the transformation matrix for the given view angles
+ // build the transformation matrix for the given view angles
VectorCopy (r_refdef.vieworg, modelorg);
VectorCopy (r_refdef.vieworg, r_origin);
AngleVectors (r_refdef.viewangles, vpn, vright, vup);
-// current viewleaf
+ // current viewleaf
r_oldviewleaf = r_viewleaf;
r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel);
@@ -255,10 +255,10 @@
r_viewchanged = false;
}
-// start off with just the four screen edge clip planes
+ // start off with just the four screen edge clip planes
R_TransformFrustum ();
-// save base values
+ // save base values
VectorCopy (vpn, base_vpn);
VectorCopy (vright, base_vright);
VectorCopy (vup, base_vup);
@@ -270,13 +270,12 @@
r_cache_thrash = false;
-// clear frame counts
+ // clear frame counts
c_faceclip = 0;
d_spanpixcount = 0;
r_polycount = 0;
r_drawnpolycount = 0;
r_wholepolycount = 0;
- r_amodels_drawn = 0;
D_SetupFrame ();
}
--- a/r_part.c
+++ b/r_part.c
@@ -46,7 +46,7 @@
float sp, sy, cp, cy;
vec3_t forward;
float dist;
-
+
dist = 64;
if(!avelocities[0][0]){
@@ -66,7 +66,7 @@
angle = cl.time * avelocities[i][1];
sp = sin(angle);
cp = cos(angle);
-
+
forward[0] = cp*cy;
forward[1] = cp*sy;
forward[2] = -sp;
@@ -81,10 +81,10 @@
p->die = cl.time + 0.01;
p->color = 0x6f;
p->type = pt_explode;
-
- p->org[0] = ent->origin[0] + r_avertexnormals[i][0]*dist + forward[0]*beamlength;
- p->org[1] = ent->origin[1] + r_avertexnormals[i][1]*dist + forward[1]*beamlength;
- p->org[2] = ent->origin[2] + r_avertexnormals[i][2]*dist + forward[2]*beamlength;
+
+ p->org[0] = ent->origin[0] + r_avertexnormals[i][0]*dist + forward[0]*beamlength;
+ p->org[1] = ent->origin[1] + r_avertexnormals[i][1]*dist + forward[1]*beamlength;
+ p->org[2] = ent->origin[2] + r_avertexnormals[i][2]*dist + forward[2]*beamlength;
}
}
@@ -97,7 +97,7 @@
void R_ClearParticles (void)
{
int i;
-
+
free_particles = &particles[0];
active_particles = nil;
@@ -117,7 +117,7 @@
{
vec3_t org, dir;
int i, count, msgcount, color;
-
+
MSG_ReadVec(cl.protocol, org);
for (i=0 ; i<3 ; i++)
dir[i] = MSG_ReadChar () * (1.0/16);
@@ -124,10 +124,10 @@
msgcount = MSG_ReadByte ();
color = MSG_ReadByte ();
count = msgcount < 255 ? msgcount : 1024;
-
+
R_RunParticleEffect (org, dir, color, count);
}
-
+
/*
===============
R_ParticleExplosion
@@ -138,7 +138,7 @@
{
int i, j;
particle_t *p;
-
+
for (i=0 ; i<1024 ; i++)
{
if (!free_particles)
@@ -216,7 +216,7 @@
{
int i, j;
particle_t *p;
-
+
for (i=0 ; i<1024 ; i++)
{
if (!free_particles)
@@ -261,7 +261,7 @@
{
int i, j;
particle_t *p;
-
+
for (i=0 ; i<count ; i++)
{
if (!free_particles)
@@ -333,20 +333,20 @@
free_particles = p->next;
p->next = active_particles;
active_particles = p;
-
+
p->die = cl.time + 2 + (rand()&31) * 0.02;
p->color = 224 + (rand()&7);
p->type = pt_slowgrav;
-
+
dir[0] = j*8 + (rand()&7);
dir[1] = i*8 + (rand()&7);
dir[2] = 256;
-
+
p->org[0] = org[0] + dir[0];
p->org[1] = org[1] + dir[1];
p->org[2] = org[2] + (rand()&63);
-
- VectorNormalize (dir);
+
+ VectorNormalize (dir);
vel = 50 + (rand()&63);
VectorScale (dir, vel, p->vel);
}
@@ -375,20 +375,20 @@
free_particles = p->next;
p->next = active_particles;
active_particles = p;
-
+
p->die = cl.time + 0.2 + (rand()&7) * 0.02;
p->color = 7 + (rand()&7);
p->type = pt_slowgrav;
-
+
dir[0] = j*8;
dir[1] = i*8;
dir[2] = k*8;
-
+
p->org[0] = org[0] + i + (rand()&3);
p->org[1] = org[1] + j + (rand()&3);
p->org[2] = org[2] + k + (rand()&3);
-
- VectorNormalize (dir);
+
+ VectorNormalize (dir);
vel = 50 + (rand()&63);
VectorScale (dir, vel, p->vel);
}
@@ -423,7 +423,7 @@
free_particles = p->next;
p->next = active_particles;
active_particles = p;
-
+
VectorCopy (vec3_origin, p->vel);
p->die = cl.time + 2;
@@ -460,7 +460,7 @@
p->color = 52 + ((tracercount&4)<<1);
else
p->color = 230 + ((tracercount&4)<<1);
-
+
tracercount++;
VectorCopy (start, p->org);
@@ -492,8 +492,8 @@
p->org[j] = start[j] + ((rand()&15)-8);
break;
}
-
+
VectorAdd (start, vec, start);
}
}
@@ -515,7 +515,7 @@
float time1;
float dvel;
float frametime;
-
+
D_StartParticles ();
VectorScale (vright, xscaleshrink, r_pright);
@@ -527,8 +527,8 @@
time1 = frametime * 5;
grav = frametime * sv_gravity.value * 0.05;
dvel = 4*frametime;
-
- for ( ;; )
+
+ for ( ;; )
{
kill = active_particles;
if (kill && kill->die < cl.time)
@@ -560,7 +560,7 @@
p->org[0] += p->vel[0]*frametime;
p->org[1] += p->vel[1]*frametime;
p->org[2] += p->vel[2]*frametime;
-
+
switch (p->type)
{
case pt_static:
--- a/r_sprite.c
+++ b/r_sprite.c
@@ -5,8 +5,8 @@
static int sprite_width, sprite_height;
spritedesc_t r_spritedesc;
-
+
/*
================
R_RotateSprite
@@ -15,7 +15,7 @@
void R_RotateSprite (float beamlength)
{
vec3_t vec;
-
+
if (beamlength == 0.0)
return;
@@ -42,8 +42,8 @@
clipdist = pclipplane->dist;
pclipnormal = pclipplane->normal;
-
-// calc dists
+
+ // calc dists
if (clip_current)
{
in = clip_verts[1][0];
@@ -56,19 +56,19 @@
outstep = clip_verts[1][0];
clip_current = 1;
}
-
+
instep = in;
for (i=0 ; i<nump ; i++, instep += sizeof (vec5_t) / sizeof (float))
{
dists[i] = DotProduct (instep, pclipnormal) - clipdist;
}
-
-// handle wraparound case
+
+ // handle wraparound case
dists[nump] = dists[0];
memcpy(instep, in, sizeof(vec5_t));
-// clip the winding
+ // clip the winding
instep = in;
outcount = 0;
@@ -86,12 +86,12 @@
if ( (dists[i] > 0) == (dists[i+1] > 0) )
continue;
-
- // split it into a new vertex
+
+ // split it into a new vertex
frac = dists[i] / (dists[i] - dists[i+1]);
-
+
vert2 = instep + sizeof (vec5_t) / sizeof (float);
-
+
outstep[0] = instep[0] + frac*(vert2[0] - instep[0]);
outstep[1] = instep[1] + frac*(vert2[1] - instep[1]);
outstep[2] = instep[2] + frac*(vert2[2] - instep[2]);
@@ -100,8 +100,8 @@
outstep += sizeof (vec5_t) / sizeof (float);
outcount++;
- }
-
+ }
+
return outcount;
}
@@ -121,11 +121,11 @@
dot = DotProduct (r_spritedesc.vpn, modelorg);
-// backface cull
+ // backface cull
if (dot >= 0)
return;
-// build the sprite poster in worldspace
+ // build the sprite poster in worldspace
VectorScale (r_spritedesc.vright, r_spritedesc.pspriteframe->right, right);
VectorScale (r_spritedesc.vup, r_spritedesc.pspriteframe->up, up);
VectorScale (r_spritedesc.vright, r_spritedesc.pspriteframe->left, left);
@@ -157,7 +157,7 @@
pverts[3][3] = 0;
pverts[3][4] = sprite_height;
-// clip to the frustum in worldspace
+ // clip to the frustum in worldspace
nump = 4;
clip_current = 0;
@@ -170,7 +170,7 @@
fatal("R_SetupAndDrawSprite: too many points");
}
-// transform vertices into viewspace and project
+ // transform vertices into viewspace and project
pv = &clip_verts[clip_current][0][0];
r_spritedesc.nearzi = -Q_MAXFLOAT;
@@ -189,7 +189,7 @@
pout->s = pv[3];
pout->t = pv[4];
-
+
scale = xscale * pout->zi;
pout->u = (xcenter + scale * transformed[0]);
@@ -199,7 +199,7 @@
pv += sizeof (vec5_t) / sizeof (*pv);
}
-// draw it
+ // draw it
r_spritedesc.nump = nump;
r_spritedesc.pverts = outverts;
D_DrawSprite ();
@@ -239,8 +239,8 @@
time = cl.time + currententity->syncbase;
- // when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
- // are positive, so we don't have to worry about division by 0
+ // when loading in Mod_LoadSpriteGroup, we guaranteed all interval values
+ // are positive, so we don't have to worry about division by 0
targettime = time - ((int)(time / fullinterval)) * fullinterval;
for (i=0 ; i<(numframes-1) ; i++)
@@ -275,15 +275,15 @@
sprite_width = r_spritedesc.pspriteframe->width;
sprite_height = r_spritedesc.pspriteframe->height;
-// TODO: make this caller-selectable
+ // TODO: make this caller-selectable
if (psprite->type == SPR_FACING_UPRIGHT)
{
- // generate the sprite's axes, with vup straight up in worldspace, and
- // r_spritedesc.vright perpendicular to modelorg.
- // This will not work if the view direction is very close to straight up or
- // down, because the cross product will be between two nearly parallel
- // vectors and starts to approach an undefined state, so we don't draw if
- // the two vectors are less than 1 degree apart
+ // generate the sprite's axes, with vup straight up in worldspace, and
+ // r_spritedesc.vright perpendicular to modelorg.
+ // This will not work if the view direction is very close to straight up or
+ // down, because the cross product will be between two nearly parallel
+ // vectors and starts to approach an undefined state, so we don't draw if
+ // the two vectors are less than 1 degree apart
tvec[0] = -modelorg[0];
tvec[1] = -modelorg[1];
tvec[2] = -modelorg[2];
@@ -309,9 +309,9 @@
}
else if (psprite->type == SPR_VP_PARALLEL)
{
- // generate the sprite's axes, completely parallel to the viewplane. There
- // are no problem situations, because the sprite is always in the same
- // position relative to the viewer
+ // generate the sprite's axes, completely parallel to the viewplane. There
+ // are no problem situations, because the sprite is always in the same
+ // position relative to the viewer
for (i=0 ; i<3 ; i++)
{
r_spritedesc.vup[i] = vup[i];
@@ -321,12 +321,12 @@
}
else if (psprite->type == SPR_VP_PARALLEL_UPRIGHT)
{
- // generate the sprite's axes, with vup straight up in worldspace, and
- // r_spritedesc.vright parallel to the viewplane.
- // This will not work if the view direction is very close to straight up or
- // down, because the cross product will be between two nearly parallel
- // vectors and starts to approach an undefined state, so we don't draw if
- // the two vectors are less than 1 degree apart
+ // generate the sprite's axes, with vup straight up in worldspace, and
+ // r_spritedesc.vright parallel to the viewplane.
+ // This will not work if the view direction is very close to straight up or
+ // down, because the cross product will be between two nearly parallel
+ // vectors and starts to approach an undefined state, so we don't draw if
+ // the two vectors are less than 1 degree apart
dot = vpn[2]; // same as DotProduct (vpn, r_spritedesc.vup) because
// r_spritedesc.vup is 0, 0, 1
if ((dot > 0.999848) || (dot < -0.999848)) // cos(1 degree) = 0.999848
@@ -347,15 +347,15 @@
}
else if (psprite->type == SPR_ORIENTED)
{
- // generate the sprite's axes, according to the sprite's world orientation
+ // generate the sprite's axes, according to the sprite's world orientation
AngleVectors (currententity->angles, r_spritedesc.vpn,
r_spritedesc.vright, r_spritedesc.vup);
}
else if (psprite->type == SPR_VP_PARALLEL_ORIENTED)
{
- // generate the sprite's axes, parallel to the viewplane, but rotated in
- // that plane around the center according to the sprite entity's roll
- // angle. So vpn stays the same, but vright and vup rotate
+ // generate the sprite's axes, parallel to the viewplane, but rotated in
+ // that plane around the center according to the sprite entity's roll
+ // angle. So vpn stays the same, but vright and vup rotate
angle = currententity->angles[ROLL] * (M_PI*2 / 360);
sr = sin(angle);
cr = cos(angle);
--- a/r_surf.c
+++ b/r_surf.c
@@ -77,7 +77,7 @@
local[0] -= surf->texturemins[0];
local[1] -= surf->texturemins[1];
-
+
for (t = 0 ; t<tmax ; t++)
{
td = local[1] - t*16;
@@ -130,27 +130,27 @@
return;
}
-// clear to ambient
+ // clear to ambient
for (i=0 ; i<size ; i++)
blocklights[i] = r_refdef.ambientlight<<8;
-// add all the lightmaps
+ // add all the lightmaps
if (lightmap)
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
maps++)
{
- scale = r_drawsurf.lightadj[maps]; // 8.8 fraction
+ scale = r_drawsurf.lightadj[maps]; // 8.8 fraction
for (i=0 ; i<size ; i++)
blocklights[i] += lightmap[i] * scale;
lightmap += size; // skip to next lightmap
}
-// add all the dynamic lights
+ // add all the dynamic lights
if (surf->dlightframe == r_framecount)
R_AddDynamicLights ();
-// bound, invert, and shift
+ // bound, invert, and shift
for (i=0 ; i<size ; i++)
{
t = (255*256 - (int)blocklights[i]) >> (8 - VID_CBITS);
@@ -180,13 +180,13 @@
if (base->alternate_anims)
base = base->alternate_anims;
}
-
+
if (!base->anim_total)
return base;
reletive = (int)(cl.time*10) % base->anim_total;
- count = 0;
+ count = 0;
while (base->anim_min > reletive || base->anim_max <= reletive)
{
base = base->anim_next;
@@ -216,24 +216,24 @@
void (*pblockdrawer)(void);
texture_t *mt;
-// calculate the lightings
+ // calculate the lightings
R_BuildLightMap ();
-
+
surfrowbytes = r_drawsurf.rowbytes;
mt = r_drawsurf.texture;
-
+
r_source = (byte *)mt + mt->offsets[r_drawsurf.surfmip];
-
-// the fractional light values should range from 0 to (VID_GRADES - 1) << 16
-// from a source range of 0 - 255
-
+
+ // the fractional light values should range from 0 to (VID_GRADES - 1) << 16
+ // from a source range of 0 - 255
+
texwidth = mt->width >> r_drawsurf.surfmip;
blocksize = 16 >> r_drawsurf.surfmip;
blockdivshift = 4 - r_drawsurf.surfmip;
blockdivmask = (1 << blockdivshift) - 1;
-
+
r_lightwidth = (r_drawsurf.surf->extents[0]>>4)+1;
r_numhblocks = r_drawsurf.surfwidth >> blockdivshift;
@@ -254,9 +254,9 @@
soffset = r_drawsurf.surf->texturemins[0];
basetoffset = r_drawsurf.surf->texturemins[1];
-// << 16 components are to guarantee positive values for %
+ // << 16 components are to guarantee positive values for %
soffset = ((soffset >> r_drawsurf.surfmip) + (smax << 16)) % smax;
- basetptr = &r_source[((((basetoffset >> r_drawsurf.surfmip)
+ basetptr = &r_source[((((basetoffset >> r_drawsurf.surfmip)
+ (tmax << 16)) % tmax) * twidth)];
pcolumndest = r_drawsurf.surfdat;
@@ -297,7 +297,7 @@
for (v=0 ; v<r_numvblocks ; v++)
{
- // FIXME: use delta rather than both right and left, like ASM?
+ // FIXME: use delta rather than both right and left, like ASM?
lightleft = r_lightptr[0];
lightright = r_lightptr[1];
r_lightptr += r_lightwidth;
@@ -355,7 +355,7 @@
for (v=0 ; v<r_numvblocks ; v++)
{
- // FIXME: use delta rather than both right and left, like ASM?
+ // FIXME: use delta rather than both right and left, like ASM?
lightleft = r_lightptr[0];
lightright = r_lightptr[1];
r_lightptr += r_lightwidth;
@@ -376,7 +376,7 @@
[(light & 0xFF00) + pix];
light += lightstep;
}
-
+
psource += sourcetstep;
lightright += lightrightstep;
lightleft += lightleftstep;
@@ -404,7 +404,7 @@
for (v=0 ; v<r_numvblocks ; v++)
{
- // FIXME: use delta rather than both right and left, like ASM?
+ // FIXME: use delta rather than both right and left, like ASM?
lightleft = r_lightptr[0];
lightright = r_lightptr[1];
r_lightptr += r_lightwidth;
@@ -425,7 +425,7 @@
[(light & 0xFF00) + pix];
light += lightstep;
}
-
+
psource += sourcetstep;
lightright += lightrightstep;
lightleft += lightleftstep;
@@ -453,7 +453,7 @@
for (v=0 ; v<r_numvblocks ; v++)
{
- // FIXME: use delta rather than both right and left, like ASM?
+ // FIXME: use delta rather than both right and left, like ASM?
lightleft = r_lightptr[0];
lightright = r_lightptr[1];
r_lightptr += r_lightwidth;
@@ -474,7 +474,7 @@
[(light & 0xFF00) + pix];
light += lightstep;
}
-
+
psource += sourcetstep;
lightright += lightrightstep;
lightleft += lightleftstep;
@@ -496,7 +496,7 @@
int *turb;
int i, j, s, t;
byte *pd;
-
+
turb = sintable + ((int)(cl.time*SPEED)&(CYCLE-1));
pd = (byte *)pdest;
@@ -503,7 +503,7 @@
for (i=0 ; i<TILE_SIZE ; i++)
{
for (j=0 ; j<TILE_SIZE ; j++)
- {
+ {
s = (((j << 16) + turb[i & (CYCLE-1)]) >> 16) & 63;
t = (((i << 16) + turb[j & (CYCLE-1)]) >> 16) & 63;
*pd++ = *(pbasetex + (t<<6) + s);
--- a/render.h
+++ b/render.h
@@ -25,10 +25,10 @@
entity_state_t baseline; // to fill in defaults in updates
double msgtime; // time of last update
- vec3_t msg_origins[2]; // last two updates (0 is newest)
+ vec3_t msg_origins[2]; // last two updates (0 is newest)
vec3_t origin;
vec3_t msg_angles[2]; // last two updates (0 is newest)
- vec3_t angles;
+ vec3_t angles;
struct model_s *model; // NULL = no model
struct efrag_s *efrag; // linked list of efrags
int frame;
@@ -38,10 +38,10 @@
int skinnum; // for Alias models
int visframe; // last frame this entity was
// found in an active leaf
-
+
int dlightframe; // dynamic lighting
int dlightbits;
-
+
// FIXME: could turn these into a union
int trivial_accept;
struct mnode_s *topnode; // for bmodels, first world node
@@ -71,7 +71,7 @@
// right and bottom edges, for clamping
float fvrectright; // rightmost edge, for Alias clamping
float fvrectbottom; // bottommost edge, for Alias clamping
- float horizontalFieldOfView; // at Z = 1.0, this many X is visible
+ float horizontalFieldOfView; // at Z = 1.0, this many X is visible
// 2.0 = 90 degrees
float xOrigin; // should probably allways be 0.5
float yOrigin; // between be around 0.3 to 0.5
@@ -78,7 +78,7 @@
vec3_t vieworg;
vec3_t viewangles;
-
+
float fov_x, fov_y;
int ambientlight;
--- a/sbar.c
+++ b/sbar.c
@@ -174,7 +174,7 @@
sb_ibar = Draw_PicFromWad ("ibar");
sb_scorebar = Draw_PicFromWad ("scorebar");
-//MED 01/04/97 added new hipnotic weapons
+ //MED 01/04/97 added new hipnotic weapons
if (hipnotic)
{
hsb_weapons[0][0] = Draw_PicFromWad ("inv_laser");
@@ -216,9 +216,9 @@
rsb_items[0] = Draw_PicFromWad ("r_shield1");
rsb_items[1] = Draw_PicFromWad ("r_agrav1");
-// PGM 01/19/97 - team color border
+ // PGM 01/19/97 - team color border
rsb_teambord = Draw_PicFromWad ("r_teambord");
-// PGM 01/19/97 - team color border
+ // PGM 01/19/97 - team color border
rsb_ammo[0] = Draw_PicFromWad ("r_ammolava");
rsb_ammo[1] = Draw_PicFromWad ("r_ammomulti");
@@ -445,7 +445,7 @@
sprint (str,"Secrets :%3d /%3d", cl.stats[STAT_SECRETS], cl.stats[STAT_TOTALSECRETS]);
Sbar_DrawString (8, 12, str);
-// time
+ // time
minutes = cl.time / 60;
seconds = cl.time - 60*minutes;
tens = seconds / 10;
@@ -453,7 +453,7 @@
sprint (str,"Time :%3d:%d%d", minutes, tens, units);
Sbar_DrawString (184, 4, str);
-// draw level name
+ // draw level name
l = strlen (cl.levelname);
Sbar_DrawString (232 - l*4, 12, cl.levelname);
}
@@ -494,7 +494,7 @@
if (!s->name[0])
continue;
- // draw background
+ // draw background
top = s->colors & 0xf0;
bottom = (s->colors & 15)<<4;
top = Sbar_ColorForMap (top);
@@ -503,7 +503,7 @@
Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y + vid.height - SBAR_HEIGHT, 28, 4, top);
Draw_Fill ( x*8+10 + ((vid.width - 320)>>1), y+4 + vid.height - SBAR_HEIGHT, 28, 4, bottom);
- // draw text
+ // draw text
for (j=0 ; j<20 ; j++)
{
c = scoreboardtext[i][j];
@@ -541,7 +541,7 @@
Sbar_DrawPic (0, -24, sb_ibar);
}
-// weapons
+ // weapons
for (i=0 ; i<7 ; i++)
{
if (cl.items & (IT_SHOTGUN<<i) )
@@ -565,8 +565,8 @@
}
}
-// MED 01/04/97
-// hipnotic weapons
+ // MED 01/04/97
+ // hipnotic weapons
if (hipnotic)
{
int grenadeflashing=0;
@@ -624,7 +624,7 @@
if (rogue)
{
- // check for powered up weapon.
+ // check for powered up weapon.
if ( cl.stats[STAT_ACTIVEWEAPON] >= RIT_LAVA_NAILGUN )
{
for (i=0;i<5;i++)
@@ -637,7 +637,7 @@
}
}
-// ammo counts
+ // ammo counts
for (i=0 ; i<4 ; i++)
{
sprint (num, "%3d",cl.stats[STAT_SHELLS+i] );
@@ -650,50 +650,50 @@
}
flashon = 0;
- // items
- for (i=0 ; i<6 ; i++)
- if (cl.items & (1<<(17+i)))
- {
- time = cl.item_gettime[17+i];
- if (time && time > cl.time - 2 && flashon )
- { // flash frame
- sb_updates = 0;
- }
- else
- {
- //MED 01/04/97 changed keys
- if (!hipnotic || (i>1))
- {
- Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
- }
- }
- if (time && time > cl.time - 2)
- sb_updates = 0;
- }
- //MED 01/04/97 added hipnotic items
- // hipnotic items
- if (hipnotic)
- {
- for (i=0 ; i<2 ; i++)
- if (cl.items & (1<<(24+i)))
- {
- time = cl.item_gettime[24+i];
- if (time && time > cl.time - 2 && flashon )
- { // flash frame
- sb_updates = 0;
- }
- else
- {
- Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
- }
- if (time && time > cl.time - 2)
- sb_updates = 0;
- }
- }
+ // items
+ for (i=0 ; i<6 ; i++){
+ if (cl.items & (1<<(17+i))){
+ time = cl.item_gettime[17+i];
+ if (time && time > cl.time - 2 && flashon )
+ { // flash frame
+ sb_updates = 0;
+ }
+ else
+ {
+ //MED 01/04/97 changed keys
+ if (!hipnotic || (i>1))
+ {
+ Sbar_DrawPic (192 + i*16, -16, sb_items[i]);
+ }
+ }
+ if (time && time > cl.time - 2)
+ sb_updates = 0;
+ }
+ }
+ //MED 01/04/97 added hipnotic items
+ // hipnotic items
+ if (hipnotic)
+ {
+ for (i=0 ; i<2 ; i++)
+ if (cl.items & (1<<(24+i)))
+ {
+ time = cl.item_gettime[24+i];
+ if (time && time > cl.time - 2 && flashon )
+ { // flash frame
+ sb_updates = 0;
+ }
+ else
+ {
+ Sbar_DrawPic (288 + i*16, -16, hsb_items[i]);
+ }
+ if (time && time > cl.time - 2)
+ sb_updates = 0;
+ }
+ }
if (rogue)
{
- // new rogue items
+ // new rogue items
for (i=0 ; i<2 ; i++)
{
if (cl.items & (1<<(29+i)))
@@ -716,7 +716,7 @@
}
else
{
- // sigils
+ // sigils
for (i=0 ; i<4 ; i++)
{
if (cl.items & (1<<(28+i)))
@@ -753,7 +753,7 @@
Sbar_SortFrags ();
-// draw the text
+ // draw the text
l = scoreboardlines <= 4 ? scoreboardlines : 4;
x = 23;
@@ -770,7 +770,7 @@
if (!s->name[0])
continue;
- // draw background
+ // draw background
top = s->colors & 0xf0;
bottom = (s->colors & 15)<<4;
top = Sbar_ColorForMap (top);
@@ -779,7 +779,7 @@
Draw_Fill (xofs + x*8 + 10, y, 28, 4, top);
Draw_Fill (xofs + x*8 + 10, y+4, 28, 3, bottom);
- // draw number
+ // draw number
f = s->frags;
sprint (num, "%3d",f);
@@ -808,8 +808,8 @@
{
int f, anim;
-// PGM 01/19/97 - team color drawing
-// PGM 03/02/97 - fixed so color swatch only appears in CTF modes
+ // PGM 01/19/97 - team color drawing
+ // PGM 03/02/97 - fixed so color swatch only appears in CTF modes
if (rogue &&
(cl.maxclients != 1) &&
(teamplay.value>3) &&
@@ -819,7 +819,7 @@
int xofs;
char num[12];
scoreboard_t *s;
-
+
s = &cl.scores[cl.viewentity - 1];
// draw background
top = s->colors & 0xf0;
@@ -855,10 +855,10 @@
Sbar_DrawCharacter ( 116, 3, num[1]);
Sbar_DrawCharacter ( 123, 3, num[2]);
}
-
+
return;
}
-// PGM 01/19/97 - team color drawing
+ // PGM 01/19/97 - team color drawing
if ( (cl.items & (IT_INVISIBILITY | IT_INVULNERABILITY) )
== (IT_INVISIBILITY | IT_INVULNERABILITY) )
@@ -914,7 +914,7 @@
sb_updates++;
- if (sb_lines && vid.width > 320)
+ if (sb_lines && vid.width > 320)
Draw_TileClear (0, vid.height - sb_lines, vid.width, sb_lines);
if (sb_lines > 24)
@@ -934,16 +934,16 @@
{
Sbar_DrawPic (0, 0, sb_sbar);
- // keys (hipnotic only)
- //MED 01/04/97 moved keys here so they would not be overwritten
- if (hipnotic)
- {
- if (cl.items & IT_KEY1)
- Sbar_DrawPic (209, 3, sb_items[0]);
- if (cl.items & IT_KEY2)
- Sbar_DrawPic (209, 12, sb_items[1]);
- }
- // armor
+ // keys (hipnotic only)
+ //MED 01/04/97 moved keys here so they would not be overwritten
+ if (hipnotic)
+ {
+ if (cl.items & IT_KEY1)
+ Sbar_DrawPic (209, 3, sb_items[0]);
+ if (cl.items & IT_KEY2)
+ Sbar_DrawPic (209, 12, sb_items[1]);
+ }
+ // armor
if (cl.items & IT_INVULNERABILITY)
{
Sbar_DrawNum (24, 0, 666, 3, 1);
@@ -975,14 +975,14 @@
}
}
- // face
+ // face
Sbar_DrawFace ();
- // health
+ // health
Sbar_DrawNum (136, 0, cl.stats[STAT_HEALTH], 3
, cl.stats[STAT_HEALTH] <= 25);
- // ammo icon
+ // ammo icon
if (rogue)
{
if (cl.items & RIT_SHELLS)
@@ -1077,10 +1077,10 @@
pic = Draw_CachePic ("gfx/ranking.lmp");
M_DrawPic ((320-pic->width)/2, 8, pic);
-// scores
+ // scores
Sbar_SortFrags ();
-// draw the text
+ // draw the text
l = scoreboardlines;
x = 80 + ((vid.width - 320)>>1);
@@ -1092,7 +1092,7 @@
if (!s->name[0])
continue;
- // draw background
+ // draw background
top = s->colors & 0xf0;
bottom = (s->colors & 15)<<4;
top = Sbar_ColorForMap (top);
@@ -1101,7 +1101,7 @@
Draw_Fill ( x, y, 40, 4, top);
Draw_Fill ( x, y+4, 40, 4, bottom);
- // draw number
+ // draw number
f = s->frags;
sprint (num, "%3d",f);
@@ -1117,7 +1117,7 @@
int total;
int n, minutes, tens, units;
- // draw time
+ // draw time
total = cl.completed_time - s->entertime;
minutes = (int)total/60;
n = total - minutes*60;
@@ -1130,7 +1130,7 @@
}
*/
- // draw name
+ // draw name
Draw_String (x+64, y, s->name);
y += 10;
@@ -1158,10 +1158,10 @@
scr_copyeverything = 1;
scr_fullupdate = 0;
-// scores
+ // scores
Sbar_SortFrags ();
-// draw the text
+ // draw the text
y = vid.height - sb_lines;
numlines = sb_lines/8;
if (numlines < 3)
@@ -1190,7 +1190,7 @@
if (!s->name[0])
continue;
- // draw background
+ // draw background
top = s->colors & 0xf0;
bottom = (s->colors & 15)<<4;
top = Sbar_ColorForMap (top);
@@ -1199,7 +1199,7 @@
Draw_Fill ( x, y+1, 40, 3, top);
Draw_Fill ( x, y+4, 40, 4, bottom);
- // draw number
+ // draw number
f = s->frags;
sprint (num, "%3d",f);
@@ -1217,7 +1217,7 @@
int total;
int n, minutes, tens, units;
- // draw time
+ // draw time
total = cl.completed_time - s->entertime;
minutes = (int)total/60;
n = total - minutes*60;
@@ -1230,7 +1230,7 @@
}
*/
- // draw name
+ // draw name
Draw_String (x+48, y, s->name);
y += 8;
@@ -1264,7 +1264,7 @@
pic = Draw_CachePic ("gfx/inter.lmp");
Draw_TransPic (0, 56, pic);
-// time
+ // time
dig = cl.completed_time/60;
Sbar_IntermissionNumber (160, 64, dig, 3, 0);
num = cl.completed_time - dig*60;
--- a/screen.c
+++ b/screen.c
@@ -1,6 +1,6 @@
#include "quakedef.h"
-// only the refresh window will be updated unless these variables are flagged
+// only the refresh window will be updated unless these variables are flagged
int scr_copytop;
int scr_copyeverything;
@@ -68,7 +68,7 @@
scr_centertime_off = scr_centertime.value;
scr_centertime_start = cl.time;
-// count the number of lines for centering
+ // count the number of lines for centering
scr_center_lines = 1;
while (*str)
{
@@ -105,7 +105,7 @@
int x, y;
int remaining;
-// the finale prints the characters one at a time
+ // the finale prints the characters one at a time
if (cl.intermission)
remaining = scr_printspeed.value * (cl.time - scr_centertime_start);
else
@@ -119,9 +119,9 @@
else
y = 48;
- do
+ do
{
- // scan the width of the line
+ // scan the width of the line
for (l=0 ; l<40 ; l++)
if (start[l] == '\n' || !start[l])
break;
@@ -128,11 +128,11 @@
x = (vid.width - l*8)/2;
for (j=0 ; j<l ; j++, x+=8)
{
- Draw_Character (x, y, start[j]);
+ Draw_Character (x, y, start[j]);
if (!remaining--)
return;
}
-
+
y += 8;
while (*start && *start != '\n')
@@ -151,7 +151,7 @@
scr_erase_lines = scr_center_lines;
scr_centertime_off -= host_frametime;
-
+
if (scr_centertime_off <= 0 && !cl.intermission)
return;
if (key_dest != key_game)
@@ -169,19 +169,19 @@
*/
float CalcFov (float fov_x, float width, float height)
{
- float a = 0;
- float x;
+ float a = 0;
+ float x;
- if (fov_x < 1 || fov_x > 179)
- fatal ("Bad fov: %f", fov_x);
+ if (fov_x < 1 || fov_x > 179)
+ fatal ("Bad fov: %f", fov_x);
- x = width/tan(fov_x/360*M_PI);
+ x = width/tan(fov_x/360*M_PI);
if(x != 0)
- a = atan (height/x);
- a = a*360/M_PI;
+ a = atan (height/x);
+ a = a*360/M_PI;
- return a;
+ return a;
}
/*
@@ -200,18 +200,18 @@
scr_fullupdate = 0; // force a background redraw
vid.recalc_refdef = 0;
-// force the status bar to redraw
+ // force the status bar to redraw
Sbar_Changed ();
//========================================
-
-// bound viewsize
+
+ // bound viewsize
if (scr_viewsize.value < 100)
setcvar ("viewsize","100");
if (scr_viewsize.value > 120)
setcvar ("viewsize","120");
-// bound field of view
+ // bound field of view
if (scr_fov.value < 10)
setcvar ("fov","10");
if (scr_fov.value > 170)
@@ -220,7 +220,7 @@
r_refdef.fov_x = scr_fov.value;
r_refdef.fov_y = CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
-// intermission is always full screen
+ // intermission is always full screen
if (cl.intermission)
size = 120;
else
@@ -233,8 +233,8 @@
else
sb_lines = 24+16+8;
-// these calculations mirror those in R_Init() for r_refdef, but take no
-// account of water warping
+ // these calculations mirror those in R_Init() for r_refdef, but take no
+ // account of water warping
vrect.x = 0;
vrect.y = 0;
vrect.width = vid.width;
@@ -242,12 +242,12 @@
R_SetVrect (&vrect, &scr_vrect, sb_lines);
-// guard against going from one mode to another that's less than half the
-// vertical resolution
+ // guard against going from one mode to another that's less than half the
+ // vertical resolution
if (scr_con_current > vid.height)
scr_con_current = vid.height;
-// notify the refresh of the change
+ // notify the refresh of the change
R_ViewChanged (&vrect, sb_lines, vid.aspect);
}
@@ -307,7 +307,7 @@
void SCR_DrawTurtle (void)
{
static int count;
-
+
if (!scr_showturtle.value)
return;
@@ -375,7 +375,7 @@
return;
pic = Draw_CachePic ("gfx/pause.lmp");
- Draw_Pic ( (vid.width - pic->width)/2,
+ Draw_Pic ( (vid.width - pic->width)/2,
(vid.height - 48 - pic->height)/2, pic);
}
@@ -392,9 +392,9 @@
if (!scr_drawloading)
return;
-
+
pic = Draw_CachePic ("gfx/loading.lmp");
- Draw_Pic ( (vid.width - pic->width)/2,
+ Draw_Pic ( (vid.width - pic->width)/2,
(vid.height - 48 - pic->height)/2, pic);
}
@@ -411,11 +411,11 @@
void SCR_SetUpToDrawConsole (void)
{
Con_CheckResize ();
-
+
if (scr_drawloading)
return; // never a console with loading plaque
-
-// decide on the height of the console
+
+ // decide on the height of the console
con_forcedup = !cl.worldmodel || cls.signon != SIGNONS;
if (con_forcedup)
@@ -427,7 +427,7 @@
scr_conlines = vid.height/2; // half screen
else
scr_conlines = 0; // none visible
-
+
if (scr_conlines < scr_con_current)
{
scr_con_current -= scr_conspeed.value*host_frametime;
@@ -456,7 +456,7 @@
else
con_notifylines = 0;
}
-
+
/*
==================
SCR_DrawConsole
@@ -491,8 +491,8 @@
return;
if (cls.signon != SIGNONS)
return;
-
-// redraw with no console and the loading plaque
+
+ // redraw with no console and the loading plaque
Con_ClearNotify ();
scr_centertime_off = 0;
scr_con_current = 0;
@@ -537,16 +537,16 @@
y = vid.height*0.35;
- do
+ do
{
- // scan the width of the line
+ // scan the width of the line
for (l=0 ; l<40 ; l++)
if (start[l] == '\n' || !start[l])
break;
x = (vid.width - l*8)/2;
for (j=0 ; j<l ; j++, x+=8)
- Draw_Character (x, y, start[j]);
-
+ Draw_Character (x, y, start[j]);
+
y += 8;
while (*start && *start != '\n')
@@ -563,7 +563,7 @@
SCR_ModalMessage
Displays a text string in the center of the screen and waits for a Y or N
-keypress.
+keypress.
==================
*/
int SCR_ModalMessage (char *text)
@@ -572,8 +572,8 @@
return true;
scr_notifystring = text;
-
-// draw a fresh screen
+
+ // draw a fresh screen
scr_fullupdate = 0;
scr_drawdialog = true;
SCR_UpdateScreen ();
@@ -603,9 +603,9 @@
void SCR_BringDownConsole (void)
{
int i;
-
+
scr_centertime_off = 0;
-
+
for (i=0 ; i<20 && scr_conlines != scr_con_current ; i++)
SCR_UpdateScreen ();
@@ -628,7 +628,7 @@
void SCR_UpdateScreen (void)
{
static float oldlcd_x;
-
+
if (scr_skipupdate || block_drawing)
return;
@@ -651,37 +651,33 @@
if (!scr_initialized || !con_initialized)
return; // not initialized yet
-
-//
-// check for vid changes
-//
+
+ // check for vid changes
if (oldfov != scr_fov.value)
{
oldfov = scr_fov.value;
vid.recalc_refdef = true;
}
-
+
if (oldlcd_x != lcd_x.value)
{
oldlcd_x = lcd_x.value;
vid.recalc_refdef = true;
}
-
+
if (oldscreensize != scr_viewsize.value)
{
oldscreensize = scr_viewsize.value;
vid.recalc_refdef = true;
}
-
+
if (vid.recalc_refdef)
{
- // something changed, so reorder the screen
+ // something changed, so reorder the screen
SCR_CalcRefdef ();
}
-//
-// do 3D refresh drawing, and then update the screen
-//
+ // do 3D refresh drawing, and then update the screen
if (scr_fullupdate++ < vid.numpages)
{ // clear the entire screen
scr_copyeverything = 1;
--- a/screen.h
+++ b/screen.h
@@ -25,7 +25,7 @@
extern cvar_t scr_viewsize;
-// only the refresh window will be updated unless these variables are flagged
+// only the refresh window will be updated unless these variables are flagged
extern int scr_copytop;
extern int scr_copyeverything;
--- a/server.h
+++ b/server.h
@@ -20,10 +20,10 @@
qboolean loadgame; // handle connections specially
double time;
-
+
int lastcheck; // used by PF_checkclient
double lastchecktime;
-
+
char name[64]; // map name
char modelname[64]; // maps/<name>.bsp, for model_precache[0]
struct model_s *worldmodel;
@@ -72,7 +72,7 @@
edict_t *edict; // EDICT_NUM(clientnum+1)
char name[32]; // for printing to other people
int colors;
-
+
float ping_times[NUM_PING_TIMES];
int num_pings; // ping_times[num_pings%NUM_PING_TIMES]
@@ -79,7 +79,7 @@
// spawn parms are carried from level to level
float spawn_parms[Nparms];
-// client known data for deltas
+// client known data for deltas
int old_frags;
} client_t;
--- a/snd.c
+++ b/snd.c
@@ -165,7 +165,7 @@
data_p = nil;
return;
}
-
+
data_p += 4;
iff_chunk_len = GetLittleLong();
if (iff_chunk_len < 0)
@@ -201,7 +201,7 @@
if (!wav)
return info;
-
+
iff_data = wav;
iff_end = wav + wavlength;
@@ -278,7 +278,7 @@
info.samples = samples;
info.dataofs = data_p - wav;
-
+
return info;
}
@@ -303,7 +303,7 @@
Con_DPrintf("loadsfx: non mono wave %s\n", sfx->s);
return nil;
}
- stepscale = (float)info.rate / Srate;
+ stepscale = (float)info.rate / Srate;
len = info.samples / stepscale;
len *= info.width * info.channels;
if(sc = Cache_Alloc(&sfx->cu, len + sizeof *sc), sc == nil)
@@ -599,7 +599,7 @@
if(p != nil)
p->sfx = nil;
return p;
-}
+}
void
startsfx(int entn, int entch, Sfx *sfx, vec3_t zp, float vol, float att)
@@ -829,7 +829,7 @@
chans = calloc(Nchan, sizeof(*chans));
known_sfx = Hunk_Alloc(MAX_SOUNDS * sizeof *known_sfx);
num_sfx = 0;
-
+
ambsfx[Ambwater] = precachesfx("ambience/water1.wav");
ambsfx[Ambsky] = precachesfx("ambience/wind2.wav");
stopallsfx();
--- a/sv_main.c
+++ b/sv_main.c
@@ -82,7 +82,7 @@
=============================================================================
*/
-/*
+/*
==================
SV_StartParticle
@@ -94,7 +94,7 @@
int i, v;
if (sv.datagram.cursize > MAX_DATAGRAM-16)
- return;
+ return;
MSG_WriteByte(&sv.datagram, svc_particle);
MSG_WriteVec(*sv.protocol, &sv.datagram, org);
for (i=0 ; i<3 ; i++)
@@ -108,9 +108,9 @@
}
MSG_WriteByte (&sv.datagram, count);
MSG_WriteByte (&sv.datagram, color);
-}
+}
-/*
+/*
==================
SV_StartSound
@@ -124,10 +124,10 @@
Larger attenuations will drop off. (max 4 attenuation)
==================
-*/
+*/
void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
float attenuation)
-{
+{
int sound_num;
int field_mask;
int i;
@@ -134,14 +134,14 @@
int ent;
if (sv.datagram.cursize > MAX_DATAGRAM-21)
- return;
+ return;
-// find precache number for sound
+ // find precache number for sound
for (sound_num=1 ; sound_num<MAX_SOUNDS
&& sv.sound_precache[sound_num] ; sound_num++)
if (!strcmp(sample, sv.sound_precache[sound_num]))
break;
-
+
if ( sound_num == MAX_SOUNDS || !sv.sound_precache[sound_num] )
{
Con_Printf ("SV_StartSound: %s not precacheed\n", sample);
@@ -165,7 +165,7 @@
if(attenuation != Spktatt)
field_mask |= SND_ATTENUATION;
-// directed messages go only to the entity the are targeted on
+ // directed messages go only to the entity the are targeted on
MSG_WriteByte(&sv.datagram, svc_sound);
MSG_WriteByte(&sv.datagram, field_mask);
if(field_mask & SND_VOLUME)
@@ -184,7 +184,7 @@
MSG_WriteByte(&sv.datagram, sound_num);
for (i=0 ; i<3 ; i++)
sv.protocol->MSG_WriteCoord (&sv.datagram, entity->v.origin[i]+0.5*(entity->v.mins[i]+entity->v.maxs[i]));
-}
+}
/*
==============================================================================
@@ -229,12 +229,12 @@
MSG_WriteString(&client->message, *s);
MSG_WriteByte(&client->message, 0);
-// send music
+ // send music
MSG_WriteByte (&client->message, svc_cdtrack);
MSG_WriteByte (&client->message, sv.edicts->v.sounds);
MSG_WriteByte (&client->message, sv.edicts->v.sounds);
-// set view
+ // set view
MSG_WriteByte (&client->message, svc_setview);
MSG_WriteShort (&client->message, NUM_FOR_EDICT(client->edict));
@@ -268,10 +268,10 @@
edictnum = clientnum+1;
ent = EDICT_NUM(edictnum);
-
-// set up the client_t
+
+ // set up the client_t
netconnection = client->netconnection;
-
+
if(sv.loadgame)
memcpy(spawn_parms, client->spawn_parms, sizeof spawn_parms);
memset(client, 0, sizeof *client);
@@ -308,10 +308,8 @@
{
struct qsocket_s *ret;
int i;
-
-//
-// check for new connections
-//
+
+ // check for new connections
while (1)
{
ret = NET_CheckNewConnections ();
@@ -318,18 +316,16 @@
if (!ret)
break;
- //
- // init a new client structure
- //
+ // init a new client structure
for (i=0 ; i<svs.maxclients ; i++)
if (!svs.clients[i].active)
break;
if (i == svs.maxclients)
fatal ("Host_CheckForNewClients: no free clients");
-
+
svs.clients[i].netconnection = ret;
- SV_ConnectClient (i);
-
+ SV_ConnectClient (i);
+
net_activeconnections++;
}
}
@@ -379,7 +375,7 @@
while (1)
{
- // if this is a leaf, accumulate the pvs bits
+ // if this is a leaf, accumulate the pvs bits
if (node->contents < 0)
{
if (node->contents != CONTENTS_SOLID)
@@ -390,7 +386,7 @@
}
return;
}
-
+
plane = node->plane;
d = DotProduct (org, plane->normal) - plane->dist;
if (d > 8)
@@ -444,15 +440,15 @@
float miss;
edict_t *ent;
-// find the client's PVS
+ // find the client's PVS
VectorAdd (clent->v.origin, clent->v.view_ofs, org);
pvs = SV_FatPVS (org, sv.worldmodel);
-// send over all entities (excpet the client) that touch the pvs
+ // send over all entities (excpet the client) that touch the pvs
ent = NEXT_EDICT(sv.edicts);
for (e=1 ; e<sv.num_edicts ; e++, ent = NEXT_EDICT(ent))
{
-// ignore if not touching a PV leaf
+ // ignore if not touching a PV leaf
model = ent->v.modelindex;
v = GetEdictFieldValue(ent, "alpha");
@@ -462,7 +458,7 @@
{
if((int)ent->v.effects == EF_NODRAW)
continue;
-// ignore ents without visible models
+ // ignore ents without visible models
if(!model || !*PR_Str(ent->v.model))
continue;
if(model >= sv.protocol->limit_model)
@@ -479,7 +475,7 @@
return;
}
-// send an update
+ // send an update
bits = 0;
for (i=0 ; i<3 ; i++)
@@ -530,9 +526,8 @@
bits |= U_MOREBITS3;
}
}
- //
- // write the message
- //
+
+ // write the message
MSG_WriteByte (msg, bits | U_SIGNAL);
if (bits & U_MOREBITS){
@@ -555,7 +550,7 @@
if (bits & U_EFFECTS)
MSG_WriteByte(msg, ent->v.effects);
if (bits & U_ORIGIN1)
- sv.protocol->MSG_WriteCoord(msg, ent->v.origin[0]);
+ sv.protocol->MSG_WriteCoord(msg, ent->v.origin[0]);
if (bits & U_ANGLE1)
sv.protocol->MSG_WriteAngle(msg, ent->v.angles[0]);
if (bits & U_ORIGIN2)
@@ -585,7 +580,7 @@
{
int e;
edict_t *ent;
-
+
ent = NEXT_EDICT(sv.edicts);
for (e=1 ; e<sv.num_edicts ; e++, ent = NEXT_EDICT(ent))
{
@@ -608,9 +603,7 @@
int items, weaponmodel;
eval_t *val;
-//
-// send a damage message
-//
+ // send a damage message
if (ent->v.dmg_take || ent->v.dmg_save)
{
other = PROG_TO_EDICT(ent->v.dmg_inflictor);
@@ -619,17 +612,15 @@
MSG_WriteByte (msg, ent->v.dmg_take);
for (i=0 ; i<3 ; i++)
sv.protocol->MSG_WriteCoord (msg, other->v.origin[i] + 0.5*(other->v.mins[i] + other->v.maxs[i]));
-
+
ent->v.dmg_take = 0;
ent->v.dmg_save = 0;
}
-//
-// send the current viewpos offset from the view entity
-//
+ // send the current viewpos offset from the view entity
SV_SetIdealPitch (); // how much to look up / down ideally
-// a fixangle might get lost in a dropped packet. Oh well.
+ // a fixangle might get lost in a dropped packet. Oh well.
if ( ent->v.fixangle )
{
MSG_WriteByte (msg, svc_setangle);
@@ -644,8 +635,8 @@
if (ent->v.idealpitch)
bits |= SU_IDEALPITCH;
-// stuff the sigil bits into the high bits of items for sbar, or else
-// mix in items2
+ // stuff the sigil bits into the high bits of items for sbar, or else
+ // mix in items2
val = GetEdictFieldValue(ent, "items2");
items = (int)ent->v.items | (val ? ((int)val->_float << 23) : ((int)pr_global_struct->serverflags << 28));
weaponmodel = SV_ModelIndex(PR_Str(ent->v.weaponmodel));
@@ -687,7 +678,7 @@
bits |= SU_MOREBITS2;
}
-// send the data
+ // send the data
MSG_WriteByte (msg, svc_clientdata);
MSG_WriteShort (msg, bits);
@@ -710,7 +701,7 @@
MSG_WriteChar (msg, ent->v.velocity[i]/16);
}
-// [always sent] if (bits & SU_ITEMS)
+ // [always sent] if (bits & SU_ITEMS)
MSG_WriteLong (msg, items);
if (bits & SU_WEAPONFRAME)
@@ -719,7 +710,7 @@
MSG_WriteByte (msg, ent->v.armorvalue);
if (bits & SU_WEAPON)
MSG_WriteByte (msg, weaponmodel);
-
+
MSG_WriteShort (msg, ent->v.health);
MSG_WriteByte (msg, ent->v.currentammo);
MSG_WriteByte (msg, ent->v.ammo_shells);
@@ -769,22 +760,22 @@
MSG_WriteByte (&msg, svc_time);
MSG_WriteFloat (&msg, sv.time);
-// add the client specific data to the datagram
+ // add the client specific data to the datagram
SV_WriteClientdataToMessage (client->edict, &msg);
SV_WriteEntitiesToClient (client->edict, &msg);
-// copy the server datagram if there is space
+ // copy the server datagram if there is space
if (msg.cursize + sv.datagram.cursize < msg.maxsize)
SZ_Write (&msg, sv.datagram.data, sv.datagram.cursize);
-// send the datagram
+ // send the datagram
if (NET_SendUnreliableMessage (client->netconnection, &msg) == -1)
{
SV_DropClient (true);// if the message couldn't send, kick off
return false;
}
-
+
return true;
}
@@ -798,7 +789,7 @@
int i, j;
client_t *client;
-// check for changes to be sent over the reliable streams
+ // check for changes to be sent over the reliable streams
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
{
if (host_client->old_frags != host_client->edict->v.frags)
@@ -815,7 +806,7 @@
host_client->old_frags = host_client->edict->v.frags;
}
}
-
+
for (j=0, client = svs.clients ; j<svs.maxclients ; j++, client++)
{
if (!client->active)
@@ -839,7 +830,7 @@
{
sizebuf_t msg;
byte buf[4];
-
+
msg.data = buf;
msg.maxsize = sizeof buf;
msg.cursize = 0;
@@ -859,11 +850,11 @@
void SV_SendClientMessages (void)
{
int i;
-
-// update frags, names, etc
+
+ // update frags, names, etc
SV_UpdateToReliableMessages ();
-// build individual updates
+ // build individual updates
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
{
if (!host_client->active)
@@ -879,7 +870,7 @@
// the player isn't totally in the game yet
// send small keepalive messages if too much time has passed
// send a full message when the next signon stage has been requested
- // some other message data (name changes, etc) may accumulate
+ // some other message data (name changes, etc) may accumulate
// between signon stages
if (!host_client->sendsignon)
{
@@ -898,12 +889,12 @@
host_client->message.overflowed = false;
continue;
}
-
+
if (host_client->message.cursize || host_client->dropasap)
{
if (!NET_CanSendMessage (host_client->netconnection))
{
-// I_Printf ("can't write\n");
+ //I_Printf ("can't write\n");
continue;
}
@@ -920,9 +911,9 @@
}
}
}
-
-
-// clear muzzle flashes
+
+
+ // clear muzzle flashes
SV_CleanupEnts ();
}
@@ -944,7 +935,7 @@
int SV_ModelIndex (char *name)
{
int i;
-
+
if (!name || !name[0])
return 0;
@@ -967,11 +958,11 @@
u32int bits;
int i;
edict_t *svent;
- int entnum;
-
+ int entnum;
+
for (entnum = 0; entnum < sv.num_edicts ; entnum++)
{
- // get the current server version
+ // get the current server version
svent = EDICT_NUM(entnum);
if (svent->free)
continue;
@@ -978,9 +969,7 @@
if (entnum > svs.maxclients && !svent->v.modelindex)
continue;
- //
- // create entity baseline
- //
+ // create entity baseline
VectorCopy (svent->v.origin, svent->baseline.origin);
VectorCopy (svent->v.angles, svent->baseline.angles);
svent->baseline.frame = svent->v.frame;
@@ -1010,9 +999,7 @@
if(!defalpha(svent->baseline.alpha))
bits |= sv.protocol->fl_baseline_alpha;
- //
- // add to the message
- //
+ // add to the message
MSG_WriteByte (&sv.signon, bits ? svc_spawnbaseline2 : svc_spawnbaseline);
MSG_WriteShort (&sv.signon, entnum);
if(bits != 0)
@@ -1054,7 +1041,7 @@
MSG_WriteChar (&msg, svc_stufftext);
MSG_WriteString (&msg, "reconnect\n");
NET_SendToAll (&msg, 5);
-
+
if (cls.state != ca_dedicated)
Cmd_ExecuteString ("reconnect\n", src_command);
}
@@ -1079,7 +1066,7 @@
if (!host_client->active)
continue;
- // call the progs to get default spawn parms for the new client
+ // call the progs to get default spawn parms for the new client
pr_global_struct->self = EDICT_TO_PROG(host_client->edict);
PR_ExecuteProgram (pr_global_struct->SetChangeParms);
for (j=0 ; j<Nparms ; j++)
@@ -1111,17 +1098,13 @@
Con_DPrintf("SV_SpawnServer: %s\n", server);
svs.changelevel_issued = false; // now safe to issue another
-//
-// tell all connected clients that we are going to a new level
-//
+ // tell all connected clients that we are going to a new level
if (sv.active)
{
SV_SendReconnect ();
}
-//
-// make cvars consistant
-//
+ // make cvars consistant
if (coop.value)
setcvarv ("deathmatch", 0);
current_skill = (int)(skill.value + 0.5);
@@ -1131,10 +1114,8 @@
current_skill = 3;
setcvarv ("skill", (float)current_skill);
-
-//
-// set up the new server
-//
+
+ // set up the new server
Host_ClearMemory ();
memset(&sv, 0, sizeof sv);
@@ -1142,12 +1123,12 @@
strcpy(sv.name, server);
sv.protocol = sv_protocol;
-// load progs to get entity field count
+ // load progs to get entity field count
PR_LoadProgs ();
-// allocate server memory
+ // allocate server memory
sv.max_edicts = MAX_EDICTS;
-
+
sv.edicts = Hunk_Alloc(sv.max_edicts*pr_edict_size);
sv.datagram.maxsize = sizeof sv.datagram_buf;
@@ -1154,7 +1135,7 @@
sv.datagram.cursize = 0;
sv.datagram.data = sv.datagram_buf;
sv.datagram.name = "sv.datagram";
-
+
sv.reliable_datagram.maxsize = sizeof sv.reliable_datagram_buf;
sv.reliable_datagram.cursize = 0;
sv.reliable_datagram.data = sv.reliable_datagram_buf;
@@ -1165,7 +1146,7 @@
sv.signon.data = sv.signon_buf;
sv.signon.name = "sv.signon";
-// leave slots at start for clients only
+ // leave slots at start for clients only
sv.num_edicts = svs.maxclients+1;
for (i=0 ; i<svs.maxclients ; i++)
{
@@ -1172,12 +1153,12 @@
ent = EDICT_NUM(i+1);
svs.clients[i].edict = ent;
}
-
+
sv.state = ss_loading;
sv.paused = false;
sv.time = 1.0;
-
+
strcpy (sv.name, server);
sprint (sv.modelname,"maps/%s.bsp", server);
sv.worldmodel = Mod_ForName (sv.modelname, false);
@@ -1188,12 +1169,10 @@
return;
}
sv.models[1] = sv.worldmodel;
-
-//
-// clear world interaction links
-//
+
+ // clear world interaction links
SV_ClearWorld ();
-
+
sv.sound_precache[0] = dummy;
sv.model_precache[0] = dummy;
sv.model_precache[1] = sv.modelname;
@@ -1203,9 +1182,7 @@
sv.models[i+1] = Mod_ForName (localmodels[i], false);
}
-//
-// load the rest of the entities
-//
+ // load the rest of the entities
ent = EDICT_NUM(0);
memset(&ent->v, 0, progs->entityfields * 4);
ent->free = false;
@@ -1221,27 +1198,27 @@
pr_global_struct->mapname = PR_SetStr(sv.name);
-// serverflags are for cross level information (sigils)
+ // serverflags are for cross level information (sigils)
pr_global_struct->serverflags = svs.serverflags;
-
+
ED_LoadFromFile (sv.worldmodel->entities);
sv.active = true;
-// all setup is completed, any further precache statements are errors
+ // all setup is completed, any further precache statements are errors
sv.state = ss_active;
-
-// run two frames to allow everything to settle
+
+ // run two frames to allow everything to settle
host_frametime = 0.1;
SV_Physics ();
SV_Physics ();
-// create a baseline for more efficient communications
+ // create a baseline for more efficient communications
SV_CreateBaseline ();
UDP_Listen(svs.maxclients > 1);
-// send serverinfo to all connected clients
+ // send serverinfo to all connected clients
for (i=0,host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
if (host_client->active)
SV_SendServerinfo (host_client);
--- a/sv_move.c
+++ b/sv_move.c
@@ -19,13 +19,13 @@
trace_t trace;
int x, y;
float mid, bottom;
-
+
VectorAdd (ent->v.origin, ent->v.mins, mins);
VectorAdd (ent->v.origin, ent->v.maxs, maxs);
-// if all of the points under the corners are solid world, don't bother
-// with the tougher checks
-// the corners must be within 16 of the midpoint
+ // if all of the points under the corners are solid world, don't bother
+ // with the tougher checks
+ // the corners must be within 16 of the midpoint
start[2] = mins[2] - 1;
for (x=0 ; x<=1 ; x++)
for (y=0 ; y<=1 ; y++)
@@ -41,12 +41,11 @@
realcheck:
c_no++;
-//
-// check it for real...
-//
+
+ // check it for real...
start[2] = mins[2];
-
-// the midpoint must be within 16 of the bottom
+
+ // the midpoint must be within 16 of the bottom
start[0] = stop[0] = (mins[0] + maxs[0])*0.5;
start[1] = stop[1] = (mins[1] + maxs[1])*0.5;
stop[2] = start[2] - 2*STEPSIZE;
@@ -55,16 +54,16 @@
if (trace.fraction == 1.0)
return false;
mid = bottom = trace.endpos[2];
-
-// the corners must be within 16 of the midpoint
+
+ // the corners must be within 16 of the midpoint
for (x=0 ; x<=1 ; x++)
for (y=0 ; y<=1 ; y++)
{
start[0] = stop[0] = x ? maxs[0] : mins[0];
start[1] = stop[1] = y ? maxs[1] : mins[1];
-
+
trace = SV_Move (start, vec3_origin, vec3_origin, stop, true, ent);
-
+
if (trace.fraction != 1.0 && trace.endpos[2] > bottom)
bottom = trace.endpos[2];
if (trace.fraction == 1.0 || mid - trace.endpos[2] > STEPSIZE)
@@ -94,14 +93,14 @@
int i;
edict_t *enemy;
-// try the move
+ // try the move
VectorCopy (ent->v.origin, oldorg);
VectorAdd (ent->v.origin, move, neworg);
-// flying monsters don't step up
+ // flying monsters don't step up
if ( (int)ent->v.flags & (FL_SWIM | FL_FLY) )
{
- // try one move with vertical motion, then one without
+ // try one move with vertical motion, then one without
for (i=0 ; i<2 ; i++)
{
VectorAdd (ent->v.origin, move, neworg);
@@ -115,26 +114,26 @@
neworg[2] += 8;
}
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, neworg, false, ent);
-
+
if (trace.fraction == 1)
{
if ( ((int)ent->v.flags & FL_SWIM) && SV_PointContents(trace.endpos) == CONTENTS_EMPTY )
return false; // swim monster left water
-
+
VectorCopy (trace.endpos, ent->v.origin);
if (relink)
SV_LinkEdict (ent, true);
return true;
}
-
+
if (enemy == sv.edicts)
break;
}
-
+
return false;
}
-// push down from a step height above the wished position
+ // push down from a step height above the wished position
neworg[2] += STEPSIZE;
VectorCopy (neworg, end);
end[2] -= STEPSIZE*2;
@@ -153,7 +152,7 @@
}
if (trace.fraction == 1)
{
- // if monster had the ground pulled out, go ahead and fall
+ // if monster had the ground pulled out, go ahead and fall
if ( (int)ent->v.flags & FL_PARTIALGROUND )
{
VectorAdd (ent->v.origin, move, ent->v.origin);
@@ -160,16 +159,16 @@
if (relink)
SV_LinkEdict (ent, true);
ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
-// Con_Printf ("fall down\n");
+ //Con_Printf ("fall down\n");
return true;
}
-
+
return false; // walked off an edge
}
-// check point traces down for dangling corners
+ // check point traces down for dangling corners
VectorCopy (trace.endpos, ent->v.origin);
-
+
if (!SV_CheckBottom (ent))
{
if ( (int)ent->v.flags & FL_PARTIALGROUND )
@@ -185,12 +184,12 @@
if ( (int)ent->v.flags & FL_PARTIALGROUND )
{
-// Con_Printf ("back on ground\n");
+ //Con_Printf ("back on ground\n");
ent->v.flags = (int)ent->v.flags & ~FL_PARTIALGROUND;
}
ent->v.groundentity = EDICT_TO_PROG(trace.ent);
-// the move is ok
+ // the move is ok
if (relink)
SV_LinkEdict (ent, true);
return true;
@@ -213,10 +212,10 @@
{
vec3_t move, oldorigin;
float delta;
-
+
ent->v.ideal_yaw = yaw;
PF_changeyaw();
-
+
yaw = yaw*M_PI*2 / 360;
move[0] = cos(yaw)*dist;
move[1] = sin(yaw)*dist;
@@ -234,7 +233,7 @@
return true;
}
SV_LinkEdict (ent, true);
-
+
return false;
}
@@ -246,8 +245,8 @@
*/
void SV_FixCheckBottom (edict_t *ent)
{
-// Con_Printf ("SV_FixCheckBottom\n");
-
+ //Con_Printf ("SV_FixCheckBottom\n");
+
ent->v.flags = (int)ent->v.flags | FL_PARTIALGROUND;
}
@@ -284,7 +283,7 @@
else
d[2]= DI_NODIR;
-// try direct route
+ // try direct route
if (d[1] != DI_NODIR && d[2] != DI_NODIR)
{
if (d[1] == 0)
@@ -291,12 +290,12 @@
tdir = d[2] == 90 ? 45 : 315;
else
tdir = d[2] == 90 ? 135 : 215;
-
+
if (tdir != turnaround && SV_StepDirection(actor, tdir, dist))
return;
}
-// try other directions
+ // try other directions
if ( ((rand()&3) & 1) || fabs(deltay)>fabs(deltax))
{
tdir=d[1];
@@ -304,7 +303,7 @@
d[2]=tdir;
}
- if (d[1]!=DI_NODIR && d[1]!=turnaround
+ if (d[1]!=DI_NODIR && d[1]!=turnaround
&& SV_StepDirection(actor, d[1], dist))
return;
@@ -312,7 +311,7 @@
&& SV_StepDirection(actor, d[2], dist))
return;
-/* there is no direct path to the player, so pick another direction */
+ /* there is no direct path to the player, so pick another direction */
if (olddir!=DI_NODIR && SV_StepDirection(actor, olddir, dist))
return;
@@ -335,8 +334,8 @@
actor->v.ideal_yaw = olddir; // can't move
-// if a bridge was pulled out from underneath a monster, it may not have
-// a valid standing position at all
+ // if a bridge was pulled out from underneath a monster, it may not have
+ // a valid standing position at all
if (!SV_CheckBottom (actor))
SV_FixCheckBottom (actor);
@@ -352,7 +351,7 @@
qboolean SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
{
int i;
-
+
for (i=0 ; i<3 ; i++)
{
if (goal->v.absmin[i] > ent->v.absmax[i] + dist)
@@ -384,11 +383,11 @@
return;
}
-// if the next step hits the enemy, return immediately
+ // if the next step hits the enemy, return immediately
if ( PROG_TO_EDICT(ent->v.enemy) != sv.edicts && SV_CloseEnough (ent, goal, dist) )
return;
-// bump around...
+ // bump around...
if ( (rand()&3)==1 ||
!SV_StepDirection (ent, ent->v.ideal_yaw, dist))
{
--- a/sv_phys.c
+++ b/sv_phys.c
@@ -5,7 +5,7 @@
pushmove objects do not obey gravity, and do not interact with each other or trigger fields, but block normal movement and push normal objects when they move.
-onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects
+onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects
doors, plats, etc are SOLID_BSP, and MOVETYPE_PUSH
bonus items are SOLID_TRIGGER touch, and MOVETYPE_TOSS
@@ -38,7 +38,7 @@
int e;
edict_t *check;
-// see if any solid entities are inside the final position
+ // see if any solid entities are inside the final position
check = NEXT_EDICT(sv.edicts);
for (e=1 ; e<sv.num_edicts ; e++, check = NEXT_EDICT(check))
{
@@ -63,9 +63,7 @@
{
int i;
-//
-// bound velocity
-//
+ // bound velocity
for (i=0 ; i<3 ; i++)
{
if (isnanf(ent->v.velocity[i]))
@@ -102,7 +100,7 @@
thinktime = ent->v.nextthink;
if (thinktime <= 0 || thinktime > sv.time + host_frametime)
return true;
-
+
if (thinktime < sv.time)
thinktime = sv.time; // don't let things stay in the past.
// it is possible to start that way
@@ -125,10 +123,10 @@
void SV_Impact (edict_t *e1, edict_t *e2)
{
int old_self, old_other;
-
+
old_self = pr_global_struct->self;
old_other = pr_global_struct->other;
-
+
pr_global_struct->time = sv.time;
if (e1->v.touch && e1->v.solid != SOLID_NOT)
{
@@ -136,7 +134,7 @@
pr_global_struct->other = EDICT_TO_PROG(e2);
PR_ExecuteProgram (e1->v.touch);
}
-
+
if (e2->v.touch && e2->v.solid != SOLID_NOT)
{
pr_global_struct->self = EDICT_TO_PROG(e2);
@@ -164,13 +162,13 @@
float backoff;
float change;
int i, blocked;
-
+
blocked = 0;
if (normal[2] > 0)
blocked |= 1; // floor
if (!normal[2])
blocked |= 2; // step
-
+
backoff = DotProduct (in, normal) * overbounce;
for (i=0 ; i<3 ; i++)
@@ -180,7 +178,7 @@
if (out[i] > -STOP_EPSILON && out[i] < STOP_EPSILON)
out[i] = 0;
}
-
+
return blocked;
}
@@ -211,14 +209,14 @@
vec3_t end;
float time_left;
int blocked;
-
+
numbumps = 4;
-
+
blocked = 0;
VectorCopy (ent->v.velocity, original_velocity);
VectorCopy (ent->v.velocity, primal_velocity);
numplanes = 0;
-
+
time_left = time;
for (bumpcount=0 ; bumpcount<numbumps ; bumpcount++)
@@ -266,17 +264,15 @@
*steptrace = trace; // save for player extrafriction
}
-//
-// run the impact function
-//
+ // run the impact function
SV_Impact (ent, trace.ent);
if (ent->free)
break; // removed by the impact function
-
+
time_left -= time_left * trace.fraction;
-
- // cliped to another plane
+
+ // cliped to another plane
if (numplanes >= MAX_CLIP_PLANES)
{ // this shouldn't really happen
VectorCopy (vec3_origin, ent->v.velocity);
@@ -286,9 +282,7 @@
VectorCopy (trace.plane.normal, planes[numplanes]);
numplanes++;
-//
-// modify original_velocity so it parallels all of the clip planes
-//
+ // modify original_velocity so it parallels all of the clip planes
for (i=0 ; i<numplanes ; i++)
{
ClipVelocity (original_velocity, planes[i], new_velocity, 1);
@@ -301,7 +295,7 @@
if (j == numplanes)
break;
}
-
+
if (i != numplanes)
{ // go along this plane
VectorCopy (new_velocity, ent->v.velocity);
@@ -310,7 +304,7 @@
{ // go along the crease
if (numplanes != 2)
{
-// Con_Printf ("clip velocity, numplanes == %d\n",numplanes);
+ //Con_Printf ("clip velocity, numplanes == %d\n",numplanes);
VectorCopy (vec3_origin, ent->v.velocity);
return 7;
}
@@ -319,10 +313,8 @@
VectorScale (dir, d, ent->v.velocity);
}
-//
-// if original velocity is against the original velocity, stop dead
-// to avoid tiny occilations in sloping corners
-//
+ // if original velocity is against the original velocity, stop dead
+ // to avoid tiny occilations in sloping corners
if (DotProduct (ent->v.velocity, primal_velocity) <= 0)
{
VectorCopy (vec3_origin, ent->v.velocity);
@@ -374,25 +366,25 @@
{
trace_t trace;
vec3_t end;
-
+
VectorAdd (ent->v.origin, push, end);
if (ent->v.movetype == MOVETYPE_FLYMISSILE)
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_MISSILE, ent);
else if (ent->v.solid == SOLID_TRIGGER || ent->v.solid == SOLID_NOT)
- // only clip against bmodels
+ // only clip against bmodels
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NOMONSTERS, ent);
else
- trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
-
+ trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, end, MOVE_NORMAL, ent);
+
VectorCopy (trace.endpos, ent->v.origin);
SV_LinkEdict (ent, true);
if (trace.ent)
- SV_Impact (ent, trace.ent);
+ SV_Impact (ent, trace.ent);
return trace;
-}
+}
/*
@@ -425,15 +417,15 @@
}
VectorCopy (pusher->v.origin, pushorig);
-
-// move the pusher to it's final position
+ // move the pusher to it's final position
+
VectorAdd (pusher->v.origin, move, pusher->v.origin);
pusher->v.ltime += movetime;
SV_LinkEdict (pusher, false);
-// see if any solid entities are inside the final position
+ // see if any solid entities are inside the final position
num_moved = 0;
check = NEXT_EDICT(sv.edicts);
for (e=1 ; e<sv.num_edicts ; e++, check = NEXT_EDICT(check))
@@ -445,7 +437,7 @@
|| check->v.movetype == MOVETYPE_NOCLIP)
continue;
- // if the entity is standing on the pusher, it will definately be moved
+ // if the entity is standing on the pusher, it will definately be moved
if ( ! ( ((int)check->v.flags & FL_ONGROUND)
&& PROG_TO_EDICT(check->v.groundentity) == pusher) )
{
@@ -457,26 +449,26 @@
|| check->v.absmax[2] <= mins[2] )
continue;
- // see if the ent's bbox is inside the pusher's final position
+ // see if the ent's bbox is inside the pusher's final position
if (!SV_TestEntityPosition (check))
continue;
}
- // remove the onground flag for non-players
+ // remove the onground flag for non-players
if (check->v.movetype != MOVETYPE_WALK)
check->v.flags = (int)check->v.flags & ~FL_ONGROUND;
-
+
VectorCopy (check->v.origin, entorig);
VectorCopy (check->v.origin, moved_from[num_moved]);
moved_edict[num_moved] = check;
num_moved++;
- // try moving the contacted entity
+ // try moving the contacted entity
pusher->v.solid = SOLID_NOT;
SV_PushEntity (check, move);
pusher->v.solid = SOLID_BSP;
- // if it is still inside the pusher, block
+ // if it is still inside the pusher, block
block = SV_TestEntityPosition (check);
if (block)
{ // fail the move
@@ -488,7 +480,7 @@
VectorCopy (check->v.mins, check->v.maxs);
continue;
}
-
+
VectorCopy (entorig, check->v.origin);
SV_LinkEdict (check, true);
@@ -504,8 +496,8 @@
pr_global_struct->other = EDICT_TO_PROG(check);
PR_ExecuteProgram (pusher->v.blocked);
}
-
- // move back any entities we already moved
+
+ // move back any entities we already moved
for (i=0 ; i<num_moved ; i++)
{
VectorCopy (moved_from[i], moved_edict[i]->v.origin);
@@ -512,10 +504,10 @@
SV_LinkEdict (moved_edict[i], false);
}
return;
- }
+ }
}
-
+
}
/*
@@ -531,7 +523,7 @@
float movetime;
oldltime = ent->v.ltime;
-
+
thinktime = ent->v.nextthink;
if (thinktime < ent->v.ltime + host_frametime)
{
@@ -544,7 +536,7 @@
if (movetime)
SV_PushMove (ent, movetime); // advances ent->v.ltime if not blocked
-
+
if (thinktime > oldltime && thinktime <= ent->v.ltime)
{
ent->v.nextthink = 0;
@@ -595,7 +587,7 @@
SV_LinkEdict (ent, true);
return;
}
-
+
for (z=0 ; z< 18 ; z++)
for (i=-1 ; i <= 1 ; i++)
for (j=-1 ; j <= 1 ; j++)
@@ -610,7 +602,7 @@
return;
}
}
-
+
VectorCopy (org, ent->v.origin);
Con_DPrintf("player is stuck\n");
}
@@ -628,8 +620,8 @@
point[0] = ent->v.origin[0];
point[1] = ent->v.origin[1];
- point[2] = ent->v.origin[2] + ent->v.mins[2] + 1;
-
+ point[2] = ent->v.origin[2] + ent->v.mins[2] + 1;
+
ent->v.waterlevel = 0;
ent->v.watertype = CONTENTS_EMPTY;
cont = SV_PointContents (point);
@@ -648,7 +640,7 @@
ent->v.waterlevel = 3;
}
}
-
+
return ent->v.waterlevel > 1;
}
@@ -663,19 +655,19 @@
vec3_t forward, right, up;
float d, i;
vec3_t into, side;
-
+
AngleVectors (ent->v.v_angle, forward, right, up);
d = DotProduct (trace->plane.normal, forward);
-
+
d += 0.5;
if (d >= 0)
return;
-
-// cut the tangential velocity
+
+ // cut the tangential velocity
i = DotProduct (trace->plane.normal, ent->v.velocity);
VectorScale (trace->plane.normal, i, into);
VectorSubtract (ent->v.velocity, into, side);
-
+
ent->v.velocity[0] = side[0] * (1 + d);
ent->v.velocity[1] = side[1] * (1 + d);
}
@@ -699,13 +691,13 @@
vec3_t dir;
int clip;
trace_t steptrace;
-
+
VectorCopy (ent->v.origin, oldorg);
VectorCopy (vec3_origin, dir);
for (i=0 ; i<8 ; i++)
{
-// try pushing a little in an axial direction
+ // try pushing a little in an axial direction
switch (i)
{
case 0: dir[0] = 2; dir[1] = 0; break;
@@ -717,10 +709,10 @@
case 6: dir[0] = 2; dir[1] = -2; break;
case 7: dir[0] = -2; dir[1] = -2; break;
}
-
+
SV_PushEntity (ent, dir);
-// retry the original move
+ // retry the original move
ent->v.velocity[0] = oldvel[0];
ent->v. velocity[1] = oldvel[1];
ent->v. velocity[2] = 0;
@@ -729,14 +721,14 @@
if ( fabs(oldorg[1] - ent->v.origin[1]) > 4
|| fabs(oldorg[0] - ent->v.origin[0]) > 4 )
{
-//Con_DPrintf ("unstuck!\n");
+ //Con_DPrintf ("unstuck!\n");
return clip;
}
-
-// go back to the original pos and try again
+
+ // go back to the original pos and try again
VectorCopy (oldorg, ent->v.origin);
}
-
+
VectorCopy (vec3_origin, ent->v.velocity);
return 7; // still not moving
}
@@ -757,16 +749,14 @@
int clip;
int oldonground;
trace_t steptrace, downtrace;
-
-//
-// do a regular slide move unless it looks like you ran into a step
-//
+
+ // do a regular slide move unless it looks like you ran into a step
oldonground = (int)ent->v.flags & FL_ONGROUND;
ent->v.flags = (int)ent->v.flags & ~FL_ONGROUND;
-
+
VectorCopy (ent->v.origin, oldorg);
VectorCopy (ent->v.velocity, oldvel);
-
+
clip = SV_FlyMove (ent, host_frametime, &steptrace);
if ( !(clip & 2) )
@@ -774,13 +764,13 @@
if (!oldonground && ent->v.waterlevel == 0)
return; // don't stair up while jumping
-
+
if (ent->v.movetype != MOVETYPE_WALK)
return; // gibbed by a trigger
-
+
if (sv_nostep.value)
return;
-
+
if ( (int)sv_player->v.flags & FL_WATERJUMP )
return;
@@ -787,9 +777,7 @@
VectorCopy (ent->v.origin, nosteporg);
VectorCopy (ent->v.velocity, nostepvel);
-//
-// try moving up and forward to go up a step
-//
+ // try moving up and forward to go up a step
VectorCopy (oldorg, ent->v.origin); // back to start pos
VectorCopy (vec3_origin, upmove);
@@ -797,17 +785,17 @@
upmove[2] = STEPSIZE;
downmove[2] = -STEPSIZE + oldvel[2]*host_frametime;
-// move up
+ // move up
SV_PushEntity (ent, upmove); // FIXME: don't link?
-// move forward
+ // move forward
ent->v.velocity[0] = oldvel[0];
ent->v. velocity[1] = oldvel[1];
ent->v. velocity[2] = 0;
clip = SV_FlyMove (ent, host_frametime, &steptrace);
-// check for stuckness, possibly due to the limited precision of floats
-// in the clipping hulls
+ // check for stuckness, possibly due to the limited precision of floats
+ // in the clipping hulls
if (clip)
{
if ( fabs(oldorg[1] - ent->v.origin[1]) < 0.03125
@@ -816,12 +804,12 @@
clip = SV_TryUnstick (ent, oldvel);
}
}
-
-// extra friction based on view angle
+
+ // extra friction based on view angle
if ( clip & 2 )
SV_WallFriction (ent, &steptrace);
-// move down
+ // move down
downtrace = SV_PushEntity (ent, downmove); // FIXME: don't link?
if (downtrace.plane.normal[2] > 0.7)
@@ -834,9 +822,9 @@
}
else
{
-// if the push down didn't end up on good ground, use the move without
-// the step up. This happens near wall / slope combinations, and can
-// cause the player to hop up higher on a slope too steep to climb
+ // if the push down didn't end up on good ground, use the move without
+ // the step up. This happens near wall / slope combinations, and can
+ // cause the player to hop up higher on a slope too steep to climb
VectorCopy (nosteporg, ent->v.origin);
VectorCopy (nostepvel, ent->v.velocity);
}
@@ -855,21 +843,15 @@
if ( ! svs.clients[num-1].active )
return; // unconnected slot
-//
-// call standard client pre-think
-//
+ // call standard client pre-think
pr_global_struct->time = sv.time;
pr_global_struct->self = EDICT_TO_PROG(ent);
PR_ExecuteProgram (pr_global_struct->PlayerPreThink);
-
-//
-// do a move
-//
+
+ // do a move
SV_CheckVelocity (ent);
-//
-// decide which move function to call
-//
+ // decide which move function to call
switch ((int)ent->v.movetype)
{
case MOVETYPE_NONE:
@@ -885,7 +867,7 @@
SV_CheckStuck (ent);
SV_WalkMove (ent);
break;
-
+
case MOVETYPE_TOSS:
case MOVETYPE_BOUNCE:
SV_Physics_Toss (ent);
@@ -896,20 +878,18 @@
return;
SV_FlyMove (ent, host_frametime, nil);
break;
-
+
case MOVETYPE_NOCLIP:
if (!SV_RunThink (ent))
return;
VectorMA (ent->v.origin, host_frametime, ent->v.velocity, ent->v.origin);
break;
-
+
default:
fatal ("SV_Physics_client: bad movetype %d", (int)ent->v.movetype);
}
-//
-// call standard player post-think
-//
+ // call standard player post-think
SV_LinkEdict (ent, true);
pr_global_struct->time = sv.time;
@@ -928,7 +908,7 @@
*/
void SV_Physics_None (edict_t *ent)
{
-// regular thinking
+ // regular thinking
SV_RunThink (ent);
}
@@ -941,10 +921,10 @@
*/
void SV_Physics_Noclip (edict_t *ent)
{
-// regular thinking
+ // regular thinking
if (!SV_RunThink (ent))
return;
-
+
VectorMA (ent->v.angles, host_frametime, ent->v.avelocity, ent->v.angles);
VectorMA (ent->v.origin, host_frametime, ent->v.velocity, ent->v.origin);
@@ -975,13 +955,13 @@
ent->v.waterlevel = 1;
return;
}
-
+
if (cont <= CONTENTS_WATER)
{
if (ent->v.watertype == CONTENTS_EMPTY)
{ // just crossed into water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
- }
+ }
ent->v.watertype = cont;
ent->v.waterlevel = 1;
}
@@ -990,7 +970,7 @@
if (ent->v.watertype != CONTENTS_EMPTY)
{ // just crossed into water
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
- }
+ }
ent->v.watertype = CONTENTS_EMPTY;
ent->v.waterlevel = cont;
}
@@ -1013,21 +993,21 @@
if (!SV_RunThink (ent))
return;
-// if onground, return without moving
+ // if onground, return without moving
if ( ((int)ent->v.flags & FL_ONGROUND) )
return;
SV_CheckVelocity (ent);
-// add gravity
+ // add gravity
if (ent->v.movetype != MOVETYPE_FLY
&& ent->v.movetype != MOVETYPE_FLYMISSILE)
SV_AddGravity (ent);
-// move angles
+ // move angles
VectorMA (ent->v.angles, host_frametime, ent->v.avelocity, ent->v.angles);
-// move origin
+ // move origin
VectorScale (ent->v.velocity, host_frametime, move);
trace = SV_PushEntity (ent, move);
if (trace.fraction == 1)
@@ -1034,7 +1014,7 @@
return;
if (ent->free)
return;
-
+
if (ent->v.movetype == MOVETYPE_BOUNCE)
backoff = 1.5;
else
@@ -1042,9 +1022,9 @@
ClipVelocity (ent->v.velocity, trace.plane.normal, ent->v.velocity, backoff);
-// stop if on ground
+ // stop if on ground
if (trace.plane.normal[2] > 0.7)
- {
+ {
if (ent->v.velocity[2] < 60 || ent->v.movetype != MOVETYPE_BOUNCE)
{
ent->v.flags = (int)ent->v.flags | FL_ONGROUND;
@@ -1053,8 +1033,8 @@
VectorCopy (vec3_origin, ent->v.avelocity);
}
}
-
-// check for in water
+
+ // check for in water
SV_CheckWaterTransition (ent);
}
@@ -1081,7 +1061,7 @@
{
qboolean hitsound;
-// freefall if not onground
+ // freefall if not onground
if ( ! ((int)ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM) ) )
{
if (ent->v.velocity[2] < sv_gravity.value*-0.1)
@@ -1101,9 +1081,9 @@
}
}
-// regular thinking
+ // regular thinking
SV_RunThink (ent);
-
+
SV_CheckWaterTransition (ent);
}
@@ -1120,17 +1100,15 @@
int i;
edict_t *ent;
-// let the progs know that a new frame has started
+ // let the progs know that a new frame has started
pr_global_struct->self = EDICT_TO_PROG(sv.edicts);
pr_global_struct->other = EDICT_TO_PROG(sv.edicts);
pr_global_struct->time = sv.time;
PR_ExecuteProgram (pr_global_struct->StartFrame);
-//SV_CheckAllEnts ();
+ //SV_CheckAllEnts ();
-//
-// treat each object in turn
-//
+ // treat each object in turn
ent = sv.edicts;
for (i=0 ; i<sv.num_edicts ; i++, ent = NEXT_EDICT(ent))
{
@@ -1152,17 +1130,17 @@
SV_Physics_Noclip (ent);
else if (ent->v.movetype == MOVETYPE_STEP)
SV_Physics_Step (ent);
- else if (ent->v.movetype == MOVETYPE_TOSS
+ else if (ent->v.movetype == MOVETYPE_TOSS
|| ent->v.movetype == MOVETYPE_BOUNCE
|| ent->v.movetype == MOVETYPE_FLY
|| ent->v.movetype == MOVETYPE_FLYMISSILE)
SV_Physics_Toss (ent);
else
- fatal ("SV_Physics: bad movetype %d", (int)ent->v.movetype);
+ fatal ("SV_Physics: bad movetype %d", (int)ent->v.movetype);
}
-
+
if (pr_global_struct->force_retouch)
- pr_global_struct->force_retouch--;
+ pr_global_struct->force_retouch--;
sv.time += host_frametime;
}
--- a/sv_user.c
+++ b/sv_user.c
@@ -42,7 +42,7 @@
if (!((int)sv_player->v.flags & FL_ONGROUND))
return;
-
+
angleval = sv_player->v.angles[YAW] * M_PI*2 / 360;
sinval = sin(angleval);
cosval = cos(angleval);
@@ -52,11 +52,11 @@
top[0] = sv_player->v.origin[0] + cosval*(i+3)*12;
top[1] = sv_player->v.origin[1] + sinval*(i+3)*12;
top[2] = sv_player->v.origin[2] + sv_player->v.view_ofs[2];
-
+
bottom[0] = top[0];
bottom[1] = top[1];
bottom[2] = top[2] - 160;
-
+
tr = SV_Move (top, vec3_origin, vec3_origin, bottom, 1, sv_player);
if (tr.allsolid)
return; // looking at a wall, leave ideal the way is was
@@ -63,10 +63,10 @@
if (tr.fraction == 1)
return; // near a dropoff
-
+
z[i] = top[2] + tr.fraction*(bottom[2]-top[2]);
}
-
+
dir = 0;
steps = 0;
for (j=1 ; j<i ; j++)
@@ -78,16 +78,16 @@
if (dir && ( step-dir > ON_EPSILON || step-dir < -ON_EPSILON ) )
return; // mixed changes
- steps++;
+ steps++;
dir = step;
}
-
+
if (!dir)
{
sv_player->v.idealpitch = 0;
return;
}
-
+
if (steps < 2)
return;
sv_player->v.idealpitch = -dir * sv_idealpitchscale.value;
@@ -107,14 +107,14 @@
vec3_t start, stop;
float friction;
trace_t trace;
-
+
vel = velocity;
-
+
speed = sqrt(vel[0]*vel[0] +vel[1]*vel[1]);
if (!speed)
return;
-// if the leading edge is over a dropoff, increase friction
+ // if the leading edge is over a dropoff, increase friction
start[0] = stop[0] = origin[0] + vel[0]/speed*16;
start[1] = stop[1] = origin[1] + vel[1]/speed*16;
start[2] = origin[2] + sv_player->v.mins[2];
@@ -127,10 +127,10 @@
else
friction = sv_friction.value;
-// apply friction
+ // apply friction
control = speed < sv_stopspeed.value ? sv_stopspeed.value : speed;
newspeed = speed - host_frametime*control*friction;
-
+
if (newspeed < 0)
newspeed = 0;
newspeed /= speed;
@@ -147,27 +147,6 @@
*/
cvar_t sv_maxspeed = {"sv_maxspeed", "320", false, true};
cvar_t sv_accelerate = {"sv_accelerate", "10"};
-/*
-void SV_Accelerate (vec3_t wishvel)
-{
- int i;
- float addspeed, accelspeed;
- vec3_t pushvec;
-
- if (wishspeed == 0)
- return;
-
- VectorSubtract (wishvel, velocity, pushvec);
- addspeed = VectorNormalize (pushvec);
-
- accelspeed = sv_accelerate.value*host_frametime*addspeed;
- if (accelspeed > addspeed)
- accelspeed = addspeed;
-
- for (i=0 ; i<3 ; i++)
- velocity[i] += accelspeed*pushvec[i];
-}
-*/
void SV_Accelerate (void)
{
int i;
@@ -180,9 +159,9 @@
accelspeed = sv_accelerate.value*host_frametime*wishspeed;
if (accelspeed > addspeed)
accelspeed = addspeed;
-
+
for (i=0 ; i<3 ; i++)
- velocity[i] += accelspeed*wishdir[i];
+ velocity[i] += accelspeed*wishdir[i];
}
void SV_AirAccelerate (vec3_t wishveloc)
@@ -189,7 +168,7 @@
{
int i;
float addspeed, wishspd, accelspeed, currentspeed;
-
+
wishspd = VectorNormalize (wishveloc);
if (wishspd > 30)
wishspd = 30;
@@ -197,13 +176,12 @@
addspeed = wishspd - currentspeed;
if (addspeed <= 0)
return;
-// accelspeed = sv_accelerate.value * host_frametime;
accelspeed = sv_accelerate.value*wishspeed * host_frametime;
if (accelspeed > addspeed)
accelspeed = addspeed;
-
+
for (i=0 ; i<3 ; i++)
- velocity[i] += accelspeed*wishveloc[i];
+ velocity[i] += accelspeed*wishveloc[i];
}
@@ -210,9 +188,9 @@
void DropPunchAngle (void)
{
float len;
-
+
len = VectorNormalize (sv_player->v.punchangle);
-
+
len -= 10*host_frametime;
if (len < 0)
len = 0;
@@ -231,9 +209,7 @@
vec3_t wishvel;
float speed, newspeed, wishspeed, addspeed, accelspeed;
-//
-// user intentions
-//
+ // user intentions
AngleVectors (sv_player->v.v_angle, forward, right, up);
for (i=0 ; i<3 ; i++)
@@ -252,23 +228,19 @@
}
wishspeed *= 0.7;
-//
-// water friction
-//
+ // water friction
speed = Length (velocity);
if (speed)
{
newspeed = speed - host_frametime * speed * sv_friction.value;
if (newspeed < 0)
- newspeed = 0;
+ newspeed = 0;
VectorScale (velocity, newspeed/speed, velocity);
}
else
newspeed = 0;
-
-//
-// water acceleration
-//
+
+ // water acceleration
if (!wishspeed)
return;
@@ -314,11 +286,11 @@
fmove = cmd.forwardmove;
smove = cmd.sidemove;
-
-// hack to not let you back into teleporter
+
+ // hack to not let you back into teleporter
if (sv.time < sv_player->v.teleport_time && fmove < 0)
fmove = 0;
-
+
for (i=0 ; i<3 ; i++)
wishvel[i] = forward[i]*fmove + right[i]*smove;
@@ -334,7 +306,7 @@
VectorScale (wishvel, sv_maxspeed.value/wishspeed, wishvel);
wishspeed = sv_maxspeed.value;
}
-
+
if ( sv_player->v.movetype == MOVETYPE_NOCLIP)
{ // noclip
VectorCopy (wishvel, velocity);
@@ -347,7 +319,7 @@
else
{ // not on ground, so little effect on velocity
SV_AirAccelerate (wishvel);
- }
+ }
}
/*
@@ -364,7 +336,7 @@
if (sv_player->v.movetype == MOVETYPE_NONE)
return;
-
+
onground = (int)sv_player->v.flags & FL_ONGROUND;
origin = sv_player->v.origin;
@@ -371,19 +343,16 @@
velocity = sv_player->v.velocity;
DropPunchAngle ();
-
-//
-// if dead, behave differently
-//
+
+ // if dead, behave differently
if (sv_player->v.health <= 0)
return;
-//
-// angles
-// show 1/3 the pitch angle and all the roll angle
+ // angles
+ // show 1/3 the pitch angle and all the roll angle
cmd = host_client->cmd;
angles = sv_player->v.angles;
-
+
VectorAdd (sv_player->v.v_angle, sv_player->v.punchangle, v_angle);
angles[ROLL] = V_CalcRoll (sv_player->v.angles, sv_player->v.velocity)*4;
if (!sv_player->v.fixangle)
@@ -397,9 +366,8 @@
SV_WaterJump ();
return;
}
-//
-// walk
-//
+
+ // walk
if ( (sv_player->v.waterlevel >= 2)
&& (sv_player->v.movetype != MOVETYPE_NOCLIP) )
{
@@ -407,7 +375,7 @@
return;
}
- SV_AirMove ();
+ SV_AirMove ();
}
@@ -421,24 +389,24 @@
int i;
vec3_t angle;
int bits;
-
-// read ping time
+
+ // read ping time
host_client->ping_times[host_client->num_pings%NUM_PING_TIMES]
= sv.time - MSG_ReadFloat ();
host_client->num_pings++;
-// read current angles
+ // read current angles
for (i=0 ; i<3 ; i++)
angle[i] = sv.protocol->MSG_ReadAngle ();
VectorCopy (angle, host_client->edict->v.v_angle);
-
-// read movement
+
+ // read movement
move->forwardmove = MSG_ReadShort ();
move->sidemove = MSG_ReadShort ();
move->upmove = MSG_ReadShort ();
-
-// read buttons
+
+ // read buttons
bits = MSG_ReadByte ();
host_client->edict->v.button0 = bits & 1;
host_client->edict->v.button2 = (bits & 2)>>1;
@@ -460,7 +428,7 @@
int ret;
int cmd;
char *s;
-
+
do
{
nextmsg:
@@ -472,9 +440,9 @@
}
if (!ret)
return true;
-
+
MSG_BeginReading ();
-
+
while (1)
{
if (!host_client->active)
@@ -484,23 +452,23 @@
{
Con_DPrintf("SV_ReadClientMessage: badread\n");
return false;
- }
-
+ }
+
cmd = MSG_ReadChar ();
-
+
switch (cmd)
{
case -1:
goto nextmsg; // end of message
-
+
default:
Con_DPrintf("SV_ReadClientMessage: unknown command char\n");
return false;
-
+
case clc_nop:
break;
-
- case clc_stringcmd:
+
+ case clc_stringcmd:
s = MSG_ReadString ();
ret = 0;
if (cistrncmp(s, "status", 6) == 0)
@@ -548,10 +516,10 @@
else
Con_DPrintf("%s tried to %s\n", host_client->name, s);
break;
-
+
case clc_disconnect:
return false;
-
+
case clc_move:
SV_ReadClientMove (&host_client->cmd);
break;
@@ -558,7 +526,7 @@
}
}
} while (ret == 1);
-
+
return true;
}
@@ -571,12 +539,12 @@
void SV_RunClients (void)
{
int i;
-
+
for (i=0, host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
{
if (!host_client->active)
continue;
-
+
sv_player = host_client->edict;
if (!SV_ReadClientMessage ())
@@ -592,7 +560,7 @@
continue;
}
-// always pause in single player if in console or menus
+ // always pause in single player if in console or menus
if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game) )
SV_ClientThink ();
}
--- a/vid.h
+++ b/vid.h
@@ -19,7 +19,7 @@
unsigned short *colormap16; // 256 * VID_GRADES size
int fullbright; // index of first fullbright color
unsigned rowbytes; // may be > width if displayed in a window
- int width;
+ int width;
int height;
float aspect; // width / height -- < 0 is taller than wide
int numpages;
--- a/view.c
+++ b/view.c
@@ -61,23 +61,23 @@
float sign;
float side;
float value;
-
+
AngleVectors (angles, forward, right, up);
side = DotProduct (velocity, right);
sign = side < 0 ? -1 : 1;
side = fabs(side);
-
+
value = cl_rollangle.value;
-// if (cl.inwater)
-// value *= 6;
+ //if (cl.inwater)
+ // value *= 6;
if (side < cl_rollspeed.value)
side = side * value / cl_rollspeed.value;
else
side = value;
-
+
return side*sign;
-
+
}
@@ -91,7 +91,7 @@
{
float bob;
float cycle;
-
+
cycle = cl.time - (int)(cl.time/cl_bobcycle.value)*cl_bobcycle.value;
cycle /= cl_bobcycle.value;
if (cycle < cl_bobup.value)
@@ -99,11 +99,11 @@
else
cycle = M_PI + M_PI*(cycle-cl_bobup.value)/(1.0 - cl_bobup.value);
-// bob is proportional to velocity in the xy plane
-// (don't count Z, or jumping messes it up)
+ // bob is proportional to velocity in the xy plane
+ // (don't count Z, or jumping messes it up)
bob = sqrt(cl.velocity[0]*cl.velocity[0] + cl.velocity[1]*cl.velocity[1]) * cl_bob.value;
-//Con_Printf ("speed: %5.1f\n", Length(cl.velocity));
+ //Con_Printf ("speed: %5.1f\n", Length(cl.velocity));
bob = bob*0.3 + bob*0.7*sin(cycle);
if (bob > 4)
bob = 4;
@@ -110,7 +110,7 @@
else if (bob < -7)
bob = -7;
return bob;
-
+
}
@@ -152,7 +152,7 @@
mlook and mouse, or klook and keyboard, pitch drifting is constantly stopped.
Drifting is enabled when the center view key is hit, mlook is released and
-lookspring is non 0, or when
+lookspring is non 0, or when
===============
*/
void V_DriftPitch (void)
@@ -166,7 +166,7 @@
return;
}
-// don't count small mouse motion
+ // don't count small mouse motion
if (cl.nodrift)
{
if ( fabs(cl.cmd.forwardmove) < cl_forwardspeed.value)
@@ -173,7 +173,7 @@
cl.driftmove = 0;
else
cl.driftmove += host_frametime;
-
+
if ( cl.driftmove > v_centermove.value)
{
V_StartPitchDrift ();
@@ -180,7 +180,7 @@
}
return;
}
-
+
delta = cl.idealpitch - cl.viewangles[PITCH];
if (!delta)
@@ -191,9 +191,9 @@
move = host_frametime * cl.pitchvel;
cl.pitchvel += host_frametime * v_centerspeed.value;
-
-//Con_Printf ("move: %f (%f)\n", move, host_frametime);
+ //Con_Printf ("move: %f (%f)\n", move, host_frametime);
+
if (delta > 0)
{
if (move > delta)
@@ -219,14 +219,14 @@
/*
-==============================================================================
-
- PALETTE FLASHES
-
-==============================================================================
-*/
-
-
+==============================================================================
+
+ PALETTE FLASHES
+
+==============================================================================
+*/
+
+
cshift_t cshift_empty = { {130,80,50}, 0 };
cshift_t cshift_water = { {130,80,50}, 128 };
cshift_t cshift_slime = { {0,25,5}, 150 };
@@ -239,7 +239,7 @@
void BuildGammaTable (float g)
{
int i, inf;
-
+
if (g == 1.0)
{
for (i=0 ; i<256 ; i++)
@@ -246,7 +246,7 @@
gammatable[i] = i;
return;
}
-
+
for (i=0 ; i<256 ; i++)
{
inf = 255 * pow ( (i+0.5)/255.5 , g ) + 0.5;
@@ -266,14 +266,14 @@
qboolean V_CheckGamma (void)
{
static float oldgammavalue;
-
+
if (v_gamma.value == oldgammavalue)
return false;
oldgammavalue = v_gamma.value;
-
+
BuildGammaTable (v_gamma.value);
vid.recalc_refdef = 1; // force a surface cache flush
-
+
return true;
}
@@ -292,7 +292,7 @@
entity_t *ent;
float side;
float count;
-
+
armor = MSG_ReadByte ();
blood = MSG_ReadByte ();
MSG_ReadVec(cl.protocol, from);
@@ -309,7 +309,7 @@
if (cl.cshifts[CSHIFT_DAMAGE].percent > 150)
cl.cshifts[CSHIFT_DAMAGE].percent = 150;
- if (armor > blood)
+ if (armor > blood)
{
cl.cshifts[CSHIFT_DAMAGE].destcolor[0] = 200;
cl.cshifts[CSHIFT_DAMAGE].destcolor[1] = 100;
@@ -328,19 +328,17 @@
cl.cshifts[CSHIFT_DAMAGE].destcolor[2] = 0;
}
-//
-// calculate view angle kicks
-//
+ // calculate view angle kicks
ent = &cl_entities[cl.viewentity];
-
+
VectorSubtract (from, ent->origin, from);
VectorNormalize (from);
-
+
AngleVectors (ent->angles, forward, right, up);
side = DotProduct (from, right);
v_dmg_roll = count*side*v_kickroll.value;
-
+
side = DotProduct (from, forward);
v_dmg_pitch = count*side*v_kickpitch.value;
@@ -457,9 +455,9 @@
qboolean force;
V_CalcPowerupCshift ();
-
+
new = false;
-
+
for (i=0 ; i<NUM_CSHIFTS ; i++)
{
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent)
@@ -474,13 +472,13 @@
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
}
}
-
-// drop the damage value
+
+ // drop the damage value
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime*150;
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
-// drop the bonus value
+ // drop the bonus value
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime*100;
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
cl.cshifts[CSHIFT_BONUS].percent = 0;
@@ -488,10 +486,10 @@
force = V_CheckGamma ();
if (!new && !force)
return;
-
+
basepal = host_basepal;
newpal = pal;
-
+
for (i=0 ; i<256 ; i++)
{
r = basepal[0];
@@ -498,31 +496,31 @@
g = basepal[1];
b = basepal[2];
basepal += 3;
-
- for (j=0 ; j<NUM_CSHIFTS ; j++)
+
+ for (j=0 ; j<NUM_CSHIFTS ; j++)
{
r += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[0]-r))>>8;
g += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[1]-g))>>8;
b += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[2]-b))>>8;
}
-
+
newpal[0] = gammatable[r];
newpal[1] = gammatable[g];
newpal[2] = gammatable[b];
newpal += 3;
}
- setpal(pal);
+ setpal(pal);
}
-/*
-==============================================================================
-
- VIEW RENDERING
-
-==============================================================================
-*/
+/*
+==============================================================================
+ VIEW RENDERING
+
+==============================================================================
+*/
+
float angledelta (float a)
{
a = anglemod(a);
@@ -537,11 +535,11 @@
==================
*/
void CalcGunAngle (void)
-{
+{
float yaw, pitch, move;
static float oldyaw = 0;
static float oldpitch = 0;
-
+
yaw = r_refdef.viewangles[YAW];
pitch = -r_refdef.viewangles[PITCH];
@@ -566,7 +564,7 @@
if (oldyaw - move > yaw)
yaw = oldyaw - move;
}
-
+
if (pitch > oldpitch)
{
if (oldpitch + move < pitch)
@@ -577,7 +575,7 @@
if (oldpitch - move > pitch)
pitch = oldpitch - move;
}
-
+
oldyaw = yaw;
oldpitch = pitch;
@@ -597,11 +595,11 @@
void V_BoundOffsets (void)
{
entity_t *ent;
-
+
ent = &cl_entities[cl.viewentity];
-// absolutely bound refresh reletive to entity clipping hull
-// so the view can never be inside a solid wall
+ // absolutely bound refresh reletive to entity clipping hull
+ // so the view can never be inside a solid wall
if (r_refdef.vieworg[0] < ent->origin[0] - 14)
r_refdef.vieworg[0] = ent->origin[0] - 14;
@@ -642,7 +640,7 @@
void V_CalcViewRoll (void)
{
float side;
-
+
side = V_CalcRoll (cl_entities[cl.viewentity].angles, cl.velocity);
r_refdef.viewangles[ROLL] += side;
@@ -673,9 +671,9 @@
entity_t *ent, *view;
float old;
-// ent is the player model (visible when out of body)
+ // ent is the player model (visible when out of body)
ent = &cl_entities[cl.viewentity];
-// view is the weapon model (only visible from inside body)
+ // view is the weapon model (only visible from inside body)
view = &cl.viewent;
VectorCopy (ent->origin, r_refdef.vieworg);
@@ -682,7 +680,7 @@
VectorCopy (ent->angles, r_refdef.viewangles);
view->model = nil;
-// allways idle in intermission
+ // allways idle in intermission
old = v_idlescale.value;
v_idlescale.value = 1;
V_AddIdle ();
@@ -706,29 +704,29 @@
V_DriftPitch ();
-// ent is the player model (visible when out of body)
+ // ent is the player model (visible when out of body)
ent = &cl_entities[cl.viewentity];
-// view is the weapon model (only visible from inside body)
+ // view is the weapon model (only visible from inside body)
view = &cl.viewent;
-
-// transform the view offset by the model's matrix to get the offset from
-// model origin for the view
+
+ // transform the view offset by the model's matrix to get the offset from
+ // model origin for the view
ent->angles[YAW] = cl.viewangles[YAW]; // the model should face
// the view dir
ent->angles[PITCH] = -cl.viewangles[PITCH]; // the model should face
// the view dir
-
-
+
+
bob = V_CalcBob ();
-
-// refresh position
+
+ // refresh position
VectorCopy (ent->origin, r_refdef.vieworg);
r_refdef.vieworg[2] += cl.viewheight + bob;
-// never let it sit exactly on a node line, because a water plane can
-// dissapear when viewed with the eye exactly on it.
-// the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
+ // never let it sit exactly on a node line, because a water plane can
+ // dissapear when viewed with the eye exactly on it.
+ // the server protocol only specifies to 1/16 pixel, so add 1/32 in each axis
r_refdef.vieworg[0] += 1.0/32;
r_refdef.vieworg[1] += 1.0/32;
r_refdef.vieworg[2] += 1.0/32;
@@ -737,7 +735,7 @@
V_CalcViewRoll ();
V_AddIdle ();
-// offsets
+ // offsets
angles[PITCH] = -ent->angles[PITCH]; // because entity pitches are
// actually backward
angles[YAW] = ent->angles[YAW];
@@ -749,13 +747,13 @@
r_refdef.vieworg[i] += scr_ofsx.value*forward[i]
+ scr_ofsy.value*right[i]
+ scr_ofsz.value*up[i];
-
-
+
+
V_BoundOffsets ();
-
-// set up gun position
+
+ // set up gun position
VectorCopy (cl.viewangles, view->angles);
-
+
CalcGunAngle ();
VectorCopy (ent->origin, view->origin);
@@ -764,13 +762,13 @@
for (i=0 ; i<3 ; i++)
{
view->origin[i] += forward[i]*bob*0.4;
-// view->origin[i] += right[i]*bob*0.4;
-// view->origin[i] += up[i]*bob*0.8;
+ //view->origin[i] += right[i]*bob*0.4;
+ //view->origin[i] += up[i]*bob*0.8;
}
view->origin[2] += bob;
-// fudge position around to keep amount of weapon visible
-// roughly equal with different FOV
+ // fudge position around to keep amount of weapon visible
+ // roughly equal with different FOV
/*
if (cl.model_precache[cl.stats[STAT_WEAPON]] && strcmp (cl.model_precache[cl.stats[STAT_WEAPON]]->name, "progs/v_shot2.mdl"))
@@ -784,17 +782,18 @@
view->frame = cl.stats[STAT_WEAPONFRAME];
view->colormap = vid.colormap;
-// set up the refresh position
+ // set up the refresh position
VectorAdd (r_refdef.viewangles, cl.punchangle, r_refdef.viewangles);
-// smooth out stair step ups
+ // smooth out stair step ups
if (cl.onground && ent->origin[2] - oldz > 0){
float steptime;
steptime = cl.time - cl.oldtime;
- if (steptime < 0)
-//FIXME I_Error ("steptime < 0");
+ if (steptime < 0){
+ //FIXME I_Error ("steptime < 0");
steptime = 0;
+ }
oldz += steptime * 80;
if (oldz > ent->origin[2])
@@ -825,7 +824,7 @@
if (con_forcedup)
return;
-// don't allow cheats in multiplayer
+ // don't allow cheats in multiplayer
if (cl.maxclients > 1)
{
setcvar ("scr_ofsx", "0");
@@ -835,7 +834,7 @@
if (cl.intermission)
{ // intermission / finale rendering
- V_CalcIntermissionRefdef ();
+ V_CalcIntermissionRefdef ();
}
else
{
@@ -847,9 +846,7 @@
if (lcd_x.value)
{
- //
// render two interleaved views
- //
int i;
vid.rowbytes <<= 1;
@@ -882,7 +879,7 @@
}
if (crosshair.value)
- Draw_Character (scr_vrect.x + scr_vrect.width/2 + cl_crossx.value,
+ Draw_Character (scr_vrect.x + scr_vrect.width/2 + cl_crossx.value,
scr_vrect.y + scr_vrect.height/2 + cl_crossy.value, '+');
}
@@ -895,7 +892,7 @@
*/
void V_Init (void)
{
- Cmd_AddCommand ("v_cshift", V_cshift_f);
+ Cmd_AddCommand ("v_cshift", V_cshift_f);
Cmd_AddCommand ("bf", V_BonusFlash_f);
Cmd_AddCommand ("centerview", V_StartPitchDrift);
@@ -929,8 +926,8 @@
Cvar_RegisterVariable (&v_kicktime);
Cvar_RegisterVariable (&v_kickroll);
- Cvar_RegisterVariable (&v_kickpitch);
-
+ Cvar_RegisterVariable (&v_kickpitch);
+
BuildGammaTable (1.0); // no gamma yet
Cvar_RegisterVariable (&v_gamma);
}
--- a/wad.c
+++ b/wad.c
@@ -21,18 +21,18 @@
{
int i;
int c;
-
+
for (i=0 ; i<16 ; i++ )
{
c = in[i];
if (!c)
break;
-
+
if (c >= 'A' && c <= 'Z')
c += ('a' - 'A');
out[i] = c;
}
-
+
for ( ; i< 16 ; i++ )
out[i] = 0;
}
@@ -56,17 +56,17 @@
fatal("W_LoadWadFile: %s", lerr());
header = (wadinfo_t *)wad_base;
-
+
if (header->identification[0] != 'W'
|| header->identification[1] != 'A'
|| header->identification[2] != 'D'
|| header->identification[3] != '2')
fatal ("Wad file %s doesn't have WAD2 id\n",filename);
-
+
wad_numlumps = LittleLong(header->numlumps);
infotableofs = LittleLong(header->infotableofs);
wad_lumps = (lumpinfo_t *)(wad_base + infotableofs);
-
+
for (i=0, lump_p = wad_lumps ; i<wad_numlumps ; i++,lump_p++)
{
lump_p->filepos = LittleLong(lump_p->filepos);
@@ -88,15 +88,15 @@
int i;
lumpinfo_t *lump_p;
char clean[16];
-
+
W_CleanupName (name, clean);
-
+
for (lump_p=wad_lumps, i=0 ; i<wad_numlumps ; i++,lump_p++)
{
if (!strcmp(clean, lump_p->name))
return lump_p;
}
-
+
fatal ("W_GetLumpinfo: %s not found", name);
return nil;
}
@@ -104,9 +104,9 @@
void *W_GetLumpName (char *name)
{
lumpinfo_t *lump;
-
+
lump = W_GetLumpinfo (name);
-
+
return (void *)(wad_base + lump->filepos);
}
@@ -113,12 +113,12 @@
void *W_GetLumpNum (int num)
{
lumpinfo_t *lump;
-
+
if (num < 0 || num > wad_numlumps)
fatal ("W_GetLumpNum: bad number: %d", num);
-
+
lump = wad_lumps + num;
-
+
return (void *)(wad_base + lump->filepos);
}
@@ -133,5 +133,5 @@
void SwapPic (qpic_t *pic)
{
pic->width = LittleLong(pic->width);
- pic->height = LittleLong(pic->height);
+ pic->height = LittleLong(pic->height);
}
--- a/world.c
+++ b/world.c
@@ -57,19 +57,19 @@
for (i=0 ; i<6 ; i++)
{
box_clipnodes[i].planenum = i;
-
+
side = i&1;
-
+
box_clipnodes[i].children[side] = CONTENTS_EMPTY;
if (i != 5)
box_clipnodes[i].children[side^1] = i + 1;
else
box_clipnodes[i].children[side^1] = CONTENTS_SOLID;
-
+
box_planes[i].type = i>>1;
box_planes[i].normal[i>>1] = 1;
}
-
+
}
@@ -112,7 +112,7 @@
vec3_t hullmins, hullmaxs;
hull_t *hull;
-// decide which clipping hull to use, based on the size
+ // decide which clipping hull to use, based on the size
if (ent->v.solid == SOLID_BSP)
{ // explicit hulls in the BSP model
if (ent->v.movetype != MOVETYPE_PUSH)
@@ -131,7 +131,7 @@
else
hull = &model->hulls[2];
-// calculate an offset value to center the origin
+ // calculate an offset value to center the origin
VectorSubtract (hull->clip_mins, mins, offset);
VectorAdd (offset, ent->v.origin, offset);
}
@@ -141,7 +141,7 @@
VectorSubtract (ent->v.mins, maxs, hullmins);
VectorSubtract (ent->v.maxs, mins, hullmaxs);
hull = SV_HullForBox (hullmins, hullmaxs);
-
+
VectorCopy (ent->v.origin, offset);
}
@@ -189,7 +189,7 @@
ClearLink (&anode->trigger_edicts);
ClearLink (&anode->solid_edicts);
-
+
if (depth == AREA_DEPTH)
{
anode->axis = -1;
@@ -196,21 +196,21 @@
anode->children[0] = anode->children[1] = nil;
return anode;
}
-
+
VectorSubtract (maxs, mins, size);
if (size[0] > size[1])
anode->axis = 0;
else
anode->axis = 1;
-
+
anode->dist = 0.5 * (maxs[anode->axis] + mins[anode->axis]);
- VectorCopy (mins, mins1);
- VectorCopy (mins, mins2);
- VectorCopy (maxs, maxs1);
- VectorCopy (maxs, maxs2);
-
+ VectorCopy (mins, mins1);
+ VectorCopy (mins, mins2);
+ VectorCopy (maxs, maxs1);
+ VectorCopy (maxs, maxs2);
+
maxs1[anode->axis] = mins2[anode->axis] = anode->dist;
-
+
anode->children[0] = SV_CreateAreaNode (depth+1, mins2, maxs2);
anode->children[1] = SV_CreateAreaNode (depth+1, mins1, maxs1);
@@ -259,7 +259,7 @@
edict_t *touch;
int old_self, old_other;
-// touch linked edicts
+ // touch linked edicts
for (l = node->trigger_edicts.next ; l != nil && l != &node->trigger_edicts ; l = next)
{
next = l->next;
@@ -286,11 +286,11 @@
pr_global_struct->self = old_self;
pr_global_struct->other = old_other;
}
-
-// recurse down both sides
+
+ // recurse down both sides
if (node->axis == -1)
return;
-
+
if ( ent->v.absmax[node->axis] > node->dist )
SV_TouchLinks ( ent, node->children[0] );
if ( ent->v.absmin[node->axis] < node->dist )
@@ -312,7 +312,7 @@
if(node->contents == CONTENTS_SOLID)
return 0;
-
+
if(node->contents < 0){
leafnum = (mleaf_t*)node - sv.worldmodel->leafs - 1;
return pvs[leafnum>>3] & (1<<(leafnum&7));
@@ -338,7 +338,7 @@
if (ent->area.prev)
SV_UnlinkEdict (ent); // unlink from old position
-
+
if (ent == sv.edicts)
return; // don't add the world
@@ -345,14 +345,12 @@
if (ent->free)
return;
-// set the abs box
- VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin);
+ // set the abs box
+ VectorAdd (ent->v.origin, ent->v.mins, ent->v.absmin);
VectorAdd (ent->v.origin, ent->v.maxs, ent->v.absmax);
-//
-// to make items easier to pick up and allow them to be grabbed off
-// of shelves, the abs sizes are expanded
-//
+ // to make items easier to pick up and allow them to be grabbed off
+ // of shelves, the abs sizes are expanded
if ((int)ent->v.flags & FL_ITEM)
{
ent->v.absmin[0] -= 15;
@@ -374,7 +372,7 @@
if (ent->v.solid == SOLID_NOT)
return;
-// find the first node that the ent's box crosses
+ // find the first node that the ent's box crosses
node = sv_areanodes;
while (1)
{
@@ -387,15 +385,14 @@
else
break; // crosses the node
}
-
-// link it in
+ // link it in
if (ent->v.solid == SOLID_TRIGGER)
InsertLinkBefore (&ent->area, &node->trigger_edicts);
else
InsertLinkBefore (&ent->area, &node->solid_edicts);
-
-// if touch_triggers, touch all entities at this node and decend for more
+
+ // if touch_triggers, touch all entities at this node and decend for more
if (touch_triggers)
SV_TouchLinks ( ent, sv_areanodes );
}
@@ -426,10 +423,10 @@
{
if (num < hull->firstclipnode || num > hull->lastclipnode)
fatal ("SV_HullPointContents: bad node number");
-
+
node = hull->clipnodes + num;
plane = hull->planes + node->planenum;
-
+
if (plane->type < 3)
d = p[plane->type] - plane->dist;
else
@@ -439,7 +436,7 @@
else
num = node->children[0];
}
-
+
return num;
}
@@ -479,10 +476,10 @@
trace_t trace;
trace = SV_Move (ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, 0, ent);
-
+
if (trace.startsolid)
return sv.edicts;
-
+
return nil;
}
@@ -515,7 +512,7 @@
int side;
float midf;
-// check for empty
+ // check for empty
if (num < 0)
{
if (num != CONTENTS_SOLID)
@@ -534,9 +531,7 @@
if (num < hull->firstclipnode || num > hull->lastclipnode)
fatal ("SV_RecursiveHullCheck: bad node number");
-//
-// find the point distances
-//
+ // find the point distances
node = hull->clipnodes + num;
plane = hull->planes + node->planenum;
@@ -550,7 +545,7 @@
t1 = DotProductDouble(plane->normal, p1) - plane->dist;
t2 = DotProductDouble(plane->normal, p2) - plane->dist;
}
-
+
/*
if ( (t1 >= DIST_EPSILON && t2 >= DIST_EPSILON) || (t2 > t1 && t1 >= 0) )
return SV_RecursiveHullCheck (hull, node->children[0], p1f, p2f, p1, p2, trace);
@@ -562,7 +557,7 @@
if (t1 < 0 && t2 < 0)
return SV_RecursiveHullCheck (hull, node->children[1], p1f, p2f, p1, p2, trace);
-// put the crosspoint DIST_EPSILON pixels on the near side
+ // put the crosspoint DIST_EPSILON pixels on the near side
if (t1 < 0)
frac = (t1 + DIST_EPSILON)/(t1-t2);
else
@@ -571,7 +566,7 @@
frac = 0;
if (frac > 1)
frac = 1;
-
+
midf = p1f + (p2f - p1f)*frac;
for (i=0 ; i<3 ; i++)
mid[i] = p1[i] + frac*(p2[i] - p1[i]);
@@ -578,7 +573,7 @@
side = (t1 < 0);
-// move up to the node
+ // move up to the node
if (!SV_RecursiveHullCheck (hull, node->children[side], p1f, midf, p1, mid, trace) )
return false;
@@ -590,17 +585,17 @@
return false;
}
#endif
-
+
if (SV_HullPointContents (hull, node->children[side^1], mid) != CONTENTS_SOLID)
-// go past the node
+ // go past the node
return SV_RecursiveHullCheck (hull, node->children[side^1], midf, p2f, mid, p2, trace);
-
+
if (trace->allsolid)
return false; // never got out of the solid area
-
-//==================
-// the other side of the node is solid, this is the impact point
-//==================
+
+ //==================
+ // the other side of the node is solid, this is the impact point
+ //==================
if (!side)
{
VectorCopy (plane->normal, trace->plane.normal);
@@ -612,8 +607,7 @@
trace->plane.dist = -plane->dist;
}
- while (SV_HullPointContents (hull, hull->firstclipnode, mid)
- == CONTENTS_SOLID)
+ while (SV_HullPointContents (hull, hull->firstclipnode, mid) == CONTENTS_SOLID)
{ // shouldn't really happen, but does occasionally
frac -= 0.1;
if (frac < 0)
@@ -650,26 +644,26 @@
vec3_t start_l, end_l;
hull_t *hull;
-// fill in a default trace
+ // fill in a default trace
memset(&trace, 0, sizeof trace);
trace.fraction = 1;
trace.allsolid = true;
VectorCopy (end, trace.endpos);
-// get the clipping hull
+ // get the clipping hull
hull = SV_HullForEntity (ent, mins, maxs, offset);
VectorSubtract (start, offset, start_l);
VectorSubtract (end, offset, end_l);
-// trace a line through the apropriate clipping hull
+ // trace a line through the apropriate clipping hull
SV_RecursiveHullCheck (hull, hull->firstclipnode, 0, 1, start_l, end_l, &trace);
-// fix trace up by the offset
+ // fix trace up by the offset
if (trace.fraction != 1)
VectorAdd (trace.endpos, offset, trace.endpos);
-// did we clip the move?
+ // did we clip the move?
if (trace.fraction < 1 || trace.startsolid )
trace.ent = ent;
@@ -691,7 +685,7 @@
edict_t *touch;
trace_t trace;
-// touch linked edicts
+ // touch linked edicts
for (l = node->solid_edicts.next ; l != &node->solid_edicts ; l = next)
{
next = l->next;
@@ -717,7 +711,7 @@
if (clip->passedict && clip->passedict->v.size[0] && !touch->v.size[0])
continue; // points never interact
- // might intersect, so do an exact clip
+ // might intersect, so do an exact clip
if (clip->trace.allsolid)
return;
if (clip->passedict)
@@ -747,8 +741,8 @@
else if (trace.startsolid)
clip->trace.startsolid = true;
}
-
-// recurse down both sides
+
+ // recurse down both sides
if (node->axis == -1)
return;
@@ -772,7 +766,7 @@
*/
int i;
-
+
for (i=0 ; i<3 ; i++)
{
if (end[i] > start[i])
@@ -800,7 +794,7 @@
memset(&clip, 0, sizeof clip);
-// clip to world
+ // clip to world
clip.trace = SV_ClipMoveToEntity ( sv.edicts, start, mins, maxs, end );
clip.start = start;
@@ -823,11 +817,11 @@
VectorCopy (mins, clip.mins2);
VectorCopy (maxs, clip.maxs2);
}
-
-// create the bounding box of the entire move
+
+ // create the bounding box of the entire move
SV_MoveBounds ( start, clip.mins2, clip.maxs2, end, clip.boxmins, clip.boxmaxs );
-// clip to entities
+ // clip to entities
SV_ClipToLinks ( sv_areanodes, &clip );
return clip.trace;
--- a/zone.c
+++ b/zone.c
@@ -140,7 +140,7 @@
Cache_Flush(void)
{
mem_t *s;
-
+
while(cache_head != nil){
s = cache_head->next;
free(cache_head);
@@ -188,7 +188,7 @@
cache_head = cs;
c->data = cs+1;
cs->user = c;
-
+
return c->data;
}