[Scummvm-git-logs] scummvm master -> 7346b69d886b10adc93e848ea3c609b253e162f6
bluegr
bluegr at gmail.com
Mon May 27 13:55:13 CEST 2019
This automated email contains information about 13 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e412bf5ee4 ADL: Fix MSVC warnings
5724a1f385 CRYO: Fix MSVC warnings
ea39214f7a ILLUSIONS: Fix MSVC warnings
e94026e800 MACVENTURE: Fix MSVC warnings
f5ed07c3e7 MOHAWK: Fix MSVC warnings
87e13a5048 PEGASUS: Fix MSVC warnings
9da3d22703 SCI: Fix MSVC warnings
174721e911 SCUMM: Fix MSVC warnings
f4e8eed13d SLUDGE: Fix MSVC warnings
f6af273fca STARTREK: Fix MSVC warnings
a5614eeaac TITANIC: Change add float suffixes to float assignments
80f773c915 WINTERMUTE: Remove unused variable
7346b69d88 GRAPHICS: Initialize potentially uninitialized variables
Commit: e412bf5ee44c7c1fb2be634e9db6aaa2322818e3
https://github.com/scummvm/scummvm/commit/e412bf5ee44c7c1fb2be634e9db6aaa2322818e3
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:37+03:00
Commit Message:
ADL: Fix MSVC warnings
- Change APPLECHAR to APPLEBYTE, when its output is used as a byte
- Replace uses of strncpy with Common::strlcpy
- Merge redundant switch and if statements
- Remove redundant semicolons
Changed paths:
engines/adl/adl.cpp
engines/adl/display.cpp
engines/adl/display.h
engines/adl/hires1.cpp
engines/adl/hires6.cpp
diff --git a/engines/adl/adl.cpp b/engines/adl/adl.cpp
index 17fdd28..d866af6 100644
--- a/engines/adl/adl.cpp
+++ b/engines/adl/adl.cpp
@@ -119,7 +119,7 @@ Common::String AdlEngine::readString(Common::ReadStream &stream, byte until) con
break;
str += b;
- };
+ }
return str;
}
@@ -209,21 +209,13 @@ Common::String AdlEngine::inputString(byte prompt) const {
return s;
}
- if (b < 0xa0) {
- switch (b) {
- case Common::KEYCODE_BACKSPACE | 0x80:
- if (!s.empty()) {
- _display->moveCursorBackward();
- _display->setCharAtCursor(APPLECHAR(' '));
- s.deleteLastChar();
- }
- break;
- };
- } else {
- if (s.size() < 255) {
- s += b;
- _display->printString(Common::String(b));
- }
+ if (b < 0xa0 && b == (Common::KEYCODE_BACKSPACE | 0x80) && !s.empty()) {
+ _display->moveCursorBackward();
+ _display->setCharAtCursor(APPLEBYTE(' '));
+ s.deleteLastChar();
+ } else if (s.size() < 255) {
+ s += b;
+ _display->printString(Common::String(b));
}
}
}
@@ -233,7 +225,7 @@ byte AdlEngine::inputKey(bool showCursor) const {
// If debug script is active, we fake a return press for the text overflow handling
if (_inputScript && !_scriptPaused)
- return APPLECHAR('\r');
+ return APPLEBYTE('\r');
if (showCursor)
_display->showCursor(true);
@@ -252,12 +244,12 @@ byte AdlEngine::inputKey(bool showCursor) const {
default:
if (event.kbd.ascii >= 0x20 && event.kbd.ascii < 0x80)
key = convertKey(event.kbd.ascii);
- };
+ }
}
// If debug script was activated in the meantime, abort input
if (_inputScript && !_scriptPaused)
- return APPLECHAR('\r');
+ return APPLEBYTE('\r');
_display->updateTextScreen();
g_system->delayMillis(16);
@@ -917,11 +909,11 @@ Common::Error AdlEngine::saveGameState(int slot, const Common::String &desc) {
char name[SAVEGAME_NAME_LEN] = { };
if (!desc.empty())
- strncpy(name, desc.c_str(), sizeof(name) - 1);
+ Common::strlcpy(name, desc.c_str(), sizeof(name) - 1);
else {
Common::String defaultName("Save ");
defaultName += 'A' + slot;
- strncpy(name, defaultName.c_str(), sizeof(name) - 1);
+ Common::strlcpy(name, defaultName.c_str(), sizeof(name) - 1);
}
outFile->write(name, sizeof(name));
@@ -992,7 +984,7 @@ byte AdlEngine::convertKey(uint16 ascii) const {
Common::String AdlEngine::getLine() {
while (1) {
- Common::String line = inputString(APPLECHAR('?'));
+ Common::String line = inputString(APPLEBYTE('?'));
if (shouldQuit() || _isRestoring)
return Common::String();
@@ -1028,8 +1020,10 @@ Common::String AdlEngine::getWord(const Common::String &line, uint &index) const
// Copy up to 8 characters
while (1) {
- if (copied < 8)
- str.setChar(line[index], copied++);
+ if (copied < 8) {
+ str.setChar(line[index], copied);
+ copied++;
+ }
index++;
diff --git a/engines/adl/display.cpp b/engines/adl/display.cpp
index 52fb1b4..a1a1f6f 100644
--- a/engines/adl/display.cpp
+++ b/engines/adl/display.cpp
@@ -383,6 +383,9 @@ static byte processColorBits(uint16 &bits, bool &odd, bool secondPal) {
break;
case 0x5: // 101 (color)
color = 2 + !odd;
+ break;
+ default:
+ break;
}
if (secondPal)
@@ -477,9 +480,9 @@ static void renderPixelRowMono(byte *dst, byte *src) {
static void copyEvenSurfaceRows(Graphics::Surface &surf) {
byte *src = (byte *)surf.getPixels();
- for (uint y = 0; y < surf.h / 2; ++y) {
+ for (uint16 y = 0; y < surf.h / 2; ++y) {
byte *dst = src + surf.pitch;
- for (uint x = 0; x < surf.w; ++x)
+ for (uint16 x = 0; x < surf.w; ++x)
dst[x] = ALTCOL(src[x]);
src += surf.pitch * 2;
}
@@ -553,8 +556,8 @@ void Display::createFont() {
byte *buf = (byte *)_font->getPixels();
byte *bufInv = buf + (_font->h / 2) * _font->pitch;
- for (uint row = 0; row < _font->h / 2; row += 2) {
- for (uint col = 0; col < _font->w; ++col)
+ for (uint16 row = 0; row < _font->h / 2; row += 2) {
+ for (uint16 col = 0; col < _font->w; ++col)
bufInv[col] = (buf[col] ? 0 : 1);
buf += _font->pitch * 2;
diff --git a/engines/adl/display.h b/engines/adl/display.h
index c1c0f41..08e6f4c 100644
--- a/engines/adl/display.h
+++ b/engines/adl/display.h
@@ -52,6 +52,7 @@ enum DisplayMode {
};
#define APPLECHAR(C) ((char)((C) | 0x80))
+#define APPLEBYTE(C) ((byte)((C) | 0x80))
class Display {
public:
diff --git a/engines/adl/hires1.cpp b/engines/adl/hires1.cpp
index 2cf2931..39aec93 100644
--- a/engines/adl/hires1.cpp
+++ b/engines/adl/hires1.cpp
@@ -398,7 +398,7 @@ void HiRes1Engine::printString(const Common::String &str) {
Common::String HiRes1Engine::loadMessage(uint idx) const {
StreamPtr stream(_messages[idx]->createReadStream());
- return readString(*stream, APPLECHAR('\r')) + APPLECHAR('\r');
+ return readString(*stream, APPLEBYTE('\r')) + APPLEBYTE('\r');
}
void HiRes1Engine::printMessage(uint idx) {
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index 5cbca1c..3093b14 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -214,7 +214,7 @@ void HiRes6Engine::runIntro() {
error("Failed to open disk volume 0");
stream.reset(files->createReadStream("\010\010\010\010\010\010"));
- Common::String copyright(readStringAt(*stream, 0x103, APPLECHAR('\r')));
+ Common::String copyright(readStringAt(*stream, 0x103, APPLEBYTE('\r')));
delete files;
Commit: 5724a1f3852676903c2aa8474c44db655f84813b
https://github.com/scummvm/scummvm/commit/5724a1f3852676903c2aa8474c44db655f84813b
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:38+03:00
Commit Message:
CRYO: Fix MSVC warnings
- Add missing default switch cases
- Specify packing for structs with pointers to complex objects
- Change literal suffixes to uppercase
- Replace uses of malloc() with new []
Changed paths:
engines/cryo/eden.cpp
diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp
index bf8fbe4..04191ff 100644
--- a/engines/cryo/eden.cpp
+++ b/engines/cryo/eden.cpp
@@ -559,6 +559,8 @@ void EdenGame::move(Direction dir) {
case kCryoWest:
newLoc = room->_exits[3];
break;
+ default:
+ break;
}
deplaval((roomNum & 0xFF00) | newLoc);
}
@@ -582,6 +584,8 @@ void EdenGame::move2(Direction dir) {
case kCryoWest:
newLoc = room->_exits[3];
break;
+ default:
+ break;
}
deplaval((roomNum & 0xFF00) | newLoc);
}
@@ -3125,12 +3129,17 @@ void EdenGame::tyranDies(perso_t *perso) {
}
void EdenGame::specialObjects(perso_t *perso, char objid) {
+
+#include "common/pack-start.h" // START STRUCT PACKING
+
struct SpecialObject {
int8 _characterType;
int8 _objectId;
void (EdenGame::*dispFct)(perso_t *perso);
};
+#include "common/pack-end.h" // END STRUCT PACKING
+
static SpecialObject kSpecialObjectActions[] = {
// persoType, objectId, dispFct
{ PersonFlags::pfType8, Objects::obShroom, &EdenGame::specialMushroom },
@@ -7090,9 +7099,9 @@ void EdenGame::projectionFix(Cube *cubep, int n) {
int y = cubep->_vertices[i].y;
int z = cubep->_vertices[i].z;
- int transformX = _passMat31 * x + _passMat21 * y + _passMat11 * z + (int)(_translationX * 256.0f);
- int transformY = _passMat32 * x + _passMat22 * y + _passMat12 * z + (int)(_translationY * 256.0f);
- int transformZ = _passMat33 * x + _passMat23 * y + _passMat13 * z + (int)(_translationZ * 256.0f);
+ int transformX = _passMat31 * x + _passMat21 * y + _passMat11 * z + (int)(_translationX * 256.0F);
+ int transformY = _passMat32 * x + _passMat22 * y + _passMat12 * z + (int)(_translationY * 256.0F);
+ int transformZ = _passMat33 * x + _passMat23 * y + _passMat13 * z + (int)(_translationZ * 256.0F);
transformZ >>= 8;
if (transformZ == -256)
@@ -7166,7 +7175,7 @@ void EdenGame::loadMap(int file_id, byte *buffer) {
}
void EdenGame::NEWcharge_objet_mob(Cube *cubep, int fileNum, byte *texturePtr) {
- char *tmp1 = (char *)malloc(454);
+ char *tmp1 = new char[454];
if (_vm->getPlatform() == Common::kPlatformMacintosh)
loadpartoffile(fileNum, tmp1, 0, 454);
else {
@@ -7214,7 +7223,7 @@ void EdenGame::NEWcharge_objet_mob(Cube *cubep, int fileNum, byte *texturePtr) {
} else
tmp4[i]->ff_4 = 0;
}
- free(tmp1);
+ delete[] tmp1;
cubep->_num = count2;
cubep->_faces = tmp4;
cubep->_projection = projection;
Commit: ea39214f7a252ad60d686a7dac44a50dc2cbad1d
https://github.com/scummvm/scummvm/commit/ea39214f7a252ad60d686a7dac44a50dc2cbad1d
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:38+03:00
Commit Message:
ILLUSIONS: Fix MSVC warnings
- Fix warnings about conversion between float and double
- Initialize potentially uninitialized variables
Changed paths:
engines/illusions/bbdou/bbdou_bubble.cpp
engines/illusions/bbdou/bbdou_inventory.cpp
diff --git a/engines/illusions/bbdou/bbdou_bubble.cpp b/engines/illusions/bbdou/bbdou_bubble.cpp
index fd2585f..b2370f0 100644
--- a/engines/illusions/bbdou/bbdou_bubble.cpp
+++ b/engines/illusions/bbdou/bbdou_bubble.cpp
@@ -241,16 +241,16 @@ void BbdouBubble::calcBubbleTrail(Common::Point &sourcePt, Common::Point &destPt
if (!swapY) {
if (destPt.y < sourcePt.y) {
- currentAngle = M_PI * 0.5;
+ currentAngle = (float)M_PI * 0.5F;
} else {
- currentAngle = M_PI * 1.5;
+ currentAngle = (float)M_PI * 1.5F;
partAngle = -partAngle;
}
if (destPt.x < sourcePt.x)
partAngle = -partAngle;
} else {
if (destPt.x <= sourcePt.x) {
- currentAngle = M_PI;
+ currentAngle = (float)M_PI;
} else {
currentAngle = 0.0;
partAngle = -partAngle;
diff --git a/engines/illusions/bbdou/bbdou_inventory.cpp b/engines/illusions/bbdou/bbdou_inventory.cpp
index 88184b9..b491c77 100644
--- a/engines/illusions/bbdou/bbdou_inventory.cpp
+++ b/engines/illusions/bbdou/bbdou_inventory.cpp
@@ -306,6 +306,7 @@ void BbdouInventory::cause0x1B0001(TriggerFunction *triggerFunction, uint32 call
foundSceneId = _activeInventorySceneId;
foundVerbId = triggerFunction->_verbId;
+ foundObjectId = 0;
foundObjectId2 = 0;
if (triggerFunction->_verbId == 0x1B0008) {
Commit: e94026e8000243333a1ca594d91ad5eda4e6930a
https://github.com/scummvm/scummvm/commit/e94026e8000243333a1ca594d91ad5eda4e6930a
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:39+03:00
Commit Message:
MACVENTURE: Fix MSVC warnings
- Added a CHECKME for a code which is never used at the moment
- Add default cases to switch statements
- Remove unused variables
- Fix integer variable assignments from booleans
Changed paths:
engines/macventure/gui.cpp
engines/macventure/macventure.cpp
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 0008e34..34aa2c9 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -802,6 +802,7 @@ void Gui::updateWindow(WindowReference winID, bool containerOpen) {
ObjID child = children[i].obj;
BlitMode mode = kBlitDirect;
bool off = !_engine->isObjVisible(child);
+ // CHECKME: Since flag = 0, this always evaluates to false
if (flag || !off || !_engine->isObjClickable(child)) {
mode = kBlitBIC;
if (off || flag) {
@@ -1021,9 +1022,8 @@ WindowReference Gui::getObjWindow(ObjID objID) {
case 0xfffd: return kSelfWindow;
case 0xfffe: return kOutConsoleWindow;
case 0xffff: return kCommandsWindow;
+ default: return findObjWindow(objID);
}
-
- return findObjWindow(objID);
}
WindowReference Gui::findObjWindow(ObjID objID) {
@@ -1250,7 +1250,7 @@ void Gui::invertWindowColors(WindowReference winID) {
}
bool Gui::tryCloseWindow(WindowReference winID) {
- WindowData data = findWindowData(winID);
+ //WindowData data = findWindowData(winID);
Graphics::MacWindow *win = findWindow(winID);
_wm.removeWindow(win);
if (winID < 0x80) {
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 907349d..39740fd 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -614,6 +614,8 @@ void MacVentureEngine::runObjQueue() {
case 0xe:
zoomObject(obj.object);
break;
+ default:
+ break;
}
}
}
@@ -635,6 +637,8 @@ void MacVentureEngine::printTexts() {
_gui->printText(_world->getText(text.asset, text.source, text.destination));
gameChanged();
break;
+ default:
+ break;
}
}
}
@@ -654,6 +658,8 @@ void MacVentureEngine::playSounds(bool pause) {
case kSoundWait:
// Empty in the original.
break;
+ default:
+ break;
}
}
if (pause && delay > 0) {
@@ -804,7 +810,6 @@ void MacVentureEngine::openObject(ObjID objID) {
void MacVentureEngine::closeObject(ObjID objID) {
warning("closeObject: not fully implemented");
_gui->tryCloseWindow(getObjWindow(objID));
- return;
}
void MacVentureEngine::checkObject(QueuedObject old) {
@@ -819,8 +824,8 @@ void MacVentureEngine::checkObject(QueuedObject old) {
if (old.parent != _world->getObjAttr(id, kAttrParentObject)) {
enqueueObject(kSetToPlayerParent, id);
}
- if (old.offscreen != _world->getObjAttr(id, kAttrInvisible) ||
- old.invisible != _world->getObjAttr(id, kAttrUnclickable)) {
+ if (old.offscreen != !!_world->getObjAttr(id, kAttrInvisible) ||
+ old.invisible != !!_world->getObjAttr(id, kAttrUnclickable)) {
updateWindow(findParentWindow(id));
}
} else if (old.parent != _world->getObjAttr(id, kAttrParentObject) ||
@@ -837,14 +842,14 @@ void MacVentureEngine::checkObject(QueuedObject old) {
_gui->addChild(newWin, id);
hasChanged = true;
}
- } else if (old.offscreen != _world->getObjAttr(id, kAttrInvisible) ||
- old.invisible != _world->getObjAttr(id, kAttrUnclickable)) {
+ } else if (old.offscreen != !!_world->getObjAttr(id, kAttrInvisible) ||
+ old.invisible != !!_world->getObjAttr(id, kAttrUnclickable)) {
updateWindow(findParentWindow(id));
}
if (_world->getObjAttr(id, kAttrIsExit)) {
if (hasChanged ||
- old.hidden != _world->getObjAttr(id, kAttrHiddenExit) ||
+ old.hidden != !!_world->getObjAttr(id, kAttrHiddenExit) ||
old.exitx != _world->getObjAttr(id, kAttrExitX) ||
old.exity != _world->getObjAttr(id, kAttrExitY))
_gui->updateExit(id);
Commit: f5ed07c3e7083059600a37034a3d322e3495008e
https://github.com/scummvm/scummvm/commit/f5ed07c3e7083059600a37034a3d322e3495008e
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:40+03:00
Commit Message:
MOHAWK: Fix MSVC warnings
Fix assignments to float variables, by adding a float suffix
Changed paths:
engines/mohawk/riven_graphics.cpp
diff --git a/engines/mohawk/riven_graphics.cpp b/engines/mohawk/riven_graphics.cpp
index 71339d6..e83ca08 100644
--- a/engines/mohawk/riven_graphics.cpp
+++ b/engines/mohawk/riven_graphics.cpp
@@ -832,11 +832,11 @@ const FliesEffect::FliesEffectData FliesEffect::_firefliesParameters = {
true,
true,
true,
- 3.0,
- 0.7,
+ 3.0F,
+ 0.7F,
40,
- 2.0,
- 1.0,
+ 2.0F,
+ 1.0F,
8447718,
30,
10
@@ -847,11 +847,11 @@ const FliesEffect::FliesEffectData FliesEffect::_fliesParameters = {
false,
false,
true,
- 8.0,
- 3.0,
+ 8.0F,
+ 3.0F,
80,
- 3.0,
- 1.0,
+ 3.0F,
+ 1.0F,
661528,
30,
10
@@ -915,9 +915,9 @@ void FliesEffect::initFlyAtPosition(uint index, int posX, int posY, int posZ) {
fly.framesTillLightSwitch = randomBetween(_parameters->minFramesLit, _parameters->minFramesLit + _parameters->maxLightDuration);
fly.hasBlur = false;
- fly.directionAngleRad = randomBetween(0, 300) / 100.0f;
- fly.directionAngleRadZ = randomBetween(0, 300) / 100.0f;
- fly.speed = randomBetween(0, 100) / 100.0f;
+ fly.directionAngleRad = randomBetween(0, 300) / 100.0F;
+ fly.directionAngleRadZ = randomBetween(0, 300) / 100.0F;
+ fly.speed = randomBetween(0, 100) / 100.0F;
}
void FliesEffect::update() {
@@ -953,17 +953,17 @@ void FliesEffect::updateFlies() {
void FliesEffect::updateFlyPosition(uint index) {
FliesEffectEntry &fly = _fly[index];
- if (fly.directionAngleRad > 2.0f * M_PI) {
- fly.directionAngleRad = fly.directionAngleRad - 2.0f * M_PI;
+ if (fly.directionAngleRad > 2.0F * M_PI) {
+ fly.directionAngleRad = fly.directionAngleRad - 2.0F * M_PI;
}
- if (fly.directionAngleRad < 0.0f) {
- fly.directionAngleRad = fly.directionAngleRad + 2.0f * M_PI;
+ if (fly.directionAngleRad < 0.0F) {
+ fly.directionAngleRad = fly.directionAngleRad + 2.0F * M_PI;
}
- if (fly.directionAngleRadZ > 2.0f * M_PI) {
- fly.directionAngleRadZ = fly.directionAngleRadZ - 2.0f * M_PI;
+ if (fly.directionAngleRadZ > 2.0F * M_PI) {
+ fly.directionAngleRadZ = fly.directionAngleRadZ - 2.0F * M_PI;
}
- if (fly.directionAngleRadZ < 0.0f) {
- fly.directionAngleRadZ = fly.directionAngleRadZ + 2.0f * M_PI;
+ if (fly.directionAngleRadZ < 0.0F) {
+ fly.directionAngleRadZ = fly.directionAngleRadZ + 2.0F * M_PI;
}
fly.posXFloat += cos(fly.directionAngleRad) * fly.speed;
fly.posYFloat += sin(fly.directionAngleRad) * fly.speed;
@@ -975,7 +975,7 @@ void FliesEffect::updateFlyPosition(uint index) {
&fly.alphaMap,
&fly.width,
&fly.height);
- fly.posZFloat += cos(fly.directionAngleRadZ) * (fly.speed / 2.0f);
+ fly.posZFloat += cos(fly.directionAngleRadZ) * (fly.speed / 2.0F);
fly.posZ = fly.posZFloat;
if (_parameters->canBlur && fly.speed > _parameters->blurSpeedTreshold) {
fly.hasBlur = true;
@@ -997,16 +997,16 @@ void FliesEffect::updateFlyPosition(uint index) {
maxAngularSpeed /= 2;
}
int angularSpeed = randomBetween(-maxAngularSpeed, maxAngularSpeed);
- fly.directionAngleRad += angularSpeed / 100.0f;
+ fly.directionAngleRad += angularSpeed / 100.0F;
} else {
// Make the flies go down if they are too high in the screen
int angularSpeed = randomBetween(0, 50);
- if (fly.directionAngleRad >= M_PI / 2.0f && fly.directionAngleRad <= 3.0f * M_PI / 2.0f) {
+ if (fly.directionAngleRad >= M_PI / 2.0F && fly.directionAngleRad <= 3.0F * M_PI / 2.0F) {
// Going down
- fly.directionAngleRad -= angularSpeed / 100.0f;
+ fly.directionAngleRad -= angularSpeed / 100.0F;
} else {
// Going up
- fly.directionAngleRad += angularSpeed / 100.0f;
+ fly.directionAngleRad += angularSpeed / 100.0F;
}
if (fly.posY < 1) {
initFlyRandomPosition(index);
@@ -1026,23 +1026,23 @@ void FliesEffect::updateFlyPosition(uint index) {
distanceToScreenEdge = 30;
}
if (fly.posZ <= distanceToScreenEdge) {
- fly.directionAngleRadZ += randomBetween(-_parameters->maxAcceleration, _parameters->maxAcceleration) / 100.0f;
+ fly.directionAngleRadZ += randomBetween(-_parameters->maxAcceleration, _parameters->maxAcceleration) / 100.0F;
} else {
fly.posZ = distanceToScreenEdge;
- fly.directionAngleRadZ += M_PI;
+ fly.directionAngleRadZ += (float)M_PI;
}
} else {
fly.posZ = 0;
- fly.directionAngleRadZ += M_PI;
+ fly.directionAngleRadZ += (float)M_PI;
}
- float minSpeed = _parameters->minSpeed - fly.posZ / 40.0f;
- float maxSpeed = _parameters->maxSpeed - fly.posZ / 20.0f;
- fly.speed += randomBetween(-_parameters->maxAcceleration, _parameters->maxAcceleration) / 100.0f;
+ float minSpeed = _parameters->minSpeed - fly.posZ / 40.0F;
+ float maxSpeed = _parameters->maxSpeed - fly.posZ / 20.0F;
+ fly.speed += randomBetween(-_parameters->maxAcceleration, _parameters->maxAcceleration) / 100.0F;
if (fly.speed > maxSpeed) {
- fly.speed -= randomBetween(0, 50) / 100.0f;
+ fly.speed -= randomBetween(0, 50) / 100.0F;
}
if (fly.speed < minSpeed) {
- fly.speed += randomBetween(0, 50) / 100.0f;
+ fly.speed += randomBetween(0, 50) / 100.0F;
}
}
@@ -1200,9 +1200,9 @@ void FliesEffect::draw() {
}
if (_vm->_rnd->getRandomBit()) {
- fly.directionAngleRad += M_PI / 2.0;
+ fly.directionAngleRad += (float)M_PI / 2.0F;
} else {
- fly.directionAngleRad -= M_PI / 2.0;
+ fly.directionAngleRad -= (float)M_PI / 2.0F;
}
}
}
Commit: 87e13a50488fea398885eae8c46e01898a9fe41f
https://github.com/scummvm/scummvm/commit/87e13a50488fea398885eae8c46e01898a9fe41f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:41+03:00
Commit Message:
PEGASUS: Fix MSVC warnings
- Add a float suffix in convertScreenHToSpaceX/Y
Changed paths:
engines/pegasus/neighborhood/mars/spacechase3d.h
diff --git a/engines/pegasus/neighborhood/mars/spacechase3d.h b/engines/pegasus/neighborhood/mars/spacechase3d.h
index 455904f..95f7b6c 100644
--- a/engines/pegasus/neighborhood/mars/spacechase3d.h
+++ b/engines/pegasus/neighborhood/mars/spacechase3d.h
@@ -43,10 +43,10 @@ static const float kTangentFOV = 1.0;
(kShuttleWindowMidV - (y) / (z) * (kScreenWidth / (2 * kTangentFOV)))
#define convertScreenHToSpaceX(x, d) \
- (((2.0 * kTangentFOV) / kScreenWidth) * ((float)(x) - kShuttleWindowMidH) * (d))
+ (((2.0F * kTangentFOV) / kScreenWidth) * ((float)(x) - kShuttleWindowMidH) * (d))
#define convertScreenVToSpaceY(y, d) \
- (((2.0 * kTangentFOV) / kScreenWidth) * ((float)kShuttleWindowMidV - (y)) * (d))
+ (((2.0F * kTangentFOV) / kScreenWidth) * ((float)kShuttleWindowMidV - (y)) * (d))
struct Point3D {
float x, y, z;
Commit: 9da3d22703a0dc230d505e9839c3e33cc313b403
https://github.com/scummvm/scummvm/commit/9da3d22703a0dc230d505e9839c3e33cc313b403
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:41+03:00
Commit Message:
SCI: Fix MSVC warnings
- Remove unused parameters
- Initialize potentially uninitialized variables
- Use Common::String instead of a fixed buffer
- Remove redundant parentheses
- Change float suffix to be uppercase
- Fix spacing
- Fix integer left shifts with boolean variables
- Fix potential division by zero
- Fix missing breaks
Changed paths:
engines/sci/console.cpp
engines/sci/engine/kpathing.cpp
engines/sci/engine/scriptdebug.cpp
engines/sci/graphics/paint32.cpp
engines/sci/graphics/video32.cpp
engines/sci/resource_audio.cpp
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 6d75e59..8409ca0 100644
--- a/engines/sci/console.cpp
+++ b/engines/sci/console.cpp
@@ -73,7 +73,7 @@ int g_debug_simulated_key = 0;
bool g_debug_track_mouse_clicks = false;
// Refer to the "addresses" command on how to pass address parameters
-static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeValue);
+static int parse_reg_t(EngineState *s, const char *str, reg_t *dest);
Console::Console(SciEngine *engine) : GUI::Debugger(),
_engine(engine), _debugState(engine->_debugState) {
@@ -1462,7 +1462,7 @@ bool Console::cmdAudioDump(int argc, const char **argv) {
int numChannels = 1;
int bytesPerSample = 1;
bool sourceIs8Bit = true;
- uint32 compressedSize;
+ uint32 compressedSize = 0;
uint32 decompressedSize;
if (isSol) {
@@ -1719,19 +1719,18 @@ bool Console::cmdParse(int argc, const char **argv) {
}
char *error;
- char string[1000];
+ Common::String string = argv[1];
// Construct the string
- strcpy(string, argv[1]);
for (int i = 2; i < argc; i++) {
- strcat(string, " ");
- strcat(string, argv[i]);
+ string += " ";
+ string += argv[i];
}
- debugPrintf("Parsing '%s'\n", string);
+ debugPrintf("Parsing '%s'\n", string.c_str());
ResultWordListList words;
- bool res = _engine->getVocabulary()->tokenizeString(words, string, &error);
+ bool res = _engine->getVocabulary()->tokenizeString(words, string.c_str(), &error);
if (res && !words.empty()) {
int syntax_fail = 0;
@@ -1773,15 +1772,14 @@ bool Console::cmdSaid(int argc, const char **argv) {
}
char *error;
- char string[1000];
+ Common::String string = argv[1];
byte spec[1000];
int p;
// Construct the string
- strcpy(string, argv[1]);
for (p = 2; p < argc && strcmp(argv[p],"&") != 0; p++) {
- strcat(string, " ");
- strcat(string, argv[p]);
+ string += " ";
+ string += argv[p];
}
if (p >= argc-1) {
@@ -1841,12 +1839,12 @@ bool Console::cmdSaid(int argc, const char **argv) {
}
spec[len++] = 0xFF;
- debugN("Matching '%s' against:", string);
+ debugN("Matching '%s' against:", string.c_str());
_engine->getVocabulary()->debugDecipherSaidBlock(SciSpan<const byte>(spec, len));
debugN("\n");
ResultWordListList words;
- bool res = _engine->getVocabulary()->tokenizeString(words, string, &error);
+ bool res = _engine->getVocabulary()->tokenizeString(words, string.c_str(), &error);
if (res && !words.empty()) {
int syntax_fail = 0;
@@ -2089,7 +2087,7 @@ bool Console::cmdPlaneItemList(int argc, const char **argv) {
reg_t planeObject = NULL_REG;
- if (parse_reg_t(_engine->_gamestate, argv[1], &planeObject, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &planeObject)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -2117,7 +2115,7 @@ bool Console::cmdVisiblePlaneItemList(int argc, const char **argv) {
reg_t planeObject = NULL_REG;
- if (parse_reg_t(_engine->_gamestate, argv[1], &planeObject, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &planeObject)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -2192,7 +2190,7 @@ bool Console::cmdShowSavedBits(int argc, const char **argv) {
reg_t memoryHandle = NULL_REG;
- if (parse_reg_t(_engine->_gamestate, argv[1], &memoryHandle, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &memoryHandle)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -2613,7 +2611,7 @@ bool Console::cmdSongInfo(int argc, const char **argv) {
reg_t addr;
- if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &addr)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -2656,7 +2654,7 @@ bool Console::cmdToggleSound(int argc, const char **argv) {
reg_t id;
- if (parse_reg_t(_engine->_gamestate, argv[1], &id, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &id)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -2748,7 +2746,7 @@ bool Console::cmdGCShowReachable(int argc, const char **argv) {
reg_t addr;
- if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &addr)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -2780,7 +2778,7 @@ bool Console::cmdGCShowFreeable(int argc, const char **argv) {
reg_t addr;
- if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &addr)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -2813,7 +2811,7 @@ bool Console::cmdGCNormalize(int argc, const char **argv) {
reg_t addr;
- if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &addr)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -2934,7 +2932,7 @@ bool Console::cmdVMVars(int argc, const char **argv) {
printBasicVarInfo(*curValue);
debugPrintf("\n");
} else {
- if (parse_reg_t(s, setValue, curValue, true)) {
+ if (parse_reg_t(s, setValue, curValue)) {
debugPrintf("Invalid value/address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
debugPrintf("Or pass a decimal or hexadecimal value directly (e.g. 12, 1Ah)\n");
@@ -2981,7 +2979,7 @@ bool Console::cmdValueType(int argc, const char **argv) {
reg_t val;
- if (parse_reg_t(_engine->_gamestate, argv[1], &val, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &val)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -3022,7 +3020,7 @@ bool Console::cmdViewListNode(int argc, const char **argv) {
reg_t addr;
- if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &addr)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -3045,14 +3043,14 @@ bool Console::cmdViewReference(int argc, const char **argv) {
reg_t reg = NULL_REG;
reg_t reg_end = NULL_REG;
- if (parse_reg_t(_engine->_gamestate, argv[1], ®, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], ®)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
}
if (argc > 2) {
- if (parse_reg_t(_engine->_gamestate, argv[2], ®_end, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[2], ®_end)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -3076,14 +3074,14 @@ bool Console::cmdDumpReference(int argc, const char **argv) {
reg_t reg = NULL_REG;
reg_t reg_end = NULL_REG;
- if (parse_reg_t(_engine->_gamestate, argv[1], ®, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], ®)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
}
if (argc > 2) {
- if (parse_reg_t(_engine->_gamestate, argv[2], ®_end, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[2], ®_end)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -3192,7 +3190,7 @@ bool Console::cmdViewObject(int argc, const char **argv) {
reg_t addr;
- if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &addr)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -3536,7 +3534,7 @@ bool Console::cmdDisassemble(int argc, const char **argv) {
bool printBytecode = false;
bool printBWTag = false;
- if (parse_reg_t(_engine->_gamestate, argv[1], &objAddr, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &objAddr)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -3601,7 +3599,7 @@ bool Console::cmdDisassembleAddress(int argc, const char **argv) {
bool printBytes = false;
uint32 size;
- if (parse_reg_t(_engine->_gamestate, argv[1], &vpc, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &vpc)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -3789,7 +3787,7 @@ bool Console::cmdSend(int argc, const char **argv) {
reg_t object;
- if (parse_reg_t(_engine->_gamestate, argv[1], &object, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &object)) {
debugPrintf("Invalid address \"%s\" passed.\n", argv[1]);
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -3825,7 +3823,7 @@ bool Console::cmdSend(int argc, const char **argv) {
stackframe[0] = make_reg(0, selectorId);
stackframe[1] = make_reg(0, send_argc);
for (int i = 0; i < send_argc; i++) {
- if (parse_reg_t(_engine->_gamestate, argv[3+i], &stackframe[2+i], false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[3+i], &stackframe[2+i])) {
debugPrintf("Invalid address \"%s\" passed.\n", argv[3+i]);
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -4271,7 +4269,7 @@ bool Console::cmdBreakpointAddress(int argc, const char **argv) {
reg_t addr;
- if (parse_reg_t(_engine->_gamestate, argv[1], &addr, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &addr)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -4495,7 +4493,7 @@ bool Console::cmdMapVocab994(int argc, const char **argv) {
return true;
}
- if (parse_reg_t(_engine->_gamestate, argv[1], ®, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], ®)) {
debugPrintf("Invalid address passed.\n");
debugPrintf("Check the \"addresses\" command on how to use addresses\n");
return true;
@@ -4577,7 +4575,7 @@ bool Console::cmdAddresses(int argc, const char **argv) {
}
// Returns 0 on success
-static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeValue) {
+static int parse_reg_t(EngineState *s, const char *str, reg_t *dest) {
// Pointer to the part of str which contains a numeric offset (if any)
const char *offsetStr = NULL;
@@ -4595,7 +4593,7 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest, bool mayBeV
*dest = s->_executionStack.back().addr.pc;
offsetStr = str + 3;
} else if (!scumm_strnicmp(str + 1, "P", 1)) {
- *dest = s->_executionStack.back().addr.pc;;
+ *dest = s->_executionStack.back().addr.pc;
offsetStr = str + 2;
} else if (!scumm_strnicmp(str + 1, "PREV", 4)) {
*dest = s->r_prev;
@@ -5006,14 +5004,12 @@ void Console::printReference(reg_t reg, reg_t reg_end) {
case SIG_TYPE_REFERENCE: {
switch (_engine->_gamestate->_segMan->getSegmentType(reg.getSegment())) {
#ifdef ENABLE_SCI32
- case SEG_TYPE_ARRAY: {
+ case SEG_TYPE_ARRAY:
printArray(reg);
break;
- }
- case SEG_TYPE_BITMAP: {
+ case SEG_TYPE_BITMAP:
printBitmap(reg);
break;
- }
#endif
default: {
const SegmentRef block = _engine->_gamestate->_segMan->dereference(reg);
diff --git a/engines/sci/engine/kpathing.cpp b/engines/sci/engine/kpathing.cpp
index 3177fbd..afa743b 100644
--- a/engines/sci/engine/kpathing.cpp
+++ b/engines/sci/engine/kpathing.cpp
@@ -825,10 +825,10 @@ int PathfindingState::findNearPoint(const Common::Point &p, Polygon *polygon, Co
u = ((p.x - p1.x) * (p2.x - p1.x) + (p.y - p1.y) * (p2.y - p1.y)) / (float)p1.sqrDist(p2);
// Clip to edge
- if (u < 0.0f)
- u = 0.0f;
- if (u > 1.0f)
- u = 1.0f;
+ if (u < 0.0F)
+ u = 0.0F;
+ if (u > 1.0F)
+ u = 1.0F;
new_point.x = p1.x + u * (p2.x - p1.x);
new_point.y = p1.y + u * (p2.y - p1.y);
@@ -1022,6 +1022,9 @@ static Common::Point *fixup_start_point(PathfindingState *s, const Common::Point
if (start != *new_start)
s->_prependPoint = new Common::Point(start);
}
+ break;
+ default:
+ break;
}
++it;
@@ -1079,6 +1082,9 @@ static Common::Point *fixup_end_point(PathfindingState *s, const Common::Point &
if ((type == POLY_NEAREST_ACCESS) && (end != *new_end))
s->_appendPoint = new Common::Point(end);
}
+ break;
+ default:
+ break;
}
++it;
@@ -1499,8 +1505,10 @@ static reg_t output_path(PathfindingState *p, EngineState *s) {
int offset = 0;
- if (p->_prependPoint)
- writePoint(arrayRef, offset++, *p->_prependPoint);
+ if (p->_prependPoint) {
+ writePoint(arrayRef, offset, *p->_prependPoint);
+ offset++;
+ }
vertex = p->vertex_end;
for (int i = path_len - 1; i >= 0; i--) {
@@ -1820,8 +1828,8 @@ reg_t kIntersections(EngineState *s, int argc, reg_t *argv) {
// If intersection point lies on both the query line segment and the poly
// line segment, add it to the output
- if (((PointInRect(Common::Point(intersectionX, intersectionY), pSourceX, pSourceY, pDestX, pDestY))
- && PointInRect(Common::Point(intersectionX, intersectionY), qSourceX, qSourceY, qDestX, qDestY))) {
+ if (PointInRect(Common::Point(intersectionX, intersectionY), pSourceX, pSourceY, pDestX, pDestY)
+ && PointInRect(Common::Point(intersectionX, intersectionY), qSourceX, qSourceY, qDestX, qDestY)) {
outBuf[outCount * 3] = make_reg(0, intersectionX);
outBuf[outCount * 3 + 1] = make_reg(0, intersectionY);
outBuf[outCount * 3 + 2] = make_reg(0, curIndex);
@@ -1878,7 +1886,7 @@ static float pointSegDistance(const Common::Point &a, const Common::Point &b,
FloatPoint bp(b-p);
// Check if the projection of p on the line a-b lies between a and b
- if (ba*pa >= 0.0f && ba*bp >= 0.0f) {
+ if (ba * pa >= 0.0F && ba * bp >= 0.0F) {
// If yes, return the (squared) distance of p to the line a-b:
// translate a to origin, project p and subtract
float linedist = (ba*((ba*pa)/(ba*ba)) - pa).norm();
@@ -1940,12 +1948,12 @@ static bool segSegIntersect(const Vertex *v1, const Vertex *v2, Common::Point &i
if (!len_dc) error("zero length edge in polygon");
- if (pointSegDistance(c, d, a) <= 2.0f) {
+ if (pointSegDistance(c, d, a) <= 2.0F) {
intp = a;
return true;
}
- if (pointSegDistance(c, d, b) <= 2.0f) {
+ if (pointSegDistance(c, d, b) <= 2.0F) {
intp = b;
return true;
}
@@ -1968,7 +1976,7 @@ static bool segSegIntersect(const Vertex *v1, const Vertex *v2, Common::Point &i
static int intersectDir(const Vertex *v1, const Vertex *v2) {
Common::Point p1 = v1->_next->v - v1->v;
Common::Point p2 = v2->_next->v - v2->v;
- return (p1.x*p2.y - p2.x*p1.y);
+ return (p1.x * p2.y - p2.x * p1.y);
}
// Direction of edge in degrees from pos. x-axis, between -180 and 180
@@ -2191,12 +2199,12 @@ bool mergeSinglePolygon(Polygon &work, const Polygon &polygon) {
// edge of poly. Because it starts at polyv->_next, it will skip
// the correct re-entry and proceed to the next.
- const Vertex *workv2;
+ const Vertex *workv2 = workv;
const Vertex *polyv2 = polyv->_next;
intersects = false;
- uint pi2, wi2;
+ uint pi2, wi2 = 0;
for (pi2 = 0; pi2 < polygonSize; ++pi2, polyv2 = polyv2->_next) {
int newAngle = edgeDir(polyv2);
@@ -2457,8 +2465,10 @@ reg_t kMergePoly(EngineState *s, int argc, reg_t *argv) {
Vertex *vertex;
uint32 n = 0;
CLIST_FOREACH(vertex, &work.vertices) {
- if (vertex == work.vertices._head || vertex->v != vertex->_prev->v)
- writePoint(arrayRef, n++, vertex->v);
+ if (vertex == work.vertices._head || vertex->v != vertex->_prev->v) {
+ writePoint(arrayRef, n, vertex->v);
+ n++;
+ }
}
writePoint(arrayRef, n, Common::Point(POLY_LAST_POINT, POLY_LAST_POINT));
diff --git a/engines/sci/engine/scriptdebug.cpp b/engines/sci/engine/scriptdebug.cpp
index 2bb58d4..bf6372b 100644
--- a/engines/sci/engine/scriptdebug.cpp
+++ b/engines/sci/engine/scriptdebug.cpp
@@ -370,6 +370,8 @@ reg_t disassemble(EngineState *s, reg_t pos, const Object *obj, bool printBWTag,
case kSelectorNone:
debugN("INVALID");
break;
+ default:
+ break;
}
}
@@ -938,6 +940,8 @@ void debugSelectorCall(reg_t send_obj, Selector selector, int argc, StackPtr arg
}
}
break;
+ default:
+ break;
} // switch
}
@@ -1039,7 +1043,7 @@ void logKernelCall(const KernelFunction *kernelCall, const KernelSubFunction *ke
// TODO: Any other segment types which could
// use special handling?
- if (kernelCall->function == kSaid) {
+ if (kernelCall->function == &kSaid) {
SegmentRef saidSpec = s->_segMan->dereference(argv[parmNr]);
if (saidSpec.isRaw) {
debugN(" ('");
@@ -1085,7 +1089,8 @@ void logBacktrace() {
switch (call.type) {
case EXEC_STACK_TYPE_CALL: // Normal function
if (call.type == EXEC_STACK_TYPE_CALL)
- con->debugPrintf(" %x: script %d - ", i, s->_segMan->getScript(call.addr.pc.getSegment())->getScriptNumber());
+ con->debugPrintf(" %x: script %d - ", i, s->_segMan->getScript(call.addr.pc.getSegment())->getScriptNumber());
+
if (call.debugSelector != -1) {
con->debugPrintf("%s::%s(", objname, g_sci->getKernel()->getSelectorName(call.debugSelector).c_str());
} else if (call.debugExportId != -1) {
diff --git a/engines/sci/graphics/paint32.cpp b/engines/sci/graphics/paint32.cpp
index f80f115..fc2e4cf 100644
--- a/engines/sci/graphics/paint32.cpp
+++ b/engines/sci/graphics/paint32.cpp
@@ -145,6 +145,7 @@ reg_t GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const Common::
LineProperties properties;
properties.bitmap = &bitmap;
+ properties.solid = true;
switch (style) {
case kLineStyleSolid:
@@ -158,6 +159,8 @@ reg_t GfxPaint32::makeLineBitmap(const Common::Point &startPoint, const Common::
case kLineStylePattern:
properties.solid = pattern == 0xFFFF;
break;
+ default:
+ break;
}
// Change coordinates to be relative to the bitmap
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index b7b3c9ed..0efb257 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -578,8 +578,8 @@ void VMDPlayer::init(int16 x, int16 y, const PlayFlags flags, const int16 boostP
_doublePixels = (flags & kPlayFlagDoublePixels) || upscaleVideos;
_stretchVertical = flags & kPlayFlagStretchVertical;
- const int16 width = _decoder->getWidth() << _doublePixels;
- const int16 height = _decoder->getHeight() << (_doublePixels || _stretchVertical);
+ const int16 width = _decoder->getWidth() << (_doublePixels ? 1 : 0);
+ const int16 height = _decoder->getHeight() << (_doublePixels || _stretchVertical ? 1 : 0);
if (getSciVersion() < SCI_VERSION_3) {
x &= ~1;
@@ -1052,8 +1052,8 @@ void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, con
// SSCI seems to incorrectly calculate the draw rect by scaling the origin
// in addition to the width/height for the BR point
setDrawRect(x, y,
- (_decoder->getWidth() << _doublePixels),
- (_decoder->getHeight() << _doublePixels));
+ (_decoder->getWidth() << (_doublePixels ? 1 : 0)),
+ (_decoder->getHeight() << (_doublePixels ? 1 : 0)));
g_sci->_gfxCursor32->hide();
diff --git a/engines/sci/resource_audio.cpp b/engines/sci/resource_audio.cpp
index 58437a6..879b25f 100644
--- a/engines/sci/resource_audio.cpp
+++ b/engines/sci/resource_audio.cpp
@@ -73,6 +73,7 @@ AudioVolumeResourceSource::AudioVolumeResourceSource(ResourceManager *resMan, co
}
lastEntry->size = fileStream->size() - lastEntry->offset;
+ break;
}
resMan->disposeVolumeFileStream(fileStream, this);
@@ -448,7 +449,7 @@ int ResourceManager::readAudioMapSCI11(IntMapResourceSource *map) {
// works
if ((n & kEndOfMapFlag) == kEndOfMapFlag) {
const uint32 bytesLeft = mapRes->cend() - ptr;
- if (bytesLeft >= entrySize) {
+ if (bytesLeft >= entrySize && entrySize > 0) {
warning("End of %s reached, but %u entries remain", mapResId.toString().c_str(), bytesLeft / entrySize);
}
break;
Commit: 174721e911497ab232915da5ebed7c5d5f2b86ba
https://github.com/scummvm/scummvm/commit/174721e911497ab232915da5ebed7c5d5f2b86ba
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:42+03:00
Commit Message:
SCUMM: Fix MSVC warnings
- Change float suffix to uppercase
- Initialize potentially uninitialized variables
- Fix default cases in switch statements
Changed paths:
engines/scumm/he/logic/soccer.cpp
engines/scumm/he/moonbase/ai_main.cpp
diff --git a/engines/scumm/he/logic/soccer.cpp b/engines/scumm/he/logic/soccer.cpp
index 0efe482..e01363c 100644
--- a/engines/scumm/he/logic/soccer.cpp
+++ b/engines/scumm/he/logic/soccer.cpp
@@ -200,7 +200,7 @@ int LogicHEsoccer::op_1005(float x1, float y1, float z1, float x2, float y2, flo
*nextVelX = x2 - 2 * dot * x1;
*nextVelY = y2 - 2 * dot * y1;
*nextVelZ = z2 - 2 * dot * z1;
- *a10 = 1.0f; // It always does this. How curious!
+ *a10 = 1.0F; // It always does this. How curious!
return 1;
}
diff --git a/engines/scumm/he/moonbase/ai_main.cpp b/engines/scumm/he/moonbase/ai_main.cpp
index c5c1f6a..d6ab54c 100644
--- a/engines/scumm/he/moonbase/ai_main.cpp
+++ b/engines/scumm/he/moonbase/ai_main.cpp
@@ -491,6 +491,9 @@ int AI::masterControlProgram(const int paramCount, const int32 *params) {
case -1:
_aiState = STATE_LAUNCH;
break;
+
+ default:
+ break;
}
delete myTree;
@@ -778,8 +781,8 @@ int AI::masterControlProgram(const int paramCount, const int32 *params) {
}
if ((lastSource[currentPlayer] == launchAction[LAUNCH_SOURCE_HUB]) && (lastAngle[currentPlayer] == launchAction[LAUNCH_ANGLE]) && (lastPower[currentPlayer] == launchAction[LAUNCH_POWER])) {
- randomAttenuation -= .2f;
- randomAttenuation = MAX(randomAttenuation, 0.0f);
+ randomAttenuation -= .2F;
+ randomAttenuation = MAX(randomAttenuation, 0.0F);
debugC(DEBUG_MOONBASE_AI, "Attenuating...");
} else {
randomAttenuation = 1;
@@ -1643,7 +1646,7 @@ int AI::chooseTarget(int behavior) {
int returnBuilding = 0;
int savedTally = 0;
- int savedDamage;
+ int savedDamage = 0;
float savedNumDefenses = 0;
int savedWorth = 0;
@@ -2756,9 +2759,10 @@ int AI::energyPoolSize(int pool) {
case 63:
return 60;
+
+ default:
+ return 0;
}
-
- return 0;
}
int AI::getMaxCollectors(int pool) {
Commit: f4e8eed13d7da5bcd87db7424358bf0d8759208f
https://github.com/scummvm/scummvm/commit/f4e8eed13d7da5bcd87db7424358bf0d8759208f
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:43+03:00
Commit Message:
SLUDGE: Fix MSVC warnings
- Fix invalid check with empty()
- Change float suffixes to uppercase
- Fix potentially uninitialized variables
Changed paths:
engines/sludge/fonttext.cpp
engines/sludge/movie.cpp
engines/sludge/people.cpp
engines/sludge/sprites.cpp
diff --git a/engines/sludge/fonttext.cpp b/engines/sludge/fonttext.cpp
index da380f4..6163c44 100644
--- a/engines/sludge/fonttext.cpp
+++ b/engines/sludge/fonttext.cpp
@@ -175,7 +175,7 @@ bool TextManager::loadFont(int filenum, const Common::String &charOrder, int h)
// load & save
void TextManager::saveFont(Common::WriteStream *stream) {
stream->writeByte(!_fontTable.empty());
- if (!_fontTable.empty() > 0) {
+ if (!_fontTable.empty()) {
stream->writeUint16BE(_loadedFontNum);
stream->writeUint16BE(_fontHeight);
writeString(_fontOrder.getUTF8String(), stream);
diff --git a/engines/sludge/movie.cpp b/engines/sludge/movie.cpp
index 2c43c3c..4fc2bee 100644
--- a/engines/sludge/movie.cpp
+++ b/engines/sludge/movie.cpp
@@ -38,7 +38,7 @@ MovieStates movieIsPlaying = nothing;
int movieIsEnding = 0;
-float movieAspect = 1.6;
+float movieAspect = 1.6F;
#if 0
typedef struct audioBuffers {
char *buffer;
diff --git a/engines/sludge/people.cpp b/engines/sludge/people.cpp
index 433ab2d..2d29319 100644
--- a/engines/sludge/people.cpp
+++ b/engines/sludge/people.cpp
@@ -66,7 +66,7 @@ PersonaAnimation::PersonaAnimation(int num, VariableStack *&stacky) {
theSprites = nullptr;
numFrames = num;
frames = new AnimFrame[num];
- int a = num, frameNum, howMany;
+ int a = num, frameNum = 0, howMany = 0;
while (a) {
a--;
diff --git a/engines/sludge/sprites.cpp b/engines/sludge/sprites.cpp
index 49c27db..a7f82de 100644
--- a/engines/sludge/sprites.cpp
+++ b/engines/sludge/sprites.cpp
@@ -384,11 +384,11 @@ Graphics::Surface *GraphicsManager::applyLightmapToSprite(Graphics::Surface *&bl
// calculate light map color
float fr, fg, fb;
- fr = fg = fb = 0.f;
+ fr = fg = fb = 0.0F;
if (thisPerson->colourmix) {
- fr = curLight[0]*thisPerson->r * thisPerson->colourmix / 65025 / 255.f;
- fg = curLight[1]*thisPerson->g * thisPerson->colourmix / 65025 / 255.f;
- fb = curLight[2]*thisPerson->b * thisPerson->colourmix / 65025 / 255.f;
+ fr = curLight[0]*thisPerson->r * thisPerson->colourmix / 65025 / 255.0F;
+ fg = curLight[1]*thisPerson->g * thisPerson->colourmix / 65025 / 255.0F;
+ fb = curLight[2]*thisPerson->b * thisPerson->colourmix / 65025 / 255.0F;
}
uint32 primaryColor = TS_ARGB((uint8)(255 - thisPerson->transparency),
Commit: f6af273fca66678bfa805184b8e6ac5ea4892291
https://github.com/scummvm/scummvm/commit/f6af273fca66678bfa805184b8e6ac5ea4892291
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:44+03:00
Commit Message:
STARTREK: Fix MSVC warnings
- Disable duplicate if block
- Fix potentially uninitialized variables
- Change _activeMenu to be a regular pointer, instead of a SharedPtr - it was not
initialized correctly
- Fix struct packing in structs with pointers to complex objects
- Fix sound initialization
- Fix memory leaks (handles to files which were never deleted)
Changed paths:
engines/startrek/awaymission.cpp
engines/startrek/math.cpp
engines/startrek/menu.cpp
engines/startrek/room.h
engines/startrek/sound.cpp
engines/startrek/startrek.cpp
engines/startrek/startrek.h
diff --git a/engines/startrek/awaymission.cpp b/engines/startrek/awaymission.cpp
index 9edf121..3f33d1f 100644
--- a/engines/startrek/awaymission.cpp
+++ b/engines/startrek/awaymission.cpp
@@ -410,8 +410,8 @@ void StarTrekEngine::awayMissionUseObject(int16 clickedObject) {
else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
tryWalkToHotspot = true;
// CHECKME: Identical to the previous check, thus never used
- else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
- tryWalkToHotspot = true;
+ //else if (_awayMission.activeObject == OBJECT_MCCOY && _room->actionHasCode(ACTION_USE, OBJECT_IMEDKIT, _awayMission.passiveObject, 0))
+ // tryWalkToHotspot = true;
else if (_awayMission.activeObject == OBJECT_SPOCK && _room->actionHasCode(ACTION_USE, OBJECT_ISTRICOR, _awayMission.passiveObject, 0))
tryWalkToHotspot = true;
diff --git a/engines/startrek/math.cpp b/engines/startrek/math.cpp
index 7770ed3..f9527dd 100644
--- a/engines/startrek/math.cpp
+++ b/engines/startrek/math.cpp
@@ -83,7 +83,7 @@ Angle StarTrekEngine::atan2(int32 deltaX, int32 deltaY) {
int16 endIndex = 128;
int16 index = 0;
- int16 angle;
+ int16 angle = 0;
while (index <= endIndex) {
angle = (index + endIndex) / 2;
Fixed14 tableValue = Fixed14::fromRaw(atanTable[angle]);
diff --git a/engines/startrek/menu.cpp b/engines/startrek/menu.cpp
index 0ef1659..a4a3739 100644
--- a/engines/startrek/menu.cpp
+++ b/engines/startrek/menu.cpp
@@ -499,8 +499,8 @@ void StarTrekEngine::loadMenuButtons(String mnuFilename, int xpos, int ypos) {
if (_activeMenu == nullptr)
_keyboardControlsMouseOutsideMenu = _keyboardControlsMouse;
- SharedPtr<Menu> oldMenu = _activeMenu;
- _activeMenu = SharedPtr<Menu>(new Menu());
+ Menu *oldMenu = _activeMenu;
+ _activeMenu = new Menu();
_activeMenu->nextMenu = oldMenu;
SharedPtr<FileStream> stream = loadFile(mnuFilename + ".MNU");
@@ -851,7 +851,9 @@ void StarTrekEngine::unloadMenuButtons() {
_gfx->delSprite(sprite);
}
+ Menu *prevMenu = _activeMenu;
_activeMenu = _activeMenu->nextMenu;
+ delete prevMenu;
if (_activeMenu == nullptr)
_keyboardControlsMouse = _keyboardControlsMouseOutsideMenu;
diff --git a/engines/startrek/room.h b/engines/startrek/room.h
index b6a7d5d..8e0e3a3 100644
--- a/engines/startrek/room.h
+++ b/engines/startrek/room.h
@@ -42,12 +42,16 @@ namespace StarTrek {
class StarTrekEngine;
class Room;
+#include "common/pack-start.h" // START STRUCT PACKING
+
// Per-room action functions
struct RoomAction {
const Action action;
void (Room::*funcPtr)();
};
+#include "common/pack-end.h" // END STRUCT PACKING
+
// Offsets of data in RDF files
const int RDF_BAN_DATA_START = 0x1e;
diff --git a/engines/startrek/sound.cpp b/engines/startrek/sound.cpp
index f7f9338..ae31727 100644
--- a/engines/startrek/sound.cpp
+++ b/engines/startrek/sound.cpp
@@ -35,7 +35,7 @@ namespace StarTrek {
// Main Sound Functions
Sound::Sound(StarTrekEngine *vm) : _vm(vm) {
- _midiDevice = MT_INVALID;
+ _midiDevice = MT_AUTO;
_midiDriver = nullptr;
_loopingMidiTrack = false;
diff --git a/engines/startrek/startrek.cpp b/engines/startrek/startrek.cpp
index 0a3a89a..968bc3c 100644
--- a/engines/startrek/startrek.cpp
+++ b/engines/startrek/startrek.cpp
@@ -67,6 +67,7 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam
DebugMan.addDebugChannel(kDebugGeneral, "general", "General");
_gfx = nullptr;
+ _activeMenu = nullptr;
_sound = nullptr;
_macResFork = nullptr;
@@ -104,6 +105,8 @@ StarTrekEngine::StarTrekEngine(OSystem *syst, const StarTrekGameDescription *gam
}
StarTrekEngine::~StarTrekEngine() {
+ delete _activeMenu->nextMenu;
+ delete _activeMenu;
delete _gfx;
delete _sound;
delete _macResFork;
@@ -418,11 +421,15 @@ SharedPtr<FileStream> StarTrekEngine::loadFile(Common::String filename, int file
// The Judgment Rites demo has its files not in the standard archive
if (getGameType() == GType_STJR && (getFeatures() & GF_DEMO)) {
Common::File *file = new Common::File();
- if (!file->open(filename.c_str()))
+ if (!file->open(filename.c_str())) {
+ delete file;
error("Could not find file \'%s\'", filename.c_str());
- byte *data = (byte *)malloc(file->size());
- file->read(data, file->size());
- return SharedPtr<FileStream>(new FileStream(data, file->size(), bigEndian));
+ }
+ int32 size = file->size();
+ byte *data = (byte *)malloc(size);
+ file->read(data, size);
+ delete file;
+ return SharedPtr<FileStream>(new FileStream(data, size, bigEndian));
}
Common::SeekableReadStream *indexFile = 0;
diff --git a/engines/startrek/startrek.h b/engines/startrek/startrek.h
index 373778e..bfc8266 100644
--- a/engines/startrek/startrek.h
+++ b/engines/startrek/startrek.h
@@ -162,7 +162,7 @@ struct Menu {
SharedPtr<FileStream> menuFile;
uint16 numButtons;
int16 selectedButton;
- SharedPtr<Menu> nextMenu;
+ Menu *nextMenu;
};
// Special events that can be returned by handleMenuEvents.
@@ -646,7 +646,7 @@ private:
uint32 _textboxVar2;
uint16 _textboxVar6;
bool _textboxHasMultipleChoices;
- SharedPtr<Menu> _activeMenu;
+ Menu *_activeMenu;
// Saved value of StarTrekEngine::_keyboardControlsMouse when menus are up
bool _keyboardControlsMouseOutsideMenu;
Commit: a5614eeaac90c1fb1acb2a714f50e97ac37ea2f4
https://github.com/scummvm/scummvm/commit/a5614eeaac90c1fb1acb2a714f50e97ac37ea2f4
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:45+03:00
Commit Message:
TITANIC: Change add float suffixes to float assignments
Changed paths:
engines/titanic/star_control/frange.cpp
diff --git a/engines/titanic/star_control/frange.cpp b/engines/titanic/star_control/frange.cpp
index 7e42bad..d105731 100644
--- a/engines/titanic/star_control/frange.cpp
+++ b/engines/titanic/star_control/frange.cpp
@@ -29,8 +29,8 @@ FRange::FRange() {
}
void FRange::reset() {
- _min._x = _min._y = _min._z = 9.9999994e27;
- _max._x = _max._y = _max._z = -9.9999994e27;
+ _min._x = _min._y = _min._z = 9.9999994e27F;
+ _max._x = _max._y = _max._z = -9.9999994e27F;
}
void FRange::expand(const FVector &v) {
Commit: 80f773c9151b00995b986e96eedfe91400b028ad
https://github.com/scummvm/scummvm/commit/80f773c9151b00995b986e96eedfe91400b028ad
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:45+03:00
Commit Message:
WINTERMUTE: Remove unused variable
Changed paths:
engines/wintermute/debugger/debugger_controller.cpp
diff --git a/engines/wintermute/debugger/debugger_controller.cpp b/engines/wintermute/debugger/debugger_controller.cpp
index 38f8623..8d1968d 100644
--- a/engines/wintermute/debugger/debugger_controller.cpp
+++ b/engines/wintermute/debugger/debugger_controller.cpp
@@ -241,7 +241,7 @@ Error DebuggerController::setValue(const Common::String &name, const Common::Str
// Something funny happened here.
}
} else if (var->_type == VAL_BOOL) {
- Common::String str = Common::String(trimmed);
+ //Common::String str = Common::String(trimmed);
bool valAsBool;
if (Common::parseBool(trimmed, valAsBool)) {
var->setBool(valAsBool);
Commit: 7346b69d886b10adc93e848ea3c609b253e162f6
https://github.com/scummvm/scummvm/commit/7346b69d886b10adc93e848ea3c609b253e162f6
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2019-05-27T14:53:46+03:00
Commit Message:
GRAPHICS: Initialize potentially uninitialized variables
Changed paths:
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 4edc924..8f1c293 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -190,7 +190,7 @@ void MacTextWindow::drawSelection() {
end = MIN((int)getInnerDimensions().height(), end);
int numLines = 0;
- int x1, x2;
+ int x1 = 0, x2 = 0;
for (int y = start; y < end; y++) {
if (!numLines) {
More information about the Scummvm-git-logs
mailing list