MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / TilesInView

Function TilesInView

Source/engine/render/scrollrt.cpp:1481–1509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1479}
1480
1481void TilesInView(int *rcolumns, int *rrows)
1482{
1483 uint16_t screenWidth = GetScreenWidth();
1484 uint16_t viewportHeight = GetViewportHeight();
1485
1486 int columns = screenWidth / TILE_WIDTH;
1487 if ((screenWidth % TILE_WIDTH) != 0) {
1488 columns++;
1489 }
1490 int rows = viewportHeight / TILE_HEIGHT;
1491 if ((viewportHeight % TILE_HEIGHT) != 0) {
1492 rows++;
1493 }
1494
1495 if (*sgOptions.Graphics.zoom) {
1496 // Half the number of tiles, rounded up
1497 if ((columns & 1) != 0) {
1498 columns++;
1499 }
1500 columns /= 2;
1501 if ((rows & 1) != 0) {
1502 rows++;
1503 }
1504 rows /= 2;
1505 }
1506
1507 *rcolumns = columns;
1508 *rrows = rows;
1509}
1510
1511void CalcViewportGeometry()
1512{

Callers 2

TESTFunction · 0.85
CheckCursMoveFunction · 0.85

Calls 2

GetScreenWidthFunction · 0.85
GetViewportHeightFunction · 0.85

Tested by 1

TESTFunction · 0.68