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