From: hgn Date: Thu, 6 Feb 2025 17:04:30 +0000 (+0000) Subject: Not sure how this diddn't crash before! Fix bad index. X-Git-Url: https://harrygodden.com/git/?a=commitdiff_plain;h=14795f16009cc1e28777cf90290bab26422cbfcb;p=carveJwlIkooP6JGAAIwe30JlM.git Not sure how this diddn't crash before! Fix bad index. --- diff --git a/src/world_render.c b/src/world_render.c index 68952c7..a5e700c 100644 --- a/src/world_render.c +++ b/src/world_render.c @@ -511,26 +511,32 @@ static void world_render_challenges( world_instance *world, ent_challenge *active_challenge = NULL; int running = 0; - if( mdl_entity_id_type( world_static.focused_entity ) == k_ent_challenge ){ + if( mdl_entity_id_type( world_static.focused_entity ) == k_ent_challenge ) + { if( (skaterift.activity == k_skaterift_default) && - world_static.challenge_target ){ + world_static.challenge_target ) + { running = 1; } if( !((skaterift.activity != k_skaterift_ent_focus) && - !world_static.challenge_target) ){ + !world_static.challenge_target) ) + { world_instance *challenge_world = world_current_instance(); u32 index = mdl_entity_id_id( world_static.focused_entity ); active_challenge = af_arritm(&challenge_world->ent_challenge, index); } } - if( active_challenge ){ + if( active_challenge ) + { shader_scene_fxglow_uUvOffset( (v2f){ 8.0f/256.0f, 0.0f } ); - challenge_list[ challenge_count ++ ] = world_static.focused_entity; + challenge_list[ challenge_count ++ ] = + mdl_entity_id_id( world_static.focused_entity ); u32 next = active_challenge->first; - while( mdl_entity_id_type(next) == k_ent_objective ){ + while( mdl_entity_id_type(next) == k_ent_objective ) + { u32 index = mdl_entity_id_id( next ); objective_list[ objective_count ++ ] = index; @@ -540,21 +546,25 @@ static void world_render_challenges( world_instance *world, radius = 10000.0f; } - else { + else + { shader_scene_fxglow_uUvOffset( (v2f){ 0.0f, 0.0f } ); bh_iter it; bh_iter_init_range( 0, &it, pos, radius+10.0f ); i32 idx; - while( bh_next( world->entity_bh, &it, &idx ) ){ + while( bh_next( world->entity_bh, &it, &idx ) ) + { u32 id = world->entity_list[ idx ], type = mdl_entity_id_type( id ), index = mdl_entity_id_id( id ); - if( type == k_ent_objective ) { + if( type == k_ent_objective ) + { if( objective_count < VG_ARRAY_LEN(objective_list) ) objective_list[ objective_count ++ ] = index; } - else if( type == k_ent_challenge ){ + else if( type == k_ent_challenge ) + { if( challenge_count < VG_ARRAY_LEN(challenge_list) ) challenge_list[ challenge_count ++ ] = index; } @@ -569,8 +579,8 @@ static void world_render_challenges( world_instance *world, { u32 index = objective_list[ i ]; ent_objective *objective = af_arritm( &world->ent_objective, index ); - if( (objective->flags & k_ent_objective_hidden) && - !active_challenge ) continue; + if( (objective->flags & k_ent_objective_hidden) && !active_challenge ) + continue; f32 scale = 1.0f; @@ -639,6 +649,7 @@ static void world_render_challenges( world_instance *world, for( u32 i=0; ient_challenge, index ); m4x3f mmdl; mdl_transform_m4x3( &challenge->transform, mmdl );