Пример #1
0
// Add the main Transporter Contents Interface
bool intAddTransporterContents(void)
{
	bool			Animate = true;

	// Is the form already up?
	if (widgGetFromID(psWScreen, IDTRANS_CONTENTFORM) != NULL)
	{
		intRemoveTransContentNoAnim();
		Animate = false;
	}

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

	WIDGET *parent = psWScreen->psForm;

	IntFormAnimated *transContentForm = new IntFormAnimated(parent, Animate);  // Do not animate the opening, if the window was already open.
	transContentForm->id = IDTRANS_CONTENTFORM;
	transContentForm->setGeometry(TRANSCONT_X, TRANSCONT_Y, TRANSCONT_WIDTH, TRANSCONT_HEIGHT);

	/* Add the close button */
	W_BUTINIT sButInit;
	sButInit.formID = IDTRANS_CONTENTFORM;
	sButInit.id = IDTRANS_CONTCLOSE;
	sButInit.x = STAT_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 (bMultiPlayer)
	{
		//add the capacity label
		W_LABINIT sLabInit;
		sLabInit.formID = IDTRANS_CONTENTFORM;
		sLabInit.id = IDTRANS_CAPACITY;
		sLabInit.x = (SWORD)sButInit.x - 40;
		sLabInit.y = 0;
		sLabInit.width = 16;
		sLabInit.height = 16;
		sLabInit.pText = "00/10";
		sLabInit.pCallback = intUpdateTransCapacity;
		if (!widgAddLabel(psWScreen, &sLabInit))
		{
			return false;
		}
	}
	//add the Launch button if on a mission
	if (onMission)
	{
		W_FORMINIT sButFInit;
		sButFInit.formID = IDTRANS_CONTENTFORM;
		sButFInit.id = IDTRANS_LAUNCH;
		sButFInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;

		sButFInit.x = OBJ_STARTX;
		sButFInit.y = (UWORD)(STAT_SLDY - 1);

		sButFInit.width = iV_GetImageWidth(IntImages, IMAGE_LAUNCHUP);
		sButFInit.height = iV_GetImageHeight(IntImages, IMAGE_LAUNCHUP);
		sButFInit.pTip = _("Launch Transport");
		sButFInit.pDisplay = intDisplayImageHilight;

		sButFInit.UserData = PACKDWORD_TRI(0, IMAGE_LAUNCHDOWN, IMAGE_LAUNCHUP);

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

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

	return true;
}
Пример #2
0
// Add the main Transporter Contents Interface
bool intAddTransporterContents(void)
{
	bool			Animate = true;

	// Is the form already up?
	if (widgGetFromID(psWScreen, IDTRANS_CONTENTFORM) != NULL)
	{
		intRemoveTransContentNoAnim();
		Animate = false;
	}

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

	W_FORMINIT sFormInit;
	sFormInit.formID = 0;
	sFormInit.id = IDTRANS_CONTENTFORM;
	sFormInit.style = WFORM_PLAIN;
	sFormInit.x = (SWORD)TRANSCONT_X;
	sFormInit.y = (SWORD)TRANSCONT_Y;
	sFormInit.width = TRANSCONT_WIDTH;
	sFormInit.height = TRANSCONT_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_CONTENTFORM;
	sButInit.id = IDTRANS_CONTCLOSE;
	sButInit.x = STAT_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 (bMultiPlayer)
	{
		//add the capacity label
		W_LABINIT sLabInit;
		sLabInit.formID = IDTRANS_CONTENTFORM;
		sLabInit.id = IDTRANS_CAPACITY;
		sLabInit.x = (SWORD)sButInit.x - 40;
		sLabInit.y = 0;
		sLabInit.width = 16;
		sLabInit.height = 16;
		sLabInit.pText = "00/10";
		sLabInit.pCallback = intUpdateTransCapacity;
		if (!widgAddLabel(psWScreen, &sLabInit))
		{
			return false;
		}
	}
	//add the Launch button if on a mission
	if (onMission)
	{
		W_FORMINIT sButFInit;
		sButFInit.formID = IDTRANS_CONTENTFORM;
		sButFInit.id = IDTRANS_LAUNCH;
		sButFInit.style = WFORM_CLICKABLE | WFORM_NOCLICKMOVE;

		sButFInit.x = OBJ_STARTX;
		sButFInit.y = (UWORD)(STAT_SLDY - 1);

		sButFInit.width = iV_GetImageWidth(IntImages, IMAGE_LAUNCHUP);
		sButFInit.height = iV_GetImageHeight(IntImages, IMAGE_LAUNCHUP);
		sButFInit.pTip = _("Launch Transport");
		//sButInit.pText = "Launch";
		sButFInit.pDisplay = intDisplayImageHilight;

		sButFInit.UserData = PACKDWORD_TRI(0, IMAGE_LAUNCHDOWN, IMAGE_LAUNCHUP);

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

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

	return true;
}