forked from mirror/openmw-tes3mp
moved sound extensions from mwsound to mwscript (reduces coupling between openmw components)
This commit is contained in:
parent
d8c99c6ce3
commit
31b4d83fac
6 changed files with 69 additions and 72 deletions
|
@ -35,6 +35,7 @@ set(GAMESCRIPT
|
||||||
mwscript/cellextensions.cpp
|
mwscript/cellextensions.cpp
|
||||||
mwscript/miscextensions.cpp
|
mwscript/miscextensions.cpp
|
||||||
mwscript/guiextensions.cpp
|
mwscript/guiextensions.cpp
|
||||||
|
mwscript/soundextensions.cpp
|
||||||
mwscript/extensions.cpp
|
mwscript/extensions.cpp
|
||||||
mwscript/globalscripts.cpp
|
mwscript/globalscripts.cpp
|
||||||
)
|
)
|
||||||
|
@ -46,17 +47,16 @@ set(GAMESCRIPT_HEADER
|
||||||
mwscript/cellextensions.hpp
|
mwscript/cellextensions.hpp
|
||||||
mwscript/miscextensions.hpp
|
mwscript/miscextensions.hpp
|
||||||
mwscript/guiextensions.hpp
|
mwscript/guiextensions.hpp
|
||||||
|
mwscript/soundextensions.hpp
|
||||||
mwscript/extensions.hpp
|
mwscript/extensions.hpp
|
||||||
mwscript/globalscripts.hpp
|
mwscript/globalscripts.hpp
|
||||||
)
|
)
|
||||||
source_group(apps\\openmw\\mwscript FILES ${GAMESCRIPT} ${GAMESCRIPT_HEADER})
|
source_group(apps\\openmw\\mwscript FILES ${GAMESCRIPT} ${GAMESCRIPT_HEADER})
|
||||||
|
|
||||||
set(GAMESOUND
|
set(GAMESOUND
|
||||||
mwsound/soundmanager.cpp
|
mwsound/soundmanager.cpp)
|
||||||
mwsound/extensions.cpp)
|
|
||||||
set(GAMESOUND_HEADER
|
set(GAMESOUND_HEADER
|
||||||
mwsound/soundmanager.hpp
|
mwsound/soundmanager.hpp)
|
||||||
mwsound/extensions.hpp)
|
|
||||||
source_group(apps\\openmw\\mwsound FILES ${GAMESOUND} ${GAMESOUND_HEADER})
|
source_group(apps\\openmw\\mwsound FILES ${GAMESOUND} ${GAMESOUND_HEADER})
|
||||||
|
|
||||||
set(GAMEGUI
|
set(GAMEGUI
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
|
|
||||||
#include "extensions.hpp"
|
#include "extensions.hpp"
|
||||||
|
|
||||||
#include "../mwsound/extensions.hpp"
|
#include "soundextensions.hpp"
|
||||||
|
|
||||||
#include "cellextensions.hpp"
|
#include "cellextensions.hpp"
|
||||||
#include "miscextensions.hpp"
|
#include "miscextensions.hpp"
|
||||||
#include "guiextensions.hpp"
|
#include "guiextensions.hpp"
|
||||||
|
@ -14,7 +13,7 @@ namespace MWScript
|
||||||
Cell::registerExtensions (extensions);
|
Cell::registerExtensions (extensions);
|
||||||
Misc::registerExtensions (extensions);
|
Misc::registerExtensions (extensions);
|
||||||
Gui::registerExtensions (extensions);
|
Gui::registerExtensions (extensions);
|
||||||
MWSound::registerExtensions (extensions);
|
Sound::registerExtensions (extensions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,7 @@
|
||||||
#include <components/interpreter/installopcodes.hpp>
|
#include <components/interpreter/installopcodes.hpp>
|
||||||
#include <components/interpreter/interpreter.hpp>
|
#include <components/interpreter/interpreter.hpp>
|
||||||
|
|
||||||
#include "../mwsound/extensions.hpp"
|
#include "soundextensions.hpp"
|
||||||
|
|
||||||
#include "cellextensions.hpp"
|
#include "cellextensions.hpp"
|
||||||
#include "miscextensions.hpp"
|
#include "miscextensions.hpp"
|
||||||
#include "guiextensions.hpp"
|
#include "guiextensions.hpp"
|
||||||
|
@ -125,7 +124,7 @@ namespace MWScript
|
||||||
Cell::installOpcodes (interpreter);
|
Cell::installOpcodes (interpreter);
|
||||||
Misc::installOpcodes (interpreter);
|
Misc::installOpcodes (interpreter);
|
||||||
Gui::installOpcodes (interpreter);
|
Gui::installOpcodes (interpreter);
|
||||||
MWSound::installOpcodes (interpreter);
|
Sound::installOpcodes (interpreter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,15 +7,15 @@
|
||||||
#include <components/interpreter/runtime.hpp>
|
#include <components/interpreter/runtime.hpp>
|
||||||
#include <components/interpreter/opcodes.hpp>
|
#include <components/interpreter/opcodes.hpp>
|
||||||
|
|
||||||
#include "../mwscript/interpretercontext.hpp"
|
#include "interpretercontext.hpp"
|
||||||
|
|
||||||
#include "../mwworld/world.hpp"
|
#include "../mwworld/world.hpp"
|
||||||
|
|
||||||
#include "soundmanager.hpp"
|
#include "../mwsound/soundmanager.hpp"
|
||||||
|
|
||||||
namespace MWSound
|
namespace MWScript
|
||||||
{
|
{
|
||||||
namespace Script
|
namespace Sound
|
||||||
{
|
{
|
||||||
class OpSay : public Interpreter::Opcode0
|
class OpSay : public Interpreter::Opcode0
|
||||||
{
|
{
|
||||||
|
@ -198,39 +198,35 @@ namespace MWSound
|
||||||
const int opcodePlayLoopSound3DVP = 0x2000009;
|
const int opcodePlayLoopSound3DVP = 0x2000009;
|
||||||
const int opcodeStopSound = 0x200000a;
|
const int opcodeStopSound = 0x200000a;
|
||||||
const int opcodeGetSoundPlaying = 0x200000b;
|
const int opcodeGetSoundPlaying = 0x200000b;
|
||||||
}
|
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions)
|
void registerExtensions (Compiler::Extensions& extensions)
|
||||||
{
|
{
|
||||||
extensions.registerInstruction ("say", "SS", Script::opcodeSay);
|
extensions.registerInstruction ("say", "SS", opcodeSay);
|
||||||
extensions.registerFunction ("saydone", 'l', "", Script::opcodeSayDone);
|
extensions.registerFunction ("saydone", 'l', "", opcodeSayDone);
|
||||||
extensions.registerInstruction ("streammusic", "S", Script::opcodeStreamMusic);
|
extensions.registerInstruction ("streammusic", "S", opcodeStreamMusic);
|
||||||
extensions.registerInstruction ("playsound", "c", Script::opcodePlaySound);
|
extensions.registerInstruction ("playsound", "c", opcodePlaySound);
|
||||||
extensions.registerInstruction ("playsoundvp", "cff", Script::opcodePlaySoundVP);
|
extensions.registerInstruction ("playsoundvp", "cff", opcodePlaySoundVP);
|
||||||
extensions.registerInstruction ("playsound3d", "c", Script::opcodePlaySound3D);
|
extensions.registerInstruction ("playsound3d", "c", opcodePlaySound3D);
|
||||||
extensions.registerInstruction ("playsound3dvp", "cff", Script::opcodePlaySound3DVP);
|
extensions.registerInstruction ("playsound3dvp", "cff", opcodePlaySound3DVP);
|
||||||
extensions.registerInstruction ("playloopsound3d", "c", Script::opcodePlayLoopSound3D);
|
extensions.registerInstruction ("playloopsound3d", "c", opcodePlayLoopSound3D);
|
||||||
extensions.registerInstruction ("playloopsound3dvp", "cff",
|
extensions.registerInstruction ("playloopsound3dvp", "cff", opcodePlayLoopSound3DVP);
|
||||||
Script::opcodePlayLoopSound3DVP);
|
extensions.registerInstruction ("stopsound", "c", opcodeStopSound);
|
||||||
extensions.registerInstruction ("stopsound", "c", Script::opcodeStopSound);
|
extensions.registerFunction ("getsoundplaying", 'l', "c", opcodeGetSoundPlaying);
|
||||||
extensions.registerFunction ("getsoundplaying", 'l', "c", Script::opcodeGetSoundPlaying);
|
}
|
||||||
}
|
|
||||||
|
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
{
|
||||||
{
|
interpreter.installSegment5 (opcodeSay, new OpSay);
|
||||||
interpreter.installSegment5 (Script::opcodeSay, new Script::OpSay);
|
interpreter.installSegment5 (opcodeSayDone, new OpSayDone);
|
||||||
interpreter.installSegment5 (Script::opcodeSayDone, new Script::OpSayDone);
|
interpreter.installSegment5 (opcodeStreamMusic, new OpStreamMusic);
|
||||||
interpreter.installSegment5 (Script::opcodeStreamMusic, new Script::OpStreamMusic);
|
interpreter.installSegment5 (opcodePlaySound, new OpPlaySound);
|
||||||
interpreter.installSegment5 (Script::opcodePlaySound, new Script::OpPlaySound);
|
interpreter.installSegment5 (opcodePlaySoundVP, new OpPlaySoundVP);
|
||||||
interpreter.installSegment5 (Script::opcodePlaySoundVP, new Script::OpPlaySoundVP);
|
interpreter.installSegment5 (opcodePlaySound3D, new OpPlaySound3D (false));
|
||||||
interpreter.installSegment5 (Script::opcodePlaySound3D, new Script::OpPlaySound3D (false));
|
interpreter.installSegment5 (opcodePlaySound3DVP, new OpPlaySoundVP3D (false));
|
||||||
interpreter.installSegment5 (Script::opcodePlaySound3DVP,
|
interpreter.installSegment5 (opcodePlayLoopSound3D, new OpPlaySound3D (true));
|
||||||
new Script::OpPlaySoundVP3D (false));
|
interpreter.installSegment5 (opcodePlayLoopSound3DVP, new OpPlaySoundVP3D (true));
|
||||||
interpreter.installSegment5 (Script::opcodePlayLoopSound3D,
|
interpreter.installSegment5 (opcodeStopSound, new OpStopSound);
|
||||||
new Script::OpPlaySound3D (true));
|
interpreter.installSegment5 (opcodeGetSoundPlaying, new OpGetSoundPlaying);
|
||||||
interpreter.installSegment5 (Script::opcodePlayLoopSound3DVP,
|
}
|
||||||
new Script::OpPlaySoundVP3D (true));
|
}
|
||||||
interpreter.installSegment5 (Script::opcodeStopSound, new Script::OpStopSound);
|
|
||||||
interpreter.installSegment5 (Script::opcodeGetSoundPlaying, new Script::OpGetSoundPlaying);
|
|
||||||
}
|
|
||||||
}
|
}
|
27
apps/openmw/mwscript/soundextensions.hpp
Normal file
27
apps/openmw/mwscript/soundextensions.hpp
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#ifndef GAME_SCRIPT_SOUNDEXTENSIONS_H
|
||||||
|
#define GAME_SCRIPT_SOUNDEXTENSIONS_H
|
||||||
|
|
||||||
|
namespace Compiler
|
||||||
|
{
|
||||||
|
class Extensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Interpreter
|
||||||
|
{
|
||||||
|
class Interpreter;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace MWScript
|
||||||
|
{
|
||||||
|
namespace Sound
|
||||||
|
{
|
||||||
|
// Script-extensions related to sound
|
||||||
|
|
||||||
|
void registerExtensions (Compiler::Extensions& extensions);
|
||||||
|
|
||||||
|
void installOpcodes (Interpreter::Interpreter& interpreter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
#ifndef GAME_SOUND_EXTENSIONS_H
|
|
||||||
#define GAME_SOUND_EXTENSIONS_H
|
|
||||||
|
|
||||||
namespace Compiler
|
|
||||||
{
|
|
||||||
class Extensions;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Interpreter
|
|
||||||
{
|
|
||||||
class Interpreter;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWSound
|
|
||||||
{
|
|
||||||
// Script-extensions related to sound
|
|
||||||
|
|
||||||
void registerExtensions (Compiler::Extensions& extensions);
|
|
||||||
|
|
||||||
void installOpcodes (Interpreter::Interpreter& interpreter);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
Loading…
Reference in a new issue