rem: printf ("PROCESSING 0x%x <--> 0x%x at %u\n", ElementPtr, TestElementPtr, time_val);
add: fprintf (stderr, "PROCESSING 0x%x <--> 0x%x at %u\n", ElementPtr, TestElementPtr, time_val);
context: ProcessCollisions (HELEMENT hSuccElement, register ELEMENTPTR ElementPtr,		TIME_VALUE min_time, ELEMENT_FLAGS process_flags){	HELEMENT hTestElement;	while ((hTestElement = hSuccElement) != 0)	{		ELEMENTPTR TestElementPtr;		LockElement (hTestElement, &TestElementPtr);		if (!(TestElementPtr->state_flags & process_flags))			PreProcess (TestElementPtr);		hSuccElement = GetSuccElement (TestElementPtr);		if (TestElementPtr == ElementPtr)		{			UnlockElement (hTestElement);			continue;		}		if (CollisionPossible (TestElementPtr, ElementPtr))		{			register ELEMENT_FLAGS state_flags, test_state_flags;			TIME_VALUE time_val;			state_flags = ElementPtr->state_flags;			test_state_flags = TestElementPtr->state_flags;			if (((state_flags | test_state_flags) & FINITE_LIFE)					&& (((state_flags & APPEARING)					&& ElementPtr->life_span > 1)					|| ((test_state_flags & APPEARING)					&& TestElementPtr->life_span > 1)))				time_val = 0;			else			{				while ((time_val = DrawablesIntersect (&ElementPtr->IntersectControl,						&TestElementPtr->IntersectControl, min_time)) == 1						&& !((state_flags | test_state_flags) & FINITE_LIFE))				{#ifdef DEBUGprintf ("BAD NEWS 0x%x <--> 0x%x\n", ElementPtr, TestElementPtr);#endif /* DEBUG */					if (state_flags & COLLISION)					{						InitIntersectEndPoint (TestElementPtr);						TestElementPtr->IntersectControl.IntersectStamp.origin =								TestElementPtr->IntersectControl.EndPoint;						time_val = DrawablesIntersect (&ElementPtr->IntersectControl,								&TestElementPtr->IntersectControl, 1);						InitIntersectStartPoint (TestElementPtr);					}					if (time_val == 1)					{						FRAME CurFrame, NextFrame,								TestCurFrame, TestNextFrame;						CurFrame = ElementPtr->current.image.frame;						NextFrame = ElementPtr->next.image.frame;						TestCurFrame = TestElementPtr->current.image.frame;						TestNextFrame = TestElementPtr->next.image.frame;						if (NextFrame == CurFrame								&& TestNextFrame == TestCurFrame)						{							if (test_state_flags & APPEARING)							{								do_damage (TestElementPtr, TestElementPtr->hit_points);								if (TestElementPtr->pParent) /* untarget this dead element */									Untarget (TestElementPtr);								TestElementPtr->state_flags |= (COLLISION | DISAPPEARING);								if (TestElementPtr->death_func)									(*TestElementPtr->death_func) (TestElementPtr);							}							if (state_flags & APPEARING)							{								do_damage (ElementPtr, ElementPtr->hit_points);								if (ElementPtr->pParent) /* untarget this dead element */									Untarget (ElementPtr);								ElementPtr->state_flags |= (COLLISION | DISAPPEARING);								if (ElementPtr->death_func)									(*ElementPtr->death_func) (ElementPtr);								UnlockElement (hTestElement);								return (COLLISION);							}							time_val = 0;						}						else						{							if (GetFrameIndex (CurFrame) !=									GetFrameIndex (NextFrame))								ElementPtr->next.image.frame =										SetEquFrameIndex (NextFrame,										CurFrame);							else if (NextFrame != CurFrame)							{								ElementPtr->next.image =										ElementPtr->current.image;								if (ElementPtr->life_span > NORMAL_LIFE)									ElementPtr->life_span = NORMAL_LIFE;							}							if (GetFrameIndex (TestCurFrame) !=									GetFrameIndex (TestNextFrame))								TestElementPtr->next.image.frame =										SetEquFrameIndex (TestNextFrame,										TestCurFrame);							else if (TestNextFrame != TestCurFrame)							{								TestElementPtr->next.image =										TestElementPtr->current.image;								if (TestElementPtr->life_span > NORMAL_LIFE)									TestElementPtr->life_span = NORMAL_LIFE;							}							InitIntersectStartPoint (ElementPtr);							InitIntersectEndPoint (ElementPtr);							InitIntersectFrame (ElementPtr);							if (state_flags & PLAYER_SHIP)							{								STARSHIPPTR StarShipPtr;								GetElementStarShip (ElementPtr, &StarShipPtr);								StarShipPtr->ShipFacing =										GetFrameIndex (										ElementPtr->next.image.frame);							}							InitIntersectStartPoint (TestElementPtr);							InitIntersectEndPoint (TestElementPtr);							InitIntersectFrame (TestElementPtr);							if (test_state_flags & PLAYER_SHIP)							{								STARSHIPPTR StarShipPtr;								GetElementStarShip (TestElementPtr, &StarShipPtr);								StarShipPtr->ShipFacing =										GetFrameIndex (										TestElementPtr->next.image.frame);							}						}					}					if (time_val == 0)					{						InitIntersectEndPoint (ElementPtr);						InitIntersectEndPoint (TestElementPtr);						break;					}				}			}			if (time_val > 0)			{				POINT SavePt, TestSavePt;#ifdef DEBUGprintf ("0x%x <--> 0x%x at %u\n", ElementPtr, TestElementPtr, time_val);#endif /* DEBUG */				SavePt = ElementPtr->IntersectControl.EndPoint;				TestSavePt = TestElementPtr->IntersectControl.EndPoint;				InitIntersectEndPoint (ElementPtr);				InitIntersectEndPoint (TestElementPtr);				if (time_val == 1						|| (((state_flags & COLLISION)						|| !ProcessCollisions (hSuccElement, ElementPtr,						time_val - 1, process_flags))						&& ((test_state_flags & COLLISION)						|| !ProcessCollisions (						!(TestElementPtr->state_flags & APPEARING) ?						GetSuccElement (ElementPtr) :						GetHeadElement (), TestElementPtr,						time_val - 1, process_flags))))				{					state_flags = ElementPtr->state_flags;					test_state_flags = TestElementPtr->state_flags;#ifdef DEBUGprintf ("PROCESSING 0x%x <--> 0x%x at %u\n", ElementPtr, TestElementPtr, time_val);#endif /* DEBUG */					if (test_state_flags & PLAYER_SHIP)					{						(*TestElementPtr->collision_func) (								TestElementPtr, &TestSavePt,								ElementPtr, &SavePt								);						(*ElementPtr->collision_func) (								ElementPtr, &SavePt,								TestElementPtr, &TestSavePt								);					}					else					{						(*ElementPtr->collision_func) (								ElementPtr, &SavePt,								TestElementPtr, &TestSavePt								);						(*TestElementPtr->collision_func) (								TestElementPtr, &TestSavePt,								ElementPtr, &SavePt								);					}					if (TestElementPtr->state_flags & COLLISION)					{						if (!(test_state_flags & COLLISION))						{							TestElementPtr->IntersectControl.IntersectStamp.origin =									TestSavePt;							TestElementPtr->next.location.x =									DISPLAY_TO_WORLD (TestSavePt.x);							TestElementPtr->next.location.y =									DISPLAY_TO_WORLD (TestSavePt.y);							InitIntersectEndPoint (TestElementPtr);						}					}					if (ElementPtr->state_flags & COLLISION)					{						if (!(state_flags & COLLISION))						{							ElementPtr->IntersectControl.IntersectStamp.origin =									SavePt;							ElementPtr->next.location.x =									DISPLAY_TO_WORLD (SavePt.x);							ElementPtr->next.location.y =									DISPLAY_TO_WORLD (SavePt.y);							InitIntersectEndPoint (ElementPtr);							if (!(state_flags & FINITE_LIFE) &&									!(test_state_flags & FINITE_LIFE))							{								collide (ElementPtr, TestElementPtr);								ProcessCollisions (GetHeadElement (), ElementPtr,										MAX_TIME_VALUE, process_flags);								ProcessCollisions (GetHeadElement (), TestElementPtr,										MAX_TIME_VALUE, process_flags);							}						}						UnlockElement (hTestElement);						return (COLLISION);					}					if (!CollidingElement (ElementPtr))					{						ElementPtr->state_flags |= COLLISION;						UnlockElement (hTestElement);						return (COLLISION);					}				}			}		}		UnlockElement (hTestElement);	}	return (ElementPtr->state_flags & COLLISION);}