From 79711f4dcd05f300fb01a17ea696e7630a33c3a4 Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 25 May 2019 16:57:25 +0200 Subject: [PATCH] Avoid double copying on video playback --- SourceX/miniwin/ddraw.h | 1 + SourceX/storm/storm.cpp | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/SourceX/miniwin/ddraw.h b/SourceX/miniwin/ddraw.h index f6069ce04..1704192d9 100644 --- a/SourceX/miniwin/ddraw.h +++ b/SourceX/miniwin/ddraw.h @@ -9,6 +9,7 @@ extern SDL_Texture *texture; extern SDL_Surface *surface; extern SDL_Palette *palette; extern SDL_Surface *pal_surface; +extern bool bufferUpdated; struct StubDraw : public IDirectDraw { public: diff --git a/SourceX/storm/storm.cpp b/SourceX/storm/storm.cpp index 7598c3aae..2a4a2e816 100644 --- a/SourceX/storm/storm.cpp +++ b/SourceX/storm/storm.cpp @@ -588,13 +588,13 @@ BOOL SVidPlayContinue(void) return SVidLoadNextFrame(); // Skip video if the system is to slow } - SDL_Rect pal_surface_offset = { 64, 160, 0, 0 }; - if (SDL_BlitSurface(SVidSurface, NULL, pal_surface, &pal_surface_offset) <= -1) { + if (SDL_BlitSurface(SVidSurface, NULL, surface, NULL) <= -1) { SDL_Log(SDL_GetError()); return false; } - SetFadeLevel(256); // present frame + bufferUpdated = true; + lpDDSPrimary->Unlock(NULL); double now = SDL_GetTicks() * 1000; if (now < SVidFrameEnd) {