shithub: gm4s

Download patch

ref: 46eaa536bf45124e5ad5f2f6034304ebc131e029
parent: b597cdf52dfe14c9835a9543b46e34356384e3c9
author: qwx <qwx@sciops.net>
date: Sat Mar 15 09:30:43 EDT 2025

improve speed increments; don't wait for next step to spawn

--- a/game.c
+++ b/game.c
@@ -2,6 +2,7 @@
 #include <libc.h>
 #include "dat.h"
 #include "fns.h"
+#include "/sys/src/games/eui.h"
 
 char playfield[Ncol * Nrow];
 Current *cur;
@@ -8,6 +9,7 @@
 
 enum{
 	Nlineperlvl = 10,
+	Timeinc = BILLION / 10.0,
 };
 static vlong ncleared;
 static int held = -1;
@@ -96,9 +98,16 @@
 static void
 updatelevel(void)
 {
+	double t;
+
 	if(++ncleared % Nlineperlvl != 0)
 		return;
-	T *= 0.9;	/* FIXME: linear makes more sense */
+	if((t = T - Timeinc) >= Timeinc)
+		T = t;
+	else if(T > Timeinc)
+		T = Timeinc;
+	else
+		T *= 0.9;
 }
 
 static void
@@ -162,7 +171,7 @@
 	}
 	clearlines();
 	disengage();
-	cur = nil;
+	spawn();
 }
 
 void