diff options
-rw-r--r-- | engines/kyra/screen.cpp | 11 | ||||
-rw-r--r-- | engines/kyra/screen.h | 3 |
2 files changed, 6 insertions, 8 deletions
diff --git a/engines/kyra/screen.cpp b/engines/kyra/screen.cpp index 44b3f53d1a..5b5fab4de0 100644 --- a/engines/kyra/screen.cpp +++ b/engines/kyra/screen.cpp @@ -57,10 +57,8 @@ Screen::~Screen() { delete[] _decodeShapeBuffer; delete[] _animBlockPtr; - if (_vm->gameFlags().platform != Common::kPlatformAmiga) { - for (int i = 0; i < ARRAYSIZE(_palettes); ++i) - delete _palettes[i]; - } + for (uint i = 0; i < _palettes.size(); ++i) + delete _palettes[i]; CursorMan.popAllCursors(); } @@ -123,14 +121,13 @@ bool Screen::init() { memset(_shapePages, 0, sizeof(_shapePages)); - memset(_palettes, 0, sizeof(_palettes)); - const int paletteCount = (_vm->gameFlags().platform == Common::kPlatformAmiga) ? 12 : 4; const int numColors = (_vm->gameFlags().platform == Common::kPlatformAmiga) ? 32 : 256; _screenPalette = new Palette(numColors); assert(_screenPalette); + _palettes.resize(paletteCount); for (int i = 0; i < paletteCount; ++i) { _palettes[i] = new Palette(numColors); assert(_palettes[i]); @@ -2640,7 +2637,7 @@ void Screen::setMouseCursor(int x, int y, const byte *shape) { } Palette &Screen::getPalette(int num) { - assert(num >= 0 && num < (_vm->gameFlags().platform == Common::kPlatformAmiga ? 12 : 4)); + assert(num >= 0 && (uint)num < _palettes.size()); return *_palettes[num]; } diff --git a/engines/kyra/screen.h b/engines/kyra/screen.h index bbc06a7021..b6e64bd5ca 100644 --- a/engines/kyra/screen.h +++ b/engines/kyra/screen.h @@ -29,6 +29,7 @@ #include "common/util.h" #include "common/func.h" #include "common/list.h" +#include "common/array.h" #include "common/rect.h" #include "common/stream.h" @@ -374,7 +375,7 @@ protected: uint8 _sjisInvisibleColor; Palette *_screenPalette; - Palette *_palettes[12]; + Common::Array<Palette *> _palettes; Palette *_internFadePalette; Font _fonts[FID_NUM]; |