Bringing back 'Entering Planetary Orbit' wait screen; some code cleanups

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1994 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2005-11-14 00:59:10 +00:00
parent 8353fe6903
commit 1e2c356182
+80 -80
View File
@@ -24,16 +24,14 @@
#include "libs/graphics/gfx_common.h"
//Added by Chris
void
DrawPlanet(int x, int y, int dy, unsigned int rgb);
//End Added by Chris
extern void DrawPlanet (int x, int y, int dy, unsigned int rgb);
extern void GeneratePlanetSide (void);
extern void GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth);
extern void SetPlanetMusic (BYTE planet_type);
extern int rotate_planet_task (PVOID Blah);
extern MUSIC_REF LanderMusic;
void
DrawScannedObjects (BOOLEAN Reversed)
{
@@ -62,28 +60,90 @@ DrawScannedObjects (BOOLEAN Reversed)
}
}
typedef enum
{
DRAW_ORBITAL_FULL,
DRAW_ORBITAL_WAIT,
DRAW_ORBITAL_UPDATE,
} DRAW_ORBITAL_MODE;
static void
DrawOrbitalDisplay (DRAW_ORBITAL_MODE Mode)
{
RECT r = { SIS_ORG_X, SIS_ORG_Y,
SIS_SCREEN_WIDTH, SIS_SCREEN_HEIGHT };
BatchGraphics ();
if (Mode != DRAW_ORBITAL_UPDATE)
{
SetTransitionSource (NULL);
DrawSISFrame ();
DrawSISMessage (NULL_PTR);
DrawSISTitle (GLOBAL_SIS (PlanetName));
DrawStarBackGround (TRUE);
}
SetContext (SpaceContext);
if (Mode == DRAW_ORBITAL_WAIT)
{
STAMP s;
s.frame = CaptureDrawable (
LoadCelFile ("ipanims/orbenter.ani"));
s.origin.x = -SAFE_X;
s.origin.y = SIS_SCREEN_HEIGHT - MAP_HEIGHT;
DrawStamp (&s);
DestroyDrawable (ReleaseDrawable (s.frame));
}
else
{
DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH,
SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);
}
if (Mode != DRAW_ORBITAL_UPDATE)
{
ScreenTransition (3, &r);
}
UnbatchGraphics ();
if (Mode != DRAW_ORBITAL_WAIT)
{
LoadIntoExtraScreen (&r);
}
}
// Initialise the surface graphics, and start the planet music.
// Called from the GENERATE_ORBITAL case of an IP generation function
// (when orbit is entered; either from IP, or from loading a saved game)
// and when "starmap" is selected from orbit and then cancelled.
// and when "starmap" is selected from orbit and then cancelled;
// also after in-orbit comm and after defeating planet guards in combat.
// IsDefined is true only when the planet comes with its own bitmap,
// namely for Earth.
void
LoadPlanet (BOOLEAN IsDefined)
{
STAMP s;
BOOLEAN WaitMode;
#ifdef DEBUG
if (disableInteractivity)
return;
#endif
LockMutex (GraphicsLock);
WaitMode = !(LastActivity & CHECK_LOAD) &&
(pSolarSysState->MenuState.Initialized <= 2);
BatchGraphics ();
SetTransitionSource (NULL);
if (!(LastActivity & CHECK_LOAD))
DrawStarBackGround (TRUE);
if (WaitMode)
{
LockMutex (GraphicsLock);
DrawOrbitalDisplay (DRAW_ORBITAL_WAIT);
UnlockMutex (GraphicsLock);
}
if (pSolarSysState->MenuState.flash_task == 0)
{
@@ -91,7 +151,6 @@ LoadPlanet (BOOLEAN IsDefined)
// This means the call to LoadPlanet is made from a
// GENERATE_ORBITAL case of an IP generation function.
PPLANET_DESC pPlanetDesc;
extern void GeneratePlanetSide (void);
StopMusic ();
@@ -109,12 +168,7 @@ LoadPlanet (BOOLEAN IsDefined)
LoadLanderData ();
*/
{
extern void GeneratePlanetMask (PPLANET_DESC
pPlanetDesc, BOOLEAN IsEarth);
GeneratePlanetMask (pPlanetDesc, IsDefined);
}
SetPlanetMusic ((UBYTE)(pPlanetDesc->data_index & ~PLANET_SHIELDED));
if (pPlanetDesc->pPrevDesc != &pSolarSysState->SunDesc[0])
@@ -123,23 +177,11 @@ LoadPlanet (BOOLEAN IsDefined)
GeneratePlanetSide ();
}
if (LastActivity & CHECK_LOAD)
{
if (LOBYTE (LastActivity) == 0)
{
DrawSISFrame ();
}
else
{
ClearSISRect (DRAW_SIS_DISPLAY);
RepairSISBorder ();
}
DrawSISMessage (NULL_PTR);
DrawSISTitle (GLOBAL_SIS (PlanetName));
}
LockMutex (GraphicsLock);
DrawOrbitalDisplay (WaitMode ? DRAW_ORBITAL_UPDATE : DRAW_ORBITAL_FULL);
#if 0
// this used to draw the static slave shield graphic
SetContext (SpaceContext);
s.frame = pSolarSysState->PlanetSideFrame[2];
if (s.frame)
{
@@ -147,31 +189,12 @@ LoadPlanet (BOOLEAN IsDefined)
s.origin.y = ((116 - SIS_ORG_Y) >> 1) + 2;
DrawStamp (&s);
}
if (!(LastActivity & CHECK_LOAD))
{
RECT r;
BatchGraphics ();
DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);
UnbatchGraphics ();
r.corner.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT;
ScreenTransition (3, &r);
UnbatchGraphics ();
LoadIntoExtraScreen (&r);
}
#endif
UnlockMutex (GraphicsLock);
if (!PLRPlaying ((MUSIC_REF)~0))
{
extern MUSIC_REF LanderMusic;
PlayMusic (LanderMusic, TRUE, 1);
if (pSolarSysState->MenuState.flash_task == 0)
{
pSolarSysState->MenuState.flash_task =
@@ -181,29 +204,6 @@ LoadPlanet (BOOLEAN IsDefined)
while (pSolarSysState->MenuState.Initialized == 2)
TaskSwitch ();
}
}
if (LastActivity & CHECK_LOAD)
{
RECT r;
CONTEXT oldContext;
r.corner.x = SIS_ORG_X;
r.corner.y = SIS_ORG_Y;
r.extent.width = SIS_SCREEN_WIDTH;
r.extent.height = SIS_SCREEN_HEIGHT;
LockMutex (GraphicsLock);
oldContext = SetContext (SpaceContext);
DrawStarBackGround (TRUE);
SetContext (oldContext);
BatchGraphics();
DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);
UnbatchGraphics();
ScreenTransition (3, &r); // How does this work?
UnbatchGraphics ();
LoadIntoExtraScreen (&r);
UnlockMutex (GraphicsLock);
}
}
void