From 1c26738095d9b4f3e4f0ea4ea2aebb9de19d033c Mon Sep 17 00:00:00 2001 From: Spoike Date: Wed, 17 Apr 2019 00:50:14 +0000 Subject: [PATCH] Misc compile fixes. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5448 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/in_generic.c | 27 +++++++++++++++------------ engine/client/in_sdl.c | 2 +- engine/client/snd_dma.c | 37 +++++++++++++++++++++++++++++++++++-- engine/client/sys_droid.c | 13 ++++++++----- engine/client/sys_sdl.c | 10 ++++++++-- engine/d3d/d3d11_backend.c | 6 +++--- engine/d3d/d3d_backend.c | 6 +++--- engine/d3d/vid_d3d11.c | 2 +- 8 files changed, 74 insertions(+), 29 deletions(-) diff --git a/engine/client/in_generic.c b/engine/client/in_generic.c index b6a3d3683..6671218aa 100644 --- a/engine/client/in_generic.c +++ b/engine/client/in_generic.c @@ -85,18 +85,20 @@ static cvar_t joy_advaxis[6] = }; static cvar_t joy_advaxisscale[6] = { - CVARD("joyadvaxisx_scale", "1.0", "Because joyadvaxisx etc can be added together, this provides a way to rescale or invert an individual axis without affecting another with the same action."), - CVAR("joyadvaxisy_scale", "1.0"), - CVAR("joyadvaxisz_scale", "1.0"), - CVAR("joyadvaxisr_scale", "1.0"), - CVAR("joyadvaxisu_scale", "1.0"), - CVAR("joyadvaxisv_scale", "1.0") +#define ADVAXISSCALEDESC "Because joyadvaxisx etc can be added together, this provides a way to rescale or invert an individual axis without affecting another with the same action." + CVARD("joyadvaxisx_scale", "1.0", ADVAXISSCALEDESC), + CVARD("joyadvaxisy_scale", "1.0", ADVAXISSCALEDESC), + CVARD("joyadvaxisz_scale", "1.0", ADVAXISSCALEDESC), + CVARD("joyadvaxisr_scale", "1.0", ADVAXISSCALEDESC), + CVARD("joyadvaxisu_scale", "1.0", ADVAXISSCALEDESC), + CVARD("joyadvaxisv_scale", "1.0", ADVAXISSCALEDESC) }; static cvar_t joy_anglesens[3] = { - CVARD("joypitchsensitivity", "0.5", "Scaler value for the controller when it is at its most extreme value"), - CVAR("joyyawsensitivity", "-1.0"), - CVAR("joyrollsensitivity", "1.0") +#define ANGLESENSDESC "Scaler value for the controller when it is at its most extreme value" + CVARD("joypitchsensitivity", "0.5", ANGLESENSDESC), + CVARD("joyyawsensitivity", "-1.0", ANGLESENSDESC), + CVARD("joyrollsensitivity", "1.0", ANGLESENSDESC) }; static cvar_t joy_movesens[3] = { @@ -107,9 +109,10 @@ static cvar_t joy_movesens[3] = //comments on threshholds comes from microsoft's xinput docs. static cvar_t joy_anglethreshold[3] = { - CVARD("joypitchthreshold", "0.19", "Values reported near the center of the analog joystick/controller are often erroneous and undesired.\nThe joystick threshholds are how much of the total values to ignore."), //8689/32767 (right thumb) - CVAR("joyyawthreshold", "0.19"), //8689/32767 (right thumb) - CVAR("joyrollthreshold", "0.118"), //30/255 (trigger) +#define ANGLETHRESHOLDDESC "Values reported near the center of the analog joystick/controller are often erroneous and undesired.\nThe joystick threshholds are how much of the total values to ignore." + CVARD("joypitchthreshold", "0.19", ANGLETHRESHOLDDESC), //8689/32767 (right thumb) + CVARD("joyyawthreshold", "0.19", ANGLETHRESHOLDDESC), //8689/32767 (right thumb) + CVARD("joyrollthreshold", "0.118", ANGLETHRESHOLDDESC), //30/255 (trigger) }; static cvar_t joy_movethreshold[3] = { diff --git a/engine/client/in_sdl.c b/engine/client/in_sdl.c index f388f41bf..fe69d0751 100644 --- a/engine/client/in_sdl.c +++ b/engine/client/in_sdl.c @@ -868,7 +868,7 @@ void Sys_SendKeyEvents(void) { unsigned int uc; int err; - char *text = event.text.text; + const char *text = event.text.text; while(*text) { uc = utf8_decode(&err, text, &text); diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 6c27c98cd..394441f62 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -158,8 +158,10 @@ cvar_t snd_voip_play = CVARAFCD("cl_voip_play", "1", NULL, CVAR_ARCHIVE, S_Voi cvar_t snd_voip_ducking = CVARAFD("cl_voip_ducking", "0.5", NULL, CVAR_ARCHIVE, "Scales game audio by this much when someone is talking to you. Does not affect your speaker volume when you speak (minimum of cl_voip_capturingvol and cl_voip_ducking is used)."); cvar_t snd_voip_micamp = CVARAFD("cl_voip_micamp", "2", NULL, CVAR_ARCHIVE, "Amplifies your microphone when using voip."); cvar_t snd_voip_codec = CVARAFD("cl_voip_codec", "", NULL, CVAR_ARCHIVE, "0: speex(@11khz). 1: raw. 2: opus. 3: speex(@8khz). 4: speex(@16). 5:speex(@32). 6: pcma. 7: pcmu."); +#ifdef HAVE_SPEEX cvar_t snd_voip_noisefilter = CVARAFD("cl_voip_noisefilter", "1", NULL, CVAR_ARCHIVE, "Enable the use of the noise cancelation filter."); cvar_t snd_voip_autogain = CVARAFD("cl_voip_autogain", "0", NULL, CVAR_ARCHIVE, "Attempts to normalize your voice levels to a standard level. Useful for lazy people, but interferes with voice activation levels."); +#endif cvar_t snd_voip_bitrate = CVARAFD("cl_voip_bitrate", "3000", NULL, CVAR_ARCHIVE, "For codecs with non-specific bitrates, this specifies the target bitrate to use."); #endif @@ -700,17 +702,21 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un //make sure old state is closed properly. switch(s_voip.deccodec[sender]) { +#ifdef HAVE_SPEEX case VOIP_SPEEX_OLD: case VOIP_SPEEX_NARROW: case VOIP_SPEEX_WIDE: case VOIP_SPEEX_ULTRAWIDE: qspeex_decoder_destroy(s_voip.decoder[sender]); break; +#endif case VOIP_RAW16: break; +#ifdef HAVE_OPUS case VOIP_OPUS: qopus_decoder_destroy(s_voip.decoder[sender]); break; +#endif } s_voip.decoder[sender] = NULL; s_voip.deccodec[sender] = VOIP_INVALID; @@ -728,6 +734,7 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un s_voip.decsamplerate[sender] = 8000; s_voip.decframesize[sender] = 8000/20; break; +#ifdef HAVE_SPEEX case VOIP_SPEEX_OLD: case VOIP_SPEEX_NARROW: case VOIP_SPEEX_WIDE: @@ -772,6 +779,8 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un qspeex_bits_reset(&s_voip.speex.decbits[sender]); } break; +#endif +#ifdef HAVE_OPUS case VOIP_OPUS: if (!S_Opus_Init()) return; @@ -799,6 +808,7 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un else qopus_decoder_ctl(s_voip.decoder[sender], OPUS_RESET_STATE); break; +#endif } s_voip.deccodec[sender] = codec; s_voip.decgen[sender] = gen; @@ -824,6 +834,7 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un case VOIP_PCMA: case VOIP_PCMU: break; +#ifdef HAVE_SPEEX case VOIP_SPEEX_OLD: case VOIP_SPEEX_NARROW: case VOIP_SPEEX_WIDE: @@ -831,11 +842,14 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un qspeex_decode_int(s_voip.decoder[sender], NULL, decodebuf + decodesamps); decodesamps += s_voip.decframesize[sender]; break; +#endif +#ifdef HAVE_OPUS case VOIP_OPUS: r = qopus_decode(s_voip.decoder[sender], NULL, 0, decodebuf + decodesamps, min(s_voip.decframesize[sender], sizeof(decodebuf)/sizeof(decodebuf[0]) - decodesamps), false); if (r > 0) decodesamps += r; break; +#endif } s_voip.decseq[sender]++; } @@ -973,16 +987,20 @@ qboolean S_Voip_RTP_CodecOkay(const char *codec) { switch(S_Voip_NameToId(codec)) { +#ifdef HAVE_SPEEX case VOIP_SPEEX_NARROW: case VOIP_SPEEX_OLD: case VOIP_SPEEX_WIDE: case VOIP_SPEEX_ULTRAWIDE: return S_Speex_Init(); +#endif case VOIP_PCMA: case VOIP_PCMU: return true; +#ifdef HAVE_OPUS case VOIP_OPUS: return S_Opus_Init(); +#endif default: return false; } @@ -1034,8 +1052,10 @@ static float S_Voip_Preprocess(short *start, unsigned int samples, float micamp) int framesize = s_voip.encframesize; while(samples >= framesize) { +#ifdef HAVE_SPEEX if (s_voip.speexdsp.preproc) qspeex_preprocess_run(s_voip.speexdsp.preproc, start); +#endif for (i = 0; i < framesize; i++) { f = start[i] * micamp; @@ -1317,17 +1337,21 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf) //reset codecs so they start with a clean slate when new audio blocks are generated. switch(s_voip.enccodec) { +#ifdef HAVE_SPEEX case VOIP_SPEEX_OLD: case VOIP_SPEEX_NARROW: case VOIP_SPEEX_WIDE: case VOIP_SPEEX_ULTRAWIDE: qspeex_bits_reset(&s_voip.speex.encbits); break; +#endif case VOIP_RAW16: break; +#ifdef HAVE_OPUS case VOIP_OPUS: qopus_encoder_ctl(s_voip.encoder, OPUS_RESET_STATE); break; +#endif } } else @@ -1360,6 +1384,7 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf) { start = (short*)(s_voip.capturebuf + encpos); +#ifdef HAVE_SPEEX if (snd_voip_noisefilter.ival || snd_voip_autogain.ival) { if (!s_voip.speexdsp.preproc || snd_voip_noisefilter.modified || snd_voip_noisefilter.modified || s_voip.speexdsp.curframesize != s_voip.encframesize || s_voip.speexdsp.cursamplerate != s_voip.encsamplerate) @@ -1386,6 +1411,7 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf) qspeex_preprocess_state_destroy(s_voip.speexdsp.preproc); s_voip.speexdsp.preproc = NULL; } +#endif switch(s_voip.enccodec) { @@ -1630,13 +1656,18 @@ static void S_Voip_Disable_f(void) } static void S_Voip_f(void) { - int i; +#ifdef HAVE_SPEEX if (!strcmp(Cmd_Argv(1), "maxgain")) { - i = atoi(Cmd_Argv(2)); + int i = atoi(Cmd_Argv(2)); if (s_voip.speexdsp.preproc) qspeex_preprocess_ctl(s_voip.speexdsp.preproc, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, &i); } + else +#endif + { + Con_Printf("unrecognised parameter \"%s\"\n", Cmd_Argv(1)); + } } static void QDECL S_Voip_Play_Callback(cvar_t *var, char *oldval) { @@ -1695,8 +1726,10 @@ void S_Voip_Init(void) Cvar_Register(&snd_voip_ducking, "Voice Chat"); Cvar_Register(&snd_voip_micamp, "Voice Chat"); Cvar_Register(&snd_voip_codec, "Voice Chat"); +#ifdef HAVE_SPEEX Cvar_Register(&snd_voip_noisefilter, "Voice Chat"); Cvar_Register(&snd_voip_autogain, "Voice Chat"); +#endif Cvar_Register(&snd_voip_bitrate, "Voice Chat"); Cmd_AddCommand("+voip", S_Voip_Enable_f); Cmd_AddCommand("-voip", S_Voip_Disable_f); diff --git a/engine/client/sys_droid.c b/engine/client/sys_droid.c index d06478b6a..517da8633 100644 --- a/engine/client/sys_droid.c +++ b/engine/client/sys_droid.c @@ -16,14 +16,17 @@ #error ANDROID wasnt defined #endif +#if 0 +//FIXME: remove the nativeactivity shit. android's standard NativeActivity class is buggy and basically fucked. #include #include -//NOTE: This is apache 2.0, which means GPL3.0+ ONLY, no gpl2. -//#include <../../../../../sources/android/native_app_glue/android_native_app_glue.h> //Fucking frameworks suck big hairy donkey balls. -//JNIEXPORT void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_t savedStateSize); -//#include <../../../../../sources/android/native_app_glue/android_native_app_glue.c> //Fucking frameworks suck big hairy donkey balls. -//FIXME: remove that shit. android's standard NativeActivity class is buggy and basically fucked. // ANativeWindow_fromSurface((jobject)getSurfaceHolder().getSurface()) +#else +//NOTE: This is apache 2.0, which means GPL3.0+ ONLY, no gpl2. +#include <../../../../../sources/android/native_app_glue/android_native_app_glue.h> //Fucking frameworks suck big hairy donkey balls. +JNIEXPORT void ANativeActivity_onCreate(ANativeActivity* activity, void* savedState, size_t savedStateSize); +#include <../../../../../sources/android/native_app_glue/android_native_app_glue.c> //Fucking frameworks suck big hairy donkey balls. +#endif #ifndef isDedicated #ifdef SERVERONLY diff --git a/engine/client/sys_sdl.c b/engine/client/sys_sdl.c index 955fdb98a..8686686a7 100644 --- a/engine/client/sys_sdl.c +++ b/engine/client/sys_sdl.c @@ -587,7 +587,7 @@ void Sys_Clipboard_PasteText(clipboardtype_t cbt, void (*callback)(void *cb, cha { callback(ctx, SDL_GetClipboardText()); } -void Sys_SaveClipboard(clipboardtype_t cbt, char *text) +void Sys_SaveClipboard(clipboardtype_t cbt, const char *text) { SDL_SetClipboardText(text); } @@ -597,7 +597,7 @@ void Sys_Clipboard_PasteText(clipboardtype_t cbt, void (*callback)(void *cb, cha { callback(ctx, clipboard_buffer); } -void Sys_SaveClipboard(clipboardtype_t cbt, char *text) +void Sys_SaveClipboard(clipboardtype_t cbt, const char *text) { free(clipboard_buffer); clipboard_buffer = strdup(text); @@ -726,6 +726,12 @@ void Sys_Sleep (double seconds) SDL_Delay(seconds * 1000); } +#ifdef WEBCLIENT +qboolean Sys_RunInstaller(void) +{ //not implemented + return false; +} +#endif #ifdef HAVEAUTOUPDATE //legacy, so old build can still deal with updates properly diff --git a/engine/d3d/d3d11_backend.c b/engine/d3d/d3d11_backend.c index 18db93cba..ce1c7d0c6 100644 --- a/engine/d3d/d3d11_backend.c +++ b/engine/d3d/d3d11_backend.c @@ -3551,10 +3551,10 @@ void D3D11BE_SubmitMeshes (batch_t **worldbatches, batch_t **blist, int first, i } #ifdef RTLIGHTS -void D3D11BE_BaseEntTextures(void) +void D3D11BE_BaseEntTextures(qbyte *worldpvs) { batch_t *batches[SHADER_SORT_COUNT]; - BE_GenModelBatches(batches, shaderstate.curdlight, shaderstate.mode); + BE_GenModelBatches(batches, shaderstate.curdlight, shaderstate.mode, worldpvs); D3D11BE_SubmitMeshes(NULL, batches, SHADER_SORT_PORTAL, SHADER_SORT_SEETHROUGH+1); BE_SelectEntity(&r_worldentity); } @@ -3673,7 +3673,7 @@ void D3D11BE_DrawWorld (batch_t **worldbatches) D3D11BE_SetupViewCBuffer(); shaderstate.curdlight = NULL; - BE_GenModelBatches(batches, shaderstate.curdlight, BEM_STANDARD); + BE_GenModelBatches(batches, shaderstate.curdlight, BEM_STANDARD, r_refdef.scenevis); if (r_refdef.scenevis) { diff --git a/engine/d3d/d3d_backend.c b/engine/d3d/d3d_backend.c index b419a14b2..fd09fa9a7 100644 --- a/engine/d3d/d3d_backend.c +++ b/engine/d3d/d3d_backend.c @@ -4020,10 +4020,10 @@ void D3D9BE_SubmitMeshes (batch_t **worldbatches, batch_t **blist, int first, in } #ifdef RTLIGHTS -void D3D9BE_BaseEntTextures(void) +void D3D9BE_BaseEntTextures(qbyte *worldpvs) { batch_t *batches[SHADER_SORT_COUNT]; - BE_GenModelBatches(batches, shaderstate.curdlight, shaderstate.mode); + BE_GenModelBatches(batches, shaderstate.curdlight, shaderstate.mode, worldpvs); D3D9BE_SubmitMeshes(NULL, batches, SHADER_SORT_PORTAL, SHADER_SORT_SEETHROUGH+1); BE_SelectEntity(&r_worldentity); } @@ -4087,7 +4087,7 @@ void D3D9BE_DrawWorld (batch_t **worldbatches) } shaderstate.curdlight = NULL; - BE_GenModelBatches(batches, shaderstate.curdlight, BEM_STANDARD); + BE_GenModelBatches(batches, shaderstate.curdlight, BEM_STANDARD, r_refdef.scenevis); if (worldbatches) { diff --git a/engine/d3d/vid_d3d11.c b/engine/d3d/vid_d3d11.c index d11d7e28a..420ae5630 100644 --- a/engine/d3d/vid_d3d11.c +++ b/engine/d3d/vid_d3d11.c @@ -183,7 +183,7 @@ void D3D11_ApplyRenderTargets(qboolean usedepth) if (*r_refdef.rt_depth.texname) depth = R2D_RT_GetTexture(r_refdef.rt_depth.texname, &width, &height); else - depth = R2D_RT_Configure("depth", width, height, TF_DEPTH24, RT_IMAGEFLAGS); + depth = R2D_RT_Configure("depth", width, height, PTI_DEPTH24, RT_IMAGEFLAGS); } else depth = NULL;