moved sound extensions from mwsound to mwscript (reduces coupling between openmw components)

actorid
Marc Zinnschlag 15 years ago
parent d8c99c6ce3
commit 31b4d83fac

@ -35,6 +35,7 @@ set(GAMESCRIPT
mwscript/cellextensions.cpp
mwscript/miscextensions.cpp
mwscript/guiextensions.cpp
mwscript/soundextensions.cpp
mwscript/extensions.cpp
mwscript/globalscripts.cpp
)
@ -46,17 +47,16 @@ set(GAMESCRIPT_HEADER
mwscript/cellextensions.hpp
mwscript/miscextensions.hpp
mwscript/guiextensions.hpp
mwscript/soundextensions.hpp
mwscript/extensions.hpp
mwscript/globalscripts.hpp
)
source_group(apps\\openmw\\mwscript FILES ${GAMESCRIPT} ${GAMESCRIPT_HEADER})
set(GAMESOUND
mwsound/soundmanager.cpp
mwsound/extensions.cpp)
mwsound/soundmanager.cpp)
set(GAMESOUND_HEADER
mwsound/soundmanager.hpp
mwsound/extensions.hpp)
mwsound/soundmanager.hpp)
source_group(apps\\openmw\\mwsound FILES ${GAMESOUND} ${GAMESOUND_HEADER})
set(GAMEGUI

@ -1,8 +1,7 @@
#include "extensions.hpp"
#include "../mwsound/extensions.hpp"
#include "soundextensions.hpp"
#include "cellextensions.hpp"
#include "miscextensions.hpp"
#include "guiextensions.hpp"
@ -14,7 +13,7 @@ namespace MWScript
Cell::registerExtensions (extensions);
Misc::registerExtensions (extensions);
Gui::registerExtensions (extensions);
MWSound::registerExtensions (extensions);
Sound::registerExtensions (extensions);
}
}

@ -15,8 +15,7 @@
#include <components/interpreter/installopcodes.hpp>
#include <components/interpreter/interpreter.hpp>
#include "../mwsound/extensions.hpp"
#include "soundextensions.hpp"
#include "cellextensions.hpp"
#include "miscextensions.hpp"
#include "guiextensions.hpp"
@ -125,7 +124,7 @@ namespace MWScript
Cell::installOpcodes (interpreter);
Misc::installOpcodes (interpreter);
Gui::installOpcodes (interpreter);
MWSound::installOpcodes (interpreter);
Sound::installOpcodes (interpreter);
}
}

@ -7,15 +7,15 @@
#include <components/interpreter/runtime.hpp>
#include <components/interpreter/opcodes.hpp>
#include "../mwscript/interpretercontext.hpp"
#include "interpretercontext.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
{
@ -198,39 +198,35 @@ namespace MWSound
const int opcodePlayLoopSound3DVP = 0x2000009;
const int opcodeStopSound = 0x200000a;
const int opcodeGetSoundPlaying = 0x200000b;
}
void registerExtensions (Compiler::Extensions& extensions)
{
extensions.registerInstruction ("say", "SS", Script::opcodeSay);
extensions.registerFunction ("saydone", 'l', "", Script::opcodeSayDone);
extensions.registerInstruction ("streammusic", "S", Script::opcodeStreamMusic);
extensions.registerInstruction ("playsound", "c", Script::opcodePlaySound);
extensions.registerInstruction ("playsoundvp", "cff", Script::opcodePlaySoundVP);
extensions.registerInstruction ("playsound3d", "c", Script::opcodePlaySound3D);
extensions.registerInstruction ("playsound3dvp", "cff", Script::opcodePlaySound3DVP);
extensions.registerInstruction ("playloopsound3d", "c", Script::opcodePlayLoopSound3D);
extensions.registerInstruction ("playloopsound3dvp", "cff",
Script::opcodePlayLoopSound3DVP);
extensions.registerInstruction ("stopsound", "c", Script::opcodeStopSound);
extensions.registerFunction ("getsoundplaying", 'l', "c", Script::opcodeGetSoundPlaying);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
{
interpreter.installSegment5 (Script::opcodeSay, new Script::OpSay);
interpreter.installSegment5 (Script::opcodeSayDone, new Script::OpSayDone);
interpreter.installSegment5 (Script::opcodeStreamMusic, new Script::OpStreamMusic);
interpreter.installSegment5 (Script::opcodePlaySound, new Script::OpPlaySound);
interpreter.installSegment5 (Script::opcodePlaySoundVP, new Script::OpPlaySoundVP);
interpreter.installSegment5 (Script::opcodePlaySound3D, new Script::OpPlaySound3D (false));
interpreter.installSegment5 (Script::opcodePlaySound3DVP,
new Script::OpPlaySoundVP3D (false));
interpreter.installSegment5 (Script::opcodePlayLoopSound3D,
new Script::OpPlaySound3D (true));
interpreter.installSegment5 (Script::opcodePlayLoopSound3DVP,
new Script::OpPlaySoundVP3D (true));
interpreter.installSegment5 (Script::opcodeStopSound, new Script::OpStopSound);
interpreter.installSegment5 (Script::opcodeGetSoundPlaying, new Script::OpGetSoundPlaying);
}
void registerExtensions (Compiler::Extensions& extensions)
{
extensions.registerInstruction ("say", "SS", opcodeSay);
extensions.registerFunction ("saydone", 'l', "", opcodeSayDone);
extensions.registerInstruction ("streammusic", "S", opcodeStreamMusic);
extensions.registerInstruction ("playsound", "c", opcodePlaySound);
extensions.registerInstruction ("playsoundvp", "cff", opcodePlaySoundVP);
extensions.registerInstruction ("playsound3d", "c", opcodePlaySound3D);
extensions.registerInstruction ("playsound3dvp", "cff", opcodePlaySound3DVP);
extensions.registerInstruction ("playloopsound3d", "c", opcodePlayLoopSound3D);
extensions.registerInstruction ("playloopsound3dvp", "cff", opcodePlayLoopSound3DVP);
extensions.registerInstruction ("stopsound", "c", opcodeStopSound);
extensions.registerFunction ("getsoundplaying", 'l', "c", opcodeGetSoundPlaying);
}
void installOpcodes (Interpreter::Interpreter& interpreter)
{
interpreter.installSegment5 (opcodeSay, new OpSay);
interpreter.installSegment5 (opcodeSayDone, new OpSayDone);
interpreter.installSegment5 (opcodeStreamMusic, new OpStreamMusic);
interpreter.installSegment5 (opcodePlaySound, new OpPlaySound);
interpreter.installSegment5 (opcodePlaySoundVP, new OpPlaySoundVP);
interpreter.installSegment5 (opcodePlaySound3D, new OpPlaySound3D (false));
interpreter.installSegment5 (opcodePlaySound3DVP, new OpPlaySoundVP3D (false));
interpreter.installSegment5 (opcodePlayLoopSound3D, new OpPlaySound3D (true));
interpreter.installSegment5 (opcodePlayLoopSound3DVP, new OpPlaySoundVP3D (true));
interpreter.installSegment5 (opcodeStopSound, new OpStopSound);
interpreter.installSegment5 (opcodeGetSoundPlaying, new OpGetSoundPlaying);
}
}
}

@ -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…
Cancel
Save