mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-05 00:01:55 +00:00
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
@ -277,7 +277,7 @@ CharsetRenderer::CharsetRenderer(ScummEngine *vm) {
|
||||
_disableOffsX = false;
|
||||
|
||||
_vm = vm;
|
||||
_curId = 0;
|
||||
_curId = -1;
|
||||
}
|
||||
|
||||
CharsetRenderer::~CharsetRenderer() {
|
||||
@ -289,11 +289,15 @@ CharsetRendererCommon::CharsetRendererCommon(ScummEngine *vm)
|
||||
_shadowColor = 0;
|
||||
}
|
||||
|
||||
void CharsetRendererCommon::setCurID(byte id) {
|
||||
void CharsetRendererCommon::setCurID(int32 id) {
|
||||
if (id == -1)
|
||||
return;
|
||||
|
||||
assertRange(0, id, _vm->_numCharsets - 1, "charset");
|
||||
|
||||
_curId = id;
|
||||
|
||||
debug(0, "boo %d", id);
|
||||
_fontPtr = _vm->getResourceAddress(rtCharset, id);
|
||||
if (_fontPtr == 0)
|
||||
error("CharsetRendererCommon::setCurID: charset %d not found!", id);
|
||||
@ -308,7 +312,10 @@ void CharsetRendererCommon::setCurID(byte id) {
|
||||
_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");
|
||||
|
||||
_curId = id;
|
||||
@ -668,7 +675,8 @@ void CharsetRenderer::translateColor() {
|
||||
|
||||
void CharsetRenderer::saveLoadWithSerializer(Serializer *ser) {
|
||||
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)),
|
||||
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;
|
||||
assert(id < numFonts);
|
||||
_curId = id;
|
||||
|
@ -67,7 +67,7 @@ public:
|
||||
|
||||
protected:
|
||||
ScummEngine *_vm;
|
||||
byte _curId;
|
||||
int32 _curId;
|
||||
|
||||
public:
|
||||
CharsetRenderer(ScummEngine *vm);
|
||||
@ -80,7 +80,7 @@ public:
|
||||
void addLinebreaks(int a, byte *str, int pos, int maxwidth);
|
||||
void translateColor();
|
||||
|
||||
virtual void setCurID(byte id) = 0;
|
||||
virtual void setCurID(int32 id) = 0;
|
||||
int getCurID() { return _curId; }
|
||||
|
||||
virtual int getFontHeight() = 0;
|
||||
@ -113,7 +113,7 @@ protected:
|
||||
public:
|
||||
CharsetRendererCommon(ScummEngine *vm);
|
||||
|
||||
void setCurID(byte id);
|
||||
void setCurID(int32 id);
|
||||
|
||||
int getFontHeight();
|
||||
};
|
||||
@ -142,7 +142,7 @@ protected:
|
||||
public:
|
||||
CharsetRendererNES(ScummEngine *vm) : CharsetRendererCommon(vm) {}
|
||||
|
||||
void setCurID(byte id) {}
|
||||
void setCurID(int32 id) {}
|
||||
void printChar(int chr, bool ignoreCharsetMask);
|
||||
void drawChar(int chr, const Graphics::Surface &s, int x, int y);
|
||||
|
||||
@ -159,7 +159,7 @@ public:
|
||||
|
||||
void printChar(int chr, bool ignoreCharsetMask);
|
||||
void drawChar(int chr, const Graphics::Surface &s, int x, int y);
|
||||
void setCurID(byte id);
|
||||
void setCurID(int32 id);
|
||||
void setColor(byte color);
|
||||
int getCharWidth(byte chr);
|
||||
};
|
||||
@ -168,7 +168,7 @@ class CharsetRendererV2 : public CharsetRendererV3 {
|
||||
public:
|
||||
CharsetRendererV2(ScummEngine *vm, Common::Language language);
|
||||
|
||||
void setCurID(byte id) {}
|
||||
void setCurID(int32 id) {}
|
||||
int getCharWidth(byte chr) { return 8; }
|
||||
};
|
||||
|
||||
@ -184,7 +184,7 @@ public:
|
||||
|
||||
void printChar(int chr, bool ignoreCharsetMask);
|
||||
|
||||
void setCurID(byte id);
|
||||
void setCurID(int32 id);
|
||||
|
||||
int getFontHeight();
|
||||
int getCharHeight(byte chr);
|
||||
|
@ -50,7 +50,7 @@ namespace Scumm {
|
||||
* only saves/loads those which are valid for the version of the savegame
|
||||
* 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
|
||||
|
@ -560,7 +560,7 @@ protected:
|
||||
public:
|
||||
int _numLocalScripts, _numImages, _numRooms, _numScripts, _numSounds; // Used by HE games
|
||||
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;
|
||||
BaseCostumeRenderer *_costumeRenderer;
|
||||
|
Loading…
x
Reference in New Issue
Block a user