annotate exporters.pde @ 124:68e8d86c9eef

Get rid of unused variables and clean up the logic slightly in mpExportColorData()
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Jul 2018 19:34:36 +0300
parents ffa6533584ca
children c210b2e2cb47
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1 //
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
2 // machine definitions
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
3 // source writer and other export/import functions
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
4 // remember hexdump -C !
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
5 //
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
6 String g_formatname, g_formatext;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
7 int[] g_grids = new int[16];
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
8 int OLD = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
9 int NEW = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
10 int g_gridmode = OLD;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
11
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
12
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
13 public class MPWriteCtx
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
14 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
15 public int m_offs, m_bpl, m_bytes, m_indent;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
16 public String m_byteDef, m_eol, m_src;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
17 public byte[] data;
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
18
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
19 MPWriteCtx()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
20 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
21 m_offs = 0;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
22 m_bpl = 32;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
23 m_bytes = 0;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
24 m_indent = 4;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
25 m_byteDef = ".byte";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
26 m_src = "";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
27 m_eol = "\n";
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
28 m_data = new byte[1*1024];
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
29 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
30
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
31 void setOffs(int offs)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
32 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
33 m_offs = offs;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
34 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
35
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
36 void setBPL(int bpl)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
37 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
38 m_bpl = bpl;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
39 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
40
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
41 byte[] getData()
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
42 {
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
43 return m_data;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
44 }
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
45
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
46 byte[] getSource()
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
47 {
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
48 return m_src;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
49 }
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
50
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
51 String getIndent()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
52 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
53 String str = "";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
54 for (int n = 0; n < m_indent; n++)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
55 str += " ";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
56 return str;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
57 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
58
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
59 void label(String blabel)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
60 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
61 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
62 m_src += blabel +":";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
63 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
64 m_bytes = 0;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
65 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
66
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
67 void comment(String bstr)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
68 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
69 indent();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
70 m_src += "; "+ bstr;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
71 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
72 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
73
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
74 void eol()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
75 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
76 m_src += m_eol;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
77 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
78
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
79 void eod()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
80 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
81 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
82 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
83 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
84
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
85 void byteDef()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
86 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
87 m_src += m_byteDef +" ";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
88 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
89
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
90 void byteSep()
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
91 {
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
92 m_src += ",";
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
93 }
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
94
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
95 void indent()
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
96 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
97 m_src += getIndent();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
98 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
99
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
100 void line(String str)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
101 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
102 m_src += str;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
103 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
104 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
105
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
106 void writeByte(int bval, String blabel)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
107 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
108 m_data[m_offs++] = byte(bval);
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
109
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
110 if (blabel != null)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
111 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
112 m_src += blabel +": "+ m_byteDef +" "+ str(int(bval)) + m_eol;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
113 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
114 else
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
115 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
116 m_src += str(int(bval));
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
117
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
118 if (m_bpl > 0 &&
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
119 ++m_bytes >= m_bpl)
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
120 {
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
121 eol();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
122 indent();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
123 byteDef();
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
124 m_bytes = 0;
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
125 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
126 else
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
127 m_src += ",";
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
128 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
129 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
130
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
131 void writeByteAt(int boffs, int bval, String blabel)
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
132 {
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
133 m_offs = boffs;
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
134 writeByte(bval, blabel);
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
135 }
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
136
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
137 void loadTemplate(String fname)
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
138 {
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
139 m_data = mpLoadBinaryFile("templates/" + fname);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
140 }
121
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
141 }
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
142
25a29d29ee6a Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents: 120
diff changeset
143
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
144 void mpCopyByte(byte[] fdata, int moffs, int toffs)
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
145 {
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
146 g_map[moffs ] = byte((fdata[toffs] & 128) >> 7);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
147 g_map[moffs + 1] = byte((fdata[toffs] & 64) >> 6);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
148 g_map[moffs + 2] = byte((fdata[toffs] & 32) >> 5);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
149 g_map[moffs + 3] = byte((fdata[toffs] & 16) >> 4);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
150 g_map[moffs + 4] = byte((fdata[toffs] & 8) >> 3);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
151 g_map[moffs + 5] = byte((fdata[toffs] & 4) >> 2);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
152 g_map[moffs + 6] = byte((fdata[toffs] & 2) >> 1);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
153 g_map[moffs + 7] = byte( fdata[toffs] & 1);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
154 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
155
29
249c4f5742f3 Refactor the import/export stuff a bit and the GUI bits for JS.
Matti Hamalainen <ccr@tnsp.org>
parents: 14
diff changeset
156
117
44a07b1c620d Rename 'bool' -> 'boolean'.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
157 boolean mpImportFormat(byte[] fdata)
84
025efefd1704 Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents: 81
diff changeset
158 {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
159 int x, y, x2, y2, y3, head, xx, yy, yp, ad, valu;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
160 int p1, p2, p3;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
161
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
162 head = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
163
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
164 if (machine == SPECTRUM) //SCR=SCREEN$
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
165 {
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
166 // 32*24*8 bytes of bitmap
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
167 // 32*24 bytes of attributes
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
168 if (fdata.length < 6912) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
169 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
170 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
171 for (y = 0; y < 3; y++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
172 for (y2 = 0; y2 < 8; y2++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
173 for (yy = 0; yy < 8; yy++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
174 for (x = 0; x < 32; x++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
175 {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
176 yp = y * 64 + yy * 8 + y2;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
177 ad = 1024 + yp * 256 + x * 8;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
178 mpCopyByte(fdata, ad, head);
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
179 head++;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
180 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
181
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
182 for (y = 0; y < 24; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
183 for (x = 0; x < 32; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
184 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
185 ad = 65536 + x + y * (32 * 8);
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
186 valu = fdata[head];
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
187 int ink = valu & 7;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
188 int pap = valu & 56;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
189 pap = pap >> 3;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
190 int bri = valu & 64;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
191 bri = bri >> 6;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
192 ink = ink + bri * 8;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
193 pap = pap + bri * 8;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
194 if (pap == 8) {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
195 pap = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
196 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
197 for (y2 = 0; y2 <= 7; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
198 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
199 g_map[ad + y2 * 32] = byte(ink);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
200 g_map[ad + y2 * 32 + MX * MY * 8] = byte(pap);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
201 }
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
202 head++;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
203 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
204 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
205 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
206 if (machine == C64) {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
207 //0x0002->bitmap
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
208 //0x1f42->colormap
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
209 //0x232a=border (take the lower nybble)
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
210 if (fdata.length < 9006) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
211 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
212 }
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
213 if (fdata.length >= 0x232a) {
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
214 g_map[0] = byte(fdata[0x232a] & 0x0f);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
215 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
216 for (y = 0; y < 25; y++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
217 for (x = 0; x < 40; x++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
218 for (y2 = 0; y2 <= 7; y2++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
219 {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
220 head = 2 + x * 8 + y * (40 * 8) + y2;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
221 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
222 mpCopyByte(fdata, ad, head);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
223 p1 = fdata[0x1f42 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
224 p2 = fdata[0x1f42 + x + y * 40] & 0xf0;
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
225 p2 = p2 >> 4;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
226 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(p2);
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
227 g_map[65536 + MX * MY * 8 + x + y * 40 * 8 + y2 * 40] = byte(p1);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
228 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
229 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
230 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
231 if (machine == PLUS4) { // Botticelli
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
232 //g.hires.prg = botticelli
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
233 //2 - luminance 40*25
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
234 //1026 - colors 40*25
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
235 //2050 - bitmappi 40*25*8
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
236 if (fdata.length < 10050) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
237 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
238 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
239 int l1, l2;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
240 for (y = 0; y < 25; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
241 for (x = 0; x < 40; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
242 for (y2 = 0; y2 <= 7; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
243 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
244 head = 2050 + x * 8 + y * (40 * 8) + y2;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
245 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
246 mpCopyByte(fdata, ad, head);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
247
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
248 p1 = fdata[1026 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
249 p2 = fdata[1026 + x + y * 40] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
250 p2 = p2 >> 4;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
251 l1 = fdata[2 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
252 l2 = fdata[2 + x + y * 40] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
253 l2 = l2 >> 4;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
254 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(convertluminance(l1, p2));
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
255 g_map[65536 + MX * MY * 8 + x + y * 40 * 8 + y2 * 40] = byte(convertluminance(l2, p1));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
256 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
257 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
258 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
259 if (machine == PLUS4M) { // Multi Botticelli
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
260 //m.multi.prg = multi botticelli
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
261 //2- lumins 40*25
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
262 //1024 - bäkki1
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
263 //1025 - bäkki2
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
264 //1026 - colors 40*25
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
265 //2050 - bitmap 40*25*8
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
266 if (fdata.length < 10050) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
267 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
268 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
269 int l1, l2;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
270 for (y = 0; y < 25; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
271 for (x = 0; x < 40; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
272 for (y2 = 0; y2 <= 7; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
273 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
274 head = 2050 + x * 8 + y * (40 * 8) + y2;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
275 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
276 mpCopyByte(fdata, ad, head);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
277
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
278 p1 = fdata[1026 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
279 p2 = fdata[1026 + x + y * 40] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
280 p2 = p2 >> 4;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
281 l1 = fdata[2 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
282 l2 = fdata[2 + x + y * 40] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
283 l2 = l2 >> 4;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
284 g_map[65536 + x + y * 40 + 1000] = byte(convertluminance(l1, p2));
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
285 g_map[65536 + x + y * 40 + 0000] = byte(convertluminance(l2, p1));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
286 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
287
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
288 p1 = int(fdata[1025]) & 0xf0;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
289 l1 = int(fdata[1025]) & 0x0f;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
290 p1 = p1 >> 4;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
291 g_map[1] = byte(convertluminance(l1, p1));
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
292 p1 = int(fdata[1024]) & 0xf0;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
293 l1 = int(fdata[1024]) & 0x0f;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
294 p1 = p1 >> 4;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
295 g_map[2] = byte(convertluminance(l1, p1));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
296 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
297 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
298 if (machine == C64M) { //advanced art studio
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
299 //adv. art studio (=multicolor) 10018 bytes
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
300 //0x0002 bitmap (40*25*8)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
301 //0x1f42 colors1 (40*25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
302 //0x232a border
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
303 //0x232b background
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
304 //0x233a colors2 (40*25)
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
305 if (fdata.length < 10018) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
306 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
307 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
308 for (y = 0; y < 25; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
309 for (x = 0; x < 40; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
310 for (y2 = 0; y2 < 8; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
311 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
312 ad = 1024 + x * 8 + y * (320 * 8) + y2 * 320;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
313
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
314 head = 2 + x * 8 + y * (40 * 8) + y2;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
315 mpCopyByte(fdata, ad, head);
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
316
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
317 p1 = fdata[0x1f42 + x + y * 40] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
318 p2 = (fdata[0x1f42 + x + y * 40] >> 4) & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
319 p3 = fdata[0x233a + x + y * 40] & 0x0f;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
320
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
321 g_map[65536 + x + y * 40] = byte(p1);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
322 g_map[65536 + x + y * 40 + 1000] = byte(p2);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
323 g_map[65536 + x + y * 40 + 2000] = byte(p3);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
324 }
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
325 g_map[0] = byte(fdata[0x232a] & 0x0f); //bord
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
326 g_map[1] = byte(fdata[0x232b] & 0x0f); //baku
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
327 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
328 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
329 if (machine == MSX) { // sc2
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
330 // 7=bitmap 32*24*8
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
331 // 7+(32*24*8)=colormap 32*24
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
332 if (fdata.length < 14343) {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
333 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
334 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
335 for (y = 0; y < 24; y++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
336 for (x = 0; x < 32; x++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
337 for (y2 = 0; y2 <= 7; y2++)
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
338 {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
339 head = 7 + x * 8 + y * (32 * 8) + y2;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
340 ad = 1024 + x * 8 + y * (256 * 8) + y2 * 256;
120
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
341 mpCopyByte(fdata, ad, head);
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
342 p1 = fdata[(8199) + x * 8 + ((y * 8 * 32) + y2)] & 0x0f;
55b0a77af602 Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 117
diff changeset
343 p2 = fdata[(8199) + x * 8 + ((y * 8 * 32) + y2)] & 0xf0;
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
344 p2 = p2 >> 4;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
345 if (p1 == 0) {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
346 p1 = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
347 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
348 if (p2 == 0) {
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
349 p2 = 1;
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
350 }
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
351 g_map[65536 + x + y * 32 * 8 + y2 * 32] = byte(p2);
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
352 g_map[65536 + MX * MY * 8 + x + y * 32 * 8 + y2 * 32] = byte(p1);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
353 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
354 }
85
db97aef4e159 Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 84
diff changeset
355 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
356 if (machine == CPC) { // a studio?
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
357 return false;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
358 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
359
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
360 consistency();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
361 refresh();
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
362 g_boxreconstruct = 2;
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
363 return true;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
364 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
365
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
366
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
367 bool mpExportFormat(MPWriteCtx ctx, int subformat)
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
368 {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
369 int val1, val2, val3;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
370 int y, y2, yy, x, yp, xp, ad, valu, valu2, bri;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
371
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
372 if (machine == PLUS4) { // botticelli hires
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
373 ctx.loadTemplate("g.hires.prg");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
374
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
375 ctx.setOffs(0x02);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
376 mpExportColorData(ctx, 40, 25, 65536, 5); //lumis
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
377
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
378 ctx.setOffs(1026);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
379 mpExportColorData(ctx, 40, 25, 65536, 4); //colors
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
380
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
381 ctx.setOffs(2050);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
382 mpExportBitmapData(ctx, 40, 25);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
383 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
384 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
385 if (machine == PLUS4M) { // multi botticelli multicolor
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
386 ctx.loadTemplate("m.multi.prg");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
387
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
388 val2 = getpluscolor(int(g_map[1]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
389 val1 = getplusluminance(int(g_map[1]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
390 val3 = val2 * 16 + val1;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
391 ctx.writeByteAt(1025, val3);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
392
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
393 val2 = getpluscolor(int(g_map[2]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
394 val1 = getplusluminance(int(g_map[2]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
395 val3 = val2 * 16 + val1;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
396 ctx.writeByteAt(1024, val3);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
397
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
398 ctx.setOffs(1026);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
399 mpExportColorData(ctx, 40, 25, 65536, 6); //colors
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
400
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
401 ctx.setOffs(2);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
402 mpExportColorData(ctx, 40, 25, 65536, 7); //lumis
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
403
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
404 ctx.setOffs(2050);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
405 mpExportBitmapData(ctx, 40, 25);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
406 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
407 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
408 if (machine == C64) {
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
409 ctx.loadTemplate("hires.art");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
410
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
411 ctx.setOffs(2);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
412 mpExportBitmapData(ctx, 40, 25);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
413
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
414 ctx.setOffs(0x1f42);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
415 mpExportColorData(ctx, 40, 25, 65536, 0);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
416
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
417 ctx.writeByteAt(0x232a, g_map[0]);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
418 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
419 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
420 if (machine == C64M) {
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
421 if (subformat == 0)
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
422 {
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
423 // Advanced Art Studio
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
424 ctx.loadTemplate("multic.ocp");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
425
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
426 ctx.setOffs(2);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
427 mpExportBitmapData(ctx, 40, 25);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
428
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
429 ctx.setOffs(0x1f42);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
430 mpExportColorData(ctx, 40, 25, 65536, 1);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
431
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
432 ctx.setOffs(0x233a);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
433 mpExportColorData(ctx, 40, 25, 65536 + 2000, 2);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
434
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
435 ctx.writeByteAt(0x232a, g_map[0]);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
436 ctx.writeByteAt(0x232b, g_map[1]);
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
437 }
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
438 else
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
439 {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
440 // Koala Painter
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
441 ctx.loadTemplate("multic.kla");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
442
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
443 ctx.setOffs(2);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
444 mpExportBitmapData(ctx, 40, 25);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
445
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
446 ctx.setOffs(0x1f42);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
447 mpExportColorData(ctx, 40, 25, 65536, 1);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
448
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
449 ctx.setOffs(0x232a);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
450 mpExportColorData(ctx, 40, 25, 65536 + 2000, 2);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
451
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
452 ctx.writeByteAt(0x2712, g_map[1] & 0x0f);
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
453 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
454 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
455 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
456 if (machine == MSX) {
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
457 ctx.loadTemplate("msx-screen2.sc2");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
458
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
459 ctx.setOffs(7);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
460 mpExportBitmapData(ctx, 32, 24);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
461
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
462 ctx.setOffs(7 + (32 * 24 * 8) + 768 + 1280);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
463 mpExportColorData(ctx, 32, 24, 65536, 3); //there's an exception for msx-style
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
464 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
465 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
466 if (machine == SPECTRUM) {
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
467 ctx.loadTemplate("zx-screen.scr");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
468
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
469 ctx.setOffs(0);
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
470 for (y = 0; y < 3; y++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
471 for (y2 = 0; y2 < 8; y2++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
472 for (yy = 0; yy < 8; yy++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
473 for (x = 0; x < 32; x++)
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
474 {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
475 yp = y * 64 + yy * 8 + y2;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
476 ad = 1024 + yp * 256 + x * 8;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
477
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
478 valu = g_map[ad + 0] * 128 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
479 g_map[ad + 1] * 64 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
480 g_map[ad + 2] * 32 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
481 g_map[ad + 3] * 16 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
482 g_map[ad + 4] * 8 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
483 g_map[ad + 5] * 4 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
484 g_map[ad + 6] * 2 +
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
485 g_map[ad + 7] * 1;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
486
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
487 ctx.writeByte(valu);
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
488 }
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
489
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
490 for (y = 0; y < 24; y++)
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
491 for (x = 0; x <= 31; x++)
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
492 {
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
493 ad = 65536 + x + y * 256;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
494 valu = int(g_map[ad]);
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
495 valu2 = int(g_map[ad + MX * MY * 8]);
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
496 bri = 0;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
497 if (valu >= 8) {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
498 bri = 1;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
499 valu = valu - 8;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
500 valu2 = valu2 - 8;
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
501 if (valu2 <= 0) {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
502 valu2 = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
503 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
504 }
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
505 if (bri == 1) {
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
506 valu += 64;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
507 }
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
508 ctx.writeByte(valu + valu2 * 8);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
509 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
510 }
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
511 else
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
512 return false;
90
dffafe05d520 Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents: 88
diff changeset
513
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
514 return true;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
515 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
516
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
517
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
518 bool mpExportMachinePRG(MPWriteCtx ctx)
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
519 {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
520 // any common text headers
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
521 ctx.comment("machine=" + str(machine) + " (" + g_name + ")");
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
522
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
523 if (machine == C64) { //C64 HIRES
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
524 ctx.loadTemplate("c64show.prg");
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
525
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
526 ctx.setOffs(0x0227);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
527 ctx.label("_bitmap");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
528 mpExportBitmapData(ctx, 40, 25);
95
517348a7b543 More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents: 94
diff changeset
529
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
530 ctx.comment("The following two first values are border and background");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
531 ctx.writeByteAt(0x2167, g_map[0]); //=border
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
532 ctx.writeByteAt(0x2168, g_map[1]); //=background mutta ei tarvita
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
533
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
534 ctx.setOffs(0x2169);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
535 mpExportColorData(ctx, 40, 25, 65536, 0);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
536
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
537 //c64show.prg
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
538 //offsets
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
539 //0x0227->bitmappi (40x25 x 8 bytee)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
540 //0x2167:borderi väri
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
541 //0x2169->värikartta (40x25 bytee, nyppelit foreg/backg)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
542 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
543 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
544 if (machine == C64M) { //C64 MULTICOLOR
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
545
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
546 ctx.loadTemplate("c64mshow.prg");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
547 ctx.setOffs(0x0239);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
548 mpExportBitmapData(ctx, 40, 25);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
549
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
550 // first color information
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
551 ctx.comment("The following two first values are border and background");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
552 ctx.writeByteAt(0x2179, g_map[0]);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
553 ctx.writeByteAt(0x217a, g_map[1]);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
554
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
555 ctx.setOffs(0x217B);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
556 mpExportColorData(ctx, 40, 25, 65536, 1);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
557
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
558 // second color information
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
559 ctx.setOffs(0x2563);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
560 ctx.comment("The following goes to $D800 onwards");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
561 mpExportColorData(ctx, 40, 25, 65536 + 2000, 2);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
562
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
563 //c64 multicolor
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
564 //offsets
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
565 //0x0239->bitmappi (40x25 x 8 bytee)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
566 //0x2179:borderi väri
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
567 //0x217A:bäkkis väri
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
568 //0x217B->värikartta 1 (40x25 bytee, nyppelit foreg/backg ilmeisesti)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
569 //0x2563->värikartta 2 (40x25 bytee, nyppeli 3-väri nepan osoitteessa $d800-)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
570 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
571 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
572 if (machine == PLUS4M) { //PLUS4 MULTICOLOR
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
573 ctx.loadTemplate("showpfourm.prg");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
574
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
575 ctx.line(".global _bitmap");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
576 ctx.line(".global _color1");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
577 ctx.line(".global _color2");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
578 ctx.line(".global _border");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
579 ctx.line(".global _back1");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
580 ctx.line(".global _back2");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
581
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
582 ctx.label("_bitmap");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
583 ctx.setOffs(0x013e);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
584 mpExportBitmapData(ctx, 40, 25);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
585
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
586 val1 = getpluscolor(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
587 val2 = getplusluminance(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
588 val3 = val2 * 16 + val1;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
589 ctx.label("_border");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
590 ctx.setOffs(0x207e);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
591 ctx.writeByte(val3);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
592
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
593 val1 = getpluscolor(int(g_map[1]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
594 val2 = getplusluminance(int(g_map[1]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
595 val3 = val2 * 16 + val1;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
596 ctx.label("_back1");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
597 ctx.setOffs(0x207f);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
598 ctx.writeByte(val3);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
599
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
600 val1 = getpluscolor(int(g_map[2]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
601 val2 = getplusluminance(int(g_map[2]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
602 val3 = val2 * 16 + val1;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
603 ctx.label("_back2");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
604 ctx.setOffs(0x2080);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
605 ctx.writeByte(val3);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
606
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
607 ctx.label("_color1");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
608 ctx.setOffs(0x2081);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
609 mpExportColorData(ctx, 40, 25, 65536, 6);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
610
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
611 ctx.label("_color2");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
612 ctx.setOffs(0x2469);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
613 mpExportColorData(ctx, 40, 25, 65536, 7);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
614
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
615 //plus4 multic
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
616 //0x013e bitmap (40 x 25 x 8)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
617 //0x207e border
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
618 //0x207f background 1
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
619 //0x2080 background 2
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
620 //0x2081 colors (40 x 25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
621 //0x2469 luminance (40 x 25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
622 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
623 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
624 if (machine == PLUS4) { // Plus 4 hires
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
625 ctx.loadTemplate("showpfour.prg");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
626
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
627 ctx.line(".global _bitmap");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
628 ctx.line(".global _color");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
629 ctx.line(".global _lumi");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
630 ctx.line(".global _border");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
631
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
632 ctx.setOffs(0x0137);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
633 mpExportBitmapData(ctx, 40, 25);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
634
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
635 val1 = getpluscolor(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
636 val2 = getplusluminance(int(g_map[0]));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
637 val3 = val2 * 16 + val1;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
638 ctx.setOffs(0x2077);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
639 ctx.writeByte(val3); //border
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
640
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
641 ctx.setOffs(0x2078);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
642 mpExportColorData(ctx, 40, 25, 65536, 4); //colors
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
643
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
644 ctx.setOffs(0x2460);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
645 mpExportColorData(ctx, 40, 25, 65536, 5); //lumis
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
646
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
647 //plus4 hires
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
648 //0x0137 bitmap (40 x 25 x 8)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
649 //0x2077 borderi
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
650 //0x2078 colors (40 x 25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
651 //0x2460 luminance (40 x 25)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
652 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
653 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
654 if (machine == MSX) { // MSX
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
655 ctx.loadTemplate("msxshow.com");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
656 ctx.line(".globl _bitmap,_nimi2");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
657 ctx.line(".area _CODE");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
658
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
659 ctx.setOffs(0x00f9);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
660 ctx.label("_bitmap");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
661 mpExportBitmapData(ctx, 32, 24);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
662
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
663
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
664 //ctx.writeByte(g_map[1]); //backg
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
665 //ctx.comment("The first following value is background");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
666 ctx.label("_nimi2");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
667 ctx.setOffs(0x18f9);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
668 mpExportColorData(ctx, 32, 24, 65536, 3); //there's an exception for msx-style
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
669
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
670 //msx comm
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
671 //0x00f9 bitmap (32x24 x 8 bytes)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
672 //0x18f9 background color
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
673 //0x18fa colors (32*24 bytes)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
674 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
675 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
676 if (machine == SPECTRUM) { // ZX Spectrum
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
677
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
678 //would need some cleaning up
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
679
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
680 // ctx.line(".area _DATA\n";
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
681 // ctx.line(".globl _taustakuva\n\n";
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
682 // ctx.label("_taustakuva");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
683 ctx.loadTemplate("specshow.tap");
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
684
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
685 int checksum = 0xc9;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
686 for (y = 0x1d24; y <= 0x1d3d; y++) { //1d3e
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
687 checksum = checksum ^ int(g_template[y]);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
688 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
689
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
690 //TAP requires fiddling with the checksum
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
691 //println("Checksum:"+hex(checksum,2));
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
692 ctx.setOffs(0x0223);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
693 ctx.byteDef();
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
694 ctx.writeByte(g_map[0]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
695 checksum = checksum ^ int(g_map[0]);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
696
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
697 for (int y = 0; y <= 2; y++)
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
698 for (int y2 = 0; y2 < 8; y2++)
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
699 for (int yy = 0; yy < 8; yy++)
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
700 {
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
701 for (int x = 0; x < 32; x++)
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
702 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
703 int yp = y * 64 + yy * 8 + y2,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
704 ad = 1024 + yp * 256 + x * 8,
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
705 valu =
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
706 g_map[ad + 0] * 128 +
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
707 g_map[ad + 1] * 64 +
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
708 g_map[ad + 2] * 32 +
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
709 g_map[ad + 3] * 16 +
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
710 g_map[ad + 4] * 8 +
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
711 g_map[ad + 5] * 4 +
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
712 g_map[ad + 6] * 2 +
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
713 g_map[ad + 7] * 1;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
714
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
715 ctx.writeByte(valu);
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
716 checksum = checksum ^ int(valu);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
717 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
718 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
719
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
720 ctx.comment("attributes");
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
721 for (int y = 0; y < 24; y++)
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
722 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
723 for (int x = 0; x < 32; x++)
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
724 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
725 int ad = 65536 + x + y * 256,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
726 valu = int(g_map[ad]),
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
727 valu2 = int(g_map[ad + MX * MY * 8]),
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
728 bri = 0;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
729
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
730 if (valu >= 8)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
731 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
732 bri = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
733 valu = valu - 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
734 valu2 = valu2 - 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
735 if (valu2 <= 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
736 valu2 = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
737 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
738 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
739 if (bri == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
740 valu = valu + 64;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
741 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
742
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
743 ctx.writeByte(valu + valu2 * 8);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
744 checksum = checksum ^ int(valu + valu2 * 8);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
745 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
746 }
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
747
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
748 //println("checksum:"+hex(checksum,2));
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
749 ctx.writeByteAt(0x1d3e, int(checksum));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
750 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
751 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
752 if (machine == CPC) {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
753 int val1, val2, val3, valu;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
754 ctx.loadTemplate("cpc-mode0.bin");
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
755
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
756 ctx.setOffs(69); //bitmap offset
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
757 ctx.label("_bitmap");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
758 mpExportBitmapData_CPC(ctx, 160, 200);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
759
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
760 //fixed # of palette entries, just trying to be generic
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
761 ctx.setOffs(16453);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
762 ctx.setBPL(g_maxcolors - 1);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
763 ctx.label("_palette");
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
764 for (int i = 0; i < g_maxcolors; i++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
765 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
766 val1 = int(g_g[i] / (256 / g_palsteps));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
767 val2 = int(g_r[i] / (256 / g_palsteps));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
768 val3 = int(g_b[i] / (256 / g_palsteps));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
769
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
770 ctx.writeByte(ctx, val1 * 9 + val2 * 3 + val3);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
771 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
772
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
773 valu = int(g_map[0]);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
774 val1 = int(g_g[valu] / (256 / g_palsteps));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
775 val2 = int(g_r[valu] / (256 / g_palsteps));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
776 val3 = int(g_b[valu] / (256 / g_palsteps));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
777
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
778 ctx.label("_border");
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
779 ctx.setOffs(16469);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
780 ctx.writeByte(val1 * 9 + val2 * 3 + val3);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
781
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
782 //cpc
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
783 //69 bitmap 16384 bytes
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
784 //16453 palette 16 bytes (0..26)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
785 //16469 border color (0..26)
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
786 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
787 else
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
788 return false;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
789
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
790 return true;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
791 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
792
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
793
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
794 void mpExportBitmapData_CPC(MPWriteCtx ctx, int xwid, int yy)
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
795 {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
796 int x, y, ad, val1, val2, y2;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
797 int pix0b0, pix0b1, pix0b2, pix0b3;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
798 int pix1b0, pix1b1, pix1b2, pix1b3;
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
799
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
800 ctx.setBPL(xwid / 2);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
801 ctx.byteDef();
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
802
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
803 for (y2 = 0; y2 < 8; y2++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
804 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
805 for (y = 0; y < 25; y++)
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
806 for (x = 0; x < int(xwid / 2); x++)
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
807 {
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
808 ad = 1024 + (y * 8) * X + (y2 * X) + x * 4;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
809
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
810 val1 = int(g_map[ad]);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
811 pix0b0 = 0;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
812 pix0b1 = 0;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
813 pix0b2 = 0;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
814 pix0b3 = 0;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
815 if ((val1 & 1) != 0) pix0b0 = 1;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
816 if ((val1 & 2) != 0) pix0b1 = 1;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
817 if ((val1 & 4) != 0) pix0b2 = 1;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
818 if ((val1 & 8) != 0) pix0b3 = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
819
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
820 val1 = int(g_map[ad + 2]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
821
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
822 pix1b0 = 0;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
823 pix1b1 = 0;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
824 pix1b2 = 0;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
825 pix1b3 = 0;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
826 if ((val1 & 1) != 0) pix1b0 = 1;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
827 if ((val1 & 2) != 0) pix1b1 = 1;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
828 if ((val1 & 4) != 0) pix1b2 = 1;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
829 if ((val1 & 8) != 0) pix1b3 = 1;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
830
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
831 val2 = pix1b3 + pix0b3 * 2 + pix1b1 * 4 + pix0b1 * 8 + pix1b2 * 16 + pix0b2 * 32 + pix1b0 * 64 + pix0b0 * 128;
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
832
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
833 ctx.writeByte(val2);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
834 }
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
835
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
836 ctx.byteDef();
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
837 for (int j = 0; j <= 47; j++)
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
838 ctx.writeByte(0);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
839 ctx.eol();
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
840 }
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
841 ctx.eod();
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
842 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
843
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
844
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
845 void mpExportBitmapData(MPWriteCtx ctx, int xx, int yy)
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
846 {
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
847 int linep = 0,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
848 xwid = xx * 8,
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
849 ywid = yy * 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
850
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
851 ctx.setBPL(64);
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
852 ctx.byteDef();
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
853 for (int y = 0; y < yy; y++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
854 for (int x = 0; x < xx; x++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
855 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
856 for (int y2 = 0; y2 < 8; y2++)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
857 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
858 int ad = 1024 + y * (xwid * 8) + (y2 * xwid) + x * 8;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
859 int value =
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
860 g_map[ad + 0] * 128 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
861 g_map[ad + 1] * 64 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
862 g_map[ad + 2] * 32 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
863 g_map[ad + 3] * 16 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
864 g_map[ad + 4] * 8 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
865 g_map[ad + 5] * 4 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
866 g_map[ad + 6] * 2 +
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
867 g_map[ad + 7] * 1;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
868
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
869 ctx.writeByte(int(value));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
870 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
871 }
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
872 ctx.eod();
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
873 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
874
86
6e5b619861c8 Rename two more functions.
Matti Hamalainen <ccr@tnsp.org>
parents: 85
diff changeset
875
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
876 int convertluminance(int l, int f)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
877 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
878 int res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
879 if (f == 0) return 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
880 if (l == 0) res = 0 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
881 if (l == 1) res = 15 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
882 if (l == 2) res = 30 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
883 if (l == 3) res = 45 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
884 if (l == 4) res = 60 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
885 if (l == 5) res = 75 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
886 if (l == 6) res = 90 + f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
887 if (l == 7) res = 105 + f;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
888 return res;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
889 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
890
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
891
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
892 int getplusluminance(int c)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
893 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
894 int res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
895 if (c == 0) res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
896 if (c >= 1 && c <= 15) res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
897 if (c >= 16 && c <= 30) res = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
898 if (c >= 31 && c <= 45) res = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
899 if (c >= 46 && c <= 60) res = 3;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
900 if (c >= 61 && c <= 75) res = 4;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
901 if (c >= 76 && c <= 90) res = 5;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
902 if (c >= 91 && c <= 105) res = 6;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
903 if (c >= 106 && c <= 120) res = 7;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
904 return res;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
905 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
906
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
907
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
908 int getpluscolor(int c)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
909 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
910 int res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
911 if (c == 0) res = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
912 if (c >= 1 && c <= 15) res = c;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
913 if (c >= 16 && c <= 30) res = c - 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
914 if (c >= 31 && c <= 45) res = c - 30;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
915 if (c >= 46 && c <= 60) res = c - 45;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
916 if (c >= 61 && c <= 75) res = c - 60;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
917 if (c >= 76 && c <= 90) res = c - 75;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
918 if (c >= 91 && c <= 105) res = c - 90;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
919 if (c >= 106 && c <= 120) res = c - 105;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
920 return res;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
921 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
922
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
923
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
924 void mpExportColorData(MPWriteCtx ctx, int width, int height, int srcoffs, int param)
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
925 {
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
926 int xmult, myrpsi;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
927
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
928 myrpsi = 0;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
929
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
930 if (param == 0 || param == 3 || param == 4 || param == 5)
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
931 xmult = width * 8;
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
932 else
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
933 xmult = width;
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
934
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
935 if (machine == MSX) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
936 myrpsi = 7;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
937 }
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
938
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
939 for (int yc = 0; yc < height; yc++)
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
940 {
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
941 ctx.byteDef();
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
942 for (int xc = 0; xc < width; xc++)
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
943 for (int yline = 0; yline <= myrpsi; yline++)
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
944 {
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
945 int valu1, valu2, ad = srcoffs + xc + yc * xmult + yline * width;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
946
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
947 switch (param)
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
948 {
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
949 case 0:
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
950 valu1 = int(g_map[ad]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
951 valu2 = int(g_map[ad + MX * MY * 8]);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
952 break;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
953
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
954 case 1:
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
955 valu2 = int(g_map[ad]);
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
956 valu1 = int(g_map[ad + 1000]);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
957 break;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
958
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
959 case 2:
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
960 valu2 = int(g_map[ad]);
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
961 valu1 = 0;
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
962 break;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
963
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
964 case 3:
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
965 valu1 = int(g_map[ad]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
966 valu2 = int(g_map[ad + MX * MY * 8]);
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
967 break;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
968
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
969 case 4:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
970 //plus4 colortable
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
971 valu1 = getpluscolor(int(g_map[ad]));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
972 valu2 = getpluscolor(int(g_map[ad + MX * MY * 8]));
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
973 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
974
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
975 case 5:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
976 //plus4 lumitable
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
977 valu1 = getplusluminance(int(g_map[ad + MX * MY * 8]));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
978 valu2 = getplusluminance(int(g_map[ad]));
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
979 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
980
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
981 case 6:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
982 //plus4 multic1
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
983 valu2 = getpluscolor(int(g_map[ad]));
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
984 valu1 = getpluscolor(int(g_map[ad + 1000]));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
985 break;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
986
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
987 case 7:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
988 //plus4 multic2
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
989 valu1 = getplusluminance(int(g_map[ad]));
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
990 valu2 = getplusluminance(int(g_map[ad + 1000]));
91
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
991 break;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
992
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
993 default:
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
994 return null;
892a06169bb5 Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents: 90
diff changeset
995 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
996
124
68e8d86c9eef Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents: 122
diff changeset
997 ctx.writeByte(valu1 * 16 + valu2);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
998 }
122
ffa6533584ca Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents: 121
diff changeset
999 ctx.eol();
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1000 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1001 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1002
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1003
117
44a07b1c620d Rename 'bool' -> 'boolean'.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
1004 boolean mpImportFromImage(PImage image)
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1005 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1006 if (image == null)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1007 return false;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1008
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1009 if (image.width <= 16 || image.height <= 16)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1010 return false;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1011
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1012 int balx, baly, xx, yy, x2, y2, rr, gg, bb, avg, molox, i, j, target;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1013 int cx, cy;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1014 int aas, bbs, swap, idefix, avx, avy;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1015 int[] pixut = new int[260];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1016 int[] idx = new int[260];
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1017 int[] histog = new int[8192];
14
cecc594d1559 Remove unused code and variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 12
diff changeset
1018 float ww, hh, fld, compa;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1019 color c;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1020 int xcolors, limitter, vertti, erkki;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1021 int rh, gh, bh;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1022
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1023 xcolors = g_maxcolors;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1024 vertti = 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1025 erkki = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1026 limitter = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1027 if (g_britemode == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1028 xcolors = 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1029 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1030 if (g_attrimode == 0) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1031 vertti = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1032 erkki = 8;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1033 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1034 if (g_multic == 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1035 limitter = 4;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1036 } //because zero color can be anywhere?
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1037 if (g_multic == 2) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1038 limitter = 16;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1039 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1040 molox = 1;
6
07ddf9cfc6c2 Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents: 5
diff changeset
1041 command(int('O')); //special clear screen
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1042 if (g_multic == 1 || g_hzoomer == 2) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1043 molox = 2;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1044 }
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1045
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1046 balx = int(image.width / X) * molox;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1047 baly = int(image.height / Y);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1048 if (balx < 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1049 balx = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1050 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1051 if (baly < 1) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1052 baly = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1053 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1054
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1055 if (g_palsteps > 0)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1056 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1057 for (i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1058 makecolor(i, 0, 0, 0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1059 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1060
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1061 int maxhis, palls, psteps;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1062 psteps = int(g_palsteps - 1);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1063 maxhis = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1064 palls = int(255 / psteps);
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1065
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1066 for (cy = 0; cy < MY * erkki; cy++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1067 for (cx = 0; cx < MX; cx++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1068 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1069 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1070 {
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1071 x2 = int(image.width / X) * xx;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1072 y2 = int(image.height / Y) * yy;
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1073 rr = 0;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1074 gg = 0;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1075 bb = 0;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1076 avg = 0;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1077
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1078 for (avy = 0; avy < baly; avy++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1079 for (avx = 0; avx < balx; avx++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1080 c = image.get(x2 + avx, y2 + avy);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1081 rr = rr + int(red(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1082 gg = gg + int(green(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1083 bb = bb + int(blue(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1084 avg++;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1085 }
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1086 }
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1087
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1088 rh = rr / (avg);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1089 gh = gg / (avg);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1090 bh = bb / (avg);
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1091
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1092 rh = int(rh) / palls;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1093 gh = int(gh) / palls;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1094 bh = int(bh) / palls;
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1095 histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)]++;
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1096
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1097 if (histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)] > maxhis) {
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1098 maxhis = histog[int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh)];
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1099 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1100 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1101
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1102 int step = 0;
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1103 for (j = maxhis; j > 0; j--)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1104 for (i = 0; i <= 4096; i++)
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1105 {
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1106 if (histog[i] == j)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1107 {
87
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1108 rh = i / int(g_palsteps * g_palsteps);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1109 gh = i - int(rh * (g_palsteps * g_palsteps));
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1110 gh = gh / int(g_palsteps);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1111 bh = i - int(rh * (g_palsteps * g_palsteps));
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1112 bh = bh - int(gh * g_palsteps);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1113 rh = rh * int(palls);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1114 gh = gh * int(palls);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1115 bh = bh * int(palls);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1116 if (step < g_maxcolors) {
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1117 makecolor(step, rh, gh, bh);
8dd5146c881f Indentation cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 86
diff changeset
1118 step++;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1119 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1120 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1121 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1122 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1123
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1124 for (cy = 0; cy < MY * erkki; cy++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1125 for (cx = 0; cx < MX; cx++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1126 for (i = 0; i < xcolors; i++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1127 pixut[i] = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1128 idx[i] = i;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1129 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1130 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1131 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1132 x2 = int(image.width / X) * xx;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1133 y2 = int(image.height / Y) * yy;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1134 rr = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1135 gg = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1136 bb = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1137 avg = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1138 for (avy = 0; avy < baly; avy++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1139 for (avx = 0; avx < balx; avx++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1140 c = image.get(x2 + avx, y2 + avy);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1141 rr = rr + int(red(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1142 gg = gg + int(green(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1143 bb = bb + int(blue(c));
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1144 avg++;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1145 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1146 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1147 rr = rr / (avg);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1148 gg = gg / (avg);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1149 bb = bb / (avg);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1150 g_farge = 0;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1151 target = -1;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1152 compa = 9999;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1153 for (i = 0; i < xcolors; i++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1154 fld = dist(rr, gg, bb, g_r[i], g_g[i], g_b[i]);
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1155 if (fld < compa) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1156 compa = fld;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1157 target = i;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1158 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1159 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1160
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1161 g_farge = target;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1162 pixut[target]++; //histogramming
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1163 }
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1164 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1165
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1166 for (aas = 0; aas < xcolors; aas++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1167 for (bbs = 0; bbs <= aas; bbs++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1168 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1169 if (pixut[aas] > pixut[bbs])
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1170 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1171 swap = pixut[aas];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1172 pixut[aas] = pixut[bbs];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1173 pixut[bbs] = swap;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1174 swap = idx[aas];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1175 idx[aas] = idx[bbs];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1176 idx[bbs] = swap;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1177 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1178 }
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1179
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1180 for (idefix = 0; idefix < limitter; idefix++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1181 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1182 i = idx[idefix];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1183 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1184 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1185 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox)
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1186 {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1187 x2 = int(image.width / X) * xx;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1188 y2 = int(image.height / Y) * yy;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1189
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1190 rr = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1191 gg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1192 bb = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1193 avg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1194 for (avy = 0; avy < baly; avy++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1195 for (avx = 0; avx < balx; avx++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1196 c = image.get(x2 + avx, y2 + avy);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1197 rr = rr + int(red(c));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1198 gg = gg + int(green(c));
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1199 bb = bb + int(blue(c));
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1200 avg++;
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1201 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1202 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1203 rr = rr / (avg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1204 gg = gg / (avg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1205 bb = bb / (avg);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1206 g_farge = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1207 target = -1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1208 compa = 9999;
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1209 for (j = 0; j < limitter; j++) {
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1210 fld = dist(rr, gg, bb, g_r[idx[j]], g_g[idx[j]], g_b[idx[j]]);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1211 if (fld < compa) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1212 compa = fld;
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1213 target = idx[j];
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1214 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1215 }
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1216 if (i == target) {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1217
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1218 g_farge = target;
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1219 makepoint(xx, yy);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1220 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1221 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1222 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1223
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1224 if (idefix == 0) {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1225 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1226 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + molox) {
92
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1227 g_farge = idx[0];
4161d798cb64 Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents: 91
diff changeset
1228 makepoint(xx, yy);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1229 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1230 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1231 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1232 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1233 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1234 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1235
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1236
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1237 void mpRenderToImageAt(PImage output, int xoffs, int yoffs)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1238 {
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1239 if (output == null)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1240 return;
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1241
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1242 for (int yy = 0; yy < output.width; yy++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1243 for (int xx = 0; xx < output.width; xx++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1244 {
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1245 color c = color(g_r[259], g_g[259], g_b[259]);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1246 output.set(xx, yy, c);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1247 }
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1248
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1249 for (int yy = 0; yy < Y; yy++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1250 for (int xx = 0; xx < X; xx++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1251 {
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1252 int f;
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1253 if (g_multic == 1 || g_hzoomer == 2)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1254 f = getmultic(chop2(xx), yy, 0);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1255 else
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1256 f = getabsa(xx, yy, 0);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1257
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1258 if (machine == MSX && f == 0)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1259 f = g_map[1];
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1260
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1261 color c = color(g_r[f], g_g[f], g_b[f]);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1262
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1263 for (int vertti = 0; vertti <= g_omag; vertti++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1264 for (int mortti = 0; mortti <= g_omag; mortti++)
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1265 {
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1266 output.set(
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1267 xx * g_omag + xoffs + mortti,
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1268 yy * g_omag + yoffs + vertti,
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1269 c);
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1270 }
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1271 }
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1272 }
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1273
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1274
117
44a07b1c620d Rename 'bool' -> 'boolean'.
Matti Hamalainen <ccr@tnsp.org>
parents: 95
diff changeset
1275 PImage mpRenderImage(boolean border)
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1276 {
94
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1277 PImage output;
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1278
94
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1279 if (border)
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1280 {
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1281 pimage = createImage(
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1282 X * g_omag + g_bordh * g_omag,
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1283 Y * g_omag + g_bordv * g_omag,
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1284 RGB);
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1285
94
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1286 mpRenderToImageAt(output, int((g_bordh * g_omag) / 2), int((g_bordv * g_omag) / 2));
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1287 }
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1288 else
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1289 {
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1290 output = createImage(X * g_omag, Y * g_omag, RGB);
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1291 mpRenderToImageAt(output, 0, 0);
6e74d45ea620 More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents: 92
diff changeset
1292 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1293
88
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1294 return output;
03823fa2cb01 Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents: 87
diff changeset
1295 }
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1296
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1297
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1298 void make_c64_palette() {
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1299 // Pepto's murky C64 palette: http://www.pepto.de/projects/colorvic
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1300 int rgb[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1301 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1302 0xffFFFFFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1303 0xff68372B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1304 0xff70A4B2,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1305 0xff6F3D86,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1306 0xff588D43,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1307 0xff352879,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1308 0xffB8C76F,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1309 0xff6F4F25,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1310 0xff433900,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1311 0xff9A6759,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1312 0xff444444,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1313 0xff6C6C6C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1314 0xff9AD284,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1315 0xff6C5EB5,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1316 0xff959595
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1317 };
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1318 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1319 rgb[i] = rgb[i] & 0xffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1320 g_grids[i] = rgb[i] + 0xff282828;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1321 makecolor(i, rgb[i] >> 16, (rgb[i] & 0xff00FF00) >> 8, rgb[i] & 0xff0000FF);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1322 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1323 g_grids[1] = 0xffd0d0d0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1324 g_gridmode = NEW;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1325 g_map[13] = byte(C64);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1326 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1327
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1328 void make_plus4_palette() {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1329 int rgb[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1330 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1331 0xff2C2C2C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1332 0xff621307,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1333 0xff00424C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1334 0xff510378,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1335 0xff004E00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1336 0xff27188E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1337 0xff303E00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1338 0xff582100,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1339 0xff463000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1340 0xff244400,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1341 0xff630448,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1342 0xff004E0C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1343 0xff0E2784,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1344 0xff33118E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1345 0xff184800,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1346 0xff3B3B3B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1347 0xff702419,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1348 0xff00505A,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1349 0xff601685,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1350 0xff125D00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1351 0xff36289B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1352 0xff3F4C00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1353 0xff663100,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1354 0xff553F00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1355 0xff345200,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1356 0xff711656,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1357 0xff005C1D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1358 0xff1F3691,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1359 0xff42229B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1360 0xff285700,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1361 0xff424242,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1362 0xff772C21,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1363 0xff055861,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1364 0xff661E8C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1365 0xff1B6400,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1366 0xff3E30A2,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1367 0xff475400,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1368 0xff6D3900,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1369 0xff5C4700,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1370 0xff3B5900,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1371 0xff771F5D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1372 0xff046325,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1373 0xff273E98,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1374 0xff492AA1,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1375 0xff305E00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1376 0xff515151,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1377 0xff843B31,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1378 0xff17656F,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1379 0xff742E99,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1380 0xff2B7100,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1381 0xff4C3FAF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1382 0xff556200,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1383 0xff7A4709,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1384 0xff6A5500,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1385 0xff4A6700,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1386 0xff852F6B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1387 0xff177135,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1388 0xff364CA5,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1389 0xff5739AE,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1390 0xff3F6B00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1391 0xff7A7A7A,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1392 0xffAC665C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1393 0xff468E97,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1394 0xff9C5AC0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1395 0xff57992E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1396 0xff766AD5,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1397 0xff7E8A13,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1398 0xffA2713A,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1399 0xff927E20,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1400 0xff748F14,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1401 0xffAC5A93,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1402 0xff459960,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1403 0xff6276CB,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1404 0xff8064D4,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1405 0xff6A9419,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1406 0xff959595,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1407 0xffC58178,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1408 0xff62A8B1,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1409 0xffB675D9,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1410 0xff73B34C,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1411 0xff9185ED,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1412 0xff99A433,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1413 0xffBB8C57,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1414 0xffAC993E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1415 0xff8FAA34,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1416 0xffC676AD,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1417 0xff62B37B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1418 0xff7D91E4,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1419 0xff9B80ED,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1420 0xff85AE38,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1421 0xffAFAFAF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1422 0xffDE9B93,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1423 0xff7DC2CA,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1424 0xffCF90F2,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1425 0xff8DCD68,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1426 0xffAB9FFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1427 0xffB3BE51,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1428 0xffD5A673,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1429 0xffC6B35B,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1430 0xffA9C351,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1431 0xffDF91C7,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1432 0xff7DCC96,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1433 0xff97ABFD,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1434 0xffB59AFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1435 0xff9FC755,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1436 0xffE1E1E1,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1437 0xffFFCFC6,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1438 0xffB2F4FC,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1439 0xffFFC4FF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1440 0xffC1FE9D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1441 0xffDDD2FF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1442 0xffE5F088,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1443 0xffFFD9A8,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1444 0xffF7E591,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1445 0xffDBF588,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1446 0xffFFC4F9,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1447 0xffB1FEC9,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1448 0xffCBDDFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1449 0xffE7CDFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1450 0xffD2F98C
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1451 };
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1452 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1453 rgb[i] = rgb[i] & 0xffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1454 makecolor(i, rgb[i] >> 16, (rgb[i] & 0xff00FF00) >> 8, rgb[i] & 0xff0000FF);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1455 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1456 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1457
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1458 void make_msx_palette() {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1459 int rgb[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1460 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1461 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1462 0xff3EB849,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1463 0xff74D07D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1464 0xff5955E0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1465 0xff8076F1,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1466 0xffB95E51,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1467 0xff65DBEF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1468 0xffDB6559,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1469 0xffFF897D,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1470 0xffCCC35E,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1471 0xffDED087,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1472 0xff3AA241,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1473 0xffB766B5,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1474 0xffCCCCCC,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1475 0xffFFFFFF
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1476 };
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1477
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1478 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1479 rgb[i] = rgb[i] & 0xffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1480 g_grids[i] = rgb[i] + 0xff1f1f1f;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1481 makecolor(i, (rgb[i] >> 16), (rgb[i] & 0xff00FF00) >> 8, rgb[i] & 0xff0000FF);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1482 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1483 g_grids[5] = 0xff9f95Ff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1484 g_grids[7] = 0xff84faEF;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1485 g_grids[9] = 0xffffa99d;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1486 g_grids[15] = 0xffd8d8d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1487 g_gridmode = NEW;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1488 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1489
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1490 void make_spectrum_palette() {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1491 int rgb[] = {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1492 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1493 0xff0000C0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1494 0xffC00000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1495 0xffC000C0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1496 0xff00C000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1497 0xff00C0C0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1498 0xffC0C000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1499 0xffC0C0C0,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1500 0xff000000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1501 0xff0000FF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1502 0xffFF0000,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1503 0xffFF00FF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1504 0xff00FF00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1505 0xff00FFFF,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1506 0xffFFFF00,
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1507 0xffFFFFFF
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1508 };
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1509
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1510 g_grids[9] = 0xff0000d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1511 g_grids[10] = 0xffd80000;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1512 g_grids[11] = 0xffd800d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1513 g_grids[12] = 0xff00d800;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1514 g_grids[13] = 0xff00d8d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1515 g_grids[14] = 0xffd8d800;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1516 g_grids[15] = 0xffd8d8d8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1517 for (int i = 0; i < g_maxcolors; i++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1518 rgb[i] = rgb[i] & 0xffffff;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1519 if (i <= 8) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1520 g_grids[i] = rgb[i] + 0xff282828;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1521 }
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1522 makecolor(i, (rgb[i] >> 16), (rgb[i] & 0xff00FF00) >> 8, rgb[i] & 0xff0000FF);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1523 }
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1524 g_gridmode = NEW;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1525 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1526
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1527
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1528 void mpSetupMachine(int m)
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1529 {
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1530 machine = m;
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1531 g_exportext = "none";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1532 g_map[3] = byte(machine);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1533 g_map[13] = byte(machine);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1534 g_palsteps = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1535 g_farge = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1536 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1537 g_britemode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1538 g_charlimit = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1539 g_hzoomer = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1540 g_backmode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1541 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1542 g_formatext = "";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1543 g_maxcolors = 16;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1544 X = 320;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1545 Y = 200;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1546
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1547 if (machine == C64) { //c64 hires
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1548 g_name = "c64";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1549 g_exportext = "prg";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1550 g_exportname = "PRG file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1551 g_formatname = "Art Studio";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1552 g_formatext = "art";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1553
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1554 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1555 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1556 g_map[0] = 6;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1557 make_c64_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1558 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1559 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1560 if (machine == CPC) { //Amstrad CPC mode 0
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1561 g_name = "cpc";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1562 g_exportext = "bin";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1563 g_exportname = "BIN file"
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1564 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1565 g_formatext = "";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1566
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1567 g_hzoomer = 2;
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1568 g_palsteps = 3;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1569 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1570 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1571 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1572 g_map[0] = 1;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1573
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1574 makecolor(0, 0, 0, 0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1575 makecolor(1, 0x0, 0x0, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1576 makecolor(2, 0x00, 0x00, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1577 makecolor(3, 0x80, 0x00, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1578 makecolor(4, 0x80, 0x00, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1579 makecolor(5, 0x80, 0x00, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1580 makecolor(6, 0xFF, 0x00, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1581 makecolor(7, 0xFF, 0x00, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1582 makecolor(8, 0xFF, 0x00, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1583 makecolor(9, 0x00, 0x80, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1584 makecolor(10, 0x00, 0x80, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1585 makecolor(11, 0x00, 0x80, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1586 makecolor(12, 0x80, 0x80, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1587 makecolor(13, 0x80, 0x80, 0x80);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1588 makecolor(14, 0x80, 0x80, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1589 makecolor(15, 0xFF, 0xFF, 0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1590 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1591 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1592 if (machine == MSX) { // MSX
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1593 g_name = "msx";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1594 g_exportext = "com";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1595 g_exportname = "COM file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1596 g_formatname = "Screen 2";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1597 g_formatext = "sc2";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1598
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1599 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1600 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1601 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1602 g_backmode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1603 g_farge = 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1604 g_backg = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1605
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1606 //TI99 variant
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1607 /*
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1608 makecolor(0,0,0,0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1609 makecolor(1,0,0,0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1610
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1611 makecolor(2,0x21,0xc8,0x42); //21c842 medgreen
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1612 makecolor(3,0x5e,0xdc,0x78);//5edc78 light green
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1613 makecolor(4,0x54,0x55,0xed);//5455ed dark blue
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1614 makecolor(5,0x7d,0x76,0xFc);//7d76fc light blue
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1615
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1616 makecolor(6,0xd4,0x52,0x4d); //d4524d dark red
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1617 makecolor(7,0x42,0xeb,0xf5); //42ebf5 cyan
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1618 makecolor(8,0xfc,0x55,0x54); //fc5554 medium red
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1619 makecolor(9,0xff,0x79,0x78); //ff7978 light red
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1620 makecolor(10,0xd4,0xc1,0x54);// d4c154 dark yellow
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1621 makecolor(11,0xe6,0xce,0x80);// e6ce80 light yellow
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1622 makecolor(12,0x21,0xb0,0x3b);// 21b03b dark green
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1623 makecolor(13,0xc9,0x5b,0xba);// c95bba magenta
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1624 makecolor(14,0xCc,0xcc,0xCc);// gray
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1625 makecolor(15,0xFF,0xFF,0xFF);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1626 */
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1627 make_msx_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1628 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1629 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1630 if (machine == SPECTRUM) { // ZX Spectrum
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1631 g_name = "spec";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1632 g_exportext = "tap";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1633 g_exportname = "TAP file";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1634 g_formatname = "Screen$";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1635 g_formatext = "scr";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1636
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1637 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1638 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1639 g_farge = 7;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1640 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1641 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1642 g_britemode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1643 g_map[0] = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1644 g_map[1] = byte(255);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1645 make_spectrum_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1646 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1647 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1648 if (machine == TIMEX) { // timex sinclair
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1649 g_name = "tmx";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1650
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1651 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1652 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1653 g_farge = 7;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1654 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1655 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1656 g_britemode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1657 g_map[1] = byte(255);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1658 make_spectrum_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1659 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1660 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1661 if (machine == JR200) { // Panasonic JR200
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1662 g_name = "jr200";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1663
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1664 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1665 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1666 g_maxcolors = 8;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1667 g_farge = 7;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1668 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1669 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1670 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1671 make_spectrum_palette(); //cheating
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1672 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1673 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1674 if (machine == PLUS4M || machine == PLUS4) { // Commodore plus/4
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1675 g_name = "plus4m";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1676 g_exportext = "prg";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1677 g_exportname = "PRG file";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1678 g_formatname = "M.Botticelli";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1679 g_formatext = "prg";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1680
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1681 g_backmode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1682 g_multic = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1683 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1684 g_maxcolors = 121;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1685 g_charlimit = 2;
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1686 g_map[0] = 6;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1687 g_map[1] = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1688 g_map[2] = 61;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1689 g_farge = 61;
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1690
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1691 if (machine == PLUS4) { // plus/4 hires
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1692 g_name = "plus4";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1693 g_formatname = "Botticelli";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1694 g_formatext = "prg";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1695 g_multic = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1696 g_backmode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1697 g_charlimit = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1698 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1699 g_map[1] = byte(255);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1700 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1701 make_plus4_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1702 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1703 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1704 if (machine == C64M) { //c64 multicolor
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1705 g_name = "c64m";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1706 g_exportext = "prg";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1707 g_exportname = "PRG file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1708 g_formatname = "A. A. Studio";
68
59731a72ce8b Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents: 61
diff changeset
1709 g_formatext = "ocp";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1710
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1711 g_backmode = 1;
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1712 g_charlimit = 3;
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1713 g_multic = 1;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1714 g_attrimode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1715 g_map[1] = byte(0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1716 g_map[0] = 6;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1717 make_c64_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1718 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1719 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1720 if (machine == AMIGA) { //generic 16bit
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1721 g_name = "test";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1722 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1723 g_exportname = "";
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1724 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1725 g_formatext = "";
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1726
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1727 g_backmode = 1;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1728 g_maxcolors = 32;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1729 g_palsteps = 16;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1730 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1731 g_attrimode = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1732 g_map[1] = byte(0);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1733 for (int z = 0; z < g_maxcolors; z++) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1734 if (z < 16) {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1735 makecolor(z, z * 17, z * 17, z * 17);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1736 } else {
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1737 makecolor(z, (z - 16) * 17, 0, 0);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1738 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1739 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1740 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1741 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1742 if (machine == C64FLI) { //c64 hires FLI = AFLI
49
2d9a674bdeb2 Random cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 29
diff changeset
1743 g_name = "afli";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1744 g_exportext = "prg";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1745 g_exportname = "PRG file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1746 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1747 g_formatext = "";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1748
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1749 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1750 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1751 g_map[0] = 6;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1752 make_c64_palette();
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1753 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1754 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1755 if (machine == C64FLIM) { //C64 FLI multicolor
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1756 g_name = "fli";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1757 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1758 g_exportname = "PRG file";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1759 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1760 g_formatext = "";
12
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1761
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1762 g_hzoomer = 2;
a0a00f80b042 Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents: 11
diff changeset
1763 g_maxcolors = 16;
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1764 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1765 g_attrimode = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1766 g_map[1] = byte(255);
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1767 g_map[0] = 6;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1768 make_c64_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1769 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1770 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1771 if (machine == FAKEX) { // Fake 8-bit computer
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1772 g_name = "fake";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1773 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1774 g_exportname = "";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1775 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1776 g_formatext = "";
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
1777
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1778 X = 320;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1779 Y = 200;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1780 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1781 g_attrimode = 2; //g_palsteps=4;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1782 g_farge = 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1783 g_backg = 0;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1784 make_c64_palette();
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1785 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1786 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1787 if (machine == PICO8) { // Pico-8 fantasy console
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1788 g_name = "pico8";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1789 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1790 g_exportname = "";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1791 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1792 g_formatext = "";
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
1793
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1794 X = 128;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1795 Y = 128;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1796 g_farge = 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1797 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1798 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1799 g_attrimode = 2;
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1800 makecolor(0, 0, 0, 0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1801 makecolor(1, 32, 51, 123);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1802 makecolor(2, 126, 37, 83);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1803 makecolor(3, 0, 144, 61);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1804 makecolor(4, 171, 82, 54);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1805 makecolor(5, 52, 54, 53);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1806 makecolor(6, 194, 195, 199);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1807 makecolor(7, 255, 241, 232);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1808 makecolor(8, 255, 0, 77);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1809 makecolor(9, 255, 155, 0);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1810 makecolor(10, 255, 231, 39);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1811 makecolor(11, 0, 226, 50);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1812 makecolor(12, 41, 173, 255);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1813 makecolor(13, 132, 112, 169);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1814 makecolor(14, 255, 119, 168);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1815 makecolor(15, 255, 214, 197);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1816 }
81
7ee5e0c590bd Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents: 78
diff changeset
1817 else
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1818 if (machine == UNIA) { // Unia digital palette
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1819 g_name = "unia";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1820 g_exportext = "";
51
f9da5fe9a891 Define g_exportname for name of the format that the export is done in.
Matti Hamalainen <ccr@tnsp.org>
parents: 50
diff changeset
1821 g_exportname = "";
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1822 g_formatname = "";
50
8ba88c25f51d Rename some variables.
Matti Hamalainen <ccr@tnsp.org>
parents: 49
diff changeset
1823 g_formatext = "";
11
c1667eb54808 Cosmetics and indentation.
Matti Hamalainen <ccr@tnsp.org>
parents: 8
diff changeset
1824
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1825 X = 256;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1826 Y = 192;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1827 g_farge = 15;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1828 g_backg = 0;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1829 g_multic = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1830 g_attrimode = 2;
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1831 makecolor(0, 0, 0, 0);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1832 makecolor(1, 0xff, 0xff, 0xff);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1833 makecolor(2, 0xff, 0xfd, 0x38);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1834 makecolor(3, 0xff, 0xc5, 0x00);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1835 makecolor(4, 0xff, 0x00, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1836 makecolor(5, 0xff, 0x3c, 0xb4);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1837 makecolor(6, 0xa0, 0x23, 0xbc);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1838 makecolor(7, 0x1b, 0xa1, 0xfc);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1839 makecolor(8, 0xe1, 0xe1, 0xe1);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1840 makecolor(9, 0xb9, 0x63, 0x00);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1841 makecolor(10, 0xff, 0xaa, 0xbe);
2
5eb3559e1778 Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 1
diff changeset
1842 makecolor(11, 0xd2, 0x9b, 0xd7);
0
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1843 makecolor(12, 0xad, 0xad, 0xad);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1844 makecolor(13, 0x00, 0xb7, 0xb7);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1845 makecolor(14, 0x23, 0xaf, 0x32);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1846 makecolor(15, 0x29, 0xf7, 0xa7);
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1847 }
ebd5689e2985 Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff changeset
1848 }