fix a couple of issues.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4750 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-09-12 13:14:51 +00:00
parent 389a2ee285
commit 1daac61ea9
14 changed files with 63 additions and 61 deletions

View file

@ -4802,6 +4802,8 @@ void CL_ExecInitialConfigs(char *resetcommand)
SCR_ShowPic_Clear(true); SCR_ShowPic_Clear(true);
Cbuf_AddText("unbindall\n", RESTRICT_LOCAL); 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("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("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 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); Cbuf_AddText ("exec hexen.rc\n", RESTRICT_LOCAL);
else else
{ //they didn't give us an rc file! { //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); Cbuf_AddText ("exec default.cfg\n", RESTRICT_LOCAL);
if (COM_FCheckExists ("config.cfg")) if (COM_FCheckExists ("config.cfg"))
Cbuf_AddText ("exec config.cfg\n", RESTRICT_LOCAL); Cbuf_AddText ("exec config.cfg\n", RESTRICT_LOCAL);

View file

@ -2266,8 +2266,6 @@ void BoostGamma(qbyte *rgba, int width, int height)
#if defined(GLQUAKE) || defined(D3DQUAKE)
#ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT #ifndef GL_COMPRESSED_RGB_S3TC_DXT1_EXT
#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 #define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 #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; return r_nulltex;
} }
#endif
// ocrana led functions // ocrana led functions
static int ledcolors[8][3] = static int ledcolors[8][3] =
{ {

View file

@ -4235,12 +4235,13 @@ typedef struct
qbyte srcdata[1]; qbyte srcdata[1];
} mp3decoder_t; } mp3decoder_t;
static void S_MP3_Abort(sfx_t *sfx) static void S_MP3_Purge(sfx_t *sfx)
{ {
mp3decoder_t *dec = sfx->decoder.buf; mp3decoder_t *dec = sfx->decoder.buf;
sfx->decoder.buf = NULL; sfx->decoder.buf = NULL;
sfx->decoder.abort = NULL; sfx->decoder.ended = NULL;
sfx->decoder.purge = NULL;
sfx->decoder.decodedata = NULL; sfx->decoder.decodedata = NULL;
qacmStreamClose(dec->acm, 0); 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); memcpy(dec->srcdata, data, datalen);
dec->srclen = datalen; dec->srclen = datalen;
s->decoder.buf = dec; 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; s->decoder.decodedata = S_MP3_Locate;
dec->dstdata = NULL; dec->dstdata = NULL;

View file

@ -1409,19 +1409,18 @@ int M_GameType (void)
if (FS_Restarted(&cachedrestarts)) 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) #if defined(Q2CLIENT)
int q1, h2, q2; int q2 = COM_FDepthFile("pics/m_banner_game.pcx", true);
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);
if (q2 < h2 && q2 < q1) if (q2 < h2 && q2 < q1)
cached = MGT_QUAKE2; cached = MGT_QUAKE2;
else if (h2 < q1)
cached = MGT_HEXEN2;
else else
#endif #endif
if (h2 < q1)
cached = MGT_HEXEN2;
else
cached = MGT_QUAKE1; cached = MGT_QUAKE1;
} }

View file

@ -572,10 +572,10 @@ static void OpenAL_ChannelUpdate(soundcardinfo_t *sc, channel_t *chan, unsigned
if (!sbuf.length && (chan->pos>>PITCHSHIFT) == sbuf.soundoffset) if (!sbuf.length && (chan->pos>>PITCHSHIFT) == sbuf.soundoffset)
{ {
chan->sfx = NULL; chan->sfx = NULL;
if (sfx->decoder.abort) if (sfx->decoder.ended)
{ {
if (!S_IsPlayingSomewhere(sfx)) if (!S_IsPlayingSomewhere(sfx))
sfx->decoder.abort(sfx); sfx->decoder.ended(sfx);
} }
} }
sbuf.soundoffset = 0; sbuf.soundoffset = 0;

View file

@ -2067,8 +2067,10 @@ void S_Purge(qboolean retaintouched)
continue; continue;
/*stop the decoder first*/ /*stop the decoder first*/
if (sfx->decoder.abort) if (sfx->decoder.purge)
sfx->decoder.abort(sfx); 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 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) if (sfx->decoder.buf)
@ -2421,10 +2423,10 @@ void S_StopAllSounds(qboolean clear)
{ {
s = sc->channel[i].sfx; s = sc->channel[i].sfx;
sc->channel[i].sfx = NULL; 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. if (!S_IsPlayingSomewhere(s)) //if we aint playing it elsewhere, free it compleatly.
{ {
s->decoder.abort(s); s->decoder.ended(s);
} }
if (sc->ChannelUpdate) if (sc->ChannelUpdate)
sc->ChannelUpdate(sc, &sc->channel[i], true); 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].pos = 0;
sc->channel[i].sfx = NULL; sc->channel[i].sfx = NULL;
if (s) if (s && s->decoder.ended && !S_IsPlayingSomewhere(s)) //if we aint playing it elsewhere, free it compleatly.
if (s->decoder.abort) s->decoder.ended(s);
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);
}
} }
} }
} }

View file

@ -162,10 +162,10 @@ void S_PaintChannels(soundcardinfo_t *sc, int endtime)
else if (!ch->looping) else if (!ch->looping)
{ {
ch->sfx = NULL; ch->sfx = NULL;
if (s->decoder.abort) if (s->decoder.ended)
{ {
if (!S_IsPlayingSomewhere(s)) 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 else
{ // channel just stopped { // channel just stopped
ch->sfx = NULL; ch->sfx = NULL;
if (s->decoder.abort) if (s->decoder.ended)
{ {
if (!S_IsPlayingSomewhere(s)) if (!S_IsPlayingSomewhere(s))
s->decoder.abort(s); s->decoder.ended(s);
} }
break; break;
} }

View file

@ -93,7 +93,8 @@ qboolean S_LoadOVSound (sfx_t *s, qbyte *data, int datalen, int sndspeed)
buffer->s = s; buffer->s = s;
s->decoder.buf = buffer; s->decoder.buf = buffer;
s->decoder.decodedata = OV_DecodeSome; 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)) if (!OV_StartDecode(data, datalen, buffer))
{ {
@ -248,7 +249,8 @@ void OV_CancelDecoder(sfx_t *s)
dec = s->decoder.buf; dec = s->decoder.buf;
s->decoder.buf = NULL; s->decoder.buf = NULL;
s->decoder.abort = NULL; s->decoder.purge = NULL;
s->decoder.ended = NULL;
s->decoder.decodedata = NULL; s->decoder.decodedata = NULL;
p_ov_clear (&dec->vf); //close the decoder p_ov_clear (&dec->vf); //close the decoder

View file

@ -40,19 +40,22 @@ typedef struct
typedef struct { typedef struct {
struct sfxcache_s *(*decodedata) (struct sfx_s *sfx, struct sfxcache_s *buf, int start, int length); //retrurn true when done. 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; void *buf;
} sfxdecode_t; } sfxdecode_t;
typedef struct sfx_s typedef struct sfx_s
{ {
char name[MAX_OSPATH]; 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 #ifdef AVAIL_OPENAL
unsigned int openal_buffer; unsigned int openal_buffer;
#endif #endif
qboolean failedload:1; //no more super-spammy
qboolean touched:1; //if the sound is still relevent
sfxdecode_t decoder;
} sfx_t; } sfx_t;
// !!! if this is changed, it much be changed in asm_i386.h too !!! // !!! if this is changed, it much be changed in asm_i386.h too !!!

View file

@ -438,13 +438,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif #endif
//remove any options that depend upon GL. //remove any options that depend upon GL.
#ifndef SERVERONLY #if !defined(GLQUAKE)
// undefine things not supported yet for D3D #undef IMAGEFMT_DDS // this is dumb
#if defined(D3DQUAKE) && !defined(GLQUAKE) #undef IMAGEFMT_BLP // this is dumb
#undef IMAGEFMT_DDS // this is dumb
#undef IMAGEFMT_BLP // this is dumb
#endif
#endif #endif
#if !defined(Q3BSPS) #if !defined(Q3BSPS)

View file

@ -780,6 +780,8 @@ static qintptr_t VARGS Plug_Net_TCPListen(void *offset, quintptr_t mask, const q
int maxcount = VM_LONG(arg[2]); int maxcount = VM_LONG(arg[2]);
netadr_t a; netadr_t a;
if (!currentplug)
return -3; //streams depend upon current plugin context. which isn't valid in a thread.
if (!localip) if (!localip)
localip = "0.0.0.0"; //pass "[::]" for ipv6 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; int _true = 1;
char adr[MAX_ADR_SIZE]; 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; return -2;
sock = pluginstreamarray[handle].socket; sock = pluginstreamarray[handle].socket;
@ -880,7 +882,7 @@ qintptr_t VARGS Plug_Net_TCPConnect(void *offset, quintptr_t mask, const qintptr
int handle; int handle;
vfsfile_t *stream = FS_OpenTCP(remoteip, remoteport); vfsfile_t *stream = FS_OpenTCP(remoteip, remoteport);
if (!stream) if (!currentplug || !stream)
return -1; return -1;
handle = Plug_NewStreamHandle(STREAM_VFS); handle = Plug_NewStreamHandle(STREAM_VFS);
pluginstreamarray[handle].vfs = stream; 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))) if (VM_OOB(arg[1], sizeof(int)))
return -2; 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 = VM_POINTER(arg[1]);
*ret = -1; *ret = -1;

View file

@ -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" 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" PreprocessorDefinitions="_DEBUG;GLQUAKE;WIN32;_WINDOWS;MULTITHREAD;USE_MSVCRT_DEBUG"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
SmallerTypeCheck="true"
RuntimeLibrary="1" RuntimeLibrary="1"
EnableFunctionLevelLinking="true" EnableFunctionLevelLinking="true"
FloatingPointModel="2" FloatingPointModel="2"
@ -779,6 +780,7 @@
BrowseInformation="1" BrowseInformation="1"
WarningLevel="3" WarningLevel="3"
SuppressStartupBanner="true" SuppressStartupBanner="true"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3" DebugInformationFormat="3"
DisableSpecificWarnings="4996" DisableSpecificWarnings="4996"
/> />

View file

@ -4202,7 +4202,7 @@ char *Shader_DefaultBSPWater(shader_t *s, const char *shortname)
type = 3; type = 3;
else else
type = 0; type = 0;
alpha = Shader_FloatArgument(s, "ALPHA"); alpha = Shader_FloatArgument(s, "#ALPHA");
if (alpha) if (alpha)
explicitalpha = true; explicitalpha = true;
else else

View file

@ -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}, {"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. //including these for csqc stat types.
// {"EV_VOID", "const float", QW|NQ, NULL, ev_void}, // {"EV_VOID", "const float", QW|NQ|CS, NULL, ev_void},
{"EV_STRING", "const float", QW|NQ, NULL, ev_string}, {"EV_STRING", "const float", QW|NQ|CS, NULL, ev_string},
{"EV_FLOAT", "const float", QW|NQ, NULL, ev_float}, {"EV_FLOAT", "const float", QW|NQ|CS, NULL, ev_float},
{"EV_VECTOR", "const float", QW|NQ, NULL, ev_vector}, {"EV_VECTOR", "const float", QW|NQ|CS, NULL, ev_vector},
{"EV_ENTITY", "const float", QW|NQ, NULL, ev_entity}, {"EV_ENTITY", "const float", QW|NQ|CS, NULL, ev_entity},
// {"EV_FIELD", "const float", QW|NQ, NULL, ev_field}, // {"EV_FIELD", "const float", QW|NQ|CS, NULL, ev_field},
{"EV_FUNCTION", "const float", QW|NQ, NULL, ev_function}, {"EV_FUNCTION", "const float", QW|NQ|CS, NULL, ev_function},
{"EV_POINTER", "const float", QW|NQ, NULL, ev_pointer}, {"EV_POINTER", "const float", QW|NQ|CS, NULL, ev_pointer},
{"EV_INTEGER", "const float", QW|NQ, NULL, ev_integer}, {"EV_INTEGER", "const float", QW|NQ|CS, NULL, ev_integer},
{"EV_VARIANT", "const float", QW|NQ, NULL, ev_variant}, {"EV_VARIANT", "const float", QW|NQ|CS, NULL, ev_variant},
// {"EV_STRUCT", "const float", QW|NQ, NULL, ev_struct}, // {"EV_STRUCT", "const float", QW|NQ|CS, NULL, ev_struct},
// {"EV_UNION", "const float", QW|NQ, NULL, ev_union}, // {"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}, {"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}, {"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},