rem: COUNT index;
context: UndrawShip (void){	COUNT index;	SIZE radius, delta_x, delta_y;	BOOLEAN LeavingInnerSystem;	ClockTick ();#ifdef SHOW_RADAR	DrawIPRadar (FALSE);#endif /* SHOW_RADAR */	if (CurrentInputState.key[KEY_P1_THRUST])		delta_y = -1;	else		delta_y = 0;	delta_x = 0;	if (CurrentInputState.key[KEY_P1_LEFT])		delta_x -= 1;	if (CurrentInputState.key[KEY_P1_RIGHT])		delta_x += 1;			if (delta_x || delta_y < 0)	{		GLOBAL (autopilot.x) =				GLOBAL (autopilot.y) = ~0;	}	else if (GLOBAL (autopilot.x) != ~0			&& GLOBAL (autopilot.y) != ~0)		delta_y = -1;	else		delta_y = 0;	index = GetFrameIndex (GLOBAL (ShipStamp.frame));	if (pSolarSysState->turn_counter)		--pSolarSysState->turn_counter;	else if (delta_x)	{		if (delta_x < 0)			index = NORMALIZE_FACING (index - 1);		else			index = NORMALIZE_FACING (index + 1);		GLOBAL (ShipStamp.frame) =				SetAbsFrameIndex (GLOBAL (ShipStamp.frame),				index);		pSolarSysState->turn_counter = pSolarSysState->turn_wait;	}	if (pSolarSysState->thrust_counter)		--pSolarSysState->thrust_counter;	else if (delta_y < 0)	{#define THRUST_WAIT 1		flagship_inertial_thrust (FACING_TO_ANGLE (index));		pSolarSysState->thrust_counter = THRUST_WAIT;	}	LeavingInnerSystem = FALSE;	radius = pSolarSysState->SunDesc[0].radius;	if (GLOBAL (ShipStamp.origin.x) < 0			|| GLOBAL (ShipStamp.origin.x) >= SIS_SCREEN_WIDTH			|| GLOBAL (ShipStamp.origin.y) < 0			|| GLOBAL (ShipStamp.origin.y) >= SIS_SCREEN_HEIGHT)	{		if (pSolarSysState->pBaseDesc == pSolarSysState->PlanetDesc)		{			if (radius == MAX_ZOOM_RADIUS)			{				GLOBAL (CurrentActivity) |= END_INTERPLANETARY;				return;			}		}		else		{			PPLANET_DESC pPlanetDesc;			LeavingInnerSystem = TRUE;			pPlanetDesc = pSolarSysState->pBaseDesc->pPrevDesc;			pSolarSysState->pBaseDesc = pSolarSysState->PlanetDesc;			pSolarSysState->WaitIntersect = MAKE_WORD (					pPlanetDesc - pSolarSysState->PlanetDesc + 1, 0					);			GLOBAL (ip_location) =					pSolarSysState->SunDesc[0].location;			ZeroVelocityComponents (&GLOBAL (velocity));		}		radius = MAX_ZOOM_RADIUS << 1;	}	if (pSolarSysState->pBaseDesc == pSolarSysState->PlanetDesc			&& (radius > MAX_ZOOM_RADIUS			|| ((delta_x = GLOBAL (ShipStamp.origin.x)			- pSolarSysState->MenuState.flash_rect0.corner.x) >= 0			&& (delta_y = GLOBAL (ShipStamp.origin.y)			- pSolarSysState->MenuState.flash_rect0.corner.y) >= 0			&& delta_x < pSolarSysState->MenuState.flash_rect0.extent.width			&& delta_y < pSolarSysState->MenuState.flash_rect0.extent.height)))	{		old_radius = pSolarSysState->SunDesc[0].radius;		pSolarSysState->SunDesc[0].radius = radius;		FindRadius ();		if (old_radius == (MAX_ZOOM_RADIUS << 1)				|| old_radius == pSolarSysState->SunDesc[0].radius				|| LeavingInnerSystem)		{			old_radius = 0;			if (LeavingInnerSystem)				SetGraphicGrabOther (1);			DrawSystem (pSolarSysState->SunDesc[0].radius, FALSE);			if (LeavingInnerSystem)			{				COUNT OldWI;				SetGraphicGrabOther (0);				OldWI = pSolarSysState->WaitIntersect;				CheckIntersect (TRUE);				if (pSolarSysState->WaitIntersect != OldWI)				{					pSolarSysState->WaitIntersect = (COUNT)~0;					return;				}			}		}		else			return;	}	if (GLOBAL (autopilot.x) == ~0 && GLOBAL (autopilot.y) == ~0)		CheckIntersect (FALSE);}