From 8b3e3b6d4a0f1d20463328473a6534bfeb93271c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 22 Aug 2020 10:17:24 +0200 Subject: [PATCH] - cleaned out some waiting code. There's still too many loops but this at least gets rid of the empty ones. --- source/exhumed/src/cd.cpp | 17 +--------- source/exhumed/src/engine.h | 1 - source/exhumed/src/exhumed.cpp | 4 +-- source/exhumed/src/exhumed.h | 2 -- source/exhumed/src/input.cpp | 58 ---------------------------------- source/exhumed/src/light.cpp | 26 +-------------- source/exhumed/src/menu.cpp | 55 +------------------------------- source/exhumed/src/ps_input.h | 2 -- 8 files changed, 5 insertions(+), 160 deletions(-) diff --git a/source/exhumed/src/cd.cpp b/source/exhumed/src/cd.cpp index 7fe5d7b06..bef5d2dd6 100644 --- a/source/exhumed/src/cd.cpp +++ b/source/exhumed/src/cd.cpp @@ -53,10 +53,6 @@ bool playCDtrack(int nTrack, bool bLoop) return true; } -void StartfadeCDaudio() -{ -} - int StepFadeCDaudio() { if (!CDplaying()) { @@ -82,18 +78,7 @@ void FadeSong() int fadecdaudio() { - StartfadeCDaudio(); - - while (1) - { - if (!StepFadeCDaudio()) { - return 1; - } - else { - WaitTicks(1); - } - } - + Mus_Stop(); return 1; } diff --git a/source/exhumed/src/engine.h b/source/exhumed/src/engine.h index 3a719f14a..0f87c19e4 100644 --- a/source/exhumed/src/engine.h +++ b/source/exhumed/src/engine.h @@ -49,7 +49,6 @@ void resettiming(); // cd bool playCDtrack(int nTrack, bool bLoop); -void StartfadeCDaudio(); int StepFadeCDaudio(); bool CDplaying(); void StopCD(); diff --git a/source/exhumed/src/exhumed.cpp b/source/exhumed/src/exhumed.cpp index c8395035d..800ce0b47 100644 --- a/source/exhumed/src/exhumed.cpp +++ b/source/exhumed/src/exhumed.cpp @@ -1156,7 +1156,7 @@ void FinishLevel() EraseScreen(4); PlayLocalSound(StaticSound[59], 0, true, CHANF_UI); videoNextPage(); - WaitTicks(12); + //WaitTicks(12); WaitVBL(); DrawView(65536); videoNextPage(); @@ -2061,7 +2061,7 @@ void DoGameOverScene() videoNextPage(); CinemaFadeIn(); PlayGameOverSound(); - WaitAnyKey(3); + //WaitAnyKey(3); FadeOut(0); } diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 878cc0ef3..7d8265702 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -134,8 +134,6 @@ void RestorePalette(); int FindGString(const char *str); -void WaitTicks(int nTicks); - void FadeIn(); void FadeOut(int bFadeMusic); diff --git a/source/exhumed/src/input.cpp b/source/exhumed/src/input.cpp index a3eeaf558..e12167da4 100644 --- a/source/exhumed/src/input.cpp +++ b/source/exhumed/src/input.cpp @@ -146,62 +146,4 @@ void UpdateInputs() } } -/* -ClearSpaceBar_ - GetLocalInput_ - GetModemInput_ - BackupInput_ - SendInput_ - SendToUnAckd_ - LogoffPlayer_ - UpdateInputs_ - faketimerhandler_ -*/ - -void WaitNoKey(int nSecs, void (*pFunc) (void)) -{ - int nTotalTime = (kTimerTicks * nSecs) + (int)totalclock; - - while (nTotalTime > (int)totalclock) - { - HandleAsync(); - if (pFunc) { - pFunc(); - } - } -} - -int WaitAnyKey(int nSecs) -{ - int nTotalTime = (int)totalclock + (kTimerTicks * nSecs); - - while (1) - { - HandleAsync(); - if (nTotalTime <= (int)totalclock || nSecs == -1) { - return -1; - } - if (inputState.CheckAllInput()) return 1; - } -} - - -/* - Name: _nLocalPlayer - Name: _nNetPlayerCount - Name: _nModemPlayer - Name: _nNetMoves - Name: _lLocalButtons - Name: _lLocalCodes - Name: _nInputStack - Name: _bSyncNet - Name: _lStartupTime - Name: _bStackNode - Name: _sSync - Name: _nTypeStack - Name: _sPlayerInput - Name: _pStackPtr - Name: _sInputStack - - */ END_PS_NS diff --git a/source/exhumed/src/light.cpp b/source/exhumed/src/light.cpp index c129104ad..3a57ca207 100644 --- a/source/exhumed/src/light.cpp +++ b/source/exhumed/src/light.cpp @@ -164,22 +164,6 @@ void RestorePalette() videoTintBlood(0, 0, 0); } -void WaitTicks(int nTicks) -{ - if (htimer) - { - nTicks += (int)totalclock; - while (nTicks > (int)totalclock) { HandleAsync(); } - } - else - { - while (nTicks > 0) { - nTicks--; - WaitVBL(); - } - } -} - void FadeToWhite() { // fixme @@ -189,18 +173,10 @@ void FadeToWhite() void FadeOut(int bFadeMusic) { - if (bFadeMusic) { - StartfadeCDaudio(); - } - - + if (bFadeMusic) StopCD(); videoTintBlood(-255, -255, -255); videoNextPage(); - if (bFadeMusic) { - while (StepFadeCDaudio() != 0) {} - } - EraseScreen(overscanindex); } diff --git a/source/exhumed/src/menu.cpp b/source/exhumed/src/menu.cpp index 1b7a1e326..e6abc7ab0 100644 --- a/source/exhumed/src/menu.cpp +++ b/source/exhumed/src/menu.cpp @@ -404,61 +404,8 @@ void uploadCinemaPalettes() } } -//int IncrementCinemaFadeIn() -//{ -// dest = cinemapal; -// cur = curpal; -// -// int ebx = 0; -// -// for (int i = 0; i < 768; i++) -// { -// ebx++; -// -// if (*cur < *dest) -// { -// (*cur)++; -// } -// else if (*cur == *dest) -// { -// ebx--; -// } -// else -// { -// (*cur)--; -// } -// -// cur++; -// dest++; -// } -// -// MySetPalette(curpal); -// return ebx; -//} - void CinemaFadeIn() { - BlackOut(); - -#ifdef USE_OPENGL - if (videoGetRenderMode() >= REND_POLYMOST) - { - videoNextPage(); - return; - } -#endif - - int val; - - do - { - val = DoFadeIn(); - WaitTicks(2); - - // need to page flip in each iteration of the loop for non DOS version - videoNextPage(); - - } while (val > 0); } void ComputeCinemaText(int nLine) @@ -636,7 +583,7 @@ void GoToTheCinema(int nVal) switch (nVal - 1) { default: - WaitAnyKey(10); + //WaitAnyKey(10); break; case 0: diff --git a/source/exhumed/src/ps_input.h b/source/exhumed/src/ps_input.h index 0cd009631..eb61e41b0 100644 --- a/source/exhumed/src/ps_input.h +++ b/source/exhumed/src/ps_input.h @@ -52,8 +52,6 @@ struct PlayerInput // TODO consider adjusting this for demo compatibility }; void InitInput(); -void WaitNoKey(int nSecs, void (*pFunc) (void)); -int WaitAnyKey(int nSecs); void UpdateInputs();