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" #include "libs/graphics/gfx_common.h"
//Added by Chris extern void DrawPlanet (int x, int y, int dy, unsigned int rgb);
extern void GeneratePlanetSide (void);
void extern void GeneratePlanetMask (PPLANET_DESC pPlanetDesc, BOOLEAN IsEarth);
DrawPlanet(int x, int y, int dy, unsigned int rgb);
//End Added by Chris
extern void SetPlanetMusic (BYTE planet_type); extern void SetPlanetMusic (BYTE planet_type);
extern int rotate_planet_task (PVOID Blah); extern int rotate_planet_task (PVOID Blah);
extern MUSIC_REF LanderMusic;
void void
DrawScannedObjects (BOOLEAN Reversed) 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. // Initialise the surface graphics, and start the planet music.
// Called from the GENERATE_ORBITAL case of an IP generation function // Called from the GENERATE_ORBITAL case of an IP generation function
// (when orbit is entered; either from IP, or from loading a saved game) // (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, // IsDefined is true only when the planet comes with its own bitmap,
// namely for Earth. // namely for Earth.
void void
LoadPlanet (BOOLEAN IsDefined) LoadPlanet (BOOLEAN IsDefined)
{ {
STAMP s; BOOLEAN WaitMode;
#ifdef DEBUG #ifdef DEBUG
if (disableInteractivity) if (disableInteractivity)
return; return;
#endif #endif
LockMutex (GraphicsLock); WaitMode = !(LastActivity & CHECK_LOAD) &&
(pSolarSysState->MenuState.Initialized <= 2);
BatchGraphics (); if (WaitMode)
SetTransitionSource (NULL); {
if (!(LastActivity & CHECK_LOAD)) LockMutex (GraphicsLock);
DrawStarBackGround (TRUE); DrawOrbitalDisplay (DRAW_ORBITAL_WAIT);
UnlockMutex (GraphicsLock);
}
if (pSolarSysState->MenuState.flash_task == 0) if (pSolarSysState->MenuState.flash_task == 0)
{ {
@@ -91,7 +151,6 @@ LoadPlanet (BOOLEAN IsDefined)
// This means the call to LoadPlanet is made from a // This means the call to LoadPlanet is made from a
// GENERATE_ORBITAL case of an IP generation function. // GENERATE_ORBITAL case of an IP generation function.
PPLANET_DESC pPlanetDesc; PPLANET_DESC pPlanetDesc;
extern void GeneratePlanetSide (void);
StopMusic (); StopMusic ();
@@ -109,12 +168,7 @@ LoadPlanet (BOOLEAN IsDefined)
LoadLanderData (); LoadLanderData ();
*/ */
{
extern void GeneratePlanetMask (PPLANET_DESC
pPlanetDesc, BOOLEAN IsEarth);
GeneratePlanetMask (pPlanetDesc, IsDefined); GeneratePlanetMask (pPlanetDesc, IsDefined);
}
SetPlanetMusic ((UBYTE)(pPlanetDesc->data_index & ~PLANET_SHIELDED)); SetPlanetMusic ((UBYTE)(pPlanetDesc->data_index & ~PLANET_SHIELDED));
if (pPlanetDesc->pPrevDesc != &pSolarSysState->SunDesc[0]) if (pPlanetDesc->pPrevDesc != &pSolarSysState->SunDesc[0])
@@ -123,23 +177,11 @@ LoadPlanet (BOOLEAN IsDefined)
GeneratePlanetSide (); GeneratePlanetSide ();
} }
if (LastActivity & CHECK_LOAD) LockMutex (GraphicsLock);
{ DrawOrbitalDisplay (WaitMode ? DRAW_ORBITAL_UPDATE : DRAW_ORBITAL_FULL);
if (LOBYTE (LastActivity) == 0) #if 0
{ // this used to draw the static slave shield graphic
DrawSISFrame ();
}
else
{
ClearSISRect (DRAW_SIS_DISPLAY);
RepairSISBorder ();
}
DrawSISMessage (NULL_PTR);
DrawSISTitle (GLOBAL_SIS (PlanetName));
}
SetContext (SpaceContext); SetContext (SpaceContext);
s.frame = pSolarSysState->PlanetSideFrame[2]; s.frame = pSolarSysState->PlanetSideFrame[2];
if (s.frame) if (s.frame)
{ {
@@ -147,31 +189,12 @@ LoadPlanet (BOOLEAN IsDefined)
s.origin.y = ((116 - SIS_ORG_Y) >> 1) + 2; s.origin.y = ((116 - SIS_ORG_Y) >> 1) + 2;
DrawStamp (&s); DrawStamp (&s);
} }
#endif
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);
}
UnlockMutex (GraphicsLock); UnlockMutex (GraphicsLock);
if (!PLRPlaying ((MUSIC_REF)~0)) if (!PLRPlaying ((MUSIC_REF)~0))
{
extern MUSIC_REF LanderMusic;
PlayMusic (LanderMusic, TRUE, 1); PlayMusic (LanderMusic, TRUE, 1);
if (pSolarSysState->MenuState.flash_task == 0) if (pSolarSysState->MenuState.flash_task == 0)
{ {
pSolarSysState->MenuState.flash_task = pSolarSysState->MenuState.flash_task =
@@ -181,29 +204,6 @@ LoadPlanet (BOOLEAN IsDefined)
while (pSolarSysState->MenuState.Initialized == 2) while (pSolarSysState->MenuState.Initialized == 2)
TaskSwitch (); 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 void