LRU dummy
[carveJwlIkooP6JGAAIwe30JlM.git] / ent_skateshop.h
1 #ifndef ENT_SKATESHOP_H
2 #define ENT_SKATESHOP_H
3
4 #include "world.h"
5 #include "world_load.h"
6 #include "player.h"
7 #include "vg/vg_steam_remote_storage.h"
8 #include "workshop.h"
9 #include "addon.h"
10
11 #define SKATESHOP_BOARD_CACHE_MAX 10
12 #define SKATESHOP_VIEW_SLOT_MAX 6
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 reg_index;
31 addon_reg *reg_ptr;
32
33 u32 ref_count;
34
35 struct cache_board *left, *right;
36 /* double last_use_time; */
37 }
38 *cache, *cache_head, *cache_tail;
39
40 SDL_SpinLock sl_cache_access;
41
42 struct shop_view_slot{
43 struct cache_board *cache_ptr;
44 float view_blend;
45 }
46 shop_view_slots[ SKATESHOP_VIEW_SLOT_MAX ];
47
48 u32 selected_world_id,
49 selected_board_id,
50 pointcloud_world_id;
51
52 struct {
53 const char *item_title, *item_desc;
54 u32 reg_id;
55
56 const char *world_title, *world_loc;
57 u32 world_reg;
58 }
59 render;
60 }
61 static global_skateshop={.render={.reg_id=0xffffffff,.world_reg=0xffffffff}};
62
63 VG_STATIC void global_skateshop_exit(void);
64 VG_STATIC void watch_cache_board( struct cache_board *ptr );
65 VG_STATIC void unwatch_cache_board( struct cache_board *ptr );
66 VG_STATIC struct cache_board *lru_volatile_cache_board(void);
67
68 #endif /* ENT_SKATESHOP_H */