Mercurial > hg > forks > multipaint-js
annotate draw_smart.pde @ 187:28caa87348d3
Clarify what mpui.js is.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 23 Aug 2018 14:35:08 +0300 |
parents | 934934bb1fbb |
children | 1c9deae71fb1 |
rev | line source |
---|---|
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1 //all "intelligent" stuff, the color behavior |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
2 //and flood fills |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
3 |
135 | 4 void consistency() |
5 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
6 int xx, yy, ad, a, b, x0, y0, x2, y2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
7 int pat, mat, fad, bad, maxxy, mulu, ymax; |
44 | 8 |
9 if (g_multic == 1 || g_multic == 2) | |
10 return; | |
11 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
12 if (g_attrimode == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
13 mat = 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
14 mulu = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
15 maxxy = Y; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
16 ymax = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
17 } |
44 | 18 else |
19 { | |
20 mat = 64; | |
21 mulu = 8; | |
22 maxxy = MY; | |
23 ymax = 7; | |
24 } | |
25 | |
45 | 26 for (yy = 0; yy < MY; yy++) |
27 for (xx = 0; xx < MX; xx++) | |
28 { | |
29 a = getattra(xx * 8, yy * mulu, 0); | |
30 b = getattra(xx * 8, yy * mulu, 1); | |
31 if (a == b) { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
32 for (y0 = 0; y0 <= ymax; y0++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
33 for (x0 = 0; x0 <= 7; x0++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
34 ad = 1024 + (xx * 8) + (yy * X * mulu) + x0 + y0 * X; |
45 | 35 g_map[ad] = byte(0); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
36 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
37 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
38 } |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
39 pat = 0; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
40 for (y0 = 0; y0 <= ymax; y0++) { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
41 for (x0 = 0; x0 <= 7; x0++) { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
42 ad = 1024 + (xx * 8) + (yy * X * mulu) + x0 + y0 * X; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
43 pat = pat + int(g_map[ad]); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
44 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
45 } |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
46 if (pat == mat || pat == 0) { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
47 for (y0 = 0; y0 <= ymax; y0++) { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
48 fad = 65536 + xx + (yy * mulu + y0) * MX; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
49 bad = fad + (MX * MY * 8); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
50 if (pat == 0) g_map[fad] = g_map[bad]; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
51 if (pat == mat) g_map[bad] = g_map[fad]; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
52 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
53 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
54 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
55 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
56 |
44 | 57 |
135 | 58 void transchar(int xx, int yy) |
59 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
60 int fad, bad, ad, pt, x0, y0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
61 int aa, bb, pp, ya, yb; |
45 | 62 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
63 ya = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
64 yb = 0; |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
65 xx = int(xx / 8); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
66 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
67 if (g_attrimode == 1) { |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
68 yy = chop8(yy); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
69 ya = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
70 yb = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
71 } //zx spec etc |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
72 if (g_attrimode == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
73 ya = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
74 yb = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
75 } //msx |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
76 |
45 | 77 for (y0 = ya; y0 <= yb; y0++) |
78 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
79 fad = 65536 + xx + (yy + y0) * MX; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
80 bad = fad + (MX * MY * 8); |
45 | 81 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
82 aa = int(g_map[fad]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
83 bb = int(g_map[bad]); |
45 | 84 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
85 g_map[fad] = byte(bb); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
86 g_map[bad] = byte(aa); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
87 } |
45 | 88 |
89 for (y0 = ya; y0 <= yb; y0++) | |
90 for (x0 = 0; x0 < 8; x0++) | |
91 { | |
92 ad = 1024 + x0 + xx * 8 + (y0 + yy) * X; | |
93 pp = 1 - int(g_map[ad]); | |
94 g_map[ad] = byte(pp); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
95 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
96 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
97 |
44 | 98 |
135 | 99 void prepare_char(int xx, int yy, int farbe) |
100 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
101 //changes the char foreg/backg into "favorable" relative to used color |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
102 //needed in floodfill |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
103 |
45 | 104 // currently seems to be same as transchar except this check, |
105 // so we'll just call transchar() .. -- ccr | |
106 if (int(g_map[1024 + xx + yy * X]) == 0 && | |
107 g_data[int('r')] == 0 && g_data[int('R')] == 0) | |
108 transchar(xx, yy); | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
109 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
110 |
44 | 111 |
136
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
112 void changeborder(int mbut) |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
113 { |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
114 if (g_machine == MSX || g_machine == QLLOW || g_machine == AMIGA || |
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
115 g_machine == PICO8 || g_machine == BK0010 || g_machine == COCO3) |
136
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
116 return; |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
117 |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
118 int par = g_farge; |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
119 store_undo(); |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
120 message("Set border"); |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
121 if (mbut == LEFT) par = g_farge; |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
122 if (mbut == RIGHT) par = g_backg; |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
123 g_map[0] = byte(zxcolor(par)); |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
124 sussborder(); |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
125 g_boxreconstruct = 2; |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
126 refresh_all(); |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
127 } |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
128 |
12cf30907f26
More work on integrating changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents:
135
diff
changeset
|
129 |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
130 void floodfill_init(int xx, int yy) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
131 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
132 for (x = 0; x < X; x++) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
133 for (y = 0; y < Y; y++) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
134 g_fillmap[1024 + x + y * X] = byte(0); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
135 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
136 g_fillmap[1024 + xx + yy * X] = byte(100); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
137 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
138 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
139 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
140 boolean floodfill_mc_plop(int npar, int xc, int yc) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
141 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
142 int ad = 1024 + xc + yc * X; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
143 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
144 if (getmultic(xc, yc, 0) == npar && |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
145 g_fillmap[ad] == 0) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
146 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
147 g_fillmap[ad] = byte(100); |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
148 if (g_pixelw == 2) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
149 g_fillmap[ad + 1] = byte(0); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
150 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
151 return true; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
152 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
153 else |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
154 return false; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
155 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
156 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
157 |
135 | 158 void floodfill_mc(int xx, int yy, int mbut) |
159 { | |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
160 int x, y, ax, valid, okay, par, npar, zad; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
161 par = 0; |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
162 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
163 if (g_pixelw == 2) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
164 xx = chop2(xx); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
165 |
135 | 166 if (mbut == LEFT) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
167 par = g_farge; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
168 else |
135 | 169 if (mbut == RIGHT) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
170 par = g_backg; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
171 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
172 npar = getmultic(xx, yy, 0); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
173 if (npar == par) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
174 return; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
175 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
176 floodfill_init(xx, yy); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
177 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
178 valid = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
179 okay = 0; |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
180 while (okay == 0) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
181 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
182 valid = 0; |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
183 for (y = 0; y < Y; y++) |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
184 for (x = 0; x < X; x += g_pixelw) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
185 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
186 zad = 1024 + x + y * X; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
187 ax = int(g_fillmap[zad]); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
188 if (ax >= 100 && ax <= 199) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
189 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
190 valid = 1; |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
191 if (y > 0 && floodfill_mc_plop(npar, x, y - 1)) |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
192 valid = 1; |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
193 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
194 if (x > g_pixelw && floodfill_mc_plop(npar, x - g_pixelw, y)) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
195 valid = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
196 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
197 if (x < X - 1 - g_pixelw && floodfill_mc_plop(npar, x + g_pixelw, y)) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
198 valid = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
199 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
200 if (y < Y - 1 && floodfill_mc_plop(npar, x, y + 1)) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
201 valid = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
202 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
203 g_fillmap[zad] = byte(200); |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
204 if (g_pixelw == 2) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
205 g_fillmap[zad + 1] = byte(0); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
206 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
207 } |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
208 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
209 if (valid == 0) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
210 okay = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
211 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
212 |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
213 for (y = 0; y < Y; y++) |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
214 for (x = 0; x < X; x += g_pixelw) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
215 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
216 if (g_fillmap[1024 + x + y * X] == byte(200)) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
217 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
218 g_farge = par; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
219 mkaveri(x, y, par, 0); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
220 makepoint(x, y); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
221 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
222 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
223 g_farge = g_ofarge; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
224 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
225 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
226 |
117 | 227 boolean floodfill_iq_plop(int npar, int xc, int yc) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
228 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
229 int ad = 1024 + xc + yc * X; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
230 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
231 if (getabsa(xc, yc, 0) == npar && |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
232 g_fillmap[ad] == 0) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
233 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
234 prepare_char(xc, yc, npar); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
235 g_fillmap[ad] = byte(100); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
236 return true; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
237 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
238 else |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
239 return false; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
240 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
241 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
242 |
135 | 243 void floodfill_iq(int xx, int yy, int mbut) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
244 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
245 int x, y, ax, ay, valid, okay, par, npar, zad; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
246 par = 0; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
247 |
135 | 248 if (mbut == LEFT) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
249 par = g_farge; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
250 else |
135 | 251 if (mbut == RIGHT) |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
252 par = g_backg; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
253 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
254 npar = getabsa(xx, yy, 0); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
255 if (npar == par) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
256 return; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
257 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
258 // Do consistency chec, then get the NEW color under xx,yy |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
259 consistency(); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
260 prepare_char(xx, yy, npar); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
261 floodfill_init(xx, yy); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
262 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
263 valid = 0; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
264 okay = 0; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
265 while (okay == 0) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
266 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
267 valid = 0; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
268 for (y = 0; y < Y; y++) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
269 for (x = 0; x < X; x++) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
270 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
271 zad = 1024 + x + y * X; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
272 ax = int(g_fillmap[zad]); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
273 if (ax == 100) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
274 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
275 valid = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
276 if (y > 0 && floodfill_iq_plop(npar, x, y - 1)) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
277 valid = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
278 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
279 if (x > 0 && floodfill_iq_plop(npar, x - 1, y)) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
280 valid = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
281 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
282 if (x < X - 1 && floodfill_iq_plop(npar, x + 1, y)) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
283 valid = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
284 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
285 if (y < Y - 1 && floodfill_iq_plop(npar, x, y + 1)) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
286 valid = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
287 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
288 g_fillmap[zad] = byte(200); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
289 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
290 } |
46
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
291 if (valid == 0) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
292 okay = 1; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
293 } |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
294 |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
295 for (y = 0; y < Y; y++) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
296 for (x = 0; x < X; x++) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
297 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
298 if (g_fillmap[1024 + x + y * X] == byte(200)) |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
299 { |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
300 g_farge = par; |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
301 makepoint(x, y); |
31bfa78dba15
Clean up and fix the flood fill functions.
Matti Hamalainen <ccr@tnsp.org>
parents:
45
diff
changeset
|
302 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
303 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
304 g_farge = g_ofarge; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
305 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
306 |
44 | 307 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
308 //adaptive color helper for low-attribute modes |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
309 //reasons the background color for each char as you draw |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
310 //=changed |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
311 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
312 void fixattr(int x, int y, int foreg, int backg) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
313 int bad, cad, miny, maxy; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
314 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
315 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
316 if (foreg == 8 || backg == 8 || foreg == 0 || backg == 0) return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
317 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
318 |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
319 miny = chop8(y); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
320 maxy = y - miny; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
321 miny = maxy; |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
322 y = chop8(y); |
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
323 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
324 if (g_attrimode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
325 miny = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
326 maxy = 7; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
327 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
328 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
329 for (int i = miny; i <= maxy; i++) { |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
330 bad = 65536 + int(x / 8) + (y + i) * MX; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
331 cad = bad + MX * (MY * 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
332 if (foreg >= 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
333 g_map[bad] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
334 if (foreg >= 8 && g_map[cad] < 8) g_map[cad] = byte(g_map[cad] + 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
335 if (foreg < 8 && g_map[cad] >= 8) g_map[cad] = byte(g_map[cad] - 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
336 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
337 if (backg >= 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
338 g_map[cad] = byte(backg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
339 if (backg >= 8 && g_map[bad] < 8) g_map[bad] = byte(g_map[bad] + 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
340 if (backg < 8 && g_map[bad] >= 8) g_map[bad] = byte(g_map[bad] - 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
341 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
342 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
343 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
344 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
345 |
44 | 346 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
347 //multicolor color behavior |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
348 //different behavior depending on whether color area already has max colors, |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
349 //or if forcecolor is pressed. |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
350 //bit different for C64 and PLUS4M |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
351 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
352 void skaveri(int x, int y, int foreg, int backg) { |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
353 int mx = int(x / 8); |
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
354 int my = int(y / 8); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
355 if (g_control == false) return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
356 int cc = easygetcolor(x, y); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
357 mx = mx * 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
358 my = my * 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
359 for (int xx = 0; xx <= 7; xx++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
360 for (int yy = 0; yy <= 7; yy++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
361 if (easygetcolor(mx + xx, my + yy) == cc) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
362 g_map[1024 + mx + xx + (my + yy) * X] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
363 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
364 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
365 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
366 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
367 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
368 |
44 | 369 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
370 void mkaveri(int x, int y, int foreg, int backg) { |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
371 int mx = int(x / 8); |
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
372 int my = int(y / 8); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
373 int ad, bad, cad, dad, b0, b1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
374 int f0, f1, f2, f3, free1, free2, free3; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
375 int f, order, numb, suffocatelimit; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
376 int targetbit0, targetbit1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
377 order = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
378 numb = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
379 targetbit0 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
380 targetbit1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
381 suffocatelimit = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
382 |
135 | 383 if (g_multic == 2) return; |
384 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
385 f = getmultic(x, y, 0); |
135 | 386 if (g_data[int('d')] == 1 && f != g_backg) |
387 return; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
388 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
389 cad = 65536 + mx + (my * MX); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
390 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
391 f0 = int(g_map[1]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
392 f1 = int(g_map[cad]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
393 free1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
394 f2 = int(g_map[cad + 1000]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
395 free2 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
396 f3 = int(g_map[cad + 2000]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
397 free3 = 1; |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
398 if (g_machine == PLUS4M) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
399 free3 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
400 suffocatelimit = 3; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
401 f3 = int(g_map[2]); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
402 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
403 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
404 if (foreg == g_map[1] && g_control == false) return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
405 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
406 if (foreg != f1 && foreg != f2 && foreg != f3 || g_control == true) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
407 for (int yy = 0; yy <= 7; yy++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
408 for (int xx = 0; xx <= 3; xx++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
409 ad = 1024 + (mx * 8 + xx * 2) + (my * 8 + yy) * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
410 if (g_map[ad] == 0 && g_map[ad + 1] == 0) { //00 = 00 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
411 if (f0 == f) order = 4; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
412 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
413 if (g_map[ad] == 1 && g_map[ad + 1] == 0) { //01 = 10 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
414 numb = numb | 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
415 free1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
416 if (f1 == f) order = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
417 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
418 if (g_map[ad] == 0 && g_map[ad + 1] == 1) { //02 = 01 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
419 numb = numb | 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
420 free2 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
421 if (f2 == f) order = 2; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
422 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
423 if (g_map[ad] == 1 && g_map[ad + 1] == 1) { //03 = 11 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
424 if (g_machine == C64M) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
425 numb = numb | 4; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
426 free3 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
427 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
428 if (f3 == f) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
429 order = 3; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
430 targetbit0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
431 targetbit1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
432 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
433 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
434 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
435 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
436 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
437 boolean zoink = false; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
438 if (order == 4) zoink = true; |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
439 if (order == 3 && g_machine == PLUS4M) zoink = true; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
440 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
441 if ((zoink || numb != suffocatelimit) && g_control == true) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
442 if (zoink) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
443 //println("foreg:"+foreg+" f0:"+f0+" f1:"+f1+" f2:"+f2+" f3:"+f3+" free1:"+free1+" free2:"+free2+" free3:"+free3); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
444 b0 = -1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
445 b1 = -1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
446 if (foreg == f1 && free1 == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
447 b0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
448 b1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
449 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
450 if (foreg == f2 && free2 == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
451 b0 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
452 b1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
453 } |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
454 if (foreg == f3 && g_machine == C64M && free3 == 0) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
455 b0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
456 b1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
457 } |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
458 if (foreg == f3 && g_machine == PLUS4M) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
459 b0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
460 b1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
461 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
462 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
463 if (free1 == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
464 free2 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
465 free3 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
466 b0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
467 b1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
468 g_map[cad] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
469 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
470 if (free2 == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
471 free3 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
472 b0 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
473 b1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
474 g_map[cad + 1000] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
475 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
476 if (free3 == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
477 b0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
478 b1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
479 g_map[cad + 2000] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
480 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
481 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
482 for (int yy = 0; yy <= 7; yy++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
483 for (int xx = 0; xx <= 3; xx++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
484 ad = 1024 + (mx * 8 + xx * 2) + (my * 8 + yy) * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
485 if (g_map[ad] == targetbit0 && g_map[ad + 1] == targetbit1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
486 if (b0 >= 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
487 g_map[ad] = byte(b0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
488 g_map[ad + 1] = byte(b1); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
489 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
490 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
491 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
492 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
493 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
494 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
495 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
496 //if all color positions are filled, we'll just change the existing one |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
497 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
498 if (numb == suffocatelimit || g_control == true) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
499 if (order == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
500 g_map[cad] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
501 } //10==1 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
502 if (order == 2) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
503 g_map[cad + 1000] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
504 } //01==2 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
505 if (order == 3 && g_machine == C64M) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
506 g_map[cad + 2000] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
507 } //11==3 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
508 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
509 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
510 //color redundancy check |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
511 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
512 for (int yy = 0; yy <= 7; yy++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
513 for (int xx = 0; xx <= 3; xx++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
514 ad = 1024 + (mx * 8 + xx * 2) + (my * 8 + yy) * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
515 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
516 if (g_machine == C64M) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
517 if (g_map[cad] == g_map[cad + 2000]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
518 if (g_map[ad] == 1 && g_map[ad + 1] == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
519 g_map[ad] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
520 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
521 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
522 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
523 if (g_map[cad + 1000] == g_map[cad + 2000]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
524 if (g_map[ad] == 1 && g_map[ad + 1] == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
525 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
526 g_map[ad + 1] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
527 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
528 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
529 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
530 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
531 if (g_map[cad] == g_map[cad + 1000]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
532 if (g_map[ad] == 0 && g_map[ad + 1] == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
533 g_map[ad] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
534 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
535 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
536 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
537 if (g_map[1] == g_map[cad]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
538 if (g_map[ad] == 1 && g_map[ad + 1] == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
539 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
540 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
541 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
542 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
543 if (g_map[1] == g_map[cad + 1000]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
544 if (g_map[ad] == 0 && g_map[ad + 1] == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
545 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
546 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
547 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
548 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
549 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
550 if (g_machine == PLUS4M) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
551 if (g_map[2] == g_map[cad]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
552 if (g_map[ad] == 1 && g_map[ad + 1] == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
553 g_map[ad] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
554 g_map[ad + 1] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
555 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
556 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
557 if (g_map[2] == g_map[cad + 1000]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
558 if (g_map[ad] == 0 && g_map[ad + 1] == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
559 g_map[ad] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
560 g_map[ad + 1] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
561 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
562 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
563 if (g_map[1] == g_map[2]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
564 if (g_map[ad] == 1 && g_map[ad + 1] == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
565 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
566 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
567 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
568 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
569 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
570 |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
571 if (g_machine == C64M) { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
572 if (g_map[1] == g_map[cad + 2000]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
573 if (g_map[ad] == 1 && g_map[ad + 1] == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
574 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
575 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
576 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
577 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
578 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
579 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
580 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
581 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
582 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
583 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
584 |
44 | 585 |
135 | 586 void kaveri(int x, int y, int foreg, int backg) |
587 { | |
588 if (g_multic == 2) | |
589 return; | |
590 if (g_multic != 0 || g_hzoomer == 2 || g_data[int('d')] == 1) | |
591 return; | |
592 | |
593 int k_max, maxy, miny, val, ad, bad, cad; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
594 int farge0, farge1; |
135 | 595 int mx = int(x / 8); |
596 int my = int(y / 8); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
597 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
598 if (g_attrimode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
599 k_max = 64; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
600 miny = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
601 maxy = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
602 } else { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
603 k_max = 8; |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
604 miny = chop8(y); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
605 maxy = y - miny; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
606 miny = maxy; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
607 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
608 |
135 | 609 if (g_britemode == 1 && foreg == 8) |
610 foreg = 0; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
611 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
612 //check the amount of colors in the area |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
613 //if there is only one, return & draw "normally" |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
614 |
135 | 615 if (!g_control) |
616 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
617 val = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
618 |
135 | 619 for (int yy = miny; yy <= maxy; yy++) |
620 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
621 ad = 1024 + (mx * 8) + (my * 8 + yy) * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
622 for (int xx = 0; xx <= 7; xx++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
623 val = val + g_map[ad + xx]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
624 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
625 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
626 |
135 | 627 if (val >= k_max || val == 0) |
628 return; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
629 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
630 //check the two colors the color area is made of |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
631 //if either of the intended color already exists inside the color area, return & draw "normally" |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
632 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
633 bad = 65536 + mx + y * MX; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
634 cad = bad + MX * (MY * 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
635 farge0 = g_map[bad]; //if(g_britemode==1&&farge0==8){farge0=0;} |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
636 farge1 = g_map[cad]; //if(g_britemode==1&&farge1==8){farge1=0;} |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
637 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
638 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
639 if (farge0 < 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
640 if (foreg == farge0 + 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
641 fixattr(x, y, foreg, -1); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
642 return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
643 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
644 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
645 if (farge1 < 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
646 if (foreg == farge1 + 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
647 fixattr(x, y, -1, foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
648 return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
649 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
650 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
651 if (farge0 >= 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
652 if (foreg == farge0 - 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
653 fixattr(x, y, foreg, -1); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
654 return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
655 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
656 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
657 if (farge1 >= 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
658 if (foreg == farge1 - 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
659 fixattr(x, y, -1, foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
660 return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
661 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
662 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
663 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
664 if (foreg == farge0) return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
665 if (foreg == farge1) return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
666 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
667 //new IQ: simply change the underlying color into the intended one, return & draw "normally" |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
668 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
669 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
670 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
671 int piksuf; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
672 int bg, fg; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
673 piksuf = getabsa(x, y, 0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
674 if (g_britemode == 1 && piksuf == 8) piksuf = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
675 bad = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
676 cad = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
677 for (int yy = miny; yy <= maxy; yy++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
678 bad = 65536 + mx + (my * 8) * MX + yy * MX; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
679 cad = bad + MX * (MY * 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
680 fg = g_map[bad]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
681 if (g_britemode == 1 && fg == 8) fg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
682 bg = g_map[cad]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
683 if (g_britemode == 1 && bg == 8) bg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
684 if (piksuf == fg) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
685 g_map[bad] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
686 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
687 if (foreg > 7 && g_map[cad] < 8 && g_map[cad] != 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
688 g_map[cad] = byte(g_map[cad] + 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
689 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
690 if (foreg < 8 && g_map[cad] > 8 && foreg != 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
691 g_map[cad] = byte(g_map[cad] - 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
692 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
693 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
694 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
695 if (piksuf == bg) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
696 g_map[cad] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
697 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
698 if (foreg > 7 && g_map[bad] < 8 && g_map[bad] != 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
699 g_map[bad] = byte(g_map[bad] + 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
700 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
701 if (foreg < 8 && g_map[bad] > 8 && foreg != 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
702 g_map[bad] = byte(g_map[bad] - 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
703 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
704 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
705 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
706 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
707 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
708 // if the result is same color, zero the pixel data |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
709 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
710 if (g_map[bad] == g_map[cad]) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
711 for (int yy = miny; yy <= maxy; yy++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
712 for (int xx = 0; xx <= 7; xx++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
713 ad = 1024 + (mx * 8 + xx) + (my * 8 + yy) * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
714 g_map[ad] = byte(0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
715 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
716 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
717 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
718 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
719 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
720 |
44 | 721 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
722 void kaveri_iq(int x, int y, int f1, int f2) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
723 int k_xx, k_yy, k_ad, k_bad, k_ojox, k_ojoy, k_miny, k_maxy, k_xv, k_yv; |
135 | 724 int k_c1, k_c2, k_v0, k_v1, k_tipping, k_maximum, exist; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
725 byte k_p; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
726 |
135 | 727 if (g_multic != 0 || g_hzoomer == 2) |
728 return; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
729 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
730 exist = getabsa(x, y, 0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
731 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
732 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
733 if (exist == 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
734 if (g_farge < 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
735 exist = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
736 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
737 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
738 if (exist == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
739 if (g_farge > 7) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
740 exist = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
741 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
742 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
743 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
744 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
745 k_v0 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
746 k_v1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
747 k_tipping = 4; |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
748 k_xx = chop8(x); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
749 k_yy = k_yy * 8; |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
750 k_ojox = int(x / 8); |
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
751 k_ojoy = int(y / 8); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
752 k_ojox = k_ojox * 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
753 k_ojoy = k_ojoy * 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
754 k_miny = (y - k_ojoy); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
755 k_maxy = k_miny; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
756 k_maximum = 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
757 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
758 if (g_attrimode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
759 k_miny = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
760 k_maxy = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
761 k_tipping = 32; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
762 k_maximum = 64; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
763 } //spectrum&c64 style |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
764 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
765 k_ad = 65536 + k_xx + (k_yy + k_miny) * MX; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
766 k_bad = k_ad + MX * (MY * 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
767 k_c1 = g_map[k_ad]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
768 k_c2 = g_map[k_bad]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
769 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
770 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
771 if (k_c1 == 8) k_c1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
772 if (k_c2 == 8) k_c2 = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
773 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
774 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
775 k_bad = 1024 + k_xx * 8 + k_yy * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
776 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
777 //do we have more 0's or 1's |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
778 for (k_yv = k_miny; k_yv <= k_maxy; k_yv++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
779 k_ad = k_bad + k_yv * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
780 for (k_xv = 0; k_xv <= 7; k_xv++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
781 if (g_map[k_ad] == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
782 k_v1++; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
783 } else { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
784 k_v0++; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
785 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
786 k_ad++; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
787 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
788 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
789 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
790 //force color |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
791 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
792 if (g_control) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
793 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
794 k_v1 = k_tipping + 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
795 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
796 if (k_c1 == exist) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
797 k_c1 = g_farge; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
798 if (k_c1 == 8 && g_britemode == 1) k_c1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
799 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
800 if (k_c2 == exist) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
801 k_c2 = g_farge; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
802 if (k_c2 == 8 && g_britemode == 1) k_c2 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
803 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
804 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
805 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
806 if (g_farge >= 8) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
807 if (k_c1 <= 7) k_c1 = k_c1 + 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
808 if (k_c2 <= 7) k_c2 = k_c2 + 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
809 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
810 if (g_farge <= 7) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
811 if (k_c1 >= 8) k_c1 = k_c1 - 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
812 if (k_c2 >= 8) k_c2 = k_c2 - 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
813 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
814 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
815 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
816 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
817 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
818 if (k_v1 > k_tipping) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
819 for (k_yv = k_miny; k_yv <= k_maxy; k_yv++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
820 k_ad = 65536 + k_xx + (k_yy + k_yv) * MX; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
821 k_bad = k_ad + MX * (MY * 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
822 g_map[k_ad] = byte(k_c2); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
823 g_map[k_bad] = byte(k_c1); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
824 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
825 for (k_yv = k_miny; k_yv <= k_maxy; k_yv++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
826 k_ad = 1024 + k_xx * 8 + (k_yy + k_yv) * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
827 for (k_xv = 0; k_xv <= 7; k_xv++) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
828 k_p = g_map[k_ad]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
829 g_map[k_ad] = byte(1 - k_p); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
830 if (k_c1 == k_c2) g_map[k_ad] = byte(0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
831 k_ad++; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
832 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
833 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
834 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
835 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
836 } |