X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_sfd.c;h=b40d57a5896cf8ffad66360d4af238fc993b42da;hb=f6bc1299d5b30e1aba87e6ce084bcd7eed22975f;hp=a5ba3f6d82981fa6103fc51b2546a6118ef6f8e6;hpb=c2ee05fe23699fd1de7e1d8259b9bc272b232058;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_sfd.c b/world_sfd.c index a5ba3f6..b40d57a 100644 --- a/world_sfd.c +++ b/world_sfd.c @@ -4,9 +4,10 @@ #include "world_sfd.h" #include "shaders/scene_scoretext.h" #include "shaders/scene_vertex_blend.h" +#include "network.h" +#include "entity.h" -static f32 sfd_encode_glyph( char c ) -{ +static f32 sfd_encode_glyph( char c ){ int value = 0; if( c >= 'a' && c <= 'z' ) value = c-'a'+11; @@ -39,7 +40,7 @@ static f32 sfd_encode_glyph( char c ) return (float)value; } -VG_STATIC void sfd_encode( u32 row, const char *str ) +static void sfd_encode( u32 row, const char *str ) { int end=0; u32 row_h = world_sfd.h -1 -row; @@ -59,7 +60,7 @@ VG_STATIC void sfd_encode( u32 row, const char *str ) } } -VG_STATIC void world_sfd_update( world_instance *world, v3f pos ){ +static void world_sfd_update( world_instance *world, v3f pos ){ if( mdl_arrcount( &world->ent_route ) ){ u32 closest = 0; float min_dist = INFINITY; @@ -74,13 +75,24 @@ VG_STATIC void world_sfd_update( world_instance *world, v3f pos ){ } } - if( (world_sfd.active_route_board != closest) || network_scores_updated ) - { + if( (world_sfd.active_route_board != closest) || network_scores_updated ){ network_scores_updated = 0; world_sfd.active_route_board = closest; - ent_route *route = mdl_arritm( &world->ent_route, closest ); - u32 id = route->official_track_id; + + addon_reg *world_reg = world_static.addon_hub; + if( world_static.active_instance ) + world_reg = world_static.addon_client; + + char mod_uid[ ADDON_UID_MAX ]; + addon_alias_uid( &world_reg->alias, mod_uid ); + + network_request_scoreboard( + mod_uid, + mdl_pstr( &world->meta, route->pstr_name ), + 0 ); +#if 0 + u32 id = route->anon.official_track_id; if( id != 0xffffffff ){ struct netmsg_board *local_board = @@ -93,6 +105,7 @@ VG_STATIC void world_sfd_update( world_instance *world, v3f pos ){ sfd_encode( 0, mdl_pstr( &world->meta, route->pstr_name ) ); sfd_encode( 1, "No data" ); } +#endif } } @@ -113,20 +126,12 @@ VG_STATIC void world_sfd_update( world_instance *world, v3f pos ){ } } -VG_STATIC void bind_terrain_noise(void); -VG_STATIC void sfd_render( world_instance *world, camera *cam, m4x3f transform ) -{ +static void bind_terrain_noise(void); +static void sfd_render( world_instance *world, camera *cam, m4x3f transform ){ mesh_bind( &world_sfd.mesh_display ); shader_scene_scoretext_use(); shader_scene_scoretext_uTexMain(1); - - world_link_lighting_ub( world, _shader_scene_scoretext.id ); - world_bind_position_texture( world, _shader_scene_scoretext.id, - _uniform_scene_scoretext_g_world_depth, 2 ); - world_bind_light_array( world, _shader_scene_scoretext.id, - _uniform_scene_scoretext_uLightsArray, 3 ); - world_bind_light_index( world, _shader_scene_scoretext.id, - _uniform_scene_scoretext_uLightsIndex, 4 ); + WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, scene_scoretext ); bind_terrain_noise(); @@ -153,13 +158,8 @@ VG_STATIC void sfd_render( world_instance *world, camera *cam, m4x3f transform ) shader_scene_vertex_blend_use(); shader_scene_vertex_blend_uTexGarbage(0); shader_scene_vertex_blend_uTexGradients(1); - world_link_lighting_ub( world, _shader_scene_vertex_blend.id ); - world_bind_position_texture( world, _shader_scene_vertex_blend.id, - _uniform_scene_vertex_blend_g_world_depth, 2 ); - world_bind_light_array( world, _shader_scene_vertex_blend.id, - _uniform_scene_vertex_blend_uLightsArray, 3 ); - world_bind_light_index( world, _shader_scene_vertex_blend.id, - _uniform_scene_vertex_blend_uLightsIndex, 4 ); + WORLD_BIND_LIGHT_BUFFERS_UB0_TEX234( world, scene_vertex_blend ); + bind_terrain_noise(); glActiveTexture( GL_TEXTURE1 ); glBindTexture( GL_TEXTURE_2D, world_sfd.tex_scoretex ); @@ -173,8 +173,7 @@ VG_STATIC void sfd_render( world_instance *world, camera *cam, m4x3f transform ) mdl_draw_submesh( &world_sfd.sm_base ); } -VG_STATIC int world_sfd_test( int argc, const char *argv[] ) -{ +static int world_sfd_test( int argc, const char *argv[] ){ if( argc == 2 ){ int row = vg_min( vg_max(atoi(argv[0]),0), world_sfd.h); sfd_encode( row, argv[1] ); @@ -183,8 +182,7 @@ VG_STATIC int world_sfd_test( int argc, const char *argv[] ) return 0; } -VG_STATIC void world_sfd_init(void) -{ +static void world_sfd_init(void){ vg_info( "world_sfd_init\n" ); shader_scene_scoretext_register(); vg_console_reg_cmd( "sfd", world_sfd_test, NULL );