A complete workshop implementation, I guess
[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_VIEW_SLOT_MAX 6
12 #define SKATESHOP_REGISTRYID_NONE 0xffffffff
13
14 struct{
15 v3f look_target;
16 ent_skateshop *ptr_ent;
17
18 int active;
19 float factive;
20
21 struct cache_board{
22 enum cache_board_state{
23 k_cache_board_state_none,
24 k_cache_board_state_loaded,
25 k_cache_board_state_load_request
26 }
27 state;
28
29 struct player_board board;
30 u32 registry_id;
31
32 u32 ref_count;
33 double last_use_time;
34 }
35 *cache;
36 SDL_SpinLock sl_cache_access;
37
38 struct shop_view_slot{
39 struct cache_board *cache_ptr;
40 float view_blend;
41 }
42 shop_view_slots[ SKATESHOP_VIEW_SLOT_MAX ];
43
44 struct registry_board{
45 PublishedFileId_t workshop_id;
46
47 /* only for steam workshop files */
48 struct workshop_file_info workshop;
49 struct cache_board *cache_ptr;
50
51 char filename[64]; /* if workshop, string version of its published ID. */
52 u32 filename_hash;
53
54 enum registry_board_state{
55 k_registry_board_state_none,
56 k_registry_board_state_indexed,
57 k_registry_board_state_indexed_absent /*was found but is now missing*/
58 }
59 state;
60 }
61 *registry;
62 u32 t1_registry_count,
63 registry_count;
64
65 u32 selected_registry_id;
66 float interaction_cooldown;
67 }
68 static global_skateshop;
69
70 VG_STATIC void watch_cache_board( struct cache_board *ptr );
71 VG_STATIC void unwatch_cache_board( struct cache_board *ptr );
72
73 #endif /* ENT_SKATESHOP_H */