1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Implemented foreground/background obstacles:

- obstacles now have "foreground" field
- if "foreground" field set, obstacle will appear on top of other
objects, such as units
- if "foreground" is not set, obstacle will appear below units
- updated schema and cleared up obstacles config
This commit is contained in:
Ivan Savenko
2023-06-06 15:53:14 +03:00
parent ee8c8dca7b
commit 428fb832c6
7 changed files with 62 additions and 208 deletions

View File

@@ -148,7 +148,11 @@ void BattleObstacleController::collectRenderableObjects(BattleRenderer & rendere
if (obstacle->obstacleType == CObstacleInstance::MOAT)
continue;
renderer.insert(EBattleFieldLayer::OBSTACLES, obstacle->pos, [this, obstacle]( BattleRenderer::RendererRef canvas ){
bool isForeground = obstacle->obstacleType == CObstacleInstance::USUAL && obstacle->getInfo().isForegroundObstacle;
auto layer = isForeground ? EBattleFieldLayer::OBSTACLES_FG : EBattleFieldLayer::OBSTACLES_BG;
renderer.insert(layer, obstacle->pos, [this, obstacle]( BattleRenderer::RendererRef canvas ){
auto img = getObstacleImage(*obstacle);
if(img)
{