A few sound quality of life improvements. Residents now notify when collecting snares.
This commit is contained in:
@@ -147,6 +147,40 @@ void play_land_sound(int current_x, int base_end, int grass_end)
|
||||
}
|
||||
}
|
||||
|
||||
string get_item_collect_sound(string itemName)
|
||||
{
|
||||
string lookupName = itemName;
|
||||
if (lookupName == "sticks") {
|
||||
lookupName = "stick";
|
||||
} else if (lookupName == "vines") {
|
||||
lookupName = "vine";
|
||||
} else if (lookupName == "reeds") {
|
||||
lookupName = "reed";
|
||||
} else if (lookupName == "stones") {
|
||||
lookupName = "stone";
|
||||
} else if (lookupName == "logs") {
|
||||
lookupName = "log";
|
||||
}
|
||||
|
||||
if (lookupName == "reed") {
|
||||
lookupName = "stick";
|
||||
}
|
||||
|
||||
string soundFile = "sounds/items/" + lookupName + ".ogg";
|
||||
if (file_exists(soundFile)) {
|
||||
return soundFile;
|
||||
}
|
||||
return "sounds/items/miscellaneous.ogg";
|
||||
}
|
||||
|
||||
void play_item_collect_sound(string itemName)
|
||||
{
|
||||
string soundFile = get_item_collect_sound(itemName);
|
||||
if (file_exists(soundFile)) {
|
||||
p.play_stationary(soundFile, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Safe sound handle cleanup - checks if handle is valid and sound is active before destroying
|
||||
void safe_destroy_sound(int &inout handle)
|
||||
{
|
||||
|
||||
@@ -372,10 +372,7 @@ void attempt_resident_snare_retrieval() {
|
||||
snare.hours_with_catch = 0;
|
||||
snare.hour_timer.restart();
|
||||
|
||||
// Notify if player is in base
|
||||
if (x <= BASE_END) {
|
||||
speak_with_history("Resident retrieved " + game_type + " from snare at x " + pos + " and reset it.", true);
|
||||
}
|
||||
notify("Resident retrieved " + game_type + " from snare at x " + pos + " y 0 and reset it.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -498,7 +498,7 @@ void damage_tree(int target_x, int damage) {
|
||||
drop_message += " Inventory full.";
|
||||
}
|
||||
|
||||
p.play_stationary("sounds/items/stick.ogg", false);
|
||||
play_item_collect_sound("stick");
|
||||
speak_with_history(drop_message, true);
|
||||
}
|
||||
}
|
||||
@@ -514,7 +514,7 @@ void perform_search(int current_x)
|
||||
if (!try_pickup_world_drop(drop)) {
|
||||
return;
|
||||
}
|
||||
p.play_stationary("sounds/items/miscellaneous.ogg", false);
|
||||
play_item_collect_sound(drop.type);
|
||||
remove_drop_at(check_x);
|
||||
return;
|
||||
}
|
||||
@@ -553,7 +553,8 @@ void perform_search(int current_x)
|
||||
add_personal_count(ITEM_SNARES, 1); // Recover snare
|
||||
speak_with_history("Collected snare.", true);
|
||||
}
|
||||
p.play_stationary("sounds/items/miscellaneous.ogg", false);
|
||||
string collectSoundItem = s.has_catch ? s.catch_type : "snare";
|
||||
play_item_collect_sound(collectSoundItem);
|
||||
remove_snare_at(check_x);
|
||||
return; // Action taken, stop searching
|
||||
}
|
||||
@@ -582,14 +583,14 @@ void perform_search(int current_x)
|
||||
if (found_reed) {
|
||||
if (get_personal_count(ITEM_REEDS) < get_personal_stack_limit()) {
|
||||
add_personal_count(ITEM_REEDS, 1);
|
||||
p.play_stationary("sounds/items/stick.ogg", false);
|
||||
play_item_collect_sound("reed");
|
||||
speak_with_history("Found a reed.", true);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (get_personal_count(ITEM_CLAY) < get_personal_stack_limit()) {
|
||||
add_personal_count(ITEM_CLAY, 1);
|
||||
p.play_stationary("sounds/items/clay.ogg", false);
|
||||
play_item_collect_sound("clay");
|
||||
speak_with_history("Found clay.", true);
|
||||
return;
|
||||
}
|
||||
@@ -597,11 +598,11 @@ void perform_search(int current_x)
|
||||
|
||||
if (!found_reed && get_personal_count(ITEM_REEDS) < get_personal_stack_limit()) {
|
||||
add_personal_count(ITEM_REEDS, 1);
|
||||
p.play_stationary("sounds/items/stick.ogg", false);
|
||||
play_item_collect_sound("reed");
|
||||
speak_with_history("Found a reed.", true);
|
||||
} else if (found_reed && get_personal_count(ITEM_CLAY) < get_personal_stack_limit()) {
|
||||
add_personal_count(ITEM_CLAY, 1);
|
||||
p.play_stationary("sounds/items/clay.ogg", false);
|
||||
play_item_collect_sound("clay");
|
||||
speak_with_history("Found clay.", true);
|
||||
} else if (found_reed) {
|
||||
speak_with_history("You can't carry any more reeds.", true);
|
||||
@@ -655,13 +656,13 @@ void perform_search(int current_x)
|
||||
if (nearest.sticks > 0 && get_personal_count(ITEM_STICKS) < get_personal_stack_limit()) {
|
||||
nearest.sticks--;
|
||||
add_personal_count(ITEM_STICKS, 1);
|
||||
p.play_stationary("sounds/items/stick.ogg", false);
|
||||
play_item_collect_sound("stick");
|
||||
speak_with_history("Found a stick.", true);
|
||||
took_item = true;
|
||||
} else if (nearest.vines > 0 && get_personal_count(ITEM_VINES) < get_personal_stack_limit()) {
|
||||
nearest.vines--;
|
||||
add_personal_count(ITEM_VINES, 1);
|
||||
p.play_stationary("sounds/items/vine.ogg", false);
|
||||
play_item_collect_sound("vine");
|
||||
speak_with_history("Found a vine.", true);
|
||||
took_item = true;
|
||||
}
|
||||
@@ -669,13 +670,13 @@ void perform_search(int current_x)
|
||||
if (nearest.vines > 0 && get_personal_count(ITEM_VINES) < get_personal_stack_limit()) {
|
||||
nearest.vines--;
|
||||
add_personal_count(ITEM_VINES, 1);
|
||||
p.play_stationary("sounds/items/vine.ogg", false);
|
||||
play_item_collect_sound("vine");
|
||||
speak_with_history("Found a vine.", true);
|
||||
took_item = true;
|
||||
} else if (nearest.sticks > 0 && get_personal_count(ITEM_STICKS) < get_personal_stack_limit()) {
|
||||
nearest.sticks--;
|
||||
add_personal_count(ITEM_STICKS, 1);
|
||||
p.play_stationary("sounds/items/stick.ogg", false);
|
||||
play_item_collect_sound("stick");
|
||||
speak_with_history("Found a stick.", true);
|
||||
took_item = true;
|
||||
}
|
||||
@@ -742,7 +743,7 @@ void perform_search(int current_x)
|
||||
if (get_personal_count(ITEM_STONES) < get_personal_stack_limit())
|
||||
{
|
||||
add_personal_count(ITEM_STONES, 1);
|
||||
p.play_stationary("sounds/items/stone.ogg", false);
|
||||
play_item_collect_sound("stone");
|
||||
speak_with_history("Found a stone.", true);
|
||||
}
|
||||
else
|
||||
@@ -793,11 +794,11 @@ void perform_search(int current_x)
|
||||
|
||||
if (find_stick) {
|
||||
add_personal_count(ITEM_STICKS, 1);
|
||||
p.play_stationary("sounds/items/stick.ogg", false);
|
||||
play_item_collect_sound("stick");
|
||||
speak_with_history("Found a stick.", true);
|
||||
} else {
|
||||
add_personal_count(ITEM_VINES, 1);
|
||||
p.play_stationary("sounds/items/vine.ogg", false);
|
||||
play_item_collect_sound("vine");
|
||||
speak_with_history("Found a vine.", true);
|
||||
}
|
||||
return;
|
||||
@@ -1076,11 +1077,10 @@ void check_rope_climb_fall() {
|
||||
rope_climb_sound_handle = -1;
|
||||
}
|
||||
|
||||
// Move one tile in the direction being pressed before falling
|
||||
if (key_down(KEY_LEFT) && x > 0) {
|
||||
x--;
|
||||
} else if (key_down(KEY_RIGHT) && x < MAP_SIZE - 1) {
|
||||
x++;
|
||||
int currentElevation = get_mountain_elevation_at(x);
|
||||
int targetElevation = get_mountain_elevation_at(rope_climb_target_x);
|
||||
if (targetElevation < currentElevation) {
|
||||
x = rope_climb_target_x;
|
||||
}
|
||||
|
||||
// Fall from rope!
|
||||
|
||||
@@ -292,7 +292,11 @@ void catch_fish() {
|
||||
string size_label = get_fish_size_label(weight);
|
||||
add_personal_count(ITEM_FISH, 1);
|
||||
add_personal_fish_weight(weight);
|
||||
p.play_stationary("sounds/items/miscellaneous.ogg", false);
|
||||
string collectSoundItem = hooked_fish_type;
|
||||
if (collectSoundItem == "") {
|
||||
collectSoundItem = "fish";
|
||||
}
|
||||
play_item_collect_sound(collectSoundItem);
|
||||
|
||||
string fish_name = hooked_fish_type;
|
||||
if (fish_name == "") fish_name = "fish";
|
||||
|
||||
Reference in New Issue
Block a user