xoreos  0.0.5
functions.h
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 #ifndef ENGINES_NWN2_SCRIPT_FUNCTIONS_H
26 #define ENGINES_NWN2_SCRIPT_FUNCTIONS_H
27 
29 
30 namespace Aurora {
31  namespace NWScript {
32  class FunctionContext;
33  class Object;
34  }
35 }
36 
37 namespace Engines {
38 
39 namespace NWN2 {
40 
41 class Game;
42 class Area;
43 class Object;
44 
45 class Functions {
46 public:
47  Functions(Game &game);
48  ~Functions();
49 
50 private:
52 
53  struct FunctionPointer {
55  const char *name;
57  };
58 
63  };
64 
68  };
69 
73 
74 
76 
77  void registerFunctions();
78 
79  // .--- Utility methods
80  void jumpTo(NWN2::Object *object, Area *area, float x, float y, float z);
81 
82  static int32 getRandom(int min, int max, int32 n = 1);
83 
84  static Common::UString formatFloat(float f, int width = 18, int decimals = 9);
85 
87  // '---
88 
89  // --- Engine functions ---
90 
92 
93  // .--- Math, functions_math.cpp
96 
100 
104 
108 
110 
120 
123 
127  // '---
128 
129  // .--- Strings, functions_string.cpp
131 
133 
139 
143 
145 
148 
150 
153 
156 
160 
162 
164  // '---
165 
166  // .--- Campaign functions, functions_campaign.cpp
169 
174 
179  // '---
180 
181  // .--- Module functions, functions_module.cpp
183 
185 
187 
189 
192  // '---
193 
194  // .--- General object functions, functions_object.cpp
198 
200 
205 
210 
212 
215 
218 
220 
222 
228 
231  // '---
232 
233  // .--- Situated objects, functions_situated.cpp
236 
238 
242  // '---
243 
244  // .--- Creatures, functions_creature.cpp
248 
252 
254 
256 
259 
262 
264 
269 
272  // '---
273 
274  // .--- Actions, functions_action.cpp
277 
279 
281 
284 
286 
291  // '---
292 
293  // .--- Conversations, functions_conversation.cpp
296 
298  // '---
299 
300  // .--- Sound, functions_sound.cpp
304 
309 
312  // '---
313 };
314 
315 } // End of namespace NWN2
316 
317 } // End of namespace Engines
318 
319 #endif // ENGINES_NWN2_SCRIPT_FUNCTIONS_H
void playSound(Aurora::NWScript::FunctionContext &ctx)
void actionMoveToObject(Aurora::NWScript::FunctionContext &ctx)
void getPositionFromLocation(Aurora::NWScript::FunctionContext &ctx)
void speakOneLinerConversation(Aurora::NWScript::FunctionContext &ctx)
void musicBackgroundStop(Aurora::NWScript::FunctionContext &ctx)
void actionDoCommand(Aurora::NWScript::FunctionContext &ctx)
void setGlobalInt(Aurora::NWScript::FunctionContext &ctx)
void getNearestObjectByTag(Aurora::NWScript::FunctionContext &ctx)
void getIsPC(Aurora::NWScript::FunctionContext &ctx)
void printObject(Aurora::NWScript::FunctionContext &ctx)
void unimplementedFunction(Aurora::NWScript::FunctionContext &ctx)
Definition: functions.cpp:97
void vectorNormalize(Aurora::NWScript::FunctionContext &ctx)
void getLevelByPosition(Aurora::NWScript::FunctionContext &ctx)
void getHitDice(Aurora::NWScript::FunctionContext &ctx)
void getIsSinglePlayer(Aurora::NWScript::FunctionContext &ctx)
void getLocalFloat(Aurora::NWScript::FunctionContext &ctx)
static const FunctionSignature kFunctionSignatures[]
The table defining the signature (return type and type of parameters) of each engine function...
Definition: functions.h:71
void d12(Aurora::NWScript::FunctionContext &ctx)
void musicBackgroundChangeNight(Aurora::NWScript::FunctionContext &ctx)
void getRacialType(Aurora::NWScript::FunctionContext &ctx)
A class holding an UTF-8 string.
Definition: ustring.h:48
void location(Aurora::NWScript::FunctionContext &ctx)
static const FunctionPointer kFunctionPointers[]
The table defining the name and function pointer of each engine function.
Definition: functions.h:70
static const FunctionDefaults kFunctionDefaults[]
The table defining the default values for the parameters of each engine function. ...
Definition: functions.h:72
void getClickingObject(Aurora::NWScript::FunctionContext &ctx)
void getOnePartyMode(Aurora::NWScript::FunctionContext &ctx)
void getClassByPosition(Aurora::NWScript::FunctionContext &ctx)
void actionOpenDoor(Aurora::NWScript::FunctionContext &ctx)
void getStringLeft(Aurora::NWScript::FunctionContext &ctx)
An area in Neverwinter Nights 2, holding all objects, room tiles and terrain within, as well as general area properties like the current background music and ambient sounds.
Definition: area.h:65
void getArea(Aurora::NWScript::FunctionContext &ctx)
void getObjectByTag(Aurora::NWScript::FunctionContext &ctx)
void getIsDM(Aurora::NWScript::FunctionContext &ctx)
void getGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
void floatToString(Aurora::NWScript::FunctionContext &ctx)
void getFactionLeader(Aurora::NWScript::FunctionContext &ctx)
void fabs(Aurora::NWScript::FunctionContext &ctx)
void d100(Aurora::NWScript::FunctionContext &ctx)
void setLocalObject(Aurora::NWScript::FunctionContext &ctx)
void getEnteringObject(Aurora::NWScript::FunctionContext &ctx)
void stringToFloat(Aurora::NWScript::FunctionContext &ctx)
void pow(Aurora::NWScript::FunctionContext &ctx)
void d6(Aurora::NWScript::FunctionContext &ctx)
const Aurora::NWScript::Variable * defaults[10]
Definition: functions.h:67
void d4(Aurora::NWScript::FunctionContext &ctx)
void getObjectType(Aurora::NWScript::FunctionContext &ctx)
void getTag(Aurora::NWScript::FunctionContext &ctx)
void setLocalInt(Aurora::NWScript::FunctionContext &ctx)
void getGlobalString(Aurora::NWScript::FunctionContext &ctx)
void playSoundByStrRef(Aurora::NWScript::FunctionContext &ctx)
void getLocked(Aurora::NWScript::FunctionContext &ctx)
An object within a NWN2 area.
Definition: object.h:58
void musicBackgroundChangeDay(Aurora::NWScript::FunctionContext &ctx)
void setGlobalFloat(Aurora::NWScript::FunctionContext &ctx)
void getLocalString(Aurora::NWScript::FunctionContext &ctx)
void jumpTo(NWN2::Object *object, Area *area, float x, float y, float z)
Definition: functions.cpp:129
void getLocalInt(Aurora::NWScript::FunctionContext &ctx)
void actionJumpToObject(Aurora::NWScript::FunctionContext &ctx)
void vectorMagnitude(Aurora::NWScript::FunctionContext &ctx)
void actionMoveToLocation(Aurora::NWScript::FunctionContext &ctx)
void setLocalString(Aurora::NWScript::FunctionContext &ctx)
void sqrt(Aurora::NWScript::FunctionContext &ctx)
void intToHexString(Aurora::NWScript::FunctionContext &ctx)
void intToFloat(Aurora::NWScript::FunctionContext &ctx)
void printString(Aurora::NWScript::FunctionContext &ctx)
void musicBackgroundPlay(Aurora::NWScript::FunctionContext &ctx)
static int32 getRandom(int min, int max, int32 n=1)
Definition: functions.cpp:102
void executeScript(Aurora::NWScript::FunctionContext &ctx)
void setGlobalBool(Aurora::NWScript::FunctionContext &ctx)
void printVector(Aurora::NWScript::FunctionContext &ctx)
void findSubString(Aurora::NWScript::FunctionContext &ctx)
void(Functions::* funcPtr)(Aurora::NWScript::FunctionContext &ctx)
Definition: functions.h:51
void actionSpeakString(Aurora::NWScript::FunctionContext &ctx)
void getSkillRank(Aurora::NWScript::FunctionContext &ctx)
void acos(Aurora::NWScript::FunctionContext &ctx)
void getLocation(Aurora::NWScript::FunctionContext &ctx)
void getPosition(Aurora::NWScript::FunctionContext &ctx)
void actionCloseDoor(Aurora::NWScript::FunctionContext &ctx)
void getName(Aurora::NWScript::FunctionContext &ctx)
void getIsRosterMember(Aurora::NWScript::FunctionContext &ctx)
void getStringUpperCase(Aurora::NWScript::FunctionContext &ctx)
void getAlignmentGoodEvil(Aurora::NWScript::FunctionContext &ctx)
void speakString(Aurora::NWScript::FunctionContext &ctx)
void setLocalFloat(Aurora::NWScript::FunctionContext &ctx)
void floatToInt(Aurora::NWScript::FunctionContext &ctx)
void getNextPC(Aurora::NWScript::FunctionContext &ctx)
void getStringByStrRef(Aurora::NWScript::FunctionContext &ctx)
void startNewModule(Aurora::NWScript::FunctionContext &ctx)
void random(Aurora::NWScript::FunctionContext &ctx)
void d8(Aurora::NWScript::FunctionContext &ctx)
void d20(Aurora::NWScript::FunctionContext &ctx)
void vector(Aurora::NWScript::FunctionContext &ctx)
void asin(Aurora::NWScript::FunctionContext &ctx)
void getExitingObject(Aurora::NWScript::FunctionContext &ctx)
void actionJumpToLocation(Aurora::NWScript::FunctionContext &ctx)
void getStringLowerCase(Aurora::NWScript::FunctionContext &ctx)
void writeTimestampedLogEntry(Aurora::NWScript::FunctionContext &ctx)
void getFirstPC(Aurora::NWScript::FunctionContext &ctx)
void stringToInt(Aurora::NWScript::FunctionContext &ctx)
void playVoiceChat(Aurora::NWScript::FunctionContext &ctx)
void speakStringByStrRef(Aurora::NWScript::FunctionContext &ctx)
void getGlobalBool(Aurora::NWScript::FunctionContext &ctx)
void getLastClosedBy(Aurora::NWScript::FunctionContext &ctx)
void getHasFeat(Aurora::NWScript::FunctionContext &ctx)
void getGlobalInt(Aurora::NWScript::FunctionContext &ctx)
void atan(Aurora::NWScript::FunctionContext &ctx)
void getLevelByClass(Aurora::NWScript::FunctionContext &ctx)
void getIsDead(Aurora::NWScript::FunctionContext &ctx)
void tan(Aurora::NWScript::FunctionContext &ctx)
void intToString(Aurora::NWScript::FunctionContext &ctx)
void getSubString(Aurora::NWScript::FunctionContext &ctx)
void d2(Aurora::NWScript::FunctionContext &ctx)
void getAlignmentLawChaos(Aurora::NWScript::FunctionContext &ctx)
uint32_t uint32
Definition: types.h:204
void setGlobalString(Aurora::NWScript::FunctionContext &ctx)
void printFloat(Aurora::NWScript::FunctionContext &ctx)
void jumpToLocation(Aurora::NWScript::FunctionContext &ctx)
void getWaypointByTag(Aurora::NWScript::FunctionContext &ctx)
void getNearestObject(Aurora::NWScript::FunctionContext &ctx)
void d10(Aurora::NWScript::FunctionContext &ctx)
void getAbilityScore(Aurora::NWScript::FunctionContext &ctx)
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
Definition: functions.cpp:118
void printInteger(Aurora::NWScript::FunctionContext &ctx)
void getDistanceToObject(Aurora::NWScript::FunctionContext &ctx)
void insertString(Aurora::NWScript::FunctionContext &ctx)
void abs(Aurora::NWScript::FunctionContext &ctx)
void getXP(Aurora::NWScript::FunctionContext &ctx)
void jumpToObject(Aurora::NWScript::FunctionContext &ctx)
void getLocalObject(Aurora::NWScript::FunctionContext &ctx)
void objectToString(Aurora::NWScript::FunctionContext &ctx)
void getStringLength(Aurora::NWScript::FunctionContext &ctx)
void getStringRight(Aurora::NWScript::FunctionContext &ctx)
void getLawChaosValue(Aurora::NWScript::FunctionContext &ctx)
void getNearestCreature(Aurora::NWScript::FunctionContext &ctx)
NWScript types.
void musicBackgroundGetNightTrack(Aurora::NWScript::FunctionContext &ctx)
void getModule(Aurora::NWScript::FunctionContext &ctx)
void delayCommand(Aurora::NWScript::FunctionContext &ctx)
Aurora::NWScript::Type parameters[13]
Definition: functions.h:62
void log(Aurora::NWScript::FunctionContext &ctx)
void getIsObjectValid(Aurora::NWScript::FunctionContext &ctx)
void getLastOpenedBy(Aurora::NWScript::FunctionContext &ctx)
void getGender(Aurora::NWScript::FunctionContext &ctx)
void d3(Aurora::NWScript::FunctionContext &ctx)
void getGoodEvilValue(Aurora::NWScript::FunctionContext &ctx)
void getLastUsedBy(Aurora::NWScript::FunctionContext &ctx)
void musicBackgroundGetDayTrack(Aurora::NWScript::FunctionContext &ctx)
void setLocked(Aurora::NWScript::FunctionContext &ctx)
void cos(Aurora::NWScript::FunctionContext &ctx)
void getIsOpen(Aurora::NWScript::FunctionContext &ctx)
static Common::UString formatFloat(float f, int width=18, int decimals=9)
Definition: functions.cpp:114
void sendMessageToPC(Aurora::NWScript::FunctionContext &ctx)
void sin(Aurora::NWScript::FunctionContext &ctx)
void assignCommand(Aurora::NWScript::FunctionContext &ctx)
void get2DAString(Aurora::NWScript::FunctionContext &ctx)
int32_t int32
Definition: types.h:203