From af5f5aad77e5b844f99dcc29895085c4e154803a Mon Sep 17 00:00:00 2001 From: nukeykt Date: Sat, 23 Nov 2019 00:57:42 +0900 Subject: [PATCH] Fix compiling errors # Conflicts: # platform/Windows/pcexhumed.vcxproj # source/platform/win32/startwin.game.cpp --- source/exhumed/src/exhumed.cpp | 64 +++++++++++++++++++--------------- source/exhumed/src/exhumed.h | 1 + source/exhumed/src/grpscan.cpp | 10 +++--- source/exhumed/src/sound.cpp | 12 +++---- 4 files changed, 48 insertions(+), 39 deletions(-) diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index f801b4dd2..924a28ec6 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -511,6 +511,8 @@ int32_t g_noAutoLoad = 0; int g_useCwd; int32_t g_groupFileHandle; +static struct strllist *CommandPaths, *CommandGrps; + void G_ExtPreInit(int32_t argc,char const * const * argv) { g_useCwd = G_CheckCmdSwitch(argc, argv, "-usecwd"); @@ -738,8 +740,6 @@ void G_LoadGroups(int32_t autoload) ////////// -struct strllist *CommandPaths, *CommandGrps; - void G_AddGroup(const char *buffer) { char buf[BMAX_PATH]; @@ -789,7 +789,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); @@ -1253,13 +1253,13 @@ void timerhandler() nCDTrackLength--; } } + if (!bInMove) + OSD_DispatchQueued(); } void HandleAsync() { handleevents(); - if (!bInMove) - OSD_DispatchQueued(); } int MyGetStringWidth(const char *str) @@ -2206,7 +2206,7 @@ int app_main(int argc, char const* const* argv) char tempbuf[256]; #ifdef _WIN32 #ifndef DEBUGGINGAIDS - if (!G_CheckCmdSwitch(argc, argv, "-noinstancechecking") && win_checkinstance()) + if (!G_CheckCmdSwitch(argc, argv, "-noinstancechecking") && !windowsCheckAlreadyRunning()) { #ifdef EDUKE32_STANDALONE if (!wm_ynbox(APPNAME, "It looks like " APPNAME " is already running.\n\n" @@ -2218,8 +2218,6 @@ int app_main(int argc, char const* const* argv) } #endif - backgroundidle = 0; - #ifndef USE_PHYSFS #ifdef DEBUGGINGAIDS extern int32_t (*check_filename_casing_fn)(void); @@ -3009,31 +3007,40 @@ LOOP3: } else { + static bool frameJustDrawn; bInMove = kTrue; if (!bPause && totalclock >= tclocks + 4) { - GetLocalInput(); - - sPlayerInput[nLocalPlayer].xVel = lPlayerXVel; - sPlayerInput[nLocalPlayer].yVel = lPlayerYVel; - sPlayerInput[nLocalPlayer].buttons = lLocalButtons | lLocalCodes; - sPlayerInput[nLocalPlayer].nAngle = nPlayerDAng; - sPlayerInput[nLocalPlayer].nTarget = besttarget; - - Ra[nLocalPlayer].nTarget = besttarget; - - lLocalCodes = 0; - nPlayerDAng = 0; - - sPlayerInput[nLocalPlayer].horizon = nVertPan[nLocalPlayer]; - do { - timerUpdate(); - tclocks += 4; - GameMove(); - timerUpdate(); - } while (levelnew < 0 && totalclock >= tclocks + 4); + if (!frameJustDrawn) + break; + + frameJustDrawn = false; + + GetLocalInput(); + + sPlayerInput[nLocalPlayer].xVel = lPlayerXVel; + sPlayerInput[nLocalPlayer].yVel = lPlayerYVel; + sPlayerInput[nLocalPlayer].buttons = lLocalButtons | lLocalCodes; + sPlayerInput[nLocalPlayer].nAngle = nPlayerDAng; + sPlayerInput[nLocalPlayer].nTarget = besttarget; + + Ra[nLocalPlayer].nTarget = besttarget; + + lLocalCodes = 0; + nPlayerDAng = 0; + + sPlayerInput[nLocalPlayer].horizon = nVertPan[nLocalPlayer]; + + do + { + // timerUpdate(); + tclocks += 4; + GameMove(); + // timerUpdate(); + } while (levelnew < 0 && totalclock >= tclocks + 4); + } while (0); } bInMove = kFalse; @@ -3042,6 +3049,7 @@ LOOP3: if (G_FPSLimit()) { GameDisplay(); + frameJustDrawn = true; } } if (!bInDemo) diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 8389eec24..882f6ef8d 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "compat.h" #include "cache1d.h" +#include "vfs.h" #include "grpscan.h" #define kTimerTicks 120 diff --git a/source/exhumed/src/grpscan.cpp b/source/exhumed/src/grpscan.cpp index 41a32e09d..a063a1410 100644 --- a/source/exhumed/src/grpscan.cpp +++ b/source/exhumed/src/grpscan.cpp @@ -174,9 +174,9 @@ static void LoadGameList(void) #else static char const base[] = "/"; #endif - CACHE1D_FIND_REC * const srch = klistpath(base, "*.grpinfo", CACHE1D_FIND_FILE); + BUILDVFS_FIND_REC * const srch = klistpath(base, "*.grpinfo", BUILDVFS_FIND_FILE); - for (CACHE1D_FIND_REC *sidx = srch; sidx; sidx = sidx->next) + for (BUILDVFS_FIND_REC *sidx = srch; sidx; sidx = sidx->next) LoadList(sidx->name); klistfree(srch); @@ -298,9 +298,9 @@ static grpinfo_t const * FindGrpInfo(int32_t crcval, int32_t size) return NULL; } -static void ProcessGroups(CACHE1D_FIND_REC *srch) +static void ProcessGroups(BUILDVFS_FIND_REC *srch) { - CACHE1D_FIND_REC *sidx; + BUILDVFS_FIND_REC *sidx; struct grpcache *fg, *fgg; char *fn; struct Bstat st; @@ -409,7 +409,7 @@ int32_t ScanGroups(void) for (char const *extension : extensions) { - CACHE1D_FIND_REC *srch = klistpath("/", extension, CACHE1D_FIND_FILE); + BUILDVFS_FIND_REC *srch = klistpath("/", extension, BUILDVFS_FIND_FILE); ProcessGroups(srch); klistfree(srch); } diff --git a/source/exhumed/src/sound.cpp b/source/exhumed/src/sound.cpp index a5d07f686..3ee66b5df 100644 --- a/source/exhumed/src/sound.cpp +++ b/source/exhumed/src/sound.cpp @@ -511,7 +511,7 @@ int LoadSound(const char *sound) int nSize = kfilelength(hVoc); SoundLock[i] = 255; // TODO: implement cache lock properly SoundLen[i] = nSize; - cacheAllocateBlock((intptr_t*)&SoundBuf[i], nSize, &SoundLock[i]); + g_cache.allocateBlock((intptr_t*)&SoundBuf[i], nSize, &SoundLock[i]); if (!SoundBuf[i]) bail2dos("Error allocating buf '%s' to %lld (size=%ld)!\n", buffer, (intptr_t)&SoundBuf[i], nSize); @@ -662,7 +662,7 @@ void SoundBigEntrance(void) CalcASSPan(63-(i&1)*127, 200, &nLeft, &nRight); if (pASound->f_e >= 0) FX_StopSound(pASound->f_e); - pASound->f_e = FX_Play(SoundBuf[kSoundTorchOn], SoundLen[kSoundTorchOn], -1, 0, 0, max(nLeft, nRight), nLeft, nRight, 0, 1.f, i); + pASound->f_e = FX_Play(SoundBuf[kSoundTorchOn], SoundLen[kSoundTorchOn], -1, 0, 0, max(nLeft, nRight), nLeft, nRight, 0, fix16_one, i); if (pASound->f_e > -1) FX_SetFrequency(pASound->f_e, 11000+nPitch); } @@ -693,7 +693,7 @@ void StartSwirly(int nActiveSound) CalcASSPan(nPan, nVolume, &nLeft, &nRight); if (pASound->f_e >= 0) FX_StopSound(pASound->f_e); - pASound->f_e = FX_Play(SoundBuf[StaticSound[kSound67]], SoundLen[StaticSound[kSound67]], -1, 0, 0, max(nLeft, nRight), nLeft, nRight, 0, 1.f, nActiveSound); + pASound->f_e = FX_Play(SoundBuf[StaticSound[kSound67]], SoundLen[StaticSound[kSound67]], -1, 0, 0, max(nLeft, nRight), nLeft, nRight, 0, fix16_one, nActiveSound); if (pASound->f_e > -1) FX_SetFrequency(pASound->f_e, nPitch); @@ -922,7 +922,7 @@ void PlaySound(int nSound) if (handle >= 0) FX_StopSound(handle); - handle = FX_Play(SoundBuf[nSound], SoundLen[nSound], bLoop ? 0 : -1, 0, 0, gFXVolume, gFXVolume, gFXVolume, 0, 1.f, -1); + handle = FX_Play(SoundBuf[nSound], SoundLen[nSound], bLoop ? 0 : -1, 0, 0, gFXVolume, gFXVolume, gFXVolume, 0, fix16_one, -1); #if 0 AIL_init_sample(handle); @@ -956,7 +956,7 @@ void PlayLocalSound(short nSound, short nRate) if (pASound->f_e >= 0) FX_StopSound(pASound->f_e); - pASound->f_e = FX_Play(SoundBuf[nSound], SoundLen[nSound], bLoop ? 0 : -1, 0, 0, gFXVolume, gFXVolume, gFXVolume, 0, 1.f, nLocalChan); + pASound->f_e = FX_Play(SoundBuf[nSound], SoundLen[nSound], bLoop ? 0 : -1, 0, 0, gFXVolume, gFXVolume, gFXVolume, 0, fix16_one, nLocalChan); if (nRate) { @@ -1165,7 +1165,7 @@ short PlayFX2(unsigned short nSound, short nSprite) CalcASSPan(nPan, nVolume>>1, &nLeft, &nRight); - vdi->f_e = FX_Play(SoundBuf[nSound], SoundLen[nSound], bLoop ? 0 : -1, 0, 0, max(nLeft, nRight), nLeft, nRight, 0, 1.f, vdi-sActiveSound); + vdi->f_e = FX_Play(SoundBuf[nSound], SoundLen[nSound], bLoop ? 0 : -1, 0, 0, max(nLeft, nRight), nLeft, nRight, 0, fix16_one, vdi-sActiveSound); if (nPitch) {