changeset 4:a1261cd4c676

Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 03 Jul 2018 21:19:29 +0300
parents 0a8490574442
children a2d09299dce5
files Interface.pde draw_inputs.pde draw_outputs.pde draw_smart.pde events.pde multipaint.pde
diffstat 6 files changed, 231 insertions(+), 231 deletions(-) [+]
line wrap: on
line diff
--- a/Interface.pde	Tue Jul 03 21:08:55 2018 +0300
+++ b/Interface.pde	Tue Jul 03 21:19:29 2018 +0300
@@ -125,13 +125,13 @@
         g_raster_no--;
         if (g_raster_no < 0) g_raster_no = 9;
         set_fixed_raster(g_raster_no);
-        g_data['r'] = 1;
+        g_data[int('r')] = 1;
     }
     if (par == 'n') {
         g_raster_no++;
         if (g_raster_no > 9) g_raster_no = 0;
         set_fixed_raster(g_raster_no);
-        g_data['r'] = 1;
+        g_data[int('r')] = 1;
     }
     if (par == 'x') {
         g_raster_offset_x++;
@@ -149,9 +149,9 @@
     int base = 0;
     if (g_uizoom == 1) base = 10;
     if (g_uizoom == 3) base = 20;
-    if (g_data['M'] == 1 && g_data['m'] == 1) g_data['m'] = 0;
-    if (g_data['m'] == 1) base++;
-    if (g_data['M'] == 1) base = base + 2;
+    if (g_data[int('M')] == 1 && g_data[int('m')] == 1) g_data[int('m')] = 0;
+    if (g_data[int('m')] == 1) base++;
+    if (g_data[int('M')] == 1) base = base + 2;
     return base;
 }
 
@@ -477,10 +477,10 @@
 
 boolean moicon(int xx, int yy, int ww, int hh) {
     //check mouse/icon boundary without actually drawing the icon
-    if (g_data['m'] == 0 && g_data['M'] == 0) {
+    if (g_data[int('m')] == 0 && g_data[int('M')] == 0) {
         if (g_mx + g_windowx >= xx && g_mx + g_windowx < xx + ww && g_my + g_windowy >= yy && g_my + g_windowy < yy + hh) return true;
     }
-    if (g_data['m'] == 1 || g_data['M'] == 1) {
+    if (g_data[int('m')] == 1 || g_data[int('M')] == 1) {
         if (g_mx >= xx && g_mx <= xx + ww && g_my >= yy && g_my <= yy + hh) return true;
     }
     return false;
@@ -574,7 +574,7 @@
         if (tool() == 8 && g_phase == 1) {
             a = abs(g_rx2 - g_rx) + 1;
             b = abs(g_ry2 - g_ry) + 1;
-            if (g_data['c'] == 1 || g_shift) {
+            if (g_data[int('c')] == 1 || g_shift) {
                 a--;
                 b--;
             } //purkkaa
@@ -655,7 +655,7 @@
             break;
         case 'B':
             teks = "Set border|[Export=N]";
-            if (g_data['Q'] == 1) teks = "Set border|[Export=Y]";
+            if (g_data[int('Q')] == 1) teks = "Set border|[Export=Y]";
             break;
         case 'C':
             teks = "Set backgnd";
@@ -765,8 +765,8 @@
 void icontable(int xx, int yy, int tabletype, int realdraw) {
     String pan = "";
     int x, y, ad;
-    g_data['9'] = 0;
-    if (g_btype == 9) g_data['9'] = 1;
+    g_data[int('9')] = 0;
+    if (g_btype == 9) g_data[int('9')] = 1;
 
     // the main and sideboard icon panel order
     if (tabletype == 0) pan = ";;h9::123456::78::pzxy::XYtn::lsEAwW::jc0g::uo::.b";
@@ -847,7 +847,7 @@
             }
         }
     }
-    g_data['9'] = 0;
+    g_data[int('9')] = 0;
 }
 
 int nextluminance(int f, int d) {
@@ -944,7 +944,7 @@
     if (hand == 0) {
         g_farge = x;
         g_ofarge = x; //kludgey, the colour and the "original colour"
-        if (g_btype == 9) g_data['p'] = 1;
+        if (g_btype == 9) g_data[int('p')] = 1;
         g_realfront = byte(g_farge);
         g_realback = byte(g_backg);
     }
@@ -1242,9 +1242,9 @@
     mmode = magmode();
     fari = 0;
     makecolor(259, g_r[g_map[0]], g_g[g_map[0]], g_b[g_map[0]]); //use border color
-    if (g_data['M'] == 1 && g_data['m'] == 1) g_data['m'] = 0;
-    if (g_data['m'] == 1) makecolor(259, 48, 48, 48); //don't use border color in mag modes
-    if (g_data['M'] == 1) makecolor(259, 48, 48, 48);
+    if (g_data[int('M')] == 1 && g_data[int('m')] == 1) g_data[int('m')] = 0;
+    if (g_data[int('m')] == 1) makecolor(259, 48, 48, 48); //don't use border color in mag modes
+    if (g_data[int('M')] == 1) makecolor(259, 48, 48, 48);
 
     psize = g_magpix[mmode];
     mag = psize * 8;
@@ -1579,7 +1579,7 @@
 
                 //draw grid
                 //can in principle be non-square
-                if (int(g_data['g']) == 1) {
+                if (int(g_data[int('g')]) == 1) {
                     int lapx;
                     lapx = (xx * 8) / g_gridx;
                     lapx = lapx * g_gridx;
--- a/draw_inputs.pde	Tue Jul 03 21:08:55 2018 +0300
+++ b/draw_inputs.pde	Tue Jul 03 21:19:29 2018 +0300
@@ -225,7 +225,7 @@
     if (g_animx > 63 || g_animy > 63 || g_animx <= 2 || g_animy <= 2) {
         message("BAD SIZE|See manual");
         restoreparameters();
-        g_data['n'] = 0;
+        g_data[int('n')] = 0;
         return;
     }
     int boldsourcex = g_bsourcex;
@@ -255,7 +255,7 @@
     if (g_animframes <= 0) {
         message("BAD BOOKEND|See manual");
         restoreparameters();
-        g_data['n'] = 0;
+        g_data[int('n')] = 0;
         g_bsourcex = boldsourcex;
         g_bsourcey = boldsourcey;
         g_bsourcex2 = boldsourcex2;
--- a/draw_outputs.pde	Tue Jul 03 21:08:55 2018 +0300
+++ b/draw_outputs.pde	Tue Jul 03 21:19:29 2018 +0300
@@ -51,21 +51,21 @@
                     doborx(ofx, ofy, ofx + 1, ofy + 1);
                     break;
                 case 1:
-                    if (g_data['c'] == 1 || g_shift == true) {
+                    if (g_data[int('c')] == 1 || g_shift == true) {
                         ofx = ofx + 1;
                         ofy = ofy + 1;
                     }
                     doborx(ofx - 1, ofy - 1, ofx + 1, ofy + 1);
                     break;
                 case 2:
-                    if (g_data['c'] == 1 || g_shift == true) {
+                    if (g_data[int('c')] == 1 || g_shift == true) {
                         ofx = ofx + 2;
                         ofy = ofy + 2;
                     }
                     doborx(ofx - 2, ofy - 2, ofx + 1, ofy + 1);
                     break;
                 case 3:
-                    if (g_data['c'] == 1 || g_shift == true) {
+                    if (g_data[int('c')] == 1 || g_shift == true) {
                         ofx = ofx + 3;
                         ofy = ofy + 3;
                     }
@@ -90,14 +90,14 @@
         tempoy = g_bsourcey;
         tempx = g_bsourcex2;
         tempy = g_bsourcey2;
-        if (g_data['t'] == 1) {
+        if (g_data[int('t')] == 1) {
             if (tempx > g_bsourcex + 16) tempx = g_bsourcex + 16;
             if (tempy > g_bsourcey + 16) tempy = g_bsourcey + 16;
         }
         midx = (g_bsourcex2 - g_bsourcex) / 2;
         midy = (g_bsourcey2 - g_bsourcey) / 2;
-        if (g_data['c'] == 1 || g_shift == true) {
-            if (g_data['q'] == 1) {
+        if (g_data[int('c')] == 1 || g_shift == true) {
+            if (g_data[int('q')] == 1) {
                 midy = midy / g_gridx;
                 midy = midy * g_gridx;
                 midx = midx / g_gridx;
@@ -105,7 +105,7 @@
             }
         }
         int orient;
-        orient = g_data['x'] * 100 + g_data['y'] * 10 + g_data['q'];
+        orient = g_data[int('x')] * 100 + g_data[int('y')] * 10 + g_data[int('q')];
         if (g_multic == 1 || g_hzoomer == 2) {
             x = x / 2;
             x = x * 2;
@@ -123,7 +123,7 @@
                         x0 = x + xx - g_bsourcex;
                         y0 = y + yy - g_bsourcey;
 
-                        if (g_data['q'] == 1) {
+                        if (g_data[int('q')] == 1) {
                             x0 = x - (yy - g_bsourcey2);
                             y0 = y + (xx - g_bsourcex);
                             x0 = x0 + midx;
@@ -132,19 +132,19 @@
                             y0 = y0 - midx;
                         }
 
-                        if (g_data['x'] == 1) {
+                        if (g_data[int('x')] == 1) {
                             x0 = x0 - (x + midx);
                             x0 = -x0;
                             x0 = x0 + (x + midx);
                         }
 
-                        if (g_data['y'] == 1) {
+                        if (g_data[int('y')] == 1) {
                             y0 = y0 - (y + midy);
                             y0 = -y0;
                             y0 = y0 + (y + midy);
                         }
 
-                        if (g_data['c'] == 1 || g_shift) {
+                        if (g_data[int('c')] == 1 || g_shift) {
                             if (orient == 10) y0 = y0 + 1;
                             if (orient == 11) y0 = y0 + g_gridy - molox;
                             if (orient == 100) x0 = x0 + 1;
@@ -162,10 +162,10 @@
                         if (mb == LEFT) {
                             if (g_multic > 0) {
                                 g_farge = s1;
-                                if (g_data['p'] == 1) g_farge = g_ofarge;
+                                if (g_data[int('p')] == 1) g_farge = g_ofarge;
                                 if (g_multic == 1 || g_hzoomer == 2) {
-                                    if (g_data['q'] == 0) makepoint(x0, y0);
-                                    if (g_data['q'] == 1) {
+                                    if (g_data[int('q')] == 0) makepoint(x0, y0);
+                                    if (g_data[int('q')] == 1) {
                                         makepoint(x0 - x + x0, y + (y0 - y));
                                         makepoint(x0 - x + x0, y + (y0 - y) + 1);
                                     }
@@ -175,7 +175,7 @@
                             } else {
                                 g_farge = s1;
                                 if (zxcolor(g_farge) != zxcolor(g_backg)) {
-                                    if (g_data['p'] == 1) g_farge = g_ofarge;
+                                    if (g_data[int('p')] == 1) g_farge = g_ofarge;
                                     makepoint(x0, y0);
                                 }
                             }
@@ -185,8 +185,8 @@
 
                             if (g_multic > 0) {
                                 if (g_multic == 1 || g_hzoomer == 2) {
-                                    if (g_data['q'] == 0) clearpoint(x0, y0);
-                                    if (g_data['q'] == 1) {
+                                    if (g_data[int('q')] == 0) clearpoint(x0, y0);
+                                    if (g_data[int('q')] == 1) {
                                         clearpoint(x0 - x + x0, y + (y0 - y));
                                         clearpoint(x0 - x + x0, y + (y0 - y) + 1);
                                     }
@@ -362,15 +362,15 @@
     if (x2 < x1) x2 = x1 - (x2 - x1);
     if (y2 < y1) y2 = y1 - (y2 - y1);
 
-    if (g_data['t'] == 1 && x2 > x1 + 15) x2 = x1 + 16;
-    if (g_data['t'] == 1 && y2 > y1 + 15) y2 = y1 + 16;
+    if (g_data[int('t')] == 1 && x2 > x1 + 15) x2 = x1 + 16;
+    if (g_data[int('t')] == 1 && y2 > y1 + 15) y2 = y1 + 16;
 
     prex = 0;
     prey = 0;
     kimea = y1 - (y2 - y1);
 
-    if (g_data['f'] == 1 && g_btype != 9) {
-        if (g_multic == 1 && g_data['d'] == 0) {
+    if (g_data[int('f')] == 1 && g_btype != 9) {
+        if (g_multic == 1 && g_data[int('d')] == 0) {
             g_farge = g_map[1];
             docircx(x1, y1, abs(x2 - int(x1)), abs(y2 - int(y1)));
             g_farge = g_ofarge;
@@ -415,18 +415,18 @@
         y1 = y0;
     }
 
-    if (g_data['t'] == 1 && x2 > x1 + 15) x2 = x1 + 16;
-    if (g_data['t'] == 1 && y2 > y1 + 15) y2 = y1 + 16;
+    if (g_data[int('t')] == 1 && x2 > x1 + 15) x2 = x1 + 16;
+    if (g_data[int('t')] == 1 && y2 > y1 + 15) y2 = y1 + 16;
 
     if (g_btype != 9) {
-        if (g_data['c'] == 1 || g_shift) {
+        if (g_data[int('c')] == 1 || g_shift) {
             if (x2 > x1) x2--;
             if (y2 > y1) y2--;
         }
     }
 
-    if (g_data['f'] == 1 && g_btype != 9) {
-        if (g_multic == 1 && g_data['d'] == 0) {
+    if (g_data[int('f')] == 1 && g_btype != 9) {
+        if (g_multic == 1 && g_data[int('d')] == 0) {
             g_farge = g_map[1];
             for (int y = y1; y <= y2; y++) {
                 for (int x = x1; x <= x2; x = x + molox) {
@@ -444,8 +444,8 @@
             }
         }
     }
-    if (g_data['f'] == 0 || g_btype == 9) {
-        if (g_data['c'] == 1 && g_btype == 1) {
+    if (g_data[int('f')] == 0 || g_btype == 9) {
+        if (g_data[int('c')] == 1 && g_btype == 1) {
             if (x2 > x1) {
                 if (g_bsize == 0) x2--;
                 if (g_bsize == 1) x2 = x2 - 2;
@@ -506,7 +506,7 @@
         if (g_multic == 2) skaveri(xx, yy, g_farge, 0);
 
         if (g_multic != 2) {
-            if (g_data['b'] == 0) {
+            if (g_data[int('b')] == 0) {
                 if (g_multic == 1) {
                     mkaveri(xx, yy, g_farge, 0);
                 } else {
@@ -524,11 +524,11 @@
         xx = xx * 2;
     }
 
-    if (g_data['r'] == 1) { //simple raster
+    if (g_data[int('r')] == 1) { //simple raster
         if (get_raster(xx, yy) == 0) ignore = 1;
     }
 
-    if (g_data['R'] == 1) { //user defined raster
+    if (g_data[int('R')] == 1) { //user defined raster
         if (g_bsourcex2 > g_bsourcex && g_bsourcey2 > g_bsourcey) {
 
             int x0 = xx / ((g_bsourcex2 + 1) - g_bsourcex);
@@ -558,7 +558,7 @@
 
     int xc, yc;
 
-    if (ignore == 0 && g_data['d'] == 1 && g_attrimode <= 1) {
+    if (ignore == 0 && g_data[int('d')] == 1 && g_attrimode <= 1) {
         int aba, baba, ii, jj, miny, maxy, ojox, ojoy;
         aba = getattra(xx, yy, 0);
         baba = getattra(xx, yy, 1);
@@ -678,7 +678,7 @@
                 }
                 if (cut) {
                     // X Y mirrors
-                    if (g_data['t'] == 1) {
+                    if (g_data[int('t')] == 1) {
                         if (tiler == 0) {
                             int ex = X / g_gridx;
                             int ey = Y / g_gridy;
@@ -690,9 +690,9 @@
                         }
                         return;
                     }
-                    if (g_data['X'] == 1 && mirrix == 0) makepoint(10000 + (X - 1) - xx, yy);
-                    if (g_data['Y'] == 1 && mirriy == 0) makepoint(xx, 10000 + (Y - 1) - yy);
-                    if (g_data['X'] == 1 && g_data['Y'] == 1) {
+                    if (g_data[int('X')] == 1 && mirrix == 0) makepoint(10000 + (X - 1) - xx, yy);
+                    if (g_data[int('Y')] == 1 && mirriy == 0) makepoint(xx, 10000 + (Y - 1) - yy);
+                    if (g_data[int('X')] == 1 && g_data[int('Y')] == 1) {
                         if (mirrix == 0) {
                             makepoint(10000 + (X - 1) - xx, 10000 + (Y - 1) - yy);
                         }
@@ -810,7 +810,7 @@
             case 2: // VGA style i.e. Amiga, CPC
                 fari = g_farge;
 
-                if (g_data['d'] == 1) {
+                if (g_data[int('d')] == 1) {
                     if (g_map[1024 + xx + yy * X] == byte(g_backg)) {
                         g_map[1024 + xx + yy * X] = byte(g_farge);
                         if (g_hzoomer == 2) g_map[1024 + xx + yy * X + 1] = byte(g_farge);
@@ -827,7 +827,7 @@
 
     // X Y mirrors & tiler
 
-    if (g_data['t'] == 1) {
+    if (g_data[int('t')] == 1) {
         if (tiler == 0) {
             int ex = X / g_gridx;
             int ey = Y / g_gridy;
@@ -839,9 +839,9 @@
         }
         return;
     }
-    if (g_data['X'] == 1 && mirrix == 0) makepoint(10000 + (X - 1) - xx, yy);
-    if (g_data['Y'] == 1 && mirriy == 0) makepoint(xx, 10000 + (Y - 1) - yy);
-    if (g_data['X'] == 1 && g_data['Y'] == 1) {
+    if (g_data[int('X')] == 1 && mirrix == 0) makepoint(10000 + (X - 1) - xx, yy);
+    if (g_data[int('Y')] == 1 && mirriy == 0) makepoint(xx, 10000 + (Y - 1) - yy);
+    if (g_data[int('X')] == 1 && g_data[int('Y')] == 1) {
         if (mirrix == 0) {
             makepoint(10000 + (X - 1) - xx, 10000 + (Y - 1) - yy);
         }
@@ -895,12 +895,12 @@
         xx = xx / 2;
         xx = xx * 2;
     }
-    if (g_data['b'] == 1) return;
-    if (g_data['r'] == 1) { //raster
+    if (g_data[int('b')] == 1) return;
+    if (g_data[int('r')] == 1) { //raster
         if (get_raster(xx, yy) == 0) ignore = 1;
     }
 
-    if (g_data['R'] == 1) { //user defined raster
+    if (g_data[int('R')] == 1) { //user defined raster
         if (g_bsourcex2 > g_bsourcex && g_bsourcey2 > g_bsourcey) {
             int x0 = xx / ((g_bsourcex2 + 1) - g_bsourcex);
             int y0 = yy / ((g_bsourcey2 + 1) - g_bsourcey);
@@ -920,9 +920,9 @@
         g_redo[xc + yc * MX] = byte(0); //block update
         g_remdo[xc + yc * MX] = byte(1); //block update
     }
-    if (g_data['X'] == 1 && mirrix == 0) clearpoint(10000 + (X - 1) - xx, yy);
-    if (g_data['Y'] == 1 && mirriy == 0) clearpoint(xx, 10000 + (Y - 1) - yy);
-    if (g_data['X'] == 1 && g_data['Y'] == 1) {
+    if (g_data[int('X')] == 1 && mirrix == 0) clearpoint(10000 + (X - 1) - xx, yy);
+    if (g_data[int('Y')] == 1 && mirriy == 0) clearpoint(xx, 10000 + (Y - 1) - yy);
+    if (g_data[int('X')] == 1 && g_data[int('Y')] == 1) {
         if (mirrix == 0) clearpoint(10000 + (X - 1) - xx, 10000 + (Y - 1) - yy);
     }
 }
@@ -968,7 +968,7 @@
 
     //handles different tool behavior
 
-    if (g_data['m'] == 0 && g_data['M'] == 0) {
+    if (g_data[int('m')] == 0 && g_data[int('M')] == 0) {
         if (g_uizoom == 1) {
             x = x / 2;
             y = y / 2;
@@ -983,7 +983,7 @@
         }
     }
 
-    if (g_data['m'] == 1 || g_data['M'] == 1) {
+    if (g_data[int('m')] == 1 || g_data[int('M')] == 1) {
         x = x / psizex;
         y = y / psizey;
         x = x + g_ofx * 8;
@@ -1005,7 +1005,7 @@
         x = x - midx;
         y = y - midy;
     }
-    if (g_data['c'] == 1 || g_shift) {
+    if (g_data[int('c')] == 1 || g_shift) {
         x = x / g_gridx;
         x = x * g_gridx;
         y = y / g_gridy;
@@ -1021,11 +1021,11 @@
 
     if (mb == 254) { //block picker
         switcher(2);
-        g_data['n'] = 0;
-        g_data['x'] = 0;
-        g_data['y'] = 0;
-        g_data['q'] = 0;
-        g_data['z'] = 0;
+        g_data[int('n')] = 0;
+        g_data[int('x')] = 0;
+        g_data[int('y')] = 0;
+        g_data[int('q')] = 0;
+        g_data[int('z')] = 0;
         x = ox / g_gridx;
         x = x * g_gridx;
         y = oy / g_gridy;
@@ -1055,7 +1055,7 @@
             selectcolor(0, getattra(ox, oy, 0));
         }
         g_ofarge = g_farge;
-        if (g_btype == 9) g_data['p'] = 1;
+        if (g_btype == 9) g_data[int('p')] = 1;
         g_realfront = byte(g_farge);
         return;
     }
@@ -1094,10 +1094,10 @@
         if (g_klikkeri == 0) {
             g_klikkeri = 1;
             storeparameters();
-            g_data['X'] = 0;
-            g_data['Y'] = 0;
-            g_data['c'] = 0;
-            g_data['t'] = 0;
+            g_data[int('X')] = 0;
+            g_data[int('Y')] = 0;
+            g_data[int('c')] = 0;
+            g_data[int('t')] = 0;
             if (ox >= 0 && ox < X && oy >= 0 & oy < Y) {
                 store_undo(); // exceptional!
                 if (g_multic != 0) {
@@ -1125,18 +1125,18 @@
     }
 
     if (tt == 0) { // magnifier graphic tool
-        g_data['m'] = 1;
+        g_data[int('m')] = 1;
         g_rx = x - (magx() / 2) * 8;
         g_orx = x;
         g_ry = y - (magy() / 2) * 8;
         g_ory = y;
         g_rx2 = x + (magx() / 2 + odd(magx())) * 8;
         g_ry2 = y + (magy() / 2 + odd(magy())) * 8;
-        g_data['m'] = 0;
+        g_data[int('m')] = 0;
         g_rubbermode = 1;
         if (g_phase == 1) {
             g_rubbermode = 0;
-            g_data['m'] = 1;
+            g_data[int('m')] = 1;
             set_tool(g_prevtool);
             g_phase = 0;
             g_ofx = x / 8 - magx() / 2;
@@ -1169,7 +1169,7 @@
                 g_ry2 = g_ory;
                 g_ry = y;
             }
-            if (g_data['c'] == 1 || g_shift) {
+            if (g_data[int('c')] == 1 || g_shift) {
                 g_rx2--;
                 g_ry2--;
                 if (g_multic == 1 || g_hzoomer == 2) g_rx2--;
--- a/draw_smart.pde	Tue Jul 03 21:08:55 2018 +0300
+++ b/draw_smart.pde	Tue Jul 03 21:19:29 2018 +0300
@@ -192,7 +192,7 @@
     yb = 0;
 
     pt = int(g_map[1024 + xx + yy * X]);
-    if (pt == 0 && g_data['r'] == 0 && g_data['R'] == 0) {
+    if (pt == 0 && g_data[int('r')] == 0 && g_data[int('R')] == 0) {
         //println("trans char "+xx+"."+yy);
         xx = xx / 8;
         if (g_attrimode == 1) {
@@ -373,7 +373,7 @@
     suffocatelimit = 7;
 
     f = getmultic(x, y, 0);
-    if (g_data['d'] == 1 && f != g_backg) return;
+    if (g_data[int('d')] == 1 && f != g_backg) return;
 
     cad = 65536 + mx + (my * MX);
 
@@ -578,7 +578,7 @@
     int mx, my, val;
     int farge0, farge1;
     if (g_multic != 0 || g_hzoomer == 2) return;
-    if (g_data['d'] == 1) return;
+    if (g_data[int('d')] == 1) return;
     mx = x / 8;
     my = y / 8;
 
--- a/events.pde	Tue Jul 03 21:08:55 2018 +0300
+++ b/events.pde	Tue Jul 03 21:19:29 2018 +0300
@@ -62,7 +62,7 @@
             g_picony = -1;
         }
     } else {
-        if (g_data['m'] == 0 && g_data['M'] == 0) {
+        if (g_data[int('m')] == 0 && g_data[int('M')] == 0) {
             msx = g_iconx - (g_windowx);
             msy = g_icony - (g_windowy);
             msx = g_msx - (g_windowx);
@@ -108,7 +108,7 @@
     } else {
         g_msx = g_iconx;
         g_msy = g_icony;
-        if (g_data['m'] == 0 && g_data['M'] == 0) {
+        if (g_data[int('m')] == 0 && g_data[int('M')] == 0) {
             msx = g_iconx - (g_windowx);
             msy = g_icony - (g_windowy);
             msx = g_msx - (g_windowx);
@@ -159,21 +159,21 @@
         }
     }
 
-    if (g_data['4'] == 1) {
+    if (g_data[int('4')] == 1) {
         if (g_phase == 1) {
             g_phase = 0;
             g_rubbermode = 0;
             refresh();
-            g_data['4'] = 0;
-            g_data['d'] = 0;
-            g_data['r'] = 0;
-            g_data['R'] = 0;
-            g_data['x'] = 0;
-            g_data['y'] = 0;
-            g_data['q'] = 0;
-            g_data['p'] = 0;
-            g_data['t'] = 0;
-            g_data['n'] = 0;
+            g_data[int('4')] = 0;
+            g_data[int('d')] = 0;
+            g_data[int('r')] = 0;
+            g_data[int('R')] = 0;
+            g_data[int('x')] = 0;
+            g_data[int('y')] = 0;
+            g_data[int('q')] = 0;
+            g_data[int('p')] = 0;
+            g_data[int('t')] = 0;
+            g_data[int('n')] = 0;
             switcher(2);
             if (g_multic == 1 || g_hzoomer == 2) {
                 g_rx = g_rx / 2;
@@ -199,9 +199,9 @@
             g_repanel = -2;
             if (g_button == RIGHT) {
                 storeparameters();
-                g_data['f'] = 1;
-                g_data['X'] = 0;
-                g_data['Y'] = 0;
+                g_data[int('f')] = 1;
+                g_data[int('X')] = 0;
+                g_data[int('Y')] = 0;
                 doborx(g_rx, g_ry, g_rx2, g_ry2);
                 restoreparameters();
             }
@@ -293,11 +293,11 @@
             g_bsourcex2 = X - 1;
             g_bsourcey2 = Y - 1;
             ckey = '9';
-            g_data['p'] = 0;
-            g_data['x'] = 0;
-            g_data['y'] = 0;
-            g_data['q'] = 0;
-            g_data['z'] = 0;
+            g_data[int('p')] = 0;
+            g_data[int('x')] = 0;
+            g_data[int('y')] = 0;
+            g_data[int('q')] = 0;
+            g_data[int('z')] = 0;
             g_phase = 0;
             g_rubbermode = 0;
             set_tool(1);
@@ -318,7 +318,7 @@
         if (ckey == '.') {
             g_bsize = 0;
             g_btype = 0;
-            g_data['n'] = 0;
+            g_data[int('n')] = 0;
         }
         ckey = '3';
         if (ckey == ' ') {}
@@ -385,7 +385,7 @@
     }
 
     if (ckey == '0') {
-        if (g_data['m'] == 0 && g_data['M'] == 0) {
+        if (g_data[int('m')] == 0 && g_data[int('M')] == 0) {
             if (tool() != 0) {
                 g_prevtool = tool();
             }
@@ -410,12 +410,12 @@
         g_ry2 = -1;
         if (g_data[ckey] > 1) g_data[ckey] = 0;
         if (ckey == '4') {
-            g_data['x'] = 0;
-            g_data['y'] = 0;
-            g_data['h'] = 0;
-            g_data['q'] = 0;
-            g_data['t'] = 0;
-            g_data['n'] = 0;
+            g_data[int('x')] = 0;
+            g_data[int('y')] = 0;
+            g_data[int('h')] = 0;
+            g_data[int('q')] = 0;
+            g_data[int('t')] = 0;
+            g_data[int('n')] = 0;
         }
     }
 
@@ -431,7 +431,7 @@
             g_msgctr = 50;
         }
         if (ckey == 'G') {
-            g_data['G'] = 0;
+            g_data[int('G')] = 0;
             switch (g_gridx) {
                 case 8:
                     g_gridx = 16;
@@ -464,15 +464,15 @@
             //        poopsprites();
         }
         if (ckey == 'G') {
-            if (g_data['g'] == 0) g_data['g'] = 1;
+            if (g_data[int('g')] == 0) g_data[int('g')] = 1;
         }
-        if (g_data['M'] == 0) g_boxreconstruct = 2;
+        if (g_data[int('M')] == 0) g_boxreconstruct = 2;
 
-        if (g_data['M'] == 1) {
+        if (g_data[int('M')] == 1) {
             if (ckey == 'M') {
                 g_ofx = g_storedcoordx / 8 - magx() / 2;
                 g_ofy = g_storedcoordy / 8 - magy() / 2;
-                g_data['m'] = 0;
+                g_data[int('m')] = 0;
                 message("Super|Magnify");
                 if (tool() == 0) {
                     set_tool(g_prevtool);
@@ -481,8 +481,8 @@
                 }
             }
         }
-        if (g_data['B'] == 1) {
-            g_data['B'] = 0;
+        if (g_data[int('B')] == 1) {
+            g_data[int('B')] = 0;
             if (machine != MSX) {
                 store_undo();
                 g_map[0] = byte(zxcolor(g_farge));
@@ -490,11 +490,11 @@
                 message("Set border");
             }
             if (machine == MSX) {
-                g_data['C'] = 1;
+                g_data[int('C')] = 1;
             }
         }
-        if (g_data['C'] == 1) {
-            g_data['C'] = 0;
+        if (g_data[int('C')] == 1) {
+            g_data[int('C')] = 0;
             if (int(g_map[1]) != 255) {
                 store_undo();
                 if (machine == PLUS4M && g_farge == g_map[2]) {
@@ -511,8 +511,8 @@
                 message("Set back|color");
             }
         }
-        if (g_data['V'] == 1) {
-            g_data['V'] = 0;
+        if (g_data[int('V')] == 1) {
+            g_data[int('V')] = 0;
             if (int(g_map[1]) != 255) {
                 store_undo();
                 if (machine == PLUS4M && g_farge == g_map[1]) {
@@ -524,8 +524,8 @@
                 message("Set 2nd|back color");
             }
         }
-        if (g_data['W'] == 1) {
-            g_data['W'] = 0;
+        if (g_data[int('W')] == 1) {
+            g_data[int('W')] = 0;
             if (g_formatextension != "") {
                 gui = true;
                 exportfmt = true;
@@ -534,8 +534,8 @@
                 message("None for|" + g_name);
             }
         }
-        if (g_data['N'] == 1) {
-            g_data['N'] = 0;
+        if (g_data[int('N')] == 1) {
+            g_data[int('N')] = 0;
             int i = g_animspeed;
             i++;
             if (i > 3) i = 0;
@@ -551,102 +551,102 @@
         if (g_data[ckey] > 1) {
             if (ckey == 'm' || ckey == 'M') {
                 g_boxreconstruct = 2;
-                g_data['M'] = 0;
-                g_data['m'] = 0;
+                g_data[int('M')] = 0;
+                g_data[int('m')] = 0;
             }
             g_data[ckey] = 0;
         }
 
-        if (g_data['t'] == 1) {
+        if (g_data[int('t')] == 1) {
             if (ckey == 't') message("Tile mode");
         }
 
         if (ckey == 'n') {
-            if (g_data['n'] == 1) {
+            if (g_data[int('n')] == 1) {
                 switcher(2);
                 infersize();
-                if (g_data['n'] == 1) {
+                if (g_data[int('n')] == 1) {
                     command('1');
                     command('9');
-                    g_data['p'] = 0;
-                    g_data['x'] = 0;
-                    g_data['y'] = 0;
-                    g_data['q'] = 0;
-                    g_data['t'] = 0;
+                    g_data[int('p')] = 0;
+                    g_data[int('x')] = 0;
+                    g_data[int('y')] = 0;
+                    g_data[int('q')] = 0;
+                    g_data[int('t')] = 0;
                 }
             }
         }
 
-        if (g_data['i'] == 1) {
-            g_data['i'] = 0;
+        if (g_data[int('i')] == 1) {
+            g_data[int('i')] = 0;
             selectcolor(0, nextluminance(g_farge, 1));
         }
-        if (g_data['k'] == 1) {
-            g_data['k'] = 0;
+        if (g_data[int('k')] == 1) {
+            g_data[int('k')] = 0;
             selectcolor(0, nextluminance(g_farge, -1));
         }
-        if (g_data['d'] == 0) {
+        if (g_data[int('d')] == 0) {
             if (ckey == 'd') consistency();
         }
-        if (g_data['z'] == 1) {
-            g_data['z'] = 0;
+        if (g_data[int('z')] == 1) {
+            g_data[int('z')] = 0;
             int orient;
-            orient = g_data['x'] * 100 + g_data['y'] * 10 + g_data['q'];
+            orient = g_data[int('x')] * 100 + g_data[int('y')] * 10 + g_data[int('q')];
             if (orient == 0) {
-                g_data['x'] = 0;
-                g_data['y'] = 0;
-                g_data['q'] = 1;
+                g_data[int('x')] = 0;
+                g_data[int('y')] = 0;
+                g_data[int('q')] = 1;
             }
             if (orient == 1) {
-                g_data['x'] = 1;
-                g_data['y'] = 1;
-                g_data['q'] = 0;
+                g_data[int('x')] = 1;
+                g_data[int('y')] = 1;
+                g_data[int('q')] = 0;
             }
             if (orient == 110) {
-                g_data['x'] = 1;
-                g_data['y'] = 1;
-                g_data['q'] = 1;
+                g_data[int('x')] = 1;
+                g_data[int('y')] = 1;
+                g_data[int('q')] = 1;
             }
             if (orient == 111) {
-                g_data['x'] = 0;
-                g_data['y'] = 0;
-                g_data['q'] = 0;
+                g_data[int('x')] = 0;
+                g_data[int('y')] = 0;
+                g_data[int('q')] = 0;
             }
             if (orient == 100) {
-                g_data['x'] = 0;
-                g_data['y'] = 1;
-                g_data['q'] = 1;
+                g_data[int('x')] = 0;
+                g_data[int('y')] = 1;
+                g_data[int('q')] = 1;
             }
             if (orient == 11) {
-                g_data['x'] = 0;
-                g_data['y'] = 1;
-                g_data['q'] = 0;
+                g_data[int('x')] = 0;
+                g_data[int('y')] = 1;
+                g_data[int('q')] = 0;
             }
             if (orient == 10) {
-                g_data['x'] = 1;
-                g_data['y'] = 0;
-                g_data['q'] = 1;
+                g_data[int('x')] = 1;
+                g_data[int('y')] = 0;
+                g_data[int('q')] = 1;
             }
             if (orient == 101) {
-                g_data['x'] = 1;
-                g_data['y'] = 0;
-                g_data['q'] = 0;
+                g_data[int('x')] = 1;
+                g_data[int('y')] = 0;
+                g_data[int('q')] = 0;
             }
             message("Rotate|brush");
         }
 
         if (ckey == 'm') {
-            if (g_data['M'] == 1) {
-                g_data['M'] = 0;
-                g_data['m'] = 0;
+            if (g_data[int('M')] == 1) {
+                g_data[int('M')] = 0;
+                g_data[int('m')] = 0;
                 ckey = 0;
                 g_boxreconstruct = 2;
             }
-            g_data['M'] = 0;
+            g_data[int('M')] = 0;
         }
-        if (g_data['m'] == 1) {
+        if (g_data[int('m')] == 1) {
             if (ckey == 'm') {
-                g_data['M'] = 0;
+                g_data[int('M')] = 0;
                 int moux, mouy;
                 moux = g_mx / g_wzoom;
                 mouy = g_my / g_wzoom;
@@ -663,9 +663,9 @@
         refresh();
     }
 
-    if (g_data['J'] == 1) {
-        g_data['J'] = 0;
-        g_data['j'] = 0;
+    if (g_data[int('J')] == 1) {
+        g_data[int('J')] = 0;
+        g_data[int('j')] = 0;
         spare();
         store_undo();
         switch (g_spare) {
@@ -681,35 +681,35 @@
         spare();
     }
 
-    if (g_data['j'] == 1) {
-        g_data['j'] = 0;
+    if (g_data[int('j')] == 1) {
+        g_data[int('j')] = 0;
         if (g_spare == 0) message("Spare Page");
         if (g_spare == 1) message("Front Page");
         spare();
         makecolor(259, g_r[g_map[0]], g_g[g_map[0]], g_b[g_map[0]]);
         g_boxreconstruct = 2;
     }
-    if (g_data['E'] == 1) {
-        g_data['E'] = 0;
+    if (g_data[int('E')] == 1) {
+        g_data[int('E')] = 0;
         message("Source|export");
         gui = true;
         exporttxt = true;
         //machine_export(1);
     }
-    if (g_data['A'] == 1) {
-        g_data['A'] = 0;
+    if (g_data[int('A')] == 1) {
+        g_data[int('A')] = 0;
         message("Executable|export");
         gui = true;
         exportemu = true;
         //machine_export(0);
     }
-    if (g_data['w'] == 1) {
-        g_data['w'] = 0;
+    if (g_data[int('w')] == 1) {
+        g_data[int('w')] = 0;
         gui = true;
         importfmt = true;
     }
-    if (g_data['O'] == 1) {
-        g_data['O'] = 0;
+    if (g_data[int('O')] == 1) {
+        g_data[int('O')] = 0;
         store_undo();
         for (int xx = 0; xx < X * Y; xx++) {
             g_map[1024 + xx] = 0;
@@ -723,15 +723,15 @@
         }
     }
 
-    if (g_data['o'] == 1) {
-        g_data['o'] = 0;
+    if (g_data[int('o')] == 1) {
+        g_data[int('o')] = 0;
         message("Clear all");
         store_undo();
         storeparameters();
-        g_data['r'] = 0;
-        g_data['R'] = 0;
-        g_data['d'] = 0;
-        g_data['t'] = 0;
+        g_data[int('r')] = 0;
+        g_data[int('R')] = 0;
+        g_data[int('d')] = 0;
+        g_data[int('t')] = 0;
 
         for (int xx = 0; xx < X * Y; xx++) {
             g_map[1024 + xx] = 0;
@@ -748,39 +748,39 @@
         restoreparameters();
     }
 
-    if (g_data['e'] == 1) {
-        g_data['e'] = 0;
+    if (g_data[int('e')] == 1) {
+        g_data[int('e')] = 0;
     }
 
-    if (g_data['h'] == 1) {
-        g_data['h'] = 0;
+    if (g_data[int('h')] == 1) {
+        g_data[int('h')] = 0;
         g_bsize--;
         if (g_bsize < 0) g_bsize = 0;
         g_msgctr = -2;
         help('h');
     }
-    if (g_data['H'] == 1) {
-        g_data['H'] = 0;
+    if (g_data[int('H')] == 1) {
+        g_data[int('H')] = 0;
         g_bsize++;
         if (g_bsize > 10) g_bsize = 10;
         g_msgctr = -2;
         help('h');
     }
-    if (g_data['u'] == 1) {
-        g_data['u'] = 0;
+    if (g_data[int('u')] == 1) {
+        g_data[int('u')] = 0;
         message("Undo");
         restore_undo();
         refresh();
         g_boxreconstruct = 2;
     }
-    if (g_data['U'] == 1) {
-        g_data['U'] = 0;
+    if (g_data[int('U')] == 1) {
+        g_data[int('U')] = 0;
         message("Redo");
         redo_undo();
         refresh();
     }
-    if (g_data['S'] == 1) {
-        g_data['S'] = 0;
+    if (g_data[int('S')] == 1) {
+        g_data[int('S')] = 0;
         if (g_spare == 0) elename = filename;
         if (g_spare == 1) elename = sfilename;
 
@@ -800,14 +800,14 @@
         } else {
             message("No filename!");
             message("*");
-            g_data['S'] = 0;
-            g_data['s'] = 0;
+            g_data[int('S')] = 0;
+            g_data[int('s')] = 0;
         }
     }
 
     if (machine == SPECTRUM && debugger == 1) {
-        if (g_data['i'] == 1) {
-            g_data['i'] = 0;
+        if (g_data[int('i')] == 1) {
+            g_data[int('i')] = 0;
             if (g_iconmode == 0) {
                 message("Icons|not loaded!");
             } else {
@@ -815,8 +815,8 @@
                 store("icons.bin");
             }
         }
-        if (g_data['I'] == 1) {
-            g_data['I'] = 0;
+        if (g_data[int('I')] == 1) {
+            g_data[int('I')] = 0;
             store_undo();
             message("Restore|icons");
             restore("icons.bin");
@@ -824,17 +824,17 @@
             g_iconmode = 1;
         }
     }
-    if (g_data['l'] == 1) {
-        g_data['l'] = 0;
+    if (g_data[int('l')] == 1) {
+        g_data[int('l')] = 0;
         gui = true;
         fileselect = true;
     }
-    if (g_data['s'] == 1) {
-        g_data['s'] = 0;
+    if (g_data[int('s')] == 1) {
+        g_data[int('s')] = 0;
         gui = true;
         saveas = true;
     }
-    if (g_data['L'] == 1) {
-        g_data['L'] = 0;
+    if (g_data[int('L')] == 1) {
+        g_data[int('L')] = 0;
     }
 }
--- a/multipaint.pde	Tue Jul 03 21:08:55 2018 +0300
+++ b/multipaint.pde	Tue Jul 03 21:19:29 2018 +0300
@@ -179,8 +179,8 @@
     g_btype = 0;
     g_phase = 0;
     g_button = LEFT;
-    g_data['f'] = 1;
-    g_data['g'] = 1;
+    g_data[int('f')] = 1;
+    g_data[int('g')] = 1;
     if (fexists("icons.bin") == true) g_icons = loadBytes("icons.bin");
     set_tool(3);
 
@@ -236,10 +236,10 @@
 void store(String name) {
     String[] m1 = match(name, ".png");
     if (m1 != null) {
-        if (g_data['Q'] == 0) {
+        if (g_data[int('Q')] == 0) {
             export_image_sans_border(name);
         }
-        if (g_data['Q'] == 1) {
+        if (g_data[int('Q')] == 1) {
             export_image(name);
         }
         return;
@@ -278,9 +278,9 @@
         int lefth = g_farge;
         int righth = g_backg;
         storeparameters();
-        g_data['d'] = 0;
-        g_data['t'] = 0;
-        g_data['b'] = 1; //old IQ
+        g_data[int('d')] = 0;
+        g_data[int('t')] = 0;
+        g_data[int('b')] = 1; //old IQ
         import_image(name);
         restoreparameters();
         refreshpalette();
@@ -315,7 +315,7 @@
         delay(200);
     }
 
-    if (g_data['n'] == 1) {
+    if (g_data[int('n')] == 1) {
         g_animtime++;
         if (g_animtime > 8 - g_animspeed * 2) {
             animbrush_do();
@@ -337,7 +337,7 @@
     if (moicon(0, height - 32 * g_uizoom, 15 * 16 * g_uizoom, 32 * g_uizoom)) help(TAB);
     if (moicon(width - 32 * g_uizoom, 0, 32 * g_uizoom, 16 * g_uizoom)) help('.');
 
-    if (g_data['m'] == 0 && g_data['M'] == 0) {
+    if (g_data[int('m')] == 0 && g_data[int('M')] == 0) {
         msx = mouseX - g_windowx;
         msy = mouseY - g_windowy;
         msx = g_msx - g_windowx;