diff --git a/client/CSpellWindow.cpp b/client/CSpellWindow.cpp index 36c269967..234ac128e 100644 --- a/client/CSpellWindow.cpp +++ b/client/CSpellWindow.cpp @@ -516,13 +516,20 @@ void CSpellWindow::deactivate() void CSpellWindow::turnPageLeft() { if (settings["video"]["spellbookAnimation"].Bool()) + { + CCS->videoh->setScaling(false); CCS->videoh->openAndPlayVideo("PGTRNLFT.SMK", pos.x+13, pos.y+15, screen); + } + } void CSpellWindow::turnPageRight() { if (settings["video"]["spellbookAnimation"].Bool()) + { + CCS->videoh->setScaling(false); CCS->videoh->openAndPlayVideo("PGTRNRGH.SMK", pos.x+13, pos.y+15, screen); + } } void CSpellWindow::keyPressed(const SDL_KeyboardEvent & key) diff --git a/client/CVideoHandler.cpp b/client/CVideoHandler.cpp index 88d0f4c9f..608042bb1 100644 --- a/client/CVideoHandler.cpp +++ b/client/CVideoHandler.cpp @@ -71,6 +71,8 @@ CVideoPlayer::CVideoPlayer() // combination of av_register_input_format() / // av_register_output_format() / av_register_protocol() instead. av_register_all(); + + doScale = true; } bool CVideoPlayer::open(std::string fname) diff --git a/client/CVideoHandler.h b/client/CVideoHandler.h index a826aefd1..f47226857 100644 --- a/client/CVideoHandler.h +++ b/client/CVideoHandler.h @@ -14,6 +14,8 @@ public: virtual bool wait()=0; virtual int curFrame() const =0; virtual int frameCount() const =0; + + virtual void setScaling(bool enabled) =0; }; @@ -40,6 +42,7 @@ public: virtual void close() {}; virtual bool wait() {return false;}; virtual bool open( std::string name ) {return false;}; + void setScaling(bool enabled) override {}; }; @@ -83,6 +86,8 @@ class CVideoPlayer : public IMainVideoPlayer int refreshWait; // Wait several refresh before updating the image int refreshCount; bool doLoop; // loop through video + + bool doScale; bool playVideo(int x, int y, SDL_Surface *dst, bool stopOnKey); bool open(std::string fname, bool loop, bool useOverlay = false); @@ -108,6 +113,8 @@ public: int curFrame() const {return -1;}; int frameCount() const {return -1;}; + void setScaling(bool enabled) override {doScale = enabled;}; + // public to allow access from ffmpeg IO functions std::unique_ptr data; };