X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=fishladder_resources.h;h=ad4c6f3995615b644915ebe23002ef0f1c9db42e;hb=3363633178b1eea582304742ad1202487af0feb1;hp=90303019e2c7aa2e9a286b5f9e7ce7d555ba21ce;hpb=33a1521384fd26924a3bf9647ba7542148295642;p=fishladder.git diff --git a/fishladder_resources.h b/fishladder_resources.h index 9030301..ad4c6f3 100644 --- a/fishladder_resources.h +++ b/fishladder_resources.h @@ -9,7 +9,6 @@ vg_tex2d tex_tiles_min = { .path = "textures/tile_minimal.qoi" }; vg_tex2d tex_tiles_lab = { .path = "textures/tile_lab.qoi" }; vg_tex2d tex_ball_noise = { .path = "textures/bnoise.qoi" }; -vg_tex2d tex_monofur = { .path = "textures/ascii.qoi", .flags = VG_TEXTURE_NO_MIP }; vg_tex2d tex_unkown = { .path = "textures/unkown.qoi" }; vg_tex2d tex_buttons = { .path = "textures/buttons.qoi" }; vg_tex2d tex_sprites = { .path = "textures/autocombine.qoi" }; @@ -21,7 +20,6 @@ vg_tex2d *texture_list[] = { &tex_tiles_min, &tex_tiles_lab, &tex_ball_noise, - &tex_monofur, &tex_unkown, &tex_buttons, &tex_sprites @@ -538,17 +536,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 +561,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,73 +577,41 @@ 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 = 25, - .title = "PRINCIPLE 7", - .map_name = "cmp_p7", - .description = "Emitters", - ._unlock = 26, + 26, "cmp_p7", "PRINCIPLE 7", "Emitters", + ._unlock = 27, + ._linked = 13, .is_tutorial = 1 } }; @@ -648,163 +619,108 @@ 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 = - "", - - ._unlock = 8 + 5, "cmp_b03", "RESTRUCTURE", "", + ._unlock = 8, + ._linked = 31 }, + { + 31, "cmp_121", "1-2-1", "", + ._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 = "", - - ._unlock = 25, + 20, "cmp_xor", "QUALIFICATION PROJECT", "", + ._unlock = 26, .achievement = "GRADUATE" - } + }, + { + 27, "cmp_expander", "EXPAND", "", + ._unlock = 28 + }, + { + 28, "cmp_pattern3", "PATTERNS 3", "", + ._linked = 29 + }, + { + 29, "cmp_routing2", "ROUTING PROBLEM 2", "Spaghetti!", + ._linked = 30, + ._unlock = 32 + }, + { + 30, "cmp_exact5", "EXACTLY 5", "", + ._unlock = 32 + }, + { + 32, "cmp_3and2", "THREE AND FOUR", "" + } }; 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 } }; @@ -812,10 +728,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 = { { @@ -831,15 +745,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 = { { @@ -857,16 +767,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 = { { @@ -885,6 +789,7 @@ static struct cmp_level cmp_levels_computer[] = static struct career_level_pack { struct cmp_level *pack; + const char *title; int count; v3f primary_colour; @@ -895,6 +800,7 @@ career_packs[] = { { .pack = cmp_levels_tutorials, + .title = "", .count = vg_list_size( cmp_levels_tutorials ), .primary_colour = { 0.204f, 0.345f, 0.553f }, .origin = { -5, -2 }, @@ -902,6 +808,7 @@ career_packs[] = }, { .pack = cmp_levels_basic, + .title = "\x8C\x8D"" Core", .count = vg_list_size( cmp_levels_basic ), .primary_colour = { 0.304f, 0.245f, 0.553f }, .origin = { -3, -2 }, @@ -909,6 +816,7 @@ career_packs[] = }, { .pack = cmp_levels_grad, + .title = "\x8C\x8E"" Challenge", .count = vg_list_size( cmp_levels_grad ), .primary_colour = { 0.553f, 0.345f, 0.204f }, .origin = { -5, 6 }, @@ -916,6 +824,7 @@ career_packs[] = }, { .pack = cmp_levels_computer, + .title = "\x8C\x8F"" 3 Bit computer\n\n (preview)", .count = vg_list_size( cmp_levels_computer ), .primary_colour = { 0.75f, 0.23f, 0.39f }, .origin = { -5, 8 }, @@ -927,14 +836,23 @@ career_packs[] = static void career_local_data_init(void) { struct cmp_level *level_ptrs[ NUM_CAMPAIGN_LEVELS ]; - + for( int i = 0; i < NUM_CAMPAIGN_LEVELS; i ++ ) + level_ptrs[i] = NULL; + // COllect pointers for( int i = 0; i < vg_list_size( career_packs ); i ++ ) { struct career_level_pack *set = &career_packs[i]; for( int j = 0; j < set->count; j ++ ) - level_ptrs[ set->pack[j].serial_id ] = &set->pack[j]; + { + int id = set->pack[j].serial_id; + + if( level_ptrs[ id ] ) + vg_error( "Serial id %u already used!\n", id ); + else + level_ptrs[ set->pack[j].serial_id ] = &set->pack[j]; + } } // Apply @@ -945,8 +863,18 @@ static void career_local_data_init(void) for( int j = 0; j < set->count; j ++ ) { struct cmp_level *lvl = &set->pack[j]; - lvl->unlock = lvl->_unlock? level_ptrs[ lvl->_unlock ]: NULL; - lvl->linked = lvl->_linked? level_ptrs[ lvl->_linked ]: NULL; + + if( lvl->_unlock >= NUM_CAMPAIGN_LEVELS || + lvl->_linked >= NUM_CAMPAIGN_LEVELS ) + { + vg_error( "_unlock / _linked out of range (%d, %d)\n", + lvl->_unlock, lvl->_linked ); + } + else + { + lvl->unlock = lvl->_unlock? level_ptrs[ lvl->_unlock ]: NULL; + lvl->linked = lvl->_linked? level_ptrs[ lvl->_linked ]: NULL; + } } } }