Exemple #1
0
static void GAME_InitMenuOptions (void)
{
	uiNode_t* ufoOptions = nullptr;
	uiNode_t* aircraftOptions = nullptr;

	for (int i = 0; i < UFO_MAX; i++) {
		const char* shortName = cgi->Com_UFOTypeToShortName((ufoType_t)i);
		cgi->UI_AddOption(&ufoOptions, shortName, shortName, GAME_SK_GetRandomMapAssemblyNameForCraft(shortName));
	}
	for (int i = 0; i < UFO_MAX; i++) {
		const char* shortName = cgi->Com_UFOCrashedTypeToShortName((ufoType_t)i);
		cgi->UI_AddOption(&ufoOptions, shortName, shortName, GAME_SK_GetRandomMapAssemblyNameForCraft(shortName));
	}
	cgi->UI_RegisterOption(OPTION_UFOS, ufoOptions);

	for (int i = 0; i < DROPSHIP_MAX; i++) {
		const char* shortName = cgi->Com_DropShipTypeToShortName((humanAircraftType_t)i);
		cgi->UI_AddOption(&aircraftOptions, shortName, shortName, GAME_SK_GetRandomMapAssemblyNameForCraft(shortName));
	}
	cgi->UI_RegisterOption(OPTION_DROPSHIPS, aircraftOptions);
}
/**
 * @brief Hide the ufo selection or show it with the ufos given in the parameter
 * @param ufos if @c NULL, the ufo selection panel will be hidden, otherwise it
 * will be shown with the given list entries as content.
 */
static inline void GAME_SK_HideUFOs (const linkedList_t *ufos)
{
    const qboolean hide = (ufos == NULL);
    if (hide) {
        cgi->UI_ExecuteConfunc("skirmish_hide_ufos true");
        cgi->Cvar_Set("rm_ufo", "");
    } else {
        const char *rma = GAME_SK_GetRandomMapAssemblyNameForCraft((const char *)ufos->data);
        cgi->Cvar_Set("rm_ufo", rma);
        cgi->UI_UpdateInvisOptions(cgi->UI_GetOption(OPTION_UFOS), ufos);

        cgi->UI_ExecuteConfunc("skirmish_hide_ufos false");
    }
}
/**
 * @brief Hide the dropship selection or show it with the dropship given in the parameter
 * @param dropships if @c NULL, the dropship selection panel will be hidden, otherwise it
 * will be shown with the given list entries as content.
 */
static inline void GAME_SK_HideDropships (const linkedList_t *dropships)
{
    const qboolean hide = (dropships == NULL);
    if (hide) {
        cgi->UI_ExecuteConfunc("skirmish_hide_dropships true");
        cgi->Cvar_Set("rm_drop", "");
    } else {
        const char *rma = GAME_SK_GetRandomMapAssemblyNameForCraft((const char *)dropships->data);
        cgi->Cvar_Set("rm_drop", rma);
        cgi->UI_UpdateInvisOptions(cgi->UI_GetOption(OPTION_DROPSHIPS), dropships);

        cgi->UI_ExecuteConfunc("skirmish_hide_dropships false");
    }
}