Skip to content

Commit

Permalink
This commit was generated by cvs2svn to compensate for changes in r33,
Browse files Browse the repository at this point in the history
which included commits to RCS files with non-trunk default branches.
  • Loading branch information
VVD committed Oct 18, 2004
1 parent d3f4125 commit 8c051f3
Show file tree
Hide file tree
Showing 21 changed files with 730 additions and 300 deletions.
2 changes: 2 additions & 0 deletions make
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
make build_sv

2 changes: 2 additions & 0 deletions make_sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
make build_sv

1 change: 0 additions & 1 deletion source/cl_demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ qboolean CL_GetDemoMessage (void)
{
olddemotime = nextdemotime;
if (cls.demoplayback2) {
Con_Printf("here\n");
cls.netchan.incoming_sequence++;
cls.netchan.incoming_acknowledged++;
cls.netchan.frame_latency = 0;
Expand Down
1 change: 0 additions & 1 deletion source/cl_ents.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ void CL_ParsePlayerinfo (void)
flags = MSG_ReadShort ();
state->flags = TranslateFlags(flags);

Con_Printf("p:%d %d\n", cl.parsecount, num);
state->messagenum = cl.parsecount;
state->command.msec = 0;

Expand Down
2 changes: 0 additions & 2 deletions source/cl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,6 @@ void Host_Frame (double time)
{
player_state_t *self, *oldself;

Con_Printf("%d, %d\n", cl.parsecount, cls.netchan.incoming_acknowledged);

self = &cl.frames[cl.parsecount & UPDATE_MASK].playerstate[cl.playernum];
oldself = &cl.frames[(cls.netchan.outgoing_sequence-1) & UPDATE_MASK].playerstate[cl.playernum];
self->messagenum = cl.parsecount;
Expand Down
17 changes: 17 additions & 0 deletions source/cl_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ qboolean CL_CheckOrDownloadFile (char *filename)
if (cls.demoplayback)
return true;

if (cls.download) {
Con_Printf("here\n");
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, "nextdl");
return false;
}

strcpy (cls.downloadname, filename);
Con_Printf ("Downloading %s...\n", cls.downloadname);

Expand Down Expand Up @@ -363,12 +370,22 @@ void CL_ParseDownload (void)
int size, percent;
byte name[1024];
int r;
static float time = 0;
static int s = 0;


// read the data
size = MSG_ReadShort ();
percent = MSG_ReadByte ();

s += size;
if (realtime - time > 1)
{
cls.downloadrate = s/(1024*(realtime - time));
time = realtime;
s = 0;
}

if (cls.demoplayback) {
if (size > 0)
msg_readcount += size;
Expand Down
2 changes: 1 addition & 1 deletion source/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ byte *COM_LoadFile (char *path, int usehunk)
fread(buf+l, 1, 128, h);
l += 128;
if (l - count > READMAX && (sv_cpserver.value > 0) && (sv_cpserver.value < 100)) {
Sys_Sleep(sv_cpserver.value);
Sys_Sleep((unsigned long)sv_cpserver.value);
count = l;
}
}
Expand Down
6 changes: 3 additions & 3 deletions source/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,10 +623,10 @@ void Con_DrawConsole (int lines)
text = cls.downloadname;

x = con_linewidth - ((con_linewidth * 7) / 40);
y = x - strlen(text) - 8;
y = x - strlen(text) - 10;
i = con_linewidth/3;
if (strlen(text) > i) {
y = x - i - 11;
y = x - i - 13;
Q_strncpyz (dlbar, text, i+1);
strcat(dlbar, "...");
} else
Expand All @@ -648,7 +648,7 @@ void Con_DrawConsole (int lines)
dlbar[i++] = '\x82';
dlbar[i] = 0;

sprintf(dlbar + strlen(dlbar), " %02d%%", cls.downloadpercent);
sprintf(dlbar + strlen(dlbar), " %02d%%(%dkb/s)", cls.downloadpercent, cls.downloadrate);

// draw it
y = con_vislines-22 + 8;
Expand Down
16 changes: 10 additions & 6 deletions source/keys.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ void Key_Event (int key, qboolean down)
{
char *kb;
char cmd[1024];
qboolean allow;

// Con_Printf ("%i : %i\n", key, down); //@@@

Expand Down Expand Up @@ -920,18 +921,24 @@ void Key_Event (int key, qboolean down)
// switch. Button commands include the kenum as a parameter, so multiple
// downs can be matched with ups
//

allow = (key_dest == key_menu && menubound[key])
|| ((key_dest == key_console || key_dest == key_message)
&& !consolekeys[key])
|| (key_dest == key_game && ( cls.state == ca_active || !consolekeys[key] ) );

if (!down)
{
kb = keybindings[key];
if (kb && kb[0] == '+')
if (kb && kb[0] == '+' )//&& allow)
{
sprintf (cmd, "-%s %i\n", kb+1, key);
Cbuf_AddText (cmd);
}
if (keyshift[key] != key)
{
kb = keybindings[keyshift[key]];
if (kb && kb[0] == '+')
if (kb && kb[0] == '+' )//&& allow)
{
sprintf (cmd, "-%s %i\n", kb+1, key);
Cbuf_AddText (cmd);
Expand All @@ -955,10 +962,7 @@ void Key_Event (int key, qboolean down)
//
// if not a consolekey, send to the interpreter no matter what mode is
//
if ( (key_dest == key_menu && menubound[key])
|| ((key_dest == key_console || key_dest == key_message)
&& !consolekeys[key])
|| (key_dest == key_game && ( cls.state == ca_active || !consolekeys[key] ) ) )
if ( allow )
{
kb = keybindings[key];
if (kb)
Expand Down
2 changes: 1 addition & 1 deletion source/net_chan.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ Netchan_CanPacket
Returns true if the bandwidth choke isn't active
================
*/
#define MAX_BACKUP 200
#define MAX_BACKUP 400
qboolean Netchan_CanPacket (netchan_t *chan)
{
if (chan->cleartime < realtime + MAX_BACKUP*chan->rate)
Expand Down
57 changes: 31 additions & 26 deletions source/pr_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1152,60 +1152,60 @@ sets chararcter table to translate quake texts to more friendly texts
====================
*/

static char chartbl[256];
char chartbl2[256];

void PR_CleanLogText_Init ()
{
int i;

for (i = 0; i < 256; i++)
chartbl[i] = (i&127) < 32 ? ' ' : i&127;
chartbl2[i] = (i&127) < 32 ? ' ' : i&127;

chartbl[13] = 13;
chartbl[10] = 10;
chartbl2[13] = 13;
chartbl2[10] = 10;
// special cases

// numbers
for (i = 18; i < 28; i++)
chartbl[i] = chartbl[i + 128] = i + 30;
chartbl2[i] = chartbl2[i + 128] = i + 30;

// brackets
chartbl[29] = chartbl[29 + 128] = chartbl[128] = '(';
chartbl[31] = chartbl[31 + 128] = chartbl[130] = ')';
chartbl[16] = chartbl[16 + 128]= '[';
chartbl[17] = chartbl[17 + 128] = ']';
chartbl2[29] = chartbl2[29 + 128] = chartbl2[128] = '(';
chartbl2[31] = chartbl2[31 + 128] = chartbl2[130] = ')';
chartbl2[16] = chartbl2[16 + 128]= '[';
chartbl2[17] = chartbl2[17 + 128] = ']';

// hash
for (i = 1; i < 5; i++)
chartbl[i] = chartbl[i + 128] = '#';
chartbl2[i] = chartbl2[i + 128] = '#';
for (i = 6; i < 10; i++)
chartbl[i] = chartbl[i + 128] = '#';
chartbl2[i] = chartbl2[i + 128] = '#';

chartbl[11] = chartbl[11 + 128] = '#';
chartbl2[11] = chartbl2[11 + 128] = '#';

// dot
chartbl[5] = chartbl[14] = chartbl[15] = chartbl[28] = chartbl[46] = '.';
chartbl[5 + 128] = chartbl[14 + 128] = chartbl[15 + 128] = chartbl[28 + 128] = chartbl[46 + 128] = '.';
chartbl2[5] = chartbl2[14] = chartbl2[15] = chartbl2[28] = chartbl2[46] = '.';
chartbl2[5 + 128] = chartbl2[14 + 128] = chartbl2[15 + 128] = chartbl2[28 + 128] = chartbl2[46 + 128] = '.';

// left arrow
chartbl[127] = '>';
chartbl2[127] = '>';

// right arrow
chartbl[141] = '<';
chartbl2[141] = '<';

// '='
chartbl[30] = chartbl[129] = chartbl[30 + 128] = '=';
chartbl2[30] = chartbl2[129] = chartbl2[30 + 128] = '=';

// whitespaces
chartbl[12] = chartbl[12 + 128] = chartbl[138] = ' ';
chartbl2[12] = chartbl2[12 + 128] = chartbl2[138] = ' ';

chartbl[33] = chartbl[33 + 128]= '!';
chartbl2[33] = chartbl2[33 + 128]= '!';
}

void PR_CleanText(unsigned char *text)
{
while (*text)
*text = chartbl[*text++];
*text = chartbl2[*text++];
}

/*
Expand Down Expand Up @@ -2142,28 +2142,33 @@ void PF_infokey (void)
char *value;
char *key;
static char ov[256];
client_t *cl;

e = G_EDICT(OFS_PARM0);
e1 = NUM_FOR_EDICT(e);
key = G_STRING(OFS_PARM1);
cl = &svs.clients[e1-1];

if (e1 == 0) {
if ((value = Info_ValueForKey (svs.info, key)) == NULL ||
!*value)
value = Info_ValueForKey(localinfo, key);
} else if (e1 <= MAX_CLIENTS) {
if (!strcmp(key, "ip"))
value = strcpy(ov, NET_BaseAdrToString (svs.clients[e1-1].netchan.remote_address));
value = strcpy(ov, NET_BaseAdrToString (cl->netchan.remote_address));
else if (!strcmp(key, "realip"))
value = strcpy(ov, NET_BaseAdrToString (svs.clients[e1-1].realip));
else if (!strcmp(key, "ping")) {
int ping = SV_CalcPing (&svs.clients[e1-1]);
value = strcpy(ov, NET_BaseAdrToString (cl->realip));
else if (!strcmp(key, "download")) {
sprintf(ov, "%d", cl->download != NULL ? (int)(100*cl->downloadcount/cl->downloadsize) : -1);
value = ov;
} else if (!strcmp(key, "ping")) {
int ping = SV_CalcPing (cl);
sprintf(ov, "%d", ping);
value = ov;
} else if (!strcmp(key, "login"))
value = svs.clients[e1-1].login;
value = cl->login;
else
value = Info_ValueForKey (svs.clients[e1-1].userinfo, key);
value = Info_ValueForKey (cl->userinfo, key);
} else
value = "";

Expand Down
25 changes: 23 additions & 2 deletions source/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

#define MAX_SIGNON_BUFFERS 8

#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

typedef enum {
ss_dead, // no map loaded
ss_loading, // spawning level edicts
Expand All @@ -35,6 +40,16 @@ typedef enum {
// some qc commands are only valid before the server has finished
// initializing (precache commands, static sounds / objects, etc)

typedef struct
{
double time;
int num;
sizebuf_t sb;
byte buf[MAX_MSGLEN];
} packet_t;

#define MAX_DELAYED_PACKETS 100

typedef struct
{
// qboolean active; // false when server is going down
Expand Down Expand Up @@ -208,6 +223,8 @@ typedef struct client_s
char login[16];
int logged;

int spawncount; // for tracking map changes during downloading


//===== NETWORK ============
int chokecount;
Expand All @@ -217,6 +234,7 @@ typedef struct client_s
int realip_num; // random value
int realip_count;
qboolean rip_vip;
double delay;
} client_t;

// a client can leave the server in one of four ways:
Expand Down Expand Up @@ -289,7 +307,7 @@ typedef struct
qboolean fixangle[MAX_CLIENTS];
float fixangletime[MAX_CLIENTS];
vec3_t angles[MAX_CLIENTS];
char name[MAX_OSPATH], namelong[MAX_OSPATH];
char name[MAX_OSPATH], path[MAX_OSPATH];
int parsecount;
int lastwritten;
demo_frame_t frames[DEMO_FRAMES];
Expand Down Expand Up @@ -354,6 +372,9 @@ typedef struct
challenge_t challenges[MAX_CHALLENGES]; // to prevent invalid IPs from connecting
byte *demomem;
int demomemsize;

packet_t packets[MAX_DELAYED_PACKETS];
int num_packets;
} server_static_t;

//=============================================================================
Expand Down Expand Up @@ -499,7 +520,7 @@ void SV_InitOperatorCommands (void);

void SV_SendServerinfo (client_t *client);
void SV_ExtractFromUserinfo (client_t *cl, qboolean namechanged);
int SV_BoundRate (int rate);
int SV_BoundRate (qboolean dl, int rate);

void Master_Heartbeat (void);
void Master_Packet (void);
Expand Down
7 changes: 7 additions & 0 deletions source/skin.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,13 @@ void Skin_NextDownload (void)
va("begin %i", cl.servercount));
Cache_Report (); // print remaining memory
}

// if we were downloading before map change, continue
if (cls.download)
{
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
SZ_Print (&cls.netchan.message, "nextdl");
}
}


Expand Down
Loading

0 comments on commit 8c051f3

Please sign in to comment.