mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-18 16:32:32 +02:00
Sound as ScriptType
This commit is contained in:
parent
4119afbae3
commit
1b1b924d8f
@ -239,6 +239,15 @@ ScriptObjectType<Payphone> ScriptArguments::getScriptObject(
|
||||
}
|
||||
return {param.handleValue(), payphone};
|
||||
}
|
||||
|
||||
template <>
|
||||
ScriptObjectType<Sound> ScriptArguments::getScriptObject(
|
||||
unsigned int arg) const {
|
||||
auto& param = (*this)[arg];
|
||||
RW_CHECK(param.isLvalue(), "Non lvalue passed as object");
|
||||
return {param.handleValue(), &getWorld()->sound.getSoundRef(arg)};
|
||||
}
|
||||
|
||||
template <>
|
||||
ScriptObjectType<BlipData> ScriptArguments::getScriptObject(
|
||||
unsigned int arg) const {
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include <rw/debug.hpp>
|
||||
|
||||
#include "audio/Sound.hpp"
|
||||
#include "engine/Garage.hpp"
|
||||
|
||||
class CharacterObject;
|
||||
@ -109,9 +110,9 @@ struct BlipData;
|
||||
using ScriptVehicleGenerator = ScriptObjectType<VehicleGenerator>;
|
||||
using ScriptBlip = ScriptObjectType<BlipData>;
|
||||
using ScriptPayphone = ScriptObjectType<Payphone>;
|
||||
using ScriptSound = ScriptObjectType<Sound>;
|
||||
|
||||
/// @todo replace these with real types for sounds etc.
|
||||
using ScriptSound = ScriptObjectType<int>;
|
||||
/// @todo replace these with real types
|
||||
using ScriptFire = ScriptObjectType<int>;
|
||||
using ScriptSphere = ScriptObjectType<int>;
|
||||
|
||||
@ -349,6 +350,9 @@ ScriptObjectType<VehicleGenerator> ScriptArguments::getScriptObject(
|
||||
template <>
|
||||
ScriptObjectType<Garage> ScriptArguments::getScriptObject(
|
||||
unsigned int arg) const;
|
||||
template <>
|
||||
ScriptObjectType<Sound> ScriptArguments::getScriptObject(
|
||||
unsigned int arg) const;
|
||||
|
||||
typedef std::function<void(const ScriptArguments&)> ScriptFunction;
|
||||
typedef std::function<bool(const ScriptArguments&)> ScriptFunctionBoolean;
|
||||
|
Loading…
Reference in New Issue
Block a user