Clear the text surface when loading a saved game, otherwise any text that

was displayed before loading the game will remain.

I hope this is the correct fix.

svn-id: r17382
This commit is contained in:
Torbjörn Andersson 2005-04-05 07:53:46 +00:00
parent 5de9e36ff8
commit 23e4199699
4 changed files with 8 additions and 2 deletions

View file

@ -208,11 +208,11 @@ CharsetRenderer::CharsetRenderer(ScummEngine *vm) {
const int size = _vm->_screenWidth * _vm->_screenHeight; const int size = _vm->_screenWidth * _vm->_screenHeight;
_textSurface.pixels = malloc(size); _textSurface.pixels = malloc(size);
memset(_textSurface.pixels, CHARSET_MASK_TRANSPARENCY, size);
_textSurface.w = _vm->_screenWidth; _textSurface.w = _vm->_screenWidth;
_textSurface.h = _vm->_screenHeight; _textSurface.h = _vm->_screenHeight;
_textSurface.pitch = _vm->_screenWidth; _textSurface.pitch = _vm->_screenWidth;
_textSurface.bytesPerPixel = 1; _textSurface.bytesPerPixel = 1;
clearTextSurface();
} }
CharsetRenderer::~CharsetRenderer() { CharsetRenderer::~CharsetRenderer() {

View file

@ -92,6 +92,7 @@ public:
void restoreCharsetBg(); void restoreCharsetBg();
void clearCharsetMask(); void clearCharsetMask();
void clearTextSurface();
virtual void printChar(int chr) = 0; virtual void printChar(int chr) = 0;
virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {} virtual void drawChar(int chr, const Graphics::Surface &s, int x, int y) {}

View file

@ -887,7 +887,7 @@ void CharsetRenderer::restoreCharsetBg() {
if (vs->hasTwoBuffers) { if (vs->hasTwoBuffers) {
// Clean out the charset mask // Clean out the charset mask
memset(_textSurface.pixels, CHARSET_MASK_TRANSPARENCY, _textSurface.pitch * _textSurface.h); clearTextSurface();
} }
} }
} }
@ -896,6 +896,10 @@ void CharsetRenderer::clearCharsetMask() {
memset(_vm->getResourceAddress(rtBuffer, 9), 0, _vm->gdi._imgBufOffs[1]); memset(_vm->getResourceAddress(rtBuffer, 9), 0, _vm->gdi._imgBufOffs[1]);
} }
void CharsetRenderer::clearTextSurface() {
memset(_textSurface.pixels, CHARSET_MASK_TRANSPARENCY, _textSurface.pitch * _textSurface.h);
}
byte *ScummEngine::getMaskBuffer(int x, int y, int z) { byte *ScummEngine::getMaskBuffer(int x, int y, int z) {
return gdi.getMaskBuffer((x + virtscr[0].xstart) / 8, y, z); return gdi.getMaskBuffer((x + virtscr[0].xstart) / 8, y, z);
} }

View file

@ -311,6 +311,7 @@ bool ScummEngine::loadState(int slot, bool compat) {
// Reset charset mask // Reset charset mask
_charset->_hasMask = false; _charset->_hasMask = false;
_charset->clearTextSurface();
_lastCodePtr = NULL; _lastCodePtr = NULL;
_drawObjectQueNr = 0; _drawObjectQueNr = 0;