Skip to content

Commit

Permalink
WIP: Support proper display of maps smaller than screens.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanemagnenat committed Apr 30, 2023
1 parent 9a1c29f commit 7b94314
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,7 @@ inline void Game::drawMapDebugAreas(int left, int top, int right, int bot, int s
}
}

inline void Game::drawMapBuilding(int x, int y, int gid, int viewportX, int viewportY, int localTeam, Uint32 drawOptions)
inline void Game::drawMapBuilding(int x, int y, int gid, int localTeam, Uint32 drawOptions)
{
Building *building = teams[Building::GIDtoTeam(gid)]->myBuildings[Building::GIDtoID(gid)];
assert(building);
Expand Down Expand Up @@ -2292,9 +2292,11 @@ inline void Game::drawMapGroundBuildings(int left, int top, int right, int bot,
|| (building->seenByMask & visibleTeams)
|| map.isFOWDiscovered(x+viewportX, y+viewportY, visibleTeams))
{
int px,py;
int px, py;
map.mapCaseToDisplayable(building->posXLocal, building->posYLocal, &px, &py, viewportX, viewportY);
drawMapBuilding(px, py, gid, viewportX, viewportY, localTeam, drawOptions);
for (;py >> 5 < bot; py += map.h * 32)
for (;px >> 5 < right; px += map.w * 32)
drawMapBuilding(px, py, gid, localTeam, drawOptions);
drawnBuildings.insert(building);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class Game
///draws debug information. switched in the code.
inline void drawMapDebugAreas(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions);
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);
inline void drawMapBuilding(int x, int y, int gid, int viewportX, int viewportY, int localTeam, Uint32 drawOptions);
inline void drawMapBuilding(int x, int y, int gid, int localTeam, Uint32 drawOptions);
inline void drawMapAreas(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions);
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);
inline void drawMapAirUnits(int left, int top, int right, int bot, int sw, int sh, int viewportX, int viewportY, int localTeam, Uint32 drawOptions);
Expand Down

0 comments on commit 7b94314

Please sign in to comment.