add skybox editor
[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 "vg/vg_steam_auth.h"
10 #include "vg/vg_steam_ugc.h"
11 #include "vg/vg_steam_friends.h"
12 #include "steam.h"
13 #include "ent_skateshop.h"
14
15 struct async_workshop_filepath_info{
16 PublishedFileId_t id;
17 char *buf;
18 u32 len;
19 };
20
21 struct async_workshop_installed_files_info{
22 PublishedFileId_t *buffer;
23 u32 *len; /* inout */
24 };
25
26 struct async_workshop_metadata_info{
27 struct workshop_file_info *info;
28 const char *path;
29 };
30
31
32 #define WORKSHOP_VIEW_PER_PAGE 15
33
34 struct workshop_form{
35 enum workshop_op {
36 k_workshop_op_none,
37 k_workshop_op_downloading_submission,
38 k_workshop_op_publishing_update,
39 k_workshop_op_loading_model
40 }
41 op;
42
43 struct {
44 char title[80];
45 char description[512];
46 char author[32];
47 i32 submission_type_selection;
48 enum addon_type type;
49
50 PublishedFileId_t file_id; /* 0 if not published yet */
51
52 i32 visibility;
53 int submit_title, /* set if the respective controls are touched */
54 submit_description,
55 submit_file_and_image;
56 }
57 submission;
58
59 enum workshop_form_page{
60 k_workshop_form_hidden,
61 k_workshop_form_open, /* open but not looking at anything */
62 k_workshop_form_edit, /* editing a submission */
63 k_workshop_form_cclosing,
64 k_workshop_form_closing_good, /* post upload screen */
65 k_workshop_form_closing_bad,
66 }
67 page;
68
69 /* model viewer
70 * -----------------------------
71 */
72
73 char addon_folder[128];
74 struct player_board board_model;
75 struct player_model player_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 static int workshop_submit_command( int argc, const char *argv[] );
136 static void async_workshop_get_filepath( void *data, u32 len );
137 static void async_workshop_get_installed_files( void *data, u32 len );
138 static void workshop_load_metadata( const char *path,
139 struct workshop_file_info *info );
140
141 #endif /* WORKSHOP_H */