A few bugs fixed. Very very rough draft of pet system. Hopefully it works, maybe it doesn't.

This commit is contained in:
Storm Dragon
2026-02-12 03:30:38 -05:00
parent 04ecb404c7
commit af6b3e4e3e
37 changed files with 936 additions and 43 deletions

View File

@@ -356,7 +356,7 @@ string pick_random_name_for_sex(int sex, const string[]@ usedNames) {
bool select_player_sex(int &out sex) {
string[] options = {"Male", "Female"};
int selection = 0;
string prompt = "Choose your character's sex.";
string prompt = "Choose your sex.";
speak_with_history(prompt + " " + options[selection], true);
while (true) {
@@ -365,13 +365,13 @@ bool select_player_sex(int &out sex) {
play_menu_move_sound();
selection++;
if (selection >= options.length()) selection = 0;
speak_with_history(prompt + " " + options[selection], true);
speak_with_history(options[selection], true);
}
if (key_pressed(KEY_UP)) {
play_menu_move_sound();
selection--;
if (selection < 0) selection = options.length() - 1;
speak_with_history(prompt + " " + options[selection], true);
speak_with_history(options[selection], true);
}
if (key_pressed(KEY_RETURN)) {
play_menu_select_sound();
@@ -586,6 +586,7 @@ void reset_game_state() {
blessing_speed_active = false;
blessing_resident_active = false;
reset_fylgja_state();
reset_pet_state();
// Reset inventory using the registry system
reset_inventory();
@@ -800,6 +801,11 @@ bool save_game_state() {
saveData.set("adventure_completion_counts", serialize_inventory_array(adventureCompletionCounts));
saveData.set("incense_hours_remaining", incense_hours_remaining);
saveData.set("incense_burning", incense_burning);
saveData.set("pet_active", petActive);
saveData.set("pet_sound_path", petSoundPath);
saveData.set("pet_type", petType);
saveData.set("pet_gender", petGender);
saveData.set("pet_loyalty", petLoyalty);
// Save inventory arrays using new compact format
saveData.set("personal_inventory", serialize_inventory_array(personal_inventory));
@@ -1106,6 +1112,40 @@ bool load_game_state_from_file(const string&in filename) {
incense_hours_remaining = int(get_number(saveData, "incense_hours_remaining", 0));
incense_burning = get_bool(saveData, "incense_burning", false);
if (incense_hours_remaining > 0) incense_burning = true;
petActive = get_bool(saveData, "pet_active", false);
string loadedPetSound;
petSoundPath = "";
if (saveData.get("pet_sound_path", loadedPetSound)) {
petSoundPath = loadedPetSound;
}
string loadedPetType;
petType = "";
if (saveData.get("pet_type", loadedPetType)) {
petType = loadedPetType;
}
string loadedPetGender;
petGender = "";
if (saveData.get("pet_gender", loadedPetGender)) {
petGender = loadedPetGender;
}
petLoyalty = int(get_number(saveData, "pet_loyalty", 0));
if (!petActive) {
petSoundPath = "";
petType = "";
petGender = "";
petLoyalty = 0;
}
if (petActive && petSoundPath != "" && !file_exists(petSoundPath)) {
petActive = false;
petSoundPath = "";
petType = "";
petGender = "";
petLoyalty = 0;
}
if (petActive) {
petAttackTimer.restart();
petRetrieveTimer.restart();
}
if (x < 0) x = 0;
if (x >= MAP_SIZE) x = MAP_SIZE - 1;