Fix for bug #1945335: "SCUMM: Invalid charset id can be stored".
Regressions possible. svn-id: r33552
This commit is contained in:
parent
9034ce2a7c
commit
3047e084c1
4 changed files with 25 additions and 14 deletions
|
@ -277,7 +277,7 @@ CharsetRenderer::CharsetRenderer(ScummEngine *vm) {
|
||||||
_disableOffsX = false;
|
_disableOffsX = false;
|
||||||
|
|
||||||
_vm = vm;
|
_vm = vm;
|
||||||
_curId = 0;
|
_curId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CharsetRenderer::~CharsetRenderer() {
|
CharsetRenderer::~CharsetRenderer() {
|
||||||
|
@ -289,11 +289,15 @@ CharsetRendererCommon::CharsetRendererCommon(ScummEngine *vm)
|
||||||
_shadowColor = 0;
|
_shadowColor = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharsetRendererCommon::setCurID(byte id) {
|
void CharsetRendererCommon::setCurID(int32 id) {
|
||||||
|
if (id == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
assertRange(0, id, _vm->_numCharsets - 1, "charset");
|
assertRange(0, id, _vm->_numCharsets - 1, "charset");
|
||||||
|
|
||||||
_curId = id;
|
_curId = id;
|
||||||
|
|
||||||
|
debug(0, "boo %d", id);
|
||||||
_fontPtr = _vm->getResourceAddress(rtCharset, id);
|
_fontPtr = _vm->getResourceAddress(rtCharset, id);
|
||||||
if (_fontPtr == 0)
|
if (_fontPtr == 0)
|
||||||
error("CharsetRendererCommon::setCurID: charset %d not found!", id);
|
error("CharsetRendererCommon::setCurID: charset %d not found!", id);
|
||||||
|
@ -308,7 +312,10 @@ void CharsetRendererCommon::setCurID(byte id) {
|
||||||
_numChars = READ_LE_UINT16(_fontPtr + 2);
|
_numChars = READ_LE_UINT16(_fontPtr + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharsetRendererV3::setCurID(byte id) {
|
void CharsetRendererV3::setCurID(int32 id) {
|
||||||
|
if (id == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
assertRange(0, id, _vm->_numCharsets - 1, "charset");
|
assertRange(0, id, _vm->_numCharsets - 1, "charset");
|
||||||
|
|
||||||
_curId = id;
|
_curId = id;
|
||||||
|
@ -668,7 +675,8 @@ void CharsetRenderer::translateColor() {
|
||||||
|
|
||||||
void CharsetRenderer::saveLoadWithSerializer(Serializer *ser) {
|
void CharsetRenderer::saveLoadWithSerializer(Serializer *ser) {
|
||||||
static const SaveLoadEntry charsetRendererEntries[] = {
|
static const SaveLoadEntry charsetRendererEntries[] = {
|
||||||
MKLINE(CharsetRenderer, _curId, sleByte, VER(73)),
|
MKLINE_OLD(CharsetRenderer, _curId, sleByte, VER(73), VER(73)),
|
||||||
|
MKLINE(CharsetRenderer, _curId, sleInt32, VER(74)),
|
||||||
MKLINE(CharsetRenderer, _color, sleByte, VER(73)),
|
MKLINE(CharsetRenderer, _color, sleByte, VER(73)),
|
||||||
MKEND()
|
MKEND()
|
||||||
};
|
};
|
||||||
|
@ -988,7 +996,10 @@ CharsetRendererNut::~CharsetRendererNut() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharsetRendererNut::setCurID(byte id) {
|
void CharsetRendererNut::setCurID(int32 id) {
|
||||||
|
if (id == -1)
|
||||||
|
return;
|
||||||
|
|
||||||
int numFonts = ((_vm->_game.id == GID_CMI) && (_vm->_game.features & GF_DEMO)) ? 4 : 5;
|
int numFonts = ((_vm->_game.id == GID_CMI) && (_vm->_game.features & GF_DEMO)) ? 4 : 5;
|
||||||
assert(id < numFonts);
|
assert(id < numFonts);
|
||||||
_curId = id;
|
_curId = id;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ScummEngine *_vm;
|
ScummEngine *_vm;
|
||||||
byte _curId;
|
int32 _curId;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CharsetRenderer(ScummEngine *vm);
|
CharsetRenderer(ScummEngine *vm);
|
||||||
|
@ -80,7 +80,7 @@ public:
|
||||||
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
|
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
|
||||||
void translateColor();
|
void translateColor();
|
||||||
|
|
||||||
virtual void setCurID(byte id) = 0;
|
virtual void setCurID(int32 id) = 0;
|
||||||
int getCurID() { return _curId; }
|
int getCurID() { return _curId; }
|
||||||
|
|
||||||
virtual int getFontHeight() = 0;
|
virtual int getFontHeight() = 0;
|
||||||
|
@ -113,7 +113,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
CharsetRendererCommon(ScummEngine *vm);
|
CharsetRendererCommon(ScummEngine *vm);
|
||||||
|
|
||||||
void setCurID(byte id);
|
void setCurID(int32 id);
|
||||||
|
|
||||||
int getFontHeight();
|
int getFontHeight();
|
||||||
};
|
};
|
||||||
|
@ -142,7 +142,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
CharsetRendererNES(ScummEngine *vm) : CharsetRendererCommon(vm) {}
|
CharsetRendererNES(ScummEngine *vm) : CharsetRendererCommon(vm) {}
|
||||||
|
|
||||||
void setCurID(byte id) {}
|
void setCurID(int32 id) {}
|
||||||
void printChar(int chr, bool ignoreCharsetMask);
|
void printChar(int chr, bool ignoreCharsetMask);
|
||||||
void drawChar(int chr, const Graphics::Surface &s, int x, int y);
|
void drawChar(int chr, const Graphics::Surface &s, int x, int y);
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
|
|
||||||
void printChar(int chr, bool ignoreCharsetMask);
|
void printChar(int chr, bool ignoreCharsetMask);
|
||||||
void drawChar(int chr, const Graphics::Surface &s, int x, int y);
|
void drawChar(int chr, const Graphics::Surface &s, int x, int y);
|
||||||
void setCurID(byte id);
|
void setCurID(int32 id);
|
||||||
void setColor(byte color);
|
void setColor(byte color);
|
||||||
int getCharWidth(byte chr);
|
int getCharWidth(byte chr);
|
||||||
};
|
};
|
||||||
|
@ -168,7 +168,7 @@ class CharsetRendererV2 : public CharsetRendererV3 {
|
||||||
public:
|
public:
|
||||||
CharsetRendererV2(ScummEngine *vm, Common::Language language);
|
CharsetRendererV2(ScummEngine *vm, Common::Language language);
|
||||||
|
|
||||||
void setCurID(byte id) {}
|
void setCurID(int32 id) {}
|
||||||
int getCharWidth(byte chr) { return 8; }
|
int getCharWidth(byte chr) { return 8; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ public:
|
||||||
|
|
||||||
void printChar(int chr, bool ignoreCharsetMask);
|
void printChar(int chr, bool ignoreCharsetMask);
|
||||||
|
|
||||||
void setCurID(byte id);
|
void setCurID(int32 id);
|
||||||
|
|
||||||
int getFontHeight();
|
int getFontHeight();
|
||||||
int getCharHeight(byte chr);
|
int getCharHeight(byte chr);
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace Scumm {
|
||||||
* only saves/loads those which are valid for the version of the savegame
|
* only saves/loads those which are valid for the version of the savegame
|
||||||
* which is being loaded/saved currently.
|
* which is being loaded/saved currently.
|
||||||
*/
|
*/
|
||||||
#define CURRENT_VER 73
|
#define CURRENT_VER 74
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An auxillary macro, used to specify savegame versions. We use this instead
|
* An auxillary macro, used to specify savegame versions. We use this instead
|
||||||
|
|
|
@ -560,7 +560,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
int _numLocalScripts, _numImages, _numRooms, _numScripts, _numSounds; // Used by HE games
|
int _numLocalScripts, _numImages, _numRooms, _numScripts, _numSounds; // Used by HE games
|
||||||
int _numCostumes; // FIXME - should be protected, used by Actor::remapActorPalette
|
int _numCostumes; // FIXME - should be protected, used by Actor::remapActorPalette
|
||||||
int _numCharsets; // FIXME - should be protected, used by CharsetRenderer
|
int32 _numCharsets; // FIXME - should be protected, used by CharsetRenderer
|
||||||
|
|
||||||
BaseCostumeLoader *_costumeLoader;
|
BaseCostumeLoader *_costumeLoader;
|
||||||
BaseCostumeRenderer *_costumeRenderer;
|
BaseCostumeRenderer *_costumeRenderer;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue