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);
static const FunctionSignature kFunctionSignatures[]
The table defining the signature (return type and type of parameters) of each engine function...
Creature * getPC()
Return the currently playing PC.
void jumpTo(NWN::Object *object, Area *area, float x, float y, float z)
The global graphics manager.
const Common::UString & getResRef()
Return the area's resref (resource ID).
A container of Neverwinter Nights objects.
std::vector< class Variable > Parameters
A class holding an UTF-8 string.
Common::UString formatType(Type type)
Construct a string describing this variable type.
static Common::UString formatFloat(float f, int width=18, int decimals=9)
void unimplementedFunction(Aurora::NWScript::FunctionContext &ctx)
Area * getArea() const
Return the area this object is currently in.
Object * getCaller() const
Basic Neverwinter Nights type definitions.
#define ARRAYSIZE(x)
Macro which determines the number of entries in a fixed size array.
static const FunctionDefaults kFunctionDefaults[]
The table defining the default values for the parameters of each engine function. ...
static NWN::Object * toObject(::Aurora::NWScript::Object *object)
An area in Neverwinter Nights, holding all objects and room tiles within, as well as general area pro...
Fake value to describe the calling object in a script.
const Aurora::NWScript::Variable * defaults[6]
The NWScript function manager.
The context needed to run a Neverwinter Nights module.
Aurora::NWScript::Type returnType
The context holding a Neverwinter Nights area.
static Aurora::NWScript::Object * getParamObject(const Aurora::NWScript::FunctionContext &ctx, size_t n)
const char * c_str() const
Return the (utf8 encoded) string data.
static UString format(const char *s,...) GCC_PRINTF(1
Print formatted data into an UString object, similar to sprintf().
Utility templates and functions.
std::vector< Type > Signature
const Common::UString & getName() const
static const FunctionPointer kFunctionPointers[]
The table defining the name and function pointer of each engine function.
void warning(const char *s,...)
static int32 getRandom(int min, int max, int32 n=1)
An object in a Neverwinter Nights area.
void(Functions::* funcPtr)(Aurora::NWScript::FunctionContext &ctx)
A creature in a Neverwinter Nights area.
Tables defining the engine functions in Neverwinter Nights.
Common::UString formatParams(const FunctionContext &ctx)
Construct a string describing parameters of this function.
The context handling the gameplay in Neverwinter Nights.
Aurora::NWScript::Type parameters[8]
NWScript utility functions.
ObjectType getType() const
Return the exact type of the object.
void movedPC()
Notify the module that the PC was moved.
Neverwinter Nights engine functions.
Module & getModule()
Return the module context.
#define GfxMan
Shortcut for accessing the graphics manager.