rem: KillThread (pES->AnimTask);
add: Task_SetState (pES->AnimTask, TASK_EXIT);
context: DoCommunication (INPUT_STATE InputState, PENCOUNTER_STATE pES){	if (!(CommData.AlienTransitionDesc.AnimFlags & (TALK_INTRO | TALK_DONE)))		AlienTalkSegue ((COUNT)~0);	if (GLOBAL (CurrentActivity) & CHECK_ABORT)		;	else if (pES->num_responses == 0)	{		DWORD TimeIn, TimeOut;		TimeOut = FadeMusic (0, ONE_SECOND * 3) + 2;		TimeIn = GetTimeCounter ();		do		{			SleepThreadUntil (TimeIn + 1);			TimeIn = GetTimeCounter ();			if (GetInputXComponent (GetInputState (NormalInput)) < 0)			{				FadeMusic (BACKGROUND_VOL, ONE_SECOND);				SetSemaphore (GraphicsSem);				SpewPhrases (0);				ClearSemaphore (GraphicsSem);				if (GLOBAL (CurrentActivity) & CHECK_ABORT)					break;				TimeOut = FadeMusic (0, ONE_SECOND * 2) + 2;				TimeIn = GetTimeCounter ();			}		} while (TimeIn <= TimeOut);	}	else	{		BYTE response;		if (pES->top_response == (BYTE)~0)		{			pES->top_response = 0;			SetSemaphore (GraphicsSem);			RefreshResponses (pES);			ClearSemaphore (GraphicsSem);		}		if (InputState & DEVICE_BUTTON1)		{			pES->phrase_buf_index =					pES->response_list[pES->cur_response].response_text.CharCount;			wstrncpy (pES->phrase_buf,					pES->response_list[pES->cur_response].response_text.pStr,					pES->phrase_buf_index);			pES->phrase_buf[pES->phrase_buf_index++] = '\0';			SetSemaphore (GraphicsSem);			FeedbackPlayerPhrase (pES->phrase_buf);			StopTrack ();			SetSliderImage (SetAbsFrameIndex (ActivityFrame, 2));			ClearSemaphore (GraphicsSem);			FadeMusic (BACKGROUND_VOL, ONE_SECOND);			CommData.AlienTransitionDesc.AnimFlags &= ~(TALK_INTRO | TALK_DONE);			pES->num_responses = 0;			(*pES->response_list[pES->cur_response].response_func)					(pES->response_list[pES->cur_response].response_ref);		}		else		{			response = pES->cur_response;			if (GetInputXComponent (InputState) < 0)			{				FadeMusic (BACKGROUND_VOL, ONE_SECOND);				SetSemaphore (GraphicsSem);				FeedbackPlayerPhrase (pES->phrase_buf);				SpewPhrases (0);				if (!(GLOBAL (CurrentActivity) & CHECK_ABORT))				{					RefreshResponses (pES);					FadeMusic (FOREGROUND_VOL, ONE_SECOND);				}				ClearSemaphore (GraphicsSem);			}			else if (GetInputYComponent (InputState) < 0)				response = (BYTE)((response + (BYTE)(pES->num_responses - 1))						% pES->num_responses);			else if (GetInputYComponent (InputState) > 0)				response = (BYTE)((BYTE)(response + 1)						% pES->num_responses);			if (response != pES->cur_response)			{				COORD y;				SetSemaphore (GraphicsSem);				BatchGraphics ();				add_text (-2, &pES->response_list[pES->cur_response].response_text);				pES->cur_response = response;				y = add_text (-1, &pES->response_list[pES->cur_response].response_text);				if (response < pES->top_response)				{					pES->top_response = 0;					RefreshResponses (pES);				}				else if (y > SIS_SCREEN_HEIGHT)				{					pES->top_response = response;					RefreshResponses (pES);				}				UnbatchGraphics ();				ClearSemaphore (GraphicsSem);			}		}				return (TRUE);	}	SetSemaphore (GraphicsSem);	if (pES->AnimTask)	{		KillThread (pES->AnimTask);		pES->AnimTask = 0;	}	CommData.AlienTransitionDesc.AnimFlags &= ~(TALK_INTRO | TALK_DONE);	SetContext (SpaceContext);	DestroyContext (ReleaseContext (TaskContext));	TaskContext = 0;	ClearSemaphore (GraphicsSem);	FlushPLUTXForms ();	ColorChange = FALSE;	FlushColorXForms ();	StopMusic ();	StopSound ();	StopTrack ();	SleepThreadUntil (FadeMusic (FOREGROUND_VOL, 0) + 2);	return (FALSE);}