本文整理汇总了C++中CreaturePtr::isWalking方法的典型用法代码示例。如果您正苦于以下问题:C++ CreaturePtr::isWalking方法的具体用法?C++ CreaturePtr::isWalking怎么用?C++ CreaturePtr::isWalking使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreaturePtr
的用法示例。
在下文中一共展示了CreaturePtr::isWalking方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
//.........这里部分代码省略.........
g_painter->setOpacity(g_map.getZoneOpacity());
g_painter->setColor(g_map.getZoneColor(flag));
restore = true;
break;
}
}
}
if((thing->isGround() && drawFlags & Otc::DrawGround) ||
(thing->isGroundBorder() && drawFlags & Otc::DrawGroundBorders) ||
(thing->isOnBottom() && drawFlags & Otc::DrawOnBottom)) {
thing->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
if(restore) {
g_painter->resetOpacity();
g_painter->resetColor();
}
}
m_drawElevation += thing->getElevation();
if(m_drawElevation > Otc::MAX_ELEVATION)
m_drawElevation = Otc::MAX_ELEVATION;
}
}
int redrawPreviousTopW = 0;
int redrawPreviousTopH = 0;
if(drawFlags & Otc::DrawItems) {
// now common items in reverse order
for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) {
const ThingPtr& thing = *it;
if(thing->isOnTop() || thing->isOnBottom() || thing->isGroundBorder() || thing->isGround() || thing->isCreature())
break;
thing->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
if(thing->isLyingCorpse()) {
redrawPreviousTopW = std::max(thing->getWidth(), redrawPreviousTopW);
redrawPreviousTopH = std::max(thing->getHeight(), redrawPreviousTopH);
}
m_drawElevation += thing->getElevation();
if(m_drawElevation > Otc::MAX_ELEVATION)
m_drawElevation = Otc::MAX_ELEVATION;
}
}
// after we render 2x2 lying corpses, we must redraw previous creatures/ontop above them
if(redrawPreviousTopH > 0 || redrawPreviousTopW > 0) {
int topRedrawFlags = drawFlags & (Otc::DrawCreatures | Otc::DrawEffects | Otc::DrawOnTop | Otc::DrawAnimations);
if(topRedrawFlags) {
for(int x=-redrawPreviousTopW;x<=0;++x) {
for(int y=-redrawPreviousTopH;y<=0;++y) {
if(x == 0 && y == 0)
continue;
const TilePtr& tile = g_map.getTile(m_position.translated(x,y));
if(tile)
tile->draw(dest + Point(x*Otc::TILE_PIXELS, y*Otc::TILE_PIXELS)*scaleFactor, scaleFactor, topRedrawFlags);
}
}
}
}
// creatures
if(drawFlags & Otc::DrawCreatures) {
if(animate) {
for(const CreaturePtr& creature : m_walkingCreatures) {
creature->draw(Point(dest.x + ((creature->getPosition().x - m_position.x)*Otc::TILE_PIXELS - m_drawElevation)*scaleFactor,
dest.y + ((creature->getPosition().y - m_position.y)*Otc::TILE_PIXELS - m_drawElevation)*scaleFactor), scaleFactor, animate, lightView);
}
}
for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) {
const ThingPtr& thing = *it;
if(!thing->isCreature())
continue;
CreaturePtr creature = thing->static_self_cast<Creature>();
if(creature && (!creature->isWalking() || !animate))
creature->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
}
}
// effects
if(drawFlags & Otc::DrawEffects)
for(const EffectPtr& effect : m_effects)
effect->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
// top items
if(drawFlags & Otc::DrawOnTop)
for(const ThingPtr& thing : m_things)
if(thing->isOnTop())
thing->draw(dest, scaleFactor, animate, lightView);
// draw translucent light (for tiles beneath holes)
if(hasTranslucentLight() && lightView) {
Light light;
light.intensity = 1;
lightView->addLightSource(dest + Point(16,16) * scaleFactor, scaleFactor, light);
}
}
示例2: draw
void Tile::draw(const Point& dest, float scaleFactor, int drawFlags, LightView *lightView)
{
bool animate = drawFlags & Otc::DrawAnimations;
// Added for MapEditor purposes.
// This check will and must evaluate to false if using
// normal client, unless some flag error.
// Save last color
Color lastColor = g_painter->getColor();
if((m_flags & TILESTATE_HOUSE) == TILESTATE_HOUSE)
g_painter->setColor(Color::blue);
else if((m_flags & TILESTATE_PROTECTIONZONE) == TILESTATE_PROTECTIONZONE)
g_painter->setColor(Color::green);
// first bottom items
if(drawFlags & (Otc::DrawGround | Otc::DrawGroundBorders | Otc::DrawOnBottom)) {
m_drawElevation = 0;
for(const ThingPtr& thing : m_things) {
if(!thing->isGround() && !thing->isGroundBorder() && !thing->isOnBottom())
break;
if((thing->isGround() && drawFlags & Otc::DrawGround) ||
(thing->isGroundBorder() && drawFlags & Otc::DrawGroundBorders) ||
(thing->isOnBottom() && drawFlags & Otc::DrawOnBottom)) {
thing->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
}
m_drawElevation += thing->getElevation();
if(m_drawElevation > Otc::MAX_ELEVATION)
m_drawElevation = Otc::MAX_ELEVATION;
}
}
int redrawPreviousTopW = 0;
int redrawPreviousTopH = 0;
if(drawFlags & Otc::DrawItems) {
// now common items in reverse order
for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) {
const ThingPtr& thing = *it;
if(thing->isOnTop() || thing->isOnBottom() || thing->isGroundBorder() || thing->isGround() || thing->isCreature())
break;
thing->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
if(thing->isLyingCorpse()) {
redrawPreviousTopW = std::max(thing->getWidth(), redrawPreviousTopW);
redrawPreviousTopH = std::max(thing->getHeight(), redrawPreviousTopH);
}
m_drawElevation += thing->getElevation();
if(m_drawElevation > Otc::MAX_ELEVATION)
m_drawElevation = Otc::MAX_ELEVATION;
}
}
// after we render 2x2 lying corpses, we must redraw previous creatures/ontop above them
if(redrawPreviousTopH > 0 || redrawPreviousTopW > 0) {
int topRedrawFlags = drawFlags & (Otc::DrawCreatures | Otc::DrawEffects | Otc::DrawOnTop | Otc::DrawAnimations);
if(topRedrawFlags) {
for(int x=-redrawPreviousTopW;x<=0;++x) {
for(int y=-redrawPreviousTopH;y<=0;++y) {
if(x == 0 && y == 0)
continue;
const TilePtr& tile = g_map.getTile(m_position.translated(x,y));
if(tile)
tile->draw(dest + Point(x*Otc::TILE_PIXELS, y*Otc::TILE_PIXELS)*scaleFactor, scaleFactor, topRedrawFlags);
}
}
}
}
// creatures
if(drawFlags & Otc::DrawCreatures) {
if(animate) {
for(const CreaturePtr& creature : m_walkingCreatures) {
creature->draw(Point(dest.x + ((creature->getPosition().x - m_position.x)*Otc::TILE_PIXELS - m_drawElevation)*scaleFactor,
dest.y + ((creature->getPosition().y - m_position.y)*Otc::TILE_PIXELS - m_drawElevation)*scaleFactor), scaleFactor, animate, lightView);
}
}
for(auto it = m_things.rbegin(); it != m_things.rend(); ++it) {
const ThingPtr& thing = *it;
if(!thing->isCreature())
continue;
CreaturePtr creature = thing->static_self_cast<Creature>();
if(creature && (!creature->isWalking() || !animate))
creature->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
}
}
// effects
if(drawFlags & Otc::DrawEffects) {
for(const EffectPtr& effect : m_effects){
effect->draw(dest - m_drawElevation*scaleFactor, scaleFactor, animate, lightView);
}
}
// top items
if(drawFlags & Otc::DrawOnTop) {
for(const ThingPtr& thing : m_things) {
//.........这里部分代码省略.........