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.
C calculatorcalculator-gamescasiochesscrossy-roaddrive-madfx-cg50gamesgeometry-dashgraphing-calculatorndlessnumworksnumworks-appsnumworks-calculatornumworks-gamenumworks-gamestetristi-84-plus-ceti-nspire
Merge pull request #47 from LanoCodes17/sequence-v1: the Konami code
Mason Chene77ae7c22eaa
diff --cc docs/play.mdindex f0bb6ef7,f0bb6ef7..8418be0b--- a/docs/play.md+++ b/docs/play.md@@@ -14,7 -14,7 +14,7 @@@ The last card, **Settings**, can- **Reset** a game's progress, or every game's at once: hold **OK** on the red button to confirm (levels you made are kept)- **Uninstall** the games you don't play, to free up space--- **Start as Matrices**: NumPlay opens as a plain matrix calculator. Your secret way in opens the games: pick the x,n,t key, var, Toolbox, π, √, or *Examples* in the Toolbox menu. A small gray hint in the corner names it (turn it off with **Show a hint**)++- **Start as Matrices**: NumPlay opens as a plain matrix calculator. Your secret way in opens the games: pick the x,n,t key, var, Toolbox, π, √, *Examples* in the Toolbox menu, or the Konami code (up, up, down, down, left, right, left, right). A small gray hint in the corner names it (turn it off with **Show a hint**)Your progress is also copied into a Python script, `numplay_saves.py`, so updating NumPlay doesn't erase it. Leave it there; if it gets deleted, NumPlay writes it again.diff --cc launcher/lang/fr.txtindex a0e50e9d,799a0479..ae2541a5--- a/launcher/lang/fr.txt+++ b/launcher/lang/fr.txt@@@ -24,6 -24,6 +24,7 @@@ Toolbox key touche Boîte à outilPi key touche PiSquare root key touche racine carréeMenu: Examples Menu : Exemples++Konami code Code KonamiINSTALLED GAMES JEUX INSTALLÉSMade with Fait avecby Mason Chen par Mason Chendiff --cc launcher/lang/zh.txtindex 6993a15f,4db0fefd..20e96b6d--- a/launcher/lang/zh.txt+++ b/launcher/lang/zh.txt@@@ -23,6 -23,6 +23,7 @@@ Toolbox key 工具箱�Pi key π 键Square root key 根号键Menu: Examples 菜单:示例++Konami code 科乐美秘技INSTALLED GAMES 已安装的游戏Made with 用by Mason Chen 打造 · Mason Chendiff --cc launcher/src/matrices.cindex d42669c0,e96f8006..a9b7319a--- a/launcher/src/matrices.c+++ b/launcher/src/matrices.c@@@ -1,7 -1,6 +1,7 @@@/* Matrices: NumPlay dressed as a calculator app, drawn like the calculator's* own apps (their fonts, colours and layout): a matrix to fill in, its results,- * and a menu on the Toolbox key. The secret chosen in Settings (a key, or the- * Examples item of the menu) opens NumPlay; Home quits. */- * and a menu on the Toolbox key. * A secret sequence opens NumPlay; Home quits. */++ * and a menu on the Toolbox key. The secret chosen in Settings (a key, the++ * Examples item of the menu, or the Konami code) opens NumPlay; Home quits. */#include <eadk.h>#include <string.h>#include "np.h"@@@ -27,10 -26,14 +27,13 @@@ enumKEY_DOT = 49, KEY_EXE = 52};static const int8_t digit_keys[10] = {48, 42, 43, 44, 36, 37, 38, 30, 31, 32};- static const uint8_t secret_keys[NP_SECRET_COUNT] = {KEY_XNT, KEY_VAR, KEY_TOOLBOX, KEY_PI, KEY_SQRT, 255};--/* the secret sequence: konami code */-static const uint8_t seq_keys[] = {KEY_UP, KEY_UP, KEY_DOWN, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_LEFT, KEY_RIGHT};-#define SEQ_LEN ((int)sizeof seq_keys)-static int seq_pos;--/* no hint shown: the sequence stays invisible on screen */-static const char *hint = NULL;++static const uint8_t secret_keys[NP_SECRET_COUNT] = {KEY_XNT, KEY_VAR, KEY_TOOLBOX, KEY_PI, KEY_SQRT, 255, 255};+/* the hint, if Settings keeps it: the secret's name, bottom left in light gray */- static const char *const secret_hints[NP_SECRET_COUNT] = {"x,n,t", "var", T("Toolbox"), "\xCF\x80", "\xE2\x88\x9A", T("Examples")};++static const char *const secret_hints[NP_SECRET_COUNT] = {"x,n,t", "var", T("Toolbox"), "\xCF\x80", "\xE2\x88\x9A", T("Examples"),++ T("Konami code")};++/* the Konami code: up, up, down, down, left, right, left, right (an idea of LanoCodes17's) */++static const uint8_t konami[8] = {KEY_UP, KEY_UP, KEY_DOWN, KEY_DOWN, KEY_LEFT, KEY_RIGHT, KEY_LEFT, KEY_RIGHT};+static const char *hint;static struct {int n, tab, row, col; /* row -1: the dimension line */@@@ -326,8 -330,8 +329,14 @@@ bool np_matrices(const np_config_t *cfgredraw();uint64_t prev = eadk_keyboard_scan();uint32_t repeat_at = 0;++ int code = 0; /* the Konami code's keys pressed so far */for (int frame = 0;; frame++) {uint64_t k = eadk_keyboard_scan(), hit = k & ~prev;++ if (cfg->secret == NP_SECRET_KONAMI && hit) { /* fresh presses only, not held arrows repeating */++ if (hit == 1ull << konami[code]) code++;++ else code = hit == 1ull << KEY_UP ? (code == 2 ? 2 : 1) : 0; /* up, up, up... still the start */++ if (code == 8) return true;++ }uint32_t now = np_millis();const uint64_t arrows = 0xF;if (hit & arrows) repeat_at = now + 400;diff --cc launcher/src/np.hindex 577bcebe,7e861c20..1b798bdc--- a/launcher/src/np.h+++ b/launcher/src/np.h@@@ -79,7 -77,7 +79,7 @@@ uint32_t np_storage_record_size(const cbool np_reset_game(int game);/* NumPlay's own settings, in the file numplay.set */--enum { NP_SECRET_XNT, NP_SECRET_VAR, NP_SECRET_TOOLBOX, NP_SECRET_PI, NP_SECRET_SQRT, NP_SECRET_MENU, NP_SECRET_COUNT };++enum { NP_SECRET_XNT, NP_SECRET_VAR, NP_SECRET_TOOLBOX, NP_SECRET_PI, NP_SECRET_SQRT, NP_SECRET_MENU, NP_SECRET_KONAMI, NP_SECRET_COUNT };typedef struct {bool disguise; /* start as Matrices, a calculator app; NumPlay opens through the secret */uint8_t secret; /* NP_SECRET_* */diff --cc launcher/src/settings.cindex ef536e6d,ef536e6d..3d7cc479--- a/launcher/src/settings.c+++ b/launcher/src/settings.c@@@ -40,7 -40,7 +40,8 @@@ typedef struct} list_t;static const char *const secret_names[NP_SECRET_COUNT] = {T("x,n,t key"), T("var key"), T("Toolbox key"), T("Pi key"),-- T("Square root key"), T("Menu: Examples")};++ T("Square root key"), T("Menu: Examples"),++ T("Konami code")};static void build_rows(list_t *l) {l->n = l->ngames = 0;