add: ClearSISRect (CLEAR_SIS_RADAR);
context: DoInstallModule (INPUT_STATE InputState, PMENU_STATE pMS){	BYTE NewState, new_slot_piece, old_slot_piece;	SIZE FirstItem, LastItem;	//STAMP s;	if (GLOBAL (CurrentActivity) & CHECK_ABORT)	{		pMS->InputFunc = DoOutfit;		return (TRUE);	}	FirstItem = 0;	switch (NewState = pMS->CurState)	{		case PLANET_LANDER:		case EMPTY_SLOT + 3:			old_slot_piece = pMS->delta_item < GLOBAL_SIS (NumLanders)					? PLANET_LANDER : (EMPTY_SLOT + 3);			LastItem = MAX_LANDERS - 1;			break;		case FUSION_THRUSTER:		case EMPTY_SLOT + 0:			old_slot_piece =					GLOBAL_SIS (DriveSlots[pMS->delta_item]);			LastItem = NUM_DRIVE_SLOTS - 1;			break;		case TURNING_JETS:		case EMPTY_SLOT + 1:			old_slot_piece =					GLOBAL_SIS (JetSlots[pMS->delta_item]);			LastItem = NUM_JET_SLOTS - 1;			break;		default:			old_slot_piece =					GLOBAL_SIS (ModuleSlots[pMS->delta_item]);			if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 3)				FirstItem = NUM_BOMB_MODULES;			LastItem = NUM_MODULE_SLOTS - 1;			break;	}		if (NewState < CREW_POD)		FirstItem = LastItem = NewState;	else if (NewState < EMPTY_SLOT)		FirstItem = CREW_POD, LastItem = NUM_PURCHASE_MODULES - 1;	if (!pMS->Initialized)	{		new_slot_piece = old_slot_piece;		pMS->Initialized = TRUE;		pMS->InputFunc = DoInstallModule;		SetSemaphore (GraphicsSem);		SetContext (SpaceContext);		SetContextDrawState (DEST_PIXMAP | DRAW_REPLACE);		SetFlashRect (NULL_PTR, (FRAME)0);		goto InitFlash;	}	else if (InputState & (DEVICE_BUTTON1 | DEVICE_BUTTON2))	{		new_slot_piece = pMS->CurState;		if (InputState & DEVICE_BUTTON1)		{			if (new_slot_piece < EMPTY_SLOT)			{				if (GLOBAL_SIS (ResUnits) <						(DWORD)(GLOBAL (ModuleCost[new_slot_piece])						* MODULE_COST_SCALE))					return (TRUE);			}			else if (new_slot_piece == EMPTY_SLOT + 2)			{				if (old_slot_piece == CREW_POD)				{					if (GLOBAL_SIS (CrewEnlisted) > CREW_POD_CAPACITY							* (CountSISPieces (CREW_POD) - 1))						return (TRUE);				}				else if (old_slot_piece == FUEL_TANK						|| old_slot_piece == HIGHEFF_FUELSYS)				{					DWORD volume;					volume = (DWORD)CountSISPieces (FUEL_TANK)							* FUEL_TANK_CAPACITY							+ (DWORD)CountSISPieces (HIGHEFF_FUELSYS)							* HEFUEL_TANK_CAPACITY;					volume -= (old_slot_piece == FUEL_TANK							? FUEL_TANK_CAPACITY : HEFUEL_TANK_CAPACITY);					if (GLOBAL_SIS (FuelOnBoard) > volume + FUEL_RESERVE)						return (TRUE);				}				else if (old_slot_piece == STORAGE_BAY)				{					if (GLOBAL_SIS (TotalElementMass) > STORAGE_BAY_CAPACITY							* (CountSISPieces (STORAGE_BAY) - 1))						return (TRUE);				}			}		}		SetSemaphore (GraphicsSem);		SetContext (SpaceContext);		SetFlashRect (NULL_PTR, (FRAME)0);		if (InputState & DEVICE_BUTTON1)		{			if (new_slot_piece >= EMPTY_SLOT && old_slot_piece >= EMPTY_SLOT)			{				new_slot_piece -= EMPTY_SLOT - 1;				if (new_slot_piece > CREW_POD)					new_slot_piece = PLANET_LANDER;			}			else			{				switch (pMS->CurState)				{					case PLANET_LANDER:						++GLOBAL_SIS (NumLanders);						break;					case EMPTY_SLOT + 3:						--GLOBAL_SIS (NumLanders);						break;					case FUSION_THRUSTER:					case EMPTY_SLOT + 0:						GLOBAL_SIS (DriveSlots[pMS->delta_item]) =								new_slot_piece;						break;					case TURNING_JETS:					case EMPTY_SLOT + 1:						GLOBAL_SIS (JetSlots[pMS->delta_item]) =								new_slot_piece;						break;					default:						GLOBAL_SIS (ModuleSlots[pMS->delta_item]) =								new_slot_piece;						break;				}				if (new_slot_piece < EMPTY_SLOT)					DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA,							-(GLOBAL (ModuleCost[new_slot_piece])							* MODULE_COST_SCALE));				else /* if (old_slot_piece < EMPTY_SLOT) */					DeltaSISGauges (UNDEFINED_DELTA, UNDEFINED_DELTA,							GLOBAL (ModuleCost[old_slot_piece])							* MODULE_COST_SCALE);				if (pMS->CurState == PLANET_LANDER || pMS->CurState == EMPTY_SLOT + 3)					DisplayLanders (pMS);				else				{					DrawShipPiece (pMS, new_slot_piece, pMS->delta_item, FALSE);					if (new_slot_piece > TURNING_JETS							&& old_slot_piece > TURNING_JETS)						RedistributeFuel ();				}			}			InputState &= ~DEVICE_BUTTON2;		}		if (pMS->CurState < EMPTY_SLOT)		{			pMS->CurState += EMPTY_SLOT - 1;			if (pMS->CurState < EMPTY_SLOT)				pMS->CurState = EMPTY_SLOT + 3;			else if (pMS->CurState > EMPTY_SLOT + 2)				pMS->CurState = EMPTY_SLOT + 2;			if (InputState & DEVICE_BUTTON2)				new_slot_piece = pMS->CurState;			goto InitFlash;		}		else if (!(InputState & DEVICE_BUTTON2))		{			pMS->CurState = new_slot_piece;			goto InitFlash;		}		else		{			SetContext (StatusContext);			ClearSemaphore (GraphicsSem);			DrawMenuStateStrings (PM_FUEL, pMS->CurState = OUTFIT_MODULES);			SetSemaphore (GraphicsSem);			SetFlashRect ((PRECT)~0L, (FRAME)0);			pMS->InputFunc = DoOutfit;			ClearSISRect (DRAW_SIS_DISPLAY);		}		ClearSemaphore (GraphicsSem);	}	else if (InputState)	{		SIZE NewItem;		NewItem = NewState < EMPTY_SLOT ? pMS->CurState : pMS->delta_item;		do		{			SBYTE dy;			dy = GetInputYComponent (InputState);			if (NewState >= EMPTY_SLOT && dy)			{				if (dy < 0)				{					if (NewState-- == EMPTY_SLOT)						NewState = EMPTY_SLOT + 3;				}				else				{					if (NewState++ == EMPTY_SLOT + 3)						NewState = EMPTY_SLOT;				}				NewItem = 0;				if (GET_GAME_STATE (CHMMR_BOMB_STATE) == 3)				{					if (NewState == EMPTY_SLOT + 3)						NewState = dy < 0 ? EMPTY_SLOT + 2 : EMPTY_SLOT;					if (NewState == EMPTY_SLOT + 2)						NewItem = NUM_BOMB_MODULES;				}				pMS->delta_item = NewItem;			}			else if (GetInputXComponent (InputState) < 0 || dy < 0)			{				if (NewItem-- == FirstItem)					NewItem = LastItem;			}			else if (GetInputXComponent (InputState) > 0 || dy > 0)			{				if (NewItem++ == LastItem)					NewItem = FirstItem;			}		} while (NewState < EMPTY_SLOT				&& (GLOBAL (ModuleCost[NewItem]) == 0				|| (NewItem >= GUN_WEAPON && NewItem <= CANNON_WEAPON				&& pMS->delta_item > 0 && pMS->delta_item < 13)));		SetSemaphore (GraphicsSem);		if (NewState < EMPTY_SLOT)		{			if (NewItem != pMS->CurState)			{				DrawModuleStrings (pMS, pMS->CurState = NewItem);				SetFlashRect ((PRECT)~0L, (FRAME)0);			}		}		else if (NewItem != pMS->delta_item || NewState != pMS->CurState)		{			SIZE w;							switch (NewState)			{				case PLANET_LANDER:				case EMPTY_SLOT + 3:					new_slot_piece = NewItem < GLOBAL_SIS (NumLanders)							? PLANET_LANDER : (EMPTY_SLOT + 3);					break;				case FUSION_THRUSTER:				case EMPTY_SLOT + 0:					new_slot_piece = GLOBAL_SIS (DriveSlots[NewItem]);					break;				case TURNING_JETS:				case EMPTY_SLOT + 1:					new_slot_piece = GLOBAL_SIS (JetSlots[NewItem]);					break;				default:					new_slot_piece = GLOBAL_SIS (ModuleSlots[NewItem]);					break;			}			SetContext (SpaceContext);			if (NewState == pMS->CurState)			{				if (NewState == PLANET_LANDER || NewState == EMPTY_SLOT + 3)					w = LANDER_WIDTH;				else					w = SHIP_PIECE_OFFSET;				w *= (NewItem - pMS->delta_item);				pMS->flash_rect0.corner.x += w;				pMS->delta_item = NewItem;			}			else			{				pMS->CurState = NewState;InitFlash:				w = SHIP_PIECE_OFFSET;				switch (pMS->CurState)				{					case PLANET_LANDER:					case EMPTY_SLOT + 3:						pMS->flash_rect0.corner.x = LANDER_X - 1;						pMS->flash_rect0.corner.y = LANDER_Y - 1;						pMS->flash_rect0.extent.width = 11 + 2;						pMS->flash_rect0.extent.height = 13 + 2;						w = LANDER_WIDTH;						break;					case FUSION_THRUSTER:					case EMPTY_SLOT + 0:						pMS->flash_rect0.corner.x = DRIVE_TOP_X - 1;						pMS->flash_rect0.corner.y = DRIVE_TOP_Y - 1;						pMS->flash_rect0.extent.width = 8;						pMS->flash_rect0.extent.height = 6;						break;					case TURNING_JETS:					case EMPTY_SLOT + 1:						pMS->flash_rect0.corner.x = JET_TOP_X - 1;						pMS->flash_rect0.corner.y = JET_TOP_Y - 1;						pMS->flash_rect0.extent.width = 9;						pMS->flash_rect0.extent.height = 10;						break;					default:						pMS->flash_rect0.corner.x = MODULE_TOP_X - 1;						pMS->flash_rect0.corner.y = MODULE_TOP_Y - 1;						pMS->flash_rect0.extent.width = 15;						pMS->flash_rect0.extent.height = 34;						break;				}				w *= pMS->delta_item;				pMS->flash_rect0.corner.x += w;			}			DrawModuleStrings (pMS, new_slot_piece);			if (pMS->CurState < EMPTY_SLOT)				SetFlashRect ((PRECT)~0L, (FRAME)0);			else				SetFlashRect (&pMS->flash_rect0, (FRAME)0);		}		ClearSemaphore (GraphicsSem);	}	return (TRUE);}