Fixed a bug that disallowed overwriting equipment quick slots with inventory quick slots.
This commit is contained in:
+40
-2
@@ -56,8 +56,9 @@ music_manager mainMenuMusic;
|
||||
const int MAIN_MENU_NEW_GAME = 0;
|
||||
const int MAIN_MENU_LOAD_GAME = 1;
|
||||
const int MAIN_MENU_STORY = 2;
|
||||
const int MAIN_MENU_LEARN_SOUNDS = 3;
|
||||
const int MAIN_MENU_EXIT = 4;
|
||||
const int MAIN_MENU_LANGUAGE = 3;
|
||||
const int MAIN_MENU_LEARN_SOUNDS = 4;
|
||||
const int MAIN_MENU_EXIT = 5;
|
||||
|
||||
void start_main_menu_music() {
|
||||
menu_music_resume_or_play(mainMenuMusic, MAIN_MENU_MUSIC_TRACK, MAIN_MENU_MUSIC_FADE_IN_MS);
|
||||
@@ -67,6 +68,35 @@ void stop_main_menu_music() {
|
||||
menu_music_pause(mainMenuMusic, MAIN_MENU_MUSIC_FADE_OUT_MS);
|
||||
}
|
||||
|
||||
void choose_main_menu_language() {
|
||||
string[] languageCodes;
|
||||
string[] languageLabels;
|
||||
i18n_get_available_languages(languageCodes, languageLabels);
|
||||
int currentIndex = i18n_find_language_index(languageCodes, activeLanguageCode);
|
||||
if (currentIndex < 0) {
|
||||
currentIndex = i18n_find_language_index(languageCodes, I18N_DEFAULT_LANGUAGE_CODE);
|
||||
}
|
||||
if (currentIndex < 0)
|
||||
currentIndex = 0;
|
||||
|
||||
int selectedIndex = i18n_run_language_selection_menu(languageCodes, languageLabels, currentIndex, true);
|
||||
if (selectedIndex < 0 || selectedIndex >= int(languageCodes.length()))
|
||||
return;
|
||||
|
||||
string selectedCode = languageCodes[selectedIndex];
|
||||
if (!i18n_load_language(selectedCode))
|
||||
return;
|
||||
|
||||
i18n_save_language_preference(selectedCode);
|
||||
string localizedWindowTitle = tr("system.ui.window_title");
|
||||
show_window(localizedWindowTitle);
|
||||
ui_set_default_window_title(localizedWindowTitle);
|
||||
|
||||
dictionary args;
|
||||
args.set("language", languageLabels[selectedIndex]);
|
||||
speak_with_history(trf("system.language.selected", args), true);
|
||||
}
|
||||
|
||||
int run_main_menu() {
|
||||
start_main_menu_music();
|
||||
speak_with_history(tr("system.main_menu.prompt"), true);
|
||||
@@ -93,6 +123,11 @@ int run_main_menu() {
|
||||
entry_types.insert_last(0);
|
||||
action_ids.insert_last(MAIN_MENU_STORY);
|
||||
|
||||
options.insert_last(tr("system.menu.main.language"));
|
||||
entry_paths.insert_last("");
|
||||
entry_types.insert_last(0);
|
||||
action_ids.insert_last(MAIN_MENU_LANGUAGE);
|
||||
|
||||
options.insert_last(i18n_text("Learn Sounds"));
|
||||
entry_paths.insert_last("");
|
||||
entry_types.insert_last(0);
|
||||
@@ -210,6 +245,9 @@ void run_game() {
|
||||
} else if (selection == MAIN_MENU_STORY) {
|
||||
run_story_dialog();
|
||||
continue;
|
||||
} else if (selection == MAIN_MENU_LANGUAGE) {
|
||||
choose_main_menu_language();
|
||||
continue;
|
||||
} else if (selection == MAIN_MENU_LEARN_SOUNDS) {
|
||||
run_learn_sounds_menu();
|
||||
continue;
|
||||
|
||||
@@ -25,6 +25,7 @@ direction.west=wes
|
||||
direction.east=oos
|
||||
inventory.cant_carry_any_more_item=Jy kan nie meer {item} dra nie.
|
||||
menu.main.story=Die storie
|
||||
menu.main.language=Taal
|
||||
story.voice.format={speaker}: {line}
|
||||
story.god.fallback='n god
|
||||
story.god.odin=Odin
|
||||
|
||||
@@ -40,6 +40,7 @@ menu.canceled=Canceled.
|
||||
menu.no_options=No options.
|
||||
menu.no_matches=No matches for {arg1}.
|
||||
menu.main.story=The story
|
||||
menu.main.language=Language
|
||||
option.no=No
|
||||
option.yes=Yes
|
||||
inventory.cant_carry_any_more_item=You can't carry any more {item}.
|
||||
|
||||
@@ -40,6 +40,7 @@ menu.canceled=Canceled.
|
||||
menu.no_options=No options.
|
||||
menu.no_matches=No matches for {arg1}.
|
||||
menu.main.story=The story
|
||||
menu.main.language=Language
|
||||
option.no=No
|
||||
option.yes=Yes
|
||||
inventory.cant_carry_any_more_item=You can't carry any more {item}.
|
||||
|
||||
@@ -25,6 +25,7 @@ direction.west=oeste
|
||||
direction.east=este
|
||||
inventory.cant_carry_any_more_item=No puedes llevar mas {item}.
|
||||
menu.main.story=La historia
|
||||
menu.main.language=Idioma
|
||||
story.voice.format={speaker}: {line}
|
||||
story.god.fallback=Un dios
|
||||
story.god.odin=Odin
|
||||
|
||||
@@ -531,6 +531,7 @@ def write_catalog(entries: Dict[str, Dict[str, object]], output_path: Path) -> N
|
||||
("system.menu.no_options", "No options."),
|
||||
("system.menu.no_matches", "No matches for {arg1}."),
|
||||
("system.menu.main.story", "The story"),
|
||||
("system.menu.main.language", "Language"),
|
||||
("system.option.no", "No"),
|
||||
("system.option.yes", "Yes"),
|
||||
("system.inventory.cant_carry_any_more_item", "You can't carry any more {item}."),
|
||||
|
||||
+3
-1
@@ -659,7 +659,7 @@ int i18n_find_language_index(const string[] @languageCodes, const string& in lan
|
||||
}
|
||||
|
||||
int i18n_run_language_selection_menu(const string[] @languageCodes, const string[] @languageLabels,
|
||||
int defaultIndex = 0) {
|
||||
int defaultIndex = 0, bool allowCancel = false) {
|
||||
if (@languageCodes is null || @languageLabels is null)
|
||||
return -1;
|
||||
if (languageCodes.length() == 0 || languageLabels.length() == 0)
|
||||
@@ -705,6 +705,8 @@ int i18n_run_language_selection_menu(const string[] @languageCodes, const string
|
||||
}
|
||||
|
||||
if (key_pressed(KEY_ESCAPE)) {
|
||||
if (allowCancel)
|
||||
return -1;
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,34 @@ void reset_quick_slots() {
|
||||
}
|
||||
}
|
||||
|
||||
void bind_equipment_to_quick_slot(int slot_index, int equip_type, int rune_type) {
|
||||
if (slot_index < 0 || slot_index >= int(quick_slots.length())) {
|
||||
return;
|
||||
}
|
||||
|
||||
quick_slots[slot_index] = equip_type;
|
||||
if (slot_index >= 0 && slot_index < int(quick_slot_runes.length())) {
|
||||
quick_slot_runes[slot_index] = rune_type;
|
||||
}
|
||||
if (slot_index >= 0 && slot_index < int(item_count_slots.length())) {
|
||||
item_count_slots[slot_index] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void bind_item_count_to_quick_slot(int slot_index, int item_type) {
|
||||
if (slot_index < 0 || slot_index >= int(item_count_slots.length())) {
|
||||
return;
|
||||
}
|
||||
|
||||
item_count_slots[slot_index] = item_type;
|
||||
if (slot_index >= 0 && slot_index < int(quick_slots.length())) {
|
||||
quick_slots[slot_index] = -1;
|
||||
}
|
||||
if (slot_index >= 0 && slot_index < int(quick_slot_runes.length())) {
|
||||
quick_slot_runes[slot_index] = RUNE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
int get_personal_stack_limit() {
|
||||
int limit = MAX_ITEM_STACK;
|
||||
if (equipped_arms == EQUIP_POUCH) {
|
||||
|
||||
@@ -220,10 +220,7 @@ void run_equipment_menu() {
|
||||
if (slot_index != -1 && filtered_indices.length() > 0) {
|
||||
int equip_type = equipment_types[filtered_indices[selection]];
|
||||
int rune_type = rune_types[filtered_indices[selection]];
|
||||
quick_slots[slot_index] = equip_type;
|
||||
if (slot_index >= 0 && slot_index < int(quick_slot_runes.length())) {
|
||||
quick_slot_runes[slot_index] = rune_type;
|
||||
}
|
||||
bind_equipment_to_quick_slot(slot_index, equip_type, rune_type);
|
||||
string name = get_full_equipment_name(equip_type, rune_type);
|
||||
dictionary args;
|
||||
args.set("name", name);
|
||||
|
||||
@@ -194,7 +194,7 @@ void run_inventory_menu(bool allow_deposit) {
|
||||
if (slot_index != -1 && filtered_indices.length() > 0) {
|
||||
int item_type = item_types[filtered_indices[selection]];
|
||||
if (slot_index >= 0 && slot_index < int(item_count_slots.length())) {
|
||||
item_count_slots[slot_index] = item_type;
|
||||
bind_item_count_to_quick_slot(slot_index, item_type);
|
||||
string name = get_item_count_binding_name(item_type);
|
||||
dictionary args;
|
||||
args.set("name", name);
|
||||
|
||||
Reference in New Issue
Block a user