- cleaned out some waiting code.

There's still too many loops but this at least gets rid of the empty ones.
This commit is contained in:
Christoph Oelckers 2020-08-22 10:17:24 +02:00
parent c74a1f03e3
commit 8b3e3b6d4a
8 changed files with 5 additions and 160 deletions

View file

@ -53,10 +53,6 @@ bool playCDtrack(int nTrack, bool bLoop)
return true; return true;
} }
void StartfadeCDaudio()
{
}
int StepFadeCDaudio() int StepFadeCDaudio()
{ {
if (!CDplaying()) { if (!CDplaying()) {
@ -82,18 +78,7 @@ void FadeSong()
int fadecdaudio() int fadecdaudio()
{ {
StartfadeCDaudio(); Mus_Stop();
while (1)
{
if (!StepFadeCDaudio()) {
return 1;
}
else {
WaitTicks(1);
}
}
return 1; return 1;
} }

View file

@ -49,7 +49,6 @@ void resettiming();
// cd // cd
bool playCDtrack(int nTrack, bool bLoop); bool playCDtrack(int nTrack, bool bLoop);
void StartfadeCDaudio();
int StepFadeCDaudio(); int StepFadeCDaudio();
bool CDplaying(); bool CDplaying();
void StopCD(); void StopCD();

View file

@ -1156,7 +1156,7 @@ void FinishLevel()
EraseScreen(4); EraseScreen(4);
PlayLocalSound(StaticSound[59], 0, true, CHANF_UI); PlayLocalSound(StaticSound[59], 0, true, CHANF_UI);
videoNextPage(); videoNextPage();
WaitTicks(12); //WaitTicks(12);
WaitVBL(); WaitVBL();
DrawView(65536); DrawView(65536);
videoNextPage(); videoNextPage();
@ -2061,7 +2061,7 @@ void DoGameOverScene()
videoNextPage(); videoNextPage();
CinemaFadeIn(); CinemaFadeIn();
PlayGameOverSound(); PlayGameOverSound();
WaitAnyKey(3); //WaitAnyKey(3);
FadeOut(0); FadeOut(0);
} }

View file

@ -134,8 +134,6 @@ void RestorePalette();
int FindGString(const char *str); int FindGString(const char *str);
void WaitTicks(int nTicks);
void FadeIn(); void FadeIn();
void FadeOut(int bFadeMusic); void FadeOut(int bFadeMusic);

View file

@ -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 END_PS_NS

View file

@ -164,22 +164,6 @@ void RestorePalette()
videoTintBlood(0, 0, 0); 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() void FadeToWhite()
{ {
// fixme // fixme
@ -189,18 +173,10 @@ void FadeToWhite()
void FadeOut(int bFadeMusic) void FadeOut(int bFadeMusic)
{ {
if (bFadeMusic) { if (bFadeMusic) StopCD();
StartfadeCDaudio();
}
videoTintBlood(-255, -255, -255); videoTintBlood(-255, -255, -255);
videoNextPage(); videoNextPage();
if (bFadeMusic) {
while (StepFadeCDaudio() != 0) {}
}
EraseScreen(overscanindex); EraseScreen(overscanindex);
} }

View file

@ -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() 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) void ComputeCinemaText(int nLine)
@ -636,7 +583,7 @@ void GoToTheCinema(int nVal)
switch (nVal - 1) switch (nVal - 1)
{ {
default: default:
WaitAnyKey(10); //WaitAnyKey(10);
break; break;
case 0: case 0:

View file

@ -52,8 +52,6 @@ struct PlayerInput // TODO consider adjusting this for demo compatibility
}; };
void InitInput(); void InitInput();
void WaitNoKey(int nSecs, void (*pFunc) (void));
int WaitAnyKey(int nSecs);
void UpdateInputs(); void UpdateInputs();