Browse code

Added alpha to blending table

neauoire authored on 01/08/2021 18:16:29
Showing 1 changed files
... ...
@@ -12,11 +12,12 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 12
 WITH REGARD TO THIS SOFTWARE.
13 13
 */
14 14
 
15
-static Uint8 blending[4][16] = {
15
+static Uint8 blending[5][16] = {
16 16
 	{0, 0, 0, 0, 1, 0, 1, 1, 2, 2, 0, 2, 3, 3, 3, 0},
17 17
 	{0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3},
18 18
 	{1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1, 1, 2, 3, 1},
19
-	{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2}};
19
+	{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2},
20
+	{1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0}};
20 21
 
21 22
 void
22 23
 clear(Ppu *p)
... ...
@@ -41,7 +42,7 @@ puticn(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint
41 42
 	for(v = 0; v < 8; v++)
42 43
 		for(h = 0; h < 8; h++) {
43 44
 			Uint8 ch1 = (sprite[v] >> (7 - h)) & 0x1;
44
-			if(ch1 || (color != 0x05 && color != 0x0a && color != 0x0f))
45
+			if(ch1 || blending[4][color])
45 46
 				putpixel(p,
46 47
 					layer,
47 48
 					x + (flipx ? 7 - h : h),
... ...
@@ -59,7 +60,7 @@ putchr(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, Uint
59 60
 			Uint8 ch1 = ((sprite[v] >> (7 - h)) & 0x1);
60 61
 			Uint8 ch2 = ((sprite[v + 8] >> (7 - h)) & 0x1);
61 62
 			Uint8 ch = ch1 + ch2 * 2;
62
-			if(ch || (color != 0x05 && color != 0x0a && color != 0x0f))
63
+			if(ch || blending[4][color])
63 64
 				putpixel(p,
64 65
 					layer,
65 66
 					x + (flipx ? 7 - h : h),