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