2 * Copyright (C) 2021-2024 Mt.ZERO Software, Harry Godden - All Rights Reserved
7 #include "network_msg.h"
14 k_world_geo_type_solid
= 0,
15 k_world_geo_type_nonsolid
= 1,
16 k_world_geo_type_water
= 2
20 k_world_purpose_invalid
= -1,
21 k_world_purpose_hub
= 0,
22 k_world_purpose_client
= 1,
26 struct leaderboard_cache
{
27 enum request_status status
;
33 typedef struct world_instance world_instance
;
35 void skaterift_world_get_save_path( enum world_purpose which
, char buf
[128] );
37 /* submodule headers */
38 #include "world_entity.h"
39 #include "world_gate.h"
40 #include "world_gen.h"
41 #include "world_info.h"
42 #include "world_physics.h"
43 #include "world_render.h"
44 #include "world_sfd.h"
45 #include "world_volumes.h"
46 #include "world_water.h"
47 #include "world_audio.h"
48 #include "world_routes.h"
49 #include "world_routes_ui.h"
51 /* console variables */
53 static f32 k_day_length
= 30.0f
; /* minutes */
54 static i32 k_debug_light_indices
= 0,
55 k_debug_light_complexity
= 0,
59 #define WORLD_SURFACE_HAS_TRAFFIC 0x1
60 #define WORLD_SURFACE_HAS_PROPS 0x2
62 struct world_instance
{
64 * -------------------------------------------------------
71 k_world_status_unloaded
= 0,
72 k_world_status_loading
= 1,
73 k_world_status_loaded
= 2,
74 k_world_status_unloading
= 3 /* dont spawn sounds and stuff */
92 struct ub_world_lighting
{
100 v4f g_nightsky_colour
;
102 v4f g_ambient_colour
;
103 v4f g_sunset_ambient
;
112 float g_shadow_length
;
113 float g_shadow_spread
;
117 float g_sunset_phase
;
120 int g_shadow_samples
;
123 int g_debug_complexity
;
129 GLuint tbo_light_entities
,
133 float probabilities
[3];
136 struct framebuffer heightmap
;
139 * Dynamically allocated when world_load is called.
141 * the following arrays index somewhere into this linear
143 * --------------------------------------------------------------------------
154 struct world_surface
{
164 mdl_array_ptr ent_spawn
,
196 ent_gate
*rendering_gate
;
199 * ----------------------------------------------------
203 scene_context scene_geo
,
207 /* spacial mappings */
213 glmesh mesh_route_lines
;
217 u32 cubemap_cooldown
, cubemap_side
;
220 struct leaderboard_cache
*leaderboard_cache
;
223 struct route_ui
*routes_ui
;
226 struct world_static
{
228 * Allocated as system memory
229 * --------------------------------------------------------------------------
233 u32 current_run_version
;
234 double time
, rewind_from
, rewind_to
, last_use
;
236 u32 active_trigger_volumes
[8];
237 u32 active_trigger_volume_count
;
239 addon_reg
*instance_addons
[ k_world_max
];
240 world_instance instances
[ k_world_max
];
242 enum world_purpose active_instance
;
243 u32 focused_entity
; /* like skateshop, challenge.. */
248 ent_objective
*challenge_target
;
251 enum world_loader_state
{
253 k_world_loader_preload
,
260 struct world_load_args
262 enum world_purpose purpose
;
266 void world_init(void);
267 world_instance
*world_current_instance(void);
268 void world_switch_instance( u32 index
);
269 void skaterift_world_load_thread( void *_args
);
270 void world_update( world_instance
*world
, v3f pos
);