Allow object sounds to fade out to 0

This commit is contained in:
MysterD 2023-06-12 02:20:58 -07:00
parent 3331b5c98b
commit 61b72ae1ee
13 changed files with 20 additions and 3 deletions

View File

@ -338,6 +338,7 @@ MASTER_VOLUME = "Hlavní hlasitost"
MUSIC_VOLUME = "Hlasitost písničky"
SFX_VOLUME = "Hlasitost zvuků"
ENV_VOLUME = "Hlasitost prostředí"
FADEOUT = "Fadeout Distant Sounds"
[LANGUAGE]
LANGUAGE = "JAZYK"

View File

@ -336,6 +336,7 @@ MASTER_VOLUME = "Meester Geluid"
MUSIC_VOLUME = "Muziek Geluid"
SFX_VOLUME = "Sfx Geluid"
ENV_VOLUME = "Env Geluid"
FADEOUT = "Fade-out verre geluiden"
[LANGUAGE]
LANGUAGE = "TAAL"

View File

@ -338,6 +338,7 @@ MASTER_VOLUME = "Master Volume"
MUSIC_VOLUME = "Music Volume"
SFX_VOLUME = "Sfx Volume"
ENV_VOLUME = "Env Volume"
FADEOUT = "Fadeout Distant Sounds"
[LANGUAGE]
LANGUAGE = "LANGUAGE"

View File

@ -338,6 +338,7 @@ MASTER_VOLUME = "Volume principal"
MUSIC_VOLUME = "Volume de la musique"
SFX_VOLUME = "Volume des effets sonores"
ENV_VOLUME = "Volume de l'environnement"
FADEOUT = "Fondu des sons distants"
[LANGUAGE]
LANGUAGE = "LANGUE"

View File

@ -338,6 +338,7 @@ MASTER_VOLUME = "Hauptlautstärke"
MUSIC_VOLUME = "Musik Lautstärke"
SFX_VOLUME = "Geräusch Lautstärke"
ENV_VOLUME = "Env Lautstärke"
FADEOUT = "Entfernte Geräusche Ausblenden"
[LANGUAGE]
LANGUAGE = "SPRACHE"

View File

@ -335,6 +335,7 @@ MASTER_VOLUME = "Principale"
MUSIC_VOLUME = "Musica"
SFX_VOLUME = "Effetti sonori"
ENV_VOLUME = "Ambiente"
FADEOUT = "Suoni lontani in dissolvenza"
[LANGUAGE]
LANGUAGE = "LINGUA"

View File

@ -338,6 +338,7 @@ MASTER_VOLUME = "Volume Geral"
MUSIC_VOLUME = "Volume da Música"
SFX_VOLUME = "Volume dos Efeitos"
ENV_VOLUME = "Volume Ambiente"
FADEOUT = "Desaparecimento do som com a distância"
[LANGUAGE]
LANGUAGE = "IDIOMA"

View File

@ -337,6 +337,7 @@ MASTER_VOLUME = "Общая громкость"
MUSIC_VOLUME = "Громкость музыки"
SFX_VOLUME = "Громкость звуков"
ENV_VOLUME = "Объёмное звучание"
FADEOUT = "Затухание далеких звуков"
[LANGUAGE]
LANGUAGE = "LANGUAGE"

View File

@ -338,6 +338,7 @@ MASTER_VOLUME = "Volumen General"
MUSIC_VOLUME = "Volumen de Música"
SFX_VOLUME = "Volumen de Efectos de Sonido"
ENV_VOLUME = "Volumen de Entorno"
FADEOUT = "Desvanecimiento de sonidos distantes"
[LANGUAGE]
LANGUAGE = "IDIOMA"

View File

@ -1264,11 +1264,15 @@ f32 get_sound_pan(f32 x, f32 z) {
* Called from threads: thread4_sound, thread5_game_loop (EU only)
*/
static f32 get_sound_volume(u8 bank, u8 soundIndex, f32 volumeRange) {
if (configFadeoutDistantSounds) {
volumeRange = 1;
}
if (bank >= SOUND_BANK_COUNT || soundIndex >= SOUND_INDEX_COUNT) { return 0; }
f32 maxSoundDistance;
f32 intensity;
f32 maxSoundDistance = AUDIO_MAX_DISTANCE;
f32 intensity = 0;
#ifndef VERSION_JP
s32 div = bank < 3 ? 2 : 3;
f32 div = (bank < 3) ? 2.0f : 3.0f;
#endif
if (!(sSoundBanks[bank][soundIndex].soundBits & SOUND_NO_VOLUME_LOSS)) {

View File

@ -158,6 +158,7 @@ bool configForce4By3 = false;
char configCoopNetIp[MAX_CONFIG_STRING] = DEFAULT_COOPNET_IP;
unsigned int configCoopNetPort = DEFAULT_COOPNET_PORT;
char configPassword[MAX_CONFIG_STRING] = "";
bool configFadeoutDistantSounds = true;
static const struct ConfigOption options[] = {
{.name = "fullscreen", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.fullscreen},
@ -268,6 +269,7 @@ static const struct ConfigOption options[] = {
{.name = "coopnet_ip", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configCoopNetIp, .maxStringLength = MAX_CONFIG_STRING},
{.name = "coopnet_port", .type = CONFIG_TYPE_UINT , .uintValue = &configCoopNetPort},
{.name = "coopnet_password", .type = CONFIG_TYPE_STRING, .stringValue = (char*)&configPassword, .maxStringLength = MAX_CONFIG_STRING},
{.name = "fade_distant_sounds", .type = CONFIG_TYPE_BOOL , .boolValue = &configFadeoutDistantSounds},
};
// FunctionConfigOption functions

View File

@ -115,6 +115,7 @@ extern bool configForce4By3;
extern char configCoopNetIp[];
extern unsigned int configCoopNetPort;
extern char configPassword[];
extern bool configFadeoutDistantSounds;
void configfile_load(void);
void configfile_save(const char *filename);

View File

@ -13,6 +13,7 @@ void djui_panel_sound_create(struct DjuiBase* caller) {
djui_slider_create(body, DLANG(SOUND, MUSIC_VOLUME), &configMusicVolume, 0, 127, NULL);
djui_slider_create(body, DLANG(SOUND, SFX_VOLUME), &configSfxVolume, 0, 127, NULL);
djui_slider_create(body, DLANG(SOUND, ENV_VOLUME), &configEnvVolume, 0, 127, NULL);
djui_checkbox_create(body, DLANG(SOUND, FADEOUT), &configFadeoutDistantSounds, NULL);
djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back);
}