chiark / gitweb /
The cube was being drawn slightly differently on the top and left
authorSimon Tatham <anakin@pobox.com>
Sat, 1 May 2004 07:32:09 +0000 (07:32 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 1 May 2004 07:32:09 +0000 (07:32 +0000)
rows, because the coordinates were crossing one or other axis at
that point and so the lower coordinate was being rounded up while
the upper one was rounded down. Judicious use of floor() fixes it.

[originally from svn r4179]

cube.c

diff --git a/cube.c b/cube.c
index 9cb359ee2b36409241bd4b146c3d646b71e6ae97..e7790687b8f618dfeaa978c8282c3ed9b202d136 100644 (file)
--- a/cube.c
+++ b/cube.c
@@ -1294,8 +1294,8 @@ void game_redraw(frontend *fe, game_drawstate *ds, game_state *oldstate,
         }
 
         for (j = 0; j < poly->order; j++) {
-            coords[j*2] = (int)(points[j*2] * GRID_SCALE) + ds->ox;
-            coords[j*2+1] = (int)(points[j*2+1] * GRID_SCALE) + ds->oy;
+            coords[j*2] = (int)floor(points[j*2] * GRID_SCALE) + ds->ox;
+            coords[j*2+1] = (int)floor(points[j*2+1] * GRID_SCALE) + ds->oy;
         }
 
         /*