mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 17:29:11 +00:00
AGS: Fix loading sound effects in AGSWaves
This commit is contained in:
parent
3c616e3edc
commit
f9bc18c58a
@ -232,6 +232,10 @@ bool AGSEngine::is64BitGame() const {
|
||||
&& f.size() == -1;
|
||||
}
|
||||
|
||||
Common::FSNode AGSEngine::getGameFolder() {
|
||||
return Common::FSNode(ConfMan.get("path"));
|
||||
}
|
||||
|
||||
bool AGSEngine::canLoadGameStateCurrently() {
|
||||
return !_GP(thisroom).Options.SaveLoadDisabled &&
|
||||
!_G(inside_script) && !_GP(play).fast_forward && !_G(no_blocking_functions);
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "common/scummsys.h"
|
||||
#include "common/system.h"
|
||||
#include "common/error.h"
|
||||
#include "common/fs.h"
|
||||
#include "common/random.h"
|
||||
#include "common/hash-str.h"
|
||||
#include "common/util.h"
|
||||
@ -141,6 +142,11 @@ public:
|
||||
*/
|
||||
bool is64BitGame() const;
|
||||
|
||||
/**
|
||||
* Returns the game folder as a ScummVM filesystem node
|
||||
*/
|
||||
Common::FSNode getGameFolder();
|
||||
|
||||
/**
|
||||
* Indicate whether a game state can be loaded.
|
||||
*/
|
||||
|
@ -20,11 +20,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "audio/decoders/wave.h"
|
||||
#include "audio/decoders/vorbis.h"
|
||||
#include "common/file.h"
|
||||
#include "common/fs.h"
|
||||
#include "common/util.h"
|
||||
#include "ags/plugins/ags_waves/ags_waves.h"
|
||||
#include "ags/ags.h"
|
||||
|
||||
namespace AGS3 {
|
||||
namespace Plugins {
|
||||
@ -192,16 +193,16 @@ void AGSWaves::SFX_Filter(ScriptMethodParams ¶ms) {
|
||||
|
||||
|
||||
void AGSWaves::LoadSFX(int i) {
|
||||
Common::FSNode soundsFolder("sounds");
|
||||
Common::FSNode soundFileNode = soundsFolder.getChild(
|
||||
Common::String::format("sound%d.sfx", i));
|
||||
Common::FSNode fsNode = ::AGS::g_vm->getGameFolder().getChild(
|
||||
"sounds").getChild(Common::String::format("sound%d.sfx", i));
|
||||
|
||||
Common::File *soundFile = new Common::File();
|
||||
if (soundFile->open(soundFileNode)) {
|
||||
SFX[i]._stream = Audio::makeWAVStream(soundFile, DisposeAfterUse::YES);
|
||||
if (fsNode.exists()) {
|
||||
Common::File *soundFile = new Common::File();
|
||||
if (!soundFile->open(fsNode))
|
||||
error("Failed to open");
|
||||
|
||||
} else {
|
||||
delete soundFile;
|
||||
SFX[i]._stream = Audio::makeVorbisStream(soundFile, DisposeAfterUse::YES);
|
||||
assert(SFX[i]._stream);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user