From: hgn Date: Sat, 27 May 2023 20:11:49 +0000 (+0100) Subject: achievements X-Git-Url: https://skaterift.com/git/?a=commitdiff_plain;h=4c95c9c3e6033cd1360adacef3c80fc4da933715;p=carveJwlIkooP6JGAAIwe30JlM.git achievements --- diff --git a/blender_export.py b/blender_export.py index 293b87c..ca29004 100644 --- a/blender_export.py +++ b/blender_export.py @@ -35,6 +35,7 @@ sr_entity_list = [ ('ent_swspreview', 'Workshop Preview', '', 14 ), ('ent_menuitem', 'Menu Item', '', 15 ), ('ent_worldinfo', 'World Info', '', 16 ), + ('ent_ccmd', 'CCmd', '', 17 ) ] def get_entity_enum_id( alias ): @@ -439,6 +440,11 @@ class ent_worldinfo(Structure): ("timezone",c_float)] #} +class ent_ccmd(Structure): +#{ + _fields_ = [("pstr_command",c_uint32)] +#} + def obj_ent_type( obj ): #{ if obj.type == 'ARMATURE': return 'mdl_armature' @@ -1727,6 +1733,12 @@ def sr_compile( collection ): worldinfo.timezone = obj_data.timezone sr_ent_push( worldinfo ) #} + elif ent_type == 'ent_ccmd':#{ + ccmd = ent_ccmd() + obj_data = obj.SR_data.ent_ccmd[0] + ccmd.pstr_command = sr_compile_string( obj_data.command ) + sr_ent_push( ccmd ) + #} #} #} @@ -2677,7 +2689,7 @@ class SR_OBJECT_ENT_VOLUME(bpy.types.PropertyGroup): target: bpy.props.PointerProperty( \ type=bpy.types.Object, name="Target", \ poll=lambda self,obj: sr_filter_ent_type(obj,\ - ['ent_audio','ent_skateshop'])) + ['ent_audio','ent_skateshop','ent_ccmd'])) @staticmethod def sr_inspector( layout, data ): @@ -2962,6 +2974,11 @@ class SR_OBJECT_ENT_WORLD_INFO(bpy.types.PropertyGroup): timezone: bpy.props.FloatProperty(name="Timezone(hrs) (UTC0 +hrs)") #} +class SR_OBJECT_ENT_CCMD(bpy.types.PropertyGroup): +#{ + command: bpy.props.StringProperty(name="Command Line") +#} + class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup): #{ ent_gate: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_GATE) @@ -2978,6 +2995,7 @@ class SR_OBJECT_PROPERTIES(bpy.types.PropertyGroup): bpy.props.CollectionProperty(type=SR_OBJECT_ENT_WORKSHOP_PREVIEW) ent_menuitem: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_MENU_ITEM) ent_worldinfo: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_WORLD_INFO) + ent_ccmd: bpy.props.CollectionProperty(type=SR_OBJECT_ENT_CCMD) ent_type: bpy.props.EnumProperty( name="Type", @@ -4097,7 +4115,7 @@ classes = [ SR_INTERFACE, SR_MATERIAL_PANEL,\ SR_UL_FONT_VARIANT_LIST,SR_UL_FONT_GLYPH_LIST,\ SR_OBJECT_ENT_FONT,SR_OBJECT_ENT_TRAFFIC,SR_OBJECT_ENT_SKATESHOP,\ SR_OBJECT_ENT_WORKSHOP_PREVIEW,SR_OBJECT_ENT_MENU_ITEM,\ - SR_OBJECT_ENT_WORLD_INFO,\ + SR_OBJECT_ENT_WORLD_INFO,SR_OBJECT_ENT_CCMD,\ \ SR_OBJECT_PROPERTIES, SR_LIGHT_PROPERTIES, SR_BONE_PROPERTIES, SR_MESH_PROPERTIES, SR_MATERIAL_PROPERTIES \ diff --git a/entity.c b/entity.c index 1e85e56..f5e8004 100644 --- a/entity.c +++ b/entity.c @@ -17,6 +17,8 @@ VG_STATIC void entity_call( world_instance *world, ent_call *call ) ent_audio_call( world, call ); } else if( type == k_ent_skateshop ){ ent_skateshop_call( world, call ); + } else if( type == k_ent_ccmd ){ + ent_ccmd_call( world, call ); } } diff --git a/entity.h b/entity.h index 1de6f70..7143a41 100644 --- a/entity.h +++ b/entity.h @@ -25,6 +25,7 @@ typedef struct ent_skateshop ent_skateshop; typedef struct ent_camera ent_camera; typedef struct ent_swspreview ent_swspreview; typedef struct ent_worldinfo ent_worldinfo; +typedef struct ent_ccmd ent_ccmd; enum entity_alias{ k_ent_none = 0, @@ -43,21 +44,19 @@ enum entity_alias{ k_ent_camera = 13, k_ent_swspreview = 14, k_ent_menuitem = 15, - k_ent_worldinfo = 16 + k_ent_worldinfo = 16, + k_ent_ccmd = 17 }; -static u32 mdl_entity_id_type( u32 entity_id ) -{ +static u32 mdl_entity_id_type( u32 entity_id ){ return (entity_id & 0xffff0000) >> 16; } -static u32 mdl_entity_id_id( u32 entity_id ) -{ +static u32 mdl_entity_id_id( u32 entity_id ){ return entity_id & 0x0000ffff; } -static u32 mdl_entity_id( u32 type, u32 index ) -{ +static u32 mdl_entity_id( u32 type, u32 index ){ return (type & 0xfffff)<<16 | (index & 0xfffff); } @@ -375,6 +374,9 @@ struct ent_glyph{ indice_count; }; +struct ent_ccmd{ + u32 pstr_command; +}; typedef struct ent_call ent_call; struct ent_call{ diff --git a/highscores.h b/highscores.h index 3a20717..817a503 100644 --- a/highscores.h +++ b/highscores.h @@ -310,8 +310,7 @@ VG_STATIC aatree_ptr highscores_push_record( highscore_record *record ) vg_low( "Inserting record into database for track %hu\n",record->trackid ); - if( record->trackid >= vg_list_size(sys->dbheader.tracks) ) - { + if( record->trackid >= vg_list_size(sys->dbheader.tracks) ){ vg_error( "TrackID out of range (%hu>=%d)\n", record->trackid, vg_list_size(sys->dbheader.tracks) ); @@ -324,8 +323,7 @@ VG_STATIC aatree_ptr highscores_push_record( highscore_record *record ) table->root_playerid, record ); - if( existing != AATREE_PTR_NIL ) - { + if( existing != AATREE_PTR_NIL ){ highscore_record *crecord = aatree_get_data( &sys->aainfo_playerid, existing ); diff --git a/maps_src/mp_mtzero/main.mdl b/maps_src/mp_mtzero/main.mdl index ddd7d6d..32a44d9 100644 Binary files a/maps_src/mp_mtzero/main.mdl and b/maps_src/mp_mtzero/main.mdl differ diff --git a/maps_src/mp_spawn/main.mdl b/maps_src/mp_spawn/main.mdl index 097b6bd..56ef1b3 100644 Binary files a/maps_src/mp_spawn/main.mdl and b/maps_src/mp_spawn/main.mdl differ diff --git a/network.h b/network.h index 3d45ab8..3a49d63 100644 --- a/network.h +++ b/network.h @@ -135,15 +135,12 @@ VG_STATIC void send_score_update(void) setscore->inetmsg_id = k_inetmsg_set_score; int count = 0; - for( u32 i=0; irecord_count = count; diff --git a/steam.h b/steam.h index 5403c16..09e3935 100644 --- a/steam.h +++ b/steam.h @@ -91,8 +91,7 @@ VG_STATIC void steam_clear_achievement( const char *name ) } -VG_STATIC int steam_list_achievements( int argc, char const *argv[] ) -{ +VG_STATIC void steam_print_all_achievements(void){ vg_info( "Achievements: \n" ); if( steam_ready && steam_stats_ready ){ @@ -113,38 +112,39 @@ VG_STATIC int steam_list_achievements( int argc, char const *argv[] ) else{ vg_warn( " Steam is not initialized, no results\n" ); } - - return 0; } -VG_STATIC int steam_clear_all_achievements( int argc, char const *argv[] ) +VG_STATIC int steam_achievement_ccmd( int argc, char const *argv[] ) { - if( steam_ready && steam_stats_ready ){ - for( int i=0; istatus == k_world_status_unloading ){ vg_warn( "cannot modify audio while unloading world\n" ); return; @@ -256,4 +255,13 @@ VG_STATIC void ent_audio_call( world_instance *world, ent_call *call ) } } + +VG_STATIC void ent_ccmd_call( world_instance *world, ent_call *call ){ + if( call->function == k_ent_function_trigger ){ + u32 index = mdl_entity_id_id( call->id ); + ent_ccmd *ccmd = mdl_arritm( &world->ent_ccmd, index ); + vg_execute_console_input( mdl_pstr(&world->meta, ccmd->pstr_command) ); + } +} + #endif /* WORLD_ENTITY_C */ diff --git a/world_entity.h b/world_entity.h index 807cd97..3c6d10d 100644 --- a/world_entity.h +++ b/world_entity.h @@ -12,5 +12,6 @@ VG_STATIC ent_spawn *world_find_closest_spawn( world_instance *world, VG_STATIC void ent_volume_call( world_instance *world, ent_call *call ); VG_STATIC void ent_audio_call( world_instance *world, ent_call *call ); +VG_STATIC void ent_ccmd_call( world_instance *world, ent_call *call ); #endif /* WORLD_ENTITY_H */ diff --git a/world_gen.c b/world_gen.c index 799059a..f7f8eda 100644 --- a/world_gen.c +++ b/world_gen.c @@ -227,7 +227,7 @@ VG_STATIC void world_gen_generate_meshes(void) vg_async_item *call = scene_alloc_async( &world->scene_no_collide, &world->mesh_no_collide, - 200000, 500000 ); + 250000, 500000 ); for( u32 i=0; isurface_count; i++ ){ struct world_surface *surf = &world->surfaces[ i ]; diff --git a/world_load.c b/world_load.c index 4f5f8f4..2eca813 100644 --- a/world_load.c +++ b/world_load.c @@ -58,6 +58,7 @@ VG_STATIC void world_load_mdl( const char *path ) mdl_load_array( meta, &world->ent_marker, "ent_marker", heap ); mdl_load_array( meta, &world->ent_skateshop, "ent_skateshop", heap ); mdl_load_array( meta, &world->ent_swspreview,"ent_swspreview", heap ); + mdl_load_array( meta, &world->ent_ccmd, "ent_ccmd", heap ); mdl_array_ptr infos; mdl_load_array( meta, &infos, "ent_worldinfo", vg_mem.scratch ); diff --git a/world_routes.c b/world_routes.c index 529fdef..efde364 100644 --- a/world_routes.c +++ b/world_routes.c @@ -14,6 +14,7 @@ #include "font.h" #include "pointcloud.h" #include "gui.h" +#include "steam.h" #include "shaders/scene_route.h" #include "shaders/routeui.h" @@ -45,10 +46,8 @@ void world_routes_local_set_record( world_instance *world, ent_route *route, ti->push = 1; if( ti->achievement_id ){ -#if 0 steam_set_achievement( ti->achievement_id ); steam_store_achievements(); -#endif } } else{