diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 4ebce8914..f1fcf389d 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -4802,6 +4802,8 @@ void CL_ExecInitialConfigs(char *resetcommand) SCR_ShowPic_Clear(true); Cbuf_AddText("unbindall\n", RESTRICT_LOCAL); + Cbuf_AddText("bind volup \"inc volume 0.1\"\n", RESTRICT_LOCAL); + Cbuf_AddText("bind voldown \"inc volume -0.1\"\n", RESTRICT_LOCAL); Cbuf_AddText("cl_warncmd 0\n", RESTRICT_LOCAL); Cbuf_AddText("cvar_purgedefaults\n", RESTRICT_LOCAL); //reset cvar defaults to their engine-specified values. the tail end of 'exec default.cfg' will update non-cheat defaults to mod-specified values. Cbuf_AddText("cvarreset *\n", RESTRICT_LOCAL); //reset all cvars to their current (engine) defaults @@ -4819,7 +4821,7 @@ void CL_ExecInitialConfigs(char *resetcommand) Cbuf_AddText ("exec hexen.rc\n", RESTRICT_LOCAL); else { //they didn't give us an rc file! - Cbuf_AddText ("bind ` toggleconsole\n", RESTRICT_LOCAL); //in case default.cfg does not exist. :( + // Cbuf_AddText ("bind ` toggleconsole\n", RESTRICT_LOCAL); //in case default.cfg does not exist. :( Cbuf_AddText ("exec default.cfg\n", RESTRICT_LOCAL); if (COM_FCheckExists ("config.cfg")) Cbuf_AddText ("exec config.cfg\n", RESTRICT_LOCAL); diff --git a/engine/client/image.c b/engine/client/image.c index e182295a9..0d323751a 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -2266,8 +2266,6 @@ void BoostGamma(qbyte *rgba, int width, int height) -#if defined(GLQUAKE) || defined(D3DQUAKE) - #ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 @@ -3108,8 +3106,6 @@ texid_t R_LoadBumpmapTexture(const char *name, const char *subpath) return r_nulltex; } -#endif - // ocrana led functions static int ledcolors[8][3] = { diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index e12554ce3..e8af7003a 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -4235,12 +4235,13 @@ typedef struct qbyte srcdata[1]; } mp3decoder_t; -static void S_MP3_Abort(sfx_t *sfx) +static void S_MP3_Purge(sfx_t *sfx) { mp3decoder_t *dec = sfx->decoder.buf; sfx->decoder.buf = NULL; - sfx->decoder.abort = NULL; + sfx->decoder.ended = NULL; + sfx->decoder.purge = NULL; sfx->decoder.decodedata = NULL; qacmStreamClose(dec->acm, 0); @@ -4374,7 +4375,8 @@ qboolean S_LoadMP3Sound (sfx_t *s, qbyte *data, int datalen, int sndspeed) memcpy(dec->srcdata, data, datalen); dec->srclen = datalen; s->decoder.buf = dec; - s->decoder.abort = S_MP3_Abort; + s->decoder.ended = S_MP3_Purge; + s->decoder.purge = S_MP3_Purge; s->decoder.decodedata = S_MP3_Locate; dec->dstdata = NULL; diff --git a/engine/client/menu.c b/engine/client/menu.c index d42ad5148..f84a028e3 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -1409,19 +1409,18 @@ int M_GameType (void) if (FS_Restarted(&cachedrestarts)) { + int q1 = COM_FDepthFile("gfx/sp_menu.lmp", true); + int h2 = COM_FDepthFile("gfx/menu/title2.lmp", true); #if defined(Q2CLIENT) - int q1, h2, q2; - - q1 = COM_FDepthFile("gfx/sp_menu.lmp", true); - h2 = COM_FDepthFile("gfx/menu/title2.lmp", true); - q2 = COM_FDepthFile("pics/m_banner_game.pcx", true); + int q2 = COM_FDepthFile("pics/m_banner_game.pcx", true); if (q2 < h2 && q2 < q1) cached = MGT_QUAKE2; - else if (h2 < q1) - cached = MGT_HEXEN2; else #endif + if (h2 < q1) + cached = MGT_HEXEN2; + else cached = MGT_QUAKE1; } diff --git a/engine/client/snd_al.c b/engine/client/snd_al.c index b8c3b81df..5baebcc87 100644 --- a/engine/client/snd_al.c +++ b/engine/client/snd_al.c @@ -572,10 +572,10 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned if (!sbuf.length && (chan->pos>>PITCHSHIFT) == sbuf.soundoffset) { chan->sfx = NULL; - if (sfx->decoder.abort) + if (sfx->decoder.ended) { if (!S_IsPlayingSomewhere(sfx)) - sfx->decoder.abort(sfx); + sfx->decoder.ended(sfx); } } sbuf.soundoffset = 0; diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 58089c92c..36421e618 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -2067,8 +2067,10 @@ void S_Purge(qboolean retaintouched) continue; /*stop the decoder first*/ - if (sfx->decoder.abort) - sfx->decoder.abort(sfx); + if (sfx->decoder.purge) + sfx->decoder.purge(sfx); + else if (sfx->decoder.ended) + sfx->decoder.ended(sfx); /*if there's any data associated still, kill it. if present, it should be a single sfxcache_t (with data in same alloc)*/ if (sfx->decoder.buf) @@ -2421,10 +2423,10 @@ void S_StopAllSounds(qboolean clear) { s = sc->channel[i].sfx; sc->channel[i].sfx = NULL; - if (s->decoder.abort) + if (s->decoder.ended) if (!S_IsPlayingSomewhere(s)) //if we aint playing it elsewhere, free it compleatly. { - s->decoder.abort(s); + s->decoder.ended(s); } if (sc->ChannelUpdate) sc->ChannelUpdate(sc, &sc->channel[i], true); @@ -2540,14 +2542,8 @@ void S_Music_Clear(sfx_t *onlyifsample) sc->channel[i].pos = 0; sc->channel[i].sfx = NULL; - if (s) - if (s->decoder.abort) - if (!S_IsPlayingSomewhere(s)) //if we aint playing it elsewhere, free it compleatly. - { - s->decoder.abort(s); -// if (s->cache.data) -// Cache_Free(&s->cache); - } + if (s && s->decoder.ended && !S_IsPlayingSomewhere(s)) //if we aint playing it elsewhere, free it compleatly. + s->decoder.ended(s); } } } diff --git a/engine/client/snd_mix.c b/engine/client/snd_mix.c index 3a4763696..d087cb278 100644 --- a/engine/client/snd_mix.c +++ b/engine/client/snd_mix.c @@ -162,10 +162,10 @@ void S_PaintChannels(soundcardinfo_t *sc, int endtime) else if (!ch->looping) { ch->sfx = NULL; - if (s->decoder.abort) + if (s->decoder.ended) { if (!S_IsPlayingSomewhere(s)) - s->decoder.abort(s); + s->decoder.ended(s); } } } @@ -265,10 +265,10 @@ void S_PaintChannels(soundcardinfo_t *sc, int endtime) else { // channel just stopped ch->sfx = NULL; - if (s->decoder.abort) + if (s->decoder.ended) { if (!S_IsPlayingSomewhere(s)) - s->decoder.abort(s); + s->decoder.ended(s); } break; } diff --git a/engine/client/snd_ov.c b/engine/client/snd_ov.c index 862a2ee24..d3730b5d7 100644 --- a/engine/client/snd_ov.c +++ b/engine/client/snd_ov.c @@ -93,7 +93,8 @@ qboolean S_LoadOVSound (sfx_t *s, qbyte *data, int datalen, int sndspeed) buffer->s = s; s->decoder.buf = buffer; s->decoder.decodedata = OV_DecodeSome; - s->decoder.abort = OV_CancelDecoder; + s->decoder.purge = OV_CancelDecoder; + s->decoder.ended = OV_CancelDecoder; if (!OV_StartDecode(data, datalen, buffer)) { @@ -248,7 +249,8 @@ void OV_CancelDecoder(sfx_t *s) dec = s->decoder.buf; s->decoder.buf = NULL; - s->decoder.abort = NULL; + s->decoder.purge = NULL; + s->decoder.ended = NULL; s->decoder.decodedata = NULL; p_ov_clear (&dec->vf); //close the decoder diff --git a/engine/client/sound.h b/engine/client/sound.h index c40d5bb8c..92a8e2211 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -40,19 +40,22 @@ typedef struct typedef struct { struct sfxcache_s *(*decodedata) (struct sfx_s *sfx, struct sfxcache_s *buf, int start, int length); //retrurn true when done. - void (*abort) (struct sfx_s *sfx); //it's not playing elsewhere. free entirly + void (*ended) (struct sfx_s *sfx); //sound stopped playing and is now silent (allow rewinding or something). + void (*purge) (struct sfx_s *sfx); //sound is being purged from memory. destroy everything. void *buf; } sfxdecode_t; typedef struct sfx_s { char name[MAX_OSPATH]; + sfxdecode_t decoder; + + qboolean failedload:1; //no more super-spammy + qboolean touched:1; //if the sound is still relevent + #ifdef AVAIL_OPENAL unsigned int openal_buffer; #endif - qboolean failedload:1; //no more super-spammy - qboolean touched:1; //if the sound is still relevent - sfxdecode_t decoder; } sfx_t; // !!! if this is changed, it much be changed in asm_i386.h too !!! diff --git a/engine/common/bothdefs.h b/engine/common/bothdefs.h index a3c86e119..050be0d2f 100644 --- a/engine/common/bothdefs.h +++ b/engine/common/bothdefs.h @@ -438,13 +438,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif //remove any options that depend upon GL. -#ifndef SERVERONLY - // undefine things not supported yet for D3D - #if defined(D3DQUAKE) && !defined(GLQUAKE) - #undef IMAGEFMT_DDS // this is dumb - #undef IMAGEFMT_BLP // this is dumb - #endif - +#if !defined(GLQUAKE) + #undef IMAGEFMT_DDS // this is dumb + #undef IMAGEFMT_BLP // this is dumb #endif #if !defined(Q3BSPS) diff --git a/engine/common/plugin.c b/engine/common/plugin.c index c01dffeb3..93357372c 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -780,6 +780,8 @@ static qintptr_t VARGS Plug_Net_TCPListen(void *offset, quintptr_t mask, const q int maxcount = VM_LONG(arg[2]); netadr_t a; + if (!currentplug) + return -3; //streams depend upon current plugin context. which isn't valid in a thread. if (!localip) localip = "0.0.0.0"; //pass "[::]" for ipv6 @@ -840,7 +842,7 @@ static qintptr_t VARGS Plug_Net_Accept(void *offset, quintptr_t mask, const qint int _true = 1; char adr[MAX_ADR_SIZE]; - if (handle < 0 || handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug || pluginstreamarray[handle].type != STREAM_SOCKET) + if (!currentplug || handle < 0 || handle >= pluginstreamarraylen || pluginstreamarray[handle].plugin != currentplug || pluginstreamarray[handle].type != STREAM_SOCKET) return -2; sock = pluginstreamarray[handle].socket; @@ -880,7 +882,7 @@ qintptr_t VARGS Plug_Net_TCPConnect(void *offset, quintptr_t mask, const qintptr int handle; vfsfile_t *stream = FS_OpenTCP(remoteip, remoteport); - if (!stream) + if (!currentplug || !stream) return -1; handle = Plug_NewStreamHandle(STREAM_VFS); pluginstreamarray[handle].vfs = stream; @@ -938,6 +940,8 @@ qintptr_t VARGS Plug_FS_Open(void *offset, quintptr_t mask, const qintptr_t *arg if (VM_OOB(arg[1], sizeof(int))) return -2; + if (!currentplug) + return -3; //streams depend upon current plugin context. which isn't valid in a thread. ret = VM_POINTER(arg[1]); *ret = -1; diff --git a/engine/dotnet2005/ftequake.vcproj b/engine/dotnet2005/ftequake.vcproj index 5ac545f3d..8d3692eda 100644 --- a/engine/dotnet2005/ftequake.vcproj +++ b/engine/dotnet2005/ftequake.vcproj @@ -771,6 +771,7 @@ AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include,../d3d,../d3d9,../libs/dxsdk9/include" PreprocessorDefinitions="_DEBUG;GLQUAKE;WIN32;_WINDOWS;MULTITHREAD;USE_MSVCRT_DEBUG" BasicRuntimeChecks="3" + SmallerTypeCheck="true" RuntimeLibrary="1" EnableFunctionLevelLinking="true" FloatingPointModel="2" @@ -779,6 +780,7 @@ BrowseInformation="1" WarningLevel="3" SuppressStartupBanner="true" + Detect64BitPortabilityProblems="true" DebugInformationFormat="3" DisableSpecificWarnings="4996" /> diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index 5ea2685a2..f0f209bcc 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -4202,7 +4202,7 @@ char *Shader_DefaultBSPWater(shader_t *s, const char *shortname) type = 3; else type = 0; - alpha = Shader_FloatArgument(s, "ALPHA"); + alpha = Shader_FloatArgument(s, "#ALPHA"); if (alpha) explicitalpha = true; else diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index bbfff2d8f..4ec8b5362 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -10587,18 +10587,18 @@ void PR_DumpPlatform_f(void) {"PFLAGS_FULLDYNAMIC", "const float", QW|NQ, "When set in self.pflags, enables fully-customised dynamic lights. Custom rtlight information is not otherwise used.", PFLAGS_FULLDYNAMIC}, //including these for csqc stat types. -// {"EV_VOID", "const float", QW|NQ, NULL, ev_void}, - {"EV_STRING", "const float", QW|NQ, NULL, ev_string}, - {"EV_FLOAT", "const float", QW|NQ, NULL, ev_float}, - {"EV_VECTOR", "const float", QW|NQ, NULL, ev_vector}, - {"EV_ENTITY", "const float", QW|NQ, NULL, ev_entity}, -// {"EV_FIELD", "const float", QW|NQ, NULL, ev_field}, - {"EV_FUNCTION", "const float", QW|NQ, NULL, ev_function}, - {"EV_POINTER", "const float", QW|NQ, NULL, ev_pointer}, - {"EV_INTEGER", "const float", QW|NQ, NULL, ev_integer}, - {"EV_VARIANT", "const float", QW|NQ, NULL, ev_variant}, -// {"EV_STRUCT", "const float", QW|NQ, NULL, ev_struct}, -// {"EV_UNION", "const float", QW|NQ, NULL, ev_union}, +// {"EV_VOID", "const float", QW|NQ|CS, NULL, ev_void}, + {"EV_STRING", "const float", QW|NQ|CS, NULL, ev_string}, + {"EV_FLOAT", "const float", QW|NQ|CS, NULL, ev_float}, + {"EV_VECTOR", "const float", QW|NQ|CS, NULL, ev_vector}, + {"EV_ENTITY", "const float", QW|NQ|CS, NULL, ev_entity}, +// {"EV_FIELD", "const float", QW|NQ|CS, NULL, ev_field}, + {"EV_FUNCTION", "const float", QW|NQ|CS, NULL, ev_function}, + {"EV_POINTER", "const float", QW|NQ|CS, NULL, ev_pointer}, + {"EV_INTEGER", "const float", QW|NQ|CS, NULL, ev_integer}, + {"EV_VARIANT", "const float", QW|NQ|CS, NULL, ev_variant}, +// {"EV_STRUCT", "const float", QW|NQ|CS, NULL, ev_struct}, +// {"EV_UNION", "const float", QW|NQ|CS, NULL, ev_union}, {"gamestate", "hashtable", ALL, "Special hash table index for hash_add and hash_get. Entries in this table will persist over map changes (and doesn't need to be created/deleted).", 0}, {"HASH_REPLACE", "const float", ALL, "Used with hash_add. Attempts to remove the old value instead of adding two values for a single key.", 256},