Example #1
0
/**
 * @brief Init skins into the GUI
 */
static void CL_InitSkin_f (void)
{
	/* create option for singleplayer skins */
	if (UI_GetOption(OPTION_SINGLEPLAYER_SKINS) == nullptr) {
		uiNode_t* skins = nullptr;
		int idx = 0;
		const actorSkin_t* skin;
		while ((skin = CL_GetActorSkinByIDS(idx++))) {
			if (!skin->singleplayer)
				continue;
			UI_AddOption(&skins, skin->id, skin->name, va("%d", skin->idx));
		}
		UI_RegisterOption(OPTION_SINGLEPLAYER_SKINS, skins);
	}

	/* create option for multiplayer skins */
	if (UI_GetOption(OPTION_MULTIPLAYER_SKINS) == nullptr) {
		uiNode_t* skins = nullptr;
		int idx = 0;
		const actorSkin_t* skin;
		while ((skin = CL_GetActorSkinByIDS(idx++))) {
			if (!skin->multiplayer)
				continue;
			UI_AddOption(&skins, skin->id, skin->name, va("%d", skin->idx));
		}
		UI_RegisterOption(OPTION_MULTIPLAYER_SKINS, skins);
	}
}
Example #2
0
/**
 * @brief Adds joysticks to the options menu
 */
void IN_JoystickInitMenu (void)
{
	uiNode_t* joystickOptions = nullptr;
	const int total = SDL_NumJoysticks();

	if (total == 0) {
		UI_AddOption(&joystickOptions, "", _("None"), "0");
	} else {
		for (int i = 0; i < total; i++)
			UI_AddOption(&joystickOptions, "", SDL_JoystickName(i), va("%i", i));
	}
	UI_RegisterOption(OPTION_JOYSTICKS, joystickOptions);
}
Example #3
0
/**
 * @brief Fills the options language menu node with the parsed language mappings
 * @sa CL_InitAfter
 * @sa CL_LocaleSet
 */
void CL_LanguageInit (void)
{
	int i;
	language_t* language;
	uiNode_t* languageOption = nullptr;
	char systemLanguage[MAX_VAR];

	fs_i18ndir = Cvar_Get("fs_i18ndir", "", 0, "System path to language files");

	if (s_language->string[0] != '\0') {
		Com_Printf("CL_LanguageInit: language settings are stored in configuration: %s\n", s_language->string);
		Q_strncpyz(systemLanguage, s_language->string, sizeof(systemLanguage));
	} else {
		const char* currentLocale = Sys_GetLocale();

		if (currentLocale) {
			const char* localeID = CL_GetLocaleID(currentLocale);
			if (localeID)
				Q_strncpyz(systemLanguage, localeID, sizeof(systemLanguage));
			else
				systemLanguage[0] = '\0';
		} else
			systemLanguage[0] = '\0';
	}

	Com_DPrintf(DEBUG_CLIENT, "CL_LanguageInit: system language is: '%s'\n", systemLanguage);

	for (i = 0, language = languageList; i < languageCount; language = language->next, i++) {
		bool available;
		available = Q_streq(language->localeID, "none") || CL_LanguageTest(language->localeID);
		uiNode_t* option;
#if 0
		option = UI_AddOption(&languageOption, "", language->localeString, language->localeID);
#else
		option = UI_AddOption(&languageOption, "", language->nativeString, language->localeID);
#endif
		option->disabled = !available;
	}

	/* sort the list, and register it to the menu */
	UI_SortOptions(&languageOption);
	UI_RegisterOption(OPTION_LANGUAGES, languageOption);

	/* Set to the locale remembered previously. */
	CL_LanguageTryToSet(systemLanguage);
}
Example #4
0
static void GAME_InitMenuOptions (void)
{
	int i;
	uiNode_t* ufoOptions = NULL;
	uiNode_t* aircraftOptions = NULL;

	for (i = 0; i < UFO_MAX; i++) {
		const char *shortName = Com_UFOTypeToShortName(i);
		UI_AddOption(&ufoOptions, shortName, shortName, Com_GetRandomMapAssemblyNameForCraft(shortName));
	}
	for (i = 0; i < UFO_MAX; i++) {
		const char *shortName = Com_UFOCrashedTypeToShortName(i);
		UI_AddOption(&ufoOptions, shortName, shortName, Com_GetRandomMapAssemblyNameForCraft(shortName));
	}
	UI_RegisterOption(OPTION_UFOS, ufoOptions);

	for (i = 0; i < DROPSHIP_MAX; i++) {
		const char *shortName = Com_DropShipTypeToShortName(i);
		UI_AddOption(&aircraftOptions, shortName, shortName, Com_GetRandomMapAssemblyNameForCraft(shortName));
	}
	UI_RegisterOption(OPTION_DROPSHIPS, aircraftOptions);
}
Example #5
0
static void CL_TeamDefInitMenu (void)
{
	uiNode_t* option = UI_GetOption(OPTION_TEAMDEFS);
	if (option != nullptr)
		return;

	for (int i = 0; i < csi.numTeamDefs; i++) {
		const teamDef_t* td = &csi.teamDef[i];
		if (td->team != TEAM_CIVILIAN)
			UI_AddOption(&option, td->id, va("_%s", td->name), td->id);
	}
	UI_RegisterOption(OPTION_TEAMDEFS, option);
}
Example #6
0
static void CL_VideoInitMenu (void)
{
	uiNode_t* option = UI_GetOption(OPTION_VIDEO_RESOLUTIONS);
	if (option != nullptr) {
		return;
	}
	const int length = VID_GetModeNums();
	for (int i = 0; i < length; i++) {
		vidmode_t vidmode;
		if (VID_GetModeInfo(i, &vidmode))
			UI_AddOption(&option, va("r%ix%i", vidmode.width, vidmode.height), va("%i x %i", vidmode.width, vidmode.height), va("%i", i));
	}
	UI_RegisterOption(OPTION_VIDEO_RESOLUTIONS, option);
}
Example #7
0
/**
 * @brief Fills the options language menu node with the parsed language mappings
 * @sa CL_InitAfter
 * @sa CL_LocaleSet
 */
void CL_LanguageInit (void)
{
	int i;
	language_t* language;
	uiNode_t *languageOption = NULL;
	char systemLanguage[MAX_VAR];

	fs_i18ndir = Cvar_Get("fs_i18ndir", "", 0, "System path to language files");

	if (s_language->string[0] != '\0') {
		Com_Printf("CL_LanguageInit: language settings are stored in configuration: %s\n", s_language->string);
		Q_strncpyz(systemLanguage, s_language->string, sizeof(systemLanguage));
	} else {
		const char *currentLocale = Sys_GetLocale();

		if (currentLocale) {
			const char *localeID = CL_GetLocaleID(currentLocale);
			if (localeID)
				Q_strncpyz(systemLanguage, localeID, sizeof(systemLanguage));
			else
				systemLanguage[0] = '\0';
		} else
			systemLanguage[0] = '\0';
	}

	Com_DPrintf(DEBUG_CLIENT, "CL_LanguageInit: system language is: '%s'\n", systemLanguage);

	for (i = 0, language = languageList; i < languageCount; language = language->next, i++) {
#ifndef DEBUG
		/* No language option available only for DEBUG. */
		if (!CL_LanguageTest(language->localeID))
			continue;
#endif

		/* Test the locale first, add to list if setting given locale possible. */
		if (CL_LanguageTest(language->localeID) || Q_streq(language->localeID, "none")) {
			UI_AddOption(&languageOption, "", va("_%s", language->localeString), language->localeID);
		}
	}

	/* sort the list, and register it to the menu */
	UI_SortOptions(&languageOption);
	UI_RegisterOption(OPTION_LANGUAGES, languageOption);

	/* Set to the locale remembered previously. */
	CL_LanguageTryToSet(systemLanguage);
}
Example #8
0
void CL_LanguageInitMenu (void)
{
	uiNode_t* languageOption = nullptr;
	language_t* language = languageList;
	while (language) {
		const bool available = Q_streq(language->localeID, "none") || CL_LanguageTest(language->localeID);
		uiNode_t* option = UI_AddOption(&languageOption, "", language->nativeString, language->localeID);
		option->disabled = !available;
		language = language->next;
	}

	/* sort the list, and register it to the menu */
	UI_SortOptions(&languageOption);
	UI_RegisterOption(OPTION_LANGUAGES, languageOption);

	/* Set to the locale remembered previously. */
	CL_LanguageTryToSet(s_language->string);
}