loader stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / ent_skateshop.h
1 #ifndef ENT_SKATESHOP_H
2 #define ENT_SKATESHOP_H
3
4 #include "world.h"
5 #include "player.h"
6 #include "vg/vg_steam_remote_storage.h"
7 #include "workshop.h"
8
9 #define SKATESHOP_REGISTRY_MAX 64
10 #define SKATESHOP_BOARD_CACHE_MAX 10
11 #define SKATESHOP_WORLDS_MAX 32
12 #define SKATESHOP_VIEW_SLOT_MAX 6
13 #define SKATESHOP_REGISTRYID_NONE 0xffffffff
14
15 struct{
16 v3f look_target;
17 ent_skateshop *ptr_ent;
18
19 int active;
20 float factive;
21
22 struct cache_board{
23 enum cache_board_state{
24 k_cache_board_state_none,
25 k_cache_board_state_loaded,
26 k_cache_board_state_load_request
27 }
28 state;
29
30 struct player_board board;
31 u32 registry_id;
32
33 u32 ref_count;
34 double last_use_time;
35 }
36 *cache;
37 SDL_SpinLock sl_cache_access;
38
39 struct shop_view_slot{
40 struct cache_board *cache_ptr;
41 float view_blend;
42 }
43 shop_view_slots[ SKATESHOP_VIEW_SLOT_MAX ];
44
45 struct registry_board{
46 PublishedFileId_t workshop_id;
47
48 /* only for steam workshop files */
49 struct workshop_file_info workshop;
50 struct cache_board *cache_ptr;
51
52 char filename[64]; /* if workshop, string version of its published ID. */
53 u32 filename_hash;
54
55 enum registry_board_state{
56 k_registry_board_state_none,
57 k_registry_board_state_indexed,
58 k_registry_board_state_indexed_absent /*was found but is now missing*/
59 }
60 state;
61 }
62 *registry;
63 u32 t1_registry_count,
64 registry_count;
65
66 u32 selected_registry_id;
67
68 /* worlds */
69 struct registry_world{
70 enum registry_board_state state;
71 char foldername[64];
72 u32 foldername_hash;
73
74 int meta_present;
75 ent_worldinfo info;
76 }
77 *world_registry;
78 u32 t1_world_registry_count,
79 world_registry_count,
80 selected_world_id;
81 }
82 static global_skateshop;
83
84 VG_STATIC void watch_cache_board( struct cache_board *ptr );
85 VG_STATIC void unwatch_cache_board( struct cache_board *ptr );
86
87 #endif /* ENT_SKATESHOP_H */