X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=ent_region.c;h=fd24f4e1cd3b6f3dc98bfc6b025475b011de76f7;hb=74b2136d5b41b18e2eec698f1fd11b503aa1100a;hp=4d835b8ff632e89f6dff158b5118c659eb88aaea;hpb=3b1909cad505b859b9c6524498b1969cd018af8c;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/ent_region.c b/ent_region.c index 4d835b8..fd24f4e 100644 --- a/ent_region.c +++ b/ent_region.c @@ -62,6 +62,9 @@ static void ent_region_call( world_instance *world, ent_call *call ){ * reevaluate all achievements to calculate the compiled achievement */ static void ent_region_re_eval( world_instance *world ){ + u32 world_total = k_ent_route_flag_achieve_gold | + k_ent_route_flag_achieve_silver; + for( u32 i=0; ient_region); i ++ ){ ent_region *region = mdl_arritm(&world->ent_region, i); @@ -88,8 +91,46 @@ static void ent_region_re_eval( world_instance *world ){ combined &= route->flags; } + for( u32 j=0; jent_challenge); j ++ ){ + ent_challenge *challenge = mdl_arritm( &world->ent_challenge, j ); + + v3f local; + m4x3_mulv( volume->to_local, challenge->transform.co, local ); + if( !((fabsf(local[0]) <= 1.0f) && + (fabsf(local[1]) <= 1.0f) && + (fabsf(local[2]) <= 1.0f)) ){ + continue; + } + + u32 flags = 0x00; + if( challenge->status ){ + flags |= k_ent_route_flag_achieve_gold; + flags |= k_ent_route_flag_achieve_silver; + } + + combined &= flags; + } + region->flags = combined; + world_total &= combined; + } + + u32 instance_id = world - world_static.instances; + + if( world_static.instance_addons[instance_id]->flags & ADDON_REG_MTZERO ){ + if( world_total & k_ent_route_flag_achieve_gold ){ + steam_set_achievement( "MTZERO_GOLD" ); + steam_store_achievements(); + } + + if( world_total & k_ent_route_flag_achieve_silver ){ + steam_set_achievement( "MTZERO_SILVER" ); + steam_store_achievements(); + } + } - /* TODO: Challenges */ + if( world_static.instance_addons[instance_id]->flags & ADDON_REG_CITY ){ + steam_set_achievement( "CITY_COMPLETE" ); + steam_store_achievements(); } }