aboutsummaryrefslogtreecommitdiff
path: root/engines/cine
diff options
context:
space:
mode:
authorStrangerke2014-02-09 20:41:08 +0100
committerStrangerke2014-02-09 20:41:08 +0100
commit2937727018eef69c30a758a31b6fe3a6158ee35e (patch)
treecf6e226b6b0f4e5edccc2606bca92a8d32c82bf6 /engines/cine
parent78eff8fea96bf0391fa50410950b44917c634955 (diff)
downloadscummvm-rg350-2937727018eef69c30a758a31b6fe3a6158ee35e.tar.gz
scummvm-rg350-2937727018eef69c30a758a31b6fe3a6158ee35e.tar.bz2
scummvm-rg350-2937727018eef69c30a758a31b6fe3a6158ee35e.zip
CINE: Reduce the scope of some variables, optimize a couple of iterator increment
Diffstat (limited to 'engines/cine')
-rw-r--r--engines/cine/gfx.cpp27
-rw-r--r--engines/cine/main_loop.cpp2
2 files changed, 13 insertions, 16 deletions
diff --git a/engines/cine/gfx.cpp b/engines/cine/gfx.cpp
index 636c0cf8d9..18a569b9c4 100644
--- a/engines/cine/gfx.cpp
+++ b/engines/cine/gfx.cpp
@@ -246,17 +246,16 @@ void FWRenderer::incrustSprite(const BGIncrust &incrust) {
* Draw command box on screen
*/
void FWRenderer::drawCommand() {
- unsigned int i;
- int x = 10, y = _cmdY;
-
if (disableSystemMenu == 0) {
+ int x = 10, y = _cmdY;
+
drawPlainBox(x, y, 301, 11, 0);
drawBorder(x - 1, y - 1, 302, 12, 2);
x += 2;
y += 2;
- for (i = 0; i < _cmd.size(); i++) {
+ for (unsigned int i = 0; i < _cmd.size(); i++) {
x = drawChar(_cmd[i], x, y);
}
}
@@ -458,12 +457,12 @@ void FWRenderer::drawDoubleBorder(int x, int y, int width, int height, byte colo
* @param y Character coordinate
*/
int FWRenderer::drawChar(char character, int x, int y) {
- int width, idx;
+ int width;
if (character == ' ') {
x += 5;
} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
- idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+ int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
drawSpriteRaw(g_cine->_textHandler.textTable[idx][FONT_DATA], g_cine->_textHandler.textTable[idx][FONT_MASK], FONT_WIDTH, FONT_HEIGHT, _backBuffer, x, y);
x += width + 1;
}
@@ -481,12 +480,12 @@ int FWRenderer::drawChar(char character, int x, int y) {
* @param y Character coordinate
*/
int FWRenderer::undrawChar(char character, int x, int y) {
- int width, idx;
+ int width;
if (character == ' ') {
x += 5;
} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
- idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+ int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
const byte *sprite = g_cine->_textHandler.textTable[idx][FONT_DATA];
for (uint i = 0; i < FONT_HEIGHT; ++i) {
byte *dst = _backBuffer + (y + i) * 320 + x;
@@ -997,11 +996,10 @@ void SelectionMenu::drawMenu(FWRenderer &r, bool top) {
}
int lineY = y + 4;
- int charX;
const int elemCount = getElementCount();
for (int i = 0; i < elemCount; ++i, lineY += 9) {
- charX = x + 4;
+ int charX = x + 4;
if (i == _selection) {
int color;
@@ -1228,12 +1226,12 @@ void OSRenderer::incrustSprite(const BGIncrust &incrust) {
* @param y Character coordinate
*/
int OSRenderer::drawChar(char character, int x, int y) {
- int width, idx;
+ int width;
if (character == ' ') {
x += 5;
} else if ((width = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterWidth)) {
- idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
+ int idx = g_cine->_textHandler.fontParamTable[(unsigned char)character].characterIdx;
drawSpriteRaw2(g_cine->_textHandler.textTable[idx][FONT_DATA], 0, FONT_WIDTH, FONT_HEIGHT, _backBuffer, x, y);
x += width + 1;
}
@@ -1834,7 +1832,7 @@ void OSRenderer::drawSprite(overlay *overlayPtr, const byte *spritePtr, int16 wi
}
}
}
- it++;
+ ++it;
}
// now, draw with the mask we created
@@ -1887,7 +1885,6 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he
byte *page, int16 x, int16 y) {
int16 i, j, tmpWidth, tmpHeight;
Common::List<BGIncrust>::iterator it;
- byte *mask;
const byte *backup = maskPtr;
// background pass
@@ -1915,7 +1912,7 @@ void maskBgOverlay(const byte *bgPtr, const byte *maskPtr, int16 width, int16 he
for (it = g_cine->_bgIncrustList.begin(); it != g_cine->_bgIncrustList.end(); ++it) {
tmpWidth = g_cine->_animDataTable[it->frame]._realWidth;
tmpHeight = g_cine->_animDataTable[it->frame]._height;
- mask = (byte *)malloc(tmpWidth * tmpHeight);
+ byte *mask = (byte *)malloc(tmpWidth * tmpHeight);
if (it->param == 0) {
generateMask(g_cine->_animDataTable[it->frame].data(), mask, tmpWidth * tmpHeight, it->part);
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index c822f1cabd..789e764df3 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -254,7 +254,7 @@ void purgeSeqList() {
it = g_cine->_seqList.erase(it);
} else {
// Let the element be and jump to the next element
- it++;
+ ++it;
}
}
}