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