Timing fixes, from fOSSiL.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@540 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2003-01-10 22:37:24 +00:00
parent 8a35211f73
commit f9e93e95de
6 changed files with 13 additions and 6 deletions
@@ -120,7 +120,7 @@ transition_task_func (void *data)
for (;;) for (;;)
{ {
SleepThread (10); SDL_Delay (10);
current_time = SDL_GetTicks (); current_time = SDL_GetTicks ();
delta_time = current_time - last_time; delta_time = current_time - last_time;
@@ -528,7 +528,7 @@ TFB_FlushGraphics () // Only call from main thread!!
} }
else else
{ {
SleepThread (1); TaskSwitch ();
} }
last_fade = current_fade; last_fade = current_fade;
+1 -1
View File
@@ -161,7 +161,7 @@ StreamDecoderTaskFunc (void *data)
{ {
int i; int i;
SleepThread (1); TaskSwitch ();
for (i = MUSIC_SOURCE; i < NUM_SOUNDSOURCES; ++i) for (i = MUSIC_SOURCE; i < NUM_SOUNDSOURCES; ++i)
{ {
@@ -45,6 +45,12 @@ SDLWrapper_PrintThreadStats (SDL_Thread *thread) {
} }
#endif #endif
void
SDLWrapper_SleepThread (TimeCount sleepTime)
{
SDL_Delay (sleepTime * 1000 / ONE_SECOND);
}
void void
SDLWrapper_SleepThreadUntil (TimeCount wakeTime) { SDLWrapper_SleepThreadUntil (TimeCount wakeTime) {
TimeCount now; TimeCount now;
@@ -33,8 +33,9 @@ typedef int (*NativeThreadFunction) (void *);
SDL_CreateThread ((func), (data)) SDL_CreateThread ((func), (data))
#define NativeKillThread(thread) \ #define NativeKillThread(thread) \
SDL_KillThread ((thread)) SDL_KillThread ((thread))
#define NativeSleepThread(ms) \ extern void SDLWrapper_SleepThread (TimeCount sleepTime);
SDL_Delay ((ms)) #define NativeSleepThread(sleepTime) \
SDLWrapper_SleepThread ((sleepTime))
extern void SDLWrapper_SleepThreadUntil (TimeCount wakeTime); extern void SDLWrapper_SleepThreadUntil (TimeCount wakeTime);
#define NativeSleepThreadUntil(wakeTime) \ #define NativeSleepThreadUntil(wakeTime) \
SDLWrapper_SleepThreadUntil ((wakeTime)) SDLWrapper_SleepThreadUntil ((wakeTime))
+1 -1
View File
@@ -1462,7 +1462,7 @@ InitPlanetSide (void)
#ifdef SPIN_ON_LAUNCH #ifdef SPIN_ON_LAUNCH
pSolarSysState->PauseRotate = 1; pSolarSysState->PauseRotate = 1;
ClearSemaphore (GraphicsSem); ClearSemaphore (GraphicsSem);
SleepThread (1); TaskSwitch ();
SetSemaphore (GraphicsSem); SetSemaphore (GraphicsSem);
#endif #endif
// Adjust pSolarSysState->MenuState.first_item by a random jitter. // Adjust pSolarSysState->MenuState.first_item by a random jitter.