X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=ent_region.c;h=eecf22d05ff65d1b4846bdb324c56733ed0c2b33;hb=fbc68c65e01838feb77f47b30994b45fcc39ebaf;hp=026af35d89042fb24231232b354e2cee75c2c8a1;hpb=71b7175073e0c764c3c5cb0c7ceee0f8cca09e58;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/ent_region.c b/ent_region.c index 026af35..eecf22d 100644 --- a/ent_region.c +++ b/ent_region.c @@ -1,5 +1,16 @@ #include "ent_region.h" #include "gui.h" +#include "network_common.h" +#include "network.h" + +static u32 region_spark_colour( u32 flags ){ + if( flags & k_ent_route_flag_achieve_gold ) + return 0xff8ce0fa; + else if( flags & k_ent_route_flag_achieve_silver ) + return 0xffc2c2c2; + else + return 0x00; +} static void ent_region_call( world_instance *world, ent_call *call ){ ent_region *region = @@ -30,12 +41,13 @@ static void ent_region_call( world_instance *world, ent_call *call ){ gui_location_print_ccmd( 1, (const char *[]){ mdl_pstr(&world->meta,region->pstr_title)} ); - if( region->flags & k_ent_route_flag_achieve_gold ) - localplayer.effect_data.spark.colour = 0xff8ce0fa; - else if( region->flags & k_ent_route_flag_achieve_silver ) - localplayer.effect_data.spark.colour = 0xffc2c2c2; - else - localplayer.effect_data.spark.colour = 0x00; + vg_strncpy( mdl_pstr(&world->meta,region->pstr_title), + global_ent_region.location, NETWORK_REGION_MAX, + k_strncpy_always_add_null ); + global_ent_region.flags = region->flags; + network_send_region(); + + localplayer.effect_data.spark.colour = region_spark_colour(region->flags); } else if( call->function == 1 ){ /* leave */ for( u32 i=0; ient_route); i ++ ){ @@ -76,8 +88,26 @@ static void ent_region_re_eval( world_instance *world ){ combined &= route->flags; } - region->flags = combined; + for( u32 j=0; jent_challenge); j ++ ){ + ent_challenge *challenge = mdl_arritm( &world->ent_challenge, j ); - /* TODO: Challenges */ + 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; } }