small compression
[carveJwlIkooP6JGAAIwe30JlM.git] / ent_objective.c
index c037eaf5cbb5cb5afe1d55527a5c4c59317cc341..0cf5790a70c0ce690011c56abc5239302c83e6fb 100644 (file)
@@ -5,8 +5,9 @@
 #include "world_load.h"
 #include "entity.h"
 #include "audio.h"
+#include "steam.h"
 
-VG_STATIC void ent_objective_pass( world_instance *world, 
+static void ent_objective_pass( world_instance *world, 
                                    ent_objective *objective ){
    if( objective->id_next ){
       world_static.challenge_timer += objective->filter;
@@ -29,6 +30,7 @@ VG_STATIC void ent_objective_pass( world_instance *world,
       audio_oneshot( &audio_challenge[2], 1.0f, 0.0f );
       world_static.challenge_target = NULL;
       world_static.challenge_timer = 0.0f;
+      world_static.focused_entity = 0;
 
       if( objective->id_win ){
          ent_call call;
@@ -37,12 +39,30 @@ VG_STATIC void ent_objective_pass( world_instance *world,
          call.id = objective->id_win;
          entity_call( world, &call );
       }
+
+      u32 world_completed = 1;
+      for( u32 i=0; i<mdl_arrcount(&world->ent_challenge); i++ ){
+         ent_challenge *challenge = mdl_arritm( &world->ent_challenge, i );
+         if( !challenge->status ){
+            world_completed = 0;
+            break;
+         }
+      }
+
+      if( world_completed ){
+         const char *understate = "Understate DIY park";
+         if( mdl_pstreq( &world->meta, world->info.pstr_name, 
+                         understate, vg_strdjb2( understate ))){
+            steam_set_achievement( "CITY_COMPLETE" );
+            steam_store_achievements();
+         }
+      }
    }
 }
 
-VG_STATIC int ent_objective_check_filter( ent_objective *objective ){
+static int ent_objective_check_filter( ent_objective *objective ){
    if( objective->filter ){
-      struct player_skate_state *s = &localplayer._skate.state;
+      struct player_skate_state *s = &player_skate.state;
       enum trick_type trick = s->trick_type;
 
       u32 state = 0x00;
@@ -73,7 +93,7 @@ VG_STATIC int ent_objective_check_filter( ent_objective *objective ){
    }
 }
 
-VG_STATIC void ent_objective_call( world_instance *world, ent_call *call ){
+static void ent_objective_call( world_instance *world, ent_call *call ){
    u32 index = mdl_entity_id_id( call->id );
    ent_objective *objective = mdl_arritm( &world->ent_objective, index );