Merge pull request #519 from NQNStudios:sounds

* Changed shop purchase sound effects where Yum! definitely didn't fit. For alchemy, mage spells, and priest spells, I made the sound the same as the sound when you perform those actions. I figure this actually makes sense because the teacher would show you how to do the thing.
* For skill training, I made the sound be the same as leveling up. I think this makes sense.
* When something is too heavy to pick up, the "Argh!" labeled as 'Action Failure' in the editor sound picker makes a lot of sense--you tried to pick it up and were frustrated.
* I changed beep() so every platform just plays sound effect 1, the one labeled "low beep" [here](http://openboe.com/docs/editor/appendix/Sounds.html) that's labeled "Cancel target lock" in the editor picker. I think this reasonable.
* Removed `ding()` which was an unused alias for `beep()`
This commit is contained in:
2025-01-07 21:34:08 -05:00
committed by GitHub
6 changed files with 17 additions and 23 deletions

View File

@@ -293,8 +293,7 @@ void handle_sale(int i) {
else if(!take_gold(cost,false))
ASB("Not enough gold.");
else {
// TODO: This seems like the wrong sound
play_sound(62);
play_sound(8);
ASB("You buy an alchemical recipe.");
univ.party.alchemy[base_item.item_level] = true;
}
@@ -352,8 +351,7 @@ void handle_sale(int i) {
else if(!take_gold(cost,false))
ASB("Not enough gold.");
else {
// TODO: This seems like the wrong sound
play_sound(62);
play_sound(25);
ASB("You buy a spell.");
univ.current_pc().mage_spells[base_item.item_level] = true;
give_help(41,0);
@@ -370,8 +368,7 @@ void handle_sale(int i) {
else if(!take_gold(cost,false))
ASB("Not enough gold.");
else {
// TODO: This seems like the wrong sound
play_sound(62);
play_sound(24);
ASB("You buy a spell.");
univ.current_pc().priest_spells[base_item.item_level] = true;
give_help(41,0);
@@ -401,8 +398,7 @@ void handle_sale(int i) {
else if(!take_gold(cost, false))
ASB("Not enough gold.");
else {
// TODO: No idea what's a good sound here.
play_sound(62);
play_sound(7);
ASB("You learn a little...");
active_shop.takeOne(i);
univ.current_pc().skills[skill]++;
@@ -787,7 +783,8 @@ void handle_talk_node(int which_talk_entry) {
break;
case TALK_RECORD:
if(!can_save_talk) {
beep();
// TODO the button shouldn't be shown if it won't work, no?
play_sound(1);
return;
}
if(univ.party.save_talk(univ.town->talking.people[store_personality%10].title, univ.town->name, save_talk_str1, save_talk_str2)) {

View File

@@ -499,7 +499,7 @@ static bool display_item_event_filter(cDialog& me, std::string id, size_t& first
set_item_flag(&item);
} else {
if(!allow_overload && item.item_weight() > univ.party[current_getting_pc].free_weight()) {
beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
play_sound(41);
me["prompt"].setText("It's too heavy to carry.");
give_help(38,0,me);
return true;

View File

@@ -380,7 +380,7 @@ static bool spend_xp_navigate_filter(cDialog& me, std::string item_hit,xp_dlog_s
} while(univ.party[save.who].main_status != eMainStatus::ALIVE);
do_xp_draw(me,save);
} else
beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
play_sound(1);
} else if(item_hit == "right") {
// TODO: If they don't work in mode 0, why are they visible?
if(save.mode != 0) {
@@ -390,7 +390,7 @@ static bool spend_xp_navigate_filter(cDialog& me, std::string item_hit,xp_dlog_s
} while(univ.party[save.who].main_status != eMainStatus::ALIVE);
do_xp_draw(me,save);
} else
beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
play_sound(1);
}
return true;
}
@@ -409,7 +409,7 @@ static bool spend_xp_event_filter(cDialog& me, std::string item_hit, eKeyMod mod
if(save.mode == 1)
save.g += 10;
}
} else beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
} else play_sound(1);
} else if(item_hit[3] == 'p') {
if(can_change_skill(eSkill::MAX_SP, save, true)) {
save.hp += 2;
@@ -444,7 +444,7 @@ static bool spend_xp_event_filter(cDialog& me, std::string item_hit, eKeyMod mod
if(save.mode == 1)
save.g += 15;
}
} else beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
} else play_sound(1);
} else if(item_hit[3] == 'p') {
if(can_change_skill(eSkill::MAX_SP, save, true)) {
save.sp += 1;
@@ -492,7 +492,7 @@ static bool spend_xp_event_filter(cDialog& me, std::string item_hit, eKeyMod mod
if(save.mode == 1)
save.g += skill_g_cost[which_skill];
}
} else beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
} else play_sound(1);
} else if(dir == 'p') {
if(can_change_skill(which_skill, save, true)) {
save.skills[which_skill] += 1;
@@ -506,7 +506,7 @@ static bool spend_xp_event_filter(cDialog& me, std::string item_hit, eKeyMod mod
give_help(25,0,me);
else if(save.mode == 1 && save.g < skill_g_cost[which_skill])
give_help(24,0,me);
else beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
else play_sound(1);
}
}

View File

@@ -68,7 +68,6 @@ void handle_one_event(const sf::Event&);
void redraw_everything();
void Mouse_Pressed(const sf::Event&);
void close_program();
void ding();
void adjust_windows(sf::RenderWindow&, sf::View&);
sf::FloatRect compute_viewport(const sf::RenderWindow&, float ui_scale);
@@ -773,8 +772,3 @@ void Mouse_Pressed(const sf::Event & event) {
void close_program() {
}
// TODO: Remove this function and replace it with beep() or play_sound() everywhere.
void ding() {
beep();
}

View File

@@ -16,6 +16,8 @@
extern sf::RenderWindow mainPtr;
extern void showError(std::string str1, std::string str2, cDialog* parent = nullptr);
extern void play_sound(snd_num_t which, sf::Time delay = sf::Time());
// TODO: I'm sure there's a better way to do this (maybe one that's keyboard layout agnostic)
// The proper way would involve use of the TextEntered event
char keyToChar(sf::Keyboard::Key key, bool isShift) {
@@ -225,6 +227,7 @@ std::unique_ptr<sf::Image> get_clipboard_img() {
}
void beep() {
play_sound(1);
}
void launchURL(std::string url) {

View File

@@ -477,7 +477,7 @@ bool cPlayer::give_item(cItem item, int flags) {
}
if(!allow_overload && item.item_weight() > free_weight()) {
if(do_print && print_result) {
//beep(); // TODO: This is a game event, so it should have a game sound, not a system alert.
play_sound(41);
print_result("Item too heavy to carry.");
}
return false;