ktpro should work better now woot. a few other things too
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1130 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4261e03dc7
commit
7e9bbc3fac
18 changed files with 1006 additions and 924 deletions
|
@ -40,7 +40,7 @@ extern void (*Draw_BeginDisc) (void);
|
|||
extern void (*Draw_EndDisc) (void);
|
||||
extern qboolean (*Draw_IsCached) (char *picname); //can be null
|
||||
|
||||
extern void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic
|
||||
extern void (*Draw_Image) (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); //gl-style scaled/coloured/subpic
|
||||
extern void (*Draw_ImageColours) (float r, float g, float b, float a);
|
||||
|
||||
extern void (*R_Init) (void);
|
||||
|
@ -48,7 +48,6 @@ extern void (*R_DeInit) (void);
|
|||
extern void (*R_ReInit) (void);
|
||||
extern void (*R_RenderView) (void); // must set r_refdef first
|
||||
|
||||
extern void (*R_InitSky) (struct texture_s *mt); // called at level load
|
||||
extern qboolean (*R_CheckSky) (void);
|
||||
extern void (*R_SetSky) (char *name, float rotate, vec3_t axis);
|
||||
|
||||
|
@ -156,7 +155,6 @@ typedef struct {
|
|||
void (*R_ReInit) (void);
|
||||
void (*R_RenderView) (void); // must set r_refdef first
|
||||
|
||||
void (*R_InitSky) (struct texture_s *mt); // called at level load
|
||||
qboolean (*R_CheckSky) (void);
|
||||
void (*R_SetSky) (char *name, float rotate, vec3_t axis);
|
||||
|
||||
|
|
|
@ -562,7 +562,6 @@ void (*R_DeInit) (void);
|
|||
void (*R_ReInit) (void);
|
||||
void (*R_RenderView) (void); // must set r_refdef first
|
||||
|
||||
void (*R_InitSky) (struct texture_s *mt); // called at level load
|
||||
qboolean (*R_CheckSky) (void);
|
||||
void (*R_SetSky) (char *name, float rotate, vec3_t axis);
|
||||
|
||||
|
@ -614,6 +613,7 @@ r_qrenderer_t qrenderer=-1;
|
|||
char *q_renderername = "Non-Selected renderer";
|
||||
|
||||
|
||||
|
||||
rendererinfo_t dedicatedrendererinfo = {
|
||||
//ALL builds need a 'none' renderer, as 0.
|
||||
"Dedicated server",
|
||||
|
@ -625,9 +625,6 @@ rendererinfo_t dedicatedrendererinfo = {
|
|||
},
|
||||
QR_NONE,
|
||||
|
||||
|
||||
|
||||
|
||||
NULL, //Draw_PicFromWad;
|
||||
NULL, //Draw_PicFromWad; //Not supported
|
||||
NULL, //Draw_CachePic;
|
||||
|
@ -660,7 +657,7 @@ rendererinfo_t dedicatedrendererinfo = {
|
|||
NULL, //R_DeInit;
|
||||
NULL, //R_ReInit;
|
||||
NULL, //R_RenderView;
|
||||
NULL, //R_InitSky;
|
||||
|
||||
NULL, //R_CheckSky;
|
||||
NULL, //R_SetSky;
|
||||
|
||||
|
@ -772,7 +769,6 @@ rendererinfo_t softwarerendererinfo = {
|
|||
NULL,//SWR_ReInit,
|
||||
SWR_RenderView,
|
||||
|
||||
SWR_InitSky,
|
||||
SWR_CheckSky,
|
||||
SWR_SetSky,
|
||||
|
||||
|
@ -826,101 +822,100 @@ rendererinfo_t *psoftwarerendererinfo = &softwarerendererinfo;
|
|||
#endif
|
||||
#ifdef RGLQUAKE
|
||||
rendererinfo_t openglrendererinfo = {
|
||||
"OpenGL",
|
||||
{
|
||||
"gl",
|
||||
"opengl",
|
||||
"hardware",
|
||||
},
|
||||
QR_OPENGL,
|
||||
"OpenGL",
|
||||
{
|
||||
"gl",
|
||||
"opengl",
|
||||
"hardware",
|
||||
},
|
||||
QR_OPENGL,
|
||||
|
||||
|
||||
GLDraw_PicFromWad,
|
||||
GLDraw_SafePicFromWad,
|
||||
GLDraw_CachePic,
|
||||
GLDraw_SafeCachePic,
|
||||
GLDraw_Init,
|
||||
GLDraw_ReInit,
|
||||
GLDraw_Character,
|
||||
GLDraw_ColouredCharacter,
|
||||
GLDraw_String,
|
||||
GLDraw_Alt_String,
|
||||
GLDraw_Crosshair,
|
||||
GLDraw_DebugChar,
|
||||
GLDraw_Pic,
|
||||
GLDraw_ScalePic,
|
||||
GLDraw_SubPic,
|
||||
GLDraw_TransPic,
|
||||
GLDraw_TransPicTranslate,
|
||||
GLDraw_ConsoleBackground,
|
||||
GLDraw_EditorBackground,
|
||||
GLDraw_TileClear,
|
||||
GLDraw_Fill,
|
||||
GLDraw_FadeScreen,
|
||||
GLDraw_BeginDisc,
|
||||
GLDraw_EndDisc,
|
||||
GLDraw_PicFromWad,
|
||||
GLDraw_SafePicFromWad,
|
||||
GLDraw_CachePic,
|
||||
GLDraw_SafeCachePic,
|
||||
GLDraw_Init,
|
||||
GLDraw_ReInit,
|
||||
GLDraw_Character,
|
||||
GLDraw_ColouredCharacter,
|
||||
GLDraw_String,
|
||||
GLDraw_Alt_String,
|
||||
GLDraw_Crosshair,
|
||||
GLDraw_DebugChar,
|
||||
GLDraw_Pic,
|
||||
GLDraw_ScalePic,
|
||||
GLDraw_SubPic,
|
||||
GLDraw_TransPic,
|
||||
GLDraw_TransPicTranslate,
|
||||
GLDraw_ConsoleBackground,
|
||||
GLDraw_EditorBackground,
|
||||
GLDraw_TileClear,
|
||||
GLDraw_Fill,
|
||||
GLDraw_FadeScreen,
|
||||
GLDraw_BeginDisc,
|
||||
GLDraw_EndDisc,
|
||||
|
||||
GLDraw_Image,
|
||||
GLDraw_ImageColours,
|
||||
GLDraw_Image,
|
||||
GLDraw_ImageColours,
|
||||
|
||||
GLR_Init,
|
||||
GLR_DeInit,
|
||||
GLR_ReInit,
|
||||
GLR_RenderView,
|
||||
GLR_Init,
|
||||
GLR_DeInit,
|
||||
GLR_ReInit,
|
||||
GLR_RenderView,
|
||||
|
||||
|
||||
GLR_InitSky,
|
||||
GLR_CheckSky,
|
||||
GLR_SetSky,
|
||||
GLR_CheckSky,
|
||||
GLR_SetSky,
|
||||
|
||||
GLR_NewMap,
|
||||
GLR_PreNewMap,
|
||||
GLR_LightPoint,
|
||||
GLR_PushDlights,
|
||||
GLR_NewMap,
|
||||
GLR_PreNewMap,
|
||||
GLR_LightPoint,
|
||||
GLR_PushDlights,
|
||||
|
||||
|
||||
GLR_AddStain,
|
||||
GLR_LessenStains,
|
||||
GLR_AddStain,
|
||||
GLR_LessenStains,
|
||||
|
||||
MediaGL_ShowFrameBGR_24_Flip,
|
||||
MediaGL_ShowFrameRGBA_32,
|
||||
MediaGL_ShowFrame8bit,
|
||||
MediaGL_ShowFrameBGR_24_Flip,
|
||||
MediaGL_ShowFrameRGBA_32,
|
||||
MediaGL_ShowFrame8bit,
|
||||
|
||||
|
||||
GLMod_Init,
|
||||
GLMod_ClearAll,
|
||||
GLMod_ForName,
|
||||
GLMod_FindName,
|
||||
GLMod_Extradata,
|
||||
GLMod_TouchModel,
|
||||
GLMod_Init,
|
||||
GLMod_ClearAll,
|
||||
GLMod_ForName,
|
||||
GLMod_FindName,
|
||||
GLMod_Extradata,
|
||||
GLMod_TouchModel,
|
||||
|
||||
GLMod_PointInLeaf,
|
||||
GLMod_LeafPVS,
|
||||
GLMod_NowLoadExternal,
|
||||
GLMod_Think,
|
||||
GLMod_PointInLeaf,
|
||||
GLMod_LeafPVS,
|
||||
GLMod_NowLoadExternal,
|
||||
GLMod_Think,
|
||||
|
||||
GLMod_GetTag,
|
||||
GLMod_TagNumForName,
|
||||
GLMod_GetTag,
|
||||
GLMod_TagNumForName,
|
||||
|
||||
GLVID_Init,
|
||||
GLVID_DeInit,
|
||||
GLVID_HandlePause,
|
||||
GLVID_LockBuffer,
|
||||
GLVID_UnlockBuffer,
|
||||
GLD_BeginDirectRect,
|
||||
GLD_EndDirectRect,
|
||||
GLVID_ForceLockState,
|
||||
GLVID_ForceUnlockedAndReturnState,
|
||||
GLVID_SetPalette,
|
||||
GLVID_ShiftPalette,
|
||||
GLVID_GetRGBInfo,
|
||||
GLVID_Init,
|
||||
GLVID_DeInit,
|
||||
GLVID_HandlePause,
|
||||
GLVID_LockBuffer,
|
||||
GLVID_UnlockBuffer,
|
||||
GLD_BeginDirectRect,
|
||||
GLD_EndDirectRect,
|
||||
GLVID_ForceLockState,
|
||||
GLVID_ForceUnlockedAndReturnState,
|
||||
GLVID_SetPalette,
|
||||
GLVID_ShiftPalette,
|
||||
GLVID_GetRGBInfo,
|
||||
|
||||
NULL, //setcaption
|
||||
NULL, //setcaption
|
||||
|
||||
|
||||
GLSCR_UpdateScreen,
|
||||
GLSCR_UpdateScreen,
|
||||
|
||||
""
|
||||
""
|
||||
};
|
||||
rendererinfo_t *popenglrendererinfo = &openglrendererinfo;
|
||||
#endif
|
||||
|
@ -1033,7 +1028,7 @@ qboolean M_VideoApply (union menuoption_s *op,struct menu_s *menu,int key)
|
|||
Cbuf_AddText(va("vid_conwidth %s\n", info->customwidth->text), RESTRICT_LOCAL);
|
||||
Cbuf_AddText(va("vid_conheight %s\n", info->customheight->text), RESTRICT_LOCAL);
|
||||
}
|
||||
|
||||
|
||||
selectedbpp = 16;
|
||||
switch(info->bppcombo->selectedoption)
|
||||
{
|
||||
|
@ -1052,7 +1047,7 @@ qboolean M_VideoApply (union menuoption_s *op,struct menu_s *menu,int key)
|
|||
}
|
||||
|
||||
Cbuf_AddText(va("vid_bpp %i\n", selectedbpp), RESTRICT_LOCAL);
|
||||
|
||||
|
||||
switch(info->renderer->selectedoption)
|
||||
{
|
||||
#ifdef SWQUAKE
|
||||
|
@ -1193,6 +1188,7 @@ void M_Menu_Video_f (void)
|
|||
void R_SetRenderer(int wanted)
|
||||
{
|
||||
rendererinfo_t *ri;
|
||||
|
||||
if (wanted<0)
|
||||
{ //-1 is used so we know when we've applied something instead of never setting anything.
|
||||
wanted=0;
|
||||
|
@ -1205,6 +1201,7 @@ void R_SetRenderer(int wanted)
|
|||
|
||||
q_renderername = ri->name[0];
|
||||
|
||||
|
||||
Draw_PicFromWad = ri->Draw_PicFromWad;
|
||||
Draw_SafePicFromWad = ri->Draw_SafePicFromWad; //Not supported
|
||||
Draw_CachePic = ri->Draw_CachePic;
|
||||
|
@ -1240,7 +1237,6 @@ void R_SetRenderer(int wanted)
|
|||
R_PreNewMap = ri->R_PreNewMap;
|
||||
R_LightPoint = ri->R_LightPoint;
|
||||
R_PushDlights = ri->R_PushDlights;
|
||||
R_InitSky = ri->R_InitSky;
|
||||
R_CheckSky = ri->R_CheckSky;
|
||||
R_SetSky = ri->R_SetSky;
|
||||
|
||||
|
@ -1279,8 +1275,6 @@ void R_SetRenderer(int wanted)
|
|||
Mod_GetTag = ri->Mod_GetTag;
|
||||
Mod_TagNumForName = ri->Mod_TagNumForName;
|
||||
|
||||
|
||||
|
||||
SCR_UpdateScreen = ri->SCR_UpdateScreen;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,34 @@
|
|||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include "quakedef.h"
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void *alsasharedobject;
|
||||
|
||||
int (*psnd_pcm_open) (snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode);
|
||||
int (*psnd_pcm_close) (snd_pcm_t *pcm);
|
||||
const char *(*psnd_strerror) (int errnum);
|
||||
int (*psnd_pcm_hw_params_any) (snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
int (*psnd_pcm_hw_params_set_access) (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access);
|
||||
int (*psnd_pcm_hw_params_set_format) (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
|
||||
int (*psnd_pcm_hw_params_set_channels) (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
|
||||
int (*psnd_pcm_hw_params_set_rate_near) (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
|
||||
int (*psnd_pcm_hw_params_set_period_size_near) (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir);
|
||||
int (*psnd_pcm_hw_params) (snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
|
||||
int (*psnd_pcm_sw_params_current) (snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
|
||||
int (*psnd_pcm_sw_params_set_start_threshold) (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
||||
int (*psnd_pcm_sw_params_set_stop_threshold) (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
|
||||
int (*psnd_pcm_sw_params) (snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
|
||||
int (*psnd_pcm_hw_params_get_buffer_size) (const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
|
||||
snd_pcm_sframes_t (*psnd_pcm_avail_update) (snd_pcm_t *pcm);
|
||||
int (*psnd_pcm_mmap_begin) (snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames);
|
||||
snd_pcm_sframes_t (*psnd_pcm_mmap_commit) (snd_pcm_t *pcm, snd_pcm_uframes_t offset, snd_pcm_uframes_t frames);
|
||||
snd_pcm_state_t (*psnd_pcm_state) (snd_pcm_t *pcm);
|
||||
int (*psnd_pcm_start) (snd_pcm_t *pcm);
|
||||
|
||||
size_t (*psnd_pcm_hw_params_sizeof) (void);
|
||||
size_t (*psnd_pcm_sw_params_sizeof) (void);
|
||||
|
||||
|
||||
|
||||
static unsigned int ALSA_GetDMAPos (soundcardinfo_t *sc)
|
||||
|
@ -39,8 +67,8 @@ static unsigned int ALSA_GetDMAPos (soundcardinfo_t *sc)
|
|||
snd_pcm_uframes_t offset;
|
||||
snd_pcm_uframes_t nframes = sc->sn.samples / sc->sn.numchannels;
|
||||
|
||||
snd_pcm_avail_update (sc->handle);
|
||||
snd_pcm_mmap_begin (sc->handle, &areas, &offset, &nframes);
|
||||
psnd_pcm_avail_update (sc->handle);
|
||||
psnd_pcm_mmap_begin (sc->handle, &areas, &offset, &nframes);
|
||||
offset *= sc->sn.numchannels;
|
||||
nframes *= sc->sn.numchannels;
|
||||
sc->sn.samplepos = offset;
|
||||
|
@ -50,7 +78,7 @@ static unsigned int ALSA_GetDMAPos (soundcardinfo_t *sc)
|
|||
|
||||
static void ALSA_Shutdown (soundcardinfo_t *sc)
|
||||
{
|
||||
snd_pcm_close (sc->handle);
|
||||
psnd_pcm_close (sc->handle);
|
||||
}
|
||||
|
||||
static void ALSA_Submit (soundcardinfo_t *sc)
|
||||
|
@ -64,18 +92,18 @@ static void ALSA_Submit (soundcardinfo_t *sc)
|
|||
|
||||
nframes = count / sc->sn.numchannels;
|
||||
|
||||
snd_pcm_avail_update (sc->handle);
|
||||
snd_pcm_mmap_begin (sc->handle, &areas, &offset, &nframes);
|
||||
psnd_pcm_avail_update (sc->handle);
|
||||
psnd_pcm_mmap_begin (sc->handle, &areas, &offset, &nframes);
|
||||
|
||||
state = snd_pcm_state (sc->handle);
|
||||
state = psnd_pcm_state (sc->handle);
|
||||
|
||||
switch (state) {
|
||||
case SND_PCM_STATE_PREPARED:
|
||||
snd_pcm_mmap_commit (sc->handle, offset, nframes);
|
||||
snd_pcm_start (sc->handle);
|
||||
psnd_pcm_mmap_commit (sc->handle, offset, nframes);
|
||||
psnd_pcm_start (sc->handle);
|
||||
break;
|
||||
case SND_PCM_STATE_RUNNING:
|
||||
snd_pcm_mmap_commit (sc->handle, offset, nframes);
|
||||
psnd_pcm_mmap_commit (sc->handle, offset, nframes);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -99,6 +127,68 @@ void S_UpdateCapture(void)
|
|||
{
|
||||
}
|
||||
|
||||
static qboolean Alsa_InitAlsa(void)
|
||||
{
|
||||
static qboolean tried;
|
||||
static qboolean alsaworks;
|
||||
if (tried)
|
||||
return alsaworks;
|
||||
tried = true;
|
||||
|
||||
alsasharedobject = dlopen("libasound.so", RTLD_LAZY|RTLD_LOCAL);
|
||||
if (!alsasharedobject)
|
||||
return false;
|
||||
|
||||
|
||||
psnd_pcm_open = dlsym(alsasharedobject, "snd_pcm_open");
|
||||
psnd_pcm_close = dlsym(alsasharedobject, "snd_pcm_close");
|
||||
psnd_strerror = dlsym(alsasharedobject, "snd_strerror");
|
||||
psnd_pcm_hw_params_any = dlsym(alsasharedobject, "snd_pcm_hw_params_any");
|
||||
psnd_pcm_hw_params_set_access = dlsym(alsasharedobject, "snd_pcm_hw_params_set_access");
|
||||
psnd_pcm_hw_params_set_format = dlsym(alsasharedobject, "snd_pcm_hw_params_set_format");
|
||||
psnd_pcm_hw_params_set_channels = dlsym(alsasharedobject, "snd_pcm_hw_params_set_channels");
|
||||
psnd_pcm_hw_params_set_rate_near = dlsym(alsasharedobject, "snd_pcm_hw_params_set_rate_near");
|
||||
psnd_pcm_hw_params_set_period_size_near = dlsym(alsasharedobject, "snd_pcm_hw_params_set_period_size_near");
|
||||
psnd_pcm_hw_params = dlsym(alsasharedobject, "snd_pcm_hw_params");
|
||||
psnd_pcm_sw_params_current = dlsym(alsasharedobject, "snd_pcm_sw_params_current");
|
||||
psnd_pcm_sw_params_set_start_threshold = dlsym(alsasharedobject, "snd_pcm_sw_params_set_start_threshold");
|
||||
psnd_pcm_sw_params_set_stop_threshold = dlsym(alsasharedobject, "snd_pcm_sw_params_set_stop_threshold");
|
||||
psnd_pcm_sw_params = dlsym(alsasharedobject, "snd_pcm_sw_params");
|
||||
psnd_pcm_hw_params_get_buffer_size = dlsym(alsasharedobject, "snd_pcm_hw_params_get_buffer_size");
|
||||
psnd_pcm_avail_update = dlsym(alsasharedobject, "snd_pcm_avail_update");
|
||||
psnd_pcm_mmap_begin = dlsym(alsasharedobject, "snd_pcm_mmap_begin");
|
||||
psnd_pcm_state = dlsym(alsasharedobject, "snd_pcm_state");
|
||||
psnd_pcm_mmap_commit = dlsym(alsasharedobject, "snd_pcm_mmap_commit");
|
||||
psnd_pcm_start = dlsym(alsasharedobject, "snd_pcm_start");
|
||||
psnd_pcm_hw_params_sizeof = dlsym(alsasharedobject, "snd_pcm_hw_params_sizeof");
|
||||
psnd_pcm_sw_params_sizeof = dlsym(alsasharedobject, "snd_pcm_sw_params_sizeof");
|
||||
|
||||
alsaworks = psnd_pcm_open
|
||||
&& psnd_pcm_close
|
||||
&& psnd_strerror
|
||||
&& psnd_pcm_hw_params_any
|
||||
&& psnd_pcm_hw_params_set_access
|
||||
&& psnd_pcm_hw_params_set_format
|
||||
&& psnd_pcm_hw_params_set_channels
|
||||
&& psnd_pcm_hw_params_set_rate_near
|
||||
&& psnd_pcm_hw_params_set_period_size_near
|
||||
&& psnd_pcm_hw_params
|
||||
&& psnd_pcm_sw_params_current
|
||||
&& psnd_pcm_sw_params_set_start_threshold
|
||||
&& psnd_pcm_sw_params_set_stop_threshold
|
||||
&& psnd_pcm_sw_params
|
||||
&& psnd_pcm_hw_params_get_buffer_size
|
||||
&& psnd_pcm_avail_update
|
||||
&& psnd_pcm_mmap_begin
|
||||
&& psnd_pcm_state
|
||||
&& psnd_pcm_mmap_commit
|
||||
&& psnd_pcm_start
|
||||
&& psnd_pcm_hw_params_sizeof
|
||||
&& psnd_pcm_sw_params_sizeof;
|
||||
|
||||
return alsaworks;
|
||||
}
|
||||
|
||||
static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
||||
{
|
||||
snd_pcm_t *pcm;
|
||||
|
@ -115,8 +205,11 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
|||
snd_pcm_sw_params_t *sw;
|
||||
snd_pcm_uframes_t frag_size;
|
||||
|
||||
snd_pcm_hw_params_alloca (&hw);
|
||||
snd_pcm_sw_params_alloca (&sw);
|
||||
if (!Alsa_InitAlsa())
|
||||
return 2;
|
||||
|
||||
hw = alloca(psnd_pcm_hw_params_sizeof());
|
||||
sw = alloca(psnd_pcm_sw_params_sizeof());
|
||||
|
||||
devname = Cvar_Get(va("snd_alsadevice%i", cardnum+1), cardnum==0?"default":"", 0, "Sound controls");
|
||||
pcmname = devname->string;
|
||||
|
@ -161,50 +254,50 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
|||
if ((i=COM_CheckParm("-sndstereo")) != 0)
|
||||
stereo=1;
|
||||
|
||||
err = snd_pcm_open (&pcm, pcmname, SND_PCM_STREAM_PLAYBACK,
|
||||
err = psnd_pcm_open (&pcm, pcmname, SND_PCM_STREAM_PLAYBACK,
|
||||
SND_PCM_NONBLOCK);
|
||||
if (0 > err) {
|
||||
Con_Printf ("Error: audio open error: %s\n", snd_strerror (err));
|
||||
Con_Printf ("Error: audio open error: %s\n", psnd_strerror (err));
|
||||
return 0;
|
||||
}
|
||||
Con_Printf ("ALSA: Using PCM %s.\n", pcmname);
|
||||
|
||||
err = snd_pcm_hw_params_any (pcm, hw);
|
||||
err = psnd_pcm_hw_params_any (pcm, hw);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: error setting hw_params_any. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
|
||||
err = snd_pcm_hw_params_set_access (pcm, hw, SND_PCM_ACCESS_MMAP_INTERLEAVED);
|
||||
err = psnd_pcm_hw_params_set_access (pcm, hw, SND_PCM_ACCESS_MMAP_INTERLEAVED);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: Failure to set noninterleaved PCM access. %s\n"
|
||||
"Note: Interleaved is not supported\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
|
||||
switch (bps) {
|
||||
case -1:
|
||||
err = snd_pcm_hw_params_set_format (pcm, hw, SND_PCM_FORMAT_S16);
|
||||
err = psnd_pcm_hw_params_set_format (pcm, hw, SND_PCM_FORMAT_S16);
|
||||
if (0 <= err) {
|
||||
bps = 16;
|
||||
} else if (0 <= (err = snd_pcm_hw_params_set_format (pcm, hw, SND_PCM_FORMAT_U8))) {
|
||||
} else if (0 <= (err = psnd_pcm_hw_params_set_format (pcm, hw, SND_PCM_FORMAT_U8))) {
|
||||
bps = 8;
|
||||
} else {
|
||||
Con_Printf ("ALSA: no useable formats. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
case 16:
|
||||
err = snd_pcm_hw_params_set_format (pcm, hw, bps == 8 ?
|
||||
err = psnd_pcm_hw_params_set_format (pcm, hw, bps == 8 ?
|
||||
SND_PCM_FORMAT_U8 :
|
||||
SND_PCM_FORMAT_S16);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: no usable formats. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
@ -215,23 +308,27 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
|||
|
||||
switch (stereo) {
|
||||
case -1:
|
||||
err = snd_pcm_hw_params_set_channels (pcm, hw, 2);
|
||||
err = psnd_pcm_hw_params_set_channels (pcm, hw, 2);
|
||||
if (0 <= err) {
|
||||
stereo = 1;
|
||||
} else if (0 <= (err = snd_pcm_hw_params_set_channels (pcm, hw, 1))) {
|
||||
} else if (0 <= (err = psnd_pcm_hw_params_set_channels (pcm, hw, 1))) {
|
||||
stereo = 0;
|
||||
} else {
|
||||
Con_Printf ("ALSA: no usable channels. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
case 0:
|
||||
case 1:
|
||||
err = snd_pcm_hw_params_set_channels (pcm, hw, stereo ? 2 : 1);
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
err = psnd_pcm_hw_params_set_channels (pcm, hw, stereo+1);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: no usable channels. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
break;
|
||||
|
@ -243,23 +340,23 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
|||
switch (rate) {
|
||||
case 0:
|
||||
rate = 44100;
|
||||
err = snd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
err = psnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 <= err) {
|
||||
frag_size = 32 * bps;
|
||||
} else {
|
||||
rate = 22050;
|
||||
err = snd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
err = psnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 <= err) {
|
||||
frag_size = 16 * bps;
|
||||
} else {
|
||||
rate = 11025;
|
||||
err = snd_pcm_hw_params_set_rate_near (pcm, hw, &rate,
|
||||
err = psnd_pcm_hw_params_set_rate_near (pcm, hw, &rate,
|
||||
0);
|
||||
if (0 <= err) {
|
||||
frag_size = 8 * bps;
|
||||
} else {
|
||||
Con_Printf ("ALSA: no usable rates. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
@ -268,10 +365,10 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
|||
case 11025:
|
||||
case 22050:
|
||||
case 44100:
|
||||
err = snd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
err = psnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: desired rate %i not supported. %s\n", rate,
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
frag_size = 8 * bps * rate / 11025;
|
||||
|
@ -281,40 +378,40 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
|||
goto error;
|
||||
}
|
||||
|
||||
err = snd_pcm_hw_params_set_period_size_near (pcm, hw, &frag_size, 0);
|
||||
err = psnd_pcm_hw_params_set_period_size_near (pcm, hw, &frag_size, 0);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: unable to set period size near %i. %s\n",
|
||||
(int) frag_size, snd_strerror (err));
|
||||
(int) frag_size, psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
err = snd_pcm_hw_params (pcm, hw);
|
||||
err = psnd_pcm_hw_params (pcm, hw);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: unable to install hw params: %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
err = snd_pcm_sw_params_current (pcm, sw);
|
||||
err = psnd_pcm_sw_params_current (pcm, sw);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: unable to determine current sw params. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
err = snd_pcm_sw_params_set_start_threshold (pcm, sw, ~0U);
|
||||
err = psnd_pcm_sw_params_set_start_threshold (pcm, sw, ~0U);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: unable to set playback threshold. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
err = snd_pcm_sw_params_set_stop_threshold (pcm, sw, ~0U);
|
||||
err = psnd_pcm_sw_params_set_stop_threshold (pcm, sw, ~0U);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: unable to set playback stop threshold. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
err = snd_pcm_sw_params (pcm, sw);
|
||||
err = psnd_pcm_sw_params (pcm, sw);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: unable to install sw params. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -322,10 +419,10 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
|||
sc->sn.samplepos = 0;
|
||||
sc->sn.samplebits = bps;
|
||||
|
||||
err = snd_pcm_hw_params_get_buffer_size (hw, &buffer_size);
|
||||
err = psnd_pcm_hw_params_get_buffer_size (hw, &buffer_size);
|
||||
if (0 > err) {
|
||||
Con_Printf ("ALSA: unable to get buffer size. %s\n",
|
||||
snd_strerror (err));
|
||||
psnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
@ -344,7 +441,7 @@ static int ALSA_InitCard (soundcardinfo_t *sc, int cardnum)
|
|||
return true;
|
||||
|
||||
error:
|
||||
snd_pcm_close (pcm);
|
||||
psnd_pcm_close (pcm);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
|
@ -33,7 +33,7 @@ void Cmd_ForwardToServer (void);
|
|||
typedef struct cmdalias_s
|
||||
{
|
||||
struct cmdalias_s *next;
|
||||
char name[MAX_ALIAS_NAME];
|
||||
char name[MAX_ALIAS_NAME];
|
||||
char *value;
|
||||
qbyte execlevel;
|
||||
qbyte restriction;
|
||||
|
@ -150,7 +150,7 @@ bind g "impulse 5 ; +attack ; wait ; -attack ; impulse 2"
|
|||
*/
|
||||
void Cmd_Wait_f (void)
|
||||
{
|
||||
cmd_text[Cmd_ExecLevel].waitattime = realtime;
|
||||
cmd_text[Cmd_ExecLevel].waitattime = realtime;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -181,7 +181,7 @@ void Cbuf_AddText (const char *text, int level)
|
|||
Con_Printf("Bad execution level\n");
|
||||
return; //reject.
|
||||
}
|
||||
|
||||
|
||||
l = Q_strlen (text);
|
||||
|
||||
if (!cmd_text[level].buf.maxsize)
|
||||
|
@ -239,7 +239,7 @@ void Cbuf_InsertText (const char *text, int level)
|
|||
}
|
||||
else
|
||||
temp = NULL; // shut up compiler
|
||||
|
||||
|
||||
// add the entire text of the file
|
||||
Cbuf_AddText (text, level);
|
||||
SZ_Write (&cmd_text[level].buf, "\n", 1);
|
||||
|
@ -280,11 +280,11 @@ start:
|
|||
Con_Printf("Statement too long\n");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
memcpy (line, text, i);
|
||||
line[i] = 0;
|
||||
|
||||
|
||||
// delete the text from the command buffer and move remaining commands down
|
||||
// this is necessary because commands (exec, alias) can insert data at the
|
||||
// beginning of the text buffer
|
||||
|
@ -352,7 +352,7 @@ void Cbuf_ExecuteLevel (int level)
|
|||
i = sizeof(line)-1;
|
||||
memcpy (line, text, i);
|
||||
line[i] = 0;
|
||||
|
||||
|
||||
// delete the text from the command buffer and move remaining commands down
|
||||
// this is necessary because commands (exec, alias) can insert data at the
|
||||
// beginning of the text buffer
|
||||
|
@ -366,7 +366,7 @@ void Cbuf_ExecuteLevel (int level)
|
|||
Q_memcpy (text, text+i, cmd_text[level].buf.cursize);
|
||||
}
|
||||
|
||||
// execute the command line
|
||||
// execute the command line
|
||||
Cmd_ExecuteString (line, level);
|
||||
}
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ void Cmd_StuffCmds (void)
|
|||
}
|
||||
if (!s)
|
||||
return;
|
||||
|
||||
|
||||
text = (char*)Z_Malloc (s+1);
|
||||
text[0] = 0;
|
||||
for (i=1 ; i<com_argc ; i++)
|
||||
|
@ -430,11 +430,11 @@ void Cmd_StuffCmds (void)
|
|||
if (i != com_argc-1)
|
||||
Q_strcat (text, " ");
|
||||
}
|
||||
|
||||
|
||||
// pull out the commands
|
||||
build = (char*)Z_Malloc (s+1);
|
||||
build[0] = 0;
|
||||
|
||||
|
||||
for (i=0 ; i<s-1 ; i++)
|
||||
{
|
||||
if (text[i] == '+')
|
||||
|
@ -446,17 +446,17 @@ void Cmd_StuffCmds (void)
|
|||
|
||||
c = text[j];
|
||||
text[j] = 0;
|
||||
|
||||
|
||||
Q_strcat (build, text+i);
|
||||
Q_strcat (build, "\n");
|
||||
text[j] = c;
|
||||
i = j-1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (build[0])
|
||||
Cbuf_AddText (build, RESTRICT_LOCAL);
|
||||
|
||||
|
||||
Z_Free (text);
|
||||
Z_Free (build);
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ Just prints the rest of the line to the console
|
|||
void Cmd_Echo_f (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i=1 ; i<Cmd_Argc() ; i++)
|
||||
Con_Printf ("%s ",Cmd_Argv(i));
|
||||
Con_Printf ("\n");
|
||||
|
@ -527,7 +527,7 @@ void Cmd_Echo_f (void)
|
|||
char *CopyString (char *in)
|
||||
{
|
||||
char *out;
|
||||
|
||||
|
||||
out = (char*)Z_Malloc (strlen(in)+1);
|
||||
strcpy (out, in);
|
||||
return out;
|
||||
|
@ -621,7 +621,7 @@ void Cmd_Alias_f (void)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// check for overlap with a command
|
||||
if (Cmd_Exists (s))
|
||||
{
|
||||
|
@ -674,7 +674,7 @@ void Cmd_Alias_f (void)
|
|||
|
||||
while(*line <= ' ' && *line) //skip leading whitespace.
|
||||
line++;
|
||||
|
||||
|
||||
for (end = line + strlen(line)-1; end >= line && *end <= ' '; end--) //skip trailing
|
||||
*end = '\0';
|
||||
if (!strcmp(line, "{"))
|
||||
|
@ -862,9 +862,9 @@ void Cmd_AliasLevel_f (void)
|
|||
void Cmd_AliasList_f (void)
|
||||
{
|
||||
cmdalias_t *cmd;
|
||||
int num=0;
|
||||
int num=0;
|
||||
for (cmd=cmd_alias ; cmd ; cmd=cmd->next)
|
||||
{
|
||||
{
|
||||
if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
|
||||
continue;
|
||||
if (!num)
|
||||
|
@ -882,9 +882,9 @@ void Cmd_AliasList_f (void)
|
|||
void Alias_WriteAliases (FILE *f)
|
||||
{
|
||||
cmdalias_t *cmd;
|
||||
int num=0;
|
||||
int num=0;
|
||||
for (cmd=cmd_alias ; cmd ; cmd=cmd->next)
|
||||
{
|
||||
{
|
||||
// if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
|
||||
// continue;
|
||||
if (cmd->flags & ALIAS_FROMSERVER)
|
||||
|
@ -967,7 +967,7 @@ char *VARGS Cmd_Argv (int arg)
|
|||
{
|
||||
if ( arg >= cmd_argc )
|
||||
return cmd_null_string;
|
||||
return cmd_argv[arg];
|
||||
return cmd_argv[arg];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1145,14 +1145,14 @@ Parses the given string into command line tokens.
|
|||
void Cmd_TokenizeString (char *text, qboolean expandmacros, qboolean qctokenize)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
// clear the args from the last string
|
||||
for (i=0 ; i<cmd_argc ; i++)
|
||||
Z_Free (cmd_argv[i]);
|
||||
|
||||
|
||||
cmd_argc = 0;
|
||||
cmd_args = NULL;
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
// skip whitespace up to a /n
|
||||
|
@ -1160,16 +1160,16 @@ void Cmd_TokenizeString (char *text, qboolean expandmacros, qboolean qctokenize)
|
|||
{
|
||||
text++;
|
||||
}
|
||||
|
||||
|
||||
if (*text == '\n')
|
||||
{ // a newline seperates commands in the buffer
|
||||
text++;
|
||||
text++;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!*text)
|
||||
return;
|
||||
|
||||
|
||||
if (cmd_argc == 1)
|
||||
cmd_args = text;
|
||||
|
||||
|
@ -1184,7 +1184,7 @@ void Cmd_TokenizeString (char *text, qboolean expandmacros, qboolean qctokenize)
|
|||
cmd_argc++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1196,17 +1196,17 @@ Cmd_AddCommand
|
|||
qboolean Cmd_AddCommand (char *cmd_name, xcommand_t function)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
|
||||
|
||||
if (host_initialized) // because hunk allocation would get stomped
|
||||
Sys_Error ("Cmd_AddCommand after host_initialized");
|
||||
|
||||
|
||||
// fail if the command is a variable name
|
||||
if (Cvar_VariableString(cmd_name)[0])
|
||||
{
|
||||
Con_Printf ("Cmd_AddCommand: %s already defined as a var\n", cmd_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// fail if the command already exists
|
||||
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
|
||||
{
|
||||
|
@ -1237,7 +1237,7 @@ qboolean Cmd_AddRemCommand (char *cmd_name, xcommand_t function)
|
|||
Con_Printf ("Cmd_AddCommand: %s already defined as a var\n", cmd_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// fail if the command already exists
|
||||
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
|
||||
{
|
||||
|
@ -1333,7 +1333,7 @@ void Cmd_RestrictCommand_f (void)
|
|||
else if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
|
||||
Con_TPrintf(TL_RESTRICTCOMMANDTOOHIGH);
|
||||
else
|
||||
cmd->restriction = level;
|
||||
cmd->restriction = level;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1437,7 +1437,7 @@ void Cmd_CompleteCheck(char *check, match_t *match) //compare cumulative strings
|
|||
{
|
||||
if (*match->result)
|
||||
{
|
||||
char *r;
|
||||
char *r;
|
||||
if (match->allowcutdown)
|
||||
{
|
||||
for(r = match->result; *r == *check && *r; r++, check++)
|
||||
|
@ -1474,10 +1474,10 @@ char *Cmd_CompleteCommand (char *partial, qboolean fullonly, qboolean caseinsens
|
|||
static match_t match;
|
||||
|
||||
cvar_group_t *grp;
|
||||
cvar_t *cvar;
|
||||
|
||||
cvar_t *cvar;
|
||||
|
||||
len = Q_strlen(partial);
|
||||
|
||||
|
||||
if (!len)
|
||||
return NULL;
|
||||
|
||||
|
@ -1532,7 +1532,7 @@ char *Cmd_CompleteCommand (char *partial, qboolean fullonly, qboolean caseinsens
|
|||
void Cmd_List_f (void)
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
int num=0;
|
||||
int num=0;
|
||||
for (cmd=cmd_functions ; cmd ; cmd=cmd->next)
|
||||
{
|
||||
if ((cmd->restriction?cmd->restriction:rcon_level.value) > Cmd_ExecLevel)
|
||||
|
@ -1564,7 +1564,7 @@ void Cmd_ForwardToServer (void)
|
|||
Con_TPrintf (TL_CANTXNOTCONNECTED, Cmd_Argv(0));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (cls.demoplayback)
|
||||
return; // not really connected
|
||||
|
||||
|
@ -1595,7 +1595,7 @@ void Cmd_ForwardToServer_f (void)
|
|||
if (SCR_RSShot())
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (cls.demoplayback)
|
||||
return; // not really connected
|
||||
|
||||
|
@ -1617,7 +1617,7 @@ FIXME: lookupnoadd the token to speed search?
|
|||
============
|
||||
*/
|
||||
void Cmd_ExecuteString (char *text, int level)
|
||||
{
|
||||
{
|
||||
cmd_function_t *cmd;
|
||||
cmdalias_t *a;
|
||||
|
||||
|
@ -1627,7 +1627,7 @@ void Cmd_ExecuteString (char *text, int level)
|
|||
|
||||
text = Cmd_ExpandString(text, dest, sizeof(dest), level, !Cmd_IsInsecure()?true:false);
|
||||
Cmd_TokenizeString (text, level == RESTRICT_LOCAL?true:false, false);
|
||||
|
||||
|
||||
// execute the command line
|
||||
if (!Cmd_Argc())
|
||||
return; // no tokens
|
||||
|
@ -1656,6 +1656,7 @@ void Cmd_ExecuteString (char *text, int level)
|
|||
if (!Q_strcasecmp (cmd_argv[0], a->name))
|
||||
{
|
||||
int i;
|
||||
int execlevel;
|
||||
|
||||
if ((a->restriction?a->restriction:rcon_level.value) > level)
|
||||
{
|
||||
|
@ -1663,29 +1664,31 @@ void Cmd_ExecuteString (char *text, int level)
|
|||
return;
|
||||
}
|
||||
if (a->execlevel)
|
||||
level = a->execlevel;
|
||||
execlevel = a->execlevel;
|
||||
else
|
||||
execlevel = level;
|
||||
|
||||
Cbuf_InsertText ("\n", level);
|
||||
Cbuf_InsertText ("\n", execlevel);
|
||||
|
||||
// if the alias value is a command or cvar and
|
||||
// the alias is called with parameters, add them
|
||||
if (Cmd_Argc() > 1 && !strchr(a->value, ' ') && !strchr(a->value, '\t') &&
|
||||
if (Cmd_Argc() > 1 && !strchr(a->value, ' ') && !strchr(a->value, '\t') &&
|
||||
(Cvar_FindVar(a->value) || (Cmd_Exists(a->value) && a->value[0] != '+' && a->value[0] != '-'))
|
||||
)
|
||||
{
|
||||
Cbuf_InsertText (Cmd_Args(), level);
|
||||
Cbuf_InsertText (" ", level);
|
||||
Cbuf_InsertText (Cmd_Args(), execlevel);
|
||||
Cbuf_InsertText (" ", execlevel);
|
||||
}
|
||||
|
||||
Cbuf_InsertText (a->value, level);
|
||||
Cbuf_InsertText (a->value, execlevel);
|
||||
|
||||
if (level>=RESTRICT_SERVER)
|
||||
if (execlevel>=RESTRICT_SERVER)
|
||||
return; //don't do the cmd_argc/cmd_argv stuff. When it's from the server, we had a tendancy to lock aliases, so don't set them anymore.
|
||||
|
||||
Cbuf_InsertText (va("set cmd_argc \"%i\"\n", cmd_argc), level);
|
||||
Cbuf_InsertText (va("set cmd_argc \"%i\"\n", cmd_argc), execlevel);
|
||||
|
||||
for (i = 1; i < cmd_argc; i++)
|
||||
Cbuf_InsertText (va("set cmd_argv%i \"%s\"\n", i, cmd_argv[i]), level);
|
||||
Cbuf_InsertText (va("set cmd_argv%i \"%s\"\n", i, cmd_argv[i]), execlevel);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1756,14 +1759,14 @@ where the given parameter apears, or 0 if not present
|
|||
int Cmd_CheckParm (char *parm)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (!parm)
|
||||
Sys_Error ("Cmd_CheckParm: NULL");
|
||||
|
||||
for (i = 1; i < Cmd_Argc (); i++)
|
||||
if (! Q_strcasecmp (parm, Cmd_Argv (i)))
|
||||
return i;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1831,13 +1834,13 @@ const char *retfloat(float f)
|
|||
return ret->str;
|
||||
}
|
||||
qboolean is_numeric (const char *c)
|
||||
{
|
||||
{
|
||||
return (*c >= '0' && *c <= '9') ||
|
||||
((*c == '-' || *c == '+') && (c[1] == '.' || (c[1]>='0' && c[1]<='9'))) ||
|
||||
(*c == '.' && (c[1]>='0' && c[1]<='9'))?true:false;
|
||||
}
|
||||
const char *If_Token(const char *func, const char **end)
|
||||
{
|
||||
{
|
||||
const char *s, *s2;
|
||||
cvar_t *var;
|
||||
int level;
|
||||
|
@ -1861,7 +1864,7 @@ const char *If_Token(const char *func, const char **end)
|
|||
else if (*s2 == '(')
|
||||
level++;
|
||||
s2++;
|
||||
}
|
||||
}
|
||||
func = If_Token(s, end);
|
||||
*end = s2+1;
|
||||
s = *end;
|
||||
|
@ -1913,7 +1916,7 @@ const char *If_Token(const char *func, const char **end)
|
|||
if ((var->restriction?var->restriction:rcon_level.value) > Cmd_ExecLevel)
|
||||
s2 = "RESTRICTED";
|
||||
else
|
||||
s2 = var->string;
|
||||
s2 = var->string;
|
||||
}
|
||||
else
|
||||
s2 = retstring(com_token);
|
||||
|
@ -2010,7 +2013,7 @@ const char *If_Token(const char *func, const char **end)
|
|||
else
|
||||
return retfloat(atoi(s2)|atoi(If_Token(s, end)));
|
||||
}
|
||||
|
||||
|
||||
return s2;
|
||||
}
|
||||
|
||||
|
@ -2037,7 +2040,7 @@ void Cbuf_ExecBlock(int level)
|
|||
|
||||
while(*line <= ' ' && *line) //skip leading whitespace.
|
||||
line++;
|
||||
|
||||
|
||||
for (end = line + strlen(line)-1; end >= line && *end <= ' '; end--) //skip trailing
|
||||
*end = '\0';
|
||||
|
||||
|
@ -2102,7 +2105,7 @@ void Cbuf_SkipBlock(int level)
|
|||
|
||||
while(*line <= ' ' && *line) //skip leading whitespace.
|
||||
line++;
|
||||
|
||||
|
||||
for (end = line + strlen(line)-1; end >= line && *end <= ' '; end--) //skip trailing
|
||||
*end = '\0';
|
||||
|
||||
|
@ -2167,7 +2170,7 @@ skipws:
|
|||
end+=4;
|
||||
goto skipws;
|
||||
}
|
||||
|
||||
|
||||
if (!*end)
|
||||
{
|
||||
if (ret && *ret) //equation was true.
|
||||
|
@ -2611,7 +2614,7 @@ qboolean Cmd_FilterMessage (char *message, qboolean sameteam) //returns true if
|
|||
filter++;
|
||||
|
||||
Q_strncpyz(trimmedfilter, filter, sizeof(trimmedfilter)); //might have whitespace.
|
||||
|
||||
|
||||
for (end = trimmedfilter + strlen(filter)-1; end >= trimmedfilter && *end <= ' '; end--) //skip trailing
|
||||
*end = '\0';
|
||||
|
||||
|
@ -2654,7 +2657,7 @@ void Cmd_WriteConfig_f(void)
|
|||
Con_Printf ("Couldn't write config %s\n",filename);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
filename = va("%s/configs/%s.cfg",com_gamedir, filename);
|
||||
}
|
||||
COM_DefaultExtension(filename, ".cfg");
|
||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
|
@ -35,7 +35,7 @@ cvar_t *Cvar_FindVar (const char *var_name)
|
|||
{
|
||||
cvar_group_t *grp;
|
||||
cvar_t *var;
|
||||
|
||||
|
||||
for (grp=cvar_groups ; grp ; grp=grp->next)
|
||||
for (var=grp->cvars ; var ; var=var->next)
|
||||
if (!Q_strcasecmp (var_name, var->name))
|
||||
|
@ -52,7 +52,7 @@ cvar_t *Cvar_FindVar (const char *var_name)
|
|||
cvar_group_t *Cvar_FindGroup (const char *group_name)
|
||||
{
|
||||
cvar_group_t *grp;
|
||||
|
||||
|
||||
for (grp=cvar_groups ; grp ; grp=grp->next)
|
||||
if (!Q_strcasecmp (group_name, grp->name))
|
||||
return grp;
|
||||
|
@ -104,7 +104,7 @@ Cvar_VariableValue
|
|||
float Cvar_VariableValue (const char *var_name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
||||
var = Cvar_FindVar (var_name);
|
||||
if (!var)
|
||||
return 0;
|
||||
|
@ -120,7 +120,7 @@ Cvar_VariableString
|
|||
char *Cvar_VariableString (const char *var_name)
|
||||
{
|
||||
cvar_t *var;
|
||||
|
||||
|
||||
var = Cvar_FindVar (var_name);
|
||||
if (!var)
|
||||
return cvar_null_string;
|
||||
|
@ -139,12 +139,12 @@ char *Cvar_CompleteVariable (char *partial)
|
|||
cvar_group_t *grp;
|
||||
cvar_t *cvar;
|
||||
int len;
|
||||
|
||||
|
||||
len = Q_strlen(partial);
|
||||
|
||||
|
||||
if (!len)
|
||||
return NULL;
|
||||
|
||||
|
||||
// check exact match
|
||||
for (grp=cvar_groups ; grp ; grp=grp->next)
|
||||
for (cvar=grp->cvars ; cvar ; cvar=cvar->next)
|
||||
|
@ -170,7 +170,7 @@ Cvar_Set
|
|||
cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
|
||||
{
|
||||
char *latch=NULL;
|
||||
|
||||
|
||||
if (!var)
|
||||
return NULL;
|
||||
|
||||
|
@ -252,7 +252,7 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
|
|||
#endif
|
||||
|
||||
latch = var->string;
|
||||
|
||||
|
||||
var->string = (char*)Z_Malloc (Q_strlen(value)+1);
|
||||
Q_strcpy (var->string, value);
|
||||
var->value = Q_atof (var->string);
|
||||
|
@ -449,7 +449,7 @@ void Cvar_Register (cvar_t *variable, const char *groupname)
|
|||
Cvar_Free(old);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Con_Printf ("Can't register variable %s, allready defined\n", variable->name);
|
||||
return;
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ void Cvar_Register (cvar_t *variable, const char *groupname)
|
|||
}
|
||||
/*
|
||||
void Cvar_RegisterVariable (cvar_t *variable)
|
||||
{
|
||||
{
|
||||
Cvar_Register(variable, NULL);
|
||||
}
|
||||
*/
|
||||
|
@ -603,9 +603,12 @@ qboolean Cvar_Command (int level)
|
|||
//let cvar_set latch if needed.
|
||||
}
|
||||
else if (Cmd_FromGamecode())
|
||||
{
|
||||
Cvar_LockFromServer(v, str);
|
||||
return true;
|
||||
{//it's not latched yet
|
||||
if (strcmp(v->defaultstr, str))
|
||||
{ //lock the cvar, unless it's going to it's default value.
|
||||
Cvar_LockFromServer(v, str);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Cvar_Set (v, str); //will use all, quote included
|
||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
|
@ -69,6 +69,10 @@ struct sockaddr;
|
|||
#define closesocket close
|
||||
#define ioctlsocket ioctl
|
||||
|
||||
#ifndef INVALID_SOCKET
|
||||
#define INVALID_SOCKET -1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
@ -310,7 +314,7 @@ qboolean NET_CompareBaseAdr (netadr_t a, netadr_t b)
|
|||
char *NET_AdrToString (netadr_t a)
|
||||
{
|
||||
static char s[64];
|
||||
|
||||
|
||||
switch(a.type)
|
||||
{
|
||||
case NA_BROADCAST_IP:
|
||||
|
@ -343,7 +347,7 @@ char *NET_AdrToString (netadr_t a)
|
|||
char *NET_BaseAdrToString (netadr_t a)
|
||||
{
|
||||
static char s[64];
|
||||
|
||||
|
||||
switch(a.type)
|
||||
{
|
||||
case NA_BROADCAST_IP:
|
||||
|
@ -394,7 +398,7 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr)
|
|||
struct hostent *h;
|
||||
char *colon;
|
||||
char copy[128];
|
||||
|
||||
|
||||
memset (sadr, 0, sizeof(*sadr));
|
||||
|
||||
#ifdef USEIPX
|
||||
|
@ -441,7 +445,7 @@ qboolean NET_StringToSockaddr (char *s, struct sockaddr_qstorage *sadr)
|
|||
break;
|
||||
port--;
|
||||
}
|
||||
|
||||
|
||||
if (port == s)
|
||||
port = NULL;
|
||||
if (port)
|
||||
|
@ -530,13 +534,13 @@ qboolean NET_StringToAdr (char *s, netadr_t *a)
|
|||
|
||||
if (!NET_StringToSockaddr (s, &sadr))
|
||||
return false;
|
||||
|
||||
|
||||
SockadrToNetadr (&sadr, a);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Returns true if we can't bind the address locally--in other words,
|
||||
// Returns true if we can't bind the address locally--in other words,
|
||||
// the IP is NOT one of our interfaces.
|
||||
qboolean NET_IsClientLegal(netadr_t *adr)
|
||||
{
|
||||
|
@ -554,7 +558,7 @@ qboolean NET_IsClientLegal(netadr_t *adr)
|
|||
|
||||
sadr.sin_port = 0;
|
||||
|
||||
if( bind (newsocket, (void *)&sadr, sizeof(sadr)) == -1)
|
||||
if( bind (newsocket, (void *)&sadr, sizeof(sadr)) == -1)
|
||||
{
|
||||
// It is not a local address
|
||||
close(newsocket);
|
||||
|
@ -777,7 +781,7 @@ void NET_SendPacket (netsrc_t netsrc, int length, void *data, netadr_t to)
|
|||
socket = cls.socketip;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
NetadrToSockadr (&to, &addr);
|
||||
|
||||
switch(to.type)
|
||||
|
@ -863,7 +867,7 @@ int maxport = port + 100;
|
|||
address.sin_port = 0;
|
||||
else
|
||||
address.sin_port = htons((short)port);
|
||||
|
||||
|
||||
if( bind (newsocket, (void *)&address, sizeof(address)) == -1)
|
||||
{
|
||||
if (!port)
|
||||
|
@ -899,7 +903,7 @@ int maxport = port + 100;
|
|||
|
||||
if (bcast)
|
||||
{
|
||||
// address.sin6_addr
|
||||
// address.sin6_addr
|
||||
// _true = true;
|
||||
// if (setsockopt(newsocket, SOL_SOCKET, IP_ADD_MEMBERSHIP, (char *)&_true, sizeof(_true)) == -1)
|
||||
// {
|
||||
|
@ -1084,7 +1088,7 @@ NET_Init
|
|||
void NET_Init (void)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
WORD wVersionRequested;
|
||||
WORD wVersionRequested;
|
||||
int r;
|
||||
#ifdef IPPROTO_IPV6
|
||||
HMODULE ws2_32dll;
|
||||
|
@ -1104,7 +1108,7 @@ void NET_Init (void)
|
|||
pgetaddrinfo = NULL;
|
||||
#endif
|
||||
|
||||
wVersionRequested = MAKEWORD(1, 1);
|
||||
wVersionRequested = MAKEWORD(1, 1);
|
||||
|
||||
r = WSAStartup (MAKEWORD(1, 1), &winsockdata);
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ int P_ParticleTypeForName(char *name);
|
|||
int P_AllocateParticleType(char *name); //find one if it exists, or create if it doesn't.
|
||||
int P_FindParticleType(char *name); //checks if particle description 'name' exists, returns -1 if not.
|
||||
|
||||
qboolean P_DescriptionIsLoaded(char *name); //returns true if it's usable.
|
||||
int P_DescriptionIsLoaded(char *name); //returns true if it's usable.
|
||||
|
||||
void P_SkyTri(float *v1, float *v2, float *v3, struct msurface_s *surf);
|
||||
|
||||
|
|
|
@ -982,7 +982,7 @@ TRACE(("dbg: GLMod_LoadTextures: inittexturedescs\n"));
|
|||
if (!Q_strncmp(mt->name,"sky",3))
|
||||
{
|
||||
tx->offsets[0] = (char *)mt + mt->offsets[0] - (char *)tx;
|
||||
R_InitSky (tx);
|
||||
GLR_InitSky (tx);
|
||||
}
|
||||
else
|
||||
#ifdef PEXT_BULLETENS
|
||||
|
|
|
@ -3,7 +3,7 @@ GTKGUI_OBJS=qcc_gtk.o qccguistuff.c
|
|||
|
||||
CC=gcc -Wall -DQCCONLY
|
||||
|
||||
DO_CC=$(CC) $(BASE_CFLAGS) -DUSEGUI -o $@ -c $< $(CFLAGS)
|
||||
DO_CC=$(CC) $(BASE_CFLAGS) -o $@ -c $< $(CFLAGS)
|
||||
|
||||
all: qcc
|
||||
|
||||
|
@ -48,4 +48,4 @@ qcc_gtk.o: qcc_gtk.c qcc.h
|
|||
$(DO_CC) `pkg-config --cflags gtk+-2.0`
|
||||
|
||||
gtkgui: $(QCC_OBJS) $(GTKGUI_OBJS)
|
||||
$(CC) $(BASE_CFLAGS) -DQCCONLY -DUSEGUI -o fteqccgui.bin -O3 $(GTKGUI_OBJS) $(QCC_OBJS) `pkg-config --libs gtk+-2.0`
|
||||
$(CC) $(BASE_CFLAGS) -DQCCONLY -DUSEGUI -o fteqccgui.bin -O3 $(GTKGUI_OBJS) $(QCC_OBJS) `pkg-config --libs gtk+-2.0`
|
||||
|
|
|
@ -36,7 +36,7 @@ static qboolean ignoreprotocol;
|
|||
#define TE_EXPLOSIONSMALL2 20 // org.
|
||||
|
||||
client_t *Write_GetClient(void);
|
||||
sizebuf_t *WriteDest (int dest);
|
||||
sizebuf_t *QWWriteDest (int dest);
|
||||
#ifdef NQPROT
|
||||
sizebuf_t *NQWriteDest (int dest);
|
||||
#endif
|
||||
|
@ -57,7 +57,7 @@ void NPP_SetInfo(client_t *cl, char *key, char *value)
|
|||
MSG_WriteString (&sv.reliable_datagram, Info_ValueForKey(cl->userinfo, key));
|
||||
}
|
||||
|
||||
void NPP_Flush(void)
|
||||
void NPP_NQFlush(void)
|
||||
{
|
||||
if (!bufferlen)
|
||||
return;
|
||||
|
@ -67,7 +67,7 @@ void NPP_Flush(void)
|
|||
{
|
||||
case svc_cdtrack:
|
||||
if (bufferlen!=protocollen)
|
||||
Con_Printf("svc_cdtrack wasn't the right length\n");
|
||||
Con_Printf("NQFlush: svc_cdtrack wasn't the right length\n");
|
||||
else
|
||||
bufferlen-=1;
|
||||
break;
|
||||
|
@ -120,7 +120,7 @@ void NPP_Flush(void)
|
|||
writedest = NULL;
|
||||
}
|
||||
break;
|
||||
// case svc_finale:
|
||||
// case svc_finale:
|
||||
// bufferlen = 0;
|
||||
// break;
|
||||
case svc_setview:
|
||||
|
@ -156,7 +156,7 @@ void NPP_Flush(void)
|
|||
switch (buffer[1])
|
||||
{
|
||||
case NQTE_EXPLOSION2: //happens with rogue.
|
||||
bufferlen -= 2; //trim the colour
|
||||
bufferlen -= 2; //trim the colour
|
||||
buffer[1] = TE_EXPLOSION;
|
||||
break;
|
||||
}
|
||||
|
@ -211,17 +211,17 @@ void NPP_Flush(void)
|
|||
multicastpos=0;
|
||||
requireextension=0;
|
||||
}
|
||||
void NPP_CheckFlush(void)
|
||||
void NPP_NQCheckFlush(void)
|
||||
{
|
||||
if (bufferlen >= protocollen && protocollen)
|
||||
NPP_Flush();
|
||||
NPP_NQFlush();
|
||||
}
|
||||
|
||||
void NPP_CheckDest(int dest)
|
||||
void NPP_NQCheckDest(int dest)
|
||||
{
|
||||
if (dest == MSG_ONE)
|
||||
{
|
||||
client_t *cl = Write_GetClient();
|
||||
/* client_t *cl = Write_GetClient();
|
||||
if (!cl)
|
||||
{
|
||||
Con_Printf("Not a client\n");
|
||||
|
@ -230,17 +230,18 @@ void NPP_CheckDest(int dest)
|
|||
if ((cldest && cldest != cl) || writedest)
|
||||
{
|
||||
Con_Printf("MSG destination changed in the middle of a packet %i.\n", (int)*buffer);
|
||||
NPP_Flush();
|
||||
NPP_NQFlush();
|
||||
}
|
||||
cldest = cl;
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
sizebuf_t *ndest = WriteDest(dest);
|
||||
sizebuf_t *ndest = QWWriteDest(dest);
|
||||
if (cldest || (writedest && writedest != ndest))
|
||||
{
|
||||
Con_Printf("MSG destination changed in the middle of a packet %i.\n", (int)*buffer);
|
||||
NPP_Flush();
|
||||
Con_Printf("NQCheckDest: MSG destination changed in the middle of a packet %i.\n", (int)*buffer);
|
||||
NPP_NQFlush();
|
||||
}
|
||||
writedest = ndest;
|
||||
}
|
||||
|
@ -250,18 +251,18 @@ void NPP_AddData(void *data, int len)
|
|||
if (bufferlen+len > sizeof(buffer))
|
||||
Sys_Error("Preparse buffer was filled\n");
|
||||
memcpy(buffer+bufferlen, data, len);
|
||||
bufferlen+=len;
|
||||
bufferlen+=len;
|
||||
}
|
||||
|
||||
void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_CheckDest(dest);
|
||||
NPP_NQCheckDest(dest);
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && !ISQWCLIENT(cl))
|
||||
{
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(qbyte));
|
||||
ClientReliableWrite_Byte(cl, data);
|
||||
}
|
||||
|
@ -269,13 +270,13 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
MSG_WriteByte (NQWriteDest(dest), data);
|
||||
#endif
|
||||
if (!bufferlen) //new message section
|
||||
{
|
||||
{
|
||||
switch(data)
|
||||
{
|
||||
case svcdp_showlmp:
|
||||
case svcdp_hidelmp:
|
||||
break;
|
||||
case svc_temp_entity:
|
||||
case svc_temp_entity:
|
||||
break;
|
||||
case svc_setangle:
|
||||
protocollen = sizeof(qbyte)*4;
|
||||
|
@ -330,7 +331,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
ignoreprotocol = true;
|
||||
break;
|
||||
default:
|
||||
Con_Printf("nq: bad protocol %i\n", (int)data);
|
||||
Con_Printf("NQWriteByte: bad protocol %i\n", (int)data);
|
||||
protocollen = sizeof(buffer);
|
||||
break;
|
||||
}
|
||||
|
@ -377,7 +378,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
multicastpos=2;
|
||||
multicasttype=MULTICAST_PVS;
|
||||
protocollen = sizeofcoord*3+sizeof(qbyte)*2;
|
||||
break;
|
||||
break;
|
||||
case TE_EXPLOSION3_NEH:
|
||||
protocollen = sizeof(qbyte) + sizeofcoord*6;
|
||||
ignoreprotocol = true;
|
||||
|
@ -441,7 +442,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
|
||||
default:
|
||||
protocollen = sizeof(buffer);
|
||||
Con_Printf("bad tempentity\n");
|
||||
Con_Printf("NQWriteByte: bad tempentity\n");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -450,7 +451,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
case svc_centerprint:
|
||||
break;
|
||||
default:
|
||||
Con_Printf("Non-Implemented svc\n");
|
||||
Con_Printf("NQWriteByte: Non-Implemented svc\n");
|
||||
protocollen = sizeof(buffer);
|
||||
break;
|
||||
}
|
||||
|
@ -481,7 +482,7 @@ void NPP_NQWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
}
|
||||
|
||||
NPP_AddData(&data, sizeof(qbyte));
|
||||
NPP_CheckFlush();
|
||||
NPP_NQCheckFlush();
|
||||
}
|
||||
|
||||
void NPP_NQWriteChar(int dest, char data) //replacement write func (nq to qw)
|
||||
|
@ -489,7 +490,7 @@ void NPP_NQWriteChar(int dest, char data) //replacement write func (nq to qw)
|
|||
NPP_NQWriteByte(dest, (qbyte)data);
|
||||
return;
|
||||
/*
|
||||
NPP_CheckDest(dest);
|
||||
NPP_NQCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
{
|
||||
NPP_NQWriteByte(dest, (qbyte)data);
|
||||
|
@ -500,7 +501,7 @@ void NPP_NQWriteChar(int dest, char data) //replacement write func (nq to qw)
|
|||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && cl->nqprot)
|
||||
{
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(char));
|
||||
ClientReliableWrite_Char(cl, data);
|
||||
}
|
||||
|
@ -509,69 +510,48 @@ void NPP_NQWriteChar(int dest, char data) //replacement write func (nq to qw)
|
|||
#endif
|
||||
|
||||
NPP_AddData(&data, sizeof(char));
|
||||
NPP_CheckFlush();*/
|
||||
NPP_NQCheckFlush();*/
|
||||
}
|
||||
|
||||
void NPP_NQWriteShort(int dest, short data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_CheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte\n");
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && !ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(short));
|
||||
ClientReliableWrite_Short(cl, data);
|
||||
}
|
||||
} else
|
||||
MSG_WriteShort (NQWriteDest(dest), data);
|
||||
#endif
|
||||
|
||||
data = LittleShort(data);
|
||||
NPP_AddData(&data, sizeof(short));
|
||||
NPP_CheckFlush();
|
||||
union {
|
||||
qbyte b[2];
|
||||
short s;
|
||||
} u;
|
||||
u.s = LittleShort(data);
|
||||
NPP_NQWriteByte(dest, u.b[0]);
|
||||
NPP_NQWriteByte(dest, u.b[1]);
|
||||
}
|
||||
|
||||
void NPP_NQWriteLong(int dest, long data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_CheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte\n");
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && !ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(long));
|
||||
ClientReliableWrite_Long(cl, data);
|
||||
}
|
||||
} else
|
||||
MSG_WriteLong (NQWriteDest(dest), data);
|
||||
#endif
|
||||
|
||||
data = LittleLong(data);
|
||||
NPP_AddData(&data, sizeof(long));
|
||||
NPP_CheckFlush();
|
||||
union {
|
||||
qbyte b[4];
|
||||
int l;
|
||||
} u;
|
||||
u.l = LittleLong(data);
|
||||
NPP_NQWriteByte(dest, u.b[0]);
|
||||
NPP_NQWriteByte(dest, u.b[1]);
|
||||
NPP_NQWriteByte(dest, u.b[2]);
|
||||
NPP_NQWriteByte(dest, u.b[3]);
|
||||
}
|
||||
void NPP_NQWriteAngle(int dest, float in) //replacement write func (nq to qw)
|
||||
{
|
||||
char data = (int)(in*256/360) & 255;
|
||||
NPP_CheckDest(dest);
|
||||
NPP_NQCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte\n");
|
||||
Con_Printf("NQWriteAngle: Messages should start with WriteByte\n");
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE)
|
||||
{
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && !ISQWCLIENT(cl))
|
||||
{
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(char));
|
||||
ClientReliableWrite_Angle(cl, in);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -579,23 +559,24 @@ NPP_CheckDest(dest);
|
|||
#endif
|
||||
|
||||
NPP_AddData(&data, sizeof(char));
|
||||
NPP_CheckFlush();
|
||||
NPP_NQCheckFlush();
|
||||
}
|
||||
void NPP_NQWriteCoord(int dest, float in) //replacement write func (nq to qw)
|
||||
{
|
||||
short datas = (int)(in*8);
|
||||
float dataf = in;
|
||||
NPP_CheckDest(dest);
|
||||
NPP_NQCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte\n");
|
||||
Con_Printf("NQWriteCoord: Messages should start with WriteByte\n");
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && !ISQWCLIENT(cl))
|
||||
{
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(float));
|
||||
ClientReliableWrite_Coord(cl, in);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
MSG_WriteCoord (NQWriteDest(dest), in);
|
||||
|
@ -611,21 +592,22 @@ NPP_CheckDest(dest);
|
|||
datas = LittleShort(datas);
|
||||
NPP_AddData(&datas, sizeof(short));
|
||||
}
|
||||
NPP_CheckFlush();
|
||||
NPP_NQCheckFlush();
|
||||
}
|
||||
void NPP_NQWriteString(int dest, char *data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_CheckDest(dest);
|
||||
NPP_NQCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte\n");
|
||||
Con_Printf("NQWriteString: Messages should start with WriteByte\n");
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && !ISQWCLIENT(cl))
|
||||
{
|
||||
{
|
||||
ClientReliableCheckBlock(cl, strlen(data)+1);
|
||||
ClientReliableWrite_String(cl, data);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
MSG_WriteString (NQWriteDest(dest), data);
|
||||
|
@ -645,13 +627,13 @@ NPP_CheckDest(dest);
|
|||
}
|
||||
}
|
||||
|
||||
NPP_CheckFlush();
|
||||
NPP_NQCheckFlush();
|
||||
}
|
||||
void NPP_NQWriteEntity(int dest, short data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_CheckDest(dest);
|
||||
NPP_NQCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte\n");
|
||||
Con_Printf("NQWriteEntity: Messages should start with WriteByte\n");
|
||||
|
||||
if (majortype == svc_temp_entity && data >= 0 && data <= sv.allocated_client_slots)
|
||||
if (svs.clients[data-1].viewent)
|
||||
|
@ -661,16 +643,17 @@ NPP_CheckDest(dest);
|
|||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && !ISQWCLIENT(cl))
|
||||
{
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(short));
|
||||
ClientReliableWrite_Short(cl, data);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
MSG_WriteShort (NQWriteDest(dest), data);
|
||||
#endif
|
||||
|
||||
NPP_AddData(&data, sizeof(short));
|
||||
NPP_CheckFlush();
|
||||
NPP_NQCheckFlush();
|
||||
}
|
||||
|
||||
|
||||
|
@ -699,7 +682,6 @@ void NPP_QWFlush(void)
|
|||
if (!bufferlen)
|
||||
return;
|
||||
|
||||
|
||||
switch(majortype)
|
||||
{
|
||||
case svc_setname: //not a standard feature, but hey, if a progs wants bots.
|
||||
|
@ -713,7 +695,7 @@ void NPP_QWFlush(void)
|
|||
break;
|
||||
case svc_cdtrack:
|
||||
if (bufferlen!=protocollen)
|
||||
Con_Printf("svc_cdtrack wasn't the right length\n");
|
||||
Con_Printf("QWFlush: svc_cdtrack wasn't the right length\n");
|
||||
else
|
||||
{
|
||||
b = 0;
|
||||
|
@ -743,7 +725,7 @@ void NPP_QWFlush(void)
|
|||
|
||||
ClientReliableCheckBlock(cl, 1);
|
||||
ClientReliableWrite_Byte(cl, svc_intermission);
|
||||
|
||||
|
||||
org[0] = (*(short*)&buffer[1])/8.0f;
|
||||
org[1] = (*(short*)&buffer[1+2])/8.0f;
|
||||
org[2] = (*(short*)&buffer[1+4])/8.0f;
|
||||
|
@ -762,7 +744,7 @@ void NPP_QWFlush(void)
|
|||
bufferlen = 0;
|
||||
protocollen=0;
|
||||
writedest = NULL;
|
||||
// case svc_finale:
|
||||
// case svc_finale:
|
||||
// bufferlen = 0;
|
||||
break;
|
||||
case svc_setview:
|
||||
|
@ -772,21 +754,21 @@ void NPP_QWFlush(void)
|
|||
case svc_muzzleflash:
|
||||
//we need to make a fake muzzleflash position.
|
||||
multicastpos = 4;
|
||||
{
|
||||
{
|
||||
short data;
|
||||
float org[3];
|
||||
edict_t *ent = EDICT_NUM(svprogfuncs, (*(short*)&buffer[1]));
|
||||
VectorCopy(ent->v->origin, org);
|
||||
|
||||
|
||||
data = LittleShort((short)(org[0]*8));
|
||||
NPP_AddData(&data, sizeof(short));
|
||||
data = LittleShort((short)(org[1]*8));
|
||||
NPP_AddData(&data, sizeof(short));
|
||||
data = LittleShort((short)(org[2]*8));
|
||||
NPP_AddData(&data, sizeof(short));
|
||||
|
||||
|
||||
}
|
||||
bufferlen = 0;
|
||||
bufferlen = 0; //can't send this to nq. :(
|
||||
break;
|
||||
case svc_smallkick:
|
||||
case svc_bigkick:
|
||||
|
@ -815,16 +797,23 @@ void NPP_QWFlush(void)
|
|||
case TE_BLOOD: //needs to be converted to a particle
|
||||
{
|
||||
vec3_t org;
|
||||
qbyte count;
|
||||
qbyte colour;
|
||||
char dir[3];
|
||||
short s;
|
||||
int v;
|
||||
int i;
|
||||
org[0] = (*(short*)&buffer[multicastpos])/8.0f;
|
||||
qbyte svc;
|
||||
svc = svc_particle;
|
||||
org[0] = (*(short*)&buffer[multicastpos])/8.0f;
|
||||
org[1] = (*(short*)&buffer[multicastpos+2])/8.0f;
|
||||
org[2] = (*(short*)&buffer[multicastpos+4])/8.0f;
|
||||
count = buffer[2]*20;
|
||||
if (minortype == TE_LIGHTNINGBLOOD)
|
||||
colour = 225;
|
||||
else
|
||||
colour = 73;
|
||||
|
||||
MSG_WriteByte (&sv.nqmulticast, svc_particle);
|
||||
MSG_WriteCoord (&sv.nqmulticast, org[0]);
|
||||
MSG_WriteCoord (&sv.nqmulticast, org[1]);
|
||||
MSG_WriteCoord (&sv.nqmulticast, org[2]);
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
v = 0*16;
|
||||
|
@ -832,19 +821,38 @@ void NPP_QWFlush(void)
|
|||
v = 127;
|
||||
else if (v < -128)
|
||||
v = -128;
|
||||
MSG_WriteChar (&sv.nqmulticast, v);
|
||||
dir[i] = v;
|
||||
}
|
||||
MSG_WriteByte (&sv.nqmulticast, buffer[2]*20);
|
||||
if (minortype == TE_LIGHTNINGBLOOD)
|
||||
MSG_WriteByte (&sv.nqmulticast, 225);
|
||||
else
|
||||
MSG_WriteByte (&sv.nqmulticast, 73);
|
||||
|
||||
bufferlen = 0; //restart
|
||||
protocollen = 1000;
|
||||
|
||||
multicastpos = 1;
|
||||
|
||||
NPP_AddData(&svc, sizeof(qbyte));
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
if (sizeofcoord == 4)
|
||||
NPP_AddData(&org[i], sizeof(float));
|
||||
else
|
||||
{
|
||||
s = org[i]*8;
|
||||
NPP_AddData(&s, sizeof(short));
|
||||
}
|
||||
}
|
||||
NPP_AddData(&dir[0], sizeof(char));
|
||||
NPP_AddData(&dir[1], sizeof(char));
|
||||
NPP_AddData(&dir[2], sizeof(char));
|
||||
NPP_AddData(&count, sizeof(qbyte));
|
||||
NPP_AddData(&colour, sizeof(qbyte));
|
||||
}
|
||||
bufferlen = 0;
|
||||
break;
|
||||
case TE_GUNSHOT: //needs qbyte 3 removed
|
||||
memmove(buffer+2, buffer+3, bufferlen-3);
|
||||
bufferlen--;
|
||||
case TE_GUNSHOT: //needs byte 3 removed
|
||||
if (bufferlen >= 3)
|
||||
{
|
||||
memmove(buffer+2, buffer+3, bufferlen-3);
|
||||
bufferlen--;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -908,7 +916,7 @@ void NPP_QWCheckDest(int dest)
|
|||
{
|
||||
if (dest == MSG_ONE)
|
||||
{
|
||||
client_t *cl = Write_GetClient();
|
||||
/*client_t *cl = Write_GetClient();
|
||||
if (!cl)
|
||||
{
|
||||
Con_Printf("Not a client\n");
|
||||
|
@ -920,13 +928,14 @@ void NPP_QWCheckDest(int dest)
|
|||
NPP_QWFlush();
|
||||
}
|
||||
cldest = cl;
|
||||
*/
|
||||
}
|
||||
else
|
||||
{
|
||||
sizebuf_t *ndest = NQWriteDest(dest);
|
||||
if (cldest || (writedest && writedest != ndest))
|
||||
{
|
||||
Con_Printf("MSG destination changed in the middle of a packet %i.\n", (int)*buffer);
|
||||
Con_Printf("QWCheckDest: MSG destination changed in the middle of a packet %i.\n", (int)*buffer);
|
||||
NPP_QWFlush();
|
||||
}
|
||||
writedest = ndest;
|
||||
|
@ -944,18 +953,19 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && ISQWCLIENT(cl))
|
||||
{
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(qbyte));
|
||||
ClientReliableWrite_Byte(cl, data);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
MSG_WriteByte (WriteDest(dest), data);
|
||||
MSG_WriteByte (QWWriteDest(dest), data);
|
||||
#endif
|
||||
if (!bufferlen) //new message section
|
||||
{
|
||||
{
|
||||
switch(data)
|
||||
{
|
||||
case svc_temp_entity:
|
||||
case svc_temp_entity:
|
||||
break;
|
||||
case svc_setangle:
|
||||
protocollen = sizeof(qbyte)*4;
|
||||
|
@ -1013,7 +1023,7 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
protocollen = 6;
|
||||
break;
|
||||
default:
|
||||
Con_Printf("bad protocol %i\n", (int)data);
|
||||
Con_Printf("QWWriteByte: bad protocol %i\n", (int)data);
|
||||
protocollen = sizeof(buffer);
|
||||
break;
|
||||
}
|
||||
|
@ -1033,7 +1043,7 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
multicastpos=4;
|
||||
multicasttype=MULTICAST_PHS;
|
||||
protocollen = sizeofcoord*6+sizeof(short)+sizeof(qbyte)*2;
|
||||
break;
|
||||
break;
|
||||
case TE_BLOOD: //needs to be converted to a particle
|
||||
case TE_GUNSHOT: //needs qbyte 2 removed
|
||||
multicastpos=3;
|
||||
|
@ -1064,12 +1074,12 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
break;
|
||||
default:
|
||||
protocollen = sizeof(buffer);
|
||||
Con_Printf("bad tempentity - %i\n", data);
|
||||
Con_Printf("QWWriteByte: bad tempentity - %i\n", data);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Con_Printf("Non-Implemented svc\n");
|
||||
Con_Printf("QWWriteByte: Non-Implemented svc\n");
|
||||
protocollen = sizeof(buffer);
|
||||
break;
|
||||
}
|
||||
|
@ -1084,144 +1094,87 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
|
||||
void NPP_QWWriteChar(int dest, char data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_QWCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(char));
|
||||
ClientReliableWrite_Char(cl, data);
|
||||
}
|
||||
} else
|
||||
MSG_WriteChar (WriteDest(dest), data);
|
||||
#endif
|
||||
|
||||
NPP_AddData(&data, sizeof(char));
|
||||
if (!data && bufferlen>=protocollen)
|
||||
if (nullterms)
|
||||
nullterms--;
|
||||
NPP_QWCheckFlush();
|
||||
NPP_QWWriteByte(dest, (qbyte)data);
|
||||
}
|
||||
|
||||
void NPP_QWWriteShort(int dest, short data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_QWCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
union {
|
||||
qbyte b[2];
|
||||
short s;
|
||||
} u;
|
||||
u.s = LittleShort(data);
|
||||
NPP_QWWriteByte(dest, u.b[0]);
|
||||
NPP_QWWriteByte(dest, u.b[1]);
|
||||
}
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(short));
|
||||
ClientReliableWrite_Short(cl, data);
|
||||
}
|
||||
} else
|
||||
MSG_WriteShort (WriteDest(dest), data);
|
||||
#endif
|
||||
|
||||
data = LittleShort(data);
|
||||
NPP_AddData(&data, sizeof(short));
|
||||
NPP_QWCheckFlush();
|
||||
void NPP_QWWriteFloat(int dest, float data) //replacement write func (nq to qw)
|
||||
{
|
||||
union {
|
||||
qbyte b[4];
|
||||
short f;
|
||||
} u;
|
||||
u.f = LittleFloat(data);
|
||||
NPP_QWWriteByte(dest, u.b[0]);
|
||||
NPP_QWWriteByte(dest, u.b[1]);
|
||||
NPP_QWWriteByte(dest, u.b[2]);
|
||||
NPP_QWWriteByte(dest, u.b[3]);
|
||||
}
|
||||
|
||||
void NPP_QWWriteLong(int dest, long data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_QWCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(long));
|
||||
ClientReliableWrite_Long(cl, data);
|
||||
}
|
||||
} else
|
||||
MSG_WriteLong (WriteDest(dest), data);
|
||||
#endif
|
||||
|
||||
data = LittleLong(data);
|
||||
NPP_AddData(&data, sizeof(long));
|
||||
NPP_QWCheckFlush();
|
||||
union {
|
||||
qbyte b[4];
|
||||
int l;
|
||||
} u;
|
||||
u.l = LittleLong(data);
|
||||
NPP_QWWriteByte(dest, u.b[0]);
|
||||
NPP_QWWriteByte(dest, u.b[1]);
|
||||
NPP_QWWriteByte(dest, u.b[2]);
|
||||
NPP_QWWriteByte(dest, u.b[3]);
|
||||
}
|
||||
void NPP_QWWriteAngle(int dest, float in) //replacement write func (nq to qw)
|
||||
{
|
||||
char data = (int)(in*256/360) & 255;
|
||||
NPP_QWCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(char));
|
||||
ClientReliableWrite_Angle(cl, in);
|
||||
}
|
||||
} else
|
||||
MSG_WriteAngle (WriteDest(dest), in);
|
||||
#endif
|
||||
|
||||
NPP_AddData(&data, sizeof(char));
|
||||
NPP_QWCheckFlush();
|
||||
if (sizeofangle==1)
|
||||
{
|
||||
char data = (int)(in*256/360) & 255;
|
||||
NPP_NQWriteChar(dest, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
short data = (int)(in*0xffff/360) & 0xffff;
|
||||
NPP_NQWriteShort(dest, data);
|
||||
}
|
||||
}
|
||||
void NPP_QWWriteCoord(int dest, float in) //replacement write func (nq to qw)
|
||||
{
|
||||
short datas = (int)(in*8);
|
||||
float dataf = in;
|
||||
if (sizeofcoord==4)
|
||||
{
|
||||
NPP_QWWriteFloat(dest, in);
|
||||
}
|
||||
else
|
||||
{
|
||||
short datas = (int)(in*8);
|
||||
NPP_QWWriteShort(dest, datas);
|
||||
}
|
||||
}
|
||||
void NPP_QWWriteString(int dest, char *data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_QWCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
Con_Printf("QWWriteString: Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(float));
|
||||
ClientReliableWrite_Coord(cl, in);
|
||||
}
|
||||
} else
|
||||
MSG_WriteCoord (WriteDest(dest), in);
|
||||
#endif
|
||||
|
||||
if (sizeofcoord==4)
|
||||
{
|
||||
dataf = LittleFloat(dataf);
|
||||
NPP_AddData(&dataf, sizeof(float));
|
||||
}
|
||||
else
|
||||
{
|
||||
datas = LittleShort(datas);
|
||||
NPP_AddData(&datas, sizeof(short));
|
||||
}
|
||||
NPP_QWCheckFlush();
|
||||
}
|
||||
void NPP_QWWriteString(int dest, char *data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_QWCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, strlen(data)+1);
|
||||
ClientReliableWrite_String(cl, data);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
MSG_WriteString (WriteDest(dest), data);
|
||||
MSG_WriteString (QWWriteDest(dest), data);
|
||||
#endif
|
||||
|
||||
NPP_AddData(data, strlen(data)+1);
|
||||
|
@ -1231,24 +1184,13 @@ void NPP_QWWriteString(int dest, char *data) //replacement write func (nq to qw)
|
|||
}
|
||||
void NPP_QWWriteEntity(int dest, short data) //replacement write func (nq to qw)
|
||||
{
|
||||
NPP_QWCheckDest(dest);
|
||||
if (!bufferlen)
|
||||
Con_Printf("Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
client_t *cl = Write_GetClient();
|
||||
if (cl && ISQWCLIENT(cl))
|
||||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(short));
|
||||
ClientReliableWrite_Short(cl, data);
|
||||
}
|
||||
} else
|
||||
MSG_WriteShort (WriteDest(dest), data);
|
||||
#endif
|
||||
|
||||
NPP_AddData(&data, sizeof(short));
|
||||
NPP_QWCheckFlush();
|
||||
union {
|
||||
qbyte b[2];
|
||||
short s;
|
||||
} u;
|
||||
u.s = LittleShort(data);
|
||||
NPP_QWWriteByte(dest, u.b[0]);
|
||||
NPP_QWWriteByte(dest, u.b[1]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1479,7 +1421,7 @@ void NPP_MVDFlush(void)
|
|||
{ //new entity, reset to baseline
|
||||
memcpy(ents, &sv.demobaselines[entnum], sizeof(mvdentity_state_t));
|
||||
}
|
||||
|
||||
|
||||
if (s & U_MOREBITS)
|
||||
{
|
||||
s |= buffer[i];
|
||||
|
@ -1491,7 +1433,7 @@ void NPP_MVDFlush(void)
|
|||
ents->modelindex = buffer[i];
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
if (s & U_FRAME)
|
||||
{
|
||||
ents->frame = buffer[i];
|
||||
|
@ -1521,7 +1463,7 @@ void NPP_MVDFlush(void)
|
|||
ents->origin[0] = (short)(buffer[i]+buffer[i+1]*256) /8.0f;
|
||||
i+=2;
|
||||
}
|
||||
|
||||
|
||||
if (s & U_ANGLE1)
|
||||
{
|
||||
ents->angles[0] = (unsigned char)(buffer[i]);// * (360.0/256);
|
||||
|
@ -1533,7 +1475,7 @@ void NPP_MVDFlush(void)
|
|||
ents->origin[1] = (short)(buffer[i]+buffer[i+1]*256) /8.0f;
|
||||
i+=2;
|
||||
}
|
||||
|
||||
|
||||
if (s & U_ANGLE2)
|
||||
{
|
||||
ents->angles[1] = (unsigned char)(buffer[i]);// * (360.0/256);
|
||||
|
@ -1545,7 +1487,7 @@ void NPP_MVDFlush(void)
|
|||
ents->origin[2] = (short)(buffer[i]+buffer[i+1]*256) /8.0f;
|
||||
i+=2;
|
||||
}
|
||||
|
||||
|
||||
if (s & U_ANGLE3)
|
||||
{
|
||||
ents->angles[2] = (unsigned char)(buffer[i]);// * (360.0/256);
|
||||
|
@ -1746,7 +1688,7 @@ void NPP_MVDFlush(void)
|
|||
writedest = &sv.multicast;
|
||||
multicasttype = MULTICAST_ALL_R;
|
||||
}
|
||||
|
||||
|
||||
if (bufferlen)
|
||||
SZ_Write(writedest, buffer, bufferlen);
|
||||
|
||||
|
@ -1822,7 +1764,7 @@ void NPP_MVDWriteByte(qbyte data, client_t *to, int broadcast) //replacement wri
|
|||
NPP_MVDCheckDest(to, broadcast);
|
||||
|
||||
if (!bufferlen) //new message section
|
||||
{
|
||||
{
|
||||
switch(data)
|
||||
{
|
||||
case svc_temp_entity://depends on following bytes
|
||||
|
@ -1830,7 +1772,7 @@ void NPP_MVDWriteByte(qbyte data, client_t *to, int broadcast) //replacement wri
|
|||
case svc_serverinfo:
|
||||
case svc_print:
|
||||
case svc_sound:
|
||||
case svc_serverdata:
|
||||
case svc_serverdata:
|
||||
case svc_stufftext:
|
||||
case svc_modellist:
|
||||
case svc_soundlist:
|
||||
|
@ -1938,7 +1880,7 @@ void NPP_MVDWriteByte(qbyte data, client_t *to, int broadcast) //replacement wri
|
|||
multicastpos=4;
|
||||
multicasttype=MULTICAST_PHS;
|
||||
protocollen = sizeof(short)*6+sizeof(short)+sizeof(qbyte)*2;
|
||||
break;
|
||||
break;
|
||||
case TE_BLOOD: //needs to be converted to a particle
|
||||
case TE_GUNSHOT: //needs qbyte 2 removed
|
||||
multicastpos=3;
|
||||
|
@ -1961,7 +1903,7 @@ void NPP_MVDWriteByte(qbyte data, client_t *to, int broadcast) //replacement wri
|
|||
multicastpos=2;
|
||||
multicasttype=MULTICAST_PVS;
|
||||
protocollen = sizeof(short)*3+sizeof(qbyte)*2;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
protocollen = sizeof(buffer);
|
||||
Con_Printf("bad tempentity\n");
|
||||
|
@ -2015,7 +1957,7 @@ void NPP_MVDWriteByte(qbyte data, client_t *to, int broadcast) //replacement wri
|
|||
for (j=0 ; j<3 ; j++)
|
||||
if (pflags & (DF_ORIGIN << j))
|
||||
protocollen += 2;
|
||||
|
||||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
if (pflags & (DF_ANGLES << j))
|
||||
protocollen += 2;
|
||||
|
@ -2093,7 +2035,7 @@ void NPP_MVDWriteByte(qbyte data, client_t *to, int broadcast) //replacement wri
|
|||
|
||||
if (s & U_MODEL)
|
||||
i++;
|
||||
|
||||
|
||||
if (s & U_FRAME)
|
||||
i++;
|
||||
|
||||
|
@ -2108,19 +2050,19 @@ void NPP_MVDWriteByte(qbyte data, client_t *to, int broadcast) //replacement wri
|
|||
|
||||
if (s & U_ORIGIN1)
|
||||
i+=2;
|
||||
|
||||
|
||||
if (s & U_ANGLE1)
|
||||
i++;
|
||||
|
||||
if (s & U_ORIGIN2)
|
||||
i+=2;
|
||||
|
||||
|
||||
if (s & U_ANGLE2)
|
||||
i++;
|
||||
|
||||
if (s & U_ORIGIN3)
|
||||
i+=2;
|
||||
|
||||
|
||||
if (s & U_ANGLE3)
|
||||
i++;
|
||||
}
|
||||
|
@ -2214,4 +2156,14 @@ void NPP_MVDWriteByte(qbyte data, client_t *to, int broadcast) //replacement wri
|
|||
NPP_MVDCheckFlush();
|
||||
}
|
||||
|
||||
|
||||
void NPP_Flush(void)
|
||||
{
|
||||
if (progstype == PROG_NQ)
|
||||
NPP_NQFlush();
|
||||
#ifdef NQPROT
|
||||
else
|
||||
NPP_QWFlush();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -4190,7 +4190,7 @@ MESSAGE WRITING
|
|||
#define MSG_INIT 3 // write to the init string
|
||||
#define MSG_MULTICAST 4 // for multicast()
|
||||
|
||||
sizebuf_t *WriteDest (int dest)
|
||||
sizebuf_t *QWWriteDest (int dest)
|
||||
{
|
||||
switch (dest)
|
||||
{
|
||||
|
@ -4337,7 +4337,7 @@ void PF_WriteByte (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
ClientReliableWrite_Byte(cl, G_FLOAT(OFS_PARM1));
|
||||
}
|
||||
else
|
||||
MSG_WriteByte (WriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteByte (QWWriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4374,7 +4374,7 @@ void PF_WriteChar (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
ClientReliableWrite_Char(cl, G_FLOAT(OFS_PARM1));
|
||||
}
|
||||
else
|
||||
MSG_WriteChar (WriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteChar (QWWriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4393,13 +4393,13 @@ void PF_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
pr_netglob = pr_globals;
|
||||
if (progstype == PROG_NQ || progstype == PROG_H2)
|
||||
{
|
||||
NPP_NQWriteShort(G_FLOAT(OFS_PARM0), (short)G_FLOAT(OFS_PARM1));
|
||||
NPP_NQWriteShort(G_FLOAT(OFS_PARM0), (int)G_FLOAT(OFS_PARM1));
|
||||
return;
|
||||
}
|
||||
#ifdef NQPROT
|
||||
else
|
||||
{
|
||||
NPP_QWWriteShort(G_FLOAT(OFS_PARM0), (short)G_FLOAT(OFS_PARM1));
|
||||
NPP_QWWriteShort(G_FLOAT(OFS_PARM0), (int)G_FLOAT(OFS_PARM1));
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -4412,7 +4412,7 @@ void PF_WriteShort (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
ClientReliableWrite_Short(cl, G_FLOAT(OFS_PARM1));
|
||||
}
|
||||
else
|
||||
MSG_WriteShort (WriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteShort (QWWriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4450,7 +4450,7 @@ void PF_WriteLong (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
ClientReliableWrite_Long(cl, G_FLOAT(OFS_PARM1));
|
||||
}
|
||||
else
|
||||
MSG_WriteLong (WriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteLong (QWWriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4487,7 +4487,7 @@ void PF_WriteAngle (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
ClientReliableWrite_Angle(cl, G_FLOAT(OFS_PARM1));
|
||||
}
|
||||
else
|
||||
MSG_WriteAngle (WriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteAngle (QWWriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4525,7 +4525,7 @@ void PF_WriteCoord (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
ClientReliableWrite_Coord(cl, G_FLOAT(OFS_PARM1));
|
||||
}
|
||||
else
|
||||
MSG_WriteCoord (WriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
MSG_WriteCoord (QWWriteDest(G_FLOAT(OFS_PARM0)), G_FLOAT(OFS_PARM1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4564,7 +4564,7 @@ void PF_WriteString (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
ClientReliableWrite_String(cl, str);
|
||||
}
|
||||
else
|
||||
MSG_WriteString (WriteDest(G_FLOAT(OFS_PARM0)), str);
|
||||
MSG_WriteString (QWWriteDest(G_FLOAT(OFS_PARM0)), str);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4584,13 +4584,13 @@ void PF_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
pr_netglob = pr_globals;
|
||||
if (progstype == PROG_NQ || progstype == PROG_H2)
|
||||
{
|
||||
NPP_NQWriteEntity(G_FLOAT(OFS_PARM0), (short)G_EDICTNUM(prinst, OFS_PARM1));
|
||||
NPP_NQWriteEntity(G_FLOAT(OFS_PARM0), G_EDICTNUM(prinst, OFS_PARM1));
|
||||
return;
|
||||
}
|
||||
#ifdef NQPROT
|
||||
else
|
||||
{
|
||||
NPP_QWWriteEntity(G_FLOAT(OFS_PARM0), (short)G_EDICTNUM(prinst, OFS_PARM1));
|
||||
NPP_QWWriteEntity(G_FLOAT(OFS_PARM0), G_EDICTNUM(prinst, OFS_PARM1));
|
||||
return;
|
||||
}
|
||||
#else
|
||||
|
@ -4603,7 +4603,7 @@ void PF_WriteEntity (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
ClientReliableWrite_Short(cl, G_EDICTNUM(prinst, OFS_PARM1));
|
||||
}
|
||||
else
|
||||
MSG_WriteShort (WriteDest(G_FLOAT(OFS_PARM0)), G_EDICTNUM(prinst, OFS_PARM1));
|
||||
MSG_WriteShort (QWWriteDest(G_FLOAT(OFS_PARM0)), G_EDICTNUM(prinst, OFS_PARM1));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -4745,7 +4745,9 @@ void SV_point_tempentity (vec3_t o, int type, int count) //count (usually 1) is
|
|||
SV_Error("SV_point_tempentity - type is a beam\n");
|
||||
default:
|
||||
MSG_WriteByte (&sv.multicast, type);
|
||||
#ifdef NQPROT
|
||||
MSG_WriteByte (&sv.nqmulticast, type);
|
||||
#endif
|
||||
}
|
||||
MSG_WriteCoord (&sv.multicast, o[0]);
|
||||
MSG_WriteCoord (&sv.multicast, o[1]);
|
||||
|
@ -4927,7 +4929,8 @@ void PF_setspawnparms (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
client = svs.clients + (i-1);
|
||||
|
||||
for (i=0 ; i< NUM_SPAWN_PARMS ; i++)
|
||||
*spawnparamglobals[i] = client->spawn_parms[i];
|
||||
if (spawnparamglobals[i])
|
||||
*spawnparamglobals[i] = client->spawn_parms[i];
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5100,7 +5103,6 @@ void(vector where, float set) multicast
|
|||
*/
|
||||
void PF_multicast (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
#if !defined(NQPROT) && !defined(PREPARSE) //these make multicasts issue when message is compleate, making the multicast builtin useless.
|
||||
float *o;
|
||||
int to;
|
||||
|
||||
|
@ -5108,7 +5110,6 @@ void PF_multicast (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
to = G_FLOAT(OFS_PARM1);
|
||||
|
||||
SV_Multicast (o, to);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -7333,13 +7334,21 @@ void PF_plaque_draw(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
}
|
||||
else
|
||||
{
|
||||
MSG_WriteByte (WriteDest(G_FLOAT(OFS_PARM0)), svc_centerprint);
|
||||
MSG_WriteByte (QWWriteDest(G_FLOAT(OFS_PARM0)), svc_centerprint);
|
||||
if (*s)
|
||||
{
|
||||
MSG_WriteByte (WriteDest(G_FLOAT(OFS_PARM0)), '/');
|
||||
MSG_WriteByte (WriteDest(G_FLOAT(OFS_PARM0)), 'P');
|
||||
MSG_WriteByte (QWWriteDest(G_FLOAT(OFS_PARM0)), '/');
|
||||
MSG_WriteByte (QWWriteDest(G_FLOAT(OFS_PARM0)), 'P');
|
||||
}
|
||||
MSG_WriteString (WriteDest(G_FLOAT(OFS_PARM0)), s);
|
||||
MSG_WriteString (QWWriteDest(G_FLOAT(OFS_PARM0)), s);
|
||||
|
||||
MSG_WriteByte (NQWriteDest(G_FLOAT(OFS_PARM0)), svc_centerprint);
|
||||
if (*s)
|
||||
{
|
||||
MSG_WriteByte (NQWriteDest(G_FLOAT(OFS_PARM0)), '/');
|
||||
MSG_WriteByte (NQWriteDest(G_FLOAT(OFS_PARM0)), 'P');
|
||||
}
|
||||
MSG_WriteString (NQWriteDest(G_FLOAT(OFS_PARM0)), s);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ extern cvar_t deathmatch;
|
|||
extern cvar_t coop;
|
||||
extern cvar_t teamplay;
|
||||
|
||||
//Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
|
||||
//Writes a SAVEGAME_COMMENT_LENGTH character comment describing the current
|
||||
void SV_SavegameComment (char *text)
|
||||
{
|
||||
int i;
|
||||
|
@ -30,11 +30,13 @@ void SV_SavegameComment (char *text)
|
|||
i = SAVEGAME_COMMENT_LENGTH;
|
||||
memcpy (text, mapname, i);
|
||||
}
|
||||
#ifdef Q2SERVER
|
||||
if (ge) //q2
|
||||
{
|
||||
sprintf (kills,"");
|
||||
}
|
||||
else
|
||||
#endif
|
||||
sprintf (kills,"kills:%3i/%3i", (int)pr_global_struct->killed_monsters, (int)pr_global_struct->total_monsters);
|
||||
memcpy (text+22, kills, strlen(kills));
|
||||
// convert space to _ to make stdio happy
|
||||
|
@ -105,7 +107,7 @@ void SV_Savegame_f (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fprintf (f, "%i\n", version);
|
||||
SV_SavegameComment (comment);
|
||||
fprintf (f, "%s\n", comment);
|
||||
|
@ -200,7 +202,7 @@ void SV_Loadgame_f(void)
|
|||
|
||||
sprintf (filename, "%s/saves/%s", com_gamedir, Cmd_Argv(1));
|
||||
COM_DefaultExtension (filename, ".sav");
|
||||
|
||||
|
||||
// we can't call SCR_BeginLoadingPlaque, because too much stack space has
|
||||
// been used. The menu calls it before stuffing loadgame command
|
||||
// SCR_BeginLoadingPlaque ();
|
||||
|
@ -232,7 +234,7 @@ void SV_Loadgame_f(void)
|
|||
else
|
||||
Con_Printf("loading FTE saved game\n");
|
||||
|
||||
|
||||
|
||||
|
||||
for (clnum = 0; clnum < MAX_CLIENTS; clnum++) //clear the server for the level change.
|
||||
{
|
||||
|
@ -295,7 +297,7 @@ void SV_Loadgame_f(void)
|
|||
strcpy(cl->name, com_token);
|
||||
cl->state = cs_zombie;
|
||||
cl->connection_started = realtime+20;
|
||||
cl->istobeloaded = true;
|
||||
cl->istobeloaded = true;
|
||||
|
||||
for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
|
||||
fscanf (f, "%f\n", &cl->spawn_parms[i]);
|
||||
|
@ -346,8 +348,8 @@ void SV_Loadgame_f(void)
|
|||
Cvar_SetValue ("teamplay", tfloat);
|
||||
}
|
||||
fscanf (f, "%s\n",mapname);
|
||||
fscanf (f, "%f\n",&time);
|
||||
|
||||
fscanf (f, "%f\n",&time);
|
||||
|
||||
SV_SpawnServer (mapname, NULL, false, false); //always inits MAX_CLIENTS slots. That's okay, because we can cut the max easily.
|
||||
if (sv.state != ss_active)
|
||||
{
|
||||
|
@ -385,7 +387,7 @@ void SV_Loadgame_f(void)
|
|||
progstype = pt; //presumably the progs.dat will be what they were before.
|
||||
}
|
||||
|
||||
filepos = ftell(f);
|
||||
filepos = ftell(f);
|
||||
fseek(f, 0, SEEK_END);
|
||||
filelen = ftell(f);
|
||||
fseek(f, filepos, SEEK_SET);
|
||||
|
@ -394,7 +396,7 @@ void SV_Loadgame_f(void)
|
|||
memset(file, 0, filelen+1+8);
|
||||
strcpy(file, "loadgame");
|
||||
clnum=fread(file+8, 1, filelen, f);
|
||||
file[filelen+8]='\0';
|
||||
file[filelen+8]='\0';
|
||||
pr_edict_size=svprogfuncs->load_ents(svprogfuncs, file, 0);
|
||||
BZ_Free(file);
|
||||
|
||||
|
@ -512,7 +514,7 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers)
|
|||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// we can't call SCR_BeginLoadingPlaque, because too much stack space has
|
||||
// been used. The menu calls it before stuffing loadgame command
|
||||
// SCR_BeginLoadingPlaque ();
|
||||
|
@ -551,8 +553,8 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers)
|
|||
Cvar_SetValue (&teamplay, tfloat);
|
||||
|
||||
fscanf (f, "%s\n",mapname);
|
||||
fscanf (f, "%f\n",&time);
|
||||
|
||||
fscanf (f, "%f\n",&time);
|
||||
|
||||
SV_SpawnServer (mapname, startspot, false, false);
|
||||
if (svs.gametype != gametype)
|
||||
{
|
||||
|
@ -589,7 +591,7 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers)
|
|||
PR_RegisterFields();
|
||||
PR_InitEnts(svprogfuncs, sv.max_edicts);
|
||||
|
||||
filepos = ftell(f);
|
||||
filepos = ftell(f);
|
||||
fseek(f, 0, SEEK_END);
|
||||
filelen = ftell(f);
|
||||
fseek(f, filepos, SEEK_SET);
|
||||
|
@ -597,7 +599,7 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers)
|
|||
file = BZ_Malloc(filelen+1);
|
||||
memset(file, 0, filelen+1);
|
||||
clnum=fread(file, 1, filelen, f);
|
||||
file[filelen]='\0';
|
||||
file[filelen]='\0';
|
||||
pr_edict_size=svprogfuncs->load_ents(svprogfuncs, file, 0);
|
||||
BZ_Free(file);
|
||||
|
||||
|
@ -626,7 +628,7 @@ qboolean SV_LoadLevelCache(char *level, char *startspot, qboolean ignoreplayers)
|
|||
if (eval)
|
||||
for (i=0 ; i<MAX_CLIENTS ; i++)
|
||||
{
|
||||
if (svs.clients[i].spawninfo)
|
||||
if (svs.clients[i].spawninfo)
|
||||
{
|
||||
globalvars_t *pr_globals = PR_globals(svprogfuncs, PR_CURRENT);
|
||||
ent = svs.clients[i].edict;
|
||||
|
@ -694,7 +696,7 @@ void SV_SaveLevelCache(qboolean dontharmgame)
|
|||
svs.levcache = cache;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sprintf (name, "%s/saves/%s", com_gamedir, cache->mapname);
|
||||
COM_DefaultExtension (name, ".lvc");
|
||||
|
||||
|
@ -1024,7 +1026,7 @@ void SV_Loadgame_f (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
fgets(str, sizeof(str)-1, f);
|
||||
for (trim = str+strlen(str)-1; trim>=str && *trim <= ' '; trim--)
|
||||
*trim='\0';
|
||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
|
@ -80,9 +80,9 @@ client_t *SV_GetClientForString(char *name, int *id)
|
|||
return cl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = first, cl = svs.clients+first; i < sv.allocated_client_slots; i++, cl++)
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ void SV_God_f (void)
|
|||
if ((int)sv_player->v->flags & FL_GODMODE)
|
||||
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_GODON);
|
||||
else
|
||||
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_GODOFF);
|
||||
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_GODOFF);
|
||||
}
|
||||
|
||||
|
||||
|
@ -330,13 +330,13 @@ void SV_Give_f (void)
|
|||
{
|
||||
char *t;
|
||||
int v;
|
||||
|
||||
|
||||
if (!sv_allow_cheats)
|
||||
{
|
||||
Con_TPrintf (STL_NEEDCHEATPARM);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!SV_SetPlayer ())
|
||||
{
|
||||
int oldself;
|
||||
|
@ -352,7 +352,7 @@ void SV_Give_f (void)
|
|||
|
||||
t = Cmd_Argv(2);
|
||||
v = atoi (Cmd_Argv(3));
|
||||
|
||||
|
||||
switch (t[0])
|
||||
{
|
||||
case '2':
|
||||
|
@ -365,19 +365,19 @@ void SV_Give_f (void)
|
|||
case '9':
|
||||
sv_player->v->items = (int)sv_player->v->items | IT_SHOTGUN<< (t[0] - '2');
|
||||
break;
|
||||
|
||||
|
||||
case 's':
|
||||
sv_player->v->ammo_shells = v;
|
||||
break;
|
||||
break;
|
||||
case 'n':
|
||||
sv_player->v->ammo_nails = v;
|
||||
break;
|
||||
break;
|
||||
case 'r':
|
||||
sv_player->v->ammo_rockets = v;
|
||||
break;
|
||||
break;
|
||||
case 'h':
|
||||
sv_player->v->health = v;
|
||||
break;
|
||||
break;
|
||||
case 'c':
|
||||
sv_player->v->ammo_cells = v;
|
||||
break;
|
||||
|
@ -408,7 +408,7 @@ void SV_MapList_f(void)
|
|||
======================
|
||||
SV_Map_f
|
||||
|
||||
handle a
|
||||
handle a
|
||||
map <mapname>
|
||||
command from the console or progs.
|
||||
======================
|
||||
|
@ -459,7 +459,7 @@ void SV_Map_f (void)
|
|||
startspot = NULL;
|
||||
|
||||
if (!strcmp(level, ".")) //restart current
|
||||
{
|
||||
{
|
||||
COM_StripExtension(COM_SkipPath(sv.modelname), level);
|
||||
issamelevel = true;
|
||||
|
||||
|
@ -505,6 +505,7 @@ void SV_Map_f (void)
|
|||
|
||||
if (startspot && !issamelevel && !newunit)
|
||||
{
|
||||
#ifdef Q2SERVER
|
||||
if (ge)
|
||||
{
|
||||
qboolean savedinuse[MAX_CLIENTS];
|
||||
|
@ -520,6 +521,7 @@ void SV_Map_f (void)
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
SV_SaveLevelCache(false);
|
||||
}
|
||||
|
||||
|
@ -534,7 +536,7 @@ void SV_Map_f (void)
|
|||
|
||||
#ifndef SERVERONLY
|
||||
S_StopAllSounds (true);
|
||||
SCR_BeginLoadingPlaque();
|
||||
SCR_BeginLoadingPlaque();
|
||||
#endif
|
||||
|
||||
if (newunit || !startspot || !SV_LoadLevelCache(level, startspot, false))
|
||||
|
@ -571,7 +573,7 @@ Kick a user off of the server
|
|||
==================
|
||||
*/
|
||||
void SV_Kick_f (void)
|
||||
{
|
||||
{
|
||||
client_t *cl;
|
||||
int clnum=-1;
|
||||
|
||||
|
@ -581,8 +583,8 @@ void SV_Kick_f (void)
|
|||
// print directly, because the dropped client won't get the
|
||||
// SV_BroadcastPrintf message
|
||||
SV_ClientTPrintf (cl, PRINT_HIGH, STL_YOUWEREKICKED);
|
||||
SV_DropClient (cl);
|
||||
}
|
||||
SV_DropClient (cl);
|
||||
}
|
||||
|
||||
if (clnum == -1)
|
||||
Con_TPrintf (STL_USERDOESNTEXIST, Cmd_Argv(1));
|
||||
|
@ -639,7 +641,7 @@ void SV_BanName_f (void)
|
|||
}
|
||||
else
|
||||
Con_Printf("User is not using an account\n");
|
||||
SV_DropClient (cl);
|
||||
SV_DropClient (cl);
|
||||
}
|
||||
|
||||
if (clnum == -1)
|
||||
|
@ -696,7 +698,7 @@ void SV_CripplePlayer_f (void)
|
|||
{
|
||||
cl->iscrippled = false;
|
||||
SV_ClientTPrintf (cl, PRINT_HIGH, STL_YOUARNTCRIPPLED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clnum == -1)
|
||||
|
@ -931,7 +933,7 @@ void SV_Status_f (void)
|
|||
Con_Printf ("%6i %5i", cl->userid, (int)cl->old_frags);
|
||||
if (cl->spectator)
|
||||
Con_Printf(" (s)\n");
|
||||
else
|
||||
else
|
||||
Con_Printf("\n");
|
||||
|
||||
s = NET_BaseAdrToString ( cl->netchan.remote_address);
|
||||
|
@ -970,7 +972,7 @@ void SV_Status_f (void)
|
|||
l = 16 - strlen(s);
|
||||
for (j=0 ; j<l ; j++)
|
||||
Con_Printf (" ");
|
||||
|
||||
|
||||
Con_Printf ("%s", cl->name);
|
||||
l = 16 - strlen(cl->name);
|
||||
for (j=0 ; j<l ; j++)
|
||||
|
@ -995,10 +997,10 @@ void SV_Status_f (void)
|
|||
}
|
||||
if (cl->spectator)
|
||||
Con_Printf(" (s)\n");
|
||||
else
|
||||
else
|
||||
Con_Printf("\n");
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Con_Printf ("\n");
|
||||
|
@ -1145,12 +1147,12 @@ void SV_Serverinfo_f (void)
|
|||
|
||||
Info_SetValueForKey (svs.info, Cmd_Argv(1), value, MAX_SERVERINFO_STRING);
|
||||
|
||||
// if this is a cvar, change it too
|
||||
// if this is a cvar, change it too
|
||||
var = Cvar_FindVar (Cmd_Argv(1));
|
||||
if (var)
|
||||
{
|
||||
Cvar_Set(var, value);
|
||||
/* Z_Free (var->string); // free the old value string
|
||||
/* Z_Free (var->string); // free the old value string
|
||||
var->string = CopyString (value);
|
||||
var->value = Q_atof (var->string);
|
||||
*/ }
|
||||
|
@ -1262,11 +1264,11 @@ Sets the gamedir and path to a different directory.
|
|||
void SV_Floodprot_f (void)
|
||||
{
|
||||
int arg1, arg2, arg3;
|
||||
|
||||
|
||||
if (Cmd_Argc() == 1)
|
||||
{
|
||||
if (fp_messages) {
|
||||
Con_TPrintf (STL_FLOODPROTSETTINGS,
|
||||
Con_TPrintf (STL_FLOODPROTSETTINGS,
|
||||
fp_messages, fp_persecond, fp_secondsdead);
|
||||
return;
|
||||
} else
|
||||
|
@ -1287,7 +1289,7 @@ void SV_Floodprot_f (void)
|
|||
Con_TPrintf (STL_NONEGATIVEVALUES);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (arg1 > 10) {
|
||||
Con_TPrintf (STL_TRACK10PLUSSMESSAGES);
|
||||
return;
|
||||
|
@ -1309,7 +1311,7 @@ void SV_Floodprotmsg_f (void)
|
|||
}
|
||||
sprintf(fp_msg, "%s", Cmd_Argv(1));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -1392,7 +1394,7 @@ SV_Snap
|
|||
void SV_Snap (int uid)
|
||||
{
|
||||
client_t *cl;
|
||||
char pcxname[80];
|
||||
char pcxname[80];
|
||||
char checkname[MAX_OSPATH];
|
||||
int i;
|
||||
|
||||
|
@ -1418,16 +1420,16 @@ void SV_Snap (int uid)
|
|||
sprintf(checkname, "%s/snap", gamedirfile);
|
||||
Sys_mkdir(gamedirfile);
|
||||
Sys_mkdir(checkname);
|
||||
|
||||
for (i=0 ; i<=99 ; i++)
|
||||
{
|
||||
pcxname[strlen(pcxname) - 6] = i/10 + '0';
|
||||
pcxname[strlen(pcxname) - 5] = i%10 + '0';
|
||||
|
||||
for (i=0 ; i<=99 ; i++)
|
||||
{
|
||||
pcxname[strlen(pcxname) - 6] = i/10 + '0';
|
||||
pcxname[strlen(pcxname) - 5] = i%10 + '0';
|
||||
sprintf (checkname, "%s/snap/%s", gamedirfile, pcxname);
|
||||
if (Sys_FileTime(checkname) == -1)
|
||||
break; // file doesn't exist
|
||||
}
|
||||
if (i==100)
|
||||
}
|
||||
if (i==100)
|
||||
{
|
||||
Con_TPrintf (STL_SNAPTOOMANYFILES);
|
||||
return;
|
||||
|
@ -1619,7 +1621,7 @@ void SV_InitOperatorCommands (void)
|
|||
|
||||
Cmd_AddCommand ("heartbeat", SV_Heartbeat_f);
|
||||
|
||||
Cmd_AddCommand ("localinfo", SV_Localinfo_f);
|
||||
Cmd_AddCommand ("localinfo", SV_Localinfo_f);
|
||||
Cmd_AddCommand ("gamedir", SV_Gamedir_f);
|
||||
Cmd_AddCommand ("sv_gamedir", SV_Gamedir);
|
||||
Cmd_AddCommand ("floodprot", SV_Floodprot_f);
|
||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
|
@ -48,7 +48,7 @@ SV_ModelIndex
|
|||
int SV_ModelIndex (char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (!name || !name[0])
|
||||
return 0;
|
||||
|
||||
|
@ -73,7 +73,7 @@ int SV_ModelIndex (char *name)
|
|||
int SV_SafeModelIndex (char *name)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (!name || !name[0])
|
||||
return 0;
|
||||
|
||||
|
@ -134,8 +134,8 @@ baseline will be transmitted
|
|||
{
|
||||
int i;
|
||||
edict_t *svent;
|
||||
int entnum;
|
||||
|
||||
int entnum;
|
||||
|
||||
for (entnum = 0; entnum < sv.num_edicts ; entnum++)
|
||||
{
|
||||
svent = EDICT_NUM(entnum);
|
||||
|
@ -180,7 +180,7 @@ baseline will be transmitted
|
|||
//
|
||||
// add to the message
|
||||
//
|
||||
MSG_WriteByte (&sv.signon,svc_spawnbaseline);
|
||||
MSG_WriteByte (&sv.signon,svc_spawnbaseline);
|
||||
MSG_WriteShort (&sv.signon,entnum);
|
||||
|
||||
MSG_WriteByte (&sv.signon, svent->baseline.modelindex);
|
||||
|
@ -198,10 +198,10 @@ baseline will be transmitted
|
|||
void SVNQ_CreateBaseline (void)
|
||||
{
|
||||
edict_t *svent;
|
||||
int entnum;
|
||||
int entnum;
|
||||
|
||||
int playermodel = SV_SafeModelIndex("progs/player.mdl");
|
||||
|
||||
|
||||
for (entnum = 0; entnum < sv.num_edicts ; entnum++)
|
||||
{
|
||||
svent = EDICT_NUM(svprogfuncs, entnum);
|
||||
|
@ -253,7 +253,7 @@ void SVNQ_CreateBaseline (void)
|
|||
================
|
||||
SV_SaveSpawnparms
|
||||
|
||||
Grabs the current state of the progs serverinfo flags
|
||||
Grabs the current state of the progs serverinfo flags
|
||||
and each client for saving across the
|
||||
transition to another level
|
||||
================
|
||||
|
@ -290,7 +290,7 @@ void SV_SaveSpawnparms (qboolean dontsave)
|
|||
char *buf;
|
||||
for (j=0 ; j<NUM_SPAWN_PARMS ; j++)
|
||||
host_client->spawn_parms[j] = 0;
|
||||
|
||||
|
||||
buf = svprogfuncs->saveent(svprogfuncs, buffer, &bufsize, host_client->edict);
|
||||
|
||||
if (host_client->spawninfo)
|
||||
|
@ -307,7 +307,7 @@ void SV_SaveSpawnparms (qboolean dontsave)
|
|||
{
|
||||
if (spawnparamglobals[j])
|
||||
host_client->spawn_parms[j] = *spawnparamglobals[j];
|
||||
else
|
||||
else
|
||||
host_client->spawn_parms[j] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -498,7 +498,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
int spawnflagmask;
|
||||
|
||||
#ifndef SERVERONLY
|
||||
if (!isDedicated && !qrenderer)
|
||||
if (!isDedicated && (!qrenderer || qrenderer == -1))
|
||||
{
|
||||
R_RestartRenderer_f();
|
||||
}
|
||||
|
@ -603,7 +603,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
|
||||
sv.nqreliable_datagram.maxsize = sizeof(sv.nqreliable_datagram_buf);
|
||||
sv.nqreliable_datagram.data = sv.nqreliable_datagram_buf;
|
||||
|
||||
|
||||
sv.nqmulticast.maxsize = sizeof(sv.nqmulticast_buf);
|
||||
sv.nqmulticast.data = sv.nqmulticast_buf;
|
||||
#endif
|
||||
|
@ -614,13 +614,13 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
|
||||
sv.q2reliable_datagram.maxsize = sizeof(sv.q2reliable_datagram_buf);
|
||||
sv.q2reliable_datagram.data = sv.q2reliable_datagram_buf;
|
||||
|
||||
|
||||
sv.q2multicast.maxsize = sizeof(sv.q2multicast_buf);
|
||||
sv.q2multicast.data = sv.q2multicast_buf;
|
||||
|
||||
sv.master.maxsize = sizeof(sv.master_buf);
|
||||
sv.master.data = sv.master_buf;
|
||||
|
||||
|
||||
sv.signon.maxsize = sizeof(sv.signon_buffers[0]);
|
||||
sv.signon.data = sv.signon_buffers[0];
|
||||
sv.num_signon_buffers = 1;
|
||||
|
@ -794,6 +794,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
sv.model_player_checksum = SV_CheckModel("progs/player.mdl");
|
||||
sv.eyes_player_checksum = SV_CheckModel("progs/eyes.mdl");
|
||||
}
|
||||
#ifdef Q2SERVER
|
||||
else if (svs.gametype == GT_QUAKE2)
|
||||
{
|
||||
memset(sv.configstring, 0, sizeof(sv.configstring));
|
||||
|
@ -804,6 +805,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
sv.models[i+1] = Mod_ForName (localmodels[i], false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -823,7 +825,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
case GT_PROGS:
|
||||
ent = EDICT_NUM(svprogfuncs, 0);
|
||||
ent->isfree = false;
|
||||
|
||||
|
||||
// leave slots at start for clients only
|
||||
// sv.num_edicts = MAX_CLIENTS+1;
|
||||
for (i=0 ; i<MAX_CLIENTS ; i++)
|
||||
|
@ -881,7 +883,7 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
|
||||
//
|
||||
// spawn the rest of the entities on the map
|
||||
//
|
||||
//
|
||||
|
||||
// precache and static commands can be issued during
|
||||
// map initialization
|
||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
|
@ -280,7 +280,7 @@ void VARGS SV_Error (char *error, ...)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
SV_Shutdown ();
|
||||
|
||||
Sys_Error ("SV_Error: %s\n",string);
|
||||
|
@ -300,7 +300,7 @@ void SV_FinalMessage (char *message)
|
|||
{
|
||||
int i;
|
||||
client_t *cl;
|
||||
|
||||
|
||||
SZ_Clear (&sv.datagram);
|
||||
MSG_WriteByte (&sv.datagram, svc_print);
|
||||
MSG_WriteByte (&sv.datagram, PRINT_HIGH);
|
||||
|
@ -547,15 +547,15 @@ void SV_FullClientUpdate (client_t *client, sizebuf_t *buf)
|
|||
MSG_WriteByte (buf, svc_updatefrags);
|
||||
MSG_WriteByte (buf, i);
|
||||
MSG_WriteShort (buf, sv.recordedplayer[i].frags);
|
||||
|
||||
|
||||
MSG_WriteByte (buf, svc_updateping);
|
||||
MSG_WriteByte (buf, i);
|
||||
MSG_WriteShort (buf, sv.recordedplayer[i].ping);
|
||||
|
||||
|
||||
MSG_WriteByte (buf, svc_updatepl);
|
||||
MSG_WriteByte (buf, i);
|
||||
MSG_WriteByte (buf, sv.recordedplayer[i].pl);
|
||||
|
||||
|
||||
MSG_WriteByte (buf, svc_updateentertime);
|
||||
MSG_WriteByte (buf, i);
|
||||
MSG_WriteFloat (buf, 0);
|
||||
|
@ -563,7 +563,7 @@ void SV_FullClientUpdate (client_t *client, sizebuf_t *buf)
|
|||
strcpy (info, sv.recordedplayer[i].userinfo);
|
||||
Info_RemoveKey(info, "password"); //main password key
|
||||
Info_RemoveKey(info, "*ip"); //don't broadcast this in playback
|
||||
Info_RemovePrefixedKeys (info, '_'); // server passwords, etc
|
||||
Info_RemovePrefixedKeys (info, '_'); // server passwords, etc
|
||||
|
||||
MSG_WriteByte (buf, svc_updateuserinfo);
|
||||
MSG_WriteByte (buf, i);
|
||||
|
@ -577,11 +577,11 @@ void SV_FullClientUpdate (client_t *client, sizebuf_t *buf)
|
|||
MSG_WriteByte (buf, svc_updatefrags);
|
||||
MSG_WriteByte (buf, i);
|
||||
MSG_WriteShort (buf, client->old_frags);
|
||||
|
||||
|
||||
MSG_WriteByte (buf, svc_updateping);
|
||||
MSG_WriteByte (buf, i);
|
||||
MSG_WriteShort (buf, SV_CalcPing (client));
|
||||
|
||||
|
||||
MSG_WriteByte (buf, svc_updatepl);
|
||||
MSG_WriteByte (buf, i);
|
||||
MSG_WriteByte (buf, client->lossage);
|
||||
|
@ -592,7 +592,7 @@ void SV_FullClientUpdate (client_t *client, sizebuf_t *buf)
|
|||
|
||||
strcpy (info, client->userinfo);
|
||||
Info_RemoveKey(info, "password"); //main password key
|
||||
Info_RemovePrefixedKeys (info, '_'); // server passwords, etc
|
||||
Info_RemovePrefixedKeys (info, '_'); // server passwords, etc
|
||||
|
||||
MSG_WriteByte (buf, svc_updateuserinfo);
|
||||
MSG_WriteByte (buf, i);
|
||||
|
@ -711,18 +711,18 @@ void SVC_Status (void)
|
|||
bottom = (bottom < 0) ? 0 : ((bottom > 13) ? 13 : bottom);
|
||||
ping = SV_CalcPing (cl);
|
||||
if (!cl->state) //show bots differently. Just to be courteous.
|
||||
Con_Printf ("%i %i %i %i \"BOT:%s\" \"%s\" %i %i\n", cl->userid,
|
||||
Con_Printf ("%i %i %i %i \"BOT:%s\" \"%s\" %i %i\n", cl->userid,
|
||||
cl->old_frags, (int)(realtime - cl->connection_started)/60,
|
||||
ping, cl->name, Info_ValueForKey (cl->userinfo, "skin"), top, bottom);
|
||||
else
|
||||
Con_Printf ("%i %i %i %i \"%s\" \"%s\" %i %i\n", cl->userid,
|
||||
Con_Printf ("%i %i %i %i \"%s\" \"%s\" %i %i\n", cl->userid,
|
||||
cl->old_frags, (int)(realtime - cl->connection_started)/60,
|
||||
ping, cl->name, Info_ValueForKey (cl->userinfo, "skin"), top, bottom);
|
||||
}
|
||||
else
|
||||
slots++;
|
||||
}
|
||||
|
||||
|
||||
//No. Not a good idea.
|
||||
/* if (slots>16)
|
||||
Con_Printf ("5016 35 54 114 \"annigilator\" \"soldier\" 0 0\n");
|
||||
|
@ -738,6 +738,7 @@ void SVC_Status (void)
|
|||
SV_EndRedirect ();
|
||||
}
|
||||
|
||||
#ifdef NQPROT
|
||||
void SVC_GetInfo (char *challenge)
|
||||
{
|
||||
//dpmaster support
|
||||
|
@ -776,7 +777,9 @@ void SVC_GetInfo (char *challenge)
|
|||
|
||||
NET_SendPacket (NS_SERVER, strlen(resp), resp, net_from);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef Q2SERVER
|
||||
void SVC_InfoQ2 (void)
|
||||
{
|
||||
char string[64];
|
||||
|
@ -802,6 +805,7 @@ void SVC_InfoQ2 (void)
|
|||
|
||||
Netchan_OutOfBandPrint (NS_SERVER, net_from, "info\n%s", string);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
===================
|
||||
|
@ -1017,7 +1021,7 @@ void SVC_GetChallenge (void)
|
|||
}
|
||||
}
|
||||
|
||||
// Netchan_OutOfBandPrint (net_from, "%c%i", S2C_CHALLENGE,
|
||||
// Netchan_OutOfBandPrint (net_from, "%c%i", S2C_CHALLENGE,
|
||||
// svs.challenges[i].challenge);
|
||||
}
|
||||
|
||||
|
@ -1032,7 +1036,7 @@ void SV_GetNewSpawnParms(client_t *cl)
|
|||
for (i=0 ; i<NUM_SPAWN_PARMS ; i++)
|
||||
{
|
||||
if (spawnparamglobals[i])
|
||||
cl->spawn_parms[i] = *spawnparamglobals[i];
|
||||
cl->spawn_parms[i] = *spawnparamglobals[i];
|
||||
else
|
||||
cl->spawn_parms[i] = 0;
|
||||
}
|
||||
|
@ -1223,7 +1227,7 @@ client_t *SVC_DirectConnect(void)
|
|||
int protocol;
|
||||
|
||||
unsigned int protextsupported=0;
|
||||
|
||||
|
||||
|
||||
char *name;
|
||||
|
||||
|
@ -1350,7 +1354,7 @@ client_t *SVC_DirectConnect(void)
|
|||
s = Info_ValueForKey (userinfo[0], "spectator");
|
||||
if (s[0] && strcmp(s, "0"))
|
||||
{
|
||||
if (spectator_password.string[0] &&
|
||||
if (spectator_password.string[0] &&
|
||||
stricmp(spectator_password.string, "none") &&
|
||||
strcmp(spectator_password.string, s) )
|
||||
{ // failed
|
||||
|
@ -1365,7 +1369,7 @@ client_t *SVC_DirectConnect(void)
|
|||
else
|
||||
{
|
||||
s = Info_ValueForKey (userinfo[0], "password");
|
||||
if (password.string[0] &&
|
||||
if (password.string[0] &&
|
||||
stricmp(password.string, "none") &&
|
||||
strcmp(password.string, s) )
|
||||
{
|
||||
|
@ -1414,7 +1418,7 @@ client_t *SVC_DirectConnect(void)
|
|||
if (cl->state == cs_free)
|
||||
continue;
|
||||
if (NET_CompareBaseAdr (adr, cl->netchan.remote_address)
|
||||
&& ( cl->netchan.qport == qport
|
||||
&& ( cl->netchan.qport == qport
|
||||
|| adr.port == cl->netchan.remote_address.port ))
|
||||
{
|
||||
if (cl->state == cs_connected) {
|
||||
|
@ -1567,7 +1571,7 @@ client_t *SVC_DirectConnect(void)
|
|||
edictnum = (newcl-svs.clients)+1;
|
||||
if (svprogfuncs)
|
||||
{
|
||||
ent = EDICT_NUM(svprogfuncs, edictnum);
|
||||
ent = EDICT_NUM(svprogfuncs, edictnum);
|
||||
#ifdef Q2SERVER
|
||||
temp.q2edict = NULL;
|
||||
#endif
|
||||
|
@ -1595,7 +1599,7 @@ client_t *SVC_DirectConnect(void)
|
|||
#ifdef Q2SERVER
|
||||
else
|
||||
{
|
||||
q2ent = Q2EDICT_NUM(edictnum);
|
||||
q2ent = Q2EDICT_NUM(edictnum);
|
||||
temp.edict = NULL;
|
||||
temp.q2edict = q2ent;
|
||||
|
||||
|
@ -1614,7 +1618,7 @@ client_t *SVC_DirectConnect(void)
|
|||
temp.q2frames = Z_Malloc(sizeof(q2client_frame_t)*Q2UPDATE_BACKUP);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
{
|
||||
char *n, *t;
|
||||
|
@ -1628,7 +1632,7 @@ client_t *SVC_DirectConnect(void)
|
|||
newcl->zquake_extensions = atoi(Info_ValueForKey(newcl->userinfo, "*z_ext"));
|
||||
|
||||
//dmw - delayed - Netchan_OutOfBandPrint (adr, "%c", S2C_CONNECTION );
|
||||
|
||||
|
||||
Netchan_Setup (NS_SERVER, &newcl->netchan , adr, qport);
|
||||
|
||||
if (huffcrc)
|
||||
|
@ -1637,7 +1641,9 @@ client_t *SVC_DirectConnect(void)
|
|||
newcl->netchan.compress = false;
|
||||
|
||||
newcl->protocol = protocol;
|
||||
#ifdef NQNET
|
||||
newcl->netchan.isnqprotocol = ISNQCLIENT(newcl);
|
||||
#endif
|
||||
|
||||
newcl->state = cs_connected;
|
||||
|
||||
|
@ -1647,7 +1653,7 @@ client_t *SVC_DirectConnect(void)
|
|||
|
||||
// spectator mode can ONLY be set at join time
|
||||
newcl->spectator = spectator;
|
||||
|
||||
|
||||
// parse some info from the info strings
|
||||
SV_ExtractFromUserinfo (newcl);
|
||||
|
||||
|
@ -1692,7 +1698,7 @@ client_t *SVC_DirectConnect(void)
|
|||
}
|
||||
|
||||
if (rs.flags1 & RANK_BANNED)
|
||||
{
|
||||
{
|
||||
SV_RejectMessage (protocol, "You were banned.\nContact the administrator to complain.\n");
|
||||
Con_Printf("banned player %s is trying to connect\n", newcl->name);
|
||||
newcl->name[0] = 0;
|
||||
|
@ -1703,16 +1709,16 @@ client_t *SVC_DirectConnect(void)
|
|||
|
||||
if (rs.flags1 & RANK_MUTED)
|
||||
{
|
||||
SV_BroadcastTPrintf(PRINT_MEDIUM, STL_CLIENTISSTILLMUTED, newcl->name);
|
||||
SV_BroadcastTPrintf(PRINT_MEDIUM, STL_CLIENTISSTILLMUTED, newcl->name);
|
||||
}
|
||||
if (rs.flags1 & RANK_CUFFED)
|
||||
{
|
||||
SV_BroadcastTPrintf(PRINT_LOW, STL_CLIENTISSTILLCUFFED, newcl->name);
|
||||
SV_BroadcastTPrintf(PRINT_LOW, STL_CLIENTISSTILLCUFFED, newcl->name);
|
||||
}
|
||||
if (rs.flags1 & RANK_CRIPPLED)
|
||||
{
|
||||
SV_BroadcastTPrintf(PRINT_HIGH, STL_CLIENTISSTILLCRIPPLED, newcl->name);
|
||||
}
|
||||
SV_BroadcastTPrintf(PRINT_HIGH, STL_CLIENTISSTILLCRIPPLED, newcl->name);
|
||||
}
|
||||
|
||||
if (rs.timeonserver)
|
||||
{
|
||||
|
@ -1909,7 +1915,7 @@ void SVC_RemoteCommand (void)
|
|||
if (!Rank_GetPlayerStats(rid, &stats))
|
||||
return;
|
||||
|
||||
|
||||
|
||||
Con_Printf ("Rcon from %s:\n%s\n"
|
||||
, NET_AdrToString (net_from), net_message.data+4);
|
||||
|
||||
|
@ -2019,8 +2025,10 @@ qboolean SV_ConnectionlessPacket (void)
|
|||
SVC_Status ();
|
||||
else if (!strcmp(c,"log"))
|
||||
SVC_Log ();
|
||||
#ifdef Q2SERVER
|
||||
else if (!strcmp(c, "info"))
|
||||
SVC_InfoQ2 ();
|
||||
#endif
|
||||
else if (!strncmp(c,"connect", 7))
|
||||
{
|
||||
#ifdef Q3SERVER
|
||||
|
@ -2029,7 +2037,7 @@ qboolean SV_ConnectionlessPacket (void)
|
|||
SVQ3_DirectConnect();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif
|
||||
if (secure.value) //FIXME: possible problem for nq clients when enabled
|
||||
Netchan_OutOfBandPrint (NS_SERVER, net_from, "%c\nThis server requires client validation.\nPlease use the "DISTRIBUTION" validation program\n", A2C_PRINT);
|
||||
|
@ -2043,8 +2051,10 @@ qboolean SV_ConnectionlessPacket (void)
|
|||
{
|
||||
SVC_GetChallenge ();
|
||||
}
|
||||
#ifdef NQPROT
|
||||
else if (!strcmp(c, "getinfo"))
|
||||
SVC_GetInfo(Cmd_Args());
|
||||
#endif
|
||||
else if (!strcmp(c, "rcon"))
|
||||
SVC_RemoteCommand ();
|
||||
else
|
||||
|
@ -2117,7 +2127,7 @@ void SVNQ_ConnectionlessPacket(void)
|
|||
==============================================================================
|
||||
|
||||
PACKET FILTERING
|
||||
|
||||
|
||||
|
||||
You can add or remove addresses from the filter list with:
|
||||
|
||||
|
@ -2169,13 +2179,13 @@ qboolean StringToFilter (char *s, ipfilter_t *f)
|
|||
int i, j;
|
||||
qbyte b[4];
|
||||
qbyte m[4];
|
||||
|
||||
|
||||
for (i=0 ; i<4 ; i++)
|
||||
{
|
||||
b[i] = 0;
|
||||
m[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
for (i=0 ; i<4 ; i++)
|
||||
{
|
||||
if (*s < '0' || *s > '9')
|
||||
|
@ -2183,7 +2193,7 @@ qboolean StringToFilter (char *s, ipfilter_t *f)
|
|||
Con_Printf ("Bad filter address: %s\n", s);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
j = 0;
|
||||
while (*s >= '0' && *s <= '9')
|
||||
{
|
||||
|
@ -2198,10 +2208,10 @@ qboolean StringToFilter (char *s, ipfilter_t *f)
|
|||
break;
|
||||
s++;
|
||||
}
|
||||
|
||||
|
||||
f->mask = *(unsigned *)m;
|
||||
f->compare = *(unsigned *)b;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2213,7 +2223,7 @@ SV_AddIP_f
|
|||
void SV_AddIP_f (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
for (i=0 ; i<numipfilters ; i++)
|
||||
if (ipfilters[i].compare == 0xffffffff)
|
||||
break; // free spot
|
||||
|
@ -2226,7 +2236,7 @@ void SV_AddIP_f (void)
|
|||
}
|
||||
numipfilters++;
|
||||
}
|
||||
|
||||
|
||||
if (!StringToFilter (Cmd_Argv(1), &ipfilters[i]))
|
||||
ipfilters[i].compare = 0xffffffff;
|
||||
}
|
||||
|
@ -2296,13 +2306,13 @@ void SV_WriteIP_f (void)
|
|||
Con_Printf ("Couldn't open %s\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (i=0 ; i<numipfilters ; i++)
|
||||
{
|
||||
*(unsigned *)b = ipfilters[i].compare;
|
||||
fprintf (f, "addip %i.%i.%i.%i\n", b[0], b[1], b[2], b[3]);
|
||||
}
|
||||
|
||||
|
||||
fclose (f);
|
||||
}
|
||||
|
||||
|
@ -2319,7 +2329,7 @@ void SV_SendBan (void)
|
|||
data[4] = A2C_PRINT;
|
||||
data[5] = 0;
|
||||
strcat (data, "\nbanned.\n");
|
||||
|
||||
|
||||
NET_SendPacket (NS_SERVER, strlen(data), data, net_from);
|
||||
}
|
||||
|
||||
|
@ -2332,7 +2342,7 @@ qboolean SV_FilterPacket (void)
|
|||
{
|
||||
int i;
|
||||
unsigned in;
|
||||
|
||||
|
||||
in = *(unsigned *)net_from.ip;
|
||||
|
||||
for (i=0 ; i<numipfilters ; i++)
|
||||
|
@ -2452,14 +2462,14 @@ void SV_ReadPackets (void)
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (i != MAX_CLIENTS)
|
||||
continue;
|
||||
|
||||
#ifdef NQPROT
|
||||
SVNQ_ConnectionlessPacket();
|
||||
#endif
|
||||
|
||||
|
||||
// packet is not from a known client
|
||||
// Con_Printf ("%s:sequenced packet without connection\n"
|
||||
// ,NET_AdrToString(net_from));
|
||||
|
@ -2484,7 +2494,7 @@ void SV_CheckTimeouts (void)
|
|||
client_t *cl;
|
||||
float droptime;
|
||||
int nclients;
|
||||
|
||||
|
||||
droptime = realtime - timeout.value;
|
||||
nclients = 0;
|
||||
|
||||
|
@ -2495,11 +2505,11 @@ void SV_CheckTimeouts (void)
|
|||
nclients++;
|
||||
if (cl->netchan.last_received < droptime && cl->netchan.remote_address.type != NA_LOOPBACK && cl->protocol != SCP_BAD) {
|
||||
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTTIMEDOUT, cl->name);
|
||||
SV_DropClient (cl);
|
||||
SV_DropClient (cl);
|
||||
cl->state = cs_free; // don't bother with zombie state
|
||||
}
|
||||
}
|
||||
if (cl->state == cs_zombie &&
|
||||
if (cl->state == cs_zombie &&
|
||||
realtime - cl->connection_started > zombietime.value)
|
||||
{
|
||||
if (cl->connection_started == -1)
|
||||
|
@ -2649,7 +2659,7 @@ void SV_Impulse_f (void)
|
|||
PR_ExecuteProgram (svprogfuncs, pr_global_struct->ClientConnect);
|
||||
|
||||
pr_global_struct->time = sv.time;
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, svs.clients[i].edict);
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, svs.clients[i].edict);
|
||||
PR_ExecuteProgram (svprogfuncs, pr_global_struct->PutClientInServer);
|
||||
|
||||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, svs.clients[i].edict);
|
||||
|
@ -2682,11 +2692,11 @@ void SV_Frame (float time)
|
|||
{
|
||||
extern cvar_t pr_imitatemvdsv;
|
||||
static double start, end;
|
||||
|
||||
|
||||
start = Sys_DoubleTime ();
|
||||
svs.stats.idle += start - end;
|
||||
end = start;
|
||||
|
||||
|
||||
// keep the random time dependent
|
||||
rand ();
|
||||
|
||||
|
@ -2852,7 +2862,7 @@ void SV_InitLocal (void)
|
|||
|
||||
SV_InitOperatorCommands ();
|
||||
SV_UserInit ();
|
||||
|
||||
|
||||
#ifndef SERVERONLY
|
||||
if (isDedicated)
|
||||
#endif
|
||||
|
@ -2862,7 +2872,7 @@ void SV_InitLocal (void)
|
|||
Cvar_Register (&password, cvargroup_servercontrol);
|
||||
Cvar_Register (&rcon_password, cvargroup_servercontrol);
|
||||
}
|
||||
rcon_password.restriction = RESTRICT_MAX; //no cheatie rconers changing rcon passwords...
|
||||
rcon_password.restriction = RESTRICT_MAX; //no cheatie rconers changing rcon passwords...
|
||||
Cvar_Register (&spectator_password, cvargroup_servercontrol);
|
||||
|
||||
Cvar_Register (&sv_mintic, cvargroup_servercontrol);
|
||||
|
@ -2886,8 +2896,8 @@ void SV_InitLocal (void)
|
|||
Cvar_Register (&mirrors, cvargroup_serverinfo);
|
||||
Cvar_Register (&allow_luma, cvargroup_serverinfo);
|
||||
Cvar_Register (&allow_bump, cvargroup_serverinfo);
|
||||
Cvar_Register (&allow_skybox, cvargroup_serverinfo);
|
||||
Cvar_Register (&sv_allow_splitscreen, cvargroup_serverinfo);
|
||||
Cvar_Register (&allow_skybox, cvargroup_serverinfo);
|
||||
Cvar_Register (&sv_allow_splitscreen, cvargroup_serverinfo);
|
||||
Cvar_Register (&fbskins, cvargroup_serverinfo);
|
||||
|
||||
Cvar_Register (&timeout, cvargroup_servercontrol);
|
||||
|
@ -2937,7 +2947,7 @@ void SV_InitLocal (void)
|
|||
Cvar_Register (&sv_masterport, cvargroup_servercontrol);
|
||||
|
||||
Cvar_Register (&filterban, cvargroup_servercontrol);
|
||||
|
||||
|
||||
Cvar_Register (&allow_download, cvargroup_serverpermissions);
|
||||
Cvar_Register (&allow_download_skins, cvargroup_serverpermissions);
|
||||
Cvar_Register (&allow_download_models, cvargroup_serverpermissions);
|
||||
|
@ -3025,7 +3035,7 @@ void SV_InitLocal (void)
|
|||
#ifdef PEXT_TE_BULLET
|
||||
svs.fteprotocolextensions |= PEXT_TE_BULLET;
|
||||
#endif
|
||||
#ifdef PEXT_HULLSIZE
|
||||
#ifdef PEXT_HULLSIZE
|
||||
svs.fteprotocolextensions |= PEXT_HULLSIZE;
|
||||
#endif
|
||||
#ifdef PEXT_SETVIEW
|
||||
|
@ -3048,10 +3058,10 @@ void SV_InitLocal (void)
|
|||
// svs.fteprotocolextensions |= PEXT_64PLAYERS;
|
||||
svs.fteprotocolextensions |= PEXT_SHOWPIC;
|
||||
svs.fteprotocolextensions |= PEXT_SETATTACHMENT;
|
||||
|
||||
|
||||
#ifdef PEXT_PK3DOWNLOADS
|
||||
svs.fteprotocolextensions |= PEXT_PK3DOWNLOADS;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef PEXT_CHUNKEDDOWNLOADS
|
||||
svs.fteprotocolextensions |= PEXT_CHUNKEDDOWNLOADS;
|
||||
|
@ -3399,9 +3409,9 @@ void SV_ExtractFromUserinfo (client_t *cl)
|
|||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (strncmp(newname, cl->name, sizeof(cl->namebuf)-1))
|
||||
{
|
||||
{
|
||||
if (cl->ismuted)
|
||||
SV_ClientTPrintf (cl, PRINT_HIGH, STL_NONAMEASMUTE);
|
||||
else
|
||||
|
@ -3415,13 +3425,13 @@ void SV_ExtractFromUserinfo (client_t *cl)
|
|||
} else if (cl->lastnamecount++ > 4) {
|
||||
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTKICKEDNAMESPAM, cl->name);
|
||||
SV_ClientTPrintf (cl, PRINT_HIGH, STL_YOUWEREKICKEDNAMESPAM);
|
||||
SV_DropClient (cl);
|
||||
SV_DropClient (cl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (cl->state >= cs_spawned && !cl->spectator)
|
||||
{
|
||||
{
|
||||
SV_BroadcastTPrintf (PRINT_HIGH, STL_CLIENTNAMECHANGE, cl->name, val);
|
||||
}
|
||||
Q_strncpyz (cl->name, newname, sizeof(cl->namebuf));
|
||||
|
@ -3542,7 +3552,7 @@ void SV_Init (quakeparms_t *parms)
|
|||
// if (parms->memsize < MINIMUM_MEMORY)
|
||||
// SV_Error ("Only %4.1f megs of memory reported, can't execute game", parms->memsize / (float)0x100000);
|
||||
|
||||
Memory_Init (parms->membase, parms->memsize);
|
||||
Memory_Init (parms->membase, parms->memsize);
|
||||
|
||||
COM_ParsePlusSets();
|
||||
|
||||
|
@ -3554,7 +3564,7 @@ void SV_Init (quakeparms_t *parms)
|
|||
COM_Init ();
|
||||
Mod_Init ();
|
||||
}
|
||||
PR_Init ();
|
||||
PR_Init ();
|
||||
|
||||
SV_InitNet ();
|
||||
|
||||
|
@ -3563,7 +3573,7 @@ void SV_Init (quakeparms_t *parms)
|
|||
#ifdef IWEB_H__
|
||||
IWebInit();
|
||||
#endif
|
||||
|
||||
|
||||
SV_Demo_Init();
|
||||
|
||||
#ifdef SVRANKING
|
||||
|
@ -3581,16 +3591,16 @@ void SV_Init (quakeparms_t *parms)
|
|||
host_hunklevel = Hunk_LowMark ();
|
||||
|
||||
host_initialized = true;
|
||||
|
||||
|
||||
Con_TPrintf (TL_EXEDATETIME, __DATE__, __TIME__);
|
||||
Con_TPrintf (TL_HEAPSIZE,parms->memsize/ (1024*1024.0));
|
||||
Con_TPrintf (TL_HEAPSIZE,parms->memsize/ (1024*1024.0));
|
||||
|
||||
Con_TPrintf (TL_SERVERVERSION, DISTRIBUTION, VERSION, build_number());
|
||||
|
||||
Con_TPrintf (STL_INITED);
|
||||
|
||||
Cbuf_InsertText ("exec server.cfg\nexec ftesrv.cfg\n", RESTRICT_LOCAL);
|
||||
|
||||
Cbuf_InsertText ("exec server.cfg\nexec ftesrv.cfg\n", RESTRICT_LOCAL);
|
||||
|
||||
// process command line arguments
|
||||
Cbuf_Execute ();
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the included (GNU.txt) GNU General Public License for more details.
|
||||
|
||||
|
@ -62,6 +62,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define closesocket close
|
||||
#define ioctlsocket ioctl
|
||||
#endif
|
||||
|
||||
#ifndef INVALID_SOCKET
|
||||
#define INVALID_SOCKET -1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -234,7 +239,7 @@ void SV_TimeOfDay(date_t *date)
|
|||
{
|
||||
struct tm *newtime;
|
||||
time_t long_time;
|
||||
|
||||
|
||||
time( &long_time );
|
||||
newtime = localtime( &long_time );
|
||||
|
||||
|
@ -291,7 +296,7 @@ dir_t Sys_listdir (char *path, char *ext, qboolean usesorting)
|
|||
{
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
if ((fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
|
@ -364,7 +369,7 @@ dir_t Sys_listdir (char *path, char *ext, qboolean usesorting)
|
|||
for(;;)
|
||||
{
|
||||
oneentry=readdir(dir);
|
||||
if(!oneentry)
|
||||
if(!oneentry)
|
||||
break;
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
|
@ -884,7 +889,7 @@ void SV_MVDWritePackets (int num)
|
|||
for (j=0 ; j<3 ; j++)
|
||||
if (flags & (DF_ORIGIN << j))
|
||||
MSG_WriteCoord (&msg, origin[j]);
|
||||
|
||||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
if (flags & (DF_ANGLES << j))
|
||||
MSG_WriteAngle16 (&msg, angles[j]);
|
||||
|
@ -980,20 +985,20 @@ static char *SV_PrintTeams(void)
|
|||
}
|
||||
|
||||
// create output
|
||||
|
||||
|
||||
if (numcl == 2) // duel
|
||||
{
|
||||
_snprintf(buf, sizeof(buf), "team1 %s\nteam2 %s\n", clients[0]->name, clients[1]->name);
|
||||
}
|
||||
}
|
||||
else if (!teamplay.value) // ffa
|
||||
{
|
||||
{
|
||||
_snprintf(buf, sizeof(buf), "players:\n");
|
||||
for (i = 0; i < numcl; i++)
|
||||
_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %s\n", clients[i]->name);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{ // teamplay
|
||||
for (j = 0; j < numt; j++)
|
||||
for (j = 0; j < numt; j++)
|
||||
{
|
||||
_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "team %s:\n", teams[j]);
|
||||
for (i = 0; i < numcl; i++)
|
||||
|
@ -1037,7 +1042,7 @@ mvddest_t *SV_InitRecordFile (char *name)
|
|||
dst->file = file;
|
||||
dst->maxcachesize = 0;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
dst->desttype = DEST_BUFFEREDFILE;
|
||||
dst->file = file;
|
||||
|
@ -1051,7 +1056,7 @@ mvddest_t *SV_InitRecordFile (char *name)
|
|||
while (*s != '/') s--;
|
||||
Q_strncpyz(dst->name, s+1, sizeof(dst->name));
|
||||
Q_strncpyz(dst->path, sv_demoDir.string, sizeof(dst->path));
|
||||
|
||||
|
||||
if (!*demo.path)
|
||||
Q_strncpyz(demo.path, ".", MAX_OSPATH);
|
||||
|
||||
|
@ -1079,7 +1084,7 @@ mvddest_t *SV_InitRecordFile (char *name)
|
|||
fclose(f);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
Sys_remove(path);
|
||||
|
||||
|
||||
|
@ -1225,7 +1230,7 @@ void SV_WriteSetMVDMessage (void)
|
|||
c = dem_set;
|
||||
DemoWrite (&c, sizeof(c));
|
||||
|
||||
|
||||
|
||||
len = LittleLong(0);
|
||||
DemoWrite (&len, 4);
|
||||
len = LittleLong(0);
|
||||
|
@ -1345,7 +1350,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
|
|||
MSG_WriteByte (&buf, 0);
|
||||
MSG_WriteByte (&buf, n);
|
||||
SV_WriteRecordMVDMessage (&buf, seq++);
|
||||
SZ_Clear (&buf);
|
||||
SZ_Clear (&buf);
|
||||
MSG_WriteByte (&buf, svc_soundlist);
|
||||
MSG_WriteByte (&buf, n + 1);
|
||||
}
|
||||
|
@ -1358,7 +1363,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
|
|||
MSG_WriteByte (&buf, 0);
|
||||
MSG_WriteByte (&buf, 0);
|
||||
SV_WriteRecordMVDMessage (&buf, seq++);
|
||||
SZ_Clear (&buf);
|
||||
SZ_Clear (&buf);
|
||||
}
|
||||
|
||||
// modellist
|
||||
|
@ -1375,7 +1380,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
|
|||
MSG_WriteByte (&buf, 0);
|
||||
MSG_WriteByte (&buf, n);
|
||||
SV_WriteRecordMVDMessage (&buf, seq++);
|
||||
SZ_Clear (&buf);
|
||||
SZ_Clear (&buf);
|
||||
MSG_WriteByte (&buf, svc_modellist);
|
||||
MSG_WriteByte (&buf, n + 1);
|
||||
}
|
||||
|
@ -1387,7 +1392,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
|
|||
MSG_WriteByte (&buf, 0);
|
||||
MSG_WriteByte (&buf, 0);
|
||||
SV_WriteRecordMVDMessage (&buf, seq++);
|
||||
SZ_Clear (&buf);
|
||||
SZ_Clear (&buf);
|
||||
}
|
||||
|
||||
// baselines
|
||||
|
@ -1450,7 +1455,7 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
|
|||
if (buf.cursize > MAX_QWMSGLEN/2)
|
||||
{
|
||||
SV_WriteRecordMVDMessage (&buf, seq++);
|
||||
SZ_Clear (&buf);
|
||||
SZ_Clear (&buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1459,24 +1464,24 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
|
|||
|
||||
for (n = 0; n < sv.num_signon_buffers; n++)
|
||||
{
|
||||
SZ_Write (&buf,
|
||||
SZ_Write (&buf,
|
||||
sv.signon_buffers[n],
|
||||
sv.signon_buffer_size[n]);
|
||||
|
||||
if (buf.cursize > MAX_QWMSGLEN/2)
|
||||
{
|
||||
SV_WriteRecordMVDMessage (&buf, seq++);
|
||||
SZ_Clear (&buf);
|
||||
SZ_Clear (&buf);
|
||||
}
|
||||
}
|
||||
|
||||
MSG_WriteByte (&buf, svc_stufftext);
|
||||
MSG_WriteString (&buf, va("cmd spawn %i\n",svs.spawncount) );
|
||||
|
||||
|
||||
if (buf.cursize)
|
||||
{
|
||||
SV_WriteRecordMVDMessage (&buf, seq++);
|
||||
SZ_Clear (&buf);
|
||||
SZ_Clear (&buf);
|
||||
}
|
||||
|
||||
// send current status of all other players
|
||||
|
@ -1512,10 +1517,10 @@ static qboolean SV_MVD_Record (mvddest_t *dest)
|
|||
if (buf.cursize > MAX_QWMSGLEN/2)
|
||||
{
|
||||
SV_WriteRecordMVDMessage (&buf, seq++);
|
||||
SZ_Clear (&buf);
|
||||
SZ_Clear (&buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// send all current light styles
|
||||
for (i=0 ; i<MAX_LIGHTSTYLES ; i++)
|
||||
{
|
||||
|
@ -1610,7 +1615,7 @@ void CleanName_Init ()
|
|||
|
||||
chartbl[91] = chartbl[91 + 128] = '[';
|
||||
chartbl[93] = chartbl[93 + 128] = ']';
|
||||
|
||||
|
||||
chartbl[16] = chartbl[16 + 128] = '[';
|
||||
chartbl[17] = chartbl[17 + 128] = ']';
|
||||
|
||||
|
@ -1692,7 +1697,7 @@ void SV_MVD_Record_f (void)
|
|||
COM_StripExtension(name, name);
|
||||
COM_DefaultExtension(name, ".mvd");
|
||||
|
||||
|
||||
|
||||
SV_MVD_Record (SV_InitRecordFile(name));
|
||||
}
|
||||
|
||||
|
@ -1780,7 +1785,7 @@ char *Dem_PlayerNameTeam(char *t)
|
|||
if (!client->name[0] || client->spectator)
|
||||
continue;
|
||||
|
||||
if (strcmp(t, Info_ValueForKey(client->userinfo, "team"))==0)
|
||||
if (strcmp(t, Info_ValueForKey(client->userinfo, "team"))==0)
|
||||
{
|
||||
if (sep >= 1)
|
||||
Q_strncatz (n, "_", sizeof(n));
|
||||
|
@ -1840,8 +1845,8 @@ void SV_MVDEasyRecord_f (void)
|
|||
// -> scream
|
||||
/* if (c == 2)
|
||||
Q_strncpyz (name, Cmd_Argv(1), sizeof(name));
|
||||
|
||||
else {
|
||||
|
||||
else {
|
||||
// guess game type and write demo name
|
||||
i = Dem_CountPlayers();
|
||||
if (teamplay.value && i > 2)
|
||||
|
@ -1867,7 +1872,7 @@ void SV_MVDEasyRecord_f (void)
|
|||
}
|
||||
}*/
|
||||
|
||||
|
||||
|
||||
if (c == 2)
|
||||
Q_strncpyz (name, Cmd_Argv(1), sizeof(name));
|
||||
else
|
||||
|
@ -1879,8 +1884,8 @@ void SV_MVDEasyRecord_f (void)
|
|||
_snprintf (name, sizeof(name), "%don%d_", Dem_CountTeamPlayers(Dem_Team(1)), Dem_CountTeamPlayers(Dem_Team(2)));
|
||||
if (sv_demoExtraNames.value > 0)
|
||||
{
|
||||
Q_strncatz (name, va("[%s]_%s_vs_[%s]_%s_%s",
|
||||
Dem_Team(1), Dem_PlayerNameTeam(Dem_Team(1)),
|
||||
Q_strncatz (name, va("[%s]_%s_vs_[%s]_%s_%s",
|
||||
Dem_Team(1), Dem_PlayerNameTeam(Dem_Team(1)),
|
||||
Dem_Team(2), Dem_PlayerNameTeam(Dem_Team(2)),
|
||||
sv.name), sizeof(name));
|
||||
} else
|
||||
|
@ -1913,7 +1918,7 @@ void SV_MVDEasyRecord_f (void)
|
|||
strcat (name2, ".mvd");
|
||||
if ((f = fopen (name2, "rb")) == 0)
|
||||
f = fopen(va("%s.gz", name2), "rb");
|
||||
|
||||
|
||||
if (f)
|
||||
{
|
||||
i = 1;
|
||||
|
@ -1934,7 +1939,7 @@ void SV_MVDEasyRecord_f (void)
|
|||
int MVD_StreamStartListening(int port)
|
||||
{
|
||||
int sock;
|
||||
|
||||
|
||||
struct sockaddr_in address;
|
||||
// int fromlen;
|
||||
|
||||
|
@ -1954,13 +1959,13 @@ int MVD_StreamStartListening(int port)
|
|||
{
|
||||
Sys_Error ("FTP_TCP_OpenSocket: ioctl FIONBIO:", strerror(qerrno));
|
||||
}
|
||||
|
||||
|
||||
if( bind (sock, (void *)&address, sizeof(address)) == -1)
|
||||
{
|
||||
closesocket(sock);
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
|
||||
listen(sock, 2);
|
||||
|
||||
return sock;
|
||||
|
@ -2004,7 +2009,7 @@ void SV_MVDStream_Poll(void)
|
|||
|
||||
if (client == INVALID_SOCKET)
|
||||
return;
|
||||
|
||||
|
||||
if (sv.mvdrecording)
|
||||
{ //sorry
|
||||
closesocket(client);
|
||||
|
@ -2084,7 +2089,7 @@ char *SV_MVDNum(int num)
|
|||
|
||||
while (list->name[0] && num) {list++; num--;};
|
||||
|
||||
if (list->name[0])
|
||||
if (list->name[0])
|
||||
return list->name;
|
||||
|
||||
return NULL;
|
||||
|
@ -2151,7 +2156,7 @@ void SV_MVDRemove_f (void)
|
|||
Con_Printf("removing %s...\n", list->name);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
Sys_remove(SV_MVDName2Txt(path));
|
||||
}
|
||||
}
|
||||
|
@ -2180,7 +2185,7 @@ void SV_MVDRemove_f (void)
|
|||
{
|
||||
Con_Printf("demo %s successfully removed\n", name);
|
||||
}
|
||||
else
|
||||
else
|
||||
Con_Printf("unable to remove demo %s\n", name);
|
||||
|
||||
Sys_remove(SV_MVDName2Txt(path));
|
||||
|
@ -2219,7 +2224,7 @@ void SV_MVDRemoveNum_f (void)
|
|||
{
|
||||
Con_Printf("demo %s succesfully removed\n", name);
|
||||
}
|
||||
else
|
||||
else
|
||||
Con_Printf("unable to remove demo %s\n", name);
|
||||
|
||||
Sys_remove(SV_MVDName2Txt(path));
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,7 @@ of the License, or (at your option) any later version.
|
|||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
|
@ -83,7 +83,7 @@ int Mod_LeafForPoint (vec3_t p, model_t *model)
|
|||
else
|
||||
node = node->children[1];
|
||||
}
|
||||
|
||||
|
||||
return 0; // never reached
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ qbyte *Mod_DecompressVis (qbyte *in, model_t *model, qbyte *decompressed)
|
|||
qbyte *out;
|
||||
int row;
|
||||
|
||||
row = (model->numleafs+7)>>3;
|
||||
row = (model->numleafs+7)>>3;
|
||||
out = decompressed;
|
||||
|
||||
#if 0
|
||||
|
@ -123,7 +123,7 @@ qbyte *Mod_DecompressVis (qbyte *in, model_t *model, qbyte *decompressed)
|
|||
*out++ = 0xff;
|
||||
row--;
|
||||
}
|
||||
return decompressed;
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
do
|
||||
|
@ -133,7 +133,7 @@ qbyte *Mod_DecompressVis (qbyte *in, model_t *model, qbyte *decompressed)
|
|||
*out++ = *in++;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
c = in[1];
|
||||
in += 2;
|
||||
while (c)
|
||||
|
@ -143,7 +143,7 @@ qbyte *Mod_DecompressVis (qbyte *in, model_t *model, qbyte *decompressed)
|
|||
}
|
||||
} while (out - decompressed < row);
|
||||
#endif
|
||||
|
||||
|
||||
return decompressed;
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ void Mod_ClearAll (void)
|
|||
{
|
||||
int i;
|
||||
model_t *mod;
|
||||
|
||||
|
||||
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
|
||||
if (mod->type != mod_alias)
|
||||
mod->needload = true;
|
||||
|
@ -190,17 +190,17 @@ model_t *Mod_FindName (char *name)
|
|||
{
|
||||
int i;
|
||||
model_t *mod;
|
||||
|
||||
|
||||
if (!name[0])
|
||||
SV_Error ("Mod_ForName: NULL name");
|
||||
|
||||
|
||||
//
|
||||
// search the currently loaded models
|
||||
//
|
||||
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
|
||||
if (!strcmp (mod->name, name) )
|
||||
break;
|
||||
|
||||
|
||||
if (i == mod_numknown)
|
||||
{
|
||||
if (mod_numknown == MAX_MOD_KNOWN)
|
||||
|
@ -238,7 +238,7 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
|
|||
else
|
||||
return mod; // not cached at all
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// load the file
|
||||
//
|
||||
|
@ -249,12 +249,12 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
|
|||
SV_Error ("Mod_NumForName: %s not found", mod->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// allocate a new model
|
||||
//
|
||||
COM_FileBase (mod->name, loadname);
|
||||
|
||||
|
||||
loadmodel = mod;
|
||||
|
||||
//
|
||||
|
@ -263,11 +263,11 @@ model_t *Mod_LoadModel (model_t *mod, qboolean crash)
|
|||
|
||||
// call the apropriate loader
|
||||
mod->needload = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
switch (LittleLong(*(unsigned *)buf))
|
||||
{
|
||||
#if defined(Q2BSPS)
|
||||
|
@ -301,9 +301,9 @@ Loads in a model for the given name
|
|||
model_t *Mod_ForName (char *name, qboolean crash)
|
||||
{
|
||||
model_t *mod;
|
||||
|
||||
|
||||
mod = Mod_FindName (name);
|
||||
|
||||
|
||||
return Mod_LoadModel (mod, crash);
|
||||
}
|
||||
|
||||
|
@ -342,9 +342,9 @@ void Mod_LoadTextures (lump_t *l)
|
|||
return;
|
||||
}
|
||||
m = (dmiptexlump_t *)(mod_base + l->fileofs);
|
||||
|
||||
|
||||
m->nummiptex = LittleLong (m->nummiptex);
|
||||
|
||||
|
||||
loadmodel->numtextures = m->nummiptex;
|
||||
loadmodel->textures = Hunk_AllocName (m->nummiptex * sizeof(*loadmodel->textures) , loadname);
|
||||
|
||||
|
@ -358,7 +358,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
mt->height = LittleLong (mt->height);
|
||||
for (j=0 ; j<MIPLEVELS ; j++)
|
||||
mt->offsets[j] = LittleLong (mt->offsets[j]);
|
||||
|
||||
|
||||
if ( (mt->width & 15) || (mt->height & 15) )
|
||||
SV_Error ("Texture %s is not 16 aligned", mt->name);
|
||||
pixels = mt->width*mt->height/64*85;
|
||||
|
@ -438,7 +438,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
else
|
||||
SV_Error ("Bad animating texture %s", tx->name);
|
||||
}
|
||||
|
||||
|
||||
#define ANIM_CYCLE 2
|
||||
// link them all together
|
||||
for (j=0 ; j<max ; j++)
|
||||
|
@ -480,7 +480,7 @@ void Mod_LoadLighting (lump_t *l)
|
|||
loadmodel->lightdata = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname);
|
||||
loadmodel->lightdata = Hunk_AllocName ( l->filelen, loadname);
|
||||
memcpy (loadmodel->lightdata, mod_base + l->fileofs, l->filelen);
|
||||
}
|
||||
|
||||
|
@ -497,7 +497,7 @@ void Mod_LoadVisibility (lump_t *l)
|
|||
loadmodel->visdata = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname);
|
||||
loadmodel->visdata = Hunk_AllocName ( l->filelen, loadname);
|
||||
memcpy (loadmodel->visdata, mod_base + l->fileofs, l->filelen);
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ void Mod_LoadEntities (lump_t *l)
|
|||
loadmodel->entities = NULL;
|
||||
return;
|
||||
}
|
||||
loadmodel->entities = Hunk_AllocName ( l->filelen, loadname);
|
||||
loadmodel->entities = Hunk_AllocName ( l->filelen, loadname);
|
||||
memcpy (loadmodel->entities, mod_base + l->fileofs, l->filelen);
|
||||
}
|
||||
|
||||
|
@ -534,7 +534,7 @@ void Mod_LoadVertexes (lump_t *l)
|
|||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->vertexes = out;
|
||||
loadmodel->numvertexes = count;
|
||||
|
@ -570,7 +570,7 @@ void Mod_LoadSubmodels (lump_t *l)
|
|||
if (l->filelen % sizeof(*inh))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*inh);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->submodels = out;
|
||||
loadmodel->numsubmodels = count;
|
||||
|
@ -605,7 +605,7 @@ void Mod_LoadSubmodels (lump_t *l)
|
|||
if (l->filelen % sizeof(*inq))
|
||||
Sys_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*inq);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->submodels = out;
|
||||
loadmodel->numsubmodels = count;
|
||||
|
@ -650,7 +650,7 @@ void Mod_LoadEdges (lump_t *l)
|
|||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( (count + 1) * sizeof(*out), loadname);
|
||||
|
||||
loadmodel->edges = out;
|
||||
loadmodel->numedges = count;
|
||||
|
@ -679,7 +679,7 @@ void Mod_LoadTexinfo (lump_t *l)
|
|||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->texinfo = out;
|
||||
loadmodel->numtexinfo = count;
|
||||
|
@ -706,7 +706,7 @@ void Mod_LoadTexinfo (lump_t *l)
|
|||
|
||||
miptex = LittleLong (in->miptex);
|
||||
out->flags = LittleLong (in->flags);
|
||||
|
||||
|
||||
if (!loadmodel->textures)
|
||||
{
|
||||
out->texture = r_notexture_mip; // checkerboard texture
|
||||
|
@ -734,10 +734,8 @@ Fills in s->texturemins[] and s->extents[]
|
|||
================
|
||||
*/
|
||||
|
||||
void CalcSurfaceExtents (msurface_t *s)
|
||||
#ifdef Q2BSPS
|
||||
;
|
||||
#else
|
||||
void CalcSurfaceExtents (msurface_t *s);
|
||||
/*
|
||||
{
|
||||
float mins[2], maxs[2], val;
|
||||
int i,j, e;
|
||||
|
@ -749,7 +747,7 @@ void CalcSurfaceExtents (msurface_t *s)
|
|||
maxs[0] = maxs[1] = -99999;
|
||||
|
||||
tex = s->texinfo;
|
||||
|
||||
|
||||
for (i=0 ; i<s->numedges ; i++)
|
||||
{
|
||||
e = loadmodel->surfedges[s->firstedge+i];
|
||||
|
@ -757,10 +755,10 @@ void CalcSurfaceExtents (msurface_t *s)
|
|||
v = &loadmodel->vertexes[loadmodel->edges[e].v[0]];
|
||||
else
|
||||
v = &loadmodel->vertexes[loadmodel->edges[-e].v[1]];
|
||||
|
||||
|
||||
for (j=0 ; j<2 ; j++)
|
||||
{
|
||||
val = v->position[0] * tex->vecs[j][0] +
|
||||
val = v->position[0] * tex->vecs[j][0] +
|
||||
v->position[1] * tex->vecs[j][1] +
|
||||
v->position[2] * tex->vecs[j][2] +
|
||||
tex->vecs[j][3];
|
||||
|
@ -772,7 +770,7 @@ void CalcSurfaceExtents (msurface_t *s)
|
|||
}
|
||||
|
||||
for (i=0 ; i<2 ; i++)
|
||||
{
|
||||
{
|
||||
bmins[i] = floor(mins[i]/16);
|
||||
bmaxs[i] = ceil(maxs[i]/16);
|
||||
|
||||
|
@ -782,7 +780,7 @@ void CalcSurfaceExtents (msurface_t *s)
|
|||
// SV_Error ("Bad surface extents");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -800,7 +798,7 @@ void Mod_LoadFaces (lump_t *l)
|
|||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->surfaces = out;
|
||||
loadmodel->numsurfaces = count;
|
||||
|
@ -808,20 +806,20 @@ void Mod_LoadFaces (lump_t *l)
|
|||
for ( surfnum=0 ; surfnum<count ; surfnum++, in++, out++)
|
||||
{
|
||||
out->firstedge = LittleLong(in->firstedge);
|
||||
out->numedges = LittleShort(in->numedges);
|
||||
out->numedges = LittleShort(in->numedges);
|
||||
out->flags = 0;
|
||||
|
||||
planenum = LittleShort(in->planenum);
|
||||
side = LittleShort(in->side);
|
||||
if (side)
|
||||
out->flags |= SURF_PLANEBACK;
|
||||
out->flags |= SURF_PLANEBACK;
|
||||
|
||||
out->plane = loadmodel->planes + planenum;
|
||||
|
||||
out->texinfo = loadmodel->texinfo + LittleShort (in->texinfo);
|
||||
|
||||
CalcSurfaceExtents (out);
|
||||
|
||||
|
||||
// lighting info
|
||||
|
||||
for (i=0 ; i<MAXLIGHTMAPS ; i++)
|
||||
|
@ -831,15 +829,15 @@ void Mod_LoadFaces (lump_t *l)
|
|||
out->samples = NULL;
|
||||
else
|
||||
out->samples = loadmodel->lightdata + i;
|
||||
|
||||
|
||||
// set the drawing flags flag
|
||||
|
||||
|
||||
if (!Q_strncmp(out->texinfo->texture->name,"sky",3)) // sky
|
||||
{
|
||||
out->flags |= (SURF_DRAWSKY | SURF_DRAWTILED);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (!Q_strncmp(out->texinfo->texture->name,"*",1)) // turbulent
|
||||
{
|
||||
out->flags |= (SURF_DRAWTURB | SURF_DRAWTILED);
|
||||
|
@ -883,7 +881,7 @@ void Mod_LoadNodes (lump_t *l)
|
|||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->nodes = out;
|
||||
loadmodel->numnodes = count;
|
||||
|
@ -895,13 +893,13 @@ void Mod_LoadNodes (lump_t *l)
|
|||
out->minmaxs[j] = LittleShort (in->mins[j]);
|
||||
out->minmaxs[3+j] = LittleShort (in->maxs[j]);
|
||||
}
|
||||
|
||||
|
||||
p = LittleLong(in->planenum);
|
||||
out->plane = loadmodel->planes + p;
|
||||
|
||||
out->firstsurface = LittleShort (in->firstface);
|
||||
out->numsurfaces = LittleShort (in->numfaces);
|
||||
|
||||
|
||||
for (j=0 ; j<2 ; j++)
|
||||
{
|
||||
p = LittleShort (in->children[j]);
|
||||
|
@ -911,7 +909,7 @@ void Mod_LoadNodes (lump_t *l)
|
|||
out->children[j] = (mnode_t *)(loadmodel->leafs + (-1 - p));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Mod_SetParent (loadmodel->nodes, NULL); // sets nodes and leafs
|
||||
}
|
||||
|
||||
|
@ -930,7 +928,7 @@ void Mod_LoadLeafs (lump_t *l)
|
|||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->leafs = out;
|
||||
loadmodel->numleafs = count;
|
||||
|
@ -949,17 +947,17 @@ void Mod_LoadLeafs (lump_t *l)
|
|||
out->firstmarksurface = loadmodel->marksurfaces +
|
||||
LittleShort(in->firstmarksurface);
|
||||
out->nummarksurfaces = LittleShort(in->nummarksurfaces);
|
||||
|
||||
|
||||
p = LittleLong(in->visofs);
|
||||
if (p == -1)
|
||||
out->compressed_vis = NULL;
|
||||
else
|
||||
out->compressed_vis = loadmodel->visdata + p;
|
||||
out->efrags = NULL;
|
||||
|
||||
|
||||
for (j=0 ; j<4 ; j++)
|
||||
out->ambient_sound_level[j] = in->ambient_level[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -977,7 +975,7 @@ void Mod_LoadClipnodes (lump_t *l)
|
|||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->clipnodes = out;
|
||||
loadmodel->numclipnodes = count;
|
||||
|
@ -1086,12 +1084,12 @@ void Mod_MakeHull0 (void)
|
|||
dclipnode_t *out;
|
||||
int i, j, count;
|
||||
hull_t *hull;
|
||||
|
||||
hull = &loadmodel->hulls[0];
|
||||
|
||||
|
||||
hull = &loadmodel->hulls[0];
|
||||
|
||||
in = loadmodel->nodes;
|
||||
count = loadmodel->numnodes;
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
hull->clipnodes = out;
|
||||
hull->firstclipnode = 0;
|
||||
|
@ -1118,16 +1116,16 @@ Mod_LoadMarksurfaces
|
|||
=================
|
||||
*/
|
||||
void Mod_LoadMarksurfaces (lump_t *l)
|
||||
{
|
||||
{
|
||||
int i, j, count;
|
||||
short *in;
|
||||
msurface_t **out;
|
||||
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->marksurfaces = out;
|
||||
loadmodel->nummarksurfaces = count;
|
||||
|
@ -1147,15 +1145,15 @@ Mod_LoadSurfedges
|
|||
=================
|
||||
*/
|
||||
void Mod_LoadSurfedges (lump_t *l)
|
||||
{
|
||||
{
|
||||
int i, count;
|
||||
int *in, *out;
|
||||
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
out = Hunk_AllocName ( count*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->surfedges = out;
|
||||
loadmodel->numsurfedges = count;
|
||||
|
@ -1176,13 +1174,13 @@ void Mod_LoadPlanes (lump_t *l)
|
|||
dplane_t *in;
|
||||
int count;
|
||||
int bits;
|
||||
|
||||
|
||||
in = (void *)(mod_base + l->fileofs);
|
||||
if (l->filelen % sizeof(*in))
|
||||
SV_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||
count = l->filelen / sizeof(*in);
|
||||
out = Hunk_AllocName ( count*2*sizeof(*out), loadname);
|
||||
|
||||
out = Hunk_AllocName ( count*2*sizeof(*out), loadname);
|
||||
|
||||
loadmodel->planes = out;
|
||||
loadmodel->numplanes = count;
|
||||
|
||||
|
@ -1216,9 +1214,9 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
int i, j;
|
||||
dheader_t *header;
|
||||
mmodel_t *bm;
|
||||
|
||||
|
||||
loadmodel->type = mod_brush;
|
||||
|
||||
|
||||
header = (dheader_t *)buffer;
|
||||
|
||||
i = LittleLong (header->version);
|
||||
|
@ -1246,12 +1244,12 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
for (i = 0; i < HEADER_LUMPS; i++) {
|
||||
if (i == LUMP_ENTITIES)
|
||||
continue;
|
||||
mod->checksum ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs,
|
||||
mod->checksum ^= LittleLong(Com_BlockChecksum(mod_base + header->lumps[i].fileofs,
|
||||
header->lumps[i].filelen));
|
||||
|
||||
if (i == LUMP_VISIBILITY || i == LUMP_LEAFS || i == LUMP_NODES)
|
||||
continue;
|
||||
mod->checksum2 ^= Com_BlockChecksum(mod_base + header->lumps[i].fileofs,
|
||||
mod->checksum2 ^= Com_BlockChecksum(mod_base + header->lumps[i].fileofs,
|
||||
header->lumps[i].filelen);
|
||||
}
|
||||
|
||||
|
@ -1283,8 +1281,8 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
mod->funcs.LeafForPoint = Mod_LeafForPoint;
|
||||
mod->funcs.LeafPVS = Mod_LeafnumPVS;
|
||||
|
||||
|
||||
mod->numframes = 2; // regular and alternate animation
|
||||
|
||||
mod->numframes = 2; // regular and alternate animation
|
||||
//
|
||||
// set up the submodels (FIXME: this is confusing)
|
||||
//
|
||||
|
@ -1300,13 +1298,13 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
|||
mod->hulls[j].lastclipnode = mod->numclipnodes-1;
|
||||
Q1BSP_SetHullFuncs(&mod->hulls[j]);
|
||||
}
|
||||
|
||||
|
||||
mod->firstmodelsurface = bm->firstface;
|
||||
mod->nummodelsurfaces = bm->numfaces;
|
||||
|
||||
|
||||
VectorCopy (bm->maxs, mod->maxs);
|
||||
VectorCopy (bm->mins, mod->mins);
|
||||
|
||||
|
||||
mod->numleafs = bm->visleafs;
|
||||
|
||||
if (i < mod->numsubmodels-1)
|
||||
|
|
Loading…
Reference in a new issue