commit 4a0607f
Devine Lu Linvega
·
2026-02-18 18:22:16 +0000 UTC
parent 6d9d022
Draw flipx using static values
1 files changed,
+14,
-11
+14,
-11
1@@ -524,9 +524,8 @@ screen_deo_sprite(void)
2 const int ctrl = dev[0x2f];
3 const int flipx = ctrl & 0x10, dx = flipx ? -rDY : rDY;
4 const int flipy = ctrl & 0x20, dy = flipy ? -rDX : rDX;
5- const int row_start = flipx ? 0 : 7, row_delta = flipx ? 1 : -1;
6- const int col_start = flipy ? 7 : 0, col_delta = flipy ? -1 : 1;
7 const int layer = ctrl & 0x40, layer_mask = layer ? 0x3 : 0xc;
8+ const int row_step = flipy ? -1 : 1, row_start = flipy ? 7 : 0;
9 const int is_2bpp = ctrl >> 7;
10 const int addr_incr = rMA << (is_2bpp + 1);
11 const int blend = ctrl & 0xf;
12@@ -536,15 +535,19 @@ screen_deo_sprite(void)
13 const Uint16 x0 = x + 8, y0 = y + 8;
14 if(x0 + 8 >= screen_wmar2 || y0 + 8 >= screen_hmar2) continue;
15 Uint8 *dst = screen_layers + y0 * screen_wmar2 + x0;
16- const Uint8 *col = &ram[rA + col_start];
17- for(j = 0; j < 8; j++, dst += screen_wmar2, col += col_delta) {
18- Uint8 *d = dst;
19- const int ch1 = *col, ch2 = is_2bpp ? col[8] : 0;
20- for(int k = 0, row = row_start; k < 8; k++, d++, row += row_delta) {
21- const int color = ((ch1 >> row) & 1) | (((ch2 >> row) & 1) << 1);
22- if(opaque_mask || color)
23- *d = (*d & layer_mask) | table[color];
24- }
25+ const Uint8 *rowptr = &ram[rA + row_start];
26+ for(j = 0; j < 8; j++, dst += screen_wmar2, rowptr += row_step) {
27+ Uint8 *d = dst, bits1 = rowptr[0], bits2 = is_2bpp ? rowptr[8] : 0;
28+ if(flipx)
29+ for(int k = 0; k < 8; k++, d++, bits1 >>= 1, bits2 >>= 1) {
30+ const int color = (bits1 & 1) | ((bits2 << 1) & 2);
31+ if(opaque_mask || color) *d = (*d & layer_mask) | table[color];
32+ }
33+ else
34+ for(int k = 0; k < 8; k++, d++, bits1 <<= 1, bits2 <<= 1) {
35+ const int color = (bits1 >> 7) | ((bits2 >> 6) & 2);
36+ if(opaque_mask || color) *d = (*d & layer_mask) | table[color];
37+ }
38 }
39 }
40 if(!screen_reqdraw) {