X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_sfd.c;h=6473d63b3404b24f3699a789d9d9ffcd171afbf7;hb=494c85703c76c4123c49937a32584840b6be1470;hp=6d663dec54dc348e569bc39b420e07d5c7fdbf2a;hpb=045a89deb1f4ef14c3fc543437fa826df4b6df94;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_sfd.c b/world_sfd.c index 6d663de..6473d63 100644 --- a/world_sfd.c +++ b/world_sfd.c @@ -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, ¢iseconds, 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,15 +300,15 @@ 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; mdl_open( &mscoreboard, "models/rs_scoretext.mdl", vg_mem.scratch ); mdl_load_metadata_block( &mscoreboard, vg_mem.scratch ); - mdl_async_load_glmesh( &mscoreboard, &world_sfd.mesh_base ); + mdl_async_load_glmesh( &mscoreboard, &world_sfd.mesh_base, NULL ); mdl_load_mesh_block( &mscoreboard, vg_mem.scratch );