Skip to content

Commit 7b94314

Browse files
WIP: Support proper display of maps smaller than screens.
1 parent 9a1c29f commit 7b94314

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/Game.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2093,7 +2093,7 @@ inline void Game::drawMapDebugAreas(int left, int top, int right, int bot, int s
20932093
}
20942094
}
20952095

2096-
inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int viewportY, int localTeam, Uint32 drawOptions)
2096+
inline void Game::drawMapBuilding(int x, int y, int gid, int localTeam, Uint32 drawOptions)
20972097
{
20982098
Building *building = teams[Building::GIDtoTeam(gid)]->myBuildings[Building::GIDtoID(gid)];
20992099
assert(building);
@@ -2292,9 +2292,11 @@ inline void Game::drawMapGroundBuildings(int left, int top, int right, int bot,
22922292
|| (building->seenByMask & visibleTeams)
22932293
|| map.isFOWDiscovered(x+viewportX, y+viewportY, visibleTeams))
22942294
{
2295-
int px,py;
2295+
int px, py;
22962296
map.mapCaseToDisplayable(building->posXLocal, building->posYLocal, &px, &py, viewportX, viewportY);
2297-
drawMapBuilding(px, py, gid, viewportX, viewportY, localTeam, drawOptions);
2297+
for (;py >> 5 < bot; py += map.h * 32)
2298+
for (;px >> 5 < right; px += map.w * 32)
2299+
drawMapBuilding(px, py, gid, localTeam, drawOptions);
22982300
drawnBuildings.insert(building);
22992301
}
23002302
}

src/Game.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class Game
205205
///draws debug information. switched in the code.
206206
inline void drawMapDebugAreas(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions);
207207
inline void drawMapGroundBuildings(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions, std::set<Building*> *visibleBuildings);
208-
inline void drawMapBuilding(int x, int y, int gid, int viewportX, int viewportY, int localTeam, Uint32 drawOptions);
208+
inline void drawMapBuilding(int x, int y, int gid, int localTeam, Uint32 drawOptions);
209209
inline void drawMapAreas(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions);
210210
inline void drawMapArea(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions, Map * map, bool (Map::*mapIs)(int, int) const, int areaAnimationTick, AreaType areaType);
211211
inline void drawMapAirUnits(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions);

0 commit comments

Comments
 (0)