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