OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
sounddefinitions.cpp
Go to the documentation of this file.
1
#include "
sounddefinitions.h
"
2
3
#include <Tempest/Log>
4
#include <
gothic.h
>
5
6
using namespace
Tempest;
7
8
SoundDefinitions::SoundDefinitions
() {
9
auto
vm =
Gothic::inst
().
createPhoenixVm
(
"Sfx.dat"
);
10
11
vm->enumerate_instances_by_class_name(
"C_SFX"
, [
this
, &vm](zenkit::DaedalusSymbol& s) {
12
try
{
13
this->sfx[s.name()] = vm->init_instance<zenkit::ISoundEffect>(&s);
14
}
15
catch
(
const
zenkit::DaedalusScriptError&) {
16
// There was an error during initialization. Ignore it.
17
}
18
});
19
}
20
21
const
zenkit::ISoundEffect&
SoundDefinitions::operator[]
(std::string_view name)
const
{
22
std::string buf(name);
// FIXME
23
auto
i = sfx.find(buf);
24
if
(i!=sfx.end())
25
return
*i->second;
26
static
const
zenkit::ISoundEffect s {};
27
return
s;
28
}
29
Gothic::inst
static Gothic & inst()
Definition
gothic.cpp:249
Gothic::createPhoenixVm
std::unique_ptr< zenkit::DaedalusVm > createPhoenixVm(std::string_view datFile, const ScriptLang lang=ScriptLang::NONE)
Definition
gothic.cpp:711
SoundDefinitions::operator[]
const zenkit::ISoundEffect & operator[](std::string_view name) const
Definition
sounddefinitions.cpp:21
SoundDefinitions::SoundDefinitions
SoundDefinitions()
Definition
sounddefinitions.cpp:8
gothic.h
sounddefinitions.h
game
game
definitions
sounddefinitions.cpp
Generated by
1.9.8