(svn r1337) Use MapMax[XY]() (or MapSize[XY]() if appropriate) instead of TILE_MAX_[XY]

While here replace one erroneous TILE_MAX_X with MapMaxY()
This commit is contained in:
tron
2005-01-03 12:56:22 +00:00
parent 4c14afba4e
commit 32bfe0dddd
15 changed files with 42 additions and 46 deletions

View File

@@ -295,7 +295,7 @@ Point TranslateXYToTileCoord(ViewPort *vp, int x, int y) {
pt.x = a+z;
pt.y = b+z;
if ((uint)pt.x >= TILE_X_MAX*16 || (uint)pt.y >= TILE_Y_MAX*16) {
if ((uint)pt.x >= MapMaxX() * 16 || (uint)pt.y >= MapMaxY() * 16) {
pt.x = pt.y = -1;
}
@@ -1289,8 +1289,8 @@ void UpdateViewportPosition(Window *w)
vx = -x + y * 2;
vy = x + y * 2;
// clamp to size of map
vx = clamp(vx, 0 * 4, TILE_X_MAX * 16 * 4);
vy = clamp(vy, 0 * 4, TILE_Y_MAX * 16 * 4);
vx = clamp(vx, 0 * 4, MapMaxX() * 16 * 4);
vy = clamp(vy, 0 * 4, MapMaxY() * 16 * 4);
// Convert map coordinates to viewport coordinates
x = (-vx + vy) / 2;
y = ( vx + vy) / 4;