示例#1
0
/*Add the Transporter Interface*/
static bool _intAddTransporter(DROID *psSelected, bool offWorld)
{
	bool			Animate = true;

	onMission = offWorld;
	psCurrTransporter = psSelected;

	/*if transporter has died - close the interface - this can only happen in
	multiPlayer where the transporter can be killed*/
	if (bMultiPlayer)
	{
		if (psCurrTransporter && isDead((BASE_OBJECT *)psCurrTransporter))
		{
			intRemoveTransNoAnim();
			return true;
		}
	}

	// Add the main Transporter form
	// Is the form already up?
	if (widgGetFromID(psWScreen, IDTRANS_FORM) != NULL)
	{
		intRemoveTransNoAnim();
		Animate = false;
	}

	if (intIsRefreshing())
	{
		Animate = false;
	}

	WIDGET *parent = psWScreen->psForm;

	IntFormAnimated *transForm = new IntFormAnimated(parent, Animate);  // Do not animate the opening, if the window was already open.
	transForm->id = IDTRANS_FORM;
	transForm->setGeometry(TRANS_X, TRANS_Y, TRANS_WIDTH, TRANS_HEIGHT);

	/* Add the close button */
	W_BUTINIT sButInit;
	sButInit.formID = IDTRANS_FORM;
	sButInit.id = IDTRANS_CLOSE;
	sButInit.x = TRANS_WIDTH - CLOSE_WIDTH;
	sButInit.y = 0;
	sButInit.width = CLOSE_WIDTH;
	sButInit.height = CLOSE_HEIGHT;
	sButInit.pTip = _("Close");
	sButInit.pDisplay = intDisplayImageHilight;
	sButInit.UserData = PACKDWORD_TRI(0, IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
	if (!widgAddButton(psWScreen, &sButInit))
	{
		return false;
	}

	if (!intAddTransButtonForm())
	{
		return false;
	}

	// Add the Transporter Contents form (and buttons)
	if (!intAddTransporterContents())
	{
		return false;
	}

	//if on a mission - add the Droids back at home base form
	if (onMission)
	{
		if (!intAddDroidsAvailForm())
		{
			return false;
		}
	}

	return true;
}
示例#2
0
/*Add the Transporter Interface*/
static bool _intAddTransporter(DROID *psSelected, bool offWorld)
{
	bool			Animate = true;

	onMission = offWorld;
	psCurrTransporter = psSelected;

	/*if transporter has died - close the interface - this can only happen in
	multiPlayer where the transporter can be killed*/
	if (bMultiPlayer)
	{
		if (psCurrTransporter && isDead((BASE_OBJECT *)psCurrTransporter))
		{
			intRemoveTransNoAnim();
			return true;
		}
	}

	// Add the main Transporter form
	// Is the form already up?
	if (widgGetFromID(psWScreen, IDTRANS_FORM) != NULL)
	{
		intRemoveTransNoAnim();
		Animate = false;
	}


	if (intIsRefreshing())
	{
		Animate = false;
	}

	W_FORMINIT sFormInit;
	sFormInit.formID = 0;
	sFormInit.id = IDTRANS_FORM;
	sFormInit.style = WFORM_PLAIN;
	sFormInit.x = (SWORD)TRANS_X;
	sFormInit.y = (SWORD)TRANS_Y;
	sFormInit.width = TRANS_WIDTH;
	sFormInit.height = TRANS_HEIGHT;
	// If the window was closed then do open animation.
	if (Animate)
	{
		sFormInit.pDisplay = intOpenPlainForm;
		sFormInit.disableChildren = true;
	}
	else
	{
		// otherwise just recreate it.
		sFormInit.pDisplay = intDisplayPlainForm;
	}

	if (!widgAddForm(psWScreen, &sFormInit))
	{
		return false;
	}

	/* Add the close button */
	W_BUTINIT sButInit;
	sButInit.formID = IDTRANS_FORM;
	sButInit.id = IDTRANS_CLOSE;
	sButInit.x = TRANS_WIDTH - CLOSE_WIDTH;
	sButInit.y = 0;
	sButInit.width = CLOSE_WIDTH;
	sButInit.height = CLOSE_HEIGHT;
	sButInit.pTip = _("Close");
	sButInit.pDisplay = intDisplayImageHilight;
	sButInit.UserData = PACKDWORD_TRI(0, IMAGE_CLOSEHILIGHT , IMAGE_CLOSE);
	if (!widgAddButton(psWScreen, &sButInit))
	{
		return false;
	}


	if (!intAddTransButtonForm())
	{
		return false;
	}

	// Add the Transporter Contents form (and buttons)
	if (!intAddTransporterContents())
	{
		return false;
	}

	//if on a mission - add the Droids back at home base form
	if (onMission)
	{
		if (!intAddDroidsAvailForm())
		{
			return false;
		}
	}

	return true;
}