Pause/exit game dialog problem with planets fixed, GraphicsSem usage

reverted back in RotatePlanet, from PhracturedBlue


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@423 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
gewlitys
2002-12-13 19:27:49 +00:00
parent 062821d782
commit 643957c679
4 changed files with 45 additions and 18 deletions
+5 -2
View File
@@ -61,9 +61,12 @@ ConfirmExit (void)
F = CaptureDrawable (LoadDisplayPixmap (&r, (FRAME)0)); F = CaptureDrawable (LoadDisplayPixmap (&r, (FRAME)0));
DrawStamp (&s); DrawStamp (&s);
ClearSemaphore (GraphicsSem); // Releasing the Semaphore lets the rotate_planet_task
// draw a frame. PauseRotate can still allow one more frame
// to be drawn, so it is safer to just not release the Semaphore
//ClearSemaphore (GraphicsSem);
FlushGraphics (); FlushGraphics ();
SetSemaphore (GraphicsSem); //SetSemaphore (GraphicsSem);
{ {
INPUT_STATE PressState; INPUT_STATE PressState;
+15 -2
View File
@@ -115,7 +115,19 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
zoom_from = 0; zoom_from = 0;
} }
} }
SetSemaphore (GraphicsSem);
//SetSemaphore (GraphicsSem);
// PauseRotate needs to be checked twice. It is first
// checked at the rotate_planet_task function to bypass
// rendering the planet (and thus slowinng down other
// parts of te code. It is checked here because it is possile
// that PauseRotate was set between then and now, and we don't
// want too push anything onto the DrawQueue in that case.
// If the setSemaphore is moved before the RenderLevelMasks call,
// one of the two PauseRotate checks can be removed.
//if (((PSOLARSYS_STATE volatile)pSolarSysState)->PauseRotate !=1)
{
OldContext = SetContext (SpaceContext); OldContext = SetContext (SpaceContext);
BatchGraphics (); BatchGraphics ();
if (rp) if (rp)
@@ -129,7 +141,8 @@ RotatePlanet (int x, int da, int dx, int dy, int zoom)
} }
UnbatchGraphics (); UnbatchGraphics ();
SetContext (OldContext); SetContext (OldContext);
ClearSemaphore (GraphicsSem); }
//ClearSemaphore (GraphicsSem);
return (zoom); return (zoom);
} }
+9 -1
View File
@@ -1300,6 +1300,14 @@ rotate_planet_task (void *data)
view_index = MAP_WIDTH; view_index = MAP_WIDTH;
do do
{ {
// This SetSemaphore was placed before the RotatePlanet call
// To prevent the thread from being interrupted by the flash
// task while computing the Planet Frame. This should help
// to smooth out the planet rotation animation.
// The PauseRotate needs to be placed after the SetSemaphore,
// to gaurantee that PauseRotate doesn't change while waiting
// to aquire the GraphicsSem
SetSemaphore (GraphicsSem);
if (((PSOLARSYS_STATE volatile)pSS)->PauseRotate !=1 if (((PSOLARSYS_STATE volatile)pSS)->PauseRotate !=1
// if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3 // if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3
&& !(GLOBAL (CurrentActivity) & CHECK_ABORT)) && !(GLOBAL (CurrentActivity) & CHECK_ABORT))
@@ -1319,7 +1327,7 @@ rotate_planet_task (void *data)
} }
x += i; x += i;
} }
ClearSemaphore (GraphicsSem);
SleepThreadUntil (TimeIn + (ONE_SECOND * ROTATION_TIME) / (MAP_WIDTH)); SleepThreadUntil (TimeIn + (ONE_SECOND * ROTATION_TIME) / (MAP_WIDTH));
// SleepThreadUntil (TimeIn + (ONE_SECOND * 5 / (MAP_WIDTH-32))); // SleepThreadUntil (TimeIn + (ONE_SECOND * 5 / (MAP_WIDTH-32)));
TimeIn = GetTimeCounter (); TimeIn = GetTimeCounter ();
+5 -2
View File
@@ -174,9 +174,12 @@ PauseGame (void)
F = CaptureDrawable (LoadDisplayPixmap (&r, (FRAME)0)); F = CaptureDrawable (LoadDisplayPixmap (&r, (FRAME)0));
DrawStamp (&s); DrawStamp (&s);
ClearSemaphore (GraphicsSem); // Releasing the Semaphore lets the rotate_planet_task
// draw a frame. PauseRotate can still allow one more frame
// to be drawn, so it is safer to just not release the Semaphore
//ClearSemaphore (GraphicsSem);
FlushGraphics (); FlushGraphics ();
SetSemaphore (GraphicsSem); //SetSemaphore (GraphicsSem);
{ {
BYTE scan; BYTE scan;