28 #include <boost/bind.hpp> 72 assert((fSig.
id ==
id) && (fDef.
id ==
id));
93 FunctionMan.registerFunction(fPtr.
name,
id, boost::bind(f,
this, _1), signature, defaults);
109 r += std::rand() % (max - min + 1) + min;
131 if (!object->
getArea() || !area) {
132 warning(
"Functions::jumpTo(): No area?!? (%d, %d)", object->
getArea() != 0, area != 0);
139 if (object->
getArea() != area) {
143 warning(
"TODO: Functions::jumpTo(): Moving from \"%s\" to \"%s\"", areaFrom.
c_str(), areaTo.
c_str());
149 if (areaFrom == pcArea) {
153 object->unloadModel();
155 }
else if (areaTo == pcArea) {
164 object->setArea(area);
168 object->setPosition(x, y, z);
void unimplementedFunction(Aurora::NWScript::FunctionContext &ctx)
The global graphics manager.
The context handling the gameplay in Neverwinter Nights 2.
std::vector< class Variable > Parameters
static NWN2::Object * toObject(::Aurora::NWScript::Object *object)
static const FunctionSignature kFunctionSignatures[]
The table defining the signature (return type and type of parameters) of each engine function...
A class holding an UTF-8 string.
static const FunctionPointer kFunctionPointers[]
The table defining the name and function pointer of each engine function.
Area * getArea() const
Return the area this object is currently in.
static const FunctionDefaults kFunctionDefaults[]
The table defining the default values for the parameters of each engine function. ...
Common::UString formatType(Type type)
Construct a string describing this variable type.
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.
The context holding a Neverwinter Nights 2 area.
Tables defining the engine functions in Neverwinter Nights 2.
Object * getCaller() const
const Aurora::NWScript::Variable * defaults[10]
#define ARRAYSIZE(x)
Macro which determines the number of entries in a fixed size array.
An object within a NWN2 area.
void jumpTo(NWN2::Object *object, Area *area, float x, float y, float z)
The NWScript function manager.
The context needed to run a Neverwinter Nights 2 module.
static int32 getRandom(int min, int max, int32 n=1)
Neverwinter Nights 2 engine functions.
A creature in a Neverwinter Nights 2 area.
const char * c_str() const
Return the (utf8 encoded) string data.
A container of Neverwinter Nights 2 objects.
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
void(Functions::* funcPtr)(Aurora::NWScript::FunctionContext &ctx)
Utility templates and functions.
Basic Neverwinter Nights 2 type definitions.
Fake value to describe the calling object in a script.
std::vector< Type > Signature
const Common::UString & getName() const
const Common::UString & getResRef()
Return the area's resref (resource ID).
void warning(const char *s,...)
Aurora::NWScript::Type returnType
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
An object in a Neverwinter Nights 2 area.
Common::UString formatParams(const FunctionContext &ctx)
Construct a string describing parameters of this function.
Creature * getPC()
Return the currently playing PC.
Module & getModule()
Return the module context.
NWScript utility functions.
Aurora::NWScript::Type parameters[13]
void movedPC()
Notify the module that the PC was moved.
ObjectType getType() const
Return the exact type of the object.
#define GfxMan
Shortcut for accessing the graphics manager.
static Common::UString formatFloat(float f, int width=18, int decimals=9)