return;
}
+ /* TODO: we definitely need a different, robust interface for this
+ *
+ * msg_frame f = msg_get_frame( hello )
+ * msg_kv kv = get_kv( f, "" );
+ * if( kv.type == unsigned )
+ * ...
+ */
+
enum workshop_file_type type = k_workshop_file_type_none;
vg_msg msg;
vg_msg_init( &msg, reg->metadata, reg->metadata_len );
}
struct cache_board *cache_ptr = skateshop_selected_cache_if_loaded();
- if( !cache_ptr ) return;
+ if( !cache_ptr ){
+ global_skateshop.render.item_title = "";
+ global_skateshop.render.item_desc = "";
+ return;
+ }
+
+ if( global_skateshop.render.reg_id != global_skateshop.selected_board_id ){
+ addon_reg *reg = cache_ptr->reg_ptr;
+ vg_msg msg;
+ vg_msg_init( &msg, reg->metadata, reg->metadata_len );
+
+ vg_msg_cmd cmd;
+ while( vg_msg_next( &msg, &cmd ) ){
+ if( (msg.depth == 1) && (cmd.code == k_vg_msg_code_frame) ){
+ if( VG_STRDJB2_EQ( "workshop", cmd.key, cmd.key_djb2 ) ){
+ u32 depth = msg.depth;
+ while( (msg.depth == depth) && vg_msg_next( &msg, &cmd ) ){
+ if( cmd.code == k_vg_msg_code_kvstring ){
+ if( VG_STRDJB2_EQ( "title", cmd.key, cmd.key_djb2 ) ){
+ global_skateshop.render.item_title = cmd.value._buf;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ global_skateshop.render.reg_id = global_skateshop.selected_board_id;
+ }
addon_reg *reg = cache_ptr->reg_ptr;
* ----------------------------------------------------------------- */
m3x3_zero( mlocal );
m3x3_setdiagonalv3( mlocal, (v3f){ scale, scale, thickness } );
- mlocal[3][0] = -font3d_string_width( &gui.font, 0, "Flubber" );
+ mlocal[3][0] = -font3d_string_width( &gui.font, 0,
+ global_skateshop.render.item_title );
mlocal[3][0] *= scale*0.5f;
mlocal[3][1] = 0.1f;
mlocal[3][2] = 0.0f;
m4x3_mul( mtext, mlocal, mmdl );
- font3d_simple_draw( &gui.font, 0, "Flubber", &main_camera, mmdl );
+ font3d_simple_draw( &gui.font, 0, global_skateshop.render.item_title,
+ &main_camera, mmdl );
/* Author name
* ----------------------------------------------------------------- */
}
shop_view_slots[ SKATESHOP_VIEW_SLOT_MAX ];
-#if 0
- struct registry_board{
- PublishedFileId_t workshop_id;
-
- /* only for steam workshop files */
- //struct workshop_file_info workshop;
- struct cache_board *cache_ptr;
-
- char foldername[64]; /* if workshop, string version of its published ID. */
- u32 foldername_hash;
-
- enum registry_board_state{
- k_registry_board_state_none,
- k_registry_board_state_indexed,
- k_registry_board_state_indexed_absent /*was found but is now missing*/
- }
- state;
- }
- *registry;
- u32 t1_registry_count,
- registry_count;
-
- /* worlds */
- struct registry_world{
- PublishedFileId_t workshop_id;
- enum registry_board_state state;
- char foldername[64];
- u32 foldername_hash;
- enum world_load_type type;
-
-#if 0
- int meta_present;
- ent_worldinfo info;
-#endif
- }
- *world_registry;
- u32 t1_world_registry_count,
- world_registry_count;
-#endif
u32 selected_world_id,
selected_board_id,
pointcloud_world_id;
+
+ struct {
+ const char *item_title, *item_desc;
+ u32 reg_id;
+ }
+ render;
}
-static global_skateshop;
+static global_skateshop={.render={.reg_id=0xffffffff}};
VG_STATIC void global_skateshop_exit(void);
VG_STATIC void watch_cache_board( struct cache_board *ptr );