More cleaning up after slobs.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-03-21 21:26:26 +00:00
parent 5fb8aa07f3
commit 41bfde9cfa
8 changed files with 151 additions and 99 deletions

View file

@ -597,8 +597,8 @@ CL_RelinkEntities (void)
}
}
CL_NewDlight (i, ent->origin, state->effects);
if ( VectorDistance_fast(state->msg_origins[1], ent->origin)
> (256*256))
if (VectorDistance_fast (state->msg_origins[1], ent->origin)
> (256 * 256))
VectorCopy (ent ->origin, state->msg_origins[1]);
if (ent->model->flags & EF_ROCKET) {
dl = R_AllocDlight (i);

View file

@ -727,7 +727,9 @@ CL_ParseStaticSound (void)
S_StaticSound (cl.sound_precache[sound_num], org, vol, atten);
}
#define SHOWNET(x) if(cl_shownet->int_val==2)Con_Printf ("%3i:%s\n", net_message->readcount-1, x);
#define SHOWNET(x) \
if (cl_shownet->int_val == 2) \
Con_Printf ("%3i:%s\n", net_message->readcount - 1, x);
int viewentity;
@ -883,7 +885,7 @@ CL_ParseServerMessage (void)
case svc_spawnbaseline:
i = MSG_ReadShort (net_message);
// must use CL_EntityNum() to force cl.num_entities up
// must use CL_EntityNum () to force cl.num_entities up
CL_ParseBaseline (CL_EntityNum (i));
break;
case svc_spawnstatic:

View file

@ -154,11 +154,11 @@ CL_ClearTEnts (void)
int j;
for (j = 0; j < MAX_BEAM_ENTS; j++) {
CL_Init_Entity(&cl_beams[i].ent_list[j]);
CL_Init_Entity (&cl_beams[i].ent_list[j]);
}
}
for (i = 0; i < MAX_EXPLOSIONS; i++) {
CL_Init_Entity(&cl_explosions[i].ent);
CL_Init_Entity (&cl_explosions[i].ent);
}
}
@ -278,7 +278,7 @@ CL_ParseBeam (model_t *m)
b->entity = ent;
b->model = m;
b->endtime = cl.time + 0.2;
b->seed = rand();
b->seed = rand ();
VectorCopy (end, b->end);
if (b->entity != cl.viewentity) {
// this will be done in CL_UpdateBeams
@ -424,7 +424,7 @@ CL_ParseTEnt (void)
dl->radius = 350;
dl->die = cl.time + 0.5;
dl->decay = 300;
colorStart = (colorStart + (rand() % colorLength)) * 3;
colorStart = (colorStart + (rand () % colorLength)) * 3;
dl->color[0] = vid.palette[colorStart] * (1.0 / 255.0);
dl->color[1] = vid.palette[colorStart + 1] * (1.0 / 255.0);
dl->color[2] = vid.palette[colorStart + 2] * (1.0 / 255.0);

View file

@ -433,7 +433,7 @@ V_PrepBlend (void)
if (!vid.cshift_changed && !vid.recalc_refdef)
return;
V_CalcBlend();
V_CalcBlend ();
}
/* VIEW RENDERING */

View file

@ -711,7 +711,7 @@ Host_Say (qboolean teamonly)
save = host_client;
p = Hunk_TempAlloc (strlen(Cmd_Args (1)) + 1);
p = Hunk_TempAlloc (strlen (Cmd_Args (1)) + 1);
strcpy (p, Cmd_Args (1));
// remove quotes if present
if (*p == '"') {
@ -777,7 +777,7 @@ Host_Tell_f (void)
strcpy (text, host_client->name);
strcat (text, ": ");
p = Hunk_TempAlloc (strlen(Cmd_Args (1)) + 1);
p = Hunk_TempAlloc (strlen (Cmd_Args (1)) + 1);
strcpy (p, Cmd_Args (1));
// remove quotes if present

View file

@ -82,8 +82,8 @@ location_t *
locs_find (const vec3_t target)
{
int i;
i = locs_nearest(target);
if (i == -1)
i = locs_nearest (target);
if (i == -1)
return NULL;
return locations[i];
}
@ -139,7 +139,7 @@ locs_load (const char *filename)
char foundname[MAX_OSPATH];
int templength = 0;
snprintf(tmp,sizeof(tmp), "maps/%s",filename);
snprintf (tmp, sizeof(tmp), "maps/%s", filename);
templength = _QFS_FOpenFile (tmp, &file, foundname, 1);
if (!file) {
Con_Printf ("Couldn't load %s\n", tmp);
@ -156,7 +156,7 @@ locs_load (const char *filename)
if (t2 == t1)
continue;
loc[2] = strtol (t2, &t1, 0) * (1.0 / 8);
if ((t1 == t2) || (strlen(t1) < 2))
if ((t1 == t2) || (strlen (t1) < 2))
continue;
t1++;
t2 = strrchr (t1, '\n');
@ -199,23 +199,21 @@ locs_save (const char *filename, qboolean gz)
char locfile[MAX_OSPATH];
if (gz) {
if (strncmp(filename + strlen(filename) - 3,".gz",3) != 0)
snprintf (locfile, sizeof (locfile), "%s.gz",filename);
if (strncmp (filename + strlen (filename) - 3, ".gz", 3) != 0)
snprintf (locfile, sizeof (locfile), "%s.gz", filename);
else
strcpy(locfile,filename);
strcpy (locfile, filename);
locfd = Qopen (locfile,"z9w+");
} else
locfd = Qopen (filename,"w+");
if (locfd == 0) {
Con_Printf("ERROR: Unable to open %s\n",filename);
Con_Printf ("ERROR: Unable to open %s\n", filename);
return;
}
for (i=0; i < locations_count; i++)
Qprintf(locfd,"%.0f %.0f %.0f %s\n",
locations[i]->loc[0] * 8,
locations[i]->loc[1] * 8,
locations[i]->loc[2] * 8,
locations[i]->name);
Qprintf (locfd, "%.0f %.0f %.0f %s\n", locations[i]->loc[0] * 8,
locations[i]->loc[1] * 8, locations[i]->loc[2] * 8,
locations[i]->name);
Qclose (locfd);
}
@ -275,10 +273,10 @@ map_to_loc (const char *mapname, char *filename)
{
char *t1;
strcpy(filename, mapname);
t1 = strrchr(filename,'.');
strcpy (filename, mapname);
t1 = strrchr (filename, '.');
if (!t1)
Sys_Error ("Can't find .!");
t1++;
strcpy(t1,"loc");
strcpy (t1, "loc");
}

View file

@ -496,8 +496,8 @@ ReconstructHostEnt (struct hostent *s, void *flattened)
ptr = (char **) FARPKL (&old->h_aliases);
for (i = 0; i < (HOSTENT_ALIAS_LIMIT - 1) && FARPKL (ptr); i++, ptr++) {
s->h_aliases[i] = HostEnt_names[i];
// fstrncpyfrom(s->h_aliases[i], (void *) FARPKL(ptr),
// HOSTENT_STRLEN_LIMIT-1);
// fstrncpyfrom (s->h_aliases[i], (void *) FARPKL (ptr),
// HOSTENT_STRLEN_LIMIT - 1);
s->h_aliases[i][HOSTENT_STRLEN_LIMIT - 1] = 0;
}
s->h_aliases[i] = 0;

View file

@ -62,7 +62,7 @@ static __attribute__ ((unused)) const char rcsid[] =
This is a TERMINAL error, which will kill off the entire server.
Dumps self.
error(value)
error (value)
*/
void
PF_error (progs_t *pr)
@ -85,7 +85,7 @@ PF_error (progs_t *pr)
Dumps out self, then an error message. The program is aborted and self is
removed, but the level can continue.
objerror(value)
objerror (value)
*/
void
PF_objerror (progs_t *pr)
@ -107,7 +107,7 @@ PF_objerror (progs_t *pr)
PF_makevectors
Writes new values for v_forward, v_up, and v_right based on angles
makevectors(vector)
makevectors (vector)
*/
void
PF_makevectors (progs_t *pr)
@ -231,7 +231,7 @@ PF_setsize (progs_t *pr)
/*
PF_setmodel
setmodel(entity, model)
setmodel (entity, model)
*/
void
PF_setmodel (progs_t *pr)
@ -269,7 +269,7 @@ PF_setmodel (progs_t *pr)
broadcast print to everyone on server
bprint(value)
bprint (value)
*/
void
PF_bprint (progs_t *pr)
@ -285,7 +285,7 @@ PF_bprint (progs_t *pr)
single print to a specific client
sprint(clientent, value)
sprint (clientent, value)
*/
void
PF_sprint (progs_t *pr)
@ -313,12 +313,12 @@ PF_sprint (progs_t *pr)
single print to a specific client
centerprint(clientent, value)
centerprint (clientent, value)
*/
void
PF_centerprint (progs_t *pr)
{
const char *s;
const char *s;
client_t *client;
int entnum;
@ -339,7 +339,7 @@ PF_centerprint (progs_t *pr)
/*
PF_particle
particle(origin, color, count)
particle (origin, color, count)
*/
void
PF_particle (progs_t *pr)
@ -749,7 +749,7 @@ PF_precache_model (progs_t *pr)
/*
PF_walkmove
float(float yaw, float dist) walkmove
float (float yaw, float dist) walkmove
*/
void
PF_walkmove (progs_t *pr)
@ -790,7 +790,7 @@ PF_walkmove (progs_t *pr)
/*
PF_droptofloor
void() droptofloor
void () droptofloor
*/
void
PF_droptofloor (progs_t *pr)
@ -822,7 +822,7 @@ PF_droptofloor (progs_t *pr)
/*
PF_lightstyle
void(float style, string value) lightstyle
void (float style, string value) lightstyle
*/
void
PF_lightstyle (progs_t *pr)
@ -876,7 +876,7 @@ cvar_t *sv_aim;
PF_aim
Pick a vector for the player to shoot along
vector aim(entity, missilespeed)
vector aim (entity, missilespeed)
*/
void
PF_aim (progs_t *pr)
@ -1311,7 +1311,7 @@ PF_Fixme (progs_t *pr)
static void
PF_checkextension (progs_t *pr)
{
G_FLOAT(pr, OFS_RETURN) = 0; //FIXME make this function actually useful :P
G_FLOAT (pr, OFS_RETURN) = 0; // FIXME: make this function actually useful
}
void
@ -1320,69 +1320,121 @@ SV_PR_Cmds_Init ()
PR_Cmds_Init (&sv_pr_state);
PR_Obj_Progs_Init (&sv_pr_state);
PR_AddBuiltin (&sv_pr_state, "makevectors", PF_makevectors, 1); // void(entity e) makevectors
PR_AddBuiltin (&sv_pr_state, "setorigin", PF_setorigin, 2); // void(entity e, vector o) setorigin
PR_AddBuiltin (&sv_pr_state, "setmodel", PF_setmodel, 3); // void(entity e, string m) setmodel
PR_AddBuiltin (&sv_pr_state, "setsize", PF_setsize, 4); // void(entity e, vector min, vector max) setsize
PR_AddBuiltin (&sv_pr_state, "fixme", PF_Fixme, 5); // void(entity e, vector min, vector max) setabssize
PR_AddBuiltin (&sv_pr_state, "sound", PF_sound, 8); // void(entity e, float chan, string samp) sound
PR_AddBuiltin (&sv_pr_state, "error", PF_error, 10); // void(string e) error
PR_AddBuiltin (&sv_pr_state, "objerror", PF_objerror, 11); // void(string e) objerror
PR_AddBuiltin (&sv_pr_state, "spawn", PF_Spawn, 14); // entity() spawn
PR_AddBuiltin (&sv_pr_state, "remove", PF_Remove, 15); // void(entity e) remove
PR_AddBuiltin (&sv_pr_state, "traceline", PF_traceline, 16); // float(vector v1, vector v2, float tryents) traceline
PR_AddBuiltin (&sv_pr_state, "checkclient", PF_checkclient, 17); // entity() clientlist
PR_AddBuiltin (&sv_pr_state, "precache_sound", PF_precache_sound, 19); // void(string s) precache_sound
PR_AddBuiltin (&sv_pr_state, "precache_model", PF_precache_model, 20); // void(string s) precache_model
PR_AddBuiltin (&sv_pr_state, "stuffcmd", PF_stuffcmd, 21); // void(entity client, string s) stuffcmd
PR_AddBuiltin (&sv_pr_state, "findradius", PF_findradius, 22); // entity(vector org, float rad) findradius
PR_AddBuiltin (&sv_pr_state, "bprint", PF_bprint, 23); // void(string s) bprint
PR_AddBuiltin (&sv_pr_state, "sprint", PF_sprint, 24); // void(entity client, string s) sprint
PR_AddBuiltin (&sv_pr_state, "walkmove", PF_walkmove, 32); // float(float yaw, float dist) walkmove
// 33
PR_AddBuiltin (&sv_pr_state, "droptofloor", PF_droptofloor, 34); // float() droptofloor
PR_AddBuiltin (&sv_pr_state, "lightstyle", PF_lightstyle, 35); // void(float style, string value) lightstyle
// 39
PR_AddBuiltin (&sv_pr_state, "checkbottom", PF_checkbottom, 40); // float(entity e) checkbottom
PR_AddBuiltin (&sv_pr_state, "pointcontents", PF_pointcontents, 41); // float(vector v) pointcontents
// 42
PR_AddBuiltin (&sv_pr_state, "aim", PF_aim, 44); // vector(entity e, float speed) aim
PR_AddBuiltin (&sv_pr_state, "localcmd", PF_localcmd, 46); // void(string s) localcmd
PR_AddBuiltin (&sv_pr_state, "particle", PF_particle, 48); // void(vector o, vector d, float color, float count) particle
PR_AddBuiltin (&sv_pr_state, "changeyaw", PF_changeyaw, 49); // void() ChangeYaw
// 50
// void (entity e) makevectors
PR_AddBuiltin (&sv_pr_state, "makevectors", PF_makevectors, 1);
// void (entity e, vector o) setorigin
PR_AddBuiltin (&sv_pr_state, "setorigin", PF_setorigin, 2);
// void (entity e, string m) setmodel
PR_AddBuiltin (&sv_pr_state, "setmodel", PF_setmodel, 3);
// void (entity e, vector min, vector max) setsize
PR_AddBuiltin (&sv_pr_state, "setsize", PF_setsize, 4);
// void (entity e, vector min, vector max) setabssize
PR_AddBuiltin (&sv_pr_state, "fixme", PF_Fixme, 5);
PR_AddBuiltin (&sv_pr_state, "writebyte", PF_WriteByte, 52); // void(float to, float f) WriteByte
PR_AddBuiltin (&sv_pr_state, "writechar", PF_WriteChar, 53); // void(float to, float f) WriteChar
PR_AddBuiltin (&sv_pr_state, "writeshort", PF_WriteShort, 54); // void(float to, float f) WriteShort
PR_AddBuiltin (&sv_pr_state, "writelong", PF_WriteLong, 55); // void(float to, float f) WriteLong
PR_AddBuiltin (&sv_pr_state, "writecoord", PF_WriteCoord, 56); // void(float to, float f) WriteCoord
PR_AddBuiltin (&sv_pr_state, "writeangle", PF_WriteAngle, 57); // void(float to, float f) WriteAngle
PR_AddBuiltin (&sv_pr_state, "writestring", PF_WriteString, 58); // void(float to, string s) WriteString
PR_AddBuiltin (&sv_pr_state, "writeentity", PF_WriteEntity, 59); // void(float to, entity s) WriteEntity
// void (entity e, float chan, string samp) sound
PR_AddBuiltin (&sv_pr_state, "sound", PF_sound, 8);
PR_AddBuiltin (&sv_pr_state, "movetogoal", SV_MoveToGoal, 67); // void(float step) movetogoal
PR_AddBuiltin (&sv_pr_state, "precache_file", PF_precache_file, 68); // string(string s) precache_file
PR_AddBuiltin (&sv_pr_state, "makestatic", PF_makestatic, 69); // void(entity e) makestatic
// void (string e) error
PR_AddBuiltin (&sv_pr_state, "error", PF_error, 10);
// void (string e) objerror
PR_AddBuiltin (&sv_pr_state, "objerror", PF_objerror, 11);
// entity () spawn
PR_AddBuiltin (&sv_pr_state, "spawn", PF_Spawn, 14);
// void (entity e) remove
PR_AddBuiltin (&sv_pr_state, "remove", PF_Remove, 15);
// float (vector v1, vector v2, float tryents) traceline
PR_AddBuiltin (&sv_pr_state, "traceline", PF_traceline, 16);
// entity () clientlist
PR_AddBuiltin (&sv_pr_state, "checkclient", PF_checkclient, 17);
PR_AddBuiltin (&sv_pr_state, "changelevel", PF_changelevel, 70); // void(string s) changelevel
// 71
// void (string s) precache_sound
PR_AddBuiltin (&sv_pr_state, "precache_sound", PF_precache_sound, 19);
// void (string s) precache_model
PR_AddBuiltin (&sv_pr_state, "precache_model", PF_precache_model, 20);
// void (entity client, string s) stuffcmd
PR_AddBuiltin (&sv_pr_state, "stuffcmd", PF_stuffcmd, 21);
// entity (vector org, float rad) findradius
PR_AddBuiltin (&sv_pr_state, "findradius", PF_findradius, 22);
// void (string s) bprint
PR_AddBuiltin (&sv_pr_state, "bprint", PF_bprint, 23);
// void (entity client, string s) sprint
PR_AddBuiltin (&sv_pr_state, "sprint", PF_sprint, 24);
PR_AddBuiltin (&sv_pr_state, "centerprint", PF_centerprint, 73); // void(...) centerprint
// float (float yaw, float dist) walkmove
PR_AddBuiltin (&sv_pr_state, "walkmove", PF_walkmove, 32);
PR_AddBuiltin (&sv_pr_state, "ambientsound", PF_ambientsound, 74); // void(vector pos, string samp, float vol, float atten) ambientsound
// float () droptofloor
PR_AddBuiltin (&sv_pr_state, "droptofloor", PF_droptofloor, 34);
// void (float style, string value) lightstyle
PR_AddBuiltin (&sv_pr_state, "lightstyle", PF_lightstyle, 35);
PR_AddBuiltin (&sv_pr_state, "precache_model2", PF_precache_model, 75); // string(string s) precache_model2
PR_AddBuiltin (&sv_pr_state, "precache_sound2", PF_precache_sound, 76); // string(string s) precache_sound2
PR_AddBuiltin (&sv_pr_state, "precache_file2", PF_precache_file, 77); // string(string s) precache_file2
// float (entity e) checkbottom
PR_AddBuiltin (&sv_pr_state, "checkbottom", PF_checkbottom, 40);
// float (vector v) pointcontents
PR_AddBuiltin (&sv_pr_state, "pointcontents", PF_pointcontents, 41);
PR_AddBuiltin (&sv_pr_state, "setspawnparms", PF_setspawnparms, 78); // void(entity e) setspawnparms
// vector (entity e, float speed) aim
PR_AddBuiltin (&sv_pr_state, "aim", PF_aim, 44);
PR_AddBuiltin (&sv_pr_state, "hullpointcontents", PF_hullpointcontents, 93); // integer (entity ent, vector point) hullpointcontents
PR_AddBuiltin (&sv_pr_state, "getboxbounds", PF_getboxbounds, 94); // vector (integer hull, integer max) getboxbounds
PR_AddBuiltin (&sv_pr_state, "getboxhull", PF_getboxhull, 95); // integer () getboxhull
PR_AddBuiltin (&sv_pr_state, "freeboxhull", PF_freeboxhull, 96); // void (integer hull) freeboxhull
PR_AddBuiltin (&sv_pr_state, "rotate_bbox", PF_rotate_bbox, 97); // void (integer hull, vector right, vector forward, vector up, vector mins, vector maxs) rotate_bbox
// void (string s) localcmd
PR_AddBuiltin (&sv_pr_state, "localcmd", PF_localcmd, 46);
PR_AddBuiltin (&sv_pr_state, "checkextension", PF_checkextension, 99); // float () checkextension
// void (vector o, vector d, float color, float count) particle
PR_AddBuiltin (&sv_pr_state, "particle", PF_particle, 48);
// void () ChangeYaw
PR_AddBuiltin (&sv_pr_state, "changeyaw", PF_changeyaw, 49);
// void (float to, float f) WriteByte
PR_AddBuiltin (&sv_pr_state, "writebyte", PF_WriteByte, 52);
// void (float to, float f) WriteChar
PR_AddBuiltin (&sv_pr_state, "writechar", PF_WriteChar, 53);
// void (float to, float f) WriteShort
PR_AddBuiltin (&sv_pr_state, "writeshort", PF_WriteShort, 54);
// void (float to, float f) WriteLong
PR_AddBuiltin (&sv_pr_state, "writelong", PF_WriteLong, 55);
// void (float to, float f) WriteCoord
PR_AddBuiltin (&sv_pr_state, "writecoord", PF_WriteCoord, 56);
// void (float to, float f) WriteAngle
PR_AddBuiltin (&sv_pr_state, "writeangle", PF_WriteAngle, 57);
// void (float to, string s) WriteString
PR_AddBuiltin (&sv_pr_state, "writestring", PF_WriteString, 58);
// void (float to, entity s) WriteEntity
PR_AddBuiltin (&sv_pr_state, "writeentity", PF_WriteEntity, 59);
// void (float step) movetogoal
PR_AddBuiltin (&sv_pr_state, "movetogoal", SV_MoveToGoal, 67);
// string (string s) precache_file
PR_AddBuiltin (&sv_pr_state, "precache_file", PF_precache_file, 68);
// void (entity e) makestatic
PR_AddBuiltin (&sv_pr_state, "makestatic", PF_makestatic, 69);
// void (string s) changelevel
PR_AddBuiltin (&sv_pr_state, "changelevel", PF_changelevel, 70);
// void (...) centerprint
PR_AddBuiltin (&sv_pr_state, "centerprint", PF_centerprint, 73);
// void (vector pos, string samp, float vol, float atten) ambientsound
PR_AddBuiltin (&sv_pr_state, "ambientsound", PF_ambientsound, 74);
// string (string s) precache_model2
PR_AddBuiltin (&sv_pr_state, "precache_model2", PF_precache_model, 75);
// string (string s) precache_sound2
PR_AddBuiltin (&sv_pr_state, "precache_sound2", PF_precache_sound, 76);
// string (string s) precache_file2
PR_AddBuiltin (&sv_pr_state, "precache_file2", PF_precache_file, 77);
// void (entity e) setspawnparms
PR_AddBuiltin (&sv_pr_state, "setspawnparms", PF_setspawnparms, 78);
// integer (entity ent, vector point) hullpointcontents
PR_AddBuiltin (&sv_pr_state, "hullpointcontents", PF_hullpointcontents,
93);
// vector (integer hull, integer max) getboxbounds
PR_AddBuiltin (&sv_pr_state, "getboxbounds", PF_getboxbounds, 94);
// integer () getboxhull
PR_AddBuiltin (&sv_pr_state, "getboxhull", PF_getboxhull, 95);
// void (integer hull) freeboxhull
PR_AddBuiltin (&sv_pr_state, "freeboxhull", PF_freeboxhull, 96);
// void (integer hull, vector right, vector forward, vector up, vector mins, vector maxs) rotate_bbox
PR_AddBuiltin (&sv_pr_state, "rotate_bbox", PF_rotate_bbox, 97);
// float () checkextension
PR_AddBuiltin (&sv_pr_state, "checkextension", PF_checkextension, 99);
}