rem: printf ("Star index = %d, Planet index = %d, <%d, %d>\n", CurStarDescPtr - star_array, pCurDesc - pSolarSysState->PlanetDesc, pSolarSysState->SunDesc[0].location.x, pSolarSysState->SunDesc[0].location.y);
add: fprintf (stderr, "Star index = %d, Planet index = %d, <%d, %d>\n", CurStarDescPtr - star_array, pCurDesc - pSolarSysState->PlanetDesc, pSolarSysState->SunDesc[0].location.x, pSolarSysState->SunDesc[0].location.y);
context: CheckIntersect (BOOLEAN just_checking){	COUNT i;	PPLANET_DESC pCurDesc;	INTERSECT_CONTROL ShipIntersect, PlanetIntersect;	COUNT NewWaitPlanet;	BYTE PlanetOffset, MoonOffset;	pCurDesc = pSolarSysState->pBaseDesc->pPrevDesc;	ShipIntersect.IntersectStamp.origin = GLOBAL (ShipStamp.origin);	ShipIntersect.EndPoint = ShipIntersect.IntersectStamp.origin;	ShipIntersect.IntersectStamp.frame = GLOBAL (ShipStamp.frame);	PlanetIntersect.IntersectStamp.origin.x = SIS_SCREEN_WIDTH >> 1;	PlanetIntersect.IntersectStamp.origin.y = SIS_SCREEN_HEIGHT >> 1;	PlanetIntersect.EndPoint = PlanetIntersect.IntersectStamp.origin;	if (pSolarSysState->WaitIntersect != (COUNT)~0			&& pSolarSysState->WaitIntersect != MAKE_WORD (					pCurDesc - pSolarSysState->PlanetDesc + 1, 1					))		PlanetIntersect.IntersectStamp.frame = DecFrameIndex (stars_in_space);	else		PlanetIntersect.IntersectStamp.frame = pCurDesc->image.frame;	NewWaitPlanet = 0;	if (pCurDesc != pSolarSysState->SunDesc /* can't intersect with sun */			&& DrawablesIntersect (&ShipIntersect,			&PlanetIntersect, MAX_TIME_VALUE))	{		PlanetOffset = pCurDesc - pSolarSysState->PlanetDesc + 1;		MoonOffset = 1;//printf ("0: Planet %d, Moon %d\n", PlanetOffset, MoonOffset);		NewWaitPlanet = MAKE_WORD (PlanetOffset, MoonOffset);		if (pSolarSysState->WaitIntersect != (COUNT)~0				&& pSolarSysState->WaitIntersect != NewWaitPlanet)		{ShowPlanet:			pSolarSysState->WaitIntersect = NewWaitPlanet;					if (!just_checking)			{				ZeroVelocityComponents (&GLOBAL (velocity));				++pSolarSysState->MenuState.Initialized;				pSolarSysState->pOrbitalDesc = pCurDesc;			}#ifdef DEBUGprintf ("Star index = %d, Planet index = %d, <%d, %d>\n",CurStarDescPtr - star_array,pCurDesc - pSolarSysState->PlanetDesc,pSolarSysState->SunDesc[0].location.x,pSolarSysState->SunDesc[0].location.y);#endif /* DEBUG */			return;		}	}	{		for (i = pCurDesc->NumPlanets,				pCurDesc = pSolarSysState->pBaseDesc; i; --i, ++pCurDesc)		{			PlanetIntersect.IntersectStamp.origin = pCurDesc->image.origin;			PlanetIntersect.EndPoint = PlanetIntersect.IntersectStamp.origin;			if (pSolarSysState->pBaseDesc == pSolarSysState->MoonDesc)			{				PlanetOffset = pCurDesc->pPrevDesc - pSolarSysState->PlanetDesc;				MoonOffset = pCurDesc - pSolarSysState->MoonDesc + 2;			}			else			{				PlanetOffset = pCurDesc - pSolarSysState->PlanetDesc;				MoonOffset = 0;			}			++PlanetOffset;			if (pSolarSysState->WaitIntersect != (COUNT)~0					&& pSolarSysState->WaitIntersect != MAKE_WORD (PlanetOffset, MoonOffset))				PlanetIntersect.IntersectStamp.frame = DecFrameIndex (stars_in_space);			else				PlanetIntersect.IntersectStamp.frame = pCurDesc->image.frame;			if (DrawablesIntersect (&ShipIntersect,					&PlanetIntersect, MAX_TIME_VALUE))			{//printf ("1: Planet %d, Moon %d\n", PlanetOffset, MoonOffset);				NewWaitPlanet = MAKE_WORD (PlanetOffset, MoonOffset);								if (pSolarSysState->WaitIntersect == (COUNT)~0)					return;				else if (pSolarSysState->WaitIntersect == NewWaitPlanet)					continue;				else if (pSolarSysState->pBaseDesc == pSolarSysState->MoonDesc)					goto ShowPlanet;				else if (!just_checking) /* pBaseDesc == PlanetDesc */				{					COUNT angle;					RECT r;					angle = FACING_TO_ANGLE (							GetFrameIndex (GLOBAL (ShipStamp.frame))							) + HALF_CIRCLE;					GLOBAL (ShipStamp.origin.x) =							(SIS_SCREEN_WIDTH >> 1) + COSINE (							angle, MIN_MOON_RADIUS							+ ((MAX_MOONS - 1) * MOON_DELTA)							+ (MOON_DELTA >> 2)							);					GLOBAL (ShipStamp.origin.y) =							(SIS_SCREEN_HEIGHT >> 1) + SINE (							angle, MIN_MOON_RADIUS							+ ((MAX_MOONS - 1) * MOON_DELTA)							+ (MOON_DELTA >> 2)							);					if (GLOBAL (ShipStamp.origin.y) < 0)						GLOBAL (ShipStamp.origin.y) = 1;					else if (GLOBAL (ShipStamp.origin.y) >= SIS_SCREEN_HEIGHT)						GLOBAL (ShipStamp.origin.y) =								(SIS_SCREEN_HEIGHT - 1) - 1;					pSolarSysState->pBaseDesc = pCurDesc;					XFormIPLoc (							&pCurDesc->image.origin,							&pSolarSysState->SunDesc[0].location,							FALSE							);					ZeroVelocityComponents (&GLOBAL (velocity));					GenerateMoons ();					NewWaitPlanet = 0;					BatchGraphics ();					SetGraphicGrabOther (1);					DrawSystem (pSolarSysState->pBaseDesc->pPrevDesc->radius, TRUE);					SetGraphicGrabOther (0);					r.corner.x = SIS_ORG_X;					r.corner.y = SIS_ORG_Y;					r.extent.width = SIS_SCREEN_WIDTH;					r.extent.height = SIS_SCREEN_HEIGHT;					ScreenTransition (3, &r);					UnbatchGraphics ();					LoadIntoExtraScreen (&r);				}				break;			}		}	}	if (pSolarSysState->WaitIntersect != (COUNT)~0 || NewWaitPlanet == 0)		pSolarSysState->WaitIntersect = NewWaitPlanet;}