From e6f53f7c303314b42453e26e4c7cd02a8d7cfede Mon Sep 17 00:00:00 2001 From: nukeykt Date: Thu, 24 Oct 2019 22:25:34 +0900 Subject: [PATCH] Resolve merge issues # Conflicts: # GNUmakefile # platform/Windows/eduke32.sln # platform/Windows/props/build_common.props # source/audiolib/include/music.h # source/blood/src/blood.cpp # source/blood/src/gui.cpp # source/blood/src/mapedit.cpp # source/blood/src/sound.cpp # source/build/include/vfs.h # source/build/src/vfs.cpp --- source/audiolib/include/multivoc.h | 9 ++- source/audiolib/include/music.h | 1 - source/audiolib/src/flac.cpp | 8 +-- source/audiolib/src/formats.cpp | 75 +++++++++++++++++++++-- source/audiolib/src/fx_man.cpp | 32 +++++++++- source/audiolib/src/multivoc.cpp | 4 +- source/audiolib/src/vorbis.cpp | 8 +-- source/audiolib/src/xa.cpp | 4 +- source/audiolib/src/xmp.cpp | 8 +-- source/blood/src/blood.cpp | 22 ++++--- source/blood/src/common.cpp | 2 +- source/blood/src/common_game.h | 4 +- source/blood/src/config.h | 1 + source/blood/src/credits.cpp | 10 +-- source/blood/src/demo.cpp | 2 +- source/blood/src/loadsave.cpp | 2 +- source/blood/src/network.cpp | 4 +- source/blood/src/osdcmd.cpp | 2 +- source/blood/src/resource.cpp | 4 +- source/blood/src/sound.cpp | 7 ++- source/blood/src/startwin.game.cpp | 6 +- source/blood/src/view.cpp | 2 +- source/build/include/common.h | 1 + source/libsmackerdec/include/FileStream.h | 2 +- 24 files changed, 162 insertions(+), 58 deletions(-) diff --git a/source/audiolib/include/multivoc.h b/source/audiolib/include/multivoc.h index e43448480..ea31ce9e5 100644 --- a/source/audiolib/include/multivoc.h +++ b/source/audiolib/include/multivoc.h @@ -99,9 +99,9 @@ int MV_GetReverbDelay(void); void MV_SetReverbDelay(int delay); int MV_PlayVOC3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, - int priority, float volume, uint32_t callbackval); + int priority, float volume, intptr_t callbackval); int MV_PlayVOC(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, - int left, int right, int priority, float volume, uint32_t callbackval); + int left, int right, int priority, float volume, intptr_t callbackval); decltype(MV_PlayVOC3D) MV_PlayWAV3D; decltype(MV_PlayVOC) MV_PlayWAV; @@ -114,12 +114,15 @@ decltype(MV_PlayVOC) MV_PlayXA; decltype(MV_PlayVOC3D) MV_PlayXMP3D; decltype(MV_PlayVOC) MV_PlayXMP; +int MV_PlayRAW(char *ptr, uint32_t length, int rate, char *loopstart, char *loopend, int pitchoffset, int vol, + int left, int right, int priority, float volume, intptr_t callbackval); + int MV_IdentifyXMP(char const *ptr, uint32_t length); int MV_GetPosition(int handle, int *position); int MV_SetPosition(int handle, int position); void MV_SetVolume(int volume); int MV_GetVolume(void); -void MV_SetCallBack(void (*function)(uint32_t)); +void MV_SetCallBack(void (*function)(intptr_t)); void MV_SetReverseStereo(int setting); int MV_GetReverseStereo(void); int MV_Init(int soundcard, int MixRate, int Voices, int numchannels, void *initdata); diff --git a/source/audiolib/include/music.h b/source/audiolib/include/music.h index 91bf9a7c7..1613431be 100644 --- a/source/audiolib/include/music.h +++ b/source/audiolib/include/music.h @@ -53,7 +53,6 @@ typedef struct uint32_t tick; } songposition; - #define MUSIC_LoopSong ( 1 == 1 ) #define MUSIC_PlayOnce ( !MUSIC_LoopSong ) diff --git a/source/audiolib/src/flac.cpp b/source/audiolib/src/flac.cpp index 1f45cea30..fc8ebc9bc 100644 --- a/source/audiolib/src/flac.cpp +++ b/source/audiolib/src/flac.cpp @@ -380,7 +380,7 @@ Begin playback of sound data at specified angle and distance from listener. ---------------------------------------------------------------------*/ -int MV_PlayFLAC3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, int priority, float volume, uint32_t callbackval) +int MV_PlayFLAC3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, int priority, float volume, intptr_t callbackval) { int left; int right; @@ -419,7 +419,7 @@ Begin playback of sound data with the given sound levels and priority. ---------------------------------------------------------------------*/ -int MV_PlayFLAC(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, int priority, float volume, uint32_t callbackval) +int MV_PlayFLAC(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, int priority, float volume, intptr_t callbackval) { VoiceNode *voice; flac_data *fd = 0; @@ -658,7 +658,7 @@ void MV_ReleaseFLACVoice(VoiceNode *voice) #include "_multivc.h" int MV_PlayFLAC(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int pitchoffset, - int vol, int left, int right, int priority, float volume, uint32_t callbackval) + int vol, int left, int right, int priority, float volume, intptr_t callbackval) { UNREFERENCED_PARAMETER(ptr); UNREFERENCED_PARAMETER(ptrlength); @@ -677,7 +677,7 @@ int MV_PlayFLAC(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int p } int MV_PlayFLAC3D(char *ptr, uint32_t ptrlength, int loophow, int pitchoffset, int angle, - int distance, int priority, float volume, uint32_t callbackval) + int distance, int priority, float volume, intptr_t callbackval) { UNREFERENCED_PARAMETER(ptr); UNREFERENCED_PARAMETER(ptrlength); diff --git a/source/audiolib/src/formats.cpp b/source/audiolib/src/formats.cpp index 6478c6be8..5fcfedf56 100644 --- a/source/audiolib/src/formats.cpp +++ b/source/audiolib/src/formats.cpp @@ -301,8 +301,31 @@ end_of_data: return NoMoreData; } +static playbackstatus MV_GetNextRAWBlock(VoiceNode *voice) +{ + if (voice->BlockLength == 0) + { + if (voice->LoopStart == NULL) + return NoMoreData; + + voice->BlockLength = voice->LoopSize; + voice->NextBlock = voice->LoopStart; + voice->length = 0; + voice->position = 0; + } + + voice->sound = voice->NextBlock; + voice->position -= voice->length; + voice->length = min(voice->BlockLength, 0x8000u); + voice->NextBlock += voice->length * (voice->channels * voice->bits / 8); + voice->BlockLength -= voice->length; + voice->length <<= 16; + + return KeepPlaying; +} + int MV_PlayWAV3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, - int priority, float volume, uint32_t callbackval) + int priority, float volume, intptr_t callbackval) { if (!MV_Installed) return MV_Error; @@ -323,7 +346,7 @@ int MV_PlayWAV3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int a } int MV_PlayWAV(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, - int left, int right, int priority, float volume, uint32_t callbackval) + int left, int right, int priority, float volume, intptr_t callbackval) { if (!MV_Installed) return MV_Error; @@ -404,7 +427,7 @@ int MV_PlayWAV(char *ptr, uint32_t length, int loopstart, int loopend, int pitch } int MV_PlayVOC3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, - int distance, int priority, float volume, uint32_t callbackval) + int distance, int priority, float volume, intptr_t callbackval) { if (!MV_Installed) return MV_Error; @@ -425,7 +448,7 @@ int MV_PlayVOC3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int a } int MV_PlayVOC(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, - int left, int right, int priority, float volume, uint32_t callbackval) + int left, int right, int priority, float volume, intptr_t callbackval) { if (!MV_Installed) return MV_Error; @@ -468,3 +491,47 @@ int MV_PlayVOC(char *ptr, uint32_t length, int loopstart, int loopend, int pitch return voice->handle; } +int MV_PlayRAW(char *ptr, uint32_t length, int rate, char *loopstart, char *loopend, int pitchoffset, int vol, + int left, int right, int priority, float volume, intptr_t callbackval) +{ + if (!MV_Installed) + return MV_Error; + + // Request a voice from the voice pool + VoiceNode *voice = MV_AllocVoice(priority); + + if (voice == NULL) + { + MV_SetErrorCode(MV_NoVoices); + return MV_Error; + } + + voice->rawdataptr = (uint8_t *)ptr; + voice->ptrlength = length; + voice->Paused = FALSE; + voice->wavetype = FMT_RAW; + voice->bits = 8; + voice->channels = 1; + voice->GetSound = MV_GetNextRAWBlock; + voice->NextBlock = ptr; + voice->LoopCount = 0; + voice->position = 0; + voice->BlockLength = length; + voice->PitchScale = PITCH_GetScale(pitchoffset); + voice->length = 0; + voice->next = NULL; + voice->prev = NULL; + voice->priority = priority; + voice->callbackval = callbackval; + voice->LoopStart = loopstart; + voice->LoopEnd = loopend; + voice->LoopSize = loopend - loopstart + 1; + + voice->volume = volume; + + MV_SetVoicePitch(voice, rate, pitchoffset); + MV_SetVoiceVolume(voice, vol, left, right, volume); + MV_PlayVoice(voice); + + return voice->handle; +} diff --git a/source/audiolib/src/fx_man.cpp b/source/audiolib/src/fx_man.cpp index 5b830f614..9f7be2837 100644 --- a/source/audiolib/src/fx_man.cpp +++ b/source/audiolib/src/fx_man.cpp @@ -185,7 +185,7 @@ static wavefmt_t FX_DetectFormat(char const * const ptr, uint32_t length) } int FX_Play(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int pitchoffset, - int vol, int left, int right, int priority, float volume, uint32_t callbackval) + int vol, int left, int right, int priority, float volume, intptr_t callbackval) { static constexpr decltype(MV_PlayVOC) *func[] = { nullptr, nullptr, MV_PlayVOC, MV_PlayWAV, MV_PlayVorbis, MV_PlayFLAC, MV_PlayXA, MV_PlayXMP }; @@ -207,7 +207,7 @@ int FX_Play(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int pitch } int FX_Play3D(char *ptr, uint32_t ptrlength, int loophow, int pitchoffset, int angle, int distance, - int priority, float volume, uint32_t callbackval) + int priority, float volume, intptr_t callbackval) { static constexpr decltype(MV_PlayVOC3D) *func[] = { nullptr, nullptr, MV_PlayVOC3D, MV_PlayWAV3D, MV_PlayVorbis3D, MV_PlayFLAC3D, MV_PlayXA3D, MV_PlayXMP3D }; @@ -228,6 +228,34 @@ int FX_Play3D(char *ptr, uint32_t ptrlength, int loophow, int pitchoffset, int a return handle; } +int FX_PlayRaw(char *ptr, uint32_t ptrlength, int rate, int pitchoffset, int vol, + int left, int right, int priority, float volume, intptr_t callbackval) +{ + int handle = MV_PlayRAW(ptr, ptrlength, rate, NULL, NULL, pitchoffset, vol, left, right, priority, volume, callbackval); + + if (handle <= MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return handle; +} + +int FX_PlayLoopedRaw(char *ptr, uint32_t ptrlength, char *loopstart, char *loopend, int rate, + int pitchoffset, int vol, int left, int right, int priority, float volume, intptr_t callbackval) +{ + int handle = MV_PlayRAW(ptr, ptrlength, rate, loopstart, loopend, pitchoffset, vol, left, right, priority, volume, callbackval); + + if (handle <= MV_Ok) + { + FX_SetErrorCode(FX_MultiVocError); + handle = FX_Warning; + } + + return handle; +} + int FX_SetPrintf(void (*function)(const char *, ...)) { MV_SetPrintf(function); diff --git a/source/audiolib/src/multivoc.cpp b/source/audiolib/src/multivoc.cpp index afe626f9e..e01f6b3cd 100644 --- a/source/audiolib/src/multivoc.cpp +++ b/source/audiolib/src/multivoc.cpp @@ -79,7 +79,7 @@ static VoiceNode VoicePool; static int MV_MixPage; void (*MV_Printf)(const char *fmt, ...) = initprintf; -static void (*MV_CallBackFunc)(uint32_t); +static void (*MV_CallBackFunc)(intptr_t); char *MV_MixDestination; int MV_SampleSize = 1; @@ -775,7 +775,7 @@ void MV_SetVolume(int volume) int MV_GetVolume(void) { return MV_TotalVolume; } -void MV_SetCallBack(void (*function)(uint32_t)) { MV_CallBackFunc = function; } +void MV_SetCallBack(void (*function)(intptr_t)) { MV_CallBackFunc = function; } void MV_SetReverseStereo(int setting) { MV_ReverseStereo = setting; } diff --git a/source/audiolib/src/vorbis.cpp b/source/audiolib/src/vorbis.cpp index 69a2351b4..48ae878f7 100644 --- a/source/audiolib/src/vorbis.cpp +++ b/source/audiolib/src/vorbis.cpp @@ -324,7 +324,7 @@ Begin playback of sound data at specified angle and distance from listener. ---------------------------------------------------------------------*/ -int MV_PlayVorbis3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, int priority, float volume, uint32_t callbackval) +int MV_PlayVorbis3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, int priority, float volume, intptr_t callbackval) { if (!MV_Installed) return MV_SetErrorCode(MV_NotInstalled); @@ -352,7 +352,7 @@ Begin playback of sound data with the given sound levels and priority. ---------------------------------------------------------------------*/ -int MV_PlayVorbis(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, int priority, float volume, uint32_t callbackval) +int MV_PlayVorbis(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, int priority, float volume, intptr_t callbackval) { UNREFERENCED_PARAMETER(loopend); @@ -458,7 +458,7 @@ void MV_ReleaseVorbisVoice( VoiceNode * voice ) #include "_multivc.h" int MV_PlayVorbis(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int pitchoffset, - int vol, int left, int right, int priority, float volume, uint32_t callbackval) + int vol, int left, int right, int priority, float volume, intptr_t callbackval) { UNREFERENCED_PARAMETER(ptr); UNREFERENCED_PARAMETER(ptrlength); @@ -477,7 +477,7 @@ int MV_PlayVorbis(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int } int MV_PlayVorbis3D(char *ptr, uint32_t ptrlength, int loophow, int pitchoffset, int angle, - int distance, int priority, float volume, uint32_t callbackval) + int distance, int priority, float volume, intptr_t callbackval) { UNREFERENCED_PARAMETER(ptr); UNREFERENCED_PARAMETER(ptrlength); diff --git a/source/audiolib/src/xa.cpp b/source/audiolib/src/xa.cpp index 1eea49ea8..0ed7815c0 100644 --- a/source/audiolib/src/xa.cpp +++ b/source/audiolib/src/xa.cpp @@ -370,7 +370,7 @@ from listener. ---------------------------------------------------------------------*/ int MV_PlayXA3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, int priority, float volume, - uint32_t callbackval) + intptr_t callbackval) { int left; int right; @@ -410,7 +410,7 @@ priority. ---------------------------------------------------------------------*/ int MV_PlayXA(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, - int priority, float volume, uint32_t callbackval) + int priority, float volume, intptr_t callbackval) { VoiceNode *voice; xa_data * xad = 0; diff --git a/source/audiolib/src/xmp.cpp b/source/audiolib/src/xmp.cpp index 57fa5ebb4..6b7f4d68f 100644 --- a/source/audiolib/src/xmp.cpp +++ b/source/audiolib/src/xmp.cpp @@ -64,7 +64,7 @@ static playbackstatus MV_GetNextXMPBlock(VoiceNode *voice) return KeepPlaying; } -int MV_PlayXMP3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, int priority, float volume, uint32_t callbackval) +int MV_PlayXMP3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int angle, int distance, int priority, float volume, intptr_t callbackval) { int left; int right; @@ -95,7 +95,7 @@ int MV_PlayXMP3D(char *ptr, uint32_t length, int loophow, int pitchoffset, int a return status; } -int MV_PlayXMP(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, int priority, float volume, uint32_t callbackval) +int MV_PlayXMP(char *ptr, uint32_t length, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, int priority, float volume, intptr_t callbackval) { VoiceNode *voice; xmp_data * xmpd = 0; @@ -200,7 +200,7 @@ void MV_ReleaseXMPVoice(VoiceNode * voice) static char const NoXMP[] = "MV_PlayXMP: libxmp-lite support not included in this binary.\n"; int MV_PlayXMP(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int pitchoffset, int vol, - int left, int right, int priority, float volume, uint32_t callbackval) + int left, int right, int priority, float volume, intptr_t callbackval) { UNREFERENCED_PARAMETER(ptr); UNREFERENCED_PARAMETER(ptrlength); @@ -219,7 +219,7 @@ int MV_PlayXMP(char *ptr, uint32_t ptrlength, int loopstart, int loopend, int pi } int MV_PlayXMP3D(char *ptr, uint32_t ptrlength, int loophow, int pitchoffset, int angle, - int distance, int priority, float volume, uint32_t callbackval) + int distance, int priority, float volume, intptr_t callbackval) { UNREFERENCED_PARAMETER(ptr); UNREFERENCED_PARAMETER(ptrlength); diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 77f47ee3e..bf09a4920 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mmulti.h" #include "compat.h" #include "renderlayer.h" +#include "vfs.h" #include "fx_man.h" #include "common.h" #include "common_game.h" @@ -387,7 +388,7 @@ void PreloadTiles(void) for (int i = 1; i < gSkyCount; i++) tilePrecacheTile(skyTile+i, 0); } - G_HandleAsync(); + gameHandleEvents(); } @@ -422,7 +423,7 @@ void PreloadCache(void) MUSIC_Update(); if ((++cnt & 7) == 0) - G_HandleAsync(); + gameHandleEvents(); if (videoGetRenderMode() != REND_CLASSIC && totalclock - clock > (kTicRate>>2)) { @@ -431,10 +432,10 @@ void PreloadCache(void) // this just prevents the loading screen percentage bar from making large jumps while (percentDisplayed < percentComplete) { + gameHandleEvents(); Bsprintf(tempbuf, "Loaded %d%% (%d/%d textures)\n", percentDisplayed, cnt, nPrecacheCount); viewLoadingScreenUpdate(tempbuf, percentDisplayed); videoNextPage(); - timerUpdate(); if (totalclock - clock >= 1) { @@ -1054,7 +1055,7 @@ void ProcessFrame(void) { while (gNetFifoMasterTail < gNetFifoTail) { - G_HandleAsync(); + gameHandleEvents(); netMasterUpdate(); } } @@ -1492,6 +1493,7 @@ int app_main(int argc, char const * const * argv) margc = argc; margv = argv; #ifdef _WIN32 +#endif G_ExtPreInit(argc, argv); @@ -1740,7 +1742,7 @@ RESTART: { char gameUpdate = false; double const gameUpdateStartTime = timerGetHiTicks(); - G_HandleAsync(); + gameHandleEvents(); while (gPredictTail < gNetFifoHead[myconnectindex] && !gPaused) { viewUpdatePrediction(&gFifoInput[gPredictTail&255][myconnectindex]); @@ -1761,10 +1763,10 @@ RESTART: break; faketimerhandler(); ProcessFrame(); - timerUpdate(); + timerUpdateClock(); gameUpdate = true; } - timerUpdate(); + timerUpdateClock(); } if (gameUpdate) { @@ -1794,7 +1796,7 @@ RESTART: videoClearScreen(0); rotatesprite(160<<16,100<<16,65536,0,2518,0,0,0x4a,0,0,xdim-1,ydim-1); } - G_HandleAsync(); + gameHandleEvents(); if (gQuitRequest && !gQuitGame) netBroadcastMyLogoff(gQuitRequest == 2); } @@ -1849,7 +1851,7 @@ RESTART: while (gGameMenuMgr.m_bActive) { gGameMenuMgr.Process(); - G_HandleAsync(); + gameHandleEvents(); if (G_FPSLimit()) { videoClearScreen(0); @@ -2512,7 +2514,7 @@ bool AddINIFile(const char *pzFile, bool bForce = false) void ScanINIFiles(void) { nINICount = 0; - CACHE1D_FIND_REC *pINIList = klistpath("/", "*.ini", CACHE1D_FIND_FILE); + BUILDVFS_FIND_REC *pINIList = klistpath("/", "*.ini", BUILDVFS_FIND_FILE); pINIChain = NULL; if (bINIOverride || !pINIList) diff --git a/source/blood/src/common.cpp b/source/blood/src/common.cpp index 59e165911..d9038538d 100644 --- a/source/blood/src/common.cpp +++ b/source/blood/src/common.cpp @@ -643,7 +643,7 @@ void G_LoadGroupsInDir(const char *dirname) for (auto & extension : extensions) { - CACHE1D_FIND_REC *rec; + BUILDVFS_FIND_REC *rec; fnlist_getnames(&fnlist, dirname, extension, -1, 0); diff --git a/source/blood/src/common_game.h b/source/blood/src/common_game.h index d4ff9460f..6dc7fdd7f 100644 --- a/source/blood/src/common_game.h +++ b/source/blood/src/common_game.h @@ -532,10 +532,10 @@ extern void G_SetupGlobalPsky(void); #define G_ModDirSnprintfLite(buf, size, basename) \ ((g_modDir[0] != '/') ? Bsnprintf(buf, size, "%s/%s", g_modDir, basename) : Bsnprintf(buf, size, "%s", basename)) -static inline void G_HandleAsync(void) +static inline int gameHandleEvents(void) { - handleevents(); netGetPackets(); + return handleevents(); } # define FORMAT_UPGRADE_ELIGIBLE diff --git a/source/blood/src/config.h b/source/blood/src/config.h index 8f26bdcd9..dd618653d 100644 --- a/source/blood/src/config.h +++ b/source/blood/src/config.h @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "function.h" #include "control.h" #include "_control.h" +#include "gamedefs.h" #include "hash.h" #include "gamecvars.h" diff --git a/source/blood/src/credits.cpp b/source/blood/src/credits.cpp index 9db88b923..0ccd436a7 100644 --- a/source/blood/src/credits.cpp +++ b/source/blood/src/credits.cpp @@ -47,7 +47,7 @@ char Wait(int nTicks) totalclock = 0; while (totalclock < nTicks) { - timerUpdate(); + timerUpdateClock(); char key = keyGetScan(); if (key) { @@ -67,7 +67,7 @@ char DoFade(char r, char g, char b, int nTicks) totalclock = gFrameClock = 0; do { - while (totalclock < gFrameClock) { timerUpdate();}; + while (totalclock < gFrameClock) { timerUpdateClock();}; gFrameClock += 2; scrNextPage(); scrFadeAmount(divscale16(ClipHigh((int)totalclock, nTicks), nTicks)); @@ -86,7 +86,7 @@ char DoUnFade(int nTicks) totalclock = gFrameClock = 0; do { - while (totalclock < gFrameClock) { timerUpdate(); }; + while (totalclock < gFrameClock) { timerUpdateClock(); }; scrNextPage(); scrFadeAmount(0x10000-divscale16(ClipHigh((int)totalclock, nTicks), nTicks)); if (keyGetScan()) @@ -250,7 +250,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) UpdateDacs(0, true); - timerUpdate(); + timerUpdateClock(); ClockTicks nStartTime = totalclock; ctrlClearAllInput(); @@ -258,7 +258,7 @@ void credPlaySmk(const char *_pzSMK, const char *_pzWAV, int nWav) int nFrame = 0; do { - G_HandleAsync(); + gameHandleEvents(); if (scale((int)(totalclock-nStartTime), nFrameRate, kTicRate) < nFrame) continue; diff --git a/source/blood/src/demo.cpp b/source/blood/src/demo.cpp index ead04ce6f..183d9c8f4 100644 --- a/source/blood/src/demo.cpp +++ b/source/blood/src/demo.cpp @@ -433,7 +433,7 @@ void CDemo::LoadDemoInfo(void) pathsearchmode = 0; char zFN[BMAX_PATH]; Bsnprintf(zFN, BMAX_PATH, "%s*.dem", BloodIniPre); - auto pList = klistpath("/", zFN, CACHE1D_FIND_FILE); + auto pList = klistpath("/", zFN, BUILDVFS_FIND_FILE); auto pIterator = pList; while (pIterator != NULL) { diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index 4c7265365..cfa2ebe3f 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -424,7 +424,7 @@ void MyLoadSave::Save(void) void LoadSavedInfo(void) { - auto pList = klistpath("./", "game*.sav", CACHE1D_FIND_FILE); + auto pList = klistpath("./", "game*.sav", BUILDVFS_FIND_FILE); int nCount = 0; for (auto pIterator = pList; pIterator != NULL && nCount < 10; pIterator = pIterator->next, nCount++) { diff --git a/source/blood/src/network.cpp b/source/blood/src/network.cpp index e0bd53ce9..293156658 100644 --- a/source/blood/src/network.cpp +++ b/source/blood/src/network.cpp @@ -639,7 +639,7 @@ void netWaitForEveryone(char a1) { if (keystatus[sc_Escape] && a1) exit(0); - G_HandleAsync(); + gameHandleEvents(); faketimerhandler(); for (p = connecthead; p >= 0; p = connectpoint2[p]) if (gPlayerReady[p] < gPlayerReady[myconnectindex]) @@ -1375,7 +1375,7 @@ void netUpdate(void) void faketimerhandler(void) { - timerUpdate(); + timerUpdateClock(); #ifndef NETCODE_DISABLE if (gNetMode != NETWORK_NONE && gNetENetInit) netUpdate(); diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index 87c123405..fcbb9bfee 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -110,7 +110,7 @@ static int osdcmd_map(osdcmdptr_t parm) if (parm->numparms != 1 || wildcardp) { - CACHE1D_FIND_REC *r; + BUILDVFS_FIND_REC *r; fnlist_t fnlist = FNLIST_INITIALIZER; int32_t maxwidth = 0; diff --git a/source/blood/src/resource.cpp b/source/blood/src/resource.cpp index cf57af184..da12e1668 100644 --- a/source/blood/src/resource.cpp +++ b/source/blood/src/resource.cpp @@ -895,7 +895,7 @@ void Resource::FNAddFiles(fnlist_t * fnlist, const char *pattern) sprintf(filename, "%s.%s", pNode->name, pNode->type); if (!Bwildmatch(filename, pattern)) continue; - switch (klistaddentry(&fnlist->findfiles, filename, CACHE1D_FIND_FILE, CACHE1D_SOURCE_GRP)) + switch (klistaddentry(&fnlist->findfiles, filename, BUILDVFS_FIND_FILE, BUILDVFS_SOURCE_GRP)) { case -1: return; @@ -932,7 +932,7 @@ void Resource::PrecacheSounds(void) if ((!strcmp(pNode->type, "RAW") || !strcmp(pNode->type, "SFX")) && !pNode->ptr) { Load(pNode); - G_HandleAsync(); + gameHandleEvents(); } } } diff --git a/source/blood/src/sound.cpp b/source/blood/src/sound.cpp index 845f976fd..ab8349956 100644 --- a/source/blood/src/sound.cpp +++ b/source/blood/src/sound.cpp @@ -437,13 +437,16 @@ void DeinitSoundDevice(void) void InitMusicDevice(void) { - int nStatus = MUSIC_Init(1/*MusicDevice*/, 0); + int nStatus = MUSIC_Init(MusicDevice); if (nStatus != 0) { initprintf("InitMusicDevice: %s\n", MUSIC_ErrorString(nStatus)); return; } - MUSIC_SetVolume(mus_volume); + DICTNODE *hTmb = gSoundRes.Lookup("GMTIMBRE", "TMB"); + if (hTmb) + AL_RegisterTimbreBank((unsigned char*)gSoundRes.Load(hTmb)); + MUSIC_SetVolume(MusicVolume); } void DeinitMusicDevice(void) diff --git a/source/blood/src/startwin.game.cpp b/source/blood/src/startwin.game.cpp index 31b259d08..26059e9bb 100644 --- a/source/blood/src/startwin.game.cpp +++ b/source/blood/src/startwin.game.cpp @@ -75,7 +75,7 @@ static HWND pages[3]; static int done = -1; static int mode = TAB_CONFIG; -static CACHE1D_FIND_REC *finddirs; +static BUILDVFS_FIND_REC *finddirs; static inline void clearfilenames(void) { @@ -86,7 +86,7 @@ static inline void clearfilenames(void) static inline void getfilenames(char const *path) { clearfilenames(); - finddirs = klistpath(path,"*",CACHE1D_FIND_DIR); + finddirs = klistpath(path,"*",BUILDVFS_FIND_DIR); } #define POPULATE_VIDEO 1 @@ -249,7 +249,7 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L settings.gamedir = NULL; else { - CACHE1D_FIND_REC *dir = finddirs; + BUILDVFS_FIND_REC *dir = finddirs; for (int j = 1; dir != NULL; dir = dir->next, j++) { if (j == i) diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index e2d7c5cca..799ca7b39 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -3024,7 +3024,7 @@ void viewDrawScreen(void) polymostcenterhoriz = defaultHoriz; #endif - timerUpdate(); + timerUpdateClock(); ClockTicks delta = totalclock - lastUpdate; if (delta < 0) delta = 0; diff --git a/source/build/include/common.h b/source/build/include/common.h index 9756e8247..ed9c63da7 100644 --- a/source/build/include/common.h +++ b/source/build/include/common.h @@ -8,6 +8,7 @@ #define EDUKE32_COMMON_H_ #include "cache1d.h" +#include "vfs.h" #include "compat.h" #include "pragmas.h" // klabs #include "scriptfile.h" diff --git a/source/libsmackerdec/include/FileStream.h b/source/libsmackerdec/include/FileStream.h index 02ae8ee84..3ddd05c1c 100644 --- a/source/libsmackerdec/include/FileStream.h +++ b/source/libsmackerdec/include/FileStream.h @@ -21,7 +21,7 @@ #define _SmackerFileStream_h_ #include -#include "cache1d.h" +#include "vfs.h" #include "compat.h" #include