• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ witcher::Object类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中witcher::Object的典型用法代码示例。如果您正苦于以下问题:C++ Object类的具体用法?C++ Object怎么用?C++ Object使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Object类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getArea

void Functions::getArea(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Aurora::NWScript::Object *) 0;

	Witcher::Object *object = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0));
	if (object)
		ctx.getReturn() = (Aurora::NWScript::Object *) object->getArea();
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:7,代码来源:functions_object.cpp


示例2: getLocation

void Functions::getLocation(Aurora::NWScript::FunctionContext &ctx) {
	Witcher::Object *object = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0));
	if (!object)
		return;

	ctx.getReturn() = object->getLocation();
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:7,代码来源:functions_object.cpp


示例3: getNearestObjectByTag

void Functions::getNearestObjectByTag(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Object *) 0;

	const Common::UString &tag = ctx.getParams()[0].getString();
	if (tag.empty())
		return;

	Witcher::Object *target = Witcher::ObjectContainer::toObject(getParamObject(ctx, 1));
	if (!target)
		return;

	size_t nth = MAX<int32>(ctx.getParams()[2].getInt() - 1, 0);

	Common::ScopedPtr<Aurora::NWScript::ObjectSearch> search(_game->getModule().findObjectsByTag(tag));
	Aurora::NWScript::Object *object = 0;

	std::list<Object *> objects;
	while ((object = search->next())) {
		// Needs to be a valid object, not the target, but in the target's area
		Witcher::Object *witcherObject = Witcher::ObjectContainer::toObject(object);
		if (!witcherObject || (witcherObject == target) || (witcherObject->getArea() != target->getArea()))
			continue;

		objects.push_back(witcherObject);
	}

	objects.sort(ObjectDistanceSort(*target));

	std::list<Object *>::iterator it = objects.begin();
	for (size_t n = 0; (n < nth) && (it != objects.end()); ++n)
		++it;

	if (it != objects.end())
		ctx.getReturn() = *it;
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:35,代码来源:functions_object.cpp


示例4: getObjectType

void Functions::getObjectType(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (int32) kObjectTypeInvalid;

	Witcher::Object *object = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0));
	if (!object || ((uint32)object->getType() >= kObjectTypeMAX))
		return;

	ctx.getReturn() = (int32) object->getType();
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:9,代码来源:functions_object.cpp


示例5: playSound

void Functions::playSound(Aurora::NWScript::FunctionContext &ctx) {
	Witcher::Object *object = Witcher::ObjectContainer::toObject(ctx.getCaller());

	if (object)
		object->playSound(ctx.getParams()[0].getString());
	else
		::Engines::playSound(ctx.getParams()[0].getString(), Sound::kSoundTypeSFX);

	unimplementedFunction(ctx);
}
开发者ID:clone2727,项目名称:xoreos,代码行数:10,代码来源:functions_sound.cpp


示例6: getPosition

void Functions::getPosition(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn().setVector(0.0f, 0.0f, 0.0f);

	Witcher::Object *object = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0));
	if (!object)
		return;

	float x, y, z;
	object->getPosition(x, y, z);

	ctx.getReturn().setVector(x, y, z);
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:12,代码来源:functions_object.cpp


示例7: playSoundByStrRef

void Functions::playSoundByStrRef(Aurora::NWScript::FunctionContext &ctx) {
	Witcher::Object *object = Witcher::ObjectContainer::toObject(ctx.getCaller());

	const Common::UString sound = TalkMan.getSoundResRef((uint32) ctx.getParams()[0].getInt());

	// TODO: Run as action
	// bool runAsAction = ctx.getParams()[1].getInt() != 0;

	if (object)
		object->playSound(sound);
	else
		::Engines::playSound(sound, Sound::kSoundTypeVoice);
}
开发者ID:clone2727,项目名称:xoreos,代码行数:13,代码来源:functions_sound.cpp


示例8: actionMoveToObject

void Functions::actionMoveToObject(Aurora::NWScript::FunctionContext &ctx) {
	Witcher::Object *object = Witcher::ObjectContainer::toObject(ctx.getCaller());
	Witcher::Object *moveTo = Witcher::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);

	unimplementedFunction(ctx);
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:14,代码来源:functions_action.cpp


示例9: jumpToObject

void Functions::jumpToObject(Aurora::NWScript::FunctionContext &ctx) {
	// TODO: walkStraightLineToPoint
	// bool walkStraightLineToPoint = ctx.getParams()[1].getInt() != 0;

	Witcher::Object *object = Witcher::ObjectContainer::toObject(ctx.getCaller());
	Witcher::Object *moveTo = Witcher::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);
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:15,代码来源:functions_object.cpp


示例10: addObject

void ObjectContainer::addObject(Witcher::Object &object) {
	lock();

	::Aurora::NWScript::ObjectContainer::addObject(object);

	_objects[object.getType()].push_back(&object);

	unlock();
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:9,代码来源:objectcontainer.cpp


示例11: removeObject

void ObjectContainer::removeObject(Witcher::Object &object) {
	lock();

	_objects[object.getType()].remove(&object);

	::Aurora::NWScript::ObjectContainer::removeObject(object);

	unlock();
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:9,代码来源:objectcontainer.cpp


示例12: getNearestObject

void Functions::getNearestObject(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Aurora::NWScript::Object *) 0;

	Witcher::Object *target = Witcher::ObjectContainer::toObject(getParamObject(ctx, 1));
	if (!target)
		return;

	// Bitfield of type(s) to check for
	uint32 type = ctx.getParams()[0].getInt();
	// We want the nth nearest object
	size_t nth  = MAX<int32>(ctx.getParams()[2].getInt() - 1, 0);

	Aurora::NWScript::ObjectSearch *search = _game->getModule().findObjects();
	Aurora::NWScript::Object       *object = 0;

	std::list<Object *> objects;
	while ((object = search->next())) {
		// Needs to be a valid object, not the target, but in the target's area
		Witcher::Object *witcherObject = Witcher::ObjectContainer::toObject(object);
		if (!witcherObject || (witcherObject == target) || (witcherObject->getArea() != target->getArea()))
			continue;

		// Ignore invalid object types
		const uint32 objectType = (uint32) witcherObject->getType();
		if (objectType >= kObjectTypeMAX)
			continue;

		if (type & objectType)
			objects.push_back(witcherObject);
	}

	delete search;

	objects.sort(ObjectDistanceSort(*target));

	std::list<Object *>::iterator it = objects.begin();
	for (size_t n = 0; (n < nth) && (it != objects.end()); ++n)
		++it;

	if (it != objects.end())
		ctx.getReturn() = *it;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:42,代码来源:functions_object.cpp


示例13: getNearestCreature

void Functions::getNearestCreature(Aurora::NWScript::FunctionContext &ctx) {
	ctx.getReturn() = (Aurora::NWScript::Object *) 0;

	Witcher::Object *target = Witcher::ObjectContainer::toObject(getParamObject(ctx, 2));
	if (!target)
		return;

	size_t nth = MAX<int32>(ctx.getParams()[3].getInt() - 1, 0);

	/* TODO: Criteria:
	 *
	 * int crit1Type  = ctx.getParams()[0].getInt();
	 * int crit1Value = ctx.getParams()[1].getInt();
	 * int crit2Type  = ctx.getParams()[4].getInt();
	 * int crit2Value = ctx.getParams()[5].getInt();
	 * int crit3Type  = ctx.getParams()[6].getInt();
	 * int crit3Value = ctx.getParams()[7].getInt();
	 */

	Aurora::NWScript::ObjectSearch *search = _game->getModule().findObjects();
	Aurora::NWScript::Object       *object = 0;

	std::list<Object *> creatures;
	while ((object = search->next())) {
		Creature *creature = Witcher::ObjectContainer::toCreature(object);

		if (creature && (creature != target) && (creature->getArea() == target->getArea()))
			creatures.push_back(creature);
	}

	delete search;

	creatures.sort(ObjectDistanceSort(*target));

	std::list<Object *>::iterator it = creatures.begin();
	for (size_t n = 0; (n < nth) && (it != creatures.end()); ++n)
		++it;

	if (it != creatures.end())
		ctx.getReturn() = *it;
}
开发者ID:clone2727,项目名称:xoreos,代码行数:41,代码来源:functions_object.cpp


示例14: actionSpeakString

void Functions::actionSpeakString(Aurora::NWScript::FunctionContext &ctx) {
	Witcher::Object *object = Witcher::ObjectContainer::toObject(ctx.getCaller());

	if (object)
		object->speakString(ctx.getParams()[0].getString(), ctx.getParams()[1].getInt());
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:6,代码来源:functions_action.cpp


示例15:

ObjectDistanceSort::ObjectDistanceSort(const Witcher::Object &target) {
	target.getPosition(xt, yt, zt);
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:3,代码来源:objectcontainer.cpp


示例16: getDistance

float ObjectDistanceSort::getDistance(Witcher::Object &a) {
	float x, y, z;
	a.getPosition(x, y, z);

	return ABS(x - xt) + ABS(y - yt) + ABS(z - zt);
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:6,代码来源:objectcontainer.cpp


示例17: getName

void Functions::getName(Aurora::NWScript::FunctionContext &ctx) {
	// TODO: bOriginalName

	Witcher::Object *object = Witcher::ObjectContainer::toObject(getParamObject(ctx, 0));
	ctx.getReturn().getString() = object ? object->getName().getString() : "";
}
开发者ID:Supermanu,项目名称:xoreos,代码行数:6,代码来源:functions_object.cpp



注:本文中的witcher::Object类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ldk::CompoundPtr类代码示例发布时间:2022-05-31
下一篇:
C++ wiselib::WiselibApplication类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap