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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user