rem: TimeIn = GetTimeCounter() + 2;
add: TimeIn = GetTimeCounter () + PLANET_SIDE_RATE;
context: ScrollPlanetSide (SIZE dx, SIZE dy, SIZE CountDown){	POINT old_pt, new_pt;	STAMP lander_s, shadow_s, shield_s;	CONTEXT OldContext;	signed char lander_pos[] = { -10, 1, 12, 22, 31, 39, 45, 50, 54, 57, 59 };	old_pt.x = pSolarSysState->MenuState.first_item.x - (SURFACE_WIDTH >> 1);	old_pt.y = pSolarSysState->MenuState.first_item.y - (SURFACE_HEIGHT >> 1);	new_pt.y = old_pt.y + dy;	if (new_pt.y < -(SURFACE_HEIGHT >> 1))	{		new_pt.y = -(SURFACE_HEIGHT >> 1);		dy = new_pt.y - old_pt.y;		dx = 0;		ZeroVelocityComponents (&GLOBAL (velocity));	}	else if (new_pt.y > (MAP_HEIGHT << MAG_SHIFT) - (SURFACE_HEIGHT >> 1))	{		new_pt.y = (MAP_HEIGHT << MAG_SHIFT) - (SURFACE_HEIGHT >> 1);		dy = new_pt.y - old_pt.y;		dx = 0;		ZeroVelocityComponents (&GLOBAL (velocity));	}	new_pt.x = old_pt.x + dx;	if (new_pt.x < 0)		new_pt.x += MAP_WIDTH << MAG_SHIFT;	else if (new_pt.x >= MAP_WIDTH << MAG_SHIFT)		new_pt.x -= MAP_WIDTH << MAG_SHIFT;	new_pt.x = pSolarSysState->MenuState.first_item.x + dx;	if (new_pt.x < 0)		new_pt.x += MAP_WIDTH << MAG_SHIFT;	else if (new_pt.x >= MAP_WIDTH << MAG_SHIFT)		new_pt.x -= MAP_WIDTH << MAG_SHIFT;	new_pt.y = pSolarSysState->MenuState.first_item.y + dy;	pSolarSysState->MenuState.first_item = new_pt;	{		DWORD TimeIn;		SleepThreadUntil (MAKE_DWORD (				pSolarSysState->MenuState.flash_rect1.corner.x,				pSolarSysState->MenuState.flash_rect1.corner.y				));		TimeIn = GetTimeCounter() + 2;		pSolarSysState->MenuState.flash_rect1.corner.x = LOWORD (TimeIn);		pSolarSysState->MenuState.flash_rect1.corner.y = HIWORD (TimeIn);	}	SetSemaphore (GraphicsSem);	OldContext = SetContext (SpaceContext);	BatchGraphics ();	// Display planet area, accounting for horizontal wrapping if	// near the edges.	{		STAMP s;		ClearDrawable ();		s.origin.x = -new_pt.x + (SURFACE_WIDTH >> 1);		s.origin.y = -new_pt.y + (SURFACE_HEIGHT >> 1);		s.frame = pSolarSysState->TopoFrame;		SetGraphicScale (1 << (MAG_SHIFT + 8));		DrawStamp (&s);		s.origin.x += MAP_WIDTH << MAG_SHIFT;		DrawStamp (&s);		s.origin.x -= MAP_WIDTH << (MAG_SHIFT + 1);		DrawStamp (&s);		SetGraphicScale (0);	}	BuildObjectList ();		DrawBatch (DisplayArray, DisplayLinks, 0);	if (pMenuState->delta_item || pMenuState->CurState < 3)	{		BYTE damage_index;		lander_s.origin.x = SURFACE_WIDTH >> 1;		lander_s.frame = LanderFrame[0];		if (CountDown < 0)			lander_s.origin.y = SURFACE_HEIGHT >> 1;		else			lander_s.origin.y = lander_pos[CountDown];		if (CountDown >= 0)		{			shadow_s.origin.x = lander_s.origin.y + (SURFACE_WIDTH >> 1) - (SURFACE_HEIGHT >> 1);//2;			shadow_s.origin.y = lander_s.origin.y;			shadow_s.frame = lander_s.frame;			SetContextForeGroundColor (BLACK_COLOR);			DrawFilledStamp (&shadow_s);		}		if ((damage_index = LOBYTE (pMenuState->delta_item)) == 0)			DrawStamp (&lander_s);		else		{			--pMenuState->delta_item;			if (!(damage_index & SHIELD_BIT))			{				SetContextForeGroundColor (DamageColorCycle (0, damage_index));				DrawFilledStamp (&lander_s);			}			else			{				if ((damage_index =						(BYTE)((damage_index & ~SHIELD_BIT) - 1)) == 0)					pMenuState->delta_item &= ~SHIELD_BIT;				else				{					shield_s.origin = lander_s.origin;					shield_s.frame = SetEquFrameIndex (							LanderFrame[4],							lander_s.frame							);					SetContextForeGroundColor (							BUILD_COLOR (MAKE_RGB15 (0x1F, 0x1F, 0x1F) | 0x8000, damage_index)							);					DrawFilledStamp (&shield_s);				}				DrawStamp (&lander_s);			}		}	}		if (CountDown < 0			&& HIBYTE (pMenuState->delta_item)			&& GetPredLink (DisplayLinks) != END_OF_LIST)		CheckObjectCollision (END_OF_LIST);	{		PPLANETSIDE_DESC pPSD;		pPSD = (PPLANETSIDE_DESC)pMenuState->ModuleFrame;		if (pPSD->NumFrames)		{			--pPSD->NumFrames;			SetContextForeGroundColor (pPSD->ColorCycle[pPSD->NumFrames >> 1]);			pPSD->MineralText[0].baseline.x -= dx;			pPSD->MineralText[0].baseline.y -= dy;			font_DrawText (&pPSD->MineralText[0]);			pPSD->MineralText[1].baseline.x = pPSD->MineralText[0].baseline.x;			pPSD->MineralText[1].baseline.y = pPSD->MineralText[0].baseline.y + 7;			font_DrawText (&pPSD->MineralText[1]);			pPSD->MineralText[2].baseline.x = pPSD->MineralText[1].baseline.x;			pPSD->MineralText[2].baseline.y = pPSD->MineralText[1].baseline.y + 7;			font_DrawText (&pPSD->MineralText[2]);		}	}	pMenuState->flash_rect0.corner.x = new_pt.x >> MAG_SHIFT;	pMenuState->flash_rect0.corner.y = new_pt.y >> MAG_SHIFT;	RepairScan ();	if (lander_flags & KILL_CREW)		DeltaLanderCrew (-1, LIGHTNING_DISASTER);	UnbatchGraphics ();	SetContext (OldContext);	ClearSemaphore (GraphicsSem);}