Skip to content

Free games for graphing calculators: NumWorks, TI-Nspire CX, Casio fx-CG50 and soon TI-84 Plus CE. Balatro, Celeste, Hollow Knight, Minecraft and more.

Temple Run: far faces textured right, room for the fuller pieces

Mason363bf44e4ac1fda
diff --git a/games/templerun/src/r3d.c b/games/templerun/src/r3d.c
index b78055fa..d17ddb06 100644
--- a/games/templerun/src/r3d.c
+++ b/games/templerun/src/r3d.c
@@ -4,8 +4,8 @@
#define NEAR 0.35f
#define FAR 190.0f
#define ZK 22000.0f /* depths are ZK / z: 62857 at the near plane, larger is nearer */
-#define MAXP 1600 /* polygons a frame */
-#define MAXV 5400 /* their corners */
+#define MAXP 1800 /* polygons a frame */
+#define MAXV 6000 /* their corners */
#define MAXT 760 /* textured faces in perspective */
#define MAXN 14 /* corners of a polygon once cut */
#define SUB 8.0f /* corners are kept in 1/8 pixels */
@@ -17,10 +17,10 @@ typedef struct {
float a, b, c; /* its depth at (sx, sy): a sx + b sy + c */
uint16_t v0; /* its first corner */
uint16_t color; /* RGB565, or the texture's number */
+ uint16_t extra; /* a textured face in perspective: its planes (uvs) */
uint8_t n, kind;
uint8_t y0, y1; /* the rows it covers */
uint8_t alpha; /* see-through (255: not); textured faces: their light 0..32 */
- uint8_t extra; /* a textured face in perspective: its planes */
} Poly;
typedef struct {
int16_t x, y;
@@ -245,7 +245,7 @@ static void emit_screen(const CV *p, int n, float *sx, float *sy, int kind, uint
for (int i = 0; i < 3; i++) wu[i] = c3[i]->u * ZK / c3[i]->z, wv[i] = c3[i]->v * ZK / c3[i]->z;
UV *u = &uvs[nuv];
if (!fit(px, py, wu, &u->ua, &u->ub, &u->uc) || !fit(px, py, wv, &u->va, &u->vb, &u->vc)) return;
- q->extra = (uint8_t)nuv++;
+ q->extra = (uint16_t)nuv++;
}
}
q->color = color;
diff --git a/games/templerun/tests/check.py b/games/templerun/tests/check.py
index 4f99a80f..fa119f43 100644
--- a/games/templerun/tests/check.py
+++ b/games/templerun/tests/check.py
@@ -117,7 +117,7 @@ def long_runs(d):
st = play(d, "--seed", str(seed), "--god", "--up", "5", "--frames", "21000", "--keys", "30:ok,90:ok",
"--bot", "100", "--draw-every", "11")
assert st["dist"] > 6000 and not st["dead"], (seed, st)
- assert st["polys"] < 1400, st # (the renderer keeps 1600)
+ assert st["polys"] < 1700, st # (the renderer keeps 1800)
assert st["turns"] > 40, st