本文整理汇总了C++中aurora::nwscript::FunctionContext::getCaller方法的典型用法代码示例。如果您正苦于以下问题:C++ FunctionContext::getCaller方法的具体用法?C++ FunctionContext::getCaller怎么用?C++ FunctionContext::getCaller使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aurora::nwscript::FunctionContext
的用法示例。
在下文中一共展示了FunctionContext::getCaller方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: actionJumpToObject
void Functions::actionJumpToObject(Aurora::NWScript::FunctionContext &ctx) {
// TODO: walkStraightLineToPoint
// bool walkStraightLineToPoint = ctx.getParams()[1].getInt() != 0;
NWN2::Object *object = NWN2::ObjectContainer::toObject(ctx.getCaller());
NWN2::Object *moveTo = NWN2::ObjectContainer::toObject(getParamObject(ctx, 0));
if (!object || !moveTo)
return;
float x, y, z;
moveTo->getPosition(x, y, z);
jumpTo(object, moveTo->getArea(), x, y, z);
}
示例2: getDistanceToObject
void Functions::getDistanceToObject(Aurora::NWScript::FunctionContext &ctx) {
ctx.getReturn() = -1.0f;
NWN2::Object *object1 = NWN2::ObjectContainer::toObject(getParamObject(ctx, 0));
NWN2::Object *object2 = NWN2::ObjectContainer::toObject(ctx.getCaller());
if (!object1 || !object2)
return;
float x1, y1, z1;
object1->getPosition(x1, y1, z1);
float x2, y2, z2;
object2->getPosition(x2, y2, z2);
ctx.getReturn() = sqrtf(SQR(x1 - x2) + SQR(y1 - y2) + SQR(z1 - z2));
}
示例3: actionMoveToLocation
void Functions::actionMoveToLocation(Aurora::NWScript::FunctionContext &ctx) {
// TODO: runType
// int32 runType = ctx.getParams()[1].getInt();
// int32 moveAnim = ctx.getParams()[2].getInt();
Jade::Object *object = Jade::ObjectContainer::toObject(ctx.getCaller());
Jade::Location *moveTo = Jade::ObjectContainer::toLocation(ctx.getParams()[0].getEngineType());
if (!object || !moveTo)
return;
float x, y, z;
moveTo->getPosition(x, y, z);
jumpTo(object, moveTo->getArea(), x, y, z);
unimplementedFunction(ctx);
}
示例4: beginConversation
void Functions::beginConversation(Aurora::NWScript::FunctionContext &ctx) {
ctx.getReturn() = 0;
// Get the script object parameters
Aurora::NWScript::Object *obj1 = ctx.getCaller();
Aurora::NWScript::Object *obj2 = getParamObject(ctx, 1);
if (!obj2)
obj2 = ctx.getTriggerer();
if (!obj2)
obj2 = _game->getModule().getPC();
// Try to convert them to an NWN Creature and Object
NWN::Creature *pc = NWN::ObjectContainer::toPC(obj2);
NWN::Object *object = NWN::ObjectContainer::toObject(obj1);
// Try the other way round, if necessary
if (!pc || !object) {
pc = NWN::ObjectContainer::toPC(obj1);
object = NWN::ObjectContainer::toObject(obj2);
}
// Fail
if (!pc || !object)
return;
if (object->getPCSpeaker()) {
if (object->getPCSpeaker() != pc) {
Creature *otherPC = NWN::ObjectContainer::toPC(object->getPCSpeaker());
warning("Functions::beginConversation(): "
"Object \"%s\" already in conversation with PC \"%s\"",
object->getTag().c_str(), otherPC ? otherPC->getName().c_str() : "");
return;
}
}
Common::UString conversation = ctx.getParams()[0].getString();
if (conversation.empty())
conversation = object->getConversation();
ctx.getReturn() = _game->getModule().startConversation(conversation, *pc, *object);
}
示例5: actionStartConversation
void Functions::actionStartConversation(Aurora::NWScript::FunctionContext &ctx) {
Jade::Object *source = Jade::ObjectContainer::toObject(ctx.getCaller());
Jade::Object *target = Jade::ObjectContainer::toObject(getParamObject(ctx, 0));
if (!source || !target)
return;
Creature *pc = Jade::ObjectContainer::toPC(target);
if (!pc) {
warning("TODO: ActionStartConversation: Non-PC target \"%s\"", target->getTag().c_str());
return;
}
if (source->getPCSpeaker()) {
if (source->getPCSpeaker() != pc) {
Creature *otherPC = Jade::ObjectContainer::toPC(source->getPCSpeaker());
warning("Functions::actionStartConversation(): "
"Object \"%s\" already in conversation with PC \"%s\"",
source->getTag().c_str(), otherPC ? otherPC->getName().c_str() : "");
return;
}
}
Common::UString conversation = ctx.getParams()[1].getString();
if (conversation.empty())
conversation = source->getConversation();
/* TODO
const int32 range = ctx.getParams()[2].getInt();
const int32 delay = ctx.getParams()[3].getInt();
const bool ignoreLOS = ctx.getParams()[4].getInt() != 0;
*/
const bool noWidescreen = ctx.getParams()[5].getInt() != 0;
const bool resetZoom = ctx.getParams()[6].getInt() != 0;
_game->getModule().startConversation(conversation, *pc, *source, noWidescreen, resetZoom);
}
示例6: actionSpeakStringByStrRef
void Functions::actionSpeakStringByStrRef(Aurora::NWScript::FunctionContext &ctx) {
Jade::Object *object = Jade::ObjectContainer::toObject(ctx.getCaller());
if (object)
object->speakString(ctx.getParams()[0].getInt());
}
示例7: actionCloseDoor
void Functions::actionCloseDoor(Aurora::NWScript::FunctionContext &ctx) {
Placeable *door = Jade::ObjectContainer::toPlaceable(getParamObject(ctx, 0));
if (door)
door->close(Jade::ObjectContainer::toObject(ctx.getCaller()));
}
示例8: actionSpeakString
void Functions::actionSpeakString(Aurora::NWScript::FunctionContext &ctx) {
NWN::Object *object = NWN::ObjectContainer::toObject(ctx.getCaller());
if (object)
object->speakString(ctx.getParams()[0].getString(), ctx.getParams()[1].getInt());
}
示例9: actionCloseDoor
void Functions::actionCloseDoor(Aurora::NWScript::FunctionContext &ctx) {
Door *door = NWN::ObjectContainer::toDoor(getParamObject(ctx, 0));
if (door)
door->close(NWN::ObjectContainer::toObject(ctx.getCaller()));
}
示例10: actionOpenDoor
void Functions::actionOpenDoor(Aurora::NWScript::FunctionContext &ctx) {
Door *door = Witcher::ObjectContainer::toDoor(getParamObject(ctx, 0));
if (door)
door->open(Witcher::ObjectContainer::toObject(ctx.getCaller()));
}