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.

Cookie Clicker: in NumPlay's games and tests

Mason363c48ee2d9430f
diff --git a/games/cookieclicker/src/data.h b/games/cookieclicker/src/data.h
index 604f62df..1de1c2d0 100644
--- a/games/cookieclicker/src/data.h
+++ b/games/cookieclicker/src/data.h
@@ -1,22 +1,21 @@
/* Generated by tools/data.py: Cookie Clicker's names, news and the store's pictures. */
-#define TIER_N 5
+#define TIER_N 3
#define ACH_TIERS 1
/* the upgrades, in the order of the save */
-#define N_CURSOR 10
+#define N_CURSOR 8
#define U_MOUSE N_CURSOR
-#define N_MOUSE 8
+#define N_MOUSE 6
#define U_KITTEN (U_MOUSE + N_MOUSE)
#define N_KITTEN 3
#define U_GOLD (U_KITTEN + N_KITTEN)
-#define U_GRANDMA (U_GOLD + 3)
-#define U_COOKIE (U_GRANDMA + 18)
-#define N_COOKIE 16
+#define U_COOKIE (U_GOLD + 3)
+#define N_COOKIE 9
#define U_TIER (U_COOKIE + N_COOKIE)
#define N_UP (U_TIER + 19 * TIER_N)
/* the achievements, in the order of the save */
-#define N_BANK 16
+#define N_BANK 13
#define A_CPS N_BANK
-#define N_CPS 12
+#define N_CPS 10
#define A_CLICK (A_CPS + N_CPS)
#define N_CLICK 6
#define A_BUILD (A_CLICK + N_CLICK) /* the cursor's, then ACH_TIERS for each other building */
@@ -26,138 +25,95 @@
#define A_OWNED (A_GOLDEN + N_GOLDEN)
#define A_UPGRADED (A_OWNED + 2)
#define A_MISC (A_UPGRADED + 2)
-#define N_ACH (A_MISC + 5)
+#define N_ACH (A_MISC + 0)
/* the texts: the upgrades' names, the achievements', the news, the other achievements'
- descriptions, the milks */
+ descriptions, the milks; then the pictures, 18 bytes each (12 x 12 bits, the first lowest) */
#define X_ACH N_UP
#define X_NEWS (X_ACH + N_ACH)
-#define N_LORE 15
+#define N_LORE 10
#define X_MDESC (X_NEWS + N_LORE)
-#define X_MILK (X_MDESC + 5)
+#define X_MILK (X_MDESC + 0)
#define N_MILK 3
-#define N_TEXT 245
-#define TEXT_SIZE 4886
-static const uint8_t cookie_up[N_COOKIE] = {33, 49, 34, 82, 67, 83, 67, 84, 69, 85, 166, 166, 86, 71, 87, 72};
+#define N_TEXT 158
+#define ICONS_AT 2916
+#define TEXT_SIZE 3312
+static const uint8_t cookie_up[N_COOKIE] = {33, 49, 34, 82, 67, 83, 67, 84, 69};
enum { IC_CURSOR, IC_GRANDMA, IC_FARM, IC_MINE, IC_FACTORY, IC_BANK, IC_TEMPLE, IC_WIZARD, IC_SHIPMENT, IC_ALCHEMY, IC_PORTAL, IC_TIME, IC_ANTIMATTER, IC_PRISM, IC_CHANCE, IC_FRACTAL, IC_CONSOLE, IC_IDLEVERSE, IC_CORTEX, IC_YOU, IC_MOUSE, IC_KITTEN };
-static const uint8_t icons[22][18] = {
- {1, 48, 0, 7, 240, 0, 31, 240, 3, 127, 240, 15, 31, 176, 3, 49, 0, 6},
- {240, 128, 31, 254, 103, 96, 154, 101, 102, 2, 36, 79, 4, 130, 31, 156, 227, 127},
- {96, 128, 22, 252, 35, 79, 252, 131, 22, 96, 192, 54, 248, 1, 6, 96, 240, 255},
- {252, 227, 127, 99, 28, 134, 96, 0, 6, 96, 0, 6, 96, 0, 6, 96, 0, 6},
- {6, 96, 0, 6, 96, 34, 54, 227, 59, 255, 191, 237, 219, 254, 255, 255, 255, 255},
- {96, 128, 31, 254, 247, 255, 0, 96, 219, 182, 109, 219, 182, 13, 0, 255, 255, 255},
- {96, 0, 15, 144, 128, 31, 248, 193, 63, 156, 227, 121, 254, 247, 255, 255, 15, 0},
- {192, 0, 14, 224, 1, 23, 176, 129, 63, 216, 195, 111, 252, 247, 255, 254, 7, 0},
- {96, 0, 15, 240, 128, 25, 152, 129, 31, 248, 193, 63, 254, 183, 223, 145, 8, 9},
- {240, 0, 6, 96, 0, 6, 144, 128, 16, 4, 162, 95, 253, 219, 191, 253, 235, 127},
- {248, 193, 48, 102, 54, 201, 9, 153, 144, 9, 153, 144, 147, 108, 102, 12, 131, 31},
- {255, 47, 64, 6, 198, 63, 248, 1, 15, 144, 128, 16, 100, 162, 95, 254, 247, 255},
- {96, 192, 54, 146, 164, 80, 108, 115, 239, 247, 206, 54, 10, 37, 73, 108, 3, 6},
- {96, 0, 6, 240, 0, 15, 152, 129, 25, 12, 195, 48, 6, 102, 96, 255, 255, 255},
- {156, 227, 123, 254, 199, 63, 159, 255, 240, 15, 255, 249, 252, 227, 127, 222, 199, 56},
- {96, 0, 15, 144, 128, 31, 12, 195, 57, 146, 228, 127, 3, 124, 224, 9, 249, 255},
- {255, 31, 128, 5, 152, 128, 17, 152, 128, 5, 24, 188, 1, 248, 255, 0, 0, 0},
- {240, 192, 63, 254, 231, 127, 255, 15, 0, 255, 239, 127, 254, 199, 63, 240, 0, 0},
- {216, 192, 63, 182, 247, 237, 251, 251, 246, 254, 199, 30, 96, 0, 6, 0, 0, 0},
- {240, 128, 31, 248, 129, 31, 240, 0, 0, 252, 227, 127, 255, 255, 255, 255, 15, 0},
- {240, 128, 22, 100, 66, 38, 252, 67, 32, 4, 66, 32, 4, 130, 16, 240, 0, 0},
- {1, 56, 192, 7, 254, 255, 255, 63, 207, 243, 252, 255, 159, 239, 127, 252, 3, 0},
-};
-static const uint8_t text_z[2298] = {
- 141, 88, 7, 147, 220, 58, 108, 214, 79, 65, 234, 171, 231, 244, 54, 221, 221, 78, 220, 207, 126, 109, 42, 68,
- 98, 87, 204, 81, 128, 30, 8, 221, 90, 249, 245, 33, 200, 209, 237, 186, 101, 226, 42, 128, 16, 58, 62, 80,
- 247, 142, 18, 31, 68, 3, 69, 72, 28, 233, 35, 28, 18, 31, 73, 135, 135, 168, 11, 102, 176, 149, 153, 50,
- 44, 74, 183, 196, 150, 132, 33, 40, 225, 60, 220, 159, 199, 84, 165, 77, 101, 45, 195, 251, 169, 254, 139, 28,
- 161, 191, 91, 134, 151, 41, 103, 151, 221, 233, 7, 159, 209, 239, 245, 51, 198, 219, 21, 227, 151, 188, 196, 246,
- 25, 239, 154, 62, 126, 206, 122, 147, 177, 88, 10, 48, 203, 90, 104, 120, 174, 194, 208, 31, 223, 39, 67, 78,
- 235, 12, 157, 188, 31, 113, 70, 182, 51, 227, 3, 203, 104, 152, 46, 68, 30, 231, 53, 158, 169, 95, 83, 153,
- 48, 103, 217, 160, 211, 79, 144, 13, 139, 17, 101, 232, 140, 255, 74, 102, 196, 48, 81, 94, 72, 203, 78, 158,
- 68, 111, 46, 72, 226, 99, 98, 114, 198, 139, 53, 220, 108, 16, 113, 171, 81, 40, 113, 76, 75, 178, 109, 120,
- 74, 6, 217, 79, 170, 126, 157, 73, 225, 168, 200, 113, 70, 79, 34, 95, 146, 191, 54, 189, 103, 250, 1, 242,
- 39, 244, 27, 77, 84, 140, 74, 185, 120, 37, 89, 152, 206, 228, 67, 41, 115, 10, 103, 250, 189, 34, 151, 121,
- 53, 138, 103, 222, 253, 108, 164, 151, 140, 167, 218, 31, 190, 187, 144, 97, 75, 119, 196, 59, 76, 60, 202, 233,
- 124, 218, 195, 60, 71, 65, 134, 103, 159, 19, 163, 110, 159, 89, 99, 52, 186, 8, 75, 49, 241, 118, 225, 116,
- 22, 62, 31, 123, 181, 19, 67, 16, 185, 73, 84, 219, 97, 61, 162, 222, 81, 175, 209, 102, 194, 12, 138, 169,
- 92, 8, 189, 33, 228, 213, 96, 92, 205, 104, 23, 246, 100, 4, 113, 246, 78, 255, 58, 37, 35, 8, 83, 101,
- 103, 119, 104, 231, 191, 196, 128, 17, 231, 132, 112, 41, 253, 72, 214, 49, 211, 85, 152, 210, 242, 77, 13, 243,
- 87, 223, 188, 159, 243, 213, 151, 86, 30, 161, 222, 156, 95, 189, 10, 130, 70, 241, 235, 154, 191, 60, 126, 28,
- 114, 90, 202, 89, 217, 31, 52, 42, 158, 115, 196, 41, 220, 144, 70, 145, 152, 157, 52, 21, 89, 78, 120, 160,
- 92, 134, 39, 162, 39, 212, 88, 224, 160, 50, 239, 73, 174, 34, 68, 249, 106, 201, 205, 136, 74, 206, 137, 143,
- 176, 36, 246, 218, 142, 154, 66, 227, 71, 98, 91, 213, 211, 171, 43, 19, 252, 247, 154, 2, 237, 105, 177, 169,
- 154, 132, 99, 198, 82, 60, 211, 19, 225, 2, 147, 80, 181, 71, 106, 41, 167, 255, 113, 124, 105, 238, 129, 41,
- 81, 109, 50, 98, 178, 20, 48, 231, 237, 106, 150, 152, 14, 233, 34, 188, 167, 109, 208, 71, 37, 140, 80, 2,
- 42, 5, 149, 211, 94, 251, 99, 107, 177, 99, 71, 143, 225, 67, 54, 61, 63, 166, 25, 251, 243, 179, 171, 81,
- 230, 17, 230, 196, 85, 85, 13, 111, 213, 152, 90, 43, 240, 45, 109, 162, 48, 82, 54, 247, 51, 229, 8, 25,
- 71, 209, 225, 250, 68, 104, 101, 146, 165, 246, 119, 131, 4, 37, 12, 38, 90, 251, 157, 66, 213, 37, 227, 154,
- 177, 209, 239, 49, 103, 82, 48, 202, 185, 1, 84, 72, 165, 136, 94, 41, 149, 84, 12, 217, 28, 47, 99, 50,
- 8, 158, 231, 225, 126, 72, 241, 106, 81, 145, 3, 220, 226, 218, 173, 158, 123, 193, 83, 252, 248, 227, 34, 236,
- 80, 139, 25, 18, 27, 41, 21, 3, 69, 243, 68, 72, 142, 196, 144, 162, 228, 106, 8, 131, 214, 60, 5, 111,
- 30, 202, 41, 36, 89, 11, 140, 153, 74, 105, 49, 174, 12, 7, 42, 150, 110, 49, 15, 143, 57, 163, 30, 41,
- 194, 130, 108, 19, 9, 15, 111, 36, 177, 121, 10, 38, 180, 58, 114, 132, 26, 179, 147, 35, 117, 47, 57, 36,
- 98, 131, 163, 166, 89, 146, 82, 3, 179, 48, 17, 67, 88, 181, 144, 71, 57, 137, 100, 144, 3, 20, 95, 29,
- 186, 13, 191, 32, 167, 156, 17, 152, 60, 51, 228, 104, 53, 79, 146, 189, 230, 74, 127, 174, 174, 237, 144, 55,
- 210, 225, 87, 212, 5, 162, 166, 91, 186, 8, 125, 22, 150, 156, 108, 234, 216, 82, 169, 109, 120, 92, 10, 113,
- 32, 183, 17, 101, 61, 78, 21, 173, 214, 139, 25, 240, 5, 164, 82, 18, 14, 247, 255, 92, 17, 130, 174, 197,
- 154, 225, 221, 119, 195, 49, 147, 13, 207, 185, 32, 19, 8, 90, 235, 226, 29, 156, 175, 101, 205, 48, 10, 199,
- 154, 71, 78, 230, 176, 204, 129, 28, 124, 152, 192, 28, 23, 151, 140, 108, 195, 147, 188, 126, 132, 128, 11, 134,
- 212, 171, 157, 102, 130, 5, 21, 163, 124, 4, 165, 34, 249, 150, 212, 183, 23, 219, 58, 131, 35, 10, 71, 93,
- 231, 186, 61, 215, 130, 217, 21, 83, 223, 174, 58, 252, 238, 232, 172, 179, 168, 202, 169, 74, 206, 174, 197, 68,
- 247, 70, 30, 165, 8, 183, 241, 116, 63, 189, 76, 53, 171, 47, 188, 110, 13, 72, 212, 55, 175, 143, 98, 36,
- 173, 48, 122, 132, 17, 217, 255, 185, 161, 218, 145, 213, 7, 31, 255, 45, 100, 49, 21, 246, 121, 154, 97, 145,
- 156, 202, 52, 252, 135, 77, 254, 162, 232, 69, 186, 115, 58, 78, 230, 200, 222, 160, 123, 120, 179, 42, 65, 232,
- 203, 161, 31, 253, 46, 171, 246, 173, 212, 167, 144, 134, 191, 172, 184, 5, 15, 200, 10, 220, 87, 130, 215, 135,
- 195, 95, 194, 140, 199, 20, 90, 215, 214, 69, 195, 236, 110, 103, 113, 140, 221, 192, 28, 114, 106, 246, 100, 213,
- 171, 76, 120, 128, 144, 165, 58, 9, 135, 68, 57, 14, 247, 65, 41, 164, 133, 96, 172, 186, 1, 71, 89, 173,
- 61, 246, 101, 225, 49, 105, 71, 94, 142, 148, 71, 149, 19, 67, 241, 28, 213, 86, 242, 33, 76, 177, 12, 175,
- 60, 153, 17, 86, 78, 45, 246, 61, 95, 47, 201, 161, 2, 202, 34, 245, 127, 8, 158, 157, 247, 19, 193, 127,
- 226, 45, 94, 7, 77, 139, 121, 137, 138, 100, 130, 131, 40, 196, 117, 158, 221, 208, 191, 254, 243, 152, 12, 80,
- 21, 55, 47, 0, 86, 236, 114, 111, 15, 185, 230, 230, 177, 143, 224, 162, 169, 80, 171, 89, 202, 84, 193, 97,
- 227, 42, 100, 41, 116, 183, 220, 209, 228, 195, 6, 209, 39, 142, 183, 102, 115, 94, 179, 117, 231, 32, 49, 180,
- 29, 80, 38, 202, 185, 47, 0, 97, 63, 74, 194, 195, 203, 179, 28, 30, 137, 173, 212, 206, 15, 184, 16, 120,
- 3, 250, 82, 231, 154, 170, 76, 17, 152, 86, 197, 12, 101, 170, 254, 101, 223, 118, 35, 109, 53, 149, 101, 209,
- 196, 149, 225, 131, 146, 84, 209, 146, 112, 235, 188, 154, 45, 97, 3, 228, 8, 163, 135, 52, 209, 156, 202, 50,
- 145, 146, 167, 175, 233, 98, 50, 31, 8, 7, 12, 95, 179, 94, 193, 91, 116, 15, 152, 244, 88, 81, 58, 186,
- 215, 154, 220, 43, 71, 77, 54, 136, 13, 224, 247, 173, 172, 228, 61, 215, 182, 67, 159, 22, 37, 186, 82, 108,
- 185, 207, 194, 190, 185, 106, 9, 186, 11, 94, 139, 151, 232, 182, 160, 200, 76, 208, 135, 250, 90, 218, 73, 4,
- 245, 190, 3, 150, 83, 29, 57, 138, 71, 87, 218, 78, 180, 198, 120, 56, 228, 6, 32, 157, 118, 104, 201, 241,
- 234, 128, 126, 9, 219, 121, 253, 106, 179, 83, 79, 49, 99, 176, 51, 253, 161, 183, 9, 230, 157, 225, 99, 236,
- 80, 185, 211, 207, 249, 144, 56, 25, 221, 209, 243, 44, 106, 103, 249, 71, 194, 223, 25, 20, 147, 5, 102, 114,
- 47, 125, 66, 32, 32, 119, 158, 51, 250, 62, 43, 128, 57, 123, 55, 194, 9, 55, 136, 114, 226, 225, 117, 53,
- 29, 165, 80, 197, 132, 178, 118, 149, 158, 240, 103, 168, 49, 136, 210, 78, 95, 27, 97, 220, 192, 176, 216, 6,
- 197, 148, 112, 238, 58, 27, 58, 22, 35, 239, 179, 82, 96, 81, 137, 107, 56, 47, 208, 91, 81, 163, 143, 59,
- 181, 172, 185, 160, 238, 84, 69, 70, 167, 94, 79, 48, 209, 246, 51, 108, 178, 126, 167, 4, 197, 82, 206, 224,
- 141, 48, 188, 32, 251, 174, 0, 59, 128, 184, 31, 222, 130, 152, 184, 118, 213, 201, 115, 12, 135, 148, 189, 243,
- 78, 201, 166, 139, 187, 8, 49, 216, 148, 60, 119, 227, 6, 83, 178, 2, 255, 244, 175, 110, 106, 191, 192, 239,
- 162, 176, 248, 130, 145, 181, 186, 147, 43, 30, 120, 100, 41, 244, 103, 180, 41, 11, 247, 103, 201, 219, 188, 164,
- 80, 58, 37, 138, 51, 246, 71, 44, 243, 157, 252, 145, 98, 220, 95, 184, 187, 124, 53, 226, 165, 172, 133, 224,
- 52, 17, 229, 253, 174, 90, 67, 218, 189, 125, 224, 93, 102, 173, 32, 7, 212, 185, 149, 237, 134, 229, 212, 56,
- 253, 114, 240, 166, 37, 212, 154, 227, 19, 38, 159, 57, 50, 219, 96, 33, 230, 173, 35, 161, 57, 234, 155, 64,
- 153, 52, 113, 221, 18, 116, 106, 235, 48, 250, 178, 166, 152, 252, 221, 187, 203, 52, 58, 229, 25, 244, 237, 7,
- 76, 167, 158, 203, 190, 57, 78, 168, 75, 91, 113, 35, 154, 87, 244, 133, 79, 209, 50, 137, 9, 183, 123, 51,
- 69, 144, 213, 134, 107, 202, 7, 199, 8, 195, 196, 213, 202, 147, 127, 248, 71, 135, 148, 237, 187, 156, 123, 173,
- 122, 8, 167, 9, 205, 243, 15, 223, 209, 60, 60, 247, 66, 142, 190, 23, 28, 213, 155, 199, 195, 203, 13, 228,
- 196, 125, 20, 247, 203, 67, 79, 140, 27, 59, 99, 251, 125, 239, 55, 185, 105, 16, 226, 160, 239, 215, 66, 91,
- 61, 208, 53, 101, 223, 55, 247, 53, 84, 59, 20, 172, 34, 195, 132, 28, 156, 181, 30, 103, 98, 143, 225, 53,
- 83, 239, 16, 247, 108, 179, 201, 155, 249, 149, 63, 247, 250, 124, 224, 128, 204, 27, 52, 170, 138, 63, 70, 205,
- 27, 140, 73, 107, 246, 92, 121, 43, 201, 129, 40, 67, 78, 213, 133, 185, 77, 195, 94, 191, 123, 240, 96, 117,
- 84, 24, 37, 110, 112, 66, 182, 226, 101, 32, 52, 239, 101, 189, 147, 234, 85, 58, 36, 45, 14, 18, 237, 155,
- 71, 200, 69, 91, 153, 77, 177, 76, 247, 192, 65, 153, 169, 194, 204, 40, 58, 137, 68, 80, 12, 65, 132, 97,
- 68, 165, 188, 129, 201, 26, 38, 42, 144, 108, 215, 135, 115, 170, 124, 60, 42, 81, 87, 166, 91, 199, 46, 57,
- 124, 97, 255, 76, 1, 42, 193, 34, 203, 154, 81, 193, 75, 241, 153, 221, 175, 72, 27, 102, 47, 125, 223, 132,
- 190, 153, 170, 225, 118, 36, 43, 127, 46, 63, 170, 231, 103, 71, 153, 81, 182, 187, 56, 55, 212, 175, 41, 63,
- 137, 218, 4, 232, 187, 217, 29, 159, 133, 105, 187, 55, 188, 33, 89, 114, 219, 105, 212, 47, 255, 94, 60, 159,
- 17, 64, 71, 46, 19, 56, 146, 1, 54, 60, 250, 50, 96, 111, 71, 165, 166, 222, 59, 113, 94, 11, 173, 115,
- 129, 72, 177, 127, 29, 128, 201, 255, 149, 161, 9, 111, 9, 70, 34, 6, 198, 217, 3, 135, 5, 181, 121, 231,
- 113, 116, 236, 57, 9, 71, 210, 111, 191, 185, 100, 12, 20, 97, 117, 41, 56, 250, 190, 102, 111, 72, 40, 171,
- 222, 82, 202, 217, 219, 244, 158, 95, 167, 250, 58, 82, 194, 246, 185, 210, 131, 221, 235, 177, 175, 46, 178, 2,
- 167, 84, 166, 189, 202, 159, 250, 254, 128, 170, 92, 127, 19, 196, 38, 82, 136, 105, 38, 246, 245, 93, 32, 227,
- 210, 86, 188, 247, 229, 199, 84, 140, 56, 248, 215, 80, 177, 255, 79, 14, 207, 23, 152, 9, 75, 75, 165, 173,
- 202, 20, 187, 190, 46, 217, 55, 229, 207, 123, 149, 103, 201, 20, 90, 111, 101, 186, 165, 124, 175, 78, 111, 150,
- 128, 217, 161, 166, 64, 233, 248, 3, 186, 114, 1, 132, 127, 248, 251, 171, 57, 241, 106, 4, 133, 218, 188, 246,
- 30, 251, 212, 17, 184, 94, 67, 160, 82, 254, 2, 190, 175, 124, 56, 181, 235, 74, 63, 252, 97, 120, 230, 9,
- 71, 131, 76, 88, 12, 254, 193, 163, 160, 214, 42, 163, 99, 67, 205, 203, 61, 223, 234, 84, 79, 230, 207, 208,
- 127, 220, 64, 56, 111, 94, 50, 79, 115, 159, 255, 8, 255, 240, 47, 14, 78, 30, 127, 3, 115, 80, 194, 156,
- 183, 159, 251, 255, 222, 129, 197, 246, 35, 132, 227, 37, 104, 65, 219, 216, 54, 33, 87, 107, 133, 130, 112, 4,
- 60, 24, 41, 36, 131, 178, 224, 137, 171, 210, 215, 39, 62, 187, 251, 111, 251, 39, 45, 216, 182, 184, 201, 246,
- 211, 3, 247, 244, 230, 124, 27, 238, 228, 59, 44, 203, 72, 170, 91, 39, 255, 23,
+static const uint8_t text_z[1812] = {
+ 124, 86, 7, 151, 228, 56, 10, 246, 79, 225, 114, 206, 249, 229, 201, 155, 183, 111, 123, 230, 194, 203, 216, 194,
+ 54, 175, 36, 240, 34, 84, 53, 190, 95, 127, 226, 149, 187, 186, 55, 206, 116, 2, 33, 36, 224, 251, 62, 213,
+ 23, 196, 50, 171, 77, 148, 128, 37, 209, 123, 152, 89, 22, 178, 225, 5, 218, 134, 25, 188, 137, 80, 134, 205,
+ 232, 76, 226, 172, 2, 147, 17, 150, 225, 89, 25, 185, 71, 187, 105, 171, 195, 219, 181, 255, 68, 73, 199, 222,
+ 58, 124, 202, 57, 71, 236, 131, 253, 252, 107, 246, 91, 251, 154, 227, 159, 13, 211, 215, 125, 119, 25, 171, 243,
+ 4, 165, 39, 167, 225, 67, 83, 57, 254, 124, 203, 142, 194, 173, 28, 230, 179, 132, 5, 197, 31, 29, 239, 68,
+ 71, 71, 126, 18, 242, 42, 183, 244, 104, 125, 204, 238, 36, 176, 82, 222, 226, 156, 195, 188, 168, 157, 158, 152,
+ 36, 11, 11, 133, 227, 147, 54, 157, 118, 72, 184, 15, 247, 100, 36, 137, 55, 246, 125, 120, 67, 14, 57, 86,
+ 226, 158, 44, 48, 169, 158, 152, 234, 112, 223, 22, 180, 155, 245, 57, 122, 33, 204, 96, 200, 245, 73, 208, 29,
+ 161, 52, 135, 177, 185, 211, 99, 240, 11, 157, 52, 220, 15, 246, 191, 87, 118, 130, 105, 237, 238, 140, 78, 55,
+ 255, 167, 56, 97, 194, 194, 8, 79, 163, 95, 106, 27, 51, 253, 102, 90, 121, 251, 206, 12, 229, 91, 119, 190,
+ 86, 187, 160, 165, 10, 179, 105, 129, 197, 80, 82, 193, 225, 222, 137, 242, 111, 182, 216, 151, 192, 52, 103, 150,
+ 5, 54, 150, 104, 200, 104, 60, 97, 248, 19, 137, 55, 139, 187, 175, 132, 27, 172, 26, 233, 200, 156, 51, 255,
+ 47, 64, 20, 39, 16, 184, 209, 173, 51, 11, 246, 2, 104, 185, 142, 123, 120, 151, 221, 142, 63, 239, 189, 89,
+ 98, 138, 118, 200, 153, 118, 53, 24, 41, 123, 100, 230, 156, 32, 227, 168, 54, 220, 95, 8, 189, 174, 186, 13,
+ 111, 49, 103, 50, 112, 138, 95, 61, 247, 196, 181, 170, 253, 198, 168, 114, 117, 20, 15, 152, 38, 238, 191, 162,
+ 176, 225, 217, 196, 233, 55, 155, 169, 206, 112, 198, 22, 89, 223, 104, 78, 36, 192, 73, 115, 223, 141, 147, 241,
+ 204, 83, 116, 145, 50, 79, 172, 173, 194, 152, 169, 86, 150, 101, 184, 83, 22, 143, 139, 173, 232, 29, 202, 132,
+ 150, 114, 152, 35, 93, 115, 203, 196, 36, 14, 139, 113, 81, 142, 94, 252, 11, 133, 115, 70, 16, 26, 91, 70,
+ 26, 254, 173, 86, 86, 205, 209, 26, 163, 47, 91, 4, 207, 121, 39, 235, 91, 189, 239, 145, 125, 120, 85, 43,
+ 201, 68, 160, 51, 36, 109, 203, 218, 9, 210, 158, 204, 237, 118, 134, 227, 152, 201, 135, 15, 165, 162, 16, 40,
+ 122, 12, 229, 134, 220, 123, 109, 25, 70, 149, 52, 188, 206, 237, 61, 76, 184, 225, 196, 174, 193, 55, 46, 4,
+ 27, 26, 38, 125, 15, 70, 85, 243, 153, 44, 72, 39, 222, 10, 4, 234, 36, 89, 43, 199, 136, 70, 173, 42,
+ 61, 157, 91, 100, 247, 149, 212, 246, 225, 19, 180, 229, 10, 160, 32, 226, 20, 120, 72, 100, 157, 6, 5, 54,
+ 205, 92, 215, 225, 31, 190, 134, 95, 251, 216, 111, 128, 203, 188, 172, 62, 252, 87, 155, 93, 201, 114, 96, 110,
+ 248, 225, 179, 156, 225, 57, 121, 133, 103, 70, 240, 249, 60, 255, 16, 10, 46, 60, 245, 117, 150, 225, 223, 44,
+ 18, 71, 103, 13, 126, 236, 224, 60, 157, 200, 59, 108, 28, 71, 60, 145, 93, 73, 32, 137, 242, 104, 122, 17,
+ 168, 113, 237, 222, 92, 156, 92, 57, 133, 30, 17, 124, 132, 103, 188, 159, 140, 55, 143, 250, 170, 102, 130, 89,
+ 13, 82, 43, 37, 182, 255, 245, 207, 35, 59, 160, 25, 238, 81, 41, 78, 39, 208, 51, 217, 156, 245, 18, 169,
+ 121, 166, 234, 144, 250, 15, 150, 61, 242, 65, 105, 217, 185, 71, 84, 2, 22, 192, 32, 80, 93, 41, 231, 161,
+ 87, 242, 155, 73, 37, 150, 88, 101, 184, 51, 150, 137, 183, 76, 9, 132, 154, 97, 134, 186, 246, 236, 57, 196,
+ 96, 164, 125, 120, 6, 117, 51, 150, 238, 136, 105, 179, 25, 134, 170, 98, 14, 77, 121, 145, 53, 234, 134, 115,
+ 0, 237, 149, 144, 45, 157, 69, 41, 142, 178, 24, 127, 92, 180, 137, 67, 10, 166, 7, 187, 241, 68, 16, 178,
+ 27, 77, 233, 183, 62, 197, 222, 170, 133, 14, 16, 221, 107, 172, 4, 123, 99, 10, 32, 122, 233, 192, 160, 180,
+ 228, 136, 139, 21, 235, 215, 153, 231, 28, 136, 60, 236, 192, 106, 78, 191, 153, 49, 148, 242, 193, 247, 66, 107,
+ 225, 233, 193, 122, 131, 25, 39, 127, 180, 223, 9, 71, 237, 152, 31, 28, 1, 182, 224, 206, 131, 253, 161, 204,
+ 44, 236, 116, 179, 75, 81, 243, 199, 248, 151, 42, 63, 115, 168, 174, 27, 20, 130, 184, 229, 11, 172, 237, 186,
+ 30, 252, 251, 0, 45, 77, 106, 116, 216, 33, 76, 152, 118, 112, 172, 190, 67, 117, 35, 44, 15, 66, 83, 84,
+ 170, 147, 245, 94, 212, 10, 155, 105, 106, 211, 163, 10, 157, 213, 156, 222, 63, 88, 91, 203, 21, 111, 107, 95,
+ 54, 12, 235, 243, 21, 86, 218, 127, 13, 187, 182, 159, 25, 65, 117, 206, 185, 123, 140, 134, 79, 200, 127, 86,
+ 65, 232, 28, 196, 199, 232, 251, 130, 44, 125, 98, 29, 154, 113, 19, 158, 174, 127, 163, 175, 89, 15, 191, 230,
+ 189, 108, 60, 213, 195, 50, 44, 120, 4, 213, 114, 139, 95, 40, 165, 135, 13, 55, 13, 207, 97, 124, 26, 143,
+ 21, 92, 86, 162, 60, 188, 185, 138, 242, 207, 234, 77, 180, 159, 199, 136, 61, 216, 9, 51, 90, 9, 142, 193,
+ 73, 244, 2, 225, 185, 42, 234, 157, 69, 3, 174, 143, 246, 138, 28, 216, 36, 247, 29, 54, 18, 217, 175, 164,
+ 244, 16, 6, 87, 168, 171, 177, 80, 23, 183, 11, 251, 180, 82, 26, 94, 189, 223, 40, 113, 236, 237, 90, 132,
+ 82, 75, 115, 244, 176, 158, 245, 27, 5, 153, 132, 46, 33, 60, 57, 93, 197, 229, 130, 182, 133, 158, 241, 136,
+ 30, 19, 248, 68, 133, 96, 91, 213, 85, 226, 1, 13, 20, 106, 243, 225, 158, 242, 28, 108, 113, 100, 161, 174,
+ 83, 127, 248, 99, 144, 107, 255, 89, 206, 71, 111, 163, 132, 126, 2, 58, 172, 236, 240, 51, 42, 195, 135, 209,
+ 248, 145, 23, 24, 13, 89, 226, 198, 29, 235, 59, 4, 239, 167, 172, 66, 135, 148, 31, 141, 57, 94, 235, 195,
+ 120, 22, 248, 208, 19, 5, 213, 66, 127, 226, 169, 243, 22, 133, 54, 206, 41, 20, 216, 166, 120, 34, 39, 239,
+ 116, 91, 81, 166, 112, 181, 165, 144, 68, 13, 209, 210, 153, 40, 67, 230, 158, 162, 92, 249, 117, 244, 255, 183,
+ 240, 188, 5, 165, 70, 77, 123, 47, 94, 188, 70, 27, 9, 61, 176, 99, 183, 168, 107, 151, 103, 182, 26, 12,
+ 243, 105, 133, 69, 41, 66, 33, 198, 228, 134, 117, 253, 45, 132, 188, 8, 117, 142, 142, 106, 171, 106, 2, 195,
+ 169, 39, 144, 190, 195, 40, 239, 224, 218, 166, 149, 42, 176, 63, 228, 195, 194, 221, 143, 139, 209, 145, 204, 246,
+ 43, 241, 117, 254, 182, 243, 15, 11, 208, 8, 54, 221, 90, 70, 131, 104, 229, 215, 206, 253, 150, 104, 199, 28,
+ 163, 195, 81, 155, 67, 232, 103, 225, 76, 177, 164, 77, 190, 30, 63, 90, 244, 7, 115, 134, 72, 60, 234, 126,
+ 171, 115, 71, 251, 150, 228, 1, 31, 95, 1, 67, 230, 227, 226, 69, 133, 246, 223, 14, 119, 164, 91, 166, 30,
+ 88, 232, 250, 129, 228, 76, 182, 7, 198, 1, 47, 184, 71, 202, 133, 28, 16, 130, 117, 223, 82, 240, 219, 160,
+ 43, 68, 250, 64, 82, 105, 149, 90, 169, 144, 40, 29, 159, 88, 92, 191, 175, 67, 43, 158, 9, 70, 34, 1,
+ 193, 18, 133, 199, 171, 25, 183, 139, 58, 174, 120, 239, 63, 37, 145, 245, 157, 215, 15, 126, 133, 243, 233, 241,
+ 197, 187, 154, 95, 96, 221, 70, 50, 219, 175, 230, 255, 123, 30, 6, 24, 185, 130, 232, 91, 163, 182, 187, 222,
+ 184, 182, 86, 81, 163, 109, 236, 108, 109, 55, 168, 103, 126, 21, 167, 182, 17, 107, 131, 250, 108, 95, 124, 182,
+ 61, 199, 213, 223, 121, 55, 127, 15, 207, 134, 106, 19, 24, 24, 88, 152, 134, 176, 5, 150, 176, 102, 51, 232,
+ 25, 181, 240, 83, 135, 223, 157, 56, 169, 118, 6, 181, 247, 44, 31, 218, 200, 97, 186, 92, 118, 4, 229, 251,
+ 203, 15, 103, 237, 136, 170, 244, 135, 25, 202, 109, 228, 216, 218, 71, 135, 65, 63, 75, 41, 101, 223, 209, 182,
+ 23, 51, 7, 234, 56, 10, 56, 44, 230, 68, 16, 14, 215, 253, 186, 80, 247, 107, 30, 40, 17, 88, 240, 132,
+ 90, 162, 217, 158, 15, 109, 55, 68, 10, 23, 64, 22, 204, 111, 86, 173, 8, 75, 158, 234, 220, 75, 114, 4,
+ 185, 1, 68, 13, 163, 171, 222, 72, 74, 25, 255, 221, 244, 212, 104, 98, 169, 249, 79, 232, 66, 237, 183, 80,
+ 178, 46, 51, 217, 71, 162, 217, 155, 78, 238, 40, 54, 189, 125, 34, 232, 249, 249, 147, 115, 239, 91, 112, 163,
+ 87, 95, 224, 137, 170, 22, 136, 178, 227, 223, 66, 98, 184, 56, 245, 217, 143, 67, 231, 175, 13, 69, 42, 118,
+ 152, 93, 7, 207, 107, 148, 33, 12, 22, 188, 145, 86, 205, 205, 221, 164, 63, 121, 24, 17, 63, 180, 221, 226,
+ 133, 158, 207, 200, 22, 96, 76, 124, 212, 88, 184, 107, 234, 194, 185, 185, 187, 159, 181, 19, 205, 237, 102, 83,
+ 12, 209, 66, 117, 111, 232, 162, 55, 84, 183, 50, 77, 21, 69, 0, 96, 89, 30, 222, 69, 112, 1, 224, 16,
+ 17, 237, 12, 160, 58, 203, 243, 43, 50, 144, 72, 76, 240, 194, 245, 135, 65, 175, 212, 136, 55, 37, 11, 3,
+ 16, 99, 81, 192, 2, 17, 89, 126, 220, 239, 150, 3, 86, 173, 223, 170, 189, 183, 144, 1, 168, 118, 101, 25,
+ 56, 162, 167, 114, 84, 198, 207, 67, 68, 214, 192, 36,
};
diff --git a/games/cookieclicker/src/main.c b/games/cookieclicker/src/main.c
index f20cd2e5..d78fcf19 100644
--- a/games/cookieclicker/src/main.c
+++ b/games/cookieclicker/src/main.c
@@ -86,7 +86,7 @@ static uint16_t text_at[N_TEXT];
static uint8_t list[N_UP];
static float cps, raw_cps, cpc, each[NB], milk;
static int nach, nup, owned, nlist, tab = 1, sel[3], top[3], ov, osel, toast = -1, gc_x, gc_y, news_x, news_w;
-static uint32_t now, seed, toast_t, news_n, clicks_t, clicks_n, gc_life, gc_dur, pop_t, bounce_t;
+static uint32_t now, seed, toast_t, news_n, gc_life, gc_dur, pop_t, bounce_t;
static struct {
int16_t x, y;
uint32_t t;
@@ -113,7 +113,7 @@ static int many(void) { return sv.mode == 2 ? 100 : sv.mode * 9 + 1; }
/* the price of n more buildings b: 15% more for each one owned, rounded up */
static float price(int b, int n) {
float p = base_price(b) * powi(1.15f, sv.amount[b]);
- return __builtin_ceilf(n > 1 ? p * (powi(1.15f, n) - 1) / 0.15f : p * 0.99999f);
+ return __builtin_ceilf((n > 1 ? p * (powi(1.15f, n) - 1) / 0.15f : p) * 0.999999f);
}
/* ------------------------------------------------------------ numbers, as the game writes them */
@@ -184,8 +184,6 @@ static void compute(void) {
float c = bdata[b][2] * p10(bdata[b][3]);
if (b == 0) c = c * clicks + fingers();
else c *= (float)(1 << bought(U_TIER + (b - 1) * TIER_N, TIER_N));
- if (b == 1) c *= (float)(1 << bought(U_GRANDMA, 18));
- if (b > 1 && has(sv.up, U_GRANDMA + b - 2)) c *= 1 + sv.amount[1] / 100.f / (float)(b - 1);
each[b] = c * mult * frenzy;
total += sv.amount[b] * c;
}
@@ -194,16 +192,15 @@ static void compute(void) {
}
/* ------------------------------------------------------------ upgrades */
-static const uint16_t cursor_at[10] = {1, 1, 10, 25, 50, 100, 150, 200, 250, 300};
-static const uint8_t cursor_e[10] = {2, 2, 4, 5, 7, 8, 9, 10, 13, 16}, kitten_e[3] = {6, 9, 13};
-static const uint8_t tier_e[TIER_N] = {1, 1, 2, 4, 6}, tier_at[TIER_N] = {1, 5, 25, 50, 100}, golden_at[3] = {7, 27, 77};
+static const uint8_t cursor_at[N_CURSOR] = {1, 1, 10, 25, 50, 100, 150, 200};
+static const uint8_t cursor_e[N_CURSOR] = {2, 2, 4, 5, 7, 8, 9, 10}, kitten_e[3] = {6, 9, 13};
+static const uint8_t tier_e[TIER_N] = {1, 1, 2}, tier_at[TIER_N] = {1, 5, 25}, golden_at[3] = {7, 27, 77};
static float up_price(int u) {
if (u < U_MOUSE) return (u == 1 ? 5 : 1) * p10(cursor_e[u]);
if (u < U_KITTEN) return 5 * p10(4 + 2 * (u - U_MOUSE));
if (u < U_GOLD) return 9 * p10(kitten_e[u - U_KITTEN]);
- if (u < U_GRANDMA) return 7 * (p10(9 + 2 * (u - U_GOLD) + (u == U_GOLD + 2)) - 1) / 9; /* 777,777,777... */
- if (u < U_COOKIE) return 50 * base_price(u - U_GRANDMA + 2);
+ if (u < U_COOKIE) return 7 * (p10(9 + 2 * (u - U_GOLD) + (u == U_GOLD + 2)) - 1) / 9; /* 777,777,777... */
if (u < U_TIER) { /* 999,999 or 4,999,995... */
int c = cookie_up[u - U_COOKIE];
return (p10((c & 15) + 5) - 1) * (c & 16 ? 5 : 1);
@@ -215,23 +212,19 @@ static bool up_ready(int u) { /* unlocked by what the bakery has done */
if (u < U_MOUSE) return sv.amount[0] >= cursor_at[u];
if (u < U_KITTEN) return sv.handmade >= p10(3 + 2 * (u - U_MOUSE));
if (u < U_GOLD) return milk >= (u == U_KITTEN ? 0.5f : (float)(u - U_KITTEN));
- if (u < U_GRANDMA) return sv.golden >= golden_at[u - U_GOLD];
- if (u < U_COOKIE) return sv.amount[u - U_GRANDMA + 2] >= 15 && sv.amount[1];
+ if (u < U_COOKIE) return sv.golden >= golden_at[u - U_GOLD];
if (u < U_TIER) return sv.earned * 20 >= up_price(u);
return sv.amount[1 + (u - U_TIER) / TIER_N] >= tier_at[(u - U_TIER) % TIER_N];
}
static void up_desc(int u) { /* what it does, in buf */
- int b = u - U_GRANDMA + 2;
if (u < 3) cpy(buf, T("The mouse and cursors are twice as efficient."));
- else if (u == 3) cpy(buf, T("The mouse and cursors gain +0.1 cookies for each non-cursor building owned."));
- else if (u < U_MOUSE) cat(buf, T("Multiplies the gain from Thousand fingers by "), u == 4 ? 5 : u == 5 ? 10 : 20, ".");
+ else if (u == 3) cpy(buf, T("The mouse and cursors gain +0.1 cookies for each other building."));
+ else if (u < U_MOUSE) cat(buf, T("Thousand fingers x"), u == 4 ? 5 : u == 5 ? 10 : 20, "");
else if (u < U_KITTEN) cpy(buf, T("Clicking gains +1% of your CpS."));
- else if (u < U_GOLD) cpy(buf, T("You gain more CpS the more milk you have."));
- else if (u < U_GRANDMA) cpy(buf, u < U_GOLD + 2 ? T("Golden cookies appear twice as often and stay twice as long.")
- : T("Golden cookie effects last twice as long."));
- else if (u < U_COOKIE)
- cat(cpy(cpy(buf, T("Grandmas are twice as efficient. ")), bname[b]), T(": +1% CpS per "), b - 1, T(" grandmas."));
- else if (u < U_TIER) cat(buf, T("Cookie production multiplier +"), cookie_up[u - U_COOKIE] >> 5, "%.");
+ else if (u < U_GOLD) cpy(buf, T("More CpS the more milk you have."));
+ else if (u < U_COOKIE) cpy(buf, u < U_GOLD + 2 ? T("Golden cookies come twice as often, stay twice as long.")
+ : T("Golden cookie effects last twice as long."));
+ else if (u < U_TIER) cat(buf, T("Cookie production +"), cookie_up[u - U_COOKIE] >> 5, "%");
else cpy(cpy(buf, bname[1 + (u - U_TIER) / TIER_N]), T(": twice as efficient."));
}
static void sort_list(void) { /* the store's upgrades: unlocked, not bought yet, cheapest first */
@@ -246,39 +239,25 @@ static void sort_list(void) { /* the store's upgrades: unlocked, not bought yet,
}
/* ------------------------------------------------------------ achievements */
-/* their kind: baked, per second, from clicking, buildings, golden cookies, owned, upgrades, or one of
- their own (7); where each kind starts; the counts they ask for */
-static const uint8_t kinds[7] = {A_CPS, A_CLICK, A_BUILD, A_GOLDEN, A_OWNED, A_UPGRADED, A_MISC};
+/* their kind: baked, per second, from clicking, buildings, golden cookies, owned, upgrades; where each
+ kind starts; the counts they ask for */
+static const uint8_t kinds[6] = {A_CPS, A_CLICK, A_BUILD, A_GOLDEN, A_OWNED, A_UPGRADED};
static const uint16_t counts[] = {1, 2, 50, 1, 7, 27, 77, 100, 500, 20, 50};
static int threshold(int a, float *v) {
static const uint8_t first[7] = {0, 0, 0, 0, 3, 7, 9}; /* (in counts) */
int k = 0, i;
- while (k < 7 && a >= kinds[k]) k++;
+ while (k < 6 && a >= kinds[k]) k++;
i = a - (k ? kinds[k - 1] : 0);
*v = k == 0 ? (a ? p10(3 * a / 2 + 2) : 1) : k == 1 ? p10(6 * i / 5) : k == 2 ? p10(3 + 2 * i)
- : k == 3 ? counts[i < N_CURSOR_ACH ? i : 0] : k < 7 ? counts[first[k] + i] : 0;
+ : k == 3 ? counts[i < N_CURSOR_ACH ? i : 0] : counts[first[k] + i];
return k;
}
static int ach_building(int a) { return a - A_BUILD < N_CURSOR_ACH ? 0 : a - A_BUILD - N_CURSOR_ACH + 1; }
static bool ach_won(int a) {
float v;
- int k = threshold(a, &v), least = 65535;
- switch (k) {
- case 0: return sv.earned >= v;
- case 1: return raw_cps >= v;
- case 2: return sv.handmade >= v;
- case 3: return sv.amount[ach_building(a)] >= v;
- case 4: return sv.golden >= v;
- case 5: return owned >= v;
- case 6: return nup >= v;
- }
- for (int b = 0; b < NB; b++) least = sv.amount[b] < least ? sv.amount[b] : least;
- switch (a - A_MISC) {
- case 0: return least; /* one with everything */
- case 1: return sv.earned >= 1e6 && sv.clicks <= 15; /* neverclick */
- case 4: return bought(U_GRANDMA, 18) >= 7; /* elder */
- }
- return false; /* the others are won as they happen */
+ int k = threshold(a, &v);
+ float have[7] = {0, raw_cps, 0, sv.amount[ach_building(a)], sv.golden, owned, nup};
+ return k == 0 ? sv.earned >= v : k == 2 ? sv.handmade >= v : have[k] >= v;
}
static void win(int a) {
if (has(sv.ach, a)) return;
@@ -292,8 +271,7 @@ static void ach_desc(int a) { /* what it takes, in buf */
T(" upgrades.")};
float v;
int k = threshold(a, &v);
- if (k > 6) cpy(buf, txt(X_MDESC + a - A_MISC));
- else cpy(cat(buf, pre[k], v, post[k]), k == 3 ? bname[ach_building(a)] : "");
+ cpy(cat(buf, pre[k], v, post[k]), k == 3 ? bname[ach_building(a)] : "");
}
static void check(void) { /* once a second, and after a purchase: what unlocks, what is won */
@@ -316,8 +294,6 @@ static void click(void) {
int i = sv.clicks++ & 3;
earn(cpc);
sv.handmade += cpc, bounce_t = now;
- if (now - clicks_t > 1000) clicks_t = now, clicks_n = 0;
- if (++clicks_n >= 10) win(A_MISC + 2); /* uncanny clicker */
rises[i].x = (int16_t)(CX - 30 + rnd() % 60), rises[i].y = (int16_t)(CY - 24 - rnd() % 24), rises[i].t = now;
big(cpy(rises[i].s, "+"), cpc);
}
@@ -339,10 +315,9 @@ static int luck(void) { return has(sv.up, U_GOLD) + has(sv.up, U_GOLD + 1); }
static void golden_pop(void) {
uint32_t dur = has(sv.up, U_GOLD + 2) + 1, e = rnd() % 20;
sv.golden++, sv.gc_t = 0;
- if (gc_life > gc_dur - 1000) win(A_MISC + 3); /* early bird */
gc_life = 0;
- if (e < 2) sv.cfrenzy = 13000 * dur, cpy(pop, T("Click frenzy! x777"));
- else if (e < 11) sv.frenzy = 77000 * dur, cpy(pop, T("Frenzy! Production x7"));
+ if (e < 2) sv.cfrenzy = 13000 * dur;
+ else if (e < 11) sv.frenzy = 77000 * dur;
else {
double v = sv.cookies * 0.15 < cps * 900.0 ? sv.cookies * 0.15 : cps * 900.0;
earn(v + 13);
@@ -374,30 +349,20 @@ static void cookie(int x, int y, int r, bool gold) {
}
static void left(void) {
- gfx_vgrad(0, 16, LW, SCREEN_H - 16, 0x2E5480, 0x14263F);
- /* light turning slowly behind the big cookie */
- for (int y = gfx_y0; y < gfx_y1; y++)
- for (int x = 0; x < LW; x++) {
- int dx = x - CX, dy = y - CY, d = dx * dx + dy * dy, ax = dx < 0 ? -dx : dx, ay = dy < 0 ? -dy : dy;
- if (d > 74 * 74 || d < 900) continue;
- int q = ay * 256 / (ax + ay); /* an angle, 0 to 1023 around */
- q = dx < 0 ? (dy < 0 ? 512 + q : 511 - q) : (dy < 0 ? 1023 - q : q);
- color_t *p = gfx_buf + (y - gfx_y0) * SCREEN_W + x;
- if (((q + (int)(now / 12)) & 127) < 64) *p = gfx_mix(*p, WHITE, (74 * 74 - d) * 9 / (74 * 74));
- }
+ gfx_fill(0, 16, LW, SCREEN_H - 16, HEX(0x22406A));
+ gfx_circle(CX, CY, 70, WHITE, 24); /* the light behind the big cookie */
uint32_t b = now - bounce_t; /* a little smaller for a moment when clicked */
cookie(CX, CY, b < 240 ? 48 + (int)b / 60 : 52, false);
/* the milk, which rises with the achievements and changes flavor every 25 */
int h = 10 + (int)((milk > 1 ? 1 : milk) * 20), rank = nach / 25 < N_MILK ? nach / 25 : N_MILK - 1;
for (int x = 0; x < LW; x++) {
- int w = (int)(now / 40 + x) % 48, top = SCREEN_H - h + (w < 24 ? w : 48 - w) / 6;
- gfx_fill(x, top, 1, h + 8, gfx_rgb(milk_rgb[rank]));
- gfx_fill(x, top, 1, 2, WHITE);
+ int w = (int)(now / 40 + x) % 48;
+ gfx_fill(x, SCREEN_H - h + (w < 24 ? w : 48 - w) / 6, 1, h + 8, gfx_rgb(milk_rgb[rank]));
}
/* the cookies: "1.234 million", the number on its own line, "million cookies" under it; per second */
if (VIS(16, 56)) {
char *name = NULL, *line2 = buf + 80;
- big(buf, sv.cookies);
+ big(buf, sv.cookies < 1e6 ? (double)(uint32_t)sv.cookies : sv.cookies); /* (whole cookies) */
for (char *s = buf; *s && !name; s++)
if (*s == ' ') *s = 0, name = s + 1;
mid(&np_font_title, CX + 1, 41, buf, 0);
@@ -407,12 +372,10 @@ static void left(void) {
cat(buf, T("per second: "), cps, "");
mid(&np_font_small, CX, 67, buf, CREAM);
}
- /* the effects going on, what the golden cookie did, +1 rising from the cookie */
- for (int i = 0; i < 2; i++) {
- uint32_t ms = i ? sv.cfrenzy : sv.frenzy;
- if (ms) num(cpy(buf, i ? T("Click frenzy ") : T("Frenzy ")), (ms + 999) / 1000), say(&np_font_small, 4, 84 + 11 * i, buf, GOLD);
- }
- if (now - pop_t < 2500) mid(&np_font_small, CX, 196, pop, GOLD);
+ /* what the golden cookie did, and for how long still; +1 rising from the cookie */
+ uint32_t ms = sv.cfrenzy ? sv.cfrenzy : sv.frenzy;
+ if (ms) num(cpy(buf, sv.cfrenzy ? T("Click frenzy x777: ") : T("Frenzy x7: ")), (ms + 999) / 1000);
+ if (ms || now - pop_t < 2500) mid(&np_font_small, CX, 196, ms ? buf : pop, GOLD);
for (int i = 0; i < 4; i++) {
uint32_t t = now - rises[i].t;
if (rises[i].t && t < 900)
@@ -442,14 +405,13 @@ static void picture(int u, int x, int y) {
int t = u, k = IC_CURSOR;
if (u >= U_MOUSE) t = u - U_MOUSE, k = IC_MOUSE;
if (u >= U_KITTEN) t = u - U_KITTEN, k = IC_KITTEN;
- if (u >= U_GRANDMA) t = 1, k = IC_GRANDMA;
if (u >= U_TIER) t = (u - U_TIER) % TIER_N, k = 1 + (u - U_TIER) / TIER_N;
if (u < 0) t = 3, k = -1 - u; /* (a building) */
gfx_rrect(x, y, 18, 18, 4, gfx_rgb(tier_rgb[t]), 256);
- if ((u >= U_GOLD && u < U_GRANDMA) || (u >= U_COOKIE && u < U_TIER)) cookie(x + 9, y + 9, 7, u < U_GRANDMA);
+ if (u >= U_GOLD && u < U_TIER) cookie(x + 9, y + 9, 7, u < U_COOKIE);
else
for (int i = 0; i < 144; i++)
- if (icons[k][i >> 3] >> (i & 7) & 1) gfx_fill(x + 3 + i % 12, y + 3 + i / 12, 1, 1, DARK);
+ if ((uint8_t)text[ICONS_AT + 18 * k + (i >> 3)] >> (i & 7) & 1) gfx_fill(x + 3 + i % 12, y + 3 + i / 12, 1, 1, DARK);
}
static bool locked(int b) { return !sv.amount[b] && sv.earned < base_price(b); }
static int rows(void) {
@@ -468,9 +430,9 @@ static void store(void) {
if (i == tab) gfx_rrect(SX + 1 + i * 58, 18, 56, 14, 5, HEX(0x8A6238), 256);
mid(&np_font_small, SX + 29 + i * 58, 29, tabs[i], i == tab ? WHITE : HEX(0xB79C7C));
}
+ *buf = 0;
if (tab == 1) num(cpy(buf, T("Buy x")), (uint32_t)many());
- else if (tab == 0) cpy(num(buf, (uint32_t)nlist), T(" upgrades"));
- else cpy(num(cpy(num(buf, (uint32_t)nach), " / "), N_ACH), T(" achievements"));
+ if (tab == 2) cpy(num(cpy(num(buf, (uint32_t)nach), " / "), N_ACH), T(" achievements"));
mid(&np_font_small, SX + 87, 42, buf, HEX(0x9CF29C));
}
/* the list */
@@ -495,7 +457,6 @@ static void store(void) {
fit(&np_font_body, txt(list[i]), SCREEN_W - SX - 30);
p = up_price(list[i]);
}
- say(&np_font_body, SX + 26, y + 12, buf, 0);
say(&np_font_body, SX + 25, y + 11, buf, WHITE);
big(buf, p);
say(&np_font_small, SX + 25, y + 21, buf, sv.cookies >= p ? HEX(0x6CF26C) : HEX(0xFF6B6B));
@@ -505,12 +466,10 @@ static void store(void) {
gfx_fill(SX, INFO, SCREEN_W - SX, SCREEN_H - INFO, DARK);
int y = INFO + 14;
*buf = 0;
- if (tab == 1) {
- if (locked(s)) return;
- char *o = cat(buf, T("Each makes "), each[s], T(" cookies per second."));
- o = cat(num(cpy(o, "\n"), sv.amount[s]), T(" make "), each[s] * sv.amount[s], "");
- if (cps > 0) cat(o, " (", each[s] * sv.amount[s] * 100 / cps, "%)");
- } else if (s >= n) cpy(buf, T("Upgrades show up here as your bakery grows."));
+ if (s >= n || (tab == 1 && locked(s))) return;
+ if (tab == 1)
+ cat(num(cpy(cat(buf, T("Each makes "), each[s], T(" cookies per second.")), "\n"), sv.amount[s]), T(" make "),
+ each[s] * sv.amount[s], "");
else if (tab == 0) y = para(y, txt(list[s]), GOLD), up_desc(list[s]);
else y = para(y, txt(X_ACH + s), GOLD), ach_desc(s);
para(y, buf, CREAM);
@@ -537,7 +496,7 @@ static void overlay(void) {
static const char *const titles[4] = {0, "Cookie Clicker", T("How to play"), T("Quit the game?")};
gfx_fill_alpha(0, 0, SCREEN_W, SCREEN_H, 0, 130);
gfx_rrect(40, 22, 240, 204, 14, WOOD, 256);
- gfx_rrect_outline(40, 22, 240, 204, 14, 2, HEX(0xC8A27A), 256);
+
mid(&np_font_title, 160, 52, titles[ov], WHITE);
if (ov == OV_HELP) {
for (int i = 0; i < 6; i++) {
diff --git a/games/cookieclicker/tools/data.py b/games/cookieclicker/tools/data.py
index e470ddba..4569f2ef 100644
--- a/games/cookieclicker/tools/data.py
+++ b/games/cookieclicker/tools/data.py
@@ -16,7 +16,7 @@ import zopfli.zlib
HERE = os.path.dirname(os.path.abspath(__file__))
OUT = sys.argv[1] if len(sys.argv) > 1 else os.path.join(HERE, "..", "src", "data.h")
-TIER_N = 5 # tiered upgrades for each building (the game has 15)
+TIER_N = 3 # tiered upgrades for each building (the game has 15)
ACH_TIERS = 1 # building achievements for each (have 1)
# ------------------------------------------------------------------ upgrades, in the order of the save
@@ -525,26 +525,31 @@ def icon_bytes(art):
# How much of the game fits in NumPlay (13 KB): the upgrades, achievements and news that come first, so
# far that milk (an achievement is 4%) takes the kittens to the engineers
-N = dict(cursor=10, mouse=8, kitten=3, cookie=16, bank=16, cps=12, click=6, cursor_ach=3, golden=4, owned=2,
- upgraded=2, milk=3)
-MISC_KEPT = [0, 3, 5, 6, 8] # one with everything, neverclick, uncanny clicker, early bird, elder
+N = dict(cursor=8, mouse=6, kitten=3, cookie=9, bank=13, cps=10, click=6, cursor_ach=3, golden=4, owned=2,
+ upgraded=2, milk=3, lore=10)
+MISC_KEPT = []
def main():
order = [b for b in BUILDINGS[1:]]
cookies = COOKIES[:N["cookie"]]
misc = [MISC[i] for i in MISC_KEPT]
- ups = CURSOR[:N["cursor"]] + MOUSE[:N["mouse"]] + KITTEN[:N["kitten"]] + GOLD + GRANDMA + [c[0] for c in cookies]
+ ups = CURSOR[:N["cursor"]] + MOUSE[:N["mouse"]] + KITTEN[:N["kitten"]] + GOLD + [c[0] for c in cookies]
for b in order:
ups += TIERED[b][:TIER_N]
achs = BANK[:N["bank"]] + CPS[:N["cps"]] + CLICK[:N["click"]] + CURSOR_ACH[:N["cursor_ach"]]
for b in order:
achs += BUILDING_ACH[b][:ACH_TIERS]
achs += GOLDEN[:N["golden"]] + OWNED[:N["owned"]] + UPGRADED[:N["upgraded"]] + misc
- news = [LORE[i] for i in [0, 1, 2] + list(range(3, 27, 2))] # a line for each power of ten
+ # a line for each power of ten of the bakery's fame
+ news = [LORE[i] for i in [0, 1, 2] + list(range(3, 27, 2))][:N["lore"]]
assert len(MISC_DESC) == len(MISC)
strings = ups + achs + news + [MISC_DESC[i] for i in MISC_KEPT] + MILK[:N["milk"]]
+ names = list(ICONS)
+ data = [b for n in names for b in icon_bytes(ICONS[n])]
text = "\0".join(strings).encode("ascii") + b"\0"
+ icons_at = len(text)
+ text += bytes(data) # the pictures, packed with them
z = zopfli.zlib.compress(text, numiterations=100)[2:-4]
raw = len(text)
L = ["/* Generated by tools/data.py: Cookie Clicker's names, news and the store's pictures. */",
@@ -552,8 +557,8 @@ def main():
"/* the upgrades, in the order of the save */",
"#define N_CURSOR %d" % N["cursor"], "#define U_MOUSE N_CURSOR", "#define N_MOUSE %d" % N["mouse"],
"#define U_KITTEN (U_MOUSE + N_MOUSE)", "#define N_KITTEN %d" % N["kitten"],
- "#define U_GOLD (U_KITTEN + N_KITTEN)", "#define U_GRANDMA (U_GOLD + 3)",
- "#define U_COOKIE (U_GRANDMA + 18)", "#define N_COOKIE %d" % len(cookies),
+ "#define U_GOLD (U_KITTEN + N_KITTEN)",
+ "#define U_COOKIE (U_GOLD + 3)", "#define N_COOKIE %d" % len(cookies),
"#define U_TIER (U_COOKIE + N_COOKIE)", "#define N_UP (U_TIER + 19 * TIER_N)",
"/* the achievements, in the order of the save */",
"#define N_BANK %d" % N["bank"], "#define A_CPS N_BANK", "#define N_CPS %d" % N["cps"],
@@ -564,23 +569,18 @@ def main():
"#define A_OWNED (A_GOLDEN + N_GOLDEN)", "#define A_UPGRADED (A_OWNED + %d)" % N["owned"],
"#define A_MISC (A_UPGRADED + %d)" % N["upgraded"], "#define N_ACH (A_MISC + %d)" % len(misc),
"/* the texts: the upgrades' names, the achievements', the news, the other achievements'",
- " descriptions, the milks */",
+ " descriptions, the milks; then the pictures, 18 bytes each (12 x 12 bits, the first lowest) */",
"#define X_ACH N_UP", "#define X_NEWS (X_ACH + N_ACH)",
- "#define N_LORE 15",
+ "#define N_LORE %d" % len(news),
"#define X_MDESC (X_NEWS + N_LORE)", "#define X_MILK (X_MDESC + %d)" % len(misc),
- "#define N_MILK %d" % N["milk"], "#define N_TEXT %d" % len(strings), "#define TEXT_SIZE %d" % raw]
+ "#define N_MILK %d" % N["milk"], "#define N_TEXT %d" % len(strings), "#define ICONS_AT %d" % icons_at,
+ "#define TEXT_SIZE %d" % raw]
COOKIES[:] = cookies
# a cookie upgrade: its % in the top 3 bits, then 5 if it is so many nines times 5, then the nines
L.append("static const uint8_t cookie_up[N_COOKIE] = {%s};" %
", ".join(str(p << 5 | x5 << 4 | (n - 5)) for _, p, n, x5 in COOKIES))
assert all(1 <= p <= 7 and 5 <= n < 21 for _, p, n, _ in COOKIES)
- names = list(ICONS)
L.append("enum { %s };" % ", ".join("IC_" + n.upper() for n in names))
- data = [b for n in names for b in icon_bytes(ICONS[n])]
- L.append("static const uint8_t icons[%d][18] = {" % len(names))
- for i in range(len(names)):
- L.append(" {%s}," % ", ".join(str(b) for b in data[18 * i:18 * i + 18]))
- L.append("};")
L.append("static const uint8_t text_z[%d] = {" % len(z))
for i in range(0, len(z), 24):
L.append(" " + ", ".join(str(b) for b in z[i:i + 24]) + ",")
diff --git a/games/games.json b/games/games.json
index a13dd7f5..44ed1b26 100644
--- a/games/games.json
+++ b/games/games.json
@@ -380,6 +380,24 @@
"app": "TwoPlayers.nwa",
"repo": "https://github.com/Mason363/NumPlay/tree/main/games/twoplayer"
},
+ {
+ "id": "cookieclicker",
+ "title": "Cookie Clicker",
+ "tagline": "Click the cookie, bake billions",
+ "credit": "Based on Cookie Clicker by Orteil",
+ "top": "0x2E5480",
+ "bottom": "0x14263F",
+ "accent": "0xD9A25E",
+ "colors": 8,
+ "records": [
+ "cookieclicker.sav"
+ ],
+ "shots": [
+ "docs/shot.png"
+ ],
+ "app": "CookieClicker.nwa",
+ "repo": "https://github.com/Mason363/NumPlay/tree/main/games/cookieclicker"
+ },
{
"id": "numvisuals",
"title": "NumVisuals",
diff --git a/launcher/lang/fr.txt b/launcher/lang/fr.txt
index c1fe3f86..b7edb03b 100644
--- a/launcher/lang/fr.txt
+++ b/launcher/lang/fr.txt
@@ -97,6 +97,8 @@ Block Breaker Casse-briques
Break every brick Casse toutes les briques
2 Players 2 joueurs
Pong and more, side by side Pong et plus, côte à côte
+Cookie Clicker Cookie Clicker
+Click the cookie, bake billions Clique le cookie, cuis des milliards
Backgrounds, clocks, timers Fonds, horloges, minuteurs
Reach the door, trust nothing Atteins la porte, ne te fie à rien
# (names that stay as they are)
@@ -113,6 +115,7 @@ Inspired by Tatone26's All the Apps Inspiré d'All the Apps de Tatone26
Based on 2048 by Gabriele Cirulli D'après 2048 de Gabriele Cirulli
Based on Block Blast! by Hungry Studio D'après Block Blast! de Hungry Studio
Based on Level Devil by Unept D'après Level Devil d'Unept
+Based on Cookie Clicker by Orteil D'après Cookie Clicker d'Orteil
# a game the RAM of the calculator's software is too small for
Needs Il manque
KB more memory Ko de mémoire
diff --git a/launcher/lang/zh.txt b/launcher/lang/zh.txt
index 73a97ed1..f5ce0fe1 100644
--- a/launcher/lang/zh.txt
+++ b/launcher/lang/zh.txt
@@ -96,6 +96,8 @@ Block Breaker 打砖块
Break every brick 打碎每一块砖
2 Players 双人对战
Pong and more, side by side Pong 等游戏,两人并肩玩
+Cookie Clicker Cookie Clicker
+Click the cookie, bake billions 点击饼干,烤出亿万饼干
Backgrounds, clocks, timers 背景、时钟、计时器
Reach the door, trust nothing 走到门口,什么都别相信
# (names that stay as they are)
@@ -112,6 +114,7 @@ Inspired by Tatone26's All the Apps 灵感来自 Tatone26 的 All the Apps
Based on 2048 by Gabriele Cirulli 改编自 Gabriele Cirulli 的 2048
Based on Block Blast! by Hungry Studio 改编自 Hungry Studio 的 Block Blast!
Based on Level Devil by Unept 改编自 Unept 的 Level Devil
+Based on Cookie Clicker by Orteil 改编自 Orteil 的 Cookie Clicker
# a game the RAM of the calculator's software is too small for
Needs 内存还差
KB more memory KB
diff --git a/tests/test_games.py b/tests/test_games.py
index e2f5ce05..1b5ede7a 100644
--- a/tests/test_games.py
+++ b/tests/test_games.py
@@ -109,6 +109,10 @@ GAMES = {
"blockblast": ("BlockBlast.nwa", "blockblast.sav", presses((1500, "ok"), (2000, "ok")), 3000,
presses(*[(1500 + 250 * i, "up") for i in range(4)], *[(2500 + 250 * i, "left") for i in range(4)],
(3600, "ok")), 4500),
+ # past how to play, the big cookie clicked three times; next time two more
+ "cookieclicker": ("CookieClicker.nwa", "cookieclicker.sav",
+ presses((1500, "ok"), (2000, "ok"), (2300, "ok"), (2600, "ok")), 4000,
+ presses((1500, "ok"), (1800, "ok")), 3000),
# the intro film is skipped (seen), Lucky walks up the dock and talks to the
# guardians; next time the game starts where it was left
"championisland": ("ChampionIsland.nwa", "champion.sav",
@@ -269,6 +273,10 @@ CHECKS = {
# the keys were shown and the runner died (the deaths at 8); then died again
"leveldevil": (lambda v: len(v) == 48 and v[:2] == b"L\1" and v[2] & 1 and struct.unpack_from("<I", v, 8)[0] >= 1,
lambda v: struct.unpack_from("<I", v, 8)[0] >= 2),
+ # the guide read, 3 clicks and the cookies they made (the bank at 64, baked at 72); then 5
+ "cookieclicker": (lambda v: len(v) == 120 and v[:3] == b"C\1\1" and struct.unpack_from("<I", v, 44)[0] == 3
+ and struct.unpack_from("<d", v, 72)[0] >= 3,
+ lambda v: struct.unpack_from("<I", v, 44)[0] == 5 and struct.unpack_from("<d", v, 64)[0] >= 5),
"breakout": (lambda v: len(v) == 12 and v[:2] == b"B\2" and v[4] == 1 and struct.unpack_from("<I", v, 8)[0] >= 10,
lambda v: v[4] == 0 and struct.unpack_from("<I", v, 8)[0] >= 1), # best kept, shake off
# Air Hockey and the easy computer chosen; then the normal computer and Tanks, the tallies kept