From 975a232cfb08410177af2ba06251e4c553780e7b Mon Sep 17 00:00:00 2001 From: Aki Date: Mon, 31 Jan 2022 22:19:15 +0100 Subject: Removed AVI recording functionality --- Stars45/Game.cpp | 140 +------------------------------------------------------ 1 file changed, 1 insertion(+), 139 deletions(-) (limited to 'Stars45/Game.cpp') diff --git a/Stars45/Game.cpp b/Stars45/Game.cpp index 93fd3dd..a596776 100644 --- a/Stars45/Game.cpp +++ b/Stars45/Game.cpp @@ -49,7 +49,6 @@ #include "Video.h" #include "VideoFactory.h" #include "VideoSettings.h" -#include "AviFile.h" #include "ContentBundle.h" // +--------------------------------------------------------------------+ @@ -91,7 +90,7 @@ Game::Game() gamma(128), max_tex_size(2048), screen(0), totaltime(0), hInst(0), hwnd(0), frame_rate(0), frame_count(0), frame_count0(0), frame_time(0), frame_time0(0), gui_seconds(0), content(0), - status(Game::OK), exit_code(0), window_style(0), avi_file(0) + status(Game::OK), exit_code(0), window_style(0) { if (!game) { panicbuf[0] = 0; @@ -125,7 +124,6 @@ Game::~Game() delete video; delete soundcard; delete video_settings; - delete avi_file; if (status == EXIT) ShowStats(); @@ -1026,33 +1024,6 @@ Game::UpdateScreen() if (!screen || !video) return; if (screen->Refresh()) { - if (Keyboard::KeyDown(VK_F12)) { - if (Keyboard::KeyDown(VK_SHIFT)) { - if (!avi_file) { - AVICapture(); // begin capturing - SetMaxFrameLength(MAX_FRAME_TIME_VIDEO); - } - else { - delete avi_file; // end capture; - avi_file = 0; - SetMaxFrameLength(MAX_FRAME_TIME_NORMAL); - } - } - else { - if (!avi_file) { - ScreenCapture(); - } - else { - delete avi_file; // end capture; - avi_file = 0; - SetMaxFrameLength(MAX_FRAME_TIME_NORMAL); - } - } - } - else if (avi_file) { - AVICapture(); // continue capturing... - } - video->Present(); } else { @@ -1118,115 +1089,6 @@ Game::GetScreenHeight() // +--------------------------------------------------------------------+ void -Game::ScreenCapture(const char* name) -{ - if (server || !video || !screen) return; - - static DWORD last_shot = 0; - static DWORD shot_num = 1; - DataLoader* loader = DataLoader::GetLoader(); - char filename[256]; - - if (!name && (real_time - last_shot) < 1000) - return; - - // try not to overwrite existing screen shots... - if (loader) { - bool use_file_sys = loader->IsFileSystemEnabled(); - loader->UseFileSystem(true); - loader->SetDataPath(0); - List shot_list; - loader->ListFiles("*.PCX", shot_list); - loader->UseFileSystem(use_file_sys); - - for (int i = 0; i < shot_list.size(); i++) { - Text* s = shot_list[i]; - int n = 0; - - sscanf_s(s->data()+1, "%d", &n); - if (shot_num <= (DWORD) n) - shot_num = n+1; - } - - shot_list.destroy(); - } - - if (name) - strcpy_s(filename, name); - else - sprintf_s(filename, "A%d.PCX", shot_num++); //-V576 - - Bitmap bmp; - - if (video && video->Capture(bmp)) { - PcxImage pcx(bmp.Width(), bmp.Height(), (LPDWORD) bmp.HiPixels()); - pcx.Save((char*) filename); - } - - last_shot = real_time; -} - -// +--------------------------------------------------------------------+ - -void -Game::AVICapture(const char* name) -{ - if (server || !video || !screen) return; - - if (!avi_file) { - char filename[256]; - Bitmap bmp; - DataLoader* loader = DataLoader::GetLoader(); - DWORD avi_num = 1; - - // try not to overwrite existing screen shots... - if (loader) { - bool use_file_sys = loader->IsFileSystemEnabled(); - loader->UseFileSystem(true); - loader->SetDataPath(0); - List avi_list; - loader->ListFiles("*.avi", avi_list); - loader->UseFileSystem(use_file_sys); - - for (int i = 0; i < avi_list.size(); i++) { - Text* s = avi_list[i]; - int n = 0; - - sscanf_s(s->data()+1, "%d", &n); - if (avi_num <= (DWORD) n) - avi_num = n+1; - } - - avi_list.destroy(); - } - - if (name) - strcpy_s(filename, name); - else - sprintf_s(filename, "A%d.avi", avi_num); //-V576 - - if (video && video->Capture(bmp)) { - //bmp.ScaleTo(bmp.Width()/2, bmp.Height()/2); - avi_file = new(__FILE__,__LINE__) AviFile(filename, Rect(0,0,bmp.Width(),bmp.Height()), VIDEO_FPS); - } - - } - - else { - Bitmap bmp; - - if (video && video->Capture(bmp)) { - //bmp.ScaleTo(bmp.Width()/2, bmp.Height()/2); - avi_file->AddFrame(bmp); - } - } -} - - - -// +--------------------------------------------------------------------+ - -void Game::CollectStats() { frame_count++; -- cgit v1.1