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.

test better textures

Lily Pitiot6387c6662c15
diff --git a/games/dinorun/Makefile b/games/dinorun/Makefile
index 981d0605..7c2232df 100644
--- a/games/dinorun/Makefile
+++ b/games/dinorun/Makefile
@@ -4,7 +4,7 @@ CC = arm-none-eabi-gcc
NWLINK ?= npx --yes -- [email protected]
OUT = output
SRC = src/main.c
-HEADERS = ../common/epsilon_app.h ../common/epsilon_files.h
+HEADERS = ../common/epsilon_app.h ../common/epsilon_files.h src/dino_sprites.h
FLAGS = -std=c11 $(shell $(NWLINK) eadk-cflags-device) -Os -Wall -Wextra -Wno-unused-parameter \
-fno-math-errno -fno-tree-loop-distribute-patterns -flto -fno-fat-lto-objects \
-fwhole-program -fvisibility=internal
diff --git a/games/dinorun/README.md b/games/dinorun/README.md
index 7cd627ab..ce41d9cb 100644
--- a/games/dinorun/README.md
+++ b/games/dinorun/README.md
@@ -1,6 +1,8 @@
-# Dino Run — NumWorks native C game (prototype)
+# Chrome Dino — NumWorks native C sprite port (prototype)
-An original endless runner inspired by offline dinosaur games, including the Chrome Dino game from Lily's NumWorks Python collection. The **C source code, pixel drawings and assets are independently written**; the Python version's code and sprites have not been copied. Unofficial, not affiliated with Google.
+This C game uses the original *rectangle-defined pixel art* decoded from [Lily's Python Chrome Dino version](https://github.com/LilyTheCuteCatgirl/lilys-small-numworks-games/blob/main/games/chrome_dino.py). The jump/duck/flying frames, cacti, outline clouds, stars, moon and ground details are now copied precisely as rectangles rather than hand-redrawn placeholders. The existing C gameplay/NumWorks integration remains independent. Unofficial, not affiliated with Google.
+
+**Art rights warning:** The source Python script credits **Diego KHELLADI** (2026) and displays an **all-rights-reserved** statement; Lily's collection also describes third-party contributions. These sprites are included for a private prototype only. **Confirm permission from the original rightsholder before pushing the sprite-based port as an upstream/public PR or distributing it.** Attribution alone does not establish permission.
![Gameplay screenshot](docs/shot.png)
@@ -14,7 +16,7 @@ An original endless runner inspired by offline dinosaur games, including the Chr
| **SHIFT** at title | Help screen |
| **HOME** | Exit back to calculator |
-The game features cacti, flying dinosaurs/birds, gradually increasing speed, day/night changes, high-score storage (`dinorun.sav`) and instant restart.
+The game features the original pixel cacti, flying bird frames, scrolling clouds, moon/stars, gradually increasing speed, day/night changes, high-score storage (`dinorun.sav`) and instant restart.
## Build as an individual NumWorks app
diff --git a/games/dinorun/docs/game.png b/games/dinorun/docs/game.png
index ae9ba62b..96d28905 100644
Binary files a/games/dinorun/docs/game.png and b/games/dinorun/docs/game.png differ
diff --git a/games/dinorun/docs/shot.png b/games/dinorun/docs/shot.png
index ae9ba62b..96d28905 100644
Binary files a/games/dinorun/docs/shot.png and b/games/dinorun/docs/shot.png differ
diff --git a/games/dinorun/docs/title.png b/games/dinorun/docs/title.png
index be379b08..7a6c0c0a 100644
Binary files a/games/dinorun/docs/title.png and b/games/dinorun/docs/title.png differ
diff --git a/games/dinorun/src/dino_sprites.h b/games/dinorun/src/dino_sprites.h
new file mode 100644
index 00000000..15543c2c
--- /dev/null
+++ b/games/dinorun/src/dino_sprites.h
@@ -0,0 +1,165 @@
+/* Exact rectangle geometry decoded from the compressed sprite lists in
+ * https://github.com/LilyTheCuteCatgirl/lilys-small-numworks-games/blob/main/games/chrome_dino.py
+ * Original Python program credits Diego KHELLADI (2026, all rights reserved).
+ * This experimental derivative needs permission from the relevant rights holder
+ * before distributing the imported artwork in an upstream/public release.
+ * Coordinates are unscaled, preserving the original pixel-art geometry.
+ */
+#ifndef DINO_PYTHON_SPRITES_H
+#define DINO_PYTHON_SPRITES_H
+#include <stdint.h>
+typedef struct { int8_t x, y; uint8_t w, h; } dino_sprite_rect;
+#define COUNT_OF(x) (sizeof(x)/sizeof((x)[0]))
+
+/* Python aY: 29 rectangles; bounds x=[0, 20), y=[-12, 9) */
+static const dino_sprite_rect DINO_JUMP[] = {
+ {11,-12,8,1}, {10,-11,10,1}, {13,-10,7,1}, {10,-10,2,1}, {10,-9,10,3},
+ {10,-6,5,1}, {10,-5,8,1}, {9,-4,5,1}, {0,-4,1,1}, {7,-3,7,1},
+ {0,-3,1,1}, {6,-2,10,1}, {0,-2,2,1}, {15,-1,1,1}, {5,-1,9,1},
+ {0,-1,3,1}, {0,0,14,1}, {1,1,12,1}, {2,2,11,1}, {3,3,9,1},
+ {4,4,7,1}, {5,5,3,1}, {9,5,2,1}, {6,6,2,1}, {9,6,1,1},
+ {6,7,1,1}, {9,7,1,1}, {6,8,2,1}, {9,8,2,1},
+};
+
+/* Python aF: 27 rectangles; bounds x=[0, 20), y=[-12, 9) */
+static const dino_sprite_rect DINO_RUN_1[] = {
+ {11,-12,8,1}, {10,-11,10,1}, {13,-10,7,1}, {10,-10,2,1}, {10,-9,10,3},
+ {10,-6,5,1}, {10,-5,8,1}, {9,-4,5,1}, {0,-4,1,1}, {7,-3,7,1},
+ {0,-3,1,1}, {6,-2,10,1}, {0,-2,2,1}, {15,-1,1,1}, {5,-1,9,1},
+ {0,-1,3,1}, {0,0,14,1}, {1,1,12,1}, {2,2,11,1}, {3,3,9,1},
+ {4,4,7,1}, {5,5,4,1}, {10,5,1,1}, {6,6,2,1}, {10,6,3,1},
+ {6,7,1,1}, {6,8,2,1},
+};
+
+/* Python aE: 27 rectangles; bounds x=[0, 20), y=[-12, 9) */
+static const dino_sprite_rect DINO_RUN_2[] = {
+ {11,-12,8,1}, {10,-11,10,1}, {13,-10,7,1}, {10,-10,2,1}, {10,-9,10,3},
+ {10,-6,5,1}, {10,-5,8,1}, {9,-4,5,1}, {0,-4,1,1}, {7,-3,7,1},
+ {0,-3,1,1}, {6,-2,10,1}, {0,-2,2,1}, {15,-1,1,1}, {5,-1,9,1},
+ {0,-1,3,1}, {0,0,14,1}, {1,1,12,1}, {2,2,11,1}, {3,3,9,1},
+ {4,4,7,1}, {5,5,2,1}, {9,5,2,1}, {6,6,2,1}, {9,6,1,1},
+ {9,7,1,1}, {9,8,2,1},
+};
+
+/* Python aU: 22 rectangles; bounds x=[0, 20), y=[-12, 11) */
+static const dino_sprite_rect DINO_MENU_MINI[] = {
+ {11,-12,8,1}, {10,-11,10,1}, {13,-10,7,1}, {10,-10,2,1}, {10,-9,10,3},
+ {10,-6,5,1}, {10,-5,8,1}, {9,-4,5,1}, {0,-4,1,1}, {7,-3,7,1},
+ {0,-3,1,1}, {6,-2,10,1}, {0,-2,2,1}, {15,-1,1,1}, {5,-1,9,1},
+ {0,-1,3,1}, {0,0,14,1}, {1,1,12,1}, {2,2,11,1}, {3,3,9,1},
+ {4,4,7,1}, {3,5,11,6},
+};
+
+/* Python aj: 21 rectangles; bounds x=[0, 27), y=[-3, 10) */
+static const dino_sprite_rect DINO_DUCK_BASE[] = {
+ {0,-3,1,1}, {18,-3,8,1}, {0,-2,3,1}, {7,-2,8,1}, {17,-2,10,1},
+ {0,-1,19,1}, {20,-1,7,1}, {1,0,26,1}, {2,1,25,1}, {3,2,24,1},
+ {4,3,18,1}, {5,4,11,1}, {18,4,7,1}, {6,5,5,1}, {14,5,1,1},
+ {5,6,3,1}, {10,6,2,1}, {14,6,2,1}, {5,7,2,1}, {5,8,1,1},
+ {5,9,2,1},
+};
+
+/* Python V: 28 rectangles; bounds x=[0, 27), y=[-3, 10) */
+static const dino_sprite_rect DINO_DUCK_1[] = {
+ {0,-3,1,1}, {18,-3,8,1}, {0,-2,3,1}, {7,-2,8,1}, {17,-2,10,1},
+ {0,-1,19,1}, {20,-1,7,1}, {1,0,26,1}, {2,1,25,1}, {3,2,24,1},
+ {4,3,18,1}, {5,4,11,1}, {18,4,7,1}, {6,5,5,1}, {14,5,1,1},
+ {5,6,3,1}, {10,6,2,1}, {14,6,2,1}, {5,7,2,1}, {5,8,1,1},
+ {5,9,2,1}, {5,6,1,1}, {8,6,3,1}, {14,6,2,1}, {5,7,2,1},
+ {8,7,2,1}, {8,8,1,1}, {8,9,2,1},
+};
+
+/* Python ai: 22 rectangles; bounds x=[0, 27), y=[-3, 10) */
+static const dino_sprite_rect DINO_DUCK_2[] = {
+ {0,-3,1,1}, {18,-3,8,1}, {0,-2,3,1}, {7,-2,8,1}, {17,-2,10,1},
+ {0,-1,19,1}, {20,-1,7,1}, {1,0,26,1}, {2,1,25,1}, {3,2,24,1},
+ {4,3,18,1}, {5,4,11,1}, {18,4,7,1}, {6,5,5,1}, {14,5,1,1},
+ {5,6,1,1}, {8,6,3,1}, {14,6,2,1}, {5,7,2,1}, {8,7,2,1},
+ {8,8,1,1}, {8,9,2,1},
+};
+
+/* Python au: 29 rectangles; bounds x=[0, 60), y=[-36, 27) */
+static const dino_sprite_rect DINO_MENU_LARGE[] = {
+ {33,-36,24,3}, {30,-33,30,3}, {39,-30,21,3}, {30,-30,6,3}, {30,-27,30,9},
+ {30,-18,15,3}, {30,-15,24,3}, {27,-12,15,3}, {0,-12,3,3}, {21,-9,21,3},
+ {0,-9,3,3}, {18,-6,30,3}, {0,-6,6,3}, {45,-3,3,3}, {15,-3,27,3},
+ {0,-3,9,3}, {0,0,42,3}, {3,3,36,3}, {6,6,33,3}, {9,9,27,3},
+ {12,12,21,3}, {15,15,9,3}, {27,15,6,3}, {15,18,6,3}, {30,18,3,3},
+ {15,21,3,3}, {30,21,3,3}, {15,24,6,3}, {30,24,6,3},
+};
+
+/* Python S: 9 rectangles; bounds x=[-20, -6), y=[-14, 9) */
+static const dino_sprite_rect CACTUS_ORIGINAL[] = {
+ {-15,2,4,7}, {-19,0,11,1}, {-20,-1,13,1}, {-20,-8,3,7}, {-15,-13,4,15},
+ {-9,-10,3,9}, {-19,-9,1,1}, {-14,-14,2,1}, {-8,-11,1,1},
+};
+
+/* Python at: 28 rectangles; bounds x=[0, 45), y=[1, 14) */
+static const dino_sprite_rect CLOUD_ORIGINAL[] = {
+ {0,13,2,1}, {10,13,35,1}, {1,12,2,1}, {4,12,2,1}, {9,12,1,1},
+ {44,12,1,1}, {5,11,1,1}, {43,11,1,1}, {5,10,1,1}, {41,10,3,1},
+ {5,9,2,1}, {41,9,1,1}, {6,8,8,1}, {38,8,4,1}, {13,7,5,1},
+ {30,7,1,1}, {38,7,1,1}, {17,6,1,1}, {31,6,8,1}, {17,5,1,1},
+ {31,5,1,1}, {17,4,3,1}, {30,4,2,1}, {19,3,2,1}, {30,3,2,1},
+ {20,2,6,1}, {28,2,3,1}, {25,1,4,1},
+};
+
+/* Python av: 11 rectangles; bounds x=[0, 22), y=[3, 7) */
+static const dino_sprite_rect GROUND_DETAIL_1[] = {
+ {0,5,1,1}, {1,5,5,1}, {1,4,2,1}, {3,3,3,1}, {6,4,1,1},
+ {7,5,5,1}, {12,6,2,1}, {12,5,5,1}, {14,6,3,1}, {17,5,2,1},
+ {20,5,2,1},
+};
+
+/* Python W: 12 rectangles; bounds x=[0, 22), y=[3, 7) */
+static const dino_sprite_rect GROUND_DETAIL_2[] = {
+ {1,5,7,1}, {0,5,1,1}, {1,5,5,1}, {1,4,2,1}, {3,3,3,1},
+ {6,4,1,1}, {7,5,5,1}, {12,6,2,1}, {12,5,5,1}, {14,6,3,1},
+ {17,5,2,1}, {20,5,2,1},
+};
+
+/* Python aB: 15 rectangles; bounds x=[0, 21), y=[0, 15) */
+static const dino_sprite_rect BIRD_WING_DOWN[] = {
+ {4,0,2,1}, {3,1,3,1}, {2,2,5,1}, {1,3,6,1}, {0,4,14,1},
+ {6,5,9,1}, {7,6,14,1}, {8,7,10,1}, {8,8,12,1}, {8,9,9,1},
+ {8,10,4,1}, {8,11,3,1}, {8,12,2,1}, {8,13,2,1}, {8,14,1,1},
+};
+
+/* Python an: 17 rectangles; bounds x=[0, 21), y=[-3, 10) */
+static const dino_sprite_rect BIRD_WING_UP[] = {
+ {7,-3,1,1}, {7,-2,2,1}, {7,-1,3,1}, {8,0,3,1}, {8,1,4,1},
+ {8,2,5,1}, {8,3,6,1}, {4,0,2,1}, {3,1,3,1}, {2,2,5,1},
+ {1,3,6,1}, {0,4,14,1}, {6,5,9,1}, {7,6,14,1}, {8,7,10,1},
+ {9,8,11,1}, {10,9,7,1},
+};
+
+/* Python X: 23 rectangles; bounds x=[0, 21), y=[-3, 15) */
+static const dino_sprite_rect BIRD_ALT[] = {
+ {4,0,2,1}, {3,1,3,1}, {2,2,5,1}, {1,3,6,1}, {0,4,14,1},
+ {6,5,9,1}, {7,6,14,1}, {8,7,10,1}, {8,8,12,1}, {8,9,9,1},
+ {8,10,4,1}, {8,11,3,1}, {8,12,2,1}, {8,13,2,1}, {8,14,1,1},
+ {7,-3,1,1}, {7,-2,2,1}, {7,-1,3,1}, {8,0,3,1}, {8,1,4,1},
+ {8,2,5,1}, {8,3,6,1}, {10,9,7,1},
+};
+
+/* Python aC: 12 rectangles; bounds x=[0, 20), y=[0, 36) */
+static const dino_sprite_rect MOON_ORIGINAL[] = {
+ {0,0,6,2}, {4,2,8,2}, {6,4,8,2}, {8,6,8,2}, {10,8,8,4},
+ {12,12,8,4}, {12,12,8,14}, {10,24,8,4}, {8,28,8,2}, {6,30,8,2},
+ {4,32,8,2}, {0,34,6,2},
+};
+
+/* Python aG: 13 rectangles; bounds x=[0, 8), y=[0, 9) */
+static const dino_sprite_rect STAR_ORIGINAL_1[] = {
+ {3,0,1,1}, {0,1,1,1}, {3,1,1,1}, {6,1,1,1}, {3,2,1,1},
+ {2,3,3,1}, {0,4,8,1}, {2,5,3,1}, {3,6,1,1}, {0,7,1,1},
+ {3,7,1,1}, {6,7,1,1}, {3,8,1,1},
+};
+
+/* Python aw: 9 rectangles; bounds x=[0, 8), y=[0, 9) */
+static const dino_sprite_rect STAR_ORIGINAL_2[] = {
+ {3,0,1,1}, {3,1,1,1}, {3,2,1,1}, {2,3,3,1}, {0,4,8,1},
+ {2,5,3,1}, {3,6,1,1}, {3,7,1,1}, {3,8,1,1},
+};
+
+#endif
diff --git a/games/dinorun/src/main.c b/games/dinorun/src/main.c
index 6458cac9..7eb674a9 100644
--- a/games/dinorun/src/main.c
+++ b/games/dinorun/src/main.c
@@ -1,6 +1,6 @@
-/* Dino Run — an original native endless runner for NumWorks / NumPlay.
- * Gameplay inspiration: offline dinosaur runners; no third-party source/sprites copied.
- * 320x240, 30 fps, RGB565; draws 16-row bands rather than using a full frame buffer.
+/* Dino Run — C gameplay for NumWorks / NumPlay with geometry converted from
+ * the Python Chrome Dino sprites. See dino_sprites.h for source/rights note.
+ * 320x240, RGB565, 16-row bands, 30 fps.
* Keyboard: OK/Up/Exe jump, Down duck, Back/Backspace pause, Home exit.
*/
#include <eadk.h>
@@ -8,17 +8,20 @@
#include <stdint.h>
#include "../../common/epsilon_app.h"
#include "../../common/epsilon_files.h"
+#include "dino_sprites.h"
#ifdef __ELF__
-const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Dino Run";
+const char eadk_app_name[] __attribute__((section(".rodata.eadk_app_name"))) = "Chrome Dino";
const uint32_t eadk_api_level __attribute__((section(".rodata.eadk_api_level"))) = 0;
#endif
#define W 320
#define H 240
-#define GROUND 194
-#define DX 34
-#define DY (GROUND - 40)
+#define GROUND 195
+#define DX 20
+/* In the original Python sprites (1 px per art pixel), standing is drawn
+ * around (20,190): 12 px above this anchor, 9 px below it. */
+#define DY 190
#define BAND 16
#define KEY(k) (1ull << (k))
#define RGB(c) (uint16_t)((((c) >> 8) & 0xF800u) | (((c) >> 5) & 0x07E0u) | (((c) >> 3) & 0x1Fu))
@@ -104,74 +107,82 @@ static void number(int x,int y,unsigned n,int min_digits,int scale,color c) {
s[i]=0;text_at(x,y,s,scale,c);
}
+/* Draw the original rectangle lists without approximation or antialiasing.
+ * The existing banded framebuffer clips each individual rectangle for us. */
+static void sprite(const dino_sprite_rect *pieces, unsigned n,
+ int x, int y, color c) {
+ for (unsigned i=0; i<n; i++)
+ rect(x+pieces[i].x, y+pieces[i].y,
+ pieces[i].w, pieces[i].h, c);
+}
+#define SPRITE(name, x, y, c) sprite(name, COUNT_OF(name), x, y, c)
+
static void dino(int x,int y,bool crouch,int step) {
if (crouch) {
- rect(x+7,y+15,24,12,ink); rect(x+20,y+10,16,10,ink);
- rect(x+32,y+17,7,5,ink); rect(x+3,y+19,9,4,ink);
- rect(x+25,y+13,2,2,bg); rect(x+10,y+27,7,3,ink); rect(x+26,y+27,7,3,ink);
+ if (step & 1) SPRITE(DINO_DUCK_1,x,y,ink);
+ else SPRITE(DINO_DUCK_2,x,y,ink);
+ } else if (y < DY) {
+ SPRITE(DINO_JUMP,x,y,ink);
+ } else if (step & 1) {
+ SPRITE(DINO_RUN_1,x,y,ink);
} else {
- rect(x+15,y+1,17,14,ink); rect(x+23,y+13,14,5,ink);
- rect(x+17,y+17,14,5,ink);rect(x+10,y+15,16,21,ink);
- rect(x+5,y+22,10,6,ink); rect(x+1,y+19,5,4,ink);
- rect(x+22,y+22,9,3,ink);rect(x+23,y+26,4,4,ink);
- rect(x+24,y+4,3,3,bg);rect(x+30,y+15,7,2,bg);
- if (step&1) {rect(x+12,y+35,5,6,ink);rect(x+25,y+34,6,3,ink);}
- else {rect(x+12,y+34,7,3,ink);rect(x+25,y+35,5,6,ink);}
+ SPRITE(DINO_RUN_2,x,y,ink);
}
}
+
static void cactus(obstacle *o) {
- int x=o->x,y=o->y;
- if (o->kind==LARGE_CACTUS) {
- rect(x+8,y,10,o->h,ink);rect(x+4,y+12,6,6,ink);
- rect(x,y+5,5,15,ink);rect(x+16,y+17,7,5,ink);
- rect(x+19,y+8,5,18,ink);
- } else {
- rect(x+6,y,7,o->h,ink);rect(x+2,y+13,5,5,ink);
- rect(x,y+7,4,12,ink);rect(x+12,y+18,5,4,ink);
- rect(x+15,y+11,4,13,ink);
- }
+ /* In the Python source S is drawn at (cactus position, F=190), and
+ * occupies x=[-20,-6], y=[-14,+9]. Use o->x/o->y as its top-left. */
+ SPRITE(CACTUS_ORIGINAL,o->x+20,o->y+14,ink);
+ if (o->kind==LARGE_CACTUS)
+ SPRITE(CACTUS_ORIGINAL,o->x+16+20,o->y+14,ink);
}
+
static void bird(obstacle *o) {
- int x=o->x,y=o->y;
- rect(x+6,y+7,20,7,ink);rect(x+25,y+9,7,3,ink);rect(x+3,y+10,5,3,ink);
- rect(x+22,y+8,2,2,bg);
- if ((ticks/7)&1) {rect(x+13,y,8,8,ink);rect(x+9,y+3,5,4,ink);}
- else {rect(x+11,y+13,10,7,ink);rect(x+8,y+16,5,4,ink);}
+ /* Python aB/an: original flapping bird poses. */
+ if ((ticks/7)&1) SPRITE(BIRD_WING_DOWN,o->x,o->y+3,ink);
+ else SPRITE(BIRD_WING_UP,o->x,o->y+3,ink);
}
+
static void scenery(void) {
- rect(0,GROUND+1,W,2,ink);
- /* Daytime clouds; tiny stars replace them in the night. */
+ rect(0,GROUND,W,1,ink);
if ((score/300)&1) {
- for(int i=0;i<23;i++) {
- int x=(i*101+23 - (int)(distance_px/8)%570 +570)%570-80;
- int y=34+(i*47)%102;
- rect(x,y,2,2,faint);
+ /* aC is the original crescent moon; aG/aw are the stars. */
+ SPRITE(MOON_ORIGINAL,241,24,ink);
+ for(int i=0;i<18;i++) {
+ int x=(i*87+23-(int)(distance_px/9)%720+720)%720-20;
+ int y=20+(i*43)%127;
+ if (i&1) SPRITE(STAR_ORIGINAL_1,x,y,ink);
+ else SPRITE(STAR_ORIGINAL_2,x,y,ink);
}
} else {
- for(int i=0;i<4;i++) {
- int x=(i*143+330 - (int)(distance_px/5)%620 +620)%620-85;
- int y=49+(i*31)%70;
- rect(x+10,y,31,2,faint);rect(x+17,y-7,18,2,faint);
- rect(x+9,y-5,2,7,faint);rect(x+35,y-5,2,7,faint);
- rect(x+16,y-9,3,3,faint);
+ /* at: the very same outlined cloud as in the Python version. */
+ for(int i=0;i<5;i++) {
+ int x=(i*143+330-(int)(distance_px/6)%690+690)%690-65;
+ int y=44+(i*29)%88;
+ SPRITE(CLOUD_ORIGINAL,x,y,faint);
}
}
- for(int i=0;i<25;i++) {
- int x=(i*43+17 - (int)(distance_px%1075)+1075)%1075;
- if (x < W) rect(x,GROUND+9+(i*7)%21,3+(i%3),1,faint);
+ /* av and W: original little ground tufts/dots. */
+ for(int i=0;i<16;i++) {
+ int x=(i*58+17-(int)(distance_px%960)+960)%960;
+ if(x>W+22)continue;
+ if(i&1) SPRITE(GROUND_DETAIL_1,x,GROUND-5,faint);
+ else SPRITE(GROUND_DETAIL_2,x,GROUND-5,ink);
}
}
static bool overlap(int x,int y,int w,int h,int xx,int yy,int ww,int hh) {
return x<xx+ww && x+w>xx && y<yy+hh && y+h>yy;
}
static bool collision(void) {
- int y=(dino_y+255)/256;
- int x=DX+8, top=y+4, w=24,h=37;
- if (duck && y>=DY) {x=DX+7;top=GROUND-26;w=32;h=26;}
+ int y=(dino_y+128)/256;
+ /* Aligned with the original Python sprite outlines, not the old 40px art. */
+ int x=DX+1, top=y-11, w=18,h=19;
+ if (duck && y>=DY) {x=DX+1;top=y-3;w=25;h=12;}
for(int i=0;i<count;i++) {
obstacle *o=&obstacles[i];
- int ox=o->x+2, oy=o->y+2, ow=o->w-4, oh=o->h-3;
- if (o->kind==BIRD) {oy=o->y+6;oh=10;ox=o->x+5;ow=22;}
+ int ox=o->x+1, oy=o->y+1, ow=o->w-2, oh=o->h-2;
+ if(o->kind==BIRD) {ox=o->x+2;oy=o->y+2;ow=19;oh=14;}
if(overlap(x,top,w,h,ox,oy,ow,oh))return true;
}
return false;
@@ -185,13 +196,13 @@ static void spawn(void) {
obstacle *o=&obstacles[count++];
o->x=W+5;
if(score>350 && randint(5)==0) {
- o->kind=BIRD;o->w=33;o->h=22;
- o->y=randint(2)?GROUND-46:GROUND-75;
+ o->kind=BIRD;o->w=21;o->h=18;
+ /* Low birds require ducking; high birds can cross a jump. */
+ o->y=randint(2)?GROUND-28:GROUND-56;
} else {
o->kind=randint(3)==0?LARGE_CACTUS:CACTUS;
- o->w=o->kind==LARGE_CACTUS?24:19;
- o->h=o->kind==LARGE_CACTUS?43:32;
- o->y=GROUND-o->h;
+ o->w=o->kind==LARGE_CACTUS?30:14;
+ o->h=23;o->y=DY-14;
}
}
static void lose(void) {
@@ -227,9 +238,10 @@ static void update(bool jump,bool down) {
}
static void frame(void) {
bool night=((score/300)&1)!=0;
- bg=RGB(night?0x181D2A:0xF7F7F7);
- ink=RGB(night?0xF1F1F1:0x404040);
- faint=RGB(night?0x7A8193:0xBBBBBB);
+ /* Exact daytime/nighttime palette from the Python version. */
+ bg=RGB(night?0x000000:0xFFFFFF);
+ ink=RGB(night?0xACACAC:0x535353);
+ faint=RGB(night?0x252525:0xDADADA);
for(band_y=0;band_y<H;band_y+=BAND) {
for(int i=0;i<W*BAND;i++)pixels[i]=bg;
scenery();
@@ -241,12 +253,12 @@ static void frame(void) {
text_at(11,11,"HI",2,faint);number(47,11,high_score,5,2,ink);
number(245,11,(unsigned)score,5,2,ink);
} else {
- dino(134,101,0,ticks/8);
- centered(40,"DINO RUN",3,ink);
- centered(170,scene==HELP?"OK OR UP JUMP":"PRESS OK TO PLAY",2,ink);
- centered(209,scene==HELP?"DOWN DUCK":"SHIFT FOR HELP",2,faint);
- if(scene==HELP) centered(230,"BACK PAUSE",1,faint);
- else {text_at(9,230,"BEST",1,faint);number(46,230,high_score,5,1,ink);}
+ /* The original title character is the separately encoded 3x sprite. */
+ SPRITE(DINO_MENU_LARGE,120,150,ink);
+ centered(40,"CHROME DINO",3,ink);
+ centered(202,scene==HELP?"OK OR UP JUMP":"PRESS OK TO PLAY",2,ink);
+ centered(225,scene==HELP?"DOWN DUCK, BACK PAUSE":"SHIFT FOR HELP",1,faint);
+ if(scene!=HELP) {text_at(9,230,"BEST",1,faint);number(46,230,high_score,5,1,ink);}
}
if(scene==DEAD) {
rect(46,61,228,90,bg);
diff --git a/games/dinorun/tests/test_dino.c b/games/dinorun/tests/test_dino.c
index fb61d6f8..7d4c1193 100644
--- a/games/dinorun/tests/test_dino.c
+++ b/games/dinorun/tests/test_dino.c
@@ -38,7 +38,7 @@ int main(int argc,char **argv) {
update(false,true);assert(duck);
update(false,false);assert(!duck);
/* Force a collision, test the game-over state and restart. */
- count=1;obstacles[0]=(obstacle){DX+12,GROUND-32,19,32,CACTUS};
+ count=1;obstacles[0]=(obstacle){DX+12,DY-14,14,23,CACTUS};
update(false,false);assert(scene==DEAD && high_score==score);
start_game();assert(scene==PLAY && score==0 && count==0);
for(int i=0;i<160;i++){
@@ -48,9 +48,9 @@ int main(int argc,char **argv) {
start_game();
score=328; ticks=1312;distance_px=2100;
count=3;
- obstacles[0]=(obstacle){244,GROUND-32,19,32,CACTUS};
- obstacles[1]=(obstacle){304,GROUND-43,24,43,LARGE_CACTUS};
- obstacles[2]=(obstacle){152,GROUND-75,33,22,BIRD};
+ obstacles[0]=(obstacle){244,DY-14,14,23,CACTUS};
+ obstacles[1]=(obstacle){289,DY-14,30,23,LARGE_CACTUS};
+ obstacles[2]=(obstacle){152,GROUND-28,21,18,BIRD};
frame();
if(argc>=3)screenshot(argv[2]);
printf("Host test passed: jump, crouch, collision, restart, rendering.\n");