2 * Copyright (C) 2021-2024 Mt.ZERO Software, Harry Godden - All Rights Reserved
7 #include "network_msg.h"
15 k_world_geo_type_solid
= 0,
16 k_world_geo_type_nonsolid
= 1,
17 k_world_geo_type_water
= 2
21 k_world_purpose_invalid
= -1,
22 k_world_purpose_hub
= 0,
23 k_world_purpose_client
= 1,
27 struct leaderboard_cache
{
28 enum request_status status
;
34 typedef struct world_instance world_instance
;
36 void skaterift_world_get_save_path( enum world_purpose which
, char buf
[128] );
38 /* submodule headers */
39 #include "world_entity.h"
40 #include "world_gate.h"
41 #include "world_gen.h"
42 #include "world_info.h"
43 #include "world_physics.h"
44 #include "world_render.h"
45 #include "world_sfd.h"
46 #include "world_volumes.h"
47 #include "world_water.h"
48 #include "world_audio.h"
49 #include "world_routes.h"
50 #include "world_routes_ui.h"
52 /* console variables */
54 static f32 k_day_length
= 30.0f
; /* minutes */
55 static i32 k_debug_light_indices
= 0,
56 k_debug_light_complexity
= 0,
60 #define WORLD_SURFACE_HAS_TRAFFIC 0x1
61 #define WORLD_SURFACE_HAS_PROPS 0x2
63 struct world_instance
{
65 * -------------------------------------------------------
72 k_world_status_unloaded
= 0,
73 k_world_status_loading
= 1,
74 k_world_status_loaded
= 2,
75 k_world_status_unloading
= 3 /* dont spawn sounds and stuff */
93 struct ub_world_lighting
{
101 v4f g_nightsky_colour
;
103 v4f g_ambient_colour
;
104 v4f g_sunset_ambient
;
113 float g_shadow_length
;
114 float g_shadow_spread
;
118 float g_sunset_phase
;
121 int g_shadow_samples
;
124 int g_debug_complexity
;
130 GLuint tbo_light_entities
,
134 float probabilities
[3];
137 struct framebuffer heightmap
;
140 * Dynamically allocated when world_load is called.
142 * the following arrays index somewhere into this linear
144 * --------------------------------------------------------------------------
155 struct world_surface
{
166 mdl_array_ptr ent_spawn
,
199 ent_gate
*rendering_gate
;
202 * ----------------------------------------------------
206 scene_context scene_geo
,
210 /* spacial mappings */
216 glmesh mesh_route_lines
;
220 u32 cubemap_cooldown
, cubemap_side
;
223 struct leaderboard_cache
*leaderboard_cache
;
226 struct route_ui
*routes_ui
;
229 struct world_static
{
231 * Allocated as system memory
232 * --------------------------------------------------------------------------
236 u32 current_run_version
;
237 double time
, rewind_from
, rewind_to
, last_use
;
239 u32 active_trigger_volumes
[8];
240 u32 active_trigger_volume_count
;
242 addon_reg
*instance_addons
[ k_world_max
];
243 world_instance instances
[ k_world_max
];
245 enum world_purpose active_instance
;
246 u32 focused_entity
; /* like skateshop, challenge.. */
251 ent_objective
*challenge_target
;
254 enum world_loader_state
{
256 k_world_loader_preload
,
261 bool clear_async_op_when_done
;
265 struct world_load_args
267 enum world_purpose purpose
;
271 void world_init(void);
272 world_instance
*world_current_instance(void);
273 void world_switch_instance( u32 index
);
274 void skaterift_world_load_thread( void *_args
);
275 void world_update( world_instance
*world
, v3f pos
);