Mercurial > hg > forks > multipaint-js
annotate draw_smart.pde @ 237:a3f79ce74471
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 10 Sep 2018 11:10:19 +0300 |
parents | 1d9f9c3d8ab1 |
children | 3a85cf4a4fef |
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 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
320 int bad, cad, miny, maxy; |
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 { | |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
340 bad = 65536 + int(x / 8) + (y + i) * MX; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
341 cad = bad + MX * (MY * 8); |
225 | 342 if (foreg >= 0) |
343 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
344 g_map[bad] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
345 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
|
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 } |
225 | 348 if (backg >= 0) |
349 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
350 g_map[cad] = byte(backg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
351 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
|
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 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
354 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
355 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
356 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
357 |
44 | 358 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
359 //multicolor color behavior |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
360 //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
|
361 //or if forcecolor is pressed. |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
362 //bit different for C64 and PLUS4M |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
363 |
225 | 364 void skaveri(int x, int y, int foreg, int backg) |
365 { | |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
366 int mx = int(x / 8); |
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
367 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
|
368 if (g_control == false) return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
369 int cc = easygetcolor(x, y); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
370 mx = mx * 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
371 my = my * 8; |
225 | 372 for (int xx = 0; xx <= 7; xx++) |
373 { | |
374 for (int yy = 0; yy <= 7; yy++) | |
375 { | |
376 if (easygetcolor(mx + xx, my + yy) == cc) | |
377 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
378 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
|
379 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
380 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
381 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
382 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
383 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
384 |
44 | 385 |
225 | 386 void mkaveri(int x, int y, int foreg, int backg) |
387 { | |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
388 int mx = int(x / 8); |
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
389 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
|
390 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
|
391 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
|
392 int f, order, numb, suffocatelimit; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
393 int targetbit0, targetbit1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
394 order = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
395 numb = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
396 targetbit0 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
397 targetbit1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
398 suffocatelimit = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
399 |
135 | 400 if (g_multic == 2) return; |
401 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
402 f = getmultic(x, y, 0); |
135 | 403 if (g_data[int('d')] == 1 && f != g_backg) |
404 return; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
405 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
406 cad = 65536 + mx + (my * MX); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
407 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
408 f0 = int(g_map[1]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
409 f1 = int(g_map[cad]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
410 free1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
411 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
|
412 free2 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
413 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
|
414 free3 = 1; |
225 | 415 if (g_machine == PLUS4M) |
416 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
417 free3 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
418 suffocatelimit = 3; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
419 f3 = int(g_map[2]); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
420 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
421 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
422 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
|
423 |
225 | 424 if (foreg != f1 && foreg != f2 && foreg != f3 || g_control == true) |
425 { | |
426 for (int yy = 0; yy <= 7; yy++) | |
427 { | |
428 for (int xx = 0; xx <= 3; xx++) | |
429 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
430 ad = 1024 + (mx * 8 + xx * 2) + (my * 8 + yy) * X; |
225 | 431 if (g_map[ad] == 0 && g_map[ad + 1] == 0) |
432 { //00 = 00 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
433 if (f0 == f) order = 4; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
434 } |
225 | 435 if (g_map[ad] == 1 && g_map[ad + 1] == 0) |
436 { //01 = 10 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
437 numb = numb | 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
438 free1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
439 if (f1 == f) order = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
440 } |
225 | 441 if (g_map[ad] == 0 && g_map[ad + 1] == 1) |
442 { //02 = 01 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
443 numb = numb | 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
444 free2 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
445 if (f2 == f) order = 2; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
446 } |
225 | 447 if (g_map[ad] == 1 && g_map[ad + 1] == 1) |
448 { //03 = 11 | |
449 if (g_machine == C64M) | |
450 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
451 numb = numb | 4; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
452 free3 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
453 } |
225 | 454 if (f3 == f) |
455 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
456 order = 3; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
457 targetbit0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
458 targetbit1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
459 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
460 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
461 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
462 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
463 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
464 boolean zoink = false; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
465 if (order == 4) zoink = true; |
179
934934bb1fbb
Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents:
136
diff
changeset
|
466 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
|
467 |
225 | 468 if ((zoink || numb != suffocatelimit) && g_control == true) |
469 { | |
470 if (zoink) | |
471 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
472 //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
|
473 b0 = -1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
474 b1 = -1; |
225 | 475 if (foreg == f1 && free1 == 0) |
476 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
477 b0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
478 b1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
479 } |
225 | 480 if (foreg == f2 && free2 == 0) |
481 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
482 b0 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
483 b1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
484 } |
225 | 485 if (foreg == f3 && g_machine == C64M && free3 == 0) |
486 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
487 b0 = 1; |
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 == PLUS4M) |
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 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
495 |
225 | 496 if (free1 == 1) |
497 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
498 free2 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
499 free3 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
500 b0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
501 b1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
502 g_map[cad] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
503 } |
225 | 504 if (free2 == 1) |
505 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
506 free3 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
507 b0 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
508 b1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
509 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
|
510 } |
225 | 511 if (free3 == 1) |
512 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
513 b0 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
514 b1 = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
515 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
|
516 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
517 |
225 | 518 for (int yy = 0; yy <= 7; yy++) |
519 { | |
520 for (int xx = 0; xx <= 3; xx++) | |
521 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
522 ad = 1024 + (mx * 8 + xx * 2) + (my * 8 + yy) * X; |
225 | 523 if (g_map[ad] == targetbit0 && g_map[ad + 1] == targetbit1) |
524 { | |
525 if (b0 >= 0) | |
526 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
527 g_map[ad] = byte(b0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
528 g_map[ad + 1] = byte(b1); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
529 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
530 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
531 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
532 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
533 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
534 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
535 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
536 //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
|
537 |
225 | 538 if (numb == suffocatelimit || g_control == true) |
539 { | |
540 if (order == 1) | |
541 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
542 g_map[cad] = byte(foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
543 } //10==1 |
225 | 544 if (order == 2) |
545 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
546 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
|
547 } //01==2 |
225 | 548 if (order == 3 && g_machine == C64M) |
549 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
550 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
|
551 } //11==3 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
552 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
553 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
554 //color redundancy check |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
555 |
225 | 556 for (int yy = 0; yy <= 7; yy++) |
557 { | |
558 for (int xx = 0; xx <= 3; xx++) | |
559 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
560 ad = 1024 + (mx * 8 + xx * 2) + (my * 8 + yy) * X; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
561 |
225 | 562 if (g_machine == C64M) |
563 { | |
564 if (g_map[cad] == g_map[cad + 2000]) | |
565 { | |
566 if (g_map[ad] == 1 && g_map[ad + 1] == 1) | |
567 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
568 g_map[ad] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
569 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
570 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
571 } |
225 | 572 if (g_map[cad + 1000] == g_map[cad + 2000]) |
573 { | |
574 if (g_map[ad] == 1 && g_map[ad + 1] == 1) | |
575 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
576 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
577 g_map[ad + 1] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
578 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
579 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
580 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
581 |
225 | 582 if (g_map[cad] == g_map[cad + 1000]) |
583 { | |
584 if (g_map[ad] == 0 && g_map[ad + 1] == 1) | |
585 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
586 g_map[ad] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
587 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
588 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
589 } |
225 | 590 if (g_map[1] == g_map[cad]) |
591 { | |
592 if (g_map[ad] == 1 && g_map[ad + 1] == 0) | |
593 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
594 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
595 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
596 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
597 } |
225 | 598 if (g_map[1] == g_map[cad + 1000]) |
599 { | |
600 if (g_map[ad] == 0 && g_map[ad + 1] == 1) | |
601 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
602 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
603 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
604 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
605 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
606 |
225 | 607 if (g_machine == PLUS4M) |
608 { | |
609 if (g_map[2] == g_map[cad]) | |
610 { | |
611 if (g_map[ad] == 1 && g_map[ad + 1] == 0) | |
612 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
613 g_map[ad] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
614 g_map[ad + 1] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
615 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
616 } |
225 | 617 if (g_map[2] == g_map[cad + 1000]) |
618 { | |
619 if (g_map[ad] == 0 && g_map[ad + 1] == 1) | |
620 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
621 g_map[ad] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
622 g_map[ad + 1] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
623 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
624 } |
225 | 625 if (g_map[1] == g_map[2]) |
626 { | |
627 if (g_map[ad] == 1 && g_map[ad + 1] == 1) | |
628 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
629 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
630 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
631 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
632 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
633 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
634 |
225 | 635 if (g_machine == C64M) |
636 { | |
637 if (g_map[1] == g_map[cad + 2000]) | |
638 { | |
639 if (g_map[ad] == 1 && g_map[ad + 1] == 1) | |
640 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
641 g_map[ad] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
642 g_map[ad + 1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
643 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
644 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
645 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
646 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
647 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
648 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
649 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
650 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
651 |
44 | 652 |
135 | 653 void kaveri(int x, int y, int foreg, int backg) |
654 { | |
655 if (g_multic == 2) | |
656 return; | |
657 if (g_multic != 0 || g_hzoomer == 2 || g_data[int('d')] == 1) | |
658 return; | |
659 | |
660 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
|
661 int farge0, farge1; |
135 | 662 int mx = int(x / 8); |
663 int my = int(y / 8); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
664 |
225 | 665 if (g_attrimode == 1) |
666 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
667 k_max = 64; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
668 miny = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
669 maxy = 7; |
225 | 670 } |
671 else | |
672 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
673 k_max = 8; |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
674 miny = chop8(y); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
675 maxy = y - miny; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
676 miny = maxy; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
677 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
678 |
135 | 679 if (g_britemode == 1 && foreg == 8) |
680 foreg = 0; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
681 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
682 //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
|
683 //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
|
684 |
135 | 685 if (!g_control) |
686 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
687 val = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
688 |
135 | 689 for (int yy = miny; yy <= maxy; yy++) |
690 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
691 ad = 1024 + (mx * 8) + (my * 8 + yy) * X; |
225 | 692 for (int xx = 0; xx <= 7; xx++) |
693 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
694 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
|
695 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
696 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
697 |
135 | 698 if (val >= k_max || val == 0) |
699 return; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
700 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
701 //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
|
702 //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
|
703 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
704 bad = 65536 + mx + y * MX; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
705 cad = bad + MX * (MY * 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
706 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
|
707 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
|
708 |
225 | 709 if (g_britemode == 1) |
710 { | |
711 if (farge0 < 8) | |
712 { | |
713 if (foreg == farge0 + 8) | |
714 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
715 fixattr(x, y, foreg, -1); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
716 return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
717 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
718 } |
225 | 719 if (farge1 < 8) |
720 { | |
721 if (foreg == farge1 + 8) | |
722 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
723 fixattr(x, y, -1, foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
724 return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
725 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
726 } |
225 | 727 if (farge0 >= 8) |
728 { | |
729 if (foreg == farge0 - 8) | |
730 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
731 fixattr(x, y, foreg, -1); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
732 return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
733 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
734 } |
225 | 735 if (farge1 >= 8) |
736 { | |
737 if (foreg == farge1 - 8) | |
738 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
739 fixattr(x, y, -1, foreg); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
740 return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
741 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
742 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
743 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
744 if (foreg == farge0) return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
745 if (foreg == farge1) return; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
746 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
747 //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
|
748 |
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 int piksuf; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
752 int bg, fg; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
753 piksuf = getabsa(x, y, 0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
754 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
|
755 bad = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
756 cad = 0; |
225 | 757 for (int yy = miny; yy <= maxy; yy++) |
758 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
759 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
|
760 cad = bad + MX * (MY * 8); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
761 fg = g_map[bad]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
762 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
|
763 bg = g_map[cad]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
764 if (g_britemode == 1 && bg == 8) bg = 0; |
225 | 765 if (piksuf == fg) |
766 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
767 g_map[bad] = byte(foreg); |
225 | 768 if (g_britemode == 1) |
769 { | |
770 if (foreg > 7 && g_map[cad] < 8 && g_map[cad] != 0) | |
771 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
772 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
|
773 } |
225 | 774 if (foreg < 8 && g_map[cad] > 8 && foreg != 0) |
775 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
776 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
|
777 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
778 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
779 } |
225 | 780 if (piksuf == bg) |
781 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
782 g_map[cad] = byte(foreg); |
225 | 783 if (g_britemode == 1) |
784 { | |
785 if (foreg > 7 && g_map[bad] < 8 && g_map[bad] != 0) | |
786 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
787 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
|
788 } |
225 | 789 if (foreg < 8 && g_map[bad] > 8 && foreg != 0) |
790 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
791 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
|
792 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
793 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
794 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
795 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
796 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
797 // 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
|
798 |
225 | 799 if (g_map[bad] == g_map[cad]) |
800 { | |
801 for (int yy = miny; yy <= maxy; yy++) | |
802 { | |
803 for (int xx = 0; xx <= 7; xx++) | |
804 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
805 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
|
806 g_map[ad] = byte(0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
807 } |
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 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
811 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
812 |
44 | 813 |
225 | 814 void kaveri_iq(int x, int y, int f1, int f2) |
815 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
816 int k_xx, k_yy, k_ad, k_bad, k_ojox, k_ojoy, k_miny, k_maxy, k_xv, k_yv; |
135 | 817 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
|
818 byte k_p; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
819 |
135 | 820 if (g_multic != 0 || g_hzoomer == 2) |
821 return; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
822 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
823 exist = getabsa(x, y, 0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
824 |
225 | 825 if (g_britemode == 1) |
826 { | |
827 if (exist == 8) | |
828 { | |
829 if (g_farge < 8) | |
830 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
831 exist = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
832 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
833 } |
225 | 834 if (exist == 0) |
835 { | |
836 if (g_farge > 7) | |
837 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
838 exist = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
839 } |
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 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
842 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
843 k_v0 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
844 k_v1 = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
845 k_tipping = 4; |
7
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
846 k_xx = chop8(x); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
847 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
|
848 k_ojox = int(x / 8); |
c848a6133cfc
Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents:
4
diff
changeset
|
849 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
|
850 k_ojox = k_ojox * 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
851 k_ojoy = k_ojoy * 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
852 k_miny = (y - k_ojoy); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
853 k_maxy = k_miny; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
854 k_maximum = 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
855 |
225 | 856 if (g_attrimode == 1) |
857 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
858 k_miny = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
859 k_maxy = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
860 k_tipping = 32; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
861 k_maximum = 64; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
862 } //spectrum&c64 style |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
863 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
864 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
|
865 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
|
866 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
|
867 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
|
868 |
225 | 869 if (g_britemode == 1) |
870 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
871 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
|
872 if (k_c2 == 8) k_c2 = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
873 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
874 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
875 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
|
876 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
877 //do we have more 0's or 1's |
225 | 878 for (k_yv = k_miny; k_yv <= k_maxy; k_yv++) |
879 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
880 k_ad = k_bad + k_yv * X; |
225 | 881 for (k_xv = 0; k_xv <= 7; k_xv++) |
882 { | |
883 if (g_map[k_ad] == 1) | |
884 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
885 k_v1++; |
225 | 886 } |
887 else | |
888 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
889 k_v0++; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
890 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
891 k_ad++; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
892 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
893 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
894 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
895 //force color |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
896 |
225 | 897 if (g_control) |
898 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
899 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
900 k_v1 = k_tipping + 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
901 |
225 | 902 if (k_c1 == exist) |
903 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
904 k_c1 = g_farge; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
905 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
|
906 } |
225 | 907 if (k_c2 == exist) |
908 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
909 k_c2 = g_farge; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
910 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
|
911 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
912 |
225 | 913 if (g_britemode == 1) |
914 { | |
915 if (g_farge >= 8) | |
916 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
917 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
|
918 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
|
919 } |
225 | 920 if (g_farge <= 7) |
921 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
922 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
|
923 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
|
924 } |
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 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
927 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
928 |
225 | 929 if (k_v1 > k_tipping) |
930 { | |
931 for (k_yv = k_miny; k_yv <= k_maxy; k_yv++) | |
932 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
933 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
|
934 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
|
935 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
|
936 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
|
937 } |
225 | 938 for (k_yv = k_miny; k_yv <= k_maxy; k_yv++) |
939 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
940 k_ad = 1024 + k_xx * 8 + (k_yy + k_yv) * X; |
225 | 941 for (k_xv = 0; k_xv <= 7; k_xv++) |
942 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
943 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
|
944 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
|
945 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
|
946 k_ad++; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
0
diff
changeset
|
947 } |
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 updatepoint(x, y); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
951 } |