rem: SetSemaphore (&GraphicsSem);
add: SetSemaphore (GraphicsSem);
context: DoDiscardCargo (INPUT_STATE InputState, PMENU_STATE pMS){	BYTE NewState;	if (GLOBAL (CurrentActivity) & CHECK_ABORT)		return (FALSE);	if (!(pMS->Initialized & 1))	{		pMS->InputFunc = DoDiscardCargo;		++pMS->Initialized;		NewState = pMS->CurState;		pMS->CurState = (BYTE)~0;		goto SelectCargo;	}	else if (InputState & DEVICE_BUTTON2)	{		SetSemaphore (&GraphicsSem);		ClearSISRect (DRAW_SIS_DISPLAY);		ClearSemaphore (&GraphicsSem);		return (FALSE);	}	else if (InputState & DEVICE_BUTTON1)	{		if (GLOBAL_SIS (ElementAmounts[pMS->CurState - 1]))		{			--GLOBAL_SIS (ElementAmounts[pMS->CurState - 1]);			DrawCargoStrings ((BYTE)(pMS->CurState - 1), (BYTE)(pMS->CurState - 1));			SetSemaphore (&GraphicsSem);			--GLOBAL_SIS (TotalElementMass);			ShowRemainingCapacity ();			ClearSemaphore (&GraphicsSem);		}	}	else	{		NewState = pMS->CurState - 1;		if (GetInputXComponent (InputState) < 0				|| GetInputYComponent (InputState) < 0)		{			if (NewState-- == 0)				NewState = NUM_ELEMENT_CATEGORIES - 1;		}		else if (GetInputXComponent (InputState) > 0				|| GetInputYComponent (InputState) > 0)		{			if (++NewState == NUM_ELEMENT_CATEGORIES)				NewState = 0;		}		if (++NewState != pMS->CurState)		{SelectCargo:			DrawCargoStrings ((BYTE)(pMS->CurState - 1), (BYTE)(NewState - 1));			SetSemaphore (&GraphicsSem);			DrawStatusMessage (GAME_STRING (NewState - 1 + (CARGO_STRING_BASE + 2)));			ClearSemaphore (&GraphicsSem);			pMS->CurState = NewState;		}	}	return (TRUE);}