commit fddeb23
Devine Lu Linvega
·
2026-01-11 18:21:35 +0000 UTC
parent 1ed4169
Added opaque lut
1 files changed,
+6,
-3
+6,
-3
1@@ -427,7 +427,7 @@ static int screen_vector, *screen_pixels, screen_palette[16];
2 static int rX, rY, rA, rMX, rMY, rMA, rML, rDX, rDY;
3 static Uint8 *screen_layers;
4
5-static const Uint8 blending[16][2][4] = {
6+static const Uint8 blend_lut[16][2][4] = {
7 {{0, 0, 1, 2}, {0, 0, 4, 8}},
8 {{0, 1, 2, 3}, {0, 4, 8, 12}},
9 {{0, 2, 3, 1}, {0, 8, 12, 4}},
10@@ -445,6 +445,9 @@ static const Uint8 blending[16][2][4] = {
11 {{3, 2, 3, 1}, {12, 8, 12, 4}},
12 {{0, 3, 1, 2}, {0, 12, 4, 8}}};
13
14+static const int opaque_lut[16] = {
15+ 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0, -1, -1, -1, -1, 0};
16+
17 void emu_redraw(void), emu_resize(void);
18
19 static void
20@@ -606,11 +609,11 @@ screen_deo_sprite(void)
21 int i, j, x = rX, y = rY;
22 const int ctrl = dev[0x2f];
23 const int blend = ctrl & 0xf;
24- const int opaque_mask = -(blend % 5);
25+ const int opaque_mask = opaque_lut[blend];
26 const int flipx = ctrl & 0x10, dx = flipx ? -rDY : rDY;
27 const int flipy = ctrl & 0x20, dy = flipy ? -rDX : rDX;
28 const int layer_mask = (ctrl & 0x40) ? 0x3 : 0xc;
29- const Uint8 *table = (ctrl & 0x40) ? blending[blend][1] : blending[blend][0];
30+ const Uint8 *table = (ctrl & 0x40) ? blend_lut[blend][1] : blend_lut[blend][0];
31 const int is_2bpp = (ctrl & 0x80) != 0;
32 const int addr_incr = rMA << (is_2bpp ? 2 : 1);
33 const int stride = screen_wmar2;