annotate exporters.pde @ 225:1c9deae71fb1

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