change shader properties to be vg_msg based
[carveJwlIkooP6JGAAIwe30JlM.git] / world_sfd.c
index b247ba6e778f5f173627704e38427b4f153c4eb9..6473d63b3404b24f3699a789d9d9ffcd171afbf7 100644 (file)
@@ -9,6 +9,8 @@
 #include "network_common.h"
 #include "world_routes.h"
 
+struct world_sfd world_sfd;
+
 static f32 sfd_encode_glyph( char c ){
    int value = 0;
    if( c >= 'a' && c <= 'z' )
@@ -50,7 +52,8 @@ static void sfd_clear( u32 row ){
    }
 }
 
-static void sfd_encode( v2i co, const char *str, enum world_sfd_align align ){
+void sfd_encode( v2i co, const char *str, enum world_sfd_align align )
+{
    i32 row_h = world_sfd.h -1 -co[1];
    i32 offset_x = 0;
 
@@ -76,8 +79,9 @@ static void sfd_encode( v2i co, const char *str, enum world_sfd_align align ){
    }
 }
 
-static void world_sfd_compile_scores( struct leaderboard_cache *board,
-                                      const char *title ){
+void world_sfd_compile_scores( struct leaderboard_cache *board,
+                               const char *title )
+{
    for( u32 i=0; i<13; i++ )
       sfd_clear(i);
 
@@ -142,8 +146,11 @@ static void world_sfd_compile_scores( struct leaderboard_cache *board,
 
          /* time */
          vg_strnull( &str, buf, 100 );
-         i32 centiseconds = vg_msg_getkvi32( &body, "time", 0 ),
-             seconds      = centiseconds / 100,
+         
+         u32 centiseconds;
+         vg_msg_getkvintg( &body, "time", k_vg_msg_i32, &centiseconds, NULL );
+
+         i32 seconds      = centiseconds / 100,
              minutes      = seconds / 60;
 
          centiseconds %= 100;
@@ -166,7 +173,8 @@ static void world_sfd_compile_scores( struct leaderboard_cache *board,
    }
 }
 
-static void world_sfd_compile_active_scores(void){
+void world_sfd_compile_active_scores(void)
+{
    world_instance *world = world_current_instance();
    
    struct leaderboard_cache *board = NULL;
@@ -182,7 +190,8 @@ static void world_sfd_compile_active_scores(void){
    world_sfd_compile_scores( board, name );
 }
 
-static void world_sfd_update( world_instance *world, v3f pos ){
+void world_sfd_update( world_instance *world, v3f pos )
+{
    if( mdl_arrcount( &world->ent_route ) ){
       u32 closest = 0;
       float min_dist = INFINITY;
@@ -243,8 +252,9 @@ static void world_sfd_update( world_instance *world, v3f pos ){
    }
 }
 
-static void bind_terrain_noise(void);
-static void sfd_render( world_instance *world, camera *cam, m4x3f transform ){
+void bind_terrain_noise(void);
+void sfd_render( world_instance *world, vg_camera *cam, m4x3f transform )
+{
    mesh_bind( &world_sfd.mesh_display );
    shader_scene_scoretext_use();
    shader_scene_scoretext_uTexMain(1);
@@ -290,9 +300,9 @@ static void sfd_render( world_instance *world, camera *cam, m4x3f transform ){
    mdl_draw_submesh( &world_sfd.sm_base );
 }
 
-static void world_sfd_init(void){
+void world_sfd_init(void)
+{
    vg_info( "world_sfd_init\n" );
-   shader_scene_scoretext_register();
    vg_linear_clear( vg_mem.scratch );
 
    mdl_context mscoreboard;