minor final stuff
[carveJwlIkooP6JGAAIwe30JlM.git] / workshop.h
1 #ifndef WORKSHOP_H
2 #define WORKSHOP_H
3
4 #define VG_GAME
5 #include "addon_types.h"
6 #include "vg/vg.h"
7 #include "vg/vg_steam_remote_storage.h"
8 #include "skaterift.h"
9 #include "pointcloud.h"
10 #include "vg/vg_steam_auth.h"
11 #include "vg/vg_steam_ugc.h"
12 #include "vg/vg_steam_friends.h"
13 #include "steam.h"
14 #include "ent_skateshop.h"
15
16 struct async_workshop_filepath_info{
17 PublishedFileId_t id;
18 char *buf;
19 u32 len;
20 };
21
22 struct async_workshop_installed_files_info{
23 PublishedFileId_t *buffer;
24 u32 *len; /* inout */
25 };
26
27 struct async_workshop_metadata_info{
28 struct workshop_file_info *info;
29 const char *path;
30 };
31
32
33 #define WORKSHOP_VIEW_PER_PAGE 15
34
35 struct workshop_form{
36 enum workshop_op {
37 k_workshop_op_none,
38 k_workshop_op_downloading_submission,
39 k_workshop_op_publishing_update,
40 k_workshop_op_loading_model
41 }
42 op;
43
44 struct {
45 char title[80];
46 char description[512];
47 char author[32];
48 struct ui_dropdown_value submission_type_selection;
49 enum addon_type type;
50
51 PublishedFileId_t file_id; /* 0 if not published yet */
52
53 struct ui_dropdown_value visibility;
54 int submit_title, /* set if the respective controls are touched */
55 submit_description,
56 submit_file_and_image;
57 }
58 submission;
59
60 enum workshop_form_page{
61 k_workshop_form_hidden,
62 k_workshop_form_open, /* open but not looking at anything */
63 k_workshop_form_edit, /* editing a submission */
64 k_workshop_form_cclosing,
65 k_workshop_form_closing_good, /* post upload screen */
66 k_workshop_form_closing_bad,
67 }
68 page;
69
70 /* model viewer
71 * -----------------------------
72 */
73
74 char addon_folder[128];
75 struct player_board board_model;
76
77 /* what does the user want to do with the image preview? */
78 enum workshop_form_file_intent{
79 k_workshop_form_file_intent_none, /* loading probably */
80 k_workshop_form_file_intent_new, /* board_model is valid */
81 k_workshop_form_file_intent_keep_old /* just browsing */
82 }
83 file_intent;
84
85 world_instance *view_world;
86 ent_swspreview *ptr_ent;
87 v2f view_angles,
88 view_angles_begin;
89 v3f view_offset,
90 view_offset_begin;
91
92 float view_dist;
93 int view_changed;
94
95 /*
96 * published UGC request
97 * ------------------------------
98 */
99
100 struct {
101 UGCQueryHandle_t handle;
102 EResult result;
103
104 int all_item_count,
105 returned_item_count;
106 }
107 ugc_query;
108
109 /*
110 * UI information
111 * ------------------------------------------
112 */
113
114 const char *failure_or_success_string;
115 char error_msg[256];
116
117 int img_w, img_h;
118 u8 *img_buffer;
119
120 int view_published_page_count,
121 view_published_page_id;
122
123 struct published_file{
124 EResult result;
125 int result_index;
126 char title[80];
127 }
128 published_files_list[WORKSHOP_VIEW_PER_PAGE];
129 int published_files_list_length;
130 }
131 static workshop_form;
132
133
134
135 VG_STATIC int workshop_submit_command( int argc, const char *argv[] );
136 VG_STATIC void async_workshop_get_filepath( void *data, u32 len );
137 VG_STATIC void async_workshop_get_installed_files( void *data, u32 len );
138 VG_STATIC void workshop_load_metadata( const char *path,
139 struct workshop_file_info *info );
140
141 #endif /* WORKSHOP_H */