06 Sep 2007
This commit is contained in:
parent
cc5ec77d05
commit
d6ccf91e53
|
@ -6,15 +6,10 @@ SV_Move SV_Trace
|
||||||
SV_ClipMoveToEntity CM_BoxTrace
|
SV_ClipMoveToEntity CM_BoxTrace
|
||||||
SV_ClipToLinks SV_ClipMoveToEntities
|
SV_ClipToLinks SV_ClipMoveToEntities
|
||||||
|
|
||||||
|
|
||||||
1. Откатываем назад до имплементации QC, пытаемся восстановить работоспособность OK
|
|
||||||
2. Откатываем назад таймер (предварительно сохранив текущуюю версию)
|
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// FIXME
|
// FIXME
|
||||||
//==================================================
|
//==================================================
|
||||||
1. Переписать главный игровой цикл
|
1. Пофиксить движение игрока (сл. большая скорость)
|
||||||
2. Пофиксить физику
|
|
||||||
|
|
||||||
//==================================================
|
//==================================================
|
||||||
// òî, ÷òî óæå ãîòîâî
|
// òî, ÷òî óæå ãîòîâî
|
||||||
|
|
|
@ -601,7 +601,7 @@ void CL_ParsePlayerstate (frame_t *oldframe, frame_t *newframe)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & PS_FOV)
|
if (flags & PS_FOV)
|
||||||
state->fov = MSG_ReadFloat (&net_message);
|
state->fov = MSG_ReadByte (&net_message);
|
||||||
|
|
||||||
if (flags & PS_RDFLAGS)
|
if (flags & PS_RDFLAGS)
|
||||||
state->rdflags = MSG_ReadByte (&net_message);
|
state->rdflags = MSG_ReadByte (&net_message);
|
||||||
|
|
|
@ -295,9 +295,7 @@ void CL_BaseMove (usercmd_t *cmd)
|
||||||
cmd->forwardmove -= cl_forwardspeed->value * CL_KeyState (&in_back);
|
cmd->forwardmove -= cl_forwardspeed->value * CL_KeyState (&in_back);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
// adjust for speed key / running
|
||||||
// adjust for speed key / running
|
|
||||||
//
|
|
||||||
if ( (in_speed.state & 1) ^ (int)(cl_run->value) )
|
if ( (in_speed.state & 1) ^ (int)(cl_run->value) )
|
||||||
{
|
{
|
||||||
cmd->forwardmove *= 2;
|
cmd->forwardmove *= 2;
|
||||||
|
@ -369,8 +367,7 @@ usercmd_t CL_CreateCmd (void)
|
||||||
usercmd_t cmd;
|
usercmd_t cmd;
|
||||||
|
|
||||||
frame_msec = host.cl_timer - old_sys_frame_time;
|
frame_msec = host.cl_timer - old_sys_frame_time;
|
||||||
if (frame_msec < 1) frame_msec = 1;
|
frame_msec = bound(1, frame_msec, 200);
|
||||||
if (frame_msec > 200) frame_msec = 200;
|
|
||||||
|
|
||||||
// get basic movement from keyboard
|
// get basic movement from keyboard
|
||||||
CL_BaseMove (&cmd);
|
CL_BaseMove (&cmd);
|
||||||
|
|
|
@ -1401,7 +1401,7 @@ CL_InitLocal
|
||||||
void CL_InitLocal (void)
|
void CL_InitLocal (void)
|
||||||
{
|
{
|
||||||
cls.state = ca_disconnected;
|
cls.state = ca_disconnected;
|
||||||
cls.realtime = 1.0f;
|
cls.realtime = Sys_DoubleTime();
|
||||||
|
|
||||||
CL_InitInput ();
|
CL_InitInput ();
|
||||||
|
|
||||||
|
@ -1429,7 +1429,7 @@ void CL_InitLocal (void)
|
||||||
cl_footsteps = Cvar_Get ("cl_footsteps", "1", 0);
|
cl_footsteps = Cvar_Get ("cl_footsteps", "1", 0);
|
||||||
cl_noskins = Cvar_Get ("cl_noskins", "0", 0);
|
cl_noskins = Cvar_Get ("cl_noskins", "0", 0);
|
||||||
cl_autoskins = Cvar_Get ("cl_autoskins", "0", 0);
|
cl_autoskins = Cvar_Get ("cl_autoskins", "0", 0);
|
||||||
cl_predict = Cvar_Get ("cl_predict", "0", 0);
|
cl_predict = Cvar_Get ("cl_predict", "1", 0);
|
||||||
// cl_minfps = Cvar_Get ("cl_minfps", "5", 0);
|
// cl_minfps = Cvar_Get ("cl_minfps", "5", 0);
|
||||||
cl_maxfps = Cvar_Get ("cl_maxfps", "90", 0);
|
cl_maxfps = Cvar_Get ("cl_maxfps", "90", 0);
|
||||||
|
|
||||||
|
@ -1606,8 +1606,8 @@ void CL_FixCvarCheats (void)
|
||||||
int i;
|
int i;
|
||||||
cheatvar_t *var;
|
cheatvar_t *var;
|
||||||
|
|
||||||
if ( !strcmp(cl.configstrings[CS_MAXCLIENTS], "1") || !cl.configstrings[CS_MAXCLIENTS][0] )
|
if(!strcmp(cl.configstrings[CS_MAXCLIENTS], "1") || !cl.configstrings[CS_MAXCLIENTS][0] )
|
||||||
return; // single player can cheat
|
return; // single player can cheat
|
||||||
|
|
||||||
// find all the cvars if we haven't done it yet
|
// find all the cvars if we haven't done it yet
|
||||||
if (!numcheatvars)
|
if (!numcheatvars)
|
||||||
|
|
|
@ -439,8 +439,7 @@ SCR_DrawNet
|
||||||
*/
|
*/
|
||||||
void SCR_DrawNet (void)
|
void SCR_DrawNet (void)
|
||||||
{
|
{
|
||||||
if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged
|
if (cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP-1)
|
||||||
< CMD_BACKUP-1)
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
re->DrawPic (scr_vrect.x+64, scr_vrect.y, "net");
|
re->DrawPic (scr_vrect.x+64, scr_vrect.y, "net");
|
||||||
|
|
|
@ -486,7 +486,7 @@ bool NET_CompareBaseAdr (netadr_t a, netadr_t b);
|
||||||
bool NET_IsLocalAddress (netadr_t adr);
|
bool NET_IsLocalAddress (netadr_t adr);
|
||||||
char *NET_AdrToString (netadr_t a);
|
char *NET_AdrToString (netadr_t a);
|
||||||
bool NET_StringToAdr (char *s, netadr_t *a);
|
bool NET_StringToAdr (char *s, netadr_t *a);
|
||||||
void NET_Sleep(float time);
|
void NET_Sleep(int msec);
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
@ -502,13 +502,13 @@ typedef struct
|
||||||
|
|
||||||
int dropped; // between last packet and previous
|
int dropped; // between last packet and previous
|
||||||
|
|
||||||
float last_received; // for timeouts
|
int last_received; // for timeouts
|
||||||
float last_sent; // for retransmits
|
int last_sent; // for retransmits
|
||||||
|
|
||||||
netadr_t remote_address;
|
netadr_t remote_address;
|
||||||
int qport; // qport value to write when transmitting
|
int qport; // qport value to write when transmitting
|
||||||
|
|
||||||
// sequencing variables
|
// sequencing variables
|
||||||
int incoming_sequence;
|
int incoming_sequence;
|
||||||
int incoming_acknowledged;
|
int incoming_acknowledged;
|
||||||
int incoming_reliable_acknowledged; // single bit
|
int incoming_reliable_acknowledged; // single bit
|
||||||
|
|
|
@ -93,7 +93,7 @@ void Con_ToggleConsole_f (void)
|
||||||
M_ForceMenuOff ();
|
M_ForceMenuOff ();
|
||||||
cls.key_dest = key_console;
|
cls.key_dest = key_console;
|
||||||
|
|
||||||
if (host.maxclients == 1 && Com_ServerState ())
|
if (host.maxclients == 1 && Com_ServerState())
|
||||||
Cvar_Set ("paused", "1");
|
Cvar_Set ("paused", "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ cvar_t *Cvar_FindVar (const char *var_name)
|
||||||
{
|
{
|
||||||
cvar_t *var;
|
cvar_t *var;
|
||||||
|
|
||||||
for (var=cvar_vars ; var ; var=var->next)
|
for (var = cvar_vars; var; var = var->next)
|
||||||
if (!strcmp (var_name, var->name))
|
if (!strcmp (var_name, var->name))
|
||||||
return var;
|
return var;
|
||||||
|
|
||||||
|
@ -93,16 +93,15 @@ Cvar_CompleteVariable
|
||||||
char *Cvar_CompleteVariable (char *partial)
|
char *Cvar_CompleteVariable (char *partial)
|
||||||
{
|
{
|
||||||
cvar_t *cvar;
|
cvar_t *cvar;
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
len = strlen(partial);
|
len = strlen(partial);
|
||||||
|
|
||||||
if (!len)
|
if (!len) return NULL;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// check exact match
|
// check exact match
|
||||||
for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
|
for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
|
||||||
if (!strcmp (partial,cvar->name))
|
if (!strcmp (partial, cvar->name))
|
||||||
return cvar->name;
|
return cvar->name;
|
||||||
|
|
||||||
// check partial match
|
// check partial match
|
||||||
|
@ -177,12 +176,9 @@ Cvar_Set2
|
||||||
cvar_t *Cvar_Set2 (const char *var_name, const char *value, bool force)
|
cvar_t *Cvar_Set2 (const char *var_name, const char *value, bool force)
|
||||||
{
|
{
|
||||||
cvar_t *var;
|
cvar_t *var;
|
||||||
|
|
||||||
var = Cvar_FindVar (var_name);
|
var = Cvar_FindVar (var_name);
|
||||||
if (!var)
|
if (!var) return Cvar_Get (var_name, value, 0); // create it
|
||||||
{ // create it
|
|
||||||
return Cvar_Get (var_name, value, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var->flags & (CVAR_USERINFO | CVAR_SERVERINFO))
|
if (var->flags & (CVAR_USERINFO | CVAR_SERVERINFO))
|
||||||
{
|
{
|
||||||
|
@ -242,13 +238,13 @@ cvar_t *Cvar_Set2 (const char *var_name, const char *value, bool force)
|
||||||
|
|
||||||
var->modified = true;
|
var->modified = true;
|
||||||
|
|
||||||
if (var->flags & CVAR_USERINFO)
|
// transmit at next oportunity
|
||||||
userinfo_modified = true; // transmit at next oportunity
|
if (var->flags & CVAR_USERINFO) userinfo_modified = true;
|
||||||
|
|
||||||
Z_Free (var->string); // free the old value string
|
Z_Free (var->string); // free the old value string
|
||||||
|
|
||||||
var->string = CopyString(value);
|
var->string = CopyString(value);
|
||||||
var->value = atof (var->string);
|
var->value = atof(var->string);
|
||||||
|
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
@ -268,7 +264,7 @@ cvar_t *Cvar_ForceSet (const char *var_name, const char *value)
|
||||||
Cvar_Set
|
Cvar_Set
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
cvar_t *Cvar_Set (const char *var_name, const char *value)
|
cvar_t *_Cvar_Set (const char *var_name, const char *value, const char *filename, int fileline)
|
||||||
{
|
{
|
||||||
return Cvar_Set2 (var_name, value, false);
|
return Cvar_Set2 (var_name, value, false);
|
||||||
}
|
}
|
||||||
|
@ -350,14 +346,13 @@ Handles variable inspection and changing from the console
|
||||||
*/
|
*/
|
||||||
bool Cvar_Command (void)
|
bool Cvar_Command (void)
|
||||||
{
|
{
|
||||||
cvar_t *v;
|
cvar_t *v;
|
||||||
|
|
||||||
// check variables
|
// check variables
|
||||||
v = Cvar_FindVar (Cmd_Argv(0));
|
v = Cvar_FindVar (Cmd_Argv(0));
|
||||||
if (!v)
|
if (!v) return false;
|
||||||
return false;
|
|
||||||
|
|
||||||
// perform a variable print or set
|
// perform a variable print or set
|
||||||
if (Cmd_Argc() == 1)
|
if (Cmd_Argc() == 1)
|
||||||
{
|
{
|
||||||
Msg ("\"%s\" is \"%s\"\n", v->name, v->string);
|
Msg ("\"%s\" is \"%s\"\n", v->name, v->string);
|
||||||
|
@ -390,10 +385,8 @@ void Cvar_Set_f (void)
|
||||||
|
|
||||||
if (c == 4)
|
if (c == 4)
|
||||||
{
|
{
|
||||||
if (!strcmp(Cmd_Argv(3), "u"))
|
if (!strcmp(Cmd_Argv(3), "u")) flags = CVAR_USERINFO;
|
||||||
flags = CVAR_USERINFO;
|
else if (!strcmp(Cmd_Argv(3), "s")) flags = CVAR_SERVERINFO;
|
||||||
else if (!strcmp(Cmd_Argv(3), "s"))
|
|
||||||
flags = CVAR_SERVERINFO;
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Msg ("flags can only be 'u' or 's'\n");
|
Msg ("flags can only be 'u' or 's'\n");
|
||||||
|
@ -401,8 +394,7 @@ void Cvar_Set_f (void)
|
||||||
}
|
}
|
||||||
Cvar_FullSet (Cmd_Argv(1), Cmd_Argv(2), flags);
|
Cvar_FullSet (Cmd_Argv(1), Cmd_Argv(2), flags);
|
||||||
}
|
}
|
||||||
else
|
else Cvar_Set (Cmd_Argv(1), Cmd_Argv(2));
|
||||||
Cvar_Set (Cmd_Argv(1), Cmd_Argv(2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,7 +465,7 @@ void Cvar_List_f (void)
|
||||||
bool userinfo_modified;
|
bool userinfo_modified;
|
||||||
|
|
||||||
|
|
||||||
char *Cvar_BitInfo (int bit)
|
char *Cvar_BitInfo (int bit)
|
||||||
{
|
{
|
||||||
static char info[MAX_INFO_STRING];
|
static char info[MAX_INFO_STRING];
|
||||||
cvar_t *var;
|
cvar_t *var;
|
||||||
|
@ -489,13 +481,13 @@ char *Cvar_BitInfo (int bit)
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns an info string containing all the CVAR_USERINFO cvars
|
// returns an info string containing all the CVAR_USERINFO cvars
|
||||||
char *Cvar_Userinfo (void)
|
char *Cvar_Userinfo (void)
|
||||||
{
|
{
|
||||||
return Cvar_BitInfo (CVAR_USERINFO);
|
return Cvar_BitInfo (CVAR_USERINFO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// returns an info string containing all the CVAR_SERVERINFO cvars
|
// returns an info string containing all the CVAR_SERVERINFO cvars
|
||||||
char *Cvar_Serverinfo (void)
|
char *Cvar_Serverinfo (void)
|
||||||
{
|
{
|
||||||
return Cvar_BitInfo (CVAR_SERVERINFO);
|
return Cvar_BitInfo (CVAR_SERVERINFO);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ cvar_t *Cvar_Get (const char *var_name, const char *value, int flags);
|
||||||
// if it exists, the value will not be changed, but flags will be ORed in
|
// if it exists, the value will not be changed, but flags will be ORed in
|
||||||
// that allows variables to be unarchived without needing bitflags
|
// that allows variables to be unarchived without needing bitflags
|
||||||
|
|
||||||
cvar_t *Cvar_Set (const char *var_name, const char *value);
|
#define Cvar_Set(name, val) _Cvar_Set (name, val, __FILE__, __LINE__)
|
||||||
|
cvar_t *_Cvar_Set (const char *var_name, const char *value, const char *filename, int fileline);
|
||||||
// will create the variable if it doesn't exist
|
// will create the variable if it doesn't exist
|
||||||
|
|
||||||
cvar_t *Cvar_ForceSet (const char *var_name, const char *value);
|
cvar_t *Cvar_ForceSet (const char *var_name, const char *value);
|
||||||
|
|
|
@ -158,7 +158,7 @@ void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport)
|
||||||
chan->sock = sock;
|
chan->sock = sock;
|
||||||
chan->remote_address = adr;
|
chan->remote_address = adr;
|
||||||
chan->qport = qport;
|
chan->qport = qport;
|
||||||
chan->last_received = host.realtime;
|
chan->last_received = host.realtime * 1000;
|
||||||
chan->incoming_sequence = 0;
|
chan->incoming_sequence = 0;
|
||||||
chan->outgoing_sequence = 1;
|
chan->outgoing_sequence = 1;
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data)
|
||||||
|
|
||||||
if (!chan->reliable_length && chan->message.cursize)
|
if (!chan->reliable_length && chan->message.cursize)
|
||||||
{
|
{
|
||||||
memcpy (chan->reliable_buf, chan->message_buf, chan->message.cursize);
|
Mem_Copy (chan->reliable_buf, chan->message_buf, chan->message.cursize);
|
||||||
chan->reliable_length = chan->message.cursize;
|
chan->reliable_length = chan->message.cursize;
|
||||||
chan->message.cursize = 0;
|
chan->message.cursize = 0;
|
||||||
chan->reliable_sequence ^= 1;
|
chan->reliable_sequence ^= 1;
|
||||||
|
@ -244,7 +244,7 @@ void Netchan_Transmit (netchan_t *chan, int length, byte *data)
|
||||||
w2 = ( chan->incoming_sequence & ~(1<<31) ) | (chan->incoming_reliable_sequence<<31);
|
w2 = ( chan->incoming_sequence & ~(1<<31) ) | (chan->incoming_reliable_sequence<<31);
|
||||||
|
|
||||||
chan->outgoing_sequence++;
|
chan->outgoing_sequence++;
|
||||||
chan->last_sent = host.realtime;
|
chan->last_sent = host.realtime * 1000;
|
||||||
|
|
||||||
MSG_WriteLong (&send, w1);
|
MSG_WriteLong (&send, w1);
|
||||||
MSG_WriteLong (&send, w2);
|
MSG_WriteLong (&send, w2);
|
||||||
|
@ -297,9 +297,9 @@ bool Netchan_Process (netchan_t *chan, sizebuf_t *msg)
|
||||||
{
|
{
|
||||||
unsigned sequence, sequence_ack;
|
unsigned sequence, sequence_ack;
|
||||||
unsigned reliable_ack, reliable_message;
|
unsigned reliable_ack, reliable_message;
|
||||||
int qport;
|
int qport;
|
||||||
|
|
||||||
// get sequence numbers
|
// get sequence numbers
|
||||||
MSG_BeginReading (msg);
|
MSG_BeginReading (msg);
|
||||||
sequence = MSG_ReadLong (msg);
|
sequence = MSG_ReadLong (msg);
|
||||||
sequence_ack = MSG_ReadLong (msg);
|
sequence_ack = MSG_ReadLong (msg);
|
||||||
|
@ -351,7 +351,10 @@ bool Netchan_Process (netchan_t *chan, sizebuf_t *msg)
|
||||||
if (chan->dropped > 0)
|
if (chan->dropped > 0)
|
||||||
{
|
{
|
||||||
if (showdrop->value)
|
if (showdrop->value)
|
||||||
Msg ("%s:Dropped %i packets at %i\n", NET_AdrToString (chan->remote_address), chan->dropped, sequence);
|
Msg ("%s:Dropped %i packets at %i\n",
|
||||||
|
NET_AdrToString (chan->remote_address),
|
||||||
|
chan->dropped,
|
||||||
|
sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -375,7 +378,7 @@ bool Netchan_Process (netchan_t *chan, sizebuf_t *msg)
|
||||||
//
|
//
|
||||||
// the message can now be read from the current message pointer
|
// the message can now be read from the current message pointer
|
||||||
//
|
//
|
||||||
chan->last_received = host.realtime;
|
chan->last_received = host.realtime * 1000;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -707,7 +707,7 @@ void NET_Config (bool multiplayer)
|
||||||
}
|
}
|
||||||
|
|
||||||
// sleeps msec or until net socket is ready
|
// sleeps msec or until net socket is ready
|
||||||
void NET_Sleep(float time)
|
void NET_Sleep(int msec)
|
||||||
{
|
{
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
fd_set fdset;
|
fd_set fdset;
|
||||||
|
@ -717,8 +717,6 @@ void NET_Sleep(float time)
|
||||||
if (host.type == HOST_NORMAL) return;
|
if (host.type == HOST_NORMAL) return;
|
||||||
FD_ZERO(&fdset);
|
FD_ZERO(&fdset);
|
||||||
|
|
||||||
Msg("NET_Sleep: sleep time %g\n", time );
|
|
||||||
|
|
||||||
if (ip_sockets[NS_SERVER])
|
if (ip_sockets[NS_SERVER])
|
||||||
{
|
{
|
||||||
FD_SET(ip_sockets[NS_SERVER], &fdset); // network socket
|
FD_SET(ip_sockets[NS_SERVER], &fdset); // network socket
|
||||||
|
@ -729,8 +727,8 @@ void NET_Sleep(float time)
|
||||||
FD_SET(ipx_sockets[NS_SERVER], &fdset); // network socket
|
FD_SET(ipx_sockets[NS_SERVER], &fdset); // network socket
|
||||||
if (ipx_sockets[NS_SERVER] > i) i = ipx_sockets[NS_SERVER];
|
if (ipx_sockets[NS_SERVER] > i) i = ipx_sockets[NS_SERVER];
|
||||||
}
|
}
|
||||||
timeout.tv_sec = time;
|
timeout.tv_sec = msec/1000;
|
||||||
timeout.tv_usec = fmod(time, 1.0f) * 1.0f;
|
timeout.tv_usec = (msec%1000) * 1000;
|
||||||
select(i+1, &fdset, NULL, NULL, &timeout);
|
select(i+1, &fdset, NULL, NULL, &timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
--------------------Configuration: engine - Win32 Debug--------------------
|
--------------------Configuration: engine - Win32 Debug--------------------
|
||||||
</h3>
|
</h3>
|
||||||
<h3>Command Lines</h3>
|
<h3>Command Lines</h3>
|
||||||
Creating temporary file "C:\Temp\RSP451.tmp" with contents
|
Creating temporary file "C:\Temp\RSP89.tmp" with contents
|
||||||
[
|
[
|
||||||
/nologo /MTd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "prvm" /I "common" /I "server" /I "client" /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\engine\!debug/" /Fo"..\temp\engine\!debug/" /Fd"..\temp\engine\!debug/" /FD /c
|
/nologo /MTd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "prvm" /I "common" /I "server" /I "client" /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR"..\temp\engine\!debug/" /Fo"..\temp\engine\!debug/" /Fd"..\temp\engine\!debug/" /FD /c
|
||||||
"D:\XASH3D\src_main\!source\engine\system.c"
|
"D:\XASH3D\src_main\!source\engine\server\sv_user.c"
|
||||||
]
|
]
|
||||||
Creating command line "cl.exe @C:\Temp\RSP451.tmp"
|
Creating command line "cl.exe @C:\Temp\RSP89.tmp"
|
||||||
Creating temporary file "C:\Temp\RSP452.tmp" with contents
|
Creating temporary file "C:\Temp\RSP8A.tmp" with contents
|
||||||
[
|
[
|
||||||
gdi32.lib winmm.lib kernel32.lib user32.lib wsock32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\engine\!debug/engine.pdb" /debug /machine:I386 /out:"..\temp\engine\!debug/engine.dll" /implib:"..\temp\engine\!debug/engine.lib" /pdbtype:sept
|
gdi32.lib winmm.lib kernel32.lib user32.lib wsock32.lib /nologo /subsystem:windows /dll /incremental:yes /pdb:"..\temp\engine\!debug/engine.pdb" /debug /machine:I386 /out:"..\temp\engine\!debug/engine.dll" /implib:"..\temp\engine\!debug/engine.lib" /pdbtype:sept
|
||||||
"\XASH3D\src_main\!source\temp\engine\!debug\cl_cin.obj"
|
"\XASH3D\src_main\!source\temp\engine\!debug\cl_cin.obj"
|
||||||
|
@ -66,15 +66,15 @@ gdi32.lib winmm.lib kernel32.lib user32.lib wsock32.lib /nologo /subsystem:windo
|
||||||
"\XASH3D\src_main\!source\temp\engine\!debug\vm_edict.obj"
|
"\XASH3D\src_main\!source\temp\engine\!debug\vm_edict.obj"
|
||||||
"\XASH3D\src_main\!source\temp\engine\!debug\vm_exec.obj"
|
"\XASH3D\src_main\!source\temp\engine\!debug\vm_exec.obj"
|
||||||
]
|
]
|
||||||
Creating command line "link.exe @C:\Temp\RSP452.tmp"
|
Creating command line "link.exe @C:\Temp\RSP8A.tmp"
|
||||||
Creating temporary file "C:\Temp\RSP453.bat" with contents
|
Creating temporary file "C:\Temp\RSP8B.bat" with contents
|
||||||
[
|
[
|
||||||
@echo off
|
@echo off
|
||||||
copy \XASH3D\src_main\!source\temp\engine\!debug\engine.dll "D:\Xash3D\bin\engine.dll"
|
copy \XASH3D\src_main\!source\temp\engine\!debug\engine.dll "D:\Xash3D\bin\engine.dll"
|
||||||
]
|
]
|
||||||
Creating command line "C:\Temp\RSP453.bat"
|
Creating command line "C:\Temp\RSP8B.bat"
|
||||||
Compiling...
|
Compiling...
|
||||||
system.c
|
sv_user.c
|
||||||
Linking...
|
Linking...
|
||||||
<h3>Output Window</h3>
|
<h3>Output Window</h3>
|
||||||
Performing Custom Build Step on \XASH3D\src_main\!source\temp\engine\!debug\engine.dll
|
Performing Custom Build Step on \XASH3D\src_main\!source\temp\engine\!debug\engine.dll
|
||||||
|
|
|
@ -214,8 +214,12 @@ void Host_Main( void )
|
||||||
DispatchMessage (&msg);
|
DispatchMessage (&msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
newtime = Sys_DoubleTime();
|
do
|
||||||
host.realtime = newtime - oldtime;
|
{
|
||||||
|
newtime = Sys_DoubleTime();
|
||||||
|
host.realtime = newtime - oldtime;
|
||||||
|
|
||||||
|
} while (host.realtime < 0.001);
|
||||||
|
|
||||||
Host_Frame (host.realtime);
|
Host_Frame (host.realtime);
|
||||||
oldtime = newtime;
|
oldtime = newtime;
|
||||||
|
|
|
@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
typedef struct link_s
|
typedef struct link_s
|
||||||
{
|
{
|
||||||
struct link_s *prev, *next;
|
struct link_s *prev, *next;
|
||||||
int entitynumber;
|
int entnum; // get edict by number
|
||||||
} link_t;
|
} link_t;
|
||||||
|
|
||||||
typedef struct server_edict_s
|
typedef struct server_edict_s
|
||||||
|
|
|
@ -107,19 +107,18 @@ typedef void (*prvm_builtin_t) (void);
|
||||||
// NOTE: external code has to create and free the mempools but everything else is done by prvm !
|
// NOTE: external code has to create and free the mempools but everything else is done by prvm !
|
||||||
typedef struct prvm_prog_s
|
typedef struct prvm_prog_s
|
||||||
{
|
{
|
||||||
dprograms_t *progs;
|
dprograms_t *progs;
|
||||||
mfunction_t *functions;
|
mfunction_t *functions;
|
||||||
char *strings;
|
char *strings;
|
||||||
int stringssize;
|
int stringssize;
|
||||||
ddef_t *fielddefs;
|
ddef_t *fielddefs;
|
||||||
ddef_t *globaldefs;
|
ddef_t *globaldefs;
|
||||||
dstatement_t *statements;
|
dstatement_t *statements;
|
||||||
int edict_size; // in bytes
|
int edict_size; // in bytes
|
||||||
int edictareasize; // LordHavoc: in bytes (for bound checking)
|
int edictareasize; // in bytes (for bound checking)
|
||||||
|
|
||||||
int *statement_linenums;// NULL if not available
|
int *statement_linenums;// NULL if not available
|
||||||
|
double *statement_profile; // only incremented if prvm_statementprofiling is on
|
||||||
double *statement_profile; // only incremented if prvm_statementprofiling is on
|
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
@ -127,117 +126,117 @@ typedef struct prvm_prog_s
|
||||||
globalvars_t *server;
|
globalvars_t *server;
|
||||||
} globals;
|
} globals;
|
||||||
|
|
||||||
int maxknownstrings;
|
int maxknownstrings;
|
||||||
int numknownstrings;
|
int numknownstrings;
|
||||||
|
|
||||||
// this is updated whenever a string is removed or added
|
// this is updated whenever a string is removed or added
|
||||||
// (simple optimization of the free string search)
|
// (simple optimization of the free string search)
|
||||||
int firstfreeknownstring;
|
int firstfreeknownstring;
|
||||||
const char **knownstrings;
|
const char **knownstrings;
|
||||||
unsigned char *knownstrings_freeable;
|
byte *knownstrings_freeable;
|
||||||
const char ***stringshash;
|
const char ***stringshash;
|
||||||
|
|
||||||
// all memory allocations related to this vm_prog (code, edicts, strings)
|
// all memory allocations related to this vm_prog (code, edicts, strings)
|
||||||
byte *progs_mempool; // [INIT]
|
byte *progs_mempool; // [INIT]
|
||||||
|
|
||||||
prvm_builtin_t *builtins; // [INIT]
|
prvm_builtin_t *builtins; // [INIT]
|
||||||
int numbuiltins; // [INIT]
|
int numbuiltins; // [INIT]
|
||||||
|
|
||||||
int argc;
|
int argc;
|
||||||
|
|
||||||
int trace;
|
int trace;
|
||||||
mfunction_t *xfunction;
|
mfunction_t *xfunction;
|
||||||
int xstatement;
|
int xstatement;
|
||||||
|
|
||||||
// stacktrace writes into stack[MAX_STACK_DEPTH]
|
// stacktrace writes into stack[MAX_STACK_DEPTH]
|
||||||
// thus increase the array, so depth wont be overwritten
|
// thus increase the array, so depth wont be overwritten
|
||||||
prvm_stack_t stack[PRVM_MAX_STACK_DEPTH+1];
|
prvm_stack_t stack[PRVM_MAX_STACK_DEPTH + 1];
|
||||||
int depth;
|
int depth;
|
||||||
|
|
||||||
int localstack[PRVM_LOCALSTACK_SIZE];
|
int localstack[PRVM_LOCALSTACK_SIZE];
|
||||||
int localstack_used;
|
int localstack_used;
|
||||||
|
|
||||||
word filecrc;
|
word filecrc;
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// until this point everything also exists (with the pr_ prefix) in the old vm
|
// until this point everything also exists (with the pr_ prefix) in the old vm
|
||||||
|
|
||||||
file_t *openfiles[PRVM_MAX_OPENFILES];
|
file_t *openfiles[PRVM_MAX_OPENFILES];
|
||||||
search_t *opensearches[PRVM_MAX_OPENSEARCHES];
|
search_t *opensearches[PRVM_MAX_OPENSEARCHES];
|
||||||
|
|
||||||
// copies of some vars that were former read from sv
|
// copies of some vars that were former read from sv
|
||||||
int num_edicts;
|
int num_edicts;
|
||||||
// number of edicts for which space has been (should be) allocated
|
// number of edicts for which space has been (should be) allocated
|
||||||
int max_edicts; // [INIT]
|
int max_edicts; // [INIT]
|
||||||
// used instead of the constant MAX_EDICTS
|
// used instead of the constant MAX_EDICTS
|
||||||
int limit_edicts; // [INIT]
|
int limit_edicts; // [INIT]
|
||||||
|
|
||||||
// number of reserved edicts (allocated from 1)
|
// number of reserved edicts (allocated from 1)
|
||||||
int reserved_edicts; // [INIT]
|
int reserved_edicts; // [INIT]
|
||||||
|
|
||||||
prvm_edict_t *edicts;
|
prvm_edict_t *edicts;
|
||||||
void *edictsfields;
|
void *edictsfields;
|
||||||
void *edictprivate;
|
void *edictprivate;
|
||||||
|
|
||||||
// size of the engine private struct
|
// size of the engine private struct
|
||||||
int edictprivate_size; // [INIT]
|
int edictprivate_size; // [INIT]
|
||||||
|
|
||||||
// has to be updated every frame - so the vm time is up-to-date
|
// has to be updated every frame - so the vm time is up-to-date
|
||||||
// AK changed so time will point to the time field (if there is one) else it points to _time
|
// AK changed so time will point to the time field (if there is one) else it points to _time
|
||||||
// actually should be double, but qc doesnt support it
|
// actually should be double, but qc doesnt support it
|
||||||
float *time;
|
float *time;
|
||||||
float _time;
|
float _time;
|
||||||
|
|
||||||
// allow writing to world entity fields, this is set by server init and
|
// allow writing to world entity fields, this is set by server init and
|
||||||
// cleared before first server frame
|
// cleared before first server frame
|
||||||
bool allowworldwrites;
|
bool protect_world;
|
||||||
|
|
||||||
// name of the prog, e.g. "Server", "Client" or "Menu" (used for text output)
|
// name of the prog, e.g. "Server", "Client" or "Menu" (used for text output)
|
||||||
char *name; // [INIT]
|
char *name; // [INIT]
|
||||||
|
|
||||||
// flag - used to store general flags like PRVM_GE_SELF, etc.
|
// flag - used to store general flags like PRVM_GE_SELF, etc.
|
||||||
int flag;
|
int flag;
|
||||||
|
|
||||||
char *extensionstring; // [INIT]
|
char *extensionstring; // [INIT]
|
||||||
|
|
||||||
bool loadintoworld; // [INIT]
|
bool loadintoworld; // [INIT]
|
||||||
|
|
||||||
// used to indicate whether a prog is loaded
|
// used to indicate whether a prog is loaded
|
||||||
bool loaded;
|
bool loaded;
|
||||||
|
|
||||||
// now passes as parameter of PRVM_LoadProgs
|
|
||||||
// char **required_func;
|
|
||||||
// int numrequiredfunc;
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
ddef_t *self; // if self != 0 then there is a global self
|
ddef_t *self; // if self != 0 then there is a global self
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
// function pointers
|
// function pointers
|
||||||
|
|
||||||
void (*begin_increase_edicts)(void); // [INIT] used by PRVM_MEM_Increase_Edicts
|
void (*begin_increase_edicts)(void); // [INIT] used by PRVM_MEM_Increase_Edicts
|
||||||
void (*end_increase_edicts)(void); // [INIT]
|
void (*end_increase_edicts)(void); // [INIT]
|
||||||
|
|
||||||
void (*init_edict)(prvm_edict_t *edict); // [INIT] used by PRVM_ED_ClearEdict
|
void (*init_edict)(prvm_edict_t *edict); // [INIT] used by PRVM_ED_ClearEdict
|
||||||
void (*free_edict)(prvm_edict_t *ed); // [INIT] used by PRVM_ED_Free
|
void (*free_edict)(prvm_edict_t *ed); // [INIT] used by PRVM_ED_Free
|
||||||
|
|
||||||
void (*count_edicts)(void); // [INIT] used by PRVM_ED_Count_f
|
void (*count_edicts)(void); // [INIT] used by PRVM_ED_Count_f
|
||||||
|
|
||||||
bool (*load_edict)(prvm_edict_t *ent); // [INIT] used by PRVM_ED_LoadFromFile
|
bool (*load_edict)(prvm_edict_t *ent); // [INIT] used by PRVM_ED_LoadFromFile
|
||||||
|
|
||||||
void (*init_cmd)(void); // [INIT] used by PRVM_InitProg
|
void (*init_cmd)(void); // [INIT] used by PRVM_InitProg
|
||||||
void (*reset_cmd)(void); // [INIT] used by PRVM_ResetProg
|
void (*reset_cmd)(void); // [INIT] used by PRVM_ResetProg
|
||||||
|
|
||||||
void (*error_cmd)(const char *format, ...); // [INIT]
|
void (*error_cmd)(const char *format, ...); // [INIT]
|
||||||
|
|
||||||
} prvm_prog_t;
|
} prvm_prog_t;
|
||||||
|
|
||||||
extern prvm_prog_t *prog;
|
extern prvm_prog_t *prog;
|
||||||
|
|
||||||
#define PRVM_MAXPROGS 3
|
enum
|
||||||
#define PRVM_SERVERPROG 0 // actually not used at the moment
|
{
|
||||||
#define PRVM_CLIENTPROG 1
|
PRVM_SERVERPROG = 0,
|
||||||
#define PRVM_MENUPROG 2
|
PRVM_CLIENTPROG,
|
||||||
|
PRVM_MENUPROG,
|
||||||
|
PRVM_MAXPROGS, // must be last
|
||||||
|
};
|
||||||
|
|
||||||
extern prvm_prog_t prvm_prog_list[PRVM_MAXPROGS];
|
extern prvm_prog_t prvm_prog_list[PRVM_MAXPROGS];
|
||||||
|
|
||||||
|
@ -291,7 +290,9 @@ void PRVM_Crash (void);
|
||||||
int PRVM_ED_FindFieldOffset(const char *field);
|
int PRVM_ED_FindFieldOffset(const char *field);
|
||||||
int PRVM_ED_FindGlobalOffset(const char *global);
|
int PRVM_ED_FindGlobalOffset(const char *global);
|
||||||
ddef_t *PRVM_ED_FindField (const char *name);
|
ddef_t *PRVM_ED_FindField (const char *name);
|
||||||
|
ddef_t *PRVM_ED_FindGlobal (const char *name);
|
||||||
mfunction_t *PRVM_ED_FindFunction (const char *name);
|
mfunction_t *PRVM_ED_FindFunction (const char *name);
|
||||||
|
func_t PRVM_ED_FindFunctionOffset(const char *function);
|
||||||
|
|
||||||
void PRVM_MEM_IncreaseEdicts(void);
|
void PRVM_MEM_IncreaseEdicts(void);
|
||||||
|
|
||||||
|
@ -310,27 +311,19 @@ void PRVM_ED_ParseGlobals (const char *data);
|
||||||
void PRVM_ED_LoadFromFile (const char *data);
|
void PRVM_ED_LoadFromFile (const char *data);
|
||||||
|
|
||||||
prvm_edict_t *PRVM_EDICT_NUM_ERROR(int n, char *filename, int fileline);
|
prvm_edict_t *PRVM_EDICT_NUM_ERROR(int n, char *filename, int fileline);
|
||||||
#define PRVM_EDICT_NUM(n) (((n) >= 0 && (n) < prog->max_edicts) ? prog->edicts + (n) : PRVM_EDICT_NUM_ERROR(n, __FILE__, __LINE__))
|
#define PRVM_EDICT_NUM(n) (((n) >= 0 && (n) < prog->max_edicts) ? prog->edicts + (n) : PRVM_EDICT_NUM_ERROR(n, __FILE__, __LINE__))
|
||||||
#define PRVM_EDICT_NUM_UNSIGNED(n) (((n) < prog->max_edicts) ? prog->edicts + (n) : PRVM_EDICT_NUM_ERROR(n, __FILE__, __LINE__))
|
#define PRVM_EDICT_NUM_UNSIGNED(n) (((n) < prog->max_edicts) ? prog->edicts + (n) : PRVM_EDICT_NUM_ERROR(n, __FILE__, __LINE__))
|
||||||
#define PRVM_EDICT_FROM_AREA(l) ((prvm_edict_t *)((byte *)l - (int)&(((prvm_edict_t *)0)->priv.sv->area)))
|
|
||||||
|
|
||||||
//int NUM_FOR_EDICT_ERROR(prvm_edict_t *e);
|
|
||||||
#define PRVM_NUM_FOR_EDICT(e) ((int)((prvm_edict_t *)(e) - prog->edicts))
|
#define PRVM_NUM_FOR_EDICT(e) ((int)((prvm_edict_t *)(e) - prog->edicts))
|
||||||
//int PRVM_NUM_FOR_EDICT(prvm_edict_t *e);
|
#define PRVM_NEXT_EDICT(e) ((e) + 1)
|
||||||
|
|
||||||
#define PRVM_NEXT_EDICT(e) ((e) + 1)
|
|
||||||
|
|
||||||
#define PRVM_EDICT_TO_PROG(e) (PRVM_NUM_FOR_EDICT(e))
|
#define PRVM_EDICT_TO_PROG(e) (PRVM_NUM_FOR_EDICT(e))
|
||||||
//int PRVM_EDICT_TO_PROG(prvm_edict_t *e);
|
|
||||||
#define PRVM_PROG_TO_EDICT(n) (PRVM_EDICT_NUM(n))
|
#define PRVM_PROG_TO_EDICT(n) (PRVM_EDICT_NUM(n))
|
||||||
//prvm_edict_t *PRVM_PROG_TO_EDICT(int n);
|
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#define PRVM_G_FLOAT(o) (prog->globals.generic[o])
|
#define PRVM_G_FLOAT(o) (prog->globals.generic[o])
|
||||||
#define PRVM_G_INT(o) (*(int *)&prog->globals.generic[o])
|
#define PRVM_G_INT(o) (*(int *)&prog->globals.generic[o])
|
||||||
#define PRVM_G_EDICT(o) (PRVM_PROG_TO_EDICT(*(int *)&prog->globals.generic[o]))
|
#define PRVM_G_EDICT(o) (PRVM_PROG_TO_EDICT(*(int *)&prog->globals.generic[o]))
|
||||||
#define PRVM_G_EDICTNUM(o) PRVM_NUM_FOR_EDICT(PRVM_G_EDICT(o))
|
#define PRVM_G_EDICTNUM(o) PRVM_NUM_FOR_EDICT(PRVM_G_EDICT(o))
|
||||||
#define PRVM_G_VECTOR(o) (&prog->globals.generic[o])
|
#define PRVM_G_VECTOR(o) (&prog->globals.generic[o])
|
||||||
#define PRVM_G_STRING(o) (PRVM_GetString(*(string_t *)&prog->globals.generic[o]))
|
#define PRVM_G_STRING(o) (PRVM_GetString(*(string_t *)&prog->globals.generic[o]))
|
||||||
//#define PRVM_G_FUNCTION(o) (*(func_t *)&prog->globals.generic[o])
|
//#define PRVM_G_FUNCTION(o) (*(func_t *)&prog->globals.generic[o])
|
||||||
|
@ -341,7 +334,7 @@ prvm_edict_t *PRVM_EDICT_NUM_ERROR(int n, char *filename, int fileline);
|
||||||
//#define PRVM_E_VECTOR(e,o) (&((float*)e->fields.vp)[o])
|
//#define PRVM_E_VECTOR(e,o) (&((float*)e->fields.vp)[o])
|
||||||
#define PRVM_E_STRING(e,o) (PRVM_GetString(*(string_t *)&((float*)e->fields.vp)[o]))
|
#define PRVM_E_STRING(e,o) (PRVM_GetString(*(string_t *)&((float*)e->fields.vp)[o]))
|
||||||
|
|
||||||
extern int prvm_type_size[8]; // for consistency : I think a goal of this sub-project is to
|
extern int prvm_type_size[8]; // for consistency : I think a goal of this sub-project is to
|
||||||
// make the new vm mostly independent from the old one, thus if it's necessary, I copy everything
|
// make the new vm mostly independent from the old one, thus if it's necessary, I copy everything
|
||||||
|
|
||||||
void PRVM_Init_Exec(void);
|
void PRVM_Init_Exec(void);
|
||||||
|
@ -356,28 +349,13 @@ void PRVM_FreeString(int num);
|
||||||
|
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
// used as replacement for a prog stack
|
|
||||||
//#define PRVM_DEBUGPRSTACK
|
|
||||||
|
|
||||||
#ifdef PRVM_DEBUGPRSTACK
|
|
||||||
#define PRVM_Begin if(prog != 0) Con_Printf("prog not 0(prog = %i) in file: %s line: %i!\n", PRVM_GetProgNr(), __FILE__, __LINE__)
|
|
||||||
#define PRVM_End prog = 0
|
|
||||||
#else
|
|
||||||
#define PRVM_Begin
|
#define PRVM_Begin
|
||||||
#define PRVM_End prog = 0
|
#define PRVM_End prog = 0
|
||||||
#endif
|
#define PRVM_NAME (prog->name ? prog->name : "unnamed.dat")
|
||||||
|
|
||||||
//#define PRVM_SAFENAME
|
|
||||||
#ifndef PRVM_SAFENAME
|
|
||||||
# define PRVM_NAME (prog->name)
|
|
||||||
#else
|
|
||||||
# define PRVM_NAME (prog->name ? prog->name : "Unknown prog name")
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// helper macro to make function pointer calls easier
|
// helper macro to make function pointer calls easier
|
||||||
#define PRVM_GCALL(func) if(prog->func) prog->func
|
#define PRVM_GCALL(func) if(prog->func) prog->func
|
||||||
|
#define PRVM_ERROR prog->error_cmd
|
||||||
#define PRVM_ERROR prog->error_cmd
|
|
||||||
|
|
||||||
// other prog handling functions
|
// other prog handling functions
|
||||||
bool PRVM_SetProgFromString(const char *str);
|
bool PRVM_SetProgFromString(const char *str);
|
||||||
|
@ -396,7 +374,7 @@ void PRVM_ResetProg(void);
|
||||||
|
|
||||||
bool PRVM_ProgLoaded(int prognr);
|
bool PRVM_ProgLoaded(int prognr);
|
||||||
|
|
||||||
int PRVM_GetProgNr(void);
|
int PRVM_GetProgNr(void);
|
||||||
|
|
||||||
void VM_Warning(const char *fmt, ...);
|
void VM_Warning(const char *fmt, ...);
|
||||||
void VM_Error(const char *fmt, ...);
|
void VM_Error(const char *fmt, ...);
|
||||||
|
|
|
@ -26,7 +26,7 @@ prvm_prog_t *prog;
|
||||||
|
|
||||||
static prvm_prog_t prog_list[PRVM_MAXPROGS];
|
static prvm_prog_t prog_list[PRVM_MAXPROGS];
|
||||||
|
|
||||||
int prvm_type_size[8] = {1,sizeof(string_t)/4,1,3,1,1,sizeof(func_t)/4,sizeof(void *)/4};
|
int prvm_type_size[8] = {1, sizeof(string_t)/4,1,3,1,1, sizeof(func_t)/4, sizeof(void *)/4};
|
||||||
|
|
||||||
ddef_t *PRVM_ED_FieldAtOfs(int ofs);
|
ddef_t *PRVM_ED_FieldAtOfs(int ofs);
|
||||||
bool PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s);
|
bool PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s);
|
||||||
|
@ -120,19 +120,25 @@ int PRVM_ED_FindFieldOffset(const char *field)
|
||||||
{
|
{
|
||||||
ddef_t *d;
|
ddef_t *d;
|
||||||
d = PRVM_ED_FindField(field);
|
d = PRVM_ED_FindField(field);
|
||||||
if (!d)
|
if (!d) return 0;
|
||||||
return 0;
|
return d->ofs * 4;
|
||||||
return d->ofs*4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ddef_t* PRVM_ED_FindGlobal(const char *name);
|
|
||||||
int PRVM_ED_FindGlobalOffset(const char *global)
|
int PRVM_ED_FindGlobalOffset(const char *global)
|
||||||
{
|
{
|
||||||
ddef_t *d;
|
ddef_t *d;
|
||||||
d = PRVM_ED_FindGlobal(global);
|
d = PRVM_ED_FindGlobal(global);
|
||||||
if (!d)
|
if (!d) return 0;
|
||||||
|
return d->ofs * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
func_t PRVM_ED_FindFunctionOffset(const char *function)
|
||||||
|
{
|
||||||
|
mfunction_t *f;
|
||||||
|
f = PRVM_ED_FindFunction(function);
|
||||||
|
if (!f)
|
||||||
return 0;
|
return 0;
|
||||||
return d->ofs*4;
|
return (func_t)(f - prog->functions);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PRVM_ProgLoaded(int prognr)
|
bool PRVM_ProgLoaded(int prognr)
|
||||||
|
@ -226,7 +232,7 @@ prvm_edict_t *PRVM_ED_Alloc (void)
|
||||||
// AK: changed i=svs.maxclients+1
|
// AK: changed i=svs.maxclients+1
|
||||||
// AK: changed so the edict 0 wont spawn -> used as reserved/world entity
|
// AK: changed so the edict 0 wont spawn -> used as reserved/world entity
|
||||||
// although the menu/client has no world
|
// although the menu/client has no world
|
||||||
for (i = prog->reserved_edicts + 1;i < prog->num_edicts;i++)
|
for (i = prog->reserved_edicts + 1; i < prog->num_edicts; i++)
|
||||||
{
|
{
|
||||||
e = PRVM_EDICT_NUM(i);
|
e = PRVM_EDICT_NUM(i);
|
||||||
// the first couple seconds of server time can involve a lot of
|
// the first couple seconds of server time can involve a lot of
|
||||||
|
@ -948,10 +954,8 @@ bool PRVM_ED_ParseEpair(prvm_edict_t *ent, ddef_t *key, const char *s)
|
||||||
MsgDev(D_WARN, "PRVM_ED_ParseEpair: ev_entity reference too large (edict %u >= MAX_EDICTS %u) on %s\n", (uint)i, (uint)MAX_EDICTS, PRVM_NAME);
|
MsgDev(D_WARN, "PRVM_ED_ParseEpair: ev_entity reference too large (edict %u >= MAX_EDICTS %u) on %s\n", (uint)i, (uint)MAX_EDICTS, PRVM_NAME);
|
||||||
while (i >= prog->max_edicts)
|
while (i >= prog->max_edicts)
|
||||||
PRVM_MEM_IncreaseEdicts();
|
PRVM_MEM_IncreaseEdicts();
|
||||||
//SV_IncreaseEdicts();
|
// if IncreaseEdicts was called the base pointer needs to be updated
|
||||||
// if SV_IncreaseEdicts was called the base pointer needs to be updated
|
if (ent) val = (prvm_eval_t *)((int *)ent->fields.vp + key->ofs);
|
||||||
if (ent)
|
|
||||||
val = (prvm_eval_t *)((int *)ent->fields.vp + key->ofs);
|
|
||||||
val->edict = PRVM_EDICT_TO_PROG(PRVM_EDICT_NUM((int)i));
|
val->edict = PRVM_EDICT_TO_PROG(PRVM_EDICT_NUM((int)i));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1131,8 +1135,7 @@ void PRVM_ED_LoadFromFile (const char *data)
|
||||||
prog->loadintoworld = false;
|
prog->loadintoworld = false;
|
||||||
ent = PRVM_EDICT_NUM(0);
|
ent = PRVM_EDICT_NUM(0);
|
||||||
}
|
}
|
||||||
else
|
else ent = PRVM_ED_Alloc();
|
||||||
ent = PRVM_ED_Alloc();
|
|
||||||
|
|
||||||
// clear it
|
// clear it
|
||||||
if (ent != prog->edicts) // hack
|
if (ent != prog->edicts) // hack
|
||||||
|
@ -1508,8 +1511,7 @@ void PRVM_LoadProgs (const char *filename, int numedfunc, char **ed_func, int nu
|
||||||
if(PRVM_ED_FindField ("classname"))
|
if(PRVM_ED_FindField ("classname"))
|
||||||
prog->flag |= PRVM_FE_CLASSNAME;
|
prog->flag |= PRVM_FE_CLASSNAME;
|
||||||
|
|
||||||
if(PRVM_ED_FindField ("nextthink") && PRVM_ED_FindField ("frame") && PRVM_ED_FindField ("think")
|
if(PRVM_ED_FindField ("nextthink") && PRVM_ED_FindField ("frame") && PRVM_ED_FindField ("think") && prog->flag && prog->self)
|
||||||
&& prog->flag && prog->self)
|
|
||||||
prog->flag |= PRVM_OP_STATE;
|
prog->flag |= PRVM_OP_STATE;
|
||||||
|
|
||||||
PRVM_GCALL(init_cmd)();
|
PRVM_GCALL(init_cmd)();
|
||||||
|
@ -1830,48 +1832,6 @@ prvm_edict_t *PRVM_EDICT_NUM_ERROR(int n, char *filename, int fileline)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
int NUM_FOR_EDICT_ERROR(prvm_edict_t *e)
|
|
||||||
{
|
|
||||||
PRVM_ERROR ("PRVM_NUM_FOR_EDICT: bad pointer %p (world is %p, entity number would be %i)", e, prog->edicts, e - prog->edicts);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int PRVM_NUM_FOR_EDICT(prvm_edict_t *e)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
n = e - prog->edicts;
|
|
||||||
if ((unsigned int)n >= prog->limit_edicts)
|
|
||||||
Host_Error ("PRVM_NUM_FOR_EDICT: bad pointer");
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
//int NoCrash_NUM_FOR_EDICT(prvm_edict_t *e)
|
|
||||||
//{
|
|
||||||
// return e - prog->edicts;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//#define PRVM_EDICT_TO_PROG(e) ((unsigned char *)(((prvm_edict_t *)e)->v) - (unsigned char *)(prog->edictsfields))
|
|
||||||
//#define PRVM_PROG_TO_EDICT(e) (prog->edicts + ((e) / (progs->entityfields * 4)))
|
|
||||||
int PRVM_EDICT_TO_PROG(prvm_edict_t *e)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
n = e - prog->edicts;
|
|
||||||
if ((unsigned int)n >= (unsigned int)prog->max_edicts)
|
|
||||||
Host_Error("PRVM_EDICT_TO_PROG: invalid edict %8p (number %i compared to world at %8p)", e, n, prog->edicts);
|
|
||||||
return n;// EXPERIMENTAL
|
|
||||||
//return (unsigned char *)e->v - (unsigned char *)prog->edictsfields;
|
|
||||||
}
|
|
||||||
prvm_edict_t *PRVM_PROG_TO_EDICT(int n)
|
|
||||||
{
|
|
||||||
if ((unsigned int)n >= (unsigned int)prog->max_edicts)
|
|
||||||
Host_Error("PRVM_PROG_TO_EDICT: invalid edict number %i", n);
|
|
||||||
return prog->edicts + n; // EXPERIMENTAL
|
|
||||||
//return prog->edicts + ((n) / (progs->entityfields * 4));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
const char *PRVM_GetString(int num)
|
const char *PRVM_GetString(int num)
|
||||||
{
|
{
|
||||||
if (num >= 0 && num < prog->stringssize)
|
if (num >= 0 && num < prog->stringssize)
|
||||||
|
@ -1901,7 +1861,7 @@ int PRVM_SetEngineString(const char *s)
|
||||||
if (prog->knownstrings[i] == s)
|
if (prog->knownstrings[i] == s)
|
||||||
return -1 - i;
|
return -1 - i;
|
||||||
// new unknown engine string
|
// new unknown engine string
|
||||||
MsgDev(D_WARN, "new engine string %p\n", s);
|
MsgDev(D_WARN, "new engine string %p\n", s );
|
||||||
for (i = prog->firstfreeknownstring;i < prog->numknownstrings;i++)
|
for (i = prog->firstfreeknownstring;i < prog->numknownstrings;i++)
|
||||||
if (!prog->knownstrings[i])
|
if (!prog->knownstrings[i])
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -702,7 +702,7 @@ chooseexecprogram:
|
||||||
PRVM_ERROR("%s attempted to address an invalid field (%i) in an edict", PRVM_NAME, OPB->_int);
|
PRVM_ERROR("%s attempted to address an invalid field (%i) in an edict", PRVM_NAME, OPB->_int);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (OPA->edict == 0 && !prog->allowworldwrites)
|
if (OPA->edict == 0 && prog->protect_world)
|
||||||
{
|
{
|
||||||
prog->xfunction->profile += (st - startst);
|
prog->xfunction->profile += (st - startst);
|
||||||
prog->xstatement = st - prog->statements;
|
prog->xstatement = st - prog->statements;
|
||||||
|
@ -710,7 +710,7 @@ chooseexecprogram:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ed = PRVM_PROG_TO_EDICT(OPA->edict);
|
ed = PRVM_PROG_TO_EDICT(OPA->edict);
|
||||||
OPC->_int = (unsigned char *)((int *)ed->fields.vp + OPB->_int) - (unsigned char *)prog->edictsfields;
|
OPC->_int = (byte *)((int *)ed->fields.vp + OPB->_int) - (unsigned char *)prog->edictsfields;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_LOAD_F:
|
case OP_LOAD_F:
|
||||||
|
|
|
@ -196,7 +196,7 @@ void SV_GameMap_f (void)
|
||||||
for (i = 0, cl = svs.clients; i < host.maxclients; i++, cl++)
|
for (i = 0, cl = svs.clients; i < host.maxclients; i++, cl++)
|
||||||
{
|
{
|
||||||
savedInuse[i] = cl->edict->priv.sv->free;
|
savedInuse[i] = cl->edict->priv.sv->free;
|
||||||
cl->edict->priv.sv->free = false;
|
cl->edict->priv.sv->free = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SV_WriteSaveFile( "save0" ); //autosave
|
SV_WriteSaveFile( "save0" ); //autosave
|
||||||
|
@ -243,7 +243,7 @@ void SV_Map_f (void)
|
||||||
SV_SendClientMessages ();
|
SV_SendClientMessages ();
|
||||||
SV_SpawnServer (level_path, NULL, NULL, ss_game, false, false);
|
SV_SpawnServer (level_path, NULL, NULL, ss_game, false, false);
|
||||||
Cbuf_CopyToDefer ();
|
Cbuf_CopyToDefer ();
|
||||||
//SV_BroadcastCommand ("reconnect\n");
|
//FIXME//SV_BroadcastCommand ("reconnect\n");
|
||||||
strncpy (svs.mapcmd, Cmd_Argv(1), sizeof(svs.mapcmd) - 1); // archive server state
|
strncpy (svs.mapcmd, Cmd_Argv(1), sizeof(svs.mapcmd) - 1); // archive server state
|
||||||
}
|
}
|
||||||
else Msg ("Can't loading %s\n", level_path);
|
else Msg ("Can't loading %s\n", level_path);
|
||||||
|
|
|
@ -325,7 +325,7 @@ void SV_WritePlayerstateToClient (client_frame_t *from, client_frame_t *to, size
|
||||||
MSG_WriteByte (msg, ps->blend[2] * 255);
|
MSG_WriteByte (msg, ps->blend[2] * 255);
|
||||||
MSG_WriteByte (msg, ps->blend[3] * 255);
|
MSG_WriteByte (msg, ps->blend[3] * 255);
|
||||||
}
|
}
|
||||||
if (pflags & PS_FOV) MSG_WriteFloat (msg, ps->fov);
|
if (pflags & PS_FOV) MSG_WriteByte (msg, ps->fov);
|
||||||
if (pflags & PS_RDFLAGS) MSG_WriteByte (msg, ps->rdflags);
|
if (pflags & PS_RDFLAGS) MSG_WriteByte (msg, ps->rdflags);
|
||||||
|
|
||||||
// send stats
|
// send stats
|
||||||
|
@ -526,10 +526,7 @@ void SV_BuildClientFrame (client_t *client)
|
||||||
// doors can legally straddle two areas, so
|
// doors can legally straddle two areas, so
|
||||||
// we may need to check another one
|
// we may need to check another one
|
||||||
if (!ent->priv.sv->areanum2 || !CM_AreasConnected (clientarea, ent->priv.sv->areanum2))
|
if (!ent->priv.sv->areanum2 || !CM_AreasConnected (clientarea, ent->priv.sv->areanum2))
|
||||||
{
|
continue; // blocked by a door
|
||||||
//Msg("blocked by a door [%i]\n", ent->priv.sv->state.number);
|
|
||||||
//continue; // blocked by a door
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// beams just check one point for PHS
|
// beams just check one point for PHS
|
||||||
|
@ -565,10 +562,7 @@ void SV_BuildClientFrame (client_t *client)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == ent->priv.sv->num_clusters)
|
if (i == ent->priv.sv->num_clusters)
|
||||||
{
|
continue; // not visible
|
||||||
//Msg("i == ent->priv.sv->num_clusters\n");
|
|
||||||
//continue; // not visible
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(int)ent->fields.sv->modelindex)
|
if (!(int)ent->fields.sv->modelindex)
|
||||||
|
@ -588,7 +582,7 @@ void SV_BuildClientFrame (client_t *client)
|
||||||
state = &svs.client_entities[svs.next_client_entities % svs.num_client_entities];
|
state = &svs.client_entities[svs.next_client_entities % svs.num_client_entities];
|
||||||
if (ent->priv.sv->state.number != e)
|
if (ent->priv.sv->state.number != e)
|
||||||
{
|
{
|
||||||
MsgWarn ("SV_BuildClientFrame: invalid ent->priv.sv->state.number %d\n", ent->priv.sv->state.number );
|
MsgWarn ("SV_BuildClientFrame: invalid ent->priv.sv->state.number %d (must be %d)\n", ent->priv.sv->state.number, e );
|
||||||
ent->priv.sv->state.number = e; // ptr to current entity such as entnumber
|
ent->priv.sv->state.number = e; // ptr to current entity such as entnumber
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,7 +642,7 @@ void SV_RecordDemoMessage (void)
|
||||||
while (e < prog->num_edicts)
|
while (e < prog->num_edicts)
|
||||||
{
|
{
|
||||||
// ignore ents without visible models unless they have an effect
|
// ignore ents without visible models unless they have an effect
|
||||||
if (ent->priv.sv->free && ent->priv.sv->state.number && (ent->fields.sv->modelindex || ent->fields.sv->effects || ent->priv.sv->state.sound || ent->priv.sv->state.event) && !((int)ent->fields.sv->flags & SVF_NOCLIENT))
|
if (!ent->priv.sv->free && ent->priv.sv->state.number && ((int)ent->fields.sv->modelindex || ent->fields.sv->effects || ent->priv.sv->state.sound || ent->priv.sv->state.event) && !((int)ent->fields.sv->flags & SVF_NOCLIENT))
|
||||||
MSG_WriteDeltaEntity (&nostate, &ent->priv.sv->state, &buf, false, true);
|
MSG_WriteDeltaEntity (&nostate, &ent->priv.sv->state, &buf, false, true);
|
||||||
e++;
|
e++;
|
||||||
ent = PRVM_EDICT_NUM(e);
|
ent = PRVM_EDICT_NUM(e);
|
||||||
|
|
|
@ -87,6 +87,43 @@ void SetMinMaxSize (prvm_edict_t *e, float *min, float *max, bool rotate)
|
||||||
SV_LinkEdict (e);
|
SV_LinkEdict (e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//test for stats
|
||||||
|
void PF_SetStats( void )
|
||||||
|
{
|
||||||
|
prvm_edict_t *e;
|
||||||
|
int stat_num;
|
||||||
|
const char *string;
|
||||||
|
short value;
|
||||||
|
|
||||||
|
e = PRVM_G_EDICT(OFS_PARM0);
|
||||||
|
|
||||||
|
if(!e->priv.sv->client) return;
|
||||||
|
|
||||||
|
stat_num = (int)PRVM_G_FLOAT(OFS_PARM1);
|
||||||
|
|
||||||
|
if(stat_num < 0 || stat_num > MAX_STATS) return;
|
||||||
|
|
||||||
|
string = PRVM_G_STRING(OFS_PARM2);
|
||||||
|
|
||||||
|
switch(stat_num)
|
||||||
|
{
|
||||||
|
case STAT_HEALTH_ICON:
|
||||||
|
value = SV_ImageIndex( string );
|
||||||
|
break;
|
||||||
|
case STAT_HEALTH:
|
||||||
|
value = atoi( string );
|
||||||
|
break;
|
||||||
|
case STAT_HELPICON:
|
||||||
|
value = SV_ImageIndex( string );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
MsgWarn("unknown stat type %d\n", stat_num );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e->priv.sv->client->stats[stat_num] = value;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
PF_setsize
|
PF_setsize
|
||||||
|
@ -1391,7 +1428,7 @@ PF_lightstyle, // #35 void(float style, string value) lightstyle
|
||||||
VM_rint, // #36 float(float v) rint
|
VM_rint, // #36 float(float v) rint
|
||||||
VM_floor, // #37 float(float v) floor
|
VM_floor, // #37 float(float v) floor
|
||||||
VM_ceil, // #38 float(float v) ceil
|
VM_ceil, // #38 float(float v) ceil
|
||||||
NULL, // #39
|
PF_SetStats, // #39 void(entity e, float f, string stats) setstats
|
||||||
PF_checkbottom, // #40 float(entity e) checkbottom
|
PF_checkbottom, // #40 float(entity e) checkbottom
|
||||||
PF_pointcontents, // #41 float(vector v) pointcontents
|
PF_pointcontents, // #41 float(vector v) pointcontents
|
||||||
NULL, // #42
|
NULL, // #42
|
||||||
|
|
|
@ -186,7 +186,11 @@ void SV_CreateBaseline (void)
|
||||||
{
|
{
|
||||||
svent = PRVM_EDICT_NUM(entnum);
|
svent = PRVM_EDICT_NUM(entnum);
|
||||||
|
|
||||||
if (!svent->priv.sv->free) continue;
|
if (svent->priv.sv->free)
|
||||||
|
{
|
||||||
|
Msg("Can't create baseline for entity [%d]\n", entnum );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!(int)svent->fields.sv->modelindex && !(int)svent->priv.sv->state.sound && !(int)svent->fields.sv->effects)
|
if (!(int)svent->fields.sv->modelindex && !(int)svent->priv.sv->state.sound && !(int)svent->fields.sv->effects)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -336,6 +340,7 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, server_stat
|
||||||
}
|
}
|
||||||
|
|
||||||
sv.state = ss_loading;
|
sv.state = ss_loading;
|
||||||
|
prog->protect_world = false;
|
||||||
|
|
||||||
if (serverstate != ss_game)
|
if (serverstate != ss_game)
|
||||||
{
|
{
|
||||||
|
@ -394,6 +399,7 @@ void SV_SpawnServer (char *server, char *spawnpoint, char *savename, server_stat
|
||||||
// all precaches are complete
|
// all precaches are complete
|
||||||
sv.state = serverstate;
|
sv.state = serverstate;
|
||||||
Com_SetServerState (sv.state);
|
Com_SetServerState (sv.state);
|
||||||
|
prog->protect_world = true;
|
||||||
|
|
||||||
// run two frames to allow everything to settle
|
// run two frames to allow everything to settle
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < 2; i++)
|
||||||
|
@ -583,7 +589,7 @@ void SV_VM_BeginIncreaseEdicts(void)
|
||||||
// links don't survive the transition, so unlink everything
|
// links don't survive the transition, so unlink everything
|
||||||
for (i = 0, ent = prog->edicts;i < prog->max_edicts;i++, ent++)
|
for (i = 0, ent = prog->edicts;i < prog->max_edicts;i++, ent++)
|
||||||
{
|
{
|
||||||
if (!ent->priv.sv->free) SV_UnlinkEdict(prog->edicts + i);
|
if (!ent->priv.sv->free) SV_UnlinkEdict(prog->edicts + i); //free old entity
|
||||||
memset(&ent->priv.sv->clusternums, 0, sizeof(ent->priv.sv->clusternums));
|
memset(&ent->priv.sv->clusternums, 0, sizeof(ent->priv.sv->clusternums));
|
||||||
}
|
}
|
||||||
SV_ClearWorld();
|
SV_ClearWorld();
|
||||||
|
|
|
@ -736,7 +736,7 @@ void SV_Frame (float time)
|
||||||
if (sv_showclamp->value) Msg ("sv lowclamp\n");
|
if (sv_showclamp->value) Msg ("sv lowclamp\n");
|
||||||
svs.realtime = sv.time - 0.1;
|
svs.realtime = sv.time - 0.1;
|
||||||
}
|
}
|
||||||
NET_Sleep(sv.time - svs.realtime);
|
NET_Sleep((sv.time - svs.realtime) * 0.001);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1224,15 +1224,6 @@ void SV_PhysicsStep (prvm_edict_t *ent)
|
||||||
|
|
||||||
void SV_PhysicsClient(prvm_edict_t *ent)
|
void SV_PhysicsClient(prvm_edict_t *ent)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
/*for (i = 0; i < 3; i++)
|
|
||||||
{
|
|
||||||
ent->priv.sv->client->pmove.origin[i] = ent->priv.sv->state.origin[i];
|
|
||||||
ent->priv.sv->client->pmove.velocity[i] = ent->fields.sv->velocity[i];
|
|
||||||
}*/
|
|
||||||
return;
|
|
||||||
|
|
||||||
SV_ApplyClientMove();
|
SV_ApplyClientMove();
|
||||||
SV_CheckVelocity(ent); // make sure the velocity is sane (not a NaN)
|
SV_CheckVelocity(ent); // make sure the velocity is sane (not a NaN)
|
||||||
SV_ClientThink();
|
SV_ClientThink();
|
||||||
|
@ -1356,10 +1347,26 @@ void SV_PhysicsEntity(prvm_edict_t *ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientEndServerFrame (prvm_edict_t *ent)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
ent->priv.sv->state.old_origin[i] = ent->priv.sv->state.origin[i];
|
||||||
|
ent->priv.sv->client->pmove.origin[i] = ent->priv.sv->state.origin[i]*8.0;
|
||||||
|
ent->priv.sv->client->pmove.velocity[i] = ent->fields.sv->velocity[i]*8.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void SV_Physics (void)
|
void SV_Physics (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
prvm_edict_t *ent;
|
prvm_edict_t *ent;
|
||||||
|
|
||||||
|
|
||||||
// we always need to bump framenum, even if we
|
// we always need to bump framenum, even if we
|
||||||
// don't run the world, otherwise the delta
|
// don't run the world, otherwise the delta
|
||||||
|
@ -1378,20 +1385,23 @@ void SV_Physics (void)
|
||||||
PRVM_ExecuteProgram (prog->globals.server->StartFrame, "QC function StartFrame is missing");
|
PRVM_ExecuteProgram (prog->globals.server->StartFrame, "QC function StartFrame is missing");
|
||||||
|
|
||||||
// run physics on the client entities
|
// run physics on the client entities
|
||||||
for (i = 1, ent = PRVM_EDICT_NUM(i), sv_client = svs.clients; i <= host.maxclients; i++, ent = PRVM_NEXT_EDICT(ent), sv_client++)
|
for (i = 1, sv_client = svs.clients; i < host.maxclients; i++, sv_client++)
|
||||||
{
|
{
|
||||||
if (!ent->priv.sv->free)
|
if (sv_client->edict->priv.sv->free) continue;
|
||||||
{
|
ClientEndServerFrame (sv_client->edict);
|
||||||
// don't do physics on disconnected clients, FrikBot relies on this
|
|
||||||
if (sv_client->state != cs_spawned)
|
// don't do physics on disconnected clients, FrikBot relies on this
|
||||||
memset(&sv_client->lastcmd, 0, sizeof(sv_client->lastcmd));
|
if (sv_client->state != cs_spawned)
|
||||||
else SV_PhysicsClient(ent);
|
memset(&sv_client->lastcmd, 0, sizeof(sv_client->lastcmd));
|
||||||
}
|
else SV_PhysicsClient(sv_client->edict);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (;i < prog->num_edicts; i++, ent = PRVM_NEXT_EDICT(ent))
|
for (i = 1;i < prog->num_edicts; i++)
|
||||||
{
|
{
|
||||||
if (!ent->priv.sv->free) SV_PhysicsEntity(ent);
|
ent = PRVM_EDICT_NUM( i );
|
||||||
|
if (ent->priv.sv->free) continue;
|
||||||
|
SV_PhysicsEntity(ent);
|
||||||
}
|
}
|
||||||
|
|
||||||
prog->globals.server->self = PRVM_EDICT_TO_PROG(prog->edicts);
|
prog->globals.server->self = PRVM_EDICT_TO_PROG(prog->edicts);
|
||||||
|
|
|
@ -258,8 +258,8 @@ void SV_Begin_f (void)
|
||||||
}
|
}
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
sv_player->priv.sv->client->pmove.origin[i] = sv_player->fields.sv->origin[i]*8.0;
|
sv_player->priv.sv->client->pmove.origin[i] = sv_player->priv.sv->state.origin[i] = sv_player->fields.sv->origin[i]*8.0;
|
||||||
//ent->client->ps.pmove.velocity[i] = ent->velocity[i]*8.0;
|
sv_player->priv.sv->client->pmove.velocity[i] = sv_player->fields.sv->velocity[i]*8.0;
|
||||||
}
|
}
|
||||||
sv_player->priv.sv->client->gunindex = SV_ModelIndex("models/weapons/v_glock.mdl" );
|
sv_player->priv.sv->client->gunindex = SV_ModelIndex("models/weapons/v_glock.mdl" );
|
||||||
sv_player->priv.sv->client->fov = 90;
|
sv_player->priv.sv->client->fov = 90;
|
||||||
|
@ -533,7 +533,7 @@ void SV_ClientRun (client_t *cl, usercmd_t *cmd)
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
pm.s.origin[i] = cl->edict->priv.sv->state.origin[i] * 8;
|
pm.s.origin[i] = cl->edict->fields.sv->origin[i] * 8;
|
||||||
pm.s.velocity[i] = cl->edict->fields.sv->velocity[i] * 8;
|
pm.s.velocity[i] = cl->edict->fields.sv->velocity[i] * 8;
|
||||||
}
|
}
|
||||||
pm.cmd = *cmd;
|
pm.cmd = *cmd;
|
||||||
|
@ -541,6 +541,8 @@ void SV_ClientRun (client_t *cl, usercmd_t *cmd)
|
||||||
pm.trace = PM_trace; // adds default parms
|
pm.trace = PM_trace; // adds default parms
|
||||||
pm.pointcontents = SV_PointContents;
|
pm.pointcontents = SV_PointContents;
|
||||||
|
|
||||||
|
Msg("org before pmove [%i %i %i]\n", pm.s.origin[0], pm.s.origin[1], pm.s.origin[2] );
|
||||||
|
|
||||||
Pmove (&pm); //run pmove
|
Pmove (&pm); //run pmove
|
||||||
|
|
||||||
// save results of pmove
|
// save results of pmove
|
||||||
|
@ -550,8 +552,9 @@ void SV_ClientRun (client_t *cl, usercmd_t *cmd)
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
cl->edict->priv.sv->state.origin[i] = (float)pm.s.origin[i]*0.125;
|
cl->edict->priv.sv->state.old_origin[i] = pm.s.origin[i]*0.125;
|
||||||
cl->edict->fields.sv->velocity[i] = (float)pm.s.velocity[i]*0.125;
|
cl->edict->fields.sv->origin[i] = pm.s.origin[i]*0.125;
|
||||||
|
cl->edict->fields.sv->velocity[i] = pm.s.velocity[i]*0.125;
|
||||||
}
|
}
|
||||||
VectorCopy (pm.mins, cl->edict->fields.sv->mins);
|
VectorCopy (pm.mins, cl->edict->fields.sv->mins);
|
||||||
VectorCopy (pm.maxs, cl->edict->fields.sv->maxs);
|
VectorCopy (pm.maxs, cl->edict->fields.sv->maxs);
|
||||||
|
@ -888,7 +891,7 @@ void SV_ExecuteClientMessage (client_t *cl)
|
||||||
int stringCmdCount;
|
int stringCmdCount;
|
||||||
int checksum, calculatedChecksum;
|
int checksum, calculatedChecksum;
|
||||||
int checksumIndex;
|
int checksumIndex;
|
||||||
bool move_issued;
|
bool move_issued;
|
||||||
int lastframe;
|
int lastframe;
|
||||||
|
|
||||||
sv_client = cl;
|
sv_client = cl;
|
||||||
|
@ -960,7 +963,9 @@ void SV_ExecuteClientMessage (client_t *cl)
|
||||||
MsgWarn("SV_ExecuteClientMessage: failed command checksum for %s (%d != %d)/%d\n", cl->name, calculatedChecksum, checksum, cl->netchan.incoming_sequence);
|
MsgWarn("SV_ExecuteClientMessage: failed command checksum for %s (%d != %d)/%d\n", cl->name, calculatedChecksum, checksum, cl->netchan.incoming_sequence);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Msg("sv_paused->value %g\n", sv_paused->value );
|
||||||
|
|
||||||
if (!sv_paused->value)
|
if (!sv_paused->value)
|
||||||
{
|
{
|
||||||
net_drop = cl->netchan.dropped;
|
net_drop = cl->netchan.dropped;
|
||||||
|
@ -988,4 +993,5 @@ void SV_ExecuteClientMessage (client_t *cl)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,8 +65,9 @@ void RemoveLink (link_t *l)
|
||||||
l->prev->next = l->next;
|
l->prev->next = l->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InsertLinkBefore (link_t *l, link_t *before)
|
void InsertLinkBefore (link_t *l, link_t *before, int entnum)
|
||||||
{
|
{
|
||||||
|
l->entnum = entnum;
|
||||||
l->next = before;
|
l->next = before;
|
||||||
l->prev = before->prev;
|
l->prev = before->prev;
|
||||||
l->prev->next = l;
|
l->prev->next = l;
|
||||||
|
@ -166,7 +167,11 @@ void SV_LinkEdict (prvm_edict_t *ent)
|
||||||
|
|
||||||
if (ent->priv.sv->area.prev) SV_UnlinkEdict (ent); // unlink from old position
|
if (ent->priv.sv->area.prev) SV_UnlinkEdict (ent); // unlink from old position
|
||||||
if (ent == prog->edicts) return; // don't add the world
|
if (ent == prog->edicts) return; // don't add the world
|
||||||
if (!ent->priv.sv->free) return;
|
if (ent->priv.sv->free)
|
||||||
|
{
|
||||||
|
Msg("Can't link entity [%d]\n", ent->priv.sv->state.number );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// set the size
|
// set the size
|
||||||
VectorSubtract (ent->fields.sv->maxs, ent->fields.sv->mins, ent->fields.sv->size);
|
VectorSubtract (ent->fields.sv->maxs, ent->fields.sv->mins, ent->fields.sv->size);
|
||||||
|
@ -217,7 +222,8 @@ void SV_LinkEdict (prvm_edict_t *ent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // normal
|
{
|
||||||
|
// normal
|
||||||
VectorAdd (ent->fields.sv->origin, ent->fields.sv->mins, ent->fields.sv->absmin);
|
VectorAdd (ent->fields.sv->origin, ent->fields.sv->mins, ent->fields.sv->absmin);
|
||||||
VectorAdd (ent->fields.sv->origin, ent->fields.sv->maxs, ent->fields.sv->absmax);
|
VectorAdd (ent->fields.sv->origin, ent->fields.sv->maxs, ent->fields.sv->absmax);
|
||||||
}
|
}
|
||||||
|
@ -309,8 +315,9 @@ void SV_LinkEdict (prvm_edict_t *ent)
|
||||||
}
|
}
|
||||||
|
|
||||||
// link it in
|
// link it in
|
||||||
if (ent->fields.sv->solid == SOLID_TRIGGER) InsertLinkBefore (&ent->priv.sv->area, &node->trigger_edicts);
|
if (ent->fields.sv->solid == SOLID_TRIGGER)
|
||||||
else InsertLinkBefore (&ent->priv.sv->area, &node->solid_edicts);
|
InsertLinkBefore (&ent->priv.sv->area, &node->trigger_edicts, PRVM_NUM_FOR_EDICT(ent));
|
||||||
|
else InsertLinkBefore (&ent->priv.sv->area, &node->solid_edicts, PRVM_NUM_FOR_EDICT(ent));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -335,7 +342,7 @@ void SV_AreaEdicts_r (areanode_t *node)
|
||||||
for (l = start->next; l != start; l = next)
|
for (l = start->next; l != start; l = next)
|
||||||
{
|
{
|
||||||
next = l->next;
|
next = l->next;
|
||||||
check = PRVM_EDICT_FROM_AREA(l);
|
check = PRVM_EDICT_NUM_UNSIGNED(l->entnum);
|
||||||
|
|
||||||
if (check->fields.sv->solid == SOLID_NOT) continue; // deactivated
|
if (check->fields.sv->solid == SOLID_NOT) continue; // deactivated
|
||||||
if (check->fields.sv->absmin[0] > area_maxs[0] || check->fields.sv->absmin[1] > area_maxs[1] || check->fields.sv->absmin[2] > area_maxs[2]
|
if (check->fields.sv->absmin[0] > area_maxs[0] || check->fields.sv->absmin[1] > area_maxs[1] || check->fields.sv->absmin[2] > area_maxs[2]
|
||||||
|
@ -355,10 +362,8 @@ void SV_AreaEdicts_r (areanode_t *node)
|
||||||
if (node->axis == -1) return; // terminal node
|
if (node->axis == -1) return; // terminal node
|
||||||
|
|
||||||
// recurse down both sides
|
// recurse down both sides
|
||||||
if ( area_maxs[node->axis] > node->dist )
|
if ( area_maxs[node->axis] > node->dist ) SV_AreaEdicts_r ( node->children[0] );
|
||||||
SV_AreaEdicts_r ( node->children[0] );
|
if ( area_mins[node->axis] < node->dist ) SV_AreaEdicts_r ( node->children[1] );
|
||||||
if ( area_mins[node->axis] < node->dist )
|
|
||||||
SV_AreaEdicts_r ( node->children[1] );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -85,6 +85,7 @@ void Sys_Init (void)
|
||||||
|
|
||||||
if (!GetVersionEx (&vinfo)) Sys_Error ("Couldn't get OS info");
|
if (!GetVersionEx (&vinfo)) Sys_Error ("Couldn't get OS info");
|
||||||
if (vinfo.dwMajorVersion < 4) Sys_Error ("%s requires windows version 4 or greater", GI.title);
|
if (vinfo.dwMajorVersion < 4) Sys_Error ("%s requires windows version 4 or greater", GI.title);
|
||||||
|
srand(time(NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -119,6 +120,8 @@ void Sys_SendKeyEvents (void)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
|
rand();
|
||||||
|
|
||||||
while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
|
while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
|
||||||
{
|
{
|
||||||
if (!GetMessage (&msg, NULL, 0, 0)) Sys_Quit ();
|
if (!GetMessage (&msg, NULL, 0, 0)) Sys_Quit ();
|
||||||
|
|
|
@ -462,6 +462,12 @@ char *FS_Title( void )
|
||||||
return GI.title;
|
return GI.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cvar_t *VID_Cvar_Set (const char *var_name, const char *value)
|
||||||
|
{
|
||||||
|
return Cvar_Set( var_name, value );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
VID_InitRenderer
|
VID_InitRenderer
|
||||||
|
@ -490,7 +496,7 @@ void VID_InitRenderer( void )
|
||||||
ri.gamedir = FS_Gamedir;
|
ri.gamedir = FS_Gamedir;
|
||||||
ri.title = FS_Title;
|
ri.title = FS_Title;
|
||||||
ri.Cvar_Get = Cvar_Get;
|
ri.Cvar_Get = Cvar_Get;
|
||||||
ri.Cvar_Set = Cvar_Set;
|
ri.Cvar_Set = VID_Cvar_Set;
|
||||||
ri.Cvar_SetValue = Cvar_SetValue;
|
ri.Cvar_SetValue = Cvar_SetValue;
|
||||||
ri.Vid_GetModeInfo = VID_GetModeInfo;
|
ri.Vid_GetModeInfo = VID_GetModeInfo;
|
||||||
ri.Vid_MenuInit = VID_MenuInit;
|
ri.Vid_MenuInit = VID_MenuInit;
|
||||||
|
|
|
@ -184,7 +184,6 @@ void() ClientConnect =
|
||||||
{
|
{
|
||||||
pprint(self, " has", " joined the game.");
|
pprint(self, " has", " joined the game.");
|
||||||
configstring (2, "sky"); //CS_SKY
|
configstring (2, "sky"); //CS_SKY
|
||||||
configstring (30, "4" ); //CS_MAXCLIENTS
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -278,7 +277,9 @@ void() PutClientInServer =
|
||||||
setmodel (self, "models/player.mdl"); // Set my player to the player model
|
setmodel (self, "models/player.mdl"); // Set my player to the player model
|
||||||
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX); // Set my size
|
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX); // Set my size
|
||||||
|
|
||||||
self.view_ofs = '0 0 72'; // Center my view
|
self.view_ofs = '0 0 22'; // Center my view
|
||||||
|
|
||||||
|
setsize(self, '-16 -16 -32', '16 16 32' );
|
||||||
|
|
||||||
if (self.aflag)
|
if (self.aflag)
|
||||||
CCamChasePlayer ();
|
CCamChasePlayer ();
|
||||||
|
@ -287,7 +288,11 @@ void() PutClientInServer =
|
||||||
|
|
||||||
self.th_pain = PlayerPain;
|
self.th_pain = PlayerPain;
|
||||||
self.th_die = PlayerDie;
|
self.th_die = PlayerDie;
|
||||||
|
|
||||||
|
setstats( self, STAT_HEALTH_ICON, "i_health");
|
||||||
|
setstats( self, STAT_HEALTH, ftos(self.health));
|
||||||
|
//setstats( self, STAT_HELPICON, "i_help");
|
||||||
|
|
||||||
GetLevelParms();
|
GetLevelParms();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
28
progs/defs.c
28
progs/defs.c
|
@ -166,6 +166,7 @@ void(float style, string value) lightstyle = #35;
|
||||||
float(float v) rint = #36; // round to nearest int
|
float(float v) rint = #36; // round to nearest int
|
||||||
float(float v) floor = #37; // largest integer <= v
|
float(float v) floor = #37; // largest integer <= v
|
||||||
float(float v) ceil = #38; // smallest integer >= v
|
float(float v) ceil = #38; // smallest integer >= v
|
||||||
|
void(entity e, float f, string stats) setstats = #39;
|
||||||
float(entity e) checkbottom = #40; // true if self is on ground
|
float(entity e) checkbottom = #40; // true if self is on ground
|
||||||
float(vector v) pointcontents = #41; // returns a CONTENT_*
|
float(vector v) pointcontents = #41; // returns a CONTENT_*
|
||||||
float(float f) fabs = #43;
|
float(float f) fabs = #43;
|
||||||
|
@ -213,6 +214,33 @@ void(entity e) setspawnparms = #78; // set parm1... to the
|
||||||
float FALSE = 0;
|
float FALSE = 0;
|
||||||
float TRUE = 1;
|
float TRUE = 1;
|
||||||
|
|
||||||
|
// newdefines
|
||||||
|
#define CS_STATUSBAR 5
|
||||||
|
|
||||||
|
#define CS_MAXCLIENTS 30
|
||||||
|
|
||||||
|
#define STAT_HEALTH_ICON 0
|
||||||
|
#define STAT_HEALTH 1.0
|
||||||
|
#define STAT_AMMO_ICON 2
|
||||||
|
#define STAT_AMMO 3
|
||||||
|
#define STAT_ARMOR_ICON 4
|
||||||
|
#define STAT_ARMOR 5
|
||||||
|
#define STAT_SELECTED_ICON 6
|
||||||
|
#define STAT_PICKUP_ICON 7
|
||||||
|
#define STAT_PICKUP_STRING 8
|
||||||
|
#define STAT_TIMER_ICON 9
|
||||||
|
#define STAT_TIMER 10
|
||||||
|
#define STAT_HELPICON 11
|
||||||
|
#define STAT_SELECTED_ITEM 12
|
||||||
|
#define STAT_LAYOUTS 13
|
||||||
|
#define STAT_FRAGS 14
|
||||||
|
#define STAT_FLASHES 15 // cleared each frame, 1 = health, 2 = armor
|
||||||
|
#define STAT_CHASE 16
|
||||||
|
#define STAT_SPECTATOR 17
|
||||||
|
#define STAT_SPEED 22
|
||||||
|
#define STAT_ZOOM 23
|
||||||
|
#define MAX_STATS 32
|
||||||
|
|
||||||
// edict.flags
|
// edict.flags
|
||||||
float FL_FLY = 1;
|
float FL_FLY = 1;
|
||||||
float FL_SWIM = 2;
|
float FL_SWIM = 2;
|
||||||
|
|
18
progs/main.c
18
progs/main.c
|
@ -83,6 +83,18 @@ void() GetLevelParms =
|
||||||
void() StartFrame = {};
|
void() StartFrame = {};
|
||||||
void() EndFrame = {};
|
void() EndFrame = {};
|
||||||
|
|
||||||
|
// hud program string
|
||||||
|
string single_statusbar =
|
||||||
|
"yb -24 xv 0 hnum xv 50 pic 0 \
|
||||||
|
if 2 { xv 100 anum xv 150 pic 2 } \
|
||||||
|
if 4 { xv 200 rnum xv 250 pic 4 } \
|
||||||
|
if 6 { xv 296 pic 6 } yb -50 \
|
||||||
|
if 7 { xv 0 pic 7 xv 26 yb -42 stat_string 8 yb -50 } \
|
||||||
|
if 9 { xv 230 num 4 10 xv 296 pic 9 } \
|
||||||
|
if 11 { xv 148 pic 11 } \
|
||||||
|
if 22 { yb -90 xv 128 pic 22 } \
|
||||||
|
if 23 { yv 0 xv 0 pic 23 }";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
|WORLDSPAWN():|
|
|WORLDSPAWN():|
|
||||||
|
@ -92,11 +104,13 @@ This function is called when the world spawns.
|
||||||
=================================================================================
|
=================================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void() worldspawn =
|
void worldspawn( void )
|
||||||
{
|
{
|
||||||
precaches();
|
precaches();
|
||||||
LightStyles_setup();
|
LightStyles_setup();
|
||||||
};
|
configstring (CS_MAXCLIENTS, "1" );
|
||||||
|
configstring (CS_STATUSBAR, single_statusbar );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
|
|
BIN
progs/qcclib.exe
BIN
progs/qcclib.exe
Binary file not shown.
BIN
progs/server.dat
BIN
progs/server.dat
Binary file not shown.
Reference in New Issue