projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gameserver optimisations
[carveJwlIkooP6JGAAIwe30JlM.git]
/
world_load.c
diff --git
a/world_load.c
b/world_load.c
index 6378e9bd5cac18487da984d3c3b97a1d408fb00c..d7f4afb8a3b3fd3088f129760fa22df40cacbbd9 100644
(file)
--- a/
world_load.c
+++ b/
world_load.c
@@
-107,7
+107,6
@@
static void world_instance_load_mdl( u32 instance_id, const char *path ){
/* init player position.
* - this is overriden by the save state when(if) it loads */
/* init player position.
* - this is overriden by the save state when(if) it loads */
- v3_zero( world->player_angles );
ent_spawn *rp = world_find_spawn_by_name( world, "start" );
if( !rp ) rp = world_find_closest_spawn( world, (v3f){0.0f,0.0f,0.0f} );
ent_spawn *rp = world_find_spawn_by_name( world, "start" );
if( !rp ) rp = world_find_closest_spawn( world, (v3f){0.0f,0.0f,0.0f} );
@@
-138,22
+137,21
@@
struct world_load_complete_data{
static void skaterift_world_load_done( void *payload, u32 size ){
struct world_load_complete_data *data = payload;
static void skaterift_world_load_done( void *payload, u32 size ){
struct world_load_complete_data *data = payload;
+ world_instance *world = &world_static.instances[ data->purpose ];
- /* TODO(W2): Load player position from this save file */
vg_msg sav;
vg_msg_init( &sav, data->save.buf, data->save.len );
vg_msg sav;
vg_msg_init( &sav, data->save.buf, data->save.len );
- world_instance *world = &world_static.instances[ data->purpose ];
+ if( data->purpose != k_world_purpose_hub ){
+ vg_msg player_frame = sav;
+ if( vg_msg_seekframe( &player_frame, "player" ) ){
+ vg_msg_getkvv3f( &player_frame, "position", world->player_co, NULL );
+ }
+ }
+
world_entity_start( world, &sav );
world->status = k_world_status_loaded;
world_static.load_state = k_world_loader_none;
world_entity_start( world, &sav );
world->status = k_world_status_loaded;
world_static.load_state = k_world_loader_none;
-
- for( int i=0; i<k_world_max; i ++ ){
- world_instance *wi = &world_static.instances[i];
-
- if( wi->status == k_world_status_loaded )
- world_entity_relink( wi );
- }
}
struct world_load_args {
}
struct world_load_args {
@@
-165,7
+163,6
@@
struct world_load_args {
* Does a complete world switch using the remaining free slots
*/
static void skaterift_world_load_thread( void *_args ){
* Does a complete world switch using the remaining free slots
*/
static void skaterift_world_load_thread( void *_args ){
- /* FIXME: we need to check all threads that take args. args can dissapear! */
struct world_load_args args = *((struct world_load_args *)_args);
addon_reg *reg = args.reg;
struct world_load_args args = *((struct world_load_args *)_args);
addon_reg *reg = args.reg;
@@
-180,7
+177,7
@@
static void skaterift_world_load_thread( void *_args ){
vg_strnull( &path, path_buf, 4096 );
assert( reg );
vg_strnull( &path, path_buf, 4096 );
assert( reg );
- addon_get_content_folder( reg, &path );
+ addon_get_content_folder( reg, &path
, 1
);
vg_str folder = path;
if( !vg_strgood( &folder ) ) {
vg_str folder = path;
if( !vg_strgood( &folder ) ) {
@@
-303,21
+300,19
@@
static void skaterift_change_world_start( addon_reg *reg ){
vg_linear_clear( vg_mem.scratch ); /* ?? */
vg_info( "unloading old worlds\n" );
vg_linear_clear( vg_mem.scratch ); /* ?? */
vg_info( "unloading old worlds\n" );
-
- for( u32 i=1; i<vg_list_size(world_static.instances); i++ ){
- world_instance *inst = &world_static.instances[i];
- if( inst->status == k_world_status_loaded ){
- inst->status = k_world_status_unloading;
- world_fadeout_audio( inst );
- }
- }
+ world_instance *client_world =
+ &world_static.instances[ k_world_purpose_client ];
- world_entity_relink( &world_static.instances[k_world_purpose_hub] );
+ if( client_world->status == k_world_status_loaded ){
+ client_world->status = k_world_status_unloading;
+ world_fadeout_audio( client_world );
+ }
world_static.instance_addons[ k_world_purpose_client ] = reg;
network_send_item( k_netmsg_playeritem_world1 );
relink_all_remote_player_worlds();
world_static.instance_addons[ k_world_purpose_client ] = reg;
network_send_item( k_netmsg_playeritem_world1 );
relink_all_remote_player_worlds();
+ world_unlink_nonlocal( &world_static.instances[k_world_purpose_hub] );
}
}
}
}
@@
-331,7
+326,7
@@
static int skaterift_load_world_command( int argc, const char *argv[] ){
u32 reg_id = addon_match( &q );
if( reg_id != 0xffffffff ){
u32 reg_id = addon_match( &q );
if( reg_id != 0xffffffff ){
- addon_reg *reg = get_addon_from_index( k_addon_type_world, reg_id );
+ addon_reg *reg = get_addon_from_index( k_addon_type_world, reg_id
, 0
);
skaterift_change_world_start( reg );
}
else {
skaterift_change_world_start( reg );
}
else {
@@
-341,12
+336,16
@@
static int skaterift_load_world_command( int argc, const char *argv[] ){
else {
vg_info( "worlds availible to load:\n" );
else {
vg_info( "worlds availible to load:\n" );
- for( int i=0; i<addon_count(k_addon_type_world); i ++ ){
- addon_reg *w = get_addon_from_index( k_addon_type_world, i
);
+ for( int i=0; i<addon_count(k_addon_type_world
,0
); i ++ ){
+ addon_reg *w = get_addon_from_index( k_addon_type_world, i
, 0
);
char buf[ADDON_UID_MAX];
addon_alias_uid( &w->alias, buf );
char buf[ADDON_UID_MAX];
addon_alias_uid( &w->alias, buf );
- vg_info( " %s\n", buf );
+
+ if( w->flags & ADDON_REG_HIDDEN )
+ vg_info( " %s [hidden]\n", buf );
+ else
+ vg_info( " %s\n", buf );
}
}
}
}