xoreos
0.0.5
src
engines
jade
script
functions_module.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
#include "
src/engines/jade/module.h
"
31
#include "
src/engines/jade/location.h
"
32
#include "
src/engines/jade/objectcontainer.h
"
33
34
#include "
src/engines/jade/script/functions.h
"
35
36
namespace
Engines
{
37
38
namespace
Jade {
39
40
void
Functions::location
(
Aurora::NWScript::FunctionContext
&ctx) {
41
Location
loc;
42
43
loc.
setArea
(
Jade::ObjectContainer::toArea
(ctx.
getParams
()[0].getObject()));
44
loc.
setFacing
(ctx.
getParams
()[2].getFloat());
45
46
float
x, y, z;
47
ctx.
getParams
()[1].getVector(x, y, z);
48
loc.
setPosition
(x, y, z);
49
50
ctx.
getReturn
() = loc;
51
}
52
53
void
Functions::getPositionFromLocation
(
Aurora::NWScript::FunctionContext
&ctx) {
54
ctx.
getReturn
().
setVector
(0.0f, 0.0f, 0.0f);
55
56
Location
*loc =
Jade::ObjectContainer::toLocation
(ctx.
getParams
()[0].getEngineType());
57
if
(!loc)
58
return
;
59
60
float
x, y, z;
61
loc->
getPosition
(x, y, z);
62
63
ctx.
getReturn
().
setVector
(x, y, z);
64
}
65
66
void
Functions::getPlayer
(
Aurora::NWScript::FunctionContext
&ctx) {
67
ctx.
getReturn
() = (
Aurora::NWScript::Object
*)
_game
->
getModule
().
getPC
();
68
}
69
70
void
Functions::getNextPC
(
Aurora::NWScript::FunctionContext
&ctx) {
71
ctx.
getReturn
() = (
Aurora::NWScript::Object
*) 0;
72
}
73
74
}
// End of namespace Jade
75
76
}
// End of namespace Engines
Aurora::NWScript::Object
Definition:
object.h:37
Engines::Jade::Functions::getNextPC
void getNextPC(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_module.cpp:70
Engines::Jade::Functions::getPlayer
void getPlayer(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_module.cpp:66
Engines::Jade::Game::getModule
Module & getModule()
Return the module context.
Definition:
game.cpp:61
functioncontext.h
Context of an NWScript function.
functions.h
Jade Empire engine functions.
Engines::Jade::Location
Definition:
location.h:36
Engines::Jade::Location::setPosition
void setPosition(float x, float y, float z)
Set the location's position.
Definition:
location.cpp:58
game.h
The context handling the gameplay in Jade Empire.
Engines::Jade::Location::getPosition
void getPosition(float &x, float &y, float &z) const
Return the location's position.
Definition:
location.cpp:52
Engines::Jade::Module::getPC
Creature * getPC()
Return the currently playing PC.
Definition:
module.cpp:107
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
objectcontainer.h
A container of Jade Empire objects.
Engines::Jade::Functions::getPositionFromLocation
void getPositionFromLocation(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_module.cpp:53
Engines::Jade::Functions::location
void location(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_module.cpp:40
util.h
Utility templates and functions.
Aurora::NWScript::Variable::setVector
void setVector(float x, float y, float z)
Definition:
variable.cpp:335
Engines
Definition:
console.cpp:69
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
location.h
A location within a Jade Empire area.
Engines::Jade::ObjectContainer::toArea
static Area * toArea(Aurora::NWScript::Object *object)
Definition:
objectcontainer.cpp:129
Engines::Jade::Functions::_game
Game * _game
Definition:
functions.h:76
module.h
A module.
Engines::Jade::ObjectContainer::toLocation
static Location * toLocation(Aurora::NWScript::EngineType *engineType)
Definition:
objectcontainer.cpp:153
Aurora::NWScript::FunctionContext::getReturn
Variable & getReturn()
Definition:
functioncontext.cpp:143
Engines::Jade::Location::setFacing
void setFacing(float facing)
Set the location's orientation.
Definition:
location.cpp:68
Engines::Jade::Location::setArea
void setArea(Area *area)
Set the location's area.
Definition:
location.cpp:48
Generated on Sun Nov 18 2018 15:13:39 for xoreos by
1.8.14