X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=fishladder.c;h=7520c2c86a0ae261868484d14e84642ed3ea44fc;hb=b2ed006db6dc46c57b163f572391ac74a94f4a4f;hp=d6f3ef007f2ff57ec0b95bc5f2dfef04e151a0a5;hpb=00241431bf542e48787c2bc89fc11189d97008f3;p=fishladder.git diff --git a/fishladder.c b/fishladder.c index d6f3ef0..7520c2c 100644 --- a/fishladder.c +++ b/fishladder.c @@ -1,38 +1,12 @@ // Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved +//#define VG_CAPTURE_MODE #define VG_STEAM #define VG_STEAM_APPID 1218140U #include "vg/vg.h" #include "fishladder_resources.h" -/* - Todo for release: - Tutorial levels: - 1. Transport - 2. Split - 3. Merge (and explode) - 4. Principle 1 (divide colours) - 5. Principle 2 (combine colours) - - Trainee levels: - Simple maths (x3) - Colour ordering (x2) - Routing problems (x2) - - Medium levels: - Reverse order - - New things to program: - UI text element renderer (SDF) DONE(sorta) - Particle system thing for ball collision - Level descriptions / titles HALF - Row Gridlines for I/O DONE - Play button / Speed controller PLAY/PAUSED.. todo: speed, wire connecty - - - After release: - -*/ +// #define STEAM_LEADERBOARDS // CONSTANTS // =========================================================================================================== @@ -1279,7 +1253,7 @@ void vg_update(void) if( vg_get_button_up("secondary") && world.id_drag_from == world.selected ) { - u32 link_id = local_x > 0.5f? 1: 0; + u32 link_id = cell_ptr->links[ 0 ]? 0: 1; // break existing connection off if( cell_ptr->links[ link_id ] ) @@ -1297,7 +1271,7 @@ void vg_update(void) world.id_drag_from = 0; } - if( world.id_drag_from && (cell_ptr->state & FLAG_CANAL) && (cell_ptr->config == k_cell_type_split) ) + else if( world.id_drag_from && (cell_ptr->state & FLAG_CANAL) && (cell_ptr->config == k_cell_type_split) ) { world.drag_to_co[0] = (float)world.tile_x + (local_x > 0.5f? 0.75f: 0.25f); world.drag_to_co[1] = (float)world.tile_y + 0.25f; @@ -2043,6 +2017,9 @@ void vg_render(void) int const empty_start = circle_base+32; int const empty_count = circle_base+32*2; + if( !world.initialzed ) + return; + // BACKGROUND // ======================================================================================================== use_mesh( &world.shapes ); @@ -2852,6 +2829,7 @@ void vg_ui(void) void leaderboard_dispatch_score(void) { +#if STEAM_LEADERBOARDS sw_upload_leaderboard_score( ui_data.upload_request.level->steam_leaderboard, k_ELeaderboardUploadScoreMethodKeepBest, @@ -2863,10 +2841,12 @@ void leaderboard_dispatch_score(void) ui_data.upload_request.is_waiting = 0; vg_success( "Dispatched leaderboard score\n" ); +#endif } void leaderboard_found( LeaderboardFindResult_t *pCallback ) { +#ifdef STEAM_LEADERBOARDS if( !pCallback->m_bLeaderboardFound ) { vg_error( "Leaderboard could not be found\n" ); @@ -2896,10 +2876,12 @@ void leaderboard_found( LeaderboardFindResult_t *pCallback ) } } } +#endif } void leaderboard_downloaded( LeaderboardScoresDownloaded_t *pCallback ) { +#ifdef STEAM_LEADERBOARDS // Update UI if this leaderboard matches what we currently have in view if( ui_data.level_selected->steam_leaderboard == pCallback->m_hSteamLeaderboard ) { @@ -2934,10 +2916,12 @@ void leaderboard_downloaded( LeaderboardScoresDownloaded_t *pCallback ) ui_data.leaderboard_show = 0; } else vg_warn( "Downloaded leaderboard does not match requested!\n" ); +#endif } void leaderboard_set_score( struct cmp_level *cmp_level, u32 score ) { +#ifdef STEAM_LEADERBOARDS if( ui_data.upload_request.is_waiting ) vg_warn( "You are uploading leaderboard entries too quickly!\n" ); @@ -2950,6 +2934,7 @@ void leaderboard_set_score( struct cmp_level *cmp_level, u32 score ) leaderboard_dispatch_score(); else sw_find_leaderboard( cmp_level->map_name ); +#endif } // CONSOLE COMMANDS @@ -3073,8 +3058,10 @@ static int console_changelevel( int argc, char const *argv[] ) void vg_start(void) { // Steamworks callbacks + #ifdef STEAM_LEADERBOARDS sw_leaderboard_found = &leaderboard_found; sw_leaderboard_downloaded = &leaderboard_downloaded; + #endif vg_function_push( (struct vg_cmd){ .name = "_map_write",