Open drewnydrzew opened 7 months ago
I created 2 items with the top flag. When moving between them, a character appears "for a moment" and then hides behind the "top" sprite.
is it supposed to be like this or is it a bug?
`void Tile::drawCreatures(const Point& dest, LightView* lightView) { if (m_fill != Color::alpha) return; if (m_topDraws < m_topCorrection) return; // walking creatures for (const CreaturePtr& creature : m_walkingCreatures) { if (creature->isHidden()) continue; Point creatureDest(dest.x + ((creature->getPrewalkingPosition().x - m_position.x) * g_sprites.spriteSize() - m_drawElevation * g_sprites.getOffsetFactor()), dest.y + ((creature->getPrewalkingPosition().y - m_position.y) * g_sprites.spriteSize() - m_drawElevation * g_sprites.getOffsetFactor())); creature->draw(creatureDest, true, lightView); } // creatures std::vector<CreaturePtr> creaturesToDraw; int limit = g_adaptiveRenderer.creaturesLimit(); for (auto& thing : m_things) { if (!thing->isCreature() || thing->isHidden()) continue; if (limit-- <= 0) break; CreaturePtr creature = thing->static_self_cast<Creature>(); if (!creature || creature->isWalking()) continue; creature->draw(dest - m_drawElevation * g_sprites.getOffsetFactor(), true, lightView); } }
void Tile::drawTop(const Point& dest, LightView* lightView) { if (m_fill != Color::alpha) return; if (m_topDraws++ < m_topCorrection) return; // walking creatures for (const CreaturePtr& creature : m_walkingCreatures) { if (creature->isHidden()) continue; Point creatureDest(dest.x + ((creature->getPrewalkingPosition().x - m_position.x) * g_sprites.spriteSize() - m_drawElevation * g_sprites.getOffsetFactor()), dest.y + ((creature->getPrewalkingPosition().y - m_position.y) * g_sprites.spriteSize() - m_drawElevation * g_sprites.getOffsetFactor())); creature->draw(creatureDest, true, lightView); } // creatures std::vector<CreaturePtr> creaturesToDraw; int limit = g_adaptiveRenderer.creaturesLimit(); for (auto& thing : m_things) { if (!thing->isCreature() || thing->isHidden()) continue; if (limit-- <= 0) break; CreaturePtr creature = thing->static_self_cast<Creature>(); if (!creature || creature->isWalking()) continue; creature->draw(dest - m_drawElevation * g_sprites.getOffsetFactor(), true, lightView); } // effects limit = std::min<int>((int)m_effects.size() - 1, g_adaptiveRenderer.effetsLimit()); for (int i = limit; i >= 0; --i) { if (m_effects[i]->isHidden()) continue; m_effects[i]->draw(dest - m_drawElevation * g_sprites.getOffsetFactor(), m_position.x - g_map.getCentralPosition().x, m_position.y - g_map.getCentralPosition().y, true, lightView); } // top for (const ThingPtr& thing : m_things) { if (!thing->isOnTop() || thing->isHidden()) continue; thing->draw(dest, true, lightView); } }`
under the comment "// walking creatures" there is the code responsible for this. there is the same code in 2 functions.
I created 2 items with the top flag. When moving between them, a character appears "for a moment" and then hides behind the "top" sprite.
is it supposed to be like this or is it a bug?
under the comment "// walking creatures" there is the code responsible for this. there is the same code in 2 functions.