aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorFilippos Karapetis2019-05-27 14:41:54 +0300
committerFilippos Karapetis2019-05-27 14:53:41 +0300
commit9da3d22703a0dc230d505e9839c3e33cc313b403 (patch)
treeace8fe6b3c9a5f6c0170745902e7048f0d67aec4 /engines
parent87e13a50488fea398885eae8c46e01898a9fe41f (diff)
downloadscummvm-rg350-9da3d22703a0dc230d505e9839c3e33cc313b403.tar.gz
scummvm-rg350-9da3d22703a0dc230d505e9839c3e33cc313b403.tar.bz2
scummvm-rg350-9da3d22703a0dc230d505e9839c3e33cc313b403.zip
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
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/console.cpp80
-rw-r--r--engines/sci/engine/kpathing.cpp42
-rw-r--r--engines/sci/engine/scriptdebug.cpp9
-rw-r--r--engines/sci/graphics/paint32.cpp3
-rw-r--r--engines/sci/graphics/video32.cpp8
-rw-r--r--engines/sci/resource_audio.cpp3
6 files changed, 80 insertions, 65 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp
index 6d75e59916..8409ca0440 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], &reg, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &reg)) {
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], &reg_end, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[2], &reg_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], &reg, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &reg)) {
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], &reg_end, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[2], &reg_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], &reg, false)) {
+ if (parse_reg_t(_engine->_gamestate, argv[1], &reg)) {
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 3177fbdd07..afa743b4b6 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 2bb58d4ff2..bf6372bf8e 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 f80f115e1b..fc2e4cf491 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 b7b3c9ed78..0efb2570a0 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 58437a653f..879b25f74c 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;