commit d83c55a
Devine Lu Linvega
·
2025-12-30 20:18:04 +0000 UTC
parent 8788607
Trying to use pointers in sprite drawing too
1 files changed,
+8,
-4
+8,
-4
1@@ -594,10 +594,12 @@ screen_draw_sprite(void)
2 const Uint16 xmar = x + 8, ymar = y + 8;
3 for(ay = ymar * screen_wmar2, by = ymar2 * screen_wmar2, qy = qfy; ay < by; ay += screen_wmar2, qy += fy) {
4 const int ch1 = sprite[qy], ch2 = sprite[qy + 8] << 1;
5- for(ax = xmar + ay, bx = xmar2 + ay, qx = qfx; ax < bx; ax++, qx -= fx) {
6+ Uint8 *dst = screen_layers + (xmar + ay);
7+ Uint8 *end = screen_layers + (xmar2 + ay);
8+ for(qx = qfx; dst < end; qx -= fx, dst++) {
9 const int color = ((ch1 >> qx) & 1) | ((ch2 >> qx) & 2);
10 if(opaque || color)
11- screen_layers[ax] = (screen_layers[ax] & layer_mask) | table[color];
12+ *dst = (*dst & layer_mask) | table[color];
13 }
14 }
15 }
16@@ -611,10 +613,12 @@ screen_draw_sprite(void)
17 const Uint16 xmar = x + 8, ymar = y + 8;
18 for(ay = ymar * screen_wmar2, by = ymar2 * screen_wmar2, qy = qfy; ay < by; ay += screen_wmar2, qy += fy) {
19 const int ch1 = sprite[qy];
20- for(ax = xmar + ay, bx = xmar2 + ay, qx = qfx; ax < bx; ax++, qx -= fx) {
21+ Uint8 *dst = screen_layers + (xmar + ay);
22+ Uint8 *end = screen_layers + (xmar2 + ay);
23+ for(qx = qfx; dst < end; qx -= fx, dst++) {
24 const int color = (ch1 >> qx) & 1;
25 if(opaque || color)
26- screen_layers[ax] = (screen_layers[ax] & layer_mask) | table[color];
27+ *dst = (*dst & layer_mask) | table[color];
28 }
29 }
30 }