shithub: sce

Download patch

ref: 4d6260758d819fbf8653cd4e1e2d99d613004889
parent: c67a9e22b4999ce8b23ca30ac131cdb9761fe180
author: qwx <qwx@sciops.net>
date: Thu Mar 12 18:01:42 EDT 2020

disallow dynamic rescaling

this doesn't make sense in this application.
scale isn't based on screen size, it's set arbitrarily by the user, and likely
won't change during execution.

--- a/drw.c
+++ b/drw.c
@@ -14,8 +14,6 @@
 static Point panmax;
 static Mobj *selected[Nselect];
 
-/* FIXME: rescale -> pan might be wrong and display bullshit until we repan */
-
 static int
 max(int a, int b)
 {
@@ -207,10 +205,6 @@
 void
 resetfb(void)
 {
-	if(scale < 1)
-		scale = 1;
-	else if(scale > 16)
-		scale = 16;
 	fbw = min(mapwidth * Tlwidth * scale, Dx(screen->r));
 	fbh = min(mapheight * Tlheight * scale, Dy(screen->r));
 	selr = Rpt(screen->r.min, addpt(screen->r.min, Pt(fbw, fbh)));
--- a/sce.c
+++ b/sce.c
@@ -182,19 +182,6 @@
 		case ' ':
 			pause ^= 1;
 			break;
-		case '=':
-			if(scale < 16){
-				scale++;
-				resetfb();
-			}
-			break;
-		case '-':
-			if(scale > 1){
-				scale--;
-				resetfb();
-			}
-			break;
-		case Kprint: scale = 1; pan = ZP; resetfb(); break;
 		case Kdel: quit(); break;
 		}
 	}
@@ -242,7 +229,7 @@
 static void
 usage(void)
 {
-	fprint(2, "usage: %s [-l port] [-m map] [-n name] [-t speed] [-x netmtpt] [sys]\n", argv0);
+	fprint(2, "usage: %s [-l port] [-m map] [-n name] [-s scale] [-t speed] [-x netmtpt] [sys]\n", argv0);
 	threadexits("usage");
 }
 
@@ -255,6 +242,13 @@
 	case 'l': lport = strtol(EARGF(usage()), nil, 0); break;
 	case 'm': mapname = EARGF(usage()); break;
 	case 'n': progname = EARGF(usage()); break;
+	case 's':
+		scale = strtol(EARGF(usage()), nil, 0);
+		if(scale < 1)
+			scale = 1;
+		else if(scale > 16)
+			scale = 16;
+		break;
 	case 't':
 		tv = strtol(EARGF(usage()), nil, 0);
 		if(tv < 1)