changeset 211:6d866e284dd2

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 29 Aug 2018 20:27:00 +0300
parents 13aed87e472a
children b3579297e04e
files draw_inputs.pde
diffstat 1 files changed, 12 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/draw_inputs.pde	Wed Aug 29 15:37:37 2018 +0300
+++ b/draw_inputs.pde	Wed Aug 29 20:27:00 2018 +0300
@@ -70,8 +70,7 @@
 int getmultic(int xc, int yc, int mode) //mode 0=screen 1=brush
 {
     //returns the multicolor color on point xc,yc
-    int ad, looks, mmc, source1, source2;
-    ad = 1024 + xc + yc * X;
+    int ad = 1024 + xc + yc * X;
 
     if (g_multic == 2)
     {
@@ -79,11 +78,9 @@
         if (mode == 1) return g_brush[ad];
     }
 
-    source1 = 0;
-    source2 = 0;
-
-    xc = chop2(xc);
-    looks = 65536 + int(xc / 8) + int(yc / 8) * MX;
+    int source1 = 0,
+        source2 = 0,
+        looks = 65536 + int(chop2(xc) / 8) + int(yc / 8) * MX;
 
     if (mode == 0)
     {
@@ -97,7 +94,7 @@
         source2 = g_brush[ad + 1];
     }
 
-    mmc = source1 + source2 * 2;
+    int mmc = source1 + source2 * 2;
 
     //source1=0
     //source2=+1
@@ -145,14 +142,14 @@
 int getattra(int xx, int yy, int mode) //mode foreground backround
 {
     //returns the internal foreground / background color on point xx,yy
-    if (g_multic == 2) {
-        if (mode == 0) return getmultic(xx, yy, 0);
-        return g_backg;
+    if (g_multic == 2)
+    {
+        return (mode == 0) ? getmultic(xx, yy, 0) : g_backg;
     }
     else
-    if (g_multic == 1) {
-        if (mode == 0) return getmultic(xx, yy, 0);
-        return g_map[1]; // was 0?
+    if (g_multic == 1)
+    {
+        return (mode == 0) ? getmultic(xx, yy, 0) : g_map[1]; // was 0?
     }
 
     // XXX ! is this correct? yv is not used
@@ -166,10 +163,7 @@
     else
         val = g_map[ad + (MX * MY) * 8];
 
-    if (g_britemode == 1 && val == 8)
-        return 0;
-    else
-        return val;
+    return (g_britemode == 1 && val == 8) ? 0 : val;
 }
 
 
@@ -223,10 +217,7 @@
     if (g_multic > 0)
         return getmultic(xx, yy, 0);
     else
-    if (g_multic == 0)
         return getabsa(xx, yy, 0);
-    else
-        return 0;
 }