Пример #1
0
// Initialise the surface graphics, and start the planet music.
// Called from the GenerateFunctions.generateOribital() function
// (when orbit is entered; either from IP, or from loading a saved game)
// and when "starmap" is selected from orbit and then cancelled;
// also after in-orbit comm and after defeating planet guards in combat.
// SurfDefFrame contains surface definition images when a planet comes
// with its own bitmap (currently only for Earth)
void
LoadPlanet (FRAME SurfDefFrame)
{
	bool WaitMode = !(LastActivity & CHECK_LOAD);
	PLANET_DESC *pPlanetDesc;

#ifdef DEBUG
	if (disableInteractivity)
		return;
#endif

	assert (pSolarSysState->InOrbit && !pSolarSysState->TopoFrame);

	CreatePlanetContext ();

	if (WaitMode)
	{
		LockMutex (GraphicsLock);
		DrawOrbitalDisplay (DRAW_ORBITAL_WAIT);
		UnlockMutex (GraphicsLock);
	}

	StopMusic ();

	pPlanetDesc = pSolarSysState->pOrbitalDesc;
	GeneratePlanetSurface (pPlanetDesc, SurfDefFrame);
	SetPlanetMusic (pPlanetDesc->data_index & ~PLANET_SHIELDED);
	GeneratePlanetSide ();

	if (!PLRPlaying ((MUSIC_REF)~0))
		PlayMusic (LanderMusic, TRUE, 1);

	if (WaitMode)
	{
		ZoomInPlanetSphere ();
		LockMutex (GraphicsLock);
		DrawOrbitalDisplay (DRAW_ORBITAL_UPDATE);
		UnlockMutex (GraphicsLock);
	}
	else
	{
		LockMutex (GraphicsLock);
		DrawOrbitalDisplay (DRAW_ORBITAL_FULL);
		UnlockMutex (GraphicsLock);
	}
}
Пример #2
0
// 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;
// also after in-orbit comm and after defeating planet guards in combat.
// SurfDefFrame contains surface definition images when a planet comes
// with its own bitmap (currently only for Earth)
void
LoadPlanet (FRAME SurfDefFrame)
{
    BOOLEAN WaitMode;

#ifdef DEBUG
    if (disableInteractivity)
        return;
#endif

    WaitMode = !(LastActivity & CHECK_LOAD) &&
               (pSolarSysState->MenuState.Initialized <= 2);

    if (WaitMode)
    {
        LockMutex (GraphicsLock);
        DrawOrbitalDisplay (DRAW_ORBITAL_WAIT);
        UnlockMutex (GraphicsLock);
    }

    if (pSolarSysState->MenuState.flash_task == 0)
    {
        // The "rotate planets" task is not initialised yet.
        // This means the call to LoadPlanet is made from a
        // GENERATE_ORBITAL case of an IP generation function.
        PPLANET_DESC pPlanetDesc;

        StopMusic ();

        TaskContext = CaptureContext (CreateContext ());

        pPlanetDesc = pSolarSysState->pOrbitalDesc;


        /*
        if (pPlanetDesc->data_index & PLANET_SHIELDED)
        	pSolarSysState->PlanetSideFrame[2] = CaptureDrawable (
        			LoadGraphic (PLANET_SHIELDED_MASK_PMAP_ANIM)
        			);
        else if (pSolarSysState->SysInfo.PlanetInfo.AtmoDensity != GAS_GIANT_ATMOSPHERE)
        	LoadLanderData ();
        */

        GeneratePlanetMask (pPlanetDesc, SurfDefFrame);
        SetPlanetMusic ((UBYTE)(pPlanetDesc->data_index & ~PLANET_SHIELDED));

        if (pPlanetDesc->pPrevDesc != &pSolarSysState->SunDesc[0])
            pPlanetDesc = pPlanetDesc->pPrevDesc;

        GeneratePlanetSide ();
    }

    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)
    {
        s.origin.x = SIS_SCREEN_WIDTH >> 1;
        s.origin.y = ((116 - SIS_ORG_Y) >> 1) + 2;
        DrawStamp (&s);
    }