diff --git a/Source/cursor.cpp b/Source/cursor.cpp index 593b267b6..3747f0277 100644 --- a/Source/cursor.cpp +++ b/Source/cursor.cpp @@ -244,20 +244,27 @@ void CheckCursMove() sy -= fy; } + TilesInView(&columns, &rows); + + // When both columns and rows are even or odd vertical alignment must be done using a screen offset + if (zoomflag && (columns & 1) == (rows & 1)) { + sy -= TILE_HEIGHT / 2; + } + // Convert to tile grid mx = ViewX; my = ViewY; tx = sx / TILE_WIDTH; ty = sy / TILE_HEIGHT; ShiftGrid(&mx, &my, tx, ty); - - // Center player tile on screen - TilesInView(&columns, &rows); - ShiftGrid(&mx, &my, -columns / 2, -(rows - RowsCoveredByPanel()) / 4); + // Shift player row to one that can be centered with out pixel offset if ((columns & 1) != 0) { my++; } + // Center player tile on screen + ShiftGrid(&mx, &my, -columns / 2, -(rows - RowsCoveredByPanel()) / 4); + // Shift position to match diamond grid aligment px = sx % TILE_WIDTH; py = sy % TILE_HEIGHT; diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 36b351637..d943d11b6 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1019,10 +1019,18 @@ static void DrawGame(int x, int y) // Center player tile on screen TilesInView(&columns, &rows); - ShiftGrid(&x, &y, -columns / 2, -(rows - RowsCoveredByPanel()) / 4); + // Shift player row to one that can be centered with out pixel offset if ((columns & 1) == 0) { y--; } + ShiftGrid(&x, &y, -columns / 2, -(rows - RowsCoveredByPanel()) / 4); + + // When both columns and rows are even or odd vertical alignment must be done using a screen offset + if (zoomflag && (columns & 1) == (rows & 1)) { + ShiftGrid(&x, &y, 0, -1); + rows += 2; + sy -= TILE_HEIGHT / 2; + } // Skip rendering parts covered by the panels if (PANELS_COVER) {