rlm@1
|
1 #include "GBAGfx.h"
|
rlm@1
|
2 #include "GBAGlobals.h"
|
rlm@1
|
3
|
rlm@1
|
4 void mode1RenderLine()
|
rlm@1
|
5 {
|
rlm@1
|
6 u16 *palette = (u16 *)paletteRAM;
|
rlm@1
|
7
|
rlm@1
|
8 if (DISPCNT & 0x80)
|
rlm@1
|
9 {
|
rlm@1
|
10 for (int x = 0; x < 240; x++)
|
rlm@1
|
11 {
|
rlm@1
|
12 lineMix[x] = 0x7fff;
|
rlm@1
|
13 }
|
rlm@1
|
14 gfxLastVCOUNT = VCOUNT;
|
rlm@1
|
15 return;
|
rlm@1
|
16 }
|
rlm@1
|
17
|
rlm@1
|
18 if (layerEnable & 0x0100)
|
rlm@1
|
19 {
|
rlm@1
|
20 gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
rlm@1
|
21 }
|
rlm@1
|
22
|
rlm@1
|
23 if (layerEnable & 0x0200)
|
rlm@1
|
24 {
|
rlm@1
|
25 gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
rlm@1
|
26 }
|
rlm@1
|
27
|
rlm@1
|
28 if (layerEnable & 0x0400)
|
rlm@1
|
29 {
|
rlm@1
|
30 int changed = gfxBG2Changed;
|
rlm@1
|
31 if (gfxLastVCOUNT > VCOUNT)
|
rlm@1
|
32 changed = 3;
|
rlm@1
|
33 gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
rlm@1
|
34 BG2PA, BG2PB, BG2PC, BG2PD,
|
rlm@1
|
35 gfxBG2X, gfxBG2Y, changed, line2);
|
rlm@1
|
36 }
|
rlm@1
|
37
|
rlm@1
|
38 gfxDrawSprites(lineOBJ);
|
rlm@1
|
39
|
rlm@1
|
40 u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
|
rlm@1
|
41
|
rlm@1
|
42 for (int x = 0; x < 240; x++)
|
rlm@1
|
43 {
|
rlm@1
|
44 u32 color = backdrop;
|
rlm@1
|
45 u8 top = 0x20;
|
rlm@1
|
46
|
rlm@1
|
47 if (line0[x] < color)
|
rlm@1
|
48 {
|
rlm@1
|
49 color = line0[x];
|
rlm@1
|
50 top = 0x01;
|
rlm@1
|
51 }
|
rlm@1
|
52
|
rlm@1
|
53 if ((u8)(line1[x]>>24) < (u8)(color >> 24))
|
rlm@1
|
54 {
|
rlm@1
|
55 color = line1[x];
|
rlm@1
|
56 top = 0x02;
|
rlm@1
|
57 }
|
rlm@1
|
58
|
rlm@1
|
59 if ((u8)(line2[x]>>24) < (u8)(color >> 24))
|
rlm@1
|
60 {
|
rlm@1
|
61 color = line2[x];
|
rlm@1
|
62 top = 0x04;
|
rlm@1
|
63 }
|
rlm@1
|
64
|
rlm@1
|
65 if ((u8)(lineOBJ[x]>>24) < (u8)(color >> 24))
|
rlm@1
|
66 {
|
rlm@1
|
67 color = lineOBJ[x];
|
rlm@1
|
68 top = 0x10;
|
rlm@1
|
69 }
|
rlm@1
|
70
|
rlm@1
|
71 if ((top & 0x10) && (color & 0x00010000))
|
rlm@1
|
72 {
|
rlm@1
|
73 // semi-transparent OBJ
|
rlm@1
|
74 u32 back = backdrop;
|
rlm@1
|
75 u8 top2 = 0x20;
|
rlm@1
|
76
|
rlm@1
|
77 if ((u8)(line0[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
78 {
|
rlm@1
|
79 back = line0[x];
|
rlm@1
|
80 top2 = 0x01;
|
rlm@1
|
81 }
|
rlm@1
|
82
|
rlm@1
|
83 if ((u8)(line1[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
84 {
|
rlm@1
|
85 back = line1[x];
|
rlm@1
|
86 top2 = 0x02;
|
rlm@1
|
87 }
|
rlm@1
|
88
|
rlm@1
|
89 if ((u8)(line2[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
90 {
|
rlm@1
|
91 back = line2[x];
|
rlm@1
|
92 top2 = 0x04;
|
rlm@1
|
93 }
|
rlm@1
|
94
|
rlm@1
|
95 if (top2 & (BLDMOD>>8))
|
rlm@1
|
96 color = gfxAlphaBlend(color, back,
|
rlm@1
|
97 coeff[COLEV & 0x1F],
|
rlm@1
|
98 coeff[(COLEV >> 8) & 0x1F]);
|
rlm@1
|
99 else
|
rlm@1
|
100 {
|
rlm@1
|
101 switch ((BLDMOD >> 6) & 3)
|
rlm@1
|
102 {
|
rlm@1
|
103 case 2:
|
rlm@1
|
104 if (BLDMOD & top)
|
rlm@1
|
105 color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
106 break;
|
rlm@1
|
107 case 3:
|
rlm@1
|
108 if (BLDMOD & top)
|
rlm@1
|
109 color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
110 break;
|
rlm@1
|
111 }
|
rlm@1
|
112 }
|
rlm@1
|
113 }
|
rlm@1
|
114
|
rlm@1
|
115 lineMix[x] = color;
|
rlm@1
|
116 }
|
rlm@1
|
117 gfxBG2Changed = 0;
|
rlm@1
|
118 gfxLastVCOUNT = VCOUNT;
|
rlm@1
|
119 }
|
rlm@1
|
120
|
rlm@1
|
121 void mode1RenderLineNoWindow()
|
rlm@1
|
122 {
|
rlm@1
|
123 u16 *palette = (u16 *)paletteRAM;
|
rlm@1
|
124
|
rlm@1
|
125 if (DISPCNT & 0x80)
|
rlm@1
|
126 {
|
rlm@1
|
127 for (int x = 0; x < 240; x++)
|
rlm@1
|
128 {
|
rlm@1
|
129 lineMix[x] = 0x7fff;
|
rlm@1
|
130 }
|
rlm@1
|
131 gfxLastVCOUNT = VCOUNT;
|
rlm@1
|
132 return;
|
rlm@1
|
133 }
|
rlm@1
|
134
|
rlm@1
|
135 if (layerEnable & 0x0100)
|
rlm@1
|
136 {
|
rlm@1
|
137 gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
rlm@1
|
138 }
|
rlm@1
|
139
|
rlm@1
|
140 if (layerEnable & 0x0200)
|
rlm@1
|
141 {
|
rlm@1
|
142 gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
rlm@1
|
143 }
|
rlm@1
|
144
|
rlm@1
|
145 if (layerEnable & 0x0400)
|
rlm@1
|
146 {
|
rlm@1
|
147 int changed = gfxBG2Changed;
|
rlm@1
|
148 if (gfxLastVCOUNT > VCOUNT)
|
rlm@1
|
149 changed = 3;
|
rlm@1
|
150 gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
rlm@1
|
151 BG2PA, BG2PB, BG2PC, BG2PD,
|
rlm@1
|
152 gfxBG2X, gfxBG2Y, changed, line2);
|
rlm@1
|
153 }
|
rlm@1
|
154
|
rlm@1
|
155 gfxDrawSprites(lineOBJ);
|
rlm@1
|
156
|
rlm@1
|
157 u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
|
rlm@1
|
158
|
rlm@1
|
159 for (int x = 0; x < 240; x++)
|
rlm@1
|
160 {
|
rlm@1
|
161 u32 color = backdrop;
|
rlm@1
|
162 u8 top = 0x20;
|
rlm@1
|
163
|
rlm@1
|
164 if (line0[x] < color)
|
rlm@1
|
165 {
|
rlm@1
|
166 color = line0[x];
|
rlm@1
|
167 top = 0x01;
|
rlm@1
|
168 }
|
rlm@1
|
169
|
rlm@1
|
170 if ((u8)(line1[x]>>24) < (u8)(color >> 24))
|
rlm@1
|
171 {
|
rlm@1
|
172 color = line1[x];
|
rlm@1
|
173 top = 0x02;
|
rlm@1
|
174 }
|
rlm@1
|
175
|
rlm@1
|
176 if ((u8)(line2[x]>>24) < (u8)(color >> 24))
|
rlm@1
|
177 {
|
rlm@1
|
178 color = line2[x];
|
rlm@1
|
179 top = 0x04;
|
rlm@1
|
180 }
|
rlm@1
|
181
|
rlm@1
|
182 if ((u8)(lineOBJ[x]>>24) < (u8)(color >> 24))
|
rlm@1
|
183 {
|
rlm@1
|
184 color = lineOBJ[x];
|
rlm@1
|
185 top = 0x10;
|
rlm@1
|
186 }
|
rlm@1
|
187
|
rlm@1
|
188 if (!(color & 0x00010000))
|
rlm@1
|
189 {
|
rlm@1
|
190 switch ((BLDMOD >> 6) & 3)
|
rlm@1
|
191 {
|
rlm@1
|
192 case 0:
|
rlm@1
|
193 break;
|
rlm@1
|
194 case 1:
|
rlm@1
|
195 {
|
rlm@1
|
196 if (top & BLDMOD)
|
rlm@1
|
197 {
|
rlm@1
|
198 u32 back = backdrop;
|
rlm@1
|
199 u8 top2 = 0x20;
|
rlm@1
|
200 if ((u8)(line0[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
201 {
|
rlm@1
|
202 if (top != 0x01)
|
rlm@1
|
203 {
|
rlm@1
|
204 back = line0[x];
|
rlm@1
|
205 top2 = 0x01;
|
rlm@1
|
206 }
|
rlm@1
|
207 }
|
rlm@1
|
208
|
rlm@1
|
209 if ((u8)(line1[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
210 {
|
rlm@1
|
211 if (top != 0x02)
|
rlm@1
|
212 {
|
rlm@1
|
213 back = line1[x];
|
rlm@1
|
214 top2 = 0x02;
|
rlm@1
|
215 }
|
rlm@1
|
216 }
|
rlm@1
|
217
|
rlm@1
|
218 if ((u8)(line2[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
219 {
|
rlm@1
|
220 if (top != 0x04)
|
rlm@1
|
221 {
|
rlm@1
|
222 back = line2[x];
|
rlm@1
|
223 top2 = 0x04;
|
rlm@1
|
224 }
|
rlm@1
|
225 }
|
rlm@1
|
226
|
rlm@1
|
227 if ((u8)(lineOBJ[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
228 {
|
rlm@1
|
229 if (top != 0x10)
|
rlm@1
|
230 {
|
rlm@1
|
231 back = lineOBJ[x];
|
rlm@1
|
232 top2 = 0x10;
|
rlm@1
|
233 }
|
rlm@1
|
234 }
|
rlm@1
|
235
|
rlm@1
|
236 if (top2 & (BLDMOD>>8))
|
rlm@1
|
237 color = gfxAlphaBlend(color, back,
|
rlm@1
|
238 coeff[COLEV & 0x1F],
|
rlm@1
|
239 coeff[(COLEV >> 8) & 0x1F]);
|
rlm@1
|
240 }
|
rlm@1
|
241 break;
|
rlm@1
|
242 }
|
rlm@1
|
243 case 2:
|
rlm@1
|
244 if (BLDMOD & top)
|
rlm@1
|
245 color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
246 break;
|
rlm@1
|
247 case 3:
|
rlm@1
|
248 if (BLDMOD & top)
|
rlm@1
|
249 color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
250 break;
|
rlm@1
|
251 }
|
rlm@1
|
252 }
|
rlm@1
|
253 else
|
rlm@1
|
254 {
|
rlm@1
|
255 // semi-transparent OBJ
|
rlm@1
|
256 u32 back = backdrop;
|
rlm@1
|
257 u8 top2 = 0x20;
|
rlm@1
|
258
|
rlm@1
|
259 if ((u8)(line0[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
260 {
|
rlm@1
|
261 back = line0[x];
|
rlm@1
|
262 top2 = 0x01;
|
rlm@1
|
263 }
|
rlm@1
|
264
|
rlm@1
|
265 if ((u8)(line1[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
266 {
|
rlm@1
|
267 back = line1[x];
|
rlm@1
|
268 top2 = 0x02;
|
rlm@1
|
269 }
|
rlm@1
|
270
|
rlm@1
|
271 if ((u8)(line2[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
272 {
|
rlm@1
|
273 back = line2[x];
|
rlm@1
|
274 top2 = 0x04;
|
rlm@1
|
275 }
|
rlm@1
|
276
|
rlm@1
|
277 if (top2 & (BLDMOD>>8))
|
rlm@1
|
278 color = gfxAlphaBlend(color, back,
|
rlm@1
|
279 coeff[COLEV & 0x1F],
|
rlm@1
|
280 coeff[(COLEV >> 8) & 0x1F]);
|
rlm@1
|
281 else
|
rlm@1
|
282 {
|
rlm@1
|
283 switch ((BLDMOD >> 6) & 3)
|
rlm@1
|
284 {
|
rlm@1
|
285 case 2:
|
rlm@1
|
286 if (BLDMOD & top)
|
rlm@1
|
287 color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
288 break;
|
rlm@1
|
289 case 3:
|
rlm@1
|
290 if (BLDMOD & top)
|
rlm@1
|
291 color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
292 break;
|
rlm@1
|
293 }
|
rlm@1
|
294 }
|
rlm@1
|
295 }
|
rlm@1
|
296
|
rlm@1
|
297 lineMix[x] = color;
|
rlm@1
|
298 }
|
rlm@1
|
299 gfxBG2Changed = 0;
|
rlm@1
|
300 gfxLastVCOUNT = VCOUNT;
|
rlm@1
|
301 }
|
rlm@1
|
302
|
rlm@1
|
303 void mode1RenderLineAll()
|
rlm@1
|
304 {
|
rlm@1
|
305 u16 *palette = (u16 *)paletteRAM;
|
rlm@1
|
306
|
rlm@1
|
307 if (DISPCNT & 0x80)
|
rlm@1
|
308 {
|
rlm@1
|
309 for (int x = 0; x < 240; x++)
|
rlm@1
|
310 {
|
rlm@1
|
311 lineMix[x] = 0x7fff;
|
rlm@1
|
312 }
|
rlm@1
|
313 gfxLastVCOUNT = VCOUNT;
|
rlm@1
|
314 return;
|
rlm@1
|
315 }
|
rlm@1
|
316
|
rlm@1
|
317 bool inWindow0 = false;
|
rlm@1
|
318 bool inWindow1 = false;
|
rlm@1
|
319
|
rlm@1
|
320 if (layerEnable & 0x2000)
|
rlm@1
|
321 {
|
rlm@1
|
322 u8 v0 = WIN0V >> 8;
|
rlm@1
|
323 u8 v1 = WIN0V & 255;
|
rlm@1
|
324 inWindow0 = ((v0 == v1) && (v0 >= 0xe8));
|
rlm@1
|
325 if (v1 >= v0)
|
rlm@1
|
326 inWindow0 |= (VCOUNT >= v0 && VCOUNT < v1);
|
rlm@1
|
327 else
|
rlm@1
|
328 inWindow0 |= (VCOUNT >= v0 || VCOUNT < v1);
|
rlm@1
|
329 }
|
rlm@1
|
330 if (layerEnable & 0x4000)
|
rlm@1
|
331 {
|
rlm@1
|
332 u8 v0 = WIN1V >> 8;
|
rlm@1
|
333 u8 v1 = WIN1V & 255;
|
rlm@1
|
334 inWindow1 = ((v0 == v1) && (v0 >= 0xe8));
|
rlm@1
|
335 if (v1 >= v0)
|
rlm@1
|
336 inWindow1 |= (VCOUNT >= v0 && VCOUNT < v1);
|
rlm@1
|
337 else
|
rlm@1
|
338 inWindow1 |= (VCOUNT >= v0 || VCOUNT < v1);
|
rlm@1
|
339 }
|
rlm@1
|
340
|
rlm@1
|
341 if (layerEnable & 0x0100)
|
rlm@1
|
342 {
|
rlm@1
|
343 gfxDrawTextScreen(BG0CNT, BG0HOFS, BG0VOFS, line0);
|
rlm@1
|
344 }
|
rlm@1
|
345
|
rlm@1
|
346 if (layerEnable & 0x0200)
|
rlm@1
|
347 {
|
rlm@1
|
348 gfxDrawTextScreen(BG1CNT, BG1HOFS, BG1VOFS, line1);
|
rlm@1
|
349 }
|
rlm@1
|
350
|
rlm@1
|
351 if (layerEnable & 0x0400)
|
rlm@1
|
352 {
|
rlm@1
|
353 int changed = gfxBG2Changed;
|
rlm@1
|
354 if (gfxLastVCOUNT > VCOUNT)
|
rlm@1
|
355 changed = 3;
|
rlm@1
|
356 gfxDrawRotScreen(BG2CNT, BG2X_L, BG2X_H, BG2Y_L, BG2Y_H,
|
rlm@1
|
357 BG2PA, BG2PB, BG2PC, BG2PD,
|
rlm@1
|
358 gfxBG2X, gfxBG2Y, changed, line2);
|
rlm@1
|
359 }
|
rlm@1
|
360
|
rlm@1
|
361 gfxDrawSprites(lineOBJ);
|
rlm@1
|
362 gfxDrawOBJWin(lineOBJWin);
|
rlm@1
|
363
|
rlm@1
|
364 u32 backdrop = (READ16LE(&palette[0]) | 0x30000000);
|
rlm@1
|
365
|
rlm@1
|
366 u8 inWin0Mask = WININ & 0xFF;
|
rlm@1
|
367 u8 inWin1Mask = WININ >> 8;
|
rlm@1
|
368 u8 outMask = WINOUT & 0xFF;
|
rlm@1
|
369
|
rlm@1
|
370 for (int x = 0; x < 240; x++)
|
rlm@1
|
371 {
|
rlm@1
|
372 u32 color = backdrop;
|
rlm@1
|
373 u8 top = 0x20;
|
rlm@1
|
374 u8 mask = outMask;
|
rlm@1
|
375
|
rlm@1
|
376 if (!(lineOBJWin[x] & 0x80000000))
|
rlm@1
|
377 {
|
rlm@1
|
378 mask = WINOUT >> 8;
|
rlm@1
|
379 }
|
rlm@1
|
380
|
rlm@1
|
381 if (inWindow1)
|
rlm@1
|
382 {
|
rlm@1
|
383 if (gfxInWin1[x])
|
rlm@1
|
384 mask = inWin1Mask;
|
rlm@1
|
385 }
|
rlm@1
|
386
|
rlm@1
|
387 if (inWindow0)
|
rlm@1
|
388 {
|
rlm@1
|
389 if (gfxInWin0[x])
|
rlm@1
|
390 {
|
rlm@1
|
391 mask = inWin0Mask;
|
rlm@1
|
392 }
|
rlm@1
|
393 }
|
rlm@1
|
394
|
rlm@1
|
395 if (line0[x] < color && (mask & 1))
|
rlm@1
|
396 {
|
rlm@1
|
397 color = line0[x];
|
rlm@1
|
398 top = 0x01;
|
rlm@1
|
399 }
|
rlm@1
|
400
|
rlm@1
|
401 if ((u8)(line1[x]>>24) < (u8)(color >> 24) && (mask & 2))
|
rlm@1
|
402 {
|
rlm@1
|
403 color = line1[x];
|
rlm@1
|
404 top = 0x02;
|
rlm@1
|
405 }
|
rlm@1
|
406
|
rlm@1
|
407 if ((u8)(line2[x]>>24) < (u8)(color >> 24) && (mask & 4))
|
rlm@1
|
408 {
|
rlm@1
|
409 color = line2[x];
|
rlm@1
|
410 top = 0x04;
|
rlm@1
|
411 }
|
rlm@1
|
412
|
rlm@1
|
413 if ((u8)(lineOBJ[x]>>24) < (u8)(color >> 24) && (mask & 16))
|
rlm@1
|
414 {
|
rlm@1
|
415 color = lineOBJ[x];
|
rlm@1
|
416 top = 0x10;
|
rlm@1
|
417 }
|
rlm@1
|
418
|
rlm@1
|
419 // special FX on the window
|
rlm@1
|
420 if (mask & 32)
|
rlm@1
|
421 {
|
rlm@1
|
422 if (!(color & 0x00010000))
|
rlm@1
|
423 {
|
rlm@1
|
424 switch ((BLDMOD >> 6) & 3)
|
rlm@1
|
425 {
|
rlm@1
|
426 case 0:
|
rlm@1
|
427 break;
|
rlm@1
|
428 case 1:
|
rlm@1
|
429 {
|
rlm@1
|
430 if (top & BLDMOD)
|
rlm@1
|
431 {
|
rlm@1
|
432 u32 back = backdrop;
|
rlm@1
|
433 u8 top2 = 0x20;
|
rlm@1
|
434 if ((mask & 1) && (u8)(line0[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
435 {
|
rlm@1
|
436 if (top != 0x01)
|
rlm@1
|
437 {
|
rlm@1
|
438 back = line0[x];
|
rlm@1
|
439 top2 = 0x01;
|
rlm@1
|
440 }
|
rlm@1
|
441 }
|
rlm@1
|
442
|
rlm@1
|
443 if ((mask & 2) && (u8)(line1[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
444 {
|
rlm@1
|
445 if (top != 0x02)
|
rlm@1
|
446 {
|
rlm@1
|
447 back = line1[x];
|
rlm@1
|
448 top2 = 0x02;
|
rlm@1
|
449 }
|
rlm@1
|
450 }
|
rlm@1
|
451
|
rlm@1
|
452 if ((mask & 4) && (u8)(line2[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
453 {
|
rlm@1
|
454 if (top != 0x04)
|
rlm@1
|
455 {
|
rlm@1
|
456 back = line2[x];
|
rlm@1
|
457 top2 = 0x04;
|
rlm@1
|
458 }
|
rlm@1
|
459 }
|
rlm@1
|
460
|
rlm@1
|
461 if ((mask & 16) && (u8)(lineOBJ[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
462 {
|
rlm@1
|
463 if (top != 0x10)
|
rlm@1
|
464 {
|
rlm@1
|
465 back = lineOBJ[x];
|
rlm@1
|
466 top2 = 0x10;
|
rlm@1
|
467 }
|
rlm@1
|
468 }
|
rlm@1
|
469
|
rlm@1
|
470 if (top2 & (BLDMOD>>8))
|
rlm@1
|
471 color = gfxAlphaBlend(color, back,
|
rlm@1
|
472 coeff[COLEV & 0x1F],
|
rlm@1
|
473 coeff[(COLEV >> 8) & 0x1F]);
|
rlm@1
|
474 }
|
rlm@1
|
475 break;
|
rlm@1
|
476 }
|
rlm@1
|
477 case 2:
|
rlm@1
|
478 if (BLDMOD & top)
|
rlm@1
|
479 color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
480 break;
|
rlm@1
|
481 case 3:
|
rlm@1
|
482 if (BLDMOD & top)
|
rlm@1
|
483 color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
484 break;
|
rlm@1
|
485 }
|
rlm@1
|
486 }
|
rlm@1
|
487 else
|
rlm@1
|
488 {
|
rlm@1
|
489 // semi-transparent OBJ
|
rlm@1
|
490 u32 back = backdrop;
|
rlm@1
|
491 u8 top2 = 0x20;
|
rlm@1
|
492
|
rlm@1
|
493 if ((mask & 1) && (u8)(line0[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
494 {
|
rlm@1
|
495 back = line0[x];
|
rlm@1
|
496 top2 = 0x01;
|
rlm@1
|
497 }
|
rlm@1
|
498
|
rlm@1
|
499 if ((mask & 2) && (u8)(line1[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
500 {
|
rlm@1
|
501 back = line1[x];
|
rlm@1
|
502 top2 = 0x02;
|
rlm@1
|
503 }
|
rlm@1
|
504
|
rlm@1
|
505 if ((mask & 4) && (u8)(line2[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
506 {
|
rlm@1
|
507 back = line2[x];
|
rlm@1
|
508 top2 = 0x04;
|
rlm@1
|
509 }
|
rlm@1
|
510
|
rlm@1
|
511 if (top2 & (BLDMOD>>8))
|
rlm@1
|
512 color = gfxAlphaBlend(color, back,
|
rlm@1
|
513 coeff[COLEV & 0x1F],
|
rlm@1
|
514 coeff[(COLEV >> 8) & 0x1F]);
|
rlm@1
|
515 else
|
rlm@1
|
516 {
|
rlm@1
|
517 switch ((BLDMOD >> 6) & 3)
|
rlm@1
|
518 {
|
rlm@1
|
519 case 2:
|
rlm@1
|
520 if (BLDMOD & top)
|
rlm@1
|
521 color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
522 break;
|
rlm@1
|
523 case 3:
|
rlm@1
|
524 if (BLDMOD & top)
|
rlm@1
|
525 color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
526 break;
|
rlm@1
|
527 }
|
rlm@1
|
528 }
|
rlm@1
|
529 }
|
rlm@1
|
530 }
|
rlm@1
|
531 else if (color & 0x00010000)
|
rlm@1
|
532 {
|
rlm@1
|
533 // semi-transparent OBJ
|
rlm@1
|
534 u32 back = backdrop;
|
rlm@1
|
535 u8 top2 = 0x20;
|
rlm@1
|
536
|
rlm@1
|
537 if ((mask & 1) && (u8)(line0[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
538 {
|
rlm@1
|
539 back = line0[x];
|
rlm@1
|
540 top2 = 0x01;
|
rlm@1
|
541 }
|
rlm@1
|
542
|
rlm@1
|
543 if ((mask & 2) && (u8)(line1[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
544 {
|
rlm@1
|
545 back = line1[x];
|
rlm@1
|
546 top2 = 0x02;
|
rlm@1
|
547 }
|
rlm@1
|
548
|
rlm@1
|
549 if ((mask & 4) && (u8)(line2[x]>>24) < (u8)(back >> 24))
|
rlm@1
|
550 {
|
rlm@1
|
551 back = line2[x];
|
rlm@1
|
552 top2 = 0x04;
|
rlm@1
|
553 }
|
rlm@1
|
554
|
rlm@1
|
555 if (top2 & (BLDMOD>>8))
|
rlm@1
|
556 color = gfxAlphaBlend(color, back,
|
rlm@1
|
557 coeff[COLEV & 0x1F],
|
rlm@1
|
558 coeff[(COLEV >> 8) & 0x1F]);
|
rlm@1
|
559 else
|
rlm@1
|
560 {
|
rlm@1
|
561 switch ((BLDMOD >> 6) & 3)
|
rlm@1
|
562 {
|
rlm@1
|
563 case 2:
|
rlm@1
|
564 if (BLDMOD & top)
|
rlm@1
|
565 color = gfxIncreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
566 break;
|
rlm@1
|
567 case 3:
|
rlm@1
|
568 if (BLDMOD & top)
|
rlm@1
|
569 color = gfxDecreaseBrightness(color, coeff[COLY & 0x1F]);
|
rlm@1
|
570 break;
|
rlm@1
|
571 }
|
rlm@1
|
572 }
|
rlm@1
|
573 }
|
rlm@1
|
574
|
rlm@1
|
575 lineMix[x] = color;
|
rlm@1
|
576 }
|
rlm@1
|
577 gfxBG2Changed = 0;
|
rlm@1
|
578 gfxLastVCOUNT = VCOUNT;
|
rlm@1
|
579 }
|
rlm@1
|
580
|