diff options
author | Johannes Schickel | 2009-06-25 23:04:21 +0000 |
---|---|---|
committer | Johannes Schickel | 2009-06-25 23:04:21 +0000 |
commit | 7bbad2738ac447f0d91c194017dfa8acbf9c3783 (patch) | |
tree | 786e430a26ab6a51ab411579a0c5161304b3ccdd /engines/kyra | |
parent | fc0d0e2323e1a1bdd8219345af1cdaf1e879d7f4 (diff) | |
download | scummvm-rg350-7bbad2738ac447f0d91c194017dfa8acbf9c3783.tar.gz scummvm-rg350-7bbad2738ac447f0d91c194017dfa8acbf9c3783.tar.bz2 scummvm-rg350-7bbad2738ac447f0d91c194017dfa8acbf9c3783.zip |
Store palettes in a Common::Array instead of a fixed size array.
svn-id: r41891
Diffstat (limited to 'engines/kyra')
-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]; |