mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2024-12-04 01:51:52 +00:00
Mostly whitespace, some type fixing, and boostrap/configure fixes.
This commit is contained in:
parent
9d7ee224d2
commit
451ad97dfa
8 changed files with 153 additions and 166 deletions
|
@ -20,6 +20,8 @@ fi
|
|||
# when one can just read the README
|
||||
aclocal && \
|
||||
autoheader && \
|
||||
touch ltconfig && \
|
||||
libtoolize --copy --automake && \
|
||||
automake --foreign --add-missing --copy && \
|
||||
touch depcomp && \
|
||||
autoconf
|
||||
|
|
|
@ -5,6 +5,8 @@ AC_CONFIG_AUX_DIR(.)
|
|||
AC_CONFIG_SRCDIR(src/main.c)
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
|
||||
AM_PROG_AS
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_DEFINE_UNQUOTED(BUILDHOST, "${target_cpu}-${target_os}",
|
||||
[Set to the canonical name of the target machine])
|
||||
|
|
|
@ -1434,7 +1434,7 @@ void GL_InitImages(void){
|
|||
Draw_GetPalette();
|
||||
|
||||
if( qglColorTableEXT){
|
||||
ri.FS_LoadFile( "pics/16to8.dat",(void **)&gl_state.d_16to8table);
|
||||
ri.FS_LoadFile( "pics/16to8.dat",(void **)(char *)&gl_state.d_16to8table);
|
||||
if( !gl_state.d_16to8table)
|
||||
ri.Sys_Error( ERR_FATAL, "Couldn't load pics/16to8.pcx");
|
||||
}
|
||||
|
|
|
@ -42,52 +42,49 @@ static int buffer_bytes;
|
|||
/*
|
||||
* The sample rates which will be attempted.
|
||||
*/
|
||||
static int RATES[] = {
|
||||
44100, 22050, 11025, 8000
|
||||
};
|
||||
static int RATES[] = { 48000, 44100, 22050, 11025, 8000 };
|
||||
|
||||
/*
|
||||
* Initialize ALSA pcm device, and bind it to sndinfo.
|
||||
*/
|
||||
qboolean SNDDMA_Init(struct sndinfo *s){
|
||||
int i, r, err, dir;
|
||||
|
||||
int i, err, dir;
|
||||
unsigned int r;
|
||||
si = s;
|
||||
|
||||
|
||||
if(!strcmp(si->device->string, "/dev/dsp")) //silly oss default
|
||||
si->device->string = "default";
|
||||
|
||||
|
||||
if((err = snd_pcm_open(&pcm_handle, si->device->string,
|
||||
SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0){
|
||||
si->Com_Printf("ALSA: cannot open device %s(%s)\n",
|
||||
si->device->string, snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_malloc(&hw_params)) < 0){
|
||||
si->Com_Printf("ALSA: cannot allocate hw params(%s)\n",
|
||||
snd_strerror(err));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_any(pcm_handle, hw_params)) < 0){
|
||||
si->Com_Printf("ALSA: cannot init hw params(%s)\n", snd_strerror(err));
|
||||
snd_pcm_hw_params_free(hw_params);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_set_access(pcm_handle, hw_params,
|
||||
SND_PCM_ACCESS_RW_INTERLEAVED)) < 0){
|
||||
si->Com_Printf("ALSA: cannot set access(%s)\n", snd_strerror(err));
|
||||
snd_pcm_hw_params_free(hw_params);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
si->dma->samplebits = si->bits->value;
|
||||
if(si->dma->samplebits != 8){ //try 16 by default
|
||||
|
||||
si->dma->samplebits = 16; //ensure this is set for other calculations
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_set_format(pcm_handle, hw_params,
|
||||
SND_PCM_FORMAT_S16)) < 0){
|
||||
si->Com_Printf("ALSA: 16 bit not supported, trying 8\n");
|
||||
|
@ -102,12 +99,11 @@ qboolean SNDDMA_Init(struct sndinfo *s){
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
si->dma->speed =(int)si->speed->value;
|
||||
if(si->dma->speed){ //try specified rate
|
||||
|
||||
r = si->dma->speed;
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_set_rate_near(pcm_handle, hw_params, &r, &dir)) < 0)
|
||||
si->Com_Printf("ALSA: cannot set rate %d(%s)\n", r, snd_strerror(err));
|
||||
else { //rate succeeded, but is perhaps slightly different
|
||||
|
@ -117,12 +113,10 @@ qboolean SNDDMA_Init(struct sndinfo *s){
|
|||
}
|
||||
}
|
||||
if(!si->dma->speed){ //or all available ones
|
||||
|
||||
for(i = 0; i < sizeof(RATES); i++){
|
||||
|
||||
r = RATES[i];
|
||||
dir = 0;
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_set_rate_near(pcm_handle, hw_params, &r, &dir)) < 0)
|
||||
si->Com_Printf("ALSA: cannot set rate %d(%s)\n", r, snd_strerror(err));
|
||||
else { //rate succeeded, but is perhaps slightly different
|
||||
|
@ -138,12 +132,12 @@ qboolean SNDDMA_Init(struct sndinfo *s){
|
|||
snd_pcm_hw_params_free(hw_params);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
si->dma->channels =(int)si->channels->value;
|
||||
|
||||
|
||||
if(si->dma->channels < 1 || si->dma->channels > 2)
|
||||
si->dma->channels = 2; //ensure either stereo or mono
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_set_channels(pcm_handle, hw_params,
|
||||
si->dma->channels)) < 0){
|
||||
si->Com_Printf("ALSA: cannot set channels %d(%s)\n",
|
||||
|
@ -151,44 +145,44 @@ qboolean SNDDMA_Init(struct sndinfo *s){
|
|||
snd_pcm_hw_params_free(hw_params);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
period_size = BUFFER_SAMPLES / 2 / si->dma->channels;
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_set_period_size_near(pcm_handle,
|
||||
hw_params, &period_size, 0)) < 0){
|
||||
si->Com_Printf("ALSA: cannot set period size near(%s)\n", snd_strerror(err));
|
||||
snd_pcm_hw_params_free(hw_params);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
buffer_size = period_size * 2;
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params_set_buffer_size_near(pcm_handle,
|
||||
hw_params, &buffer_size)) < 0){
|
||||
si->Com_Printf("ALSA: cannot set buffer size near(%s)\n", snd_strerror(err));
|
||||
snd_pcm_hw_params_free(hw_params);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if((err = snd_pcm_hw_params(pcm_handle, hw_params)) < 0){ //set params
|
||||
si->Com_Printf("ALSA: cannot set params(%s)\n", snd_strerror(err));
|
||||
snd_pcm_hw_params_free(hw_params);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
sample_bytes = si->dma->samplebits / 8;
|
||||
buffer_bytes = BUFFER_SAMPLES * sample_bytes;
|
||||
|
||||
|
||||
si->dma->buffer = malloc(buffer_bytes); //allocate pcm frame buffer
|
||||
memset(si->dma->buffer, 0, buffer_bytes);
|
||||
|
||||
|
||||
si->dma->samplepos = 0;
|
||||
|
||||
|
||||
si->dma->samples = BUFFER_SAMPLES;
|
||||
si->dma->submission_chunk = SUBMISSION_CHUNK;
|
||||
|
||||
|
||||
snd_pcm_prepare(pcm_handle);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -196,10 +190,9 @@ qboolean SNDDMA_Init(struct sndinfo *s){
|
|||
* Returns the current sample position, if sound is running.
|
||||
*/
|
||||
int SNDDMA_GetDMAPos(void){
|
||||
|
||||
if(si->dma->buffer)
|
||||
return si->dma->samplepos;
|
||||
|
||||
|
||||
si->Com_Printf("Sound not inizialized\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -208,12 +201,11 @@ int SNDDMA_GetDMAPos(void){
|
|||
* Closes the ALSA pcm device and frees the dma buffer.
|
||||
*/
|
||||
void SNDDMA_Shutdown(void){
|
||||
|
||||
if(si->dma->buffer){
|
||||
snd_pcm_drop(pcm_handle);
|
||||
snd_pcm_close(pcm_handle);
|
||||
}
|
||||
|
||||
|
||||
free(si->dma->buffer);
|
||||
si->dma->buffer = NULL;
|
||||
}
|
||||
|
@ -224,22 +216,22 @@ void SNDDMA_Shutdown(void){
|
|||
void SNDDMA_Submit(void){
|
||||
int s, w, frames;
|
||||
void *start;
|
||||
|
||||
|
||||
if(!si->dma->buffer)
|
||||
return;
|
||||
|
||||
|
||||
s = si->dma->samplepos * sample_bytes;
|
||||
start =(void *) & si->dma->buffer[s];
|
||||
|
||||
|
||||
frames = si->dma->submission_chunk / si->dma->channels;
|
||||
|
||||
|
||||
if((w = snd_pcm_writei(pcm_handle, start, frames)) < 0){ //write to card
|
||||
snd_pcm_prepare(pcm_handle); //xrun occured
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
si->dma->samplepos += w * si->dma->channels; //mark progress
|
||||
|
||||
|
||||
if(si->dma->samplepos >= si->dma->samples)
|
||||
si->dma->samplepos = 0; //wrap buffer
|
||||
}
|
||||
|
|
|
@ -447,31 +447,30 @@ __declspec( naked) void S_PaintChannelFrom8(channel_t *ch, sfxcache_t *sc, int c
|
|||
#else /* HAVE_MASM */
|
||||
# ifndef USE_ASM
|
||||
void S_PaintChannelFrom8(channel_t *ch, sfxcache_t *sc, int count, int offset){
|
||||
int data;
|
||||
int data, i;
|
||||
int *lscale, *rscale;
|
||||
unsigned char *sfx;
|
||||
int i;
|
||||
portable_samplepair_t *samp;
|
||||
|
||||
|
||||
if(ch->leftvol > 255)
|
||||
ch->leftvol = 255;
|
||||
if(ch->rightvol > 255)
|
||||
ch->rightvol = 255;
|
||||
|
||||
|
||||
//ZOID-- >>11 has been changed to >>3, >>11 didn't make much sense
|
||||
//as it would always be zero.
|
||||
lscale = snd_scaletable[ ch->leftvol >> 3];
|
||||
rscale = snd_scaletable[ ch->rightvol >> 3];
|
||||
sfx =(signed char *)sc->data + ch->pos;
|
||||
|
||||
lscale = snd_scaletable[ch->leftvol >> 3];
|
||||
rscale = snd_scaletable[ch->rightvol >> 3];
|
||||
sfx = (unsigned char *)sc->data + ch->pos;
|
||||
|
||||
samp = &paintbuffer[offset];
|
||||
|
||||
|
||||
for(i = 0; i < count; i++, samp++){
|
||||
data = sfx[i];
|
||||
samp->left += lscale[data];
|
||||
samp->right += rscale[data];
|
||||
}
|
||||
|
||||
|
||||
ch->pos += count;
|
||||
}
|
||||
# endif /* !USE_ASM */
|
||||
|
@ -484,11 +483,11 @@ void S_PaintChannelFrom16(channel_t *ch, sfxcache_t *sc, int count, int offset){
|
|||
signed short *sfx;
|
||||
int i;
|
||||
portable_samplepair_t *samp;
|
||||
|
||||
|
||||
leftvol = ch->leftvol * snd_vol;
|
||||
rightvol = ch->rightvol * snd_vol;
|
||||
sfx =(signed short *)sc->data + ch->pos;
|
||||
|
||||
|
||||
samp = &paintbuffer[offset];
|
||||
for(i = 0; i < count; i++, samp++){
|
||||
data = sfx[i];
|
||||
|
@ -497,6 +496,6 @@ void S_PaintChannelFrom16(channel_t *ch, sfxcache_t *sc, int count, int offset){
|
|||
samp->left += left;
|
||||
samp->right += right;
|
||||
}
|
||||
|
||||
|
||||
ch->pos += count;
|
||||
}
|
||||
|
|
206
src/sv_user.c
206
src/sv_user.c
|
@ -41,7 +41,7 @@ SV_BeginDemoServer
|
|||
*/
|
||||
void SV_BeginDemoserver(void){
|
||||
char name[MAX_OSPATH];
|
||||
|
||||
|
||||
Com_sprintf(name, sizeof(name), "demos/%s", sv.name);
|
||||
FS_FOpenFile(name, &sv.demofile);
|
||||
if(!sv.demofile)
|
||||
|
@ -51,7 +51,7 @@ void SV_BeginDemoserver(void){
|
|||
/*
|
||||
================
|
||||
SV_New_f
|
||||
|
||||
|
||||
Sends the first message from the server to a connected client.
|
||||
This will be sent on the initial connection and upon each server load.
|
||||
================
|
||||
|
@ -60,42 +60,42 @@ void SV_New_f(void){
|
|||
char *gamedir;
|
||||
int playernum;
|
||||
edict_t *ent;
|
||||
|
||||
|
||||
Com_DPrintf("New() from %s\n", sv_client->name);
|
||||
|
||||
|
||||
if(sv_client->state != cs_connected){
|
||||
Com_Printf("New not valid -- already spawned\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// demo servers just dump the file message
|
||||
if(sv.state == ss_demo){
|
||||
SV_BeginDemoserver();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// serverdata needs to go over for all types of servers
|
||||
// to make sure the protocol is right, and to set the gamedir
|
||||
//
|
||||
gamedir = Cvar_VariableString("gamedir");
|
||||
|
||||
|
||||
// send the serverdata
|
||||
MSG_WriteByte(&sv_client->netchan.message, svc_serverdata);
|
||||
MSG_WriteLong(&sv_client->netchan.message, PROTOCOL_VERSION);
|
||||
MSG_WriteLong(&sv_client->netchan.message, svs.spawncount);
|
||||
MSG_WriteByte(&sv_client->netchan.message, sv.attractloop);
|
||||
MSG_WriteString(&sv_client->netchan.message, gamedir);
|
||||
|
||||
|
||||
if(sv.state == ss_cinematic || sv.state == ss_pic)
|
||||
playernum = -1;
|
||||
else
|
||||
playernum = sv_client - svs.clients;
|
||||
MSG_WriteShort(&sv_client->netchan.message, playernum);
|
||||
|
||||
|
||||
// send full levelname
|
||||
MSG_WriteString(&sv_client->netchan.message, sv.configstrings[CS_NAME]);
|
||||
|
||||
|
||||
//
|
||||
// game server
|
||||
//
|
||||
|
@ -105,12 +105,11 @@ void SV_New_f(void){
|
|||
ent->s.number = playernum + 1;
|
||||
sv_client->edict = ent;
|
||||
memset(&sv_client->lastcmd, 0, sizeof(sv_client->lastcmd));
|
||||
|
||||
|
||||
// begin fetching configstrings
|
||||
MSG_WriteByte(&sv_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString(&sv_client->netchan.message, va("cmd configstrings %i 0\n", svs.spawncount));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -120,25 +119,25 @@ SV_Configstrings_f
|
|||
*/
|
||||
void SV_Configstrings_f(void){
|
||||
int start;
|
||||
|
||||
|
||||
Com_DPrintf("Configstrings() from %s\n", sv_client->name);
|
||||
|
||||
|
||||
if(sv_client->state != cs_connected){
|
||||
Com_Printf("configstrings not valid -- already spawned\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// handle the case of a level changing while a client was connecting
|
||||
if( atoi(Cmd_Argv(1)) != svs.spawncount){
|
||||
Com_Printf("SV_Configstrings_f from different level\n");
|
||||
SV_New_f();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
start = atoi(Cmd_Argv(2));
|
||||
|
||||
|
||||
// write a packet full of data
|
||||
|
||||
|
||||
while( sv_client->netchan.message.cursize < MAX_MSGLEN / 2
|
||||
&& start < MAX_CONFIGSTRINGS){
|
||||
if(sv.configstrings[start][0]){
|
||||
|
@ -148,9 +147,9 @@ void SV_Configstrings_f(void){
|
|||
}
|
||||
start++;
|
||||
}
|
||||
|
||||
|
||||
// send next command
|
||||
|
||||
|
||||
if(start == MAX_CONFIGSTRINGS){
|
||||
MSG_WriteByte(&sv_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString(&sv_client->netchan.message, va("cmd baselines %i 0\n", svs.spawncount));
|
||||
|
@ -169,27 +168,27 @@ void SV_Baselines_f(void){
|
|||
int start;
|
||||
entity_state_t nullstate;
|
||||
entity_state_t *base;
|
||||
|
||||
|
||||
Com_DPrintf("Baselines() from %s\n", sv_client->name);
|
||||
|
||||
|
||||
if(sv_client->state != cs_connected){
|
||||
Com_Printf("baselines not valid -- already spawned\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// handle the case of a level changing while a client was connecting
|
||||
if( atoi(Cmd_Argv(1)) != svs.spawncount){
|
||||
Com_Printf("SV_Baselines_f from different level\n");
|
||||
SV_New_f();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
start = atoi(Cmd_Argv(2));
|
||||
|
||||
|
||||
memset(&nullstate, 0, sizeof(nullstate));
|
||||
|
||||
|
||||
// write a packet full of data
|
||||
|
||||
|
||||
while( sv_client->netchan.message.cursize < MAX_MSGLEN / 2
|
||||
&& start < MAX_EDICTS){
|
||||
base = &sv.baselines[start];
|
||||
|
@ -199,9 +198,9 @@ void SV_Baselines_f(void){
|
|||
}
|
||||
start++;
|
||||
}
|
||||
|
||||
|
||||
// send next command
|
||||
|
||||
|
||||
if(start == MAX_EDICTS){
|
||||
MSG_WriteByte(&sv_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString(&sv_client->netchan.message, va("precache %i\n", svs.spawncount));
|
||||
|
@ -218,19 +217,19 @@ SV_Begin_f
|
|||
*/
|
||||
void SV_Begin_f(void){
|
||||
Com_DPrintf("Begin() from %s\n", sv_client->name);
|
||||
|
||||
|
||||
// handle the case of a level changing while a client was connecting
|
||||
if( atoi(Cmd_Argv(1)) != svs.spawncount){
|
||||
if(atoi(Cmd_Argv(1)) != svs.spawncount){
|
||||
Com_Printf("SV_Begin_f from different level\n");
|
||||
SV_New_f();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sv_client->state = cs_spawned;
|
||||
|
||||
|
||||
// call the game begin function
|
||||
ge->ClientBegin(sv_player);
|
||||
|
||||
|
||||
Cbuf_InsertFromDefer();
|
||||
}
|
||||
|
||||
|
@ -242,20 +241,18 @@ SV_NextDownload_f
|
|||
==================
|
||||
*/
|
||||
void SV_NextDownload_f(void){
|
||||
int r;
|
||||
int percent;
|
||||
int size;
|
||||
|
||||
int percent, size, r;
|
||||
|
||||
if(!sv_client->download)
|
||||
return;
|
||||
|
||||
|
||||
r = sv_client->downloadsize - sv_client->downloadcount;
|
||||
if(r > 1024)
|
||||
r = 1024;
|
||||
|
||||
|
||||
MSG_WriteByte(&sv_client->netchan.message, svc_download);
|
||||
MSG_WriteShort(&sv_client->netchan.message, r);
|
||||
|
||||
|
||||
sv_client->downloadcount += r;
|
||||
size = sv_client->downloadsize;
|
||||
if(!size)
|
||||
|
@ -264,10 +261,10 @@ void SV_NextDownload_f(void){
|
|||
MSG_WriteByte(&sv_client->netchan.message, percent);
|
||||
SZ_Write(&sv_client->netchan.message,
|
||||
sv_client->download + sv_client->downloadcount - r, r);
|
||||
|
||||
|
||||
if(sv_client->downloadcount != sv_client->downloadsize)
|
||||
return;
|
||||
|
||||
|
||||
FS_FreeFile(sv_client->download);
|
||||
sv_client->download = NULL;
|
||||
}
|
||||
|
@ -286,12 +283,12 @@ void SV_BeginDownload_f(void){
|
|||
extern cvar_t *allow_download_maps;
|
||||
extern int file_from_pak; // ZOID did file come from pak?
|
||||
int offset = 0;
|
||||
|
||||
|
||||
name = Cmd_Argv(1);
|
||||
|
||||
|
||||
if(Cmd_Argc() > 2)
|
||||
offset = atoi(Cmd_Argv(2)); // downloaded offset
|
||||
|
||||
|
||||
// hacked by zoid to allow more conrol over download
|
||||
// first off, no .. or global allow check
|
||||
if(strstr(name, "..") || strstr(name, "\\/") || !allow_download->value
|
||||
|
@ -314,17 +311,17 @@ void SV_BeginDownload_f(void){
|
|||
MSG_WriteByte(&sv_client->netchan.message, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if(sv_client->download)
|
||||
FS_FreeFile(sv_client->download);
|
||||
|
||||
sv_client->downloadsize = FS_LoadFile(name,(void **) & sv_client->download);
|
||||
|
||||
sv_client->downloadsize = FS_LoadFile(name, (void **)(char *)&sv_client->download);
|
||||
sv_client->downloadcount = offset;
|
||||
|
||||
|
||||
if(offset > sv_client->downloadsize)
|
||||
sv_client->downloadcount = sv_client->downloadsize;
|
||||
|
||||
|
||||
if(!sv_client->download
|
||||
// special check for maps, if it came from a pak file, don't allow
|
||||
// download ZOID
|
||||
|
@ -334,13 +331,13 @@ void SV_BeginDownload_f(void){
|
|||
FS_FreeFile(sv_client->download);
|
||||
sv_client->download = NULL;
|
||||
}
|
||||
|
||||
|
||||
MSG_WriteByte(&sv_client->netchan.message, svc_download);
|
||||
MSG_WriteShort(&sv_client->netchan.message, -1);
|
||||
MSG_WriteByte(&sv_client->netchan.message, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SV_NextDownload_f();
|
||||
Com_DPrintf("Downloading %s to %s\n", name, sv_client->name);
|
||||
}
|
||||
|
@ -353,7 +350,7 @@ void SV_BeginDownload_f(void){
|
|||
/*
|
||||
=================
|
||||
SV_Disconnect_f
|
||||
|
||||
|
||||
The client is going to disconnect, so remove the connection immediately
|
||||
=================
|
||||
*/
|
||||
|
@ -372,17 +369,16 @@ Dumps the serverinfo info string
|
|||
void SV_ShowServerinfo_f(void){
|
||||
cvar_t *cvar;
|
||||
char line[MAX_STRING_CHARS];
|
||||
|
||||
|
||||
if(!sv_client){ //print to server console
|
||||
Info_Print(Cvar_Serverinfo());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for(cvar = cvar_vars; cvar; cvar = cvar->next){
|
||||
|
||||
if(!(cvar->flags & CVAR_SERVERINFO))
|
||||
continue; //only print serverinfo cvars
|
||||
|
||||
|
||||
snprintf(line, MAX_STRING_CHARS, "%s %s\n", cvar->name, cvar->string);
|
||||
SV_ClientPrintf(sv_client, PRINT_MEDIUM, line);
|
||||
}
|
||||
|
@ -391,11 +387,11 @@ void SV_ShowServerinfo_f(void){
|
|||
|
||||
void SV_Nextserver(void){
|
||||
char *v;
|
||||
|
||||
|
||||
//ZOID, ss_pic can be nextserver'd in coop mode
|
||||
if(sv.state == ss_game ||(sv.state == ss_pic && !coop->value))
|
||||
return; // can't nextserver while playing a normal game
|
||||
|
||||
|
||||
svs.spawncount++; // make sure another doesn't sneak in
|
||||
v = Cvar_VariableString("nextserver");
|
||||
if(!v[0])
|
||||
|
@ -410,7 +406,7 @@ void SV_Nextserver(void){
|
|||
/*
|
||||
==================
|
||||
SV_Nextserver_f
|
||||
|
||||
|
||||
A cinematic has completed or been aborted by a client, so move
|
||||
to the next server,
|
||||
==================
|
||||
|
@ -420,9 +416,9 @@ void SV_Nextserver_f(void){
|
|||
Com_DPrintf("Nextserver() from wrong level, from %s\n", sv_client->name);
|
||||
return; // leftover from last server
|
||||
}
|
||||
|
||||
|
||||
Com_DPrintf("Nextserver() from %s\n", sv_client->name);
|
||||
|
||||
|
||||
SV_Nextserver();
|
||||
}
|
||||
|
||||
|
@ -439,20 +435,20 @@ ucmd_t ucmds[] =
|
|||
{"configstrings", SV_Configstrings_f},
|
||||
{"baselines", SV_Baselines_f},
|
||||
{"begin", SV_Begin_f},
|
||||
|
||||
|
||||
{"nextserver", SV_Nextserver_f},
|
||||
|
||||
|
||||
{"disconnect", SV_Disconnect_f},
|
||||
|
||||
|
||||
// issued by hand at client consoles
|
||||
{"info", SV_ShowServerinfo_f},
|
||||
|
||||
|
||||
{"download", SV_BeginDownload_f},
|
||||
{"nextdl", SV_NextDownload_f},
|
||||
|
||||
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SV_ExecuteUserCommand
|
||||
|
@ -460,25 +456,25 @@ SV_ExecuteUserCommand
|
|||
*/
|
||||
void SV_ExecuteUserCommand(char *s){
|
||||
ucmd_t *u;
|
||||
|
||||
|
||||
/* http://www.quakesrc.org/forum/topicDisplay.php?topicID=160
|
||||
* the client can read the rcon_password variable, among others
|
||||
* so don't do any macro expansion on the server side */
|
||||
Cmd_TokenizeString(s, false);
|
||||
sv_player = sv_client->edict;
|
||||
|
||||
// SV_BeginRedirect(RD_CLIENT);
|
||||
|
||||
|
||||
// SV_BeginRedirect(RD_CLIENT);
|
||||
|
||||
for(u = ucmds; u->name; u++)
|
||||
if(!strcmp(Cmd_Argv(0), u->name)){
|
||||
u->func();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if(!u->name && sv.state == ss_game)
|
||||
ge->ClientCommand(sv_player);
|
||||
|
||||
// SV_EndRedirect();
|
||||
|
||||
// SV_EndRedirect();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -494,12 +490,12 @@ USER CMD EXECUTION
|
|||
void SV_ClientThink(client_t *cl, usercmd_t *cmd)
|
||||
{
|
||||
cl->commandMsec -= cmd->msec;
|
||||
|
||||
|
||||
if(cl->commandMsec < 0 && sv_enforcetime->value){
|
||||
Com_DPrintf("commandMsec underflow from %s\n", cl->name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ge->ClientThink(cl->edict, cmd);
|
||||
}
|
||||
|
||||
|
@ -509,14 +505,14 @@ void SV_ClientThink(client_t *cl, usercmd_t *cmd)
|
|||
/*
|
||||
===================
|
||||
SV_ExecuteClientMessage
|
||||
|
||||
|
||||
The current net_message is parsed for the given client
|
||||
===================
|
||||
*/
|
||||
void SV_ExecuteClientMessage(client_t *cl){
|
||||
int c;
|
||||
char *s;
|
||||
|
||||
|
||||
usercmd_t nullcmd;
|
||||
usercmd_t oldest, oldcmd, newcmd;
|
||||
int net_drop;
|
||||
|
@ -525,43 +521,43 @@ void SV_ExecuteClientMessage(client_t *cl){
|
|||
int checksumIndex;
|
||||
qboolean move_issued;
|
||||
int lastframe;
|
||||
|
||||
|
||||
sv_client = cl;
|
||||
sv_player = sv_client->edict;
|
||||
|
||||
|
||||
// only allow one move command
|
||||
move_issued = false;
|
||||
stringCmdCount = 0;
|
||||
|
||||
|
||||
while(1){
|
||||
if(net_message.readcount > net_message.cursize){
|
||||
Com_Printf("SV_ReadClientMessage: badread\n");
|
||||
SV_DropClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
c = MSG_ReadByte(&net_message);
|
||||
if(c == -1)
|
||||
break;
|
||||
|
||||
|
||||
switch(c){
|
||||
default:
|
||||
Com_Printf("SV_ReadClientMessage: unknown command char\n");
|
||||
SV_DropClient(cl);
|
||||
return;
|
||||
|
||||
|
||||
case clc_nop:
|
||||
break;
|
||||
|
||||
|
||||
case clc_userinfo:
|
||||
strncpy(cl->userinfo, MSG_ReadString(&net_message), sizeof(cl->userinfo) - 1);
|
||||
SV_UserinfoChanged(cl);
|
||||
break;
|
||||
|
||||
|
||||
case clc_move:
|
||||
if(move_issued)
|
||||
return; // someone is trying to cheat...
|
||||
|
||||
|
||||
move_issued = true;
|
||||
checksumIndex = net_message.readcount;
|
||||
checksum = MSG_ReadByte(&net_message);
|
||||
|
@ -573,66 +569,60 @@ void SV_ExecuteClientMessage(client_t *cl){
|
|||
svs.realtime - cl->frames[cl->lastframe & UPDATE_MASK].senttime;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
memset(&nullcmd, 0, sizeof(nullcmd));
|
||||
MSG_ReadDeltaUsercmd(&net_message, &nullcmd, &oldest);
|
||||
MSG_ReadDeltaUsercmd(&net_message, &oldest, &oldcmd);
|
||||
MSG_ReadDeltaUsercmd(&net_message, &oldcmd, &newcmd);
|
||||
|
||||
if( cl->state != cs_spawned){
|
||||
|
||||
if(cl->state != cs_spawned){
|
||||
cl->lastframe = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// if the checksum fails, ignore the rest of the packet
|
||||
calculatedChecksum = COM_BlockSequenceCRCByte(
|
||||
net_message.data + checksumIndex + 1,
|
||||
net_message.readcount - checksumIndex - 1,
|
||||
cl->netchan.incoming_sequence);
|
||||
|
||||
|
||||
if(calculatedChecksum != checksum){
|
||||
Com_DPrintf("Failed command checksum for %s(%d != %d)/%d\n",
|
||||
cl->name, calculatedChecksum, checksum,
|
||||
cl->netchan.incoming_sequence);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(!paused->value){
|
||||
net_drop = cl->netchan.dropped;
|
||||
if(net_drop < 20){
|
||||
|
||||
//if(net_drop > 2)
|
||||
|
||||
// Com_Printf("drop %i\n", net_drop);
|
||||
// if(net_drop > 2)
|
||||
// Com_Printf("drop %i\n", net_drop);
|
||||
while(net_drop > 2){
|
||||
SV_ClientThink(cl, &cl->lastcmd);
|
||||
|
||||
net_drop--;
|
||||
}
|
||||
if(net_drop > 1)
|
||||
SV_ClientThink(cl, &oldest);
|
||||
|
||||
if(net_drop > 0)
|
||||
SV_ClientThink(cl, &oldcmd);
|
||||
|
||||
}
|
||||
SV_ClientThink(cl, &newcmd);
|
||||
}
|
||||
|
||||
|
||||
cl->lastcmd = newcmd;
|
||||
break;
|
||||
|
||||
|
||||
case clc_stringcmd:
|
||||
s = MSG_ReadString(&net_message);
|
||||
|
||||
|
||||
// malicious users may try using too many string commands
|
||||
if(++stringCmdCount < MAX_STRINGCMDS)
|
||||
SV_ExecuteUserCommand(s);
|
||||
|
||||
|
||||
if(cl->state == cs_zombie)
|
||||
return; // disconnect command
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -224,6 +224,7 @@ void VID_MenuInit( void){
|
|||
"[1152 768 ]", /* apple tibook */
|
||||
"[1280 854 ]", /* apple tibook */
|
||||
"[1440 900 ]", /* apple powerbook g4 17" */
|
||||
"[1680 1050]", /* 20" widescreen LCD */
|
||||
0
|
||||
};
|
||||
static const char *refs[] = {
|
||||
|
|
|
@ -166,7 +166,8 @@ vidmode_t vid_modes[] = {
|
|||
{ "Mode 11: 1024x480", 1024, 480, 11 }, /* Sony VAIO Pocketbook */
|
||||
{ "Mode 12: 1152x768", 1152, 768, 12 }, /* Apple TiBook */
|
||||
{ "Mode 13: 1280x854", 1280, 854, 13 }, /* Apple TiBook */
|
||||
{ "Mode 14: 1440x900", 1440, 900, 14 } /* Apple 17" Powerbook G4 */
|
||||
{ "Mode 14: 1440x900", 1440, 900, 14 }, /* Apple 17" Powerbook G4 */
|
||||
{ "Mode 15: 1680x1050", 1680, 1050, 15 } /* 20" widescreen LCD */
|
||||
};
|
||||
|
||||
qboolean VID_GetModeInfo( unsigned int *width, unsigned int *height, int mode){
|
||||
|
|
Loading…
Reference in a new issue