X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=ent_objective.c;h=0cf5790a70c0ce690011c56abc5239302c83e6fb;hb=137d40d96fe923600d8378b8e138e3c276f27ff4;hp=330e60fcb97524075020360909c37be6a1dcf848;hpb=6190deb68aa1c9e92ede62ea05c2a755bf5516de;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/ent_objective.c b/ent_objective.c index 330e60f..0cf5790 100644 --- a/ent_objective.c +++ b/ent_objective.c @@ -4,25 +4,33 @@ #include "world.h" #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->challenge_timer += objective->filter; + world_static.challenge_timer += objective->filter; u32 index = mdl_entity_id_id( objective->id_next ); ent_objective *next = mdl_arritm( &world->ent_objective, index ); - world->challenge_target = next; + world_static.challenge_target = next; + objective->flags |= k_ent_objective_passed; if( next->filter & k_ent_objective_filter_passthrough ) ent_objective_pass( world, next ); - else + else{ vg_info( "pass challenge point\n" ); + audio_oneshot_3d( &audio_challenge[0], localplayer.rb.co, + 30.0f, 1.0f ); + } } else { - vg_success( "NYU Film school graduate SUCKAH\n" ); - world->challenge_target = NULL; - world->challenge_timer = 0.0f; + vg_success( "challenge win\n" ); + 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; @@ -31,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; ient_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; @@ -67,34 +93,29 @@ 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 ); if( call->function == 0 ){ - if( objective->flags & k_ent_objective_hidden ) return; + if( objective->flags & (k_ent_objective_hidden| + k_ent_objective_passed)) return; - if( world->challenge_target ){ - if( (world->challenge_target == objective) && + if( world_static.challenge_target ){ + if( (world_static.challenge_target == objective) && ent_objective_check_filter( objective )){ ent_objective_pass( world, objective ); } else { - vg_error( "womp womp\n" ); - world->challenge_target = NULL; - world->challenge_timer = 0.0f; + audio_oneshot_3d( &audio_challenge[6], localplayer.rb.co, + 30.0f, 1.0f ); + vg_error( "challenge failed\n" ); + world_static.challenge_target = NULL; + world_static.challenge_timer = 0.0f; + world_static.focused_entity = 0; } } } -#if 0 - else if( call->function == 1 ){ - if( objective->flags & k_ent_objective_hidden ) return; - - vg_info( "begin the challenge\n" ); - world->challenge_timer = 0.0f; - ent_objective_pass( world, objective ); - } -#endif else if( call->function == 2 ){ objective->flags &= ~k_ent_objective_hidden;