mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 23:52:22 +00:00
Clean up the diffs a bit between qw and nq sv_pr_cmds
Add some missing functions to nq. In qw, Sys_Printf is mapped to SV_Printf, so no harm there.
This commit is contained in:
parent
dcbe23b3d3
commit
e1b6f50345
4 changed files with 204 additions and 227 deletions
|
@ -32,76 +32,6 @@
|
||||||
#ifndef __sv_pr_cmds_h
|
#ifndef __sv_pr_cmds_h
|
||||||
#define __sv_pr_cmds_h
|
#define __sv_pr_cmds_h
|
||||||
|
|
||||||
void PF_error (progs_t * pr);
|
|
||||||
void PF_objerror (progs_t * pr);
|
|
||||||
void PF_makevectors (progs_t * pr);
|
|
||||||
void PF_setorigin (progs_t * pr);
|
|
||||||
void PF_setsize (progs_t * pr);
|
|
||||||
void PF_setmodel (progs_t * pr);
|
|
||||||
void PF_bprint (progs_t * pr);
|
|
||||||
void PF_sprint (progs_t * pr);
|
|
||||||
void PF_centerprint (progs_t * pr);
|
|
||||||
void PF_normalize (progs_t * pr);
|
|
||||||
void PF_vlen (progs_t * pr);
|
|
||||||
void PF_vectoyaw (progs_t * pr);
|
|
||||||
void PF_vectoangles (progs_t * pr);
|
|
||||||
void PF_random (progs_t * pr);
|
|
||||||
void PF_particle (progs_t * pr);
|
|
||||||
void PF_ambientsound (progs_t * pr);
|
|
||||||
void PF_sound (progs_t * pr);
|
|
||||||
void PF_break (progs_t * pr);
|
|
||||||
void PF_traceline (progs_t * pr);
|
|
||||||
void PF_TraceToss (progs_t * pr);
|
|
||||||
void PF_checkpos (progs_t * pr);
|
|
||||||
int PF_newcheckclient (progs_t * pr, int check);
|
|
||||||
void PF_checkclient (progs_t * pr);
|
|
||||||
void PF_stuffcmd (progs_t * pr);
|
|
||||||
void PF_localcmd (progs_t * pr);
|
|
||||||
void PF_cvar (progs_t * pr);
|
|
||||||
void PF_cvar_set (progs_t * pr);
|
|
||||||
void PF_findradius (progs_t * pr);
|
|
||||||
void PF_dprint (progs_t * pr);
|
|
||||||
void PF_ftos (progs_t * pr);
|
|
||||||
void PF_fabs (progs_t * pr);
|
|
||||||
void PF_vtos (progs_t * pr);
|
|
||||||
void PF_etos (progs_t * pr);
|
|
||||||
void PF_Spawn (progs_t * pr);
|
|
||||||
void PF_Remove (progs_t * pr);
|
|
||||||
void PF_Find (progs_t * pr);
|
|
||||||
void PF_precache_file (progs_t * pr);
|
|
||||||
void PF_precache_sound (progs_t * pr);
|
|
||||||
void PF_precache_model (progs_t * pr);
|
|
||||||
void PF_coredump (progs_t * pr);
|
|
||||||
void PF_traceon (progs_t * pr);
|
|
||||||
void PF_traceoff (progs_t * pr);
|
|
||||||
void PF_eprint (progs_t * pr);
|
|
||||||
void PF_walkmove (progs_t * pr);
|
|
||||||
void PF_droptofloor (progs_t * pr);
|
|
||||||
void PF_lightstyle (progs_t * pr);
|
|
||||||
void PF_rint (progs_t * pr);
|
|
||||||
void PF_floor (progs_t * pr);
|
|
||||||
void PF_ceil (progs_t * pr);
|
|
||||||
void PF_checkbottom (progs_t * pr);
|
|
||||||
void PF_pointcontents (progs_t * pr);
|
|
||||||
void PF_nextent (progs_t * pr);
|
|
||||||
void PF_aim (progs_t * pr);
|
|
||||||
void PF_changeyaw (progs_t * pr);
|
void PF_changeyaw (progs_t * pr);
|
||||||
void PF_changepitch (progs_t * pr);
|
|
||||||
void PF_WriteByte (progs_t * pr);
|
|
||||||
void PF_WriteChar (progs_t * pr);
|
|
||||||
void PF_WriteShort (progs_t * pr);
|
|
||||||
void PF_WriteLong (progs_t * pr);
|
|
||||||
void PF_WriteAngle (progs_t * pr);
|
|
||||||
void PF_WriteCoord (progs_t * pr);
|
|
||||||
void PF_WriteString (progs_t * pr);
|
|
||||||
void PF_WriteEntity (progs_t * pr);
|
|
||||||
void PF_makestatic (progs_t * pr);
|
|
||||||
void PF_setspawnparms (progs_t * pr);
|
|
||||||
void PF_changelevel (progs_t * pr);
|
|
||||||
void PF_WaterMove (progs_t * pr);
|
|
||||||
void PF_sin (progs_t * pr);
|
|
||||||
void PF_cos (progs_t * pr);
|
|
||||||
void PF_sqrt (progs_t * pr);
|
|
||||||
void PF_Fixme (progs_t * pr);
|
|
||||||
|
|
||||||
#endif // __sv_pr_cmds_h
|
#endif // __sv_pr_cmds_h
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static __attribute__ ((used)) const char rcsid[] =
|
static __attribute__ ((used)) const char rcsid[] =
|
||||||
"$Id$";
|
"$Id$";
|
||||||
|
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
|
@ -37,6 +37,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
||||||
#ifdef HAVE_STRINGS_H
|
#ifdef HAVE_STRINGS_H
|
||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "QF/cbuf.h"
|
#include "QF/cbuf.h"
|
||||||
#include "QF/clip_hull.h"
|
#include "QF/clip_hull.h"
|
||||||
|
@ -65,7 +66,7 @@ static __attribute__ ((used)) const char rcsid[] =
|
||||||
error (value)
|
error (value)
|
||||||
// void (string e) error
|
// void (string e) error
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_error (progs_t *pr)
|
PF_error (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -89,7 +90,7 @@ PF_error (progs_t *pr)
|
||||||
objerror (value)
|
objerror (value)
|
||||||
// void (string e) objerror
|
// void (string e) objerror
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_objerror (progs_t *pr)
|
PF_objerror (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -109,9 +110,9 @@ PF_objerror (progs_t *pr)
|
||||||
PF_makevectors
|
PF_makevectors
|
||||||
|
|
||||||
Writes new values for v_forward, v_up, and v_right based on angles
|
Writes new values for v_forward, v_up, and v_right based on angles
|
||||||
void (entity e) makevectors
|
void (vector angles) makevectors
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_makevectors (progs_t *pr)
|
PF_makevectors (progs_t *pr)
|
||||||
{
|
{
|
||||||
AngleVectors (P_VECTOR (pr, 0), *sv_globals.v_forward,
|
AngleVectors (P_VECTOR (pr, 0), *sv_globals.v_forward,
|
||||||
|
@ -130,7 +131,7 @@ PF_makevectors (progs_t *pr)
|
||||||
setorigin (entity, origin)
|
setorigin (entity, origin)
|
||||||
// void (entity e, vector o) setorigin
|
// void (entity e, vector o) setorigin
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_setorigin (progs_t *pr)
|
PF_setorigin (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
@ -220,7 +221,7 @@ SetMinMaxSize (progs_t *pr, edict_t *e, const vec3_t min, const vec3_t max,
|
||||||
setsize (entity, minvector, maxvector)
|
setsize (entity, minvector, maxvector)
|
||||||
// void (entity e, vector min, vector max) setsize
|
// void (entity e, vector min, vector max) setsize
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_setsize (progs_t *pr)
|
PF_setsize (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
@ -238,7 +239,7 @@ PF_setsize (progs_t *pr)
|
||||||
setmodel (entity, model)
|
setmodel (entity, model)
|
||||||
// void (entity e, string m) setmodel
|
// void (entity e, string m) setmodel
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_setmodel (progs_t *pr)
|
PF_setmodel (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
@ -258,9 +259,9 @@ PF_setmodel (progs_t *pr)
|
||||||
PR_RunError (pr, "no precache: %s\n", m);
|
PR_RunError (pr, "no precache: %s\n", m);
|
||||||
|
|
||||||
SVstring (e, model) = PR_SetString (pr, m);
|
SVstring (e, model) = PR_SetString (pr, m);
|
||||||
SVfloat (e, modelindex) = i; // SV_ModelIndex (m);
|
SVfloat (e, modelindex) = i;
|
||||||
|
|
||||||
mod = sv.models[(int) SVfloat (e, modelindex)]; // Mod_ForName (m, true);
|
mod = sv.models[i];
|
||||||
|
|
||||||
if (mod) {
|
if (mod) {
|
||||||
// FIXME disabled for now as setting clipmins/maxs is currently
|
// FIXME disabled for now as setting clipmins/maxs is currently
|
||||||
|
@ -282,7 +283,7 @@ PF_setmodel (progs_t *pr)
|
||||||
bprint (value)
|
bprint (value)
|
||||||
// void (string s) bprint
|
// void (string s) bprint
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_bprint (progs_t *pr)
|
PF_bprint (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -299,7 +300,7 @@ PF_bprint (progs_t *pr)
|
||||||
sprint (clientent, value)
|
sprint (clientent, value)
|
||||||
// void (entity client, string s) sprint
|
// void (entity client, string s) sprint
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_sprint (progs_t *pr)
|
PF_sprint (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -328,7 +329,7 @@ PF_sprint (progs_t *pr)
|
||||||
centerprint (clientent, value)
|
centerprint (clientent, value)
|
||||||
// void (...) centerprint
|
// void (...) centerprint
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_centerprint (progs_t *pr)
|
PF_centerprint (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -350,7 +351,7 @@ PF_centerprint (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (vector o, vector d, float color, float count) particle
|
// void (vector o, vector d, float color, float count) particle
|
||||||
void
|
static void
|
||||||
PF_particle (progs_t *pr)
|
PF_particle (progs_t *pr)
|
||||||
{
|
{
|
||||||
float *org, *dir;
|
float *org, *dir;
|
||||||
|
@ -368,7 +369,7 @@ PF_particle (progs_t *pr)
|
||||||
PF_ambientsound
|
PF_ambientsound
|
||||||
// void (vector pos, string samp, float vol, float atten) ambientsound
|
// void (vector pos, string samp, float vol, float atten) ambientsound
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_ambientsound (progs_t *pr)
|
PF_ambientsound (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char **check;
|
const char **check;
|
||||||
|
@ -424,7 +425,7 @@ PF_ambientsound (progs_t *pr)
|
||||||
Larger attenuations will drop off.
|
Larger attenuations will drop off.
|
||||||
// void (entity e, float chan, string samp) sound
|
// void (entity e, float chan, string samp) sound
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_sound (progs_t *pr)
|
PF_sound (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *sample;
|
const char *sample;
|
||||||
|
@ -458,7 +459,7 @@ PF_sound (progs_t *pr)
|
||||||
traceline (vector1, vector2, tryents)
|
traceline (vector1, vector2, tryents)
|
||||||
// float (vector v1, vector v2, float tryents) traceline
|
// float (vector v1, vector v2, float tryents) traceline
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_traceline (progs_t *pr)
|
PF_traceline (progs_t *pr)
|
||||||
{
|
{
|
||||||
float *v1, *v2;
|
float *v1, *v2;
|
||||||
|
@ -488,6 +489,45 @@ PF_traceline (progs_t *pr)
|
||||||
*sv_globals.trace_ent = EDICT_TO_PROG (pr, sv.edicts);
|
*sv_globals.trace_ent = EDICT_TO_PROG (pr, sv.edicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
PF_tracebox
|
||||||
|
// void (vector start, vector mins, vector maxs, vector end, float type,
|
||||||
|
// entity passent) tracebox
|
||||||
|
|
||||||
|
Wrapper around SV_Move, this makes PF_movetoground and PF_traceline
|
||||||
|
redundant.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
PF_tracebox (progs_t *pr)
|
||||||
|
{
|
||||||
|
edict_t *ent;
|
||||||
|
float *start, *end, *mins, *maxs;
|
||||||
|
int type;
|
||||||
|
trace_t trace;
|
||||||
|
|
||||||
|
start = P_VECTOR (pr, 0);
|
||||||
|
mins = P_VECTOR (pr, 1);
|
||||||
|
maxs = P_VECTOR (pr, 2);
|
||||||
|
end = P_VECTOR (pr, 3);
|
||||||
|
type = P_FLOAT (pr, 4);
|
||||||
|
ent = P_EDICT (pr, 5);
|
||||||
|
|
||||||
|
trace = SV_Move (start, mins, maxs, end, type, ent);
|
||||||
|
|
||||||
|
*sv_globals.trace_allsolid = trace.allsolid;
|
||||||
|
*sv_globals.trace_startsolid = trace.startsolid;
|
||||||
|
*sv_globals.trace_fraction = trace.fraction;
|
||||||
|
*sv_globals.trace_inwater = trace.inwater;
|
||||||
|
*sv_globals.trace_inopen = trace.inopen;
|
||||||
|
VectorCopy (trace.endpos, *sv_globals.trace_endpos);
|
||||||
|
VectorCopy (trace.plane.normal, *sv_globals.trace_plane_normal);
|
||||||
|
*sv_globals.trace_plane_dist = trace.plane.dist;
|
||||||
|
if (trace.ent)
|
||||||
|
*sv_globals.trace_ent = EDICT_TO_PROG (pr, trace.ent);
|
||||||
|
else
|
||||||
|
*sv_globals.trace_ent = EDICT_TO_PROG (pr, sv.edicts);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PF_checkpos
|
PF_checkpos
|
||||||
|
|
||||||
|
@ -496,14 +536,14 @@ PF_traceline (progs_t *pr)
|
||||||
FIXME: make work...
|
FIXME: make work...
|
||||||
scalar checkpos (entity, vector)
|
scalar checkpos (entity, vector)
|
||||||
*/
|
*/
|
||||||
void
|
static void __attribute__ ((used))
|
||||||
PF_checkpos (progs_t *pr)
|
PF_checkpos (progs_t *pr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
byte checkpvs[MAX_MAP_LEAFS / 8];
|
byte checkpvs[MAX_MAP_LEAFS / 8];
|
||||||
|
|
||||||
int
|
static int
|
||||||
PF_newcheckclient (progs_t *pr, int check)
|
PF_newcheckclient (progs_t *pr, int check)
|
||||||
{
|
{
|
||||||
byte *pvs;
|
byte *pvs;
|
||||||
|
@ -538,6 +578,7 @@ PF_newcheckclient (progs_t *pr, int check)
|
||||||
continue;
|
continue;
|
||||||
if ((int) SVfloat (ent, flags) & FL_NOTARGET)
|
if ((int) SVfloat (ent, flags) & FL_NOTARGET)
|
||||||
continue;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -566,9 +607,9 @@ int c_invis, c_notvis;
|
||||||
it is not returned at all.
|
it is not returned at all.
|
||||||
|
|
||||||
name checkclient ()
|
name checkclient ()
|
||||||
// entity () clientlist
|
// entity () clientlist
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_checkclient (progs_t *pr)
|
PF_checkclient (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ent, *self;
|
edict_t *ent, *self;
|
||||||
|
@ -610,7 +651,7 @@ PF_checkclient (progs_t *pr)
|
||||||
stuffcmd (clientent, value)
|
stuffcmd (clientent, value)
|
||||||
// void (entity client, string s) stuffcmd
|
// void (entity client, string s) stuffcmd
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_stuffcmd (progs_t *pr)
|
PF_stuffcmd (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
@ -636,7 +677,7 @@ PF_stuffcmd (progs_t *pr)
|
||||||
localcmd (string)
|
localcmd (string)
|
||||||
// void (string s) localcmd
|
// void (string s) localcmd
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_localcmd (progs_t *pr)
|
PF_localcmd (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
|
@ -653,20 +694,20 @@ PF_localcmd (progs_t *pr)
|
||||||
findradius (origin, radius)
|
findradius (origin, radius)
|
||||||
// entity (vector org, float rad) findradius
|
// entity (vector org, float rad) findradius
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_findradius (progs_t *pr)
|
PF_findradius (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ent, *chain;
|
edict_t *ent, *chain;
|
||||||
float rad;
|
float rsqr;
|
||||||
float *eorigin, *emins, *emaxs, *org;
|
vec_t *emins, *emaxs, *org;
|
||||||
int i, j;
|
int i, j;
|
||||||
vec3_t eorg;
|
vec3_t eorg;
|
||||||
|
|
||||||
chain = (edict_t *) sv.edicts;
|
chain = (edict_t *) sv.edicts;
|
||||||
|
|
||||||
org = P_VECTOR (pr, 0);
|
org = P_VECTOR (pr, 0);
|
||||||
rad = P_FLOAT (pr, 1);
|
rsqr = P_FLOAT (pr, 1);
|
||||||
rad *= rad; // Square early, sqrt never
|
rsqr *= rsqr; // Square early, sqrt never
|
||||||
|
|
||||||
ent = NEXT_EDICT (pr, sv.edicts);
|
ent = NEXT_EDICT (pr, sv.edicts);
|
||||||
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
|
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
|
||||||
|
@ -674,12 +715,11 @@ PF_findradius (progs_t *pr)
|
||||||
continue;
|
continue;
|
||||||
if (SVfloat (ent, solid) == SOLID_NOT)
|
if (SVfloat (ent, solid) == SOLID_NOT)
|
||||||
continue;
|
continue;
|
||||||
eorigin = SVvector (ent, origin);
|
emins = SVvector (ent, absmin);
|
||||||
emins = SVvector (ent, mins);
|
emaxs = SVvector (ent, absmax);
|
||||||
emaxs = SVvector (ent, maxs);
|
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
eorg[j] = org[j] - eorigin[j] - 0.5 * (emins[j] + emaxs[j]);
|
eorg[j] = org[j] - 0.5 * (emins[j] + emaxs[j]);
|
||||||
if (DotProduct (eorg, eorg) > rad)
|
if (DotProduct (eorg, eorg) > rsqr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SVentity (ent, chain) = EDICT_TO_PROG (pr, chain);
|
SVentity (ent, chain) = EDICT_TO_PROG (pr, chain);
|
||||||
|
@ -690,7 +730,7 @@ PF_findradius (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// entity () spawn
|
// entity () spawn
|
||||||
void
|
static void
|
||||||
PF_Spawn (progs_t *pr)
|
PF_Spawn (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ed;
|
edict_t *ed;
|
||||||
|
@ -700,7 +740,7 @@ PF_Spawn (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (entity e) remove
|
// void (entity e) remove
|
||||||
void
|
static void
|
||||||
PF_Remove (progs_t *pr)
|
PF_Remove (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ed;
|
edict_t *ed;
|
||||||
|
@ -716,9 +756,43 @@ PR_CheckEmptyString (progs_t *pr, const char *s)
|
||||||
PR_RunError (pr, "Bad string");
|
PR_RunError (pr, "Bad string");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
do_precache (progs_t *pr, const char **cache, int max, const char *name,
|
||||||
|
const char *func)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
if (sv.state != ss_loading)
|
||||||
|
PR_RunError (pr, "%s: Precache can be done only in spawn functions",
|
||||||
|
func);
|
||||||
|
|
||||||
|
PR_CheckEmptyString (pr, name);
|
||||||
|
|
||||||
|
s = Hunk_TempAlloc (strlen (name) + 1);
|
||||||
|
for (i = 0; *name; i++, name++) {
|
||||||
|
int c = (byte) *name;
|
||||||
|
s[i] = tolower (c);
|
||||||
|
}
|
||||||
|
s[i] = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < MAX_SOUNDS; i++) {
|
||||||
|
if (!cache[i]) {
|
||||||
|
char *c = Hunk_Alloc (strlen (s) + 1);
|
||||||
|
strcpy (c, s);
|
||||||
|
cache[i] = c; // blah, const
|
||||||
|
Sys_MaskPrintf (SYS_DEV, "%s: %3d %s\n", func, i, s);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!strcmp (cache[i], s))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PR_RunError (pr, "%s: overflow", func);
|
||||||
|
}
|
||||||
|
|
||||||
// string (string s) precache_file
|
// string (string s) precache_file
|
||||||
// string (string s) precache_file2
|
// string (string s) precache_file2
|
||||||
void
|
static void
|
||||||
PF_precache_file (progs_t *pr)
|
PF_precache_file (progs_t *pr)
|
||||||
{
|
{
|
||||||
// precache_file is used only to copy files with qcc, it does nothing
|
// precache_file is used only to copy files with qcc, it does nothing
|
||||||
|
@ -727,57 +801,22 @@ PF_precache_file (progs_t *pr)
|
||||||
|
|
||||||
// void (string s) precache_sound
|
// void (string s) precache_sound
|
||||||
// string (string s) precache_sound2
|
// string (string s) precache_sound2
|
||||||
void
|
static void
|
||||||
PF_precache_sound (progs_t *pr)
|
PF_precache_sound (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
do_precache (pr, sv.sound_precache, MAX_SOUNDS, P_GSTRING (pr, 0),
|
||||||
int i;
|
"precache_sound");
|
||||||
|
|
||||||
if (sv.state != ss_loading)
|
|
||||||
PR_RunError (pr, "PF_Precache_*: Precache can be done only in spawn "
|
|
||||||
"functions");
|
|
||||||
|
|
||||||
s = P_GSTRING (pr, 0);
|
|
||||||
R_INT (pr) = P_INT (pr, 0);
|
R_INT (pr) = P_INT (pr, 0);
|
||||||
PR_CheckEmptyString (pr, s);
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_SOUNDS; i++) {
|
|
||||||
if (!sv.sound_precache[i]) {
|
|
||||||
sv.sound_precache[i] = s;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!strcmp (sv.sound_precache[i], s))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PR_RunError (pr, "PF_precache_sound: overflow");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (string s) precache_model
|
// void (string s) precache_model
|
||||||
// string (string s) precache_model2
|
// string (string s) precache_model2
|
||||||
void
|
static void
|
||||||
PF_precache_model (progs_t *pr)
|
PF_precache_model (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
do_precache (pr, sv.model_precache, MAX_MODELS, P_GSTRING (pr, 0),
|
||||||
int i;
|
"precache_model");
|
||||||
|
|
||||||
if (sv.state != ss_loading)
|
|
||||||
PR_RunError (pr, "PF_Precache_*: Precache can be done only in spawn "
|
|
||||||
"functions");
|
|
||||||
|
|
||||||
s = P_GSTRING (pr, 0);
|
|
||||||
R_INT (pr) = P_INT (pr, 0);
|
R_INT (pr) = P_INT (pr, 0);
|
||||||
PR_CheckEmptyString (pr, s);
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_MODELS; i++) {
|
|
||||||
if (!sv.model_precache[i]) {
|
|
||||||
sv.model_precache[i] = s;
|
|
||||||
sv.models[i] = Mod_ForName (s, true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!strcmp (sv.model_precache[i], s))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
PR_RunError (pr, "PF_precache_model: overflow");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -786,7 +825,7 @@ PF_precache_model (progs_t *pr)
|
||||||
float (float yaw, float dist) walkmove
|
float (float yaw, float dist) walkmove
|
||||||
// float (float yaw, float dist) walkmove
|
// float (float yaw, float dist) walkmove
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_walkmove (progs_t *pr)
|
PF_walkmove (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
@ -824,7 +863,7 @@ PF_walkmove (progs_t *pr)
|
||||||
void () droptofloor
|
void () droptofloor
|
||||||
// float () droptofloor
|
// float () droptofloor
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_droptofloor (progs_t *pr)
|
PF_droptofloor (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
@ -856,11 +895,11 @@ PF_droptofloor (progs_t *pr)
|
||||||
void (float style, string value) lightstyle
|
void (float style, string value) lightstyle
|
||||||
// void (float style, string value) lightstyle
|
// void (float style, string value) lightstyle
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_lightstyle (progs_t *pr)
|
PF_lightstyle (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *val;
|
const char *val;
|
||||||
client_t *client;
|
client_t *cl;
|
||||||
int style, j;
|
int style, j;
|
||||||
|
|
||||||
style = P_FLOAT (pr, 0);
|
style = P_FLOAT (pr, 0);
|
||||||
|
@ -873,16 +912,16 @@ PF_lightstyle (progs_t *pr)
|
||||||
if (sv.state != ss_active)
|
if (sv.state != ss_active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++)
|
for (j = 0, cl = svs.clients; j < svs.maxclients; j++, cl++)
|
||||||
if (client->active || client->spawned) {
|
if (cl->active || cl->spawned) {
|
||||||
MSG_WriteByte (&client->message, svc_lightstyle);
|
MSG_WriteByte (&cl->message, svc_lightstyle);
|
||||||
MSG_WriteByte (&client->message, style);
|
MSG_WriteByte (&cl->message, style);
|
||||||
MSG_WriteString (&client->message, val);
|
MSG_WriteString (&cl->message, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// float (entity e) checkbottom
|
// float (entity e) checkbottom
|
||||||
void
|
static void
|
||||||
PF_checkbottom (progs_t *pr)
|
PF_checkbottom (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
@ -893,7 +932,7 @@ PF_checkbottom (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// float (vector v) pointcontents
|
// float (vector v) pointcontents
|
||||||
void
|
static void
|
||||||
PF_pointcontents (progs_t *pr)
|
PF_pointcontents (progs_t *pr)
|
||||||
{
|
{
|
||||||
float *v;
|
float *v;
|
||||||
|
@ -912,7 +951,7 @@ cvar_t *sv_aim;
|
||||||
vector aim (entity, missilespeed)
|
vector aim (entity, missilespeed)
|
||||||
// vector (entity e, float speed) aim
|
// vector (entity e, float speed) aim
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
PF_aim (progs_t *pr)
|
PF_aim (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ent, *check, *bestent;
|
edict_t *ent, *check, *bestent;
|
||||||
|
@ -924,7 +963,7 @@ PF_aim (progs_t *pr)
|
||||||
|
|
||||||
ent = P_EDICT (pr, 0);
|
ent = P_EDICT (pr, 0);
|
||||||
speed = P_FLOAT (pr, 1);
|
speed = P_FLOAT (pr, 1);
|
||||||
(void)speed; //FIXME
|
(void) speed; //FIXME
|
||||||
|
|
||||||
VectorCopy (SVvector (ent, origin), start);
|
VectorCopy (SVvector (ent, origin), start);
|
||||||
start[2] += 20;
|
start[2] += 20;
|
||||||
|
@ -1077,42 +1116,42 @@ PF_WriteBytes (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (float to, float f) WriteByte
|
// void (float to, float f) WriteByte
|
||||||
void
|
static void
|
||||||
PF_WriteByte (progs_t *pr)
|
PF_WriteByte (progs_t *pr)
|
||||||
{
|
{
|
||||||
MSG_WriteByte (WriteDest (pr), P_FLOAT (pr, 1));
|
MSG_WriteByte (WriteDest (pr), P_FLOAT (pr, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (float to, float f) WriteChar
|
// void (float to, float f) WriteChar
|
||||||
void
|
static void
|
||||||
PF_WriteChar (progs_t *pr)
|
PF_WriteChar (progs_t *pr)
|
||||||
{
|
{
|
||||||
MSG_WriteByte (WriteDest (pr), P_FLOAT (pr, 1));
|
MSG_WriteByte (WriteDest (pr), P_FLOAT (pr, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (float to, float f) WriteShort
|
// void (float to, float f) WriteShort
|
||||||
void
|
static void
|
||||||
PF_WriteShort (progs_t *pr)
|
PF_WriteShort (progs_t *pr)
|
||||||
{
|
{
|
||||||
MSG_WriteShort (WriteDest (pr), P_FLOAT (pr, 1));
|
MSG_WriteShort (WriteDest (pr), P_FLOAT (pr, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (float to, float f) WriteLong
|
// void (float to, float f) WriteLong
|
||||||
void
|
static void
|
||||||
PF_WriteLong (progs_t *pr)
|
PF_WriteLong (progs_t *pr)
|
||||||
{
|
{
|
||||||
MSG_WriteLong (WriteDest (pr), P_FLOAT (pr, 1));
|
MSG_WriteLong (WriteDest (pr), P_FLOAT (pr, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (float to, float f) WriteAngle
|
// void (float to, float f) WriteAngle
|
||||||
void
|
static void
|
||||||
PF_WriteAngle (progs_t *pr)
|
PF_WriteAngle (progs_t *pr)
|
||||||
{
|
{
|
||||||
MSG_WriteAngle (WriteDest (pr), P_FLOAT (pr, 1));
|
MSG_WriteAngle (WriteDest (pr), P_FLOAT (pr, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (float to, float f) WriteCoord
|
// void (float to, float f) WriteCoord
|
||||||
void
|
static void
|
||||||
PF_WriteCoord (progs_t *pr)
|
PF_WriteCoord (progs_t *pr)
|
||||||
{
|
{
|
||||||
MSG_WriteCoord (WriteDest (pr), P_FLOAT (pr, 1));
|
MSG_WriteCoord (WriteDest (pr), P_FLOAT (pr, 1));
|
||||||
|
@ -1137,23 +1176,21 @@ PF_WriteCoordV (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (float to, string s) WriteString
|
// void (float to, string s) WriteString
|
||||||
void
|
static void
|
||||||
PF_WriteString (progs_t *pr)
|
PF_WriteString (progs_t *pr)
|
||||||
{
|
{
|
||||||
MSG_WriteString (WriteDest (pr), P_GSTRING (pr, 1));
|
MSG_WriteString (WriteDest (pr), P_GSTRING (pr, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (float to, entity s) WriteEntity
|
// void (float to, entity s) WriteEntity
|
||||||
void
|
static void
|
||||||
PF_WriteEntity (progs_t *pr)
|
PF_WriteEntity (progs_t *pr)
|
||||||
{
|
{
|
||||||
MSG_WriteShort (WriteDest (pr), P_EDICTNUM (pr, 1));
|
MSG_WriteShort (WriteDest (pr), P_EDICTNUM (pr, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
// void (entity e) makestatic
|
// void (entity e) makestatic
|
||||||
void
|
static void
|
||||||
PF_makestatic (progs_t *pr)
|
PF_makestatic (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *model;
|
const char *model;
|
||||||
|
@ -1211,7 +1248,7 @@ nosend:
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (entity e) setspawnparms
|
// void (entity e) setspawnparms
|
||||||
void
|
static void
|
||||||
PF_setspawnparms (progs_t *pr)
|
PF_setspawnparms (progs_t *pr)
|
||||||
{
|
{
|
||||||
client_t *client;
|
client_t *client;
|
||||||
|
@ -1231,7 +1268,7 @@ PF_setspawnparms (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
// void (string s) changelevel
|
// void (string s) changelevel
|
||||||
void
|
static void
|
||||||
PF_changelevel (progs_t *pr)
|
PF_changelevel (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -1245,6 +1282,14 @@ PF_changelevel (progs_t *pr)
|
||||||
Cbuf_AddText (host_cbuf, va ("changelevel %s\n", s));
|
Cbuf_AddText (host_cbuf, va ("changelevel %s\n", s));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// entity (entity ent) testentitypos
|
||||||
|
static void
|
||||||
|
PF_testentitypos (progs_t *pr)
|
||||||
|
{
|
||||||
|
edict_t *ent = P_EDICT (pr, 0);
|
||||||
|
ent = SV_TestEntityPosition (ent);
|
||||||
|
RETURN_EDICT (pr, ent ? ent : sv.edicts);
|
||||||
|
}
|
||||||
|
|
||||||
#define MAX_PF_HULLS 64 // FIXME make dynamic?
|
#define MAX_PF_HULLS 64 // FIXME make dynamic?
|
||||||
clip_hull_t *pf_hull_list[MAX_PF_HULLS];
|
clip_hull_t *pf_hull_list[MAX_PF_HULLS];
|
||||||
|
@ -1416,12 +1461,6 @@ PF_rotate_bbox (progs_t *pr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
PF_Fixme (progs_t *pr)
|
|
||||||
{
|
|
||||||
PR_RunError (pr, "unimplemented bulitin function called");
|
|
||||||
}
|
|
||||||
|
|
||||||
// float () checkextension
|
// float () checkextension
|
||||||
static void
|
static void
|
||||||
PF_checkextension (progs_t *pr)
|
PF_checkextension (progs_t *pr)
|
||||||
|
@ -1436,29 +1475,38 @@ static builtin_t builtins[] = {
|
||||||
{"setorigin", PF_setorigin, 2},
|
{"setorigin", PF_setorigin, 2},
|
||||||
{"setmodel", PF_setmodel, 3},
|
{"setmodel", PF_setmodel, 3},
|
||||||
{"setsize", PF_setsize, 4},
|
{"setsize", PF_setsize, 4},
|
||||||
{"fixme", PF_Fixme, 5},
|
|
||||||
{"sound", PF_sound, 8},
|
{"sound", PF_sound, 8},
|
||||||
|
|
||||||
{"error", PF_error, 10},
|
{"error", PF_error, 10},
|
||||||
{"objerror", PF_objerror, 11},
|
{"objerror", PF_objerror, 11},
|
||||||
{"spawn", PF_Spawn, 14},
|
{"spawn", PF_Spawn, 14},
|
||||||
{"remove", PF_Remove, 15},
|
{"remove", PF_Remove, 15},
|
||||||
{"traceline", PF_traceline, 16},
|
{"traceline", PF_traceline, 16},
|
||||||
{"checkclient", PF_checkclient, 17},
|
{"checkclient", PF_checkclient, 17},
|
||||||
|
|
||||||
{"precache_sound", PF_precache_sound, 19},
|
{"precache_sound", PF_precache_sound, 19},
|
||||||
{"precache_model", PF_precache_model, 20},
|
{"precache_model", PF_precache_model, 20},
|
||||||
{"stuffcmd", PF_stuffcmd, 21},
|
{"stuffcmd", PF_stuffcmd, 21},
|
||||||
{"findradius", PF_findradius, 22},
|
{"findradius", PF_findradius, 22},
|
||||||
{"bprint", PF_bprint, 23},
|
{"bprint", PF_bprint, 23},
|
||||||
{"sprint", PF_sprint, 24},
|
{"sprint", PF_sprint, 24},
|
||||||
|
|
||||||
{"walkmove", PF_walkmove, 32},
|
{"walkmove", PF_walkmove, 32},
|
||||||
|
|
||||||
{"droptofloor", PF_droptofloor, 34},
|
{"droptofloor", PF_droptofloor, 34},
|
||||||
{"lightstyle", PF_lightstyle, 35},
|
{"lightstyle", PF_lightstyle, 35},
|
||||||
|
|
||||||
{"checkbottom", PF_checkbottom, 40},
|
{"checkbottom", PF_checkbottom, 40},
|
||||||
{"pointcontents", PF_pointcontents, 41},
|
{"pointcontents", PF_pointcontents, 41},
|
||||||
|
|
||||||
{"aim", PF_aim, 44},
|
{"aim", PF_aim, 44},
|
||||||
|
|
||||||
{"localcmd", PF_localcmd, 46},
|
{"localcmd", PF_localcmd, 46},
|
||||||
|
|
||||||
{"particle", PF_particle, 48},
|
{"particle", PF_particle, 48},
|
||||||
{"changeyaw", PF_changeyaw, 49},
|
{"changeyaw", PF_changeyaw, 49},
|
||||||
|
|
||||||
{"writebyte", PF_WriteByte, 52},
|
{"writebyte", PF_WriteByte, 52},
|
||||||
{"WriteBytes", PF_WriteBytes, -1},
|
{"WriteBytes", PF_WriteBytes, -1},
|
||||||
{"writechar", PF_WriteChar, 53},
|
{"writechar", PF_WriteChar, 53},
|
||||||
|
@ -1470,26 +1518,30 @@ static builtin_t builtins[] = {
|
||||||
{"WriteAngleV", PF_WriteAngleV, -1},
|
{"WriteAngleV", PF_WriteAngleV, -1},
|
||||||
{"writestring", PF_WriteString, 58},
|
{"writestring", PF_WriteString, 58},
|
||||||
{"writeentity", PF_WriteEntity, 59},
|
{"writeentity", PF_WriteEntity, 59},
|
||||||
|
|
||||||
{"movetogoal", SV_MoveToGoal, 67},
|
{"movetogoal", SV_MoveToGoal, 67},
|
||||||
{"precache_file", PF_precache_file, 68},
|
{"precache_file", PF_precache_file, 68},
|
||||||
{"makestatic", PF_makestatic, 69},
|
{"makestatic", PF_makestatic, 69},
|
||||||
{"changelevel", PF_changelevel, 70},
|
{"changelevel", PF_changelevel, 70},
|
||||||
|
|
||||||
{"centerprint", PF_centerprint, 73},
|
{"centerprint", PF_centerprint, 73},
|
||||||
{"ambientsound", PF_ambientsound, 74},
|
{"ambientsound", PF_ambientsound, 74},
|
||||||
{"precache_model2", PF_precache_model, 75},
|
{"precache_model2", PF_precache_model, 75},
|
||||||
{"precache_sound2", PF_precache_sound, 76},
|
{"precache_sound2", PF_precache_sound, 76},
|
||||||
{"precache_file2", PF_precache_file, 77},
|
{"precache_file2", PF_precache_file, 77},
|
||||||
{"setspawnparms", PF_setspawnparms, 78},
|
{"setspawnparms", PF_setspawnparms, 78},
|
||||||
|
|
||||||
|
{"testentitypos", PF_testentitypos, QF 92},
|
||||||
{"hullpointcontents", PF_hullpointcontents, QF 93},
|
{"hullpointcontents", PF_hullpointcontents, QF 93},
|
||||||
{"getboxbounds", PF_getboxbounds, QF 94},
|
{"getboxbounds", PF_getboxbounds, QF 94},
|
||||||
{"getboxhull", PF_getboxhull, QF 95},
|
{"getboxhull", PF_getboxhull, QF 95},
|
||||||
{"freeboxhull", PF_freeboxhull, QF 96},
|
{"freeboxhull", PF_freeboxhull, QF 96},
|
||||||
{"rotate_bbox", PF_rotate_bbox, QF 97},
|
{"rotate_bbox", PF_rotate_bbox, QF 97},
|
||||||
|
{"tracebox", PF_tracebox, QF 98},
|
||||||
{"checkextension", PF_checkextension, QF 99},
|
{"checkextension", PF_checkextension, QF 99},
|
||||||
|
|
||||||
{"EntityParseFunction", ED_EntityParseFunction, -1},
|
{"EntityParseFunction", ED_EntityParseFunction, -1},
|
||||||
|
|
||||||
|
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1502,5 +1554,3 @@ SV_PR_Cmds_Init ()
|
||||||
|
|
||||||
PR_RegisterBuiltins (&sv_pr_state, builtins);
|
PR_RegisterBuiltins (&sv_pr_state, builtins);
|
||||||
}
|
}
|
||||||
// void (entity e, vector min, vector max) setabssize
|
|
||||||
// void (float step) movetogoal
|
|
||||||
|
|
|
@ -40,12 +40,12 @@ static __attribute__ ((used)) const char rcsid[] =
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_FCNTL_H
|
#ifdef HAVE_FCNTL_H
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/fcntl.h>
|
# include <sys/fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "QF/qargs.h"
|
#include "QF/qargs.h"
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static __attribute__ ((used)) const char rcsid[] =
|
static __attribute__ ((used)) const char rcsid[] =
|
||||||
"$Id$";
|
"$Id$";
|
||||||
|
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
|
@ -44,7 +44,6 @@ static __attribute__ ((used)) const char rcsid[] =
|
||||||
#include "QF/cmd.h"
|
#include "QF/cmd.h"
|
||||||
#include "QF/cvar.h"
|
#include "QF/cvar.h"
|
||||||
#include "QF/msg.h"
|
#include "QF/msg.h"
|
||||||
#include "QF/progs.h"
|
|
||||||
#include "QF/ruamoko.h"
|
#include "QF/ruamoko.h"
|
||||||
#include "QF/sys.h"
|
#include "QF/sys.h"
|
||||||
#include "QF/va.h"
|
#include "QF/va.h"
|
||||||
|
@ -53,7 +52,6 @@ static __attribute__ ((used)) const char rcsid[] =
|
||||||
#include "crudefile.h"
|
#include "crudefile.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "sv_gib.h"
|
#include "sv_gib.h"
|
||||||
#include "sv_pr_cmds.h"
|
|
||||||
#include "sv_progs.h"
|
#include "sv_progs.h"
|
||||||
#include "sv_recorder.h"
|
#include "sv_recorder.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
@ -77,7 +75,7 @@ PF_error (progs_t *pr)
|
||||||
edict_t *ed;
|
edict_t *ed;
|
||||||
|
|
||||||
s = PF_VarString (pr, 0);
|
s = PF_VarString (pr, 0);
|
||||||
SV_Printf ("======SERVER ERROR in %s:\n%s\n",
|
Sys_Printf ("======SERVER ERROR in %s:\n%s\n",
|
||||||
PR_GetString (pr, pr->pr_xfunction->descriptor->s_name), s);
|
PR_GetString (pr, pr->pr_xfunction->descriptor->s_name), s);
|
||||||
ed = PROG_TO_EDICT (pr, *sv_globals.self);
|
ed = PROG_TO_EDICT (pr, *sv_globals.self);
|
||||||
ED_Print (pr, ed);
|
ED_Print (pr, ed);
|
||||||
|
@ -101,7 +99,7 @@ PF_objerror (progs_t *pr)
|
||||||
edict_t *ed;
|
edict_t *ed;
|
||||||
|
|
||||||
s = PF_VarString (pr, 0);
|
s = PF_VarString (pr, 0);
|
||||||
SV_Printf ("======OBJECT ERROR in %s:\n%s\n",
|
Sys_Printf ("======OBJECT ERROR in %s:\n%s\n",
|
||||||
PR_GetString (pr, pr->pr_xfunction->descriptor->s_name), s);
|
PR_GetString (pr, pr->pr_xfunction->descriptor->s_name), s);
|
||||||
ed = PROG_TO_EDICT (pr, *sv_globals.self);
|
ed = PROG_TO_EDICT (pr, *sv_globals.self);
|
||||||
ED_Print (pr, ed);
|
ED_Print (pr, ed);
|
||||||
|
@ -114,8 +112,7 @@ PF_objerror (progs_t *pr)
|
||||||
PF_makevectors
|
PF_makevectors
|
||||||
|
|
||||||
Writes new values for v_forward, v_up, and v_right based on angles
|
Writes new values for v_forward, v_up, and v_right based on angles
|
||||||
makevectors (vector)
|
void (vector angles) makevectors
|
||||||
// void (entity e) makevectors
|
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PF_makevectors (progs_t *pr)
|
PF_makevectors (progs_t *pr)
|
||||||
|
@ -174,7 +171,7 @@ PF_setsize (progs_t *pr)
|
||||||
/*
|
/*
|
||||||
PF_setmodel
|
PF_setmodel
|
||||||
|
|
||||||
setmodel(entity, model)
|
setmodel (entity, model)
|
||||||
// void (entity e, string m) setmodel
|
// void (entity e, string m) setmodel
|
||||||
Also sets size, mins, and maxs for inline bmodels
|
Also sets size, mins, and maxs for inline bmodels
|
||||||
*/
|
*/
|
||||||
|
@ -249,7 +246,7 @@ PF_sprint (progs_t *pr)
|
||||||
level = P_FLOAT (pr, 1);
|
level = P_FLOAT (pr, 1);
|
||||||
|
|
||||||
if (entnum < 1 || entnum > MAX_CLIENTS) {
|
if (entnum < 1 || entnum > MAX_CLIENTS) {
|
||||||
SV_Printf ("tried to sprint to a non-client\n");
|
Sys_Printf ("tried to sprint to a non-client\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,11 +262,11 @@ PF_sprint (progs_t *pr)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PF_centerprint
|
PF_centerprint
|
||||||
// void (...) centerprint
|
|
||||||
|
|
||||||
single print to a specific client
|
single print to a specific client
|
||||||
|
|
||||||
centerprint (clientent, value)
|
centerprint (clientent, value)
|
||||||
|
// void (...) centerprint
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PF_centerprint (progs_t *pr)
|
PF_centerprint (progs_t *pr)
|
||||||
|
@ -281,7 +278,7 @@ PF_centerprint (progs_t *pr)
|
||||||
entnum = P_EDICTNUM (pr, 0);
|
entnum = P_EDICTNUM (pr, 0);
|
||||||
|
|
||||||
if (entnum < 1 || entnum > MAX_CLIENTS) {
|
if (entnum < 1 || entnum > MAX_CLIENTS) {
|
||||||
SV_Printf ("tried to sprint to a non-client\n");
|
Sys_Printf ("tried to sprint to a non-client\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +324,7 @@ PF_ambientsound (progs_t *pr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!*check) {
|
if (!*check) {
|
||||||
SV_Printf ("no precache: %s\n", samp);
|
Sys_Printf ("no precache: %s\n", samp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +339,6 @@ PF_ambientsound (progs_t *pr)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PF_sound
|
PF_sound
|
||||||
// void (entity e, float chan, string samp) sound
|
|
||||||
|
|
||||||
Each entity can have eight independant sound sources, like voice,
|
Each entity can have eight independant sound sources, like voice,
|
||||||
weapon, feet, etc.
|
weapon, feet, etc.
|
||||||
|
@ -352,6 +348,7 @@ PF_ambientsound (progs_t *pr)
|
||||||
|
|
||||||
An attenuation of 0 will play full volume everywhere in the level.
|
An attenuation of 0 will play full volume everywhere in the level.
|
||||||
Larger attenuations will drop off.
|
Larger attenuations will drop off.
|
||||||
|
// void (entity e, float chan, string samp) sound
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PF_sound (progs_t *pr)
|
PF_sound (progs_t *pr)
|
||||||
|
@ -403,6 +400,7 @@ PF_traceline (progs_t *pr)
|
||||||
VectorCopy (trace.endpos, *sv_globals.trace_endpos);
|
VectorCopy (trace.endpos, *sv_globals.trace_endpos);
|
||||||
VectorCopy (trace.plane.normal, *sv_globals.trace_plane_normal);
|
VectorCopy (trace.plane.normal, *sv_globals.trace_plane_normal);
|
||||||
*sv_globals.trace_plane_dist = trace.plane.dist;
|
*sv_globals.trace_plane_dist = trace.plane.dist;
|
||||||
|
|
||||||
if (trace.ent)
|
if (trace.ent)
|
||||||
*sv_globals.trace_ent = EDICT_TO_PROG (pr, trace.ent);
|
*sv_globals.trace_ent = EDICT_TO_PROG (pr, trace.ent);
|
||||||
else
|
else
|
||||||
|
@ -411,7 +409,8 @@ PF_traceline (progs_t *pr)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PF_tracebox
|
PF_tracebox
|
||||||
// void (vector start, vector mins, vector maxs, vector end, float type, entity passent) tracebox
|
// void (vector start, vector mins, vector maxs, vector end, float type,
|
||||||
|
// entity passent) tracebox
|
||||||
|
|
||||||
Wrapper around SV_Move, this makes PF_movetoground and PF_traceline
|
Wrapper around SV_Move, this makes PF_movetoground and PF_traceline
|
||||||
redundant.
|
redundant.
|
||||||
|
@ -419,10 +418,10 @@ PF_traceline (progs_t *pr)
|
||||||
static void
|
static void
|
||||||
PF_tracebox (progs_t *pr)
|
PF_tracebox (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
float *start, *end, *mins, *maxs;
|
float *start, *end, *mins, *maxs;
|
||||||
int type;
|
int type;
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
|
|
||||||
start = P_VECTOR (pr, 0);
|
start = P_VECTOR (pr, 0);
|
||||||
mins = P_VECTOR (pr, 1);
|
mins = P_VECTOR (pr, 1);
|
||||||
|
@ -516,15 +515,17 @@ int c_invis, c_notvis;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PF_checkclient
|
PF_checkclient
|
||||||
// entity () clientlist
|
|
||||||
|
|
||||||
Returns a client (or object that has a client enemy) that would be a
|
Returns a client (or object that has a client enemy) that would be a
|
||||||
valid target.
|
valid target.
|
||||||
|
|
||||||
If there are more than one valid options, they are cycled each frame
|
If there are more than one valid options, they are cycled each frame
|
||||||
|
|
||||||
If (self.origin + self.viewofs) is not in the PVS of the current target, it
|
If (self.origin + self.viewofs) is not in the PVS of the current target,
|
||||||
is not returned at all.
|
it is not returned at all.
|
||||||
|
|
||||||
|
name checkclient ()
|
||||||
|
// entity () clientlist
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PF_checkclient (progs_t *pr)
|
PF_checkclient (progs_t *pr)
|
||||||
|
@ -620,11 +621,11 @@ PF_stuffcmd (progs_t *pr)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PF_localcmd
|
PF_localcmd
|
||||||
// void (string s) localcmd
|
|
||||||
|
|
||||||
Inserts text into the server console's execution buffer
|
Inserts text into the server console's execution buffer
|
||||||
|
|
||||||
localcmd (string)
|
localcmd (string)
|
||||||
|
// void (string s) localcmd
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PF_localcmd (progs_t *pr)
|
PF_localcmd (progs_t *pr)
|
||||||
|
@ -648,15 +649,15 @@ PF_findradius (progs_t *pr)
|
||||||
{
|
{
|
||||||
edict_t *ent, *chain;
|
edict_t *ent, *chain;
|
||||||
float rsqr;
|
float rsqr;
|
||||||
//float *eorigin;
|
vec_t *emins, *emaxs, *org;
|
||||||
float *emins, *emaxs, *org;
|
|
||||||
int i, j;
|
int i, j;
|
||||||
vec3_t eorg;
|
vec3_t eorg;
|
||||||
|
|
||||||
chain = (edict_t *) sv.edicts;
|
chain = (edict_t *) sv.edicts;
|
||||||
|
|
||||||
org = P_VECTOR (pr, 0);
|
org = P_VECTOR (pr, 0);
|
||||||
rsqr = P_FLOAT (pr, 1) * P_FLOAT (pr, 1); // Square early, sqrt never
|
rsqr = P_FLOAT (pr, 1);
|
||||||
|
rsqr *= rsqr; // Square early, sqrt never
|
||||||
|
|
||||||
ent = NEXT_EDICT (pr, sv.edicts);
|
ent = NEXT_EDICT (pr, sv.edicts);
|
||||||
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
|
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
|
||||||
|
@ -665,14 +666,10 @@ PF_findradius (progs_t *pr)
|
||||||
if (SVfloat (ent, solid) == SOLID_NOT
|
if (SVfloat (ent, solid) == SOLID_NOT
|
||||||
&& !((int) SVfloat (ent, flags) & FL_FINDABLE_NONSOLID))
|
&& !((int) SVfloat (ent, flags) & FL_FINDABLE_NONSOLID))
|
||||||
continue;
|
continue;
|
||||||
//eorigin = SVvector (ent, origin);
|
|
||||||
//emins = SVvector (ent, mins);
|
|
||||||
//emaxs = SVvector (ent, maxs);
|
|
||||||
emins = SVvector (ent, absmin);
|
emins = SVvector (ent, absmin);
|
||||||
emaxs = SVvector (ent, absmax);
|
emaxs = SVvector (ent, absmax);
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
eorg[j] = org[j] - 0.5 * (emins[j] + emaxs[j]);
|
eorg[j] = org[j] - 0.5 * (emins[j] + emaxs[j]);
|
||||||
//eorg[j] = org[j] - eorigin[j] - 0.5 * (emins[j] + emaxs[j]);
|
|
||||||
if (DotProduct (eorg, eorg) > rsqr)
|
if (DotProduct (eorg, eorg) > rsqr)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -705,14 +702,14 @@ PF_Remove (progs_t *pr)
|
||||||
if (NUM_FOR_EDICT (pr, ed) < *pr->reserved_edicts) {
|
if (NUM_FOR_EDICT (pr, ed) < *pr->reserved_edicts) {
|
||||||
if (pr_double_remove->int_val == 1) {
|
if (pr_double_remove->int_val == 1) {
|
||||||
PR_DumpState (pr);
|
PR_DumpState (pr);
|
||||||
SV_Printf ("Reserved entity remove\n");
|
Sys_Printf ("Reserved entity remove\n");
|
||||||
} else // == 2
|
} else // == 2
|
||||||
PR_RunError (pr, "Reserved entity remove\n");
|
PR_RunError (pr, "Reserved entity remove\n");
|
||||||
}
|
}
|
||||||
if (ed->free && pr_double_remove->int_val) {
|
if (ed->free && pr_double_remove->int_val) {
|
||||||
if (pr_double_remove->int_val == 1) {
|
if (pr_double_remove->int_val == 1) {
|
||||||
PR_DumpState (pr);
|
PR_DumpState (pr);
|
||||||
SV_Printf ("Double entity remove\n");
|
Sys_Printf ("Double entity remove\n");
|
||||||
} else // == 2
|
} else // == 2
|
||||||
PR_RunError (pr, "Double entity remove\n");
|
PR_RunError (pr, "Double entity remove\n");
|
||||||
}
|
}
|
||||||
|
@ -734,7 +731,7 @@ do_precache (progs_t *pr, const char **cache, int max, const char *name,
|
||||||
char *s;
|
char *s;
|
||||||
|
|
||||||
if (sv.state != ss_loading)
|
if (sv.state != ss_loading)
|
||||||
PR_RunError (pr, "%s: Precache can be done in only spawn functions",
|
PR_RunError (pr, "%s: Precache can be done only in spawn functions",
|
||||||
func);
|
func);
|
||||||
|
|
||||||
PR_CheckEmptyString (pr, name);
|
PR_CheckEmptyString (pr, name);
|
||||||
|
@ -764,8 +761,8 @@ do_precache (progs_t *pr, const char **cache, int max, const char *name,
|
||||||
// string (string s) precache_file2
|
// string (string s) precache_file2
|
||||||
static void
|
static void
|
||||||
PF_precache_file (progs_t *pr)
|
PF_precache_file (progs_t *pr)
|
||||||
{ // precache_file is used only to copy
|
{
|
||||||
// files with qcc, it does nothing
|
// precache_file is used only to copy files with qcc, it does nothing
|
||||||
R_INT (pr) = P_INT (pr, 0);
|
R_INT (pr) = P_INT (pr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,10 +781,9 @@ PF_precache_sound (progs_t *pr)
|
||||||
static void
|
static void
|
||||||
PF_precache_model (progs_t *pr)
|
PF_precache_model (progs_t *pr)
|
||||||
{
|
{
|
||||||
R_INT (pr) = P_INT (pr, 0);
|
|
||||||
|
|
||||||
do_precache (pr, sv.model_precache, MAX_MODELS, P_GSTRING (pr, 0),
|
do_precache (pr, sv.model_precache, MAX_MODELS, P_GSTRING (pr, 0),
|
||||||
"precache_model");
|
"precache_model");
|
||||||
|
R_INT (pr) = P_INT (pr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -925,10 +921,10 @@ cvar_t *sv_aim;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PF_aim
|
PF_aim
|
||||||
// vector (entity e, float speed) aim
|
|
||||||
|
|
||||||
Pick a vector for the player to shoot along
|
Pick a vector for the player to shoot along
|
||||||
vector aim (entity, missilespeed)
|
vector aim (entity, missilespeed)
|
||||||
|
// vector (entity e, float speed) aim
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
PF_aim (progs_t *pr)
|
PF_aim (progs_t *pr)
|
||||||
|
@ -1021,9 +1017,9 @@ PF_aim (progs_t *pr)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
PF_changeyaw
|
PF_changeyaw
|
||||||
// void () ChangeYaw
|
|
||||||
|
|
||||||
This was a major timewaster in progs, so it was converted to C
|
This was a major timewaster in progs, so it was converted to C
|
||||||
|
// void () ChangeYaw
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
PF_changeyaw (progs_t *pr)
|
PF_changeyaw (progs_t *pr)
|
||||||
|
@ -1065,7 +1061,7 @@ PF_changeyaw (progs_t *pr)
|
||||||
#define MSG_INIT 3 // write to the init string
|
#define MSG_INIT 3 // write to the init string
|
||||||
#define MSG_MULTICAST 4 // for multicast ()
|
#define MSG_MULTICAST 4 // for multicast ()
|
||||||
|
|
||||||
static sizebuf_t *
|
static sizebuf_t *
|
||||||
WriteDest (progs_t *pr)
|
WriteDest (progs_t *pr)
|
||||||
{
|
{
|
||||||
int dest;
|
int dest;
|
||||||
|
@ -1971,6 +1967,7 @@ static builtin_t builtins[] = {
|
||||||
{"aim", PF_aim, 44},
|
{"aim", PF_aim, 44},
|
||||||
|
|
||||||
{"localcmd", PF_localcmd, 46},
|
{"localcmd", PF_localcmd, 46},
|
||||||
|
|
||||||
{"changeyaw", PF_changeyaw, 49},
|
{"changeyaw", PF_changeyaw, 49},
|
||||||
|
|
||||||
{"writebyte", PF_WriteByte, 52},
|
{"writebyte", PF_WriteByte, 52},
|
||||||
|
@ -2000,13 +1997,13 @@ static builtin_t builtins[] = {
|
||||||
{"logfrag", PF_logfrag, 79},
|
{"logfrag", PF_logfrag, 79},
|
||||||
{"infokey", PF_infokey, 80},
|
{"infokey", PF_infokey, 80},
|
||||||
{"multicast", PF_multicast, 82},
|
{"multicast", PF_multicast, 82},
|
||||||
|
|
||||||
{"testentitypos", PF_testentitypos, QF 92},
|
{"testentitypos", PF_testentitypos, QF 92},
|
||||||
{"hullpointcontents", PF_hullpointcontents, QF 93},
|
{"hullpointcontents", PF_hullpointcontents, QF 93},
|
||||||
{"getboxbounds", PF_getboxbounds, QF 94},
|
{"getboxbounds", PF_getboxbounds, QF 94},
|
||||||
{"getboxhull", PF_getboxhull, QF 95},
|
{"getboxhull", PF_getboxhull, QF 95},
|
||||||
{"freeboxhull", PF_freeboxhull, QF 96},
|
{"freeboxhull", PF_freeboxhull, QF 96},
|
||||||
{"rotate_bbox", PF_rotate_bbox, QF 97},
|
{"rotate_bbox", PF_rotate_bbox, QF 97},
|
||||||
|
|
||||||
{"tracebox", PF_tracebox, QF 98},
|
{"tracebox", PF_tracebox, QF 98},
|
||||||
{"checkextension", PF_checkextension, QF 99},
|
{"checkextension", PF_checkextension, QF 99},
|
||||||
{"setinfokey", PF_setinfokey, QF 102},
|
{"setinfokey", PF_setinfokey, QF 102},
|
||||||
|
@ -2025,6 +2022,7 @@ static builtin_t builtins[] = {
|
||||||
{"SV_Spawn", PR_SV_Spawn, -1},
|
{"SV_Spawn", PR_SV_Spawn, -1},
|
||||||
|
|
||||||
{"EntityParseFunction", ED_EntityParseFunction, -1},
|
{"EntityParseFunction", ED_EntityParseFunction, -1},
|
||||||
|
|
||||||
{0}
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2042,5 +2040,4 @@ SV_PR_Cmds_Init ()
|
||||||
bi->proc = PF_sv_cvar;
|
bi->proc = PF_sv_cvar;
|
||||||
|
|
||||||
PR_RegisterBuiltins (&sv_pr_state, builtins);
|
PR_RegisterBuiltins (&sv_pr_state, builtins);
|
||||||
};
|
}
|
||||||
// void (float step) movetogoal
|
|
||||||
|
|
Loading…
Reference in a new issue