From 8e1875fdb6195c00caccc11008be6257c85afdb8 Mon Sep 17 00:00:00 2001 From: avolkov Date: Sat, 5 Dec 2009 23:27:06 +0000 Subject: [PATCH] Hangar animation is now a DoInput callback; now works in Game menu too git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3395 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/uqm/shipyard.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/sc2/src/uqm/shipyard.c b/sc2/src/uqm/shipyard.c index 046bedab9..294a8d632 100644 --- a/sc2/src/uqm/shipyard.c +++ b/sc2/src/uqm/shipyard.c @@ -100,6 +100,18 @@ animatePowerLines (MENU_STATE *pMS) } } +static void +on_input_frame (void) +{ + CONTEXT oldContext; + + LockMutex (GraphicsLock); + oldContext = SetContext (SpaceContext); + animatePowerLines (NULL); + SetContext (oldContext); + UnlockMutex (GraphicsLock); +} + #ifdef WANT_SHIP_SPINS static void SpinStarShip (MENU_STATE *pMS, HFLEETINFO hStarShip) @@ -1025,13 +1037,6 @@ ChangeFlashRect: } UnlockMutex (GraphicsLock); } - -#ifndef USE_3DO_HANGAR - LockMutex (GraphicsLock); - SetContext (SpaceContext); - animatePowerLines (NULL); - UnlockMutex (GraphicsLock); -#endif } SleepThread (ONE_SECOND / 30); @@ -1215,21 +1220,16 @@ DoShipyard (MENU_STATE *pMS) SetContextFont (TinyFont); - { - RECT r; - - r.corner.x = 0; - r.corner.y = 0; - r.extent.width = SCREEN_WIDTH; - r.extent.height = SCREEN_HEIGHT; - ScreenTransition (3, &r); - } + ScreenTransition (3, NULL); UnbatchGraphics (); UnlockMutex (GraphicsLock); PlayMusic (pMS->hMusic, TRUE, 1); ShowCombatShip (pMS, (COUNT)~0, NULL); + + SetInputCallback (on_input_frame); + LockMutex (GraphicsLock); SetFlashRect (SFR_MENU_3DO); UnlockMutex (GraphicsLock); @@ -1240,6 +1240,8 @@ DoShipyard (MENU_STATE *pMS) else if (cancel || (select && pMS->CurState == SHIPYARD_EXIT)) { ExitShipyard: + SetInputCallback (NULL); + LockMutex (GraphicsLock); DestroyDrawable (ReleaseDrawable (pMS->ModuleFrame)); pMS->ModuleFrame = 0; @@ -1269,12 +1271,6 @@ ExitShipyard: } else { -#ifndef USE_3DO_HANGAR - LockMutex (GraphicsLock); - SetContext (SpaceContext); - animatePowerLines (NULL); - UnlockMutex (GraphicsLock); -#endif DoMenuChooser (pMS, PM_CREW); }