commit 79c1964
Devine Lu Linvega
·
2025-12-30 19:53:40 +0000 UTC
parent 7126a9d
Use pointer in 1bpp sprites
1 files changed,
+6,
-5
+6,
-5
1@@ -606,16 +606,17 @@ screen_draw_sprite(void)
2 } else {
3 const int addr_incr = rMA << 1;
4 for(i = 0; i <= rML; i++, x += dyx, y += dxy, rA += addr_incr) {
5- const Uint16 ymar2 = MAR2(y), xmar2 = MAR2(x);
6+ const Uint16 xmar2 = x + 16, ymar2 = y + 16;
7 if(xmar2 < screen_wmar2 && ymar2 < screen_hmar2) {
8- const Uint16 xmar = MAR(x), ymar = MAR(y);
9 const Uint8 *sprite = &ram[rA];
10+ const Uint16 xmar = x + 8, ymar = y + 8;
11 for(ay = ymar * screen_wmar2, by = ymar2 * screen_wmar2, qy = qfy; ay < by; ay += screen_wmar2, qy += fy) {
12 const int ch1 = sprite[qy];
13- for(ax = xmar + ay, bx = xmar2 + ay, qx = qfx; ax < bx; ax++, qx -= fx) {
14- const int color = ch1 >> qx & 1;
15+ Uint8 *dst = &screen_layers[xmar + ay];
16+ for(int px = 0, qx = qfx; px < 8; px++, qx -= fx, dst++) {
17+ const int color = (ch1 >> qx) & 1;
18 if(opaque || color)
19- screen_layers[ax] = (screen_layers[ax] & layer_mask) | table[color];
20+ *dst = (*dst & layer_mask) | table[color];
21 }
22 }
23 }