rem: pMS->flash_task = CreateThread (flash_ship_task, NULL, 2048,
add: pMS->flash_task = AssignTask (flash_ship_task, 2048,
context: DoModifyRoster (INPUT_STATE InputState, PMENU_STATE pMS){	BYTE NewState;	SBYTE sx, sy;	RECT r;	STAMP s;	SHIP_FRAGMENTPTR StarShipPtr;	if (GLOBAL (CurrentActivity) & CHECK_ABORT)	{		pMS->CurFrame = 0;		SetSemaphore (GraphicsSem);		RosterCleanup (pMS);		ClearSemaphore (GraphicsSem);		return (FALSE);	}	if (!pMS->Initialized)	{		pMS->InputFunc = DoModifyRoster;		pMS->Initialized = TRUE;		pMS->CurState = NewState = 0;		SetSemaphore (GraphicsSem);		SetContext (StatusContext);		goto SelectSupport;	}	else if ((InputState & DEVICE_BUTTON2)			&& !(pMS->CurState & SHIP_TOGGLE))	{		SetSemaphore (GraphicsSem);		SetFlashRect (NULL_PTR, (FRAME)0);		RosterCleanup (pMS);		pMS->CurFrame = 0;		DrawStatusMessage (NULL_PTR);		ClearSemaphore (GraphicsSem);		return (FALSE);	}	else if (InputState & (DEVICE_BUTTON1 | DEVICE_BUTTON2))	{		SetSemaphore (GraphicsSem);		pMS->CurState ^= SHIP_TOGGLE;		if (!(pMS->CurState & SHIP_TOGGLE))			SetFlashRect (NULL_PTR, (FRAME)0);		else		{			RosterCleanup (pMS);			r.corner.x = 2;			r.corner.y = 130;			r.extent.width = STATUS_MESSAGE_WIDTH;			r.extent.height = STATUS_MESSAGE_HEIGHT;			SetContext (StatusContext);			SetFlashRect (&r, (FRAME)0);		}		ClearSemaphore (GraphicsSem);	}	else if (pMS->CurState & SHIP_TOGGLE)	{		if ((sy = GetInputYComponent (InputState)) < 0)		{			if (GLOBAL_SIS (CrewEnlisted))			{				SetSemaphore (GraphicsSem);				DeltaSupportCrew (1);				ClearSemaphore (GraphicsSem);			}		}		else if (sy > 0)		{			if (GLOBAL_SIS (CrewEnlisted)					< GetCPodCapacity (NULL_PTR))			{				SetSemaphore (GraphicsSem);				DeltaSupportCrew (-1);				ClearSemaphore (GraphicsSem);			}		}	}	else	{		PPOINT pship_pos;		NewState = pMS->CurState;		sx = (SBYTE)((pMS->delta_item + 1) >> 1);		if (GetInputXComponent (InputState))		{			pship_pos = (PPOINT)pMS->flash_frame1;			if (NewState == (BYTE)(sx - 1))				NewState = (BYTE)(pMS->delta_item - 1);			else if (NewState >= (BYTE)sx)			{				NewState -= sx;				if (pship_pos[NewState].y < pship_pos[pMS->CurState].y)					++NewState;			}			else			{				NewState += sx;				if (NewState != (BYTE)sx						&& pship_pos[NewState].y > pship_pos[pMS->CurState].y)					--NewState;			}		}		else if ((sy = GetInputYComponent (InputState)) > 0)		{			if (++NewState == (BYTE)pMS->delta_item)				NewState = (BYTE)(sx - 1);			else if (NewState == (BYTE)sx)				NewState = 0;		}		else if (sy < 0)		{			if (NewState == 0)				NewState += sx - 1;			else if (NewState == (BYTE)sx)				NewState = (BYTE)(pMS->delta_item - 1);			else				--NewState;		}		if (NewState != pMS->CurState)		{			SetSemaphore (GraphicsSem);			SetContext (StatusContext);			s.origin = pMS->first_item;			StarShipPtr = (SHIP_FRAGMENTPTR)LockStarShip (					&GLOBAL (built_ship_q),					(HSTARSHIP)pMS->CurFrame					);			s.frame = StarShipPtr->ShipInfo.icons;			UnlockStarShip (					&GLOBAL (built_ship_q),					(HSTARSHIP)pMS->CurFrame					);			DrawStamp (&s);SelectSupport:			pship_pos = (PPOINT)pMS->flash_frame1;			pMS->first_item = pship_pos[NewState];			pMS->CurFrame = (FRAME)MatchSupportShip (pMS);			DeltaSupportCrew (0);			ClearSemaphore (GraphicsSem);			pMS->CurState = NewState;		}		if (pMS->flash_task == 0)			pMS->flash_task = CreateThread (flash_ship_task, NULL, 2048,					"flash roster menu");	}	return (TRUE);}