Mercurial > hg > forks > multipaint-js
annotate exporters.pde @ 154:1b2cbf3ab441
Cleanups.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 16 Aug 2018 13:00:03 +0300 |
parents | f5c32f6470d0 |
children | c9515fd7d897 |
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 // |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
6 |
49 | 7 |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
8 public class MPWriteCtx |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
9 { |
126 | 10 public int m_offs, m_bpl, m_bytes, m_indent, m_state, m_intmode; |
11 public String m_byteDef, m_eol, m_src, m_prefix; | |
12 public byte[] m_data; | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
13 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
14 MPWriteCtx() |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
15 { |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
16 m_offs = 0; |
126 | 17 m_data = new byte[1*1024]; |
18 | |
19 setBPLOff(); | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
20 m_bytes = 0; |
126 | 21 m_state = -1; |
22 | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
23 m_indent = 4; |
126 | 24 |
121
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"; |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
28 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
29 m_intmode = 0; |
126 | 30 m_prefix = ""; |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
31 } |
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 void setOffs(int 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 m_offs = offs; |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
36 } |
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 void setBPL(int 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 m_bpl = bpl; |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
41 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
42 |
126 | 43 void setBPLOff() |
44 { | |
45 m_bpl = -1; | |
46 } | |
47 | |
48 void loadTemplate(String fname) | |
49 { | |
50 m_data = mpLoadBinaryFile("templates/" + fname); | |
51 } | |
52 | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
53 byte[] getData() |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
54 { |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
55 return m_data; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
56 } |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
57 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
58 byte[] getSource() |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
59 { |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
60 return m_src; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
61 } |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
62 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
63 String getHexValue(int dval, int dlen) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
64 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
65 static final String mpHexChars[16] = "0123456789abcdef"; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
66 char[] dstr = new char[dlen]; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
67 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
68 for (i = dlen - 1; i >= 0; i--) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
69 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
70 dstr[i] = mpHexChars[dval & 0x0f]; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
71 dval >>= 4; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
72 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
73 |
129 | 74 return dstr.join(''); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
75 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
76 |
126 | 77 String getByteStr(int val) |
78 { | |
79 switch (m_intmode) | |
80 { | |
81 case 0: return str(val & 0xff); | |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
82 case 1: return "$"+ getHexValue(val & 0xff, 2); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
83 case 2: return getHexValue(val & 0xff, 2) +"h"; |
126 | 84 } |
85 } | |
86 | |
87 void addIndent() | |
88 { | |
89 for (int n = 0; n < m_indent; n++) | |
90 m_src += " "; | |
91 } | |
92 | |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
93 void addByteSep() |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
94 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
95 m_src += ","; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
96 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
97 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
98 void addEOL() |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
99 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
100 m_state = 4; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
101 m_src += m_eol; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
102 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
103 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
104 void addByteDef(boolean force) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
105 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
106 if (m_state != 2 || force) |
126 | 107 { |
108 m_src += m_eol; | |
109 addIndent(); | |
110 } | |
111 | |
112 m_src += m_byteDef +" "; | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
113 m_bytes = 0; |
126 | 114 m_state = 2; |
115 } | |
116 | |
117 void addLabel(String blabel, boolean nl) | |
118 { | |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
119 if (m_state != 3) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
120 addEOL(); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
121 |
126 | 122 m_src += m_prefix + blabel +":"+ (nl ? " " : ""); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
123 m_state = 3; |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
124 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
125 |
125 | 126 void addComment(String bstr) |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
127 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
128 if (m_state != 4) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
129 addEOL(); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
130 |
126 | 131 m_src += "; "+ bstr + m_eol; |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
132 m_state = 4; |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
133 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
134 |
126 | 135 void addLine(String bstr) |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
136 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
137 if (m_state != 4) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
138 addEOL(); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
139 |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
140 m_src += bstr.replace("@@", m_prefix) + m_eol; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
141 m_state = 4; |
121
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 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
144 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
|
145 { |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
146 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
|
147 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
148 if (blabel != null) |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
149 { |
126 | 150 addLabel(blabel, true); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
151 m_state = 2; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
152 addByteDef(false); |
126 | 153 m_src += getByteStr(bval); |
154 m_src += m_eol; | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
155 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
156 else |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
157 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
158 if (m_state != 2) |
126 | 159 addByteDef(true); |
160 else | |
129 | 161 if (m_bpl > 0 && m_bytes >= m_bpl) |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
162 addByteDef(true); |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
163 |
126 | 164 if (m_bytes++ > 0) |
165 addByteSep(); | |
166 | |
167 m_src += getByteStr(bval); | |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
168 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
169 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
170 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
171 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
|
172 { |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
173 m_offs = boffs; |
121
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
174 writeByte(bval, blabel); |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
175 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
176 } |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
177 |
25a29d29ee6a
Add helper class MPWriteCtx for exporting data and source code.
Matti Hamalainen <ccr@tnsp.org>
parents:
120
diff
changeset
|
178 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
179 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
|
180 { |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
181 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 g_map[moffs + 7] = byte( fdata[toffs] & 1); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
189 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
190 |
29
249c4f5742f3
Refactor the import/export stuff a bit and the GUI bits for JS.
Matti Hamalainen <ccr@tnsp.org>
parents:
14
diff
changeset
|
191 |
117 | 192 boolean mpImportFormat(byte[] fdata) |
84
025efefd1704
Rename few functions and a variable.
Matti Hamalainen <ccr@tnsp.org>
parents:
81
diff
changeset
|
193 { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
194 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
|
195 int p1, p2, p3; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
196 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
197 head = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
198 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
199 if (machine == SPECTRUM) //SCR=SCREEN$ |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
200 { |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
201 // 32*24*8 bytes of bitmap |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
202 // 32*24 bytes of attributes |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
203 if (fdata.length < 6912) { |
49 | 204 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
205 } |
49 | 206 for (y = 0; y < 3; y++) |
207 for (y2 = 0; y2 < 8; y2++) | |
208 for (yy = 0; yy < 8; yy++) | |
209 for (x = 0; x < 32; x++) | |
210 { | |
211 yp = y * 64 + yy * 8 + y2; | |
212 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
|
213 mpCopyByte(fdata, ad, head); |
49 | 214 head++; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
215 } |
49 | 216 |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
217 for (y = 0; y < 24; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
218 for (x = 0; x < 32; x++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
219 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
220 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
|
221 valu = fdata[head]; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
222 int ink = valu & 7; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
223 int pap = valu & 56; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
224 pap = pap >> 3; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
225 int bri = valu & 64; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
226 bri = bri >> 6; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
227 ink = ink + bri * 8; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
228 pap = pap + bri * 8; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
229 if (pap == 8) { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
230 pap = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
231 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
232 for (y2 = 0; y2 <= 7; y2++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
233 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
234 g_map[ad + y2 * 32] = byte(ink); |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
235 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
|
236 } |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
237 head++; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
238 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
239 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
240 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
241 if (machine == C64) { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
242 //0x0002->bitmap |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
243 //0x1f42->colormap |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
244 //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
|
245 if (fdata.length < 9006) { |
49 | 246 return false; |
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 if (fdata.length >= 0x232a) { |
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
249 g_map[0] = byte(fdata[0x232a] & 0x0f); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
250 } |
49 | 251 for (y = 0; y < 25; y++) |
252 for (x = 0; x < 40; x++) | |
253 for (y2 = 0; y2 <= 7; y2++) | |
254 { | |
255 head = 2 + x * 8 + y * (40 * 8) + y2; | |
256 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
|
257 mpCopyByte(fdata, ad, head); |
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
258 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
|
259 p2 = fdata[0x1f42 + x + y * 40] & 0xf0; |
49 | 260 p2 = p2 >> 4; |
261 g_map[65536 + x + y * 40 * 8 + y2 * 40] = byte(p2); | |
262 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
|
263 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
264 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
265 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
266 if (machine == PLUS4) { // Botticelli |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
267 //g.hires.prg = botticelli |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
268 //2 - luminance 40*25 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
269 //1026 - colors 40*25 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
270 //2050 - bitmappi 40*25*8 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
271 if (fdata.length < 10050) { |
49 | 272 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
273 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
274 int l1, l2; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
275 for (y = 0; y < 25; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
276 for (x = 0; x < 40; x++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
277 for (y2 = 0; y2 <= 7; y2++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
278 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
279 head = 2050 + x * 8 + y * (40 * 8) + y2; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
280 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
|
281 mpCopyByte(fdata, ad, head); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
282 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
283 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
|
284 p2 = fdata[1026 + x + y * 40] & 0xf0; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
285 p2 = p2 >> 4; |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
286 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
|
287 l2 = fdata[2 + x + y * 40] & 0xf0; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
288 l2 = l2 >> 4; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
289 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
|
290 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
|
291 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
292 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
293 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
294 if (machine == PLUS4M) { // Multi Botticelli |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
295 //m.multi.prg = multi botticelli |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
296 //2- lumins 40*25 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
297 //1024 - bäkki1 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
298 //1025 - bäkki2 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
299 //1026 - colors 40*25 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
300 //2050 - bitmap 40*25*8 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
301 if (fdata.length < 10050) { |
49 | 302 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
303 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
304 int l1, l2; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
305 for (y = 0; y < 25; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
306 for (x = 0; x < 40; x++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
307 for (y2 = 0; y2 <= 7; y2++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
308 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
309 head = 2050 + x * 8 + y * (40 * 8) + y2; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
310 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
|
311 mpCopyByte(fdata, ad, head); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
312 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
313 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
|
314 p2 = fdata[1026 + x + y * 40] & 0xf0; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
315 p2 = p2 >> 4; |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
316 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
|
317 l2 = fdata[2 + x + y * 40] & 0xf0; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
318 l2 = l2 >> 4; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
319 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
|
320 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
|
321 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
322 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
323 p1 = int(fdata[1025]) & 0xf0; |
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
324 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
|
325 p1 = p1 >> 4; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
326 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
|
327 p1 = int(fdata[1024]) & 0xf0; |
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
328 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
|
329 p1 = p1 >> 4; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
330 g_map[2] = byte(convertluminance(l1, p1)); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
331 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
332 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
333 if (machine == C64M) { //advanced art studio |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
334 //adv. art studio (=multicolor) 10018 bytes |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
335 //0x0002 bitmap (40*25*8) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
336 //0x1f42 colors1 (40*25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
337 //0x232a border |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
338 //0x232b background |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
339 //0x233a colors2 (40*25) |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
340 if (fdata.length < 10018) { |
49 | 341 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
342 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
343 for (y = 0; y < 25; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
344 for (x = 0; x < 40; x++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
345 for (y2 = 0; y2 < 8; y2++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
346 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
347 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
|
348 |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
349 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
|
350 mpCopyByte(fdata, ad, head); |
11 | 351 |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
352 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
|
353 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
|
354 p3 = fdata[0x233a + x + y * 40] & 0x0f; |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
355 |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
356 g_map[65536 + x + y * 40] = byte(p1); |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
357 g_map[65536 + x + y * 40 + 1000] = byte(p2); |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
358 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
|
359 } |
120
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
360 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
|
361 g_map[1] = byte(fdata[0x232b] & 0x0f); //baku |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
362 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
363 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
364 if (machine == MSX) { // sc2 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
365 // 7=bitmap 32*24*8 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
366 // 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
|
367 if (fdata.length < 14343) { |
49 | 368 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
369 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
370 for (y = 0; y < 24; y++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
371 for (x = 0; x < 32; x++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
372 for (y2 = 0; y2 <= 7; y2++) |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
373 { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
374 head = 7 + x * 8 + y * (32 * 8) + y2; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
375 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
|
376 mpCopyByte(fdata, ad, head); |
55b0a77af602
Clean up the format import code a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
117
diff
changeset
|
377 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
|
378 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
|
379 p2 = p2 >> 4; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
380 if (p1 == 0) { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
381 p1 = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
382 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
383 if (p2 == 0) { |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
384 p2 = 1; |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
385 } |
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
386 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
|
387 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
|
388 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
389 } |
85
db97aef4e159
Clean up mpImportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
84
diff
changeset
|
390 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
391 if (machine == CPC) { // a studio? |
49 | 392 return false; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
393 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
394 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
395 consistency(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
396 refresh(); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
397 g_boxreconstruct = 2; |
49 | 398 return true; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
399 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
400 |
49 | 401 |
126 | 402 boolean mpExportFormat(MPWriteCtx ctx, int subformat) |
49 | 403 { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
404 int val1, val2, val3; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
405 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
|
406 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
407 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
|
408 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
|
409 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
410 ctx.setOffs(0x02); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
411 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
|
412 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
413 ctx.setOffs(1026); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
414 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
|
415 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
416 ctx.setOffs(2050); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
417 mpExportBitmapData(ctx, 40, 25); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
418 } |
49 | 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 == 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
|
421 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
|
422 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 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
|
427 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
428 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
|
429 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
|
430 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
|
431 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
|
432 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
433 ctx.setOffs(1026); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
434 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
|
435 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
436 ctx.setOffs(2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
437 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
|
438 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
439 ctx.setOffs(2050); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
440 mpExportBitmapData(ctx, 40, 25); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
441 } |
49 | 442 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
443 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
|
444 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
|
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(2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
447 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
|
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(0x1f42); |
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, 0); |
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(0x232a, g_map[0]); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
453 } |
49 | 454 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
455 if (machine == C64M) { |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
456 if (subformat == 0) |
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
457 { |
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
458 // 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
|
459 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
|
460 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
461 ctx.setOffs(2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
462 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
|
463 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
464 ctx.setOffs(0x1f42); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
465 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
|
466 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
467 ctx.setOffs(0x233a); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
468 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
|
469 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
470 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
|
471 ctx.writeByteAt(0x232b, g_map[1]); |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
472 } |
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
473 else |
49 | 474 { |
475 // Koala Painter | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
476 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
|
477 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
478 ctx.setOffs(2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
479 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
|
480 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
481 ctx.setOffs(0x1f42); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
482 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
|
483 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
484 ctx.setOffs(0x232a); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
485 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
|
486 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
487 ctx.writeByteAt(0x2712, g_map[1] & 0x0f); |
49 | 488 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
489 } |
49 | 490 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
491 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
|
492 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
|
493 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
494 ctx.setOffs(7); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
495 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
|
496 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
497 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
|
498 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
|
499 } |
49 | 500 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
501 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
|
502 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
|
503 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
504 ctx.setOffs(0); |
49 | 505 for (y = 0; y < 3; y++) |
506 for (y2 = 0; y2 < 8; y2++) | |
507 for (yy = 0; yy < 8; yy++) | |
508 for (x = 0; x < 32; x++) | |
509 { | |
510 yp = y * 64 + yy * 8 + y2; | |
511 ad = 1024 + yp * 256 + x * 8; | |
512 | |
513 valu = g_map[ad + 0] * 128 + | |
514 g_map[ad + 1] * 64 + | |
515 g_map[ad + 2] * 32 + | |
516 g_map[ad + 3] * 16 + | |
517 g_map[ad + 4] * 8 + | |
518 g_map[ad + 5] * 4 + | |
519 g_map[ad + 6] * 2 + | |
520 g_map[ad + 7] * 1; | |
521 | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
522 ctx.writeByte(valu); |
49 | 523 } |
524 | |
525 for (y = 0; y < 24; y++) | |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
526 for (x = 0; x <= 31; x++) |
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
527 { |
49 | 528 ad = 65536 + x + y * 256; |
529 valu = int(g_map[ad]); | |
530 valu2 = int(g_map[ad + MX * MY * 8]); | |
531 bri = 0; | |
532 if (valu >= 8) { | |
533 bri = 1; | |
534 valu = valu - 8; | |
535 valu2 = valu2 - 8; | |
536 if (valu2 <= 0) { | |
537 valu2 = 0; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
538 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
539 } |
49 | 540 if (bri == 1) { |
541 valu += 64; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
542 } |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
543 ctx.writeByte(valu + valu2 * 8); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
544 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
545 } |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
546 else |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
547 return false; |
90
dffafe05d520
Refactor mpExportFormat() a bit.
Matti Hamalainen <ccr@tnsp.org>
parents:
88
diff
changeset
|
548 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
549 return true; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
550 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
551 |
49 | 552 |
126 | 553 boolean mpExportMachinePRG(MPWriteCtx ctx) |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
554 { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
555 // any common text headers |
125 | 556 ctx.addComment("machine=" + str(machine) + " (" + g_name + ")"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
557 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
558 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
|
559 ctx.loadTemplate("c64show.prg"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
560 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
561 ctx.setOffs(0x0227); |
125 | 562 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
563 mpExportBitmapData(ctx, 40, 25); |
95
517348a7b543
More work on mpExportMachinePRG().
Matti Hamalainen <ccr@tnsp.org>
parents:
94
diff
changeset
|
564 |
126 | 565 ctx.writeByteAt(0x2167, g_map[0], "_border"); //=border |
566 ctx.writeByteAt(0x2168, g_map[1], "_backg"); //=background mutta ei tarvita | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
567 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
568 ctx.setOffs(0x2169); |
126 | 569 ctx.addLabel("_screenram"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
570 mpExportColorData(ctx, 40, 25, 65536, 0); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
571 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
572 //c64show.prg |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
573 //offsets |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
574 //0x0227->bitmappi (40x25 x 8 bytee) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
575 //0x2167:borderi väri |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
576 //0x2169->värikartta (40x25 bytee, nyppelit foreg/backg) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
577 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
578 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
579 if (machine == C64M) { //C64 MULTICOLOR |
126 | 580 ctx.loadTemplate("c64mshow.prg"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
581 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
582 ctx.setOffs(0x0239); |
126 | 583 ctx.addLabel("_bitmap"); |
122
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); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
585 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
586 // first color information |
126 | 587 ctx.writeByteAt(0x2179, g_map[0], "_border"); |
588 ctx.writeByteAt(0x217a, g_map[1], "_backg"); | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
589 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
590 ctx.setOffs(0x217B); |
126 | 591 ctx.addLabel("_screenram"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
592 mpExportColorData(ctx, 40, 25, 65536, 1); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
593 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
594 // 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
|
595 ctx.setOffs(0x2563); |
126 | 596 ctx.addLabel("_colorram"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
597 mpExportColorData(ctx, 40, 25, 65536 + 2000, 2); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
598 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
599 //c64 multicolor |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
600 //offsets |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
601 //0x0239->bitmappi (40x25 x 8 bytee) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
602 //0x2179:borderi väri |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
603 //0x217A:bäkkis väri |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
604 //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
|
605 //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
|
606 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
607 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
608 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
|
609 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
|
610 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
611 ctx.addLine(".global @@_bitmap"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
612 ctx.addLine(".global @@_color1"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
613 ctx.addLine(".global @@_color2"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
614 ctx.addLine(".global @@_border"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
615 ctx.addLine(".global @@_back1"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
616 ctx.addLine(".global @@_back2"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
617 |
125 | 618 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
619 ctx.setOffs(0x013e); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
620 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
|
621 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
622 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
|
623 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
|
624 val3 = val2 * 16 + val1; |
125 | 625 ctx.addLabel("_border"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
626 ctx.setOffs(0x207e); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
627 ctx.writeByte(val3); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
628 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
629 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
|
630 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
|
631 val3 = val2 * 16 + val1; |
125 | 632 ctx.addLabel("_back1"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
633 ctx.setOffs(0x207f); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
634 ctx.writeByte(val3); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
635 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
636 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
|
637 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
|
638 val3 = val2 * 16 + val1; |
125 | 639 ctx.addLabel("_back2"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
640 ctx.setOffs(0x2080); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
641 ctx.writeByte(val3); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
642 |
125 | 643 ctx.addLabel("_color1"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
644 ctx.setOffs(0x2081); |
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, 6); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
646 |
125 | 647 ctx.addLabel("_color2"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
648 ctx.setOffs(0x2469); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
649 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
|
650 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
651 //plus4 multic |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
652 //0x013e bitmap (40 x 25 x 8) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
653 //0x207e border |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
654 //0x207f background 1 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
655 //0x2080 background 2 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
656 //0x2081 colors (40 x 25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
657 //0x2469 luminance (40 x 25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
658 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
659 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
660 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
|
661 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
|
662 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
663 ctx.addLine(".global @@_bitmap"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
664 ctx.addLine(".global @@_color"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
665 ctx.addLine(".global @@_lumi"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
666 ctx.addLine(".global @@_border"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
667 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
668 ctx.setOffs(0x0137); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
669 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
670 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
|
671 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
672 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
|
673 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
|
674 val3 = val2 * 16 + val1; |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
675 ctx.writeByteAt(0x2077, val3, "_border"); //border |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
676 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
677 ctx.setOffs(0x2078); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
678 ctx.addLabel("_color"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
679 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
|
680 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
681 ctx.setOffs(0x2460); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
682 ctx.addLabel("_lumi"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
683 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
|
684 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
685 //plus4 hires |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
686 //0x0137 bitmap (40 x 25 x 8) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
687 //0x2077 borderi |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
688 //0x2078 colors (40 x 25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
689 //0x2460 luminance (40 x 25) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
690 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
691 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
692 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
|
693 ctx.loadTemplate("msxshow.com"); |
126 | 694 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
695 ctx.addLine(".globl @@_bitmap,@@_nimi2"); |
125 | 696 ctx.addLine(".area _CODE"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
697 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
698 ctx.setOffs(0x00f9); |
125 | 699 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
700 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
|
701 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
702 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
703 //ctx.writeByte(g_map[1]); //backg |
125 | 704 //ctx.addComment("The first following value is background"); |
705 ctx.addLabel("_nimi2"); | |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
706 ctx.setOffs(0x18f9); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
707 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
|
708 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
709 //msx comm |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
710 //0x00f9 bitmap (32x24 x 8 bytes) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
711 //0x18f9 background color |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
712 //0x18fa colors (32*24 bytes) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
713 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
714 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
715 if (machine == SPECTRUM) { // ZX Spectrum |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
716 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
717 //would need some cleaning up |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
718 |
126 | 719 // ctx.addLine(".area _DATA"); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
720 // ctx.addLine(".globl @@_taustakuva"); |
125 | 721 // ctx.addLabel("_taustakuva"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
722 ctx.loadTemplate("specshow.tap"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
723 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
724 int checksum = 0xc9; |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
725 for (y = 0x1d24; y < 0x1d3e; y++) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
726 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
727 checksum = checksum ^ int(g_template[y]); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
728 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
729 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
730 //TAP requires fiddling with the checksum |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
731 //println("Checksum:"+hex(checksum,2)); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
732 ctx.writeByteAt(0x0223, g_map[0], "_something1"); |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
733 checksum = checksum ^ int(g_map[0]); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
734 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
735 ctx.addLabel("_something2"); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
736 ctx.setBPL(32); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
737 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
|
738 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
|
739 for (int yy = 0; yy < 8; yy++) |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
740 for (int x = 0; x < 32; x++) |
87 | 741 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
742 int yp = y * 64 + yy * 8 + y2, |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
743 ad = 1024 + yp * 256 + x * 8, |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
744 valu = |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
745 g_map[ad + 0] * 128 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
746 g_map[ad + 1] * 64 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
747 g_map[ad + 2] * 32 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
748 g_map[ad + 3] * 16 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
749 g_map[ad + 4] * 8 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
750 g_map[ad + 5] * 4 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
751 g_map[ad + 6] * 2 + |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
752 g_map[ad + 7] * 1; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
753 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
754 ctx.writeByte(valu); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
755 checksum = checksum ^ int(valu); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
756 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
757 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
758 ctx.addLabel("_attributes"); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
759 for (int y = 0; y < 24; y++) |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
760 for (int x = 0; x < 32; x++) |
87 | 761 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
762 int ad = 65536 + x + y * 256, |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
763 valu = int(g_map[ad]), |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
764 valu2 = int(g_map[ad + MX * MY * 8]), |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
765 bri = 0; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
766 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
767 if (valu >= 8) |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
768 { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
769 bri = 1; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
770 valu = valu - 8; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
771 valu2 = valu2 - 8; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
772 if (valu2 <= 0) { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
773 valu2 = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
774 } |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
775 } |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
776 if (bri == 1) { |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
777 valu = valu + 64; |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
778 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
779 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
780 ctx.writeByte(valu + valu2 * 8); |
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
781 checksum = checksum ^ int(valu + valu2 * 8); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
782 } |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
783 ctx.setBPLOff(); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
784 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
785 ctx.writeByteAt(0x1d3e, int(checksum), "_checksum"); |
0
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 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
788 if (machine == CPC) { |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
789 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
|
790 ctx.loadTemplate("cpc-mode0.bin"); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
791 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
792 ctx.setOffs(69); //bitmap offset |
125 | 793 ctx.addLabel("_bitmap"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
794 mpExportBitmapData_CPC(ctx, 160, 200); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
795 |
87 | 796 //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
|
797 ctx.setOffs(16453); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
798 ctx.setBPL(32); |
125 | 799 ctx.addLabel("_palette"); |
87 | 800 for (int i = 0; i < g_maxcolors; i++) |
801 { | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
802 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
|
803 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
|
804 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
|
805 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
806 ctx.writeByte(val1 * 9 + val2 * 3 + val3); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
807 } |
126 | 808 ctx.setBPLOff(); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
809 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
810 valu = int(g_map[0]); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
811 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
|
812 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
|
813 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
|
814 |
126 | 815 ctx.setOffs(16469); |
125 | 816 ctx.addLabel("_border"); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
817 ctx.writeByte(val1 * 9 + val2 * 3 + val3); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
818 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
819 //cpc |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
820 //69 bitmap 16384 bytes |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
821 //16453 palette 16 bytes (0..26) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
822 //16469 border color (0..26) |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
823 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
824 else |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
825 return false; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
826 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
827 ctx.addEOL(); |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
828 return true; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
829 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
830 |
86 | 831 |
129 | 832 void mpExportBitmapData_CPC(MPWriteCtx ctx, int mwidth, int mheight) |
86 | 833 { |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
834 int x, y, ad, val1, val2, y2; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
835 int pix0b0, pix0b1, pix0b2, pix0b3; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
836 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
|
837 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
838 ctx.setBPL(32); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
839 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
840 for (y2 = 0; y2 < 8; y2++) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
841 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
842 ctx.addByteDef(true); |
126 | 843 |
129 | 844 for (y = 0; y < int(mheight / 8); y++) |
845 for (x = 0; x < int(mwidth / 2); x++) | |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
846 { |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
847 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
|
848 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
849 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
|
850 pix0b0 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
851 pix0b1 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
852 pix0b2 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
853 pix0b3 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
854 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
|
855 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
|
856 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
|
857 if ((val1 & 8) != 0) pix0b3 = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
858 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
859 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
|
860 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
861 pix1b0 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
862 pix1b1 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
863 pix1b2 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
864 pix1b3 = 0; |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
865 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
|
866 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
|
867 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
|
868 if ((val1 & 8) != 0) pix1b3 = 1; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
869 |
122
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
870 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
|
871 |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
872 ctx.writeByte(val2); |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
873 } |
ffa6533584ca
Use the MPWriteCtx class. However, due to this refactoring, there are
Matti Hamalainen <ccr@tnsp.org>
parents:
121
diff
changeset
|
874 |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
875 ctx.addByteDef(true); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
876 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
|
877 ctx.writeByte(0); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
878 } |
129 | 879 |
126 | 880 ctx.setBPLOff(); |
881 ctx.addEOL(); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
882 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
883 |
86 | 884 |
129 | 885 void mpExportBitmapData(MPWriteCtx ctx, int mwidth, int mheight) |
86 | 886 { |
129 | 887 int xwid = mwidth * 8, |
888 ywid = mheight * 8; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
889 |
126 | 890 ctx.setBPL(32); |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
891 ctx.addByteDef(true); |
126 | 892 |
129 | 893 for (int y = 0; y < mheight; y++) |
894 for (int x = 0; x < mwidth; x++) | |
895 for (int y2 = 0; y2 < 8; y2++) | |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
896 { |
129 | 897 int ad = 1024 + y * (xwid * 8) + (y2 * xwid) + x * 8; |
898 int value = | |
899 g_map[ad + 0] * 128 + | |
900 g_map[ad + 1] * 64 + | |
901 g_map[ad + 2] * 32 + | |
902 g_map[ad + 3] * 16 + | |
903 g_map[ad + 4] * 8 + | |
904 g_map[ad + 5] * 4 + | |
905 g_map[ad + 6] * 2 + | |
906 g_map[ad + 7] * 1; | |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
907 |
129 | 908 ctx.writeByte(value); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
909 } |
129 | 910 |
126 | 911 ctx.setBPLOff(); |
912 ctx.addEOL(); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
913 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
914 |
86 | 915 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
916 int convertluminance(int l, int f) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
917 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
918 int res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
919 if (f == 0) return 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
920 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
|
921 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
|
922 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
|
923 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
|
924 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
|
925 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
|
926 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
|
927 if (l == 7) res = 105 + f; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
928 return res; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
929 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
930 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
931 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
932 int getplusluminance(int c) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
933 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
934 int res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
935 if (c == 0) res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
936 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
|
937 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
|
938 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
|
939 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
|
940 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
|
941 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
|
942 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
|
943 if (c >= 106 && c <= 120) res = 7; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
944 return res; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
945 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
946 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
947 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
948 int getpluscolor(int c) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
949 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
950 int res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
951 if (c == 0) res = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
952 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
|
953 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
|
954 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
|
955 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
|
956 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
|
957 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
|
958 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
|
959 if (c >= 106 && c <= 120) res = c - 105; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
960 return res; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
961 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
962 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
963 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
964 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
|
965 { |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
966 int xmult, myrpsi; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
967 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
968 myrpsi = 0; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
969 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
970 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
|
971 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
|
972 else |
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
973 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
|
974 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
975 if (machine == MSX) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
976 myrpsi = 7; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
977 } |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
978 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
979 for (int yc = 0; yc < height; yc++) |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
980 { |
127
4cebbee4b29b
More work on source export.
Matti Hamalainen <ccr@tnsp.org>
parents:
126
diff
changeset
|
981 ctx.addByteDef(true); |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
982 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
|
983 for (int yline = 0; yline <= myrpsi; yline++) |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
984 { |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
985 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
|
986 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
987 switch (param) |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
988 { |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
989 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
|
990 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
|
991 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
|
992 break; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
993 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
994 case 1: |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
995 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
|
996 valu1 = int(g_map[ad + 1000]); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
997 break; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
998 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
999 case 2: |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1000 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
|
1001 valu1 = 0; |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1002 break; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1003 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1004 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
|
1005 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
|
1006 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
|
1007 break; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1008 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1009 case 4: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1010 //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
|
1011 valu1 = getpluscolor(int(g_map[ad])); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1012 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
|
1013 break; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1014 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1015 case 5: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1016 //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
|
1017 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
|
1018 valu2 = getplusluminance(int(g_map[ad])); |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1019 break; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1020 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1021 case 6: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1022 //plus4 multic1 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1023 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
|
1024 valu1 = getpluscolor(int(g_map[ad + 1000])); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1025 break; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1026 |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1027 case 7: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1028 //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
|
1029 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
|
1030 valu2 = getplusluminance(int(g_map[ad + 1000])); |
91
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1031 break; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1032 |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1033 default: |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1034 return null; |
892a06169bb5
Refactor machine program and source exporting.
Matti Hamalainen <ccr@tnsp.org>
parents:
90
diff
changeset
|
1035 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1036 |
124
68e8d86c9eef
Get rid of unused variables and clean up the logic slightly in mpExportColorData()
Matti Hamalainen <ccr@tnsp.org>
parents:
122
diff
changeset
|
1037 ctx.writeByte(valu1 * 16 + valu2); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1038 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1039 } |
126 | 1040 ctx.addEOL(); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1041 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1042 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1043 |
117 | 1044 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
|
1045 { |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1046 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
|
1047 return false; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1048 |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1049 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
|
1050 return false; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1051 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1052 int balx, baly, xx, yy, x2, y2, rr, gg, bb, avg, i, j, target; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1053 int cx, cy; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1054 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
|
1055 int[] pixut = new int[260]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1056 int[] idx = new int[260]; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1057 int[] histog = new int[8192]; |
14
cecc594d1559
Remove unused code and variables.
Matti Hamalainen <ccr@tnsp.org>
parents:
12
diff
changeset
|
1058 float ww, hh, fld, compa; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1059 color c; |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1060 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
|
1061 int rh, gh, bh; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1062 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1063 xcolors = g_maxcolors; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1064 vertti = 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1065 erkki = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1066 limitter = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1067 if (g_britemode == 1) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1068 xcolors = 8; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1069 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1070 if (g_attrimode == 0) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1071 vertti = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1072 erkki = 8; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1073 } |
154 | 1074 if (g_multic == 1) |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1075 limitter = 4; |
154 | 1076 else |
1077 //because zero color can be anywhere? | |
1078 if (g_multic == 2) | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1079 limitter = 16; |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1080 |
6
07ddf9cfc6c2
Cast char to int where needed and other related operations.
Matti Hamalainen <ccr@tnsp.org>
parents:
5
diff
changeset
|
1081 command(int('O')); //special clear screen |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1082 |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1083 balx = int(image.width / X) * g_pixelw; |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1084 baly = int(image.height / Y); |
154 | 1085 if (balx < 1) |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1086 balx = 1; |
154 | 1087 if (baly < 1) |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1088 baly = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1089 |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1090 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
|
1091 { |
154 | 1092 int psteps = int(g_palsteps - 1), |
1093 maxhis = 0, | |
1094 palls = int(255 / psteps); | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1095 |
154 | 1096 for (i = 0; i < g_maxcolors; i++) |
1097 makecolor(i, 0, 0, 0); | |
87 | 1098 |
1099 for (cy = 0; cy < MY * erkki; cy++) | |
1100 for (cx = 0; cx < MX; cx++) | |
1101 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) | |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1102 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + g_pixelw) |
87 | 1103 { |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1104 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
|
1105 y2 = int(image.height / Y) * yy; |
87 | 1106 rr = 0; |
1107 gg = 0; | |
1108 bb = 0; | |
1109 avg = 0; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1110 |
154 | 1111 for (avy = 0; avy < baly; avy++) |
1112 for (avx = 0; avx < balx; avx++) | |
1113 { | |
1114 c = image.get(x2 + avx, y2 + avy); | |
1115 rr = rr + int(red(c)); | |
1116 gg = gg + int(green(c)); | |
1117 bb = bb + int(blue(c)); | |
1118 avg++; | |
87 | 1119 } |
1120 | |
154 | 1121 rh = int(int(rr / avg) / palls); |
1122 gh = int(int(gg / avg) / palls); | |
1123 bh = int(int(bb / avg) / palls); | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1124 |
154 | 1125 int hindex = int(rh * (g_palsteps * g_palsteps) + gh * (g_palsteps) + bh); |
1126 if (++histog[hindex] > maxhis) | |
1127 maxhis = histog[hindex]; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1128 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1129 |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1130 int step = 0; |
87 | 1131 for (j = maxhis; j > 0; j--) |
1132 for (i = 0; i <= 4096; i++) | |
1133 { | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1134 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
|
1135 { |
87 | 1136 rh = i / int(g_palsteps * g_palsteps); |
1137 gh = i - int(rh * (g_palsteps * g_palsteps)); | |
1138 gh = gh / int(g_palsteps); | |
1139 bh = i - int(rh * (g_palsteps * g_palsteps)); | |
1140 bh = bh - int(gh * g_palsteps); | |
1141 rh = rh * int(palls); | |
1142 gh = gh * int(palls); | |
1143 bh = bh * int(palls); | |
154 | 1144 if (step < g_maxcolors) |
1145 { | |
87 | 1146 makecolor(step, rh, gh, bh); |
1147 step++; | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1148 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1149 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1150 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1151 } |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1152 |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1153 for (cy = 0; cy < MY * erkki; cy++) |
154 | 1154 for (cx = 0; cx < MX; cx++) |
1155 { | |
1156 for (i = 0; i < xcolors; i++) | |
1157 { | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1158 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
|
1159 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
|
1160 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1161 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) { |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1162 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + g_pixelw) { |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1163 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
|
1164 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
|
1165 rr = 0; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1166 gg = 0; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1167 bb = 0; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1168 avg = 0; |
154 | 1169 |
1170 for (avy = 0; avy < baly; avy++) | |
1171 for (avx = 0; avx < balx; avx++) | |
1172 { | |
1173 c = image.get(x2 + avx, y2 + avy); | |
1174 rr += int(red(c)); | |
1175 gg += int(green(c)); | |
1176 bb += int(blue(c)); | |
1177 avg++; | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1178 } |
154 | 1179 |
1180 rr = int(rr / avg); | |
1181 gg = int(gg / avg); | |
1182 bb = int(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
|
1183 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
|
1184 target = -1; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1185 compa = 9999; |
154 | 1186 for (i = 0; i < xcolors; i++) |
1187 { | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1188 fld = dist(rr, gg, bb, g_r[i], g_g[i], g_b[i]); |
154 | 1189 if (fld < compa) |
1190 { | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1191 compa = fld; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1192 target = i; |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1193 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1194 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1195 |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1196 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
|
1197 pixut[target]++; //histogramming |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1198 } |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1199 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1200 |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1201 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
|
1202 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
|
1203 { |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1204 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
|
1205 { |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1206 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
|
1207 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
|
1208 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
|
1209 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
|
1210 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
|
1211 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
|
1212 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1213 } |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1214 |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1215 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
|
1216 { |
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1217 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
|
1218 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) |
154 | 1219 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + g_pixelw) |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1220 { |
154 | 1221 x2 = int(image.width / X) * xx; |
1222 y2 = int(image.height / Y) * yy; | |
92
4161d798cb64
Clean up/refactor image (jpeg/png) importing a bit and rename function.
Matti Hamalainen <ccr@tnsp.org>
parents:
91
diff
changeset
|
1223 |
154 | 1224 rr = 0; |
1225 gg = 0; | |
1226 bb = 0; | |
1227 avg = 0; | |
1228 for (avy = 0; avy < baly; avy++) { | |
1229 for (avx = 0; avx < balx; avx++) { | |
1230 c = image.get(x2 + avx, y2 + avy); | |
1231 rr = rr + int(red(c)); | |
1232 gg = gg + int(green(c)); | |
1233 bb = bb + int(blue(c)); | |
1234 avg++; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1235 } |
154 | 1236 } |
1237 rr = rr / (avg); | |
1238 gg = gg / (avg); | |
1239 bb = bb / (avg); | |
1240 g_farge = 0; | |
1241 target = -1; | |
1242 compa = 9999; | |
1243 for (j = 0; j < limitter; j++) { | |
1244 fld = dist(rr, gg, bb, g_r[idx[j]], g_g[idx[j]], g_b[idx[j]]); | |
1245 if (fld < compa) { | |
1246 compa = fld; | |
1247 target = idx[j]; | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1248 } |
154 | 1249 } |
1250 if (i == target) { | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1251 |
154 | 1252 g_farge = target; |
1253 makepoint(xx, yy); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1254 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1255 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1256 |
126 | 1257 if (idefix == 0) |
1258 { | |
1259 for (yy = cy * vertti; yy <= cy * vertti + vertti - 1; yy++) | |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1260 for (xx = cx * 8; xx <= cx * 8 + 7; xx = xx + g_pixelw) |
126 | 1261 { |
1262 g_farge = idx[0]; | |
1263 makepoint(xx, yy); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1264 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1265 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1266 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1267 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1268 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1269 |
88
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 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
|
1272 { |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1273 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
|
1274 return; |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1275 |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1276 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
|
1277 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
|
1278 { |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1279 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
|
1280 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
|
1281 } |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1282 |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1283 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
|
1284 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
|
1285 { |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1286 int f; |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1287 if (g_pixelw == 2) |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1288 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
|
1289 else |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1290 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
|
1291 |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1292 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
|
1293 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
|
1294 |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1295 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
|
1296 |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1297 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
|
1298 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
|
1299 { |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1300 output.set( |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1301 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
|
1302 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
|
1303 c); |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1304 } |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1305 } |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1306 } |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1307 |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1308 |
117 | 1309 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
|
1310 { |
94
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1311 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
|
1312 |
94
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1313 if (border) |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1314 { |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1315 pimage = createImage( |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1316 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
|
1317 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
|
1318 RGB); |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1319 |
94
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1320 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
|
1321 } |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1322 else |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1323 { |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1324 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
|
1325 mpRenderToImageAt(output, 0, 0); |
6e74d45ea620
More work towards jpeg/png image export/import.
Matti Hamalainen <ccr@tnsp.org>
parents:
92
diff
changeset
|
1326 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1327 |
88
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1328 return output; |
03823fa2cb01
Refactor export_image() and export_image_sans_border() to use common code,
Matti Hamalainen <ccr@tnsp.org>
parents:
87
diff
changeset
|
1329 } |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1330 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1331 |
154 | 1332 void make_c64_palette() |
1333 { | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1334 // Pepto's murky C64 palette: http://www.pepto.de/projects/colorvic |
154 | 1335 int rgb[] = |
1336 { | |
1337 0x000000, | |
1338 0xFFFFFF, | |
1339 0x68372B, | |
1340 0x70A4B2, | |
1341 0x6F3D86, | |
1342 0x588D43, | |
1343 0x352879, | |
1344 0xB8C76F, | |
1345 0x6F4F25, | |
1346 0x433900, | |
1347 0x9A6759, | |
1348 0x444444, | |
1349 0x6C6C6C, | |
1350 0x9AD284, | |
1351 0x6C5EB5, | |
1352 0x959595 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1353 }; |
154 | 1354 for (int i = 0; i < g_maxcolors; i++) |
1355 { | |
1356 g_grids[i] = (rgb[i] + 0x282828) | 0xff000000; | |
1357 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1358 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1359 g_grids[1] = 0xffd0d0d0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1360 g_gridmode = NEW; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1361 g_map[13] = byte(C64); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1362 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1363 |
154 | 1364 |
1365 void make_plus4_palette() | |
1366 { | |
1367 int rgb[] = | |
1368 { | |
1369 0x000000, | |
1370 0x2C2C2C, | |
1371 0x621307, | |
1372 0x00424C, | |
1373 0x510378, | |
1374 0x004E00, | |
1375 0x27188E, | |
1376 0x303E00, | |
1377 0x582100, | |
1378 0x463000, | |
1379 0x244400, | |
1380 0x630448, | |
1381 0x004E0C, | |
1382 0x0E2784, | |
1383 0x33118E, | |
1384 0x184800, | |
1385 0x3B3B3B, | |
1386 0x702419, | |
1387 0x00505A, | |
1388 0x601685, | |
1389 0x125D00, | |
1390 0x36289B, | |
1391 0x3F4C00, | |
1392 0x663100, | |
1393 0x553F00, | |
1394 0x345200, | |
1395 0x711656, | |
1396 0x005C1D, | |
1397 0x1F3691, | |
1398 0x42229B, | |
1399 0x285700, | |
1400 0x424242, | |
1401 0x772C21, | |
1402 0x055861, | |
1403 0x661E8C, | |
1404 0x1B6400, | |
1405 0x3E30A2, | |
1406 0x475400, | |
1407 0x6D3900, | |
1408 0x5C4700, | |
1409 0x3B5900, | |
1410 0x771F5D, | |
1411 0x046325, | |
1412 0x273E98, | |
1413 0x492AA1, | |
1414 0x305E00, | |
1415 0x515151, | |
1416 0x843B31, | |
1417 0x17656F, | |
1418 0x742E99, | |
1419 0x2B7100, | |
1420 0x4C3FAF, | |
1421 0x556200, | |
1422 0x7A4709, | |
1423 0x6A5500, | |
1424 0x4A6700, | |
1425 0x852F6B, | |
1426 0x177135, | |
1427 0x364CA5, | |
1428 0x5739AE, | |
1429 0x3F6B00, | |
1430 0x7A7A7A, | |
1431 0xAC665C, | |
1432 0x468E97, | |
1433 0x9C5AC0, | |
1434 0x57992E, | |
1435 0x766AD5, | |
1436 0x7E8A13, | |
1437 0xA2713A, | |
1438 0x927E20, | |
1439 0x748F14, | |
1440 0xAC5A93, | |
1441 0x459960, | |
1442 0x6276CB, | |
1443 0x8064D4, | |
1444 0x6A9419, | |
1445 0x959595, | |
1446 0xC58178, | |
1447 0x62A8B1, | |
1448 0xB675D9, | |
1449 0x73B34C, | |
1450 0x9185ED, | |
1451 0x99A433, | |
1452 0xBB8C57, | |
1453 0xAC993E, | |
1454 0x8FAA34, | |
1455 0xC676AD, | |
1456 0x62B37B, | |
1457 0x7D91E4, | |
1458 0x9B80ED, | |
1459 0x85AE38, | |
1460 0xAFAFAF, | |
1461 0xDE9B93, | |
1462 0x7DC2CA, | |
1463 0xCF90F2, | |
1464 0x8DCD68, | |
1465 0xAB9FFF, | |
1466 0xB3BE51, | |
1467 0xD5A673, | |
1468 0xC6B35B, | |
1469 0xA9C351, | |
1470 0xDF91C7, | |
1471 0x7DCC96, | |
1472 0x97ABFD, | |
1473 0xB59AFF, | |
1474 0x9FC755, | |
1475 0xE1E1E1, | |
1476 0xFFCFC6, | |
1477 0xB2F4FC, | |
1478 0xFFC4FF, | |
1479 0xC1FE9D, | |
1480 0xDDD2FF, | |
1481 0xE5F088, | |
1482 0xFFD9A8, | |
1483 0xF7E591, | |
1484 0xDBF588, | |
1485 0xFFC4F9, | |
1486 0xB1FEC9, | |
1487 0xCBDDFF, | |
1488 0xE7CDFF, | |
1489 0xD2F98C | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1490 }; |
154 | 1491 for (int i = 0; i < g_maxcolors; i++) |
1492 { | |
1493 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1494 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1495 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1496 |
154 | 1497 |
1498 void make_msx_palette() | |
1499 { | |
1500 int rgb[] = | |
1501 { | |
1502 0x000000, | |
1503 0x000000, | |
1504 0x3EB849, | |
1505 0x74D07D, | |
1506 0x5955E0, | |
1507 0x8076F1, | |
1508 0xB95E51, | |
1509 0x65DBEF, | |
1510 0xDB6559, | |
1511 0xFF897D, | |
1512 0xCCC35E, | |
1513 0xDED087, | |
1514 0x3AA241, | |
1515 0xB766B5, | |
1516 0xCCCCCC, | |
1517 0xFFFFFF | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1518 }; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1519 |
154 | 1520 for (int i = 0; i < g_maxcolors; i++) |
1521 { | |
1522 g_grids[i] = (rgb[i] + 0x1f1f1f) | 0xff000000; | |
1523 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1524 } |
154 | 1525 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1526 g_grids[5] = 0xff9f95Ff; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1527 g_grids[7] = 0xff84faEF; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1528 g_grids[9] = 0xffffa99d; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1529 g_grids[15] = 0xffd8d8d8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1530 g_gridmode = NEW; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1531 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1532 |
154 | 1533 |
1534 void make_spectrum_palette() | |
1535 { | |
1536 int rgb[] = | |
1537 { | |
1538 0x000000, | |
1539 0x0000C0, | |
1540 0xC00000, | |
1541 0xC000C0, | |
1542 0x00C000, | |
1543 0x00C0C0, | |
1544 0xC0C000, | |
1545 0xC0C0C0, | |
1546 0x000000, | |
1547 0x0000FF, | |
1548 0xFF0000, | |
1549 0xFF00FF, | |
1550 0x00FF00, | |
1551 0x00FFFF, | |
1552 0xFFFF00, | |
1553 0xFFFFFF | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1554 }; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1555 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1556 g_grids[9] = 0xff0000d8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1557 g_grids[10] = 0xffd80000; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1558 g_grids[11] = 0xffd800d8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1559 g_grids[12] = 0xff00d800; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1560 g_grids[13] = 0xff00d8d8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1561 g_grids[14] = 0xffd8d800; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1562 g_grids[15] = 0xffd8d8d8; |
154 | 1563 |
1564 for (int i = 0; i < g_maxcolors; i++) | |
1565 { | |
1566 if (i <= 8) | |
1567 g_grids[i] = (rgb[i] + 0x282828) | 0xff000000; | |
1568 | |
1569 makecolor(i, (rgb[i] >> 16) & 0xff, (rgb[i] >> 8) & 0xff, rgb[i] & 0xff); | |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1570 } |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1571 g_gridmode = NEW; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1572 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1573 |
49 | 1574 |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1575 void mpSetupMachine(int m) |
49 | 1576 { |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1577 machine = m; |
154 | 1578 |
1579 g_name = "ERROR"; | |
50 | 1580 g_exportext = "none"; |
154 | 1581 g_exportname = ""; |
1582 g_formatname = ""; | |
1583 g_formatext = ""; | |
1584 g_formatname = ""; | |
1585 g_formatext = ""; | |
1586 | |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1587 g_map[3] = byte(machine); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1588 g_map[13] = byte(machine); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1589 g_palsteps = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1590 g_farge = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1591 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1592 g_britemode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1593 g_charlimit = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1594 g_hzoomer = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1595 g_backmode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1596 g_maxcolors = 16; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1597 X = 320; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1598 Y = 200; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1599 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1600 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
|
1601 g_name = "c64"; |
50 | 1602 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
|
1603 g_exportname = "PRG file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1604 g_formatname = "Art Studio"; |
50 | 1605 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
|
1606 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1607 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1608 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1609 g_map[0] = 6; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1610 make_c64_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1611 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1612 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1613 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
|
1614 g_name = "cpc"; |
50 | 1615 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
|
1616 g_exportname = "BIN file" |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1617 g_formatname = ""; |
50 | 1618 g_formatext = ""; |
12
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1619 |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1620 g_hzoomer = 2; |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1621 g_palsteps = 3; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1622 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1623 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1624 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1625 g_map[0] = 1; |
0
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 makecolor(0, 0, 0, 0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1628 makecolor(1, 0x0, 0x0, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1629 makecolor(2, 0x00, 0x00, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1630 makecolor(3, 0x80, 0x00, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1631 makecolor(4, 0x80, 0x00, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1632 makecolor(5, 0x80, 0x00, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1633 makecolor(6, 0xFF, 0x00, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1634 makecolor(7, 0xFF, 0x00, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1635 makecolor(8, 0xFF, 0x00, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1636 makecolor(9, 0x00, 0x80, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1637 makecolor(10, 0x00, 0x80, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1638 makecolor(11, 0x00, 0x80, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1639 makecolor(12, 0x80, 0x80, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1640 makecolor(13, 0x80, 0x80, 0x80); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1641 makecolor(14, 0x80, 0x80, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1642 makecolor(15, 0xFF, 0xFF, 0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1643 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1644 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1645 if (machine == MSX) { // MSX |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1646 g_name = "msx"; |
50 | 1647 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
|
1648 g_exportname = "COM file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1649 g_formatname = "Screen 2"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1650 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
|
1651 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1652 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1653 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1654 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1655 g_backmode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1656 g_farge = 15; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1657 g_backg = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1658 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1659 //TI99 variant |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1660 /* |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1661 makecolor(0,0,0,0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1662 makecolor(1,0,0,0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1663 |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1664 makecolor(2,0x21,0xc8,0x42); //21c842 medgreen |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1665 makecolor(3,0x5e,0xdc,0x78);//5edc78 light green |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1666 makecolor(4,0x54,0x55,0xed);//5455ed dark blue |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1667 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
|
1668 |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1669 makecolor(6,0xd4,0x52,0x4d); //d4524d dark red |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1670 makecolor(7,0x42,0xeb,0xf5); //42ebf5 cyan |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1671 makecolor(8,0xfc,0x55,0x54); //fc5554 medium red |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1672 makecolor(9,0xff,0x79,0x78); //ff7978 light red |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1673 makecolor(10,0xd4,0xc1,0x54);// d4c154 dark yellow |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1674 makecolor(11,0xe6,0xce,0x80);// e6ce80 light yellow |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1675 makecolor(12,0x21,0xb0,0x3b);// 21b03b dark green |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1676 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
|
1677 makecolor(14,0xCc,0xcc,0xCc);// gray |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1678 makecolor(15,0xFF,0xFF,0xFF); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1679 */ |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1680 make_msx_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1681 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1682 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1683 if (machine == SPECTRUM) { // ZX Spectrum |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1684 g_name = "spec"; |
50 | 1685 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
|
1686 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
|
1687 g_formatname = "Screen$"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1688 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
|
1689 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1690 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1691 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1692 g_farge = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1693 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1694 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1695 g_britemode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1696 g_map[0] = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1697 g_map[1] = byte(255); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1698 make_spectrum_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1699 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1700 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1701 if (machine == TIMEX) { // timex sinclair |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1702 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
|
1703 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1704 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1705 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1706 g_farge = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1707 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1708 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1709 g_britemode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1710 g_map[1] = byte(255); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1711 make_spectrum_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1712 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1713 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1714 if (machine == JR200) { // Panasonic JR200 |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1715 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
|
1716 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1717 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1718 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1719 g_maxcolors = 8; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1720 g_farge = 7; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1721 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1722 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1723 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1724 make_spectrum_palette(); //cheating |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1725 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1726 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1727 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
|
1728 g_name = "plus4m"; |
50 | 1729 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
|
1730 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
|
1731 g_formatname = "M.Botticelli"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1732 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
|
1733 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1734 g_backmode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1735 g_multic = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1736 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1737 g_maxcolors = 121; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1738 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
|
1739 g_map[0] = 6; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1740 g_map[1] = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1741 g_map[2] = 61; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1742 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
|
1743 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1744 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
|
1745 g_name = "plus4"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1746 g_formatname = "Botticelli"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1747 g_formatext = "prg"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1748 g_multic = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1749 g_backmode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1750 g_charlimit = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1751 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1752 g_map[1] = byte(255); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1753 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1754 make_plus4_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1755 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1756 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1757 if (machine == C64M) { //c64 multicolor |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1758 g_name = "c64m"; |
50 | 1759 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
|
1760 g_exportname = "PRG file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1761 g_formatname = "A. A. Studio"; |
68
59731a72ce8b
Remove dots from format exts.
Matti Hamalainen <ccr@tnsp.org>
parents:
61
diff
changeset
|
1762 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
|
1763 |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1764 g_backmode = 1; |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1765 g_charlimit = 3; |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1766 g_multic = 1; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1767 g_attrimode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1768 g_map[1] = byte(0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1769 g_map[0] = 6; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1770 make_c64_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1771 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1772 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1773 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
|
1774 g_name = "test"; |
50 | 1775 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
|
1776 g_exportname = ""; |
49 | 1777 g_formatname = ""; |
50 | 1778 g_formatext = ""; |
49 | 1779 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1780 g_backmode = 1; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1781 g_maxcolors = 32; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1782 g_palsteps = 16; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1783 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1784 g_attrimode = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1785 g_map[1] = byte(0); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1786 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
|
1787 if (z < 16) { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1788 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
|
1789 } else { |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1790 makecolor(z, (z - 16) * 17, 0, 0); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1791 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1792 } |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1793 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1794 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1795 if (machine == C64FLI) { //c64 hires FLI = AFLI |
49 | 1796 g_name = "afli"; |
50 | 1797 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
|
1798 g_exportname = "PRG file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1799 g_formatname = ""; |
50 | 1800 g_formatext = ""; |
12
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1801 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1802 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1803 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1804 g_map[0] = 6; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1805 make_c64_palette(); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1806 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1807 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1808 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
|
1809 g_name = "fli"; |
50 | 1810 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
|
1811 g_exportname = "PRG file"; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1812 g_formatname = ""; |
50 | 1813 g_formatext = ""; |
12
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1814 |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1815 g_hzoomer = 2; |
a0a00f80b042
Make the machine setup sections a bit more uniform in order.
Matti Hamalainen <ccr@tnsp.org>
parents:
11
diff
changeset
|
1816 g_maxcolors = 16; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1817 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1818 g_attrimode = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1819 g_map[1] = byte(255); |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1820 g_map[0] = 6; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1821 make_c64_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1822 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1823 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1824 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
|
1825 g_name = "fake"; |
50 | 1826 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
|
1827 g_exportname = ""; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1828 g_formatname = ""; |
50 | 1829 g_formatext = ""; |
11 | 1830 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1831 X = 320; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1832 Y = 200; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1833 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1834 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
|
1835 g_farge = 15; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1836 g_backg = 0; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1837 make_c64_palette(); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1838 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1839 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1840 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
|
1841 g_name = "pico8"; |
50 | 1842 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
|
1843 g_exportname = ""; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1844 g_formatname = ""; |
50 | 1845 g_formatext = ""; |
11 | 1846 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1847 X = 128; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1848 Y = 128; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1849 g_farge = 15; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1850 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1851 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1852 g_attrimode = 2; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1853 makecolor(0, 0, 0, 0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1854 makecolor(1, 32, 51, 123); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1855 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
|
1856 makecolor(3, 0, 144, 61); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1857 makecolor(4, 171, 82, 54); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1858 makecolor(5, 52, 54, 53); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1859 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
|
1860 makecolor(7, 255, 241, 232); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1861 makecolor(8, 255, 0, 77); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1862 makecolor(9, 255, 155, 0); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1863 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
|
1864 makecolor(11, 0, 226, 50); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1865 makecolor(12, 41, 173, 255); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1866 makecolor(13, 132, 112, 169); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1867 makecolor(14, 255, 119, 168); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1868 makecolor(15, 255, 214, 197); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1869 } |
81
7ee5e0c590bd
Clean set_machine() and rename to mpSetupMachine()
Matti Hamalainen <ccr@tnsp.org>
parents:
78
diff
changeset
|
1870 else |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1871 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
|
1872 g_name = "unia"; |
50 | 1873 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
|
1874 g_exportname = ""; |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1875 g_formatname = ""; |
50 | 1876 g_formatext = ""; |
11 | 1877 |
2
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1878 X = 256; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1879 Y = 192; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1880 g_farge = 15; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1881 g_backg = 0; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1882 g_multic = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1883 g_attrimode = 2; |
5eb3559e1778
Run everything through JS-beautifier and remove trailing whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents:
1
diff
changeset
|
1884 makecolor(0, 0, 0, 0); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1885 makecolor(1, 0xff, 0xff, 0xff); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1886 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
|
1887 makecolor(3, 0xff, 0xc5, 0x00); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1888 makecolor(4, 0xff, 0x00, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1889 makecolor(5, 0xff, 0x3c, 0xb4); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1890 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
|
1891 makecolor(7, 0x1b, 0xa1, 0xfc); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1892 makecolor(8, 0xe1, 0xe1, 0xe1); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1893 makecolor(9, 0xb9, 0x63, 0x00); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1894 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
|
1895 makecolor(11, 0xd2, 0x9b, 0xd7); |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1896 makecolor(12, 0xad, 0xad, 0xad); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1897 makecolor(13, 0x00, 0xb7, 0xb7); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1898 makecolor(14, 0x23, 0xaf, 0x32); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1899 makecolor(15, 0x29, 0xf7, 0xa7); |
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1900 } |
133
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1901 |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1902 // Compute pixel width |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1903 if (g_multic == 1 || g_hzoomer == 2) |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1904 g_pixelw = 2; |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1905 else |
f5c32f6470d0
Begin integrating more changes from Multipaint 1.8.2018.
Matti Hamalainen <ccr@tnsp.org>
parents:
129
diff
changeset
|
1906 g_pixelw = 1; |
0
ebd5689e2985
Initial import of Multipaint sketch version 22.5.2017.
Tero Heikkinen
parents:
diff
changeset
|
1907 } |