From 681351050c11616480f7aa8467ca8eb3b81e193e Mon Sep 17 00:00:00 2001 From: hgn Date: Mon, 24 Jan 2022 09:13:17 +0000 Subject: [PATCH] organise level information --- fishladder_resources.h | 231 +++++++++-------------------------------- 1 file changed, 49 insertions(+), 182 deletions(-) diff --git a/fishladder_resources.h b/fishladder_resources.h index 929d4a4..a5e3bd6 100644 --- a/fishladder_resources.h +++ b/fishladder_resources.h @@ -538,17 +538,19 @@ void vg_register(void) struct cmp_level { + // Basic info + int serial_id; + const char *map_name; const char *title; const char *description; - const char *achievement; - int unlocked; - int completed_score; + const char *achievement; int _unlock, _linked; // When completed, unlock this level - struct cmp_level *unlock, *linked; + int is_tutorial; + // Aesthetic struct world_string { enum placement @@ -561,11 +563,14 @@ struct cmp_level const char *str; } strings[2]; - - int serial_id; - int is_tutorial; + // Persistent stats + int unlocked; + int completed_score; + + // Runtime struct world_button btn; + struct cmp_level *unlock, *linked; #ifdef VG_STEAM SteamLeaderboard_t steam_leaderboard; @@ -574,72 +579,39 @@ struct cmp_level static struct cmp_level cmp_levels_tutorials[] = { - { - .serial_id = 0, - .title = "PRINCIPLE 1", - .map_name = "cmp_t01", - .description = - "", - + { + 0, "cmp_t01", "PRINCIPLE 1", "", ._unlock = 1, .is_tutorial = 1 }, - { - .serial_id = 1, - .title = "PRINCIPLE 2", - .map_name = "cmp_t02", - .description = - "", - + { + 1, "cmp_t02", "PRINCIPLE 2", "", ._unlock = 2, .is_tutorial = 1, }, { - .serial_id = 2, - .title = "PRINCIPLE 3", - .map_name = "cmp_t03", - .description = - "", - + 2, "cmp_t03", "PRINCIPLE 3", "", ._unlock = 12, .is_tutorial = 1 }, { - .serial_id = 12, - .title = "PRINCIPLE 4", - .map_name = "cmp_t04", - .description = - "", - + 12, "cmp_t04", "PRINCIPLE 4", "", ._unlock = 6, .is_tutorial = 1, .achievement = "TUTORIALS" }, { - .serial_id = 15, - .title = "PRINCIPLE 5", - .map_name = "cmp_b10", - .description = - "", - + 15, "cmp_b10", "PRINCIPLE 5", "", ._unlock = 16, .is_tutorial = 1 }, { - .serial_id = 17, - .title = "PRINCIPLE 6", - .map_name = "cmp_b11", - .description = - "(Right click)", - + 17, "cmp_b11", "PRINCIPLE 6", "(Right click)", ._unlock = 18, .is_tutorial = 1 }, { - .serial_id = 26, - .title = "PRINCIPLE 7", - .map_name = "cmp_p7", - .description = "Emitters", + 26, "cmp_p7", "PRINCIPLE 7", "Emitters", ._unlock = 27, .is_tutorial = 1 } @@ -648,191 +620,98 @@ static struct cmp_level cmp_levels_tutorials[] = static struct cmp_level cmp_levels_basic[] = { { - .serial_id = 6, - .title = "PATCH", - .map_name = "cmp_b04", - .description = - "", - + 6, "cmp_b04", "PATCH", "", ._unlock = 7, ._linked = 3 }, { - .serial_id = 3, - .title = "SUBDIVISION 1", - .map_name = "cmp_b01", - .description = - "", - + 3, "cmp_b01", "SUBDIVISION 1", "", ._linked = 4, ._unlock = 5 }, { - .serial_id = 4, - .title = "SUBDIVISION 2", - .map_name = "cmp_b02", - .description = - "", - + 4, "cmp_b02", "SUBDIVISION 2", "", ._unlock = 7 }, { - .serial_id = 5, - .title = "RESTRUCTURE", - .map_name = "cmp_b03", - .description = - "", - + 5, "cmp_b03", "RESTRUCTURE", "", ._unlock = 8 }, { - .serial_id = 7, - .title = "PATTERNS 1", - .map_name = "cmp_b05", - .description = - "", - + 7, "cmp_b05", "PATTERNS 1", "", ._unlock = 15, ._linked = 8 }, { - .serial_id = 8, - .title = "PATTERNS 2", - .map_name = "cmp_b06", - .description = - "", - + 8, "cmp_b06", "PATTERNS 2", "", ._unlock = 15 }, { - .serial_id = 16, - .title = "ROUTING PROBLEM", - .map_name = "cmp_routing", - .description = - "", - + 16, "cmp_routing", "ROUTING PROBLEM", "", ._linked = 9 }, { - .serial_id = 9, - .title = "MIGHTY CONSUMER", - .map_name = "cmp_b07", - .description = - "", - + 9, "cmp_b07", "MIGHTY CONSUMER", "", ._linked = 10, ._unlock = 11, .achievement = "MIGHTY_CONSUMER" }, { - .serial_id = 10, - .title = "SHIFT", - .map_name = "cmp_b08", - .description = - "", - + 10, "cmp_b08", "SHIFT", "", ._unlock = 17 }, { - .serial_id = 11, - .title = "REVERSE", - .map_name = "cmp_b09", - .description = - "", - + 11, "cmp_b09", "REVERSE", "", ._unlock = 17 }, { - .serial_id = 18, - .title = "NOT GATE", - .map_name = "cmp_not", - .description = "", - + 18, "cmp_not", "NOT GATE", "", ._linked = 19, ._unlock = 20 }, { - .serial_id = 19, - .title = "AND GATE", - .map_name = "cmp_and", - .description = "", - + 19, "cmp_and", "AND GATE", "", ._unlock = 20 }, { - .serial_id = 20, - .title = "QUALIFICATION PROJECT", - .map_name = "cmp_xor", - .description = "", - + 20, "cmp_xor", "QUALIFICATION PROJECT", "", ._unlock = 25, .achievement = "GRADUATE" }, { - .serial_id = 27, - .title = "EXPAND", - .map_name = "cmp_expander", - .description = "", - + 27, "cmp_expander", "EXPAND", "", ._unlock = 28 }, { - .serial_id = 28, - .title = "PATTERNS 3", - .map_name = "cmp_pattern3", - .description = "", + 28, "cmp_pattern3", "PATTERNS 3", "", ._linked = 29 }, { - .serial_id = 29, - .title = "ROUTING PROBLEM 2", - .map_name = "cmp_routing2", - .description = "Spaghetti!", + 29, "cmp_routing2", "ROUTING PROBLEM 2", "Spaghetti!", ._linked = 30 }, { - .serial_id = 30, - .title = "EXACTLY 5", - .map_name = "cmp_exact5", - .description = "" + 30, "cmp_exact5", "EXACTLY 5", "" } }; static struct cmp_level cmp_levels_grad[] = { - // r2 { - .serial_id = 13, - .title = "SORT", - .map_name = "cmp_i01", - .description = "", + 13, "cmp_i01", "SORT", "", ._linked = 14 - }, - // r2 { - .serial_id = 14, - .title = "THIRDS", - .map_name = "cmp_i02", - .description = "", + 14, "cmp_i02", "THIRDS", "", ._linked = 21 - }, { - .serial_id = 21, - .title = "SIMPLE ADDITION", - .map_name = "cmp_grad", - .description = "", - + 21, "cmp_grad", "SIMPLE ADDITION", "", ._linked = 22, ._unlock = 23 }, { - .serial_id = 22, - .title = "SECRET CODE", - .map_name = "cmp_secret", - .description = "", - + 22, "cmp_secret", "SECRET CODE", "", ._unlock = 23 } }; @@ -840,10 +719,8 @@ static struct cmp_level cmp_levels_grad[] = static struct cmp_level cmp_levels_computer[] = { { - .serial_id = 23, - .title = "3 BIT BINARY", - .map_name = "cmp_binary", - .description = "convert amount to binary", + 23, "cmp_binary", "3 BIT BINARY", "Convert amount to binary", + ._unlock = 24, .strings = { { @@ -859,15 +736,11 @@ static struct cmp_level cmp_levels_computer[] = "\n" "\t\t\t\t\t\t\t\t\t\t\t Count" } - }, - - ._unlock = 24 + } }, { - .serial_id = 24, - .title = "3 BIT ADDER", - .map_name = "cmp_add3b", - .description = "binary addition", + 24, "cmp_add3b", "3 BIT ADDER", "Binary addition", + ._unlock = 25, .strings = { { @@ -885,16 +758,10 @@ static struct cmp_level cmp_levels_computer[] = "\t\t\t\x83 \x84 result a+b\n" "\t\t\t\x83 8 4 2 1 \x84" } - }, - - ._unlock = 25 + } }, { - .serial_id = 25, - .title = "3x3 PLOT", - .map_name = "cmp_plot3x3", - .description = "2 bit x/y", - + 25, "cmp_plot3x3", "3x3 PLOT", "2 bit x/y", .strings = { { -- 2.25.1