commit d241ce1
zzo38
·
2023-09-07 03:40:44 +0000 UTC
parent 2fa40f1
Implement the new sprite flipping with reverse direction.
2 files changed,
+10,
-5
M
main.c
+3,
-0
1@@ -38,6 +38,9 @@ set corresponds to newer behaviour, generally.
2 * bit0 = clear if drawing sprites with colour mode 0 is opaque, or set if
3 it is transparent.
4
5+* bit1 = set if flipping will reverse the direction of auto advancement
6+when drawing sprites.
7+
8 Other bits are currently unused.
9
10
M
main.c
+7,
-5
1@@ -233,7 +233,7 @@ static Uint8 layers;
2 static Uint8 palet=7;
3 static Uint8 touch_mode=0;
4 static SDL_cond*stdin_cond;
5-static Uint8 screencompat=0x01;
6+static Uint8 screencompat=0x03;
7
8 static Uint16 scriptc;
9 static Script*scriptv;
10@@ -724,7 +724,7 @@ static void draw_sprite(Uint16 x,Uint16 y,Uint16 addr,Uint8 v) {
11 }
12
13 static void screen_out(Device*dev,Uint8 id) {
14- int i;
15+ int i,fx,fy;
16 Uint16 w;
17 Uint16 x=GET16(dev->d+8);
18 Uint16 y=GET16(dev->d+10);
19@@ -758,12 +758,14 @@ static void screen_out(Device*dev,Uint8 id) {
20 if(size_changed) set_screen_mode(scr_w,scr_h);
21 picture_changed=1;
22 w=GET16(dev->d+12);
23+ fx=((z&0x10)&&(screencompat&0x02)?-8:8);
24+ fy=((z&0x20)&&(screencompat&0x02)?-8:8);
25 for(i=0;i<=(dev->d[6]>>4);i++) {
26- draw_sprite(x+i*(dev->d[6]&0x02?8:0),y+i*(dev->d[6]&0x01?8:0),w,z);
27+ draw_sprite(x+i*(dev->d[6]&0x02?fx:0),y+i*(dev->d[6]&0x01?fy:0),w,z);
28 if(dev->d[6]&0x04) w+=z&0x80?16:8;
29 }
30- if(dev->d[6]&0x01) PUT16(dev->d+8,x+8);
31- if(dev->d[6]&0x02) PUT16(dev->d+10,y+8);
32+ if(dev->d[6]&0x01) PUT16(dev->d+8,x+fx);
33+ if(dev->d[6]&0x02) PUT16(dev->d+10,y+fy);
34 if(dev->d[6]&0x04) PUT16(dev->d+12,w);
35 break;
36 }