Esempio n. 1
0
// Given a widget id get it's screen extents.
// NOTE that this function is slow and should be called infrequently,
// ideally only during widget initialisation.
//
BOOL widgGetScreenExtents(UDWORD ID,int *sx,int *sy,int *sw,int *sh)
{
	struct _widget *psWidget = widgGetFromID(psWScreen,ID);

	if(psWidget != NULL) {
		int x,y,w,h;

		x = psWidget->x;
		y = psWidget->y;
		w = psWidget->width;
		h = psWidget->height;

		while(psWidget->formID) {
			struct _widget *psParent = widgGetFromID(psWScreen,psWidget->formID);
			if(psParent) {
				x += psParent->x;
				y += psParent->y;
			}

			psWidget = psParent;
		}

		*sx = x; *sy = y;
		*sw = w; *sh = h;

		return TRUE;
	}

	return FALSE;
}
Esempio n. 2
0
/* Remove the Intelligence Map widgets from the screen */
void intRemoveIntelMap(void)
{
	WIDGET		*Widg;
	W_TABFORM	*Form;

	//remove 3dView if still there
	Widg = widgGetFromID(psWScreen,IDINTMAP_MSGVIEW);
	if(Widg)
	{
		intRemoveMessageView(false);
	}

	// Start the window close animation.
	Form = (W_TABFORM*)widgGetFromID(psWScreen,IDINTMAP_FORM);
	if(Form)
	{
		Form->display = intClosePlainForm;
		Form->disableChildren = true;
		Form->pUserData = NULL; // Used to signal when the close anim has finished.
	}
	ClosingIntelMap = true;
	//remove the text label
	widgDelete(psWScreen, IDINTMAP_PAUSELABEL);

	if (bMultiPlayer && MultiMenuUp)
	{
		intCloseMultiMenu();
	}
	
	intCleanUpIntelMap();
}
Esempio n. 3
0
void runLimitScreen(void)
{
	UDWORD i, id, statid;

	frontendMultiMessages();							// network stuff.

	id = widgRunScreen(psWScreen);						// Run the current set of widgets

	// sliders
	if((id > IDLIMITS_ENTRIES_START)  && (id< IDLIMITS_ENTRIES_END))
	{
		statid = widgGetFromID(psWScreen,id-1)->UserData ;
		if(statid)
		{
			asStructLimits[0][statid].limit = (UBYTE) ((W_SLIDER*)(widgGetFromID(psWScreen,id)))->pos;
		}
	}
	else
	{
		// icons that are always about.
		switch(id)
		{
		case IDLIMITS_RETURN:
			// reset the sliders..
			for (i = 0; i < numStructureStats ; ++i)
			{
				asStructLimits[0][i].limit = asStructLimits[0][i].globalLimit;
			}
			// free limiter structure
			freeLimitSet();
			//inform others
			sendOptions();

			eventReset();
			changeTitleMode(MULTIOPTION);

			// make some noize.
			if(!ingame.localOptionsReceived)
			{
				addConsoleMessage(_("Limits reset to default values"),DEFAULT_JUSTIFY, SYSTEM_MESSAGE);
			}
			else
			{
				sendTextMessage("Limits Reset To Default Values",true);
			}

			break;
		case IDLIMITS_OK:
			resetReadyStatus(false);
			createLimitSet();
			changeTitleMode(MULTIOPTION);
			break;
		default:
			break;
		}
	}

	widgDisplayScreen(psWScreen);						// show the widgets currently running
}
Esempio n. 4
0
// ////////////////////////////////////////////////////////////////////////////
bool intCloseInGameOptions(bool bPutUpLoadSave, bool bResetMissionWidgets)
{

    W_TABFORM	*Form;
    WIDGET		*widg;

    if (NetPlay.isHost)
    {
        widgDelete(psWScreen, INTINGAMEPOPUP);
    }

    if(bPutUpLoadSave)
    {
        widg = widgGetFromID(psWScreen,INTINGAMEOP);
        if(widg)
        {
            widgDelete(psWScreen,INTINGAMEOP);
        }

        InGameOpUp = false;
        ClosingInGameOp = true;
    }
    else
    {
        // close the form.
        // Start the window close animation.
        if (isInGamePopupUp)	// FIXME: we hijack this routine for the popup close.
        {
            Form = (W_TABFORM*)widgGetFromID(psWScreen,INTINGAMEPOPUP);
            isInGamePopupUp = false;
        }
        else
        {
            Form = (W_TABFORM*)widgGetFromID(psWScreen,INTINGAMEOP);
        }

        if(Form)
        {
            Form->display		 = intClosePlainForm;
            Form->pUserData		 = NULL; // Used to signal when the close anim has finished.
            Form->disableChildren= true;
            ClosingInGameOp		 = true;		// like orderup/closingorder
            InGameOpUp			 = false;
        }
    }

    ProcessOptionFinished();

    //don't add the widgets if the load/save screen is put up or exiting to front end
    if (bResetMissionWidgets)
    {
        //put any widgets back on for the missions
        resetMissionWidgets();
    }

    return true;
}
Esempio n. 5
0
static bool addQuitOptions(void)
{
    if (widgGetFromID(psWScreen,INTINGAMEOP))
    {
        widgDelete(psWScreen, INTINGAMEOP);		// get rid of the old stuff.
    }

    if (widgGetFromID(psWScreen,INTINGAMEPOPUP))
    {
        widgDelete(psWScreen, INTINGAMEPOPUP);		// get rid of the old stuff.
    }

    W_FORMINIT sFormInit;
    // add form
    sFormInit.formID	= 0;
    sFormInit.id		= INTINGAMEOP;
    sFormInit.style		= WFORM_PLAIN;
    sFormInit.width		= INTINGAMEOP3_W;
    sFormInit.height	= INTINGAMEOP3_H;;
    sFormInit.x		= (SWORD)INTINGAMEOP3_X;
    sFormInit.y		= (SWORD)INTINGAMEOP3_Y;
    sFormInit.pDisplay	= intOpenPlainForm;
    sFormInit.disableChildren= true;

    widgAddForm(psWScreen, &sFormInit);

    addIGTextButton(INTINGAMEOP_RESUME, INTINGAMEOP_1_Y, INTINGAMEOP_OP_W, _("Resume Game"), OPALIGN);
    addIGTextButton(INTINGAMEOP_QUIT_CONFIRM, INTINGAMEOP_2_Y, INTINGAMEOP_OP_W, _("Quit"), OPALIGN);

    if (NetPlay.isHost && bMultiPlayer && NetPlay.bComms)		// only show for real MP games
    {
        sFormInit.id		= INTINGAMEPOPUP;
        sFormInit.width		= 600;
        sFormInit.height	= 26;
        sFormInit.x			= (SWORD)(20+D_W);	// center it
        sFormInit.y			= (SWORD) 130;

        widgAddForm(psWScreen, &sFormInit);

        W_BUTINIT sButInit;

        sButInit.formID		= INTINGAMEPOPUP;
        sButInit.style		= OPALIGN;
        sButInit.width		= 600;
        sButInit.height		= 10;
        sButInit.x			= 0;
        sButInit.y			= 8;
        sButInit.pDisplay	= displayTextOption;
        sButInit.id			= INTINGAMEOP_POPUP_MSG3;
        sButInit.pText		= _("WARNING: You're the host. If you quit, the game ends for everyone!");

        widgAddButton(psWScreen, &sButInit);
    }

    return true;
}
Esempio n. 6
0
/* Remove the Transporter Droids Avail widgets from the screen */
void intRemoveTransDroidsAvail(void)
{
	// Start the window close animation.
	IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDTRANS_DROIDS);
	if (form)
	{
		//remember which tab we were on
		ListTabWidget *droidList = (ListTabWidget *)widgGetFromID(psWScreen, IDTRANS_DROIDTAB);
		objMajor = droidList->currentPage();
		form->closeAnimateDelete();
	}
}
Esempio n. 7
0
/* Remove the Transporter Droids Avail widgets from the screen w/o animation!*/
void intRemoveTransDroidsAvailNoAnim(void)
{
	IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDTRANS_DROIDS);
	if (form != nullptr)
	{
		//remember which tab we were on
		ListTabWidget *droidList = (ListTabWidget *)widgGetFromID(psWScreen, IDTRANS_DROIDTAB);
		objMajor = droidList->currentPage();

		//remove main screen
		delete form;
	}
}
Esempio n. 8
0
// ////////////////////////////////////////////////////////////////////////////
// A Remote Player has joined the game.
bool MultiPlayerJoin(UDWORD playerIndex)
{
	if(widgGetFromID(psWScreen,IDRET_FORM))	// if ingame.
	{
		audio_QueueTrack( ID_CLAN_ENTER );
	}

	if(widgGetFromID(psWScreen,MULTIOP_PLAYERS))	// if in multimenu.
	{
		if (!multiRequestUp && (bHosted || ingame.localJoiningInProgress))
		{
			addPlayerBox(true);	// update the player box.
		}
	}

	if(NetPlay.isHost)		// host responsible for welcoming this player.
	{
		// if we've already received a request from this player don't reallocate.
		if (ingame.JoiningInProgress[playerIndex])
		{
			return true;
		}
		ASSERT(NetPlay.playercount <= MAX_PLAYERS, "Too many players!");

		// setup data for this player, then broadcast it to the other players.
		setupNewPlayer(playerIndex);						// setup all the guff for that player.
		if (bHosted)
		{
			sendOptions();
		}
		// if skirmish and game full, then kick...
		if (NetPlay.playercount > game.maxPlayers)
		{
			kickPlayer(playerIndex, "the game is already full.", ERROR_FULL);
		}
		// send everyone's stats to the new guy
		{
			int i;

			for (i = 0; i < MAX_PLAYERS; i++)
			{
				if (NetPlay.players[i].allocated)
				{
					setMultiStats(i, getMultiStats(i), false);
				}
			}
		}
	}
	return true;
}
Esempio n. 9
0
/* Remove the Transporter Launch widget from the screen*/
void intRemoveTransporterLaunch(void)
{
	if (widgGetFromID(psWScreen, IDTRANS_LAUNCH) != NULL)
	{
		widgDelete(psWScreen, IDTRANS_LAUNCH);
	}
}
Esempio n. 10
0
/* Remove the Message View from the Intelligence screen */
void intRemoveMessageView(BOOL animated)
{
	W_TABFORM		*Form;
	VIEW_RESEARCH	*psViewResearch;

	//remove 3dView if still there
	Form = (W_TABFORM*)widgGetFromID(psWScreen,IDINTMAP_MSGVIEW);
	if(Form)
	{

		//stop the video
		psViewResearch = (VIEW_RESEARCH *)Form->pUserData;
		seq_RenderVideoToBuffer(psViewResearch->sequenceName, SEQUENCE_KILL);

		if (animated)
		{

			widgDelete(psWScreen, IDINTMAP_CLOSE);


			// Start the window close animation.
			Form->display = intClosePlainForm;
			Form->disableChildren = true;
			Form->pUserData = NULL; // Used to signal when the close anim has finished.
			ClosingMessageView = true;
		}
		else
		{
			//remove without the animating close window
			widgDelete(psWScreen, IDINTMAP_MSGVIEW);

		}
	}
}
Esempio n. 11
0
/* Set the current size of a bar graph */
void widgSetBarSize(W_SCREEN *psScreen, UDWORD id, UDWORD iValue)
{
	W_BARGRAPH		*psBGraph;
	UDWORD			size;

	ASSERT((PTRVALID(psScreen, sizeof(W_SCREEN)),
		"widgSetBarSize: Invalid screen pointer"));

	psBGraph = (W_BARGRAPH *)widgGetFromID(psScreen, id);
	if (psBGraph == NULL || psBGraph->type != WIDG_BARGRAPH)
	{
		ASSERT((FALSE, "widgSetBarSize: Couldn't find widget from id"));
		return;
	}

	if ( iValue < psBGraph->iRange )
	{
		psBGraph->iValue = (UWORD) iValue;
	}
	else
	{
		psBGraph->iValue = psBGraph->iRange;
	}

	size = WBAR_SCALE * psBGraph->iValue / psBGraph->iRange;

	psBGraph->majorSize = (UWORD)size;
}
Esempio n. 12
0
/* Set a button or clickable form's state */
void widgSetButtonState(W_SCREEN *psScreen, UDWORD id, UDWORD state)
{
	WIDGET	*psWidget;

	/* Get the button */
	psWidget = widgGetFromID(psScreen, id);
	ASSERT_OR_RETURN(, psWidget, "Couldn't find button or clickable widget by ID %u", state);

	if (psWidget->type == WIDG_BUTTON)
	{
		buttonSetState((W_BUTTON *)psWidget, state);
	}
	else if ((psWidget->type == WIDG_FORM) && (psWidget->style & WFORM_CLICKABLE))
	{
		formSetClickState((W_CLICKFORM *)psWidget, state);
	}
	else if ((psWidget->type == WIDG_EDITBOX))
	{
		editBoxSetState((W_EDITBOX *)psWidget, state);
	}
	else
	{
		ASSERT(false, "Couldn't find button or clickable widget by type %d", (int)psWidget->type);
	}
}
Esempio n. 13
0
static bool pushedKeyMap(UDWORD key)
{
//	UDWORD count =0;
//	id-KM_START
//	for(selectedKeyMap = keyMappings;
//		selectedKeyMap->status != KEYMAP_ASSIGNABLE;
//		(selectedKeyMap->status= KEYMAP__DEBUG) && (selectedKeyMap->status==KEYMAP___HIDE);
//
//		selectedKeyMap = selectedKeyMap->psNext);
//
//	while(count!=key)
//	{
//		selectedKeyMap = selectedKeyMap->psNext;
//		if((selectedKeyMap->status!=KEYMAP__DEBUG)&&(selectedKeyMap->status!=KEYMAP___HIDE))		// if it's not a debug mapping..
//		if(selectedKeyMap->status == KEYMAP_ASSIGNABLE)
//		{
//			count++;
//		}
//	}
	selectedKeyMap = (KEY_MAPPING *)widgGetFromID(psWScreen,key)->pUserData;
	if(selectedKeyMap && selectedKeyMap->status != KEYMAP_ASSIGNABLE)
	{
		selectedKeyMap = NULL;
	    audio_PlayTrack( ID_SOUND_BUILD_FAIL );

	}

	return true;
}
Esempio n. 14
0
void widgClearButtonFlash(W_SCREEN *psScreen, UDWORD id)
{
	WIDGET	*psWidget;

	/* Get the button */
	psWidget = widgGetFromID(psScreen, id);
	if (psWidget == NULL)
	{
		ASSERT(!"Couldn't find widget by ID", "Couldn't find button or clickable widget by ID");
	}
	else if (psWidget->type == WIDG_BUTTON)
	{
		buttonClearFlash((W_BUTTON *)psWidget);
	}
	else if ((psWidget->type == WIDG_FORM) && (psWidget->style & WFORM_CLICKABLE))
	{
		formClearFlash((W_FORM *)psWidget);
	}
	else if ((psWidget->type == WIDG_EDITBOX))
	{
	}
	else
	{
		ASSERT(!"Couldn't find widget by ID", "Couldn't find button or clickable widget by ID");
	}
}
Esempio n. 15
0
// ////////////////////////////////////////////////////////////////////////////
BOOL intCloseMultiMenu(void)
{
	W_TABFORM *Form;

	if (!MultiMenuUp)
	{
		return true;
	}

	widgDelete(psWScreen, MULTIMENU_CLOSE);

	// Start the window close animation.
	Form = (W_TABFORM*)widgGetFromID(psWScreen,MULTIMENU_FORM);
	if(Form) {
		Form->display = intClosePlainForm;
		Form->pUserData = NULL;	// Used to signal when the close anim has finished.
		Form->disableChildren = true;
		ClosingMultiMenu = true;
		MultiMenuUp  = false;
	}

	if (intMode != INT_INTELMAP)
	{
		intMode		= INT_NORMAL;
	}
	return true;
}
Esempio n. 16
0
// ////////////////////////////////////////////////////////////////////////////
bool startKeyMapEditor(bool first)
{
	addBackdrop();
	addSideText(FRONTEND_SIDETEXT, KM_SX, KM_Y, _("KEY MAPPING"));

	if (first)
	{
		loadKeyMap();									// get the current mappings.
	}

	WIDGET *parent = widgGetFromID(psWScreen, FRONTEND_BACKDROP);

	IntFormAnimated *kmForm = new IntFormAnimated(parent, false);
	kmForm->id = KM_FORM;
	kmForm->setGeometry(KM_X, KM_Y, KM_W, KM_H);

	addMultiBut(psWScreen, KM_FORM, KM_RETURN,			// return button.
	            8, 5,
	            iV_GetImageWidth(FrontImages, IMAGE_RETURN),
	            iV_GetImageHeight(FrontImages, IMAGE_RETURN),
	            _("Return To Previous Screen"), IMAGE_RETURN, IMAGE_RETURN_HI, IMAGE_RETURN_HI);

	addMultiBut(psWScreen, KM_FORM, KM_DEFAULT,
	            11, 45,
	            iV_GetImageWidth(FrontImages, IMAGE_KEYMAP_DEFAULT), iV_GetImageWidth(FrontImages, IMAGE_KEYMAP_DEFAULT),
	            _("Select Default"),
	            IMAGE_KEYMAP_DEFAULT, IMAGE_KEYMAP_DEFAULT_HI, IMAGE_KEYMAP_DEFAULT_HI);	// default.

	// add tab form..
	IntListTabWidget *kmList = new IntListTabWidget(kmForm);
	kmList->setChildSize(KM_ENTRYW, KM_ENTRYH);
	kmList->setChildSpacing(3, 3);
	kmList->setGeometry(52, 10, KM_ENTRYW, KM_H - 10 - 25);

	//Put the buttons on it
	std::vector<KEY_MAPPING *> mappings;
	for (KEY_MAPPING *m = keyMappings; m != nullptr; m = m->psNext)
	{
		if (m->status != KEYMAP__DEBUG && m->status != KEYMAP___HIDE)  // if it's not a debug mapping..
		{
			mappings.push_back(m);
		}
	}
	std::sort(mappings.begin(), mappings.end(), keyMappingSort);
	/* Add our first mapping to the form */
	/* Now add the others... */
	for (std::vector<KEY_MAPPING *>::const_iterator i = mappings.begin(); i != mappings.end(); ++i)
	{
		W_BUTTON *button = new W_BUTTON(kmList);
		button->id = KM_START + (i - mappings.begin());
		button->pUserData = *i;
		button->displayFunction = displayKeyMap;
		kmList->addWidgetToLayout(button);
	}

	/* Stop when the right number or when aphabetically last - not sure...! */
	/* Go home... */
	return true;
}
Esempio n. 17
0
/* Set a colour on a form */
void widgSetColour(W_SCREEN *psScreen, UDWORD id, UDWORD index, PIELIGHT colour)
{
	W_TABFORM	*psForm = (W_TABFORM *)widgGetFromID(psScreen, id);

	ASSERT_OR_RETURN(, psForm && psForm->type == WIDG_FORM, "Could not find form from id %u", id);
	ASSERT_OR_RETURN(, index < WCOL_MAX, "Colour id %u out of range", index);
	psForm->aColours[index] = colour;
}
Esempio n. 18
0
/* Set the current size of a minor bar on a double graph */
void widgSetMinorBarSize(W_SCREEN *psScreen, UDWORD id, UDWORD iValue)
{
	W_BARGRAPH *psBGraph = (W_BARGRAPH *)widgGetFromID(psScreen, id);
	ASSERT_OR_RETURN(, psBGraph != NULL, "Could not find widget from ID");
	ASSERT_OR_RETURN(, psBGraph->type == WIDG_BARGRAPH, "Wrong widget type");
	psBGraph->minorSize = MIN(WBAR_SCALE * iValue / MAX(psBGraph->iRange, 1), WBAR_SCALE);
	psBGraph->dirty = true;
}
Esempio n. 19
0
bool intAddMultiMenu(void)
{
	UDWORD			i;

	//check for already open.
	if(widgGetFromID(psWScreen,MULTIMENU_FORM))
	{
		intCloseMultiMenu();
		return true;
	}

	if (intMode != INT_INTELMAP)
	{
		intResetScreen(false);
	}

	WIDGET *parent = psWScreen->psForm;

	// add form
	IntFormAnimated *multiMenuForm = new IntFormAnimated(parent);
	multiMenuForm->id = MULTIMENU_FORM;
	multiMenuForm->setGeometry(MULTIMENU_FORM_X, MULTIMENU_FORM_Y, MULTIMENU_FORM_W, MULTIMENU_PLAYER_H*game.maxPlayers + MULTIMENU_PLAYER_H + 7);

	// add any players
	for(i=0;i<MAX_PLAYERS;i++)
	{
		if(isHumanPlayer(i) || (game.type == SKIRMISH && i<game.maxPlayers && game.skDiff[i] ) )
		{
			addMultiPlayer(i,NetPlay.players[i].position);
		}
	}

	// Add the close button.
	W_BUTINIT sButInit;
	sButInit.formID = MULTIMENU_FORM;
	sButInit.id = MULTIMENU_CLOSE;
	sButInit.x = MULTIMENU_FORM_W - 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;
	}

	intShowPowerBar();						// add power bar

	if (intMode != INT_INTELMAP)
	{
		intMode		= INT_MULTIMENU;			// change interface mode.
	}
	MultiMenuUp = true;
	return true;
}
Esempio n. 20
0
/* Remove the Transporter Content widgets from the screen */
void intRemoveTransContent(void)
{
	// Start the window close animation.
	IntFormAnimated *form = (IntFormAnimated *)widgGetFromID(psWScreen, IDTRANS_CONTENTFORM);
	if (form)
	{
		form->closeAnimateDelete();
	}
}
Esempio n. 21
0
/* Return a pointer to a buffer containing the current string of a widget.
 * NOTE: The string must be copied out of the buffer
 */
const char *widgGetString(W_SCREEN *psScreen, UDWORD id)
{
	const WIDGET *psWidget = widgGetFromID(psScreen, id);

	ASSERT( psScreen != NULL, "widgGetString: Invalid screen pointer" );

	/* Get the widget */
	if (psWidget != NULL)
	{
		switch (psWidget->type)
		{
			case WIDG_FORM:
				ASSERT( false, "widgGetString: Forms do not have a string" );
				aStringRetBuffer[0] = '\0';
				break;
			case WIDG_LABEL:
				sstrcpy(aStringRetBuffer, ((W_LABEL *)psWidget)->aText);
				break;
			case WIDG_BUTTON:
				if (((W_BUTTON *)psWidget)->pText)
				{
					sstrcpy(aStringRetBuffer, ((W_BUTTON *)psWidget)->pText);
				}
				else
				{
					aStringRetBuffer[0] = '\0';
				}
				break;
			case WIDG_EDITBOX:
			{
				char *utf = UTF32toUTF8(((W_EDITBOX *)psWidget)->aText, NULL);
				sstrcpy(aStringRetBuffer, utf);
				free(utf);
				break;
			}
			case WIDG_BARGRAPH:
				ASSERT( false, "widgGetString: Bar Graphs do not have a string" );
				aStringRetBuffer[0] = '\0';
				break;
			case WIDG_SLIDER:
				ASSERT( false, "widgGetString: Sliders do not have a string" );
				aStringRetBuffer[0] = '\0';
				break;
			default:
				ASSERT(!"Unknown widget type", "Unknown widget type");
				aStringRetBuffer[0] = '\0';
				break;
		}
	}
	else
	{
		ASSERT(!"Couldn't find widget by ID", "widgGetString: couldn't find widget by ID");
		aStringRetBuffer[0] = '\0';
	}

	return aStringRetBuffer;
}
Esempio n. 22
0
/* Set tip string for a widget */
void widgSetTip( W_SCREEN *psScreen, UDWORD id, const char *pTip )
{
	WIDGET *psWidget = widgGetFromID(psScreen, id);

	if (!psWidget)
		return;

	widgSetTipText(psWidget, pTip);
}
Esempio n. 23
0
// ////////////////////////////////////////////////////////////////////////////
// Returns true if cancel pressed or a valid game slot was selected.
// if when returning true strlen(sRequestResult) != 0 then a valid game
// slot was selected otherwise cancel was selected..
bool runChallenges(void)
{
    UDWORD		id = 0;

    id = widgRunScreen(psRequestScreen);

    sstrcpy(sRequestResult, "");					// set returned filename to null;

    // cancel this operation...
    if (id == CHALLENGE_CANCEL || CancelPressed())
    {
        goto failure;
    }

    // clicked a load entry
    if (id >= CHALLENGE_ENTRY_START  &&  id <= CHALLENGE_ENTRY_END)
    {
        if (((W_BUTTON *)widgGetFromID(psRequestScreen, id))->pText)
        {
            sstrcpy(sRequestResult, (const char *)((W_BUTTON *)widgGetFromID(psRequestScreen, id))->pUserData);
        }
        else
        {
            goto failure;				// clicked on an empty box
        }
        goto success;
    }

    return false;

// failed and/or cancelled..
failure:
    closeChallenges();
    challengeActive = false;
    return false;

// success on load.
success:
    closeChallenges();
    challengeActive = true;
    ingame.bHostSetup = true;
    changeTitleMode(MULTIOPTION);
    return true;
}
Esempio n. 24
0
static bool addSlideOptions(void)
{
    if (widgGetFromID(psWScreen,INTINGAMEOP))
    {
        widgDelete(psWScreen, INTINGAMEOP);		// get rid of the old stuff.
    }

    W_FORMINIT sFormInit;

    // add form
    sFormInit.formID	= 0;
    sFormInit.id		= INTINGAMEOP;
    sFormInit.style		= WFORM_PLAIN;
    sFormInit.x		= (SWORD)INTINGAMEOP2_X;
    sFormInit.y		= (SWORD)INTINGAMEOP2_Y;
    sFormInit.width		= INTINGAMEOP2_W;
    sFormInit.height	= INTINGAMEOP2_H;

    sFormInit.pDisplay	= intOpenPlainForm;
    sFormInit.disableChildren= true;

    widgAddForm(psWScreen, &sFormInit);

    // fx vol
    addIGTextButton(INTINGAMEOP_FXVOL, INTINGAMEOP_1_Y, INTINGAMEOP_OP_W, _("Voice Volume"), WBUT_PLAIN);
    addFESlider(INTINGAMEOP_FXVOL_S, INTINGAMEOP, INTINGAMEOP_MID, INTINGAMEOP_1_Y-5,
                AUDIO_VOL_MAX, (int)(sound_GetUIVolume() * 100.0));

    // fx vol
    addIGTextButton(INTINGAMEOP_3DFXVOL, INTINGAMEOP_2_Y, INTINGAMEOP_OP_W, _("FX Volume"), WBUT_PLAIN);
    addFESlider(INTINGAMEOP_3DFXVOL_S, INTINGAMEOP, INTINGAMEOP_MID, INTINGAMEOP_2_Y-5,
                AUDIO_VOL_MAX, (int)(sound_GetEffectsVolume() * 100.0));

    // cd vol
    addIGTextButton(INTINGAMEOP_CDVOL, INTINGAMEOP_3_Y, INTINGAMEOP_OP_W, _("Music Volume"), WBUT_PLAIN);
    addFESlider(INTINGAMEOP_CDVOL_S, INTINGAMEOP, INTINGAMEOP_MID, INTINGAMEOP_3_Y-5,
                AUDIO_VOL_MAX, (int)(sound_GetMusicVolume() * 100));

#ifdef DEBUG
    // Tactical UI: Target Origin
    if(tuiTargetOrigin)
    {
        addIGTextButton(INTINGAMEOP_TUI_TARGET_ORIGIN_SW, INTINGAMEOP_4_Y, INTINGAMEOP_SW_W,
                        _("Tactical UI (Target Origin Icon): Show"), WBUT_PLAIN);
    }
    else
    {
        addIGTextButton(INTINGAMEOP_TUI_TARGET_ORIGIN_SW, INTINGAMEOP_4_Y, INTINGAMEOP_SW_W,
                        _("Tactical UI (Target Origin Icon): Hide"), WBUT_PLAIN);
    }
#endif

    addIGTextButton(INTINGAMEOP_RESUME, INTINGAMEOP_5_Y, INTINGAMEOP_SW_W, _("Resume Game"), OPALIGN);

    return true;
}
Esempio n. 25
0
/* Set user data for a widget */
void widgSetUserData2(W_SCREEN *psScreen, UDWORD id,UDWORD UserData)
{
	WIDGET	*psWidget;

	psWidget = widgGetFromID(psScreen, id);
	if (psWidget)
	{
		psWidget->UserData = UserData;
	}
}
Esempio n. 26
0
/* Remove the Transporter Droids Avail widgets from the screen w/o animation!*/
void intRemoveTransDroidsAvailNoAnim(void)
{
	if (widgGetFromID(psWScreen, IDTRANS_DROIDS) != NULL)
	{
		//remember which tab we were on
		widgGetTabs(psWScreen, IDTRANS_DROIDTAB, &objMajor, &objMinor);

		//remove main screen
		widgDelete(psWScreen, IDTRANS_DROIDS);
	}
}
Esempio n. 27
0
// update the order interface only if it is already open.
// NOTE: Unused! bool intUpdateOrder(DROID *psDroid)
bool intUpdateOrder(DROID *psDroid)
{
	if(widgGetFromID(psWScreen,IDORDER_FORM) != NULL && OrderUp)
	{
		widgDelete(psWScreen, IDORDER_CLOSE);
        //changed to a BASE_OBJECT to accomodate the factories - AB 21/04/99
		//intAddOrder(psDroid);
        intAddOrder((BASE_OBJECT *)psDroid);
	}

	return true;
}
Esempio n. 28
0
static bool pushedKeyMap(UDWORD key)
{
	selectedKeyMap = (KEY_MAPPING *)widgGetFromID(psWScreen,key)->pUserData;
	if(selectedKeyMap && selectedKeyMap->status != KEYMAP_ASSIGNABLE)
	{
		selectedKeyMap = NULL;
	    audio_PlayTrack( ID_SOUND_BUILD_FAIL );

	}

	return true;
}
Esempio n. 29
0
/* Return the user data for a widget */
void *widgGetUserData(W_SCREEN *psScreen, UDWORD id)
{
	WIDGET	*psWidget;

	psWidget = widgGetFromID(psScreen, id);
	if (psWidget)
	{
		return psWidget->pUserData;
	}

	return NULL;
}
Esempio n. 30
0
/* Return the user data for a widget */
UDWORD widgGetUserData2(W_SCREEN *psScreen, UDWORD id)
{
	WIDGET	*psWidget;

	psWidget = widgGetFromID(psScreen, id);
	if (psWidget)
	{
		return psWidget->UserData;
	}

	return 0;
}