2001-03-01 08:34:30 +00:00
|
|
|
/*
|
|
|
|
sv_progs.h
|
|
|
|
|
|
|
|
server specific progs definitions
|
|
|
|
|
|
|
|
Copyright (C) 2000 Bill Currie
|
|
|
|
|
|
|
|
Author: Bill Currie
|
|
|
|
Date: 28 Feb 2001
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __sv_progs_h
|
|
|
|
#define __sv_progs_h
|
|
|
|
|
2001-03-27 20:33:07 +00:00
|
|
|
#include "QF/progs.h"
|
2002-02-20 20:53:41 +00:00
|
|
|
#include "sv_pr_cmds.h"
|
2001-03-01 08:34:30 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int *self;
|
|
|
|
int *other;
|
|
|
|
int *world;
|
|
|
|
float *time;
|
|
|
|
float *frametime;
|
|
|
|
int *newmis;
|
|
|
|
float *force_retouch;
|
|
|
|
string_t *mapname;
|
|
|
|
float *serverflags;
|
|
|
|
float *total_secrets;
|
|
|
|
float *total_monsters;
|
|
|
|
float *found_secrets;
|
|
|
|
float *killed_monsters;
|
|
|
|
float *parms; // an actual array
|
|
|
|
vec3_t *v_forward;
|
|
|
|
vec3_t *v_up;
|
|
|
|
vec3_t *v_right;
|
|
|
|
float *trace_allsolid;
|
|
|
|
float *trace_startsolid;
|
|
|
|
float *trace_fraction;
|
|
|
|
vec3_t *trace_endpos;
|
|
|
|
vec3_t *trace_plane_normal;
|
|
|
|
float *trace_plane_dist;
|
|
|
|
int *trace_ent;
|
|
|
|
float *trace_inopen;
|
|
|
|
float *trace_inwater;
|
|
|
|
int *msg_entity;
|
2001-07-13 22:47:11 +00:00
|
|
|
float *current_skill;
|
2001-03-01 08:34:30 +00:00
|
|
|
} sv_globals_t;
|
|
|
|
|
|
|
|
extern sv_globals_t sv_globals;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
func_t main;
|
|
|
|
func_t StartFrame;
|
|
|
|
func_t PlayerPreThink;
|
|
|
|
func_t PlayerPostThink;
|
|
|
|
func_t ClientKill;
|
|
|
|
func_t ClientConnect;
|
|
|
|
func_t PutClientInServer;
|
|
|
|
func_t ClientDisconnect;
|
|
|
|
func_t SetNewParms;
|
|
|
|
func_t SetChangeParms;
|
|
|
|
} sv_funcs_t;
|
|
|
|
|
|
|
|
extern sv_funcs_t sv_funcs;
|
|
|
|
|
2001-03-01 18:44:19 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2001-03-01 19:05:40 +00:00
|
|
|
int modelindex; //float
|
|
|
|
int absmin; //vec3_t
|
|
|
|
int absmax; //vec3_t
|
|
|
|
int ltime; //float
|
|
|
|
int lastruntime; //float
|
|
|
|
int movetype; //float
|
|
|
|
int solid; //float
|
|
|
|
int origin; //vec3_t
|
|
|
|
int oldorigin; //vec3_t
|
|
|
|
int velocity; //vec3_t
|
|
|
|
int angles; //vec3_t
|
|
|
|
int avelocity; //vec3_t
|
2001-03-01 18:44:19 +00:00
|
|
|
int classname; //string_t
|
2001-03-01 19:05:40 +00:00
|
|
|
int model; //string_t
|
|
|
|
int frame; //float
|
|
|
|
int skin; //float
|
|
|
|
int effects; //float
|
|
|
|
int mins; //vec3_t
|
|
|
|
int maxs; //vec3_t
|
|
|
|
int size; //vec3_t
|
|
|
|
int touch; //func_t
|
|
|
|
int think; //func_t
|
|
|
|
int blocked; //func_t
|
|
|
|
int nextthink; //float
|
|
|
|
int groundentity; //int
|
|
|
|
int health; //float
|
|
|
|
int frags; //float
|
|
|
|
int weapon; //float
|
|
|
|
int weaponmodel; //string_t
|
|
|
|
int weaponframe; //float
|
2001-03-01 18:44:19 +00:00
|
|
|
int currentammo; //float
|
2001-03-01 19:05:40 +00:00
|
|
|
int ammo_shells; //float
|
|
|
|
int ammo_nails; //float
|
|
|
|
int ammo_rockets; //float
|
|
|
|
int ammo_cells; //float
|
|
|
|
int items; //float
|
2001-03-01 18:44:19 +00:00
|
|
|
int takedamage; //float
|
2001-03-01 19:05:40 +00:00
|
|
|
int chain; //int
|
|
|
|
int view_ofs; //vec3_t
|
|
|
|
int button0; //float
|
|
|
|
int button1; //float
|
|
|
|
int button2; //float
|
2001-03-01 18:44:19 +00:00
|
|
|
int impulse; //float
|
2001-03-01 19:05:40 +00:00
|
|
|
int fixangle; //float
|
|
|
|
int v_angle; //vec3_t
|
|
|
|
int netname; //string_t
|
|
|
|
int enemy; //int
|
|
|
|
int flags; //float
|
|
|
|
int colormap; //float
|
2001-03-01 18:44:19 +00:00
|
|
|
int team; //float
|
2001-03-01 19:05:40 +00:00
|
|
|
int teleport_time; //float
|
|
|
|
int armorvalue; //float
|
|
|
|
int waterlevel; //float
|
|
|
|
int watertype; //float
|
|
|
|
int ideal_yaw; //float
|
|
|
|
int yaw_speed; //float
|
|
|
|
int goalentity; //int
|
|
|
|
int spawnflags; //float
|
|
|
|
int dmg_take; //float
|
|
|
|
int dmg_save; //float
|
|
|
|
int dmg_inflictor; //int
|
2001-03-01 18:44:19 +00:00
|
|
|
int owner; //int
|
|
|
|
int message; //string_t
|
|
|
|
int sounds; //float
|
2001-07-26 00:01:13 +00:00
|
|
|
int rotated_bbox; //int
|
2001-03-02 19:18:04 +00:00
|
|
|
|
|
|
|
int alpha;
|
|
|
|
int scale;
|
2001-03-27 03:57:17 +00:00
|
|
|
int glow_size;
|
|
|
|
int glow_color;
|
2001-03-02 19:18:04 +00:00
|
|
|
int colormod;
|
2002-02-25 07:44:17 +00:00
|
|
|
|
|
|
|
int gravity;
|
|
|
|
int maxspeed;
|
2001-03-01 18:44:19 +00:00
|
|
|
} sv_fields_t;
|
|
|
|
|
|
|
|
extern sv_fields_t sv_fields;
|
|
|
|
|
2001-06-08 00:11:54 +00:00
|
|
|
#if TYPECHECK_PROGS
|
2001-03-27 03:57:17 +00:00
|
|
|
#define SVFIELD(e,f,t) E_var (e, PR_AccessField (&sv_pr_state, #f, ev_##t, __FILE__, __LINE__), t)
|
2001-03-01 21:11:35 +00:00
|
|
|
#else
|
2001-03-01 18:44:19 +00:00
|
|
|
#define SVFIELD(e,f,t) E_var (e, sv_fields.f, t)
|
2001-03-01 21:11:35 +00:00
|
|
|
#endif
|
2001-03-01 18:44:19 +00:00
|
|
|
|
2001-08-08 20:28:53 +00:00
|
|
|
#define SVfloat(e,f) SVFIELD (e, f, float)
|
|
|
|
#define SVstring(e,f) SVFIELD (e, f, string)
|
|
|
|
#define SVfunc(e,f) SVFIELD (e, f, func)
|
|
|
|
#define SVentity(e,f) SVFIELD (e, f, entity)
|
|
|
|
#define SVvector(e,f) SVFIELD (e, f, vector)
|
|
|
|
#define SVinteger(e,f) SVFIELD (e, f, integer)
|
|
|
|
|
2001-03-01 18:44:19 +00:00
|
|
|
#define PROGHEADER_CRC 54730
|
|
|
|
|
2001-03-03 08:59:55 +00:00
|
|
|
extern func_t EndFrame;
|
|
|
|
extern func_t SpectatorConnect;
|
|
|
|
extern func_t SpectatorThink;
|
|
|
|
extern func_t SpectatorDisconnect;
|
2001-07-20 05:05:47 +00:00
|
|
|
extern func_t UserInfoCallback;
|
2001-03-03 08:59:55 +00:00
|
|
|
|
2002-05-31 21:05:58 +00:00
|
|
|
static inline void
|
|
|
|
sv_pr_touch (edict_t *self, edict_t *other)
|
|
|
|
{
|
|
|
|
int this;
|
|
|
|
|
|
|
|
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, self);
|
|
|
|
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, other);
|
|
|
|
if ((this = sv_pr_state.fields.this) != -1) {
|
|
|
|
P_INT (&sv_pr_state, 0) = E_var (self, this, integer);
|
|
|
|
P_INT (&sv_pr_state, 1) = 0;
|
|
|
|
P_INT (&sv_pr_state, 2) = E_var (other, this, integer);
|
|
|
|
}
|
|
|
|
PR_ExecuteProgram (&sv_pr_state, SVfunc (self, touch));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
sv_pr_use (edict_t *self, edict_t *other)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
sv_pr_think (edict_t *self)
|
|
|
|
{
|
|
|
|
int this;
|
|
|
|
|
|
|
|
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, self);
|
|
|
|
*sv_globals.other = 0;
|
|
|
|
if ((this = sv_pr_state.fields.this) != -1) {
|
|
|
|
P_INT (&sv_pr_state, 0) = E_var (self, this, integer);
|
|
|
|
P_INT (&sv_pr_state, 1) = 0;
|
|
|
|
P_INT (&sv_pr_state, 2) = 0;
|
|
|
|
}
|
|
|
|
PR_ExecuteProgram (&sv_pr_state, SVfunc (self, think));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
sv_pr_blocked (edict_t *self, edict_t *other)
|
|
|
|
{
|
|
|
|
int this;
|
|
|
|
|
|
|
|
*sv_globals.self = EDICT_TO_PROG (&sv_pr_state, self);
|
|
|
|
*sv_globals.other = EDICT_TO_PROG (&sv_pr_state, other);
|
|
|
|
if ((this = sv_pr_state.fields.this) != -1) {
|
|
|
|
P_INT (&sv_pr_state, 0) = E_var (self, this, integer);
|
|
|
|
P_INT (&sv_pr_state, 1) = 0;
|
|
|
|
P_INT (&sv_pr_state, 2) = E_var (other, this, integer);
|
|
|
|
}
|
|
|
|
PR_ExecuteProgram (&sv_pr_state, SVfunc (self, blocked));
|
|
|
|
}
|
|
|
|
|
2001-03-01 08:34:30 +00:00
|
|
|
#endif // __sv_progs_h
|