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
Kingdom Rush: stars on the map's flags, a clearer upgrades screen
Mason36312d62fa7f9bf
diff --git a/games/kingdomrush/src/data.bin b/games/kingdomrush/src/data.binindex 8efb6079..49377424 100644Binary files a/games/kingdomrush/src/data.bin and b/games/kingdomrush/src/data.bin differdiff --git a/games/kingdomrush/src/data.h b/games/kingdomrush/src/data.hindex 4b97812f..ccdf801e 100644--- a/games/kingdomrush/src/data.h+++ b/games/kingdomrush/src/data.h@@ -33,7 +33,7 @@#define PIC_MAP 13#define MAP_Y0 17#define PIC_UPGRADES 14-#define UPG_X 52+#define UPG_X 2#define AN_E_GOBLIN_WALKING 0#define AN_E_GOBLIN_WALKINGUP 1#define AN_E_GOBLIN_WALKINGDOWN 2diff --git a/games/kingdomrush/src/menus.c b/games/kingdomrush/src/menus.cindex 40fab02b..4843cfb3 100644--- a/games/kingdomrush/src/menus.c+++ b/games/kingdomrush/src/menus.c@@ -119,8 +119,10 @@ static void map_band(void) {}if (g.p.camp[i]) {spr_anim(AN_UI_FLAGDONE, 0, false, x, y, false);- for (int k = 0; k < 3; k++) spr_anim(AN_UI_FLAGSTAR, k < g.p.camp[i] ? 1 : 0, false, x - 13 + 7 * k, y + 3, false);- if (g.p.heroic[i]) spr_anim(AN_UI_FLAGHEROIC, 0, false, x, y, false);+ /* LevelThumbCompleted: star1 to star3 over the banner, the heroic shield beside it */+ static const int8_t sx[3] = {-7, -1, 4}, sy[3] = {-25, -25, -24};+ for (int k = 0; k < g.p.camp[i] && k < 3; k++) spr_anim(AN_UI_FLAGSTAR, 1, false, x + sx[k], y + sy[k], false);+ if (g.p.heroic[i]) spr_anim(AN_UI_FLAGHEROIC, 0, false, x - 7, y - 20, false);} elsespr_anim(AN_UI_FLAGNEW, 0, false, x, y, false);}@@ -219,32 +221,37 @@ static void upgrades_band(void) {int state = r < have ? 2 : r == have ? 0 : 1;spr_anim(AN_UI_UPITEM, state, false, x, y, false);int icon = icon_line[c] * 5 + r;- if (state == 1) spr_frame_tint(anim_slot(AN_UI_UPICONS, icon, false), x, y, false, RGB(0x202020), 20);+ if (state == 1) spr_frame_tint(anim_slot(AN_UI_UPICONS, icon, false), x, y, false, RGB(0x181410), 24);else spr_anim(AN_UI_UPICONS, icon, false, x, y, false);- if (state == 0) {- char s[4];- snprintf(s, sizeof s, "%d", up_cost[c][r]);- gfx_text_oc(FONT_SMALL, x + 6, y + 6, s, stars_free() >= up_cost[c][r] ? C_GOLD : RGB(0xFF6040));+ /* (the icons hang from their top left corner: 18 x 17) */+ if (state == 0) { /* the next to buy: its price */+ char p[4];+ snprintf(p, sizeof p, "%d", up_cost[c][r]);+ gfx_text_oc(FONT_SMALL, x + 16, y + 8, p, stars_free() >= up_cost[c][r] ? C_GOLD : RGB(0xFF6040));}if (c == up_col && r == up_row) {- gfx_frame_rect(x - 10, y - 10, 21, 21, RGB(0xFFE14D));- gfx_frame_rect(x - 11, y - 11, 23, 23, RGB(0x6A4A00));+ gfx_frame_rect(x - 2, y - 2, 23, 22, RGB(0xFFE14D));+ gfx_frame_rect(x - 3, y - 3, 25, 24, RGB(0x6A4A00));}}- /* stars to spend, and what the chosen one does */+ /* stars to spend */char s[48];snprintf(s, sizeof s, "%d", stars_free());spr_anim(AN_UI_STAR, 0, false, UPG_X + 8, 213, false);gfx_text_o(FONT_HUD, UPG_X + 25, 213, s, C_GOLD);+ /* what the chosen one does, what it costs, the keys */if (gfx_rows(0, 240)) {- const char *nm = upgrade_name(up_col, up_row), *ds = upgrade_desc(up_col, up_row);- gfx_fill(0, 0, UPG_X - 2, 240, RGB(0x1E140B));- gfx_fill(UPG_X + 217, 0, 320 - UPG_X - 217, 240, RGB(0x1E140B));- gfx_text_box(FONT_SMALL, UPG_X + 220, 40, 48, nm, C_GOLD);- gfx_text_box(FONT_SMALL, UPG_X + 220, 80, 48, ds, C_TEXT);- gfx_text_box(FONT_SMALL, 2, 40, 48, "OK buy", C_TEXT);- gfx_text_box(FONT_SMALL, 2, 64, 48, "Clear: all stars back", C_DIM);- gfx_text_box(FONT_SMALL, 2, 110, 48, "Back map", C_TEXT);+ int x0 = UPG_X + 217, w = 320 - x0;+ panel(x0, 0, w, 240);+ int y = 8 + gfx_text_box(FONT_HUD, x0 + 6, 8, w - 10, upgrade_name(up_col, up_row), C_GOLD);+ int have = g.p.ups[up_col];+ if (up_row < have) snprintf(s, sizeof s, "Bought");+ else snprintf(s, sizeof s, "%d star%s", up_cost[up_col][up_row], up_cost[up_col][up_row] > 1 ? "s" : "");+ gfx_text(FONT_SMALL, x0 + 6, y + 2, s, up_row < have ? C_DIM : up_row > have ? C_DIM : stars_free() >= up_cost[up_col][up_row] ? C_GOLD : RGB(0xFF6040));+ gfx_text_box(FONT_TEXT, x0 + 6, y + 20, w - 10, upgrade_desc(up_col, up_row), C_TEXT);+ gfx_text(FONT_SMALL, x0 + 6, 196, "OK buy", C_TEXT);+ gfx_text(FONT_SMALL, x0 + 6, 210, "Clear reset", C_TEXT);+ gfx_text(FONT_SMALL, x0 + 6, 224, "Back map", C_TEXT);}}void upgrades_draw(void) { gfx_frame(upgrades_band); }diff --git a/games/kingdomrush/tests/rules.c b/games/kingdomrush/tests/rules.cindex 3f1f2292..485bafcd 100644--- a/games/kingdomrush/tests/rules.c+++ b/games/kingdomrush/tests/rules.c@@ -328,6 +328,20 @@ int main(int argc, char **argv) {host_shot(p);}}+ /* the map halfway through, the upgrades, the help */+ for (int i = 0; i < 7; i++) g.p.camp[i] = (uint8_t)(1 + i % 3);+ g.p.heroic[0] = g.p.iron[1] = 1;+ memset(g.p.ups, 0, sizeof g.p.ups);+ g.p.ups[0] = 2, g.p.ups[3] = 1;+ g.map_sel = 7;+ g.screen = SCR_MAP;+ game_draw();+ snprintf(p, sizeof p, "%s/map2.ppm", argv[2]);+ host_shot(p);+ press(K_DIGIT(0));+ game_draw();+ snprintf(p, sizeof p, "%s/upgrades.ppm", argv[2]);+ host_shot(p);return 0;}test_numbers();diff --git a/games/kingdomrush/tools/pack.py b/games/kingdomrush/tools/pack.pyindex 0744173a..0f495791 100644--- a/games/kingdomrush/tools/pack.py+++ b/games/kingdomrush/tools/pack.py@@ -43,7 +43,7 @@ FONT_DIRS = [os.environ.get("FONTS", ""), os.path.expanduser("~/Documents/Assetsos.path.expanduser("~/Documents/Assets/gamesrc/fonts/dejavu"), "/Library/Fonts"]NLEVELS = 12MAP_Y0 = 17 # the map's rows shown: from 17 (of 274)-UPG_X = 52 # where the upgrades' panel (215 x 240) sits+UPG_X = 2 # where the upgrades' panel (215 x 240) sits; what the chosen one does at its rightTERRAIN_IDS = [1541, 1540, 1537, 1505, 1498, 1495, 1492, 1489, 1486, 1483, 1480, 1477]DEFINES = []