basic replayable replays
[carveJwlIkooP6JGAAIwe30JlM.git] / workshop.c
index d9d576d8e47632b53ea17c7f0d916e24c8499b7f..30ddb5647528410b5cfdbf8debd7c982480fbea0 100644 (file)
@@ -31,8 +31,7 @@ static struct ui_dropdown_opt workshop_form_type_opts[] = {
 /* 
  * Close the form and discard UGC query result
  */
-VG_STATIC void workshop_quit_form(void)
-{
+VG_STATIC void workshop_quit_form(void){
    player_board_unload( &workshop_form.board_model );
    workshop_form.file_intent = k_workshop_form_file_intent_none;
 
@@ -45,6 +44,7 @@ VG_STATIC void workshop_quit_form(void)
    }
 
    workshop_form.page = k_workshop_form_hidden;
+   workshop_form.op = k_workshop_op_none;
 }
 
 /*
@@ -400,32 +400,35 @@ VG_STATIC void _workshop_form_submit_thread( void *data )
 /*
  * Entry point for the publishing submission operation
  */
-VG_STATIC void workshop_op_submit(void)
-{
+VG_STATIC void workshop_op_submit(void){
    /* TODO: Show these errors to the user */
    if( workshop_form.submission.submit_title ){
       if( !workshop_form.submission.title[0] ){
-         vg_error( "Cannot submit because a title is required\n" );
+         ui_start_modal( "Cannot submit because a title is required\n",
+                         UI_MODAL_WARN);
          return;
       }
    }
 
    if( workshop_form.submission.submit_description ){
       if( !workshop_form.submission.description[0] ){
-         vg_error( "Cannot submit because a description is required\n" );
+         ui_start_modal( "Cannot submit because a description is required\n",
+                         UI_MODAL_WARN );
          return;
       }
    }
 
    if( workshop_form.submission.submit_file_and_image ){
       if( workshop_form.file_intent == k_workshop_form_file_intent_none ){
-         vg_error( "Cannot submit because the file is empty or unspecified\n" );
+         ui_start_modal( "Cannot submit because the file is "
+                         "empty or unspecified\n", UI_MODAL_WARN );
          return;
       }
    }
 
    player_board_unload( &workshop_form.board_model );
    workshop_form.file_intent = k_workshop_form_file_intent_none;
+   workshop_form.op = k_workshop_op_publishing_update;
 
    vg_loader_start( _workshop_form_submit_thread, NULL );
 }
@@ -531,11 +534,12 @@ VG_STATIC void workshop_op_load_model(void){
             mdl_arritm( &workshop_form.view_world->ent_swspreview, 0 );
    }
    else{
-      vg_error( "There is no ent_swspreview in the level. "
-                "Cannot publish here\n" );
+      ui_start_modal( "There is no ent_swspreview in the level. \n"
+                      "Cannot publish here\n", UI_MODAL_BAD );
       return;
    }
 
+   workshop_form.op = k_workshop_op_loading_model;
    vg_loader_start( _workshop_form_load_thread, NULL );
 }
 
@@ -631,6 +635,7 @@ VG_STATIC void on_workshop_download_ugcpreview( void *data, void *user )
  */
 VG_STATIC void workshop_op_download_and_view_submission( int result_index )
 {
+   workshop_form.op = k_workshop_op_downloading_submission;
    ISteamUGC *hSteamUGC = SteamAPI_SteamUGC();
    ISteamRemoteStorage *hSteamRemoteStorage = SteamAPI_SteamRemoteStorage();
    SteamUGCDetails_t details;
@@ -993,8 +998,9 @@ VG_STATIC void workshop_render_board_preview(void){
                     sizeof(struct ub_world_lighting), &world->ub_lighting );
 
    render_world( world, &cam, 1 );
-   render_board( &cam, world, board, mmdl,  k_board_shader_entity );
-   render_board( &cam, world, board, mmdl1, k_board_shader_entity );
+   struct board_pose pose = {0};
+   render_board( &cam, world, board, mmdl,  &pose, k_board_shader_entity );
+   render_board( &cam, world, board, mmdl1, &pose, k_board_shader_entity );
 
    glBindFramebuffer( GL_FRAMEBUFFER, 0 );
    glViewport( 0,0, vg.window_x, vg.window_y );
@@ -1425,14 +1431,14 @@ VG_STATIC void workshop_form_gui(void)
                               "the current operation that is running.";
 
       switch( skaterift.op ){
-         case k_workshop_form_op_loading_model:
+         case k_workshop_op_loading_model:
             op_string = "Operation in progress: Loading model file.";
          break;
-         case k_workshop_form_op_publishing_update:
+         case k_workshop_op_publishing_update:
             op_string = "Operation in progress: publishing submission update "
                         "to steam.";
          break;
-         case k_workshop_form_op_downloading_submission:
+         case k_workshop_op_downloading_submission:
             op_string = "Operation in progress: downloading existing submission"
                         " from Steam services.";
          break;