mission is possible 2
[carveJwlIkooP6JGAAIwe30JlM.git] / ent_skateshop.h
index e7acd43255d456db1d2bb291431eafcba768ff58..c368c8d3425cfd3f9592250e6e551b91407712a4 100644 (file)
@@ -2,11 +2,16 @@
 #define ENT_SKATESHOP_H
 
 #include "world.h"
+#include "world_load.h"
 #include "player.h"
+#include "vg/vg_steam_remote_storage.h"
+#include "workshop.h"
 
-#define MAX_LOCAL_BOARDS 64
-#define BILL_TIN_BOARDS  1
-#define MAX_DYNAMIC_BOARDS 9
+#define SKATESHOP_REGISTRY_MAX     64
+#define SKATESHOP_BOARD_CACHE_MAX  10
+#define SKATESHOP_WORLDS_MAX       32
+#define SKATESHOP_VIEW_SLOT_MAX    6
+#define SKATESHOP_REGISTRYID_NONE  0xffffffff
 
 struct{
    v3f look_target;
@@ -15,64 +20,74 @@ struct{
    int active;
    float factive;
 
-   enum skateshop_loc{
-      k_skateshop_loc_page__viewing,
-
-      k_skateshop_loc_select_use,
-      k_skateshop_loc_select_cancel,
-      k_skateshop_loc_select_upload,
-      k_skateshop_loc_page__selected,
-
-      k_skateshop_loc_page__upload,
-   }
-   interface_loc;
-
-   struct dynamic_board
-   {
-      enum dynamic_board_state{
-         k_dynamic_board_state_none,
-         k_dynamic_board_state_loaded,
-         k_dynamic_board_state_loading,
+   struct cache_board{
+      enum cache_board_state{
+         k_cache_board_state_none,
+         k_cache_board_state_loaded,
+         k_cache_board_state_load_request
       }
       state;
 
-      u32 ref_count;
-
       struct player_board board;
-
       u32 registry_id;
 
+      u32 ref_count;
       double last_use_time;
    }
-   *dynamic_boards;
+   *cache;
+   SDL_SpinLock sl_cache_access;
 
-   struct shop_view_slot
-   {
-      struct dynamic_board *db;
+   struct shop_view_slot{
+      struct cache_board *cache_ptr;
       float view_blend;
    }
-   shop_view_slots[6];
+   shop_view_slots[ SKATESHOP_VIEW_SLOT_MAX ];
 
-   struct board_registry
-   {
-      int workshop;
-      u64 uid;
+   struct registry_board{
+      PublishedFileId_t workshop_id;
 
-      struct dynamic_board *dynamic;
+      /* only for steam workshop files */
+      struct workshop_file_info workshop;
+      struct cache_board *cache_ptr;
 
-      char filename[64];   /* if workshop, string version of uid. */
+      char filename[64]; /* if workshop, string version of its published ID. */
       u32 filename_hash;
 
-      int ghost;
+      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 registry_count;
-
-   int loading;
-   float interaction_cooldown;
+   u32 t1_registry_count,
+          registry_count;
 
    u32 selected_registry_id;
+
+   /* worlds */
+   struct registry_world{
+      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,
+       selected_world_id,
+       pointcloud_world_id;
 }
 static global_skateshop;
 
+VG_STATIC void global_skateshop_exit(void);
+VG_STATIC void watch_cache_board( struct cache_board *ptr );
+VG_STATIC void unwatch_cache_board( struct cache_board *ptr );
+
 #endif /* ENT_SKATESHOP_H */