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_KOTOR_SCRIPT_FUNCTIONS_H
26 #define ENGINES_KOTOR_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 KotOR {
40 
41 class Game;
42 class Area;
43 class Object;
44 class Event;
45 
46 class Functions {
47 public:
48  Functions(Game &game);
49  ~Functions();
50 
51 private:
53 
54  struct FunctionPointer {
56  const char *name;
58  };
59 
64  };
65 
69  };
70 
74 
75 
78 
79  void registerFunctions();
80 
81  // .--- Utility methods
82  void jumpTo(KotOR::Object *object, float x, float y, float z);
83 
84  static int32 getRandom(int min, int max, int32 n = 1);
85 
86  static Common::UString formatFloat(float f, int width = 18, int decimals = 9);
87 
89  // '---
90 
91  // --- Engine functions ---
92 
94 
95  // .--- Math, functions_math.cpp
98 
102 
106 
110 
112 
122 
125 
129  // '---
130 
131  // .--- Strings, functions_string.cpp
133 
135 
141 
145 
147 
150 
152 
155 
158 
162 
164  // '---
165 
166  // .--- Module functions, functions_module.cpp
168 
171 
173 
176 
178  // '---
179 
180  // .--- General object functions, functions_object.cpp
184 
186 
188 
190 
193 
197 
201 
203  // '---
204 
205  // .--- Situated objects, functions_situated.cpp
208 
210 
214  // '---
215 
216  // .--- Actions, functions_action.cpp
224  // '---
225 
226  // .--- Sound, functions_sound.cpp
231 
234 
237  // '---
238 
239  // .--- Movies, functions_movie.cpp
241  // '---
242 
243  // .--- Creatures, functions_creatures.cpp
246 
249 
252  // '---
253 
254  // .--- Global values, functions_global.cpp
259  // '---
260 
261  // .--- Local variables, functions_local.cpp
266  // '---
267 
268  // .--- Party, functions_party.cpp
274  // '---
275 
276  // .--- Events, functions_events.cpp
280  // '---
281 };
282 
283 } // End of namespace KotOR
284 
285 } // End of namespace Engines
286 
287 #endif // ENGINES_KOTOR_SCRIPT_FUNCTIONS_H
void getUserDefinedEventNumber(Aurora::NWScript::FunctionContext &ctx)
void actionCloseDoor(Aurora::NWScript::FunctionContext &ctx)
void setLocked(Aurora::NWScript::FunctionContext &ctx)
void printObject(Aurora::NWScript::FunctionContext &ctx)
void musicBackgroundGetDayTrack(Aurora::NWScript::FunctionContext &ctx)
void createItemOnObject(Aurora::NWScript::FunctionContext &ctx)
void sendMessageToPC(Aurora::NWScript::FunctionContext &ctx)
void atan(Aurora::NWScript::FunctionContext &ctx)
void vectorNormalize(Aurora::NWScript::FunctionContext &ctx)
A class holding an UTF-8 string.
Definition: ustring.h:48
Aurora::NWScript::Type parameters[12]
Definition: functions.h:63
void(Functions::* funcPtr)(Aurora::NWScript::FunctionContext &ctx)
Definition: functions.h:52
void getStringByStrRef(Aurora::NWScript::FunctionContext &ctx)
void floatToInt(Aurora::NWScript::FunctionContext &ctx)
void insertString(Aurora::NWScript::FunctionContext &ctx)
void getRacialType(Aurora::NWScript::FunctionContext &ctx)
void assignCommand(Aurora::NWScript::FunctionContext &ctx)
void getEnteringObject(Aurora::NWScript::FunctionContext &ctx)
void d6(Aurora::NWScript::FunctionContext &ctx)
void findSubString(Aurora::NWScript::FunctionContext &ctx)
void setLocalBoolean(Aurora::NWScript::FunctionContext &ctx)
void getLocalNumber(Aurora::NWScript::FunctionContext &ctx)
void clearAllActions(Aurora::NWScript::FunctionContext &ctx)
void getIsPC(Aurora::NWScript::FunctionContext &ctx)
void cos(Aurora::NWScript::FunctionContext &ctx)
void getPCSpeaker(Aurora::NWScript::FunctionContext &ctx)
void getMinOneHP(Aurora::NWScript::FunctionContext &ctx)
static int32 getRandom(int min, int max, int32 n=1)
Definition: functions.cpp:101
void musicBackgroundPlay(Aurora::NWScript::FunctionContext &ctx)
void getStringRight(Aurora::NWScript::FunctionContext &ctx)
void getNextPC(Aurora::NWScript::FunctionContext &ctx)
void abs(Aurora::NWScript::FunctionContext &ctx)
void getObjectByTag(Aurora::NWScript::FunctionContext &ctx)
void signalEvent(Aurora::NWScript::FunctionContext &ctx)
void log(Aurora::NWScript::FunctionContext &ctx)
void getGlobalBoolean(Aurora::NWScript::FunctionContext &ctx)
void getLocalBoolean(Aurora::NWScript::FunctionContext &ctx)
void destroyObject(Aurora::NWScript::FunctionContext &ctx)
void getCurrentHitPoints(Aurora::NWScript::FunctionContext &ctx)
void intToString(Aurora::NWScript::FunctionContext &ctx)
void getLastOpenedBy(Aurora::NWScript::FunctionContext &ctx)
void setMinOneHP(Aurora::NWScript::FunctionContext &ctx)
SDL_Event Event
Definition: types.h:42
void getClassByPosition(Aurora::NWScript::FunctionContext &ctx)
void pow(Aurora::NWScript::FunctionContext &ctx)
void printString(Aurora::NWScript::FunctionContext &ctx)
void d12(Aurora::NWScript::FunctionContext &ctx)
void showPartySelectionGUI(Aurora::NWScript::FunctionContext &ctx)
void musicBackgroundGetNightTrack(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:72
void d20(Aurora::NWScript::FunctionContext &ctx)
void setGlobalBoolean(Aurora::NWScript::FunctionContext &ctx)
void actionStartConversation(Aurora::NWScript::FunctionContext &ctx)
static Common::UString formatFloat(float f, int width=18, int decimals=9)
Definition: functions.cpp:113
void getStringUpperCase(Aurora::NWScript::FunctionContext &ctx)
void setGlobalFadeIn(Aurora::NWScript::FunctionContext &ctx)
void intToFloat(Aurora::NWScript::FunctionContext &ctx)
void getLastClosedBy(Aurora::NWScript::FunctionContext &ctx)
void setLocalNumber(Aurora::NWScript::FunctionContext &ctx)
void intToHexString(Aurora::NWScript::FunctionContext &ctx)
void getGender(Aurora::NWScript::FunctionContext &ctx)
void getGlobalNumber(Aurora::NWScript::FunctionContext &ctx)
void getClickingObject(Aurora::NWScript::FunctionContext &ctx)
void random(Aurora::NWScript::FunctionContext &ctx)
void eventUserDefined(Aurora::NWScript::FunctionContext &ctx)
void addAvailableNPCByTemplate(Aurora::NWScript::FunctionContext &ctx)
void getLastUsedBy(Aurora::NWScript::FunctionContext &ctx)
void objectToString(Aurora::NWScript::FunctionContext &ctx)
void delayCommand(Aurora::NWScript::FunctionContext &ctx)
void unimplementedFunction(Aurora::NWScript::FunctionContext &ctx)
Definition: functions.cpp:96
void tan(Aurora::NWScript::FunctionContext &ctx)
void getItemInSlot(Aurora::NWScript::FunctionContext &ctx)
void setReturnStrref(Aurora::NWScript::FunctionContext &ctx)
void getSubRace(Aurora::NWScript::FunctionContext &ctx)
void getModule(Aurora::NWScript::FunctionContext &ctx)
void soundObjectPlay(Aurora::NWScript::FunctionContext &ctx)
void getLevelByPosition(Aurora::NWScript::FunctionContext &ctx)
void vector(Aurora::NWScript::FunctionContext &ctx)
void getPartyMemberByIndex(Aurora::NWScript::FunctionContext &ctx)
void d2(Aurora::NWScript::FunctionContext &ctx)
void getExitingObject(Aurora::NWScript::FunctionContext &ctx)
void getIsObjectValid(Aurora::NWScript::FunctionContext &ctx)
void floatToString(Aurora::NWScript::FunctionContext &ctx)
void writeTimestampedLogEntry(Aurora::NWScript::FunctionContext &ctx)
void getStringLength(Aurora::NWScript::FunctionContext &ctx)
void printVector(Aurora::NWScript::FunctionContext &ctx)
void setMaxHitPoints(Aurora::NWScript::FunctionContext &ctx)
void d10(Aurora::NWScript::FunctionContext &ctx)
void stringToFloat(Aurora::NWScript::FunctionContext &ctx)
void sin(Aurora::NWScript::FunctionContext &ctx)
void actionOpenDoor(Aurora::NWScript::FunctionContext &ctx)
uint32_t uint32
Definition: types.h:204
void getStringLowerCase(Aurora::NWScript::FunctionContext &ctx)
static const FunctionDefaults kFunctionDefaults[]
The table defining the default values for the parameters of each engine function. ...
Definition: functions.h:73
void jumpTo(KotOR::Object *object, float x, float y, float z)
Definition: functions.cpp:128
void d100(Aurora::NWScript::FunctionContext &ctx)
void isAvailableCreature(Aurora::NWScript::FunctionContext &ctx)
void getMaxHitPoints(Aurora::NWScript::FunctionContext &ctx)
void getFirstPC(Aurora::NWScript::FunctionContext &ctx)
static const FunctionPointer kFunctionPointers[]
The table defining the name and function pointer of each engine function.
Definition: functions.h:71
void actionMoveToObject(Aurora::NWScript::FunctionContext &ctx)
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
Definition: functions.cpp:117
void asin(Aurora::NWScript::FunctionContext &ctx)
void getStringLeft(Aurora::NWScript::FunctionContext &ctx)
void getSubString(Aurora::NWScript::FunctionContext &ctx)
void musicBackgroundChangeNight(Aurora::NWScript::FunctionContext &ctx)
void d8(Aurora::NWScript::FunctionContext &ctx)
NWScript types.
void stringToInt(Aurora::NWScript::FunctionContext &ctx)
void printInteger(Aurora::NWScript::FunctionContext &ctx)
void printFloat(Aurora::NWScript::FunctionContext &ctx)
void fabs(Aurora::NWScript::FunctionContext &ctx)
void setGlobalNumber(Aurora::NWScript::FunctionContext &ctx)
void soundObjectStop(Aurora::NWScript::FunctionContext &ctx)
void setGlobalFadeOut(Aurora::NWScript::FunctionContext &ctx)
void vectorMagnitude(Aurora::NWScript::FunctionContext &ctx)
void getArea(Aurora::NWScript::FunctionContext &ctx)
void acos(Aurora::NWScript::FunctionContext &ctx)
void d4(Aurora::NWScript::FunctionContext &ctx)
void getLocked(Aurora::NWScript::FunctionContext &ctx)
void d3(Aurora::NWScript::FunctionContext &ctx)
void playMovie(Aurora::NWScript::FunctionContext &ctx)
void getLevelByClass(Aurora::NWScript::FunctionContext &ctx)
void getIsOpen(Aurora::NWScript::FunctionContext &ctx)
void musicBackgroundChangeDay(Aurora::NWScript::FunctionContext &ctx)
void sqrt(Aurora::NWScript::FunctionContext &ctx)
int32_t int32
Definition: types.h:203
void isObjectPartyMember(Aurora::NWScript::FunctionContext &ctx)
const Aurora::NWScript::Variable * defaults[11]
Definition: functions.h:68
void musicBackgroundStop(Aurora::NWScript::FunctionContext &ctx)