organize world modules
[carveJwlIkooP6JGAAIwe30JlM.git] / world.c
1 /*
2 * Copyright (C) 2021-2023 Mt.ZERO Software, Harry Godden - All Rights Reserved
3 */
4
5 #ifndef WORLD_C
6 #define WORLD_C
7
8 #include "world.h"
9 #include "network.h"
10
11 static world_instance *world_current_instance(void){
12 return &world_static.worlds[ world_static.active_world ];
13 }
14
15 static void world_init(void)
16 {
17 vg_loader_step( world_render_init, NULL );
18 vg_loader_step( world_sfd_init, NULL );
19 vg_loader_step( world_water_init, NULL );
20 vg_loader_step( world_gates_init, NULL );
21 vg_loader_step( world_routes_init, NULL );
22
23 /* Allocate dynamic world memory arena */
24 u32 max_size = 76*1024*1024;
25 world_static.heap = vg_create_linear_allocator( vg_mem.rtmemory, max_size,
26 VG_MEMORY_SYSTEM );
27 }
28
29 #include "world_entity.c"
30 #include "world_gate.c"
31 #include "world_gen.c"
32 #include "world_load.c"
33 #include "world_physics.c"
34 #include "world_render.c"
35 #include "world_sfd.c"
36 #include "world_volumes.c"
37 #include "world_water.c"
38 #include "world_audio.c"
39 #include "world_routes.c"
40 #include "world_traffic.c"
41
42 VG_STATIC void world_update( world_instance *world, v3f pos )
43 {
44 world_render.sky_time += world_render.sky_rate * vg.time_delta;
45 world_render.sky_rate = vg_lerp( world_render.sky_rate,
46 world_render.sky_target_rate,
47 vg.time_delta * 5.0 );
48
49 world_routes_update_timer_texts( world );
50 world_routes_update( world );
51 world_traffic_update( world, pos );
52 world_sfd_update( world, pos );
53 world_volumes_update( world, pos );
54 }
55
56 #endif /* WORLD_C */