comparison draw_inputs.pde @ 211:6d866e284dd2

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 29 Aug 2018 20:27:00 +0300
parents 934934bb1fbb
children 1c9deae71fb1
comparison
equal deleted inserted replaced
210:13aed87e472a 211:6d866e284dd2
68 68
69 69
70 int getmultic(int xc, int yc, int mode) //mode 0=screen 1=brush 70 int getmultic(int xc, int yc, int mode) //mode 0=screen 1=brush
71 { 71 {
72 //returns the multicolor color on point xc,yc 72 //returns the multicolor color on point xc,yc
73 int ad, looks, mmc, source1, source2; 73 int ad = 1024 + xc + yc * X;
74 ad = 1024 + xc + yc * X;
75 74
76 if (g_multic == 2) 75 if (g_multic == 2)
77 { 76 {
78 if (mode == 0) return g_map[ad]; 77 if (mode == 0) return g_map[ad];
79 if (mode == 1) return g_brush[ad]; 78 if (mode == 1) return g_brush[ad];
80 } 79 }
81 80
82 source1 = 0; 81 int source1 = 0,
83 source2 = 0; 82 source2 = 0,
84 83 looks = 65536 + int(chop2(xc) / 8) + int(yc / 8) * MX;
85 xc = chop2(xc);
86 looks = 65536 + int(xc / 8) + int(yc / 8) * MX;
87 84
88 if (mode == 0) 85 if (mode == 0)
89 { 86 {
90 source1 = g_map[ad]; 87 source1 = g_map[ad];
91 source2 = g_map[ad + 1]; 88 source2 = g_map[ad + 1];
95 { 92 {
96 source1 = g_brush[ad]; 93 source1 = g_brush[ad];
97 source2 = g_brush[ad + 1]; 94 source2 = g_brush[ad + 1];
98 } 95 }
99 96
100 mmc = source1 + source2 * 2; 97 int mmc = source1 + source2 * 2;
101 98
102 //source1=0 99 //source1=0
103 //source2=+1 100 //source2=+1
104 //00=zeroc =0 101 //00=zeroc =0
105 //01=color1=2 102 //01=color1=2
143 140
144 141
145 int getattra(int xx, int yy, int mode) //mode foreground backround 142 int getattra(int xx, int yy, int mode) //mode foreground backround
146 { 143 {
147 //returns the internal foreground / background color on point xx,yy 144 //returns the internal foreground / background color on point xx,yy
148 if (g_multic == 2) { 145 if (g_multic == 2)
149 if (mode == 0) return getmultic(xx, yy, 0); 146 {
150 return g_backg; 147 return (mode == 0) ? getmultic(xx, yy, 0) : g_backg;
151 } 148 }
152 else 149 else
153 if (g_multic == 1) { 150 if (g_multic == 1)
154 if (mode == 0) return getmultic(xx, yy, 0); 151 {
155 return g_map[1]; // was 0? 152 return (mode == 0) ? getmultic(xx, yy, 0) : g_map[1]; // was 0?
156 } 153 }
157 154
158 // XXX ! is this correct? yv is not used 155 // XXX ! is this correct? yv is not used
159 int val, 156 int val,
160 xv = int(xx / 8), 157 xv = int(xx / 8),
164 if (mode == 0) 161 if (mode == 0)
165 val = g_map[ad]; 162 val = g_map[ad];
166 else 163 else
167 val = g_map[ad + (MX * MY) * 8]; 164 val = g_map[ad + (MX * MY) * 8];
168 165
169 if (g_britemode == 1 && val == 8) 166 return (g_britemode == 1 && val == 8) ? 0 : val;
170 return 0;
171 else
172 return val;
173 } 167 }
174 168
175 169
176 int getabsa(int xx, int yy, int mode) //mode 0=screen 1=brush 170 int getabsa(int xx, int yy, int mode) //mode 0=screen 1=brush
177 { 171 {
221 return 0; 215 return 0;
222 else 216 else
223 if (g_multic > 0) 217 if (g_multic > 0)
224 return getmultic(xx, yy, 0); 218 return getmultic(xx, yy, 0);
225 else 219 else
226 if (g_multic == 0)
227 return getabsa(xx, yy, 0); 220 return getabsa(xx, yy, 0);
228 else
229 return 0;
230 } 221 }
231 222
232 223
233 void infersize() 224 void infersize()
234 { 225 {