commit 8fb1c78

neauoire  ·  2023-11-12 20:34:02 +0000 UTC
parent 9e5dbc0
Fixed issue drawing sprites
2 files changed,  +50, -4
+46, -0
 1@@ -9,6 +9,7 @@
 2 	#286c .System/g DEO2
 3 	#2358 .System/b DEO2
 4 	;on-mouse .Mouse/vector DEO2
 5+	<draw-guide>
 6 	BRK
 7 
 8 @on-mouse ( -> )
 9@@ -16,6 +17,7 @@
10 	#0000 DUP2 .Screen/x DEO2
11 	.Screen/y DEO2
12 	#80 .Screen/pixel DEO
13+	<draw-guide>
14 	( | cursor )
15 	#41 ;cursor-icn <update-cursor>
16 	( | draw portrait )
17@@ -47,6 +49,44 @@
18 	#05 .Screen/sprite DEOk DEOk DEOk DEO
19 	JMP2r
20 
21+@<draw-circle> ( color -- )
22+	#01 .Screen/auto DEO
23+	;circle-chr .Screen/addr DEO2
24+	DUP .Screen/sprite DEO
25+	DUP #10 ORA .Screen/sprite DEO
26+	.Screen/y DEI2k #0008 ADD2 ROT DEO2
27+	DUP #20 ORA .Screen/sprite DEO
28+	#30 ORA .Screen/sprite DEO
29+	JMP2r
30+
31+@<draw-guide> ( -- )
32+	#0000 DUP2 .Screen/x DEO2 .Screen/y DEO2
33+	#f2 .Screen/auto DEO
34+	;guide-icn .Screen/addr DEO2
35+	#1000
36+	&l ( -- ) 
37+		#01 .Screen/sprite DEO
38+		INC GTHk ?&l 
39+	POP2
40+	( | circles )
41+	#0010 DUP2 .Screen/x DEO2 .Screen/y DEO2
42+	#02 <draw-circle>
43+	.Screen/y DEI2k #0008 ADD2 ROT DEO2
44+	#82 <draw-circle>
45+	.Screen/y DEI2k #0008 ADD2 ROT DEO2
46+	#05 <draw-circle>
47+	.Screen/y DEI2k #0008 ADD2 ROT DEO2
48+	#85 <draw-circle>
49+	.Screen/y DEI2k #0008 ADD2 ROT DEO2
50+	#03 <draw-circle>
51+	.Screen/y DEI2k #0008 ADD2 ROT DEO2
52+	#83 <draw-circle>
53+	.Screen/y DEI2k #0008 ADD2 ROT DEO2
54+	#0a <draw-circle>
55+	.Screen/y DEI2k #0008 ADD2 ROT DEO2
56+	#8a <draw-circle>
57+	JMP2r
58+
59 @<update-cursor> ( color addr* -- )
60 	[ LIT2 00 -Screen/auto ] DEO
61 	;fill-icn .Screen/addr DEO2
62@@ -61,6 +101,8 @@
63 	.Screen/sprite DEO
64 	JMP2r
65 
66+@guide-icn [ 0101 0101 0101 01ff ]
67+
68 @fill-icn [ ffff ffff ffff ffff ]
69 
70 @cursor-icn [ 80c0 e0f0 f8e0 1000 ]
71@@ -93,3 +135,7 @@
72 	4142 4448 5020 1f00 0000 0000 0000 ff00
73 	0000 0000 0000 ff00 8242 2212 0a04 f800 ]
74 
75+@circle-chr [
76+	071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
77+
78+
+4, -4
 1@@ -60,8 +60,8 @@ screen_2bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16
 2 {
 3 	int width = uxn_screen.width, height = uxn_screen.height, opaque = (color % 5);
 4 	Uint8 *ch1 = &ram[addr], *ch2 = ch1 + 8;
 5-	Uint16 y, ymod = (fy < 0 ? 8 : 0), ymax = y1 + ymod + fy * 8;
 6-	Uint16 x, xmod = (fx > 0 ? 8 : 0), xmax = x1 + xmod - fx * 8;
 7+	Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8;
 8+	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
 9 	for(y = y1 + ymod; y != ymax; y += fy) {
10 		Uint16 c = *ch1++ | (*ch2++ << 8);
11 		for(x = x1 + xmod; x != xmax; x -= fx, c >>= 1) {
12@@ -77,8 +77,8 @@ screen_1bpp(Uint8 *layer, Uint8 *ram, Uint16 addr, Uint16 x1, Uint16 y1, Uint16
13 {
14 	int width = uxn_screen.width, height = uxn_screen.height, opaque = (color % 5);
15 	Uint8 *ch1 = &ram[addr];
16-	Uint16 y, ymod = (fy < 0 ? 8 : 0), ymax = y1 + ymod + fy * 8;
17-	Uint16 x, xmod = (fx > 0 ? 8 : 0), xmax = x1 + xmod - fx * 8;
18+	Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8;
19+	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
20 	for(y = y1 + ymod; y != ymax; y += fy) {
21 		Uint16 c = *ch1++;
22 		for(x = x1 + xmod; x != xmax; x -= fx, c >>= 1) {