Favor lowered. It should require actual work to maintain. Fixed a bug with pets.

This commit is contained in:
Storm Dragon
2026-02-14 00:16:02 -05:00
parent 6687863fbe
commit dc23ddabb2
12 changed files with 276 additions and 326 deletions

View File

@@ -414,47 +414,85 @@ bool setup_new_character() {
}
bool select_save_file(string &out filename) {
string[] files = get_save_files();
if (files.length() == 0) return false;
string[] options;
for (uint i = 0; i < files.length(); i++) {
string displayName;
int sex = SEX_MALE;
int day = 1;
if (!read_save_metadata(files[i], displayName, sex, day)) {
displayName = strip_save_extension(files[i]);
options.insert_last(displayName);
} else {
string sex_label = (sex == SEX_FEMALE) ? "female" : "male";
options.insert_last(displayName + ", " + sex_label + ", day " + day);
}
}
int selection = 0;
speak_with_history("Load game. Select character.", true);
speak_with_history(options[selection], true);
while (true) {
wait(5);
if (key_pressed(KEY_DOWN)) {
play_menu_move_sound();
selection++;
if (selection >= options.length()) selection = 0;
speak_with_history(options[selection], true);
string[] files = get_save_files();
if (files.length() == 0) return false;
string[] options;
string[] displayNames;
int[] sexValues;
int[] dayValues;
bool[] hasMetadata;
for (uint i = 0; i < files.length(); i++) {
string displayName;
int sex = SEX_MALE;
int day = 1;
bool gotMeta = read_save_metadata(files[i], displayName, sex, day);
if (!gotMeta) {
displayName = strip_save_extension(files[i]);
options.insert_last(displayName);
} else {
string sex_label = (sex == SEX_FEMALE) ? "female" : "male";
options.insert_last(displayName + ", " + sex_label + ", day " + day);
}
displayNames.insert_last(displayName);
sexValues.insert_last(sex);
dayValues.insert_last(day);
hasMetadata.insert_last(gotMeta);
}
if (key_pressed(KEY_UP)) {
play_menu_move_sound();
selection--;
if (selection < 0) selection = int(options.length()) - 1;
speak_with_history(options[selection], true);
int selection = 0;
speak_with_history("Load game. Select character. Press delete to remove a save.", true);
speak_with_history(options[selection], true);
bool refreshList = false;
while (true) {
wait(5);
if (key_pressed(KEY_DOWN)) {
play_menu_move_sound();
selection++;
if (selection >= options.length()) selection = 0;
speak_with_history(options[selection], true);
}
if (key_pressed(KEY_UP)) {
play_menu_move_sound();
selection--;
if (selection < 0) selection = int(options.length()) - 1;
speak_with_history(options[selection], true);
}
if (key_pressed(KEY_RETURN)) {
play_menu_select_sound();
filename = files[selection];
return true;
}
if (key_pressed(KEY_DELETE)) {
string prompt = "Are you sure you want to delete the character " + displayNames[selection];
if (hasMetadata[selection]) {
string sex_label = (sexValues[selection] == SEX_FEMALE) ? "female" : "male";
prompt += " gender " + sex_label + " days " + dayValues[selection] + "?";
} else {
prompt += "?";
}
int confirm = ui_question("", prompt);
if (confirm == 1) {
if (file_delete(files[selection])) {
speak_with_history("Save deleted.", true);
refreshList = true;
break;
} else {
ui_info_box("Draugnorak", "Delete Save", "Unable to delete save.");
speak_with_history(options[selection], true);
}
} else {
speak_with_history(options[selection], true);
}
}
if (key_pressed(KEY_ESCAPE)) {
return false;
}
}
if (key_pressed(KEY_RETURN)) {
play_menu_select_sound();
filename = files[selection];
return true;
}
if (key_pressed(KEY_ESCAPE)) {
if (!refreshList) {
return false;
}
}