本文整理汇总了C++中Costume::getChoreId方法的典型用法代码示例。如果您正苦于以下问题:C++ Costume::getChoreId方法的具体用法?C++ Costume::getChoreId怎么用?C++ Costume::getChoreId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Costume
的用法示例。
在下文中一共展示了Costume::getChoreId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void Lua_V2::SetActorTurnChores() {
lua_Object actorObj = lua_getparam(1);
lua_Object leftChoreObj = lua_getparam(2);
lua_Object rightChoreObj = lua_getparam(3);
lua_Object costumeObj = lua_getparam(4);
Costume *costume;
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R')) {
return;
} else if (!lua_isnil(leftChoreObj) && !lua_isstring(leftChoreObj)) {
return;
} else if (!lua_isnil(rightChoreObj) && !lua_isstring(rightChoreObj)) {
return;
}
Actor *actor = getactor(actorObj);
if (!findCostume(costumeObj, actor, &costume))
return;
if (!costume) {
costume = actor->getCurrentCostume();
}
int leftChore = costume->getChoreId(lua_getstring(leftChoreObj));
int rightChore = costume->getChoreId(lua_getstring(rightChoreObj));
actor->setTurnChores(leftChore, rightChore, costume);
}
示例2: getactor
void Lua_V2::SetActorMumblechore() {
lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3);
Costume *costume;
int chore;
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R') ||
(!lua_isstring(choreObj) && !lua_isnil(choreObj))) {
return;
}
Actor *actor = getactor(actorObj);
if (!findCostume(costumeObj, actor, &costume))
return;
if (lua_isnil(choreObj)) {
chore = -1;
} else {
const char * choreStr = lua_getstring(choreObj);
chore = costume->getChoreId(choreStr);
}
actor->setMumbleChore(chore, costume);
}
示例3: getactor
// TODO: Implement, verify, and rename unknown 5th parameter
void Lua_V2::PlayActorChore() {
lua_Object actorObj = lua_getparam(1);
lua_Object choreObj = lua_getparam(2);
lua_Object costumeObj = lua_getparam(3);
lua_Object modeObj = lua_getparam(4);
/* lua_Object paramObj = */ lua_getparam(5);
if (!lua_isuserdata(actorObj) || lua_tag(actorObj) != MKTAG('A','C','T','R'))
return;
Actor *actor = getactor(actorObj);
if (!lua_isstring(choreObj) || !lua_isstring(costumeObj))
lua_pushnil();
bool mode = false;
// float param = 0.0;
if (!lua_isnil(modeObj)) {
if (lua_getnumber(modeObj) != 0.0)
mode = true;
//if (!lua_isnil(paramObj))
// if (lua_isnumber(paramObj))
// param = lua_getnumber(paramObj);
}
const char *choreName = lua_getstring(choreObj);
const char *costumeName = lua_getstring(costumeObj);
Costume *costume;
// If a new wear chore is set and it uses a different costume than the
// current one and neither of them is the shadow costume stop all active
// chores and remove the old costume before setting the new one.
//
// This is necessary, because always the last costume on the stack, even
// if it is not active, is returned by getCurrentCostume(). This would
// cause an issue if the costumes would have different joints and the lua
// code would consider a different costume active than the C code.
if (0 == strncmp("wear_", choreName, 5)) {
if (0 != strncmp("fx/dumbshadow.cos", costumeName, 17)) {
if (actor->getCurrentCostume() != NULL &&
actor->getCurrentCostume()->getFilename() != "fx/dumbshadow.cos" &&
actor->getCurrentCostume()->getFilename().compareToIgnoreCase(costumeName) != 0) {
actor->stopAllChores();
actor->setRestChore(-1, NULL);
actor->setWalkChore(-1, NULL);
actor->setTurnChores(-1, -1, NULL);
actor->setMumbleChore(-1, NULL);
actor->popCostume();
}
}
}
if (!findCostume(costumeObj, actor, &costume))
return;
EMIChore *chore = (EMIChore *)costume->getChore(choreName);
if (0 == strncmp("wear_", choreName, 5)) {
actor->setLastWearChore(costume->getChoreId(choreName), costume);
}
if (mode) {
costume->playChoreLooping(choreName);
} else {
costume->playChore(choreName);
}
if (chore) {
lua_pushusertag(chore->getId(), MKTAG('C','H','O','R'));
} else {
lua_pushnil();
}
}