diff multipaint.pde @ 7:c848a6133cfc

Fix many calculations (divisions) that assume integer variable division semantics by truncating to int(). Also add two helper functions chop2(v) and chop8(v) and use them where appropriate.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 03 Jul 2018 22:17:48 +0300
parents a1261cd4c676
children dfdc18b62fab
line wrap: on
line diff
--- a/multipaint.pde	Tue Jul 03 21:27:18 2018 +0300
+++ b/multipaint.pde	Tue Jul 03 22:17:48 2018 +0300
@@ -202,16 +202,16 @@
 
     set_machine(machine);
     g_windowx = width - (g_hedge) - (g_wzoom * X);
-    g_windowx = g_windowx / 2;
+    g_windowx = int(g_windowx / 2);
     g_windowy = height - (g_vedge) - (g_wzoom * Y);
-    g_windowy = g_windowy / 2;
+    g_windowy = int(g_windowy / 2);
 
     switcher(3);
 
     g_map[4] = byte(g_maxcolors - 1);
     g_ofarge = g_farge;
-    MX = X / 8;
-    MY = Y / 8;
+    MX = int(X / 8);
+    MY = int(Y / 8);
     g_realfront = byte(g_farge);
     g_realback = byte(g_backg);