rem: UnbatchGraphics (); SetContext (OldContext);
context: rotate_planet_task (void *data){	SIZE i;	DWORD TimeIn;	PSOLARSYS_STATE pSS;	BOOLEAN repair, zooming;	int angle=0;	Task task = (Task) data;	repair = FALSE;	zooming = TRUE;	pSS = pSolarSysState;	while (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized < 2 && !Task_ReadState (task, TASK_EXIT))		TaskSwitch ();//	SetPlanetTilt ((pSS->SysInfo.PlanetInfo.AxialTilt << 8) / 360);	SetPlanetTilt (pSS->SysInfo.PlanetInfo.AxialTilt);//	angle=pSS->SysInfo.PlanetInfo.AxialTilt;				i = 1 - ((pSS->SysInfo.PlanetInfo.AxialTilt & 1) << 1);	TimeIn = GetTimeCounter ();	while (!Task_ReadState (task, TASK_EXIT))	{		BYTE view_index;		COORD x;		if (i > 0)			x = 0;		else			x = MAP_WIDTH - 1;		view_index = MAP_WIDTH;		do		{			CONTEXT OldContext;						SetSemaphore (GraphicsSem);			if (((PSOLARSYS_STATE volatile)pSS)->MenuState.Initialized <= 3					&& !(GLOBAL (CurrentActivity) & CHECK_ABORT))			{				OldContext = SetContext (SpaceContext);				BatchGraphics ();				if (repair)				{					RECT r;						r.corner.x = 0;					r.corner.y = 0;					r.extent.width = SIS_SCREEN_WIDTH;					r.extent.height = SIS_SCREEN_HEIGHT - MAP_HEIGHT;					RepairBackRect (&r);				}				repair = RotatePlanet (x, angle, SIS_SCREEN_WIDTH >> 1,						(148 - SIS_ORG_Y) >> 1, zooming						);				UnbatchGraphics ();				SetContext (OldContext);				if (!repair && zooming)				{					zooming = FALSE;					++pSS->MenuState.Initialized;				}				x += i;			}			ClearSemaphore (GraphicsSem);			SleepThreadUntil (TimeIn + (ONE_SECOND * ROTATION_TIME) / (MAP_WIDTH));//			SleepThreadUntil (TimeIn + (ONE_SECOND * 5 / (MAP_WIDTH-32)));			TimeIn = GetTimeCounter ();		} while (--view_index && !Task_ReadState (task, TASK_EXIT));	}	FinishTask (task);	return(0);}