xoreos  0.0.5
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 
28 
29 #include "src/engines/jade/game.h"
33 
35 
36 namespace Engines {
37 
38 namespace Jade {
39 
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 
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 
68 }
69 
71  ctx.getReturn() = (Aurora::NWScript::Object *) 0;
72 }
73 
74 } // End of namespace Jade
75 
76 } // End of namespace Engines
void getNextPC(Aurora::NWScript::FunctionContext &ctx)
void getPlayer(Aurora::NWScript::FunctionContext &ctx)
Module & getModule()
Return the module context.
Definition: game.cpp:61
Context of an NWScript function.
Jade Empire engine functions.
void setPosition(float x, float y, float z)
Set the location&#39;s position.
Definition: location.cpp:58
The context handling the gameplay in Jade Empire.
void getPosition(float &x, float &y, float &z) const
Return the location&#39;s position.
Definition: location.cpp:52
Creature * getPC()
Return the currently playing PC.
Definition: module.cpp:107
A container of Jade Empire objects.
void getPositionFromLocation(Aurora::NWScript::FunctionContext &ctx)
void location(Aurora::NWScript::FunctionContext &ctx)
Utility templates and functions.
void setVector(float x, float y, float z)
Definition: variable.cpp:335
A location within a Jade Empire area.
static Area * toArea(Aurora::NWScript::Object *object)
A module.
static Location * toLocation(Aurora::NWScript::EngineType *engineType)
void setFacing(float facing)
Set the location&#39;s orientation.
Definition: location.cpp:68
void setArea(Area *area)
Set the location&#39;s area.
Definition: location.cpp:48