rem: return (PickPlanetSide (pMS));
add: return PickPlanetSide (pMS);
context: DoScan (PMENU_STATE pMS){	DWORD TimeIn, WaitTime;	BOOLEAN select, cancel;	select = CurrentMenuState.select;	cancel = CurrentMenuState.cancel;	if (GLOBAL (CurrentActivity) & CHECK_ABORT)		return (FALSE);	if (!pMS->Initialized)	{		pMS->Initialized = TRUE;		pMS->InputFunc = DoScan;	}	else if (cancel || (select && pMS->CurState == EXIT_SCAN))	{		LockMutex (GraphicsLock);		SetContext (SpaceContext);		BatchGraphics ();		DrawPlanet (SIS_SCREEN_WIDTH - MAP_WIDTH, SIS_SCREEN_HEIGHT - MAP_HEIGHT, 0, 0);		UnbatchGraphics ();		UnlockMutex (GraphicsLock);		EraseCoarseScan ();// DrawMenuStateStrings (PM_SCAN, SCAN);		return (FALSE);	}	else if (select)	{		BYTE min_scan, max_scan;		RECT r;		BOOLEAN PressState, ButtonState;		if (pMS->CurState == DISPATCH_SHUTTLE)		{			COUNT fuel_required;			UNICODE buf[20];			fuel_required = (COUNT)(					pSolarSysState->SysInfo.PlanetInfo.SurfaceGravity << 1					);			if (fuel_required > 3 * FUEL_TANK_SCALE)				fuel_required = 3 * FUEL_TANK_SCALE;			if (GLOBAL_SIS (FuelOnBoard) < (DWORD)fuel_required					|| GLOBAL_SIS (NumLanders) == 0					|| GLOBAL_SIS (CrewEnlisted) == 0)			{				PlaySoundEffect (SetAbsSoundIndex (MenuSounds, 2),						0, NotPositional (), NULL, GAME_SOUND_PRIORITY);				return (TRUE);			}			wsprintf (buf, "%s%u.%u",					GAME_STRING (NAVIGATION_STRING_BASE + 5),					fuel_required / FUEL_TANK_SCALE,					((fuel_required % FUEL_TANK_SCALE) + 5) / 10);			LockMutex (GraphicsLock);			ClearSISRect (CLEAR_SIS_RADAR);			DrawStatusMessage (buf);			UnlockMutex (GraphicsLock);			LockMutex (GraphicsLock);			SetContext (ScanContext);			BatchGraphics ();			DrawPlanet (0, 0, 0, 0);			DrawScannedObjects (FALSE);			UnbatchGraphics ();			UnlockMutex (GraphicsLock);					pMS->Initialized = FALSE;			pMS->CurFrame = 0;			return (PickPlanetSide (pMS));		}		pSolarSysState->MenuState.Initialized += 4;#ifndef SPIN_ON_SCAN		pSolarSysState->PauseRotate = 1;#endif		if ((min_scan = pMS->CurState) != AUTO_SCAN)			max_scan = min_scan;		else			min_scan = MINERAL_SCAN, max_scan = BIOLOGICAL_SCAN;		do		{		TEXT t;		SWORD i;		t.baseline.x = SIS_SCREEN_WIDTH >> 1;		t.baseline.y = SIS_SCREEN_HEIGHT - MAP_HEIGHT - 7;		t.align = ALIGN_CENTER;		t.CharCount = (COUNT)~0;		pSolarSysState->CurNode = (COUNT)~0;		(*pSolarSysState->GenFunc) (				(BYTE)(min_scan + GENERATE_MINERAL)				);		pMS->delta_item = (SIZE)pSolarSysState->CurNode;		t.pStr = GAME_STRING (SCAN_STRING_BASE + min_scan);		LockMutex (GraphicsLock);		SetContext (SpaceContext);		r.corner.x = 0;		r.corner.y = t.baseline.y - 10;		r.extent.width = SIS_SCREEN_WIDTH;		r.extent.height = t.baseline.y - r.corner.y + 1;		RepairBackRect (&r);		SetContextFont (MicroFont);		switch (min_scan)		{			case MINERAL_SCAN:				SetContextForeGroundColor (						BUILD_COLOR (MAKE_RGB15 (0x13, 0x00, 0x00), 0x2C)						);				break;			case ENERGY_SCAN:				SetContextForeGroundColor (						BUILD_COLOR (MAKE_RGB15 (0xC, 0xC, 0xC), 0x1C)						);				break;			case BIOLOGICAL_SCAN:				SetContextForeGroundColor (						BUILD_COLOR (MAKE_RGB15 (0x00, 0xE, 0x00), 0x6C)						);				break;		}		font_DrawText (&t);		SetContext (ScanContext);		UnlockMutex (GraphicsLock);	{		DWORD rgb;				switch (min_scan)		{			case MINERAL_SCAN:				rgb = 0x1f << 10;				break;			case ENERGY_SCAN:				rgb = (0x1f << 10) | (0x1f << 5) | 0x1f;				break;			case BIOLOGICAL_SCAN:				rgb = 0x1f << 5;				break;		}		LockMutex (GraphicsLock);		BatchGraphics ();		DrawPlanet (0, 0, 0, 0);		UnbatchGraphics ();		UnlockMutex (GraphicsLock);		PressState = AnyButtonPress (TRUE);		WaitTime = (ONE_SECOND << 1) / MAP_HEIGHT;//		LockMutex (GraphicsLock);		TimeIn = GetTimeCounter ();		for (i = 0; i < MAP_HEIGHT + NUM_FLASH_COLORS + 1; i++)		{			ButtonState = AnyButtonPress (TRUE);			if (PressState)			{				PressState = ButtonState;				ButtonState = FALSE;			}			if (ButtonState)				i = -i;			LockMutex (GraphicsLock);			BatchGraphics ();			DrawPlanet (0, 0, i, rgb);			if (i < 0) 				i = MAP_HEIGHT + NUM_FLASH_COLORS;			if (pMS->delta_item)				DrawScannedStuff (i, min_scan);			UnbatchGraphics ();			UnlockMutex (GraphicsLock);//			FlushGraphics ();			SleepThreadUntil (TimeIn + WaitTime);			TimeIn = GetTimeCounter ();		}//		UnlockMutex (GraphicsLock);		pSolarSysState->Tint_rgb = 0;	}		} while (++min_scan <= max_scan);		LockMutex (GraphicsLock);		SetContext (SpaceContext);		r.corner.x = 0;		r.corner.y = (SIS_SCREEN_HEIGHT - MAP_HEIGHT - 7) - 10;		r.extent.width = SIS_SCREEN_WIDTH;		r.extent.height = (SIS_SCREEN_HEIGHT - MAP_HEIGHT - 7) - r.corner.y + 1;		RepairBackRect (&r);		SetContext (ScanContext);		if (pMS->CurState == AUTO_SCAN)		{			DrawPlanet (0, 0, 0, 0);			DrawScannedObjects (FALSE);			UnlockMutex (GraphicsLock);			DrawMenuStateStrings (PM_MIN_SCAN, pMS->CurState = DISPATCH_SHUTTLE);		}		else			UnlockMutex (GraphicsLock);					pSolarSysState->MenuState.Initialized -= 4;		pSolarSysState->PauseRotate = 0;		FlushInput ();	}	else if (!(pSolarSysState->pOrbitalDesc->data_index & PLANET_SHIELDED)			&& pSolarSysState->SysInfo.PlanetInfo.AtmoDensity !=			GAS_GIANT_ATMOSPHERE)		DoMenuChooser (pMS, PM_MIN_SCAN);	return (TRUE);}