aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorStrangerke2015-06-13 08:07:34 +0200
committerStrangerke2015-06-13 08:07:34 +0200
commit5887d92d17729adfa11b2bb58cb8692507afb886 (patch)
tree87e5dd913174a579db981ace6b32f30ad0dc2e70 /engines
parentb87b081cfca659e02717b1055d746884aea5fa4a (diff)
downloadscummvm-rg350-5887d92d17729adfa11b2bb58cb8692507afb886.tar.gz
scummvm-rg350-5887d92d17729adfa11b2bb58cb8692507afb886.tar.bz2
scummvm-rg350-5887d92d17729adfa11b2bb58cb8692507afb886.zip
SHERLOCK: Reduce the scope of some variables, add a couple of CHECKMEs
Diffstat (limited to 'engines')
-rw-r--r--engines/sherlock/image_file.cpp3
-rw-r--r--engines/sherlock/objects.cpp2
-rw-r--r--engines/sherlock/screen.cpp6
-rw-r--r--engines/sherlock/tattoo/tattoo_map.cpp8
-rw-r--r--engines/sherlock/tattoo/tattoo_scene.cpp12
5 files changed, 13 insertions, 18 deletions
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 9ee3e33608..95f34dc24b 100644
--- a/engines/sherlock/image_file.cpp
+++ b/engines/sherlock/image_file.cpp
@@ -570,7 +570,6 @@ void ImageFile3DO::load3DOCelRoomData(Common::SeekableReadStream &stream) {
uint32 ccbHeight = 0;
// cel data
uint32 celDataSize = 0;
- byte *celDataPtr = NULL;
while (stream.pos() < streamSize) {
// 3DO sherlock holmes room data header
@@ -609,7 +608,7 @@ void ImageFile3DO::load3DOCelRoomData(Common::SeekableReadStream &stream) {
celDataSize = roomDataHeader_size - 68;
// read data into memory
- celDataPtr = new byte[celDataSize];
+ byte *celDataPtr = new byte[celDataSize];
stream.read(celDataPtr, celDataSize);
diff --git a/engines/sherlock/objects.cpp b/engines/sherlock/objects.cpp
index 954dcc7884..8e75ce7336 100644
--- a/engines/sherlock/objects.cpp
+++ b/engines/sherlock/objects.cpp
@@ -414,7 +414,6 @@ void Sprite::setObjTalkSequence(int seq) {
void Sprite::checkWalkGraphics() {
People &people = *_vm->_people;
- int npcNum = -1;
if (_images == nullptr) {
freeAltGraphics();
@@ -450,6 +449,7 @@ void Sprite::checkWalkGraphics() {
// If there is no Alternate Sequence set, see if we need to load a new one
if (!_altSeq) {
+ int npcNum = -1;
// Find which NPC this is so we can check the name of the graphics loaded
for (int idx = 0; idx < MAX_CHARACTERS; ++idx) {
if (this == &people[idx]) {
diff --git a/engines/sherlock/screen.cpp b/engines/sherlock/screen.cpp
index c1aec9ee6a..91f2594f50 100644
--- a/engines/sherlock/screen.cpp
+++ b/engines/sherlock/screen.cpp
@@ -213,8 +213,6 @@ void Screen::fadeIntoScreen3DO(int speed) {
Events &events = *_vm->_events;
uint16 *currentScreenBasePtr = (uint16 *)getPixels();
uint16 *targetScreenBasePtr = (uint16 *)_backBuffer->getPixels();
- uint16 *currentScreenPtr = NULL;
- uint16 *targetScreenPtr = NULL;
uint16 currentScreenPixel = 0;
uint16 targetScreenPixel = 0;
@@ -236,8 +234,8 @@ void Screen::fadeIntoScreen3DO(int speed) {
do {
pixelsChanged = 0;
- currentScreenPtr = currentScreenBasePtr;
- targetScreenPtr = targetScreenBasePtr;
+ uint16 *currentScreenPtr = currentScreenBasePtr;
+ uint16 *targetScreenPtr = targetScreenBasePtr;
for (screenY = 0; screenY < screenHeight; screenY++) {
for (screenX = 0; screenX < screenWidth; screenX++) {
diff --git a/engines/sherlock/tattoo/tattoo_map.cpp b/engines/sherlock/tattoo/tattoo_map.cpp
index fc0037ad3f..d8872171cb 100644
--- a/engines/sherlock/tattoo/tattoo_map.cpp
+++ b/engines/sherlock/tattoo/tattoo_map.cpp
@@ -318,7 +318,6 @@ void TattooMap::checkMapNames(bool slamIt) {
Events &events = *_vm->_events;
Screen &screen = *_vm->_screen;
Common::Point mousePos = events.mousePos() + _currentScroll;
- int dif = 10000;
// See if the mouse is pointing at any of the map locations
_bgFound = -1;
@@ -353,6 +352,7 @@ void TattooMap::checkMapNames(bool slamIt) {
if (width > 150) {
const char *s = desc.c_str();
+ int dif = 10000;
for (;;) {
// Move to end of next word
s = strchr(s, ' ');
@@ -409,10 +409,9 @@ void TattooMap::checkMapNames(bool slamIt) {
// The text needs to be split up over two lines
Common::String line1(desc.c_str(), space);
Common::String line2(space + 1);
- int xp, yp;
// Draw the first line
- xp = (width - screen.stringWidth(desc)) / 2;
+ int xp = (width - screen.stringWidth(desc)) / 2;
_textBuffer->writeString(line1, Common::Point(xp + 0, 0), BLACK);
_textBuffer->writeString(line1, Common::Point(xp + 1, 0), BLACK);
_textBuffer->writeString(line1, Common::Point(xp + 2, 0), BLACK);
@@ -423,8 +422,9 @@ void TattooMap::checkMapNames(bool slamIt) {
_textBuffer->writeString(line1, Common::Point(xp + 2, 2), BLACK);
_textBuffer->writeString(line1, Common::Point(xp + 1, 1), MAP_NAME_COLOR);
- yp = screen.stringHeight(line2);
+ int yp = screen.stringHeight(line2);
xp = (width - screen.stringWidth(line2)) / 2;
+ // CHECKME: Shouldn't we use yp for drawing line2?
_textBuffer->writeString(line2, Common::Point(xp + 0, 0), BLACK);
_textBuffer->writeString(line2, Common::Point(xp + 1, 0), BLACK);
_textBuffer->writeString(line2, Common::Point(xp + 2, 0), BLACK);
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index a64c86b24b..06391eac46 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -724,6 +724,7 @@ int TattooScene::getScaleVal(const Common::Point &pt) {
if (sz.contains(pos)) {
int n = (sz._bottomNumber - sz._topNumber) * 100 / sz.height() * (pos.y - sz.top) / 100 + sz._topNumber;
result = 25600L / n;
+ // CHECKME: Shouldn't we set 'found' at this place?
}
}
@@ -743,10 +744,6 @@ int TattooScene::getScaleVal(const Common::Point &pt) {
}
void TattooScene::setupBGArea(const byte cMap[PALETTE_SIZE]) {
- int r, g, b;
- byte c;
- int cd, d;
-
// This requires that there is a 16 grayscale palette sequence in the palette that goes from lighter
// to darker as the palette numbers go up. The last palette entry in that run is specified by _bgColor
byte *p = &_lookupTable[0];
@@ -758,6 +755,7 @@ void TattooScene::setupBGArea(const byte cMap[PALETTE_SIZE]) {
p = &_lookupTable1[0];
for (int idx = 0; idx < PALETTE_COUNT; ++idx) {
+ int r, g, b;
switch (_currentScene) {
case 8:
r = cMap[idx * 3] * 4 / 5;
@@ -784,11 +782,11 @@ void TattooScene::setupBGArea(const byte cMap[PALETTE_SIZE]) {
break;
}
- c = 0;
- cd = (r - cMap[0]) * (r - cMap[0]) + (g - cMap[1]) * (g - cMap[1]) + (b - cMap[2]) * (b - cMap[2]);
+ byte c = 0;
+ int cd = (r - cMap[0]) * (r - cMap[0]) + (g - cMap[1]) * (g - cMap[1]) + (b - cMap[2]) * (b - cMap[2]);
for (int pal = 0; pal < PALETTE_COUNT; ++pal) {
- d = (r - cMap[pal * 3]) * (r - cMap[pal * 3]) + (g - cMap[pal * 3 + 1]) * (g - cMap[pal * 3 + 1])
+ int d = (r - cMap[pal * 3]) * (r - cMap[pal * 3]) + (g - cMap[pal * 3 + 1]) * (g - cMap[pal * 3 + 1])
+ (b - cMap[pal * 3 + 2])*(b - cMap[pal * 3 + 2]);
if (d < cd) {