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