annotate exporters.pde @ 234:7afa7c257d93

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