move audio comp to its own thing
[carveJwlIkooP6JGAAIwe30JlM.git] / workshop.h
index 4a0f8b27008347d74cdc574d53fb790ea23b8162..e09faf124d3de0b1467c35fa35a6f02a37e1d92b 100644 (file)
@@ -2,27 +2,16 @@
 #define WORKSHOP_H
 
 #define VG_GAME
+#include "addon_types.h"
 #include "vg/vg.h"
 #include "vg/vg_steam_remote_storage.h"
-
-struct workshop{
-   enum workshop_operation{
-      k_workshop_form_op_none,
-      k_workshop_form_op_loading_model,
-      k_workshop_form_op_downloading_submission,
-      k_workshop_form_op_publishing_update,
-      k_workshop_op_item_scan,
-      k_workshop_op_item_load
-   }
-   operation;
-}
-static workshop;
-
-struct workshop_file_info{
-   u64 author;
-   char author_name[32];
-   char title[64];
-};
+#include "skaterift.h"
+#include "pointcloud.h"
+#include "vg/vg_steam_auth.h"
+#include "vg/vg_steam_ugc.h"
+#include "vg/vg_steam_friends.h"
+#include "steam.h"
+#include "ent_skateshop.h"
 
 struct async_workshop_filepath_info{
    PublishedFileId_t id;
@@ -40,41 +29,114 @@ struct async_workshop_metadata_info{
    const char *path;
 };
 
-VG_STATIC void workshop_file_info_clear( struct workshop_file_info *info )
-{
-   info->author = 0ul;
-   info->author_name[0] = '\0';
-   info->title[0] = '\0';
-}
 
-VG_STATIC void async_workshop_get_filepath( void *data, u32 len );
-VG_STATIC void async_workshop_get_installed_files( void *data, u32 len );
-VG_STATIC void workshop_load_metadata( const char *path,
-                                       struct workshop_file_info *info );
+#define WORKSHOP_VIEW_PER_PAGE 15
 
-/*
- * Start a new operation and crash if we are already running one.
- */
-VG_STATIC int workshop_begin_op( enum workshop_operation op )
-{
-   if( workshop.operation != k_workshop_form_op_none ){
-      vg_error( "Workshop form currently executing op(%d), tried to "
-                "start op(%d)\n", workshop.operation, op );
-      return 0;
+struct workshop_form{
+   enum workshop_op {
+      k_workshop_op_none,
+      k_workshop_op_downloading_submission,
+      k_workshop_op_publishing_update,
+      k_workshop_op_loading_model
    }
-   
-   workshop.operation = op;
-   vg_info( "Starting op( %d )\n", op );
-   return 1;
-}
+   op;
+
+   struct {
+      char title[80];
+      char description[512];
+      char author[32];
+      i32 submission_type_selection;
+      enum addon_type type;
+
+      PublishedFileId_t file_id; /* 0 if not published yet */
+
+      i32 visibility;
+      int submit_title,       /* set if the respective controls are touched */
+          submit_description,
+          submit_file_and_image;
+   } 
+   submission;
+
+   enum workshop_form_page{
+      k_workshop_form_hidden, 
+      k_workshop_form_open,      /* open but not looking at anything */
+      k_workshop_form_edit,      /* editing a submission */
+      k_workshop_form_cclosing,
+      k_workshop_form_closing_good, /* post upload screen */
+      k_workshop_form_closing_bad,  
+   }
+   page;
+
+   /* model viewer 
+    * -----------------------------
+    */
+
+   char addon_folder[128];
+   struct player_board board_model;
+   struct player_model player_model;
+
+   /* what does the user want to do with the image preview? */
+   enum workshop_form_file_intent{
+      k_workshop_form_file_intent_none,         /* loading probably */
+      k_workshop_form_file_intent_new,          /* board_model is valid */
+      k_workshop_form_file_intent_keep_old      /* just browsing */
+   }
+   file_intent;
+
+   world_instance *view_world;
+   ent_swspreview *ptr_ent;
+   v2f view_angles,
+       view_angles_begin;
+   v3f view_offset,
+       view_offset_begin;
+
+   float view_dist;
+   int view_changed;
+
+   /*
+    * published UGC request
+    * ------------------------------
+    */
+
+   struct {
+      UGCQueryHandle_t handle;
+      EResult result;
+
+      int all_item_count,
+          returned_item_count;
+   }
+   ugc_query;
+
+   /* 
+    * UI information
+    * ------------------------------------------
+    */
 
-/*
- * Finished operation, otheres can now run
- */
-VG_STATIC void workshop_end_op(void)
-{
-   vg_info( "Finishing op( %d )\n", workshop.operation );
-   workshop.operation = k_workshop_form_op_none;
+   const char *failure_or_success_string;
+   char error_msg[256];
+
+   int img_w, img_h;
+   u8 *img_buffer;
+
+   int view_published_page_count,
+       view_published_page_id;
+
+   struct published_file{
+      EResult result;
+      int result_index;
+      char title[80];
+   }
+   published_files_list[WORKSHOP_VIEW_PER_PAGE];
+   int published_files_list_length;
 }
+static workshop_form;
+
+
+
+static int workshop_submit_command( int argc, const char *argv[] );
+static void async_workshop_get_filepath( void *data, u32 len );
+static void async_workshop_get_installed_files( void *data, u32 len );
+static void workshop_load_metadata( const char *path,
+                                       struct workshop_file_info *info );
 
 #endif /* WORKSHOP_H */