MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / render

Method render

game/ui/tileview/battletileview.cpp:413–1585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

411}
412
413void BattleTileView::render()
414{
415 Renderer &r = *fw().renderer;
416 r.clear();
417 r.setPalette(this->pal);
418
419 if (hideDisplay)
420 {
421 hiddenBarTicksAccumulated++;
422 if (hiddenBarTicksAccumulated > 10)
423 {
424 updateHiddenBar();
425 }
426 hiddenForm->render();
427 return;
428 }
429
430 // Rotate Icons
431 {
432 healingIconTicksAccumulated++;
433 healingIconTicksAccumulated %= 2 * HEALING_ICON_ANIMATION_DELAY;
434 lowMoraleIconTicksAccumulated++;
435 lowMoraleIconTicksAccumulated %= 2 * LOWMORALE_ICON_ANIMATION_DELAY;
436 psiIconTicksAccumulated++;
437 psiIconTicksAccumulated %= 2 * PSI_ICON_ANIMATION_DELAY;
438 selectionFrameTicksAccumulated++;
439 selectionFrameTicksAccumulated %= 2 * SELECTION_FRAME_ANIMATION_DELAY;
440 iconAnimationTicksAccumulated++;
441 iconAnimationTicksAccumulated %= targetLocationIcons.size() * TARGET_ICONS_ANIMATION_DELAY;
442 focusAnimationTicksAccumulated++;
443 focusAnimationTicksAccumulated %=
444 (2 * FOCUS_ICONS_ANIMATION_FRAMES - 2) * FOCUS_ICONS_ANIMATION_DELAY;
445 }
446
447 // screenOffset.x/screenOffset.y is the 'amount added to the tile coords' - so we want
448 // the inverse to tell which tiles are at the screen bounds
449 auto topLeft = offsetScreenToTileCoords(Vec2<int>{-isoTileSize.x, -isoTileSize.y}, 0);
450 auto topRight = offsetScreenToTileCoords(Vec2<int>{dpySize.x, -isoTileSize.y}, 0);
451 auto bottomLeft = offsetScreenToTileCoords(Vec2<int>{-isoTileSize.x, dpySize.y}, map.size.z);
452 auto bottomRight = offsetScreenToTileCoords(Vec2<int>{dpySize.x, dpySize.y}, map.size.z);
453
454 int minX = std::max(0, topLeft.x);
455 int maxX = std::min(map.size.x, bottomRight.x);
456
457 int minY = std::max(0, topRight.y);
458 int maxY = std::min(map.size.y, bottomLeft.y);
459
460 int zFrom = 0;
461 int zTo = maxZDraw;
462
463 switch (layerDrawingMode)
464 {
465 case LayerDrawingMode::UpToCurrentLevel:
466 zFrom = 0;
467 zTo = battle.battleViewZLevel;
468 break;
469 case LayerDrawingMode::AllLevels:
470 zFrom = 0;

Callers

nothing calls this directly

Calls 15

ColourClass · 0.85
formatFunction · 0.85
getBoolMethod · 0.80
insertMethod · 0.80
emptyMethod · 0.80
getTileMethod · 0.80
getUnitIfPresentMethod · 0.80
getUnitMethod · 0.80
endMethod · 0.80
isRelatedToMethod · 0.80
getLayerCountMethod · 0.80
getVisibleMethod · 0.80

Tested by

no test coverage detected