commit c0dccb0

Devine Lu Linvega  ·  2024-11-19 22:52:21 +0000 UTC
parent 97ab50b
Faster vertical checks
2 files changed,  +31, -39
+27, -34
  1@@ -9,51 +9,35 @@
  2 	#286c .System/g DEO2
  3 	#2358 .System/b DEO2
  4 	;on-mouse .Mouse/vector DEO2
  5-	( <draw-guide> )
  6-	.Screen/width DEI2 #01 SFT2 .Screen/x DEO2
  7-	.Screen/height DEI2 #01 SFT2 .Screen/y DEO2
  8-	( <redraw> )
  9+	<draw-guide>
 10 	BRK
 11 
 12 @on-mouse ( -> )
 13 	( | clear background )
 14-	( #0000 DUP2 .Screen/x DEO2
 15+	#0000 DUP2 .Screen/x DEO2
 16 	.Screen/y DEO2
 17-	#80 .Screen/pixel DEO )
 18-	( <draw-guide> )
 19+	#80 .Screen/pixel DEO
 20+	<draw-guide>
 21 	( | cursor )
 22-	( #0a18 DEOk DEOk DEOk DEO )
 23-	.Mouse/x DEI2 .Screen/x DEO2
 24-	.Mouse/y DEI2 .Screen/y DEO2
 25-	;cursor-icn .Screen/addr DEO2
 26-	#41 .Screen/sprite DEO
 27-
 28-	.Mouse/x DEI2 #0018 SUB2 .Screen/x DEO2
 29-	#61 .Screen/sprite DEO
 30-
 31-	
 32-	.Mouse/x DEI2 #0010 ADD2 .Screen/x DEO2
 33-	#61 .Screen/sprite DEO
 34-	
 35-	
 36-	( <redraw> )
 37-	BRK
 38-
 39-@<redraw> ( -- )
 40+	#41 ;cursor-icn <update-cursor>
 41+	( | draw portrait )
 42 	.Screen/x DEI2k #0008 ADD2 ROT DEO2
 43 	.Screen/y DEI2k #0020 SUB2 ROT DEO2
 44 	[ LIT2 36 -Screen/auto ] DEO
 45-	#81 <draw-portrait>
 46+	#81 #80 EOR <draw-portrait>
 47 	.Screen/x DEI2k #0010 SUB2 ROT DEO2
 48 	.Screen/y DEI2k #0020 SUB2 ROT DEO2
 49-	#91 <draw-portrait>
 50+	#91 #80 EOR <draw-portrait>
 51 	.Screen/x DEI2k #0000 SUB2 ROT DEO2
 52 	.Screen/y DEI2k #0020 ADD2 ROT DEO2
 53-	#b1 <draw-portrait>
 54+	#b1 #80 EOR <draw-portrait>
 55 	.Screen/x DEI2k #0010 ADD2 ROT DEO2
 56 	.Screen/y DEI2k #0020 ADD2 ROT DEO2
 57-	#a1 <draw-portrait>
 58-	JMP2r
 59+	#a1 #80 EOR <draw-portrait>
 60+	( <draw-box>
 61+	.Screen/y DEI2k #0060 SUB2 ROT DEO2
 62+	<draw-box> )
 63+	BRK
 64 
 65 @<draw-portrait> ( color -- )
 66 	;portrait-chr .Screen/addr DEO2
 67@@ -76,8 +60,16 @@
 68 	JMP2r
 69 
 70 @<draw-guide> ( -- )
 71-	.Screen/width DEI2 #01 SFT2 #0040 SUB2 .Screen/x DEO2
 72-	.Screen/height DEI2 #01 SFT2 #0040 SUB2 .Screen/y DEO2
 73+	#0000 DUP2 .Screen/x DEO2 .Screen/y DEO2
 74+	#f2 .Screen/auto DEO
 75+	;guide-icn .Screen/addr DEO2
 76+	#1000
 77+	&l ( -- ) 
 78+		#01 .Screen/sprite DEO
 79+		INC GTHk ?&l 
 80+	POP2
 81+	( | circles )
 82+	#0010 DUP2 .Screen/x DEO2 .Screen/y DEO2
 83 	#02 <draw-circle>
 84 	.Screen/y DEI2k #0008 ADD2 ROT DEO2
 85 	#82 <draw-circle>
 86@@ -104,8 +96,8 @@
 87 	.Screen/addr DEO2
 88 
 89 @<draw-cursor> ( color -- )
 90-	[ LIT2 &x $2 ] #0004 SUB2 .Screen/x DEO2
 91-	[ LIT2 &y $2 ] #0004 SUB2 .Screen/y DEO2
 92+	[ LIT2 &x $2 ] .Screen/x DEO2
 93+	[ LIT2 &y $2 ] .Screen/y DEO2
 94 	.Screen/sprite DEO
 95 	JMP2r
 96 
 97@@ -146,3 +138,4 @@
 98 @circle-chr [
 99 	071f 3c70 60e3 c7c7 0000 030f 1f1f 3f3f ]
100 
101+
+4, -5
 1@@ -50,15 +50,14 @@ screen_1bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int f
 2 	int row, w = uxn_screen.width, opaque = (color % 5);
 3 	Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
 4 	/* find vertical bounds */
 5-	if(top > 0x8000){
 6+	if(y1 > 0xfff8){
 7 		top = 0;
 8 		if(bottom > 0x8000) bottom = 0;
 9 		offset2 = 0 - y1;
10 	}
11-	else if(bottom > uxn_screen.height){
12-		bottom = uxn_screen.height;
13-		if(top > uxn_screen.height) top = uxn_screen.height;
14-	}
15+	else if(y1 > uxn_screen.height)
16+		return;
17+	
18 
19 	for(y = top; y < bottom; y++) {
20 		int yi = y-top;