]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Modified the sound code so it can handle sounds outside of a "sound" subdirectory.
authormolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 2 Jul 2004 15:30:22 +0000 (15:30 +0000)
committermolivier <molivier@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 2 Jul 2004 15:30:22 +0000 (15:30 +0000)
Changed the video code so it uses the common sound code (nice side-effect: DP video soundtracks can now be Ogg Vorbis files). Removed "wavefile.[ch]" and updated the project files accordingly.
Fixed log timestamps on Win32.
Cleaned a bit of code and a few header files inclusions here and there.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4258 d7cf8633-e32d-0410-b094-e92efae38249

16 files changed:
cd_shared.c
cl_parse.c
cl_video.c
console.c
darkplaces.dev
darkplaces.dsp
dpvsimpledecode.c
dpvsimpledecode.h
fs.c
makefile.inc
menu.c
prvm_cmds.c
snd_dma.c
snd_mem.c
snd_null.c
sound.h

index bce1c14b4fa45769dfd8e7471b4674d1d97815d5..4923ebbef4ddeb2f062442d88589cbdc509e3eaa 100644 (file)
@@ -110,14 +110,14 @@ void CDAudio_Play (qbyte track, qboolean looping)
        CDAudio_Stop ();
 
        // Try playing a fake track (sound file) first
        CDAudio_Stop ();
 
        // Try playing a fake track (sound file) first
-       sfx = S_PrecacheSound (va ("cdtracks/track%02u.wav", track), false);
+       sfx = S_PrecacheSound (va ("cdtracks/track%02u.wav", track), false, true);
        if (sfx != NULL)
        {
                faketrack = S_StartSound (-1, 0, sfx, vec3_origin, cdvolume, 0);
                if (faketrack != -1)
                {
                        if (looping)
        if (sfx != NULL)
        {
                faketrack = S_StartSound (-1, 0, sfx, vec3_origin, cdvolume, 0);
                if (faketrack != -1)
                {
                        if (looping)
-                       S_LoopChannel (faketrack, true);
+                               S_LoopChannel (faketrack, true);
                        Con_DPrintf ("Fake CD track %u playing...\n", track);
                }
        }
                        Con_DPrintf ("Fake CD track %u playing...\n", track);
                }
        }
index b633acf05fd2044d3efc257d24f9fa92ec975c75..23e64ec6f8749e2586beb11c2b3ce9acace60c76 100644 (file)
@@ -411,7 +411,7 @@ void CL_ParseServerInfo (void)
        for (i = 1;i < numsounds;i++)
        {
                CL_KeepaliveMessage();
        for (i = 1;i < numsounds;i++)
        {
                CL_KeepaliveMessage();
-               S_TouchSound(parse_sound_precache[i]);
+               S_TouchSound(parse_sound_precache[i], true);
        }
        S_PurgeUnused();
 
        }
        S_PurgeUnused();
 
@@ -435,7 +435,7 @@ void CL_ParseServerInfo (void)
        for (i=1 ; i<numsounds ; i++)
        {
                CL_KeepaliveMessage();
        for (i=1 ; i<numsounds ; i++)
        {
                CL_KeepaliveMessage();
-               cl.sound_precache[i] = S_PrecacheSound(parse_sound_precache[i], true);
+               cl.sound_precache[i] = S_PrecacheSound(parse_sound_precache[i], true, true);
        }
 
        // local state
        }
 
        // local state
@@ -957,13 +957,13 @@ CL_ParseTEnt
 */
 void CL_InitTEnts (void)
 {
 */
 void CL_InitTEnts (void)
 {
-       cl_sfx_wizhit = S_PrecacheSound ("wizard/hit.wav", false);
-       cl_sfx_knighthit = S_PrecacheSound ("hknight/hit.wav", false);
-       cl_sfx_tink1 = S_PrecacheSound ("weapons/tink1.wav", false);
-       cl_sfx_ric1 = S_PrecacheSound ("weapons/ric1.wav", false);
-       cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav", false);
-       cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav", false);
-       cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav", false);
+       cl_sfx_wizhit = S_PrecacheSound ("wizard/hit.wav", false, true);
+       cl_sfx_knighthit = S_PrecacheSound ("hknight/hit.wav", false, true);
+       cl_sfx_tink1 = S_PrecacheSound ("weapons/tink1.wav", false, true);
+       cl_sfx_ric1 = S_PrecacheSound ("weapons/ric1.wav", false, true);
+       cl_sfx_ric2 = S_PrecacheSound ("weapons/ric2.wav", false, true);
+       cl_sfx_ric3 = S_PrecacheSound ("weapons/ric3.wav", false, true);
+       cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav", false, true);
 }
 
 void CL_ParseBeam (model_t *m, int lightning)
 }
 
 void CL_ParseBeam (model_t *m, int lightning)
index c6c094c365995c03bd292ffa81f83dca56c4b5ba..393ebd018b8d3ae6f6277d1a4c64fcfb22737060 100644 (file)
@@ -20,18 +20,12 @@ int cl_videoimagedata_bmask;
 int cl_videoimagedata_bytesperpixel;
 void *cl_videoimagedata;
 
 int cl_videoimagedata_bytesperpixel;
 void *cl_videoimagedata;
 
-int cl_videosoundrate;
-int cl_videosoundlength;
-short *cl_videosounddata;
-int cl_videosoundresamplelength;
-short *cl_videosoundresampledata;
-
 rtexture_t *cl_videotexture;
 rtexturepool_t *cl_videotexturepool;
 
 void CL_VideoFrame(void)
 {
 rtexture_t *cl_videotexture;
 rtexturepool_t *cl_videotexturepool;
 
 void CL_VideoFrame(void)
 {
-       int frames, framenum, samples, s;
+       int frames, framenum;
        if (!cl_videoplaying)
                return;
        framenum = (realtime - cl_videostarttime) * cl_videoframerate;
        if (!cl_videoplaying)
                return;
        framenum = (realtime - cl_videostarttime) * cl_videoframerate;
@@ -54,35 +48,6 @@ void CL_VideoFrame(void)
                R_UpdateTexture(cl_videotexture, cl_videoimagedata);
                //Draw_NewPic("engine_videoframe", cl_videoimagewidth, cl_videoimageheight, false, cl_videoimagedata);
        }
                R_UpdateTexture(cl_videotexture, cl_videoimagedata);
                //Draw_NewPic("engine_videoframe", cl_videoimagewidth, cl_videoimageheight, false, cl_videoimagedata);
        }
-       if (cl_videosoundrate && (samples = S_RawSamples_QueueWantsMore()))
-       {
-               Con_DPrintf("%i = S_RawSamples_QueueWantsMore()\n", samples);
-
-               // calculate how much source data we need to fill the output...
-               s = samples * cl_videosoundrate / S_RawSamples_SampleRate();
-
-               // reallocate processing buffer if needed
-               if (cl_videosoundresamplelength < samples)
-               {
-                       cl_videosoundresamplelength = samples + 100;
-                       if (cl_videosoundresampledata)
-                               Mem_Free(cl_videosoundresampledata);
-                       cl_videosoundresampledata = Mem_Alloc(clvideomempool, cl_videosoundresamplelength * sizeof(short[2]));
-               }
-
-               // reallocate loading buffer if needed
-               if (cl_videosoundlength < s)
-               {
-                       cl_videosoundlength = s + 100;
-                       if (cl_videosounddata)
-                               Mem_Free(cl_videosounddata);
-                       cl_videosounddata = Mem_Alloc(clvideomempool, cl_videosoundlength * sizeof(short[2]));
-               }
-
-               dpvsimpledecode_audio(cl_videostream, cl_videosounddata, s);
-               S_ResampleBuffer16Stereo(cl_videosounddata, s, cl_videosoundresampledata, samples);
-               S_RawSamples_Enqueue(cl_videosoundresampledata, samples);
-       }
 }
 
 void CL_DrawVideo(void)
 }
 
 void CL_DrawVideo(void)
@@ -145,12 +110,6 @@ void CL_VideoStart(char *filename)
        cl_videoimagedata = Mem_Alloc(clvideomempool, cl_videoimagewidth * cl_videoimageheight * cl_videoimagedata_bytesperpixel);
        //memset(cl_videoimagedata, 97, cl_videoimagewidth * cl_videoimageheight * cl_videoimagedata_bytesperpixel);
 
        cl_videoimagedata = Mem_Alloc(clvideomempool, cl_videoimagewidth * cl_videoimageheight * cl_videoimagedata_bytesperpixel);
        //memset(cl_videoimagedata, 97, cl_videoimagewidth * cl_videoimageheight * cl_videoimagedata_bytesperpixel);
 
-       cl_videosoundrate = dpvsimpledecode_getsoundrate(cl_videostream);
-       cl_videosoundlength = 0;
-       cl_videosounddata = NULL;
-       cl_videosoundresamplelength = 0;
-       cl_videosoundresampledata = NULL;
-
        cl_videotexturepool = R_AllocTexturePool();
        cl_videotexture = R_LoadTexture2D(cl_videotexturepool, "videotexture", cl_videoimagewidth, cl_videoimageheight, NULL, TEXTYPE_RGBA, TEXF_FRAGMENT, NULL);
 }
        cl_videotexturepool = R_AllocTexturePool();
        cl_videotexture = R_LoadTexture2D(cl_videotexturepool, "videotexture", cl_videoimagewidth, cl_videoimageheight, NULL, TEXTYPE_RGBA, TEXF_FRAGMENT, NULL);
 }
@@ -169,14 +128,6 @@ void CL_VideoStop(void)
                Mem_Free(cl_videoimagedata);
        cl_videoimagedata = NULL;
 
                Mem_Free(cl_videoimagedata);
        cl_videoimagedata = NULL;
 
-       if (cl_videosounddata)
-               Mem_Free(cl_videosounddata);
-       cl_videosounddata = NULL;
-
-       if (cl_videosoundresampledata)
-               Mem_Free(cl_videosoundresampledata);
-       cl_videosoundresampledata = NULL;
-
        cl_videotexture = NULL;
        R_FreeTexturePool(&cl_videotexturepool);
 
        cl_videotexture = NULL;
        R_FreeTexturePool(&cl_videotexturepool);
 
index 142ef641020ada3623e0f650e3be5cc3b74e2e1d..d72ddf6e4be610c1d8481aff5aaba954531b59f2 100644 (file)
--- a/console.c
+++ b/console.c
@@ -97,7 +97,7 @@ const char* Log_Timestamp (const char *desc)
        // Build the time stamp (ex: "Wed Jun 30 21:49:08 1993");
        time (&crt_time);
        crt_tm = localtime (&crt_time);
        // Build the time stamp (ex: "Wed Jun 30 21:49:08 1993");
        time (&crt_time);
        crt_tm = localtime (&crt_time);
-       strftime (timestring, sizeof (timestring), "%a %b %d %T %Y", crt_tm);
+       strftime (timestring, sizeof (timestring), "%a %b %d %H:%M:%S %Y", crt_tm);
 
        if (desc != NULL)
                snprintf (timestamp, sizeof (timestamp), "====== %s (%s) ======\n", desc, timestring);
 
        if (desc != NULL)
                snprintf (timestamp, sizeof (timestamp), "====== %s (%s) ======\n", desc, timestring);
@@ -472,7 +472,7 @@ void Con_PrintToHistory(const char *txt)
        if (txt[0] == 1)
        {
                mask = 128;             // go to colored text
        if (txt[0] == 1)
        {
                mask = 128;             // go to colored text
-               S_LocalSound ("misc/talk.wav");
+               S_LocalSound ("misc/talk.wav", true);
        // play talk wav
                txt++;
        }
        // play talk wav
                txt++;
        }
index 9466593ee16cb84ce799533eed5a470d7a23d0d2..7812e957a80ea58578a82342ca35733825a531cb 100644 (file)
@@ -1,7 +1,7 @@
 [Project]
 [Project]
-FileName=darkplaces.dev
+FileName=DARKPL~1.DEV
 Name=DarkPlaces
 Name=DarkPlaces
-UnitCount=160
+UnitCount=158
 Type=0
 Ver=1
 ObjFiles=
 Type=0
 Ver=1
 ObjFiles=
@@ -730,7 +730,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit71]
 BuildCmd=
 
 [Unit71]
-FileName=wavefile.h
+FileName=winding.h
 CompileCpp=0
 Folder=Header Files
 Compile=1
 CompileCpp=0
 Folder=Header Files
 Compile=1
@@ -740,7 +740,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit72]
 BuildCmd=
 
 [Unit72]
-FileName=winding.h
+FileName=world.h
 CompileCpp=0
 Folder=Header Files
 Compile=1
 CompileCpp=0
 Folder=Header Files
 Compile=1
@@ -750,7 +750,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit73]
 BuildCmd=
 
 [Unit73]
-FileName=world.h
+FileName=zone.h
 CompileCpp=0
 Folder=Header Files
 Compile=1
 CompileCpp=0
 Folder=Header Files
 Compile=1
@@ -760,9 +760,9 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit74]
 BuildCmd=
 
 [Unit74]
-FileName=zone.h
+FileName=zone.c
 CompileCpp=0
 CompileCpp=0
-Folder=Header Files
+Folder=Source Files
 Compile=1
 Link=1
 Priority=1000
 Compile=1
 Link=1
 Priority=1000
@@ -770,7 +770,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit75]
 BuildCmd=
 
 [Unit75]
-FileName=zone.c
+FileName=cd_shared.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -780,7 +780,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit76]
 BuildCmd=
 
 [Unit76]
-FileName=cd_shared.c
+FileName=cd_win.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -790,7 +790,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit77]
 BuildCmd=
 
 [Unit77]
-FileName=cd_win.c
+FileName=cgame.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -800,7 +800,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit78]
 BuildCmd=
 
 [Unit78]
-FileName=cgame.c
+FileName=cgamevm.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -810,7 +810,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit79]
 BuildCmd=
 
 [Unit79]
-FileName=cgamevm.c
+FileName=cl_collision.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -820,7 +820,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit80]
 BuildCmd=
 
 [Unit80]
-FileName=cl_collision.c
+FileName=cl_demo.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -830,7 +830,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit81]
 BuildCmd=
 
 [Unit81]
-FileName=cl_demo.c
+FileName=cl_input.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -840,7 +840,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit82]
 BuildCmd=
 
 [Unit82]
-FileName=cl_input.c
+FileName=cl_main.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -850,7 +850,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit83]
 BuildCmd=
 
 [Unit83]
-FileName=cl_main.c
+FileName=cl_parse.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -860,7 +860,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit84]
 BuildCmd=
 
 [Unit84]
-FileName=cl_parse.c
+FileName=cl_particles.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -870,7 +870,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit85]
 BuildCmd=
 
 [Unit85]
-FileName=cl_particles.c
+FileName=cl_screen.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -880,7 +880,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit86]
 BuildCmd=
 
 [Unit86]
-FileName=cl_screen.c
+FileName=cl_video.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -890,7 +890,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit87]
 BuildCmd=
 
 [Unit87]
-FileName=cl_video.c
+FileName=cmd.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -900,7 +900,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit88]
 BuildCmd=
 
 [Unit88]
-FileName=cmd.c
+FileName=collision.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -910,7 +910,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit89]
 BuildCmd=
 
 [Unit89]
-FileName=collision.c
+FileName=common.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -920,7 +920,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit90]
 BuildCmd=
 
 [Unit90]
-FileName=common.c
+FileName=conproc.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -930,7 +930,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit91]
 BuildCmd=
 
 [Unit91]
-FileName=conproc.c
+FileName=console.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -940,7 +940,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit92]
 BuildCmd=
 
 [Unit92]
-FileName=console.c
+FileName=crc.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -950,7 +950,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit93]
 BuildCmd=
 
 [Unit93]
-FileName=crc.c
+FileName=curves.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -960,7 +960,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit94]
 BuildCmd=
 
 [Unit94]
-FileName=curves.c
+FileName=cvar.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -970,7 +970,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit95]
 BuildCmd=
 
 [Unit95]
-FileName=cvar.c
+FileName=dpvsimpledecode.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -980,7 +980,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit96]
 BuildCmd=
 
 [Unit96]
-FileName=dpvsimpledecode.c
+FileName=filematch.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -990,7 +990,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit97]
 BuildCmd=
 
 [Unit97]
-FileName=filematch.c
+FileName=fractalnoise.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1000,7 +1000,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit98]
 BuildCmd=
 
 [Unit98]
-FileName=fractalnoise.c
+FileName=fs.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1010,7 +1010,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit99]
 BuildCmd=
 
 [Unit99]
-FileName=fs.c
+FileName=gl_backend.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1020,7 +1020,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit100]
 BuildCmd=
 
 [Unit100]
-FileName=gl_backend.c
+FileName=gl_draw.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1030,7 +1030,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit101]
 BuildCmd=
 
 [Unit101]
-FileName=gl_draw.c
+FileName=gl_models.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1040,7 +1040,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit102]
 BuildCmd=
 
 [Unit102]
-FileName=gl_models.c
+FileName=gl_rmain.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1050,7 +1050,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit103]
 BuildCmd=
 
 [Unit103]
-FileName=gl_rmain.c
+FileName=gl_rsurf.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1060,7 +1060,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit104]
 BuildCmd=
 
 [Unit104]
-FileName=gl_rsurf.c
+FileName=gl_textures.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1070,7 +1070,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit105]
 BuildCmd=
 
 [Unit105]
-FileName=gl_textures.c
+FileName=host.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1080,7 +1080,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit106]
 BuildCmd=
 
 [Unit106]
-FileName=host.c
+FileName=host_cmd.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1090,7 +1090,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit107]
 BuildCmd=
 
 [Unit107]
-FileName=host_cmd.c
+FileName=image.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1100,7 +1100,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit108]
 BuildCmd=
 
 [Unit108]
-FileName=image.c
+FileName=jpeg.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1110,7 +1110,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit109]
 BuildCmd=
 
 [Unit109]
-FileName=jpeg.c
+FileName=keys.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1120,7 +1120,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit110]
 BuildCmd=
 
 [Unit110]
-FileName=keys.c
+FileName=lhnet.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1130,7 +1130,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit111]
 BuildCmd=
 
 [Unit111]
-FileName=lhnet.c
+FileName=mathlib.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1140,7 +1140,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit112]
 BuildCmd=
 
 [Unit112]
-FileName=mathlib.c
+FileName=matrixlib.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1150,7 +1150,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit113]
 BuildCmd=
 
 [Unit113]
-FileName=matrixlib.c
+FileName=menu.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1160,7 +1160,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit114]
 BuildCmd=
 
 [Unit114]
-FileName=menu.c
+FileName=meshqueue.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1170,7 +1170,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit115]
 BuildCmd=
 
 [Unit115]
-FileName=meshqueue.c
+FileName=model_alias.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1180,7 +1180,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit116]
 BuildCmd=
 
 [Unit116]
-FileName=model_alias.c
+FileName=model_brush.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1190,7 +1190,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit117]
 BuildCmd=
 
 [Unit117]
-FileName=model_brush.c
+FileName=model_shared.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1200,7 +1200,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit118]
 BuildCmd=
 
 [Unit118]
-FileName=model_shared.c
+FileName=model_sprite.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1210,7 +1210,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit119]
 BuildCmd=
 
 [Unit119]
-FileName=model_sprite.c
+FileName=netconn.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1220,7 +1220,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit120]
 BuildCmd=
 
 [Unit120]
-FileName=netconn.c
+FileName=palette.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1230,7 +1230,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit121]
 BuildCmd=
 
 [Unit121]
-FileName=palette.c
+FileName=portals.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1240,7 +1240,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit122]
 BuildCmd=
 
 [Unit122]
-FileName=portals.c
+FileName=pr_cmds.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1250,7 +1250,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit123]
 BuildCmd=
 
 [Unit123]
-FileName=pr_cmds.c
+FileName=pr_edict.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1260,7 +1260,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit124]
 BuildCmd=
 
 [Unit124]
-FileName=pr_edict.c
+FileName=pr_exec.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1270,7 +1270,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit125]
 BuildCmd=
 
 [Unit125]
-FileName=pr_exec.c
+FileName=protocol.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1280,7 +1280,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit126]
 BuildCmd=
 
 [Unit126]
-FileName=protocol.c
+FileName=prvm_cmds.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1290,7 +1290,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit127]
 BuildCmd=
 
 [Unit127]
-FileName=prvm_cmds.c
+FileName=prvm_edict.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1300,7 +1300,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit128]
 BuildCmd=
 
 [Unit128]
-FileName=prvm_edict.c
+FileName=prvm_exec.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1310,7 +1310,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit129]
 BuildCmd=
 
 [Unit129]
-FileName=prvm_exec.c
+FileName=r_crosshairs.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1320,7 +1320,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit130]
 BuildCmd=
 
 [Unit130]
-FileName=r_crosshairs.c
+FileName=r_explosion.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1330,7 +1330,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit131]
 BuildCmd=
 
 [Unit131]
-FileName=r_explosion.c
+FileName=r_lerpanim.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1340,7 +1340,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit132]
 BuildCmd=
 
 [Unit132]
-FileName=r_lerpanim.c
+FileName=r_light.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1350,7 +1350,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit133]
 BuildCmd=
 
 [Unit133]
-FileName=r_light.c
+FileName=r_lightning.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1360,7 +1360,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit134]
 BuildCmd=
 
 [Unit134]
-FileName=r_lightning.c
+FileName=r_modules.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1370,7 +1370,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit135]
 BuildCmd=
 
 [Unit135]
-FileName=r_modules.c
+FileName=r_shadow.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1380,7 +1380,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit136]
 BuildCmd=
 
 [Unit136]
-FileName=r_shadow.c
+FileName=r_sky.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1390,7 +1390,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit137]
 BuildCmd=
 
 [Unit137]
-FileName=r_sky.c
+FileName=r_sprites.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1400,7 +1400,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit138]
 BuildCmd=
 
 [Unit138]
-FileName=r_sprites.c
+FileName=sbar.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1410,7 +1410,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit139]
 BuildCmd=
 
 [Unit139]
-FileName=sbar.c
+FileName=snd_dma.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1420,7 +1420,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit140]
 BuildCmd=
 
 [Unit140]
-FileName=snd_dma.c
+FileName=snd_mem.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1430,7 +1430,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit141]
 BuildCmd=
 
 [Unit141]
-FileName=snd_mem.c
+FileName=snd_mix.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1440,7 +1440,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit142]
 BuildCmd=
 
 [Unit142]
-FileName=snd_mix.c
+FileName=snd_ogg.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1450,7 +1450,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit143]
 BuildCmd=
 
 [Unit143]
-FileName=snd_ogg.c
+FileName=snd_wav.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1460,7 +1460,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit144]
 BuildCmd=
 
 [Unit144]
-FileName=snd_wav.c
+FileName=snd_win.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1470,7 +1470,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit145]
 BuildCmd=
 
 [Unit145]
-FileName=snd_win.c
+FileName=sv_main.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1480,7 +1480,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit146]
 BuildCmd=
 
 [Unit146]
-FileName=sv_main.c
+FileName=sv_move.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1490,7 +1490,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit147]
 BuildCmd=
 
 [Unit147]
-FileName=sv_move.c
+FileName=sv_phys.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1500,7 +1500,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit148]
 BuildCmd=
 
 [Unit148]
-FileName=sv_phys.c
+FileName=sv_user.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1510,7 +1510,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit149]
 BuildCmd=
 
 [Unit149]
-FileName=sv_user.c
+FileName=sys_shared.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1520,7 +1520,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit150]
 BuildCmd=
 
 [Unit150]
-FileName=sys_shared.c
+FileName=sys_win.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1530,7 +1530,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit151]
 BuildCmd=
 
 [Unit151]
-FileName=sys_win.c
+FileName=ui.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1540,7 +1540,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit152]
 BuildCmd=
 
 [Unit152]
-FileName=ui.c
+FileName=vid_shared.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1550,7 +1550,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit153]
 BuildCmd=
 
 [Unit153]
-FileName=vid_shared.c
+FileName=vid_wgl.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1560,7 +1560,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit154]
 BuildCmd=
 
 [Unit154]
-FileName=vid_wgl.c
+FileName=view.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1570,7 +1570,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit155]
 BuildCmd=
 
 [Unit155]
-FileName=view.c
+FileName=wad.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1580,7 +1580,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit156]
 BuildCmd=
 
 [Unit156]
-FileName=wad.c
+FileName=winding.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1590,7 +1590,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit157]
 BuildCmd=
 
 [Unit157]
-FileName=wavefile.c
+FileName=world.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
@@ -1600,7 +1600,7 @@ OverrideBuildCmd=0
 BuildCmd=
 
 [Unit158]
 BuildCmd=
 
 [Unit158]
-FileName=winding.c
+FileName=builddate.c
 CompileCpp=0
 Folder=Source Files
 Compile=1
 CompileCpp=0
 Folder=Source Files
 Compile=1
index 6a06fac7c093c2d76e961caf3094b3e1681a0e8c..82125bad3c0dc46a16192fa44ee671011a47c763 100644 (file)
@@ -424,10 +424,6 @@ SOURCE=.\wad.c
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\wavefile.c\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\winding.c\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=.\winding.c\r
 # End Source File\r
 # Begin Source File\r
@@ -704,10 +700,6 @@ SOURCE=.\wad.h
 # End Source File\r
 # Begin Source File\r
 \r
 # End Source File\r
 # Begin Source File\r
 \r
-SOURCE=.\wavefile.h\r
-# End Source File\r
-# Begin Source File\r
-\r
 SOURCE=.\winding.h\r
 # End Source File\r
 # Begin Source File\r
 SOURCE=.\winding.h\r
 # End Source File\r
 # Begin Source File\r
index bd0047050e683e98c09840dae609ca89ebc69a90..9927a7606e06eab2a1c75c2a709d7f309bc5d613 100644 (file)
@@ -1,17 +1,7 @@
 
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <math.h>
-#include <string.h>
+#include "quakedef.h"
 #include "dpvsimpledecode.h"
 #include "dpvsimpledecode.h"
-#include "wavefile.h"
 
 
-#define EMBEDDEDHZREAD 1
-
-#ifndef EMBEDDEDHZREAD
-#include "hz_read.h"
-#include "hz_read.c"
-#else
 #define HZREADERROR_OK 0
 #define HZREADERROR_EOF 1
 #define HZREADERROR_MALLOCFAILED 2
 #define HZREADERROR_OK 0
 #define HZREADERROR_EOF 1
 #define HZREADERROR_MALLOCFAILED 2
@@ -214,7 +204,6 @@ void hz_bitstream_read_bytes(hz_bitstream_readblocks_t *blocks, void *outdata, u
        while (size--)
                *out++ = hz_bitstream_read_byte(blocks);
 }
        while (size--)
                *out++ = hz_bitstream_read_byte(blocks);
 }
-#endif
 
 #define BLOCKSIZE 8
 
 
 #define BLOCKSIZE 8
 
@@ -247,8 +236,8 @@ typedef struct dpvsimpledecodestream_s
        // current video frame data (needed because of delta compression)
        unsigned int *videopixels;
 
        // current video frame data (needed because of delta compression)
        unsigned int *videopixels;
 
-       // wav file the sound is being read from
-       wavefile_t *wavefile;
+       // channel the sound file is being played on
+       int sndchan;
 }
 dpvsimpledecodestream_t;
 
 }
 dpvsimpledecodestream_t;
 
@@ -405,9 +394,15 @@ void *dpvsimpledecode_open(char *filename, char **errorstring)
                                                                wavename = malloc(strlen(filename) + 10);
                                                                if (wavename)
                                                                {
                                                                wavename = malloc(strlen(filename) + 10);
                                                                if (wavename)
                                                                {
+                                                                       sfx_t* sfx;
+
                                                                        StripExtension(filename, wavename);
                                                                        strcat(wavename, ".wav");
                                                                        StripExtension(filename, wavename);
                                                                        strcat(wavename, ".wav");
-                                                                       s->wavefile = waveopen(wavename, NULL);
+                                                                       sfx = S_PrecacheSound (wavename, false, false);
+                                                                       if (sfx != NULL)
+                                                                               s->sndchan = S_StartSound (-1, 0, sfx, vec3_origin, 1.0f, 0);
+                                                                       else
+                                                                               s->sndchan = -1;
                                                                        free(wavename);
                                                                }
                                                                // all is well...
                                                                        free(wavename);
                                                                }
                                                                // all is well...
@@ -448,8 +443,8 @@ void dpvsimpledecode_close(void *stream)
                return;
        if (s->videopixels)
                free(s->videopixels);
                return;
        if (s->videopixels)
                free(s->videopixels);
-       if (s->wavefile)
-               waveclose(s->wavefile);
+       if (s->sndchan != -1)
+               S_StopChannel (s->sndchan);
        if (s->framedatablocks)
                hz_bitstream_read_blocks_free(s->framedatablocks);
        if (s->bitstream)
        if (s->framedatablocks)
                hz_bitstream_read_blocks_free(s->framedatablocks);
        if (s->bitstream)
@@ -525,16 +520,6 @@ unsigned int dpvsimpledecode_getheight(void *stream)
        return s->info_imageheight;
 }
 
        return s->info_imageheight;
 }
 
-// returns the sound sample rate of the stream
-unsigned int dpvsimpledecode_getsoundrate(void *stream)
-{
-       dpvsimpledecodestream_t *s = stream;
-       if (s->wavefile)
-               return s->wavefile->info_rate;
-       else
-               return 0;
-}
-
 // returns the framerate of the stream
 double dpvsimpledecode_getframerate(void *stream)
 {
 // returns the framerate of the stream
 double dpvsimpledecode_getframerate(void *stream)
 {
@@ -678,20 +663,3 @@ int dpvsimpledecode_video(void *stream, void *imagedata, unsigned int Rmask, uns
        dpvsimpledecode_convertpixels(s, imagedata, imagebytesperrow);
        return s->error;
 }
        dpvsimpledecode_convertpixels(s, imagedata, imagebytesperrow);
        return s->error;
 }
-
-// (note: sound is 16bit stereo native-endian, left channel first)
-int dpvsimpledecode_audio(void *stream, short *soundbuffer, int requestedlength)
-{
-       int samples;
-       dpvsimpledecodestream_t *s = stream;
-       s->error = DPVSIMPLEDECODEERROR_NONE;
-       if (requestedlength)
-       {
-               samples = 0;
-               if (s->wavefile && requestedlength)
-                       samples = waveread16stereo(s->wavefile, soundbuffer, requestedlength);
-               if (samples < requestedlength)
-                       memset(soundbuffer + samples * 2, 0, (requestedlength - samples) * sizeof(short[2]));
-       }
-       return s->error;
-}
index 36e61a41724453ec58b6db42e54e1b28fa6fa2d7..2d1f99c9cdee8b103cf35159e678d010aff41c76 100644 (file)
@@ -34,16 +34,10 @@ unsigned int dpvsimpledecode_getwidth(void *stream);
 // returns the height of the image data
 unsigned int dpvsimpledecode_getheight(void *stream);
 
 // returns the height of the image data
 unsigned int dpvsimpledecode_getheight(void *stream);
 
-// returns the sound sample rate of the stream
-unsigned int dpvsimpledecode_getsoundrate(void *stream);
-
 // returns the framerate of the stream
 double dpvsimpledecode_getframerate(void *stream);
 
 // decodes a video frame to the supplied output pixels
 int dpvsimpledecode_video(void *stream, void *imagedata, unsigned int Rmask, unsigned int Gmask, unsigned int Bmask, unsigned int bytesperpixel, int imagebytesperrow);
 // returns the framerate of the stream
 double dpvsimpledecode_getframerate(void *stream);
 
 // decodes a video frame to the supplied output pixels
 int dpvsimpledecode_video(void *stream, void *imagedata, unsigned int Rmask, unsigned int Gmask, unsigned int Bmask, unsigned int bytesperpixel, int imagebytesperrow);
-// reads some sound
-// (note: sound is 16bit stereo native-endian, left channel first)
-int dpvsimpledecode_audio(void *stream, short *soundbuffer, int requestedlength);
 
 #endif
 
 #endif
diff --git a/fs.c b/fs.c
index 4bf26d4d3ab1949ff89d27235a9e84cb1e8dd98d..9eb46843f796fff86a8c3d1cf32e9bfdb3d78c97 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -25,8 +25,6 @@
 
 #include "quakedef.h"
 
 
 #include "quakedef.h"
 
-#include <stdlib.h>
-#include <string.h>
 #include <limits.h>
 #include <fcntl.h>
 
 #include <limits.h>
 #include <fcntl.h>
 
index 9eb9e709c168e64b9842e1779cb7e4dc24c1c1e9..5d4a35bade0d3a9226951fc08e0b8cfd495ca136 100644 (file)
@@ -97,7 +97,6 @@ OBJ_COMMON= \
        vid_shared.o \
        view.o \
        wad.o \
        vid_shared.o \
        view.o \
        wad.o \
-       wavefile.o \
        winding.o \
        world.o \
        zone.o
        winding.o \
        world.o \
        zone.o
diff --git a/menu.c b/menu.c
index b0b5b5cc2ae25208adf1ada79fd59a0dcb68bf5e..ed7724a4ea5f2a6bd2bc9a0260a8199fa5175284 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -317,7 +317,7 @@ void M_Demo_Key (int k, char ascii)
                break;
 
        case K_ENTER:
                break;
 
        case K_ENTER:
-               S_LocalSound ("misc/menu2.wav");
+               S_LocalSound ("misc/menu2.wav", true);
                m_state = m_none;
                key_dest = key_game;
                Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
                m_state = m_none;
                key_dest = key_game;
                Cbuf_AddText (va ("playdemo %s\n", NehahraDemos[demo_cursor].name));
@@ -325,7 +325,7 @@ void M_Demo_Key (int k, char ascii)
 
        case K_UPARROW:
        case K_LEFTARROW:
 
        case K_UPARROW:
        case K_LEFTARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                demo_cursor--;
                if (demo_cursor < 0)
                        demo_cursor = NumberOfNehahraDemos-1;
                demo_cursor--;
                if (demo_cursor < 0)
                        demo_cursor = NumberOfNehahraDemos-1;
@@ -333,7 +333,7 @@ void M_Demo_Key (int k, char ascii)
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                demo_cursor++;
                if (demo_cursor >= NumberOfNehahraDemos)
                        demo_cursor = 0;
                demo_cursor++;
                if (demo_cursor >= NumberOfNehahraDemos)
                        demo_cursor = 0;
@@ -417,13 +417,13 @@ void M_Main_Key (int key, char ascii)
                break;
 
        case K_DOWNARROW:
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                if (++m_main_cursor >= MAIN_ITEMS)
                        m_main_cursor = 0;
                break;
 
        case K_UPARROW:
                if (++m_main_cursor >= MAIN_ITEMS)
                        m_main_cursor = 0;
                break;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                if (--m_main_cursor < 0)
                        m_main_cursor = MAIN_ITEMS - 1;
                break;
                if (--m_main_cursor < 0)
                        m_main_cursor = MAIN_ITEMS - 1;
                break;
@@ -616,13 +616,13 @@ void M_SinglePlayer_Key (int key, char ascii)
                break;
 
        case K_DOWNARROW:
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
                        m_singleplayer_cursor = 0;
                break;
 
        case K_UPARROW:
                if (++m_singleplayer_cursor >= SINGLEPLAYER_ITEMS)
                        m_singleplayer_cursor = 0;
                break;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                if (--m_singleplayer_cursor < 0)
                        m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
                break;
                if (--m_singleplayer_cursor < 0)
                        m_singleplayer_cursor = SINGLEPLAYER_ITEMS - 1;
                break;
@@ -764,7 +764,7 @@ void M_Load_Key (int k, char ascii)
                break;
 
        case K_ENTER:
                break;
 
        case K_ENTER:
-               S_LocalSound ("misc/menu2.wav");
+               S_LocalSound ("misc/menu2.wav", true);
                if (!loadable[load_cursor])
                        return;
                m_state = m_none;
                if (!loadable[load_cursor])
                        return;
                m_state = m_none;
@@ -776,7 +776,7 @@ void M_Load_Key (int k, char ascii)
 
        case K_UPARROW:
        case K_LEFTARROW:
 
        case K_UPARROW:
        case K_LEFTARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                load_cursor--;
                if (load_cursor < 0)
                        load_cursor = MAX_SAVEGAMES-1;
                load_cursor--;
                if (load_cursor < 0)
                        load_cursor = MAX_SAVEGAMES-1;
@@ -784,7 +784,7 @@ void M_Load_Key (int k, char ascii)
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                load_cursor++;
                if (load_cursor >= MAX_SAVEGAMES)
                        load_cursor = 0;
                load_cursor++;
                if (load_cursor >= MAX_SAVEGAMES)
                        load_cursor = 0;
@@ -809,7 +809,7 @@ void M_Save_Key (int k, char ascii)
 
        case K_UPARROW:
        case K_LEFTARROW:
 
        case K_UPARROW:
        case K_LEFTARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                load_cursor--;
                if (load_cursor < 0)
                        load_cursor = MAX_SAVEGAMES-1;
                load_cursor--;
                if (load_cursor < 0)
                        load_cursor = MAX_SAVEGAMES-1;
@@ -817,7 +817,7 @@ void M_Save_Key (int k, char ascii)
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                load_cursor++;
                if (load_cursor >= MAX_SAVEGAMES)
                        load_cursor = 0;
                load_cursor++;
                if (load_cursor >= MAX_SAVEGAMES)
                        load_cursor = 0;
@@ -867,13 +867,13 @@ void M_MultiPlayer_Key (int key, char ascii)
                break;
 
        case K_DOWNARROW:
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
                        m_multiplayer_cursor = 0;
                break;
 
        case K_UPARROW:
                if (++m_multiplayer_cursor >= MULTIPLAYER_ITEMS)
                        m_multiplayer_cursor = 0;
                break;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                if (--m_multiplayer_cursor < 0)
                        m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
                break;
                if (--m_multiplayer_cursor < 0)
                        m_multiplayer_cursor = MULTIPLAYER_ITEMS - 1;
                break;
@@ -1038,14 +1038,14 @@ void M_Setup_Key (int k, char ascii)
                break;
 
        case K_UPARROW:
                break;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                setup_cursor--;
                if (setup_cursor < 0)
                        setup_cursor = NUM_SETUP_CMDS-1;
                break;
 
        case K_DOWNARROW:
                setup_cursor--;
                if (setup_cursor < 0)
                        setup_cursor = NUM_SETUP_CMDS-1;
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                setup_cursor++;
                if (setup_cursor >= NUM_SETUP_CMDS)
                        setup_cursor = 0;
                setup_cursor++;
                if (setup_cursor >= NUM_SETUP_CMDS)
                        setup_cursor = 0;
@@ -1054,7 +1054,7 @@ void M_Setup_Key (int k, char ascii)
        case K_LEFTARROW:
                if (setup_cursor < 1)
                        return;
        case K_LEFTARROW:
                if (setup_cursor < 1)
                        return;
-               S_LocalSound ("misc/menu3.wav");
+               S_LocalSound ("misc/menu3.wav", true);
                if (setup_cursor == 1)
                        setup_top = setup_top - 1;
                if (setup_cursor == 2)
                if (setup_cursor == 1)
                        setup_top = setup_top - 1;
                if (setup_cursor == 2)
@@ -1071,7 +1071,7 @@ void M_Setup_Key (int k, char ascii)
                if (setup_cursor < 1)
                        return;
 forward:
                if (setup_cursor < 1)
                        return;
 forward:
-               S_LocalSound ("misc/menu3.wav");
+               S_LocalSound ("misc/menu3.wav", true);
                if (setup_cursor == 1)
                        setup_top = setup_top + 1;
                if (setup_cursor == 2)
                if (setup_cursor == 1)
                        setup_top = setup_top + 1;
                if (setup_cursor == 2)
@@ -1188,7 +1188,7 @@ extern cvar_t gl_texture_anisotropy;
 void M_Menu_Options_AdjustSliders (int dir)
 {
        int optnum;
 void M_Menu_Options_AdjustSliders (int dir)
 {
        int optnum;
-       S_LocalSound ("misc/menu3.wav");
+       S_LocalSound ("misc/menu3.wav", true);
 
        optnum = 6;
        if (options_cursor == optnum++)
 
        optnum = 6;
        if (options_cursor == optnum++)
@@ -1400,14 +1400,14 @@ void M_Options_Key (int k, char ascii)
                return;
 
        case K_UPARROW:
                return;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                options_cursor--;
                if (options_cursor < 0)
                        options_cursor = OPTIONS_ITEMS-1;
                break;
 
        case K_DOWNARROW:
                options_cursor--;
                if (options_cursor < 0)
                        options_cursor = OPTIONS_ITEMS-1;
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                options_cursor++;
                if (options_cursor >= OPTIONS_ITEMS)
                        options_cursor = 0;
                options_cursor++;
                if (options_cursor >= OPTIONS_ITEMS)
                        options_cursor = 0;
@@ -1463,7 +1463,7 @@ extern cvar_t r_lightningbeam_qmbtexture;
 void M_Menu_Options_Effects_AdjustSliders (int dir)
 {
        int optnum;
 void M_Menu_Options_Effects_AdjustSliders (int dir)
 {
        int optnum;
-       S_LocalSound ("misc/menu3.wav");
+       S_LocalSound ("misc/menu3.wav", true);
 
        optnum = 0;
             if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
 
        optnum = 0;
             if (options_effects_cursor == optnum++) Cvar_SetValueQuick (&r_modellights, bound(0, r_modellights.value + dir, 8));
@@ -1566,14 +1566,14 @@ void M_Options_Effects_Key (int k, char ascii)
                break;
 
        case K_UPARROW:
                break;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                options_effects_cursor--;
                if (options_effects_cursor < 0)
                        options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
                break;
 
        case K_DOWNARROW:
                options_effects_cursor--;
                if (options_effects_cursor < 0)
                        options_effects_cursor = OPTIONS_EFFECTS_ITEMS-1;
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                options_effects_cursor++;
                if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
                        options_effects_cursor = 0;
                options_effects_cursor++;
                if (options_effects_cursor >= OPTIONS_EFFECTS_ITEMS)
                        options_effects_cursor = 0;
@@ -1612,7 +1612,7 @@ void M_Menu_Options_ColorControl_AdjustSliders (int dir)
 {
        int optnum;
        float f;
 {
        int optnum;
        float f;
-       S_LocalSound ("misc/menu3.wav");
+       S_LocalSound ("misc/menu3.wav", true);
 
        optnum = 1;
        if (options_colorcontrol_cursor == optnum++)
 
        optnum = 1;
        if (options_colorcontrol_cursor == optnum++)
@@ -1816,14 +1816,14 @@ void M_Options_ColorControl_Key (int k, char ascii)
                return;
 
        case K_UPARROW:
                return;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                options_colorcontrol_cursor--;
                if (options_colorcontrol_cursor < 0)
                        options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
                break;
 
        case K_DOWNARROW:
                options_colorcontrol_cursor--;
                if (options_colorcontrol_cursor < 0)
                        options_colorcontrol_cursor = OPTIONS_COLORCONTROL_ITEMS-1;
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                options_colorcontrol_cursor++;
                if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
                        options_colorcontrol_cursor = 0;
                options_colorcontrol_cursor++;
                if (options_colorcontrol_cursor >= OPTIONS_COLORCONTROL_ITEMS)
                        options_colorcontrol_cursor = 0;
@@ -2162,7 +2162,7 @@ void M_Keys_Key (int k, char ascii)
 
        if (bind_grab)
        {       // defining a key
 
        if (bind_grab)
        {       // defining a key
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                if (k == K_ESCAPE)
                {
                        bind_grab = false;
                if (k == K_ESCAPE)
                {
                        bind_grab = false;
@@ -2185,7 +2185,7 @@ void M_Keys_Key (int k, char ascii)
 
        case K_LEFTARROW:
        case K_UPARROW:
 
        case K_LEFTARROW:
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                do
                {
                        keys_cursor--;
                do
                {
                        keys_cursor--;
@@ -2197,7 +2197,7 @@ void M_Keys_Key (int k, char ascii)
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                do
                {
                        keys_cursor++;
                do
                {
                        keys_cursor++;
@@ -2209,7 +2209,7 @@ void M_Keys_Key (int k, char ascii)
 
        case K_ENTER:           // go into bind mode
                M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
 
        case K_ENTER:           // go into bind mode
                M_FindKeysForCommand (bindnames[keys_cursor][0], keys);
-               S_LocalSound ("misc/menu2.wav");
+               S_LocalSound ("misc/menu2.wav", true);
                if (keys[NUMKEYS - 1] != -1)
                        M_UnbindCommand (bindnames[keys_cursor][0]);
                bind_grab = true;
                if (keys[NUMKEYS - 1] != -1)
                        M_UnbindCommand (bindnames[keys_cursor][0]);
                bind_grab = true;
@@ -2217,7 +2217,7 @@ void M_Keys_Key (int k, char ascii)
 
        case K_BACKSPACE:               // delete bindings
        case K_DEL:                             // delete bindings
 
        case K_BACKSPACE:               // delete bindings
        case K_DEL:                             // delete bindings
-               S_LocalSound ("misc/menu2.wav");
+               S_LocalSound ("misc/menu2.wav", true);
                M_UnbindCommand (bindnames[keys_cursor][0]);
                break;
        }
                M_UnbindCommand (bindnames[keys_cursor][0]);
                break;
        }
@@ -2303,7 +2303,7 @@ void M_Video_Draw (void)
 
 void M_Menu_Video_AdjustSliders (int dir)
 {
 
 void M_Menu_Video_AdjustSliders (int dir)
 {
-       S_LocalSound ("misc/menu3.wav");
+       S_LocalSound ("misc/menu3.wav", true);
 
        switch (video_cursor)
        {
 
        switch (video_cursor)
        {
@@ -2345,7 +2345,7 @@ void M_Video_Key (int key, char ascii)
                        Cvar_SetValueQuick(&vid_height, current_vid_height);
                        Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
 
                        Cvar_SetValueQuick(&vid_height, current_vid_height);
                        Cvar_SetValueQuick(&vid_bitsperpixel, current_vid_bitsperpixel);
 
-                       S_LocalSound ("misc/menu1.wav");
+                       S_LocalSound ("misc/menu1.wav", true);
                        M_Menu_Options_f ();
                        break;
 
                        M_Menu_Options_f ();
                        break;
 
@@ -2363,14 +2363,14 @@ void M_Video_Key (int key, char ascii)
                        break;
 
                case K_UPARROW:
                        break;
 
                case K_UPARROW:
-                       S_LocalSound ("misc/menu1.wav");
+                       S_LocalSound ("misc/menu1.wav", true);
                        video_cursor--;
                        if (video_cursor < 0)
                                video_cursor = VIDEO_ITEMS-1;
                        break;
 
                case K_DOWNARROW:
                        video_cursor--;
                        if (video_cursor < 0)
                                video_cursor = VIDEO_ITEMS-1;
                        break;
 
                case K_DOWNARROW:
-                       S_LocalSound ("misc/menu1.wav");
+                       S_LocalSound ("misc/menu1.wav", true);
                        video_cursor++;
                        if (video_cursor >= VIDEO_ITEMS)
                                video_cursor = 0;
                        video_cursor++;
                        if (video_cursor >= VIDEO_ITEMS)
                                video_cursor = 0;
@@ -2668,14 +2668,14 @@ void M_LanConfig_Key (int key, char ascii)
                break;
 
        case K_UPARROW:
                break;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                lanConfig_cursor--;
                if (lanConfig_cursor < 0)
                        lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
                break;
 
        case K_DOWNARROW:
                lanConfig_cursor--;
                if (lanConfig_cursor < 0)
                        lanConfig_cursor = NUM_LANCONFIG_CMDS-1;
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                lanConfig_cursor++;
                if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
                        lanConfig_cursor = 0;
                lanConfig_cursor++;
                if (lanConfig_cursor >= NUM_LANCONFIG_CMDS)
                        lanConfig_cursor = 0;
@@ -3400,14 +3400,14 @@ void M_GameOptions_Key (int key, char ascii)
                break;
 
        case K_UPARROW:
                break;
 
        case K_UPARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                gameoptions_cursor--;
                if (gameoptions_cursor < 0)
                        gameoptions_cursor = NUM_GAMEOPTIONS-1;
                break;
 
        case K_DOWNARROW:
                gameoptions_cursor--;
                if (gameoptions_cursor < 0)
                        gameoptions_cursor = NUM_GAMEOPTIONS-1;
                break;
 
        case K_DOWNARROW:
-               S_LocalSound ("misc/menu1.wav");
+               S_LocalSound ("misc/menu1.wav", true);
                gameoptions_cursor++;
                if (gameoptions_cursor >= NUM_GAMEOPTIONS)
                        gameoptions_cursor = 0;
                gameoptions_cursor++;
                if (gameoptions_cursor >= NUM_GAMEOPTIONS)
                        gameoptions_cursor = 0;
@@ -3416,19 +3416,19 @@ void M_GameOptions_Key (int key, char ascii)
        case K_LEFTARROW:
                if (gameoptions_cursor == 0)
                        break;
        case K_LEFTARROW:
                if (gameoptions_cursor == 0)
                        break;
-               S_LocalSound ("misc/menu3.wav");
+               S_LocalSound ("misc/menu3.wav", true);
                M_NetStart_Change (-1);
                break;
 
        case K_RIGHTARROW:
                if (gameoptions_cursor == 0)
                        break;
                M_NetStart_Change (-1);
                break;
 
        case K_RIGHTARROW:
                if (gameoptions_cursor == 0)
                        break;
-               S_LocalSound ("misc/menu3.wav");
+               S_LocalSound ("misc/menu3.wav", true);
                M_NetStart_Change (1);
                break;
 
        case K_ENTER:
                M_NetStart_Change (1);
                break;
 
        case K_ENTER:
-               S_LocalSound ("misc/menu2.wav");
+               S_LocalSound ("misc/menu2.wav", true);
                if (gameoptions_cursor == 0)
                {
                        if (sv.active)
                if (gameoptions_cursor == 0)
                {
                        if (sv.active)
@@ -3543,7 +3543,7 @@ void M_ServerList_Key(int k, char ascii)
 
        case K_UPARROW:
        case K_LEFTARROW:
 
        case K_UPARROW:
        case K_LEFTARROW:
-               S_LocalSound("misc/menu1.wav");
+               S_LocalSound("misc/menu1.wav", true);
                slist_cursor--;
                if (slist_cursor < 0)
                        slist_cursor = hostCacheCount - 1;
                slist_cursor--;
                if (slist_cursor < 0)
                        slist_cursor = hostCacheCount - 1;
@@ -3551,14 +3551,14 @@ void M_ServerList_Key(int k, char ascii)
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
 
        case K_DOWNARROW:
        case K_RIGHTARROW:
-               S_LocalSound("misc/menu1.wav");
+               S_LocalSound("misc/menu1.wav", true);
                slist_cursor++;
                if (slist_cursor >= hostCacheCount)
                        slist_cursor = 0;
                break;
 
        case K_ENTER:
                slist_cursor++;
                if (slist_cursor >= hostCacheCount)
                        slist_cursor = 0;
                break;
 
        case K_ENTER:
-               S_LocalSound("misc/menu2.wav");
+               S_LocalSound("misc/menu2.wav", true);
                Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
                break;
 
                Cbuf_AddText(va("connect \"%s\"\n", hostcache[slist_cursor].cname));
                break;
 
@@ -3740,7 +3740,7 @@ void M_Draw (void)
 
        if (m_entersound)
        {
 
        if (m_entersound)
        {
-               S_LocalSound ("misc/menu2.wav");
+               S_LocalSound ("misc/menu2.wav", true);
                m_entersound = false;
        }
 
                m_entersound = false;
        }
 
index f19deb65613ffa2d1f1eea3d1603b09f076daa3d..ccca3b4cc88a991714d03b4d206d529610d4e235 100644 (file)
@@ -629,14 +629,14 @@ void VM_localsound(void)
 
        s = PRVM_G_STRING(OFS_PARM0);
 
 
        s = PRVM_G_STRING(OFS_PARM0);
 
-       if(!S_GetCached(s))
+       if(!S_GetCached(s, true))
        {
                Con_Printf("VM_localsound: %s : %s not cached !\n", PRVM_NAME, s);
                PRVM_G_FLOAT(OFS_RETURN) = -4;
                return;
        }               
 
        {
                Con_Printf("VM_localsound: %s : %s not cached !\n", PRVM_NAME, s);
                PRVM_G_FLOAT(OFS_RETURN) = -4;
                return;
        }               
 
-       S_LocalSound(s);
+       S_LocalSound(s, true);
        PRVM_G_FLOAT(OFS_RETURN) = 1;
 }
 
        PRVM_G_FLOAT(OFS_RETURN) = 1;
 }
 
@@ -1109,13 +1109,13 @@ void VM_precache_sound (void)
        PRVM_G_INT(OFS_RETURN) = PRVM_G_INT(OFS_PARM0);
        VM_CheckEmptyString (s);
        
        PRVM_G_INT(OFS_RETURN) = PRVM_G_INT(OFS_PARM0);
        VM_CheckEmptyString (s);
        
-       if(S_GetCached(s))
+       if(S_GetCached(s, true))
        {
                Con_Printf("VM_precache_sound: %s already cached (%s)\n", s, PRVM_NAME);
                return;
        }
        
        {
                Con_Printf("VM_precache_sound: %s already cached (%s)\n", s, PRVM_NAME);
                return;
        }
        
-       if(!S_PrecacheSound(s,true))
+       if(!S_PrecacheSound(s,true, true))
                Con_Printf("VM_prache_sound: Failed to load %s for %s\n", s, PRVM_NAME);
 }
 
                Con_Printf("VM_prache_sound: Failed to load %s for %s\n", s, PRVM_NAME);
 }
 
index 1c6957e30c804ebb02bf9a6f538b0ff3c8239ddc..01e48254e40049b73f734bdbec91995acb982c08 100644 (file)
--- a/snd_dma.c
+++ b/snd_dma.c
@@ -251,8 +251,8 @@ void S_Init(void)
 
        SND_InitScaletable ();
 
 
        SND_InitScaletable ();
 
-       ambient_sfx[AMBIENT_WATER] = S_PrecacheSound ("ambience/water1.wav", false);
-       ambient_sfx[AMBIENT_SKY] = S_PrecacheSound ("ambience/wind2.wav", false);
+       ambient_sfx[AMBIENT_WATER] = S_PrecacheSound ("ambience/water1.wav", false, true);
+       ambient_sfx[AMBIENT_SKY] = S_PrecacheSound ("ambience/wind2.wav", false, true);
 
        total_channels = MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS;   // no statics
        memset(channels, 0, MAX_CHANNELS * sizeof(channel_t));
 
        total_channels = MAX_DYNAMIC_CHANNELS + NUM_AMBIENTS;   // no statics
        memset(channels, 0, MAX_CHANNELS * sizeof(channel_t));
@@ -271,21 +271,25 @@ S_GetCached
 
 =========
 */
 
 =========
 */
-sfx_t *S_GetCached (const char *name)
+sfx_t *S_GetCached (const char *name, qboolean stdpath)
 {
 {
+       char namebuffer [MAX_QPATH];
+       size_t len;
        int i;
 
        if (!snd_initialized.integer)
                return NULL;
 
        if (!name)
        int i;
 
        if (!snd_initialized.integer)
                return NULL;
 
        if (!name)
-               Host_Error("S_IsCached: NULL\n");
+               Host_Error("S_GetCached: NULL");
 
 
-       if (strlen(name) >= MAX_QPATH)
-               Host_Error("Sound name too long: %s", name);
+       // Add the default sound directory to the path
+       len = snprintf (namebuffer, sizeof (namebuffer), stdpath ? "sound/%s" : "%s", name);
+       if (len >= sizeof (namebuffer))
+               Host_Error ("S_GetCached: sound name too long (%s)", name);
 
        for(i = 0;i < num_sfx;i++)
 
        for(i = 0;i < num_sfx;i++)
-               if(!strcmp(known_sfx[i].name, name))
+               if(!strcmp(known_sfx[i].name, namebuffer))
                        return &known_sfx[i];
 
        return NULL;
                        return &known_sfx[i];
 
        return NULL;
@@ -297,31 +301,22 @@ S_FindName
 
 ==================
 */
 
 ==================
 */
-sfx_t *S_FindName (char *name)
+sfx_t *S_FindName (const char *name, qboolean stdpath)
 {
 {
-       int i;
        sfx_t *sfx;
 
        sfx_t *sfx;
 
-       if (!snd_initialized.integer)
-               return NULL;
-
-       if (!name)
-               Host_Error("S_FindName: NULL\n");
-
-       if (strlen(name) >= MAX_QPATH)
-               Host_Error("Sound name too long: %s", name);
+       sfx = S_GetCached (name, stdpath);
 
 
-// see if already loaded
-       for (i = 0;i < num_sfx;i++)
-               if (!strcmp(known_sfx[i].name, name))
-                       return &known_sfx[i];
-
-       if (num_sfx == MAX_SFX)
-               Sys_Error("S_FindName: out of sfx_t");
+       // If we haven't allocated a sfx_t struct for it yet
+       if (sfx == NULL)
+       {
+               if (num_sfx == MAX_SFX)
+                       Sys_Error ("S_FindName: out of sfx_t");
 
 
-       sfx = &known_sfx[num_sfx++];
-       memset(sfx, 0, sizeof(*sfx));
-       strlcpy (sfx->name, name, sizeof (sfx->name));
+               sfx = &known_sfx[num_sfx++];
+               memset (sfx, 0, sizeof(*sfx));
+               snprintf (sfx->name, sizeof (sfx->name), stdpath ? "sound/%s" : "%s", name);
+       }
        return sfx;
 }
 
        return sfx;
 }
 
@@ -332,11 +327,11 @@ S_TouchSound
 
 ==================
 */
 
 ==================
 */
-void S_TouchSound (char *name)
+void S_TouchSound (const char *name, qboolean stdpath)
 {
        sfx_t *sfx;
 
 {
        sfx_t *sfx;
 
-       sfx = S_FindName (name);
+       sfx = S_FindName (name, stdpath);
 
        // Set the "used" flag for this sound
        if (sfx != NULL)
 
        // Set the "used" flag for this sound
        if (sfx != NULL)
@@ -387,14 +382,14 @@ S_PrecacheSound
 
 ==================
 */
 
 ==================
 */
-sfx_t *S_PrecacheSound (char *name, int complain)
+sfx_t *S_PrecacheSound (const char *name, qboolean complain, qboolean stdpath)
 {
        sfx_t *sfx;
 
        if (!snd_initialized.integer)
                return NULL;
 
 {
        sfx_t *sfx;
 
        if (!snd_initialized.integer)
                return NULL;
 
-       sfx = S_FindName(name);
+       sfx = S_FindName (name, stdpath);
 
        if (!nosound.integer && snd_precache.integer)
                S_LoadSound(sfx, complain);
 
        if (!nosound.integer && snd_precache.integer)
                S_LoadSound(sfx, complain);
@@ -1038,7 +1033,7 @@ static void S_Play_Common(float fvol, float attenuation)
                        snprintf(name, sizeof(name), "%s.wav", Cmd_Argv(i));
                else
                        strlcpy(name, Cmd_Argv(i), sizeof(name));
                        snprintf(name, sizeof(name), "%s.wav", Cmd_Argv(i));
                else
                        strlcpy(name, Cmd_Argv(i), sizeof(name));
-               sfx = S_PrecacheSound(name, true);
+               sfx = S_PrecacheSound(name, true, true);
 
                // If we need to get the volume from the command line
                if (fvol == -1.0f)
 
                // If we need to get the volume from the command line
                if (fvol == -1.0f)
@@ -1096,7 +1091,7 @@ void S_SoundList(void)
 }
 
 
 }
 
 
-void S_LocalSound (char *sound)
+void S_LocalSound (const char *sound, qboolean stdpath)
 {
        sfx_t   *sfx;
        int             ch_ind;
 {
        sfx_t   *sfx;
        int             ch_ind;
@@ -1104,7 +1099,7 @@ void S_LocalSound (char *sound)
        if (!snd_initialized.integer || nosound.integer)
                return;
 
        if (!snd_initialized.integer || nosound.integer)
                return;
 
-       sfx = S_PrecacheSound (sound, true);
+       sfx = S_PrecacheSound (sound, true, stdpath);
        if (!sfx)
        {
                Con_Printf("S_LocalSound: can't precache %s\n", sound);
        if (!sfx)
        {
                Con_Printf("S_LocalSound: can't precache %s\n", sound);
index a10b2631f62959b047ddadabd51f9219af3d86de..2cb01bee3adae3d371761c105cad2975153f9c53 100644 (file)
--- a/snd_mem.c
+++ b/snd_mem.c
@@ -212,7 +212,7 @@ size_t ResampleSfx (const qbyte *in_data, size_t in_length, const snd_format_t*
 S_LoadSound
 ==============
 */
 S_LoadSound
 ==============
 */
-qboolean S_LoadSound (sfx_t *s, int complain)
+qboolean S_LoadSound (sfx_t *s, qboolean complain)
 {
        char namebuffer[MAX_QPATH];
        size_t len;
 {
        char namebuffer[MAX_QPATH];
        size_t len;
@@ -228,7 +228,7 @@ qboolean S_LoadSound (sfx_t *s, int complain)
                return true;
        }
 
                return true;
        }
 
-       len = snprintf (namebuffer, sizeof (namebuffer), "sound/%s", s->name);
+       len = strlcpy (namebuffer, s->name, sizeof (namebuffer));
        if (len >= sizeof (namebuffer))
                return false;
 
        if (len >= sizeof (namebuffer))
                return false;
 
index 52abac6efae2c7f7d64daa430702c0f84bb417b3..35592de9f2829541ab0cc63d4627277303123020 100755 (executable)
@@ -44,7 +44,7 @@ void S_Shutdown (void)
 {
 }
 
 {
 }
 
-void S_TouchSound (char *sample)
+void S_TouchSound (const char *sample, qboolean stdpath)
 {
 }
 
 {
 }
 
@@ -93,12 +93,12 @@ void S_SetChannelVolume (unsigned int ch_ind, float fvol)
 {
 }
 
 {
 }
 
-sfx_t *S_GetCached(const char *name)
+sfx_t *S_GetCached(const char *name, qboolean stdpath)
 {
        return NULL;
 }
 
 {
        return NULL;
 }
 
-sfx_t *S_PrecacheSound (char *sample, int complain)
+sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean stdpath)
 {
        return NULL;
 }
 {
        return NULL;
 }
@@ -115,7 +115,7 @@ void S_ExtraUpdate (void)
 {
 }
 
 {
 }
 
-void S_LocalSound (char *s)
+void S_LocalSound (const char *s, qboolean stdpath)
 {
 }
 
 {
 }
 
diff --git a/sound.h b/sound.h
index 70a350b575552d723181ffc0fb979aaa125b1a9d..d9aaeb7acbdc54496a16b11ac3e92f6cafc7f0a3 100644 (file)
--- a/sound.h
+++ b/sound.h
@@ -116,9 +116,9 @@ void S_SetChannelVolume (unsigned int ch_ind, float fvol);
 void S_Update(vec3_t origin, vec3_t forward, vec3_t left, vec3_t up);
 void S_ExtraUpdate (void);
 
 void S_Update(vec3_t origin, vec3_t forward, vec3_t left, vec3_t up);
 void S_ExtraUpdate (void);
 
-sfx_t *S_GetCached(const char *name);
-sfx_t *S_PrecacheSound (char *sample, int complain);
-void S_TouchSound (char *sample);
+sfx_t *S_GetCached(const char *name, qboolean stdpath);
+sfx_t *S_PrecacheSound (const char *sample, qboolean complain, qboolean stdpath);
+void S_TouchSound (const char *sample, qboolean stdpath);
 void S_ClearUsed (void);
 void S_PurgeUnused (void);
 void S_PaintChannels(int endtime);
 void S_ClearUsed (void);
 void S_PurgeUnused (void);
 void S_PaintChannels(int endtime);
@@ -179,8 +179,8 @@ extern cvar_t snd_streaming;
 
 extern int snd_blocked;
 
 
 extern int snd_blocked;
 
-void S_LocalSound (char *s);
-qboolean S_LoadSound (sfx_t *s, int complain);
+void S_LocalSound (const char *s, qboolean stdpath);
+qboolean S_LoadSound (sfx_t *s, qboolean complain);
 void S_UnloadSound(sfx_t *s);
 
 void SND_InitScaletable (void);
 void S_UnloadSound(sfx_t *s);
 
 void SND_InitScaletable (void);