Browse Source

Force alignment on even/even and odd/odd resolutions

pull/872/head
Anders Jenbo 6 years ago
parent
commit
146516467b
  1. 15
      Source/cursor.cpp
  2. 10
      Source/scrollrt.cpp

15
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;

10
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) {

Loading…
Cancel
Save