changeset 147:9ad847dcd8e3

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 14 Aug 2018 13:41:06 +0300
parents bb1602f371d4
children d80871032cdd
files draw_outputs.pde
diffstat 1 files changed, 53 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/draw_outputs.pde	Tue Aug 14 13:34:54 2018 +0300
+++ b/draw_outputs.pde	Tue Aug 14 13:41:06 2018 +0300
@@ -944,7 +944,7 @@
 
 void simplepaint(int xx, int yy, int mode, int attr)
 {
-    int ad, swad, j, miny, maxy, ojyx;
+    int ad, swad, miny, maxy, ojyx;
     xx = int(xx / 8);
     ojyx = chop8(yy);
 
@@ -952,11 +952,15 @@
     swad = 0;
     miny = yy - ojyx;
     maxy = miny;
-    if (g_attrimode == 1) {
+
+    if (g_attrimode == 1)
+    {
         miny = 0;
         maxy = 7;
     }
-    for (j = miny; j <= maxy; j++) {
+
+    for (int j = miny; j <= maxy; j++)
+    {
         if (mode == 0) {
             ad = 65536 + xx + (ojyx + j) * MX;
             swad = 65536 + xx + (ojyx + j) * MX + (MX * MY) * 8;
@@ -1008,17 +1012,22 @@
         x -= int((g_bsourcex2 - g_bsourcex) / 2);
         y -= int((g_bsourcey2 - g_bsourcey) / 2);
     }
-    if (g_data[int('c')] == 1 || g_shift) {
+
+    if (g_data[int('c')] == 1 || g_shift)
+    {
         x = chopv(x, g_gridx);
         y = chopv(y, g_gridy);
     }
 
-    if (g_pixelw == 2) {
+    if (g_pixelw == 2)
+    {
         x = chop2(x);
         ox = chop2(ox);
     }
 
-    if (mbut == 254) { //block picker
+    if (mbut == 254)
+    {
+        //block picker
         switcher(2);
         g_data[int('n')] = 0;
         g_data[int('x')] = 0;
@@ -1037,7 +1046,7 @@
         g_btype = 9;
         return;
     }
-
+    else
     if (mbut == 255) { // color picker
         if (g_multic == 2) {
             if (g_hzoomer == 2) {
@@ -1063,14 +1072,18 @@
     if (g_phase > 0)
         help(1000, x, y);
 
-    if (tt == 1) {
+    if (tt == 1)
+    {
         craft(x, y, 0); //pixeller
     }
     else
-    if (tt == 2) { //spraycan
+    if (tt == 2)
+    {
+        //spraycan
         //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++) {
+        for (int i = 0; i <= 12; i++)
+        {
             int rx = x - 10 + int(random((10) * 2));
             int ry = y - 10 + int(random((10) * 2));
             if (mbut == LEFT) {
@@ -1081,8 +1094,11 @@
         }
     }
     else
-    if (tt == 3) { //cont line
-        if (g_phase == 0) {
+    if (tt == 3)
+    {
+        //cont line
+        if (g_phase == 0)
+        {
             g_prex = x;
             g_prey = y;
             craft(x, y, 0);
@@ -1092,7 +1108,9 @@
         g_prey = y;
     }
     else
-    if (tt == 5) { //floodfill
+    if (tt == 5)
+    {
+        //floodfill
         if (g_klikkeri)
         {
             g_klikkeri = true;
@@ -1118,30 +1136,36 @@
         }
     }
     else
-    if (tt == 6 || tt == 7 || tt == 8) { //line,circle,rect
-        if (g_phase == 0) {
-            g_rx = x;
-            g_ry = y;
-            g_rx2 = x;
-            g_ry2 = y;
+    if (tt == 6 || tt == 7 || tt == 8)
+    {
+        //line,circle,rect
+        if (g_phase == 0)
+        {
+            g_rx = g_rx2 = x;
+            g_ry = g_ry2 = y;
             g_rubbermode = 0;
         }
-        if (g_phase == 1) {
+        else
+        if (g_phase == 1)
+        {
             g_rx2 = x;
             g_ry2 = y;
         }
     }
     else
-    if (tt == 0) { // magnifier graphic tool
+    if (tt == 0)
+    {
+        // magnifier graphic tool
         g_data[int('m')] = 1;
         g_orx = x;
         g_ory = y;
-        g_rx = x - int(magx() / 2) * 8;
-        g_ry = y - int(magy() / 2) * 8;
+        g_rx  = x - int(magx() / 2) * 8;
+        g_ry  = y - int(magy() / 2) * 8;
         g_rx2 = x + (int(magx() / 2) + odd(magx())) * 8;
         g_ry2 = y + (int(magy() / 2) + odd(magy())) * 8;
         g_data[int('m')] = 0;
-        if (g_phase == 1) {
+        if (g_phase == 1)
+        {
             g_rubbermode = 0;
             g_data[int('m')] = 1;
             set_tool(g_prevtool);
@@ -1156,7 +1180,9 @@
             g_rubbermode = 1;
     }
     else
-    if (tt == 4) { //brush grabber grab brush
+    if (tt == 4)
+    {
+        //brush grabber grab brush
         if (g_phase == 0) {
             g_rx = x;
             g_orx = x;
@@ -1188,7 +1214,8 @@
         g_rubbermode = 1;
     }
 
-    if (tt == 0 || tt == 4) {
+    if (tt == 0 || tt == 4)
+    {
         if (g_rubbermode == 1) {
             for (int xx = g_rx; xx <= g_rx2 + 2; xx++) {
                 updatepoint(xx, g_ry);