本文整理汇总了C++中THAnimation::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ THAnimation::setPosition方法的具体用法?C++ THAnimation::setPosition怎么用?C++ THAnimation::setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THAnimation
的用法示例。
在下文中一共展示了THAnimation::setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l_map_updateblueprint
//.........这里部分代码省略.........
for(int iX = iNewX; iX < iNewX + iNewW; ++iX)
{
THMapNode *pNode = pMap->getNodeUnchecked(iX, iY);
if(is_valid(entire_invalid, pNode))
pNode->iBlock[3] = iFloorTileGood;
else
{
pNode->iBlock[3] = iFloorTileBad;
valid = false;
}
pNode->iFlags |= ((pNode->iFlags & THMN_Passable) != 0) ? THMN_PassableIfNotForBlueprint : 0;
}
}
// Set center floor tiles
if(iNewW >= 2 && iNewH >= 2)
{
int iCenterX = iNewX + (iNewW - 2) / 2;
int iCenterY = iNewY + (iNewH - 2) / 2;
THMapNode *pNode = pMap->getNodeUnchecked(iCenterX, iCenterY);
if(pNode->iBlock[3] == iFloorTileGood)
pNode->iBlock[3] = iFloorTileGoodCenter + 2;
pNode = pMap->getNodeUnchecked(iCenterX + 1, iCenterY);
if(pNode->iBlock[3] == iFloorTileGood)
pNode->iBlock[3] = iFloorTileGoodCenter + 1;
pNode = pMap->getNodeUnchecked(iCenterX, iCenterY + 1);
if(pNode->iBlock[3] == iFloorTileGood)
pNode->iBlock[3] = iFloorTileGoodCenter + 0;
pNode = pMap->getNodeUnchecked(iCenterX + 1, iCenterY + 1);
if(pNode->iBlock[3] == iFloorTileGood)
pNode->iBlock[3] = iFloorTileGoodCenter + 3;
}
// Set wall animations
int iNextAnim = 1;
THAnimation *pAnim = l_map_updateblueprint_getnextanim(L, iNextAnim);
THMapNode *pNode = pMap->getNodeUnchecked(iNewX, iNewY);
pAnim->setAnimation(pAnims, iWallAnimTopCorner);
pAnim->setFlags(THDF_ListBottom | (is_valid(entire_invalid, pNode) ? 0 : THDF_AltPalette));
pAnim->attachToTile(pNode, 0);
for(int iX = iNewX; iX < iNewX + iNewW; ++iX)
{
if(iX != iNewX)
{
pAnim = l_map_updateblueprint_getnextanim(L, iNextAnim);
pNode = pMap->getNodeUnchecked(iX, iNewY);
pAnim->setAnimation(pAnims, iWallAnim);
pAnim->setFlags(THDF_ListBottom | (is_valid(entire_invalid, pNode) ? 0 : THDF_AltPalette));
pAnim->attachToTile(pNode, 0);
pAnim->setPosition(0, 0);
}
pAnim = l_map_updateblueprint_getnextanim(L, iNextAnim);
pNode = pMap->getNodeUnchecked(iX, iNewY + iNewH - 1);
pAnim->setAnimation(pAnims, iWallAnim);
pAnim->setFlags(THDF_ListBottom | (is_valid(entire_invalid, pNode) ? 0 : THDF_AltPalette));
pNode = pMap->getNodeUnchecked(iX, iNewY + iNewH);
pAnim->attachToTile(pNode, 0);
pAnim->setPosition(0, -1);
}
for(int iY = iNewY; iY < iNewY + iNewH; ++iY)
{
if(iY != iNewY)
{
pAnim = l_map_updateblueprint_getnextanim(L, iNextAnim);
pNode = pMap->getNodeUnchecked(iNewX, iY);
pAnim->setAnimation(pAnims, iWallAnim);
pAnim->setFlags(THDF_ListBottom | THDF_FlipHorizontal | (is_valid(entire_invalid, pNode) ? 0 : THDF_AltPalette));
pAnim->attachToTile(pNode, 0);
pAnim->setPosition(2, 0);
}
pAnim = l_map_updateblueprint_getnextanim(L, iNextAnim);
pNode = pMap->getNodeUnchecked(iNewX + iNewW - 1, iY);
pAnim->setAnimation(pAnims, iWallAnim);
pAnim->setFlags(THDF_ListBottom | THDF_FlipHorizontal | (is_valid(entire_invalid, pNode) ? 0 : THDF_AltPalette));
pNode = pMap->getNodeUnchecked(iNewX + iNewW, iY);
pAnim->attachToTile(pNode, 0);
pAnim->setPosition(2, -1);
}
// Clear away extra animations
int iAnimCount = (int)lua_objlen(L, 10);
if(iAnimCount >= iNextAnim)
{
for(int i = iNextAnim; i <= iAnimCount; ++i)
{
pAnim = l_map_updateblueprint_getnextanim(L, iNextAnim);
pAnim->removeFromTile();
lua_pushnil(L);
lua_rawseti(L, 10, i);
}
}
lua_pushboolean(L, valid ? 1 : 0);
return 1;
}