changeset 232:ea6eb6541607

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 06 Sep 2018 12:58:41 +0300
parents a53b3fe97412
children 1d9f9c3d8ab1
files draw_outputs.pde events.pde
diffstat 2 files changed, 15 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/draw_outputs.pde	Thu Sep 06 01:15:29 2018 +0300
+++ b/draw_outputs.pde	Thu Sep 06 12:58:41 2018 +0300
@@ -1027,19 +1027,12 @@
     }
 }
 
+
 void clearpoint(int xx, int yy)
 {
-    if (g_multic == 2)
-    {
-        g_farge = g_backg;
-        makepoint(xx, yy);
-        g_farge = g_ofarge;
-        return;
-    }
     if (g_multic == 1)
-    {
         xx = chop2(xx);
-    }
+
     g_farge = g_backg;
     makepoint(xx, yy);
     g_farge = g_ofarge;
@@ -1120,14 +1113,11 @@
 
 void simplepaint(int xx, int yy, int mode, int attr)
 {
-    int ad, swad, miny, maxy, ojyx;
-    xx = int(xx / 8);
-    ojyx = chop8(yy);
+    int ojyx = chop8(yy),
+        miny = yy - ojyx,
+        maxy = miny;
 
-    ad = 0;
-    swad = 0;
-    miny = yy - ojyx;
-    maxy = miny;
+    xx = int(xx / 8);
 
     if (g_attrimode == 1)
     {
@@ -1137,6 +1127,7 @@
 
     for (int j = miny; j <= maxy; j++)
     {
+        int ad, swad;
         if (mode == 0)
         {
             ad = 65536 + xx + (ojyx + j) * MX;
@@ -1144,8 +1135,8 @@
         }
         if (mode == 1)
         {
+            swad = 65536 + xx + (ojyx + j) * MX;
             ad = 65536 + xx + (ojyx + j) * MX + (MX * MY) * 8;
-            swad = 65536 + xx + (ojyx + j) * MX;
         }
         if (g_britemode == 1)
         {
--- a/events.pde	Thu Sep 06 01:15:29 2018 +0300
+++ b/events.pde	Thu Sep 06 12:58:41 2018 +0300
@@ -363,6 +363,7 @@
 
 void command(int ckey)
 {
+    int tt = tool();
     g_dirty = true;
 
     //keypresses change g_data[] values directly as 1/0 switches
@@ -565,8 +566,8 @@
     {
         if (g_data[int('m')] == 0 && g_data[int('M')] == 0)
         {
-            if (tool() != 0)
-                g_prevtool = tool();
+            if (tt != 0)
+                g_prevtool = tt;
         }
         else
             ckey = 'm';
@@ -659,7 +660,7 @@
                 g_data[int('m')] = 0;
                 message("Super|Magnify");
 
-                if (tool() == 0)
+                if (tt == 0)
                 {
                     set_tool(g_prevtool);
                     g_phase = 0;
@@ -850,7 +851,7 @@
                 g_ofx = int(g_storedcoordx / 8) - int(magx() / 2);
                 g_ofy = int(g_storedcoordy / 8) - int(magy() / 2);
                 message("Magnify");
-                if (tool() == 0)
+                if (tt == 0)
                 {
                     set_tool(g_prevtool);
                     g_phase = 0;
@@ -914,15 +915,15 @@
             g_map[1024 + xx] = 0;
         }
 
+        g_farge = g_backg;
         for (int xx = 0; xx < X; xx++)
         {
             for (int yy = 0; yy < Y; yy++)
             {
-                g_farge = g_backg;
                 makepoint(xx, yy);
-                g_farge = g_ofarge;
             }
         }
+        g_farge = g_ofarge;
 
         restoreparameters();
     }