mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 15:01:41 +00:00
qw-server builds, but dies a sad death. I REALLY REALLY NEED to clean up my
progs globals and edict fields accessors, but I'm not so sure that's the cause of the run-time error: SV_Error: SV_ModelIndex: model progs/player.mdl not precached Fatal error: SV_Error: SV_ModelIndex: model progs/player.mdl not precached I suspect I failed to find the spawn function.
This commit is contained in:
parent
dfaf767890
commit
63b990cd30
16 changed files with 753 additions and 719 deletions
1
include/.gitignore
vendored
1
include/.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
|
.vimrc
|
||||||
Makefile.in
|
Makefile.in
|
||||||
Makefile
|
Makefile
|
||||||
config.h.in
|
config.h.in
|
||||||
|
|
|
@ -62,6 +62,7 @@ typedef struct edict_s
|
||||||
short leafnums[MAX_ENT_LEAFS];
|
short leafnums[MAX_ENT_LEAFS];
|
||||||
|
|
||||||
float freetime; // sv.time when the object was freed
|
float freetime; // sv.time when the object was freed
|
||||||
|
void *data; // external per-edict data
|
||||||
pr_type_t v[1]; // fields from progs
|
pr_type_t v[1]; // fields from progs
|
||||||
} edict_t;
|
} edict_t;
|
||||||
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
|
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
|
||||||
|
@ -122,15 +123,15 @@ int NUM_FOR_EDICT(progs_t *pr, edict_t *e);
|
||||||
#define G_EDICT(p,o) ((edict_t *)(PR_edicts (p) + G_INT (p, o)))
|
#define G_EDICT(p,o) ((edict_t *)(PR_edicts (p) + G_INT (p, o)))
|
||||||
#define G_EDICTNUM(p,o) NUM_FOR_EDICT(p, G_EDICT(p, o))
|
#define G_EDICTNUM(p,o) NUM_FOR_EDICT(p, G_EDICT(p, o))
|
||||||
#define G_VECTOR(p,o) (&G_FLOAT (p, o))
|
#define G_VECTOR(p,o) (&G_FLOAT (p, o))
|
||||||
#define G_STRING(p,o) PR_GetString (p, G_var (p, o, string_t))
|
#define G_STRING(p,o) PR_GetString (p, G_var (p, o, string))
|
||||||
#define G_FUNCTION(p,o) G_var (p, o, func_t)
|
#define G_FUNCTION(p,o) G_var (p, o, func)
|
||||||
|
|
||||||
#define E_var(e,o,t) ((e)->v.vv[o].t##_var)
|
#define E_var(e,o,t) ((e)->v[o].t##_var)
|
||||||
|
|
||||||
#define E_FLOAT(e,o) E_var (e, o, float)
|
#define E_FLOAT(e,o) E_var (e, o, float)
|
||||||
#define E_INT(e,o) E_var (e, o, int)
|
#define E_INT(e,o) E_var (e, o, int)
|
||||||
#define E_VECTOR(e,o) (&E_FLOAT (e, o))
|
#define E_VECTOR(e,o) (&E_FLOAT (e, o))
|
||||||
#define E_STRING(p,e,o) (PR_GetString (p, E_var (e, o, string_t)))
|
#define E_STRING(p,e,o) (PR_GetString (p, E_var (e, o, string)))
|
||||||
|
|
||||||
extern int type_size[8];
|
extern int type_size[8];
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ extern func_t SpectatorConnect;
|
||||||
extern func_t SpectatorThink;
|
extern func_t SpectatorThink;
|
||||||
extern func_t SpectatorDisconnect;
|
extern func_t SpectatorDisconnect;
|
||||||
|
|
||||||
void PR_Error (progs_t *pr, char *error, ...) __attribute__((format(printf,2,3)));
|
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)));
|
void PR_RunError (progs_t *pr, char *error, ...) __attribute__((format(printf,2,3)));
|
||||||
|
|
||||||
void ED_PrintEdicts (progs_t *pr);
|
void ED_PrintEdicts (progs_t *pr);
|
||||||
|
@ -196,7 +197,7 @@ struct progs_s {
|
||||||
pr_type_t *pr_globals; // same as pr_global_struct
|
pr_type_t *pr_globals; // same as pr_global_struct
|
||||||
|
|
||||||
int pr_edict_size; // in bytes
|
int pr_edict_size; // in bytes
|
||||||
int pr_edictareasize; // LordHavoc: for bounds checking
|
int pr_edictareasize; // for bounds checking, starts at 0
|
||||||
|
|
||||||
int pr_argc;
|
int pr_argc;
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ struct progs_s {
|
||||||
|
|
||||||
edict_t **edicts;
|
edict_t **edicts;
|
||||||
int *num_edicts;
|
int *num_edicts;
|
||||||
int *reserved_edicts;
|
int *reserved_edicts; //alloc will start at reserved_edicts+1
|
||||||
double *time;
|
double *time;
|
||||||
int null_bad;
|
int null_bad;
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "qdefs.h"
|
#include "qdefs.h"
|
||||||
#include "qendian.h"
|
#include "qendian.h"
|
||||||
#include "quakefs.h"
|
#include "quakefs.h"
|
||||||
|
#include "sys.h" //XXX
|
||||||
#include "zone.h"
|
#include "zone.h"
|
||||||
#include "va.h"
|
#include "va.h"
|
||||||
|
|
||||||
|
@ -963,7 +964,7 @@ PR_LoadProgs (progs_t * pr, char *progsname)
|
||||||
|
|
||||||
pr->progs->entityfields * 4 + sizeof (edict_t) - sizeof (pr_type_t);
|
pr->progs->entityfields * 4 + sizeof (edict_t) - sizeof (pr_type_t);
|
||||||
|
|
||||||
pr->pr_edictareasize = pr->pr_edict_size * MAX_EDICTS;
|
pr->pr_edictareasize = 0;
|
||||||
|
|
||||||
// byte swap the lumps
|
// byte swap the lumps
|
||||||
for (i = 0; i < pr->progs->numstatements; i++) {
|
for (i = 0; i < pr->progs->numstatements; i++) {
|
||||||
|
@ -1014,8 +1015,8 @@ PR_LoadProgs (progs_t * pr, char *progsname)
|
||||||
PR_Error (pr, "%s: undefined field: nextthink", progsname);
|
PR_Error (pr, "%s: undefined field: nextthink", progsname);
|
||||||
if (!(pr->f_frame = FindFieldOffset (pr, "frame")))
|
if (!(pr->f_frame = FindFieldOffset (pr, "frame")))
|
||||||
PR_Error (pr, "%s: undefined field: frame", progsname);
|
PR_Error (pr, "%s: undefined field: frame", progsname);
|
||||||
if (!(pr->f_think = FindFieldOffset (pr, "function")))
|
if (!(pr->f_think = FindFieldOffset (pr, "think")))
|
||||||
PR_Error (pr, "%s: undefined field: function", progsname);
|
PR_Error (pr, "%s: undefined field: think", progsname);
|
||||||
|
|
||||||
// LordHavoc: Ender added this
|
// LordHavoc: Ender added this
|
||||||
FindEdictFieldOffsets (pr);
|
FindEdictFieldOffsets (pr);
|
||||||
|
@ -1172,3 +1173,16 @@ NUM_FOR_EDICT (progs_t * pr, edict_t *e)
|
||||||
PR_Error (pr, "NUM_FOR_EDICT: bad pointer");
|
PR_Error (pr, "NUM_FOR_EDICT: bad pointer");
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PR_Error (progs_t *pr, const char *error, ...)
|
||||||
|
{
|
||||||
|
va_list argptr;
|
||||||
|
char string[1024];
|
||||||
|
|
||||||
|
va_start (argptr, error);
|
||||||
|
vsnprintf (string, sizeof (string), error, argptr);
|
||||||
|
va_end (argptr);
|
||||||
|
|
||||||
|
Sys_Error ("%s", string);
|
||||||
|
}
|
||||||
|
|
|
@ -80,14 +80,14 @@ if ASM_ARCH
|
||||||
world_ASM= worlda.S
|
world_ASM= worlda.S
|
||||||
endif
|
endif
|
||||||
|
|
||||||
server_SOURCES= pr_edict.c pr_exec.c pr_offs.c sv_ccmds.c sv_cvar.c \
|
server_SOURCES= sv_ccmds.c sv_cvar.c \
|
||||||
sv_ents.c sv_init.c sv_main.c sv_misc.c sv_model.c \
|
sv_ents.c sv_init.c sv_main.c sv_misc.c sv_model.c \
|
||||||
sv_move.c sv_nchan.c sv_phys.c sv_pr_cmds.c sv_progs.c sv_send.c \
|
sv_move.c sv_nchan.c sv_phys.c sv_pr_cmds.c sv_progs.c sv_send.c \
|
||||||
sv_user.c ver_check.c world.c $(world_ASM)
|
sv_user.c ver_check.c world.c $(world_ASM)
|
||||||
|
|
||||||
qw_server_SOURCES= $(common_SOURCES) $(server_SOURCES)
|
qw_server_SOURCES= $(common_SOURCES) $(server_SOURCES)
|
||||||
qw_server_LDADD= -L. -L../../libs -lqfnet -lqfsys_sv -lqfutil $(NET_LIBS) $(Z_LIBS) $(DL_LIBS)
|
qw_server_LDADD= -L. -L../../libs -lqfnet -lqfsys_sv -lqfgamecode -lqfutil $(NET_LIBS) $(Z_LIBS) $(DL_LIBS)
|
||||||
qw_server_DEPENDENCIES= libqfnet.a libqfsys_sv.a ../../libs/libqfutil.a
|
qw_server_DEPENDENCIES= libqfnet.a libqfsys_sv.a ../../libs/libqfgamecode.a ../../libs/libqfutil.a
|
||||||
|
|
||||||
#
|
#
|
||||||
# Client builds
|
# Client builds
|
||||||
|
@ -170,8 +170,8 @@ endif
|
||||||
libqfjs_a_CFLAGS= $(JOY_CFLAGS)
|
libqfjs_a_CFLAGS= $(JOY_CFLAGS)
|
||||||
EXTRA_libqfjs_a_SOURCES= joy_linux.c joy_win.c joy_null.c
|
EXTRA_libqfjs_a_SOURCES= joy_linux.c joy_win.c joy_null.c
|
||||||
|
|
||||||
CLIENT_LIBS= -L. -L../../libs -lqfnet -lqfsys_cl -lqfsnd -lqfcd -lqfjs -lqfutil $(SOUND_LIBS) $(NET_LIBS) $(CD_LIBS) $(JOY_LIBS) $(Z_LIBS)
|
CLIENT_LIBS= -L. -L../../libs -lqfnet -lqfsys_cl -lqfsnd -lqfcd -lqfjs -lqfgamecode -lqfutil $(SOUND_LIBS) $(NET_LIBS) $(CD_LIBS) $(JOY_LIBS) $(Z_LIBS)
|
||||||
CLIENT_LIB_DEPS= libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a ../../libs/libqfutil.a
|
CLIENT_LIB_DEPS= libqfnet.a libqfsys_cl.a libqfsnd.a libqfcd.a libqfjs.a ../../libs/libqfgamecode.a ../../libs/libqfutil.a
|
||||||
|
|
||||||
if ASM_ARCH
|
if ASM_ARCH
|
||||||
client_ASM= snd_mixa.S cl_math.S
|
client_ASM= snd_mixa.S cl_math.S
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "bothdefs.h"
|
#include "bothdefs.h"
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "qargs.h"
|
#include "qargs.h"
|
||||||
#include "qendian.h"
|
#include "qendian.h"
|
||||||
#include "quakefs.h"
|
#include "quakefs.h"
|
||||||
|
@ -216,8 +217,8 @@ SV_God_f (void)
|
||||||
if (!SV_SetPlayer ())
|
if (!SV_SetPlayer ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sv_player->v.v.flags = (int) sv_player->v.v.flags ^ FL_GODMODE;
|
((entvars_t*)&sv_player->v)->flags = (int) ((entvars_t*)&sv_player->v)->flags ^ FL_GODMODE;
|
||||||
if (!((int) sv_player->v.v.flags & FL_GODMODE))
|
if (!((int) ((entvars_t*)&sv_player->v)->flags & FL_GODMODE))
|
||||||
SV_ClientPrintf (host_client, PRINT_HIGH, "godmode OFF\n");
|
SV_ClientPrintf (host_client, PRINT_HIGH, "godmode OFF\n");
|
||||||
else
|
else
|
||||||
SV_ClientPrintf (host_client, PRINT_HIGH, "godmode ON\n");
|
SV_ClientPrintf (host_client, PRINT_HIGH, "godmode ON\n");
|
||||||
|
@ -236,11 +237,11 @@ SV_Noclip_f (void)
|
||||||
if (!SV_SetPlayer ())
|
if (!SV_SetPlayer ())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (sv_player->v.v.movetype != MOVETYPE_NOCLIP) {
|
if (((entvars_t*)&sv_player->v)->movetype != MOVETYPE_NOCLIP) {
|
||||||
sv_player->v.v.movetype = MOVETYPE_NOCLIP;
|
((entvars_t*)&sv_player->v)->movetype = MOVETYPE_NOCLIP;
|
||||||
SV_ClientPrintf (host_client, PRINT_HIGH, "noclip ON\n");
|
SV_ClientPrintf (host_client, PRINT_HIGH, "noclip ON\n");
|
||||||
} else {
|
} else {
|
||||||
sv_player->v.v.movetype = MOVETYPE_WALK;
|
((entvars_t*)&sv_player->v)->movetype = MOVETYPE_WALK;
|
||||||
SV_ClientPrintf (host_client, PRINT_HIGH, "noclip OFF\n");
|
SV_ClientPrintf (host_client, PRINT_HIGH, "noclip OFF\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -276,24 +277,24 @@ SV_Give_f (void)
|
||||||
case '7':
|
case '7':
|
||||||
case '8':
|
case '8':
|
||||||
case '9':
|
case '9':
|
||||||
sv_player->v.v.items =
|
((entvars_t*)&sv_player->v)->items =
|
||||||
(int) sv_player->v.v.items | IT_SHOTGUN << (t[0] - '2');
|
(int) ((entvars_t*)&sv_player->v)->items | IT_SHOTGUN << (t[0] - '2');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
sv_player->v.v.ammo_shells = v;
|
((entvars_t*)&sv_player->v)->ammo_shells = v;
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
sv_player->v.v.ammo_nails = v;
|
((entvars_t*)&sv_player->v)->ammo_nails = v;
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
sv_player->v.v.ammo_rockets = v;
|
((entvars_t*)&sv_player->v)->ammo_rockets = v;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
sv_player->v.v.health = v;
|
((entvars_t*)&sv_player->v)->health = v;
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
sv_player->v.v.ammo_cells = v;
|
((entvars_t*)&sv_player->v)->ammo_cells = v;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +415,7 @@ SV_Status_f (void)
|
||||||
|
|
||||||
Con_Printf ("%-16.16s ", cl->name);
|
Con_Printf ("%-16.16s ", cl->name);
|
||||||
|
|
||||||
Con_Printf ("%6i %5i", cl->userid, (int) cl->edict->v.v.frags);
|
Con_Printf ("%6i %5i", cl->userid, (int) ((entvars_t*)&cl->edict->v)->frags);
|
||||||
if (cl->spectator)
|
if (cl->spectator)
|
||||||
Con_Printf (" (s)\n");
|
Con_Printf (" (s)\n");
|
||||||
else
|
else
|
||||||
|
@ -444,7 +445,7 @@ SV_Status_f (void)
|
||||||
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
for (i = 0, cl = svs.clients; i < MAX_CLIENTS; i++, cl++) {
|
||||||
if (!cl->state)
|
if (!cl->state)
|
||||||
continue;
|
continue;
|
||||||
Con_Printf ("%5i %6i ", (int) cl->edict->v.v.frags, cl->userid);
|
Con_Printf ("%5i %6i ", (int) ((entvars_t*)&cl->edict->v)->frags, cl->userid);
|
||||||
|
|
||||||
s = NET_BaseAdrToString (cl->netchan.remote_address);
|
s = NET_BaseAdrToString (cl->netchan.remote_address);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "msg_ucmd.h"
|
#include "msg_ucmd.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
|
@ -117,8 +118,8 @@ extern int sv_nailmodel, sv_supernailmodel, sv_playermodel;
|
||||||
qboolean
|
qboolean
|
||||||
SV_AddNailUpdate (edict_t *ent)
|
SV_AddNailUpdate (edict_t *ent)
|
||||||
{
|
{
|
||||||
if (ent->v.v.modelindex != sv_nailmodel
|
if (((entvars_t*)&ent->v)->modelindex != sv_nailmodel
|
||||||
&& ent->v.v.modelindex != sv_supernailmodel) return false;
|
&& ((entvars_t*)&ent->v)->modelindex != sv_supernailmodel) return false;
|
||||||
if (numnails == MAX_NAILS)
|
if (numnails == MAX_NAILS)
|
||||||
return true;
|
return true;
|
||||||
nails[numnails] = ent;
|
nails[numnails] = ent;
|
||||||
|
@ -142,11 +143,11 @@ SV_EmitNailUpdate (sizebuf_t *msg)
|
||||||
|
|
||||||
for (n = 0; n < numnails; n++) {
|
for (n = 0; n < numnails; n++) {
|
||||||
ent = nails[n];
|
ent = nails[n];
|
||||||
x = (int) (ent->v.v.origin[0] + 4096) >> 1;
|
x = (int) (((entvars_t*)&ent->v)->origin[0] + 4096) >> 1;
|
||||||
y = (int) (ent->v.v.origin[1] + 4096) >> 1;
|
y = (int) (((entvars_t*)&ent->v)->origin[1] + 4096) >> 1;
|
||||||
z = (int) (ent->v.v.origin[2] + 4096) >> 1;
|
z = (int) (((entvars_t*)&ent->v)->origin[2] + 4096) >> 1;
|
||||||
p = (int) (16 * ent->v.v.angles[0] / 360) & 15;
|
p = (int) (16 * ((entvars_t*)&ent->v)->angles[0] / 360) & 15;
|
||||||
yaw = (int) (256 * ent->v.v.angles[1] / 360) & 255;
|
yaw = (int) (256 * ((entvars_t*)&ent->v)->angles[1] / 360) & 255;
|
||||||
|
|
||||||
bits[0] = x;
|
bits[0] = x;
|
||||||
bits[1] = (x >> 8) | (y << 4);
|
bits[1] = (x >> 8) | (y << 4);
|
||||||
|
@ -362,7 +363,7 @@ SV_EmitPacketEntities (client_t *client, packet_entities_t *to, sizebuf_t *msg)
|
||||||
// the baseline
|
// the baseline
|
||||||
ent = EDICT_NUM (&sv_pr_state, newnum);
|
ent = EDICT_NUM (&sv_pr_state, newnum);
|
||||||
//Con_Printf ("baseline %i\n", newnum);
|
//Con_Printf ("baseline %i\n", newnum);
|
||||||
SV_WriteDelta (&ent->baseline, &to->entities[newindex], msg, true,
|
SV_WriteDelta (ent->data, &to->entities[newindex], msg, true,
|
||||||
client->stdver);
|
client->stdver);
|
||||||
newindex++;
|
newindex++;
|
||||||
continue;
|
continue;
|
||||||
|
@ -416,18 +417,18 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
|
||||||
|
|
||||||
pflags = PF_MSEC | PF_COMMAND;
|
pflags = PF_MSEC | PF_COMMAND;
|
||||||
|
|
||||||
if (ent->v.v.modelindex != sv_playermodel)
|
if (((entvars_t*)&ent->v)->modelindex != sv_playermodel)
|
||||||
pflags |= PF_MODEL;
|
pflags |= PF_MODEL;
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (ent->v.v.velocity[i])
|
if (((entvars_t*)&ent->v)->velocity[i])
|
||||||
pflags |= PF_VELOCITY1 << i;
|
pflags |= PF_VELOCITY1 << i;
|
||||||
if (ent->v.v.effects)
|
if (((entvars_t*)&ent->v)->effects)
|
||||||
pflags |= PF_EFFECTS;
|
pflags |= PF_EFFECTS;
|
||||||
if (ent->v.v.skin)
|
if (((entvars_t*)&ent->v)->skin)
|
||||||
pflags |= PF_SKINNUM;
|
pflags |= PF_SKINNUM;
|
||||||
if (ent->v.v.health <= 0)
|
if (((entvars_t*)&ent->v)->health <= 0)
|
||||||
pflags |= PF_DEAD;
|
pflags |= PF_DEAD;
|
||||||
if (ent->v.v.mins[2] != -24)
|
if (((entvars_t*)&ent->v)->mins[2] != -24)
|
||||||
pflags |= PF_GIB;
|
pflags |= PF_GIB;
|
||||||
|
|
||||||
if (cl->spectator) { // only sent origin and velocity to
|
if (cl->spectator) { // only sent origin and velocity to
|
||||||
|
@ -436,21 +437,21 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
|
||||||
} else if (ent == clent) { // don't send a lot of data on
|
} else if (ent == clent) { // don't send a lot of data on
|
||||||
// personal entity
|
// personal entity
|
||||||
pflags &= ~(PF_MSEC | PF_COMMAND);
|
pflags &= ~(PF_MSEC | PF_COMMAND);
|
||||||
if (ent->v.v.weaponframe)
|
if (((entvars_t*)&ent->v)->weaponframe)
|
||||||
pflags |= PF_WEAPONFRAME;
|
pflags |= PF_WEAPONFRAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->spec_track && client->spec_track - 1 == j &&
|
if (client->spec_track && client->spec_track - 1 == j &&
|
||||||
ent->v.v.weaponframe) pflags |= PF_WEAPONFRAME;
|
((entvars_t*)&ent->v)->weaponframe) pflags |= PF_WEAPONFRAME;
|
||||||
|
|
||||||
MSG_WriteByte (msg, svc_playerinfo);
|
MSG_WriteByte (msg, svc_playerinfo);
|
||||||
MSG_WriteByte (msg, j);
|
MSG_WriteByte (msg, j);
|
||||||
MSG_WriteShort (msg, pflags);
|
MSG_WriteShort (msg, pflags);
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
MSG_WriteCoord (msg, ent->v.v.origin[i]);
|
MSG_WriteCoord (msg, ((entvars_t*)&ent->v)->origin[i]);
|
||||||
|
|
||||||
MSG_WriteByte (msg, ent->v.v.frame);
|
MSG_WriteByte (msg, ((entvars_t*)&ent->v)->frame);
|
||||||
|
|
||||||
if (pflags & PF_MSEC) {
|
if (pflags & PF_MSEC) {
|
||||||
msec = 1000 * (sv.time - cl->localtime);
|
msec = 1000 * (sv.time - cl->localtime);
|
||||||
|
@ -462,10 +463,10 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
|
||||||
if (pflags & PF_COMMAND) {
|
if (pflags & PF_COMMAND) {
|
||||||
cmd = cl->lastcmd;
|
cmd = cl->lastcmd;
|
||||||
|
|
||||||
if (ent->v.v.health <= 0) { // don't show the corpse looking
|
if (((entvars_t*)&ent->v)->health <= 0) { // don't show the corpse looking
|
||||||
// around...
|
// around...
|
||||||
cmd.angles[0] = 0;
|
cmd.angles[0] = 0;
|
||||||
cmd.angles[1] = ent->v.v.angles[1];
|
cmd.angles[1] = ((entvars_t*)&ent->v)->angles[1];
|
||||||
cmd.angles[0] = 0;
|
cmd.angles[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -477,19 +478,19 @@ SV_WritePlayersToClient (client_t *client, edict_t *clent, byte * pvs,
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (pflags & (PF_VELOCITY1 << i))
|
if (pflags & (PF_VELOCITY1 << i))
|
||||||
MSG_WriteShort (msg, ent->v.v.velocity[i]);
|
MSG_WriteShort (msg, ((entvars_t*)&ent->v)->velocity[i]);
|
||||||
|
|
||||||
if (pflags & PF_MODEL)
|
if (pflags & PF_MODEL)
|
||||||
MSG_WriteByte (msg, ent->v.v.modelindex);
|
MSG_WriteByte (msg, ((entvars_t*)&ent->v)->modelindex);
|
||||||
|
|
||||||
if (pflags & PF_SKINNUM)
|
if (pflags & PF_SKINNUM)
|
||||||
MSG_WriteByte (msg, ent->v.v.skin);
|
MSG_WriteByte (msg, ((entvars_t*)&ent->v)->skin);
|
||||||
|
|
||||||
if (pflags & PF_EFFECTS)
|
if (pflags & PF_EFFECTS)
|
||||||
MSG_WriteByte (msg, ent->v.v.effects);
|
MSG_WriteByte (msg, ((entvars_t*)&ent->v)->effects);
|
||||||
|
|
||||||
if (pflags & PF_WEAPONFRAME)
|
if (pflags & PF_WEAPONFRAME)
|
||||||
MSG_WriteByte (msg, ent->v.v.weaponframe);
|
MSG_WriteByte (msg, ((entvars_t*)&ent->v)->weaponframe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +520,7 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
||||||
|
|
||||||
// find the client's PVS
|
// find the client's PVS
|
||||||
clent = client->edict;
|
clent = client->edict;
|
||||||
VectorAdd (clent->v.v.origin, clent->v.v.view_ofs, org);
|
VectorAdd (((entvars_t*)&clent->v)->origin, ((entvars_t*)&clent->v)->view_ofs, org);
|
||||||
pvs = SV_FatPVS (org);
|
pvs = SV_FatPVS (org);
|
||||||
|
|
||||||
// send over the players in the PVS
|
// send over the players in the PVS
|
||||||
|
@ -535,7 +536,7 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
||||||
for (e = MAX_CLIENTS + 1, ent = EDICT_NUM (&sv_pr_state, e); e < sv.num_edicts;
|
for (e = MAX_CLIENTS + 1, ent = EDICT_NUM (&sv_pr_state, e); e < sv.num_edicts;
|
||||||
e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
|
e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
|
||||||
// ignore ents without visible models
|
// ignore ents without visible models
|
||||||
if (!ent->v.v.modelindex || !*PR_GetString (&sv_pr_state, ent->v.v.model))
|
if (!((entvars_t*)&ent->v)->modelindex || !*PR_GetString (&sv_pr_state, ((entvars_t*)&ent->v)->model))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// ignore if not touching a PV leaf
|
// ignore if not touching a PV leaf
|
||||||
|
@ -558,13 +559,13 @@ SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg)
|
||||||
|
|
||||||
state->number = e;
|
state->number = e;
|
||||||
state->flags = 0;
|
state->flags = 0;
|
||||||
VectorCopy (ent->v.v.origin, state->origin);
|
VectorCopy (((entvars_t*)&ent->v)->origin, state->origin);
|
||||||
VectorCopy (ent->v.v.angles, state->angles);
|
VectorCopy (((entvars_t*)&ent->v)->angles, state->angles);
|
||||||
state->modelindex = ent->v.v.modelindex;
|
state->modelindex = ((entvars_t*)&ent->v)->modelindex;
|
||||||
state->frame = ent->v.v.frame;
|
state->frame = ((entvars_t*)&ent->v)->frame;
|
||||||
state->colormap = ent->v.v.colormap;
|
state->colormap = ((entvars_t*)&ent->v)->colormap;
|
||||||
state->skinnum = ent->v.v.skin;
|
state->skinnum = ((entvars_t*)&ent->v)->skin;
|
||||||
state->effects = ent->v.v.effects;
|
state->effects = ((entvars_t*)&ent->v)->effects;
|
||||||
|
|
||||||
// LordHavoc: cleaned up Endy's coding style, shortened the code,
|
// LordHavoc: cleaned up Endy's coding style, shortened the code,
|
||||||
// and implemented missing effects
|
// and implemented missing effects
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "quakefs.h"
|
#include "quakefs.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
@ -49,6 +50,8 @@ char localmodels[MAX_MODELS][5]; // inline model names for precache
|
||||||
|
|
||||||
char localinfo[MAX_LOCALINFO_STRING + 1]; // local game info
|
char localinfo[MAX_LOCALINFO_STRING + 1]; // local game info
|
||||||
|
|
||||||
|
entity_state_t baselines[MAX_EDICTS];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SV_ModelIndex
|
SV_ModelIndex
|
||||||
*/
|
*/
|
||||||
|
@ -108,30 +111,30 @@ SV_CreateBaseline (void)
|
||||||
continue;
|
continue;
|
||||||
// create baselines for all player slots,
|
// create baselines for all player slots,
|
||||||
// and any other edict that has a visible model
|
// and any other edict that has a visible model
|
||||||
if (entnum > MAX_CLIENTS && !svent->v.v.modelindex)
|
if (entnum > MAX_CLIENTS && !((entvars_t*)&svent->v)->modelindex)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//
|
//
|
||||||
// create entity baseline
|
// create entity baseline
|
||||||
//
|
//
|
||||||
VectorCopy (svent->v.v.origin, svent->baseline.origin);
|
VectorCopy (((entvars_t*)&svent->v)->origin, ((entity_state_t*)svent->data)->origin);
|
||||||
VectorCopy (svent->v.v.angles, svent->baseline.angles);
|
VectorCopy (((entvars_t*)&svent->v)->angles, ((entity_state_t*)svent->data)->angles);
|
||||||
svent->baseline.frame = svent->v.v.frame;
|
((entity_state_t*)svent->data)->frame = ((entvars_t*)&svent->v)->frame;
|
||||||
svent->baseline.skinnum = svent->v.v.skin;
|
((entity_state_t*)svent->data)->skinnum = ((entvars_t*)&svent->v)->skin;
|
||||||
if (entnum > 0 && entnum <= MAX_CLIENTS) {
|
if (entnum > 0 && entnum <= MAX_CLIENTS) {
|
||||||
svent->baseline.colormap = entnum;
|
((entity_state_t*)svent->data)->colormap = entnum;
|
||||||
svent->baseline.modelindex = SV_ModelIndex ("progs/player.mdl");
|
((entity_state_t*)svent->data)->modelindex = SV_ModelIndex ("progs/player.mdl");
|
||||||
} else {
|
} else {
|
||||||
svent->baseline.colormap = 0;
|
((entity_state_t*)svent->data)->colormap = 0;
|
||||||
svent->baseline.modelindex =
|
((entity_state_t*)svent->data)->modelindex =
|
||||||
SV_ModelIndex (PR_GetString (&sv_pr_state, svent->v.v.model));
|
SV_ModelIndex (PR_GetString (&sv_pr_state, ((entvars_t*)&svent->v)->model));
|
||||||
}
|
}
|
||||||
// LordHavoc: setup baseline to include new effects
|
// LordHavoc: setup baseline to include new effects
|
||||||
svent->baseline.alpha = 255;
|
((entity_state_t*)svent->data)->alpha = 255;
|
||||||
svent->baseline.scale = 16;
|
((entity_state_t*)svent->data)->scale = 16;
|
||||||
svent->baseline.glowsize = 0;
|
((entity_state_t*)svent->data)->glowsize = 0;
|
||||||
svent->baseline.glowcolor = 254;
|
((entity_state_t*)svent->data)->glowcolor = 254;
|
||||||
svent->baseline.colormap = 255;
|
((entity_state_t*)svent->data)->colormap = 255;
|
||||||
|
|
||||||
//
|
//
|
||||||
// flush the signon message out to a seperate buffer if
|
// flush the signon message out to a seperate buffer if
|
||||||
|
@ -145,13 +148,13 @@ SV_CreateBaseline (void)
|
||||||
MSG_WriteByte (&sv.signon, svc_spawnbaseline);
|
MSG_WriteByte (&sv.signon, svc_spawnbaseline);
|
||||||
MSG_WriteShort (&sv.signon, entnum);
|
MSG_WriteShort (&sv.signon, entnum);
|
||||||
|
|
||||||
MSG_WriteByte (&sv.signon, svent->baseline.modelindex);
|
MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->modelindex);
|
||||||
MSG_WriteByte (&sv.signon, svent->baseline.frame);
|
MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->frame);
|
||||||
MSG_WriteByte (&sv.signon, svent->baseline.colormap);
|
MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->colormap);
|
||||||
MSG_WriteByte (&sv.signon, svent->baseline.skinnum);
|
MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->skinnum);
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
MSG_WriteCoord (&sv.signon, svent->baseline.origin[i]);
|
MSG_WriteCoord (&sv.signon, ((entity_state_t*)svent->data)->origin[i]);
|
||||||
MSG_WriteAngle (&sv.signon, svent->baseline.angles[i]);
|
MSG_WriteAngle (&sv.signon, ((entity_state_t*)svent->data)->angles[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,7 +176,7 @@ SV_SaveSpawnparms (void)
|
||||||
return; // no progs loaded yet
|
return; // no progs loaded yet
|
||||||
|
|
||||||
// serverflags is the only game related thing maintained
|
// serverflags is the only game related thing maintained
|
||||||
svs.serverflags = sv_pr_state.pr_global_struct->serverflags;
|
svs.serverflags = ((globalvars_t*)sv_pr_state.pr_globals)->serverflags;
|
||||||
|
|
||||||
for (i = 0, host_client = svs.clients; i < MAX_CLIENTS; i++, host_client++) {
|
for (i = 0, host_client = svs.clients; i < MAX_CLIENTS; i++, host_client++) {
|
||||||
if (host_client->state != cs_spawned)
|
if (host_client->state != cs_spawned)
|
||||||
|
@ -183,10 +186,10 @@ SV_SaveSpawnparms (void)
|
||||||
host_client->state = cs_connected;
|
host_client->state = cs_connected;
|
||||||
|
|
||||||
// call the progs to get default spawn parms for the new client
|
// call the progs to get default spawn parms for the new client
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, host_client->edict);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, host_client->edict);
|
||||||
PR_ExecuteProgram (&sv_pr_state, sv_pr_state.pr_global_struct->SetChangeParms);
|
PR_ExecuteProgram (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->SetChangeParms);
|
||||||
for (j = 0; j < NUM_SPAWN_PARMS; j++)
|
for (j = 0; j < NUM_SPAWN_PARMS; j++)
|
||||||
host_client->spawn_parms[j] = (&sv_pr_state.pr_global_struct->parm1)[j];
|
host_client->spawn_parms[j] = (&((globalvars_t*)sv_pr_state.pr_globals)->parm1)[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,12 +342,14 @@ SV_SpawnServer (char *server)
|
||||||
MAX_SERVERINFO_STRING);
|
MAX_SERVERINFO_STRING);
|
||||||
|
|
||||||
// allocate edicts
|
// allocate edicts
|
||||||
sv.edicts = Hunk_AllocName (MAX_EDICTS * sv_pr_state.pr_edict_size, "edicts");
|
sv_pr_state.pr_edictareasize = sv_pr_state.pr_edict_size * MAX_EDICTS;
|
||||||
|
sv.edicts = Hunk_AllocName (sv_pr_state.pr_edictareasize, "edicts");
|
||||||
|
|
||||||
// leave slots at start for clients only
|
// leave slots at start for clients only
|
||||||
sv.num_edicts = MAX_CLIENTS + 1;
|
sv.num_edicts = MAX_CLIENTS + 1;
|
||||||
for (i = 0; i < MAX_CLIENTS; i++) {
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
||||||
ent = EDICT_NUM (&sv_pr_state, i + 1);
|
ent = EDICT_NUM (&sv_pr_state, i + 1);
|
||||||
|
ent->data = &baselines[i];
|
||||||
svs.clients[i].edict = ent;
|
svs.clients[i].edict = ent;
|
||||||
//ZOID - make sure we update frags right
|
//ZOID - make sure we update frags right
|
||||||
svs.clients[i].old_frags = 0;
|
svs.clients[i].old_frags = 0;
|
||||||
|
@ -387,14 +392,14 @@ SV_SpawnServer (char *server)
|
||||||
|
|
||||||
ent = EDICT_NUM (&sv_pr_state, 0);
|
ent = EDICT_NUM (&sv_pr_state, 0);
|
||||||
ent->free = false;
|
ent->free = false;
|
||||||
ent->v.v.model = PR_SetString (&sv_pr_state, sv.worldmodel->name);
|
((entvars_t*)&ent->v)->model = PR_SetString (&sv_pr_state, sv.worldmodel->name);
|
||||||
ent->v.v.modelindex = 1; // world model
|
((entvars_t*)&ent->v)->modelindex = 1; // world model
|
||||||
ent->v.v.solid = SOLID_BSP;
|
((entvars_t*)&ent->v)->solid = SOLID_BSP;
|
||||||
ent->v.v.movetype = MOVETYPE_PUSH;
|
((entvars_t*)&ent->v)->movetype = MOVETYPE_PUSH;
|
||||||
|
|
||||||
sv_pr_state.pr_global_struct->mapname = PR_SetString (&sv_pr_state, sv.name);
|
((globalvars_t*)sv_pr_state.pr_globals)->mapname = PR_SetString (&sv_pr_state, sv.name);
|
||||||
// serverflags are for cross level information (sigils)
|
// serverflags are for cross level information (sigils)
|
||||||
sv_pr_state.pr_global_struct->serverflags = svs.serverflags;
|
((globalvars_t*)sv_pr_state.pr_globals)->serverflags = svs.serverflags;
|
||||||
|
|
||||||
// run the frame start qc function to let progs check cvars
|
// run the frame start qc function to let progs check cvars
|
||||||
SV_ProgStartFrame ();
|
SV_ProgStartFrame ();
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "qargs.h"
|
#include "qargs.h"
|
||||||
#include "quakefs.h"
|
#include "quakefs.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
@ -250,12 +251,12 @@ SV_DropClient (client_t *drop)
|
||||||
if (!drop->spectator) {
|
if (!drop->spectator) {
|
||||||
// call the prog function for removing a client
|
// call the prog function for removing a client
|
||||||
// this will set the body to a dead frame, among other things
|
// this will set the body to a dead frame, among other things
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, drop->edict);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, drop->edict);
|
||||||
PR_ExecuteProgram (&sv_pr_state, sv_pr_state.pr_global_struct->ClientDisconnect);
|
PR_ExecuteProgram (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->ClientDisconnect);
|
||||||
} else if (SpectatorDisconnect) {
|
} else if (SpectatorDisconnect) {
|
||||||
// call the prog function for removing a client
|
// call the prog function for removing a client
|
||||||
// this will set the body to a dead frame, among other things
|
// this will set the body to a dead frame, among other things
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, drop->edict);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, drop->edict);
|
||||||
PR_ExecuteProgram (&sv_pr_state, SpectatorDisconnect);
|
PR_ExecuteProgram (&sv_pr_state, SpectatorDisconnect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,7 +279,7 @@ SV_DropClient (client_t *drop)
|
||||||
drop->connection_started = realtime; // for zombie timeout
|
drop->connection_started = realtime; // for zombie timeout
|
||||||
|
|
||||||
drop->old_frags = 0;
|
drop->old_frags = 0;
|
||||||
drop->edict->v.v.frags = 0;
|
((entvars_t*)&drop->edict->v)->frags = 0;
|
||||||
drop->name[0] = 0;
|
drop->name[0] = 0;
|
||||||
memset (drop->userinfo, 0, sizeof (drop->userinfo));
|
memset (drop->userinfo, 0, sizeof (drop->userinfo));
|
||||||
|
|
||||||
|
@ -841,9 +842,9 @@ SVC_DirectConnect (void)
|
||||||
newcl->lockedtill = 0;
|
newcl->lockedtill = 0;
|
||||||
|
|
||||||
// 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_ExecuteProgram (&sv_pr_state, sv_pr_state.pr_global_struct->SetNewParms);
|
PR_ExecuteProgram (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->SetNewParms);
|
||||||
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||||
newcl->spawn_parms[i] = (&sv_pr_state.pr_global_struct->parm1)[i];
|
newcl->spawn_parms[i] = (&((globalvars_t*)sv_pr_state.pr_globals)->parm1)[i];
|
||||||
|
|
||||||
if (newcl->spectator)
|
if (newcl->spectator)
|
||||||
Con_Printf ("Spectator %s connected\n", newcl->name);
|
Con_Printf ("Spectator %s connected\n", newcl->name);
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
#include "qtypes.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "sv_pr_cmds.h"
|
#include "sv_pr_cmds.h"
|
||||||
|
@ -56,8 +58,8 @@ SV_CheckBottom (edict_t *ent)
|
||||||
int x, y;
|
int x, y;
|
||||||
float mid, bottom;
|
float mid, bottom;
|
||||||
|
|
||||||
VectorAdd (ent->v.v.origin, ent->v.v.mins, mins);
|
VectorAdd (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, mins);
|
||||||
VectorAdd (ent->v.v.origin, ent->v.v.maxs, maxs);
|
VectorAdd (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->maxs, maxs);
|
||||||
|
|
||||||
// if all of the points under the corners are solid world, don't bother
|
// if all of the points under the corners are solid world, don't bother
|
||||||
// with the tougher checks
|
// with the tougher checks
|
||||||
|
@ -128,34 +130,34 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
||||||
edict_t *enemy;
|
edict_t *enemy;
|
||||||
|
|
||||||
// try the move
|
// try the move
|
||||||
VectorCopy (ent->v.v.origin, oldorg);
|
VectorCopy (((entvars_t*)&ent->v)->origin, oldorg);
|
||||||
VectorAdd (ent->v.v.origin, move, neworg);
|
VectorAdd (((entvars_t*)&ent->v)->origin, move, neworg);
|
||||||
|
|
||||||
// flying monsters don't step up
|
// flying monsters don't step up
|
||||||
if ((int) ent->v.v.flags & (FL_SWIM | FL_FLY)) {
|
if ((int) ((entvars_t*)&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++) {
|
for (i = 0; i < 2; i++) {
|
||||||
VectorAdd (ent->v.v.origin, move, neworg);
|
VectorAdd (((entvars_t*)&ent->v)->origin, move, neworg);
|
||||||
enemy = PROG_TO_EDICT (&sv_pr_state, ent->v.v.enemy);
|
enemy = PROG_TO_EDICT (&sv_pr_state, ((entvars_t*)&ent->v)->enemy);
|
||||||
if (i == 0 && enemy != sv.edicts) {
|
if (i == 0 && enemy != sv.edicts) {
|
||||||
dz =
|
dz =
|
||||||
ent->v.v.origin[2] -
|
((entvars_t*)&ent->v)->origin[2] -
|
||||||
PROG_TO_EDICT (&sv_pr_state, ent->v.v.enemy)->v.v.origin[2];
|
((entvars_t*)&PROG_TO_EDICT (&sv_pr_state, ((entvars_t*)&ent->v)->enemy)->v)->origin[2];
|
||||||
if (dz > 40)
|
if (dz > 40)
|
||||||
neworg[2] -= 8;
|
neworg[2] -= 8;
|
||||||
if (dz < 30)
|
if (dz < 30)
|
||||||
neworg[2] += 8;
|
neworg[2] += 8;
|
||||||
}
|
}
|
||||||
trace =
|
trace =
|
||||||
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, neworg, false,
|
SV_Move (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, neworg, false,
|
||||||
ent);
|
ent);
|
||||||
|
|
||||||
if (trace.fraction == 1) {
|
if (trace.fraction == 1) {
|
||||||
if (((int) ent->v.v.flags & FL_SWIM)
|
if (((int) ((entvars_t*)&ent->v)->flags & FL_SWIM)
|
||||||
&& SV_PointContents (trace.endpos) == CONTENTS_EMPTY)
|
&& SV_PointContents (trace.endpos) == CONTENTS_EMPTY)
|
||||||
return false; // swim monster left water
|
return false; // swim monster left water
|
||||||
|
|
||||||
VectorCopy (trace.endpos, ent->v.v.origin);
|
VectorCopy (trace.endpos, ((entvars_t*)&ent->v)->origin);
|
||||||
if (relink)
|
if (relink)
|
||||||
SV_LinkEdict (ent, true);
|
SV_LinkEdict (ent, true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -172,24 +174,24 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
||||||
VectorCopy (neworg, end);
|
VectorCopy (neworg, end);
|
||||||
end[2] -= STEPSIZE * 2;
|
end[2] -= STEPSIZE * 2;
|
||||||
|
|
||||||
trace = SV_Move (neworg, ent->v.v.mins, ent->v.v.maxs, end, false, ent);
|
trace = SV_Move (neworg, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, end, false, ent);
|
||||||
|
|
||||||
if (trace.allsolid)
|
if (trace.allsolid)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (trace.startsolid) {
|
if (trace.startsolid) {
|
||||||
neworg[2] -= STEPSIZE;
|
neworg[2] -= STEPSIZE;
|
||||||
trace = SV_Move (neworg, ent->v.v.mins, ent->v.v.maxs, end, false, ent);
|
trace = SV_Move (neworg, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, end, false, ent);
|
||||||
if (trace.allsolid || trace.startsolid)
|
if (trace.allsolid || trace.startsolid)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (trace.fraction == 1) {
|
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.v.flags & FL_PARTIALGROUND) {
|
if ((int) ((entvars_t*)&ent->v)->flags & FL_PARTIALGROUND) {
|
||||||
VectorAdd (ent->v.v.origin, move, ent->v.v.origin);
|
VectorAdd (((entvars_t*)&ent->v)->origin, move, ((entvars_t*)&ent->v)->origin);
|
||||||
if (relink)
|
if (relink)
|
||||||
SV_LinkEdict (ent, true);
|
SV_LinkEdict (ent, true);
|
||||||
ent->v.v.flags = (int) ent->v.v.flags & ~FL_ONGROUND;
|
((entvars_t*)&ent->v)->flags = (int) ((entvars_t*)&ent->v)->flags & ~FL_ONGROUND;
|
||||||
// Con_Printf ("fall down\n");
|
// Con_Printf ("fall down\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -197,10 +199,10 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
||||||
return false; // walked off an edge
|
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.v.origin);
|
VectorCopy (trace.endpos, ((entvars_t*)&ent->v)->origin);
|
||||||
|
|
||||||
if (!SV_CheckBottom (ent)) {
|
if (!SV_CheckBottom (ent)) {
|
||||||
if ((int) ent->v.v.flags & FL_PARTIALGROUND) { // entity had floor
|
if ((int) ((entvars_t*)&ent->v)->flags & FL_PARTIALGROUND) { // entity had floor
|
||||||
// mostly pulled out
|
// mostly pulled out
|
||||||
// from underneath it
|
// from underneath it
|
||||||
// and is trying to correct
|
// and is trying to correct
|
||||||
|
@ -208,15 +210,15 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
||||||
SV_LinkEdict (ent, true);
|
SV_LinkEdict (ent, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
VectorCopy (oldorg, ent->v.v.origin);
|
VectorCopy (oldorg, ((entvars_t*)&ent->v)->origin);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((int) ent->v.v.flags & FL_PARTIALGROUND) {
|
if ((int) ((entvars_t*)&ent->v)->flags & FL_PARTIALGROUND) {
|
||||||
// Con_Printf ("back on ground\n");
|
// Con_Printf ("back on ground\n");
|
||||||
ent->v.v.flags = (int) ent->v.v.flags & ~FL_PARTIALGROUND;
|
((entvars_t*)&ent->v)->flags = (int) ((entvars_t*)&ent->v)->flags & ~FL_PARTIALGROUND;
|
||||||
}
|
}
|
||||||
ent->v.v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
|
((entvars_t*)&ent->v)->groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
|
||||||
|
|
||||||
// the move is ok
|
// the move is ok
|
||||||
if (relink)
|
if (relink)
|
||||||
|
@ -239,7 +241,7 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
|
||||||
vec3_t move, oldorigin;
|
vec3_t move, oldorigin;
|
||||||
float delta;
|
float delta;
|
||||||
|
|
||||||
ent->v.v.ideal_yaw = yaw;
|
((entvars_t*)&ent->v)->ideal_yaw = yaw;
|
||||||
PF_changeyaw (&sv_pr_state);
|
PF_changeyaw (&sv_pr_state);
|
||||||
|
|
||||||
yaw = yaw * M_PI * 2 / 360;
|
yaw = yaw * M_PI * 2 / 360;
|
||||||
|
@ -247,12 +249,12 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
|
||||||
move[1] = sin (yaw) * dist;
|
move[1] = sin (yaw) * dist;
|
||||||
move[2] = 0;
|
move[2] = 0;
|
||||||
|
|
||||||
VectorCopy (ent->v.v.origin, oldorigin);
|
VectorCopy (((entvars_t*)&ent->v)->origin, oldorigin);
|
||||||
if (SV_movestep (ent, move, false)) {
|
if (SV_movestep (ent, move, false)) {
|
||||||
delta = ent->v.v.angles[YAW] - ent->v.v.ideal_yaw;
|
delta = ((entvars_t*)&ent->v)->angles[YAW] - ((entvars_t*)&ent->v)->ideal_yaw;
|
||||||
if (delta > 45 && delta < 315) { // not turned far enough, so
|
if (delta > 45 && delta < 315) { // not turned far enough, so
|
||||||
// don't take the step
|
// don't take the step
|
||||||
VectorCopy (oldorigin, ent->v.v.origin);
|
VectorCopy (oldorigin, ((entvars_t*)&ent->v)->origin);
|
||||||
}
|
}
|
||||||
SV_LinkEdict (ent, true);
|
SV_LinkEdict (ent, true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -270,7 +272,7 @@ SV_FixCheckBottom (edict_t *ent)
|
||||||
{
|
{
|
||||||
// Con_Printf ("SV_FixCheckBottom\n");
|
// Con_Printf ("SV_FixCheckBottom\n");
|
||||||
|
|
||||||
ent->v.v.flags = (int) ent->v.v.flags | FL_PARTIALGROUND;
|
((entvars_t*)&ent->v)->flags = (int) ((entvars_t*)&ent->v)->flags | FL_PARTIALGROUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,11 +288,11 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
|
||||||
float d[3];
|
float d[3];
|
||||||
float tdir, olddir, turnaround;
|
float tdir, olddir, turnaround;
|
||||||
|
|
||||||
olddir = anglemod ((int) (actor->v.v.ideal_yaw / 45) * 45);
|
olddir = anglemod ((int) (((entvars_t*)&actor->v)->ideal_yaw / 45) * 45);
|
||||||
turnaround = anglemod (olddir - 180);
|
turnaround = anglemod (olddir - 180);
|
||||||
|
|
||||||
deltax = enemy->v.v.origin[0] - actor->v.v.origin[0];
|
deltax = ((entvars_t*)&enemy->v)->origin[0] - ((entvars_t*)&actor->v)->origin[0];
|
||||||
deltay = enemy->v.v.origin[1] - actor->v.v.origin[1];
|
deltay = ((entvars_t*)&enemy->v)->origin[1] - ((entvars_t*)&actor->v)->origin[1];
|
||||||
if (deltax > 10)
|
if (deltax > 10)
|
||||||
d[1] = 0;
|
d[1] = 0;
|
||||||
else if (deltax < -10)
|
else if (deltax < -10)
|
||||||
|
@ -346,7 +348,7 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
|
||||||
if (turnaround != DI_NODIR && SV_StepDirection (actor, turnaround, dist))
|
if (turnaround != DI_NODIR && SV_StepDirection (actor, turnaround, dist))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
actor->v.v.ideal_yaw = olddir; // can't move
|
((entvars_t*)&actor->v)->ideal_yaw = olddir; // can't move
|
||||||
|
|
||||||
// if a bridge was pulled out from underneath a monster, it may not have
|
// if a bridge was pulled out from underneath a monster, it may not have
|
||||||
// a valid standing position at all
|
// a valid standing position at all
|
||||||
|
@ -365,9 +367,9 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (goal->v.v.absmin[i] > ent->v.v.absmax[i] + dist)
|
if (((entvars_t*)&goal->v)->absmin[i] > ((entvars_t*)&ent->v)->absmax[i] + dist)
|
||||||
return false;
|
return false;
|
||||||
if (goal->v.v.absmax[i] < ent->v.v.absmin[i] - dist)
|
if (((entvars_t*)&goal->v)->absmax[i] < ((entvars_t*)&ent->v)->absmin[i] - dist)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -382,20 +384,20 @@ SV_MoveToGoal (progs_t *pr)
|
||||||
edict_t *ent, *goal;
|
edict_t *ent, *goal;
|
||||||
float dist;
|
float dist;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT (&sv_pr_state, sv_pr_state.pr_global_struct->self);
|
ent = PROG_TO_EDICT (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->self);
|
||||||
goal = PROG_TO_EDICT (&sv_pr_state, ent->v.v.goalentity);
|
goal = PROG_TO_EDICT (&sv_pr_state, ((entvars_t*)&ent->v)->goalentity);
|
||||||
dist = G_FLOAT (&sv_pr_state, OFS_PARM0);
|
dist = G_FLOAT (&sv_pr_state, OFS_PARM0);
|
||||||
|
|
||||||
if (!((int) ent->v.v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
|
if (!((int) ((entvars_t*)&ent->v)->flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
|
||||||
G_FLOAT (&sv_pr_state, OFS_RETURN) = 0;
|
G_FLOAT (&sv_pr_state, OFS_RETURN) = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// if the next step hits the enemy, return immediately
|
// if the next step hits the enemy, return immediately
|
||||||
if (PROG_TO_EDICT (&sv_pr_state, ent->v.v.enemy) != sv.edicts
|
if (PROG_TO_EDICT (&sv_pr_state, ((entvars_t*)&ent->v)->enemy) != sv.edicts
|
||||||
&& SV_CloseEnough (ent, goal, dist)) return;
|
&& SV_CloseEnough (ent, goal, dist)) return;
|
||||||
|
|
||||||
// bump around...
|
// bump around...
|
||||||
if ((rand () & 3) == 1 || !SV_StepDirection (ent, ent->v.v.ideal_yaw, dist)) {
|
if ((rand () & 3) == 1 || !SV_StepDirection (ent, ((entvars_t*)&ent->v)->ideal_yaw, dist)) {
|
||||||
SV_NewChaseDir (ent, goal, dist);
|
SV_NewChaseDir (ent, goal, dist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cvar.h"
|
#include "cvar.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
@ -86,9 +87,9 @@ SV_CheckAllEnts (void)
|
||||||
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
if (check->free)
|
if (check->free)
|
||||||
continue;
|
continue;
|
||||||
if (check->v.v.movetype == MOVETYPE_PUSH
|
if (((entvars_t*)&check->v)->movetype == MOVETYPE_PUSH
|
||||||
|| check->v.v.movetype == MOVETYPE_NONE
|
|| ((entvars_t*)&check->v)->movetype == MOVETYPE_NONE
|
||||||
|| check->v.v.movetype == MOVETYPE_NOCLIP) continue;
|
|| ((entvars_t*)&check->v)->movetype == MOVETYPE_NOCLIP) continue;
|
||||||
|
|
||||||
if (SV_TestEntityPosition (check))
|
if (SV_TestEntityPosition (check))
|
||||||
Con_Printf ("entity in invalid position\n");
|
Con_Printf ("entity in invalid position\n");
|
||||||
|
@ -108,23 +109,23 @@ SV_CheckVelocity (edict_t *ent)
|
||||||
// bound velocity
|
// bound velocity
|
||||||
//
|
//
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (IS_NAN (ent->v.v.velocity[i])) {
|
if (IS_NAN (((entvars_t*)&ent->v)->velocity[i])) {
|
||||||
Con_Printf ("Got a NaN velocity on %s\n",
|
Con_Printf ("Got a NaN velocity on %s\n",
|
||||||
PR_GetString (&sv_pr_state, ent->v.v.classname));
|
PR_GetString (&sv_pr_state, ((entvars_t*)&ent->v)->classname));
|
||||||
ent->v.v.velocity[i] = 0;
|
((entvars_t*)&ent->v)->velocity[i] = 0;
|
||||||
}
|
}
|
||||||
if (IS_NAN (ent->v.v.origin[i])) {
|
if (IS_NAN (((entvars_t*)&ent->v)->origin[i])) {
|
||||||
Con_Printf ("Got a NaN origin on %s\n",
|
Con_Printf ("Got a NaN origin on %s\n",
|
||||||
PR_GetString (&sv_pr_state, ent->v.v.classname));
|
PR_GetString (&sv_pr_state, ((entvars_t*)&ent->v)->classname));
|
||||||
ent->v.v.origin[i] = 0;
|
((entvars_t*)&ent->v)->origin[i] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1999-10-18 SV_MAXVELOCITY fix by Maddes start
|
// 1999-10-18 SV_MAXVELOCITY fix by Maddes start
|
||||||
wishspeed = Length (ent->v.v.velocity);
|
wishspeed = Length (((entvars_t*)&ent->v)->velocity);
|
||||||
if (wishspeed > sv_maxvelocity->value) {
|
if (wishspeed > sv_maxvelocity->value) {
|
||||||
VectorScale (ent->v.v.velocity, sv_maxvelocity->value / wishspeed,
|
VectorScale (((entvars_t*)&ent->v)->velocity, sv_maxvelocity->value / wishspeed,
|
||||||
ent->v.v.velocity);
|
((entvars_t*)&ent->v)->velocity);
|
||||||
}
|
}
|
||||||
// 1999-10-18 SV_MAXVELOCITY fix by Maddes end
|
// 1999-10-18 SV_MAXVELOCITY fix by Maddes end
|
||||||
}
|
}
|
||||||
|
@ -143,7 +144,7 @@ SV_RunThink (edict_t *ent)
|
||||||
float thinktime;
|
float thinktime;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
thinktime = ent->v.v.nextthink;
|
thinktime = ((entvars_t*)&ent->v)->nextthink;
|
||||||
if (thinktime <= 0)
|
if (thinktime <= 0)
|
||||||
return true;
|
return true;
|
||||||
if (thinktime > sv.time + sv_frametime)
|
if (thinktime > sv.time + sv_frametime)
|
||||||
|
@ -153,11 +154,11 @@ SV_RunThink (edict_t *ent)
|
||||||
thinktime = sv.time; // don't let things stay in the past.
|
thinktime = sv.time; // don't let things stay in the past.
|
||||||
// it is possible to start that way
|
// it is possible to start that way
|
||||||
// by a trigger with a local time.
|
// by a trigger with a local time.
|
||||||
ent->v.v.nextthink = 0;
|
((entvars_t*)&ent->v)->nextthink = 0;
|
||||||
sv_pr_state.pr_global_struct->time = thinktime;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = thinktime;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, ent);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, ent);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
||||||
PR_ExecuteProgram (&sv_pr_state, ent->v.v.think);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&ent->v)->think);
|
||||||
|
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
return false;
|
return false;
|
||||||
|
@ -176,24 +177,24 @@ SV_Impact (edict_t *e1, edict_t *e2)
|
||||||
{
|
{
|
||||||
int old_self, old_other;
|
int old_self, old_other;
|
||||||
|
|
||||||
old_self = sv_pr_state.pr_global_struct->self;
|
old_self = ((globalvars_t*)sv_pr_state.pr_globals)->self;
|
||||||
old_other = sv_pr_state.pr_global_struct->other;
|
old_other = ((globalvars_t*)sv_pr_state.pr_globals)->other;
|
||||||
|
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
if (e1->v.v.touch && e1->v.v.solid != SOLID_NOT) {
|
if (((entvars_t*)&e1->v)->touch && ((entvars_t*)&e1->v)->solid != SOLID_NOT) {
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, e1);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, e1);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, e2);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, e2);
|
||||||
PR_ExecuteProgram (&sv_pr_state, e1->v.v.touch);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&e1->v)->touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e2->v.v.touch && e2->v.v.solid != SOLID_NOT) {
|
if (((entvars_t*)&e2->v)->touch && ((entvars_t*)&e2->v)->solid != SOLID_NOT) {
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, e2);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, e2);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, e1);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, e1);
|
||||||
PR_ExecuteProgram (&sv_pr_state, e2->v.v.touch);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&e2->v)->touch);
|
||||||
}
|
}
|
||||||
|
|
||||||
sv_pr_state.pr_global_struct->self = old_self;
|
((globalvars_t*)sv_pr_state.pr_globals)->self = old_self;
|
||||||
sv_pr_state.pr_global_struct->other = old_other;
|
((globalvars_t*)sv_pr_state.pr_globals)->other = old_other;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,27 +259,27 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
|
||||||
numbumps = 4;
|
numbumps = 4;
|
||||||
|
|
||||||
blocked = 0;
|
blocked = 0;
|
||||||
VectorCopy (ent->v.v.velocity, original_velocity);
|
VectorCopy (((entvars_t*)&ent->v)->velocity, original_velocity);
|
||||||
VectorCopy (ent->v.v.velocity, primal_velocity);
|
VectorCopy (((entvars_t*)&ent->v)->velocity, primal_velocity);
|
||||||
numplanes = 0;
|
numplanes = 0;
|
||||||
|
|
||||||
time_left = time;
|
time_left = time;
|
||||||
|
|
||||||
for (bumpcount = 0; bumpcount < numbumps; bumpcount++) {
|
for (bumpcount = 0; bumpcount < numbumps; bumpcount++) {
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
end[i] = ent->v.v.origin[i] + time_left * ent->v.v.velocity[i];
|
end[i] = ((entvars_t*)&ent->v)->origin[i] + time_left * ((entvars_t*)&ent->v)->velocity[i];
|
||||||
|
|
||||||
trace =
|
trace =
|
||||||
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end, false, ent);
|
SV_Move (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, end, false, ent);
|
||||||
|
|
||||||
if (trace.allsolid) { // entity is trapped in another solid
|
if (trace.allsolid) { // entity is trapped in another solid
|
||||||
VectorCopy (vec3_origin, ent->v.v.velocity);
|
VectorCopy (vec3_origin, ((entvars_t*)&ent->v)->velocity);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trace.fraction > 0) { // actually covered some distance
|
if (trace.fraction > 0) { // actually covered some distance
|
||||||
VectorCopy (trace.endpos, ent->v.v.origin);
|
VectorCopy (trace.endpos, ((entvars_t*)&ent->v)->origin);
|
||||||
VectorCopy (ent->v.v.velocity, original_velocity);
|
VectorCopy (((entvars_t*)&ent->v)->velocity, original_velocity);
|
||||||
numplanes = 0;
|
numplanes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,10 +291,10 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
|
||||||
|
|
||||||
if (trace.plane.normal[2] > 0.7) {
|
if (trace.plane.normal[2] > 0.7) {
|
||||||
blocked |= 1; // floor
|
blocked |= 1; // floor
|
||||||
if ((trace.ent->v.v.solid == SOLID_BSP)
|
if ((((entvars_t*)&trace.ent->v)->solid == SOLID_BSP)
|
||||||
|| (trace.ent->v.v.movetype == MOVETYPE_PPUSH)) {
|
|| (((entvars_t*)&trace.ent->v)->movetype == MOVETYPE_PPUSH)) {
|
||||||
ent->v.v.flags = (int) ent->v.v.flags | FL_ONGROUND;
|
((entvars_t*)&ent->v)->flags = (int) ((entvars_t*)&ent->v)->flags | FL_ONGROUND;
|
||||||
ent->v.v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
|
((entvars_t*)&ent->v)->groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!trace.plane.normal[2]) {
|
if (!trace.plane.normal[2]) {
|
||||||
|
@ -313,7 +314,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
|
||||||
|
|
||||||
// cliped to another plane
|
// cliped to another plane
|
||||||
if (numplanes >= MAX_CLIP_PLANES) { // this shouldn't really happen
|
if (numplanes >= MAX_CLIP_PLANES) { // this shouldn't really happen
|
||||||
VectorCopy (vec3_origin, ent->v.v.velocity);
|
VectorCopy (vec3_origin, ((entvars_t*)&ent->v)->velocity);
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,24 +336,24 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i != numplanes) { // go along this plane
|
if (i != numplanes) { // go along this plane
|
||||||
VectorCopy (new_velocity, ent->v.v.velocity);
|
VectorCopy (new_velocity, ((entvars_t*)&ent->v)->velocity);
|
||||||
} else { // go along the crease
|
} else { // go along the crease
|
||||||
if (numplanes != 2) {
|
if (numplanes != 2) {
|
||||||
// Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
|
// Con_Printf ("clip velocity, numplanes == %i\n",numplanes);
|
||||||
VectorCopy (vec3_origin, ent->v.v.velocity);
|
VectorCopy (vec3_origin, ((entvars_t*)&ent->v)->velocity);
|
||||||
return 7;
|
return 7;
|
||||||
}
|
}
|
||||||
CrossProduct (planes[0], planes[1], dir);
|
CrossProduct (planes[0], planes[1], dir);
|
||||||
d = DotProduct (dir, ent->v.v.velocity);
|
d = DotProduct (dir, ((entvars_t*)&ent->v)->velocity);
|
||||||
VectorScale (dir, d, ent->v.v.velocity);
|
VectorScale (dir, d, ((entvars_t*)&ent->v)->velocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// if original velocity is against the original velocity, stop dead
|
// if original velocity is against the original velocity, stop dead
|
||||||
// to avoid tiny occilations in sloping corners
|
// to avoid tiny occilations in sloping corners
|
||||||
//
|
//
|
||||||
if (DotProduct (ent->v.v.velocity, primal_velocity) <= 0) {
|
if (DotProduct (((entvars_t*)&ent->v)->velocity, primal_velocity) <= 0) {
|
||||||
VectorCopy (vec3_origin, ent->v.v.velocity);
|
VectorCopy (vec3_origin, ((entvars_t*)&ent->v)->velocity);
|
||||||
return blocked;
|
return blocked;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -367,7 +368,7 @@ SV_FlyMove (edict_t *ent, float time, trace_t *steptrace)
|
||||||
void
|
void
|
||||||
SV_AddGravity (edict_t *ent, float scale)
|
SV_AddGravity (edict_t *ent, float scale)
|
||||||
{
|
{
|
||||||
ent->v.v.velocity[2] -= scale * movevars.gravity * sv_frametime;
|
((entvars_t*)&ent->v)->velocity[2] -= scale * movevars.gravity * sv_frametime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -385,23 +386,23 @@ SV_PushEntity (edict_t *ent, vec3_t push)
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
|
|
||||||
VectorAdd (ent->v.v.origin, push, end);
|
VectorAdd (((entvars_t*)&ent->v)->origin, push, end);
|
||||||
|
|
||||||
if (ent->v.v.movetype == MOVETYPE_FLYMISSILE)
|
if (((entvars_t*)&ent->v)->movetype == MOVETYPE_FLYMISSILE)
|
||||||
trace =
|
trace =
|
||||||
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end, MOVE_MISSILE,
|
SV_Move (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, end, MOVE_MISSILE,
|
||||||
ent);
|
ent);
|
||||||
else if (ent->v.v.solid == SOLID_TRIGGER || ent->v.v.solid == SOLID_NOT)
|
else if (((entvars_t*)&ent->v)->solid == SOLID_TRIGGER || ((entvars_t*)&ent->v)->solid == SOLID_NOT)
|
||||||
// only clip against bmodels
|
// only clip against bmodels
|
||||||
trace =
|
trace =
|
||||||
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end,
|
SV_Move (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, end,
|
||||||
MOVE_NOMONSTERS, ent);
|
MOVE_NOMONSTERS, ent);
|
||||||
else
|
else
|
||||||
trace =
|
trace =
|
||||||
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end, MOVE_NORMAL,
|
SV_Move (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, end, MOVE_NORMAL,
|
||||||
ent);
|
ent);
|
||||||
|
|
||||||
VectorCopy (trace.endpos, ent->v.v.origin);
|
VectorCopy (trace.endpos, ((entvars_t*)&ent->v)->origin);
|
||||||
SV_LinkEdict (ent, true);
|
SV_LinkEdict (ent, true);
|
||||||
|
|
||||||
if (trace.ent)
|
if (trace.ent)
|
||||||
|
@ -429,15 +430,15 @@ SV_Push (edict_t *pusher, vec3_t move)
|
||||||
// --KB
|
// --KB
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
mins[i] = pusher->v.v.absmin[i] + move[i];
|
mins[i] = ((entvars_t*)&pusher->v)->absmin[i] + move[i];
|
||||||
maxs[i] = pusher->v.v.absmax[i] + move[i];
|
maxs[i] = ((entvars_t*)&pusher->v)->absmax[i] + move[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy (pusher->v.v.origin, pushorig);
|
VectorCopy (((entvars_t*)&pusher->v)->origin, pushorig);
|
||||||
|
|
||||||
// move the pusher to it's final position
|
// move the pusher to it's final position
|
||||||
|
|
||||||
VectorAdd (pusher->v.v.origin, move, pusher->v.v.origin);
|
VectorAdd (((entvars_t*)&pusher->v)->origin, move, ((entvars_t*)&pusher->v)->origin);
|
||||||
SV_LinkEdict (pusher, false);
|
SV_LinkEdict (pusher, false);
|
||||||
|
|
||||||
// see if any solid entities are inside the final position
|
// see if any solid entities are inside the final position
|
||||||
|
@ -446,30 +447,30 @@ SV_Push (edict_t *pusher, vec3_t move)
|
||||||
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
if (check->free)
|
if (check->free)
|
||||||
continue;
|
continue;
|
||||||
if (check->v.v.movetype == MOVETYPE_PUSH
|
if (((entvars_t*)&check->v)->movetype == MOVETYPE_PUSH
|
||||||
|| check->v.v.movetype == MOVETYPE_NONE
|
|| ((entvars_t*)&check->v)->movetype == MOVETYPE_NONE
|
||||||
|| check->v.v.movetype == MOVETYPE_PPUSH
|
|| ((entvars_t*)&check->v)->movetype == MOVETYPE_PPUSH
|
||||||
|| check->v.v.movetype == MOVETYPE_NOCLIP) continue;
|
|| ((entvars_t*)&check->v)->movetype == MOVETYPE_NOCLIP) continue;
|
||||||
|
|
||||||
// Don't assume SOLID_BSP ! --KB
|
// Don't assume SOLID_BSP ! --KB
|
||||||
solid_save = pusher->v.v.solid;
|
solid_save = ((entvars_t*)&pusher->v)->solid;
|
||||||
pusher->v.v.solid = SOLID_NOT;
|
((entvars_t*)&pusher->v)->solid = SOLID_NOT;
|
||||||
block = SV_TestEntityPosition (check);
|
block = SV_TestEntityPosition (check);
|
||||||
// pusher->v.v.solid = SOLID_BSP;
|
// ((entvars_t*)&pusher->v)->solid = SOLID_BSP;
|
||||||
pusher->v.v.solid = solid_save;
|
((entvars_t*)&pusher->v)->solid = solid_save;
|
||||||
if (block)
|
if (block)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if the entity is standing on the pusher, it will definately be
|
// if the entity is standing on the pusher, it will definately be
|
||||||
// moved
|
// moved
|
||||||
if (!(((int) check->v.v.flags & FL_ONGROUND)
|
if (!(((int) ((entvars_t*)&check->v)->flags & FL_ONGROUND)
|
||||||
&& PROG_TO_EDICT (&sv_pr_state, check->v.v.groundentity) == pusher)) {
|
&& PROG_TO_EDICT (&sv_pr_state, ((entvars_t*)&check->v)->groundentity) == pusher)) {
|
||||||
if (check->v.v.absmin[0] >= maxs[0]
|
if (((entvars_t*)&check->v)->absmin[0] >= maxs[0]
|
||||||
|| check->v.v.absmin[1] >= maxs[1]
|
|| ((entvars_t*)&check->v)->absmin[1] >= maxs[1]
|
||||||
|| check->v.v.absmin[2] >= maxs[2]
|
|| ((entvars_t*)&check->v)->absmin[2] >= maxs[2]
|
||||||
|| check->v.v.absmax[0] <= mins[0]
|
|| ((entvars_t*)&check->v)->absmax[0] <= mins[0]
|
||||||
|| check->v.v.absmax[1] <= mins[1]
|
|| ((entvars_t*)&check->v)->absmax[1] <= mins[1]
|
||||||
|| check->v.v.absmax[2] <= mins[2])
|
|| ((entvars_t*)&check->v)->absmax[2] <= mins[2])
|
||||||
continue;
|
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
|
||||||
|
@ -477,49 +478,49 @@ SV_Push (edict_t *pusher, vec3_t move)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy (check->v.v.origin, moved_from[num_moved]);
|
VectorCopy (((entvars_t*)&check->v)->origin, moved_from[num_moved]);
|
||||||
moved_edict[num_moved] = check;
|
moved_edict[num_moved] = check;
|
||||||
num_moved++;
|
num_moved++;
|
||||||
|
|
||||||
// try moving the contacted entity
|
// try moving the contacted entity
|
||||||
VectorAdd (check->v.v.origin, move, check->v.v.origin);
|
VectorAdd (((entvars_t*)&check->v)->origin, move, ((entvars_t*)&check->v)->origin);
|
||||||
block = SV_TestEntityPosition (check);
|
block = SV_TestEntityPosition (check);
|
||||||
if (!block) { // pushed ok
|
if (!block) { // pushed ok
|
||||||
SV_LinkEdict (check, false);
|
SV_LinkEdict (check, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// if it is ok to leave in the old position, do it
|
// if it is ok to leave in the old position, do it
|
||||||
VectorSubtract (check->v.v.origin, move, check->v.v.origin);
|
VectorSubtract (((entvars_t*)&check->v)->origin, move, ((entvars_t*)&check->v)->origin);
|
||||||
block = SV_TestEntityPosition (check);
|
block = SV_TestEntityPosition (check);
|
||||||
if (!block) {
|
if (!block) {
|
||||||
num_moved--;
|
num_moved--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// if it is still inside the pusher, block
|
// if it is still inside the pusher, block
|
||||||
if (check->v.v.mins[0] == check->v.v.maxs[0]) {
|
if (((entvars_t*)&check->v)->mins[0] == ((entvars_t*)&check->v)->maxs[0]) {
|
||||||
SV_LinkEdict (check, false);
|
SV_LinkEdict (check, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (check->v.v.solid == SOLID_NOT || check->v.v.solid == SOLID_TRIGGER) { // corpse
|
if (((entvars_t*)&check->v)->solid == SOLID_NOT || ((entvars_t*)&check->v)->solid == SOLID_TRIGGER) { // corpse
|
||||||
check->v.v.mins[0] = check->v.v.mins[1] = 0;
|
((entvars_t*)&check->v)->mins[0] = ((entvars_t*)&check->v)->mins[1] = 0;
|
||||||
VectorCopy (check->v.v.mins, check->v.v.maxs);
|
VectorCopy (((entvars_t*)&check->v)->mins, ((entvars_t*)&check->v)->maxs);
|
||||||
SV_LinkEdict (check, false);
|
SV_LinkEdict (check, false);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy (pushorig, pusher->v.v.origin);
|
VectorCopy (pushorig, ((entvars_t*)&pusher->v)->origin);
|
||||||
SV_LinkEdict (pusher, false);
|
SV_LinkEdict (pusher, false);
|
||||||
|
|
||||||
// if the pusher has a "blocked" function, call it
|
// if the pusher has a "blocked" function, call it
|
||||||
// otherwise, just stay in place until the obstacle is gone
|
// otherwise, just stay in place until the obstacle is gone
|
||||||
if (pusher->v.v.blocked) {
|
if (((entvars_t*)&pusher->v)->blocked) {
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, pusher);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, pusher);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, check);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, check);
|
||||||
PR_ExecuteProgram (&sv_pr_state, pusher->v.v.blocked);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&pusher->v)->blocked);
|
||||||
}
|
}
|
||||||
// move back any entities we already moved
|
// move back any entities we already moved
|
||||||
for (i = 0; i < num_moved; i++) {
|
for (i = 0; i < num_moved; i++) {
|
||||||
VectorCopy (moved_from[i], moved_edict[i]->v.v.origin);
|
VectorCopy (moved_from[i], ((entvars_t*)&moved_edict[i]->v)->origin);
|
||||||
SV_LinkEdict (moved_edict[i], false);
|
SV_LinkEdict (moved_edict[i], false);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -537,17 +538,17 @@ SV_PushMove (edict_t *pusher, float movetime)
|
||||||
int i;
|
int i;
|
||||||
vec3_t move;
|
vec3_t move;
|
||||||
|
|
||||||
if (!pusher->v.v.velocity[0] && !pusher->v.v.velocity[1]
|
if (!((entvars_t*)&pusher->v)->velocity[0] && !((entvars_t*)&pusher->v)->velocity[1]
|
||||||
&& !pusher->v.v.velocity[2]) {
|
&& !((entvars_t*)&pusher->v)->velocity[2]) {
|
||||||
pusher->v.v.ltime += movetime;
|
((entvars_t*)&pusher->v)->ltime += movetime;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
move[i] = pusher->v.v.velocity[i] * movetime;
|
move[i] = ((entvars_t*)&pusher->v)->velocity[i] * movetime;
|
||||||
|
|
||||||
if (SV_Push (pusher, move))
|
if (SV_Push (pusher, move))
|
||||||
pusher->v.v.ltime += movetime;
|
((entvars_t*)&pusher->v)->ltime += movetime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -563,36 +564,36 @@ SV_Physics_Pusher (edict_t *ent)
|
||||||
vec3_t oldorg, move;
|
vec3_t oldorg, move;
|
||||||
float l;
|
float l;
|
||||||
|
|
||||||
oldltime = ent->v.v.ltime;
|
oldltime = ((entvars_t*)&ent->v)->ltime;
|
||||||
|
|
||||||
thinktime = ent->v.v.nextthink;
|
thinktime = ((entvars_t*)&ent->v)->nextthink;
|
||||||
if (thinktime < ent->v.v.ltime + sv_frametime) {
|
if (thinktime < ((entvars_t*)&ent->v)->ltime + sv_frametime) {
|
||||||
movetime = thinktime - ent->v.v.ltime;
|
movetime = thinktime - ((entvars_t*)&ent->v)->ltime;
|
||||||
if (movetime < 0)
|
if (movetime < 0)
|
||||||
movetime = 0;
|
movetime = 0;
|
||||||
} else
|
} else
|
||||||
movetime = sv_frametime;
|
movetime = sv_frametime;
|
||||||
|
|
||||||
if (movetime) {
|
if (movetime) {
|
||||||
SV_PushMove (ent, movetime); // advances ent->v.v.ltime if not
|
SV_PushMove (ent, movetime); // advances ((entvars_t*)&ent->v)->ltime if not
|
||||||
// blocked
|
// blocked
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thinktime > oldltime && thinktime <= ent->v.v.ltime) {
|
if (thinktime > oldltime && thinktime <= ((entvars_t*)&ent->v)->ltime) {
|
||||||
VectorCopy (ent->v.v.origin, oldorg);
|
VectorCopy (((entvars_t*)&ent->v)->origin, oldorg);
|
||||||
ent->v.v.nextthink = 0;
|
((entvars_t*)&ent->v)->nextthink = 0;
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, ent);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, ent);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
||||||
PR_ExecuteProgram (&sv_pr_state, ent->v.v.think);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&ent->v)->think);
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
return;
|
return;
|
||||||
VectorSubtract (ent->v.v.origin, oldorg, move);
|
VectorSubtract (((entvars_t*)&ent->v)->origin, oldorg, move);
|
||||||
|
|
||||||
l = Length (move);
|
l = Length (move);
|
||||||
if (l > 1.0 / 64) {
|
if (l > 1.0 / 64) {
|
||||||
// Con_Printf ("**** snap: %f\n", Length (l));
|
// Con_Printf ("**** snap: %f\n", Length (l));
|
||||||
VectorCopy (oldorg, ent->v.v.origin);
|
VectorCopy (oldorg, ((entvars_t*)&ent->v)->origin);
|
||||||
SV_Push (ent, move);
|
SV_Push (ent, move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,8 +625,8 @@ SV_Physics_Noclip (edict_t *ent)
|
||||||
if (!SV_RunThink (ent))
|
if (!SV_RunThink (ent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
VectorMA (ent->v.v.angles, sv_frametime, ent->v.v.avelocity, ent->v.v.angles);
|
VectorMA (((entvars_t*)&ent->v)->angles, sv_frametime, ((entvars_t*)&ent->v)->avelocity, ((entvars_t*)&ent->v)->angles);
|
||||||
VectorMA (ent->v.v.origin, sv_frametime, ent->v.v.velocity, ent->v.v.origin);
|
VectorMA (((entvars_t*)&ent->v)->origin, sv_frametime, ((entvars_t*)&ent->v)->velocity, ((entvars_t*)&ent->v)->origin);
|
||||||
|
|
||||||
SV_LinkEdict (ent, false);
|
SV_LinkEdict (ent, false);
|
||||||
}
|
}
|
||||||
|
@ -642,27 +643,27 @@ SV_CheckWaterTransition (edict_t *ent)
|
||||||
{
|
{
|
||||||
int cont;
|
int cont;
|
||||||
|
|
||||||
cont = SV_PointContents (ent->v.v.origin);
|
cont = SV_PointContents (((entvars_t*)&ent->v)->origin);
|
||||||
if (!ent->v.v.watertype) { // just spawned here
|
if (!((entvars_t*)&ent->v)->watertype) { // just spawned here
|
||||||
ent->v.v.watertype = cont;
|
((entvars_t*)&ent->v)->watertype = cont;
|
||||||
ent->v.v.waterlevel = 1;
|
((entvars_t*)&ent->v)->waterlevel = 1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cont <= CONTENTS_WATER) {
|
if (cont <= CONTENTS_WATER) {
|
||||||
if (ent->v.v.watertype == CONTENTS_EMPTY) { // just crossed into
|
if (((entvars_t*)&ent->v)->watertype == CONTENTS_EMPTY) { // just crossed into
|
||||||
// water
|
// water
|
||||||
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
|
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
|
||||||
}
|
}
|
||||||
ent->v.v.watertype = cont;
|
((entvars_t*)&ent->v)->watertype = cont;
|
||||||
ent->v.v.waterlevel = 1;
|
((entvars_t*)&ent->v)->waterlevel = 1;
|
||||||
} else {
|
} else {
|
||||||
if (ent->v.v.watertype != CONTENTS_EMPTY) { // just crossed into
|
if (((entvars_t*)&ent->v)->watertype != CONTENTS_EMPTY) { // just crossed into
|
||||||
// water
|
// water
|
||||||
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
|
SV_StartSound (ent, 0, "misc/h2ohit1.wav", 255, 1);
|
||||||
}
|
}
|
||||||
ent->v.v.watertype = CONTENTS_EMPTY;
|
((entvars_t*)&ent->v)->watertype = CONTENTS_EMPTY;
|
||||||
ent->v.v.waterlevel = cont;
|
((entvars_t*)&ent->v)->waterlevel = cont;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,45 +683,45 @@ SV_Physics_Toss (edict_t *ent)
|
||||||
if (!SV_RunThink (ent))
|
if (!SV_RunThink (ent))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ent->v.v.velocity[2] > 0)
|
if (((entvars_t*)&ent->v)->velocity[2] > 0)
|
||||||
ent->v.v.flags = (int) ent->v.v.flags & ~FL_ONGROUND;
|
((entvars_t*)&ent->v)->flags = (int) ((entvars_t*)&ent->v)->flags & ~FL_ONGROUND;
|
||||||
|
|
||||||
// if onground, return without moving
|
// if onground, return without moving
|
||||||
if (((int) ent->v.v.flags & FL_ONGROUND))
|
if (((int) ((entvars_t*)&ent->v)->flags & FL_ONGROUND))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SV_CheckVelocity (ent);
|
SV_CheckVelocity (ent);
|
||||||
|
|
||||||
// add gravity
|
// add gravity
|
||||||
if (ent->v.v.movetype != MOVETYPE_FLY
|
if (((entvars_t*)&ent->v)->movetype != MOVETYPE_FLY
|
||||||
&& ent->v.v.movetype != MOVETYPE_FLYMISSILE) SV_AddGravity (ent, 1.0);
|
&& ((entvars_t*)&ent->v)->movetype != MOVETYPE_FLYMISSILE) SV_AddGravity (ent, 1.0);
|
||||||
|
|
||||||
// move angles
|
// move angles
|
||||||
VectorMA (ent->v.v.angles, sv_frametime, ent->v.v.avelocity, ent->v.v.angles);
|
VectorMA (((entvars_t*)&ent->v)->angles, sv_frametime, ((entvars_t*)&ent->v)->avelocity, ((entvars_t*)&ent->v)->angles);
|
||||||
|
|
||||||
// move origin
|
// move origin
|
||||||
VectorScale (ent->v.v.velocity, sv_frametime, move);
|
VectorScale (((entvars_t*)&ent->v)->velocity, sv_frametime, move);
|
||||||
trace = SV_PushEntity (ent, move);
|
trace = SV_PushEntity (ent, move);
|
||||||
if (trace.fraction == 1)
|
if (trace.fraction == 1)
|
||||||
return;
|
return;
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ent->v.v.movetype == MOVETYPE_BOUNCE)
|
if (((entvars_t*)&ent->v)->movetype == MOVETYPE_BOUNCE)
|
||||||
backoff = 1.5;
|
backoff = 1.5;
|
||||||
else
|
else
|
||||||
backoff = 1;
|
backoff = 1;
|
||||||
|
|
||||||
ClipVelocity (ent->v.v.velocity, trace.plane.normal, ent->v.v.velocity,
|
ClipVelocity (((entvars_t*)&ent->v)->velocity, trace.plane.normal, ((entvars_t*)&ent->v)->velocity,
|
||||||
backoff);
|
backoff);
|
||||||
|
|
||||||
// stop if on ground
|
// stop if on ground
|
||||||
if (trace.plane.normal[2] > 0.7) {
|
if (trace.plane.normal[2] > 0.7) {
|
||||||
if (ent->v.v.velocity[2] < 60 || ent->v.v.movetype != MOVETYPE_BOUNCE) {
|
if (((entvars_t*)&ent->v)->velocity[2] < 60 || ((entvars_t*)&ent->v)->movetype != MOVETYPE_BOUNCE) {
|
||||||
ent->v.v.flags = (int) ent->v.v.flags | FL_ONGROUND;
|
((entvars_t*)&ent->v)->flags = (int) ((entvars_t*)&ent->v)->flags | FL_ONGROUND;
|
||||||
ent->v.v.groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
|
((entvars_t*)&ent->v)->groundentity = EDICT_TO_PROG (&sv_pr_state, trace.ent);
|
||||||
VectorCopy (vec3_origin, ent->v.v.velocity);
|
VectorCopy (vec3_origin, ((entvars_t*)&ent->v)->velocity);
|
||||||
VectorCopy (vec3_origin, ent->v.v.avelocity);
|
VectorCopy (vec3_origin, ((entvars_t*)&ent->v)->avelocity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check for in water
|
// check for in water
|
||||||
|
@ -747,8 +748,8 @@ SV_Physics_Step (edict_t *ent)
|
||||||
qboolean hitsound;
|
qboolean hitsound;
|
||||||
|
|
||||||
// freefall if not on ground
|
// freefall if not on ground
|
||||||
if (!((int) ent->v.v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
|
if (!((int) ((entvars_t*)&ent->v)->flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
|
||||||
if (ent->v.v.velocity[2] < movevars.gravity * -0.1)
|
if (((entvars_t*)&ent->v)->velocity[2] < movevars.gravity * -0.1)
|
||||||
hitsound = true;
|
hitsound = true;
|
||||||
else
|
else
|
||||||
hitsound = false;
|
hitsound = false;
|
||||||
|
@ -758,7 +759,7 @@ SV_Physics_Step (edict_t *ent)
|
||||||
SV_FlyMove (ent, sv_frametime, NULL);
|
SV_FlyMove (ent, sv_frametime, NULL);
|
||||||
SV_LinkEdict (ent, true);
|
SV_LinkEdict (ent, true);
|
||||||
|
|
||||||
if ((int) ent->v.v.flags & FL_ONGROUND) // just hit ground
|
if ((int) ((entvars_t*)&ent->v)->flags & FL_ONGROUND) // just hit ground
|
||||||
{
|
{
|
||||||
if (hitsound)
|
if (hitsound)
|
||||||
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
|
SV_StartSound (ent, 0, "demon/dland2.wav", 255, 1);
|
||||||
|
@ -781,27 +782,27 @@ SV_PPushMove (edict_t *pusher, float movetime) // player push
|
||||||
|
|
||||||
SV_CheckVelocity (pusher);
|
SV_CheckVelocity (pusher);
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
move[i] = pusher->v.v.velocity[i] * movetime;
|
move[i] = ((entvars_t*)&pusher->v)->velocity[i] * movetime;
|
||||||
mins[i] = pusher->v.v.absmin[i] + move[i];
|
mins[i] = ((entvars_t*)&pusher->v)->absmin[i] + move[i];
|
||||||
maxs[i] = pusher->v.v.absmax[i] + move[i];
|
maxs[i] = ((entvars_t*)&pusher->v)->absmax[i] + move[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy (pusher->v.v.origin, pusher->v.v.oldorigin); // Backup origin
|
VectorCopy (((entvars_t*)&pusher->v)->origin, ((entvars_t*)&pusher->v)->oldorigin); // Backup origin
|
||||||
trace =
|
trace =
|
||||||
SV_Move (pusher->v.v.origin, pusher->v.v.mins, pusher->v.v.maxs, move,
|
SV_Move (((entvars_t*)&pusher->v)->origin, ((entvars_t*)&pusher->v)->mins, ((entvars_t*)&pusher->v)->maxs, move,
|
||||||
MOVE_NOMONSTERS, pusher);
|
MOVE_NOMONSTERS, pusher);
|
||||||
|
|
||||||
if (trace.fraction == 1) {
|
if (trace.fraction == 1) {
|
||||||
VectorCopy (pusher->v.v.origin, pusher->v.v.oldorigin); // Revert
|
VectorCopy (((entvars_t*)&pusher->v)->origin, ((entvars_t*)&pusher->v)->oldorigin); // Revert
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VectorAdd (pusher->v.v.origin, move, pusher->v.v.origin); // Move
|
VectorAdd (((entvars_t*)&pusher->v)->origin, move, ((entvars_t*)&pusher->v)->origin); // Move
|
||||||
SV_LinkEdict (pusher, false);
|
SV_LinkEdict (pusher, false);
|
||||||
pusher->v.v.ltime += movetime;
|
((entvars_t*)&pusher->v)->ltime += movetime;
|
||||||
|
|
||||||
oldsolid = pusher->v.v.solid;
|
oldsolid = ((entvars_t*)&pusher->v)->solid;
|
||||||
|
|
||||||
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||||
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
|
@ -813,25 +814,25 @@ SV_PPushMove (edict_t *pusher, float movetime) // player push
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Stage 2: Is it a player we can push?
|
// Stage 2: Is it a player we can push?
|
||||||
if (check->v.v.movetype == MOVETYPE_WALK) {
|
if (((entvars_t*)&check->v)->movetype == MOVETYPE_WALK) {
|
||||||
Con_Printf ("Pusher encountered a player\n"); // Yes!@#!@
|
Con_Printf ("Pusher encountered a player\n"); // Yes!@#!@
|
||||||
pusher->v.v.solid = SOLID_NOT;
|
((entvars_t*)&pusher->v)->solid = SOLID_NOT;
|
||||||
SV_PushEntity (check, move);
|
SV_PushEntity (check, move);
|
||||||
pusher->v.v.solid = oldsolid;
|
((entvars_t*)&pusher->v)->solid = oldsolid;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Stage 3: No.. Is it something that blocks us?
|
// Stage 3: No.. Is it something that blocks us?
|
||||||
if (check->v.v.mins[0] == check->v.v.maxs[0])
|
if (((entvars_t*)&check->v)->mins[0] == ((entvars_t*)&check->v)->maxs[0])
|
||||||
continue;
|
continue;
|
||||||
if (check->v.v.solid == SOLID_NOT || check->v.v.solid == SOLID_TRIGGER)
|
if (((entvars_t*)&check->v)->solid == SOLID_NOT || ((entvars_t*)&check->v)->solid == SOLID_TRIGGER)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Stage 4: Yes, it must be. Fail the move.
|
// Stage 4: Yes, it must be. Fail the move.
|
||||||
VectorCopy (pusher->v.v.origin, pusher->v.v.oldorigin); // Revert
|
VectorCopy (((entvars_t*)&pusher->v)->origin, ((entvars_t*)&pusher->v)->oldorigin); // Revert
|
||||||
if (pusher->v.v.blocked) { // Blocked func?
|
if (((entvars_t*)&pusher->v)->blocked) { // Blocked func?
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, pusher);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, pusher);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, check);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, check);
|
||||||
PR_ExecuteProgram (&sv_pr_state, pusher->v.v.blocked);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&pusher->v)->blocked);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -847,11 +848,11 @@ SV_Physics_PPusher (edict_t *ent)
|
||||||
|
|
||||||
// float l;
|
// float l;
|
||||||
|
|
||||||
oldltime = ent->v.v.ltime;
|
oldltime = ((entvars_t*)&ent->v)->ltime;
|
||||||
|
|
||||||
thinktime = ent->v.v.nextthink;
|
thinktime = ((entvars_t*)&ent->v)->nextthink;
|
||||||
if (thinktime < ent->v.v.ltime + sv_frametime) {
|
if (thinktime < ((entvars_t*)&ent->v)->ltime + sv_frametime) {
|
||||||
movetime = thinktime - ent->v.v.ltime;
|
movetime = thinktime - ((entvars_t*)&ent->v)->ltime;
|
||||||
if (movetime < 0)
|
if (movetime < 0)
|
||||||
movetime = 0;
|
movetime = 0;
|
||||||
} else
|
} else
|
||||||
|
@ -859,16 +860,16 @@ SV_Physics_PPusher (edict_t *ent)
|
||||||
|
|
||||||
// if (movetime)
|
// if (movetime)
|
||||||
// {
|
// {
|
||||||
SV_PPushMove (ent, 0.0009); // advances ent->v.v.ltime if not
|
SV_PPushMove (ent, 0.0009); // advances ((entvars_t*)&ent->v)->ltime if not
|
||||||
// blocked
|
// blocked
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if (thinktime > oldltime && thinktime <= ent->v.v.ltime) {
|
if (thinktime > oldltime && thinktime <= ((entvars_t*)&ent->v)->ltime) {
|
||||||
ent->v.v.nextthink = 0;
|
((entvars_t*)&ent->v)->nextthink = 0;
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, ent);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, ent);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
||||||
PR_ExecuteProgram (&sv_pr_state, ent->v.v.think);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&ent->v)->think);
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -880,10 +881,10 @@ void
|
||||||
SV_ProgStartFrame (void)
|
SV_ProgStartFrame (void)
|
||||||
{
|
{
|
||||||
// let the progs know that a new frame has started
|
// let the progs know that a new frame has started
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
PR_ExecuteProgram (&sv_pr_state, sv_pr_state.pr_global_struct->StartFrame);
|
PR_ExecuteProgram (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->StartFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -892,11 +893,11 @@ SV_ProgStartFrame (void)
|
||||||
void
|
void
|
||||||
SV_RunEntity (edict_t *ent)
|
SV_RunEntity (edict_t *ent)
|
||||||
{
|
{
|
||||||
if (ent->v.v.lastruntime == (float) realtime)
|
if (((entvars_t*)&ent->v)->lastruntime == (float) realtime)
|
||||||
return;
|
return;
|
||||||
ent->v.v.lastruntime = (float) realtime;
|
((entvars_t*)&ent->v)->lastruntime = (float) realtime;
|
||||||
|
|
||||||
switch ((int) ent->v.v.movetype) {
|
switch ((int) ((entvars_t*)&ent->v)->movetype) {
|
||||||
case MOVETYPE_PUSH:
|
case MOVETYPE_PUSH:
|
||||||
SV_Physics_Pusher (ent);
|
SV_Physics_Pusher (ent);
|
||||||
break;
|
break;
|
||||||
|
@ -919,7 +920,7 @@ SV_RunEntity (edict_t *ent)
|
||||||
SV_Physics_Toss (ent);
|
SV_Physics_Toss (ent);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SV_Error ("SV_Physics: bad movetype %i", (int) ent->v.v.movetype);
|
SV_Error ("SV_Physics: bad movetype %i", (int) ((entvars_t*)&ent->v)->movetype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -931,11 +932,11 @@ SV_RunNewmis (void)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
if (!sv_pr_state.pr_global_struct->newmis)
|
if (!((globalvars_t*)sv_pr_state.pr_globals)->newmis)
|
||||||
return;
|
return;
|
||||||
ent = PROG_TO_EDICT (&sv_pr_state, sv_pr_state.pr_global_struct->newmis);
|
ent = PROG_TO_EDICT (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->newmis);
|
||||||
sv_frametime = 0.05;
|
sv_frametime = 0.05;
|
||||||
sv_pr_state.pr_global_struct->newmis = 0;
|
((globalvars_t*)sv_pr_state.pr_globals)->newmis = 0;
|
||||||
|
|
||||||
SV_RunEntity (ent);
|
SV_RunEntity (ent);
|
||||||
}
|
}
|
||||||
|
@ -958,7 +959,7 @@ SV_Physics (void)
|
||||||
sv_frametime = sv_maxtic->value;
|
sv_frametime = sv_maxtic->value;
|
||||||
old_time = realtime;
|
old_time = realtime;
|
||||||
|
|
||||||
sv_pr_state.pr_global_struct->frametime = sv_frametime;
|
((globalvars_t*)sv_pr_state.pr_globals)->frametime = sv_frametime;
|
||||||
|
|
||||||
SV_ProgStartFrame ();
|
SV_ProgStartFrame ();
|
||||||
|
|
||||||
|
@ -971,7 +972,7 @@ SV_Physics (void)
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sv_pr_state.pr_global_struct->force_retouch)
|
if (((globalvars_t*)sv_pr_state.pr_globals)->force_retouch)
|
||||||
SV_LinkEdict (ent, true); // force retouch even for stationary
|
SV_LinkEdict (ent, true); // force retouch even for stationary
|
||||||
|
|
||||||
if (i > 0 && i <= MAX_CLIENTS)
|
if (i > 0 && i <= MAX_CLIENTS)
|
||||||
|
@ -982,15 +983,15 @@ SV_Physics (void)
|
||||||
SV_RunNewmis ();
|
SV_RunNewmis ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sv_pr_state.pr_global_struct->force_retouch)
|
if (((globalvars_t*)sv_pr_state.pr_globals)->force_retouch)
|
||||||
sv_pr_state.pr_global_struct->force_retouch--;
|
((globalvars_t*)sv_pr_state.pr_globals)->force_retouch--;
|
||||||
|
|
||||||
// 2000-01-02 EndFrame function by Maddes/FrikaC start
|
// 2000-01-02 EndFrame function by Maddes/FrikaC start
|
||||||
if (EndFrame) {
|
if (EndFrame) {
|
||||||
// let the progs know that the frame has ended
|
// let the progs know that the frame has ended
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, sv.edicts);
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
PR_ExecuteProgram (&sv_pr_state, EndFrame);
|
PR_ExecuteProgram (&sv_pr_state, EndFrame);
|
||||||
}
|
}
|
||||||
// 2000-01-02 EndFrame function by Maddes/FrikaC end
|
// 2000-01-02 EndFrame function by Maddes/FrikaC end
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "sv_pr_cmds.h"
|
#include "sv_pr_cmds.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "va.h"
|
#include "va.h"
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ PF_error (progs_t *pr)
|
||||||
s = PF_VarString (pr, 0);
|
s = PF_VarString (pr, 0);
|
||||||
Con_Printf ("======SERVER ERROR in %s:\n%s\n",
|
Con_Printf ("======SERVER ERROR in %s:\n%s\n",
|
||||||
PR_GetString (pr, pr->pr_xfunction->s_name), s);
|
PR_GetString (pr, pr->pr_xfunction->s_name), s);
|
||||||
ed = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
|
ed = PROG_TO_EDICT (pr, ((globalvars_t*)pr->pr_globals)->self);
|
||||||
ED_Print (pr, ed);
|
ED_Print (pr, ed);
|
||||||
|
|
||||||
SV_Error ("Program error");
|
SV_Error ("Program error");
|
||||||
|
@ -102,7 +103,7 @@ PF_objerror (progs_t *pr)
|
||||||
s = PF_VarString (pr, 0);
|
s = PF_VarString (pr, 0);
|
||||||
Con_Printf ("======OBJECT ERROR in %s:\n%s\n",
|
Con_Printf ("======OBJECT ERROR in %s:\n%s\n",
|
||||||
PR_GetString (pr, pr->pr_xfunction->s_name), s);
|
PR_GetString (pr, pr->pr_xfunction->s_name), s);
|
||||||
ed = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
|
ed = PROG_TO_EDICT (pr, ((globalvars_t*)pr->pr_globals)->self);
|
||||||
ED_Print (pr, ed);
|
ED_Print (pr, ed);
|
||||||
ED_Free (pr, ed);
|
ED_Free (pr, ed);
|
||||||
|
|
||||||
|
@ -120,8 +121,8 @@ PF_objerror (progs_t *pr)
|
||||||
void
|
void
|
||||||
PF_makevectors (progs_t *pr)
|
PF_makevectors (progs_t *pr)
|
||||||
{
|
{
|
||||||
AngleVectors (G_VECTOR (pr, OFS_PARM0), pr->pr_global_struct->v_forward,
|
AngleVectors (G_VECTOR (pr, OFS_PARM0), ((globalvars_t*)pr->pr_globals)->v_forward,
|
||||||
pr->pr_global_struct->v_right, pr->pr_global_struct->v_up);
|
((globalvars_t*)pr->pr_globals)->v_right, ((globalvars_t*)pr->pr_globals)->v_up);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -139,7 +140,7 @@ PF_setorigin (progs_t *pr)
|
||||||
|
|
||||||
e = G_EDICT (pr, OFS_PARM0);
|
e = G_EDICT (pr, OFS_PARM0);
|
||||||
org = G_VECTOR (pr, OFS_PARM1);
|
org = G_VECTOR (pr, OFS_PARM1);
|
||||||
VectorCopy (org, e->v.v.origin);
|
VectorCopy (org, ((entvars_t*)&e->v)->origin);
|
||||||
SV_LinkEdict (e, false);
|
SV_LinkEdict (e, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,9 +161,9 @@ PF_setsize (progs_t *pr)
|
||||||
e = G_EDICT (pr, OFS_PARM0);
|
e = G_EDICT (pr, OFS_PARM0);
|
||||||
min = G_VECTOR (pr, OFS_PARM1);
|
min = G_VECTOR (pr, OFS_PARM1);
|
||||||
max = G_VECTOR (pr, OFS_PARM2);
|
max = G_VECTOR (pr, OFS_PARM2);
|
||||||
VectorCopy (min, e->v.v.mins);
|
VectorCopy (min, ((entvars_t*)&e->v)->mins);
|
||||||
VectorCopy (max, e->v.v.maxs);
|
VectorCopy (max, ((entvars_t*)&e->v)->maxs);
|
||||||
VectorSubtract (max, min, e->v.v.size);
|
VectorSubtract (max, min, ((entvars_t*)&e->v)->size);
|
||||||
SV_LinkEdict (e, false);
|
SV_LinkEdict (e, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,15 +193,15 @@ PF_setmodel (progs_t *pr)
|
||||||
if (!*check)
|
if (!*check)
|
||||||
PR_RunError (pr, "no precache: %s\n", m);
|
PR_RunError (pr, "no precache: %s\n", m);
|
||||||
|
|
||||||
e->v.v.model = PR_SetString (pr, m);
|
((entvars_t*)&e->v)->model = PR_SetString (pr, m);
|
||||||
e->v.v.modelindex = i;
|
((entvars_t*)&e->v)->modelindex = i;
|
||||||
|
|
||||||
// if it is an inline model, get the size information for it
|
// if it is an inline model, get the size information for it
|
||||||
if (m[0] == '*') {
|
if (m[0] == '*') {
|
||||||
mod = Mod_ForName (m, true);
|
mod = Mod_ForName (m, true);
|
||||||
VectorCopy (mod->mins, e->v.v.mins);
|
VectorCopy (mod->mins, ((entvars_t*)&e->v)->mins);
|
||||||
VectorCopy (mod->maxs, e->v.v.maxs);
|
VectorCopy (mod->maxs, ((entvars_t*)&e->v)->maxs);
|
||||||
VectorSubtract (mod->maxs, mod->mins, e->v.v.size);
|
VectorSubtract (mod->maxs, mod->mins, ((entvars_t*)&e->v)->size);
|
||||||
SV_LinkEdict (e, false);
|
SV_LinkEdict (e, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,18 +519,18 @@ PF_traceline (progs_t *pr)
|
||||||
|
|
||||||
trace = SV_Move (v1, vec3_origin, vec3_origin, v2, nomonsters, ent);
|
trace = SV_Move (v1, vec3_origin, vec3_origin, v2, nomonsters, ent);
|
||||||
|
|
||||||
pr->pr_global_struct->trace_allsolid = trace.allsolid;
|
((globalvars_t*)pr->pr_globals)->trace_allsolid = trace.allsolid;
|
||||||
pr->pr_global_struct->trace_startsolid = trace.startsolid;
|
((globalvars_t*)pr->pr_globals)->trace_startsolid = trace.startsolid;
|
||||||
pr->pr_global_struct->trace_fraction = trace.fraction;
|
((globalvars_t*)pr->pr_globals)->trace_fraction = trace.fraction;
|
||||||
pr->pr_global_struct->trace_inwater = trace.inwater;
|
((globalvars_t*)pr->pr_globals)->trace_inwater = trace.inwater;
|
||||||
pr->pr_global_struct->trace_inopen = trace.inopen;
|
((globalvars_t*)pr->pr_globals)->trace_inopen = trace.inopen;
|
||||||
VectorCopy (trace.endpos, pr->pr_global_struct->trace_endpos);
|
VectorCopy (trace.endpos, ((globalvars_t*)pr->pr_globals)->trace_endpos);
|
||||||
VectorCopy (trace.plane.normal, pr->pr_global_struct->trace_plane_normal);
|
VectorCopy (trace.plane.normal, ((globalvars_t*)pr->pr_globals)->trace_plane_normal);
|
||||||
pr->pr_global_struct->trace_plane_dist = trace.plane.dist;
|
((globalvars_t*)pr->pr_globals)->trace_plane_dist = trace.plane.dist;
|
||||||
if (trace.ent)
|
if (trace.ent)
|
||||||
pr->pr_global_struct->trace_ent = EDICT_TO_PROG (pr, trace.ent);
|
((globalvars_t*)pr->pr_globals)->trace_ent = EDICT_TO_PROG (pr, trace.ent);
|
||||||
else
|
else
|
||||||
pr->pr_global_struct->trace_ent = EDICT_TO_PROG (pr, sv.edicts);
|
((globalvars_t*)pr->pr_globals)->trace_ent = EDICT_TO_PROG (pr, sv.edicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -581,9 +582,9 @@ PF_newcheckclient (progs_t *pr, int check)
|
||||||
|
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
continue;
|
continue;
|
||||||
if (ent->v.v.health <= 0)
|
if (((entvars_t*)&ent->v)->health <= 0)
|
||||||
continue;
|
continue;
|
||||||
if ((int) ent->v.v.flags & FL_NOTARGET)
|
if ((int) ((entvars_t*)&ent->v)->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
|
||||||
|
@ -591,7 +592,7 @@ PF_newcheckclient (progs_t *pr, int check)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the PVS for the entity
|
// get the PVS for the entity
|
||||||
VectorAdd (ent->v.v.origin, ent->v.v.view_ofs, org);
|
VectorAdd (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->view_ofs, org);
|
||||||
leaf = Mod_PointInLeaf (org, sv.worldmodel);
|
leaf = Mod_PointInLeaf (org, sv.worldmodel);
|
||||||
pvs = Mod_LeafPVS (leaf, sv.worldmodel);
|
pvs = Mod_LeafPVS (leaf, sv.worldmodel);
|
||||||
memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3);
|
memcpy (checkpvs, pvs, (sv.worldmodel->numleafs + 7) >> 3);
|
||||||
|
@ -629,13 +630,13 @@ PF_checkclient (progs_t *pr)
|
||||||
}
|
}
|
||||||
// return check if it might be visible
|
// return check if it might be visible
|
||||||
ent = EDICT_NUM (pr, sv.lastcheck);
|
ent = EDICT_NUM (pr, sv.lastcheck);
|
||||||
if (ent->free || ent->v.v.health <= 0) {
|
if (ent->free || ((entvars_t*)&ent->v)->health <= 0) {
|
||||||
RETURN_EDICT (pr, sv.edicts);
|
RETURN_EDICT (pr, sv.edicts);
|
||||||
return;
|
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, pr->pr_global_struct->self);
|
self = PROG_TO_EDICT (pr, ((globalvars_t*)pr->pr_globals)->self);
|
||||||
VectorAdd (self->v.v.origin, self->v.v.view_ofs, view);
|
VectorAdd (((entvars_t*)&self->v)->origin, ((entvars_t*)&self->v)->view_ofs, view);
|
||||||
leaf = Mod_PointInLeaf (view, sv.worldmodel);
|
leaf = Mod_PointInLeaf (view, sv.worldmodel);
|
||||||
l = (leaf - sv.worldmodel->leafs) - 1;
|
l = (leaf - sv.worldmodel->leafs) - 1;
|
||||||
if ((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7)))) {
|
if ((l < 0) || !(checkpvs[l >> 3] & (1 << (l & 7)))) {
|
||||||
|
@ -779,16 +780,16 @@ PF_findradius (progs_t *pr)
|
||||||
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)) {
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
continue;
|
continue;
|
||||||
if (ent->v.v.solid == SOLID_NOT)
|
if (((entvars_t*)&ent->v)->solid == SOLID_NOT)
|
||||||
continue;
|
continue;
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
eorg[j] =
|
eorg[j] =
|
||||||
org[j] - (ent->v.v.origin[j] +
|
org[j] - (((entvars_t*)&ent->v)->origin[j] +
|
||||||
(ent->v.v.mins[j] + ent->v.v.maxs[j]) * 0.5);
|
(((entvars_t*)&ent->v)->mins[j] + ((entvars_t*)&ent->v)->maxs[j]) * 0.5);
|
||||||
if (Length (eorg) > rad)
|
if (Length (eorg) > rad)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ent->v.v.chain = EDICT_TO_PROG (pr, chain);
|
((entvars_t*)&ent->v)->chain = EDICT_TO_PROG (pr, chain);
|
||||||
chain = ent;
|
chain = ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1002,11 +1003,11 @@ PF_walkmove (progs_t *pr)
|
||||||
dfunction_t *oldf;
|
dfunction_t *oldf;
|
||||||
int oldself;
|
int oldself;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
|
ent = PROG_TO_EDICT (pr, ((globalvars_t*)pr->pr_globals)->self);
|
||||||
yaw = G_FLOAT (pr, OFS_PARM0);
|
yaw = G_FLOAT (pr, OFS_PARM0);
|
||||||
dist = G_FLOAT (pr, OFS_PARM1);
|
dist = G_FLOAT (pr, OFS_PARM1);
|
||||||
|
|
||||||
if (!((int) ent->v.v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
|
if (!((int) ((entvars_t*)&ent->v)->flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) {
|
||||||
G_FLOAT (pr, OFS_RETURN) = 0;
|
G_FLOAT (pr, OFS_RETURN) = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1019,14 +1020,14 @@ PF_walkmove (progs_t *pr)
|
||||||
|
|
||||||
// save program state, because SV_movestep may call other progs
|
// save program state, because SV_movestep may call other progs
|
||||||
oldf = pr->pr_xfunction;
|
oldf = pr->pr_xfunction;
|
||||||
oldself = pr->pr_global_struct->self;
|
oldself = ((globalvars_t*)pr->pr_globals)->self;
|
||||||
|
|
||||||
G_FLOAT (pr, OFS_RETURN) = SV_movestep (ent, move, true);
|
G_FLOAT (pr, OFS_RETURN) = SV_movestep (ent, move, true);
|
||||||
|
|
||||||
|
|
||||||
// restore program state
|
// restore program state
|
||||||
pr->pr_xfunction = oldf;
|
pr->pr_xfunction = oldf;
|
||||||
pr->pr_global_struct->self = oldself;
|
((globalvars_t*)pr->pr_globals)->self = oldself;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1041,20 +1042,20 @@ PF_droptofloor (progs_t *pr)
|
||||||
vec3_t end;
|
vec3_t end;
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
|
ent = PROG_TO_EDICT (pr, ((globalvars_t*)pr->pr_globals)->self);
|
||||||
|
|
||||||
VectorCopy (ent->v.v.origin, end);
|
VectorCopy (((entvars_t*)&ent->v)->origin, end);
|
||||||
end[2] -= 256;
|
end[2] -= 256;
|
||||||
|
|
||||||
trace = SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, end, false, ent);
|
trace = SV_Move (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, end, false, ent);
|
||||||
|
|
||||||
if (trace.fraction == 1 || trace.allsolid)
|
if (trace.fraction == 1 || trace.allsolid)
|
||||||
G_FLOAT (pr, OFS_RETURN) = 0;
|
G_FLOAT (pr, OFS_RETURN) = 0;
|
||||||
else {
|
else {
|
||||||
VectorCopy (trace.endpos, ent->v.v.origin);
|
VectorCopy (trace.endpos, ((entvars_t*)&ent->v)->origin);
|
||||||
SV_LinkEdict (ent, false);
|
SV_LinkEdict (ent, false);
|
||||||
ent->v.v.flags = (int) ent->v.v.flags | FL_ONGROUND;
|
((entvars_t*)&ent->v)->flags = (int) ((entvars_t*)&ent->v)->flags | FL_ONGROUND;
|
||||||
ent->v.v.groundentity = EDICT_TO_PROG (pr, trace.ent);
|
((entvars_t*)&ent->v)->groundentity = EDICT_TO_PROG (pr, trace.ent);
|
||||||
G_FLOAT (pr, OFS_RETURN) = 1;
|
G_FLOAT (pr, OFS_RETURN) = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1189,7 +1190,7 @@ PF_aim (progs_t *pr)
|
||||||
ent = G_EDICT (pr, OFS_PARM0);
|
ent = G_EDICT (pr, OFS_PARM0);
|
||||||
speed = G_FLOAT (pr, OFS_PARM1);
|
speed = G_FLOAT (pr, OFS_PARM1);
|
||||||
|
|
||||||
VectorCopy (ent->v.v.origin, start);
|
VectorCopy (((entvars_t*)&ent->v)->origin, start);
|
||||||
start[2] += 20;
|
start[2] += 20;
|
||||||
|
|
||||||
// noaim option
|
// noaim option
|
||||||
|
@ -1197,18 +1198,18 @@ PF_aim (progs_t *pr)
|
||||||
if (i > 0 && i < MAX_CLIENTS) {
|
if (i > 0 && i < MAX_CLIENTS) {
|
||||||
noaim = Info_ValueForKey (svs.clients[i - 1].userinfo, "noaim");
|
noaim = Info_ValueForKey (svs.clients[i - 1].userinfo, "noaim");
|
||||||
if (atoi (noaim) > 0) {
|
if (atoi (noaim) > 0) {
|
||||||
VectorCopy (pr->pr_global_struct->v_forward, G_VECTOR (pr, OFS_RETURN));
|
VectorCopy (((globalvars_t*)pr->pr_globals)->v_forward, G_VECTOR (pr, OFS_RETURN));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// try sending a trace straight
|
// try sending a trace straight
|
||||||
VectorCopy (pr->pr_global_struct->v_forward, dir);
|
VectorCopy (((globalvars_t*)pr->pr_globals)->v_forward, dir);
|
||||||
VectorMA (start, 2048, dir, end);
|
VectorMA (start, 2048, dir, end);
|
||||||
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
|
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
|
||||||
if (tr.ent && tr.ent->v.v.takedamage == DAMAGE_AIM
|
if (tr.ent && ((entvars_t*)&tr.ent->v)->takedamage == DAMAGE_AIM
|
||||||
&& (!teamplay->int_val || ent->v.v.team <= 0
|
&& (!teamplay->int_val || ((entvars_t*)&ent->v)->team <= 0
|
||||||
|| ent->v.v.team != tr.ent->v.v.team)) {
|
|| ((entvars_t*)&ent->v)->team != ((entvars_t*)&tr.ent->v)->team)) {
|
||||||
VectorCopy (pr->pr_global_struct->v_forward, G_VECTOR (pr, OFS_RETURN));
|
VectorCopy (((globalvars_t*)pr->pr_globals)->v_forward, G_VECTOR (pr, OFS_RETURN));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1219,19 +1220,19 @@ PF_aim (progs_t *pr)
|
||||||
|
|
||||||
check = NEXT_EDICT (pr, sv.edicts);
|
check = NEXT_EDICT (pr, sv.edicts);
|
||||||
for (i = 1; i < sv.num_edicts; i++, check = NEXT_EDICT (pr, check)) {
|
for (i = 1; i < sv.num_edicts; i++, check = NEXT_EDICT (pr, check)) {
|
||||||
if (check->v.v.takedamage != DAMAGE_AIM)
|
if (((entvars_t*)&check->v)->takedamage != DAMAGE_AIM)
|
||||||
continue;
|
continue;
|
||||||
if (check == ent)
|
if (check == ent)
|
||||||
continue;
|
continue;
|
||||||
if (teamplay->int_val && ent->v.v.team > 0
|
if (teamplay->int_val && ((entvars_t*)&ent->v)->team > 0
|
||||||
&& ent->v.v.team == check->v.v.team) continue; // don't aim at
|
&& ((entvars_t*)&ent->v)->team == ((entvars_t*)&check->v)->team) continue; // don't aim at
|
||||||
// teammate
|
// teammate
|
||||||
for (j = 0; j < 3; j++)
|
for (j = 0; j < 3; j++)
|
||||||
end[j] = check->v.v.origin[j]
|
end[j] = ((entvars_t*)&check->v)->origin[j]
|
||||||
+ 0.5 * (check->v.v.mins[j] + check->v.v.maxs[j]);
|
+ 0.5 * (((entvars_t*)&check->v)->mins[j] + ((entvars_t*)&check->v)->maxs[j]);
|
||||||
VectorSubtract (end, start, dir);
|
VectorSubtract (end, start, dir);
|
||||||
VectorNormalize (dir);
|
VectorNormalize (dir);
|
||||||
dist = DotProduct (dir, pr->pr_global_struct->v_forward);
|
dist = DotProduct (dir, ((globalvars_t*)pr->pr_globals)->v_forward);
|
||||||
if (dist < bestdist)
|
if (dist < bestdist)
|
||||||
continue; // to far to turn
|
continue; // to far to turn
|
||||||
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
|
tr = SV_Move (start, vec3_origin, vec3_origin, end, false, ent);
|
||||||
|
@ -1242,9 +1243,9 @@ PF_aim (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bestent) {
|
if (bestent) {
|
||||||
VectorSubtract (bestent->v.v.origin, ent->v.v.origin, dir);
|
VectorSubtract (((entvars_t*)&bestent->v)->origin, ((entvars_t*)&ent->v)->origin, dir);
|
||||||
dist = DotProduct (dir, pr->pr_global_struct->v_forward);
|
dist = DotProduct (dir, ((globalvars_t*)pr->pr_globals)->v_forward);
|
||||||
VectorScale (pr->pr_global_struct->v_forward, dist, end);
|
VectorScale (((globalvars_t*)pr->pr_globals)->v_forward, dist, end);
|
||||||
end[2] = dir[2];
|
end[2] = dir[2];
|
||||||
VectorNormalize (end);
|
VectorNormalize (end);
|
||||||
VectorCopy (end, G_VECTOR (pr, OFS_RETURN));
|
VectorCopy (end, G_VECTOR (pr, OFS_RETURN));
|
||||||
|
@ -1264,10 +1265,10 @@ PF_changeyaw (progs_t *pr)
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
float ideal, current, move, speed;
|
float ideal, current, move, speed;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT (pr, pr->pr_global_struct->self);
|
ent = PROG_TO_EDICT (pr, ((globalvars_t*)pr->pr_globals)->self);
|
||||||
current = anglemod (ent->v.v.angles[1]);
|
current = anglemod (((entvars_t*)&ent->v)->angles[1]);
|
||||||
ideal = ent->v.v.ideal_yaw;
|
ideal = ((entvars_t*)&ent->v)->ideal_yaw;
|
||||||
speed = ent->v.v.yaw_speed;
|
speed = ((entvars_t*)&ent->v)->yaw_speed;
|
||||||
|
|
||||||
if (current == ideal)
|
if (current == ideal)
|
||||||
return;
|
return;
|
||||||
|
@ -1287,7 +1288,7 @@ PF_changeyaw (progs_t *pr)
|
||||||
move = -speed;
|
move = -speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
ent->v.v.angles[1] = anglemod (current + move);
|
((entvars_t*)&ent->v)->angles[1] = anglemod (current + move);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1313,7 +1314,7 @@ WriteDest (progs_t *pr)
|
||||||
case MSG_ONE:
|
case MSG_ONE:
|
||||||
SV_Error ("Shouldn't be at MSG_ONE");
|
SV_Error ("Shouldn't be at MSG_ONE");
|
||||||
#if 0
|
#if 0
|
||||||
ent = PROG_TO_EDICT (pr, pr->pr_global_struct->msg_entity);
|
ent = PROG_TO_EDICT (pr, ((globalvars_t*)pr->pr_globals)->msg_entity);
|
||||||
entnum = NUM_FOR_EDICT (pr, ent);
|
entnum = NUM_FOR_EDICT (pr, ent);
|
||||||
if (entnum < 1 || entnum > MAX_CLIENTS)
|
if (entnum < 1 || entnum > MAX_CLIENTS)
|
||||||
PR_RunError (pr, "WriteDest: not a client");
|
PR_RunError (pr, "WriteDest: not a client");
|
||||||
|
@ -1346,7 +1347,7 @@ Write_GetClient (progs_t *pr)
|
||||||
int entnum;
|
int entnum;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
ent = PROG_TO_EDICT (pr, pr->pr_global_struct->msg_entity);
|
ent = PROG_TO_EDICT (pr, ((globalvars_t*)pr->pr_globals)->msg_entity);
|
||||||
entnum = NUM_FOR_EDICT (pr, ent);
|
entnum = NUM_FOR_EDICT (pr, ent);
|
||||||
if (entnum < 1 || entnum > MAX_CLIENTS)
|
if (entnum < 1 || entnum > MAX_CLIENTS)
|
||||||
PR_RunError (pr, "Write_GetClient: not a client");
|
PR_RunError (pr, "Write_GetClient: not a client");
|
||||||
|
@ -1465,14 +1466,14 @@ PF_makestatic (progs_t *pr)
|
||||||
|
|
||||||
MSG_WriteByte (&sv.signon, svc_spawnstatic);
|
MSG_WriteByte (&sv.signon, svc_spawnstatic);
|
||||||
|
|
||||||
MSG_WriteByte (&sv.signon, SV_ModelIndex (PR_GetString (pr, ent->v.v.model)));
|
MSG_WriteByte (&sv.signon, SV_ModelIndex (PR_GetString (pr, ((entvars_t*)&ent->v)->model)));
|
||||||
|
|
||||||
MSG_WriteByte (&sv.signon, ent->v.v.frame);
|
MSG_WriteByte (&sv.signon, ((entvars_t*)&ent->v)->frame);
|
||||||
MSG_WriteByte (&sv.signon, ent->v.v.colormap);
|
MSG_WriteByte (&sv.signon, ((entvars_t*)&ent->v)->colormap);
|
||||||
MSG_WriteByte (&sv.signon, ent->v.v.skin);
|
MSG_WriteByte (&sv.signon, ((entvars_t*)&ent->v)->skin);
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
MSG_WriteCoord (&sv.signon, ent->v.v.origin[i]);
|
MSG_WriteCoord (&sv.signon, ((entvars_t*)&ent->v)->origin[i]);
|
||||||
MSG_WriteAngle (&sv.signon, ent->v.v.angles[i]);
|
MSG_WriteAngle (&sv.signon, ((entvars_t*)&ent->v)->angles[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// throw the entity away now
|
// throw the entity away now
|
||||||
|
@ -1500,7 +1501,7 @@ PF_setspawnparms (progs_t *pr)
|
||||||
client = svs.clients + (i - 1);
|
client = svs.clients + (i - 1);
|
||||||
|
|
||||||
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||||
(&pr->pr_global_struct->parm1)[i] = client->spawn_parms[i];
|
(&((globalvars_t*)pr->pr_globals)->parm1)[i] = client->spawn_parms[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "progs.h"
|
#include "progs.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
@ -52,7 +53,7 @@ func_t SpectatorConnect;
|
||||||
func_t SpectatorDisconnect;
|
func_t SpectatorDisconnect;
|
||||||
func_t SpectatorThink;
|
func_t SpectatorThink;
|
||||||
|
|
||||||
static reserved_edicts = MAX_CLIENTS;
|
static int reserved_edicts = MAX_CLIENTS;
|
||||||
|
|
||||||
void
|
void
|
||||||
FindEdictFieldOffsets (progs_t *pr)
|
FindEdictFieldOffsets (progs_t *pr)
|
||||||
|
@ -86,7 +87,7 @@ FindEdictFieldOffsets (progs_t *pr)
|
||||||
int
|
int
|
||||||
ED_Prune_Edict (progs_t *pr, edict_t *ent)
|
ED_Prune_Edict (progs_t *pr, edict_t *ent)
|
||||||
{
|
{
|
||||||
if (((int) ent->v.v.spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
|
if (((int) ((entvars_t*)&ent->v)->spawnflags & SPAWNFLAG_NOT_DEATHMATCH))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -148,6 +149,8 @@ SV_LoadProgs (void)
|
||||||
PR_LoadProgs (&sv_pr_state, sv_progs->string);
|
PR_LoadProgs (&sv_pr_state, sv_progs->string);
|
||||||
if (!sv_pr_state.progs)
|
if (!sv_pr_state.progs)
|
||||||
SV_Error ("SV_LoadProgs: couldn't load %s", sv_progs->string);
|
SV_Error ("SV_LoadProgs: couldn't load %s", sv_progs->string);
|
||||||
|
if (sv_pr_state.progs->crc != PROGHEADER_CRC)
|
||||||
|
SV_Error ("You must have the qwprogs.dat from QuakeWorld installed");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
|
|
||||||
#include "bothdefs.h"
|
#include "bothdefs.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
|
||||||
|
@ -332,12 +333,12 @@ SV_Multicast (vec3_t origin, int to)
|
||||||
if (to == MULTICAST_PHS_R || to == MULTICAST_PHS) {
|
if (to == MULTICAST_PHS_R || to == MULTICAST_PHS) {
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
|
|
||||||
VectorSubtract (origin, client->edict->v.v.origin, delta);
|
VectorSubtract (origin, ((entvars_t*)&client->edict->v)->origin, delta);
|
||||||
if (Length (delta) <= 1024)
|
if (Length (delta) <= 1024)
|
||||||
goto inrange;
|
goto inrange;
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf = Mod_PointInLeaf (client->edict->v.v.origin, sv.worldmodel);
|
leaf = Mod_PointInLeaf (((entvars_t*)&client->edict->v)->origin, sv.worldmodel);
|
||||||
if (leaf) {
|
if (leaf) {
|
||||||
// -1 is because pvs rows are 1 based, not 0 based like leafs
|
// -1 is because pvs rows are 1 based, not 0 based like leafs
|
||||||
leafnum = leaf - sv.worldmodel->leafs - 1;
|
leafnum = leaf - sv.worldmodel->leafs - 1;
|
||||||
|
@ -429,13 +430,13 @@ SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
|
||||||
channel |= SND_ATTENUATION;
|
channel |= SND_ATTENUATION;
|
||||||
|
|
||||||
// use the entity origin unless it is a bmodel
|
// use the entity origin unless it is a bmodel
|
||||||
if (entity->v.v.solid == SOLID_BSP) {
|
if (((entvars_t*)&entity->v)->solid == SOLID_BSP) {
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
origin[i] =
|
origin[i] =
|
||||||
entity->v.v.origin[i] + 0.5 * (entity->v.v.mins[i] +
|
((entvars_t*)&entity->v)->origin[i] + 0.5 * (((entvars_t*)&entity->v)->mins[i] +
|
||||||
entity->v.v.maxs[i]);
|
((entvars_t*)&entity->v)->maxs[i]);
|
||||||
} else {
|
} else {
|
||||||
VectorCopy (entity->v.v.origin, origin);
|
VectorCopy (((entvars_t*)&entity->v)->origin, origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
MSG_WriteByte (&sv.multicast, svc_sound);
|
MSG_WriteByte (&sv.multicast, svc_sound);
|
||||||
|
@ -502,25 +503,25 @@ SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg)
|
||||||
client->chokecount = 0;
|
client->chokecount = 0;
|
||||||
}
|
}
|
||||||
// send a damage message if the player got hit this frame
|
// send a damage message if the player got hit this frame
|
||||||
if (ent->v.v.dmg_take || ent->v.v.dmg_save) {
|
if (((entvars_t*)&ent->v)->dmg_take || ((entvars_t*)&ent->v)->dmg_save) {
|
||||||
other = PROG_TO_EDICT (&sv_pr_state, ent->v.v.dmg_inflictor);
|
other = PROG_TO_EDICT (&sv_pr_state, ((entvars_t*)&ent->v)->dmg_inflictor);
|
||||||
MSG_WriteByte (msg, svc_damage);
|
MSG_WriteByte (msg, svc_damage);
|
||||||
MSG_WriteByte (msg, ent->v.v.dmg_save);
|
MSG_WriteByte (msg, ((entvars_t*)&ent->v)->dmg_save);
|
||||||
MSG_WriteByte (msg, ent->v.v.dmg_take);
|
MSG_WriteByte (msg, ((entvars_t*)&ent->v)->dmg_take);
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
MSG_WriteCoord (msg,
|
MSG_WriteCoord (msg,
|
||||||
other->v.v.origin[i] + 0.5 * (other->v.v.mins[i] +
|
((entvars_t*)&other->v)->origin[i] + 0.5 * (((entvars_t*)&other->v)->mins[i] +
|
||||||
other->v.v.maxs[i]));
|
((entvars_t*)&other->v)->maxs[i]));
|
||||||
|
|
||||||
ent->v.v.dmg_take = 0;
|
((entvars_t*)&ent->v)->dmg_take = 0;
|
||||||
ent->v.v.dmg_save = 0;
|
((entvars_t*)&ent->v)->dmg_save = 0;
|
||||||
}
|
}
|
||||||
// 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.v.fixangle) {
|
if (((entvars_t*)&ent->v)->fixangle) {
|
||||||
MSG_WriteByte (msg, svc_setangle);
|
MSG_WriteByte (msg, svc_setangle);
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
MSG_WriteAngle (msg, ent->v.v.angles[i]);
|
MSG_WriteAngle (msg, ((entvars_t*)&ent->v)->angles[i]);
|
||||||
ent->v.v.fixangle = 0;
|
((entvars_t*)&ent->v)->fixangle = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,29 +546,29 @@ SV_UpdateClientStats (client_t *client)
|
||||||
if (client->spectator && client->spec_track > 0)
|
if (client->spectator && client->spec_track > 0)
|
||||||
ent = svs.clients[client->spec_track - 1].edict;
|
ent = svs.clients[client->spec_track - 1].edict;
|
||||||
|
|
||||||
stats[STAT_HEALTH] = ent->v.v.health;
|
stats[STAT_HEALTH] = ((entvars_t*)&ent->v)->health;
|
||||||
stats[STAT_WEAPON] = SV_ModelIndex (PR_GetString (&sv_pr_state, ent->v.v.weaponmodel));
|
stats[STAT_WEAPON] = SV_ModelIndex (PR_GetString (&sv_pr_state, ((entvars_t*)&ent->v)->weaponmodel));
|
||||||
stats[STAT_AMMO] = ent->v.v.currentammo;
|
stats[STAT_AMMO] = ((entvars_t*)&ent->v)->currentammo;
|
||||||
stats[STAT_ARMOR] = ent->v.v.armorvalue;
|
stats[STAT_ARMOR] = ((entvars_t*)&ent->v)->armorvalue;
|
||||||
stats[STAT_SHELLS] = ent->v.v.ammo_shells;
|
stats[STAT_SHELLS] = ((entvars_t*)&ent->v)->ammo_shells;
|
||||||
stats[STAT_NAILS] = ent->v.v.ammo_nails;
|
stats[STAT_NAILS] = ((entvars_t*)&ent->v)->ammo_nails;
|
||||||
stats[STAT_ROCKETS] = ent->v.v.ammo_rockets;
|
stats[STAT_ROCKETS] = ((entvars_t*)&ent->v)->ammo_rockets;
|
||||||
stats[STAT_CELLS] = ent->v.v.ammo_cells;
|
stats[STAT_CELLS] = ((entvars_t*)&ent->v)->ammo_cells;
|
||||||
if (!client->spectator)
|
if (!client->spectator)
|
||||||
stats[STAT_ACTIVEWEAPON] = ent->v.v.weapon;
|
stats[STAT_ACTIVEWEAPON] = ((entvars_t*)&ent->v)->weapon;
|
||||||
// stuff the sigil bits into the high bits of items for sbar
|
// stuff the sigil bits into the high bits of items for sbar
|
||||||
stats[STAT_ITEMS] =
|
stats[STAT_ITEMS] =
|
||||||
(int) ent->v.v.items | ((int) sv_pr_state.pr_global_struct->serverflags << 28);
|
(int) ((entvars_t*)&ent->v)->items | ((int) ((globalvars_t*)sv_pr_state.pr_globals)->serverflags << 28);
|
||||||
|
|
||||||
// Extensions to the QW 2.40 protocol for Mega2k --KB
|
// Extensions to the QW 2.40 protocol for Mega2k --KB
|
||||||
stats[STAT_VIEWHEIGHT] = (int) ent->v.v.view_ofs[2];
|
stats[STAT_VIEWHEIGHT] = (int) ((entvars_t*)&ent->v)->view_ofs[2];
|
||||||
|
|
||||||
// FIXME: this should become a * key! --KB
|
// FIXME: this should become a * key! --KB
|
||||||
if (ent->v.v.movetype == MOVETYPE_FLY && !atoi (Info_ValueForKey
|
if (((entvars_t*)&ent->v)->movetype == MOVETYPE_FLY && !atoi (Info_ValueForKey
|
||||||
(svs.info, "playerfly")))
|
(svs.info, "playerfly")))
|
||||||
ent->v.v.movetype = MOVETYPE_WALK;
|
((entvars_t*)&ent->v)->movetype = MOVETYPE_WALK;
|
||||||
|
|
||||||
stats[STAT_FLYMODE] = (ent->v.v.movetype == MOVETYPE_FLY);
|
stats[STAT_FLYMODE] = (((entvars_t*)&ent->v)->movetype == MOVETYPE_FLY);
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < MAX_CL_STATS; i++)
|
for (i = 0; i < MAX_CL_STATS; i++)
|
||||||
|
@ -649,16 +650,16 @@ SV_UpdateToReliableMessages (void)
|
||||||
host_client->sendinfo = false;
|
host_client->sendinfo = false;
|
||||||
SV_FullClientUpdate (host_client, &sv.reliable_datagram);
|
SV_FullClientUpdate (host_client, &sv.reliable_datagram);
|
||||||
}
|
}
|
||||||
if (host_client->old_frags != host_client->edict->v.v.frags) {
|
if (host_client->old_frags != ((entvars_t*)&host_client->edict->v)->frags) {
|
||||||
for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) {
|
for (j = 0, client = svs.clients; j < MAX_CLIENTS; j++, client++) {
|
||||||
if (client->state < cs_connected)
|
if (client->state < cs_connected)
|
||||||
continue;
|
continue;
|
||||||
ClientReliableWrite_Begin (client, svc_updatefrags, 4);
|
ClientReliableWrite_Begin (client, svc_updatefrags, 4);
|
||||||
ClientReliableWrite_Byte (client, i);
|
ClientReliableWrite_Byte (client, i);
|
||||||
ClientReliableWrite_Short (client, host_client->edict->v.v.frags);
|
ClientReliableWrite_Short (client, ((entvars_t*)&host_client->edict->v)->frags);
|
||||||
}
|
}
|
||||||
|
|
||||||
host_client->old_frags = host_client->edict->v.v.frags;
|
host_client->old_frags = ((entvars_t*)&host_client->edict->v)->frags;
|
||||||
}
|
}
|
||||||
// maxspeed/entgravity changes
|
// maxspeed/entgravity changes
|
||||||
ent = host_client->edict;
|
ent = host_client->edict;
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
#include "cvar.h"
|
#include "cvar.h"
|
||||||
#include "msg.h"
|
#include "msg.h"
|
||||||
#include "msg_ucmd.h"
|
#include "msg_ucmd.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "pmove.h"
|
#include "pmove.h"
|
||||||
#include "quakefs.h"
|
#include "quakefs.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
|
@ -131,7 +132,7 @@ SV_New_f (void)
|
||||||
|
|
||||||
// send full levelname
|
// send full levelname
|
||||||
MSG_WriteString (&host_client->netchan.message,
|
MSG_WriteString (&host_client->netchan.message,
|
||||||
PR_GetString (&sv_pr_state, sv.edicts->v.v.message));
|
PR_GetString (&sv_pr_state, ((entvars_t*)&sv.edicts->v)->message));
|
||||||
|
|
||||||
// send the movevars
|
// send the movevars
|
||||||
MSG_WriteFloat (&host_client->netchan.message, movevars.gravity);
|
MSG_WriteFloat (&host_client->netchan.message, movevars.gravity);
|
||||||
|
@ -147,7 +148,7 @@ SV_New_f (void)
|
||||||
|
|
||||||
// send music
|
// send music
|
||||||
MSG_WriteByte (&host_client->netchan.message, svc_cdtrack);
|
MSG_WriteByte (&host_client->netchan.message, svc_cdtrack);
|
||||||
MSG_WriteByte (&host_client->netchan.message, sv.edicts->v.v.sounds);
|
MSG_WriteByte (&host_client->netchan.message, ((entvars_t*)&sv.edicts->v)->sounds);
|
||||||
|
|
||||||
// send server info string
|
// send server info string
|
||||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||||
|
@ -378,9 +379,9 @@ SV_Spawn_f (void)
|
||||||
ent = host_client->edict;
|
ent = host_client->edict;
|
||||||
|
|
||||||
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
|
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
|
||||||
ent->v.v.colormap = NUM_FOR_EDICT (&sv_pr_state, ent);
|
((entvars_t*)&ent->v)->colormap = NUM_FOR_EDICT (&sv_pr_state, ent);
|
||||||
ent->v.v.team = 0; // FIXME
|
((entvars_t*)&ent->v)->team = 0; // FIXME
|
||||||
ent->v.v.netname = PR_SetString (&sv_pr_state, host_client->name);
|
((entvars_t*)&ent->v)->netname = PR_SetString (&sv_pr_state, host_client->name);
|
||||||
|
|
||||||
host_client->entgravity = 1.0;
|
host_client->entgravity = 1.0;
|
||||||
val = GetEdictFieldValue (&sv_pr_state, ent, "gravity");
|
val = GetEdictFieldValue (&sv_pr_state, ent, "gravity");
|
||||||
|
@ -398,19 +399,19 @@ SV_Spawn_f (void)
|
||||||
|
|
||||||
ClientReliableWrite_Begin (host_client, svc_updatestatlong, 6);
|
ClientReliableWrite_Begin (host_client, svc_updatestatlong, 6);
|
||||||
ClientReliableWrite_Byte (host_client, STAT_TOTALSECRETS);
|
ClientReliableWrite_Byte (host_client, STAT_TOTALSECRETS);
|
||||||
ClientReliableWrite_Long (host_client, sv_pr_state.pr_global_struct->total_secrets);
|
ClientReliableWrite_Long (host_client, ((globalvars_t*)sv_pr_state.pr_globals)->total_secrets);
|
||||||
|
|
||||||
ClientReliableWrite_Begin (host_client, svc_updatestatlong, 6);
|
ClientReliableWrite_Begin (host_client, svc_updatestatlong, 6);
|
||||||
ClientReliableWrite_Byte (host_client, STAT_TOTALMONSTERS);
|
ClientReliableWrite_Byte (host_client, STAT_TOTALMONSTERS);
|
||||||
ClientReliableWrite_Long (host_client, sv_pr_state.pr_global_struct->total_monsters);
|
ClientReliableWrite_Long (host_client, ((globalvars_t*)sv_pr_state.pr_globals)->total_monsters);
|
||||||
|
|
||||||
ClientReliableWrite_Begin (host_client, svc_updatestatlong, 6);
|
ClientReliableWrite_Begin (host_client, svc_updatestatlong, 6);
|
||||||
ClientReliableWrite_Byte (host_client, STAT_SECRETS);
|
ClientReliableWrite_Byte (host_client, STAT_SECRETS);
|
||||||
ClientReliableWrite_Long (host_client, sv_pr_state.pr_global_struct->found_secrets);
|
ClientReliableWrite_Long (host_client, ((globalvars_t*)sv_pr_state.pr_globals)->found_secrets);
|
||||||
|
|
||||||
ClientReliableWrite_Begin (host_client, svc_updatestatlong, 6);
|
ClientReliableWrite_Begin (host_client, svc_updatestatlong, 6);
|
||||||
ClientReliableWrite_Byte (host_client, STAT_MONSTERS);
|
ClientReliableWrite_Byte (host_client, STAT_MONSTERS);
|
||||||
ClientReliableWrite_Long (host_client, sv_pr_state.pr_global_struct->killed_monsters);
|
ClientReliableWrite_Long (host_client, ((globalvars_t*)sv_pr_state.pr_globals)->killed_monsters);
|
||||||
|
|
||||||
// get the client to check and download skins
|
// get the client to check and download skins
|
||||||
// when that is completed, a begin command will be issued
|
// when that is completed, a begin command will be issued
|
||||||
|
@ -427,15 +428,15 @@ SV_SpawnSpectator (void)
|
||||||
int i;
|
int i;
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
|
||||||
VectorCopy (vec3_origin, sv_player->v.v.origin);
|
VectorCopy (vec3_origin, ((entvars_t*)&sv_player->v)->origin);
|
||||||
VectorCopy (vec3_origin, sv_player->v.v.view_ofs);
|
VectorCopy (vec3_origin, ((entvars_t*)&sv_player->v)->view_ofs);
|
||||||
sv_player->v.v.view_ofs[2] = 22;
|
((entvars_t*)&sv_player->v)->view_ofs[2] = 22;
|
||||||
|
|
||||||
// search for an info_playerstart to spawn the spectator at
|
// search for an info_playerstart to spawn the spectator at
|
||||||
for (i = MAX_CLIENTS - 1; i < sv.num_edicts; i++) {
|
for (i = MAX_CLIENTS - 1; i < sv.num_edicts; i++) {
|
||||||
e = EDICT_NUM (&sv_pr_state, i);
|
e = EDICT_NUM (&sv_pr_state, i);
|
||||||
if (!strcmp (PR_GetString (&sv_pr_state, e->v.v.classname), "info_player_start")) {
|
if (!strcmp (PR_GetString (&sv_pr_state, ((entvars_t*)&e->v)->classname), "info_player_start")) {
|
||||||
VectorCopy (e->v.v.origin, sv_player->v.v.origin);
|
VectorCopy (((entvars_t*)&e->v)->origin, ((entvars_t*)&sv_player->v)->origin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,27 +470,27 @@ SV_Begin_f (void)
|
||||||
if (SpectatorConnect) {
|
if (SpectatorConnect) {
|
||||||
// copy spawn parms out of the client_t
|
// copy spawn parms out of the client_t
|
||||||
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||||
(&sv_pr_state.pr_global_struct->parm1)[i] = host_client->spawn_parms[i];
|
(&((globalvars_t*)sv_pr_state.pr_globals)->parm1)[i] = host_client->spawn_parms[i];
|
||||||
|
|
||||||
// call the spawn function
|
// call the spawn function
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
||||||
PR_ExecuteProgram (&sv_pr_state, SpectatorConnect);
|
PR_ExecuteProgram (&sv_pr_state, SpectatorConnect);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// copy spawn parms out of the client_t
|
// copy spawn parms out of the client_t
|
||||||
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||||
(&sv_pr_state.pr_global_struct->parm1)[i] = host_client->spawn_parms[i];
|
(&((globalvars_t*)sv_pr_state.pr_globals)->parm1)[i] = host_client->spawn_parms[i];
|
||||||
|
|
||||||
// call the spawn function
|
// call the spawn function
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
||||||
PR_ExecuteProgram (&sv_pr_state, sv_pr_state.pr_global_struct->ClientConnect);
|
PR_ExecuteProgram (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->ClientConnect);
|
||||||
|
|
||||||
// actually spawn the player
|
// actually spawn the player
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
||||||
PR_ExecuteProgram (&sv_pr_state, sv_pr_state.pr_global_struct->PutClientInServer);
|
PR_ExecuteProgram (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->PutClientInServer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear the net statistics, because connecting gives a bogus picture
|
// clear the net statistics, because connecting gives a bogus picture
|
||||||
|
@ -524,7 +525,7 @@ SV_Begin_f (void)
|
||||||
ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients));
|
ent = EDICT_NUM (&sv_pr_state, 1 + (host_client - svs.clients));
|
||||||
MSG_WriteByte (&host_client->netchan.message, svc_setangle);
|
MSG_WriteByte (&host_client->netchan.message, svc_setangle);
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
MSG_WriteAngle (&host_client->netchan.message, ent->v.v.angles[i]);
|
MSG_WriteAngle (&host_client->netchan.message, ((entvars_t*)&ent->v)->angles[i]);
|
||||||
MSG_WriteAngle (&host_client->netchan.message, 0);
|
MSG_WriteAngle (&host_client->netchan.message, 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -898,7 +899,7 @@ SV_Pings_f (void)
|
||||||
void
|
void
|
||||||
SV_Kill_f (void)
|
SV_Kill_f (void)
|
||||||
{
|
{
|
||||||
if (sv_player->v.v.health <= 0) {
|
if (((entvars_t*)&sv_player->v)->health <= 0) {
|
||||||
SV_BeginRedirect (RD_CLIENT);
|
SV_BeginRedirect (RD_CLIENT);
|
||||||
SV_ClientPrintf (host_client, PRINT_HIGH,
|
SV_ClientPrintf (host_client, PRINT_HIGH,
|
||||||
"Can't suicide -- already dead!\n");
|
"Can't suicide -- already dead!\n");
|
||||||
|
@ -906,9 +907,9 @@ SV_Kill_f (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
||||||
PR_ExecuteProgram (&sv_pr_state, sv_pr_state.pr_global_struct->ClientKill);
|
PR_ExecuteProgram (&sv_pr_state, ((globalvars_t*)sv_pr_state.pr_globals)->ClientKill);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1007,7 +1008,7 @@ SV_PTrack_f (void)
|
||||||
host_client->spec_track = 0;
|
host_client->spec_track = 0;
|
||||||
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
|
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
|
||||||
tent = EDICT_NUM (&sv_pr_state, 0);
|
tent = EDICT_NUM (&sv_pr_state, 0);
|
||||||
ent->v.v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
|
((entvars_t*)&ent->v)->goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1018,14 +1019,14 @@ SV_PTrack_f (void)
|
||||||
host_client->spec_track = 0;
|
host_client->spec_track = 0;
|
||||||
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
|
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
|
||||||
tent = EDICT_NUM (&sv_pr_state, 0);
|
tent = EDICT_NUM (&sv_pr_state, 0);
|
||||||
ent->v.v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
|
((entvars_t*)&ent->v)->goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
host_client->spec_track = i + 1; // now tracking
|
host_client->spec_track = i + 1; // now tracking
|
||||||
|
|
||||||
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
|
ent = EDICT_NUM (&sv_pr_state, host_client - svs.clients + 1);
|
||||||
tent = EDICT_NUM (&sv_pr_state, i + 1);
|
tent = EDICT_NUM (&sv_pr_state, i + 1);
|
||||||
ent->v.v.goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
|
((entvars_t*)&ent->v)->goalentity = EDICT_TO_PROG (&sv_pr_state, tent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1286,16 +1287,16 @@ AddLinksToPmove (areanode_t *node)
|
||||||
next = l->next;
|
next = l->next;
|
||||||
check = EDICT_FROM_AREA (l);
|
check = EDICT_FROM_AREA (l);
|
||||||
|
|
||||||
if (check->v.v.owner == pl)
|
if (((entvars_t*)&check->v)->owner == pl)
|
||||||
continue; // player's own missile
|
continue; // player's own missile
|
||||||
if (check->v.v.solid == SOLID_BSP
|
if (((entvars_t*)&check->v)->solid == SOLID_BSP
|
||||||
|| check->v.v.solid == SOLID_BBOX || check->v.v.solid == SOLID_SLIDEBOX) {
|
|| ((entvars_t*)&check->v)->solid == SOLID_BBOX || ((entvars_t*)&check->v)->solid == SOLID_SLIDEBOX) {
|
||||||
if (check == sv_player)
|
if (check == sv_player)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (check->v.v.absmin[i] > pmove_maxs[i]
|
if (((entvars_t*)&check->v)->absmin[i] > pmove_maxs[i]
|
||||||
|| check->v.v.absmax[i] < pmove_mins[i])
|
|| ((entvars_t*)&check->v)->absmax[i] < pmove_mins[i])
|
||||||
break;
|
break;
|
||||||
if (i != 3)
|
if (i != 3)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1304,15 +1305,15 @@ AddLinksToPmove (areanode_t *node)
|
||||||
pe = &pmove.physents[pmove.numphysent];
|
pe = &pmove.physents[pmove.numphysent];
|
||||||
pmove.numphysent++;
|
pmove.numphysent++;
|
||||||
|
|
||||||
VectorCopy (check->v.v.origin, pe->origin);
|
VectorCopy (((entvars_t*)&check->v)->origin, pe->origin);
|
||||||
pe->info = NUM_FOR_EDICT (&sv_pr_state, check);
|
pe->info = NUM_FOR_EDICT (&sv_pr_state, check);
|
||||||
|
|
||||||
if (check->v.v.solid == SOLID_BSP) {
|
if (((entvars_t*)&check->v)->solid == SOLID_BSP) {
|
||||||
pe->model = sv.models[(int) (check->v.v.modelindex)];
|
pe->model = sv.models[(int) (((entvars_t*)&check->v)->modelindex)];
|
||||||
} else {
|
} else {
|
||||||
pe->model = NULL;
|
pe->model = NULL;
|
||||||
VectorCopy (check->v.v.mins, pe->mins);
|
VectorCopy (((entvars_t*)&check->v)->mins, pe->mins);
|
||||||
VectorCopy (check->v.v.maxs, pe->maxs);
|
VectorCopy (((entvars_t*)&check->v)->maxs, pe->maxs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1349,30 +1350,30 @@ AddAllEntsToPmove (void)
|
||||||
check = NEXT_EDICT (&sv_pr_state, check)) {
|
check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
if (check->free)
|
if (check->free)
|
||||||
continue;
|
continue;
|
||||||
if (check->v.v.owner == pl)
|
if (((entvars_t*)&check->v)->owner == pl)
|
||||||
continue;
|
continue;
|
||||||
if (check->v.v.solid == SOLID_BSP
|
if (((entvars_t*)&check->v)->solid == SOLID_BSP
|
||||||
|| check->v.v.solid == SOLID_BBOX
|
|| ((entvars_t*)&check->v)->solid == SOLID_BBOX
|
||||||
|| check->v.v.solid == SOLID_SLIDEBOX) {
|
|| ((entvars_t*)&check->v)->solid == SOLID_SLIDEBOX) {
|
||||||
if (check == sv_player)
|
if (check == sv_player)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
if (check->v.v.absmin[i] > pmove_maxs[i]
|
if (((entvars_t*)&check->v)->absmin[i] > pmove_maxs[i]
|
||||||
|| check->v.v.absmax[i] < pmove_mins[i])
|
|| ((entvars_t*)&check->v)->absmax[i] < pmove_mins[i])
|
||||||
break;
|
break;
|
||||||
if (i != 3)
|
if (i != 3)
|
||||||
continue;
|
continue;
|
||||||
pe = &pmove.physents[pmove.numphysent];
|
pe = &pmove.physents[pmove.numphysent];
|
||||||
|
|
||||||
VectorCopy (check->v.v.origin, pe->origin);
|
VectorCopy (((entvars_t*)&check->v)->origin, pe->origin);
|
||||||
pmove.physents[pmove.numphysent].info = e;
|
pmove.physents[pmove.numphysent].info = e;
|
||||||
if (check->v.v.solid == SOLID_BSP)
|
if (((entvars_t*)&check->v)->solid == SOLID_BSP)
|
||||||
pe->model = sv.models[(int) (check->v.v.modelindex)];
|
pe->model = sv.models[(int) (((entvars_t*)&check->v)->modelindex)];
|
||||||
else {
|
else {
|
||||||
pe->model = NULL;
|
pe->model = NULL;
|
||||||
VectorCopy (check->v.v.mins, pe->mins);
|
VectorCopy (((entvars_t*)&check->v)->mins, pe->mins);
|
||||||
VectorCopy (check->v.v.maxs, pe->maxs);
|
VectorCopy (((entvars_t*)&check->v)->maxs, pe->maxs);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++pmove.numphysent == MAX_PHYSENTS)
|
if (++pmove.numphysent == MAX_PHYSENTS)
|
||||||
|
@ -1455,59 +1456,59 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sv_player->v.v.fixangle)
|
if (!((entvars_t*)&sv_player->v)->fixangle)
|
||||||
VectorCopy (ucmd->angles, sv_player->v.v.v_angle);
|
VectorCopy (ucmd->angles, ((entvars_t*)&sv_player->v)->v_angle);
|
||||||
|
|
||||||
sv_player->v.v.button0 = ucmd->buttons & 1;
|
((entvars_t*)&sv_player->v)->button0 = ucmd->buttons & 1;
|
||||||
// 1999-10-29 +USE fix by Maddes start
|
// 1999-10-29 +USE fix by Maddes start
|
||||||
if (!nouse) {
|
if (!nouse) {
|
||||||
sv_player->v.v.button1 = (ucmd->buttons & 4) >> 2;
|
((entvars_t*)&sv_player->v)->button1 = (ucmd->buttons & 4) >> 2;
|
||||||
}
|
}
|
||||||
// 1999-10-29 +USE fix by Maddes end
|
// 1999-10-29 +USE fix by Maddes end
|
||||||
sv_player->v.v.button2 = (ucmd->buttons & 2) >> 1;
|
((entvars_t*)&sv_player->v)->button2 = (ucmd->buttons & 2) >> 1;
|
||||||
if (ucmd->impulse)
|
if (ucmd->impulse)
|
||||||
sv_player->v.v.impulse = ucmd->impulse;
|
((entvars_t*)&sv_player->v)->impulse = ucmd->impulse;
|
||||||
|
|
||||||
//
|
//
|
||||||
// angles
|
// angles
|
||||||
// show 1/3 the pitch angle and all the roll angle
|
// show 1/3 the pitch angle and all the roll angle
|
||||||
if (sv_player->v.v.health > 0) {
|
if (((entvars_t*)&sv_player->v)->health > 0) {
|
||||||
if (!sv_player->v.v.fixangle) {
|
if (!((entvars_t*)&sv_player->v)->fixangle) {
|
||||||
sv_player->v.v.angles[PITCH] = -sv_player->v.v.v_angle[PITCH] / 3;
|
((entvars_t*)&sv_player->v)->angles[PITCH] = -((entvars_t*)&sv_player->v)->v_angle[PITCH] / 3;
|
||||||
sv_player->v.v.angles[YAW] = sv_player->v.v.v_angle[YAW];
|
((entvars_t*)&sv_player->v)->angles[YAW] = ((entvars_t*)&sv_player->v)->v_angle[YAW];
|
||||||
}
|
}
|
||||||
sv_player->v.v.angles[ROLL] =
|
((entvars_t*)&sv_player->v)->angles[ROLL] =
|
||||||
SV_CalcRoll (sv_player->v.v.angles, sv_player->v.v.velocity) * 4;
|
SV_CalcRoll (((entvars_t*)&sv_player->v)->angles, ((entvars_t*)&sv_player->v)->velocity) * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
sv_frametime = min (0.1, ucmd->msec * 0.001);
|
sv_frametime = min (0.1, ucmd->msec * 0.001);
|
||||||
|
|
||||||
if (!host_client->spectator) {
|
if (!host_client->spectator) {
|
||||||
sv_pr_state.pr_global_struct->frametime = sv_frametime;
|
((globalvars_t*)sv_pr_state.pr_globals)->frametime = sv_frametime;
|
||||||
|
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state,
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state,
|
||||||
sv_player);
|
sv_player);
|
||||||
PR_ExecuteProgram (&sv_pr_state,
|
PR_ExecuteProgram (&sv_pr_state,
|
||||||
sv_pr_state.pr_global_struct->PlayerPreThink);
|
((globalvars_t*)sv_pr_state.pr_globals)->PlayerPreThink);
|
||||||
|
|
||||||
SV_RunThink (sv_player);
|
SV_RunThink (sv_player);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
pmove.origin[i] =
|
pmove.origin[i] =
|
||||||
sv_player->v.v.origin[i]
|
((entvars_t*)&sv_player->v)->origin[i]
|
||||||
+ (sv_player->v.v.mins[i] - player_mins[i]);
|
+ (((entvars_t*)&sv_player->v)->mins[i] - player_mins[i]);
|
||||||
VectorCopy (sv_player->v.v.velocity, pmove.velocity);
|
VectorCopy (((entvars_t*)&sv_player->v)->velocity, pmove.velocity);
|
||||||
VectorCopy (sv_player->v.v.v_angle, pmove.angles);
|
VectorCopy (((entvars_t*)&sv_player->v)->v_angle, pmove.angles);
|
||||||
|
|
||||||
pmove.flying = sv_player->v.v.movetype == MOVETYPE_FLY;
|
pmove.flying = ((entvars_t*)&sv_player->v)->movetype == MOVETYPE_FLY;
|
||||||
pmove.spectator = host_client->spectator;
|
pmove.spectator = host_client->spectator;
|
||||||
pmove.waterjumptime = sv_player->v.v.teleport_time;
|
pmove.waterjumptime = ((entvars_t*)&sv_player->v)->teleport_time;
|
||||||
pmove.numphysent = 1;
|
pmove.numphysent = 1;
|
||||||
pmove.physents[0].model = sv.worldmodel;
|
pmove.physents[0].model = sv.worldmodel;
|
||||||
pmove.cmd = *ucmd;
|
pmove.cmd = *ucmd;
|
||||||
pmove.dead = sv_player->v.v.health <= 0;
|
pmove.dead = ((entvars_t*)&sv_player->v)->health <= 0;
|
||||||
pmove.oldbuttons = host_client->oldbuttons;
|
pmove.oldbuttons = host_client->oldbuttons;
|
||||||
|
|
||||||
movevars.entgravity = host_client->entgravity;
|
movevars.entgravity = host_client->entgravity;
|
||||||
|
@ -1532,7 +1533,7 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
|
||||||
PlayerMove ();
|
PlayerMove ();
|
||||||
after = PM_TestPlayerPosition (pmove.origin);
|
after = PM_TestPlayerPosition (pmove.origin);
|
||||||
|
|
||||||
if (sv_player->v.v.health > 0 && before && !after)
|
if (((entvars_t*)&sv_player->v)->health > 0 && before && !after)
|
||||||
Con_Printf ("player %s got stuck in playermove!!!!\n",
|
Con_Printf ("player %s got stuck in playermove!!!!\n",
|
||||||
host_client->name);
|
host_client->name);
|
||||||
}
|
}
|
||||||
|
@ -1541,29 +1542,29 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
host_client->oldbuttons = pmove.oldbuttons;
|
host_client->oldbuttons = pmove.oldbuttons;
|
||||||
sv_player->v.v.teleport_time = pmove.waterjumptime;
|
((entvars_t*)&sv_player->v)->teleport_time = pmove.waterjumptime;
|
||||||
sv_player->v.v.waterlevel = waterlevel;
|
((entvars_t*)&sv_player->v)->waterlevel = waterlevel;
|
||||||
sv_player->v.v.watertype = watertype;
|
((entvars_t*)&sv_player->v)->watertype = watertype;
|
||||||
if (onground != -1) {
|
if (onground != -1) {
|
||||||
sv_player->v.v.flags = (int) sv_player->v.v.flags | FL_ONGROUND;
|
((entvars_t*)&sv_player->v)->flags = (int) ((entvars_t*)&sv_player->v)->flags | FL_ONGROUND;
|
||||||
sv_player->v.v.groundentity =
|
((entvars_t*)&sv_player->v)->groundentity =
|
||||||
EDICT_TO_PROG (&sv_pr_state, EDICT_NUM (&sv_pr_state, pmove.physents[onground].info));
|
EDICT_TO_PROG (&sv_pr_state, EDICT_NUM (&sv_pr_state, pmove.physents[onground].info));
|
||||||
} else {
|
} else {
|
||||||
sv_player->v.v.flags = (int) sv_player->v.v.flags & ~FL_ONGROUND;
|
((entvars_t*)&sv_player->v)->flags = (int) ((entvars_t*)&sv_player->v)->flags & ~FL_ONGROUND;
|
||||||
}
|
}
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
sv_player->v.v.origin[i] =
|
((entvars_t*)&sv_player->v)->origin[i] =
|
||||||
pmove.origin[i] - (sv_player->v.v.mins[i] - player_mins[i]);
|
pmove.origin[i] - (((entvars_t*)&sv_player->v)->mins[i] - player_mins[i]);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// truncate velocity the same way the net protocol will
|
// truncate velocity the same way the net protocol will
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
sv_player->v.v.velocity[i] = (int) pmove.velocity[i];
|
((entvars_t*)&sv_player->v)->velocity[i] = (int) pmove.velocity[i];
|
||||||
#else
|
#else
|
||||||
VectorCopy (pmove.velocity, sv_player->v.v.velocity);
|
VectorCopy (pmove.velocity, ((entvars_t*)&sv_player->v)->velocity);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VectorCopy (pmove.angles, sv_player->v.v.v_angle);
|
VectorCopy (pmove.angles, ((entvars_t*)&sv_player->v)->v_angle);
|
||||||
|
|
||||||
if (!host_client->spectator) {
|
if (!host_client->spectator) {
|
||||||
// link into place and touch triggers
|
// link into place and touch triggers
|
||||||
|
@ -1573,11 +1574,11 @@ SV_RunCmd (usercmd_t *ucmd, qboolean inside)
|
||||||
for (i = 0; i < pmove.numtouch; i++) {
|
for (i = 0; i < pmove.numtouch; i++) {
|
||||||
n = pmove.physents[pmove.touchindex[i]].info;
|
n = pmove.physents[pmove.touchindex[i]].info;
|
||||||
ent = EDICT_NUM (&sv_pr_state, n);
|
ent = EDICT_NUM (&sv_pr_state, n);
|
||||||
if (!ent->v.v.touch || (playertouch[n / 8] & (1 << (n % 8))))
|
if (!((entvars_t*)&ent->v)->touch || (playertouch[n / 8] & (1 << (n % 8))))
|
||||||
continue;
|
continue;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, ent);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, ent);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, sv_player);
|
||||||
PR_ExecuteProgram (&sv_pr_state, ent->v.v.touch);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&ent->v)->touch);
|
||||||
playertouch[n / 8] |= 1 << (n % 8);
|
playertouch[n / 8] |= 1 << (n % 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1594,15 +1595,15 @@ SV_PostRunCmd (void)
|
||||||
// run post-think
|
// run post-think
|
||||||
|
|
||||||
if (!host_client->spectator) {
|
if (!host_client->spectator) {
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state,
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state,
|
||||||
sv_player);
|
sv_player);
|
||||||
PR_ExecuteProgram (&sv_pr_state,
|
PR_ExecuteProgram (&sv_pr_state,
|
||||||
sv_pr_state.pr_global_struct->PlayerPostThink);
|
((globalvars_t*)sv_pr_state.pr_globals)->PlayerPostThink);
|
||||||
SV_RunNewmis ();
|
SV_RunNewmis ();
|
||||||
} else if (SpectatorThink) {
|
} else if (SpectatorThink) {
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state,
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state,
|
||||||
sv_player);
|
sv_player);
|
||||||
PR_ExecuteProgram (&sv_pr_state, SpectatorThink);
|
PR_ExecuteProgram (&sv_pr_state, SpectatorThink);
|
||||||
}
|
}
|
||||||
|
@ -1745,7 +1746,7 @@ SV_ExecuteClientMessage (client_t *cl)
|
||||||
o[2] = MSG_ReadCoord (net_message);
|
o[2] = MSG_ReadCoord (net_message);
|
||||||
// only allowed by spectators
|
// only allowed by spectators
|
||||||
if (host_client->spectator) {
|
if (host_client->spectator) {
|
||||||
VectorCopy (o, sv_player->v.v.origin);
|
VectorCopy (o, ((entvars_t*)&sv_player->v)->origin);
|
||||||
SV_LinkEdict (sv_player, false);
|
SV_LinkEdict (sv_player, false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,6 +41,7 @@
|
||||||
#include "commdef.h"
|
#include "commdef.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
|
#include "progdefs.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
|
||||||
|
@ -150,12 +151,12 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
||||||
hull_t *hull;
|
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.v.solid == SOLID_BSP) {
|
if (((entvars_t*)&ent->v)->solid == SOLID_BSP) {
|
||||||
// explicit hulls in the BSP model
|
// explicit hulls in the BSP model
|
||||||
if (ent->v.v.movetype != MOVETYPE_PUSH)
|
if (((entvars_t*)&ent->v)->movetype != MOVETYPE_PUSH)
|
||||||
SV_Error ("SOLID_BSP without MOVETYPE_PUSH");
|
SV_Error ("SOLID_BSP without MOVETYPE_PUSH");
|
||||||
|
|
||||||
model = sv.models[(int) ent->v.v.modelindex];
|
model = sv.models[(int) ((entvars_t*)&ent->v)->modelindex];
|
||||||
|
|
||||||
if (!model || model->type != mod_brush)
|
if (!model || model->type != mod_brush)
|
||||||
SV_Error ("SOLID_BSP with a non bsp model");
|
SV_Error ("SOLID_BSP with a non bsp model");
|
||||||
|
@ -170,15 +171,15 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
||||||
|
|
||||||
// calculate an offset value to center the origin
|
// calculate an offset value to center the origin
|
||||||
VectorSubtract (hull->clip_mins, mins, offset);
|
VectorSubtract (hull->clip_mins, mins, offset);
|
||||||
VectorAdd (offset, ent->v.v.origin, offset);
|
VectorAdd (offset, ((entvars_t*)&ent->v)->origin, offset);
|
||||||
} else { // create a temp hull from bounding
|
} else { // create a temp hull from bounding
|
||||||
// box sizes
|
// box sizes
|
||||||
|
|
||||||
VectorSubtract (ent->v.v.mins, maxs, hullmins);
|
VectorSubtract (((entvars_t*)&ent->v)->mins, maxs, hullmins);
|
||||||
VectorSubtract (ent->v.v.maxs, mins, hullmaxs);
|
VectorSubtract (((entvars_t*)&ent->v)->maxs, mins, hullmaxs);
|
||||||
hull = SV_HullForBox (hullmins, hullmaxs);
|
hull = SV_HullForBox (hullmins, hullmaxs);
|
||||||
|
|
||||||
VectorCopy (ent->v.v.origin, offset);
|
VectorCopy (((entvars_t*)&ent->v)->origin, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -278,35 +279,35 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
|
||||||
touch = EDICT_FROM_AREA (l);
|
touch = EDICT_FROM_AREA (l);
|
||||||
if (touch == ent)
|
if (touch == ent)
|
||||||
continue;
|
continue;
|
||||||
if (!touch->v.v.touch || touch->v.v.solid != SOLID_TRIGGER)
|
if (!((entvars_t*)&touch->v)->touch || ((entvars_t*)&touch->v)->solid != SOLID_TRIGGER)
|
||||||
continue;
|
continue;
|
||||||
if (ent->v.v.absmin[0] > touch->v.v.absmax[0]
|
if (((entvars_t*)&ent->v)->absmin[0] > ((entvars_t*)&touch->v)->absmax[0]
|
||||||
|| ent->v.v.absmin[1] > touch->v.v.absmax[1]
|
|| ((entvars_t*)&ent->v)->absmin[1] > ((entvars_t*)&touch->v)->absmax[1]
|
||||||
|| ent->v.v.absmin[2] > touch->v.v.absmax[2]
|
|| ((entvars_t*)&ent->v)->absmin[2] > ((entvars_t*)&touch->v)->absmax[2]
|
||||||
|| ent->v.v.absmax[0] < touch->v.v.absmin[0]
|
|| ((entvars_t*)&ent->v)->absmax[0] < ((entvars_t*)&touch->v)->absmin[0]
|
||||||
|| ent->v.v.absmax[1] < touch->v.v.absmin[1]
|
|| ((entvars_t*)&ent->v)->absmax[1] < ((entvars_t*)&touch->v)->absmin[1]
|
||||||
|| ent->v.v.absmax[2] < touch->v.v.absmin[2])
|
|| ((entvars_t*)&ent->v)->absmax[2] < ((entvars_t*)&touch->v)->absmin[2])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
old_self = sv_pr_state.pr_global_struct->self;
|
old_self = ((globalvars_t*)sv_pr_state.pr_globals)->self;
|
||||||
old_other = sv_pr_state.pr_global_struct->other;
|
old_other = ((globalvars_t*)sv_pr_state.pr_globals)->other;
|
||||||
|
|
||||||
sv_pr_state.pr_global_struct->self = EDICT_TO_PROG (&sv_pr_state, touch);
|
((globalvars_t*)sv_pr_state.pr_globals)->self = EDICT_TO_PROG (&sv_pr_state, touch);
|
||||||
sv_pr_state.pr_global_struct->other = EDICT_TO_PROG (&sv_pr_state, ent);
|
((globalvars_t*)sv_pr_state.pr_globals)->other = EDICT_TO_PROG (&sv_pr_state, ent);
|
||||||
sv_pr_state.pr_global_struct->time = sv.time;
|
((globalvars_t*)sv_pr_state.pr_globals)->time = sv.time;
|
||||||
PR_ExecuteProgram (&sv_pr_state, touch->v.v.touch);
|
PR_ExecuteProgram (&sv_pr_state, ((entvars_t*)&touch->v)->touch);
|
||||||
|
|
||||||
sv_pr_state.pr_global_struct->self = old_self;
|
((globalvars_t*)sv_pr_state.pr_globals)->self = old_self;
|
||||||
sv_pr_state.pr_global_struct->other = old_other;
|
((globalvars_t*)sv_pr_state.pr_globals)->other = old_other;
|
||||||
}
|
}
|
||||||
|
|
||||||
// recurse down both sides
|
// recurse down both sides
|
||||||
if (node->axis == -1)
|
if (node->axis == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ent->v.v.absmax[node->axis] > node->dist)
|
if (((entvars_t*)&ent->v)->absmax[node->axis] > node->dist)
|
||||||
SV_TouchLinks (ent, node->children[0]);
|
SV_TouchLinks (ent, node->children[0]);
|
||||||
if (ent->v.v.absmin[node->axis] < node->dist)
|
if (((entvars_t*)&ent->v)->absmin[node->axis] < node->dist)
|
||||||
SV_TouchLinks (ent, node->children[1]);
|
SV_TouchLinks (ent, node->children[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +342,7 @@ SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
|
||||||
// NODE_MIXED
|
// NODE_MIXED
|
||||||
|
|
||||||
splitplane = node->plane;
|
splitplane = node->plane;
|
||||||
sides = BOX_ON_PLANE_SIDE (ent->v.v.absmin, ent->v.v.absmax, splitplane);
|
sides = BOX_ON_PLANE_SIDE (((entvars_t*)&ent->v)->absmin, ((entvars_t*)&ent->v)->absmax, splitplane);
|
||||||
|
|
||||||
// recurse down the contacted sides
|
// recurse down the contacted sides
|
||||||
if (sides & 1)
|
if (sides & 1)
|
||||||
|
@ -369,35 +370,35 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// set the abs box
|
// set the abs box
|
||||||
VectorAdd (ent->v.v.origin, ent->v.v.mins, ent->v.v.absmin);
|
VectorAdd (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->absmin);
|
||||||
VectorAdd (ent->v.v.origin, ent->v.v.maxs, ent->v.v.absmax);
|
VectorAdd (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->maxs, ((entvars_t*)&ent->v)->absmax);
|
||||||
|
|
||||||
//
|
//
|
||||||
// to make items easier to pick up and allow them to be grabbed off
|
// to make items easier to pick up and allow them to be grabbed off
|
||||||
// of shelves, the abs sizes are expanded
|
// of shelves, the abs sizes are expanded
|
||||||
//
|
//
|
||||||
if ((int) ent->v.v.flags & FL_ITEM) {
|
if ((int) ((entvars_t*)&ent->v)->flags & FL_ITEM) {
|
||||||
ent->v.v.absmin[0] -= 15;
|
((entvars_t*)&ent->v)->absmin[0] -= 15;
|
||||||
ent->v.v.absmin[1] -= 15;
|
((entvars_t*)&ent->v)->absmin[1] -= 15;
|
||||||
ent->v.v.absmax[0] += 15;
|
((entvars_t*)&ent->v)->absmax[0] += 15;
|
||||||
ent->v.v.absmax[1] += 15;
|
((entvars_t*)&ent->v)->absmax[1] += 15;
|
||||||
} else { // because movement is clipped an
|
} else { // because movement is clipped an
|
||||||
// epsilon away from an actual edge,
|
// epsilon away from an actual edge,
|
||||||
// we must fully check even when bounding boxes don't quite touch
|
// we must fully check even when bounding boxes don't quite touch
|
||||||
ent->v.v.absmin[0] -= 1;
|
((entvars_t*)&ent->v)->absmin[0] -= 1;
|
||||||
ent->v.v.absmin[1] -= 1;
|
((entvars_t*)&ent->v)->absmin[1] -= 1;
|
||||||
ent->v.v.absmin[2] -= 1;
|
((entvars_t*)&ent->v)->absmin[2] -= 1;
|
||||||
ent->v.v.absmax[0] += 1;
|
((entvars_t*)&ent->v)->absmax[0] += 1;
|
||||||
ent->v.v.absmax[1] += 1;
|
((entvars_t*)&ent->v)->absmax[1] += 1;
|
||||||
ent->v.v.absmax[2] += 1;
|
((entvars_t*)&ent->v)->absmax[2] += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// link to PVS leafs
|
// link to PVS leafs
|
||||||
ent->num_leafs = 0;
|
ent->num_leafs = 0;
|
||||||
if (ent->v.v.modelindex)
|
if (((entvars_t*)&ent->v)->modelindex)
|
||||||
SV_FindTouchedLeafs (ent, sv.worldmodel->nodes);
|
SV_FindTouchedLeafs (ent, sv.worldmodel->nodes);
|
||||||
|
|
||||||
if (ent->v.v.solid == SOLID_NOT)
|
if (((entvars_t*)&ent->v)->solid == SOLID_NOT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// find the first node that the ent's box crosses
|
// find the first node that the ent's box crosses
|
||||||
|
@ -405,9 +406,9 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
|
||||||
while (1) {
|
while (1) {
|
||||||
if (node->axis == -1)
|
if (node->axis == -1)
|
||||||
break;
|
break;
|
||||||
if (ent->v.v.absmin[node->axis] > node->dist)
|
if (((entvars_t*)&ent->v)->absmin[node->axis] > node->dist)
|
||||||
node = node->children[0];
|
node = node->children[0];
|
||||||
else if (ent->v.v.absmax[node->axis] < node->dist)
|
else if (((entvars_t*)&ent->v)->absmax[node->axis] < node->dist)
|
||||||
node = node->children[1];
|
node = node->children[1];
|
||||||
else
|
else
|
||||||
break; // crosses the node
|
break; // crosses the node
|
||||||
|
@ -415,7 +416,7 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
|
||||||
|
|
||||||
// link it in
|
// link it in
|
||||||
|
|
||||||
if (ent->v.v.solid == SOLID_TRIGGER)
|
if (((entvars_t*)&ent->v)->solid == SOLID_TRIGGER)
|
||||||
InsertLinkBefore (&ent->area, &node->trigger_edicts);
|
InsertLinkBefore (&ent->area, &node->trigger_edicts);
|
||||||
else
|
else
|
||||||
InsertLinkBefore (&ent->area, &node->solid_edicts);
|
InsertLinkBefore (&ent->area, &node->solid_edicts);
|
||||||
|
@ -489,7 +490,7 @@ SV_TestEntityPosition (edict_t *ent)
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
|
|
||||||
trace =
|
trace =
|
||||||
SV_Move (ent->v.v.origin, ent->v.v.mins, ent->v.v.maxs, ent->v.v.origin, 0,
|
SV_Move (((entvars_t*)&ent->v)->origin, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, ((entvars_t*)&ent->v)->origin, 0,
|
||||||
ent);
|
ent);
|
||||||
|
|
||||||
if (trace.startsolid)
|
if (trace.startsolid)
|
||||||
|
@ -698,38 +699,38 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip)
|
||||||
for (l = node->solid_edicts.next; l != &node->solid_edicts; l = next) {
|
for (l = node->solid_edicts.next; l != &node->solid_edicts; l = next) {
|
||||||
next = l->next;
|
next = l->next;
|
||||||
touch = EDICT_FROM_AREA (l);
|
touch = EDICT_FROM_AREA (l);
|
||||||
if (touch->v.v.solid == SOLID_NOT)
|
if (((entvars_t*)&touch->v)->solid == SOLID_NOT)
|
||||||
continue;
|
continue;
|
||||||
if (touch == clip->passedict)
|
if (touch == clip->passedict)
|
||||||
continue;
|
continue;
|
||||||
if (touch->v.v.solid == SOLID_TRIGGER)
|
if (((entvars_t*)&touch->v)->solid == SOLID_TRIGGER)
|
||||||
SV_Error ("Trigger in clipping list");
|
SV_Error ("Trigger in clipping list");
|
||||||
|
|
||||||
if (clip->type == MOVE_NOMONSTERS && touch->v.v.solid != SOLID_BSP)
|
if (clip->type == MOVE_NOMONSTERS && ((entvars_t*)&touch->v)->solid != SOLID_BSP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (clip->boxmins[0] > touch->v.v.absmax[0]
|
if (clip->boxmins[0] > ((entvars_t*)&touch->v)->absmax[0]
|
||||||
|| clip->boxmins[1] > touch->v.v.absmax[1]
|
|| clip->boxmins[1] > ((entvars_t*)&touch->v)->absmax[1]
|
||||||
|| clip->boxmins[2] > touch->v.v.absmax[2]
|
|| clip->boxmins[2] > ((entvars_t*)&touch->v)->absmax[2]
|
||||||
|| clip->boxmaxs[0] < touch->v.v.absmin[0]
|
|| clip->boxmaxs[0] < ((entvars_t*)&touch->v)->absmin[0]
|
||||||
|| clip->boxmaxs[1] < touch->v.v.absmin[1]
|
|| clip->boxmaxs[1] < ((entvars_t*)&touch->v)->absmin[1]
|
||||||
|| clip->boxmaxs[2] < touch->v.v.absmin[2])
|
|| clip->boxmaxs[2] < ((entvars_t*)&touch->v)->absmin[2])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (clip->passedict != 0 && clip->passedict->v.v.size[0]
|
if (clip->passedict != 0 && ((entvars_t*)&clip->passedict->v)->size[0]
|
||||||
&& !touch->v.v.size[0]) continue; // points never interact
|
&& !((entvars_t*)&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)
|
if (clip->trace.allsolid)
|
||||||
return;
|
return;
|
||||||
if (clip->passedict) {
|
if (clip->passedict) {
|
||||||
if (PROG_TO_EDICT (&sv_pr_state, touch->v.v.owner) == clip->passedict)
|
if (PROG_TO_EDICT (&sv_pr_state, ((entvars_t*)&touch->v)->owner) == clip->passedict)
|
||||||
continue; // don't clip against own missiles
|
continue; // don't clip against own missiles
|
||||||
if (PROG_TO_EDICT (&sv_pr_state, clip->passedict->v.v.owner) == touch)
|
if (PROG_TO_EDICT (&sv_pr_state, ((entvars_t*)&clip->passedict->v)->owner) == touch)
|
||||||
continue; // don't clip against owner
|
continue; // don't clip against owner
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((int) touch->v.v.flags & FL_MONSTER)
|
if ((int) ((entvars_t*)&touch->v)->flags & FL_MONSTER)
|
||||||
trace =
|
trace =
|
||||||
SV_ClipMoveToEntity (touch, clip->start, clip->mins2,
|
SV_ClipMoveToEntity (touch, clip->start, clip->mins2,
|
||||||
clip->maxs2, clip->end);
|
clip->maxs2, clip->end);
|
||||||
|
@ -848,30 +849,30 @@ SV_TestPlayerPosition (edict_t *ent, vec3_t origin)
|
||||||
CONTENTS_EMPTY) return sv.edicts;
|
CONTENTS_EMPTY) return sv.edicts;
|
||||||
|
|
||||||
// check all entities
|
// check all entities
|
||||||
VectorAdd (origin, ent->v.v.mins, boxmins);
|
VectorAdd (origin, ((entvars_t*)&ent->v)->mins, boxmins);
|
||||||
VectorAdd (origin, ent->v.v.maxs, boxmaxs);
|
VectorAdd (origin, ((entvars_t*)&ent->v)->maxs, boxmaxs);
|
||||||
|
|
||||||
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||||
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
for (e = 1; e < sv.num_edicts; e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
if (check->free)
|
if (check->free)
|
||||||
continue;
|
continue;
|
||||||
if (check->v.v.solid != SOLID_BSP &&
|
if (((entvars_t*)&check->v)->solid != SOLID_BSP &&
|
||||||
check->v.v.solid != SOLID_BBOX && check->v.v.solid != SOLID_SLIDEBOX)
|
((entvars_t*)&check->v)->solid != SOLID_BBOX && ((entvars_t*)&check->v)->solid != SOLID_SLIDEBOX)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (boxmins[0] > check->v.v.absmax[0]
|
if (boxmins[0] > ((entvars_t*)&check->v)->absmax[0]
|
||||||
|| boxmins[1] > check->v.v.absmax[1]
|
|| boxmins[1] > ((entvars_t*)&check->v)->absmax[1]
|
||||||
|| boxmins[2] > check->v.v.absmax[2]
|
|| boxmins[2] > ((entvars_t*)&check->v)->absmax[2]
|
||||||
|| boxmaxs[0] < check->v.v.absmin[0]
|
|| boxmaxs[0] < ((entvars_t*)&check->v)->absmin[0]
|
||||||
|| boxmaxs[1] < check->v.v.absmin[1]
|
|| boxmaxs[1] < ((entvars_t*)&check->v)->absmin[1]
|
||||||
|| boxmaxs[2] < check->v.v.absmin[2])
|
|| boxmaxs[2] < ((entvars_t*)&check->v)->absmin[2])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (check == ent)
|
if (check == ent)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// get the clipping hull
|
// get the clipping hull
|
||||||
hull = SV_HullForEntity (check, ent->v.v.mins, ent->v.v.maxs, offset);
|
hull = SV_HullForEntity (check, ((entvars_t*)&ent->v)->mins, ((entvars_t*)&ent->v)->maxs, offset);
|
||||||
|
|
||||||
VectorSubtract (origin, offset, offset);
|
VectorSubtract (origin, offset, offset);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue