예제 #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
static BOOLEAN
DoPlanetOrbit (MENU_STATE *pMS)
{
	BOOLEAN select = PulsedInputState.menu[KEY_MENU_SELECT];
	BOOLEAN handled;

	if ((GLOBAL (CurrentActivity) & (CHECK_ABORT | CHECK_LOAD))
			|| GLOBAL_SIS (CrewEnlisted) == (COUNT)~0)
		return FALSE;

	// XXX: pMS actually refers to pSolarSysState->MenuState
	handled = DoMenuChooser (pMS, PM_SCAN);
	if (handled)
		return TRUE;

	if (!select)
		return TRUE;

	LockMutex (GraphicsLock);
	SetFlashRect (NULL);
	UnlockMutex (GraphicsLock);

	switch (pMS->CurState)
	{
		case SCAN:
			ScanSystem ();
			if (GLOBAL (CurrentActivity) & START_ENCOUNTER)
			{	// Found Fwiffo on Pluto
				return FALSE;
			}
			break;
		case EQUIP_DEVICE:
			select = DevicesMenu ();
			if (GLOBAL (CurrentActivity) & START_ENCOUNTER)
			{	// Invoked Talking Pet, a Caster or Sun Device over Chmmr,
				// or a Caster for Ilwrath
				// Going into conversation
				return FALSE;
			}
			break;
		case CARGO:
			CargoMenu ();
			break;
		case ROSTER:
			select = RosterMenu ();
			break;
		case GAME_MENU:
			if (!GameOptions ())
				return FALSE; // abort or load
			break;
		case STARMAP:
		{
			BOOLEAN AutoPilotSet;
			InputFrameCallback *oldCallback;

			// Deactivate planet rotation
			oldCallback = SetInputCallback (NULL);

			LockMutex (GraphicsLock);
			RepairSISBorder ();
			UnlockMutex (GraphicsLock);

			AutoPilotSet = StarMap ();
			if (GLOBAL (CurrentActivity) & CHECK_ABORT)
				return FALSE;

			// Reactivate planet rotation
			SetInputCallback (oldCallback);

			if (!AutoPilotSet)
			{	// Redraw the orbital display
				LockMutex (GraphicsLock);
				DrawOrbitalDisplay (DRAW_ORBITAL_FULL);
				UnlockMutex (GraphicsLock);
				break;
			}
			// Fall through !!!
		}
		case NAVIGATION:
			return FALSE;
	}

	if (!(GLOBAL (CurrentActivity) & CHECK_ABORT))
	{
		if (select)
		{	// 3DO menu jumps to NAVIGATE after a successful submenu run
			if (optWhichMenu != OPT_PC)
				pMS->CurState = NAVIGATION;
			DrawMenuStateStrings (PM_SCAN, pMS->CurState);
		}
		LockMutex (GraphicsLock);
		SetFlashRect (SFR_MENU_3DO);
		UnlockMutex (GraphicsLock);
	}

	return TRUE;
}
예제 #3
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);
    }