[Scummvm-cvs-logs] scummvm master -> 0f1b756242def7cf09d7f7f4427a3d5122879f1c
Strangerke
Strangerke at scummvm.org
Sat Jun 13 08:20:45 CEST 2015
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b87b081cfc SHERLOCK: Fix 3 CppCheck warnings
5887d92d17 SHERLOCK: Reduce the scope of some variables, add a couple of CHECKMEs
09f7611651 SHERLOCK: In startCAnim, check range before accessing sequence array
0f1b756242 SHERLOCK: Remove unused variables
Commit: b87b081cfca659e02717b1055d746884aea5fa4a
https://github.com/scummvm/scummvm/commit/b87b081cfca659e02717b1055d746884aea5fa4a
Author: Strangerke (strangerke at scummvm.org)
Date: 2015-06-13T07:52:42+02:00
Commit Message:
SHERLOCK: Fix 3 CppCheck warnings
Changed paths:
engines/sherlock/scalpel/scalpel.cpp
diff --git a/engines/sherlock/scalpel/scalpel.cpp b/engines/sherlock/scalpel/scalpel.cpp
index 33f8c6b..cfe9b82 100644
--- a/engines/sherlock/scalpel/scalpel.cpp
+++ b/engines/sherlock/scalpel/scalpel.cpp
@@ -250,7 +250,7 @@ void ScalpelEngine::showOpening() {
if (finished)
finished = showStreetCutscene3DO();
if (finished)
- finished = showOfficeCutscene3DO();
+ showOfficeCutscene3DO();
_events->clearEvents();
_music->stopMusic();
@@ -264,7 +264,7 @@ void ScalpelEngine::showOpening() {
if (finished)
finished = showStreetCutscene();
if (finished)
- finished = showOfficeCutscene();
+ showOfficeCutscene();
_events->clearEvents();
_music->stopMusic();
@@ -736,9 +736,7 @@ bool ScalpelEngine::showStreetCutscene3DO() {
}
bool ScalpelEngine::showOfficeCutscene3DO() {
- bool finished = true;
-
- finished = _music->waitUntilMSec(151000, 0, 0, 1000);
+ bool finished = _music->waitUntilMSec(151000, 0, 0, 1000);
if (finished)
_animation->play3DO("COFF1", true, 1, false, 3);
Commit: 5887d92d17729adfa11b2bb58cb8692507afb886
https://github.com/scummvm/scummvm/commit/5887d92d17729adfa11b2bb58cb8692507afb886
Author: Strangerke (strangerke at scummvm.org)
Date: 2015-06-13T08:07:34+02:00
Commit Message:
SHERLOCK: Reduce the scope of some variables, add a couple of CHECKMEs
Changed paths:
engines/sherlock/image_file.cpp
engines/sherlock/objects.cpp
engines/sherlock/screen.cpp
engines/sherlock/tattoo/tattoo_map.cpp
engines/sherlock/tattoo/tattoo_scene.cpp
diff --git a/engines/sherlock/image_file.cpp b/engines/sherlock/image_file.cpp
index 9ee3e33..95f34dc 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 954dcc7..8e75ce7 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 c1aec9e..91f2594 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 fc0037a..d887217 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 a64c86b..06391ea 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) {
Commit: 09f7611651aee01c7ab8d212123fd6b4deb30d45
https://github.com/scummvm/scummvm/commit/09f7611651aee01c7ab8d212123fd6b4deb30d45
Author: Strangerke (strangerke at scummvm.org)
Date: 2015-06-13T08:09:38+02:00
Commit Message:
SHERLOCK: In startCAnim, check range before accessing sequence array
Changed paths:
engines/sherlock/scalpel/scalpel_scene.cpp
diff --git a/engines/sherlock/scalpel/scalpel_scene.cpp b/engines/sherlock/scalpel/scalpel_scene.cpp
index 87fe208..813e418 100644
--- a/engines/sherlock/scalpel/scalpel_scene.cpp
+++ b/engines/sherlock/scalpel/scalpel_scene.cpp
@@ -590,7 +590,7 @@ int ScalpelScene::startCAnim(int cAnimNum, int playRate) {
if (playRate < 0) {
// Reverse direction
// Count number of frames
- while (cObj._sequences[frames] && frames < MAX_FRAME)
+ while (frames < MAX_FRAME && cObj._sequences[frames])
++frames;
} else {
// Forward direction
Commit: 0f1b756242def7cf09d7f7f4427a3d5122879f1c
https://github.com/scummvm/scummvm/commit/0f1b756242def7cf09d7f7f4427a3d5122879f1c
Author: Strangerke (strangerke at scummvm.org)
Date: 2015-06-13T08:18:05+02:00
Commit Message:
SHERLOCK: Remove unused variables
Changed paths:
engines/sherlock/scalpel/drivers/mt32.cpp
engines/sherlock/tattoo/tattoo_scene.cpp
diff --git a/engines/sherlock/scalpel/drivers/mt32.cpp b/engines/sherlock/scalpel/drivers/mt32.cpp
index 13e2845..2aac177 100644
--- a/engines/sherlock/scalpel/drivers/mt32.cpp
+++ b/engines/sherlock/scalpel/drivers/mt32.cpp
@@ -83,10 +83,6 @@ public:
return 1000000 / _baseFreq;
}
-private:
- Common::TimerManager::TimerProc _timerProc;
- void *_timerParam;
-
protected:
Common::Mutex _mutex;
MidiDriver *_driver;
diff --git a/engines/sherlock/tattoo/tattoo_scene.cpp b/engines/sherlock/tattoo/tattoo_scene.cpp
index 06391ea..7fd8908 100644
--- a/engines/sherlock/tattoo/tattoo_scene.cpp
+++ b/engines/sherlock/tattoo/tattoo_scene.cpp
@@ -40,7 +40,6 @@ struct ShapeEntry {
ShapeEntry(TattooPerson *person, int yp) : _shape(nullptr), _person(person), _yp(yp), _isAnimation(false) {}
ShapeEntry(Object *shape, int yp) : _shape(shape), _person(nullptr), _yp(yp), _isAnimation(false) {}
ShapeEntry(int yp) : _shape(nullptr), _person(nullptr), _yp(yp), _isAnimation(true) {}
- int personNum;
};
typedef Common::List<ShapeEntry> ShapeList;
More information about the Scummvm-git-logs
mailing list