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
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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,9 +1664,11 @@ 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
|
||||
|
@ -1673,19 +1676,19 @@ void Cmd_ExecuteString (char *text, int level)
|
|||
(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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -69,6 +69,10 @@ struct sockaddr;
|
|||
#define closesocket close
|
||||
#define ioctlsocket ioctl
|
||||
|
||||
#ifndef INVALID_SOCKET
|
||||
#define INVALID_SOCKET -1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -255,7 +256,7 @@ void NPP_AddData(void *data, int 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) {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -509,60 +510,38 @@ 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)
|
||||
|
@ -572,6 +551,7 @@ NPP_CheckDest(dest);
|
|||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(char));
|
||||
ClientReliableWrite_Angle(cl, in);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -579,15 +559,15 @@ 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) {
|
||||
|
@ -596,6 +576,7 @@ NPP_CheckDest(dest);
|
|||
{
|
||||
ClientReliableCheckBlock(cl, sizeof(float));
|
||||
ClientReliableWrite_Coord(cl, in);
|
||||
return;
|
||||
}
|
||||
} else
|
||||
MSG_WriteCoord (NQWriteDest(dest), in);
|
||||
|
@ -611,13 +592,13 @@ 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) {
|
||||
|
@ -626,6 +607,7 @@ NPP_CheckDest(dest);
|
|||
{
|
||||
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)
|
||||
|
@ -664,13 +646,14 @@ NPP_CheckDest(dest);
|
|||
{
|
||||
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;
|
||||
|
@ -786,7 +768,7 @@ void NPP_QWFlush(void)
|
|||
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;
|
||||
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;
|
||||
|
@ -947,9 +956,10 @@ void NPP_QWWriteByte(int dest, qbyte data) //replacement write func (nq to qw)
|
|||
{
|
||||
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
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,133 +1094,75 @@ 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();
|
||||
}
|
||||
void NPP_QWWriteCoord(int dest, float in) //replacement write func (nq to qw)
|
||||
{
|
||||
short datas = (int)(in*8);
|
||||
float dataf = in;
|
||||
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(float));
|
||||
ClientReliableWrite_Coord(cl, in);
|
||||
}
|
||||
} else
|
||||
MSG_WriteCoord (WriteDest(dest), in);
|
||||
#endif
|
||||
|
||||
if (sizeofcoord==4)
|
||||
if (sizeofangle==1)
|
||||
{
|
||||
dataf = LittleFloat(dataf);
|
||||
NPP_AddData(&dataf, sizeof(float));
|
||||
char data = (int)(in*256/360) & 255;
|
||||
NPP_NQWriteChar(dest, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
datas = LittleShort(datas);
|
||||
NPP_AddData(&datas, sizeof(short));
|
||||
short data = (int)(in*0xffff/360) & 0xffff;
|
||||
NPP_NQWriteShort(dest, data);
|
||||
}
|
||||
}
|
||||
void NPP_QWWriteCoord(int dest, float in) //replacement write func (nq to qw)
|
||||
{
|
||||
if (sizeofcoord==4)
|
||||
{
|
||||
NPP_QWWriteFloat(dest, in);
|
||||
}
|
||||
else
|
||||
{
|
||||
short datas = (int)(in*8);
|
||||
NPP_QWWriteShort(dest, datas);
|
||||
}
|
||||
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);
|
||||
Con_Printf("QWWriteString: Messages should start with WriteByte (last was %i)\n", majortype);
|
||||
|
||||
#ifdef NQPROT
|
||||
if (dest == MSG_ONE) {
|
||||
|
@ -1219,9 +1171,10 @@ void NPP_QWWriteString(int dest, char *data) //replacement write func (nq to qw)
|
|||
{
|
||||
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]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/*
|
||||
===================
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -284,6 +284,7 @@ void SVNQ_New_f (void)
|
|||
MSG_WriteByte (&host_client->netchan.message, svc_serverdata);
|
||||
switch(host_client->protocol)
|
||||
{
|
||||
#ifdef NQPROT
|
||||
case SCP_NETQUAKE:
|
||||
MSG_WriteLong (&host_client->netchan.message, NQ_PROTOCOL_VERSION);
|
||||
MSG_WriteByte (&host_client->netchan.message, 16);
|
||||
|
@ -296,6 +297,7 @@ void SVNQ_New_f (void)
|
|||
MSG_WriteLong (&host_client->netchan.message, DP7_PROTOCOL_VERSION);
|
||||
MSG_WriteByte (&host_client->netchan.message, sv.allocated_client_slots);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
host_client->drop = true;
|
||||
break;
|
||||
|
@ -1231,8 +1233,9 @@ void SV_Begin_f (void)
|
|||
ge->ClientBegin(split->q2edict);
|
||||
split->istobeloaded = false;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
else if (split->istobeloaded)
|
||||
if (split->istobeloaded)
|
||||
{
|
||||
sendangles = true;
|
||||
split->istobeloaded = false;
|
||||
|
|
|
@ -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;
|
||||
|
@ -782,7 +780,7 @@ void CalcSurfaceExtents (msurface_t *s)
|
|||
// SV_Error ("Bad surface extents");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
|
||||
/*
|
||||
=================
|
||||
|
|
Loading…
Reference in a new issue