xoreos
0.0.5
src
engines
nwn2
script
functions_conversation.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/common/util.h
"
26
27
#include "
src/aurora/talkman.h
"
28
29
#include "
src/aurora/nwscript/functioncontext.h
"
30
31
#include "
src/engines/nwn2/game.h
"
32
#include "
src/engines/nwn2/module.h
"
33
#include "
src/engines/nwn2/objectcontainer.h
"
34
#include "
src/engines/nwn2/object.h
"
35
36
#include "
src/engines/nwn2/script/functions.h
"
37
38
namespace
Engines
{
39
40
namespace
NWN2 {
41
42
void
Functions::speakString
(
Aurora::NWScript::FunctionContext
&ctx) {
43
NWN2::Object
*
object
=
NWN2::ObjectContainer::toObject
(ctx.
getCaller
());
44
45
if
(
object
)
46
object
->
speakString
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getInt());
47
}
48
49
void
Functions::speakStringByStrRef
(
Aurora::NWScript::FunctionContext
&ctx) {
50
NWN2::Object
*
object
=
NWN2::ObjectContainer::toObject
(ctx.
getCaller
());
51
if
(!
object
)
52
return
;
53
54
// TODO: Volume
55
const
uint32
strRef = (
uint32
) ctx.
getParams
()[0].getInt();
56
const
uint32
volume = (
uint32
) ctx.
getParams
()[1].getInt();
57
58
object
->speakString(
TalkMan
.getString(strRef).c_str(), volume);
59
}
60
61
void
Functions::speakOneLinerConversation
(
Aurora::NWScript::FunctionContext
&ctx) {
62
NWN2::Object
*
object
=
NWN2::ObjectContainer::toObject
(ctx.
getCaller
());
63
if
(!
object
)
64
return
;
65
66
const
Common::UString
&dlg = ctx.
getParams
()[0].getString();
67
NWN2::Object
*tokenTarget =
NWN2::ObjectContainer::toObject
(
getParamObject
(ctx, 1));
68
69
object
->speakOneLiner(dlg, tokenTarget);
70
}
71
72
}
// End of namespace NWN2
73
74
}
// End of namespace Engines
Engines::NWN2::Functions::speakOneLinerConversation
void speakOneLinerConversation(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_conversation.cpp:61
game.h
The context handling the gameplay in Neverwinter Nights 2.
TalkMan
#define TalkMan
Shortcut for accessing the talk manager.
Definition:
talkman.h:111
Engines::NWN2::ObjectContainer::toObject
static NWN2::Object * toObject(::Aurora::NWScript::Object *object)
Definition:
objectcontainer.cpp:125
Common::UString
A class holding an UTF-8 string.
Definition:
ustring.h:48
functioncontext.h
Context of an NWScript function.
Aurora::NWScript::FunctionContext::getCaller
Object * getCaller() const
Definition:
functioncontext.cpp:119
Engines::NWN2::Object
An object within a NWN2 area.
Definition:
object.h:58
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
module.h
The context needed to run a Neverwinter Nights 2 module.
functions.h
Neverwinter Nights 2 engine functions.
objectcontainer.h
A container of Neverwinter Nights 2 objects.
util.h
Utility templates and functions.
Engines::NWN2::Object::speakString
void speakString(const Common::UString &string, uint32 volume)
Speak the specified string.
Definition:
object.cpp:245
Engines::NWN2::Functions::speakString
void speakString(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_conversation.cpp:42
Engines
Definition:
console.cpp:69
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
Engines::NWN2::Functions::speakStringByStrRef
void speakStringByStrRef(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_conversation.cpp:49
uint32
uint32_t uint32
Definition:
types.h:204
talkman.h
The global talk manager for Aurora strings.
Engines::NWN2::Functions::getParamObject
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
Definition:
functions.cpp:118
object.h
An object in a Neverwinter Nights 2 area.
Generated on Sun Nov 18 2018 15:13:40 for xoreos by
1.8.14