Sound Fixes (#686)
* Fix sound settings not applying * Reimplement miles sound artifacts * Fix stone brick stairs recipe * Fix craft and scroll sound * Rename scrollfocus.ogg to scroll.ogg * Remove unneeded code * Reorganize sounds, revert spam sound press, add witch sounds and fix slimes * I forgot my console again
This commit is contained in:
@@ -187,7 +187,7 @@ void SoundEngine::init(Options* pOptions)
|
||||
m_bSystemMusicPlaying = false;
|
||||
|
||||
app.DebugPrintf("---miniaudio initialized\n");
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,6 @@ void SoundEngine::updateMiniAudio()
|
||||
finalVolume = 1.0f;
|
||||
|
||||
ma_sound_set_volume(&s->sound, finalVolume);
|
||||
|
||||
ma_sound_set_pitch(&s->sound, s->info.pitch);
|
||||
|
||||
if (s->info.bIs3D)
|
||||
@@ -471,67 +470,64 @@ void SoundEngine::play(int iSound, float x, float y, float z, float volume, floa
|
||||
char finalPath[256];
|
||||
sprintf_s(finalPath, "%s.wav", basePath);
|
||||
|
||||
if (!FileExists(finalPath))
|
||||
{
|
||||
int count = 0;
|
||||
const char* extensions[] = { ".ogg", ".wav", ".mp3" };
|
||||
size_t extCount = sizeof(extensions) / sizeof(extensions[0]);
|
||||
bool found = false;
|
||||
|
||||
for (size_t i = 1; i < 32; i++)
|
||||
{
|
||||
char numberedFolder[256];
|
||||
sprintf_s(numberedFolder, "%s%d", basePath, i);
|
||||
|
||||
DWORD attr = GetFileAttributesA(numberedFolder);
|
||||
|
||||
if (attr != INVALID_FILE_ATTRIBUTES &&
|
||||
(attr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char chosenFolder[256];
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
sprintf_s(chosenFolder, "%s", basePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
int chosen = (rand() % count) + 1;
|
||||
sprintf_s(chosenFolder, "%s%d", basePath, chosen);
|
||||
}
|
||||
|
||||
char searchPattern[256];
|
||||
sprintf_s(searchPattern, "%s\\*.wav", chosenFolder);
|
||||
|
||||
WIN32_FIND_DATAA findData;
|
||||
HANDLE hFind = FindFirstFileA(searchPattern, &findData);
|
||||
|
||||
const char* extensions[] = { ".ogg", ".wav", ".mp3" };
|
||||
size_t extCount = sizeof(extensions) / sizeof(extensions[0]);
|
||||
bool found = false;
|
||||
for (size_t i = 0; i < extCount; i++)
|
||||
for (size_t extIdx = 0; extIdx < extCount; extIdx++)
|
||||
{
|
||||
char basePlusExt[256];
|
||||
sprintf_s(basePlusExt, "%s%s", basePath, extensions[extIdx]);
|
||||
|
||||
DWORD attr = GetFileAttributesA(basePlusExt);
|
||||
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
sprintf_s(searchPattern, "%s\\*%s", chosenFolder, extensions[i]);
|
||||
hFind = FindFirstFileA(searchPattern, &findData);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
sprintf_s(finalPath, "%s", basePlusExt);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (size_t extIdx = 0; extIdx < extCount; extIdx++)
|
||||
{
|
||||
for (size_t i = 1; i < 32; i++)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
char numberedPath[256];
|
||||
sprintf_s(numberedPath, "%s%d%s", basePath, i, extensions[extIdx]);
|
||||
|
||||
DWORD attr = GetFileAttributesA(numberedPath);
|
||||
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
count = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
app.DebugPrintf("No sound files found in %s\n", chosenFolder);
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf_s(finalPath, "%s\\%s", chosenFolder, findData.cFileName);
|
||||
FindClose(hFind);
|
||||
if (count > 0)
|
||||
{
|
||||
int chosen = (rand() % count) + 1;
|
||||
for (size_t extIdx = 0; extIdx < extCount; extIdx++)
|
||||
{
|
||||
char numberedPath[256];
|
||||
sprintf_s(numberedPath, "%s%d%s", basePath, chosen, extensions[extIdx]);
|
||||
|
||||
DWORD attr = GetFileAttributesA(numberedPath);
|
||||
if (attr != INVALID_FILE_ATTRIBUTES && !(attr & FILE_ATTRIBUTE_DIRECTORY))
|
||||
{
|
||||
sprintf_s(finalPath, "%s", numberedPath);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
sprintf_s(finalPath, "%s%d.wav", basePath, chosen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MiniAudioSound* s = new MiniAudioSound();
|
||||
@@ -649,6 +645,7 @@ void SoundEngine::playUI(int iSound, float volume, float pitch)
|
||||
float finalVolume = volume * m_MasterEffectsVolume;
|
||||
if (finalVolume > 1.0f)
|
||||
finalVolume = 1.0f;
|
||||
printf("UI Sound volume set to %f\nEffects volume: %f\n", finalVolume, m_MasterEffectsVolume);
|
||||
|
||||
ma_sound_set_volume(&s->sound, finalVolume);
|
||||
ma_sound_set_pitch(&s->sound, pitch);
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
|
||||
const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
|
||||
{
|
||||
L"mob.chicken", // eSoundType_MOB_CHICKEN_AMBIENT
|
||||
L"mob.chickenhurt", // eSoundType_MOB_CHICKEN_HURT
|
||||
L"mob.chickenplop", // eSoundType_MOB_CHICKENPLOP
|
||||
L"mob.cow", // eSoundType_MOB_COW_AMBIENT
|
||||
L"mob.cowhurt", // eSoundType_MOB_COW_HURT
|
||||
L"mob.pig", // eSoundType_MOB_PIG_AMBIENT
|
||||
L"mob.pigdeath", // eSoundType_MOB_PIG_DEATH
|
||||
L"mob.sheep", // eSoundType_MOB_SHEEP_AMBIENT
|
||||
L"mob.chicken.say", // eSoundType_MOB_CHICKEN_AMBIENT
|
||||
L"mob.chicken.hurt", // eSoundType_MOB_CHICKEN_HURT
|
||||
L"mob.chicken.plop", // eSoundType_MOB_CHICKENPLOP
|
||||
L"mob.cow.say", // eSoundType_MOB_COW_AMBIENT
|
||||
L"mob.cow.hurt", // eSoundType_MOB_COW_HURT
|
||||
L"mob.pig.say", // eSoundType_MOB_PIG_AMBIENT
|
||||
L"mob.pig.death", // eSoundType_MOB_PIG_DEATH
|
||||
L"mob.sheep.say", // eSoundType_MOB_SHEEP_AMBIENT
|
||||
L"mob.wolf.growl", // eSoundType_MOB_WOLF_GROWL
|
||||
L"mob.wolf.whine", // eSoundType_MOB_WOLF_WHINE
|
||||
L"mob.wolf.panting", // eSoundType_MOB_WOLF_PANTING
|
||||
@@ -43,15 +43,15 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
|
||||
L"mob.silverfish.step", // eSoundType_MOB_SILVERFISH_STEP,
|
||||
L"mob.skeleton", // eSoundType_MOB_SKELETON_AMBIENT,
|
||||
L"mob.skeletonhurt", // eSoundType_MOB_SKELETON_HURT,
|
||||
L"mob.spider", // eSoundType_MOB_SPIDER_AMBIENT,
|
||||
L"mob.spiderdeath", // eSoundType_MOB_SPIDER_DEATH,
|
||||
L"mob.spider.say", // eSoundType_MOB_SPIDER_AMBIENT,
|
||||
L"mob.spider.death", // eSoundType_MOB_SPIDER_DEATH,
|
||||
L"mob.slime", // eSoundType_MOB_SLIME,
|
||||
L"mob.slimeattack", // eSoundType_MOB_SLIME_ATTACK,
|
||||
L"mob.creeper", // eSoundType_MOB_CREEPER_HURT,
|
||||
L"mob.creeperdeath", // eSoundType_MOB_CREEPER_DEATH,
|
||||
L"mob.zombie", // eSoundType_MOB_ZOMBIE_AMBIENT,
|
||||
L"mob.zombiehurt", // eSoundType_MOB_ZOMBIE_HURT,
|
||||
L"mob.zombiedeath", // eSoundType_MOB_ZOMBIE_DEATH,
|
||||
L"mob.slime.attack", // eSoundType_MOB_SLIME_ATTACK,
|
||||
L"mob.creeper.say", // eSoundType_MOB_CREEPER_HURT,
|
||||
L"mob.creeper.death", // eSoundType_MOB_CREEPER_DEATH,
|
||||
L"mob.zombie.say", // eSoundType_MOB_ZOMBIE_AMBIENT,
|
||||
L"mob.zombie.hurt", // eSoundType_MOB_ZOMBIE_HURT,
|
||||
L"mob.zombie.death", // eSoundType_MOB_ZOMBIE_DEATH,
|
||||
L"mob.zombie.wood", // eSoundType_MOB_ZOMBIE_WOOD,
|
||||
L"mob.zombie.woodbreak", // eSoundType_MOB_ZOMBIE_WOOD_BREAK,
|
||||
L"mob.zombie.metal", // eSoundType_MOB_ZOMBIE_METAL,
|
||||
@@ -86,7 +86,7 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
|
||||
L"random.door_close", // eSoundType_RANDOM_DOOR_CLOSE,
|
||||
L"ambient.weather.rain", // eSoundType_AMBIENT_WEATHER_RAIN,
|
||||
L"ambient.weather.thunder", // eSoundType_AMBIENT_WEATHER_THUNDER,
|
||||
L"ambient.cave.cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!!
|
||||
L"ambient.cave", // eSoundType_CAVE_CAVE, DON'T USE FOR XBOX 360!!!
|
||||
#ifdef _XBOX
|
||||
L"ambient.cave.cave2", // eSoundType_CAVE_CAVE2 - removed the two sounds that were at 192k in the first ambient cave event
|
||||
#endif
|
||||
@@ -210,9 +210,9 @@ const WCHAR *ConsoleSoundEngine::wchSoundNames[eSoundType_MAX]=
|
||||
L"mob.horse.soft", //eSoundType_MOB_HORSE_SOFT,
|
||||
L"mob.horse.jump", //eSoundType_MOB_HORSE_JUMP,
|
||||
|
||||
L"mob.witch.idle", //eSoundType_MOB_WITCH_IDLE, <--- missing
|
||||
L"mob.witch.hurt", //eSoundType_MOB_WITCH_HURT, <--- missing
|
||||
L"mob.witch.death", //eSoundType_MOB_WITCH_DEATH, <--- missing
|
||||
L"mob.witch.ambient", //eSoundType_MOB_WITCH_IDLE,
|
||||
L"mob.witch.hurt", //eSoundType_MOB_WITCH_HURT,
|
||||
L"mob.witch.death", //eSoundType_MOB_WITCH_DEATH,
|
||||
|
||||
L"mob.slime.big", //eSoundType_MOB_SLIME_BIG,
|
||||
L"mob.slime.small", //eSoundType_MOB_SLIME_SMALL,
|
||||
|
||||
@@ -1379,8 +1379,8 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
||||
{
|
||||
int currentIndex = getCurrentIndex(m_eCurrSection) - getSectionStartOffset(m_eCurrSection);
|
||||
|
||||
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
|
||||
if (bSlotHasItem)
|
||||
bool bcanPlaySound = !isSlotEmpty(m_eCurrSection, currentIndex);
|
||||
if (bcanPlaySound)
|
||||
ui.PlayUISFX(eSFX_Press);
|
||||
}
|
||||
}
|
||||
@@ -1390,8 +1390,8 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
||||
{
|
||||
int currentIndex = getCurrentIndex(m_eCurrSection) - getSectionStartOffset(m_eCurrSection);
|
||||
|
||||
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
|
||||
if (bSlotHasItem)
|
||||
bool bcanPlaySound = !isSlotEmpty(m_eCurrSection, currentIndex);
|
||||
if (bcanPlaySound)
|
||||
ui.PlayUISFX(eSFX_Press);
|
||||
}
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user