add two more achievment triggers
[fishladder.git] / fishladder.c
index 73c9210a92474dadb5f3dbef33638a92ee957526..1f9db88f07d4fe952231bcea148551cfbe48dfc8 100644 (file)
@@ -1,7 +1,7 @@
 // Copyright (C) 2021 Harry Godden (hgn) - All Rights Reserved
 
-//#define VG_STEAM
-//#define VG_STEAM_APPID 1218140U
+#define VG_STEAM
+#define VG_STEAM_APPID 1218140U
 #include "vg/vg.h"
 #include "fishladder_resources.h"
 
@@ -332,7 +332,6 @@ struct world
        u32 score;
        u32 completed;
        u32 time;
-       
 } world = {};
 
 static void map_free(void)
@@ -709,6 +708,7 @@ static void map_serialize( FILE *stream )
 int main( int argc, char *argv[] )
 {
        vg_init( argc, argv, "Marble Computing | SPACE: Test | LeftClick: Toggle tile | RightClick: Drag wire" );
+       return 0;
 }
 
 static int console_credits( int argc, char const *argv[] )
@@ -1512,6 +1512,8 @@ void vg_update(void)
                                                        if( cell_entry->config == k_cell_type_con_r || cell_entry->config == k_cell_type_con_u 
                                                                || cell_entry->config == k_cell_type_con_l || cell_entry->config == k_cell_type_con_d )
                                                        {
+                                                               sw_set_achievement( "CAN_DO_THAT" );
+                                                       
                                                                fish->state = k_fish_state_soon_alive;
                                                                
                                                                fish->dir[0] = 0;
@@ -1599,9 +1601,11 @@ void vg_update(void)
                                                                 (fj_prev[0] == fi->pos[0]) &&
                                                                 (fj_prev[1] == fi->pos[1])
                                                                )? 1: 0;
-                                               
+                                                       
                                                        if( collide_next_frame || collide_this_frame )
                                                        {
+                                                               sw_set_achievement( "BANG" );
+                                                       
                                                                // Shatter death (+0.5s)
                                                                float death_time = collide_this_frame? 0.0f: 0.5f;
                                                                
@@ -1716,6 +1720,9 @@ void vg_update(void)
                                }
                                else
                                {
+                                       if( world.sim_run > 0 )
+                                               sw_set_achievement( "GOOD_ENOUGH" );
+                                       
                                        vg_error( "Level failed :(\n" );
                                }