changeset 6:07ddf9cfc6c2

Cast char to int where needed and other related operations.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 03 Jul 2018 21:27:18 +0300
parents a2d09299dce5
children c848a6133cfc
files Interface.pde draw_outputs.pde events.pde exporters.pde
diffstat 4 files changed, 24 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/Interface.pde	Tue Jul 03 21:22:49 2018 +0300
+++ b/Interface.pde	Tue Jul 03 21:27:18 2018 +0300
@@ -515,14 +515,13 @@
 void printat(int xx, int yy, String tex) {
     //creating text into the help box
     for (int tit = 0; tit < tex.length(); tit++) {
-        if (tex.charAt(tit) != '|') {
-            if (g_data[256 + xx + yy * 12] != byte(tex.charAt(tit))) {
-                g_data[256 + xx + yy * 12] = byte(tex.charAt(tit));
+        if (tex.charCodeAt(tit) != '|') {
+            if (g_data[256 + xx + yy * 12] != byte(tex.charCodeAt(tit))) {
+                g_data[256 + xx + yy * 12] = byte(tex.charCodeAt(tit));
                 g_chaup[xx + yy * 16] = 1;
             }
-        }
         xx++;
-        if (tex.charAt(tit) == '|') {
+        } else {
             xx = 0;
             yy++;
         }
@@ -777,11 +776,11 @@
     y = 0;
 
     for (int tit = 0; tit < pan.length(); tit++) {
-        ad = pan.charAt(tit);
+        ad = pan.charCodeAt(tit);
         if (g_repanel <= 0) {
             if (ad != ';' && ad != ':' && ad != '.') {
                 if (realdraw == 1) {
-                    int icolor = g_data[ad];
+                    int icolor = int(g_data[ad]);
                     if (ad == 'j' && g_spare == 1) icolor = 1;
                     drawicon(xx + x, yy + y, ad - 48, icolor);
                 }
@@ -819,7 +818,7 @@
                     ad = ')';
                     if (g_shift) ad = '(';
                 }
-                command(ad);
+                command(int(ad));
                 g_msgctr = 50;
             }
         }
@@ -1155,13 +1154,13 @@
     if (g_button == RIGHT) h = 1;
     e_rect(ox, oy, bs * 2, bs * 4, g_rgb[int(g_realback)]);
     e_rect(ox + bs / 2, oy + 4 * g_uizoom, 12 * g_uizoom, bs * 2, g_rgb[int(g_realfront)]);
-    if (doicon(ox, oy, bs * 2, bs * 3)) command('<');
+    if (doicon(ox, oy, bs * 2, bs * 3)) command(int('<'));
     if (machine == C64M || machine == MSX || machine == AMIGA) {
         e_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[int(g_map[1])]);
         d_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[int(257)]);
         if (doicon(ox, oy + bs * 3, bs * 2, bs)) {
             if (g_shift == false) selectcolor(h, int(g_map[1]));
-            if (g_shift) command('C');
+            if (g_shift) command(int('C'));
         }
     }
     if (machine == PLUS4M) {
@@ -1171,11 +1170,11 @@
         d_rect(ox + 8 * g_uizoom, oy + bs * 3, bs, bs, g_rgb[int(257)]);
         if (doicon(ox, oy + bs * 3, bs, bs)) {
             if (g_shift == false) selectcolor(h, int(g_map[1]));
-            if (g_shift) command('C');
+            if (g_shift) command(int('C'));
         }
         if (doicon(ox + 8 * g_uizoom, oy + bs * 3, bs, bs)) {
             if (g_shift == false) selectcolor(h, int(g_map[2]));
-            if (g_shift) command('V');
+            if (g_shift) command(int('V'));
         }
     }
 }
--- a/draw_outputs.pde	Tue Jul 03 21:22:49 2018 +0300
+++ b/draw_outputs.pde	Tue Jul 03 21:27:18 2018 +0300
@@ -1066,8 +1066,8 @@
     if (tt == 1) craft(x, y, 0); //pixeller
 
     if (tt == 2) { //spraycan
-        //if(random(100)<50){fixed_raster_command('x');}
-        //if(random(100)<50){fixed_raster_command('y');}
+        //if(random(100)<50){fixed_raster_command(int('x'));}
+        //if(random(100)<50){fixed_raster_command(int('y'));}
         for (int i = 0; i <= 12; i++) {
             int rx = x - 10 + int(random((10) * 2));
             int ry = y - 10 + int(random((10) * 2));
--- a/events.pde	Tue Jul 03 21:22:49 2018 +0300
+++ b/events.pde	Tue Jul 03 21:27:18 2018 +0300
@@ -343,26 +343,26 @@
     }
 
     if (ckey == '[') {
-        fixed_raster_command('x');
+        fixed_raster_command(int('x'));
         message("R.OFFSET " + str(g_raster_offset_x) + "." + str(g_raster_offset_y));
         g_repanel = -2;
         return;
     }
     if (ckey == ']') {
-        fixed_raster_command('y');
+        fixed_raster_command(int('y'));
         message("R.OFFSET " + str(g_raster_offset_x) + "." + str(g_raster_offset_y));
         g_repanel = -2;
         return;
     }
     if (ckey == '(') {
-        fixed_raster_command('p');
+        fixed_raster_command(int('p'));
         message("RASTER " + str(g_raster_no) + "/9|[=PREV|]=NEXT");
         g_repanel = -2;
         return;
     }
 
     if (ckey == ')') {
-        fixed_raster_command('n');
+        fixed_raster_command(int('n'));
         message("RASTER " + str(g_raster_no) + "/9|[=PREV|]=NEXT");
         g_repanel = -2;
         return;
@@ -427,7 +427,7 @@
         if (ckey == 'Q') {
             g_repanel = -2;
             g_msgctr = 0;
-            help('B');
+            help(int('B'));
             g_msgctr = 50;
         }
         if (ckey == 'G') {
@@ -448,7 +448,7 @@
             }
             g_repanel = -2;
             g_msgctr = 0;
-            help('g');
+            help(int('g'));
             g_msgctr = 50;
         }
 
@@ -566,8 +566,8 @@
                 switcher(2);
                 infersize();
                 if (g_data[int('n')] == 1) {
-                    command('1');
-                    command('9');
+                    command(int('1'));
+                    command(int('9'));
                     g_data[int('p')] = 0;
                     g_data[int('x')] = 0;
                     g_data[int('y')] = 0;
@@ -757,14 +757,14 @@
         g_bsize--;
         if (g_bsize < 0) g_bsize = 0;
         g_msgctr = -2;
-        help('h');
+        help(int('h'));
     }
     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');
+        help(int('h'));
     }
     if (g_data[int('u')] == 1) {
         g_data[int('u')] = 0;
--- a/exporters.pde	Tue Jul 03 21:22:49 2018 +0300
+++ b/exporters.pde	Tue Jul 03 21:27:18 2018 +0300
@@ -1323,7 +1323,7 @@
         limitter = 16;
     }
     molox = 1;
-    command('O'); //special clear screen
+    command(int('O')); //special clear screen
     if (g_multic == 1 || g_hzoomer == 2) {
         molox = 2;
     }