@@ -184,10 +184,12 @@ void MovieWriter::set_extensions_hint() {
184184
185185void MovieWriter::add_frame () {
186186 const int movie_time_seconds = Engine::get_singleton ()->get_frames_drawn () / fps;
187- const String movie_time = vformat (" %s:%s:%s" ,
188- String::num (movie_time_seconds / 3600 ).pad_zeros (2 ),
189- String::num ((movie_time_seconds % 3600 ) / 60 ).pad_zeros (2 ),
190- String::num (movie_time_seconds % 60 ).pad_zeros (2 ));
187+ const int frame_remainder = Engine::get_singleton ()->get_frames_drawn () % fps;
188+ const String movie_time = vformat (" %s:%s:%s:%s" ,
189+ String::num (movie_time_seconds / 3600 , 0 ).pad_zeros (2 ),
190+ String::num ((movie_time_seconds % 3600 ) / 60 , 0 ).pad_zeros (2 ),
191+ String::num (movie_time_seconds % 60 , 0 ).pad_zeros (2 ),
192+ String::num (frame_remainder, 0 ).pad_zeros (2 ));
191193
192194#ifdef DEBUG_ENABLED
193195 DisplayServer::get_singleton ()->window_set_title (vformat (" MovieWriter: Frame %d (time: %s) - %s (DEBUG)" , Engine::get_singleton ()->get_frames_drawn (), movie_time, project_name));
@@ -216,7 +218,7 @@ void MovieWriter::end() {
216218 write_end ();
217219
218220 // Print a report with various statistics.
219- print_line (" ----------------" );
221+ print_line (" -------------------------------------------------------------------------------- " );
220222 String movie_path = Engine::get_singleton ()->get_write_movie_path ();
221223 if (movie_path.is_relative_path ()) {
222224 // Print absolute path to make finding the file easier,
@@ -226,19 +228,21 @@ void MovieWriter::end() {
226228 print_line (vformat (" Done recording movie at path: %s" , movie_path));
227229
228230 const int movie_time_seconds = Engine::get_singleton ()->get_frames_drawn () / fps;
229- const String movie_time = vformat (" %s:%s:%s" ,
230- String::num (movie_time_seconds / 3600 ).pad_zeros (2 ),
231- String::num ((movie_time_seconds % 3600 ) / 60 ).pad_zeros (2 ),
232- String::num (movie_time_seconds % 60 ).pad_zeros (2 ));
231+ const int frame_remainder = Engine::get_singleton ()->get_frames_drawn () % fps;
232+ const String movie_time = vformat (" %s:%s:%s:%s" ,
233+ String::num (movie_time_seconds / 3600 , 0 ).pad_zeros (2 ),
234+ String::num ((movie_time_seconds % 3600 ) / 60 , 0 ).pad_zeros (2 ),
235+ String::num (movie_time_seconds % 60 , 0 ).pad_zeros (2 ),
236+ String::num (frame_remainder, 0 ).pad_zeros (2 ));
233237
234238 const int real_time_seconds = Time::get_singleton ()->get_ticks_msec () / 1000 ;
235239 const String real_time = vformat (" %s:%s:%s" ,
236- String::num (real_time_seconds / 3600 ).pad_zeros (2 ),
237- String::num ((real_time_seconds % 3600 ) / 60 ).pad_zeros (2 ),
238- String::num (real_time_seconds % 60 ).pad_zeros (2 ));
240+ String::num (real_time_seconds / 3600 , 0 ).pad_zeros (2 ),
241+ String::num ((real_time_seconds % 3600 ) / 60 , 0 ).pad_zeros (2 ),
242+ String::num (real_time_seconds % 60 , 0 ).pad_zeros (2 ));
239243
240- print_line (vformat (" %d frames at %d FPS (movie length: %s), recorded in %s (%d%% of real-time speed)." , Engine::get_singleton ()->get_frames_drawn (), fps, movie_time, real_time, (float (movie_time_seconds) / real_time_seconds) * 100 ));
244+ print_line (vformat (" %d frames at %d FPS (movie length: %s), recorded in %s (%d%% of real-time speed)." , Engine::get_singleton ()->get_frames_drawn (), fps, movie_time, real_time, (float (MAX ( 1 , movie_time_seconds)) / MAX ( 1 , real_time_seconds) ) * 100 ));
241245 print_line (vformat (" CPU time: %.2f seconds (average: %.2f ms/frame)" , cpu_time / 1000 , cpu_time / Engine::get_singleton ()->get_frames_drawn ()));
242246 print_line (vformat (" GPU time: %.2f seconds (average: %.2f ms/frame)" , gpu_time / 1000 , gpu_time / Engine::get_singleton ()->get_frames_drawn ()));
243- print_line (" ----------------" );
247+ print_line (" -------------------------------------------------------------------------------- " );
244248}
0 commit comments