xoreos
0.0.5
src
engines
kotor2
script
functions_sound.cpp
Go to the documentation of this file.
1
/* xoreos - A reimplementation of BioWare's Aurora engine
2
*
3
* xoreos is the legal property of its developers, whose names
4
* can be found in the AUTHORS file distributed with this source
5
* distribution.
6
*
7
* xoreos is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 3
10
* of the License, or (at your option) any later version.
11
*
12
* xoreos is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
25
#include "
src/aurora/nwscript/functioncontext.h
"
26
27
#include "
src/engines/kotor2/objectcontainer.h
"
28
#include "
src/engines/kotor2/object.h
"
29
#include "
src/engines/kotor2/area.h
"
30
31
#include "
src/engines/kotor2/script/functions.h
"
32
33
namespace
Engines
{
34
35
namespace
KotOR2 {
36
37
void
Functions::musicBackgroundPlay
(
Aurora::NWScript::FunctionContext
&ctx) {
38
Area
*area =
KotOR2::ObjectContainer::toArea
(
getParamObject
(ctx, 0));
39
if
(area)
40
area->
playAmbientMusic
();
41
}
42
43
void
Functions::musicBackgroundStop
(
Aurora::NWScript::FunctionContext
&ctx) {
44
Area
*area =
KotOR2::ObjectContainer::toArea
(
getParamObject
(ctx, 0));
45
if
(area)
46
area->
stopAmbientMusic
();
47
}
48
49
void
Functions::musicBackgroundChangeDay
(
Aurora::NWScript::FunctionContext
&ctx) {
50
Area
*area =
KotOR2::ObjectContainer::toArea
(
getParamObject
(ctx, 0));
51
if
(area)
52
area->
setMusicDayTrack
(ctx.
getParams
()[1].getInt());
53
}
54
55
void
Functions::musicBackgroundChangeNight
(
Aurora::NWScript::FunctionContext
&ctx) {
56
Area
*area =
KotOR2::ObjectContainer::toArea
(
getParamObject
(ctx, 0));
57
if
(area)
58
area->
setMusicNightTrack
(ctx.
getParams
()[1].getInt());
59
}
60
61
void
Functions::musicBackgroundGetDayTrack
(
Aurora::NWScript::FunctionContext
&ctx) {
62
Area
*area =
KotOR2::ObjectContainer::toArea
(
getParamObject
(ctx, 0));
63
64
ctx.
getReturn
() = area ? (
int32
)area->
getMusicDayTrack
() : -1;
65
}
66
67
void
Functions::musicBackgroundGetNightTrack
(
Aurora::NWScript::FunctionContext
&ctx) {
68
Area
*area =
KotOR2::ObjectContainer::toArea
(
getParamObject
(ctx, 0));
69
70
ctx.
getReturn
() = area ? (
int32
)area->
getMusicNightTrack
() : -1;
71
}
72
73
}
// End of namespace KotOR2
74
75
}
// End of namespace Engines
Engines::KotOR2::Functions::musicBackgroundPlay
void musicBackgroundPlay(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_sound.cpp:37
Engines::KotOR2::Functions::musicBackgroundGetDayTrack
void musicBackgroundGetDayTrack(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_sound.cpp:61
objectcontainer.h
A container of Star Wars: Knights of the Old Republic II - The Sith Lords objects.
functioncontext.h
Context of an NWScript function.
Engines::KotOR2::Area::setMusicNightTrack
void setMusicNightTrack(uint32 track)
Set the music track ID playing by night.
Definition:
area.cpp:136
area.h
The context holding a Star Wars: Knights of the Old Republic II - The Sith Lords area.
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
object.h
An object in a Star Wars: Knights of the Old Republic II - The Sith Lords area.
Engines::KotOR2::Area::setMusicDayTrack
void setMusicDayTrack(uint32 track)
Set the music track ID playing by day.
Definition:
area.cpp:131
functions.h
Star Wars: Knights of the Old Republic II - The Sith Lords engine functions.
Engines::KotOR2::Area::stopAmbientMusic
void stopAmbientMusic()
Stop the ambient music.
Definition:
area.cpp:168
Engines::KotOR2::Area::getMusicDayTrack
uint32 getMusicDayTrack() const
Return the music track ID playing by day.
Definition:
area.cpp:119
Engines
Definition:
console.cpp:69
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
Engines::KotOR2::Functions::musicBackgroundChangeNight
void musicBackgroundChangeNight(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_sound.cpp:55
Engines::KotOR2::Functions::getParamObject
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
Definition:
functions.cpp:115
Engines::KotOR2::Functions::musicBackgroundGetNightTrack
void musicBackgroundGetNightTrack(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_sound.cpp:67
Engines::KotOR2::Area::playAmbientMusic
void playAmbientMusic(Common::UString music="")
Play the specified music (or the area's default) as ambient music.
Definition:
area.cpp:176
Engines::KotOR2::Functions::musicBackgroundChangeDay
void musicBackgroundChangeDay(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_sound.cpp:49
Aurora::NWScript::FunctionContext::getReturn
Variable & getReturn()
Definition:
functioncontext.cpp:143
Engines::KotOR2::Area::getMusicNightTrack
uint32 getMusicNightTrack() const
Return the music track ID playing by night.
Definition:
area.cpp:123
Engines::KotOR2::ObjectContainer::toArea
static Area * toArea(Aurora::NWScript::Object *object)
Definition:
objectcontainer.cpp:132
Engines::KotOR2::Area
An area in Star Wars: Knights of the Old Republic II - The Sith Lords, holding all objects and rooms ...
Definition:
area.h:64
Engines::KotOR2::Functions::musicBackgroundStop
void musicBackgroundStop(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_sound.cpp:43
int32
int32_t int32
Definition:
types.h:203
Generated on Sun Nov 18 2018 15:13:40 for xoreos by
1.8.14