Add toggle to mute Mario's voice

This commit is contained in:
Llennpie 2021-11-16 19:54:11 -05:00
parent 611f62abf3
commit eda6218059
5 changed files with 19 additions and 6 deletions

View File

@ -12,6 +12,7 @@
#include "game/camera.h"
#include "seq_ids.h"
#include "dialog_ids.h"
#include "pc/configfile.h"
#define EU_FLOAT(x) x
// N.B. sound banks are different from the audio banks referred to in other
@ -565,6 +566,13 @@ void create_next_audio_buffer(s16 *samples, u32 num_samples) {
* Called from threads: thread5_game_loop
*/
void play_sound(s32 soundBits, f32 *pos) {
u8 bank;
bank = (soundBits & SOUNDARGS_MASK_BANK) >> SOUNDARGS_SHIFT_BANK;
if (bank == SOUND_BANK_VOICE && !configVoicesEnabled)
return;
sSoundRequests[sSoundRequestCount].soundBits = soundBits;
sSoundRequests[sSoundRequestCount].position = pos;
sSoundRequestCount++;
@ -1764,7 +1772,7 @@ void stop_sounds_from_source(f32 *pos) {
/**
* Called from threads: thread3_main, thread5_game_loop
*/
static void stop_sounds_in_bank(u8 bank) {
void stop_sounds_in_bank(u8 bank) {
u8 soundIndex = sSoundBanks[bank][0].next;
while (soundIndex != 0xff) {

View File

@ -40,6 +40,7 @@ void get_currently_playing_sound(u8 bank, u8 *numPlayingSounds, u8 *numSoundsInB
void stop_sound(u32 soundBits, f32 *pos);
void moon_stop_sound(u32 soundBits);
void stop_sounds_from_source(f32 *pos);
void stop_sounds_in_bank(u8 bank);
void stop_sounds_in_continuous_banks(void);
void sound_banks_disable(u8 player, u16 bankMask);
void sound_banks_enable(u8 player, u16 bankMask);

View File

@ -81,8 +81,8 @@ using namespace std;
SDL_Window* window = nullptr;
ImGuiIO* io = nullptr;
#define SM64_WIDTH 640
#define SM64_HEIGHT 480
#define SM64_WIDTH 1280
#define SM64_HEIGHT 960
// Helper to display a little (?) mark which shows a tooltip when hovered.
static void HelpMarker(const char* desc)
@ -600,8 +600,8 @@ namespace MoonInternal {
strcpy(cc_gameshark, global_color_to_cc().c_str());
}
}
if (ImGui::BeginTabItem("CC GameShark")) {
ImGui::InputTextMultiline("###gameshark", cc_gameshark, IM_ARRAYSIZE(cc_gameshark), ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 25), ImGuiInputTextFlags_CharsUppercase);
if (ImGui::BeginTabItem("GameShark")) {
ImGui::InputTextMultiline("###gameshark_box", cc_gameshark, IM_ARRAYSIZE(cc_gameshark), ImVec2(-FLT_MIN, ImGui::GetTextLineHeight() * 25), ImGuiInputTextFlags_CharsUppercase);
ImGui::Dummy(ImVec2(0, 5));
@ -672,6 +672,7 @@ namespace MoonInternal {
ImGui::SliderInt("SFX", (int*)&configSfxVolume, 0, MAX_VOLUME);
ImGui::SliderInt("Music", (int*)&configMusicVolume, 0, MAX_VOLUME);
ImGui::SliderInt("Environment", (int*)&configEnvVolume, 0, MAX_VOLUME);
ImGui::Checkbox("Enable Voices", &configVoicesEnabled);
}
if (ImGui::CollapsingHeader("Gameplay")) {

View File

@ -78,6 +78,7 @@ unsigned int configMasterVolume = MAX_VOLUME; // 0 - MAX_VOLUME
unsigned int configMusicVolume = 0;
unsigned int configSfxVolume = MAX_VOLUME;
unsigned int configEnvVolume = MAX_VOLUME;
bool configVoicesEnabled = false;
// Keyboard mappings (VK_ values, by default keyboard/gamepad/mouse)
unsigned int configKeyA[MAX_BINDS] = { 0x0026, 0x1000, 0x1103 };
@ -140,6 +141,7 @@ static const struct ConfigOption options[] = {
{.name = "music_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMusicVolume},
{.name = "sfx_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configSfxVolume},
{.name = "env_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configEnvVolume},
{.name = "voices_enabled", .type = CONFIG_TYPE_BOOL, .boolValue = &configVoicesEnabled},
{.name = "key_a", .type = CONFIG_TYPE_BIND, .uintValue = configKeyA},
{.name = "key_b", .type = CONFIG_TYPE_BIND, .uintValue = configKeyB},
{.name = "key_start", .type = CONFIG_TYPE_BIND, .uintValue = configKeyStart},

View File

@ -42,6 +42,7 @@ extern unsigned int configMasterVolume;
extern unsigned int configMusicVolume;
extern unsigned int configSfxVolume;
extern unsigned int configEnvVolume;
extern bool configVoicesEnabled;
extern unsigned int configKeyA[];
extern unsigned int configKeyB[];
extern unsigned int configKeyStart[];