aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorDenis Kasak2009-06-17 23:11:24 +0000
committerDenis Kasak2009-06-17 23:11:24 +0000
commitefef9e4eff421a150331b1af23b669ddb4cce0dd (patch)
treee856390035e22e75a5aefc4446bc79c8809e73da /engines
parent1712db9112dbfb2948a23b2aa2a22023041b52e3 (diff)
downloadscummvm-rg350-efef9e4eff421a150331b1af23b669ddb4cce0dd.tar.gz
scummvm-rg350-efef9e4eff421a150331b1af23b669ddb4cce0dd.tar.bz2
scummvm-rg350-efef9e4eff421a150331b1af23b669ddb4cce0dd.zip
Added kNumColours constant and replaced magic numbers with it.
svn-id: r41617
Diffstat (limited to 'engines')
-rw-r--r--engines/draci/draci.cpp4
-rw-r--r--engines/draci/screen.cpp10
-rw-r--r--engines/draci/screen.h4
3 files changed, 11 insertions, 7 deletions
diff --git a/engines/draci/draci.cpp b/engines/draci/draci.cpp
index 1ee757ccb3..3cc89abe1d 100644
--- a/engines/draci/draci.cpp
+++ b/engines/draci/draci.cpp
@@ -131,7 +131,7 @@ int DraciEngine::go() {
return 0;
}
- _screen->setPalette(f->_data, 0, 256);
+ _screen->setPalette(f->_data, 0, kNumColours);
// Fill screen with white
_screen->fillScreen(255);
@@ -187,7 +187,7 @@ int DraciEngine::go() {
}
Sprite sp(f->_data, f->_length, 0, 0, true);
- CursorMan.pushCursorPalette(_screen->getPalette(), 0, 256);
+ CursorMan.pushCursorPalette(_screen->getPalette(), 0, kNumColours);
CursorMan.pushCursor(sp._data, sp._width, sp._height, sp._width / 2, sp._height / 2);
CursorMan.showMouse(true);
diff --git a/engines/draci/screen.cpp b/engines/draci/screen.cpp
index ff6fc5856f..0a84a24c1b 100644
--- a/engines/draci/screen.cpp
+++ b/engines/draci/screen.cpp
@@ -30,11 +30,13 @@
namespace Draci {
+const uint16 kNumColours = 256;
+
Screen::Screen(DraciEngine *vm) : _vm(vm) {
_surface = new Graphics::Surface();
_surface->create(_vm->_screenWidth, _vm->_screenHeight, 1);
this->clearScreen();
- _palette = new byte[4 * 256];
+ _palette = new byte[4 * kNumColours];
setPaletteEmpty();
}
@@ -45,7 +47,7 @@ Screen::~Screen() {
}
void Screen::setPaletteEmpty(unsigned int numEntries) {
- for (unsigned int i = 0; i < numEntries * 4; ++i) {
+ for (unsigned int i = 0; i < 4 * numEntries; ++i) {
_palette[i] = 0;
}
@@ -55,7 +57,7 @@ void Screen::setPaletteEmpty(unsigned int numEntries) {
void Screen::setPalette(byte *data, uint16 start, uint16 num) {
- Common::MemoryReadStream pal(data, 256 * 3);
+ Common::MemoryReadStream pal(data, 3 * kNumColours);
pal.seek(start * 4);
// Copy the palette
@@ -68,7 +70,7 @@ void Screen::setPalette(byte *data, uint16 start, uint16 num) {
// TODO: Investigate why this is needed
// Shift the palette one bit to the left to make it brighter
- for (unsigned int i = 0; i < 4 * 256; ++i) {
+ for (unsigned int i = 0; i < 4 * kNumColours; ++i) {
_palette[i] <<= 2;
}
diff --git a/engines/draci/screen.h b/engines/draci/screen.h
index 8033fa7f53..08c9f4b4b7 100644
--- a/engines/draci/screen.h
+++ b/engines/draci/screen.h
@@ -32,6 +32,8 @@
namespace Draci {
+extern const uint16 kNumColours;
+
class DraciEngine;
class Screen {
@@ -40,7 +42,7 @@ public:
Screen(DraciEngine *vm);
~Screen();
- void setPaletteEmpty(unsigned int numEntries = 256);
+ void setPaletteEmpty(unsigned int numEntries = kNumColours);
void setPalette(byte *data, uint16 start, uint16 num);
byte *getPalette() const;
void copyToScreen() const;