xoreos
0.0.5
src
engines
jade
script
functions_game.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/nwscript/functioncontext.h
"
28
29
#include "
src/engines/jade/game.h
"
30
31
#include "
src/engines/jade/script/functions.h
"
32
33
namespace
Engines
{
34
35
namespace
Jade {
36
37
using
Aurora::NWScript::kTypeInt
;
38
using
Aurora::NWScript::kTypeFloat
;
39
using
Aurora::NWScript::kTypeString
;
40
41
void
Functions::getGlobalInt
(
Aurora::NWScript::FunctionContext
&ctx) {
42
ctx.
getReturn
() =
_game
->
getVariable
(ctx.
getParams
()[0].getString(),
kTypeInt
).getInt();
43
}
44
45
void
Functions::getGlobalBool
(
Aurora::NWScript::FunctionContext
&ctx) {
46
ctx.
getReturn
() =
_game
->
getVariable
(ctx.
getParams
()[0].getString(),
kTypeInt
).getInt() != 0;
47
}
48
49
void
Functions::getGlobalString
(
Aurora::NWScript::FunctionContext
&ctx) {
50
ctx.
getReturn
() =
_game
->
getVariable
(ctx.
getParams
()[0].getString(),
kTypeString
).getString();
51
}
52
53
void
Functions::getGlobalFloat
(
Aurora::NWScript::FunctionContext
&ctx) {
54
ctx.
getReturn
() =
_game
->
getVariable
(ctx.
getParams
()[0].getString(),
kTypeFloat
).getFloat();
55
}
56
57
void
Functions::setGlobalInt
(
Aurora::NWScript::FunctionContext
&ctx) {
58
_game
->
setVariable
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getInt());
59
}
60
61
void
Functions::setGlobalBool
(
Aurora::NWScript::FunctionContext
&ctx) {
62
_game
->
setVariable
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getInt() != 0);
63
}
64
65
void
Functions::setGlobalString
(
Aurora::NWScript::FunctionContext
&ctx) {
66
_game
->
setVariable
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getString());
67
}
68
69
void
Functions::setGlobalFloat
(
Aurora::NWScript::FunctionContext
&ctx) {
70
_game
->
setVariable
(ctx.
getParams
()[0].getString(), ctx.
getParams
()[1].getFloat());
71
}
72
73
}
// End of namespace Jade
74
75
}
// End of namespace Engines
Engines::Jade::Functions::getGlobalBool
void getGlobalBool(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_game.cpp:45
functioncontext.h
Context of an NWScript function.
functions.h
Jade Empire engine functions.
Aurora::NWScript::kTypeInt
Definition:
types.h:38
game.h
The context handling the gameplay in Jade Empire.
Aurora::NWScript::kTypeString
Definition:
types.h:40
Engines::Jade::Functions::setGlobalInt
void setGlobalInt(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_game.cpp:57
Engines::Jade::Functions::getGlobalString
void getGlobalString(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_game.cpp:49
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
Engines::Jade::Functions::getGlobalFloat
void getGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_game.cpp:53
util.h
Utility templates and functions.
Aurora::NWScript::VariableContainer::getVariable
Variable & getVariable(const Common::UString &var, Type type=kTypeVoid)
Definition:
variablecontainer.cpp:43
Engines::Jade::Functions::setGlobalString
void setGlobalString(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_game.cpp:65
Engines
Definition:
console.cpp:69
Engines::Jade::Functions::setGlobalBool
void setGlobalBool(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_game.cpp:61
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
Aurora::ActionScript::kTypeString
Definition:
types.h:38
Engines::Jade::Functions::_game
Game * _game
Definition:
functions.h:76
Engines::Jade::Functions::getGlobalInt
void getGlobalInt(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_game.cpp:41
Aurora::NWScript::FunctionContext::getReturn
Variable & getReturn()
Definition:
functioncontext.cpp:143
Aurora::NWScript::VariableContainer::setVariable
void setVariable(const Common::UString &var, const Variable &value)
Definition:
variablecontainer.cpp:64
Engines::Jade::Functions::setGlobalFloat
void setGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_game.cpp:69
Aurora::NWScript::kTypeFloat
Definition:
types.h:39
Generated on Sun Nov 18 2018 15:13:40 for xoreos by
1.8.14