mirror of
https://github.com/OpenDriver2/REDRIVER2.git
synced 2024-11-25 11:52:32 +01:00
- added emscripten_sleep to some critical loops
This commit is contained in:
parent
4241a8a2c4
commit
612b03f261
@ -54,8 +54,7 @@ void ShowHiresScreens(char **names, int delay, int wait)
|
||||
|
||||
ReadControllers();
|
||||
timedelay--;
|
||||
|
||||
} while ((wait != 0) || (Pads[0].dirnew & 0x40) == 0);
|
||||
} while (wait || (Pads[0].dirnew & 0x40) == 0);
|
||||
|
||||
FadeOutHiresScreen();
|
||||
|
||||
|
@ -67,7 +67,6 @@
|
||||
#include "RAND.H"
|
||||
#include "STRINGS.H"
|
||||
|
||||
|
||||
#include "INLINE_C.H"
|
||||
|
||||
int levelstartpos[8][4] = {
|
||||
@ -1330,13 +1329,11 @@ void GameLoop(void)
|
||||
InitControllers();
|
||||
VSync(0);
|
||||
|
||||
i = 4;
|
||||
do {
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
ReadControllers();
|
||||
VSync(0);
|
||||
i--;
|
||||
} while (i >= 0);
|
||||
}
|
||||
|
||||
while (game_over == 0)
|
||||
{
|
||||
@ -1659,10 +1656,7 @@ void DrawGame(void)
|
||||
RenderGame2(0);
|
||||
|
||||
ObjectDrawnCounter++;
|
||||
|
||||
while ((VSync(-1) - frame) < 2);
|
||||
frame = VSync(-1);
|
||||
|
||||
|
||||
SwapDrawBuffers();
|
||||
}
|
||||
else
|
||||
@ -1678,12 +1672,17 @@ void DrawGame(void)
|
||||
RenderGame2(1);
|
||||
ObjectDrawnCounter++;
|
||||
|
||||
while ((VSync(-1) - frame) < 2);
|
||||
frame = VSync(-1);
|
||||
|
||||
SwapDrawBuffers2(1);
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
while ((VSync(-1) - frame) < 2)
|
||||
emscripten_sleep(1);
|
||||
#else
|
||||
while ((VSync(-1) - frame) < 2);
|
||||
#endif
|
||||
frame = VSync(-1);
|
||||
|
||||
#ifndef PSX
|
||||
if (!FadingScreen)
|
||||
PsyX_EndScene();
|
||||
@ -1884,6 +1883,8 @@ int redriver2_main(int argc, char** argv)
|
||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "ERROR!", "Unable to load language files!\n\nSee console for details", NULL);
|
||||
return -1;
|
||||
}
|
||||
|
||||
// TODO: divide game by the states, place main loop here.
|
||||
|
||||
if (argc <= 1)
|
||||
#endif
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "driver2.h"
|
||||
#include "sound.h"
|
||||
|
||||
#include "camera.h"
|
||||
#include "xmplay.h"
|
||||
#include "mission.h"
|
||||
@ -841,6 +840,9 @@ void StopChannel(int channel)
|
||||
do {
|
||||
if (SpuGetKeyStatus(channels[channel].attr.voice) == 0)
|
||||
break;
|
||||
#ifdef __EMSCRIPTEN__
|
||||
emscripten_sleep(1);
|
||||
#endif
|
||||
} while (VSync(-1) - vsync < 8);
|
||||
|
||||
ClearChannelFields(channel);
|
||||
@ -853,14 +855,13 @@ void StopAllChannels(void)
|
||||
{
|
||||
int ct;
|
||||
|
||||
ct = 0;
|
||||
do {
|
||||
for (ct = 0; ct < MAX_SFX_CHANNELS; ct++)
|
||||
{
|
||||
StopChannel(ct);
|
||||
VSync(0);
|
||||
ct++;
|
||||
} while (ct < MAX_SFX_CHANNELS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// [D] [T]
|
||||
void LockChannel(int channel)
|
||||
{
|
||||
|
@ -4,9 +4,8 @@
|
||||
#include <stdint.h>
|
||||
#include <SDL.h>
|
||||
#endif // !PSX
|
||||
|
||||
|
||||
#include "system.h"
|
||||
|
||||
#include "platform.h"
|
||||
#include "xaplay.h"
|
||||
#include "loadview.h"
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "LIBGPU.H"
|
||||
#include "LIBSPU.H"
|
||||
|
||||
#include "psyx_compat.h"
|
||||
#include "platform.h"
|
||||
|
||||
#define USE_PC_FILESYSTEM !defined(PSX) // PC filesystem is prioritized over CD
|
||||
#define USE_CD_FILESYSTEM 1 // use always
|
||||
|
@ -7,6 +7,7 @@
|
||||
#endif
|
||||
|
||||
#include "STRINGS.H"
|
||||
#include "psyx_compat.h"
|
||||
|
||||
#ifndef PSX
|
||||
#include "../utils/fs.h"
|
||||
|
Loading…
Reference in New Issue
Block a user