more independence cleanups and nq is closer to running

This commit is contained in:
Bill Currie 2001-03-03 08:59:55 +00:00
parent 6d6c34320f
commit baa5ce01a1
9 changed files with 148 additions and 42 deletions

View file

@ -142,11 +142,6 @@ extern int pr_numbuiltins;
ddef_t *PR_FindGlobal (progs_t *pr, const char *name);
eval_t *PR_GetGlobalPointer (progs_t *pr, const char *name);
extern func_t EndFrame; // 2000-01-02 EndFrame function by Maddes/FrikaC
extern func_t SpectatorConnect;
extern func_t SpectatorThink;
extern func_t SpectatorDisconnect;
void PR_Error (progs_t *pr, const char *error, ...) __attribute__((format(printf,2,3)));
void PR_RunError (progs_t *pr, char *error, ...) __attribute__((format(printf,2,3)));

View file

@ -36,7 +36,7 @@
#include "cvar.h"
#include "protocol.h"
#include "model.h"
#include "progs.h"
#include "sv_progs.h"
#include "sizebuf.h"
#include "info.h"
#include "quakeio.h"

View file

@ -187,6 +187,4 @@ extern sv_fields_t sv_fields;
#define SVFIELD(e,f,t) E_var (e, sv_fields.f, t)
#endif
#define PROGHEADER_CRC 54730
#endif // __sv_progs_h

View file

@ -30,7 +30,7 @@
#define __world_h
#include "qtypes.h"
#include "progs.h"
#include "sv_progs.h"
typedef struct
{

View file

@ -40,7 +40,6 @@
#include "msg.h"
#include "model.h"
#include "console.h"
#include "progs.h"
#include "keys.h"
#include "sys.h"
#include "sv_progs.h"

View file

@ -32,7 +32,6 @@
#include <string.h>
#include "progs.h"
#include "console.h"
#include "sys.h"
#include "cmd.h"

View file

@ -1164,7 +1164,7 @@ SV_SpawnServer (char *server)
ent = EDICT_NUM (&sv_pr_state, 0);
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
ent->free = false;
SVFIELD (ent, model, float) = sv.worldmodel->name - sv_pr_state.pr_strings;
SVFIELD (ent, model, string) = sv.worldmodel->name - sv_pr_state.pr_strings;
SVFIELD (ent, modelindex, float) = 1; // world model
SVFIELD (ent, solid, float) = SOLID_BSP;
SVFIELD (ent, movetype, float) = MOVETYPE_PUSH;

View file

@ -40,6 +40,7 @@
#include "cmd.h"
#include "console.h"
#include "host.h"
#include "progdefs.h"
#include "server.h"
#include "sv_progs.h"
#include "world.h"
@ -63,36 +64,6 @@ cvar_t *saved2;
cvar_t *saved3;
cvar_t *saved4;
func_t EndFrame;
func_t SpectatorConnect;
func_t SpectatorDisconnect;
func_t SpectatorThink;
void
FindEdictFieldOffsets (progs_t * pr)
{
dfunction_t *f;
if (pr == &sv_pr_state) {
// Zoid, find the spectator functions
SpectatorConnect = SpectatorThink = SpectatorDisconnect = 0;
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorConnect")) != NULL)
SpectatorConnect = (func_t) (f - sv_pr_state.pr_functions);
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorThink")) != NULL)
SpectatorThink = (func_t) (f - sv_pr_state.pr_functions);
if ((f = ED_FindFunction (&sv_pr_state, "SpectatorDisconnect")) != NULL)
SpectatorDisconnect = (func_t) (f - sv_pr_state.pr_functions);
// 2000-01-02 EndFrame function by Maddes/FrikaC
EndFrame = 0;
if ((f = ED_FindFunction (&sv_pr_state, "EndFrame")) != NULL)
EndFrame = (func_t) (f - sv_pr_state.pr_functions);
}
}
int
ED_Prune_Edict (progs_t *pr, edict_t *ent)
{
@ -158,6 +129,145 @@ SV_LoadProgs (void)
PR_LoadProgs (&sv_pr_state, sv_progs->string);
if (!sv_pr_state.progs)
Host_Error ("SV_LoadProgs: couldn't load %s", sv_progs->string);
if (sv_pr_state.progs->crc != PROGHEADER_CRC)
Host_Error ("You must have the progs.dat from Quake installed");
// progs engine needs these globals anyway
sv_globals.self = sv_pr_state.globals.self;
sv_globals.time = sv_pr_state.globals.time;
(void *) sv_globals.self = PR_GetGlobalPointer (&sv_pr_state, "self");
(void *) sv_globals.other = PR_GetGlobalPointer (&sv_pr_state, "other");
(void *) sv_globals.world = PR_GetGlobalPointer (&sv_pr_state, "world");
(void *) sv_globals.time = PR_GetGlobalPointer (&sv_pr_state, "time");
(void *) sv_globals.frametime = PR_GetGlobalPointer (&sv_pr_state, "frametime");
(void *) sv_globals.force_retouch = PR_GetGlobalPointer (&sv_pr_state, "force_retouch");
(void *) sv_globals.mapname = PR_GetGlobalPointer (&sv_pr_state, "mapname");
(void *) sv_globals.startspot = PR_GetGlobalPointer (&sv_pr_state, "startspot");
(void *) sv_globals.deathmatch = PR_GetGlobalPointer (&sv_pr_state, "deathmatch");
(void *) sv_globals.coop = PR_GetGlobalPointer (&sv_pr_state, "coop");
(void *) sv_globals.teamplay = PR_GetGlobalPointer (&sv_pr_state, "teamplay");
(void *) sv_globals.serverflags = PR_GetGlobalPointer (&sv_pr_state, "serverflags");
(void *) sv_globals.total_secrets = PR_GetGlobalPointer (&sv_pr_state, "total_secrets");
(void *) sv_globals.total_monsters = PR_GetGlobalPointer (&sv_pr_state, "total_monsters");
(void *) sv_globals.found_secrets = PR_GetGlobalPointer (&sv_pr_state, "found_secrets");
(void *) sv_globals.killed_monsters = PR_GetGlobalPointer (&sv_pr_state, "killed_monsters");
(void *) sv_globals.parms = PR_GetGlobalPointer (&sv_pr_state, "parm1");
(void *) sv_globals.v_forward = PR_GetGlobalPointer (&sv_pr_state, "v_forward");
(void *) sv_globals.v_up = PR_GetGlobalPointer (&sv_pr_state, "v_up");
(void *) sv_globals.v_right = PR_GetGlobalPointer (&sv_pr_state, "v_right");
(void *) sv_globals.trace_allsolid = PR_GetGlobalPointer (&sv_pr_state, "trace_allsolid");
(void *) sv_globals.trace_startsolid = PR_GetGlobalPointer (&sv_pr_state, "trace_startsolid");
(void *) sv_globals.trace_fraction = PR_GetGlobalPointer (&sv_pr_state, "trace_fraction");
(void *) sv_globals.trace_endpos = PR_GetGlobalPointer (&sv_pr_state, "trace_endpos");
(void *) sv_globals.trace_plane_normal = PR_GetGlobalPointer (&sv_pr_state, "trace_plane_normal");
(void *) sv_globals.trace_plane_dist = PR_GetGlobalPointer (&sv_pr_state, "trace_plane_dist");
(void *) sv_globals.trace_ent = PR_GetGlobalPointer (&sv_pr_state, "trace_ent");
(void *) sv_globals.trace_inopen = PR_GetGlobalPointer (&sv_pr_state, "trace_inopen");
(void *) sv_globals.trace_inwater = PR_GetGlobalPointer (&sv_pr_state, "trace_inwater");
(void *) sv_globals.msg_entity = PR_GetGlobalPointer (&sv_pr_state, "msg_entity");
(void *) sv_globals.null = PR_GetGlobalPointer (&sv_pr_state, "null");
sv_funcs.main = ED_FindFunction (&sv_pr_state, "main") - sv_pr_state. pr_functions;
sv_funcs.StartFrame = ED_FindFunction (&sv_pr_state, "StartFrame") - sv_pr_state. pr_functions;
sv_funcs.PlayerPreThink = ED_FindFunction (&sv_pr_state, "PlayerPreThink") - sv_pr_state. pr_functions;
sv_funcs.PlayerPostThink = ED_FindFunction (&sv_pr_state, "PlayerPostThink") - sv_pr_state. pr_functions;
sv_funcs.ClientKill = ED_FindFunction (&sv_pr_state, "ClientKill") - sv_pr_state. pr_functions;
sv_funcs.ClientConnect = ED_FindFunction (&sv_pr_state, "ClientConnect") - sv_pr_state. pr_functions;
sv_funcs.PutClientInServer = ED_FindFunction (&sv_pr_state, "PutClientInServer") - sv_pr_state. pr_functions;
sv_funcs.ClientDisconnect = ED_FindFunction (&sv_pr_state, "ClientDisconnect") - sv_pr_state. pr_functions;
sv_funcs.SetNewParms = ED_FindFunction (&sv_pr_state, "SetNewParms") - sv_pr_state. pr_functions;
sv_funcs.SetChangeParms = ED_FindFunction (&sv_pr_state, "SetChangeParms") - sv_pr_state. pr_functions;
sv_fields.modelindex = ED_GetFieldIndex (&sv_pr_state, "modelindex");
sv_fields.absmin = ED_GetFieldIndex (&sv_pr_state, "absmin");
sv_fields.absmax = ED_GetFieldIndex (&sv_pr_state, "absmax");
sv_fields.ltime = ED_GetFieldIndex (&sv_pr_state, "ltime");
sv_fields.movetype = ED_GetFieldIndex (&sv_pr_state, "movetype");
sv_fields.solid = ED_GetFieldIndex (&sv_pr_state, "solid");
sv_fields.origin = ED_GetFieldIndex (&sv_pr_state, "origin");
sv_fields.oldorigin = ED_GetFieldIndex (&sv_pr_state, "oldorigin");
sv_fields.velocity = ED_GetFieldIndex (&sv_pr_state, "velocity");
sv_fields.angles = ED_GetFieldIndex (&sv_pr_state, "angles");
sv_fields.avelocity = ED_GetFieldIndex (&sv_pr_state, "avelocity");
sv_fields.basevelocity = ED_GetFieldIndex (&sv_pr_state, "basevelocity");
sv_fields.punchangle = ED_GetFieldIndex (&sv_pr_state, "punchangle");
sv_fields.classname = ED_GetFieldIndex (&sv_pr_state, "classname");
sv_fields.model = ED_GetFieldIndex (&sv_pr_state, "model");
sv_fields.frame = ED_GetFieldIndex (&sv_pr_state, "frame");
sv_fields.skin = ED_GetFieldIndex (&sv_pr_state, "skin");
sv_fields.effects = ED_GetFieldIndex (&sv_pr_state, "effects");
sv_fields.drawPercent = ED_GetFieldIndex (&sv_pr_state, "drawPercent");
sv_fields.gravity = ED_GetFieldIndex (&sv_pr_state, "gravity");
sv_fields.mass = ED_GetFieldIndex (&sv_pr_state, "mass");
sv_fields.light_level = ED_GetFieldIndex (&sv_pr_state, "light_level");
sv_fields.mins = ED_GetFieldIndex (&sv_pr_state, "mins");
sv_fields.maxs = ED_GetFieldIndex (&sv_pr_state, "maxs");
sv_fields.size = ED_GetFieldIndex (&sv_pr_state, "size");
sv_fields.touch = ED_GetFieldIndex (&sv_pr_state, "touch");
sv_fields.use = ED_GetFieldIndex (&sv_pr_state, "use");
sv_fields.think = ED_GetFieldIndex (&sv_pr_state, "think");
sv_fields.blocked = ED_GetFieldIndex (&sv_pr_state, "blocked");
sv_fields.nextthink = ED_GetFieldIndex (&sv_pr_state, "nextthink");
sv_fields.groundentity = ED_GetFieldIndex (&sv_pr_state, "groundentity");
sv_fields.health = ED_GetFieldIndex (&sv_pr_state, "health");
sv_fields.frags = ED_GetFieldIndex (&sv_pr_state, "frags");
sv_fields.weapon = ED_GetFieldIndex (&sv_pr_state, "weapon");
sv_fields.weaponmodel = ED_GetFieldIndex (&sv_pr_state, "weaponmodel");
sv_fields.weaponframe = ED_GetFieldIndex (&sv_pr_state, "weaponframe");
sv_fields.currentammo = ED_GetFieldIndex (&sv_pr_state, "currentammo");
sv_fields.ammo_shells = ED_GetFieldIndex (&sv_pr_state, "ammo_shells");
sv_fields.ammo_nails = ED_GetFieldIndex (&sv_pr_state, "ammo_nails");
sv_fields.ammo_rockets = ED_GetFieldIndex (&sv_pr_state, "ammo_rockets");
sv_fields.ammo_cells = ED_GetFieldIndex (&sv_pr_state, "ammo_cells");
sv_fields.items = ED_GetFieldIndex (&sv_pr_state, "items");
sv_fields.items2 = ED_GetFieldIndex (&sv_pr_state, "items2");
sv_fields.takedamage = ED_GetFieldIndex (&sv_pr_state, "takedamage");
sv_fields.chain = ED_GetFieldIndex (&sv_pr_state, "chain");
sv_fields.deadflag = ED_GetFieldIndex (&sv_pr_state, "deadflag");
sv_fields.view_ofs = ED_GetFieldIndex (&sv_pr_state, "view_ofs");
sv_fields.button0 = ED_GetFieldIndex (&sv_pr_state, "button0");
sv_fields.button1 = ED_GetFieldIndex (&sv_pr_state, "button1");
sv_fields.button2 = ED_GetFieldIndex (&sv_pr_state, "button2");
sv_fields.impulse = ED_GetFieldIndex (&sv_pr_state, "impulse");
sv_fields.fixangle = ED_GetFieldIndex (&sv_pr_state, "fixangle");
sv_fields.v_angle = ED_GetFieldIndex (&sv_pr_state, "v_angle");
sv_fields.idealpitch = ED_GetFieldIndex (&sv_pr_state, "idealpitch");
sv_fields.pitch_speed = ED_GetFieldIndex (&sv_pr_state, "pitch_speed");
sv_fields.netname = ED_GetFieldIndex (&sv_pr_state, "netname");
sv_fields.enemy = ED_GetFieldIndex (&sv_pr_state, "enemy");
sv_fields.flags = ED_GetFieldIndex (&sv_pr_state, "flags");
sv_fields.colormap = ED_GetFieldIndex (&sv_pr_state, "colormap");
sv_fields.team = ED_GetFieldIndex (&sv_pr_state, "team");
sv_fields.max_health = ED_GetFieldIndex (&sv_pr_state, "max_health");
sv_fields.teleport_time = ED_GetFieldIndex (&sv_pr_state, "teleport_time");
sv_fields.armortype = ED_GetFieldIndex (&sv_pr_state, "armortype");
sv_fields.armorvalue = ED_GetFieldIndex (&sv_pr_state, "armorvalue");
sv_fields.waterlevel = ED_GetFieldIndex (&sv_pr_state, "waterlevel");
sv_fields.watertype = ED_GetFieldIndex (&sv_pr_state, "watertype");
sv_fields.ideal_yaw = ED_GetFieldIndex (&sv_pr_state, "ideal_yaw");
sv_fields.yaw_speed = ED_GetFieldIndex (&sv_pr_state, "yaw_speed");
sv_fields.aiment = ED_GetFieldIndex (&sv_pr_state, "aiment");
sv_fields.goalentity = ED_GetFieldIndex (&sv_pr_state, "goalentity");
sv_fields.spawnflags = ED_GetFieldIndex (&sv_pr_state, "spawnflags");
sv_fields.target = ED_GetFieldIndex (&sv_pr_state, "target");
sv_fields.targetname = ED_GetFieldIndex (&sv_pr_state, "targetname");
sv_fields.dmg_take = ED_GetFieldIndex (&sv_pr_state, "dmg_take");
sv_fields.dmg_save = ED_GetFieldIndex (&sv_pr_state, "dmg_save");
sv_fields.dmg_inflictor = ED_GetFieldIndex (&sv_pr_state, "dmg_inflictor");
sv_fields.owner = ED_GetFieldIndex (&sv_pr_state, "owner");
sv_fields.movedir = ED_GetFieldIndex (&sv_pr_state, "movedir");
sv_fields.message = ED_GetFieldIndex (&sv_pr_state, "message");
sv_fields.sounds = ED_GetFieldIndex (&sv_pr_state, "sounds");
sv_fields.noise = ED_GetFieldIndex (&sv_pr_state, "noise");
sv_fields.noise1 = ED_GetFieldIndex (&sv_pr_state, "noise1");
sv_fields.noise2 = ED_GetFieldIndex (&sv_pr_state, "noise2");
sv_fields.noise3 = ED_GetFieldIndex (&sv_pr_state, "noise3");
sv_fields.dmg = ED_GetFieldIndex (&sv_pr_state, "dmg");
sv_fields.dmgtime = ED_GetFieldIndex (&sv_pr_state, "dmgtime");
sv_fields.air_finished = ED_GetFieldIndex (&sv_pr_state, "air_finished");
sv_fields.pain_finished = ED_GetFieldIndex (&sv_pr_state, "pain_finished");
sv_fields.radsuit_finished = ED_GetFieldIndex (&sv_pr_state, "radsuit_finished");
sv_fields.speed = ED_GetFieldIndex (&sv_pr_state, "speed");
}
void

View file

@ -165,4 +165,9 @@ extern sv_fields_t sv_fields;
#define PROGHEADER_CRC 54730
extern func_t EndFrame;
extern func_t SpectatorConnect;
extern func_t SpectatorThink;
extern func_t SpectatorDisconnect;
#endif // __sv_progs_h