xoreos
0.0.5
src
engines
kotor2
script
functions_object.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/kotor2/types.h
"
30
#include "
src/engines/kotor2/game.h
"
31
#include "
src/engines/kotor2/module.h
"
32
#include "
src/engines/kotor2/objectcontainer.h
"
33
#include "
src/engines/kotor2/object.h
"
34
35
#include "
src/engines/kotor2/script/functions.h
"
36
37
namespace
Engines
{
38
39
namespace
KotOR2 {
40
41
void
Functions::getClickingObject
(
Aurora::NWScript::FunctionContext
&ctx) {
42
ctx.
getReturn
() = ctx.
getTriggerer
();
43
}
44
45
void
Functions::getEnteringObject
(
Aurora::NWScript::FunctionContext
&ctx) {
46
// TODO: This should return the *last* entered object, i.e. it should remember past triggerers.
47
ctx.
getReturn
() = ctx.
getTriggerer
();
48
}
49
50
void
Functions::getExitingObject
(
Aurora::NWScript::FunctionContext
&ctx) {
51
// TODO: This should return the *last* exited object, i.e. it should remember past triggerers.
52
ctx.
getReturn
() = ctx.
getTriggerer
();
53
}
54
55
void
Functions::getIsObjectValid
(
Aurora::NWScript::FunctionContext
&ctx) {
56
ctx.
getReturn
() =
getParamObject
(ctx, 0) != 0;
57
}
58
59
void
Functions::getIsPC
(
Aurora::NWScript::FunctionContext
&ctx) {
60
ctx.
getReturn
() =
KotOR2::ObjectContainer::toPC
(
getParamObject
(ctx, 0)) != 0;
61
}
62
63
void
Functions::isObjectPartyMember
(
Aurora::NWScript::FunctionContext
&ctx) {
64
ctx.
getReturn
() =
KotOR2::ObjectContainer::toPartyMember
(
getParamObject
(ctx, 0)) != 0;
65
}
66
67
void
Functions::getObjectByTag
(
Aurora::NWScript::FunctionContext
&ctx) {
68
Common::UString
name = ctx.
getParams
()[0].getString();
69
int
nth = ctx.
getParams
()[1].getInt();
70
71
Common::ScopedPtr<Aurora::NWScript::ObjectSearch>
search(
_game
->
getModule
().
findObjectsByTag
(name));
72
for
(
int
i = 0; i < nth; ++i) {
73
search->next();
74
}
75
76
ctx.
getReturn
() = search->get();
77
}
78
79
}
// End of namespace KotOR2
80
81
}
// End of namespace Engines
Aurora::NWScript::FunctionContext::getTriggerer
Object * getTriggerer() const
Definition:
functioncontext.cpp:131
Common::UString
A class holding an UTF-8 string.
Definition:
ustring.h:48
game.h
The context handling the gameplay in Star Wars: Knights of the Old Republic II - The Sith Lords...
objectcontainer.h
A container of Star Wars: Knights of the Old Republic II - The Sith Lords objects.
functioncontext.h
Context of an NWScript function.
Engines::KotOR2::ObjectContainer::toPartyMember
static Creature * toPartyMember(Aurora::NWScript::Object *object)
Definition:
objectcontainer.cpp:164
Engines::KotOR2::Functions::_game
Game * _game
Definition:
functions.h:75
Aurora::NWScript::FunctionContext
Definition:
functioncontext.h:42
object.h
An object in a Star Wars: Knights of the Old Republic II - The Sith Lords area.
util.h
Utility templates and functions.
types.h
Basic Star Wars: Knights of the Old Republic II - The Sith Lords type definitions.
Engines::KotOR2::Functions::getIsPC
void getIsPC(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_object.cpp:59
functions.h
Star Wars: Knights of the Old Republic II - The Sith Lords engine functions.
Engines::KotOR2::Game::getModule
Module & getModule()
Return the module context.
Definition:
game.cpp:63
Engines::KotOR2::Functions::getObjectByTag
void getObjectByTag(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_object.cpp:67
Aurora::NWScript::ObjectContainer::findObjectsByTag
ObjectSearch * findObjectsByTag(const Common::UString &tag) const
Return a search context to iterate over all objects with this tag.
Definition:
objectcontainer.cpp:102
Engines::KotOR2::ObjectContainer::toPC
static Creature * toPC(Aurora::NWScript::Object *object)
Definition:
objectcontainer.cpp:156
Engines
Definition:
console.cpp:69
Common::ScopedPtr
A scoped plain pointer, allowing pointer-y access and normal deletion.
Definition:
scopedptr.h:120
Aurora::NWScript::FunctionContext::getParams
Parameters & getParams()
Definition:
functioncontext.cpp:151
module.h
The context needed to run a Star Wars: Knights of the Old Republic II - The Sith Lords module...
Engines::KotOR2::Functions::getParamObject
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
Definition:
functions.cpp:115
Engines::KotOR2::Functions::isObjectPartyMember
void isObjectPartyMember(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_object.cpp:63
Engines::KotOR2::Functions::getIsObjectValid
void getIsObjectValid(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_object.cpp:55
Aurora::NWScript::FunctionContext::getReturn
Variable & getReturn()
Definition:
functioncontext.cpp:143
Engines::KotOR2::Functions::getExitingObject
void getExitingObject(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_object.cpp:50
Engines::KotOR2::Functions::getEnteringObject
void getEnteringObject(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_object.cpp:45
Engines::KotOR2::Functions::getClickingObject
void getClickingObject(Aurora::NWScript::FunctionContext &ctx)
Definition:
functions_object.cpp:41
Generated on Sun Nov 18 2018 15:13:39 for xoreos by
1.8.14