mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 07:32:02 +00:00
[gamecode] Use unsigned for entity values
I don't know why they were ever signed (oversight at id and just propagated?). Anyway, this resulted in "unsigned" spreading a bit, but all to reasonable places.
This commit is contained in:
parent
2b82533526
commit
0bd05c71ac
28 changed files with 117 additions and 128 deletions
|
@ -276,8 +276,8 @@ void PR_BoundsCheck (progs_t *pr, int addr, etype_t type);
|
||||||
struct edict_s {
|
struct edict_s {
|
||||||
qboolean free;
|
qboolean free;
|
||||||
progs_t *pr; ///< progs owning this edict
|
progs_t *pr; ///< progs owning this edict
|
||||||
int entnum; ///< number of this entity
|
pr_uint_t entnum; ///< number of this entity
|
||||||
int edict; ///< offset of this entity in pr_edict_area
|
pr_uint_t edict; ///< offset of this entity in pr_edict_area
|
||||||
float freetime; ///< sv.time when the object was freed
|
float freetime; ///< sv.time when the object was freed
|
||||||
void *edata; ///< external per-edict data
|
void *edata; ///< external per-edict data
|
||||||
};
|
};
|
||||||
|
@ -286,8 +286,8 @@ struct edict_s {
|
||||||
void ED_ClearEdict (progs_t *pr, edict_t *e, int val);
|
void ED_ClearEdict (progs_t *pr, edict_t *e, int val);
|
||||||
edict_t *ED_Alloc (progs_t *pr);
|
edict_t *ED_Alloc (progs_t *pr);
|
||||||
void ED_Free (progs_t *pr, edict_t *ed);
|
void ED_Free (progs_t *pr, edict_t *ed);
|
||||||
edict_t *ED_EdictNum(progs_t *pr, pr_int_t n) __attribute__((pure));
|
edict_t *ED_EdictNum(progs_t *pr, pr_uint_t n) __attribute__((pure));
|
||||||
pr_int_t ED_NumForEdict(progs_t *pr, edict_t *e) __attribute__((pure));
|
pr_uint_t ED_NumForEdict(progs_t *pr, edict_t *e) __attribute__((pure));
|
||||||
void ED_Count (progs_t *pr);
|
void ED_Count (progs_t *pr);
|
||||||
qboolean PR_EdictValid (progs_t *pr, pr_uint_t e) __attribute__((pure));
|
qboolean PR_EdictValid (progs_t *pr, pr_uint_t e) __attribute__((pure));
|
||||||
|
|
||||||
|
@ -1896,9 +1896,9 @@ struct progs_s {
|
||||||
/// \todo FIXME should this be outside the VM?
|
/// \todo FIXME should this be outside the VM?
|
||||||
///@{
|
///@{
|
||||||
edict_t **pr_edicts;
|
edict_t **pr_edicts;
|
||||||
int max_edicts; ///< set by user
|
pr_uint_t max_edicts; ///< set by user
|
||||||
int *num_edicts;
|
pr_uint_t *num_edicts;
|
||||||
int *reserved_edicts; ///< alloc will start at reserved_edicts+1
|
pr_uint_t *reserved_edicts; ///< alloc will start at reserved_edicts+1
|
||||||
void (*unlink) (edict_t *ent);
|
void (*unlink) (edict_t *ent);
|
||||||
void (*flush) (void);
|
void (*flush) (void);
|
||||||
int (*prune_edict) (progs_t *pr, edict_t *ent);
|
int (*prune_edict) (progs_t *pr, edict_t *ent);
|
||||||
|
@ -1964,7 +1964,7 @@ struct progs_s {
|
||||||
struct {
|
struct {
|
||||||
double *dtime; ///< required for OP_STATE d
|
double *dtime; ///< required for OP_STATE d
|
||||||
float *ftime; ///< required for OP_STATE f
|
float *ftime; ///< required for OP_STATE f
|
||||||
pr_int_t *self; ///< required for OP_STATE
|
pr_uint_t *self; ///< required for OP_STATE
|
||||||
pointer_t *stack; ///< required for OP_(PUSH|POP)*
|
pointer_t *stack; ///< required for OP_(PUSH|POP)*
|
||||||
} globals;
|
} globals;
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -537,7 +537,7 @@ typedef union pr_type_u {
|
||||||
float float_var;
|
float float_var;
|
||||||
string_t string_var;
|
string_t string_var;
|
||||||
func_t func_var;
|
func_t func_var;
|
||||||
pr_int_t entity_var;
|
pr_uint_t entity_var;
|
||||||
float vector_var; // really [3], but this structure must be 32 bits
|
float vector_var; // really [3], but this structure must be 32 bits
|
||||||
float quat_var; // really [4], but this structure must be 32 bits
|
float quat_var; // really [4], but this structure must be 32 bits
|
||||||
pr_int_t integer_var;
|
pr_int_t integer_var;
|
||||||
|
|
|
@ -268,7 +268,7 @@ void NET_AddCachedHost (const char *name, const char *map, const char *cname,
|
||||||
|
|
||||||
extern double net_time;
|
extern double net_time;
|
||||||
extern struct msg_s *net_message;
|
extern struct msg_s *net_message;
|
||||||
extern int net_activeconnections;
|
extern unsigned net_activeconnections;
|
||||||
|
|
||||||
/** Initialize the networking sub-system.
|
/** Initialize the networking sub-system.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1266,7 +1266,7 @@ pr_debug_entity_view (qfot_type_t *type, pr_type_t *value, void *_data)
|
||||||
progs_t *pr = data->pr;
|
progs_t *pr = data->pr;
|
||||||
dstring_t *dstr = data->dstr;
|
dstring_t *dstr = data->dstr;
|
||||||
|
|
||||||
if (pr->pr_edicts && value->entity_var >= 0
|
if (pr->pr_edicts
|
||||||
&& value->entity_var < pr->max_edicts
|
&& value->entity_var < pr->max_edicts
|
||||||
&& !(value->entity_var % pr->pr_edict_size)) {
|
&& !(value->entity_var % pr->pr_edict_size)) {
|
||||||
edict_t *edict = PROG_TO_EDICT (pr, value->entity_var);
|
edict_t *edict = PROG_TO_EDICT (pr, value->entity_var);
|
||||||
|
|
|
@ -68,7 +68,7 @@ ED_ClearEdict (progs_t *pr, edict_t *e, int val)
|
||||||
VISIBLE edict_t *
|
VISIBLE edict_t *
|
||||||
ED_Alloc (progs_t *pr)
|
ED_Alloc (progs_t *pr)
|
||||||
{
|
{
|
||||||
pr_int_t i;
|
pr_uint_t i;
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
int start = pr->reserved_edicts ? *pr->reserved_edicts : 0;
|
int start = pr->reserved_edicts ? *pr->reserved_edicts : 0;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ ED_PrintNum (progs_t *pr, pr_int_t ent, const char *fieldname)
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
ED_PrintEdicts (progs_t *pr, const char *fieldval)
|
ED_PrintEdicts (progs_t *pr, const char *fieldval)
|
||||||
{
|
{
|
||||||
pr_int_t i;
|
pr_uint_t i;
|
||||||
int count;
|
int count;
|
||||||
pr_def_t *def;
|
pr_def_t *def;
|
||||||
|
|
||||||
|
@ -183,7 +183,6 @@ ED_PrintEdicts (progs_t *pr, const char *fieldval)
|
||||||
VISIBLE void
|
VISIBLE void
|
||||||
ED_Count (progs_t *pr)
|
ED_Count (progs_t *pr)
|
||||||
{
|
{
|
||||||
pr_int_t i;
|
|
||||||
int active, models, solid, step, zombie;
|
int active, models, solid, step, zombie;
|
||||||
pr_def_t *solid_def;
|
pr_def_t *solid_def;
|
||||||
pr_def_t *model_def;
|
pr_def_t *model_def;
|
||||||
|
@ -196,7 +195,7 @@ ED_Count (progs_t *pr)
|
||||||
solid_def = PR_FindField (pr, "solid");
|
solid_def = PR_FindField (pr, "solid");
|
||||||
model_def = PR_FindField (pr, "model");
|
model_def = PR_FindField (pr, "model");
|
||||||
active = models = solid = step = zombie = 0;
|
active = models = solid = step = zombie = 0;
|
||||||
for (i = 0; i < *pr->num_edicts; i++) {
|
for (pr_uint_t i = 0; i < *pr->num_edicts; i++) {
|
||||||
ent = EDICT_NUM (pr, i);
|
ent = EDICT_NUM (pr, i);
|
||||||
if (ent->free) {
|
if (ent->free) {
|
||||||
if (pr->globals.ftime && *pr->globals.ftime - ent->freetime <= 0.5)//FIXME double time
|
if (pr->globals.ftime && *pr->globals.ftime - ent->freetime <= 0.5)//FIXME double time
|
||||||
|
@ -218,22 +217,22 @@ ED_Count (progs_t *pr)
|
||||||
}
|
}
|
||||||
|
|
||||||
edict_t *
|
edict_t *
|
||||||
ED_EdictNum (progs_t *pr, pr_int_t n)
|
ED_EdictNum (progs_t *pr, pr_uint_t n)
|
||||||
{
|
{
|
||||||
if (n < 0 || n >= *pr->num_edicts)
|
if (n >= *pr->num_edicts)
|
||||||
PR_RunError (pr, "EDICT_NUM: bad number %d", n);
|
PR_RunError (pr, "EDICT_NUM: bad number %d", n);
|
||||||
|
|
||||||
return PR_edicts(pr) + n;
|
return PR_edicts(pr) + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_int_t
|
pr_uint_t
|
||||||
ED_NumForEdict (progs_t *pr, edict_t *e)
|
ED_NumForEdict (progs_t *pr, edict_t *e)
|
||||||
{
|
{
|
||||||
pr_int_t b;
|
pr_uint_t b;
|
||||||
|
|
||||||
b = NUM_FOR_BAD_EDICT (pr, e);
|
b = NUM_FOR_BAD_EDICT (pr, e);
|
||||||
|
|
||||||
if (b && (b < 0 || b >= *pr->num_edicts))
|
if (b && b >= *pr->num_edicts)
|
||||||
PR_RunError (pr, "NUM_FOR_EDICT: bad pointer %d %p %p", b, e,
|
PR_RunError (pr, "NUM_FOR_EDICT: bad pointer %d %p %p", b, e,
|
||||||
pr->pr_edicts);
|
pr->pr_edicts);
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ PR_ResolveGlobals (progs_t *pr)
|
||||||
if (!pr->globals.self) {
|
if (!pr->globals.self) {
|
||||||
if ((def = PR_FindGlobal (pr, ".self"))
|
if ((def = PR_FindGlobal (pr, ".self"))
|
||||||
|| (def = PR_FindGlobal (pr, "self")))
|
|| (def = PR_FindGlobal (pr, "self")))
|
||||||
pr->globals.self = &G_INT (pr, def->ofs);
|
pr->globals.self = &G_UINT (pr, def->ofs);
|
||||||
}
|
}
|
||||||
if (!pr->globals.stack) {
|
if (!pr->globals.stack) {
|
||||||
if ((def = PR_FindGlobal (pr, ".stack"))
|
if ((def = PR_FindGlobal (pr, ".stack"))
|
||||||
|
|
|
@ -78,7 +78,7 @@ PollProcedure slistPollProcedure = { NULL, 0.0, Slist_Poll };
|
||||||
static sizebuf_t _net_message_message;
|
static sizebuf_t _net_message_message;
|
||||||
static qmsg_t _net_message = { 0, 0, &_net_message_message };
|
static qmsg_t _net_message = { 0, 0, &_net_message_message };
|
||||||
qmsg_t *net_message = &_net_message;
|
qmsg_t *net_message = &_net_message;
|
||||||
int net_activeconnections = 0;
|
unsigned net_activeconnections = 0;
|
||||||
|
|
||||||
int messagesSent = 0;
|
int messagesSent = 0;
|
||||||
int messagesReceived = 0;
|
int messagesReceived = 0;
|
||||||
|
@ -197,7 +197,7 @@ NET_Listen_f (void)
|
||||||
static void
|
static void
|
||||||
MaxPlayers_f (void)
|
MaxPlayers_f (void)
|
||||||
{
|
{
|
||||||
int n;
|
unsigned n;
|
||||||
|
|
||||||
if (Cmd_Argc () != 2) {
|
if (Cmd_Argc () != 2) {
|
||||||
Sys_Printf ("\"maxplayers\" is \"%u\"\n", svs.maxclients);
|
Sys_Printf ("\"maxplayers\" is \"%u\"\n", svs.maxclients);
|
||||||
|
@ -710,7 +710,7 @@ int
|
||||||
NET_SendToAll (sizebuf_t *data, double blocktime)
|
NET_SendToAll (sizebuf_t *data, double blocktime)
|
||||||
{
|
{
|
||||||
double start;
|
double start;
|
||||||
int i;
|
unsigned i;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
qboolean state1[MAX_SCOREBOARD]; /* can we send */
|
qboolean state1[MAX_SCOREBOARD]; /* can we send */
|
||||||
qboolean state2[MAX_SCOREBOARD]; /* did we send */
|
qboolean state2[MAX_SCOREBOARD]; /* did we send */
|
||||||
|
|
|
@ -652,7 +652,7 @@ _Datagram_CheckNewConnections (void)
|
||||||
if (command == CCREQ_PLAYER_INFO) {
|
if (command == CCREQ_PLAYER_INFO) {
|
||||||
int playerNumber;
|
int playerNumber;
|
||||||
int activeNumber;
|
int activeNumber;
|
||||||
int clientNumber;
|
unsigned clientNumber;
|
||||||
client_t *client;
|
client_t *client;
|
||||||
|
|
||||||
playerNumber = MSG_ReadByte (net_message);
|
playerNumber = MSG_ReadByte (net_message);
|
||||||
|
|
|
@ -253,7 +253,7 @@ PF_Find (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s = 0, *t; // ev_string
|
const char *s = 0, *t; // ev_string
|
||||||
int i; // ev_vector
|
int i; // ev_vector
|
||||||
int e, f;
|
pr_uint_t e, f;
|
||||||
etype_t type;
|
etype_t type;
|
||||||
pr_def_t *field_def;
|
pr_def_t *field_def;
|
||||||
edict_t *ed;
|
edict_t *ed;
|
||||||
|
@ -394,7 +394,7 @@ PF_ceil (progs_t *pr)
|
||||||
static void
|
static void
|
||||||
PF_nextent (progs_t *pr)
|
PF_nextent (progs_t *pr)
|
||||||
{
|
{
|
||||||
int i;
|
pr_uint_t i;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
i = P_EDICTNUM (pr, 0);
|
i = P_EDICTNUM (pr, 0);
|
||||||
|
|
|
@ -44,8 +44,8 @@ extern progs_t sv_pr_state;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int maxclients;
|
unsigned maxclients;
|
||||||
int maxclientslimit;
|
unsigned maxclientslimit;
|
||||||
struct client_s *clients; // [maxclients]
|
struct client_s *clients; // [maxclients]
|
||||||
void (*phys_client) (struct edict_s *ent, int num);
|
void (*phys_client) (struct edict_s *ent, int num);
|
||||||
int serverflags; // episode completion information
|
int serverflags; // episode completion information
|
||||||
|
@ -75,7 +75,7 @@ typedef struct
|
||||||
struct model_s *models[MAX_MODELS];
|
struct model_s *models[MAX_MODELS];
|
||||||
const char *sound_precache[MAX_SOUNDS]; // NULL terminated
|
const char *sound_precache[MAX_SOUNDS]; // NULL terminated
|
||||||
const char *lightstyles[MAX_LIGHTSTYLES];
|
const char *lightstyles[MAX_LIGHTSTYLES];
|
||||||
int num_edicts;
|
unsigned num_edicts;
|
||||||
int max_edicts;
|
int max_edicts;
|
||||||
edict_t *edicts; // can NOT be array indexed, because
|
edict_t *edicts; // can NOT be array indexed, because
|
||||||
// edict_t is variable sized, but can
|
// edict_t is variable sized, but can
|
||||||
|
|
|
@ -38,9 +38,9 @@
|
||||||
#include "sv_pr_cmds.h"
|
#include "sv_pr_cmds.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
pr_int_t *self;
|
pr_uint_t *self;
|
||||||
pr_int_t *other;
|
pr_uint_t *other;
|
||||||
pr_int_t *world;
|
pr_uint_t *world;
|
||||||
float *time;
|
float *time;
|
||||||
float *frametime;
|
float *frametime;
|
||||||
float *force_retouch;
|
float *force_retouch;
|
||||||
|
@ -64,13 +64,13 @@ typedef struct {
|
||||||
vec3_t *trace_endpos;
|
vec3_t *trace_endpos;
|
||||||
vec3_t *trace_plane_normal;
|
vec3_t *trace_plane_normal;
|
||||||
float *trace_plane_dist;
|
float *trace_plane_dist;
|
||||||
pr_int_t *trace_ent;
|
pr_uint_t *trace_ent;
|
||||||
float *trace_inopen;
|
float *trace_inopen;
|
||||||
float *trace_inwater;
|
float *trace_inwater;
|
||||||
pr_int_t *msg_entity;
|
pr_uint_t *msg_entity;
|
||||||
string_t *null;
|
string_t *null;
|
||||||
|
|
||||||
pr_int_t *newmis;
|
pr_uint_t *newmis;
|
||||||
} sv_globals_t;
|
} sv_globals_t;
|
||||||
|
|
||||||
extern sv_globals_t sv_globals;
|
extern sv_globals_t sv_globals;
|
||||||
|
|
|
@ -323,7 +323,6 @@ void
|
||||||
SV_BroadcastPrintf (const char *fmt, ...)
|
SV_BroadcastPrintf (const char *fmt, ...)
|
||||||
{
|
{
|
||||||
static dstring_t *str;
|
static dstring_t *str;
|
||||||
int i;
|
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
if (!str)
|
if (!str)
|
||||||
|
@ -333,7 +332,7 @@ SV_BroadcastPrintf (const char *fmt, ...)
|
||||||
dvsprintf (str, fmt, argptr);
|
dvsprintf (str, fmt, argptr);
|
||||||
va_end (argptr);
|
va_end (argptr);
|
||||||
|
|
||||||
for (i = 0; i < svs.maxclients; i++)
|
for (unsigned i = 0; i < svs.maxclients; i++)
|
||||||
if (svs.clients[i].active && svs.clients[i].spawned) {
|
if (svs.clients[i].active && svs.clients[i].spawned) {
|
||||||
MSG_WriteByte (&svs.clients[i].message, svc_print);
|
MSG_WriteByte (&svs.clients[i].message, svc_print);
|
||||||
MSG_WriteString (&svs.clients[i].message, str->str);
|
MSG_WriteString (&svs.clients[i].message, str->str);
|
||||||
|
@ -372,7 +371,8 @@ void
|
||||||
SV_DropClient (qboolean crash)
|
SV_DropClient (qboolean crash)
|
||||||
{
|
{
|
||||||
client_t *client;
|
client_t *client;
|
||||||
int saveSelf, i;
|
unsigned i;
|
||||||
|
pr_uint_t saveSelf;
|
||||||
|
|
||||||
if (!crash) {
|
if (!crash) {
|
||||||
// send any final messages (don't check for errors)
|
// send any final messages (don't check for errors)
|
||||||
|
@ -406,7 +406,8 @@ SV_DropClient (qboolean crash)
|
||||||
net_activeconnections--;
|
net_activeconnections--;
|
||||||
|
|
||||||
// send notification to all clients
|
// send notification to all clients
|
||||||
for (i = 0, client = svs.clients; i < svs.maxclients; i++, client++) {
|
for (i = 0, client = svs.clients; i < svs.maxclients;
|
||||||
|
i++, client++) {
|
||||||
if (!client->active)
|
if (!client->active)
|
||||||
continue;
|
continue;
|
||||||
MSG_WriteByte (&client->message, svc_updatename);
|
MSG_WriteByte (&client->message, svc_updatename);
|
||||||
|
@ -431,7 +432,7 @@ Host_ShutdownServer (qboolean crash)
|
||||||
{
|
{
|
||||||
byte message[4];
|
byte message[4];
|
||||||
double start;
|
double start;
|
||||||
int count, i;
|
unsigned count, i;
|
||||||
sizebuf_t buf;
|
sizebuf_t buf;
|
||||||
|
|
||||||
if (!sv.active)
|
if (!sv.active)
|
||||||
|
@ -711,7 +712,7 @@ Host_Frame (float time)
|
||||||
{
|
{
|
||||||
double time1, time2;
|
double time1, time2;
|
||||||
static double timetotal;
|
static double timetotal;
|
||||||
int i, c, m;
|
int c, m;
|
||||||
static int timecount;
|
static int timecount;
|
||||||
|
|
||||||
if (!serverprofile->int_val) {
|
if (!serverprofile->int_val) {
|
||||||
|
@ -733,7 +734,7 @@ Host_Frame (float time)
|
||||||
timecount = 0;
|
timecount = 0;
|
||||||
timetotal = 0;
|
timetotal = 0;
|
||||||
c = 0;
|
c = 0;
|
||||||
for (i = 0; i < svs.maxclients; i++) {
|
for (unsigned i = 0; i < svs.maxclients; i++) {
|
||||||
if (svs.clients[i].active)
|
if (svs.clients[i].active)
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ Host_Status_f (void)
|
||||||
int seconds;
|
int seconds;
|
||||||
int minutes;
|
int minutes;
|
||||||
int hours = 0;
|
int hours = 0;
|
||||||
int j;
|
unsigned j;
|
||||||
__attribute__((format(PRINTF, 1, 2))) void (*print) (const char *fmt, ...);
|
__attribute__((format(PRINTF, 1, 2))) void (*print) (const char *fmt, ...);
|
||||||
|
|
||||||
if (cmd_source == src_command) {
|
if (cmd_source == src_command) {
|
||||||
|
@ -210,7 +210,7 @@ Host_Fly_f (void)
|
||||||
static void
|
static void
|
||||||
Host_Ping_f (void)
|
Host_Ping_f (void)
|
||||||
{
|
{
|
||||||
int i, j;
|
unsigned i, j;
|
||||||
float total;
|
float total;
|
||||||
client_t *client;
|
client_t *client;
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ static plitem_t *
|
||||||
entities_array (void)
|
entities_array (void)
|
||||||
{
|
{
|
||||||
plitem_t *entities = PL_NewArray ();
|
plitem_t *entities = PL_NewArray ();
|
||||||
int i;
|
pr_uint_t i;
|
||||||
|
|
||||||
for (i = 0; i < sv.num_edicts; i++) {
|
for (i = 0; i < sv.num_edicts; i++) {
|
||||||
PL_A_AddObject (entities,
|
PL_A_AddObject (entities,
|
||||||
|
@ -517,7 +517,6 @@ Host_Savegame_f (void)
|
||||||
const char *save_name;
|
const char *save_name;
|
||||||
char *save_text;
|
char *save_text;
|
||||||
QFile *f;
|
QFile *f;
|
||||||
int i;
|
|
||||||
char *bup1, *bup2 = 0;
|
char *bup1, *bup2 = 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -549,7 +548,7 @@ Host_Savegame_f (void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < svs.maxclients; i++) {
|
for (unsigned i = 0; i < svs.maxclients; i++) {
|
||||||
if (svs.clients[i].active && (SVfloat (svs.clients[i].edict, health)
|
if (svs.clients[i].active && (SVfloat (svs.clients[i].edict, health)
|
||||||
<= 0)) {
|
<= 0)) {
|
||||||
Sys_Printf ("Can't savegame with a dead player\n");
|
Sys_Printf ("Can't savegame with a dead player\n");
|
||||||
|
@ -562,7 +561,7 @@ Host_Savegame_f (void)
|
||||||
if (strcmp (save_name, "quick") == 0) {
|
if (strcmp (save_name, "quick") == 0) {
|
||||||
bup2 = nva ("%s/%s%d.sav", qfs_gamedir->dir.def, save_name, MAX_QUICK);
|
bup2 = nva ("%s/%s%d.sav", qfs_gamedir->dir.def, save_name, MAX_QUICK);
|
||||||
QFS_Remove (bup2);
|
QFS_Remove (bup2);
|
||||||
for (i = MAX_QUICK - 1; i > 0; i--) {
|
for (int i = MAX_QUICK - 1; i > 0; i--) {
|
||||||
bup1 = nva ("%s/%s%d.sav", qfs_gamedir->dir.def, save_name, i);
|
bup1 = nva ("%s/%s%d.sav", qfs_gamedir->dir.def, save_name, i);
|
||||||
QFS_Rename (bup1, bup2);
|
QFS_Rename (bup1, bup2);
|
||||||
free (bup2);
|
free (bup2);
|
||||||
|
@ -783,7 +782,7 @@ Host_Say (qboolean teamonly)
|
||||||
{
|
{
|
||||||
client_t *client;
|
client_t *client;
|
||||||
client_t *save;
|
client_t *save;
|
||||||
int j;
|
unsigned j;
|
||||||
char *p;
|
char *p;
|
||||||
char text[64];
|
char text[64];
|
||||||
qboolean fromServer = false;
|
qboolean fromServer = false;
|
||||||
|
@ -817,7 +816,7 @@ Host_Say (qboolean teamonly)
|
||||||
snprintf (text, sizeof (text), "%c<%s> ", 1, hostname->string);
|
snprintf (text, sizeof (text), "%c<%s> ", 1, hostname->string);
|
||||||
|
|
||||||
j = sizeof (text) - 2 - strlen (text); // -2 for /n and null terminator
|
j = sizeof (text) - 2 - strlen (text); // -2 for /n and null terminator
|
||||||
if ((int) strlen (p) > j)
|
if (strlen (p) > j)
|
||||||
p[j] = 0;
|
p[j] = 0;
|
||||||
|
|
||||||
strcat (text, p);
|
strcat (text, p);
|
||||||
|
@ -854,7 +853,7 @@ Host_Tell_f (void)
|
||||||
{
|
{
|
||||||
client_t *client;
|
client_t *client;
|
||||||
client_t *save;
|
client_t *save;
|
||||||
int j;
|
unsigned j;
|
||||||
char *p;
|
char *p;
|
||||||
char text[64];
|
char text[64];
|
||||||
|
|
||||||
|
@ -879,7 +878,7 @@ Host_Tell_f (void)
|
||||||
}
|
}
|
||||||
// check length & truncate if necessary
|
// check length & truncate if necessary
|
||||||
j = sizeof (text) - 2 - strlen (text); // -2 for /n and null terminator
|
j = sizeof (text) - 2 - strlen (text); // -2 for /n and null terminator
|
||||||
if ((int) strlen (p) > j)
|
if (strlen (p) > j)
|
||||||
p[j] = 0;
|
p[j] = 0;
|
||||||
|
|
||||||
strcat (text, p);
|
strcat (text, p);
|
||||||
|
@ -969,7 +968,7 @@ Host_PreSpawn_f (void)
|
||||||
static void
|
static void
|
||||||
Host_Spawn_f (void)
|
Host_Spawn_f (void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
client_t *client;
|
client_t *client;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
float *sendangles;
|
float *sendangles;
|
||||||
|
@ -1099,7 +1098,7 @@ Host_Kick_f (void)
|
||||||
const char *who;
|
const char *who;
|
||||||
const char *message = NULL;
|
const char *message = NULL;
|
||||||
client_t *save;
|
client_t *save;
|
||||||
int i;
|
unsigned i;
|
||||||
qboolean byNumber = false;
|
qboolean byNumber = false;
|
||||||
|
|
||||||
if (cmd_source == src_command) {
|
if (cmd_source == src_command) {
|
||||||
|
@ -1115,7 +1114,7 @@ Host_Kick_f (void)
|
||||||
|
|
||||||
if (Cmd_Argc () > 2 && strcmp (Cmd_Argv (1), "#") == 0) {
|
if (Cmd_Argc () > 2 && strcmp (Cmd_Argv (1), "#") == 0) {
|
||||||
i = atof (Cmd_Argv (2)) - 1;
|
i = atof (Cmd_Argv (2)) - 1;
|
||||||
if (i < 0 || i >= svs.maxclients)
|
if (i >= svs.maxclients)
|
||||||
return;
|
return;
|
||||||
if (!svs.clients[i].active)
|
if (!svs.clients[i].active)
|
||||||
return;
|
return;
|
||||||
|
@ -1291,7 +1290,7 @@ Host_Give_f (void)
|
||||||
static edict_t *
|
static edict_t *
|
||||||
FindViewthing (void)
|
FindViewthing (void)
|
||||||
{
|
{
|
||||||
int i;
|
pr_uint_t i;
|
||||||
edict_t *e;
|
edict_t *e;
|
||||||
|
|
||||||
for (i = 0; i < sv.num_edicts; i++) {
|
for (i = 0; i < sv.num_edicts; i++) {
|
||||||
|
|
|
@ -351,7 +351,7 @@ SV_ConnectClient (int clientnum)
|
||||||
void
|
void
|
||||||
SV_CheckForNewClients (void)
|
SV_CheckForNewClients (void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
struct qsocket_s *ret;
|
struct qsocket_s *ret;
|
||||||
|
|
||||||
// check for new connections
|
// check for new connections
|
||||||
|
@ -443,7 +443,7 @@ SV_FatPVS (vec3_t org)
|
||||||
static void
|
static void
|
||||||
SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
||||||
{
|
{
|
||||||
int bits, e, i;
|
pr_uint_t bits, e;
|
||||||
set_t *pvs;
|
set_t *pvs;
|
||||||
float miss;
|
float miss;
|
||||||
vec3_t org;
|
vec3_t org;
|
||||||
|
@ -489,7 +489,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
||||||
bits = 0;
|
bits = 0;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
miss = SVvector (ent, origin)[i] - baseline->origin[i];
|
miss = SVvector (ent, origin)[i] - baseline->origin[i];
|
||||||
if (miss < -0.1 || miss > 0.1)
|
if (miss < -0.1 || miss > 0.1)
|
||||||
bits |= U_ORIGIN1 << i;
|
bits |= U_ORIGIN1 << i;
|
||||||
|
@ -603,7 +603,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
||||||
static void
|
static void
|
||||||
SV_CleanupEnts (void)
|
SV_CleanupEnts (void)
|
||||||
{
|
{
|
||||||
int e;
|
pr_uint_t e;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
ent = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
ent = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||||
|
@ -826,7 +826,7 @@ SV_SendClientDatagram (client_t *client)
|
||||||
static void
|
static void
|
||||||
SV_UpdateToReliableMessages (void)
|
SV_UpdateToReliableMessages (void)
|
||||||
{
|
{
|
||||||
int i, j;
|
unsigned i, j;
|
||||||
client_t *client;
|
client_t *client;
|
||||||
|
|
||||||
// check for changes to be sent over the reliable streams
|
// check for changes to be sent over the reliable streams
|
||||||
|
@ -884,7 +884,7 @@ SV_SendNop (client_t *client)
|
||||||
void
|
void
|
||||||
SV_SendClientMessages (void)
|
SV_SendClientMessages (void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
// update frags, names, etc
|
// update frags, names, etc
|
||||||
SV_UpdateToReliableMessages ();
|
SV_UpdateToReliableMessages ();
|
||||||
|
@ -964,7 +964,7 @@ SV_ModelIndex (const char *name)
|
||||||
static void
|
static void
|
||||||
SV_CreateBaseline (void)
|
SV_CreateBaseline (void)
|
||||||
{
|
{
|
||||||
int entnum;
|
pr_uint_t entnum;
|
||||||
edict_t *svent;
|
edict_t *svent;
|
||||||
entity_state_t *baseline;
|
entity_state_t *baseline;
|
||||||
int bits;
|
int bits;
|
||||||
|
@ -1077,7 +1077,7 @@ SV_SendReconnect (void)
|
||||||
void
|
void
|
||||||
SV_SaveSpawnparms (void)
|
SV_SaveSpawnparms (void)
|
||||||
{
|
{
|
||||||
int i, j;
|
unsigned i, j;
|
||||||
|
|
||||||
svs.serverflags = *sv_globals.serverflags;
|
svs.serverflags = *sv_globals.serverflags;
|
||||||
|
|
||||||
|
@ -1161,7 +1161,7 @@ SV_SpawnServer (const char *server)
|
||||||
|
|
||||||
// leave slots at start for only clients
|
// leave slots at start for only clients
|
||||||
sv.num_edicts = svs.maxclients + 1;
|
sv.num_edicts = svs.maxclients + 1;
|
||||||
for (int i = 0; i < svs.maxclients; i++) {
|
for (unsigned i = 0; i < svs.maxclients; i++) {
|
||||||
ent = EDICT_NUM (&sv_pr_state, i + 1);
|
ent = EDICT_NUM (&sv_pr_state, i + 1);
|
||||||
svs.clients[i].edict = ent;
|
svs.clients[i].edict = ent;
|
||||||
}
|
}
|
||||||
|
@ -1243,7 +1243,7 @@ SV_SpawnServer (const char *server)
|
||||||
sv.signon.cursize);
|
sv.signon.cursize);
|
||||||
|
|
||||||
// send serverinfo to all connected clients
|
// send serverinfo to all connected clients
|
||||||
for (int i = 0; i < svs.maxclients; i++) {
|
for (unsigned i = 0; i < svs.maxclients; i++) {
|
||||||
host_client = svs.clients + i;
|
host_client = svs.clients + i;
|
||||||
if (host_client->active) {
|
if (host_client->active) {
|
||||||
SV_SendServerinfo (host_client);
|
SV_SendServerinfo (host_client);
|
||||||
|
|
|
@ -414,7 +414,7 @@ static qboolean
|
||||||
SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove)
|
SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove)
|
||||||
{
|
{
|
||||||
float solid_save;
|
float solid_save;
|
||||||
int num_moved, i, e;
|
int num_moved, i;
|
||||||
edict_t *check, *block;
|
edict_t *check, *block;
|
||||||
edict_t **moved_edict;
|
edict_t **moved_edict;
|
||||||
vec3_t move, org, org2;
|
vec3_t move, org, org2;
|
||||||
|
@ -455,7 +455,7 @@ SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove)
|
||||||
// see if any solid entities are inside the final position
|
// see if any solid entities are inside the final position
|
||||||
num_moved = 0;
|
num_moved = 0;
|
||||||
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||||
for (e = 1; e < sv.num_edicts;
|
for (unsigned e = 1; e < sv.num_edicts;
|
||||||
e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
if (check->free)
|
if (check->free)
|
||||||
continue;
|
continue;
|
||||||
|
@ -854,14 +854,14 @@ void
|
||||||
SV_Physics (void)
|
SV_Physics (void)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
int i;
|
|
||||||
|
|
||||||
SV_ProgStartFrame ();
|
SV_ProgStartFrame ();
|
||||||
|
|
||||||
// treat each object in turn
|
// treat each object in turn
|
||||||
// even the world gets a chance to think
|
// even the world gets a chance to think
|
||||||
ent = sv.edicts;
|
ent = sv.edicts;
|
||||||
for (i = 0; i < sv.num_edicts; i++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
|
for (unsigned i = 0; i < sv.num_edicts;
|
||||||
|
i++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ PF_sprint (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
client_t *client;
|
client_t *client;
|
||||||
int entnum;
|
unsigned entnum;
|
||||||
|
|
||||||
entnum = P_EDICTNUM (pr, 0);
|
entnum = P_EDICTNUM (pr, 0);
|
||||||
s = PF_VarString (pr, 1);
|
s = PF_VarString (pr, 1);
|
||||||
|
@ -333,7 +333,7 @@ PF_centerprint (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *s;
|
const char *s;
|
||||||
client_t *cl;
|
client_t *cl;
|
||||||
int entnum;
|
unsigned entnum;
|
||||||
|
|
||||||
entnum = P_EDICTNUM (pr, 0);
|
entnum = P_EDICTNUM (pr, 0);
|
||||||
s = PF_VarString (pr, 1);
|
s = PF_VarString (pr, 1);
|
||||||
|
@ -542,11 +542,11 @@ PF_checkpos (progs_t *pr)
|
||||||
|
|
||||||
static set_t *checkpvs;
|
static set_t *checkpvs;
|
||||||
|
|
||||||
static int
|
static unsigned
|
||||||
PF_newcheckclient (progs_t *pr, int check)
|
PF_newcheckclient (progs_t *pr, unsigned check)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
int i;
|
unsigned i;
|
||||||
mleaf_t *leaf;
|
mleaf_t *leaf;
|
||||||
vec3_t org;
|
vec3_t org;
|
||||||
|
|
||||||
|
@ -656,7 +656,7 @@ PF_stuffcmd (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
client_t *old;
|
client_t *old;
|
||||||
int entnum;
|
pr_uint_t entnum;
|
||||||
|
|
||||||
entnum = P_EDICTNUM (pr, 0);
|
entnum = P_EDICTNUM (pr, 0);
|
||||||
if (entnum < 1 || entnum > svs.maxclients)
|
if (entnum < 1 || entnum > svs.maxclients)
|
||||||
|
@ -700,7 +700,7 @@ PF_findradius (progs_t *pr)
|
||||||
edict_t *ent, *chain;
|
edict_t *ent, *chain;
|
||||||
float rsqr;
|
float rsqr;
|
||||||
vec_t *emins, *emaxs, *org;
|
vec_t *emins, *emaxs, *org;
|
||||||
int i, j;
|
pr_uint_t i;
|
||||||
vec3_t eorg;
|
vec3_t eorg;
|
||||||
|
|
||||||
chain = (edict_t *) sv.edicts;
|
chain = (edict_t *) sv.edicts;
|
||||||
|
@ -717,7 +717,7 @@ PF_findradius (progs_t *pr)
|
||||||
continue;
|
continue;
|
||||||
emins = SVvector (ent, absmin);
|
emins = SVvector (ent, absmin);
|
||||||
emaxs = SVvector (ent, absmax);
|
emaxs = SVvector (ent, absmax);
|
||||||
for (j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
eorg[j] = org[j] - 0.5 * (emins[j] + emaxs[j]);
|
eorg[j] = org[j] - 0.5 * (emins[j] + emaxs[j]);
|
||||||
if (DotProduct (eorg, eorg) > rsqr)
|
if (DotProduct (eorg, eorg) > rsqr)
|
||||||
continue;
|
continue;
|
||||||
|
@ -903,7 +903,8 @@ PF_lightstyle (progs_t *pr)
|
||||||
{
|
{
|
||||||
const char *val;
|
const char *val;
|
||||||
client_t *cl;
|
client_t *cl;
|
||||||
int style, j;
|
int style;
|
||||||
|
unsigned j;
|
||||||
|
|
||||||
style = P_FLOAT (pr, 0);
|
style = P_FLOAT (pr, 0);
|
||||||
val = P_GSTRING (pr, 1);
|
val = P_GSTRING (pr, 1);
|
||||||
|
@ -960,7 +961,7 @@ PF_aim (progs_t *pr)
|
||||||
edict_t *ent, *check, *bestent;
|
edict_t *ent, *check, *bestent;
|
||||||
float dist, bestdist, speed;
|
float dist, bestdist, speed;
|
||||||
float *mins, *maxs, *org;
|
float *mins, *maxs, *org;
|
||||||
int i, j;
|
pr_uint_t i;
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
vec3_t start, dir, end, bestdir;
|
vec3_t start, dir, end, bestdir;
|
||||||
|
|
||||||
|
@ -1000,7 +1001,7 @@ PF_aim (progs_t *pr)
|
||||||
mins = SVvector (check, mins);
|
mins = SVvector (check, mins);
|
||||||
maxs = SVvector (check, maxs);
|
maxs = SVvector (check, maxs);
|
||||||
org = SVvector (check, origin);
|
org = SVvector (check, origin);
|
||||||
for (j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
end[j] = org[j] + 0.5 * (mins[j] + maxs[j]);
|
end[j] = org[j] + 0.5 * (mins[j] + maxs[j]);
|
||||||
VectorSubtract (end, start, dir);
|
VectorSubtract (end, start, dir);
|
||||||
VectorNormalize (dir);
|
VectorNormalize (dir);
|
||||||
|
@ -1075,7 +1076,7 @@ PF_changeyaw (progs_t *pr)
|
||||||
static __attribute__((pure)) sizebuf_t *
|
static __attribute__((pure)) sizebuf_t *
|
||||||
WriteDest (progs_t *pr)
|
WriteDest (progs_t *pr)
|
||||||
{
|
{
|
||||||
int entnum;
|
pr_uint_t entnum;
|
||||||
int dest;
|
int dest;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
|
|
||||||
|
@ -1256,7 +1257,7 @@ PF_setspawnparms (progs_t *pr)
|
||||||
{
|
{
|
||||||
client_t *client;
|
client_t *client;
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
ent = P_EDICT (pr, 0);
|
ent = P_EDICT (pr, 0);
|
||||||
i = NUM_FOR_EDICT (pr, ent);
|
i = NUM_FOR_EDICT (pr, ent);
|
||||||
|
|
|
@ -584,7 +584,7 @@ SV_ReadClientMessage (void)
|
||||||
void
|
void
|
||||||
SV_RunClients (void)
|
SV_RunClients (void)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned i;
|
||||||
|
|
||||||
for (i = 0, host_client = svs.clients; i < svs.maxclients;
|
for (i = 0, host_client = svs.clients; i < svs.maxclients;
|
||||||
i++, host_client++) {
|
i++, host_client++) {
|
||||||
|
|
|
@ -780,11 +780,10 @@ SV_ClipToLinks (areanode_t *node, moveclip_t *clip)
|
||||||
edict_t *touch;
|
edict_t *touch;
|
||||||
link_t *l, *next;
|
link_t *l, *next;
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (clip->type == TL_EVERYTHING) {
|
if (clip->type == TL_EVERYTHING) {
|
||||||
touch = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
touch = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||||
for (i = 1; i < sv.num_edicts; i++,
|
for (unsigned i = 1; i < sv.num_edicts; i++,
|
||||||
touch = NEXT_EDICT (&sv_pr_state, touch)) {
|
touch = NEXT_EDICT (&sv_pr_state, touch)) {
|
||||||
if (clip->trace.allsolid)
|
if (clip->trace.allsolid)
|
||||||
return;
|
return;
|
||||||
|
@ -897,7 +896,6 @@ SV_Move (const vec3_t start, const vec3_t mins, const vec3_t maxs,
|
||||||
edict_t *
|
edict_t *
|
||||||
SV_TestPlayerPosition (edict_t *ent, const vec3_t origin)
|
SV_TestPlayerPosition (edict_t *ent, const vec3_t origin)
|
||||||
{
|
{
|
||||||
int e;
|
|
||||||
edict_t *check;
|
edict_t *check;
|
||||||
hull_t *hull;
|
hull_t *hull;
|
||||||
vec3_t boxmins, boxmaxs, offset;
|
vec3_t boxmins, boxmaxs, offset;
|
||||||
|
@ -912,8 +910,8 @@ SV_TestPlayerPosition (edict_t *ent, const vec3_t origin)
|
||||||
VectorAdd (origin, SVvector (ent, maxs), boxmaxs);
|
VectorAdd (origin, SVvector (ent, 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,
|
for (unsigned e = 1; e < sv.num_edicts;
|
||||||
check)) {
|
e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
if (check->free)
|
if (check->free)
|
||||||
continue;
|
continue;
|
||||||
if (check == ent)
|
if (check == ent)
|
||||||
|
|
|
@ -81,7 +81,7 @@ typedef struct {
|
||||||
const char *lightstyles[MAX_LIGHTSTYLES];
|
const char *lightstyles[MAX_LIGHTSTYLES];
|
||||||
struct model_s *models[MAX_MODELS];
|
struct model_s *models[MAX_MODELS];
|
||||||
|
|
||||||
int num_edicts; // increases towards MAX_EDICTS
|
unsigned num_edicts; // increases towards MAX_EDICTS
|
||||||
struct edict_s *edicts; // can NOT be array indexed, because
|
struct edict_s *edicts; // can NOT be array indexed, because
|
||||||
// struct edict_s is variable sized, but can
|
// struct edict_s is variable sized, but can
|
||||||
// be used to reference the world ent
|
// be used to reference the world ent
|
||||||
|
@ -304,8 +304,8 @@ typedef struct {
|
||||||
int spawncount; // number of servers spawned since start,
|
int spawncount; // number of servers spawned since start,
|
||||||
// used to check late spawns
|
// used to check late spawns
|
||||||
client_t clients[MAX_CLIENTS];
|
client_t clients[MAX_CLIENTS];
|
||||||
int maxclients;
|
unsigned maxclients;
|
||||||
int num_clients;
|
unsigned num_clients;
|
||||||
int serverflags; // episode completion information
|
int serverflags; // episode completion information
|
||||||
void (*phys_client) (struct edict_s *ent, int num);
|
void (*phys_client) (struct edict_s *ent, int num);
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,12 @@
|
||||||
#include "sv_pr_cmds.h"
|
#include "sv_pr_cmds.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
pr_int_t *self;
|
pr_uint_t *self;
|
||||||
pr_int_t *other;
|
pr_uint_t *other;
|
||||||
pr_int_t *world;
|
pr_uint_t *world;
|
||||||
float *time;
|
float *time;
|
||||||
float *frametime;
|
float *frametime;
|
||||||
pr_int_t *newmis;
|
pr_uint_t *newmis;
|
||||||
float *force_retouch;
|
float *force_retouch;
|
||||||
string_t *mapname;
|
string_t *mapname;
|
||||||
float *serverflags;
|
float *serverflags;
|
||||||
|
@ -61,10 +61,10 @@ typedef struct {
|
||||||
vec3_t *trace_endpos;
|
vec3_t *trace_endpos;
|
||||||
vec3_t *trace_plane_normal;
|
vec3_t *trace_plane_normal;
|
||||||
float *trace_plane_dist;
|
float *trace_plane_dist;
|
||||||
pr_int_t *trace_ent;
|
pr_uint_t *trace_ent;
|
||||||
float *trace_inopen;
|
float *trace_inopen;
|
||||||
float *trace_inwater;
|
float *trace_inwater;
|
||||||
pr_int_t *msg_entity;
|
pr_uint_t *msg_entity;
|
||||||
float *skill;
|
float *skill;
|
||||||
} sv_globals_t;
|
} sv_globals_t;
|
||||||
|
|
||||||
|
|
|
@ -122,11 +122,8 @@ SV_FlushSignon (void)
|
||||||
static void
|
static void
|
||||||
SV_CreateBaseline (void)
|
SV_CreateBaseline (void)
|
||||||
{
|
{
|
||||||
int entnum;
|
for (unsigned entnum = 0; entnum < sv.num_edicts; entnum++) {
|
||||||
edict_t *svent;
|
edict_t *svent = EDICT_NUM (&sv_pr_state, entnum);
|
||||||
|
|
||||||
for (entnum = 0; entnum < sv.num_edicts; entnum++) {
|
|
||||||
svent = EDICT_NUM (&sv_pr_state, entnum);
|
|
||||||
if (svent->free)
|
if (svent->free)
|
||||||
continue;
|
continue;
|
||||||
// create baselines for all player slots,
|
// create baselines for all player slots,
|
||||||
|
|
|
@ -417,7 +417,7 @@ static qboolean
|
||||||
SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove)
|
SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove)
|
||||||
{
|
{
|
||||||
float solid_save;
|
float solid_save;
|
||||||
int num_moved, i, e;
|
int num_moved, i;
|
||||||
edict_t *check, *block;
|
edict_t *check, *block;
|
||||||
edict_t **moved_edict;
|
edict_t **moved_edict;
|
||||||
vec3_t move, org, org2;
|
vec3_t move, org, org2;
|
||||||
|
@ -458,7 +458,7 @@ SV_Push (edict_t *pusher, const vec3_t tmove, const vec3_t amove)
|
||||||
// see if any solid entities are inside the final position
|
// see if any solid entities are inside the final position
|
||||||
num_moved = 0;
|
num_moved = 0;
|
||||||
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
check = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||||
for (e = 1; e < sv.num_edicts;
|
for (unsigned e = 1; e < sv.num_edicts;
|
||||||
e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
if (check->free)
|
if (check->free)
|
||||||
continue;
|
continue;
|
||||||
|
@ -862,14 +862,14 @@ void
|
||||||
SV_Physics (void)
|
SV_Physics (void)
|
||||||
{
|
{
|
||||||
edict_t *ent;
|
edict_t *ent;
|
||||||
int i;
|
|
||||||
|
|
||||||
SV_ProgStartFrame ();
|
SV_ProgStartFrame ();
|
||||||
|
|
||||||
// treat each object in turn
|
// treat each object in turn
|
||||||
// even the world gets a chance to think
|
// even the world gets a chance to think
|
||||||
ent = sv.edicts;
|
ent = sv.edicts;
|
||||||
for (i = 0; i < sv.num_edicts; i++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
|
for (unsigned i = 0; i < sv.num_edicts;
|
||||||
|
i++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -653,7 +653,6 @@ PF_findradius (progs_t *pr)
|
||||||
edict_t *ent, *chain;
|
edict_t *ent, *chain;
|
||||||
float rsqr;
|
float rsqr;
|
||||||
vec_t *emins, *emaxs, *org;
|
vec_t *emins, *emaxs, *org;
|
||||||
int i, j;
|
|
||||||
vec3_t eorg;
|
vec3_t eorg;
|
||||||
|
|
||||||
chain = (edict_t *) sv.edicts;
|
chain = (edict_t *) sv.edicts;
|
||||||
|
@ -663,7 +662,7 @@ PF_findradius (progs_t *pr)
|
||||||
rsqr *= rsqr; // Square early, sqrt never
|
rsqr *= rsqr; // Square early, sqrt never
|
||||||
|
|
||||||
ent = NEXT_EDICT (pr, sv.edicts);
|
ent = NEXT_EDICT (pr, sv.edicts);
|
||||||
for (i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
|
for (unsigned i = 1; i < sv.num_edicts; i++, ent = NEXT_EDICT (pr, ent)) {
|
||||||
if (ent->free)
|
if (ent->free)
|
||||||
continue;
|
continue;
|
||||||
if (SVfloat (ent, solid) == SOLID_NOT
|
if (SVfloat (ent, solid) == SOLID_NOT
|
||||||
|
@ -671,7 +670,7 @@ PF_findradius (progs_t *pr)
|
||||||
continue;
|
continue;
|
||||||
emins = SVvector (ent, absmin);
|
emins = SVvector (ent, absmin);
|
||||||
emaxs = SVvector (ent, absmax);
|
emaxs = SVvector (ent, absmax);
|
||||||
for (j = 0; j < 3; j++)
|
for (int j = 0; j < 3; j++)
|
||||||
eorg[j] = org[j] - 0.5 * (emins[j] + emaxs[j]);
|
eorg[j] = org[j] - 0.5 * (emins[j] + emaxs[j]);
|
||||||
if (DotProduct (eorg, eorg) > rsqr)
|
if (DotProduct (eorg, eorg) > rsqr)
|
||||||
continue;
|
continue;
|
||||||
|
@ -936,7 +935,7 @@ PF_aim (progs_t *pr)
|
||||||
edict_t *ent, *check, *bestent;
|
edict_t *ent, *check, *bestent;
|
||||||
float dist, bestdist, speed;
|
float dist, bestdist, speed;
|
||||||
float *mins, *maxs, *org;
|
float *mins, *maxs, *org;
|
||||||
int i, j;
|
unsigned i, j;
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
vec3_t start, dir, end, bestdir;
|
vec3_t start, dir, end, bestdir;
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ cvar_t *pr_checkextensions;
|
||||||
cvar_t *sv_old_entity_free;
|
cvar_t *sv_old_entity_free;
|
||||||
cvar_t *sv_hide_version_info;
|
cvar_t *sv_hide_version_info;
|
||||||
|
|
||||||
static int reserved_edicts = MAX_CLIENTS;
|
static pr_uint_t reserved_edicts = MAX_CLIENTS;
|
||||||
|
|
||||||
static int sv_range;
|
static int sv_range;
|
||||||
|
|
||||||
|
|
|
@ -491,16 +491,13 @@ SV_Spawn_f (void *unused)
|
||||||
static void
|
static void
|
||||||
SV_SpawnSpectator (void)
|
SV_SpawnSpectator (void)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
edict_t *e;
|
|
||||||
|
|
||||||
VectorZero (SVvector (sv_player, origin));
|
VectorZero (SVvector (sv_player, origin));
|
||||||
VectorZero (SVvector (sv_player, view_ofs));
|
VectorZero (SVvector (sv_player, view_ofs));
|
||||||
SVvector (sv_player, view_ofs)[2] = 22;
|
SVvector (sv_player, 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 (unsigned i = MAX_CLIENTS - 1; i < sv.num_edicts; i++) {
|
||||||
e = EDICT_NUM (&sv_pr_state, i);
|
edict_t *e = EDICT_NUM (&sv_pr_state, i);
|
||||||
if (!strcmp (PR_GetString (&sv_pr_state, SVstring (e, classname)),
|
if (!strcmp (PR_GetString (&sv_pr_state, SVstring (e, classname)),
|
||||||
"info_player_start")) {
|
"info_player_start")) {
|
||||||
VectorCopy (SVvector (e, origin), SVvector (sv_player, origin));
|
VectorCopy (SVvector (e, origin), SVvector (sv_player, origin));
|
||||||
|
@ -1516,7 +1513,7 @@ static void
|
||||||
AddLinksToPmove (areanode_t *node)
|
AddLinksToPmove (areanode_t *node)
|
||||||
{
|
{
|
||||||
edict_t *check;
|
edict_t *check;
|
||||||
int pl, i;
|
pr_uint_t pl, i;
|
||||||
link_t *l, *next;
|
link_t *l, *next;
|
||||||
physent_t *pe;
|
physent_t *pe;
|
||||||
|
|
||||||
|
|
|
@ -818,11 +818,10 @@ SV_ClipToLinks (areanode_t *node, moveclip_t *clip)
|
||||||
edict_t *touch;
|
edict_t *touch;
|
||||||
link_t *l, *next;
|
link_t *l, *next;
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
int i;
|
|
||||||
|
|
||||||
if (clip->type & MOVE_EVERYTHING) {
|
if (clip->type & MOVE_EVERYTHING) {
|
||||||
touch = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
touch = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||||
for (i = 1; i < sv.num_edicts; i++,
|
for (unsigned i = 1; i < sv.num_edicts; i++,
|
||||||
touch = NEXT_EDICT (&sv_pr_state, touch)) {
|
touch = NEXT_EDICT (&sv_pr_state, touch)) {
|
||||||
if (clip->trace.allsolid)
|
if (clip->trace.allsolid)
|
||||||
return;
|
return;
|
||||||
|
@ -985,7 +984,6 @@ SV_Move (const vec3_t start, const vec3_t mins, const vec3_t maxs,
|
||||||
edict_t *
|
edict_t *
|
||||||
SV_TestPlayerPosition (edict_t *ent, const vec3_t origin)
|
SV_TestPlayerPosition (edict_t *ent, const vec3_t origin)
|
||||||
{
|
{
|
||||||
int e;
|
|
||||||
edict_t *check;
|
edict_t *check;
|
||||||
hull_t *hull;
|
hull_t *hull;
|
||||||
vec3_t boxmins, boxmaxs, offset;
|
vec3_t boxmins, boxmaxs, offset;
|
||||||
|
@ -1000,8 +998,8 @@ SV_TestPlayerPosition (edict_t *ent, const vec3_t origin)
|
||||||
VectorAdd (origin, SVvector (ent, maxs), boxmaxs);
|
VectorAdd (origin, SVvector (ent, 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,
|
for (unsigned e = 1; e < sv.num_edicts;
|
||||||
check)) {
|
e++, check = NEXT_EDICT (&sv_pr_state, check)) {
|
||||||
if (check->free)
|
if (check->free)
|
||||||
continue;
|
continue;
|
||||||
if (check == ent)
|
if (check == ent)
|
||||||
|
|
|
@ -126,8 +126,8 @@ static const char *short_options =
|
||||||
;
|
;
|
||||||
|
|
||||||
static edict_t *edicts;
|
static edict_t *edicts;
|
||||||
static int num_edicts;
|
static pr_uint_t num_edicts;
|
||||||
static int reserved_edicts = 1;
|
static pr_uint_t reserved_edicts = 1;
|
||||||
static progs_t pr;
|
static progs_t pr;
|
||||||
static qfo_t *qfo;
|
static qfo_t *qfo;
|
||||||
|
|
||||||
|
|
|
@ -75,8 +75,8 @@ static const char *short_options =
|
||||||
static edict_t test_edicts[MAX_EDICTS];
|
static edict_t test_edicts[MAX_EDICTS];
|
||||||
|
|
||||||
static edict_t *edicts;
|
static edict_t *edicts;
|
||||||
static int num_edicts;
|
static pr_uint_t num_edicts;
|
||||||
static int reserved_edicts;
|
static pr_uint_t reserved_edicts;
|
||||||
static progs_t test_pr;
|
static progs_t test_pr;
|
||||||
static const char *this_program;
|
static const char *this_program;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue