diff options
author | yinsimei | 2017-06-03 21:10:38 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2017-07-13 18:27:45 +0200 |
commit | a589fac89527f2aebe8c5685d5f4620fc30b20f1 (patch) | |
tree | ec7ba4f78eae939da5938a84f247915ac60b399c | |
parent | 30eef2568cc77ae8a5cebf11ea63912fef7d6e2d (diff) | |
download | scummvm-rg350-a589fac89527f2aebe8c5685d5f4620fc30b20f1.tar.gz scummvm-rg350-a589fac89527f2aebe8c5685d5f4620fc30b20f1.tar.bz2 scummvm-rg350-a589fac89527f2aebe8c5685d5f4620fc30b20f1.zip |
SLUDGE: fix sprite flickering by using a full screen surface
-rw-r--r-- | engines/sludge/backdrop.cpp | 7 | ||||
-rw-r--r-- | engines/sludge/main_loop.cpp | 2 | ||||
-rw-r--r-- | engines/sludge/sludger.cpp | 4 | ||||
-rw-r--r-- | engines/sludge/sprites.cpp | 6 |
4 files changed, 10 insertions, 9 deletions
diff --git a/engines/sludge/backdrop.cpp b/engines/sludge/backdrop.cpp index bd087766c9..1079b57d94 100644 --- a/engines/sludge/backdrop.cpp +++ b/engines/sludge/backdrop.cpp @@ -45,10 +45,12 @@ #include "graphics/palette.h" #include "sludge.h" #include "imgloader.h" +#include "common/rect.h" namespace Sludge { extern inputType input; +extern Graphics::Surface renderSurface; bool freeze(); void unfreeze(bool); // Because FREEZE.H needs a load of other includes @@ -536,10 +538,7 @@ inline int sortOutPCamera(int cX, int fX, int sceneMax, int boxMax) { } void drawBackDrop() { - g_system->copyRectToScreen(backdropSurface.getPixels(), - backdropSurface.pitch, 0, 0, backdropSurface.w, - backdropSurface.h); - g_system->updateScreen(); + renderSurface.copyRectToSurface(backdropSurface, 0, 0, Common::Rect(0, 0, backdropSurface.w, backdropSurface.h)); #if 0 setPrimaryColor(1.0, 1.0, 1.0, 1.0); diff --git a/engines/sludge/main_loop.cpp b/engines/sludge/main_loop.cpp index 55e2fc6f6d..14ffed0595 100644 --- a/engines/sludge/main_loop.cpp +++ b/engines/sludge/main_loop.cpp @@ -100,6 +100,7 @@ extern int specialSettings; extern inputType input; extern variableStack *noStack; extern Graphics::Surface backdropSurface; +Graphics::Surface renderSurface; int dialogValue = 0; @@ -473,6 +474,7 @@ int main_loop(char *filename) SDL_EnableUNICODE(1); #endif + renderSurface.create(g_system->getWidth(), g_system->getHeight(), g_system->getScreenFormat()); weAreDoneSoQuit = 0; while (!weAreDoneSoQuit) { checkInput(); diff --git a/engines/sludge/sludger.cpp b/engines/sludge/sludger.cpp index aca52728d5..9f802283dd 100644 --- a/engines/sludge/sludger.cpp +++ b/engines/sludge/sludger.cpp @@ -76,6 +76,7 @@ extern char *launchMe; extern variable *launchResult; extern bool reallyWantToQuit; +extern Graphics::Surface renderSurface; int numBIFNames = 0; char * *allBIFNames = NULL; @@ -715,7 +716,8 @@ void sludgeDisplay() { viewSpeech();// ...and anything being said drawStatusBar(); displayCursor(); - + g_system->copyRectToScreen((byte *)renderSurface.getPixels(), renderSurface.pitch, 0, 0, renderSurface.w, renderSurface.h); + g_system->updateScreen(); if (brightnessLevel < 255) fixBrightness();// This is for transitionLevel special effects #if 0 glFlush(); diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp index baa10da783..ef6d5218e3 100644 --- a/engines/sludge/sprites.cpp +++ b/engines/sludge/sprites.cpp @@ -48,6 +48,7 @@ extern GLuint backdropTextureName; extern inputType input; extern int cameraX, cameraY; extern float cameraZoom; +extern Graphics::Surface renderSurface; unsigned char currentBurnR = 0, currentBurnG = 0, currentBurnB = 0; @@ -615,10 +616,7 @@ bool scaleSprite(sprite &single, const spritePalette &fontPal, onScreenPerson *t // Use Transparent surface to scale and blit Graphics::TransparentSurface tmp(single.surface, false); - Graphics::Surface *screen = g_system->lockScreen(); - tmp.blit(*screen, x1, y1, (mirror? Graphics::FLIP_H : Graphics::FLIP_NONE), nullptr, TS_ARGB(255, 255, 255, 255), diffX, diffY); - g_system->unlockScreen(); - g_system->updateScreen(); + tmp.blit(renderSurface, x1, y1, (mirror? Graphics::FLIP_H : Graphics::FLIP_NONE), nullptr, TS_ARGB(255, 255, 255, 255), diffX, diffY); #if 0 GLfloat z; |