commit 05a38b3
Devine Lu Linvega
·
2025-12-30 22:38:53 +0000 UTC
parent e53c964
Faster sprites still!
1 files changed,
+20,
-24
+20,
-24
1@@ -602,19 +602,17 @@ screen_draw_sprite(void)
2 if(ctrl & 0x80) {
3 const int addr_incr = rMA << 2;
4 for(i = 0; i <= rML; i++, x += dyx, y += dxy, rA += addr_incr) {
5- const Uint16 xmar2 = x + 16, ymar2 = y + 16;
6- if(xmar2 < screen_wmar2 && ymar2 < screen_hmar2) {
7+ const Uint16 xmar2 = x + 16, ymar2 = y + 16, xmar = x + 8;
8+ if(xmar2 < screen_wmar2 && ymar2 < screen_hmar2 && xmar2 == xmar + 8) {
9 const Uint8 *sprite = &ram[rA];
10- const Uint16 xmar = x + 8, ymar = y + 8;
11- if(xmar2 == xmar + 8) {
12- for(ay = ymar * screen_wmar2, by = ymar2 * screen_wmar2, qy = qfy; ay < by; ay += screen_wmar2, qy += fy) {
13- const int ch1 = sprite[qy], ch2 = sprite[qy + 8] << 1;
14- Uint8 *dst = &screen_layers[xmar + ay];
15- if(opaque) {
16- o2BPP(0) o2BPP(1) o2BPP(2) o2BPP(3) o2BPP(4) o2BPP(5) o2BPP(6) o2BPP(7)
17- } else {
18- a2BPP(0) a2BPP(1) a2BPP(2) a2BPP(3) a2BPP(4) a2BPP(5) a2BPP(6) a2BPP(7)
19- }
20+ const Uint16 ymar = y + 8;
21+ for(ay = ymar * screen_wmar2, by = ymar2 * screen_wmar2, qy = qfy; ay < by; ay += screen_wmar2, qy += fy) {
22+ const int ch1 = sprite[qy], ch2 = sprite[qy + 8] << 1;
23+ Uint8 *dst = &screen_layers[xmar + ay];
24+ if(opaque) {
25+ o2BPP(0) o2BPP(1) o2BPP(2) o2BPP(3) o2BPP(4) o2BPP(5) o2BPP(6) o2BPP(7)
26+ } else {
27+ a2BPP(0) a2BPP(1) a2BPP(2) a2BPP(3) a2BPP(4) a2BPP(5) a2BPP(6) a2BPP(7)
28 }
29 }
30 }
31@@ -622,19 +620,17 @@ screen_draw_sprite(void)
32 } else {
33 const int addr_incr = rMA << 1;
34 for(i = 0; i <= rML; i++, x += dyx, y += dxy, rA += addr_incr) {
35- const Uint16 xmar2 = x + 16, ymar2 = y + 16;
36- if(xmar2 < screen_wmar2 && ymar2 < screen_hmar2) {
37+ const Uint16 xmar2 = x + 16, ymar2 = y + 16, xmar = x + 8;
38+ if(xmar2 < screen_wmar2 && ymar2 < screen_hmar2 && xmar2 == xmar + 8) {
39 const Uint8 *sprite = &ram[rA];
40- const Uint16 xmar = x + 8, ymar = y + 8;
41- if(xmar2 == xmar + 8) {
42- for(ay = ymar * screen_wmar2, by = ymar2 * screen_wmar2, qy = qfy; ay < by; ay += screen_wmar2, qy += fy) {
43- const int ch1 = sprite[qy];
44- Uint8 *dst = &screen_layers[xmar + ay];
45- if(opaque) {
46- o1BPP(0) o1BPP(1) o1BPP(2) o1BPP(3) o1BPP(4) o1BPP(5) o1BPP(6) o1BPP(7)
47- } else {
48- a1BPP(0) a1BPP(1) a1BPP(2) a1BPP(3) a1BPP(4) a1BPP(5) a1BPP(6) a1BPP(7)
49- }
50+ const Uint16 ymar = y + 8;
51+ for(ay = ymar * screen_wmar2, by = ymar2 * screen_wmar2, qy = qfy; ay < by; ay += screen_wmar2, qy += fy) {
52+ const int ch1 = sprite[qy];
53+ Uint8 *dst = &screen_layers[xmar + ay];
54+ if(opaque) {
55+ o1BPP(0) o1BPP(1) o1BPP(2) o1BPP(3) o1BPP(4) o1BPP(5) o1BPP(6) o1BPP(7)
56+ } else {
57+ a1BPP(0) a1BPP(1) a1BPP(2) a1BPP(3) a1BPP(4) a1BPP(5) a1BPP(6) a1BPP(7)
58 }
59 }
60 }