server version check
[carveJwlIkooP6JGAAIwe30JlM.git] / world_render.c
index 022556d068a558e75ace441a3ebf314691ea99a6..aa74bbfb6a2f6c4ab7e045348795cc33dd67eb43 100644 (file)
 #include "respawn.h"
 
 static int ccmd_set_time( int argc, const char *argv[] ){
-   if( argc == 1 ){
-      world_instance *world = world_current_instance();
+   world_instance *world = world_current_instance();
+   if( argc == 1 )
       world->time = atof( argv[0] );
-   }
-   else {
-      vg_error( "Usage set_time <0-1.0>\n" );
-   }
+   else 
+      vg_error( "Usage set_time <0-1.0> (current time: %f)\n", world->time );
    return 0;
 }
 
 static void async_world_render_init( void *payload, u32 size )
 {
    vg_info( "Allocate uniform buffers\n" );
-   for( int i=0; i<4; i++ ){
+   for( int i=0; i<k_world_max; i++ ){
       world_instance *world = &world_static.instances[i];
       world->ubo_bind_point = i;
 
@@ -39,7 +37,7 @@ static void async_world_render_init( void *payload, u32 size )
    }
 
    vg_info( "Allocate frame buffers\n" );
-   for( int i=0; i<4; i++ ){
+   for( int i=0; i<k_world_max; i++ ){
       world_instance *world = &world_static.instances[i];
       struct framebuffer *fb = &world->heightmap;
 
@@ -735,12 +733,10 @@ static void render_world_gates( world_instance *world, camera *cam,
    }
 }
 
-static void world_prerender( world_instance *world )
-{
-
+static void world_prerender( world_instance *world ){
    if( mdl_arrcount( &world->ent_light ) ){
       f32 rate = vg_maxf(0.1f, fabsf(k_day_length)) * vg_signf(k_day_length);
-      world->time += vg.time_delta * (1.0/(rate*60.0));
+      world->time += vg.time_frame_delta * (1.0/(rate*60.0));
    }
    else{
       world->time = 0.834;