annotate Interface.pde @ 152:394c52d4763a

Cosmetics.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 15 Aug 2018 15:54:47 +0300
parents 8a9a9fcc02f7
children 1b2cbf3ab441
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1 // This collects UI stuff that's not directly related to the viewport
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
2 // i.e. Icons, color selectors and the like, but also undo/spare
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
3
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
4 //fixed raster parameters
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
5 int g_raster_offset_x;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
6 int g_raster_offset_y;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
7 int g_raster_no;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
8
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
9 byte[] g_depressed = new byte[256];
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
10
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
11
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
12 int g_fixedraster[] = {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
13 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
14 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
15 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
16 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
17 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
18 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
19 1,0,0,0,1,0,0,0,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
20 0,0,1,0,0,0,1,0
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
21 };
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
22
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
23
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
24 int g_rasterpatterns[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
25
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
26 0,1,1,1,0,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
27 1,1,1,1,1,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
28 1,1,0,1,1,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
29 1,1,1,1,1,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
30 0,1,1,1,0,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
31 1,1,1,1,1,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
32 1,1,0,1,1,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
33 1,1,1,1,1,1,1,1,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
34
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
35 0,1,1,1,0,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
36 1,1,0,1,1,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
37 0,1,1,1,0,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
38 1,1,0,1,1,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
39 0,1,1,1,0,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
40 1,1,0,1,1,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
41 0,1,1,1,0,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
42 1,1,0,1,1,1,0,1,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
43
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
44 0,1,1,1,0,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
45 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
46 1,1,0,1,1,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
47 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
48 0,1,1,1,0,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
49 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
50 1,1,0,1,1,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
51 1,0,1,0,1,0,1,0,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
52
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
53 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
54 0,1,0,1,0,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
55 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
56 0,1,0,1,0,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
57 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
58 0,1,0,1,0,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
59 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
60 0,1,0,1,0,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
61
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
62 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
63 0,1,0,1,0,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
64 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
65 0,1,0,1,0,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
66 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
67 0,1,0,1,0,1,0,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
68 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
69 0,1,0,1,0,1,0,1,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
70
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
71 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
72 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
73 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
74 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
75 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
76 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
77 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
78 0,0,1,0,0,0,1,0,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
79
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
80 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
81 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
82 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
83 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
84 1,0,0,0,1,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
85 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
86 0,0,1,0,0,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
87 0,0,0,0,0,0,0,0,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
88
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
89 1,1,1,1,1,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
90 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
91 1,1,1,1,1,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
92 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
93 1,1,1,1,1,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
94 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
95 1,1,1,1,1,1,1,1,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
96 0,0,0,0,0,0,0,0,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
97
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
98 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
99 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
100 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
101 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
102 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
103 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
104 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
105 0,0,0,0,0,0,0,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
106
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
107 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
108 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
109 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
110 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
111 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
112 1,0,1,0,1,0,1,0,
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
113 1,0,1,0,1,0,1,0,
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
114 1,0,1,0,1,0,1,0
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
115 };
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
116
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
117
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
118 void setup_raster()
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
119 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
120 g_raster_offset_x = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
121 g_raster_offset_y = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
122 g_raster_no = 3;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
123 set_fixed_raster(g_raster_no);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
124 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
125
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
126
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
127 void fixed_raster_command(int par)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
128 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
129 if (par == 'p') {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
130 g_raster_no--;
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
131 if (g_raster_no < 0)
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
132 g_raster_no = 9;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
133 set_fixed_raster(g_raster_no);
4
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
134 g_data[int('r')] = 1;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
135 }
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
136 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
137 if (par == 'n') {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
138 g_raster_no++;
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
139 if (g_raster_no > 9)
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
140 g_raster_no = 0;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
141 set_fixed_raster(g_raster_no);
4
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
142 g_data[int('r')] = 1;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
143 }
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
144 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
145 if (par == 'x') {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
146 g_raster_offset_x++;
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
147 if (g_raster_offset_x > 3)
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
148 g_raster_offset_x = 0;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
149 }
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
150 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
151 if (par == 'y') {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
152 g_raster_offset_y++;
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
153 if (g_raster_offset_y > 3)
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
154 g_raster_offset_y = 0;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
155 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
156 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
157
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
158
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
159 int magmode()
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
160 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
161 //return the mode "number" based on g_uizoom and 'm' and 'M'
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
162 //currently valid outputs are 0,10,20,1,11,21,2,12,22
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
163 int base = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
164 if (g_uizoom == 1) base = 10;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
165 if (g_uizoom == 3) base = 20;
4
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
166 if (g_data[int('M')] == 1 && g_data[int('m')] == 1) g_data[int('m')] = 0;
144
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
167 if (g_data[int('m')] == 1) base += 1;
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
168 if (g_data[int('M')] == 1) base += 2;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
169 return base;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
170 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
171
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
172
144
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
173 int magx()
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
174 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
175 //return the amount of horizontal 8x8 characters in current mode ('m' or 'M')
144
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
176 int mag = g_magpix[magmode()] * 8;
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
177 return int((width - (33 * g_uizoom)) / mag);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
178 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
179
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
180
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
181 int magy()
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
182 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
183 //return the amount of vertical 8x8 characters in current mode ('m' or 'M')
144
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
184 int mag = g_magpiy[magmode()] * 8;
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
185 return int((height - (33 * g_uizoom)) / mag); //how many chars in a magmode
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
186 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
187
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
188
131
9d17f991f102 Move undo and spare page management into buffers.pde as in Multipaint 2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
189 void sussborder()
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
190 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
191 makecolor(259, g_r[g_map[0]], g_g[g_map[0]], g_b[g_map[0]]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
192 g_boxreconstruct = 2;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
193 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
194
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
195
131
9d17f991f102 Move undo and spare page management into buffers.pde as in Multipaint 2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
196 void makecolor(int c, int rr, int gg, int bb)
9d17f991f102 Move undo and spare page management into buffers.pde as in Multipaint 2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
197 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
198 //0-255 go to g_map[] up until 1021-1023
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
199 //the rest is not stored
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
200 if (c < 256) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
201 g_map[256 + c * 3] = byte(rr);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
202 g_map[256 + c * 3 + 1] = byte(gg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
203 g_map[256 + c * 3 + 2] = byte(bb);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
204 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
205 g_r[c] = rr;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
206 g_g[c] = gg;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
207 g_b[c] = bb;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
208
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
209 g_rgb[c] = 0xff000000 | ((rr & 0xff) << 16) | ((gg & 0xff) << 8) | (bb & 0xff);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
210 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
211
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
212
131
9d17f991f102 Move undo and spare page management into buffers.pde as in Multipaint 2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
213 int fylli()
9d17f991f102 Move undo and spare page management into buffers.pde as in Multipaint 2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
214 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
215 //for the animated rubberband thingy
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
216 g_rband++;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
217 if (g_rband > g_rbang) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
218 g_rband = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
219 g_rbang++;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
220 if (g_rbang > 12) g_rbang = 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
221 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
222 if (g_rband >= 3) return 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
223 return 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
224 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
225
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
226
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
227 void e_rect(int x1, int y1, int w, int h, int rgb)
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
228 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
229 int ad = x1 + y1 * width;
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
230 for (int yy = 0; yy < h; yy++)
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
231 {
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
232 for (int xx = 0; xx < w; xx++)
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
233 pixels[ad + xx] = rgb;
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
234
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
235 ad += width;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
236 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
237 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
238
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
239
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
240 void d_rect(int x1, int y1, int w, int h, int rgb)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
241 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
242 int ad = x1 + y1 * width;
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
243 for (int yy = 0; yy < h; yy++)
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
244 {
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
245 for (int xx = 0; xx < w; xx++)
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
246 {
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
247 if (xx == 0 || yy == 0 || xx == w - 1 || yy == h - 1)
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
248 pixels[ad + xx] = rgb;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
249 }
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
250 ad += width;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
251 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
252 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
253
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
254
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
255 void t_rect(int x1, int y1, int w, int h, int rgb)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
256 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
257 // transparent rectangle
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
258 // fixed tp, for grid drawing
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
259
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
260 //the updatepixels rigmarole has to be handled elsewhere
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
261 int r, g, b, s, fout;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
262 int ad = x1 + y1 * width;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
263
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
264 if (g_gridmode == NEW)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
265 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
266 for (int yy = 0; yy < h; yy++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
267 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
268 for (int xx = 0; xx < w; xx++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
269 s = pixels[ad + xx];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
270 fout = 0;
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
271
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
272 if (g_rgb[0] == s) fout = g_grids[0];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
273 if (g_rgb[1] == s) fout = g_grids[1];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
274 if (g_rgb[2] == s) fout = g_grids[2];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
275 if (g_rgb[3] == s) fout = g_grids[3];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
276 if (g_rgb[4] == s) fout = g_grids[4];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
277 if (g_rgb[5] == s) fout = g_grids[5];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
278 if (g_rgb[6] == s) fout = g_grids[6];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
279 if (g_rgb[7] == s) fout = g_grids[7];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
280 if (g_rgb[8] == s) fout = g_grids[8];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
281 if (g_rgb[9] == s) fout = g_grids[9];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
282 if (g_rgb[10] == s) fout = g_grids[10];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
283 if (g_rgb[11] == s) fout = g_grids[11];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
284 if (g_rgb[12] == s) fout = g_grids[12];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
285 if (g_rgb[13] == s) fout = g_grids[13];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
286 if (g_rgb[14] == s) fout = g_grids[14];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
287 if (g_rgb[15] == s) fout = g_grids[15];
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
288
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
289 pixels[ad + xx] = fout;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
290 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
291 ad = ad + width;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
292 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
293 }
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
294 else
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
295 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
296
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
297 for (int yy = 0; yy < h; yy++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
298 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
299 for (int xx = 0; xx < w; xx++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
300 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
301 s = pixels[ad + xx];
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
302
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
303 r = (s >> 16) & 0xff;
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
304 g = (s >> 8) & 0xff;
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
305 b = (s) & 0xff;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
306
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
307 g = g + 64;
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
308
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
309 r = int((r * 2) / 3);
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
310 g = int((g * 2) / 3);
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
311 b = int((b * 2) / 3);
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
312
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
313 pixels[ad + xx] = 0xff000000 + r * 0x10000 + g * 0x100 + b;
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
314 }
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
315 ad = ad + width;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
316 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
317 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
318 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
319
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
320
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
321 // parameter store/restore in case some functions need to bypass grid, attribute modes etc
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
322 void storeparameters()
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
323 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
324 for (int i = 0; i <= 255; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
325 g_data[767 + i] = g_data[i];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
326 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
327 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
328
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
329
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
330 void restoreparameters()
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
331 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
332 for (int i = 0; i <= 255; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
333 g_data[i] = g_data[767 + i];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
334 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
335 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
336
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
337
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
338 void drawtext(int xo, int yo, String ss)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
339 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
340 //draw a bunch of text maybe not needed
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
341 for (int i = 0; i < ss.length(); i++)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
342 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
343 drawchar(xo + i * 8 * 2, yo, ss.charAt(i));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
344 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
345 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
346
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
347
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
348 void drawicon(int xo, int yo, int t, int mm)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
349 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
350 //draw one icon
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
351 int ad, cad, xx, yy, pop, far;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
352 int metal;
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
353
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
354 yy = int(t / 16);
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
355 xx = t - (yy * 16);
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
356
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
357 xx *= 2;
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
358 yy *= 2;
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
359
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
360 ad = 1024 + xx * 8 + yy * 2048;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
361
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
362 for (int y = 0; y < 16; y++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
363 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
364 for (int x = 0; x < 16; x++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
365 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
366 metal = 0xffa0a0a0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
367 far = 0xff000000;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
368 if (t == 18 || (t == 19 && g_backmode == 1)) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
369 if (x < 15 && y < 15) far = int(g_rgb[g_farge]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
370 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
371 if (g_depressed[t] > 0) metal = 0xff606060;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
372
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
373 if (x == 0 || y == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
374 metal = 0xffe0e0e0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
375 if (g_depressed[t] > 0) metal = 0xff303030;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
376 if (t == 56 || t == 9) metal = 0xffa0a0a0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
377 }
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
378
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
379 cad = 65536 + (xx + int(x / 8)) + yy * 256 + y * 32;
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
380
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
381 pop = (int(g_icons[cad]) == 0) ? 0 : 1;
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
382
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
383 if (int(g_icons[ad + x]) == pop) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
384 far = metal;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
385 if (mm == 1) far = 0xffffff80;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
386 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
387
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
388 if (t == 66) { //raster icon
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
389 if (x >= 1 && y >= 2 && x <= 13 && y <= 12) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
390 far = metal;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
391 if (mm == 1) far = 0xffffff80;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
392 if (get_raster(x + 1, y) == 1) far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
393 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
394 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
395
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
396 e_rect(xo + x * g_uizoom, yo + y * g_uizoom, g_uizoom, g_uizoom, far);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
397 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
398 ad = ad + 256;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
399 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
400 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
401
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
402
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
403 void drawchar(int xo, int yo, int t)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
404 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
405 //characters at the help box
10
80380099f1ad Check for characters < 32 in drawchar() because 32 is deducted from the value.
Matti Hamalainen <ccr@tnsp.org>
parents: 9
diff changeset
406 if (t < 32) return;
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
407
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
408 t -= 32;
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
409 int yy = int(t / 32);
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
410 int xx = t - (yy * 32);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
411 yy = yy + 18;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
412
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
413 for (int y = 0; y < 8; y++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
414 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
415 int ad = 1024 + xx * 8 + yy * 2048 + y * 256;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
416
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
417 for (int x = 0; x < 8; x++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
418 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
419 int far;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
420 if (int(g_icons[ad + x]) != 0) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
421 far = 0xffb0b0b0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
422 if (g_bsize < 4) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
423 if (g_bsize + (g_btype * 4) + 96 == t) far = 0xffffff80;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
424 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
425 } else {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
426 far = 0xff000000;
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
427 if (g_spare && t <= 95) far = 0xff008000; //different background color for spare mode
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
428 if (g_msgctr > 0 && t + 32 < 128) far = 0xff0000ff; //different background color
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
429 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
430
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
431 e_rect(xo + x * g_uizoom, yo + y * g_uizoom, g_uizoom, g_uizoom, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
432 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
433 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
434 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
435
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
436
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
437 boolean moicon(int xx, int yy, int ww, int hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
438 {
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
439 if (g_pgrab)
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
440 return false;
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
441
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
442 //check mouse/icon boundary without actually drawing the icon
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
443 if (g_data[int('m')] == 0 && g_data[int('M')] == 0)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
444 {
39
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
445 if (g_mx + g_windowx >= xx && g_mx + g_windowx < xx + ww &&
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
446 g_my + g_windowy >= yy && g_my + g_windowy < yy + hh)
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
447 return true;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
448 }
39
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
449 else
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
450 {
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
451 if (g_mx >= xx && g_mx <= xx + ww &&
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
452 g_my >= yy && g_my <= yy + hh)
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
453 return true;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
454 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
455 return false;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
456 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
457
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
458
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
459 boolean doicon_drag(int xx, int yy, int ww, int hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
460 {
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
461 if (g_pgrab)
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
462 return false;
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
463
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
464 if (g_iconx >= xx && g_iconx < xx + ww && g_icony >= yy && g_icony < yy + hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
465 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
466 g_iconx = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
467 g_icony = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
468 g_repanel = -2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
469 return true;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
470 }
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
471 else
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
472 if (g_piconx >= xx && g_piconx < xx + ww && g_picony >= yy && g_picony < yy + hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
473 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
474 g_piconx = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
475 g_picony = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
476 g_repanel = -2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
477 return true;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
478 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
479 return false;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
480 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
481
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
482
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
483 boolean doicon(int xx, int yy, int ww, int hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
484 {
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
485 if (g_pgrab)
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
486 return false;
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
487
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
488 if (g_iconx >= xx && g_iconx < xx + ww && g_icony >= yy && g_icony < yy + hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
489 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
490 g_iconx = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
491 g_icony = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
492 g_repanel = -2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
493 return true;
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 return false;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
496 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
497
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
498
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
499 void printat(int xc, int yc, String mstr)
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
500 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
501 //creating text into the help box
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
502 for (int index = 0; index < mstr.length(); index++)
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
503 {
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
504 if (mstr.charCodeAt(index) != '|')
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
505 {
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
506 if (g_data[256 + xc + yc * 12] != byte(mstr.charCodeAt(index)))
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
507 {
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
508 g_data[256 + xc + yc * 12] = byte(mstr.charCodeAt(index));
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
509 g_chaup[xc + yc * 16] = 1;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
510 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
511 xc++;
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
512 }
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
513 else
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
514 {
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
515 xc = 0;
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
516 yc++;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
517 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
518 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
519 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
520
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
521
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
522 void clearmsg()
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
523 {
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
524 for (int y = 0; y < 4; y++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
525 for (int x = 0; x < 12; x++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
526 {
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
527 g_data[256 + x + y * 12] = byte(32);
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
528 g_chaup[x + y * 16] = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
529 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
530 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
531
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
532
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
533 void message(String mstr)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
534 {
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
535 if (mstr.equals("*"))
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
536 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
537 g_msgctr = 100;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
538 return;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
539 }
142
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
540
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
541 console.log("MSG: " + mstr);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
542 clearmsg();
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
543 printat(0, 0, mstr);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
544 g_msgctr = 50;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
545 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
546
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
547
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
548 void help(int mode, int xc, int yc)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
549 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
550 String teks;
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
551
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
552 if (g_msgctr > 0 || g_pgrab)
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
553 return;
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
554
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
555 clearmsg();
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
556
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
557 if (mode >= 1000)
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
558 {
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
559 xc = int(xc);
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
560 yc = int(yc);
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
561
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
562 if (g_phase == 1)
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
563 switch (tool())
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
564 {
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
565 case 4:
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
566 case 6:
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
567 xc = abs(g_rx2 - g_rx) + 1;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
568 yc = abs(g_ry2 - g_ry) + 1;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
569 break;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
570
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
571 case 7:
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
572 xc = abs(g_rx2 - g_rx) * 2 + 1;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
573 yc = abs(g_ry2 - g_ry) * 2 + 1;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
574 break;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
575
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
576 case 8:
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
577 if (g_data[int('c')] == 1 || g_shift) {
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
578 xc = abs(g_rx2 - g_rx);
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
579 yc = abs(g_ry2 - g_ry);
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
580 } //purkkaa
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
581 else {
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
582 xc = abs(g_rx2 - g_rx) + 1;
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
583 yc = abs(g_ry2 - g_ry) + 1;
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
584 }
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
585 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
586 }
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
587
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
588 // coordinates
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
589 if (xc < X && yc < Y)
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
590 {
13
80727dab1359 Oops, fix the coordinate printing.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
591 printat(0, 0, "Px:"+ str(xc));
80727dab1359 Oops, fix the coordinate printing.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
592 printat(6, 0, ", "+ str(yc));
80727dab1359 Oops, fix the coordinate printing.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
593 printat(0, 1, "Ch:"+ str(int(xc / 8)));
80727dab1359 Oops, fix the coordinate printing.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
594 printat(6, 1, ", "+ str(int(yc / 8)));
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
595
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
596 if (tool() == 6 && g_phase == 1)
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
597 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
598 float av = getangel(g_rx2 - g_rx, g_ry2 - g_ry);
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
599
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
600 printat(0, 2, nf(dist(0, 0, xc - 1, yc - 1), 0, 2));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
601 printat(0, 3, nf((av), 0, 2));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
602 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
603 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
604 return;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
605 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
606
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
607 printat(7, 3, "Key:" + str(char(mode)));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
608
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
609 switch (char(mode))
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
610 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
611 case '.':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
612 teks = "Preset pens|.=reset";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
613 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
614 case TAB:
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
615 teks = "Pick color";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
616 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
617 case '<':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
618 teks = "Swap colors|Right<>Left";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
619 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
620 case '>':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
621 teks = "Pick backgnd|shift=set";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
622 if (g_backmode == 0) teks = "Pick backgnd|not here";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
623 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
624 case '1':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
625 teks = "Draw";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
626 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
627 case '2':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
628 teks = "Spray can";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
629 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
630 case '3':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
631 teks = "Continuous|Draw";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
632 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
633 case '4':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
634 teks = "Grab brush";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
635 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
636 case '5':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
637 teks = "Flood fill";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
638 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
639 case '8':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
640 teks = "Rectangle";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
641 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
642 case '7':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
643 teks = "Ellipse";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
644 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
645 case '6':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
646 teks = "Line";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
647 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
648 case '9':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
649 teks = "Brush tool";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
650 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
651 case '0':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
652 teks = "Magnifier|m=direct";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
653 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
654 case 'a':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
655 teks = "Bitmap only|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
656 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
657 case 'A':
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 43
diff changeset
658 teks = "Export as|" + g_exportext;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
659 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
660 case 'b':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
661 teks = "A.I.|Behavior|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
662 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
663 case 'B':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
664 teks = "Set border|[Export=N]";
4
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
665 if (g_data[int('Q')] == 1) teks = "Set border|[Export=Y]";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
666 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
667 case 'C':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
668 teks = "Set backgnd";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
669 if (machine == PLUS4M || machine == PLUS4) teks = "Set backgnd|V/RMB=back2";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
670 if (int(g_map[1]) == 255) teks = "Set backnd|-Not here";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
671 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
672 case 'i':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
673 teks = "Increase|luminance";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
674 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
675 case 'k':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
676 teks = "Decrease|luminance";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
677 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
678 case 'r':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
679 teks = "Fill raster|on/off|RMB=swap";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
680 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
681 case 'R':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
682 teks = "Raster from|brush|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
683 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
684 case 'd':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
685 teks = "Recolor|right->left|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
686 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
687 case 'p':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
688 teks = "Brush|recolor|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
689 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
690 case 'q':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
691 teks = "IQ mode|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
692 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
693 case 't':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
694 teks = "Tile mode|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
695 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
696 case 'x':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
697 teks = "Brush|flip X|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
698 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
699 case 'y':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
700 teks = "Brush|flip Y|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
701 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
702 case 'z':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
703 teks = "Brush|rotate";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
704 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
705 case 'h':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
706 teks = "Pen size " + (g_bsize + 1) + "|LMB/h=less|RMB/H=bigger";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
707 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
708 case 'j':
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
709 teks = "Switch to|"+ (!g_spare ? "spare" : "front") +" page|RMB=CopyTo";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
710 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
711 case 'f':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
712 teks = "Geometry|fill|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
713 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
714 case 'c':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
715 teks = "Constrain|to grid|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
716 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
717 case 'm':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
718 teks = "Magnify|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
719 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
720 case 'g':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
721 teks = "Draw grid|on/off|G=size " + str(g_gridx);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
722 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
723 case 'X':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
724 teks = "Mirror X|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
725 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
726 case 'Y':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
727 teks = "Mirror Y|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
728 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
729 case 'l':
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
730 teks = "Load a Multipaint";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
731 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
732 case 's':
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
733 teks = "Save as|[RMB=Save]|Multipaint";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
734 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
735 case 'u':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
736 teks = "Undo u LMB|Redo U RMB";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
737 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
738 case 'U':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
739 teks = "Redo";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
740 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
741 case 'e':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
742 teks = "Export PNG";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
743 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
744 case 'E':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
745 teks = "Export as|source";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
746 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
747 case 'o':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
748 teks = "Clear|screen";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
749 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
750 case 'O':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
751 teks = "Export|specific";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
752 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
753 case 'n':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
754 teks = "Playbrush|on/off|RMB=speed";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
755 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
756 case 'w':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
757 teks = "Format|Import:|no support";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
758 if (g_formatname != "") teks = "Import as|" + g_formatname;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
759 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
760 case 'W':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
761 teks = "Export:|no support";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
762 if (g_formatname != "") teks = "Export as|" + g_formatname;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
763 break;
9
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
764
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
765 default:
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
766 teks = "No Help";
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
767 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
768 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
769
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
770 printat(0, 0, teks);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
771 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
772
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
773
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
774 void icontable(int xx, int yy, int tabletype, int realdraw)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
775 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
776 String pan = "";
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
777 int x = 0, y = 0, ad;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
778
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
779 g_data[int('9')] = (g_btype == 9) ? 1 : 0;
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
780
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
781 // the main and sideboard icon panel order
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
782 if (tabletype == 0) pan = ";;h9::123456::78::pzxy::XYtn::lsEAwW::jc0g::uo::.b";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
783 if (tabletype == 1) pan = "BCrRfd";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
784 if (tabletype == 2) pan = "ik";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
785
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
786 for (int tit = 0; tit < pan.length(); tit++)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
787 {
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
788 int ad = pan.charCodeAt(tit);
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
789 if (g_repanel <= 0 && realdraw == 1)
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
790 {
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
791 if (ad != ';' && ad != ':' && ad != '.')
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
792 {
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
793 int icolor;
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
794 if (ad == 'j' && g_spare)
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
795 icolor = 1;
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
796 else
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
797 icolor = int(g_data[ad]);
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
798
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
799 drawicon(xx + x, yy + y, ad - 48, icolor);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
800 }
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
801 else
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
802 if (ad == ';')
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
803 {
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
804 //draw the preset brush box
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
805 drawchar(xx, yy, 128);
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
806 drawchar(xx + 8 * g_uizoom, yy, 129);
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
807 drawchar(xx + 16 * g_uizoom, yy, 130);
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
808 drawchar(xx + 24 * g_uizoom, yy, 131);
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
809 drawchar(xx, yy + 8 * g_uizoom, 132);
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
810 drawchar(xx + 8 * g_uizoom, yy + 8 * g_uizoom, 133);
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
811 drawchar(xx + 16 * g_uizoom, yy + 8 * g_uizoom, 134);
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
812 drawchar(xx + 24 * g_uizoom, yy + 8 * g_uizoom, 135);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
813 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
814 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
815
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
816 //tooltip
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
817 if (ad != ':' && ad != ';' && ad != '.')
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
818 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
819 if (realdraw == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
820 if (moicon(xx + x, yy + y, 16 * g_uizoom, 16 * g_uizoom)) help(ad);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
821 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
822 if (doicon(xx + x, yy + y, 16 * g_uizoom, 16 * g_uizoom))
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
823 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
824 //println(g_realbutton);
108
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
825 if (ad == 'C' && g_realbutton == RIGHT) ad = 'V';
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
826 if (ad == 'B' && g_realbutton == RIGHT) ad = 'Q';
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
827 if (ad == 'u' && g_realbutton == RIGHT) ad = 'U';
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
828 if (ad == 'n' && g_realbutton == RIGHT) ad = 'N';
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
829 if (ad == 'h' && g_realbutton == RIGHT) ad = 'H';
109
b9b60552667e Make right-clicking work on the Load icon.
Matti Hamalainen <ccr@tnsp.org>
parents: 108
diff changeset
830 if (ad == 'l' && g_realbutton == RIGHT) ad = 'L';
108
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
831 if (ad == 's' && g_realbutton == RIGHT) ad = 'S';
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
832 if (ad == 'j' && g_realbutton == RIGHT) ad = 'J';
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
833 if (ad == 'g' && g_realbutton == RIGHT) ad = 'G';
a9d8db1726c1 Use the constant for RIGHT mouse button instead of magic number.
Matti Hamalainen <ccr@tnsp.org>
parents: 99
diff changeset
834 if (ad == 'r' && g_realbutton == RIGHT) ad = g_shift ? '(' : ')';
6
07ddf9cfc6c2 Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
835 command(int(ad));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
836 g_msgctr = 50;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
837 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
838 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
839 if (ad == ';')
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
840 {
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
841 for (int ii = 0; ii <= 3; ii++)
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
842 for (int jj = 0; jj <= 1; jj++)
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
843 {
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
844 if (doicon(xx + ii * 8 * g_uizoom, yy + jj * 8 * g_uizoom,
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
845 8 * g_uizoom, 8 * g_uizoom))
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
846 command(128 + ii + jj * 4);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
847 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
848 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
849 if (tabletype == 0)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
850 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
851 x = x + 16 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
852 if (ad == '.') x = x - 8 * g_uizoom;
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
853 if (x > 16 * g_uizoom)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
854 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
855 x = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
856 y = y + 16 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
857 if (ad == ':') y = y - 14 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
858 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
859 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
860 if (tabletype == 1 || tabletype == 2)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
861 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
862 y = y + 16 * g_uizoom;
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
863 if (y > 16 * g_uizoom)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
864 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
865 y = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
866 x = x + 16 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
867 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
868 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
869 }
4
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
870 g_data[int('9')] = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
871 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
872
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
873
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
874 int nextluminance(int f, int d)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
875 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
876 int res = f + d;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
877
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
878 if (machine == PLUS4 || machine == PLUS4M) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
879 if (f + d * 15 > 120) return f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
880 if (f + d * 15 < 1) return f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
881 if (d == 1) return f + 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
882 if (d == -1) return f - 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
883 return res;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
884 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
885
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
886 if (g_map[13] == C64) { //here the "C64" is generic across C64,C64M and potential FLI modes
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
887 int out[] = {
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
888 6, 1, 11, 15, 8, 10,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
889 9, 13, 14, 2, 3, 4,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
890 5, 1, 12, 7
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
891 }; // from "Ptoing"
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
892 if (d == 1) res = out[f];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
893 if (d == -1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
894 if (f == 0) return 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
895 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
896 if (out[i] == f) res = i;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
897 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
898 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
899 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
900
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
901 if (g_map[13] == MSX) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
902 int out[] = {
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
903 1, 4, 9, 10,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
904 6, 12, 13, 14,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
905 5, 3, 7, 15,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
906 2, 8, 11, 15
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
907 }; // calculated Y
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
908 if (d == 1) res = out[f];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
909 if (d == -1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
910 if (f == 0) return 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
911 for (int i = 0; i < g_maxcolors - 1; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
912 if (out[i] == f) res = i;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
913 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
914 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
915 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
916
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
917 return res;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
918 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
919
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
920
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
921 int tool()
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
922 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
923 //returns the current tool #, for convenience
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
924 //as there is no "tool" variable really
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
925 for (int i = '0'; i <= '9'; i++)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
926 {
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
927 if (g_data[i] == 1)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
928 return i - '0';
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
929 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
930 return 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
931 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
932
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
933
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
934 void set_tool(int s)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
935 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
936 //set current tool, for convenience
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
937 for (int i = '0'; i <= '9'; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
938 g_data[i] = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
939 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
940 g_data[48 + s] = byte(1);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
941 g_map[12] = byte(s);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
942 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
943
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
944
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
945 void selectcolor(int hand, int x)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
946 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
947 if (x >= g_maxcolors) x = x - g_maxcolors;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
948 if (x < 0) x = x + g_maxcolors;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
949 if (hand == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
950 g_farge = x;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
951 g_ofarge = x; //kludgey, the colour and the "original colour"
4
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
952 if (g_btype == 9) g_data[int('p')] = 1;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
953 g_realfront = byte(g_farge);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
954 g_realback = byte(g_backg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
955 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
956 if (hand == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
957 g_backg = x;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
958 g_realback = byte(g_backg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
959 g_realfront = byte(g_farge);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
960 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
961 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
962
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
963
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
964 void refresh()
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
965 {
80
384b301970ac Set g_dirty flag in refresh() to ensure screen update after certain
Matti Hamalainen <ccr@tnsp.org>
parents: 79
diff changeset
966 g_dirty = true;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
967
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
968 //refreshes all "dirty chars" and icon panels
142
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
969 for (int i = 0; i < MX * MY; i++)
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
970 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
971 g_redo[i] = byte(0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
972 g_remdo[i] = byte(1);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
973 }
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
974
142
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
975 if (g_boxreconstruct == 0)
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
976 g_boxreconstruct = 1;
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
977
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
978 //elsewhere use g_boxreconstruct=2 for complete window reconstruction
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
979 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
980
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
981
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
982 void refresh_all()
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
983 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
984 refresh();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
985 g_boxreconstruct = 2;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
986 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
987
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
988
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
989 void palettebox(float x0, int y0, float x1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
990 if (g_palsteps == 0) return;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
991 float expand = ((x1 - x0) / g_palsteps);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
992 int divs = int(255 / (g_palsteps - 1));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
993 for (int i = 0; i < g_palsteps; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
994 if (doicon_drag(int(x0 + expand * i), y0, int(expand), 7 * g_uizoom)) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
995 g_r[g_farge] = int(i * divs);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
996 message("RED:" + i);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
997 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
998 refresh();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
999 g_boxreconstruct = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1000 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1001 if (doicon_drag(int(x0 + expand * i), y0 + 10 * g_uizoom, int(expand), 7 * g_uizoom)) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1002 g_g[g_farge] = int(i * divs);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1003 message("GREEN:" + i);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1004 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1005 refresh();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1006 g_boxreconstruct = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1007 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1008 if (doicon_drag(int(x0 + expand * i), y0 + 20 * g_uizoom, int(expand), 7 * g_uizoom)) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1009 g_b[g_farge] = int(i * divs);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1010 message("BLUE:" + i);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1011 makecolor(g_farge, g_r[g_farge], g_g[g_farge], g_b[g_farge]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1012 refresh();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1013 g_boxreconstruct = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1014 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1015 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1016 e_rect(int(x0), y0, int(x1 - x0), 7 * g_uizoom, g_rgb[258]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1017 e_rect(int(x0), y0 + 10 * g_uizoom, int(x1 - x0), 7 * g_uizoom, g_rgb[258]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1018 e_rect(int(x0), y0 + 20 * g_uizoom, int(x1 - x0), 7 * g_uizoom, g_rgb[258]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1019
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1020 for (int i = 1; i < g_palsteps; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1021 e_rect(int(x0 + expand * i), y0, g_uizoom, 2 * g_uizoom, g_rgb[257]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1022 e_rect(int(x0 + expand * i), y0 + 10 * g_uizoom, g_uizoom, 2 * g_uizoom, g_rgb[257]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1023 e_rect(int(x0 + expand * i), y0 + 20 * g_uizoom, g_uizoom, 2 * g_uizoom, g_rgb[257]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1024 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1025 e_rect(int(x0 + expand * g_r[g_farge] / divs), y0, int(expand), 7 * g_uizoom, g_rgb[260]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1026 e_rect(int(x0 + expand * g_g[g_farge] / divs), y0 + 10 * g_uizoom, int(expand), 7 * g_uizoom, g_rgb[261]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1027 e_rect(int(x0 + expand * g_b[g_farge] / divs), y0 + 20 * g_uizoom, int(expand), 7 * g_uizoom, g_rgb[262]);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1028 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1029
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1030
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1031 void colorselector(int xo, int yo)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1032 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1033 int x, y, ad, yfat;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1034 int far, xonko, yhei, maxp, xloc, yloc;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1035 int bfat;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1036 float expand, divus;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1037
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1038 xonko = 16 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1039 yhei = 16 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1040 expand = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1041 yfat = 4 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1042 bfat = 1 * g_uizoom;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1043
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1044 if (g_maxcolors > 60) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1045 yhei = 4 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1046 yfat = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1047 bfat = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1048 }
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1049
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1050 divus = 255 / g_palsteps;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1051 x = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1052 y = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1053 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1054
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1055 maxp = g_maxcolors;
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1056 xonko = int(int(512 / g_maxcolors) / 2) * g_uizoom;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1057
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1058 if (g_maxcolors > 32) {
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1059 maxp = int(g_maxcolors / 2);
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1060 xonko = int(1024 / g_maxcolors);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1061 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1062
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1063 if (machine == PLUS4 || machine == PLUS4M)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1064 xonko = 15 * g_uizoom;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1065
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1066 for (x = 0; x < g_maxcolors; x++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1067 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1068 xloc = xo + x * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1069 yloc = yo + 8 * g_uizoom;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1070 if (g_maxcolors > 60)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1071 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1072 yloc = yo + yhei * 7;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1073
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1074 if (x > 15 && x <= 30) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1075 xloc = xo + (x - 15) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1076 yloc = yo + yhei * 6 + yfat * 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1077 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1078 if (x > 30 && x <= 45) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1079 xloc = xo + (x - 30) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1080 yloc = yo + yhei * 5 + yfat * 4;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1081 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1082 if (x > 45 && x <= 60) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1083 xloc = xo + (x - 45) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1084 yloc = yo + yhei * 4 + yfat * 6;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1085 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1086 if (x > 60 && x <= 75) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1087 xloc = xo + (x - 60) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1088 yloc = yo + yhei * 3 + yfat * 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1089 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1090 if (x > 75 && x <= 90) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1091 xloc = xo + (x - 75) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1092 yloc = yo + yhei * 2 + yfat * 10;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1093 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1094 if (x > 90 && x <= 105) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1095 xloc = xo + (x - 90) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1096 yloc = yo + yhei * 1 + yfat * 12;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1097 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1098 if (x > 105 && x <= 120) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1099 xloc = xo + (x - 105) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1100 yloc = yo + yhei * 0 + yfat * 14;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1101 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1102 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1103 if (doicon_drag(xloc, yloc, xonko, yhei)) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1104 if (mouseButton == LEFT || mouseButton == CENTER) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1105 selectcolor(0, x);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1106 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1107 if (mouseButton == RIGHT) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1108 selectcolor(1, x);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1109 g_button = LEFT;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1110 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1111 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1112
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1113 if (g_repanel <= 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1114 int index;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1115 index = x;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1116 if (machine == MSX && x == 0) index = g_map[1];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1117 e_rect(xloc, yloc, xonko, yhei, g_rgb[index]); // the colour blocks
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1118 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1119 if (g_farge == x) far = 0xff808080;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1120 e_rect(xloc, yloc - yfat, xonko, yfat, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1121 if (doicon(xloc, yloc - yfat, xonko, yfat)) selectcolor(0, x);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1122
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1123 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1124 if (g_backg == x && yfat > 0) far = 0xff808080;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1125
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1126 e_rect(xloc, yloc + yhei, xonko, yfat, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1127 if (doicon(xloc, yloc + yhei, xonko, yfat)) selectcolor(1, x);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1128 if (yfat == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1129 if (g_farge == x) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1130 e_rect(xloc, yloc, xonko / 4, yhei / 4, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1131 e_rect(xloc, yloc + 1, xonko / 8, yhei / 4, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1132 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1133 if (g_backg == x) {
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1134 e_rect(xloc + xonko - xonko / 4, yloc + yhei - 2, int(xonko / 4), int(yhei / 4), far);
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1135 e_rect(xloc + xonko - xonko / 8, yloc + yhei - 3, int(xonko / 8), int(yhei / 4), far);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1136 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1137 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1138 if (int(g_map[0]) == x) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1139 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1140 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1141 e_rect(xloc, yloc, xonko, bfat, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1142 e_rect(xloc, yloc + yhei - bfat, xonko, bfat, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1143 e_rect(xloc, yloc, bfat, yhei, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1144 e_rect(xloc + xonko - bfat, yloc, bfat, yhei, far);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1145 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1146 if (int(g_map[1]) == x) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1147 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1148 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff;
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1149 e_rect(xloc + int(xonko / 4), yloc + int(yhei / 4), int(xonko / 4), int(yhei / 4), far);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1150 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1151 if (machine == PLUS4 || machine == PLUS4M) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1152 if (int(g_map[1]) != 255 && int(g_map[2]) == x) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1153 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1154 if (dist(g_r[x], g_g[x], g_b[x], 0, 0, 0) < 1) far = 0xffffffff;
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1155 e_rect(xloc + xonko - int(xonko / 4) * 2, yloc + yhei - int(yhei / 4) * 2, int(xonko / 4), int(yhei / 4), far);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1156 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1157 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1158 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1159 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1160 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1161
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1162
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1163 void messagebox(int ox, int oy)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1164 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1165 // lcd character display chardisplay textbox
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1166 // coordinates. has its own "dirtychar"
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1167 int cz = 8 * g_uizoom;
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1168 for (int xx = 0; xx < 12; xx++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1169 for (int yy = 0; yy < 4; yy++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1170 {
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1171 if (g_chaup[xx + yy * 16] == 1) {
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1172 g_chaup[xx + yy * 16] = 0;
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1173 drawchar(ox + xx * cz, oy + yy * cz, g_data[256 + xx + yy * 12]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1174 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1175 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1176 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1177
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1178
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1179 void colorindicator(int ox, int oy)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1180 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1181 int bs = 8 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1182 int h = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1183 if (g_button == RIGHT) h = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1184 e_rect(ox, oy, bs * 2, bs * 4, g_rgb[int(g_realback)]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1185 e_rect(ox + bs / 2, oy + 4 * g_uizoom, 12 * g_uizoom, bs * 2, g_rgb[int(g_realfront)]);
6
07ddf9cfc6c2 Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
1186 if (doicon(ox, oy, bs * 2, bs * 3)) command(int('<'));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1187 if (machine == C64M || machine == MSX || machine == AMIGA) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1188 e_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[int(g_map[1])]);
151
8a9a9fcc02f7 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
1189 d_rect(ox, oy + bs * 3, bs * 2, bs, g_rgb[257]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1190 if (doicon(ox, oy + bs * 3, bs * 2, bs)) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1191 if (g_shift == false) selectcolor(h, int(g_map[1]));
6
07ddf9cfc6c2 Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
1192 if (g_shift) command(int('C'));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1193 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1194 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1195 if (machine == PLUS4M) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1196 e_rect(ox, oy + bs * 3, bs, bs, g_rgb[int(g_map[1])]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1197 e_rect(ox + 8 * g_uizoom, oy + bs * 3, bs, bs, g_rgb[int(g_map[2])]);
151
8a9a9fcc02f7 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
1198 d_rect(ox, oy + bs * 3, bs, bs, g_rgb[257]);
8a9a9fcc02f7 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
1199 d_rect(ox + 8 * g_uizoom, oy + bs * 3, bs, bs, g_rgb[257]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1200 if (doicon(ox, oy + bs * 3, bs, bs)) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1201 if (g_shift == false) selectcolor(h, int(g_map[1]));
6
07ddf9cfc6c2 Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
1202 if (g_shift) command(int('C'));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1203 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1204 if (doicon(ox + 8 * g_uizoom, oy + bs * 3, bs, bs)) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1205 if (g_shift == false) selectcolor(h, int(g_map[2]));
6
07ddf9cfc6c2 Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 4
diff changeset
1206 if (g_shift) command(int('V'));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1207 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1208 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1209 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1210
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1211
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1212 void update_ui(boolean forced)
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1213 {
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1214 if (g_iconmode == 1)
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1215 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1216 for (int i = 0; i <= 80000; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1217 g_icons[i] = g_map[i];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1218 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1219 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1220
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1221 if (g_repanel <= 0)
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1222 g_repanel++;
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1223
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1224 messagebox(width - 12 * 8 * g_uizoom, height - 4 * 8 * g_uizoom);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1225
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1226 // when tooltipping, the panels are not really
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1227 // drawn but used for easy coordinate reference
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1228
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1229 if (g_repanel > 0 && !forced)
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1230 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1231 icontable(width - 32 * g_uizoom, 0, 0, 0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1232 icontable(272 * g_uizoom, height - 32 * g_uizoom, 1, 0);
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1233 //icontable(0,0,3,0);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1234 if (machine == PLUS4M || machine == PLUS4) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1235 icontable(240 * g_uizoom, height - 32 * g_uizoom, 2, 0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1236 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1237 return;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1238 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1239
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1240 icontable(width - 32 * g_uizoom - 1, 0, 0, 1);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1241 icontable(272 * g_uizoom, height - 32 * g_uizoom, 1, 1);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1242 palettebox(g_uizoom * 324 + 4, height - 32 * g_uizoom, width - (96 * g_uizoom) - 4);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1243 if (machine == PLUS4M || machine == PLUS4) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1244 icontable(240 * g_uizoom, height - 32 * g_uizoom, 2, 1);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1245 }
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
1246
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1247 colorselector(0, height - 32 * g_uizoom);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1248 colorindicator(256 * g_uizoom, height - 32 * g_uizoom);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1249 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1250
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1251
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1252 void magport() {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1253 int b = g_uizoom * 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1254 int xo = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1255 int yo = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1256 for (int y = 0; y < Y; y++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1257 for (int x = 0; x < X; x++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1258 int raddr = (xo * 24 + x) + (yo * 24 + y) * width;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1259 pixels[raddr] = int(g_rgb[easygetcolor(x, y)]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1260 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1261 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1262 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1263
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1264
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1265 void viewport() {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1266 // formerly void redo()
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1267 // main machine screen redraw
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1268 // and dirty char update
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1269 int xx, yy, xo, yo, xwin, ywin, x, y, winsux, winsuy, rubx;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1270 int ad, cad, a, b, c, mmode, fari, psize;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1271 int zonx, zony, maxx, mayy, mag, raddr;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1272 int left = 32 * g_uizoom;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1273 raddr = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1274 winsux = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1275 winsuy = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1276 if (g_backmode == 0) g_map[1] = 0; //some computers have overall background
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1277
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1278 mmode = magmode();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1279 fari = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1280 makecolor(259, g_r[g_map[0]], g_g[g_map[0]], g_b[g_map[0]]); //use border color
4
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
1281 if (g_data[int('M')] == 1 && g_data[int('m')] == 1) g_data[int('m')] = 0;
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
1282 if (g_data[int('m')] == 1) makecolor(259, 48, 48, 48); //don't use border color in mag modes
a1261cd4c676 Int-ize byte array index references when using character, e.g. arr['A'] -> arr[int('A')]
Matti Hamalainen <ccr@tnsp.org>
parents: 3
diff changeset
1283 if (g_data[int('M')] == 1) makecolor(259, 48, 48, 48);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1284
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1285 psize = g_magpix[mmode];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1286 mag = psize * 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1287 maxx = magx();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1288 mayy = magy();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1289
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1290 if (g_boxreconstruct == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1291 g_boxreconstruct = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1292 e_rect(0, (mayy * psize) * 8, maxx * psize * 8, height - ((g_vedge + g_uizoom * 2) + (mayy * psize * 8)), g_rgb[259]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1293 e_rect((maxx * psize) * 8, 0, width - (maxx * psize * 8 + (g_hedge + g_uizoom * 2)), height - (g_vedge + g_uizoom), g_rgb[259]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1294 }
142
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1295
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1296 if (g_boxreconstruct == 2)
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1297 {
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1298 //in case of full window update
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1299 g_boxreconstruct = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1300 e_rect(0, 0, width - (g_hedge + g_uizoom * 2), height - (g_vedge + g_uizoom * 2), g_rgb[259]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1301 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1302
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1303 if (g_pgrab)
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1304 {
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1305 // avoid preview window embarassment
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1306 e_rect(width - (g_hedge + g_uizoom * 2), 0, g_hedge + g_uizoom * 2 - 1, height - 1, g_rgb[263]);
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1307 e_rect(0, height - (g_vedge + g_uizoom * 2), width - 1, g_vedge + g_uizoom * 2 - 1, g_rgb[263]);
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1308 }
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1309
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1310 maxx--;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1311 mayy--;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1312 zonx = MX - magx();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1313 zony = MY - magy();
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1314
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1315 if (g_ofx > zonx) g_ofx = zonx;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1316 if (g_ofy > zony) g_ofy = zony;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1317 if (g_ofx < 0) g_ofx = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1318 if (g_ofy < 0) g_ofy = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1319
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1320 if (mmode == 10) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1321 g_ofx = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1322 g_ofy = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1323 maxx = MX - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1324 mayy = MY - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1325 winsux = g_windowx;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1326 winsuy = g_windowy;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1327 mag = 16;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1328 } //mini
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1329 if (mmode == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1330 g_ofx = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1331 g_ofy = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1332 maxx = MX - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1333 mayy = MY - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1334 winsux = g_windowx;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1335 winsuy = g_windowy;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1336 mag = 24;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1337 } //normal
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1338 if (mmode == 20) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1339 g_ofx = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1340 g_ofy = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1341 maxx = MX - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1342 mayy = MY - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1343 winsux = g_windowx;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1344 winsuy = g_windowy;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1345 mag = 32;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1346 } //maxi
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1347
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1348 b = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1349 c = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1350 a = 5;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1351
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1352 if (mmode == 1 || mmode == 2 || mmode == 11 || mmode == 12 || mmode == 21 || mmode == 22) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1353 winsux = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1354 winsuy = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1355 fill(32, 32, 32);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1356 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1357
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
1358 for (ywin = 0; ywin <= mayy; ywin++)
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1359 for (xwin = 0; xwin <= maxx; xwin++) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1360
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1361 // source coords: is 0,0 if not magged
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1362 xx = g_ofx + xwin;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1363 yy = g_ofy + ywin;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1364 // divided into character area blocks
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1365 // which are only updated if necessary
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1366 xo = xwin;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1367 yo = ywin;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1368
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1369 if (int(g_redo[xx + yy * MX]) == 0) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1370
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1371 for (y = 0; y <= 7; y++) { //pixel rows inside "char"
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1372
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1373 switch (g_multic) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1374 case 0:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1375 cad = 65536 + xx + ((yy * X) + y * MX);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1376 a = int(g_map[cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1377 b = int(g_map[(MX * MY) * 8 + cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1378 c = int(g_map[(MX * MY) * 8 + cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1379 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1380 case 1:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1381 cad = 65536 + xx + (yy * MX);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1382 a = int(g_map[cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1383 b = int(g_map[cad + 1000]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1384 c = int(g_map[cad + 2000]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1385 if (machine == PLUS4M) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1386 c = int(g_map[2]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1387 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1388 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1389 case 2:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1390 cad = 65536 + xx + ((yy * X) + y * MX);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1391 a = int(g_map[cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1392 b = int(g_map[(MX * MY) * 8 + cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1393 c = int(g_map[(MX * MY) * 8 + cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1394 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1395 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1396
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1397 ad = 1024 + xx * 8 + yy * (X * 8) + y * X;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1398
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1399 int po, vop;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1400
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1401 for (x = 0; x <= 7; x++) { //pixel columns inside pixel row
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1402 vop = int(x / 2);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1403 if (g_multic == 0) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1404 if (int(g_map[ad + x]) == 1) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1405 fari = a;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1406 if (fari == 0) fari = g_map[1];
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1407 } else {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1408 fari = b;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1409 if (fari == 0) fari = g_map[1];
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1410 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1411 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1412 if (g_multic == 1) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1413 po = int(g_map[ad + vop * 2]) + int(g_map[ad + vop * 2 + 1] * 2);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1414 if (po == 0) fari = g_map[1]; //00 comes from $d021 in real c64 and background 1 in plus/4
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1415 if (po == 1) fari = a; //10
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1416 if (po == 2) fari = b; //01
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1417 if (po == 3) fari = c; //g_map[2];//11 // comes from $d800 in real c64 and background 2 in plus/4
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1418 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1419 if (g_multic == 2) { // "amiga" mode
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1420 fari = int(g_map[ad + x]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1421 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1422
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1423 if (g_rubbermode == 1) { // rubberband mode
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1424 rubx = x;
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1425 if (g_pixelw == 2) {
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1426 rubx = chop2(x);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1427 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1428 if (fylli() == 1) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1429 if (xx * 8 + rubx == g_rx || xx * 8 + rubx == g_rx2) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1430 if (yy * 8 + y >= g_ry && yy * 8 + y <= g_ry2) fari = 256;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1431 if (yy * 8 + y >= g_ry && yy * 8 + y <= g_ry2) fari = 256;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1432 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1433 if (yy * 8 + y == g_ry || yy * 8 + y == g_ry2) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1434 if (xx * 8 + x >= g_rx && xx * 8 + x <= g_rx2) fari = 256;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1435 if (xx * 8 + x >= g_rx && xx * 8 + x <= g_rx2) fari = 256;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1436 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1437 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1438 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1439
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1440 color ari = g_rgb[fari];
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1441 switch (mmode) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1442 case 0:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1443 raddr = (xo * 24 + x * 3) + (yo * 24 + y * 3) * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1444 raddr = raddr + g_windowx + g_windowy * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1445 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1446 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1447 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1448 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1449 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1450 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1451 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1452 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1453 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1454 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1455 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1456 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1457 case 1:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1458 raddr = (xo * 64 + x * 8) + (yo * 64 + y * 8) * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1459 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1460 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1461 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1462 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1463 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1464 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1465 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1466 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1467 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1468 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1469 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1470 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1471 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1472 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1473 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1474 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1475 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1476 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1477 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1478 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1479 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1480 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1481 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1482 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1483 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1484 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1485 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1486 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1487 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1488 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1489 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1490 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1491 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1492 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1493 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1494 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1495 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1496 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1497 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1498 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1499 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1500 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1501 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1502 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1503 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1504 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1505 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1506 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1507 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1508 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1509 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1510 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1511 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1512 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1513 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1514 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1515 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1516 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1517 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1518 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1519 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1520 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1521 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1522 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1523 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1524 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1525 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1526 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1527 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1528 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1529 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1530 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1531 case 2:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1532 e_rect(xo * (64 * g_uizoom) + x * (8 * g_uizoom), yo * (64 * g_uizoom) + y * (8 * g_uizoom), 8 * g_uizoom, 8 * g_uizoom, g_rgb[fari]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1533 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1534 // mini modes
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1535 case 10:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1536 raddr = (xo * 16 + x * 2) + (yo * 8 + y) * width * 2;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1537 raddr = raddr + g_windowx + g_windowy * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1538 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1539 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1540 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1541 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1542 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1543 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1544 case 11:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1545 raddr = (xo * 48 + x * 6) + (yo * 48 + y * 6) * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1546 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1547 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1548 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1549 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1550 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1551 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1552 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1553 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1554 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1555 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1556 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1557 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1558 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1559 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1560 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1561 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1562 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1563 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1564 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1565 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1566 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1567 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1568 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1569 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1570 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1571 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1572 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1573 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1574 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1575 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1576 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1577 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1578 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1579 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1580 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1581 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1582 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1583 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1584 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1585 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1586 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1587 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1588 case 12:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1589 e_rect(xo * (64 * g_wzoom) + x * (8 * g_wzoom), yo * (64 * g_wzoom) + y * (8 * g_wzoom), 8 * g_wzoom, 8 * g_wzoom, g_rgb[fari]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1590 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1591 // maxi modes
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1592 case 20:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1593 raddr = (xo * (8 * 4) + x * 4) + (yo * (8 * 4) + y * 4) * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1594 raddr = raddr + g_windowx + g_windowy * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1595 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1596 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1597 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1598 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1599 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1600 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1601 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1602 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1603 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1604 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1605 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1606 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1607 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1608 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1609 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1610 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1611 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1612 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1613 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1614 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1615 case 21:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1616 e_rect(xo * (32 * g_wzoom) + x * (4 * g_wzoom), yo * (32 * g_wzoom) + y * (4 * g_wzoom), 4 * g_wzoom, 4 * g_wzoom, g_rgb[fari]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1617 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1618 case 22:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1619 e_rect(xo * (64 * g_wzoom) + x * (8 * g_wzoom), yo * (64 * g_wzoom) + y * (8 * g_wzoom), 8 * g_wzoom, 8 * g_wzoom, g_rgb[fari]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1620 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1621 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1622 } //one pixel inside pixel row
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1623 } //one pixel row inside char
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1624
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1625 //draw grid
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1626 //can in principle be non-square
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1627 if (int(g_data[int('g')]) == 1) {
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1628 int lapx = int((xx * 8) / g_gridx) * g_gridx;
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1629 if (lapx == (xx * 8)) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1630 t_rect(xo * mag + winsux, yo * mag + winsuy, 1, mag, g_rgb[257]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1631 if (g_gridx == 4) {
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1632 t_rect(xo * mag + winsux + 4 * psize, yo * mag + winsuy + 1, 1, int(mag / 2) - 2, g_rgb[257]);
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1633 t_rect(xo * mag + winsux + 4 * psize, yo * mag + winsuy + mag - int(mag / 2) + 2, 1, int(mag / 2) - 2, g_rgb[257]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1634 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1635 }
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1636 lapx = int((yy * 8) / g_gridy) * g_gridy;
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1637
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1638 if (lapx == (yy * 8)) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1639 t_rect(xo * mag + winsux + 1, yo * mag + winsuy, mag - 1, 1, g_rgb[257]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1640 if (g_gridy == 4) {
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1641 t_rect(xo * mag + winsux + 1, yo * mag + winsuy + 4 * psize, int(mag / 2) - 2, 1, g_rgb[257]);
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1642 t_rect(xo * mag + winsux + 2 + mag - int(mag / 2), yo * mag + winsuy + 4 * psize, int(mag / 2) - 2, 1, g_rgb[257]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1643 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1644 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1645 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1646 g_redo[xx + yy * MX] = byte(1);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1647 } //dirty char?
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1648 } //x char
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1649 }