mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 18:01:15 +00:00
Header cleanups (<strings.h> outside without HAVE_* tests and the like, multiply including several headers unless on windows, and other bizarre messes). Plus a hefty dose of whitespace.
This commit is contained in:
parent
272332bb2c
commit
277b141ec7
15 changed files with 713 additions and 1258 deletions
|
@ -35,8 +35,6 @@
|
|||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
#endif
|
||||
|
@ -61,27 +59,26 @@
|
|||
#ifdef HAVE_WINSOCK_H
|
||||
# include <winsock.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
#ifdef __sun__
|
||||
# include <sys/filio.h>
|
||||
#endif
|
||||
#ifdef NeXT
|
||||
# include <libc.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __sun__
|
||||
#include <sys/filio.h>
|
||||
#endif
|
||||
|
||||
#ifdef NeXT
|
||||
#include <libc.h>
|
||||
#endif
|
||||
|
||||
#include "compat.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/console.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "net.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -97,9 +94,9 @@
|
|||
|
||||
#ifndef HAVE_SOCKLEN_T
|
||||
# ifdef HAVE_SIZE
|
||||
typedef size_t socklen_t;
|
||||
typedef size_t socklen_t;
|
||||
# else
|
||||
typedef unsigned int socklen_t;
|
||||
typedef unsigned int socklen_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -107,7 +104,6 @@
|
|||
extern int close (int);
|
||||
|
||||
static int net_acceptsocket = -1; // socket for fielding new
|
||||
|
||||
// connections
|
||||
static int net_controlsocket;
|
||||
static int net_broadcastsocket = 0;
|
||||
|
@ -117,7 +113,6 @@ static unsigned long myAddr;
|
|||
|
||||
#include "net_udp.h"
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_Init (void)
|
||||
|
@ -148,7 +143,8 @@ UDP_Init (void)
|
|||
Sys_Error ("UDP_Init: Unable to open control socket\n");
|
||||
|
||||
((struct sockaddr_in *) &broadcastaddr)->sin_family = AF_INET;
|
||||
((struct sockaddr_in *) &broadcastaddr)->sin_addr.s_addr = INADDR_BROADCAST;
|
||||
((struct sockaddr_in *) &broadcastaddr)->sin_addr.s_addr =
|
||||
INADDR_BROADCAST;
|
||||
((struct sockaddr_in *) &broadcastaddr)->sin_port = htons (net_hostport);
|
||||
|
||||
UDP_GetSocketAddr (net_controlsocket, &addr);
|
||||
|
@ -163,8 +159,6 @@ UDP_Init (void)
|
|||
return net_controlsocket;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void
|
||||
UDP_Shutdown (void)
|
||||
{
|
||||
|
@ -172,8 +166,6 @@ UDP_Shutdown (void)
|
|||
UDP_CloseSocket (net_controlsocket);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
void
|
||||
UDP_Listen (qboolean state)
|
||||
{
|
||||
|
@ -192,8 +184,6 @@ UDP_Listen (qboolean state)
|
|||
net_acceptsocket = -1;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_OpenSocket (int port)
|
||||
{
|
||||
|
@ -225,8 +215,6 @@ UDP_OpenSocket (int port)
|
|||
return -1;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_CloseSocket (int socket)
|
||||
{
|
||||
|
@ -235,26 +223,18 @@ UDP_CloseSocket (int socket)
|
|||
return close (socket);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*
|
||||
============
|
||||
PartialIPAddress
|
||||
PartialIPAddress
|
||||
|
||||
this lets you type only as much of the net address as required, using
|
||||
the local network components to fill in the rest
|
||||
============
|
||||
this lets you type only as much of the net address as required, using
|
||||
the local network components to fill in the rest
|
||||
*/
|
||||
static int
|
||||
PartialIPAddress (const char *in, struct qsockaddr *hostaddr)
|
||||
{
|
||||
char buff[256];
|
||||
char *b;
|
||||
int addr;
|
||||
int num;
|
||||
int mask;
|
||||
int run;
|
||||
int port;
|
||||
int addr, mask, num, port, run;
|
||||
|
||||
buff[0] = '.';
|
||||
b = buff;
|
||||
|
@ -294,7 +274,6 @@ PartialIPAddress (const char *in, struct qsockaddr *hostaddr)
|
|||
|
||||
return 0;
|
||||
}
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_Connect (int socket, struct qsockaddr *addr)
|
||||
|
@ -302,8 +281,6 @@ UDP_Connect (int socket, struct qsockaddr *addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_CheckNewConnections (void)
|
||||
{
|
||||
|
@ -324,8 +301,6 @@ UDP_CheckNewConnections (void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_Read (int socket, byte * buf, int len, struct qsockaddr *addr)
|
||||
{
|
||||
|
@ -338,23 +313,20 @@ UDP_Read (int socket, byte * buf, int len, struct qsockaddr *addr)
|
|||
return ret;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_MakeSocketBroadcastCapable (int socket)
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
// make this socket broadcast capable
|
||||
if (setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) &i, sizeof (i)) <
|
||||
0) return -1;
|
||||
if (setsockopt (socket, SOL_SOCKET, SO_BROADCAST, (char *) &i,
|
||||
sizeof (i)) < 0)
|
||||
return -1;
|
||||
net_broadcastsocket = socket;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_Broadcast (int socket, byte * buf, int len)
|
||||
{
|
||||
|
@ -373,24 +345,18 @@ UDP_Broadcast (int socket, byte * buf, int len)
|
|||
return UDP_Write (socket, buf, len, &broadcastaddr);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_Write (int socket, byte * buf, int len, struct qsockaddr *addr)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret =
|
||||
|
||||
sendto (socket, buf, len, 0, (struct sockaddr *) addr,
|
||||
sizeof (struct qsockaddr));
|
||||
ret = sendto (socket, buf, len, 0, (struct sockaddr *) addr,
|
||||
sizeof (struct qsockaddr));
|
||||
if (ret == -1 && errno == EWOULDBLOCK)
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
const char *
|
||||
UDP_AddrToString (struct qsockaddr *addr)
|
||||
{
|
||||
|
@ -404,13 +370,10 @@ UDP_AddrToString (struct qsockaddr *addr)
|
|||
return buffer;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_StringToAddr (const char *string, struct qsockaddr *addr)
|
||||
{
|
||||
int ha1, ha2, ha3, ha4, hp;
|
||||
int ipaddr;
|
||||
int ha1, ha2, ha3, ha4, hp, ipaddr;
|
||||
|
||||
sscanf (string, "%d.%d.%d.%d:%d", &ha1, &ha2, &ha3, &ha4, &hp);
|
||||
ipaddr = (ha1 << 24) | (ha2 << 16) | (ha3 << 8) | ha4;
|
||||
|
@ -421,13 +384,11 @@ UDP_StringToAddr (const char *string, struct qsockaddr *addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_GetSocketAddr (int socket, struct qsockaddr *addr)
|
||||
{
|
||||
int addrlen = sizeof (struct qsockaddr);
|
||||
unsigned int a;
|
||||
int addrlen = sizeof (struct qsockaddr);
|
||||
|
||||
memset (addr, 0, sizeof (struct qsockaddr));
|
||||
|
||||
|
@ -439,8 +400,6 @@ UDP_GetSocketAddr (int socket, struct qsockaddr *addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_GetNameFromAddr (struct qsockaddr *addr, char *name)
|
||||
{
|
||||
|
@ -459,8 +418,6 @@ UDP_GetNameFromAddr (struct qsockaddr *addr, char *name)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_GetAddrFromName (const char *name, struct qsockaddr *addr)
|
||||
{
|
||||
|
@ -482,8 +439,6 @@ UDP_GetAddrFromName (const char *name, struct qsockaddr *addr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2)
|
||||
{
|
||||
|
@ -501,20 +456,15 @@ UDP_AddrCompare (struct qsockaddr *addr1, struct qsockaddr *addr2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
||||
int
|
||||
UDP_GetSocketPort (struct qsockaddr *addr)
|
||||
{
|
||||
return ntohs (((struct sockaddr_in *) addr)->sin_port);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
UDP_SetSocketPort (struct qsockaddr *addr, int port)
|
||||
{
|
||||
((struct sockaddr_in *) addr)->sin_port = htons (port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#endif
|
||||
|
||||
#include "QF/cvar.h"
|
||||
|
||||
#include "server.h"
|
||||
|
||||
void
|
||||
|
|
|
@ -36,21 +36,24 @@
|
|||
#include "QF/cvar.h"
|
||||
#include "QF/host.h"
|
||||
#include "QF/keys.h"
|
||||
|
||||
#include "client.h"
|
||||
|
||||
int m_return_state;
|
||||
qboolean m_return_onerror;
|
||||
char m_return_reason[32];
|
||||
enum { m_none, m_main, m_singleplayer, m_load, m_save, m_multiplayer, m_setup,
|
||||
m_net, m_options, m_video, m_keys, m_help, m_quit, m_serialconfig,
|
||||
m_modemconfig, m_lanconfig, m_gameoptions, m_search, m_slist
|
||||
m_net, m_options, m_video, m_keys, m_help, m_quit, m_serialconfig,
|
||||
m_modemconfig, m_lanconfig, m_gameoptions, m_search, m_slist
|
||||
} m_state;
|
||||
|
||||
keydest_t key_dest;
|
||||
client_static_t cls;
|
||||
client_state_t cl;
|
||||
vec3_t vright, vup, vleft, vpn;
|
||||
float scr_centertime_off;
|
||||
|
||||
|
||||
void
|
||||
Con_Printf (char *fmt, ...)
|
||||
{
|
||||
|
|
|
@ -30,12 +30,13 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/msg.h"
|
||||
#include "compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/cmd.h"
|
||||
|
||||
#include "compat.h"
|
||||
#include "host.h"
|
||||
#include "server.h"
|
||||
#include "sv_progs.h"
|
||||
|
@ -48,31 +49,25 @@ char localmodels[MAX_MODELS][5]; // inline model names for precache
|
|||
|
||||
entity_state_t baselines[MAX_EDICTS];
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
===============
|
||||
SV_Init
|
||||
===============
|
||||
*/
|
||||
void
|
||||
SV_Init (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
sv_maxvelocity = Cvar_Get ("sv_maxvelocity", "2000", CVAR_NONE, NULL,
|
||||
"None");
|
||||
"None");
|
||||
sv_gravity = Cvar_Get ("sv_gravity", "800", CVAR_SERVERINFO, Cvar_Info,
|
||||
"None");
|
||||
"None");
|
||||
sv_friction = Cvar_Get ("sv_friction", "4", CVAR_SERVERINFO, Cvar_Info,
|
||||
"None");
|
||||
"None");
|
||||
sv_edgefriction = Cvar_Get ("edgefriction", "2", CVAR_NONE, NULL, "None");
|
||||
sv_stopspeed = Cvar_Get ("sv_stopspeed", "100", CVAR_NONE, NULL, "None");
|
||||
sv_maxspeed = Cvar_Get ("sv_maxspeed", "320", CVAR_SERVERINFO, Cvar_Info,
|
||||
"None");
|
||||
"None");
|
||||
sv_accelerate = Cvar_Get ("sv_accelerate", "10", CVAR_NONE, NULL, "None");
|
||||
sv_idealpitchscale =
|
||||
Cvar_Get ("sv_idealpitchscale", "0.8", CVAR_NONE, NULL, "None");
|
||||
sv_idealpitchscale = Cvar_Get ("sv_idealpitchscale", "0.8", CVAR_NONE,
|
||||
NULL, "None");
|
||||
sv_aim = Cvar_Get ("sv_aim", "0.93", CVAR_NONE, NULL, "None");
|
||||
sv_nostep = Cvar_Get ("sv_nostep", "0", CVAR_NONE, NULL, "None");
|
||||
|
||||
|
@ -80,20 +75,12 @@ SV_Init (void)
|
|||
snprintf (localmodels[i], sizeof (localmodels[i]), "*%i", i);
|
||||
}
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
EVENT MESSAGES
|
||||
|
||||
=============================================================================
|
||||
*/
|
||||
// EVENT MESSAGES =============================================================
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_StartParticle
|
||||
SV_StartParticle
|
||||
|
||||
Make sure the event gets sent to all clients
|
||||
==================
|
||||
Make sure the event gets sent to all clients
|
||||
*/
|
||||
void
|
||||
SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
|
||||
|
@ -119,28 +106,22 @@ SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
|
|||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_StartSound
|
||||
SV_StartSound
|
||||
|
||||
Each entity can have eight independant sound sources, like voice,
|
||||
weapon, feet, etc.
|
||||
Each entity can have eight independant sound sources, like voice,
|
||||
weapon, feet, etc.
|
||||
|
||||
Channel 0 is an auto-allocate channel, the others override anything
|
||||
already running on that entity/channel pair.
|
||||
Channel 0 is an auto-allocate channel, the others override anything
|
||||
already running on that entity/channel pair.
|
||||
|
||||
An attenuation of 0 will play full volume everywhere in the level.
|
||||
Larger attenuations will drop off. (max 4 attenuation)
|
||||
|
||||
==================
|
||||
An attenuation of 0 will play full volume everywhere in the level.
|
||||
Larger attenuations will drop off. (max 4 attenuation)
|
||||
*/
|
||||
void
|
||||
SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
|
||||
float attenuation)
|
||||
{
|
||||
int sound_num;
|
||||
int field_mask;
|
||||
int i;
|
||||
int ent;
|
||||
int ent, field_mask, sound_num, i;
|
||||
|
||||
if (volume < 0 || volume > 255)
|
||||
Sys_Error ("SV_StartSound: volume = %i", volume);
|
||||
|
@ -154,7 +135,7 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
|
|||
if (sv.datagram.cursize > MAX_DATAGRAM - 16)
|
||||
return;
|
||||
|
||||
// find precache number for sound
|
||||
// find precache number for sound
|
||||
for (sound_num = 1; sound_num < MAX_SOUNDS
|
||||
&& sv.sound_precache[sound_num]; sound_num++)
|
||||
if (!strcmp (sample, sv.sound_precache[sound_num]))
|
||||
|
@ -175,7 +156,7 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
|
|||
if (attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
|
||||
field_mask |= SND_ATTENUATION;
|
||||
|
||||
// directed messages go only to the entity the are targeted on
|
||||
// directed messages go only to the entity the are targeted on
|
||||
MSG_WriteByte (&sv.datagram, svc_sound);
|
||||
MSG_WriteByte (&sv.datagram, field_mask);
|
||||
if (field_mask & SND_VOLUME)
|
||||
|
@ -185,26 +166,18 @@ SV_StartSound (edict_t *entity, int channel, const char *sample, int volume,
|
|||
MSG_WriteShort (&sv.datagram, channel);
|
||||
MSG_WriteByte (&sv.datagram, sound_num);
|
||||
for (i = 0; i < 3; i++)
|
||||
MSG_WriteCoord (&sv.datagram,
|
||||
SVvector (entity, origin)[i] + 0.5 * (SVvector (entity, mins)[i] +
|
||||
SVvector (entity, maxs)[i]));
|
||||
MSG_WriteCoord (&sv.datagram, SVvector (entity, origin)[i] + 0.5 *
|
||||
(SVvector (entity, mins)[i] +
|
||||
SVvector (entity, maxs)[i]));
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
CLIENT SPAWNING
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
// CLIENT SPAWNING ============================================================
|
||||
|
||||
/*
|
||||
================
|
||||
SV_SendServerinfo
|
||||
SV_SendServerinfo
|
||||
|
||||
Sends the first message from the server to a connected client.
|
||||
This will be sent on the initial connection and upon each server load.
|
||||
================
|
||||
Sends the first message from the server to a connected client.
|
||||
This will be sent on the initial connection and upon each server load.
|
||||
*/
|
||||
void
|
||||
SV_SendServerinfo (client_t *client)
|
||||
|
@ -239,12 +212,12 @@ SV_SendServerinfo (client_t *client)
|
|||
MSG_WriteString (&client->message, *s);
|
||||
MSG_WriteByte (&client->message, 0);
|
||||
|
||||
// send music
|
||||
// send music
|
||||
MSG_WriteByte (&client->message, svc_cdtrack);
|
||||
MSG_WriteByte (&client->message, SVfloat (sv.edicts, sounds));
|
||||
MSG_WriteByte (&client->message, SVfloat (sv.edicts, sounds));
|
||||
|
||||
// set view
|
||||
// set view
|
||||
MSG_WriteByte (&client->message, svc_setview);
|
||||
MSG_WriteShort (&client->message,
|
||||
NUM_FOR_EDICT (&sv_pr_state, client->edict));
|
||||
|
@ -257,12 +230,10 @@ SV_SendServerinfo (client_t *client)
|
|||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SV_ConnectClient
|
||||
SV_ConnectClient
|
||||
|
||||
Initializes a client_t for a new net connection. This will only be called
|
||||
once for a player each game, not once for each level change.
|
||||
================
|
||||
Initializes a client_t for a new net connection. This will only be called
|
||||
once for a player each game, not once for each level change.
|
||||
*/
|
||||
void
|
||||
SV_ConnectClient (int clientnum)
|
||||
|
@ -282,7 +253,7 @@ SV_ConnectClient (int clientnum)
|
|||
|
||||
ent = EDICT_NUM (&sv_pr_state, edictnum);
|
||||
|
||||
// set up the client_t
|
||||
// set up the client_t
|
||||
netconnection = client->netconnection;
|
||||
|
||||
if (sv.loadgame)
|
||||
|
@ -313,30 +284,19 @@ SV_ConnectClient (int clientnum)
|
|||
SV_SendServerinfo (client);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
SV_CheckForNewClients
|
||||
|
||||
===================
|
||||
*/
|
||||
void
|
||||
SV_CheckForNewClients (void)
|
||||
{
|
||||
struct qsocket_s *ret;
|
||||
int i;
|
||||
struct qsocket_s *ret;
|
||||
|
||||
//
|
||||
// check for new connections
|
||||
//
|
||||
// check for new connections
|
||||
while (1) {
|
||||
ret = NET_CheckNewConnections ();
|
||||
if (!ret)
|
||||
break;
|
||||
|
||||
//
|
||||
// init a new client structure
|
||||
//
|
||||
for (i = 0; i < svs.maxclients; i++)
|
||||
if (!svs.clients[i].active)
|
||||
break;
|
||||
|
@ -350,22 +310,8 @@ SV_CheckForNewClients (void)
|
|||
}
|
||||
}
|
||||
|
||||
// FRAME UPDATES ==============================================================
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
FRAME UPDATES
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_ClearDatagram
|
||||
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SV_ClearDatagram (void)
|
||||
{
|
||||
|
@ -373,14 +319,10 @@ SV_ClearDatagram (void)
|
|||
}
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
The PVS must include a small area around the client to allow head bobbing
|
||||
or other small motion on the client side. Otherwise, a bob might cause an
|
||||
entity that should be visible to not show up, especially when the bob
|
||||
crosses a waterline.
|
||||
|
||||
=============================================================================
|
||||
The PVS must include a small area around the client to allow head bobbing
|
||||
or other small motion on the client side. Otherwise, a bob might cause an
|
||||
entity that should be visible to not show up, especially when the bob
|
||||
crosses a waterline.
|
||||
*/
|
||||
|
||||
int fatbytes;
|
||||
|
@ -390,9 +332,9 @@ void
|
|||
SV_AddToFatPVS (vec3_t org, mnode_t *node)
|
||||
{
|
||||
int i;
|
||||
float d;
|
||||
byte *pvs;
|
||||
mplane_t *plane;
|
||||
float d;
|
||||
|
||||
while (1) {
|
||||
// if this is a leaf, accumulate the pvs bits
|
||||
|
@ -419,12 +361,10 @@ SV_AddToFatPVS (vec3_t org, mnode_t *node)
|
|||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_FatPVS
|
||||
SV_FatPVS
|
||||
|
||||
Calculates a PVS that is the inclusive or of all leafs within 8 pixels of the
|
||||
given point.
|
||||
=============
|
||||
Calculates a PVS that is the inclusive or of all leafs within 8 pixels of the
|
||||
given point.
|
||||
*/
|
||||
byte *
|
||||
SV_FatPVS (vec3_t org)
|
||||
|
@ -437,28 +377,20 @@ SV_FatPVS (vec3_t org)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_WriteEntitiesToClient
|
||||
|
||||
=============
|
||||
*/
|
||||
void
|
||||
SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
||||
{
|
||||
int e, i;
|
||||
int bits;
|
||||
int bits, e, i;
|
||||
byte *pvs;
|
||||
vec3_t org;
|
||||
float miss;
|
||||
vec3_t org;
|
||||
edict_t *ent;
|
||||
|
||||
// find the client's PVS
|
||||
// find the client's PVS
|
||||
VectorAdd (SVvector (clent, origin), SVvector (clent, view_ofs), org);
|
||||
pvs = SV_FatPVS (org);
|
||||
|
||||
// send over all entities (excpet the client) that touch the pvs
|
||||
// send over all entities (excpet the client) that touch the pvs
|
||||
ent = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||
for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
|
||||
#ifdef QUAKE2
|
||||
|
@ -467,11 +399,12 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
|||
continue;
|
||||
#endif
|
||||
|
||||
// ignore if not touching a PV leaf
|
||||
// ignore if not touching a PV leaf
|
||||
if (ent != clent) // clent is ALLWAYS sent
|
||||
{
|
||||
// ignore ents without visible models
|
||||
if (!SVfloat (ent, modelindex) || !*PR_GetString (&sv_pr_state, SVstring (ent, model)))
|
||||
// ignore ents without visible models
|
||||
if (!SVfloat (ent, modelindex) ||
|
||||
!*PR_GetString (&sv_pr_state, SVstring (ent, model)))
|
||||
continue;
|
||||
|
||||
for (i = 0; i < ent->num_leafs; i++)
|
||||
|
@ -486,22 +419,26 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
|||
Con_Printf ("packet overflow\n");
|
||||
return;
|
||||
}
|
||||
// send an update
|
||||
// send an update
|
||||
bits = 0;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
miss = SVvector (ent, origin)[i] - ((entity_state_t*)ent->data)->origin[i];
|
||||
miss = SVvector (ent, origin)[i] -
|
||||
((entity_state_t*)ent->data)->origin[i];
|
||||
if (miss < -0.1 || miss > 0.1)
|
||||
bits |= U_ORIGIN1 << i;
|
||||
}
|
||||
|
||||
if (SVvector (ent, angles)[0] != ((entity_state_t*)ent->data)->angles[0])
|
||||
if (SVvector (ent, angles)[0] !=
|
||||
((entity_state_t*)ent->data)->angles[0])
|
||||
bits |= U_ANGLE1;
|
||||
|
||||
if (SVvector (ent, angles)[1] != ((entity_state_t*)ent->data)->angles[1])
|
||||
if (SVvector (ent, angles)[1] !=
|
||||
((entity_state_t*)ent->data)->angles[1])
|
||||
bits |= U_ANGLE2;
|
||||
|
||||
if (SVvector (ent, angles)[2] != ((entity_state_t*)ent->data)->angles[2])
|
||||
if (SVvector (ent, angles)[2] !=
|
||||
((entity_state_t*)ent->data)->angles[2])
|
||||
bits |= U_ANGLE3;
|
||||
|
||||
if (SVfloat (ent, movetype) == MOVETYPE_STEP)
|
||||
|
@ -519,7 +456,8 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
|||
if (((entity_state_t*)ent->data)->effects != SVfloat (ent, effects))
|
||||
bits |= U_EFFECTS;
|
||||
|
||||
if (((entity_state_t*)ent->data)->modelindex != SVfloat (ent, modelindex))
|
||||
if (((entity_state_t*)ent->data)->modelindex != SVfloat (ent,
|
||||
modelindex))
|
||||
bits |= U_MODEL;
|
||||
|
||||
if (e >= 256)
|
||||
|
@ -528,9 +466,7 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
|||
if (bits >= 256)
|
||||
bits |= U_MOREBITS;
|
||||
|
||||
//
|
||||
// write the message
|
||||
//
|
||||
MSG_WriteByte (msg, bits | U_SIGNAL);
|
||||
|
||||
if (bits & U_MOREBITS)
|
||||
|
@ -565,12 +501,6 @@ SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
SV_CleanupEnts
|
||||
|
||||
=============
|
||||
*/
|
||||
void
|
||||
SV_CleanupEnts (void)
|
||||
{
|
||||
|
@ -579,51 +509,41 @@ SV_CleanupEnts (void)
|
|||
|
||||
ent = NEXT_EDICT (&sv_pr_state, sv.edicts);
|
||||
for (e = 1; e < sv.num_edicts; e++, ent = NEXT_EDICT (&sv_pr_state, ent)) {
|
||||
SVfloat (ent, effects) = (int) SVfloat (ent, effects) & ~EF_MUZZLEFLASH;
|
||||
SVfloat (ent, effects) = (int) SVfloat (ent, effects) &
|
||||
~EF_MUZZLEFLASH;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_WriteClientdataToMessage
|
||||
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
||||
{
|
||||
int bits;
|
||||
int i;
|
||||
int bits, items, i;
|
||||
edict_t *other;
|
||||
int items;
|
||||
|
||||
#ifndef QUAKE2
|
||||
pr_type_t *val;
|
||||
#endif
|
||||
|
||||
//
|
||||
// send a damage message
|
||||
//
|
||||
// send a damage message
|
||||
if (SVfloat (ent, dmg_take) || SVfloat (ent, dmg_save)) {
|
||||
other = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, dmg_inflictor));
|
||||
MSG_WriteByte (msg, svc_damage);
|
||||
MSG_WriteByte (msg, SVfloat (ent, dmg_save));
|
||||
MSG_WriteByte (msg, SVfloat (ent, dmg_take));
|
||||
for (i = 0; i < 3; i++)
|
||||
MSG_WriteCoord (msg,
|
||||
SVvector (other, origin)[i] + 0.5 * (SVvector (other, mins)[i] +
|
||||
SVvector (other, maxs)[i]));
|
||||
MSG_WriteCoord (msg, SVvector (other, origin)[i] + 0.5 *
|
||||
(SVvector (other, mins)[i] +
|
||||
SVvector (other, maxs)[i]));
|
||||
|
||||
SVfloat (ent, dmg_take) = 0;
|
||||
SVfloat (ent, dmg_save) = 0;
|
||||
}
|
||||
//
|
||||
// send the current viewpos offset from the view entity
|
||||
//
|
||||
|
||||
// send the current viewpos offset from the view entity
|
||||
SV_SetIdealPitch (); // how much to look up / down ideally
|
||||
|
||||
// a fixangle might get lost in a dropped packet. Oh well.
|
||||
// a fixangle might get lost in a dropped packet. Oh well.
|
||||
if (SVfloat (ent, fixangle)) {
|
||||
MSG_WriteByte (msg, svc_setangle);
|
||||
for (i = 0; i < 3; i++)
|
||||
|
@ -639,8 +559,8 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
if (SVfloat (ent, idealpitch))
|
||||
bits |= SU_IDEALPITCH;
|
||||
|
||||
// stuff the sigil bits into the high bits of items for sbar, or else
|
||||
// mix in items2
|
||||
// stuff the sigil bits into the high bits of items for sbar, or else
|
||||
// mix in items2
|
||||
#ifdef QUAKE2
|
||||
items = (int) SVfloat (ent, items) | ((int) SVfloat (ent, items2) << 23);
|
||||
#else
|
||||
|
@ -649,8 +569,8 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
if (val)
|
||||
items = (int) SVfloat (ent, items) | ((int) val->float_var << 23);
|
||||
else
|
||||
items =
|
||||
(int) SVfloat (ent, items) | ((int) *sv_globals.serverflags << 28);
|
||||
items = (int) SVfloat (ent, items) | ((int) *sv_globals.serverflags <<
|
||||
28);
|
||||
#endif
|
||||
|
||||
bits |= SU_ITEMS;
|
||||
|
@ -674,10 +594,10 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
if (SVfloat (ent, armorvalue))
|
||||
bits |= SU_ARMOR;
|
||||
|
||||
// if (SVfloat (ent, weapon))
|
||||
// if (SVfloat (ent, weapon))
|
||||
bits |= SU_WEAPON;
|
||||
|
||||
// send the data
|
||||
// send the data
|
||||
|
||||
MSG_WriteByte (msg, svc_clientdata);
|
||||
MSG_WriteShort (msg, bits);
|
||||
|
@ -695,7 +615,7 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
MSG_WriteChar (msg, SVvector (ent, velocity)[i] / 16);
|
||||
}
|
||||
|
||||
// [always sent] if (bits & SU_ITEMS)
|
||||
// [always sent] if (bits & SU_ITEMS)
|
||||
MSG_WriteLong (msg, items);
|
||||
|
||||
if (bits & SU_WEAPONFRAME)
|
||||
|
@ -704,8 +624,8 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
MSG_WriteByte (msg, SVfloat (ent, armorvalue));
|
||||
if (bits & SU_WEAPON)
|
||||
MSG_WriteByte (msg,
|
||||
SV_ModelIndex (PR_GetString (&sv_pr_state,
|
||||
SVstring (ent, weaponmodel))));
|
||||
SV_ModelIndex (PR_GetString (&sv_pr_state, SVstring
|
||||
(ent, weaponmodel))));
|
||||
|
||||
MSG_WriteShort (msg, SVfloat (ent, health));
|
||||
MSG_WriteByte (msg, SVfloat (ent, currentammo));
|
||||
|
@ -726,11 +646,6 @@ SV_WriteClientdataToMessage (edict_t *ent, sizebuf_t *msg)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
SV_SendClientDatagram
|
||||
=======================
|
||||
*/
|
||||
qboolean
|
||||
SV_SendClientDatagram (client_t *client)
|
||||
{
|
||||
|
@ -744,42 +659,36 @@ SV_SendClientDatagram (client_t *client)
|
|||
MSG_WriteByte (&msg, svc_time);
|
||||
MSG_WriteFloat (&msg, sv.time);
|
||||
|
||||
// add the client specific data to the datagram
|
||||
// add the client specific data to the datagram
|
||||
SV_WriteClientdataToMessage (client->edict, &msg);
|
||||
|
||||
SV_WriteEntitiesToClient (client->edict, &msg);
|
||||
|
||||
// copy the server datagram if there is space
|
||||
// copy the server datagram if there is space
|
||||
if (msg.cursize + sv.datagram.cursize < msg.maxsize)
|
||||
SZ_Write (&msg, sv.datagram.data, sv.datagram.cursize);
|
||||
|
||||
// send the datagram
|
||||
// send the datagram
|
||||
if (NET_SendUnreliableMessage (client->netconnection, &msg) == -1) {
|
||||
SV_DropClient (true); // if the message couldn't send, kick
|
||||
//
|
||||
// off
|
||||
SV_DropClient (true); // if the message couldn't send, kick off
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
SV_UpdateToReliableMessages
|
||||
=======================
|
||||
*/
|
||||
void
|
||||
SV_UpdateToReliableMessages (void)
|
||||
{
|
||||
int i, j;
|
||||
client_t *client;
|
||||
|
||||
// check for changes to be sent over the reliable streams
|
||||
// check for changes to be sent over the reliable streams
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients;
|
||||
i++, host_client++) {
|
||||
if (host_client->old_frags != SVfloat (host_client->edict, frags)) {
|
||||
for (j = 0, client = svs.clients; j < svs.maxclients; j++, client++) {
|
||||
for (j = 0, client = svs.clients; j < svs.maxclients; j++,
|
||||
client++) {
|
||||
if (!client->active)
|
||||
continue;
|
||||
MSG_WriteByte (&client->message, svc_updatefrags);
|
||||
|
@ -802,14 +711,11 @@ SV_UpdateToReliableMessages (void)
|
|||
SZ_Clear (&sv.reliable_datagram);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=======================
|
||||
SV_SendNop
|
||||
SV_SendNop
|
||||
|
||||
Send a nop message without trashing or sending the accumulated client
|
||||
message buffer
|
||||
=======================
|
||||
Send a nop message without trashing or sending the accumulated client
|
||||
message buffer
|
||||
*/
|
||||
void
|
||||
SV_SendNop (client_t *client)
|
||||
|
@ -824,26 +730,19 @@ SV_SendNop (client_t *client)
|
|||
MSG_WriteChar (&msg, svc_nop);
|
||||
|
||||
if (NET_SendUnreliableMessage (client->netconnection, &msg) == -1)
|
||||
SV_DropClient (true); // if the message couldn't send, kick
|
||||
//
|
||||
// off
|
||||
SV_DropClient (true); // if the message couldn't send, kick off
|
||||
client->last_message = realtime;
|
||||
}
|
||||
|
||||
/*
|
||||
=======================
|
||||
SV_SendClientMessages
|
||||
=======================
|
||||
*/
|
||||
void
|
||||
SV_SendClientMessages (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
// update frags, names, etc
|
||||
// update frags, names, etc
|
||||
SV_UpdateToReliableMessages ();
|
||||
|
||||
// build individual updates
|
||||
// build individual updates
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients;
|
||||
i++, host_client++) {
|
||||
if (!host_client->active)
|
||||
|
@ -877,7 +776,7 @@ SV_SendClientMessages (void)
|
|||
|
||||
if (host_client->message.cursize || host_client->dropasap) {
|
||||
if (!NET_CanSendMessage (host_client->netconnection)) {
|
||||
// I_Printf ("can't write\n");
|
||||
// I_Printf ("can't write\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -887,7 +786,7 @@ SV_SendClientMessages (void)
|
|||
if (NET_SendMessage
|
||||
(host_client->netconnection, &host_client->message) == -1)
|
||||
SV_DropClient (true); // if the message couldn't send,
|
||||
// kick off
|
||||
// kick off
|
||||
SZ_Clear (&host_client->message);
|
||||
host_client->last_message = realtime;
|
||||
host_client->sendsignon = false;
|
||||
|
@ -895,26 +794,12 @@ SV_SendClientMessages (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// clear muzzle flashes
|
||||
// clear muzzle flashes
|
||||
SV_CleanupEnts ();
|
||||
}
|
||||
|
||||
// SERVER SPAWNING ============================================================
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
SERVER SPAWNING
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
================
|
||||
SV_ModelIndex
|
||||
|
||||
================
|
||||
*/
|
||||
int
|
||||
SV_ModelIndex (const char *name)
|
||||
{
|
||||
|
@ -931,18 +816,11 @@ SV_ModelIndex (const char *name)
|
|||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
SV_CreateBaseline
|
||||
|
||||
================
|
||||
*/
|
||||
void
|
||||
SV_CreateBaseline (void)
|
||||
{
|
||||
int i;
|
||||
int entnum, i;
|
||||
edict_t *svent;
|
||||
int entnum;
|
||||
|
||||
for (entnum = 0; entnum < sv.num_edicts; entnum++) {
|
||||
// get the current server version
|
||||
|
@ -952,25 +830,25 @@ SV_CreateBaseline (void)
|
|||
if (entnum > svs.maxclients && !SVfloat (svent, modelindex))
|
||||
continue;
|
||||
|
||||
//
|
||||
// create entity baseline
|
||||
//
|
||||
VectorCopy (SVvector (svent, origin), ((entity_state_t*)svent->data)->origin);
|
||||
VectorCopy (SVvector (svent, angles), ((entity_state_t*)svent->data)->angles);
|
||||
VectorCopy (SVvector (svent, origin),
|
||||
((entity_state_t*)svent->data)->origin);
|
||||
VectorCopy (SVvector (svent, angles),
|
||||
((entity_state_t*)svent->data)->angles);
|
||||
((entity_state_t*)svent->data)->frame = SVfloat (svent, frame);
|
||||
((entity_state_t*)svent->data)->skin = SVfloat (svent, skin);
|
||||
if (entnum > 0 && entnum <= svs.maxclients) {
|
||||
((entity_state_t*)svent->data)->colormap = entnum;
|
||||
((entity_state_t*)svent->data)->modelindex = SV_ModelIndex ("progs/player.mdl");
|
||||
((entity_state_t*)svent->data)->modelindex = SV_ModelIndex
|
||||
("progs/player.mdl");
|
||||
} else {
|
||||
((entity_state_t*)svent->data)->colormap = 0;
|
||||
((entity_state_t*)svent->data)->modelindex =
|
||||
SV_ModelIndex (PR_GetString (&sv_pr_state,SVstring (svent, model)));
|
||||
SV_ModelIndex (PR_GetString (&sv_pr_state,SVstring (svent,
|
||||
model)));
|
||||
}
|
||||
|
||||
//
|
||||
// add to the message
|
||||
//
|
||||
MSG_WriteByte (&sv.signon, svc_spawnbaseline);
|
||||
MSG_WriteShort (&sv.signon, entnum);
|
||||
|
||||
|
@ -979,19 +857,19 @@ SV_CreateBaseline (void)
|
|||
MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->colormap);
|
||||
MSG_WriteByte (&sv.signon, ((entity_state_t*)svent->data)->skin);
|
||||
for (i = 0; i < 3; i++) {
|
||||
MSG_WriteCoord (&sv.signon, ((entity_state_t*)svent->data)->origin[i]);
|
||||
MSG_WriteAngle (&sv.signon, ((entity_state_t*)svent->data)->angles[i]);
|
||||
MSG_WriteCoord (&sv.signon,
|
||||
((entity_state_t*)svent->data)->origin[i]);
|
||||
MSG_WriteAngle (&sv.signon,
|
||||
((entity_state_t*)svent->data)->angles[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
SV_SendReconnect
|
||||
SV_SendReconnect
|
||||
|
||||
Tell all the clients that the server is changing levels
|
||||
================
|
||||
Tell all the clients that the server is changing levels
|
||||
*/
|
||||
void
|
||||
SV_SendReconnect (void)
|
||||
|
@ -1015,14 +893,11 @@ SV_SendReconnect (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
SV_SaveSpawnparms
|
||||
SV_SaveSpawnparms
|
||||
|
||||
Grabs the current state of each client for saving across the
|
||||
transition to another level
|
||||
================
|
||||
Grabs the current state of each client for saving across the
|
||||
transition to another level
|
||||
*/
|
||||
void
|
||||
SV_SaveSpawnparms (void)
|
||||
|
@ -1047,16 +922,13 @@ SV_SaveSpawnparms (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
SV_SpawnServer
|
||||
|
||||
This is called at the start of each level
|
||||
================
|
||||
*/
|
||||
extern float scr_centertime_off;
|
||||
|
||||
/*
|
||||
SV_SpawnServer
|
||||
|
||||
This is called at the start of each level
|
||||
*/
|
||||
#ifdef QUAKE2
|
||||
void
|
||||
SV_SpawnServer (const char *server, const char *startspot)
|
||||
|
@ -1065,8 +937,8 @@ void
|
|||
SV_SpawnServer (const char *server)
|
||||
#endif
|
||||
{
|
||||
edict_t *ent;
|
||||
int i;
|
||||
edict_t *ent;
|
||||
|
||||
// let's not have any servers with no name
|
||||
if (hostname->string[0] == 0)
|
||||
|
@ -1076,15 +948,12 @@ SV_SpawnServer (const char *server)
|
|||
Con_DPrintf ("SpawnServer: %s\n", server);
|
||||
svs.changelevel_issued = false; // now safe to issue another
|
||||
|
||||
//
|
||||
// tell all connected clients that we are going to a new level
|
||||
//
|
||||
// tell all connected clients that we are going to a new level
|
||||
if (sv.active) {
|
||||
SV_SendReconnect ();
|
||||
}
|
||||
//
|
||||
// make cvars consistant
|
||||
//
|
||||
|
||||
// make cvars consistant
|
||||
if (coop->int_val)
|
||||
Cvar_SetValue (deathmatch, 0);
|
||||
current_skill = skill->int_val;
|
||||
|
@ -1095,9 +964,7 @@ SV_SpawnServer (const char *server)
|
|||
|
||||
Cvar_SetValue (skill, (float) current_skill);
|
||||
|
||||
//
|
||||
// set up the new server
|
||||
//
|
||||
// set up the new server
|
||||
Host_ClearMemory ();
|
||||
|
||||
memset (&sv, 0, sizeof (sv));
|
||||
|
@ -1108,10 +975,10 @@ SV_SpawnServer (const char *server)
|
|||
strcpy (sv.startspot, startspot);
|
||||
#endif
|
||||
|
||||
// load progs to get entity field count
|
||||
// load progs to get entity field count
|
||||
SV_LoadProgs ();
|
||||
|
||||
// allocate server memory
|
||||
// allocate server memory
|
||||
sv.max_edicts = MAX_EDICTS;
|
||||
sv.edicts = PR_InitEdicts (&sv_pr_state, sv.max_edicts);
|
||||
|
||||
|
@ -1133,7 +1000,7 @@ SV_SpawnServer (const char *server)
|
|||
sv.signon.cursize = 0;
|
||||
sv.signon.data = sv.signon_buf;
|
||||
|
||||
// leave slots at start for clients only
|
||||
// leave slots at start for clients only
|
||||
sv.num_edicts = svs.maxclients + 1;
|
||||
for (i = 0; i < svs.maxclients; i++) {
|
||||
ent = EDICT_NUM (&sv_pr_state, i + 1);
|
||||
|
@ -1155,9 +1022,7 @@ SV_SpawnServer (const char *server)
|
|||
}
|
||||
sv.models[1] = sv.worldmodel;
|
||||
|
||||
//
|
||||
// clear world interaction links
|
||||
//
|
||||
// clear world interaction links
|
||||
SV_ClearWorld ();
|
||||
|
||||
sv.sound_precache[0] = sv_pr_state.pr_strings;
|
||||
|
@ -1169,9 +1034,7 @@ SV_SpawnServer (const char *server)
|
|||
sv.models[i + 1] = Mod_ForName (localmodels[i], false);
|
||||
}
|
||||
|
||||
//
|
||||
// load the rest of the entities
|
||||
//
|
||||
// load the rest of the entities
|
||||
ent = EDICT_NUM (&sv_pr_state, 0);
|
||||
memset (&ent->v, 0, sv_pr_state.progs->entityfields * 4);
|
||||
ent->free = false;
|
||||
|
@ -1191,25 +1054,25 @@ SV_SpawnServer (const char *server)
|
|||
PR_SetString (&sv_pr_state, sv.startspot);
|
||||
#endif
|
||||
|
||||
// serverflags are for cross level information (sigils)
|
||||
// serverflags are for cross level information (sigils)
|
||||
*sv_globals.serverflags = svs.serverflags;
|
||||
|
||||
ED_LoadFromFile (&sv_pr_state, sv.worldmodel->entities);
|
||||
|
||||
sv.active = true;
|
||||
|
||||
// all setup is completed, any further precache statements are errors
|
||||
// all setup is completed, any further precache statements are errors
|
||||
sv.state = ss_active;
|
||||
|
||||
// run two frames to allow everything to settle
|
||||
// run two frames to allow everything to settle
|
||||
host_frametime = 0.1;
|
||||
SV_Physics ();
|
||||
SV_Physics ();
|
||||
|
||||
// create a baseline for more efficient communications
|
||||
// create a baseline for more efficient communications
|
||||
SV_CreateBaseline ();
|
||||
|
||||
// send serverinfo to all connected clients
|
||||
// send serverinfo to all connected clients
|
||||
for (i = 0, host_client = svs.clients; i < svs.maxclients;
|
||||
i++, host_client++)
|
||||
if (host_client->active)
|
||||
|
|
|
@ -36,14 +36,15 @@
|
|||
|
||||
#define STEPSIZE 18
|
||||
|
||||
int c_yes, c_no;
|
||||
|
||||
|
||||
/*
|
||||
SV_CheckBottom
|
||||
|
||||
Returns false if any part of the bottom of the entity is off an edge that
|
||||
is not a staircase.
|
||||
*/
|
||||
int c_yes, c_no;
|
||||
|
||||
qboolean
|
||||
SV_CheckBottom (edict_t *ent)
|
||||
{
|
||||
|
@ -55,9 +56,10 @@ SV_CheckBottom (edict_t *ent)
|
|||
VectorAdd (SVvector (ent, origin), SVvector (ent, mins), mins);
|
||||
VectorAdd (SVvector (ent, origin), SVvector (ent, maxs), maxs);
|
||||
|
||||
// if all of the points under the corners are solid world, don't bother
|
||||
// with the tougher checks
|
||||
// the corners must be within 16 of the midpoint
|
||||
// if all of the points under the corners are solid world, don't bother
|
||||
// with the tougher checks
|
||||
|
||||
// the corners must be within 16 of the midpoint
|
||||
start[2] = mins[2] - 1;
|
||||
for (x = 0; x <= 1; x++)
|
||||
for (y = 0; y <= 1; y++) {
|
||||
|
@ -72,12 +74,11 @@ SV_CheckBottom (edict_t *ent)
|
|||
|
||||
realcheck:
|
||||
c_no++;
|
||||
//
|
||||
// check it for real...
|
||||
//
|
||||
|
||||
// check it for real...
|
||||
start[2] = mins[2];
|
||||
|
||||
// the midpoint must be within 16 of the bottom
|
||||
// the midpoint must be within 16 of the bottom
|
||||
start[0] = stop[0] = (mins[0] + maxs[0]) * 0.5;
|
||||
start[1] = stop[1] = (mins[1] + maxs[1]) * 0.5;
|
||||
stop[2] = start[2] - 2 * STEPSIZE;
|
||||
|
@ -87,7 +88,7 @@ SV_CheckBottom (edict_t *ent)
|
|||
return false;
|
||||
mid = bottom = trace.endpos[2];
|
||||
|
||||
// the corners must be within 16 of the midpoint
|
||||
// the corners must be within 16 of the midpoint
|
||||
for (x = 0; x <= 1; x++)
|
||||
for (y = 0; y <= 1; y++) {
|
||||
start[0] = stop[0] = x ? maxs[0] : mins[0];
|
||||
|
@ -105,7 +106,6 @@ SV_CheckBottom (edict_t *ent)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_movestep
|
||||
|
||||
|
@ -117,32 +117,31 @@ SV_CheckBottom (edict_t *ent)
|
|||
qboolean
|
||||
SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
||||
{
|
||||
int i;
|
||||
float dz;
|
||||
vec3_t oldorg, neworg, end;
|
||||
trace_t trace;
|
||||
int i;
|
||||
edict_t *enemy;
|
||||
|
||||
// try the move
|
||||
// try the move
|
||||
VectorCopy (SVvector (ent, origin), oldorg);
|
||||
VectorAdd (SVvector (ent, origin), move, neworg);
|
||||
|
||||
// flying monsters don't step up
|
||||
// flying monsters don't step up
|
||||
if ((int) SVfloat (ent, flags) & (FL_SWIM | FL_FLY)) {
|
||||
// try one move with vertical motion, then one without
|
||||
for (i = 0; i < 2; i++) {
|
||||
VectorAdd (SVvector (ent, origin), move, neworg);
|
||||
enemy = PROG_TO_EDICT (&sv_pr_state, SVentity (ent, enemy));
|
||||
if (i == 0 && enemy != sv.edicts) {
|
||||
dz =
|
||||
SVvector (ent, origin)[2] - SVvector (enemy, origin)[2];
|
||||
dz = SVvector (ent, origin)[2] - SVvector (enemy, origin)[2];
|
||||
if (dz > 40)
|
||||
neworg[2] -= 8;
|
||||
if (dz < 30)
|
||||
neworg[2] += 8;
|
||||
}
|
||||
trace =
|
||||
SV_Move (SVvector (ent, origin), SVvector (ent, mins), SVvector (ent, maxs), neworg, false, ent);
|
||||
trace = SV_Move (SVvector (ent, origin), SVvector (ent, mins),
|
||||
SVvector (ent, maxs), neworg, false, ent);
|
||||
|
||||
if (trace.fraction == 1) {
|
||||
if (((int) SVfloat (ent, flags) & FL_SWIM)
|
||||
|
@ -161,19 +160,22 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
|||
|
||||
return false;
|
||||
}
|
||||
// push down from a step height above the wished position
|
||||
|
||||
// push down from a step height above the wished position
|
||||
neworg[2] += STEPSIZE;
|
||||
VectorCopy (neworg, end);
|
||||
end[2] -= STEPSIZE * 2;
|
||||
|
||||
trace = SV_Move (neworg, SVvector (ent, mins), SVvector (ent, maxs), end, false, ent);
|
||||
trace = SV_Move (neworg, SVvector (ent, mins), SVvector (ent, maxs), end,
|
||||
false, ent);
|
||||
|
||||
if (trace.allsolid)
|
||||
return false;
|
||||
|
||||
if (trace.startsolid) {
|
||||
neworg[2] -= STEPSIZE;
|
||||
trace = SV_Move (neworg, SVvector (ent, mins), SVvector (ent, maxs), end, false, ent);
|
||||
trace = SV_Move (neworg, SVvector (ent, mins), SVvector (ent, maxs),
|
||||
end, false, ent);
|
||||
if (trace.allsolid || trace.startsolid)
|
||||
return false;
|
||||
}
|
||||
|
@ -184,20 +186,19 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
|||
if (relink)
|
||||
SV_LinkEdict (ent, true);
|
||||
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_ONGROUND;
|
||||
// Con_Printf ("fall down\n");
|
||||
// Con_Printf ("fall down\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false; // walked off an edge
|
||||
}
|
||||
// check point traces down for dangling corners
|
||||
// check point traces down for dangling corners
|
||||
VectorCopy (trace.endpos, SVvector (ent, origin));
|
||||
|
||||
if (!SV_CheckBottom (ent)) {
|
||||
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) { // entity had floor
|
||||
// mostly pulled out
|
||||
// from underneath it
|
||||
// and is trying to correct
|
||||
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
|
||||
// entity had floor mostly pulled out from underneath it and is
|
||||
// trying to correct
|
||||
if (relink)
|
||||
SV_LinkEdict (ent, true);
|
||||
return true;
|
||||
|
@ -207,31 +208,28 @@ SV_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
|||
}
|
||||
|
||||
if ((int) SVfloat (ent, flags) & FL_PARTIALGROUND) {
|
||||
// Con_Printf ("back on ground\n");
|
||||
// Con_Printf ("back on ground\n");
|
||||
SVfloat (ent, flags) = (int) SVfloat (ent, flags) & ~FL_PARTIALGROUND;
|
||||
}
|
||||
SVentity (ent, groundentity) = EDICT_TO_PROG (&sv_pr_state, trace.ent);
|
||||
|
||||
// the move is ok
|
||||
// the move is ok
|
||||
if (relink)
|
||||
SV_LinkEdict (ent, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
SV_StepDirection
|
||||
SV_StepDirection
|
||||
|
||||
Turns to the movement direction, and walks the current distance if
|
||||
facing it.
|
||||
Turns to the movement direction, and walks the current distance if
|
||||
facing it.
|
||||
*/
|
||||
qboolean
|
||||
SV_StepDirection (edict_t *ent, float yaw, float dist)
|
||||
{
|
||||
vec3_t move, oldorigin;
|
||||
float delta;
|
||||
vec3_t move, oldorigin;
|
||||
|
||||
SVfloat (ent, ideal_yaw) = yaw;
|
||||
PF_changeyaw (&sv_pr_state);
|
||||
|
@ -256,29 +254,21 @@ SV_StepDirection (edict_t *ent, float yaw, float dist)
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
SV_FixCheckBottom
|
||||
*/
|
||||
void
|
||||
SV_FixCheckBottom (edict_t *ent)
|
||||
{
|
||||
// Con_Printf ("SV_FixCheckBottom\n");
|
||||
// Con_Printf ("SV_FixCheckBottom\n");
|
||||
|
||||
SVfloat (ent, flags) = (int) SVfloat (ent, flags) | FL_PARTIALGROUND;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
SV_NewChaseDir
|
||||
*/
|
||||
#define DI_NODIR -1
|
||||
|
||||
void
|
||||
SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
|
||||
{
|
||||
float deltax, deltay;
|
||||
float deltax, deltay, olddir, tdir, turnaround;
|
||||
float d[3];
|
||||
float tdir, olddir, turnaround;
|
||||
|
||||
olddir = anglemod ((int) (SVfloat (actor, ideal_yaw) / 45) * 45);
|
||||
turnaround = anglemod (olddir - 180);
|
||||
|
@ -298,7 +288,7 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
|
|||
else
|
||||
d[2] = DI_NODIR;
|
||||
|
||||
// try direct route
|
||||
// try direct route
|
||||
if (d[1] != DI_NODIR && d[2] != DI_NODIR) {
|
||||
if (d[1] == 0)
|
||||
tdir = d[2] == 90 ? 45 : 315;
|
||||
|
@ -308,7 +298,7 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
|
|||
if (tdir != turnaround && SV_StepDirection (actor, tdir, dist))
|
||||
return;
|
||||
}
|
||||
// try other directions
|
||||
// try other directions
|
||||
if (((rand () & 3) & 1) || abs (deltay) > abs (deltax)) {
|
||||
tdir = d[1];
|
||||
d[1] = d[2];
|
||||
|
@ -321,13 +311,11 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
|
|||
if (d[2] != DI_NODIR && d[2] != turnaround
|
||||
&& SV_StepDirection (actor, d[2], dist)) return;
|
||||
|
||||
/* there is no direct path to the player, so pick another direction */
|
||||
|
||||
/* there is no direct path to the player, so pick another direction */
|
||||
if (olddir != DI_NODIR && SV_StepDirection (actor, olddir, dist))
|
||||
return;
|
||||
|
||||
if (rand () & 1) { /* randomly determine direction of
|
||||
search */
|
||||
if (rand () & 1) { /* randomly determine direction of search */
|
||||
for (tdir = 0; tdir <= 315; tdir += 45)
|
||||
if (tdir != turnaround && SV_StepDirection (actor, tdir, dist))
|
||||
return;
|
||||
|
@ -342,17 +330,13 @@ SV_NewChaseDir (edict_t *actor, edict_t *enemy, float dist)
|
|||
|
||||
SVfloat (actor, ideal_yaw) = olddir; // can't move
|
||||
|
||||
// if a bridge was pulled out from underneath a monster, it may not have
|
||||
// a valid standing position at all
|
||||
// if a bridge was pulled out from underneath a monster, it may not have
|
||||
// a valid standing position at all
|
||||
|
||||
if (!SV_CheckBottom (actor))
|
||||
SV_FixCheckBottom (actor);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
SV_CloseEnough
|
||||
*/
|
||||
qboolean
|
||||
SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
|
||||
{
|
||||
|
@ -367,14 +351,11 @@ SV_CloseEnough (edict_t *ent, edict_t *goal, float dist)
|
|||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
SV_MoveToGoal
|
||||
*/
|
||||
void
|
||||
SV_MoveToGoal (progs_t *pr)
|
||||
{
|
||||
edict_t *ent, *goal;
|
||||
float dist;
|
||||
edict_t *ent, *goal;
|
||||
|
||||
ent = PROG_TO_EDICT (pr, *pr->globals.self);
|
||||
goal = PROG_TO_EDICT (pr, SVentity (ent, goalentity));
|
||||
|
@ -384,13 +365,14 @@ SV_MoveToGoal (progs_t *pr)
|
|||
G_FLOAT (pr, OFS_RETURN) = 0;
|
||||
return;
|
||||
}
|
||||
// if the next step hits the enemy, return immediately
|
||||
// if the next step hits the enemy, return immediately
|
||||
if (PROG_TO_EDICT (pr, SVentity (ent, enemy)) != sv.edicts
|
||||
&& SV_CloseEnough (ent, goal, dist))
|
||||
return;
|
||||
|
||||
// bump around...
|
||||
if ((rand () & 3) == 1 || !SV_StepDirection (ent, SVfloat (ent, ideal_yaw), dist)) {
|
||||
// bump around...
|
||||
if ((rand () & 3) == 1 || !SV_StepDirection (ent, SVfloat
|
||||
(ent, ideal_yaw), dist)) {
|
||||
SV_NewChaseDir (ent, goal, dist);
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -29,12 +29,11 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
#include "string.h"
|
||||
# include "string.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include "strings.h"
|
||||
# include "strings.h"
|
||||
#endif
|
||||
|
||||
#include "QF/cmd.h"
|
||||
|
@ -42,10 +41,10 @@
|
|||
#include "QF/cvar.h"
|
||||
|
||||
#include "host.h"
|
||||
#include "progdefs.h"
|
||||
#include "server.h"
|
||||
#include "sv_progs.h"
|
||||
#include "world.h"
|
||||
#include "progdefs.h"
|
||||
|
||||
progs_t sv_pr_state;
|
||||
sv_globals_t sv_globals;
|
||||
|
@ -98,9 +97,9 @@ ED_PrintEdicts_f (void)
|
|||
}
|
||||
|
||||
/*
|
||||
ED_PrintEdict_f
|
||||
ED_PrintEdict_f
|
||||
|
||||
For debugging, prints a single edicy
|
||||
For debugging, prints a single edicy
|
||||
*/
|
||||
void
|
||||
ED_PrintEdict_f (void)
|
||||
|
@ -144,42 +143,70 @@ SV_LoadProgs (void)
|
|||
(void *) sv_globals.other = PR_GetGlobalPointer (&sv_pr_state, "other");
|
||||
(void *) sv_globals.world = PR_GetGlobalPointer (&sv_pr_state, "world");
|
||||
(void *) sv_globals.time = PR_GetGlobalPointer (&sv_pr_state, "time");
|
||||
(void *) sv_globals.frametime = PR_GetGlobalPointer (&sv_pr_state, "frametime");
|
||||
(void *) sv_globals.force_retouch = PR_GetGlobalPointer (&sv_pr_state, "force_retouch");
|
||||
(void *) sv_globals.mapname = PR_GetGlobalPointer (&sv_pr_state, "mapname");
|
||||
(void *) sv_globals.deathmatch = PR_GetGlobalPointer (&sv_pr_state, "deathmatch");
|
||||
(void *) sv_globals.frametime = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"frametime");
|
||||
(void *) sv_globals.force_retouch = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"force_retouch");
|
||||
(void *) sv_globals.mapname = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"mapname");
|
||||
(void *) sv_globals.deathmatch = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"deathmatch");
|
||||
(void *) sv_globals.coop = PR_GetGlobalPointer (&sv_pr_state, "coop");
|
||||
(void *) sv_globals.teamplay = PR_GetGlobalPointer (&sv_pr_state, "teamplay");
|
||||
(void *) sv_globals.serverflags = PR_GetGlobalPointer (&sv_pr_state, "serverflags");
|
||||
(void *) sv_globals.total_secrets = PR_GetGlobalPointer (&sv_pr_state, "total_secrets");
|
||||
(void *) sv_globals.total_monsters = PR_GetGlobalPointer (&sv_pr_state, "total_monsters");
|
||||
(void *) sv_globals.found_secrets = PR_GetGlobalPointer (&sv_pr_state, "found_secrets");
|
||||
(void *) sv_globals.killed_monsters = PR_GetGlobalPointer (&sv_pr_state, "killed_monsters");
|
||||
(void *) sv_globals.teamplay = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"teamplay");
|
||||
(void *) sv_globals.serverflags = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"serverflags");
|
||||
(void *) sv_globals.total_secrets = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"total_secrets");
|
||||
(void *) sv_globals.total_monsters = PR_GetGlobalPointer
|
||||
(&sv_pr_state, "total_monsters");
|
||||
(void *) sv_globals.found_secrets = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"found_secrets");
|
||||
(void *) sv_globals.killed_monsters = PR_GetGlobalPointer
|
||||
(&sv_pr_state, "killed_monsters");
|
||||
(void *) sv_globals.parms = PR_GetGlobalPointer (&sv_pr_state, "parm1");
|
||||
(void *) sv_globals.v_forward = PR_GetGlobalPointer (&sv_pr_state, "v_forward");
|
||||
(void *) sv_globals.v_forward = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"v_forward");
|
||||
(void *) sv_globals.v_up = PR_GetGlobalPointer (&sv_pr_state, "v_up");
|
||||
(void *) sv_globals.v_right = PR_GetGlobalPointer (&sv_pr_state, "v_right");
|
||||
(void *) sv_globals.trace_allsolid = PR_GetGlobalPointer (&sv_pr_state, "trace_allsolid");
|
||||
(void *) sv_globals.trace_startsolid = PR_GetGlobalPointer (&sv_pr_state, "trace_startsolid");
|
||||
(void *) sv_globals.trace_fraction = PR_GetGlobalPointer (&sv_pr_state, "trace_fraction");
|
||||
(void *) sv_globals.trace_endpos = PR_GetGlobalPointer (&sv_pr_state, "trace_endpos");
|
||||
(void *) sv_globals.trace_plane_normal = PR_GetGlobalPointer (&sv_pr_state, "trace_plane_normal");
|
||||
(void *) sv_globals.trace_plane_dist = PR_GetGlobalPointer (&sv_pr_state, "trace_plane_dist");
|
||||
(void *) sv_globals.trace_ent = PR_GetGlobalPointer (&sv_pr_state, "trace_ent");
|
||||
(void *) sv_globals.trace_inopen = PR_GetGlobalPointer (&sv_pr_state, "trace_inopen");
|
||||
(void *) sv_globals.trace_inwater = PR_GetGlobalPointer (&sv_pr_state, "trace_inwater");
|
||||
(void *) sv_globals.msg_entity = PR_GetGlobalPointer (&sv_pr_state, "msg_entity");
|
||||
(void *) sv_globals.v_right = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"v_right");
|
||||
(void *) sv_globals.trace_allsolid = PR_GetGlobalPointer
|
||||
(&sv_pr_state, "trace_allsolid");
|
||||
(void *) sv_globals.trace_startsolid = PR_GetGlobalPointer
|
||||
(&sv_pr_state, "trace_startsolid");
|
||||
(void *) sv_globals.trace_fraction = PR_GetGlobalPointer
|
||||
(&sv_pr_state, "trace_fraction");
|
||||
(void *) sv_globals.trace_endpos = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"trace_endpos");
|
||||
(void *) sv_globals.trace_plane_normal = PR_GetGlobalPointer
|
||||
(&sv_pr_state, "trace_plane_normal");
|
||||
(void *) sv_globals.trace_plane_dist = PR_GetGlobalPointer
|
||||
(&sv_pr_state, "trace_plane_dist");
|
||||
(void *) sv_globals.trace_ent = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"trace_ent");
|
||||
(void *) sv_globals.trace_inopen = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"trace_inopen");
|
||||
(void *) sv_globals.trace_inwater = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"trace_inwater");
|
||||
(void *) sv_globals.msg_entity = PR_GetGlobalPointer (&sv_pr_state,
|
||||
"msg_entity");
|
||||
|
||||
sv_funcs.main = PR_GetFunctionIndex (&sv_pr_state, "main");
|
||||
sv_funcs.StartFrame = PR_GetFunctionIndex (&sv_pr_state, "StartFrame");
|
||||
sv_funcs.PlayerPreThink = PR_GetFunctionIndex (&sv_pr_state, "PlayerPreThink");
|
||||
sv_funcs.PlayerPostThink = PR_GetFunctionIndex (&sv_pr_state, "PlayerPostThink");
|
||||
sv_funcs.PlayerPreThink = PR_GetFunctionIndex (&sv_pr_state,
|
||||
"PlayerPreThink");
|
||||
sv_funcs.PlayerPostThink = PR_GetFunctionIndex (&sv_pr_state,
|
||||
"PlayerPostThink");
|
||||
sv_funcs.ClientKill = PR_GetFunctionIndex (&sv_pr_state, "ClientKill");
|
||||
sv_funcs.ClientConnect = PR_GetFunctionIndex (&sv_pr_state, "ClientConnect");
|
||||
sv_funcs.PutClientInServer = PR_GetFunctionIndex (&sv_pr_state, "PutClientInServer");
|
||||
sv_funcs.ClientDisconnect = PR_GetFunctionIndex (&sv_pr_state, "ClientDisconnect");
|
||||
sv_funcs.ClientConnect = PR_GetFunctionIndex (&sv_pr_state,
|
||||
"ClientConnect");
|
||||
sv_funcs.PutClientInServer = PR_GetFunctionIndex (&sv_pr_state,
|
||||
"PutClientInServer");
|
||||
sv_funcs.ClientDisconnect = PR_GetFunctionIndex (&sv_pr_state,
|
||||
"ClientDisconnect");
|
||||
sv_funcs.SetNewParms = PR_GetFunctionIndex (&sv_pr_state, "SetNewParms");
|
||||
sv_funcs.SetChangeParms = PR_GetFunctionIndex (&sv_pr_state, "SetChangeParms");
|
||||
sv_funcs.SetChangeParms = PR_GetFunctionIndex (&sv_pr_state,
|
||||
"SetChangeParms");
|
||||
|
||||
sv_fields.modelindex = PR_GetFieldOffset (&sv_pr_state, "modelindex");
|
||||
sv_fields.absmin = PR_GetFieldOffset (&sv_pr_state, "absmin");
|
||||
|
@ -235,7 +262,8 @@ SV_LoadProgs (void)
|
|||
sv_fields.colormap = PR_GetFieldOffset (&sv_pr_state, "colormap");
|
||||
sv_fields.team = PR_GetFieldOffset (&sv_pr_state, "team");
|
||||
sv_fields.max_health = PR_GetFieldOffset (&sv_pr_state, "max_health");
|
||||
sv_fields.teleport_time = PR_GetFieldOffset (&sv_pr_state, "teleport_time");
|
||||
sv_fields.teleport_time = PR_GetFieldOffset (&sv_pr_state,
|
||||
"teleport_time");
|
||||
sv_fields.armortype = PR_GetFieldOffset (&sv_pr_state, "armortype");
|
||||
sv_fields.armorvalue = PR_GetFieldOffset (&sv_pr_state, "armorvalue");
|
||||
sv_fields.waterlevel = PR_GetFieldOffset (&sv_pr_state, "waterlevel");
|
||||
|
@ -249,7 +277,8 @@ SV_LoadProgs (void)
|
|||
sv_fields.targetname = PR_GetFieldOffset (&sv_pr_state, "targetname");
|
||||
sv_fields.dmg_take = PR_GetFieldOffset (&sv_pr_state, "dmg_take");
|
||||
sv_fields.dmg_save = PR_GetFieldOffset (&sv_pr_state, "dmg_save");
|
||||
sv_fields.dmg_inflictor = PR_GetFieldOffset (&sv_pr_state, "dmg_inflictor");
|
||||
sv_fields.dmg_inflictor = PR_GetFieldOffset (&sv_pr_state,
|
||||
"dmg_inflictor");
|
||||
sv_fields.owner = PR_GetFieldOffset (&sv_pr_state, "owner");
|
||||
sv_fields.movedir = PR_GetFieldOffset (&sv_pr_state, "movedir");
|
||||
sv_fields.message = PR_GetFieldOffset (&sv_pr_state, "message");
|
||||
|
@ -264,7 +293,8 @@ SV_LoadProgs (void)
|
|||
sv_fields.dmgtime = ED_GetFieldIndex (&sv_pr_state, "dmgtime");
|
||||
sv_fields.air_finished = ED_GetFieldIndex (&sv_pr_state, "air_finished");
|
||||
sv_fields.pain_finished = ED_GetFieldIndex (&sv_pr_state, "pain_finished");
|
||||
sv_fields.radsuit_finished = ED_GetFieldIndex (&sv_pr_state, "radsuit_finished");
|
||||
sv_fields.radsuit_finished = ED_GetFieldIndex (&sv_pr_state,
|
||||
"radsuit_finished");
|
||||
sv_fields.speed = ED_GetFieldIndex (&sv_pr_state, "speed");
|
||||
sv_fields.basevelocity = ED_GetFieldIndex (&sv_pr_state, "basevelocity");
|
||||
sv_fields.drawPercent = ED_GetFieldIndex (&sv_pr_state, "drawPercent");
|
||||
|
@ -290,21 +320,21 @@ SV_Progs_Init (void)
|
|||
|
||||
SV_PR_Cmds_Init ();
|
||||
|
||||
Cmd_AddCommand ("edict", ED_PrintEdict_f,
|
||||
"Report information on a given edict in the game. (edict (edict number))");
|
||||
Cmd_AddCommand ("edict", ED_PrintEdict_f, "Report information on a given "
|
||||
"edict in the game. (edict (edict number))");
|
||||
Cmd_AddCommand ("edicts", ED_PrintEdicts_f,
|
||||
"Display information on all edicts in the game.");
|
||||
Cmd_AddCommand ("edictcount", ED_Count_f,
|
||||
"Display summary information on the edicts in the game.");
|
||||
Cmd_AddCommand ("profile", PR_Profile_f,
|
||||
"FIXME: Report information about QuakeC Stuff (\?\?\?) No Description");
|
||||
Cmd_AddCommand ("profile", PR_Profile_f, "FIXME: Report information "
|
||||
"about QuakeC Stuff (\?\?\?) No Description");
|
||||
}
|
||||
|
||||
void
|
||||
SV_Progs_Init_Cvars (void)
|
||||
{
|
||||
r_skyname = Cvar_Get ("r_skyname", "", CVAR_SERVERINFO, Cvar_Info,
|
||||
"name of skybox");
|
||||
"name of skybox");
|
||||
sv_progs = Cvar_Get ("sv_progs", "progs.dat", CVAR_ROM, NULL,
|
||||
"Allows selectable game progs if you have several "
|
||||
"of them in the gamedir");
|
||||
|
@ -313,14 +343,14 @@ SV_Progs_Init_Cvars (void)
|
|||
"checkextentions qc function");
|
||||
|
||||
nomonsters = Cvar_Get ("nomonsters", "0", CVAR_NONE, NULL,
|
||||
"No Description");
|
||||
"No Description");
|
||||
gamecfg = Cvar_Get ("gamecfg", "0", CVAR_NONE, NULL, "No Description");
|
||||
scratch1 = Cvar_Get ("scratch1", "0", CVAR_NONE, NULL, "No Description");
|
||||
scratch2 = Cvar_Get ("scratch2", "0", CVAR_NONE, NULL, "No Description");
|
||||
scratch3 = Cvar_Get ("scratch3", "0", CVAR_NONE, NULL, "No Description");
|
||||
scratch4 = Cvar_Get ("scratch4", "0", CVAR_NONE, NULL, "No Description");
|
||||
savedgamecfg = Cvar_Get ("savedgamecfg", "0", CVAR_ARCHIVE, NULL,
|
||||
"No Description");
|
||||
"No Description");
|
||||
saved1 = Cvar_Get ("saved1", "0", CVAR_ARCHIVE, NULL, "No Description");
|
||||
saved2 = Cvar_Get ("saved2", "0", CVAR_ARCHIVE, NULL, "No Description");
|
||||
saved3 = Cvar_Get ("saved3", "0", CVAR_ARCHIVE, NULL, "No Description");
|
||||
|
|
|
@ -31,18 +31,19 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "server.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/console.h"
|
||||
#include "world.h"
|
||||
#include "QF/keys.h"
|
||||
#include "view.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "host.h"
|
||||
#include "sv_progs.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "host.h"
|
||||
#include "server.h"
|
||||
#include "sv_progs.h"
|
||||
#include "view.h"
|
||||
#include "world.h"
|
||||
|
||||
edict_t *sv_player;
|
||||
|
||||
cvar_t *sv_edgefriction;
|
||||
|
@ -65,21 +66,17 @@ cvar_t *sv_idealpitchscale;
|
|||
cvar_t *cl_rollspeed;
|
||||
cvar_t *cl_rollangle;
|
||||
|
||||
/*
|
||||
===============
|
||||
SV_SetIdealPitch
|
||||
===============
|
||||
*/
|
||||
#define MAX_FORWARD 6
|
||||
|
||||
|
||||
void
|
||||
SV_SetIdealPitch (void)
|
||||
{
|
||||
int dir, step, steps, i, j;
|
||||
float angleval, sinval, cosval;
|
||||
float z[MAX_FORWARD];
|
||||
trace_t tr;
|
||||
vec3_t top, bottom;
|
||||
float z[MAX_FORWARD];
|
||||
int i, j;
|
||||
int step, dir, steps;
|
||||
|
||||
if (!((int) SVfloat (sv_player, flags) & FL_ONGROUND))
|
||||
return;
|
||||
|
@ -91,8 +88,8 @@ SV_SetIdealPitch (void)
|
|||
for (i = 0; i < MAX_FORWARD; i++) {
|
||||
top[0] = SVvector (sv_player, origin)[0] + cosval * (i + 3) * 12;
|
||||
top[1] = SVvector (sv_player, origin)[1] + sinval * (i + 3) * 12;
|
||||
top[2] = SVvector (sv_player, origin)[2] + SVvector (sv_player, view_ofs)[2];
|
||||
|
||||
top[2] = SVvector (sv_player, origin)[2] + SVvector (sv_player,
|
||||
view_ofs)[2];
|
||||
bottom[0] = top[0];
|
||||
bottom[1] = top[1];
|
||||
bottom[2] = top[2] - 160;
|
||||
|
@ -100,9 +97,7 @@ SV_SetIdealPitch (void)
|
|||
tr = SV_Move (top, vec3_origin, vec3_origin, bottom, 1, sv_player);
|
||||
if (tr.allsolid)
|
||||
return; // looking at a wall, leave ideal the
|
||||
//
|
||||
// way is was
|
||||
|
||||
// way it was
|
||||
if (tr.fraction == 1)
|
||||
return; // near a dropoff
|
||||
|
||||
|
@ -133,20 +128,12 @@ SV_SetIdealPitch (void)
|
|||
SVfloat (sv_player, idealpitch) = -dir * sv_idealpitchscale->value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_UserFriction
|
||||
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SV_UserFriction (void)
|
||||
{
|
||||
float *vel;
|
||||
float speed, newspeed, control;
|
||||
float control, friction, speed, newspeed;
|
||||
vec3_t start, stop;
|
||||
float friction;
|
||||
trace_t trace;
|
||||
|
||||
vel = velocity;
|
||||
|
@ -155,7 +142,7 @@ SV_UserFriction (void)
|
|||
if (!speed)
|
||||
return;
|
||||
|
||||
// if the leading edge is over a dropoff, increase friction
|
||||
// if the leading edge is over a dropoff, increase friction
|
||||
start[0] = stop[0] = origin[0] + vel[0] / speed * 16;
|
||||
start[1] = stop[1] = origin[1] + vel[1] / speed * 16;
|
||||
start[2] = origin[2] + SVvector (sv_player, mins)[2];
|
||||
|
@ -168,7 +155,7 @@ SV_UserFriction (void)
|
|||
else
|
||||
friction = sv_friction->value;
|
||||
|
||||
// apply friction
|
||||
// apply friction
|
||||
control = speed < sv_stopspeed->value ? sv_stopspeed->value : speed;
|
||||
newspeed = speed - host_frametime * control * friction;
|
||||
|
||||
|
@ -181,11 +168,6 @@ SV_UserFriction (void)
|
|||
vel[2] = vel[2] * newspeed;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SV_Accelerate
|
||||
==============
|
||||
*/
|
||||
cvar_t *sv_maxspeed;
|
||||
cvar_t *sv_accelerate;
|
||||
|
||||
|
@ -211,6 +193,7 @@ SV_Accelerate (vec3_t wishvel)
|
|||
velocity[i] += accelspeed * pushvec[i];
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
SV_Accelerate (void)
|
||||
{
|
||||
|
@ -242,7 +225,7 @@ SV_AirAccelerate (vec3_t wishveloc)
|
|||
addspeed = wishspd - currentspeed;
|
||||
if (addspeed <= 0)
|
||||
return;
|
||||
// accelspeed = sv_accelerate->value * host_frametime;
|
||||
// accelspeed = sv_accelerate->value * host_frametime;
|
||||
accelspeed = sv_accelerate->value * wishspeed * host_frametime;
|
||||
if (accelspeed > addspeed)
|
||||
accelspeed = addspeed;
|
||||
|
@ -251,7 +234,6 @@ SV_AirAccelerate (vec3_t wishveloc)
|
|||
velocity[i] += accelspeed * wishveloc[i];
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
DropPunchAngle (void)
|
||||
{
|
||||
|
@ -262,25 +244,18 @@ DropPunchAngle (void)
|
|||
len -= 10 * host_frametime;
|
||||
if (len < 0)
|
||||
len = 0;
|
||||
VectorScale (SVvector (sv_player, punchangle), len, SVvector (sv_player, punchangle));
|
||||
VectorScale (SVvector (sv_player, punchangle), len, SVvector (sv_player,
|
||||
punchangle));
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
SV_WaterMove
|
||||
|
||||
===================
|
||||
*/
|
||||
void
|
||||
SV_WaterMove (void)
|
||||
{
|
||||
int i;
|
||||
vec3_t wishvel;
|
||||
float speed, newspeed, wishspeed, addspeed, accelspeed;
|
||||
vec3_t wishvel;
|
||||
|
||||
//
|
||||
// user intentions
|
||||
//
|
||||
// user intentions
|
||||
AngleVectors (SVvector (sv_player, v_angle), forward, right, up);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
|
@ -298,9 +273,7 @@ SV_WaterMove (void)
|
|||
}
|
||||
wishspeed *= 0.7;
|
||||
|
||||
//
|
||||
// water friction
|
||||
//
|
||||
// water friction
|
||||
speed = Length (velocity);
|
||||
if (speed) {
|
||||
newspeed = speed - host_frametime * speed * sv_friction->value;
|
||||
|
@ -310,9 +283,7 @@ SV_WaterMove (void)
|
|||
} else
|
||||
newspeed = 0;
|
||||
|
||||
//
|
||||
// water acceleration
|
||||
//
|
||||
// water acceleration
|
||||
if (!wishspeed)
|
||||
return;
|
||||
|
||||
|
@ -332,34 +303,29 @@ SV_WaterMove (void)
|
|||
void
|
||||
SV_WaterJump (void)
|
||||
{
|
||||
if (sv.time > SVfloat (sv_player, teleport_time) || !SVfloat (sv_player, waterlevel)) {
|
||||
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) & ~FL_WATERJUMP;
|
||||
if (sv.time > SVfloat (sv_player, teleport_time) ||
|
||||
!SVfloat (sv_player, waterlevel)) {
|
||||
SVfloat (sv_player, flags) = (int) SVfloat (sv_player, flags) &
|
||||
~FL_WATERJUMP;
|
||||
SVfloat (sv_player, teleport_time) = 0;
|
||||
}
|
||||
SVvector (sv_player, velocity)[0] = SVvector (sv_player, movedir)[0];
|
||||
SVvector (sv_player, velocity)[1] = SVvector (sv_player, movedir)[1];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
SV_AirMove
|
||||
|
||||
===================
|
||||
*/
|
||||
void
|
||||
SV_AirMove (void)
|
||||
{
|
||||
int i;
|
||||
vec3_t wishvel;
|
||||
float fmove, smove;
|
||||
vec3_t wishvel;
|
||||
|
||||
AngleVectors (SVvector (sv_player, angles), forward, right, up);
|
||||
|
||||
fmove = cmd.forwardmove;
|
||||
smove = cmd.sidemove;
|
||||
|
||||
// hack to not let you back into teleporter
|
||||
// hack to not let you back into teleporter
|
||||
if (sv.time < SVfloat (sv_player, teleport_time) && fmove < 0)
|
||||
fmove = 0;
|
||||
|
||||
|
@ -383,20 +349,16 @@ SV_AirMove (void)
|
|||
} else if (onground) {
|
||||
SV_UserFriction ();
|
||||
SV_Accelerate ();
|
||||
} else { // not on ground, so little effect on
|
||||
//
|
||||
// velocity
|
||||
} else { // not on ground, so little effect on velocity
|
||||
SV_AirAccelerate (wishvel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
SV_ClientThink
|
||||
SV_ClientThink
|
||||
|
||||
the move fields specify an intended velocity in pix/sec
|
||||
the angle fields specify an exact angular motion in degrees
|
||||
===================
|
||||
the move fields specify an intended velocity in pix/sec
|
||||
the angle fields specify an exact angular motion in degrees
|
||||
*/
|
||||
void
|
||||
SV_ClientThink (void)
|
||||
|
@ -413,21 +375,19 @@ SV_ClientThink (void)
|
|||
|
||||
DropPunchAngle ();
|
||||
|
||||
//
|
||||
// if dead, behave differently
|
||||
//
|
||||
// if dead, behave differently
|
||||
if (SVfloat (sv_player, health) <= 0)
|
||||
return;
|
||||
|
||||
//
|
||||
// angles
|
||||
// show 1/3 the pitch angle and all the roll angle
|
||||
// angles
|
||||
// show 1/3 the pitch angle and all the roll angle
|
||||
cmd = host_client->cmd;
|
||||
angles = SVvector (sv_player, angles);
|
||||
|
||||
VectorAdd (SVvector (sv_player, v_angle), SVvector (sv_player, punchangle), v_angle);
|
||||
angles[ROLL] =
|
||||
V_CalcRoll (SVvector (sv_player, angles), SVvector (sv_player, velocity)) * 4;
|
||||
VectorAdd (SVvector (sv_player, v_angle), SVvector (sv_player,
|
||||
punchangle), v_angle);
|
||||
angles[ROLL] = V_CalcRoll (SVvector (sv_player, angles),
|
||||
SVvector (sv_player, velocity)) * 4;
|
||||
if (!SVfloat (sv_player, fixangle)) {
|
||||
angles[PITCH] = -v_angle[PITCH] / 3;
|
||||
angles[YAW] = v_angle[YAW];
|
||||
|
@ -437,9 +397,7 @@ SV_ClientThink (void)
|
|||
SV_WaterJump ();
|
||||
return;
|
||||
}
|
||||
//
|
||||
// walk
|
||||
//
|
||||
// walk
|
||||
if ((SVfloat (sv_player, waterlevel) >= 2)
|
||||
&& (SVfloat (sv_player, movetype) != MOVETYPE_NOCLIP)) {
|
||||
SV_WaterMove ();
|
||||
|
@ -449,36 +407,29 @@ SV_ClientThink (void)
|
|||
SV_AirMove ();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===================
|
||||
SV_ReadClientMove
|
||||
===================
|
||||
*/
|
||||
void
|
||||
SV_ReadClientMove (usercmd_t *move)
|
||||
{
|
||||
int i;
|
||||
int i, bits;
|
||||
vec3_t angle;
|
||||
int bits;
|
||||
|
||||
// read ping time
|
||||
// read ping time
|
||||
host_client->ping_times[host_client->num_pings % NUM_PING_TIMES]
|
||||
= sv.time - MSG_ReadFloat (net_message);
|
||||
host_client->num_pings++;
|
||||
|
||||
// read current angles
|
||||
// read current angles
|
||||
for (i = 0; i < 3; i++)
|
||||
angle[i] = MSG_ReadAngle (net_message);
|
||||
|
||||
VectorCopy (angle, SVvector (host_client->edict, v_angle));
|
||||
|
||||
// read movement
|
||||
// read movement
|
||||
move->forwardmove = MSG_ReadShort (net_message);
|
||||
move->sidemove = MSG_ReadShort (net_message);
|
||||
move->upmove = MSG_ReadShort (net_message);
|
||||
|
||||
// read buttons
|
||||
// read buttons
|
||||
bits = MSG_ReadByte (net_message);
|
||||
SVfloat (host_client->edict, button0) = bits & 1;
|
||||
SVfloat (host_client->edict, button2) = (bits & 2) >> 1;
|
||||
|
@ -488,23 +439,20 @@ SV_ReadClientMove (usercmd_t *move)
|
|||
SVfloat (host_client->edict, impulse) = i;
|
||||
|
||||
#ifdef QUAKE2
|
||||
// read light level
|
||||
// read light level
|
||||
SVfloat (host_client->edict, light_level) = MSG_ReadByte (net_message);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
SV_ReadClientMessage
|
||||
SV_ReadClientMessage
|
||||
|
||||
Returns false if the client should be killed
|
||||
===================
|
||||
Returns false if the client should be killed
|
||||
*/
|
||||
qboolean
|
||||
SV_ReadClientMessage (void)
|
||||
{
|
||||
int ret;
|
||||
int cmd;
|
||||
int cmd, ret;
|
||||
char *s;
|
||||
|
||||
do {
|
||||
|
@ -531,18 +479,18 @@ SV_ReadClientMessage (void)
|
|||
cmd = MSG_ReadChar (net_message);
|
||||
|
||||
switch (cmd) {
|
||||
case -1:
|
||||
case -1:
|
||||
goto nextmsg; // end of message
|
||||
|
||||
default:
|
||||
default:
|
||||
Sys_Printf ("SV_ReadClientMessage: unknown command char\n");
|
||||
return false;
|
||||
|
||||
case clc_nop:
|
||||
// Sys_Printf ("clc_nop\n");
|
||||
case clc_nop:
|
||||
// Sys_Printf ("clc_nop\n");
|
||||
break;
|
||||
|
||||
case clc_stringcmd:
|
||||
case clc_stringcmd:
|
||||
s = MSG_ReadString (net_message);
|
||||
if (host_client->privileged)
|
||||
ret = 2;
|
||||
|
@ -594,11 +542,11 @@ SV_ReadClientMessage (void)
|
|||
Con_DPrintf ("%s tried to %s\n", host_client->name, s);
|
||||
break;
|
||||
|
||||
case clc_disconnect:
|
||||
// Sys_Printf ("SV_ReadClientMessage: client disconnected\n");
|
||||
case clc_disconnect:
|
||||
// Sys_Printf ("SV_ReadClientMessage: client disconnected\n");
|
||||
return false;
|
||||
|
||||
case clc_move:
|
||||
case clc_move:
|
||||
SV_ReadClientMove (&host_client->cmd);
|
||||
break;
|
||||
}
|
||||
|
@ -608,12 +556,6 @@ SV_ReadClientMessage (void)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_RunClients
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SV_RunClients (void)
|
||||
{
|
||||
|
@ -636,26 +578,21 @@ SV_RunClients (void)
|
|||
memset (&host_client->cmd, 0, sizeof (host_client->cmd));
|
||||
continue;
|
||||
}
|
||||
// always pause in single player if in console or menus
|
||||
// always pause in single player if in console or menus
|
||||
if (!sv.paused && (svs.maxclients > 1 || key_dest == key_game))
|
||||
SV_ClientThink ();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
V_CalcRoll
|
||||
V_CalcRoll
|
||||
|
||||
Used by view and sv_user
|
||||
===============
|
||||
Used by view and sv_user
|
||||
*/
|
||||
|
||||
float
|
||||
V_CalcRoll (vec3_t angles, vec3_t velocity)
|
||||
{
|
||||
float sign;
|
||||
float side;
|
||||
float value;
|
||||
float side, sign, value;
|
||||
|
||||
AngleVectors (angles, forward, right, up);
|
||||
side = DotProduct (velocity, right);
|
||||
|
@ -663,8 +600,8 @@ V_CalcRoll (vec3_t angles, vec3_t velocity)
|
|||
side = fabs (side);
|
||||
|
||||
value = cl_rollangle->value;
|
||||
// if (cl.inwater)
|
||||
// value *= 6;
|
||||
// if (cl.inwater)
|
||||
// value *= 6;
|
||||
|
||||
if (side < cl_rollspeed->value)
|
||||
side = side * value / cl_rollspeed->value;
|
||||
|
@ -672,5 +609,4 @@ V_CalcRoll (vec3_t angles, vec3_t velocity)
|
|||
side = value;
|
||||
|
||||
return side * sign;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
sys_null.c
|
||||
|
||||
@description@
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -32,17 +32,13 @@
|
|||
|
||||
#include "errno.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
VFile IO
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
#define MAX_HANDLES 10
|
||||
|
||||
VFile *sys_handles[MAX_HANDLES];
|
||||
|
||||
|
||||
// VFile IO ===================================================================
|
||||
|
||||
int
|
||||
findhandle (void)
|
||||
{
|
||||
|
@ -55,16 +51,10 @@ findhandle (void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
filelength
|
||||
================
|
||||
*/
|
||||
int
|
||||
filelength (VFile *f)
|
||||
{
|
||||
int pos;
|
||||
int end;
|
||||
int pos, end;
|
||||
|
||||
pos = ftell (f);
|
||||
fseek (f, 0, SEEK_END);
|
||||
|
@ -153,15 +143,7 @@ Sys_mkdir (char *path)
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
SYSTEM IO
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
// SYSTEM IO ==================================================================
|
||||
|
||||
void
|
||||
Sys_Error (char *error, ...)
|
||||
|
|
|
@ -29,38 +29,43 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_CONIO_H
|
||||
# include <conio.h>
|
||||
#endif
|
||||
#ifdef HAVE_IO_H
|
||||
# include <io.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
# include <stdarg.h>
|
||||
# include <string.h>
|
||||
# include <ctype.h>
|
||||
# include <fcntl.h>
|
||||
# include <signal.h>
|
||||
# include <limits.h>
|
||||
# include <sys/types.h>
|
||||
# include <stdarg.h>
|
||||
# include <sys/mman.h>
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_main.h>
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qargs.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "compat.h"
|
||||
|
@ -74,8 +79,7 @@ int noconinput;
|
|||
|
||||
#ifdef _WIN32
|
||||
# include "winquake.h"
|
||||
// FIXME: minimized is not currently supported under
|
||||
// SDL
|
||||
// FIXME: minimized is not currently supported under SDL
|
||||
qboolean Minimized = false;
|
||||
void MaskExceptions (void);
|
||||
#endif
|
||||
|
@ -110,8 +114,7 @@ Sys_Init (void)
|
|||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
// make sure the timer is high precision, otherwise
|
||||
// NT gets 18ms resolution
|
||||
// make sure the timer is high precision, otherwise NT gets 18ms resolution
|
||||
timeBeginPeriod (1);
|
||||
|
||||
vinfo.dwOSVersionInfoSize = sizeof (vinfo);
|
||||
|
@ -127,9 +130,6 @@ Sys_Init (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Quit
|
||||
*/
|
||||
void
|
||||
Sys_Quit (void)
|
||||
{
|
||||
|
@ -137,9 +137,6 @@ Sys_Quit (void)
|
|||
exit (0);
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Error
|
||||
*/
|
||||
void
|
||||
Sys_Error (const char *error, ...)
|
||||
{
|
||||
|
@ -189,14 +186,12 @@ Sys_ConsoleInput (void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
void
|
||||
Sys_HighFPPrecision (void)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Sys_LowFPPrecision (void)
|
||||
{
|
||||
|
@ -215,8 +210,8 @@ Sys_Sleep (void)
|
|||
int
|
||||
SDL_main (int c, char **v)
|
||||
{
|
||||
double time, oldtime, newtime;
|
||||
int j;
|
||||
double time, oldtime, newtime;
|
||||
|
||||
#ifndef WIN32
|
||||
signal (SIGFPE, SIG_IGN);
|
||||
|
@ -249,7 +244,7 @@ SDL_main (int c, char **v)
|
|||
|
||||
oldtime = Sys_DoubleTime ();
|
||||
while (1) {
|
||||
// find time spent rendering last frame
|
||||
// find time spent rendering last frame
|
||||
newtime = Sys_DoubleTime ();
|
||||
time = newtime - oldtime;
|
||||
|
||||
|
|
|
@ -36,23 +36,26 @@
|
|||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <time.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "QF/sys.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "server.h"
|
||||
|
||||
#include "host.h"
|
||||
#include "server.h"
|
||||
|
||||
qboolean isDedicated;
|
||||
|
||||
|
@ -72,9 +75,6 @@ Sys_Init (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Quit
|
||||
*/
|
||||
void
|
||||
Sys_Quit (void)
|
||||
{
|
||||
|
@ -84,16 +84,13 @@ Sys_Quit (void)
|
|||
exit (0);
|
||||
}
|
||||
|
||||
/*
|
||||
Sys_Error
|
||||
*/
|
||||
void
|
||||
Sys_Error (const char *error, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
char string[1024];
|
||||
|
||||
// change stdin to non blocking
|
||||
// change stdin to non blocking
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
||||
|
||||
va_start (argptr, error);
|
||||
|
@ -125,7 +122,7 @@ Sys_DebugLog (const char *file, const char *fmt, ...)
|
|||
void
|
||||
floating_point_exception_handler (int whatever)
|
||||
{
|
||||
// Sys_Warn("floating point exception\n");
|
||||
// Sys_Warn("floating point exception\n");
|
||||
signal (SIGFPE, floating_point_exception_handler);
|
||||
}
|
||||
|
||||
|
@ -171,7 +168,6 @@ void
|
|||
Sys_LowFPPrecision (void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
|
@ -200,8 +196,8 @@ main (int c, const char *v[])
|
|||
parms.membase = malloc (parms.memsize);
|
||||
|
||||
parms.basedir = basedir;
|
||||
// caching is disabled by default, use -cachedir to enable
|
||||
// parms.cachedir = cachedir;
|
||||
// caching is disabled by default, use -cachedir to enable
|
||||
// parms.cachedir = cachedir;
|
||||
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) | FNDELAY);
|
||||
|
||||
|
@ -220,15 +216,14 @@ main (int c, const char *v[])
|
|||
|
||||
oldtime = Sys_DoubleTime () - 0.1;
|
||||
while (1) {
|
||||
// find time spent rendering last frame
|
||||
// find time spent rendering last frame
|
||||
newtime = Sys_DoubleTime ();
|
||||
time = newtime - oldtime;
|
||||
|
||||
if (cls.state == ca_dedicated) { // play vcrfiles at max speed
|
||||
if (time < sys_ticrate->value && (!vcrFile || recording)) {
|
||||
usleep (1);
|
||||
continue; // not time to run a server only tic
|
||||
// yet
|
||||
continue; // not time to run a server only tic yet
|
||||
}
|
||||
time = sys_ticrate->value;
|
||||
}
|
||||
|
@ -239,8 +234,5 @@ main (int c, const char *v[])
|
|||
oldtime += time;
|
||||
|
||||
Host_Frame (time);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -35,30 +35,33 @@
|
|||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "QF/sys.h"
|
||||
#include "host.h"
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/qargs.h"
|
||||
|
||||
qboolean isDedicated;
|
||||
|
||||
|
@ -71,6 +74,7 @@ cvar_t *sys_linerefresh;
|
|||
cvar_t *timestamps;
|
||||
cvar_t *timeformat;
|
||||
|
||||
|
||||
int
|
||||
Sys_FileOpenRead (char *path, int *handle)
|
||||
{
|
||||
|
@ -187,7 +191,7 @@ Sys_Error (char *error, ...)
|
|||
va_list argptr;
|
||||
char string[1024];
|
||||
|
||||
// change stdin to non blocking
|
||||
// change stdin to non blocking
|
||||
fcntl (0, F_SETFL, fcntl (0, F_GETFL, 0) & ~FNDELAY);
|
||||
|
||||
va_start (argptr, error);
|
||||
|
@ -234,7 +238,6 @@ Sys_DoubleTime (void)
|
|||
return (tp.tv_sec - secbase) + tp.tv_usec / 1000000.0;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
Sys_ConsoleInput (void)
|
||||
{
|
||||
|
@ -329,4 +332,3 @@ main (int argc, char *argv[])
|
|||
}
|
||||
return true; // return success
|
||||
}
|
||||
|
||||
|
|
|
@ -82,20 +82,15 @@ void Sys_PopFPCW (void);
|
|||
volatile int sys_checksum;
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_PageIn
|
||||
================
|
||||
*/
|
||||
void
|
||||
Sys_PageIn (void *ptr, int size)
|
||||
{
|
||||
byte *x;
|
||||
int m, n;
|
||||
|
||||
// touch all the memory to make sure it's there. The 16-page skip is to
|
||||
// keep Win 95 from thinking we're trying to page ourselves in (we are
|
||||
// doing that, of course, but there's no reason we shouldn't)
|
||||
// touch all the memory to make sure it's there. The 16-page skip is to
|
||||
// keep Win 95 from thinking we're trying to page ourselves in (we are
|
||||
// doing that, of course, but there's no reason we shouldn't)
|
||||
x = (byte *) ptr;
|
||||
|
||||
for (n = 0; n < 4; n++) {
|
||||
|
@ -106,14 +101,7 @@ Sys_PageIn (void *ptr, int size)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
FILE IO
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
// FILE IO ====================================================================
|
||||
|
||||
#define MAX_HANDLES 10
|
||||
VFile *sys_handles[MAX_HANDLES];
|
||||
|
@ -130,15 +118,7 @@ findhandle (void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
SYSTEM IO
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
// SYSTEM IO ==================================================================
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
|
||||
|
@ -164,11 +144,6 @@ MaskExceptions (void)
|
|||
|
||||
#endif
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_Init
|
||||
================
|
||||
*/
|
||||
void
|
||||
Sys_Init (void)
|
||||
{
|
||||
|
@ -182,8 +157,8 @@ Sys_Init (void)
|
|||
if (!QueryPerformanceFrequency (&PerformanceFreq))
|
||||
Sys_Error ("No hardware timer available");
|
||||
|
||||
// get 32 out of the 64 time bits such that we have around
|
||||
// 1 microsecond resolution
|
||||
// get 32 out of the 64 time bits such that we have around
|
||||
// 1 microsecond resolution
|
||||
lowpart = (unsigned int) PerformanceFreq.LowPart;
|
||||
highpart = (unsigned int) PerformanceFreq.HighPart;
|
||||
lowshift = 0;
|
||||
|
@ -215,7 +190,6 @@ Sys_Init (void)
|
|||
WinNT = false;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Sys_Error (const char *error, ...)
|
||||
{
|
||||
|
@ -252,7 +226,6 @@ Sys_Error (const char *error, ...)
|
|||
WriteFile (houtput, text3, strlen (text3), &dummy, NULL);
|
||||
WriteFile (houtput, text4, strlen (text4), &dummy, NULL);
|
||||
|
||||
|
||||
starttime = Sys_DoubleTime ();
|
||||
sc_return_on_enter = true; // so Enter will get us out of here
|
||||
|
||||
|
@ -261,8 +234,7 @@ Sys_Error (const char *error, ...)
|
|||
}
|
||||
} else {
|
||||
// switch to windowed so the message box is visible, unless we
|
||||
// already
|
||||
// tried that and failed
|
||||
// already tried that and failed
|
||||
if (!in_sys_error0) {
|
||||
in_sys_error0 = 1;
|
||||
VID_SetDefaultMode ();
|
||||
|
@ -278,7 +250,7 @@ Sys_Error (const char *error, ...)
|
|||
in_sys_error1 = 1;
|
||||
Host_Shutdown ();
|
||||
}
|
||||
// shut down QHOST hooks if necessary
|
||||
// shut down QHOST hooks if necessary
|
||||
if (!in_sys_error2) {
|
||||
in_sys_error2 = 1;
|
||||
DeinitConProc ();
|
||||
|
@ -287,7 +259,6 @@ Sys_Error (const char *error, ...)
|
|||
exit (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Sys_Quit (void)
|
||||
{
|
||||
|
@ -302,18 +273,12 @@ Sys_Quit (void)
|
|||
if (isDedicated)
|
||||
FreeConsole ();
|
||||
|
||||
// shut down QHOST hooks if necessary
|
||||
// shut down QHOST hooks if necessary
|
||||
DeinitConProc ();
|
||||
|
||||
exit (0);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
Sys_InitFloatTime
|
||||
================
|
||||
*/
|
||||
void
|
||||
Sys_InitFloatTime (void)
|
||||
{
|
||||
|
@ -332,7 +297,6 @@ Sys_InitFloatTime (void)
|
|||
lastcurtime = curtime;
|
||||
}
|
||||
|
||||
|
||||
const char *
|
||||
Sys_ConsoleInput (void)
|
||||
{
|
||||
|
@ -347,7 +311,6 @@ Sys_ConsoleInput (void)
|
|||
if (!isDedicated)
|
||||
return NULL;
|
||||
|
||||
|
||||
for (;;) {
|
||||
if (!GetNumberOfConsoleInputEvents (hinput, &numevents))
|
||||
Sys_Error ("Error getting # of console events");
|
||||
|
@ -366,7 +329,7 @@ Sys_ConsoleInput (void)
|
|||
ch = recs[0].Event.KeyEvent.uChar.AsciiChar;
|
||||
|
||||
switch (ch) {
|
||||
case '\r':
|
||||
case '\r':
|
||||
WriteFile (houtput, "\r\n", 2, &dummy, NULL);
|
||||
|
||||
if (len) {
|
||||
|
@ -383,14 +346,14 @@ Sys_ConsoleInput (void)
|
|||
|
||||
break;
|
||||
|
||||
case '\b':
|
||||
case '\b':
|
||||
WriteFile (houtput, "\b \b", 3, &dummy, NULL);
|
||||
if (len) {
|
||||
len--;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
if (ch >= ' ') {
|
||||
WriteFile (houtput, &ch, 1, &dummy, NULL);
|
||||
text[len] = ch;
|
||||
|
@ -413,41 +376,20 @@ Sys_Sleep (void)
|
|||
Sleep (1);
|
||||
}
|
||||
|
||||
// WINDOWS CRAP ===============================================================
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
WINDOWS CRAP
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
WinMain
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SleepUntilInput (int time)
|
||||
{
|
||||
|
||||
MsgWaitForMultipleObjects (1, &tevent, FALSE, time, QS_ALLINPUT);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
WinMain
|
||||
==================
|
||||
*/
|
||||
HINSTANCE global_hInstance;
|
||||
int global_nCmdShow;
|
||||
char *argv[MAX_NUM_ARGVS];
|
||||
static char *empty_string = "";
|
||||
HWND hwnd_dialog;
|
||||
|
||||
|
||||
int WINAPI
|
||||
WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
|
@ -496,7 +438,6 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
*lpCmdLine = 0;
|
||||
lpCmdLine++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -510,8 +451,8 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
isDedicated = (COM_CheckParm ("-dedicated") != 0);
|
||||
|
||||
if (!isDedicated) {
|
||||
hwnd_dialog =
|
||||
CreateDialog (hInstance, MAKEINTRESOURCE (IDD_DIALOG1), NULL, NULL);
|
||||
hwnd_dialog = CreateDialog (hInstance, MAKEINTRESOURCE (IDD_DIALOG1),
|
||||
NULL, NULL);
|
||||
|
||||
if (hwnd_dialog) {
|
||||
if (GetWindowRect (hwnd_dialog, &rect)) {
|
||||
|
@ -528,9 +469,9 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
|
|||
SetForegroundWindow (hwnd_dialog);
|
||||
}
|
||||
}
|
||||
// take the greater of all the available memory or half the total memory,
|
||||
// but at least 8 Mb and no more than 16 Mb, unless they explicitly
|
||||
// request otherwise
|
||||
// take the greater of all the available memory or half the total memory,
|
||||
// but at least 8 Mb and no more than 16 Mb, unless they explicitly
|
||||
// request otherwise
|
||||
parms.memsize = lpBuffer.dwAvailPhys;
|
||||
|
||||
if (parms.memsize < MINIMUM_WIN_MEMORY)
|
||||
|
|
|
@ -30,23 +30,18 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "winquake.h"
|
||||
#include "errno.h"
|
||||
#include <sys\types.h>
|
||||
#include <sys\timeb.h>
|
||||
|
||||
#include "winquake.h"
|
||||
#include "errno.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
FILE IO
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
// FILE IO ====================================================================
|
||||
|
||||
#define MAX_HANDLES 10
|
||||
VFile *sys_handles[MAX_HANDLES];
|
||||
|
||||
|
||||
int
|
||||
findhandle (void)
|
||||
{
|
||||
|
@ -59,11 +54,6 @@ findhandle (void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
filelength
|
||||
================
|
||||
*/
|
||||
int
|
||||
filelength (VFile *f)
|
||||
{
|
||||
|
@ -157,15 +147,7 @@ Sys_mkdir (char *path)
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
SYSTEM IO
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
// SYSTEM IO ==================================================================
|
||||
|
||||
void
|
||||
Sys_DebugLog (char *file, char *fmt, ...)
|
||||
|
@ -182,7 +164,7 @@ Sys_Error (char *error, ...)
|
|||
vsnprintf (text, sizeof (text), error, argptr);
|
||||
va_end (argptr);
|
||||
|
||||
// MessageBox(NULL, text, "Error", 0 /* MB_OK */ );
|
||||
// MessageBox(NULL, text, "Error", 0 /* MB_OK */ );
|
||||
printf ("ERROR: %s\n", text);
|
||||
|
||||
exit (1);
|
||||
|
@ -225,7 +207,6 @@ Sys_Sleep (void)
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
IN_SendKeyEvents (void)
|
||||
{
|
||||
|
@ -278,14 +259,6 @@ Sys_ConsoleInput (void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
main
|
||||
|
||||
==================
|
||||
*/
|
||||
char *newargv[256];
|
||||
|
||||
int
|
||||
|
@ -305,7 +278,7 @@ main (int argc, char **argv)
|
|||
if (cwd[Q_strlen (cwd) - 1] == '\\')
|
||||
cwd[Q_strlen (cwd) - 1] = 0;
|
||||
parms.basedir = cwd; // "f:/quake";
|
||||
// parms.basedir = "f:\\quake";
|
||||
// parms.basedir = "f:\\quake";
|
||||
|
||||
COM_InitArgv (argc, argv);
|
||||
|
||||
|
|
|
@ -39,14 +39,10 @@
|
|||
#include "world.h"
|
||||
|
||||
/*
|
||||
|
||||
entities never clip against themselves, or their owner
|
||||
|
||||
line of sight checks trace->crosscontent, but bullets don't
|
||||
|
||||
entities never clip against themselves, or their owner
|
||||
line of sight checks trace->crosscontent, but bullets don't
|
||||
*/
|
||||
|
||||
|
||||
typedef struct {
|
||||
vec3_t boxmins, boxmaxs; // enclose the test object along
|
||||
// entire move
|
||||
|
@ -59,12 +55,9 @@ typedef struct {
|
|||
edict_t *passedict;
|
||||
} moveclip_t;
|
||||
|
||||
|
||||
int SV_HullPointContents (hull_t *hull, int num, vec3_t p);
|
||||
|
||||
/*
|
||||
HULL BOXES
|
||||
*/
|
||||
/* HULL BOXES */
|
||||
|
||||
static hull_t box_hull;
|
||||
static dclipnode_t box_clipnodes[6];
|
||||
|
@ -105,7 +98,6 @@ SV_InitBoxHull (void)
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_HullForBox
|
||||
|
||||
|
@ -125,7 +117,6 @@ SV_HullForBox (vec3_t mins, vec3_t maxs)
|
|||
return &box_hull;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_HullForEntity
|
||||
|
||||
|
@ -175,10 +166,7 @@ SV_HullForEntity (edict_t *ent, vec3_t mins, vec3_t maxs, vec3_t offset)
|
|||
return hull;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
ENTITY AREA CHECKING
|
||||
*/
|
||||
/* ENTITY AREA CHECKING */
|
||||
|
||||
typedef struct areanode_s {
|
||||
int axis; // -1 = leaf node
|
||||
|
@ -194,7 +182,6 @@ typedef struct areanode_s {
|
|||
static areanode_t sv_areanodes[AREA_NODES];
|
||||
static int sv_numareanodes;
|
||||
|
||||
|
||||
areanode_t *
|
||||
SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs)
|
||||
{
|
||||
|
@ -234,7 +221,6 @@ SV_CreateAreaNode (int depth, vec3_t mins, vec3_t maxs)
|
|||
return anode;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SV_ClearWorld (void)
|
||||
{
|
||||
|
@ -245,7 +231,6 @@ SV_ClearWorld (void)
|
|||
SV_CreateAreaNode (0, sv.worldmodel->mins, sv.worldmodel->maxs);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SV_UnlinkEdict (edict_t *ent)
|
||||
{
|
||||
|
@ -255,7 +240,6 @@ SV_UnlinkEdict (edict_t *ent)
|
|||
ent->area.prev = ent->area.next = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SV_TouchLinks (edict_t *ent, areanode_t *node)
|
||||
{
|
||||
|
@ -302,7 +286,6 @@ SV_TouchLinks (edict_t *ent, areanode_t *node)
|
|||
SV_TouchLinks (ent, node->children[1]);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
|
||||
{
|
||||
|
@ -340,7 +323,6 @@ SV_FindTouchedLeafs (edict_t *ent, mnode_t *node)
|
|||
SV_FindTouchedLeafs (ent, node->children[1]);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
|
||||
{
|
||||
|
@ -410,11 +392,7 @@ SV_LinkEdict (edict_t *ent, qboolean touch_triggers)
|
|||
SV_TouchLinks (ent, sv_areanodes);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
POINT TESTING IN HULLS
|
||||
*/
|
||||
|
||||
/* POINT TESTING IN HULLS */
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
int
|
||||
|
@ -445,7 +423,6 @@ SV_HullPointContents (hull_t *hull, int num, vec3_t p)
|
|||
}
|
||||
#endif // !USE_INTEL_ASM
|
||||
|
||||
|
||||
int
|
||||
SV_PointContents (vec3_t p)
|
||||
{
|
||||
|
@ -457,14 +434,12 @@ SV_PointContents (vec3_t p)
|
|||
return cont;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
SV_TruePointContents (vec3_t p)
|
||||
{
|
||||
return SV_HullPointContents (&sv.worldmodel->hulls[0], 0, p);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_TestEntityPosition
|
||||
|
||||
|
@ -486,15 +461,11 @@ SV_TestEntityPosition (edict_t *ent)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
LINE TESTING IN HULLS
|
||||
*/
|
||||
/* LINE TESTING IN HULLS */
|
||||
|
||||
// 1/32 epsilon to keep floating point happy
|
||||
#define DIST_EPSILON (0.03125)
|
||||
|
||||
|
||||
qboolean
|
||||
SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
|
||||
vec3_t p2, trace_t *trace)
|
||||
|
@ -619,7 +590,6 @@ SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, vec3_t p1,
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_ClipMoveToEntity
|
||||
|
||||
|
@ -663,7 +633,6 @@ SV_ClipMoveToEntity (edict_t *ent, vec3_t start, vec3_t mins, vec3_t maxs,
|
|||
return trace;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
SV_ClipToLinks
|
||||
|
||||
|
@ -743,7 +712,6 @@ SV_ClipToLinks (areanode_t *node, moveclip_t * clip)
|
|||
SV_ClipToLinks (node->children[1], clip);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
|
||||
vec3_t boxmins, vec3_t boxmaxs)
|
||||
|
@ -767,7 +735,6 @@ SV_MoveBounds (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end,
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
trace_t
|
||||
SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type,
|
||||
edict_t *passedict)
|
||||
|
|
Loading…
Reference in a new issue