annotate interface.pde @ 218:2e077cfc4f38

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 04 Sep 2018 19:24:59 +0300
parents b7c7b13b46c2
children 1c9deae71fb1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1 // This collects UI stuff, viewport
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
2 // i.e. Icons, color selectors and the like
0
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 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
161 // return the mode "number" based on g_uiscale and 'm' and 'M'
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
162 // currently valid outputs are 0,10,20,1,11,21,2,12,22
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
163 // flat variants: 100,110,120,101,111,121,102,112,122
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
164 int base = 0;
172
e77a726a587e Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents: 171
diff changeset
165 if (g_aspect == AR_FLAT) base = 100;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
166 if (g_uiscale == 1) base += 10;
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
167 if (g_uiscale == 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
168 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
169 if (g_data[int('m')] == 1) base += 1;
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
170 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
171 return base;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
172 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
173
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
174
144
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
175 int magx()
f91dda5dc8da Integer fixes.
Matti Hamalainen <ccr@tnsp.org>
parents: 142
diff changeset
176 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
177 //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
178 int mag = g_magpix[magmode()] * 8;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
179 return int((width - (33 * g_uiscale)) / mag);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
180 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
181
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
182
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
183 int magy()
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
184 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
185 //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
186 int mag = g_magpiy[magmode()] * 8;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
187 return int((height - (33 * g_uiscale)) / mag); //how many chars in a magmode
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
188 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
189
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
190
131
9d17f991f102 Move undo and spare page management into buffers.pde as in Multipaint 2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
191 void sussborder()
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
192 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
193 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
194 g_boxreconstruct = 2;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
195 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
196
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
197
131
9d17f991f102 Move undo and spare page management into buffers.pde as in Multipaint 2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
198 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
199 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
200 //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
201 //the rest is not stored
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
202 if (c < 256) {
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] = byte(rr);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
204 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
205 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
206 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
207 g_r[c] = rr;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
208 g_g[c] = gg;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
209 g_b[c] = bb;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
210
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
211 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
212 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
213
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
214
131
9d17f991f102 Move undo and spare page management into buffers.pde as in Multipaint 2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 109
diff changeset
215 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
216 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
217 //for the animated rubberband thingy
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
218 g_rband++;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
219 if (g_rband > g_rbang) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
220 g_rband = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
221 g_rbang++;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
222 if (g_rbang > 12) g_rbang = 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
223 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
224 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
225 return 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
226 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
227
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
228
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
229 void e_rect(int x1, int y1, int w, int h, int rgb)
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
230 {
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
231 if (y1 < 0 || x1 < 0 || y1 + h >= height || x1 + w >= width)
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
232 return;
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
233
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
234 int ad = x1 + y1 * width;
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
235 for (int yy = 0; yy < h; yy++)
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
236 {
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
237 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
238 pixels[ad + xx] = rgb;
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
239
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
240 ad += width;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
241 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
242 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
243
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
244
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
245 void d_rect(int x1, int y1, int w, int h, int rgb)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
246 {
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
247 // if (y1 < 0 || x1 < 0 || y1 + h >= height || x1 + w >= width)
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
248 if (y1 + h >= height || x1 + w >= width)
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
249 return;
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
250
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
251 int ad = x1 + y1 * width;
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
252 for (int yy = 0; yy < h; yy++)
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
253 {
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
254 for (int xx = 0; xx < w; xx++)
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
255 {
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
256 if (xx == 0 || yy == 0 || xx == w - 1 || yy == h - 1)
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
257 pixels[ad + xx] = rgb;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
258 }
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
259 ad += width;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
260 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
261 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
262
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
263
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
264 void t_rect(int x1, int y1, int w, int h, int rgb)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
265 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
266 // transparent rectangle
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
267 // fixed tp, for grid drawing
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
268 //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
269 int ad = x1 + y1 * width;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
270
172
e77a726a587e Rename FLATRATIO/SQUARERATIO and gridmode OLD/NEW constants to something more sane.
Matti Hamalainen <ccr@tnsp.org>
parents: 171
diff changeset
271 if (g_gridmode == GRIDMODE_NEW)
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
272 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
273 for (int yy = 0; yy < h; yy++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
274 {
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
275 for (int xx = 0; xx < w; xx++)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
276 {
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
277 int s = pixels[ad + xx],
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
278 fout = 0;
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
279
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
280 for (int qn = 0; qn < 16; qn++)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
281 {
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
282 if (g_rgb[qn] == s)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
283 {
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
284 fout = g_grids[qn];
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
285 break;
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
286 }
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
287 }
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 }
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
291 ad += width;
2
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 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
296 for (int yy = 0; yy < h; yy++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
297 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
298 for (int xx = 0; xx < w; xx++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
299 {
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
300 int s = pixels[ad + xx],
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
301 r = (s >> 16) & 0xff,
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
302 g = (s >> 8) & 0xff,
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
303 b = (s) & 0xff;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
304
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
305 g += 64;
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
306
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
307 r = int((r * 2) / 3);
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
308 g = int((g * 2) / 3);
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
309 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
310
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
311 pixels[ad + xx] = 0xff000000 + r * 0x10000 + g * 0x100 + b;
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
312 }
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
313 ad += width;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
314 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
315 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
316 }
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 // 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
320 void storeparameters()
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
321 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
322 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
323 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
324 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
325 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
326
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
327
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
328 void restoreparameters()
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
329 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
330 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
331 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
332 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
333 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
334
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
335
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
336 void drawtext(int xo, int yo, String ss)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
337 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
338 //draw a bunch of text maybe not needed
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
339 for (int i = 0; i < ss.length(); i++)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
340 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
341 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
342 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
343 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
344
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
345
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
346 void drawicon(int xo, int yo, int t, int mm)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
347 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
348 //draw one icon
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
349 int cad, xx, yy, pop, far;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
350 int metal;
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
351
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
352 yy = int(t / 16);
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
353 xx = t - (yy * 16);
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
354
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
355 xx *= 2;
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
356 yy *= 2;
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
357
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
358 int ad = 1024 + xx * 8 + yy * 2048;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
359
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
360 for (int y = 0; y < 16; y++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
361 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
362 for (int x = 0; x < 16; x++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
363 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
364 metal = 0xffa0a0a0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
365 far = 0xff000000;
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
366
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
367 if (t == 18 || (t == 19 && g_backmode == 1))
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
368 {
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 }
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
371
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
372 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
373
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
374 if (x == 0 || y == 0)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
375 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
376 metal = 0xffe0e0e0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
377 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
378 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
379 }
7
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 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
382 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
383
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
384 if (int(g_icons[ad + x]) == pop)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
385 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
386 far = metal;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
387 if (mm == 1) far = 0xffffff80;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
388 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
389
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
390 if (t == 66) { //raster icon
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
391 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
392 far = metal;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
393 if (mm == 1) far = 0xffffff80;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
394 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
395 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
396 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
397
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
398 e_rect(xo + x * g_uiscale, yo + y * g_uiscale, g_uiscale, g_uiscale, far);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
399 }
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
400 ad += 256;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
401 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
402 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
403
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
404
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
405 void drawchar(int xo, int yo, int t)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
406 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
407 //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
408 if (t < 32) return;
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
409
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
410 t -= 32;
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
411 int yy = int(t / 32);
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
412 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
413 yy = yy + 18;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
414
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
415 for (int y = 0; y < 8; y++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
416 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
417 int ad = 1024 + xx * 8 + yy * 2048 + y * 256;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
418
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
419 for (int x = 0; x < 8; x++)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
420 {
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
421 int far;
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
422 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
423 far = 0xffb0b0b0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
424 if (g_bsize < 4) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
425 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
426 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
427 } else {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
428 far = 0xff000000;
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
429 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
430 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
431 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
432
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
433 e_rect(xo + x * g_uiscale, yo + y * g_uiscale, g_uiscale, g_uiscale, far);
2
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 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
436 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
437
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
438
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
439 boolean moicon(int xx, int yy, int ww, int hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
440 {
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
441 if (g_pgrab)
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
442 return false;
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
443
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
444 //check mouse/icon boundary without actually drawing the icon
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
445 if (g_data[int('m')] == 0 && g_data[int('M')] == 0)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
446 {
39
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
447 if (g_mx + g_windowx >= xx && g_mx + g_windowx < xx + ww &&
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
448 g_my + g_windowy >= yy && g_my + g_windowy < yy + hh)
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
449 return true;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
450 }
39
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
451 else
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
452 {
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
453 if (g_mx >= xx && g_mx <= xx + ww &&
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
454 g_my >= yy && g_my <= yy + hh)
5e0306ac3575 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 19
diff changeset
455 return true;
2
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 return false;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
458 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
459
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
460
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
461 boolean doicon_drag(int xx, int yy, int ww, int hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
462 {
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
463 if (g_pgrab)
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
464 return false;
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
465
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
466 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
467 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
468 g_iconx = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
469 g_icony = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
470 g_repanel = -2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
471 return true;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
472 }
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
473 else
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
474 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
475 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
476 g_piconx = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
477 g_picony = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
478 g_repanel = -2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
479 return true;
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 return false;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
482 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
483
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
484
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
485 boolean doicon(int xx, int yy, int ww, int hh)
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
486 {
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
487 if (g_pgrab)
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
488 return false;
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
489
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
490 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
491 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
492 g_iconx = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
493 g_icony = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
494 g_repanel = -2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
495 return true;
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 return false;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
498 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
499
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
500
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
501 void printat(int xc, int yc, String mstr)
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
502 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
503 //creating text into the help box
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
504 for (int index = 0; index < mstr.length(); index++)
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
505 {
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
506 if (mstr.charCodeAt(index) != '|')
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
507 {
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
508 if (g_data[256 + xc + yc * 12] != byte(mstr.charCodeAt(index)))
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
509 {
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
510 g_data[256 + xc + yc * 12] = byte(mstr.charCodeAt(index));
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
511 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
512 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
513 xc++;
137
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
514 }
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
515 else
d6f60370b3e7 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 135
diff changeset
516 {
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
517 xc = 0;
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
518 yc++;
2
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 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
521 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
522
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
523
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
524 void clearmsg()
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
525 {
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
526 for (int y = 0; y < 4; y++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
527 for (int x = 0; x < 12; x++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
528 {
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
529 g_data[256 + x + y * 12] = byte(32);
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
530 g_chaup[x + y * 16] = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
531 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
532 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
533
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
534
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
535 void message(String mstr)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
536 {
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
537 if (mstr.equals("*"))
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
538 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
539 g_msgctr = 100;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
540 return;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
541 }
142
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
542
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
543 console.log("MSG: " + mstr);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
544 clearmsg();
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
545 printat(0, 0, mstr);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
546 g_msgctr = 50;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
547 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
548
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
549
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
550 void help(int mode, int xc, int yc)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
551 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
552 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
553
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
554 if (g_msgctr > 0 || g_pgrab)
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
555 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
556
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
557 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
558
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
559 if (mode >= 1000)
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
560 {
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
561 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
562 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
563
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
564 if (g_phase == 1)
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
565 switch (tool())
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
566 {
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
567 case 4:
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
568 case 6:
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
569 xc = abs(g_rx2 - g_rx) + 1;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
570 yc = abs(g_ry2 - g_ry) + 1;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
571 break;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
572
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
573 case 7:
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
574 xc = abs(g_rx2 - g_rx) * 2 + 1;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
575 yc = abs(g_ry2 - g_ry) * 2 + 1;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
576 break;
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
577
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
578 case 8:
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
579 if (g_data[int('c')] == 1 || g_shift) {
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
580 xc = abs(g_rx2 - g_rx);
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
581 yc = abs(g_ry2 - g_ry);
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
582 } //purkkaa
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
583 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
584 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
585 yc = abs(g_ry2 - g_ry) + 1;
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
586 }
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
587 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
588 }
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
589
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
590 // coordinates
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
591 if (xc < X && yc < Y)
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
592 {
13
80727dab1359 Oops, fix the coordinate printing.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
593 printat(0, 0, "Px:"+ str(xc));
80727dab1359 Oops, fix the coordinate printing.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
594 printat(6, 0, ", "+ str(yc));
80727dab1359 Oops, fix the coordinate printing.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
595 printat(0, 1, "Ch:"+ str(int(xc / 8)));
80727dab1359 Oops, fix the coordinate printing.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
596 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
597
99
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
598 if (tool() == 6 && g_phase == 1)
cd6450dceec2 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
599 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
600 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
601
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
602 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
603 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
604 }
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 return;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
607 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
608
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
609 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
610
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
611 switch (char(mode))
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
612 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
613 case '.':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
614 teks = "Preset pens|.=reset";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
615 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
616 case TAB:
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
617 teks = "Pick color";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
618 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
619 case '<':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
620 teks = "Swap colors|Right<>Left";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
621 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
622 case '>':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
623 teks = "Pick backgnd|shift=set";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
624 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
625 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
626 case '1':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
627 teks = "Draw";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
628 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
629 case '2':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
630 teks = "Spray can";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
631 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
632 case '3':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
633 teks = "Continuous|Draw";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
634 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
635 case '4':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
636 teks = "Grab brush";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
637 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
638 case '5':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
639 teks = "Flood fill";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
640 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
641 case '8':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
642 teks = "Rectangle";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
643 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
644 case '7':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
645 teks = "Ellipse";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
646 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
647 case '6':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
648 teks = "Line";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
649 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
650 case '9':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
651 teks = "Brush tool";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
652 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
653 case '0':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
654 teks = "Magnifier|m=direct";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
655 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
656 case 'b':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
657 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
658 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
659 case 'B':
218
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
660 teks = "Set border|[Export="+ (g_data[int('Q')] ? "Y" : "N") +"]";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
661 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
662 case 'C':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
663 teks = "Set backgnd";
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
664 if (g_machine == PLUS4M || g_machine == PLUS4) teks = "Set backgnd|V/RMB=back2";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
665 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
666 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
667 case 'i':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
668 teks = "Increase|luminance";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
669 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
670 case 'k':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
671 teks = "Decrease|luminance";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
672 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
673 case 'r':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
674 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
675 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
676 case 'R':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
677 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
678 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
679 case 'd':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
680 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
681 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
682 case 'p':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
683 teks = "Brush|recolor|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
684 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
685 case 'q':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
686 teks = "IQ mode|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
687 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
688 case 't':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
689 teks = "Tile mode|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
690 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
691 case 'x':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
692 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
693 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
694 case 'y':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
695 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
696 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
697 case 'z':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
698 teks = "Brush|rotate";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
699 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
700 case 'h':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
701 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
702 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
703 case 'j':
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
704 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
705 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
706 case 'f':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
707 teks = "Geometry|fill|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
708 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
709 case 'c':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
710 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
711 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
712 case 'm':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
713 teks = "Magnify|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
714 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
715 case 'g':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
716 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
717 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
718 case 'X':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
719 teks = "Mirror X|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
720 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
721 case 'Y':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
722 teks = "Mirror Y|on/off";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
723 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
724 case 'l':
203
b7c7b13b46c2 Improve save/load help texts.
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
725 teks = "Load Multipaint [RMB=From Lstorage]";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
726 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
727 case 's':
203
b7c7b13b46c2 Improve save/load help texts.
Matti Hamalainen <ccr@tnsp.org>
parents: 183
diff changeset
728 teks = "Save as Multipaint [RMB=To Lstorage]";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
729 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
730 case 'u':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
731 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
732 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
733 case 'U':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
734 teks = "Redo";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
735 break;
218
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
736 case 'a':
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
737 teks = "Bitmap only|on/off";
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
738 break;
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
739 case 'A':
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
740 teks = "Export as|" + g_exportext;
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
741 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
742 case 'e':
218
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
743 teks = "Export PNG|"+ (g_data[int('Q')] ? "w/border" : "w/o border");
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
744 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
745 case 'E':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
746 teks = "Export as|source";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
747 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
748 case 'o':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
749 teks = "Clear|screen";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
750 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
751 case 'O':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
752 teks = "Export|specific";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
753 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
754 case 'n':
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
755 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
756 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
757 case 'w':
218
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
758 if (g_formatname != "")
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
759 teks = "Import as|" + g_formatname;
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
760 else
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
761 teks = "Format|Import:|no support";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
762 break;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
763 case 'W':
218
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
764 if (g_formatname != "")
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
765 teks = "Export as|" + g_formatname;
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
766 else
2e077cfc4f38 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 203
diff changeset
767 teks = "Format|Export:|no support";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
768 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
769
dfdc18b62fab Change the help() function and its usage to have more than one parameter to
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
770 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
771 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
772 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
773 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
774
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
775 printat(0, 0, teks);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
776 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
777
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
778
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
779 void icontable(int xx, int yy, int tabletype, int realdraw)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
780 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
781 String pan = "";
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
782 int x = 0, y = 0;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
783
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
784 g_data[int('9')] = (g_btype == 9) ? 1 : 0;
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
785
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
786 // the main and sideboard icon panel order
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
787 if (tabletype == 0) pan = ";;h9::123456::78::pzxy::XYtn::lsEAwW::jc0g::uo::"; //.b
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
788 if (tabletype == 1) pan = "BCrRfd";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
789 if (tabletype == 2) pan = "ik";
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
790
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
791 for (int tit = 0; tit < pan.length(); tit++)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
792 {
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
793 int ad = pan.charCodeAt(tit);
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
794 if (g_repanel <= 0 && realdraw == 1)
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
795 {
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
796 if (ad != ';' && ad != ':' && ad != '.')
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
797 {
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
798 int icolor;
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
799 if (ad == 'j' && g_spare)
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
800 icolor = 1;
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 icolor = int(g_data[ad]);
43
df6eecdf1cd4 Clean up g_spare related things.
Matti Hamalainen <ccr@tnsp.org>
parents: 42
diff changeset
803
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
804 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
805 }
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
806 else
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
807 if (ad == ';')
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
808 {
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
809 //draw the preset brush box
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
810 drawchar(xx, yy, 128);
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
811 drawchar(xx + 8 * g_uiscale, yy, 129);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
812 drawchar(xx + 16 * g_uiscale, yy, 130);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
813 drawchar(xx + 24 * g_uiscale, yy, 131);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
814 drawchar(xx, yy + 8 * g_uiscale, 132);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
815 drawchar(xx + 8 * g_uiscale, yy + 8 * g_uiscale, 133);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
816 drawchar(xx + 16 * g_uiscale, yy + 8 * g_uiscale, 134);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
817 drawchar(xx + 24 * g_uiscale, yy + 8 * g_uiscale, 135);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
818 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
819 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
820
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
821 //tooltip
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
822 if (ad != ':' && ad != ';' && ad != '.')
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 if (realdraw == 0) {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
825 if (moicon(xx + x, yy + y, 16 * g_uiscale, 16 * g_uiscale)) help(ad);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
826 }
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
827 if (doicon(xx + x, yy + y, 16 * g_uiscale, 16 * g_uiscale))
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
828 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
829 //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
830 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
831 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
832 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
833 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
834 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
835 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
836 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
837 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
838 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
839 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
840 command(int(ad));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
841 g_msgctr = 50;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
842 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
843 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
844 if (ad == ';')
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
845 {
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
846 for (int ii = 0; ii <= 3; ii++)
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
847 for (int jj = 0; jj <= 1; jj++)
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
848 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
849 if (doicon(xx + ii * 8 * g_uiscale, yy + jj * 8 * g_uiscale,
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
850 8 * g_uiscale, 8 * g_uiscale))
79
dda377b64984 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
851 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
852 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
853 }
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
854
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
855 if (tabletype == 0)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
856 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
857 x += 16 * g_uiscale;
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
858 if (ad == '.') x = x - 8 * g_uiscale;
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
859 if (x > 16 * g_uiscale)
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
860 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
861 x = 0;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
862 y += 16 * g_uiscale;
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
863 if (ad == ':')
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
864 y -= 14 * g_uiscale;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
865 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
866 }
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
867 else
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
868 if (tabletype == 1 || tabletype == 2)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
869 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
870 y += 16 * g_uiscale;
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
871 if (y > 16 * g_uiscale)
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
872 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
873 y = 0;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
874 x += 16 * g_uiscale;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
875 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
876 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
877 }
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
878 g_data[int('9')] = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
879 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
880
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
881
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
882 int nextluminance(int f, int d)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
883 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
884 int res = f + d;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
885
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
886 if (g_machine == PLUS4 || g_machine == PLUS4M) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
887 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
888 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
889 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
890 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
891 return res;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
892 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
893
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
894 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
895 int out[] = {
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
896 6, 1, 11, 15, 8, 10,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
897 9, 13, 14, 2, 3, 4,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
898 5, 1, 12, 7
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
899 }; // from "Ptoing"
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
900 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
901 if (d == -1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
902 if (f == 0) return 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
903 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
904 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
905 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
906 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
907 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
908
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
909 if (g_map[13] == MSX) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
910 int out[] = {
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
911 1, 4, 9, 10,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
912 6, 12, 13, 14,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
913 5, 3, 7, 15,
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
914 2, 8, 11, 15
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
915 }; // calculated Y
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
916 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
917 if (d == -1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
918 if (f == 0) return 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
919 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
920 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
921 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
922 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
923 }
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
924
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
925 return res;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
926 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
927
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
928
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
929 int tool()
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
930 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
931 //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
932 //as there is no "tool" variable really
141
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
933 for (int i = '0'; i <= '9'; i++)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
934 {
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
935 if (g_data[i] == 1)
cdb62481ac97 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 137
diff changeset
936 return i - '0';
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
937 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
938 return 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
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
941
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
942 void set_tool(int s)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
943 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
944 //set current tool, for convenience
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
945 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
946 g_data[i] = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
947 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
948 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
949 g_map[12] = byte(s);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
950 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
951
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
952
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
953 void selectcolor(int hand, int x)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
954 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
955 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
956 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
957 if (hand == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
958 g_farge = x;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
959 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
960 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
961 g_realfront = byte(g_farge);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
962 g_realback = byte(g_backg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
963 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
964 if (hand == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
965 g_backg = x;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
966 g_realback = byte(g_backg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
967 g_realfront = byte(g_farge);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
968 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
969 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
970
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
971
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
972 void refresh()
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
973 {
80
384b301970ac Set g_dirty flag in refresh() to ensure screen update after certain
Matti Hamalainen <ccr@tnsp.org>
parents: 79
diff changeset
974 g_dirty = true;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
975
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
976 //refreshes all "dirty chars" and icon panels
142
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
977 for (int i = 0; i < MX * MY; i++)
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
978 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
979 g_redo[i] = byte(0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
980 g_remdo[i] = byte(1);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
981 }
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
982
142
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
983 if (g_boxreconstruct == 0)
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
984 g_boxreconstruct = 1;
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
985
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
986 //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
987 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
988
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
989
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
990 void refresh_all()
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
991 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
992 refresh();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
993 g_boxreconstruct = 2;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
994 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
995
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
996
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
997 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
998 if (g_palsteps == 0) return;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
999 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
1000 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
1001 for (int i = 0; i < g_palsteps; i++) {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1002 if (doicon_drag(int(x0 + expand * i), y0, int(expand), 7 * g_uiscale)) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1003 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
1004 message("RED:" + i);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1005 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
1006 refresh();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1007 g_boxreconstruct = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1008 }
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1009 if (doicon_drag(int(x0 + expand * i), y0 + 10 * g_uiscale, int(expand), 7 * g_uiscale)) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1010 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
1011 message("GREEN:" + i);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1012 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
1013 refresh();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1014 g_boxreconstruct = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1015 }
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1016 if (doicon_drag(int(x0 + expand * i), y0 + 20 * g_uiscale, int(expand), 7 * g_uiscale)) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1017 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
1018 message("BLUE:" + i);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1019 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
1020 refresh();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1021 g_boxreconstruct = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1022 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1023 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1024
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1025 for (int j = 0; j < 3; j++)
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1026 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1027 e_rect(int(x0), y0 + j * 10 * g_uiscale, int(x1 - x0), 7 * g_uiscale, g_rgb[258]);
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1028
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1029 for (int i = 1; i < g_palsteps; i++) {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1030 e_rect(int(x0 + expand * i), y0 + j * 10 * g_uiscale, g_uiscale, 2 * g_uiscale, g_rgb[257]);
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1031 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1032 }
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1033
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1034 e_rect(int(x0 + expand * g_r[g_farge] / divs), y0, int(expand), 7 * g_uiscale, g_rgb[260]);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1035 e_rect(int(x0 + expand * g_g[g_farge] / divs), y0 + 10 * g_uiscale, int(expand), 7 * g_uiscale, g_rgb[261]);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1036 e_rect(int(x0 + expand * g_b[g_farge] / divs), y0 + 20 * g_uiscale, int(expand), 7 * g_uiscale, g_rgb[262]);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1037 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1038
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1039
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1040 void colorselector(int xo, int yo)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1041 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1042 int x, y, ad, yfat;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1043 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
1044 int bfat;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1045 float expand, divus;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1046
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1047 xonko = 16 * g_uiscale;
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1048 yhei = 16 * g_uiscale;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1049 expand = 1;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1050 yfat = 4 * g_uiscale;
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1051 bfat = 1 * g_uiscale;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1052
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1053 if (g_maxcolors > 60) {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1054 yhei = 4 * g_uiscale;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1055 yfat = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1056 bfat = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1057 }
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1058
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1059 divus = 255 / g_palsteps;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1060 x = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1061 y = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1062 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1063
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1064 maxp = g_maxcolors;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1065 xonko = int(int(512 / g_maxcolors) / 2) * g_uiscale;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1066
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1067 if (g_maxcolors > 32) {
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1068 maxp = int(g_maxcolors / 2);
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1069 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
1070 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1071
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1072 if (g_machine == PLUS4 || g_machine == PLUS4M)
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1073 xonko = 15 * g_uiscale;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1074
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1075 for (x = 0; x < g_maxcolors; x++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1076 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1077 xloc = xo + x * xonko;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1078 yloc = yo + 8 * g_uiscale;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1079 if (g_maxcolors > 60)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1080 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1081 yloc = yo + yhei * 7;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1082
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1083 if (x > 15 && x <= 30) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1084 xloc = xo + (x - 15) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1085 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
1086 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1087 if (x > 30 && x <= 45) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1088 xloc = xo + (x - 30) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1089 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
1090 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1091 if (x > 45 && x <= 60) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1092 xloc = xo + (x - 45) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1093 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
1094 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1095 if (x > 60 && x <= 75) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1096 xloc = xo + (x - 60) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1097 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
1098 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1099 if (x > 75 && x <= 90) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1100 xloc = xo + (x - 75) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1101 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
1102 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1103 if (x > 90 && x <= 105) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1104 xloc = xo + (x - 90) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1105 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
1106 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1107 if (x > 105 && x <= 120) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1108 xloc = xo + (x - 105) * xonko;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1109 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
1110 }
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1111
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1112 yloc--;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1113 }
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1114
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1115 if (doicon_drag(xloc, yloc, xonko, yhei))
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1116 {
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1117 if (mouseButton == LEFT || mouseButton == CENTER)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1118 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1119 selectcolor(0, x);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1120 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1121 if (mouseButton == RIGHT) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1122 selectcolor(1, x);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1123 g_button = LEFT;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1124 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1125 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1126
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1127 if (g_repanel <= 0)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1128 {
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1129 int index = x;
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1130 if (g_machine == MSX && x == 0) index = g_map[1];
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1131 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
1132 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1133 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
1134 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
1135 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
1136
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1137 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1138 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
1139
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1140 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
1141 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
1142 if (yfat == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1143 if (g_farge == x) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1144 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
1145 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
1146 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1147 if (g_backg == x) {
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1148 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
1149 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
1150 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1151 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1152 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
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;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1155 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
1156 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
1157 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
1158 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
1159 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1160 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
1161 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1162 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
1163 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
1164 }
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1165 if (g_machine == PLUS4 || g_machine == PLUS4M) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1166 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
1167 far = 0xff000000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1168 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
1169 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
1170 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1171 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1172 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1173 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1174 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1175
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1176
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1177 void messagebox(int ox, int oy)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1178 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1179 // lcd character display chardisplay textbox
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1180 // coordinates. has its own "dirtychar"
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1181 int cz = 8 * g_uiscale;
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1182 for (int xx = 0; xx < 12; xx++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1183 for (int yy = 0; yy < 4; yy++)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1184 {
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1185 if (g_chaup[xx + yy * 16] == 1)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1186 {
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1187 g_chaup[xx + yy * 16] = 0;
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1188 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
1189 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1190 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1191 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1192
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1193
135
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1194 void colorindicator(int ox, int oy)
72ae62f2036b Cosmetic cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 133
diff changeset
1195 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1196 int bs = 8 * g_uiscale;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1197 int h = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1198 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
1199 e_rect(ox, oy, bs * 2, bs * 4, g_rgb[int(g_realback)]);
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1200 e_rect(ox + bs / 2, oy + 4 * g_uiscale, 12 * g_uiscale, 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
1201 if (doicon(ox, oy, bs * 2, bs * 3)) command(int('<'));
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1202 if (g_machine == C64M || g_machine == MSX || g_machine == AMIGA) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1203 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
1204 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
1205 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
1206 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
1207 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
1208 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1209 }
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1210 if (g_machine == PLUS4M) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1211 e_rect(ox, oy + bs * 3, bs, bs, g_rgb[int(g_map[1])]);
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1212 e_rect(ox + 8 * g_uiscale, oy + bs * 3, bs, bs, g_rgb[int(g_map[2])]);
151
8a9a9fcc02f7 Cleanup.
Matti Hamalainen <ccr@tnsp.org>
parents: 145
diff changeset
1213 d_rect(ox, oy + bs * 3, bs, bs, g_rgb[257]);
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1214 d_rect(ox + 8 * g_uiscale, 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
1215 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
1216 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
1217 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
1218 }
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1219 if (doicon(ox + 8 * g_uiscale, oy + bs * 3, bs, bs)) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1220 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
1221 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
1222 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1223 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1224 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1225
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1226
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1227 void update_ui(boolean forced)
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1228 {
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1229 if (g_repanel <= 0)
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1230 g_repanel++;
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1231
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1232 messagebox(width - 12 * 8 * g_uiscale, height - 4 * 8 * g_uiscale - g_uiscale);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1233
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1234 // 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
1235 // drawn but used for easy coordinate reference
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1236 if (g_repanel > 0 && !forced)
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1237 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1238 icontable(width - 32 * g_uiscale, 0, 0, 0);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1239 icontable(272 * g_uiscale, height - 32 * g_uiscale, 1, 0);
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1240 //icontable(0,0,3,0);
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1241 if (g_machine == PLUS4M || g_machine == PLUS4) {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1242 icontable(240 * g_uiscale, height - 32 * g_uiscale, 2, 0);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1243 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1244 }
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1245 else
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1246 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1247 icontable(width - 32 * g_uiscale - 1, 0, 0, 1);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1248 icontable(272 * g_uiscale, height - 32 * g_uiscale, 1, 1);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1249 palettebox(g_uiscale * 324 + 4, height - 32 * g_uiscale, width - (96 * g_uiscale) - 4);
152
394c52d4763a Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 151
diff changeset
1250
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1251 if (g_machine == PLUS4M || g_machine == PLUS4) {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1252 icontable(240 * g_uiscale, height - 32 * g_uiscale, 2, 1);
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1253 }
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1254
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1255 colorselector(0, height - 32 * g_uiscale);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1256 colorindicator(256 * g_uiscale, height - 32 * g_uiscale);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1257 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1258 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1259
42
14b7d678dbc2 Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 39
diff changeset
1260
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1261 void viewport()
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1262 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1263 // formerly void redo()
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1264 // main machine screen redraw
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1265 // and dirty char update
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1266 int xx, yy, xo, yo, xwin, ywin, x, y, winsux, winsuy, rubx;
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1267 int ad, cad, a, b, c, mmode, fari, psizex, psizey;
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1268 int maxx, mayy, xcmag, ycmag, raddr;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1269 int left = 32 * g_uiscale;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1270 raddr = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1271 winsux = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1272 winsuy = 0;
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1273
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1274 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
1275
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1276 mmode = magmode();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1277 fari = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1278 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
1279 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
1280 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
1281 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
1282
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1283 psizex = g_magpix[mmode];
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1284 psizey = g_magpiy[mmode];
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1285 xcmag = psizex * 8;
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1286 ycmag = psizey * 8;
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1287
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1288 maxx = magx();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1289 mayy = magy();
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1290 //borders & ultimate background
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1291
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1292 if (g_boxreconstruct == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1293 g_boxreconstruct = 0;
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1294 //between mag window and toolboxes
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1295 if (g_data['m'] == 1 || g_data['M'] == 1)
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1296 {
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1297 e_rect(0, (mayy * psizex) * 8, maxx * psizex * 8, height - ((g_vedge + g_uiscale * 2) + (mayy * psizex * 8)), g_rgb[263]);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1298 e_rect((maxx * psizex) * 8, 0, width - (maxx * psizex * 8 + (g_hedge + g_uiscale * 2)), height - (g_vedge + g_uiscale), g_rgb[263]);
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1299 }
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1300 // e_rect(width-(g_hedge+g_uiscale*2),0,g_hedge+g_uiscale*2,height,g_rgb[263]);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1301 // e_rect(0,height-(g_vedge+g_uiscale*2),width,g_vedge+g_uiscale*2,g_rgb[263]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1302 }
142
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1303
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1304 if (g_boxreconstruct == 2)
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1305 {
1ec3488bfd1e Cosmetics.
Matti Hamalainen <ccr@tnsp.org>
parents: 141
diff changeset
1306 //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
1307 g_boxreconstruct = 0;
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1308 e_rect(0, 0, width - (g_hedge + g_uiscale * 2 - 2), height - (g_vedge + g_uiscale * 2 - 2), g_rgb[259]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1309 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1310
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1311 if (g_pgrab)
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1312 {
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1313 // avoid preview window embarassment
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1314 e_rect(width - (g_hedge + g_uiscale * 2), 0, g_hedge + g_uiscale * 2 - 1, height - 1, g_rgb[263]);
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1315 e_rect(0, height - (g_vedge + g_uiscale * 2), width - 1, g_vedge + g_uiscale * 2 - 1, g_rgb[263]);
145
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1316 }
5af8b5ddf349 Merge and clean up changes from v1.8.2018
Matti Hamalainen <ccr@tnsp.org>
parents: 144
diff changeset
1317
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1318 maxx--;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1319 mayy--;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1320
156
5d73681b97eb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 155
diff changeset
1321 g_ofx = clampv(g_ofx, 0, MX - magx());
5d73681b97eb Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 155
diff changeset
1322 g_ofy = clampv(g_ofy, 0, MY - magy());
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1323
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1324 if (mmode == 10) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1325 g_ofx = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1326 g_ofy = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1327 maxx = MX - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1328 mayy = MY - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1329 winsux = g_windowx;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1330 winsuy = g_windowy;
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1331 xcmag = 16;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1332 } //mini
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1333 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1334 if (mmode == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1335 g_ofx = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1336 g_ofy = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1337 maxx = MX - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1338 mayy = MY - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1339 winsux = g_windowx;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1340 winsuy = g_windowy;
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1341 xcmag = 24;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1342 } //normal
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1343 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1344 if (mmode == 20) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1345 g_ofx = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1346 g_ofy = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1347 maxx = MX - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1348 mayy = MY - 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1349 winsux = g_windowx;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1350 winsuy = g_windowy;
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1351 xcmag = 32;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1352 } //maxi
155
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1353 else
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1354 if (mmode == 1 || mmode == 2 ||
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1355 mmode == 11 || mmode == 12 ||
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1356 mmode == 21 || mmode == 22)
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1357 {
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1358 winsux = 0;
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1359 winsuy = 0;
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1360 fill(32, 32, 32);
b9ad669fb025 Integrate more 1.8.2018 changes.
Matti Hamalainen <ccr@tnsp.org>
parents: 154
diff changeset
1361 }
157
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1362 else
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1363 if (mmode == 110)
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1364 {
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1365 g_ofx = 0;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1366 g_ofy = 0;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1367 maxx = MX - 1;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1368 mayy = MY - 1;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1369 winsux = g_windowx;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1370 winsuy = g_windowy;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1371 mag = 16;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1372 } //mini flat aspect
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1373 else
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1374 if (mmode == 100)
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1375 {
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1376 g_ofx = 0;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1377 g_ofy = 0;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1378 maxx = MX - 1;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1379 mayy = MY - 1;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1380 winsux = g_windowx;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1381 winsuy = g_windowy;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1382 mag = 24;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1383 } //normal flat aspect
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1384 else
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1385 if (mmode == 120)
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1386 {
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1387 g_ofx = 0;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1388 g_ofy = 0;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1389 maxx = MX - 1;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1390 mayy = MY - 1;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1391 winsux = g_windowx;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1392 winsuy = g_windowy;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1393 mag = 32;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1394 } //maxi flat aspect
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1395
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1396 b = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1397 c = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1398 a = 5;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1399
8
f97ee354db2a Various minor code cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 7
diff changeset
1400 for (ywin = 0; ywin <= mayy; ywin++)
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1401 for (xwin = 0; xwin <= maxx; xwin++)
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1402 {
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1403 // source coords: is 0,0 if not magged
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1404 xx = g_ofx + xwin;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1405 yy = g_ofy + ywin;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1406 // divided into character area blocks
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1407 // which are only updated if necessary
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1408 xo = xwin;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1409 yo = ywin;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1410
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1411 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
1412
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1413 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
1414
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1415 switch (g_multic) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1416 case 0:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1417 cad = 65536 + xx + ((yy * X) + y * MX);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1418 a = int(g_map[cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1419 b = int(g_map[(MX * MY) * 8 + cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1420 c = int(g_map[(MX * MY) * 8 + cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1421 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1422 case 1:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1423 cad = 65536 + xx + (yy * MX);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1424 a = int(g_map[cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1425 b = int(g_map[cad + 1000]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1426 c = int(g_map[cad + 2000]);
179
934934bb1fbb Rename global variable s/machine/g_machine/g
Matti Hamalainen <ccr@tnsp.org>
parents: 172
diff changeset
1427 if (g_machine == PLUS4M) {
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1428 c = int(g_map[2]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1429 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1430 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1431 case 2:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1432 cad = 65536 + xx + ((yy * X) + y * MX);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1433 a = int(g_map[cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1434 b = int(g_map[(MX * MY) * 8 + cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1435 c = int(g_map[(MX * MY) * 8 + cad]);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1436 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1437 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1438
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1439 ad = 1024 + xx * 8 + yy * (X * 8) + y * X;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1440
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1441 int po, vop;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1442
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1443 for (x = 0; x <= 7; x++) { //pixel columns inside pixel row
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1444 vop = int(x / 2);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1445 if (g_multic == 0) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1446 if (int(g_map[ad + x]) == 1) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1447 fari = a;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1448 if (fari == 0) fari = g_map[1];
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1449 } else {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1450 fari = b;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1451 if (fari == 0) fari = g_map[1];
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1452 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1453 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1454 if (g_multic == 1) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1455 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
1456 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
1457 if (po == 1) fari = a; //10
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1458 if (po == 2) fari = b; //01
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1459 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
1460 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1461 if (g_multic == 2) { // "amiga" mode
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1462 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
1463 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1464
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1465 if (g_rubbermode == 1) { // rubberband mode
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1466 rubx = x;
133
f5c32f6470d0 Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 131
diff changeset
1467 if (g_pixelw == 2) {
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1468 rubx = chop2(x);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1469 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1470 if (fylli() == 1) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1471 if (xx * 8 + rubx == g_rx || xx * 8 + rubx == g_rx2) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1472 if (yy * 8 + y >= g_ry && yy * 8 + y <= g_ry2) fari = 256;
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1473 // 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
1474 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1475 if (yy * 8 + y == g_ry || yy * 8 + y == g_ry2) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1476 if (xx * 8 + x >= g_rx && xx * 8 + x <= g_rx2) fari = 256;
154
1b2cbf3ab441 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 152
diff changeset
1477 // 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
1478 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1479 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1480 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1481
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1482 color ari = g_rgb[fari];
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1483 switch (mmode) {
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1484 case 0:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1485 raddr = (xo * 24 + x * 3) + (yo * 24 + y * 3) * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1486 raddr = raddr + g_windowx + g_windowy * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1487 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1488 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1489 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1490 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1491 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1492 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1493 pixels[raddr + 2] = 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 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1499 case 1:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1500 raddr = (xo * 64 + x * 8) + (yo * 64 + y * 8) * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1501 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1502 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1503 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1504 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1505 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1506 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1507 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1508 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1509 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1510 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1511 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1512 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1513 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1514 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1515 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1516 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1517 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1518 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1519 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1520 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1521 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1522 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1523 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1524 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1525 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1526 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1527 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1528 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1529 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1530 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1531 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1532 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1533 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1534 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1535 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1536 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1537 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1538 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1539 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1540 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1541 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1542 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1543 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1544 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1545 raddr = raddr + 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 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1553 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1554 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1555 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1556 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1557 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1558 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1559 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1560 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1561 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1562 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1563 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1564 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1565 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1566 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1567 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1568 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1569 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1570 pixels[raddr + 6] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1571 pixels[raddr + 7] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1572 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1573 case 2:
183
1cb7ecd73554 Rename global variable g_uizoom to g_uiscale and mpUIZoom -> mpUIScale.
Matti Hamalainen <ccr@tnsp.org>
parents: 179
diff changeset
1574 e_rect(xo * (64 * g_uiscale) + x * (8 * g_uiscale), yo * (64 * g_uiscale) + y * (8 * g_uiscale), 8 * g_uiscale, 8 * g_uiscale, g_rgb[fari]);
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1575 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1576 // mini modes
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1577 case 10:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1578 raddr = (xo * 16 + x * 2) + (yo * 8 + y) * width * 2;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1579 raddr = raddr + g_windowx + g_windowy * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1580 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1581 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1582 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1583 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1584 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1585 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1586 case 11:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1587 raddr = (xo * 48 + x * 6) + (yo * 48 + y * 6) * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1588 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1589 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1590 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1591 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1592 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1593 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1594 raddr = raddr + 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 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1600 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1601 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1602 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1603 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1604 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1605 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1606 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1607 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1608 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1609 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1610 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1611 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1612 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1613 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1614 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1615 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1616 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1617 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1618 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1619 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1620 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1621 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1622 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1623 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1624 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1625 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1626 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1627 pixels[raddr + 4] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1628 pixels[raddr + 5] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1629 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1630 case 12:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1631 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
1632 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1633 // maxi modes
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1634 case 20:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1635 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
1636 raddr = raddr + g_windowx + g_windowy * width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1637 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1638 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1639 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1640 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1641 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1642 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1643 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1644 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1645 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1646 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1647 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1648 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1649 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1650 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1651 raddr = raddr + width;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1652 pixels[raddr] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1653 pixels[raddr + 1] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1654 pixels[raddr + 2] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1655 pixels[raddr + 3] = ari;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1656 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1657 case 21:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1658 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
1659 break;
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1660 case 22:
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1661 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
1662 break;
157
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1663
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1664 //flat NORMI
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1665 case 100:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1666 raddr = (xo * 24 + x * 3) + (yo * 16 + y * 2) * width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1667 raddr = raddr + g_windowx;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1668 raddr = raddr + (g_windowy) * width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1669
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1670 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1671 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1672 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1673 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1674 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1675 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1676 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1677 break;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1678
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1679 case 101:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1680 raddr = (xo * 72 + x * 9) + (yo * 48 + y * 6) * width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1681 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1682 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1683 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1684 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1685 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1686 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1687 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1688 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1689 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1690 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1691 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1692 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1693 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1694 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1695 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1696 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1697 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1698 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1699 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1700 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1701 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1702 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1703 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1704 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1705 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1706 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1707 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1708 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1709 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1710 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1711 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1712 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1713 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1714 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1715 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1716 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1717 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1718 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1719 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1720 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1721 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1722 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1723 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1724 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1725 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1726 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1727 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1728 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1729 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1730 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1731 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1732 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1733 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1734 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1735 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1736 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1737 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1738 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1739 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1740 break;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1741
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1742 case 102:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1743 e_rect(xo * (8 * psizex) + x * (psizex), yo * (8 * psizey) + y * (psizey), psizex, psizey, g_rgb[fari]);
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1744 break;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1745
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1746 // flat mini modes = probably redundant
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1747 // mini modes
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1748 case 110:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1749 raddr = (xo * 24 + x * 3) + (yo * 16 + y * 2) * width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1750 raddr = raddr + g_windowx;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1751 raddr = raddr + (g_windowy) * width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1752
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1753 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1754 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1755 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1756 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1757 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1758 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1759 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1760 break;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1761
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1762 case 111:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1763 raddr = (xo * 72 + x * 9) + (yo * 48 + y * 6) * width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1764 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1765 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1766 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1767 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1768 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1769 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1770 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1771 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1772 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1773 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1774 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1775 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1776 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1777 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1778 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1779 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1780 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1781 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1782 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1783 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1784 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1785 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1786 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1787 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1788 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1789 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1790 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1791 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1792 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1793 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1794 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1795 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1796 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1797 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1798 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1799 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1800 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1801 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1802 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1803 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1804 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1805 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1806 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1807 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1808 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1809 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1810 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1811 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1812 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1813 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1814 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1815 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1816 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1817 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1818 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1819 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1820 pixels[raddr + 6] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1821 pixels[raddr + 7] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1822 pixels[raddr + 8] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1823 break;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1824 case 112:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1825 e_rect(xo * (8 * psizex) + x * (psizex), yo * (8 * psizey) + y * (psizey), psizex, psizey, g_rgb[fari]);
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1826 break;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1827
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1828 // flat maxi modes
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1829 case 120:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1830 raddr = (xo * (8 * 6) + x * 6) + (yo * (8 * 4) + y * 4) * width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1831 raddr = raddr + g_windowx + g_windowy * width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1832 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1833 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1834 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1835 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1836 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1837 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1838 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1839 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1840 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1841 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1842 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1843 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1844 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1845 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1846 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1847 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1848 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1849 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1850 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1851 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1852 raddr = raddr + width;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1853 pixels[raddr] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1854 pixels[raddr + 1] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1855 pixels[raddr + 2] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1856 pixels[raddr + 3] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1857 pixels[raddr + 4] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1858 pixels[raddr + 5] = ari;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1859 break;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1860 case 121:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1861 e_rect(xo * (8 * psizex) + x * (psizex), yo * (8 * psizey) + y * (psizey), psizex, psizey, g_rgb[fari]);
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1862 break;
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1863 case 122:
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1864 e_rect(xo * (8 * psizex) + x * (psizex), yo * (8 * psizey) + y * (psizey), psizex, psizey, g_rgb[fari]);
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1865 break;
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1866 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1867 } //one pixel inside pixel row
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1868 } //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
1869
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1870 //draw grid
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1871 //can in principle be non-square
157
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1872 if (int(g_data[int('g')]) == 1)
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1873 {
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1874 if (chopv(xx * 8, g_gridx) == (xx * 8))
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1875 {
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1876 t_rect(xo * psizex * 8 + winsux, yo * ycmag + winsuy, 1, ycmag, g_rgb[257]);
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1877 if (g_gridx == 4)
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1878 {
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1879 t_rect(xo * psizex * 8 + winsux + 4 * psizex, yo * ycmag + winsuy + 1, 1, ycmag / 2 - 2, g_rgb[257]);
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1880 t_rect(xo * psizex * 8 + winsux + 4 * psizex, yo * ycmag + winsuy + ycmag - ycmag / 2 + 2, 1, ycmag / 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
1881 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1882 }
7
c848a6133cfc Fix many calculations (divisions) that assume integer variable division
Matti Hamalainen <ccr@tnsp.org>
parents: 6
diff changeset
1883
157
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1884 if (chopv(yy * 8, g_gridy) == (yy * 8))
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1885 {
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1886 t_rect(xo * psizex * 8 + winsux + 1, yo * ycmag + winsuy, psizex * 8 - 1, 1, g_rgb[257]);
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1887 if (g_gridy == 4)
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1888 {
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1889 t_rect(xo * psizex * 8 + winsux + 1, yo * ycmag + winsuy + 4 * psizex, xcmag / 2 - 2, 1, g_rgb[257]);
cdfda0354332 Integrate changes from v1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents: 156
diff changeset
1890 t_rect(xo * psizex * 8 + winsux + 2 + xcmag - xcmag / 2, yo * ycmag + winsuy + 4 * psizex, xcmag / 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
1891 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1892 }
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1893 }
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1894 g_redo[xx + yy * MX] = byte(1);
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1895 } //dirty char?
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 10
diff changeset
1896 } //x char
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1897 }