diff options
author | Gregory Montoir | 2007-12-13 19:07:10 +0000 |
---|---|---|
committer | Gregory Montoir | 2007-12-13 19:07:10 +0000 |
commit | e1b73e47f826ebf96db54567a4fade6e1f1c4484 (patch) | |
tree | 8c7bb861ccd0a0e45a189fb1ff02f2cae1b24b42 /engines/cine | |
parent | ee56120fcff9fdbc5a4e068f104c4d4658b43507 (diff) | |
download | scummvm-rg350-e1b73e47f826ebf96db54567a4fade6e1f1c4484.tar.gz scummvm-rg350-e1b73e47f826ebf96db54567a4fade6e1f1c4484.tar.bz2 scummvm-rg350-e1b73e47f826ebf96db54567a4fade6e1f1c4484.zip |
use CLIP template for clipping, made an array static const and renamed MAX_OBJECTDATA to MAX_VAR
svn-id: r29853
Diffstat (limited to 'engines/cine')
-rw-r--r-- | engines/cine/cine.cpp | 4 | ||||
-rw-r--r-- | engines/cine/gfx.cpp | 15 | ||||
-rw-r--r-- | engines/cine/object.cpp | 2 | ||||
-rw-r--r-- | engines/cine/object.h | 4 | ||||
-rw-r--r-- | engines/cine/sound.cpp | 14 |
5 files changed, 13 insertions, 26 deletions
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp index 287de88378..0503dcd616 100644 --- a/engines/cine/cine.cpp +++ b/engines/cine/cine.cpp @@ -136,7 +136,7 @@ void CineEngine::initialize() { objectTable[i].name[0] = 0; } - for (i = 0; i < NUM_MAX_OBJECTDATA; i++) { + for (i = 0; i < NUM_MAX_VAR; i++) { globalVars[i] = 0; } @@ -170,7 +170,7 @@ void CineEngine::initialize() { objScriptList.next = NULL; objScriptList.scriptPtr = NULL; - + globalScriptsHead.next = NULL; globalScriptsHead.scriptPtr = NULL; diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp index 4352f2eba4..40cbc1857d 100644 --- a/engines/cine/gfx.cpp +++ b/engines/cine/gfx.cpp @@ -133,19 +133,10 @@ void setMouseCursor(int cursor) { } } -int8 clipColor(int8 color) { - if (color < 0) - color = 0; - else if (color > 7) - color = 7; - - return color; -} - static uint16 transformColor(uint16 baseColor, int8 r, int8 g, int8 b) { - int8 oriR = clipColor((baseColor & 0x7) + r); - int8 oriG = clipColor(((baseColor & 0x70) >> 4) + g); - int8 oriB = clipColor(((baseColor & 0x700) >> 8) + b); + int8 oriR = CLIP( (baseColor & 0x007) + r, 0, 7); + int8 oriG = CLIP(((baseColor & 0x070) >> 4) + g, 0, 7); + int8 oriB = CLIP(((baseColor & 0x700) >> 8) + b, 0, 7); return oriR | (oriG << 4) | (oriB << 8); } diff --git a/engines/cine/object.cpp b/engines/cine/object.cpp index f8af6ee28a..d3dd075e36 100644 --- a/engines/cine/object.cpp +++ b/engines/cine/object.cpp @@ -36,7 +36,7 @@ namespace Cine { objectStruct objectTable[NUM_MAX_OBJECT]; -uint16 globalVars[NUM_MAX_OBJECTDATA + 1]; +uint16 globalVars[NUM_MAX_VAR]; overlayHeadElement overlayHead; void unloadAllMasks(void) { diff --git a/engines/cine/object.h b/engines/cine/object.h index d7d4e145ff..9dc5dfc7e4 100644 --- a/engines/cine/object.h +++ b/engines/cine/object.h @@ -50,10 +50,10 @@ struct overlayHeadElement { }; #define NUM_MAX_OBJECT 255 -#define NUM_MAX_OBJECTDATA 255 +#define NUM_MAX_VAR 256 extern objectStruct objectTable[NUM_MAX_OBJECT]; -extern uint16 globalVars[NUM_MAX_OBJECTDATA + 1]; +extern uint16 globalVars[NUM_MAX_VAR]; extern overlayHeadElement overlayHead; diff --git a/engines/cine/sound.cpp b/engines/cine/sound.cpp index 479960a1be..7f303a1b79 100644 --- a/engines/cine/sound.cpp +++ b/engines/cine/sound.cpp @@ -304,21 +304,17 @@ void AdlibSoundDriver::initCard() { OPLWriteReg(_opl, 0xBD, _vibrato); OPLWriteReg(_opl, 0x08, 0x40); - int i, j; - int oplRegs[] = { 0x60, 0x80, 0x20, 0xE0 }; + static const int oplRegs[] = { 0x40, 0x60, 0x80, 0x20, 0xE0 }; - for (i = 0; i < 18; ++i) { - OPLWriteReg(_opl, 0x40 | _operatorsTable[i], 0); - } - for (i = 0; i < 9; ++i) { + for (int i = 0; i < 9; ++i) { OPLWriteReg(_opl, 0xB0 | i, 0); } - for (i = 0; i < 9; ++i) { + for (int i = 0; i < 9; ++i) { OPLWriteReg(_opl, 0xC0 | i, 0); } - for (j = 0; j < 4; j++) { - for (i = 0; i < 18; ++i) { + for (int j = 0; j < 5; j++) { + for (int i = 0; i < 18; ++i) { OPLWriteReg(_opl, oplRegs[j] | _operatorsTable[i], 0); } } |