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