diff options
Diffstat (limited to 'engines/scumm')
-rw-r--r-- | engines/scumm/debugger.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/he/resource_he.cpp | 13 | ||||
-rw-r--r-- | engines/scumm/insane/insane.cpp | 6 | ||||
-rw-r--r-- | engines/scumm/object.cpp | 3 | ||||
-rw-r--r-- | engines/scumm/palette.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/script_v5.cpp | 1 | ||||
-rw-r--r-- | engines/scumm/scumm.cpp | 3 |
7 files changed, 20 insertions, 12 deletions
diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index b5a4070f0b..45a407629b 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -87,7 +87,7 @@ ScummDebugger::ScummDebugger(ScummEngine *s) if (_vm->_game.id == GID_LOOM) DCmd_Register("drafts", WRAP_METHOD(ScummDebugger, Cmd_PrintDraft)); - if (_vm->_game.id == GID_MONKEY && Common::kPlatformSegaCD) + if (_vm->_game.id == GID_MONKEY && _vm->_game.platform == Common::kPlatformSegaCD) DCmd_Register("passcode", WRAP_METHOD(ScummDebugger, Cmd_Passcode)); DCmd_Register("loadgame", WRAP_METHOD(ScummDebugger, Cmd_LoadGame)); diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index c259c3ffd2..9310b5758f 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -281,11 +281,13 @@ int Win32ResExtractor::extract_resources(WinLibrary *fi, WinResource *wr, if ((id = strtol(type_wr->id, 0, 10)) != 0) type = res_type_id_to_string(id); - debugC(DEBUG_RESOURCE, "extractCursor(). Found cursor name: %s%s%s [size=%d]", - name_wr->get_resource_id_quoted(), - (lang_wr->id[0] != '\0' ? " language: " : ""), - lang_wr->get_resource_id_quoted(), size); - + if (lang_wr != NULL && lang_wr->id[0] != '\0') { + debugC(DEBUG_RESOURCE, "extractCursor(). Found cursor name: %s language: %s [size=%d]", + name_wr->get_resource_id_quoted(), lang_wr->get_resource_id_quoted(), size); + } else { + debugC(DEBUG_RESOURCE, "extractCursor(). Found cursor name: %s [size=%d]", + name_wr->get_resource_id_quoted(), size); + } return size; } @@ -696,6 +698,7 @@ bool Win32ResExtractor::read_library(WinLibrary *fi) { return false; } fi->memory = (byte *)realloc(fi->memory, fi->total_size); + assert(fi->memory); /* relocate memory, start from last section */ pe_header = PE_HEADER(fi->memory); diff --git a/engines/scumm/insane/insane.cpp b/engines/scumm/insane/insane.cpp index 3876bd4e80..f2e50382b3 100644 --- a/engines/scumm/insane/insane.cpp +++ b/engines/scumm/insane/insane.cpp @@ -944,7 +944,7 @@ bool Insane::actor1StateFlags(int state) { bool retvalue = 0; unsigned int i; - for (i = 0; i < sizeof(spans); i++) { + for (i = 0; i < ARRAYSIZE(spans); i++) { retvalue = !retvalue; if (spans[i] <= state) break; @@ -1099,7 +1099,7 @@ bool Insane::actor0StateFlags1(int state) { bool retvalue = 1; unsigned int i; - for (i = 0; i < sizeof(spans); i++) { + for (i = 0; i < ARRAYSIZE(spans); i++) { retvalue = !retvalue; if (spans[i] >= state) break; @@ -1119,7 +1119,7 @@ bool Insane::actor0StateFlags2(int state) { bool retvalue = 1; unsigned int i; - for (i = 0; i < sizeof(spans); i++) { + for (i = 0; i < ARRAYSIZE(spans); i++) { retvalue = !retvalue; if (spans[i] >= state) break; diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index e2b68f8d3b..60c3a9336e 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -993,6 +993,7 @@ void ScummEngine::resetRoomObject(ObjectData *od, const byte *room, const byte * od->flags = Gdi::dbAllowMaskOr; if (_game.version == 8) { + assert(imhd); od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); od->parent = cdhd->v7.parent; @@ -1008,6 +1009,7 @@ void ScummEngine::resetRoomObject(ObjectData *od, const byte *room, const byte * od->flags = ((((byte)READ_LE_UINT32(&imhd->v8.flags)) & 16) == 0) ? Gdi::dbAllowMaskOr : 0; } else if (_game.version == 7) { + assert(imhd); od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); od->parent = cdhd->v7.parent; @@ -1020,6 +1022,7 @@ void ScummEngine::resetRoomObject(ObjectData *od, const byte *room, const byte * od->actordir = (byte)READ_LE_UINT16(&imhd->v7.actordir); } else if (_game.version == 6) { + assert(imhd); od->obj_nr = READ_LE_UINT16(&(cdhd->v6.obj_id)); od->width = READ_LE_UINT16(&cdhd->v6.w); diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index 5c0c58595b..1402adadbf 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -498,7 +498,7 @@ void ScummEngine::cyclePalette() { int i, j; #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE - if (_game.platform == Common::kPlatformFMTowns && (!_townsPaletteFlags & 1)) + if (_game.platform == Common::kPlatformFMTowns && !(_townsPaletteFlags & 1)) return; #endif @@ -544,7 +544,7 @@ void ScummEngine::moveMemInPalRes(int start, int end, byte direction) { void ScummEngine::palManipulateInit(int resID, int start, int end, int time) { #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE - if (_game.platform == Common::kPlatformFMTowns && (!_townsPaletteFlags & 1)) + if (_game.platform == Common::kPlatformFMTowns && !(_townsPaletteFlags & 1)) return; #endif diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index ea903fc108..a702c9ae10 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -1849,6 +1849,7 @@ void ScummEngine_v5::o5_roomOps() { break; len *= 2; ptr = (byte *)realloc(ptr, len); + assert(ptr); } ptr[cnt] = '\0'; loadPtrToResource(rtString, a, ptr); diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 86bb772c7a..68adeeffc2 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -136,7 +136,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) uint tmpVal; tmpStr[0] = dr.md5[2*i]; tmpStr[1] = dr.md5[2*i+1]; - sscanf(tmpStr, "%x", &tmpVal); + int res = sscanf(tmpStr, "%x", &tmpVal); + assert(res == 1); _gameMD5[i] = (byte)tmpVal; } |