diff --git a/engines/scumm/actor.cpp b/engines/scumm/actor.cpp index 24782506411..600d6ebd9b7 100644 --- a/engines/scumm/actor.cpp +++ b/engines/scumm/actor.cpp @@ -106,7 +106,7 @@ static const byte v0WalkboxSlantedModifier[0x16] = { Actor::Actor(ScummEngine *scumm, int id) : _vm(scumm), _number(id) { - assert(_vm != 0); + assert(_vm != nullptr); } void ActorHE::initActor(int mode) { @@ -2118,7 +2118,7 @@ Actor *ScummEngine::derefActorSafe(int id, const char *errmsg) const { if (!isValidActor(id)) { debugC(DEBUG_ACTORS, "Invalid actor %d in %s (script %d, opcode 0x%x)", id, errmsg, vm.slot[_currentScript].number, _opcode); - return NULL; + return nullptr; } return _actors[id]; } @@ -3209,7 +3209,7 @@ static const char *const v0ActorNames_German[25] = { }; const byte *Actor::getActorName() { - const byte *ptr = NULL; + const byte *ptr = nullptr; if (_vm->_game.version == 0) { if (_number) { @@ -3225,7 +3225,7 @@ const byte *Actor::getActorName() { ptr = _vm->getResourceAddress(rtActorName, _number); } - if (ptr == NULL) { + if (ptr == nullptr) { debugC(DEBUG_ACTORS, "Failed to find name of actor %d", _number); } return ptr; diff --git a/engines/scumm/akos.cpp b/engines/scumm/akos.cpp index 86e661969bf..9648dd11acb 100644 --- a/engines/scumm/akos.cpp +++ b/engines/scumm/akos.cpp @@ -349,7 +349,7 @@ void AkosRenderer::setCostume(int costume, int shadow) { akct = _vm->findResourceData(MKTAG('A','K','C','T'), akos); rgbs = _vm->findResourceData(MKTAG('R','G','B','S'), akos); - xmap = 0; + xmap = nullptr; if (shadow) { const uint8 *xmapPtr = _vm->getResourceAddress(rtImage, shadow); assert(xmapPtr); @@ -1084,7 +1084,7 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) { bdd.shadowMode = _shadow_mode; bdd.shadowPalette = _vm->_shadowPalette; - bdd.actorPalette = _useBompPalette ? _palette : 0; + bdd.actorPalette = _useBompPalette ? _palette : nullptr; bdd.mirror = !_mirror; @@ -1117,7 +1117,7 @@ void AkosRenderer::akos16SetupBitReader(const byte *src) { void AkosRenderer::akos16SkipData(int32 numbytes) { - akos16DecodeLine(0, numbytes, 0); + akos16DecodeLine(nullptr, numbytes, 0); } void AkosRenderer::akos16DecodeLine(byte *buf, int32 numbytes, int32 dir) { @@ -1629,7 +1629,7 @@ bool ScummEngine_v6::akos_increaseAnim(Actor *a, int chan, const byte *aksq, con akos_queCommand(6, a, GW(2), GW(4)); continue; case AKC_JumpTable: - if (akfo == NULL) + if (akfo == nullptr) error("akos_increaseAnim: no AKFO table"); tmp = a->getAnimVar(GB(2)) - 1; if (_game.heversion >= 80) { diff --git a/engines/scumm/bomp.cpp b/engines/scumm/bomp.cpp index a0c4e67e4b1..07400ab8132 100644 --- a/engines/scumm/bomp.cpp +++ b/engines/scumm/bomp.cpp @@ -200,9 +200,9 @@ void bompScaleFuncX(byte *line_buffer, byte *scaling_x_ptr, byte skip, int32 siz void drawBomp(const BompDrawData &bd) { const byte *src; byte *dst; - byte *mask = 0; + byte *mask = nullptr; Common::Rect clip; - byte *scalingYPtr = 0; + byte *scalingYPtr = nullptr; byte skip_y_bits = 0x80; byte skip_y_new = 0; byte tmp; diff --git a/engines/scumm/boxes.cpp b/engines/scumm/boxes.cpp index fcc5941b918..9212e17b244 100644 --- a/engines/scumm/boxes.cpp +++ b/engines/scumm/boxes.cpp @@ -339,7 +339,7 @@ void ScummEngine::convertScaleTableToScaleSlot(int slot) { float m, oldM; // Do nothing if the given scale table doesn't exist - if (resptr == 0) + if (resptr == nullptr) return; if (resptr[0] == resptr[199]) { @@ -453,12 +453,12 @@ byte ScummEngine::getNumBoxes() { Box *ScummEngine::getBoxBaseAddr(int box) { byte *ptr = getResourceAddress(rtMatrix, 2); if (!ptr || box == 255) - return NULL; + return nullptr; // WORKAROUND: The NES version of Maniac Mansion attempts to set flags for boxes 2-4 // when there are only three boxes (0-2) when walking out to the garage. if ((_game.id == GID_MANIAC) && (_game.platform == Common::kPlatformNES) && (box >= ptr[0])) - return NULL; + return nullptr; // WORKAROUND: In "pass to adventure", the loom demo, when bobbin enters // the tent to the elders, box = 2, but ptr[0] = 2 -> errors out. diff --git a/engines/scumm/camera.cpp b/engines/scumm/camera.cpp index 815d6f9ca2f..9dc7d9eafd5 100644 --- a/engines/scumm/camera.cpp +++ b/engines/scumm/camera.cpp @@ -52,7 +52,7 @@ void ScummEngine::setCameraAt(int pos_x, int pos_y) { if (VAR_SCROLL_SCRIPT != 0xFF && VAR(VAR_SCROLL_SCRIPT)) { VAR(VAR_CAMERA_POS_X) = camera._cur.x; - runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0); + runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, nullptr); } // If the camera moved and text is visible, remove it @@ -68,7 +68,7 @@ void ScummEngine::setCameraFollows(Actor *a, bool setCamera) { camera._follows = a->_number; if (!a->isInCurrentRoom()) { - startScene(a->getRoom(), 0, 0); + startScene(a->getRoom(), nullptr, 0); camera._mode = kFollowActorCameraMode; camera._cur.x = a->getPos().x; setCameraAt(camera._cur.x, 0); @@ -94,7 +94,7 @@ void ScummEngine::clampCameraPos(Common::Point *pt) { void ScummEngine::moveCamera() { int pos = camera._cur.x; int t; - Actor *a = NULL; + Actor *a = nullptr; const bool snapToX = (_snapScroll || (VAR_CAMERA_FAST_X != 0xFF && VAR(VAR_CAMERA_FAST_X))); camera._cur.x &= 0xFFF8; @@ -163,7 +163,7 @@ void ScummEngine::moveCamera() { if (VAR_SCROLL_SCRIPT != 0xFF && VAR(VAR_SCROLL_SCRIPT) && pos != camera._cur.x) { VAR(VAR_CAMERA_POS_X) = camera._cur.x; - runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, 0); + runScript(VAR(VAR_SCROLL_SCRIPT), 0, 0, nullptr); } } diff --git a/engines/scumm/cdda.cpp b/engines/scumm/cdda.cpp index 2e380d02d8a..70420c2944b 100644 --- a/engines/scumm/cdda.cpp +++ b/engines/scumm/cdda.cpp @@ -110,11 +110,11 @@ Audio::SeekableAudioStream *makeCDDAStream( Audio::SeekableAudioStream *s = new CDDAStream(stream, disposeAfterUse); if (s && s->endOfData()) { delete s; - return 0; + return nullptr; } else { return s; } - return 0; + return nullptr; } } // End of namespace Scumm diff --git a/engines/scumm/charset-fontdata.cpp b/engines/scumm/charset-fontdata.cpp index a1e92a9950e..a6d0e9a8d9a 100644 --- a/engines/scumm/charset-fontdata.cpp +++ b/engines/scumm/charset-fontdata.cpp @@ -591,7 +591,7 @@ CharsetRendererV2::CharsetRendererV2(ScummEngine *vm, Common::Language language) _fontHeight = 8; _curId = 0; - const byte *replacementMap = NULL, *replacementData = NULL; + const byte *replacementMap = nullptr, *replacementData = nullptr; int replacementChars = 0; switch (language) { diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 471f9799cd8..7ae0097ca1e 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -104,7 +104,7 @@ void ScummEngine::loadCJKFont() { (_game.version >= 7 && (_language == Common::JA_JPN || _language == Common::ZH_TWN)) || (_game.version >= 3 && _language == Common::ZH_CHN)) { int numChar = 0; - const char *fontFile = NULL; + const char *fontFile = nullptr; switch (_language) { case Common::KO_KOR: @@ -185,13 +185,13 @@ void ScummEngine::loadKorFont() { if (_useMultiFont) { debug("Loading Korean Multi Font System"); _numLoadedFont = 0; - _2byteFontPtr = NULL; + _2byteFontPtr = nullptr; _2byteWidth = 0; _2byteHeight = 0; for (int i = 0; i < 20; i++) { char fontFile[256]; snprintf(fontFile, sizeof(fontFile), "korean%02d.fnt", i); - _2byteMultiFontPtr[i] = NULL; + _2byteMultiFontPtr[i] = nullptr; if (fp.open(fontFile)) { _numLoadedFont++; fp.readByte(); @@ -204,7 +204,7 @@ void ScummEngine::loadKorFont() { warning("#%d, size %d, height =%d", i, fontSize, _2byteMultiHeight[i]); fp.read(_2byteMultiFontPtr[i], fontSize); fp.close(); - if (_2byteFontPtr == NULL) { // for non-initialized Smushplayer drawChar + if (_2byteFontPtr == nullptr) { // for non-initialized Smushplayer drawChar _2byteFontPtr = _2byteMultiFontPtr[i]; _2byteWidth = _2byteMultiWidth[i]; _2byteHeight = _2byteMultiHeight[i]; @@ -238,7 +238,7 @@ void ScummEngine::loadKorFont() { byte *ScummEngine::get2byteCharPtr(int idx) { if (_game.platform == Common::kPlatformFMTowns || _game.platform == Common::kPlatformPCEngine) - return 0; + return nullptr; switch (_language) { case Common::KO_KOR: @@ -251,7 +251,7 @@ byte *ScummEngine::get2byteCharPtr(int idx) { int charsetId = 5; int numChar = 1413; byte *charsetPtr = getResourceAddress(rtCharset, charsetId); - if (charsetPtr == 0) + if (charsetPtr == nullptr) error("ScummEngine::get2byteCharPtr: charset %d not found", charsetId); memcpy(_2byteFontPtr, charsetPtr + 46, _2byteWidth * _2byteHeight * numChar / 8); } @@ -349,7 +349,7 @@ void CharsetRendererCommon::setCurID(int32 id) { _curId = id; _fontPtr = _vm->getResourceAddress(rtCharset, id); - if (_fontPtr == 0) + if (_fontPtr == nullptr) error("CharsetRendererCommon::setCurID: charset %d not found", id); if (_vm->_game.version == 4) @@ -398,7 +398,7 @@ void CharsetRendererV3::setCurID(int32 id) { _curId = id; _fontPtr = _vm->getResourceAddress(rtCharset, id); - if (_fontPtr == 0) + if (_fontPtr == nullptr) error("CharsetRendererCommon::setCurID: charset %d not found", id); _bytesPerPixel = 1; @@ -841,7 +841,7 @@ void CharsetRendererV3::printChar(int chr, bool ignoreCharsetMask) { assertRange(0, _curId, _vm->_numCharsets - 1, "charset"); - if ((vs = _vm->findVirtScreen(_top)) == NULL) { + if ((vs = _vm->findVirtScreen(_top)) == nullptr) { warning("findVirtScreen(%d) failed, therefore printChar cannot print '%c'", _top, chr); return; } @@ -981,7 +981,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { assertRange(1, _curId, _vm->_numCharsets - 1, "charset"); - if ((vs = _vm->findVirtScreen(_top)) == NULL && (vs = _vm->findVirtScreen(_top + getFontHeight())) == NULL) + if ((vs = _vm->findVirtScreen(_top)) == nullptr && (vs = _vm->findVirtScreen(_top + getFontHeight())) == nullptr) return; if (chr == '@') @@ -1078,7 +1078,7 @@ void CharsetRendererClassic::printChar(int chr, bool ignoreCharsetMask) { void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr, int origWidth, int origHeight, int width, int height, VirtScreen *vs, bool ignoreCharsetMask) { byte *dstPtr; - byte *back = NULL; + byte *back = nullptr; int drawTop = _top - vs->topline; if ((_vm->_game.heversion >= 71 && _bytesPerPixel >= 8) || (_vm->_game.heversion >= 90 && _bytesPerPixel == 0)) { @@ -1242,7 +1242,7 @@ void CharsetRendererClassic::drawBitsN(const Graphics::Surface &s, byte *dst, co // Indy4 Amiga always uses the room or verb palette map to match colors to // the currently setup palette, thus we need to select it over here too. // Done like the original interpreter. - byte *amigaMap = 0; + byte *amigaMap = nullptr; if (_vm->_game.platform == Common::kPlatformAmiga && _vm->_game.id == GID_INDY4) { if (_drawScreen == kVerbVirtScreen) amigaMap = _vm->_verbPalette; @@ -1507,7 +1507,7 @@ CharsetRendererMac::CharsetRendererMac(ScummEngine *vm, const Common::String &fo _correctFontSpacing = correctFontSpacing; _pad = false; - _glyphSurface = NULL; + _glyphSurface = nullptr; // Indy 3 provides an "Indy" font in two sizes, 9 and 12, which are // used for the text boxes. The smaller font can be used for a @@ -1685,7 +1685,7 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) { VirtScreen *vs; - if ((vs = _vm->findVirtScreen(_top)) == NULL) { + if ((vs = _vm->findVirtScreen(_top)) == nullptr) { warning("findVirtScreen(%d) failed, therefore printChar cannot print '%c'", _top, chr); return; } @@ -2134,7 +2134,7 @@ void CharsetRendererNES::printChar(int chr, bool ignoreCharsetMask) { if (_top == 0) _top = 16; - if ((vs = _vm->findVirtScreen(_top)) == NULL) + if ((vs = _vm->findVirtScreen(_top)) == nullptr) return; if (chr == '@') @@ -2313,7 +2313,7 @@ bool CharsetRendererTownsClassic::prepareDraw(uint16 chr) { if (useFontRomCharacter(chr) && !noSjis) { setupShadowMode(); - _charPtr = 0; + _charPtr = nullptr; _sjisCurChar = chr; _width = getCharWidth(chr); diff --git a/engines/scumm/costume.cpp b/engines/scumm/costume.cpp index 7ba7c477f1f..b878615542b 100644 --- a/engines/scumm/costume.cpp +++ b/engines/scumm/costume.cpp @@ -549,7 +549,7 @@ void ClassicCostumeRenderer::proc3_ami(Codec1 &v1) { // Indy4 Amiga always uses the room map to match colors to the currently // setup palette in the actor code in the original, thus we need to do this // mapping over here too. - byte *amigaMap = 0; + byte *amigaMap = nullptr; if (_vm->_game.platform == Common::kPlatformAmiga && _vm->_game.id == GID_INDY4) amigaMap = _vm->_roomPalette; diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp index d730f973ef7..36740b33686 100644 --- a/engines/scumm/cursor.cpp +++ b/engines/scumm/cursor.cpp @@ -136,7 +136,7 @@ void ScummEngine::updateCursor() { void ScummEngine_v6::grabCursor(int x, int y, int w, int h) { VirtScreen *vs = findVirtScreen(y); - if (vs == NULL) { + if (vs == nullptr) { debug(0, "grabCursor: invalid Y %d", y); return; } @@ -315,7 +315,7 @@ void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) { bomp = findResource(MKTAG('B','O','M','P'), dataptr); } - if (bomp != NULL) + if (bomp != nullptr) useBompCursor(bomp, w, h); else useIm01Cursor(dataptr, w, h); diff --git a/engines/scumm/debugger.cpp b/engines/scumm/debugger.cpp index 1a16a4cc6d3..45feb91733e 100644 --- a/engines/scumm/debugger.cpp +++ b/engines/scumm/debugger.cpp @@ -181,7 +181,7 @@ bool ScummDebugger::Cmd_Room(int argc, const char **argv) { int room = atoi(argv[1]); _vm->_actors[_vm->VAR(_vm->VAR_EGO)]->_room = room; _vm->_sound->stopAllSounds(); - _vm->startScene(room, 0, 0); + _vm->startScene(room, nullptr, 0); _vm->_fullRedraw = true; return false; } else { @@ -272,7 +272,7 @@ bool ScummDebugger::Cmd_Script(int argc, const char** argv) { if ((!strcmp(argv[2], "kill")) || (!strcmp(argv[2], "stop"))) { _vm->stopScript(scriptnum); } else if ((!strcmp(argv[2], "run")) || (!strcmp(argv[2], "start"))) { - _vm->runScript(scriptnum, 0, 0, 0); + _vm->runScript(scriptnum, 0, 0, nullptr); return false; } else { debugPrintf("Unknown script command '%s'\nUse as command\n", argv[2]); @@ -721,7 +721,7 @@ void ScummDebugger::drawBox(int box) { fillQuad(_vm, r, 13); VirtScreen *vs = _vm->findVirtScreen(coords.ul.y); - if (vs != NULL) + if (vs != nullptr) _vm->markRectAsDirty(vs->number, 0, vs->w, 0, vs->h); _vm->drawDirtyScreenParts(); _vm->_system->updateScreen(); diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index d60be3d9636..d595d660f85 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -125,7 +125,7 @@ static Common::String generatePreferredTarget(const DetectorResult &x) { DetectedGames ScummMetaEngineDetection::detectGames(const Common::FSList &fslist) const { DetectedGames detectedGames; Common::List results; - ::detectGames(fslist, results, 0); + ::detectGames(fslist, results, nullptr); for (Common::List::iterator x = results.begin(); x != results.end(); ++x) { diff --git a/engines/scumm/file.cpp b/engines/scumm/file.cpp index e8db237f26e..1c8341a51e7 100644 --- a/engines/scumm/file.cpp +++ b/engines/scumm/file.cpp @@ -241,20 +241,20 @@ static const int zakResourcesPerFile[59] = { static uint16 write_byte(Common::WriteStream *out, byte val) { val ^= 0xFF; - if (out != 0) + if (out != nullptr) out->writeByte(val); return 1; } static uint16 write_word(Common::WriteStream *out, uint16 val) { val ^= 0xFFFF; - if (out != 0) + if (out != nullptr) out->writeUint16LE(val); return 2; } ScummDiskImage::ScummDiskImage(const char *disk1, const char *disk2, GameSettings game) - : _stream(0), _buf(0), _game(game), + : _stream(nullptr), _buf(nullptr), _game(game), _disk1(disk1), _disk2(disk2), _openedDisk(0) { if (_game.id == GID_MANIAC) { @@ -341,7 +341,7 @@ bool ScummDiskImage::open(const Common::Path &filename) { return false; } - extractIndex(0); // Fill in resource arrays + extractIndex(nullptr); // Fill in resource arrays if (_game.features & GF_DEMO) return true; @@ -423,7 +423,7 @@ uint16 ScummDiskImage::extractIndex(Common::WriteStream *out) { bool ScummDiskImage::generateIndex() { int bufsize; - bufsize = extractIndex(0); + bufsize = extractIndex(nullptr); free(_buf); _buf = (byte *)calloc(1, bufsize); @@ -484,7 +484,7 @@ bool ScummDiskImage::generateResource(int res) { if (res >= _numRooms) return false; - bufsize = extractResource(0, res); + bufsize = extractResource(nullptr, res); free(_buf); _buf = (byte *)calloc(1, bufsize); @@ -501,10 +501,10 @@ bool ScummDiskImage::generateResource(int res) { void ScummDiskImage::close() { delete _stream; - _stream = 0; + _stream = nullptr; free(_buf); - _buf = 0; + _buf = nullptr; File::close(); } diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp index 02654e0bf31..4e40da944d4 100644 --- a/engines/scumm/file_nes.cpp +++ b/engines/scumm/file_nes.cpp @@ -43,7 +43,7 @@ struct ScummNESFile::ResourceGroup { const Resource *langs[ScummNESFile::kROMsetNum]; }; -ScummNESFile::ScummNESFile() : _stream(0), _buf(0), _ROMset(kROMsetNum) { +ScummNESFile::ScummNESFile() : _stream(nullptr), _buf(nullptr), _ROMset(kROMsetNum) { } static const ScummNESFile::Resource res_roomgfx_usa[40] = { @@ -921,14 +921,14 @@ const ScummNESFile::ResourceGroup res_preplist = { static uint16 write_byte(Common::WriteStream *out, byte val) { val ^= 0xFF; - if (out != 0) + if (out != nullptr) out->writeByte(val); return 1; } static uint16 write_word(Common::WriteStream *out, uint16 val) { val ^= 0xFFFF; - if (out != 0) + if (out != nullptr) out->writeUint16LE(val); return 2; } @@ -951,7 +951,7 @@ uint16 ScummNESFile::extractResource(Common::WriteStream *output, const Resource byte cnt; uint16 reslen = 0; - if (res == NULL) + if (res == nullptr) error("extract_resource - no resource specified"); if ((res->offset == 0) && (res->length == 0)) @@ -1100,62 +1100,62 @@ struct ScummNESFile::LFLEntry { // based on structure of Classic PC Maniac Mansion LFL files // (roomgfx resources are arranged in order, one per file, // after the room blocks) -static const ScummNESFile::LFLEntry lfl_01[] = { {&res_rooms, 1}, {&res_roomgfx, 1}, {&res_scripts, 57}, {&res_scripts, 61}, {&res_scripts, 76}, {&res_scripts, 105}, {&res_scripts, 111}, {&res_sounds, 5}, {&res_scripts, 132}, {&res_scripts, 148}, {&res_scripts, 155}, {&res_scripts, 156}, {&res_sounds, 39}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_02[] = { {&res_rooms, 2}, {&res_roomgfx, 2}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_03[] = { {&res_rooms, 3}, {&res_roomgfx, 3}, {&res_scripts, 21}, {&res_sounds, 26}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_04[] = { {&res_rooms, 4}, {&res_roomgfx, 4}, {&res_scripts, 46}, {&res_scripts, 56}, {&res_scripts, 137}, {&res_scripts, 146}, {&res_sounds, 12}, {&res_sounds, 11}, {&res_sounds, 13}, {&res_sounds, 42}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_05[] = { {&res_rooms, 5}, {&res_roomgfx, 5}, {&res_scripts, 30}, {&res_scripts, 31}, {&res_scripts, 32}, {&res_scripts, 33}, {&res_scripts, 34}, {&res_scripts, 35}, {&res_sounds, 22}, {&res_sounds, 23}, {&res_sounds, 24}, {&res_sounds, 21}, {&res_sounds, 46}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_06[] = { {&res_rooms, 6}, {&res_roomgfx, 6}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_07[] = { {&res_rooms, 7}, {&res_roomgfx, 7}, {&res_scripts, 17}, {&res_scripts, 58}, {&res_scripts, 59}, {&res_scripts, 60}, {&res_scripts, 74}, {&res_scripts, 81}, {&res_scripts, 82}, {&res_scripts, 150}, {&res_sounds, 14}, {&res_sounds, 15}, {&res_sounds, 16}, {&res_sounds, 17}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_08[] = { {&res_rooms, 8}, {&res_roomgfx, 8}, {&res_scripts, 7}, {&res_scripts, 12}, {&res_scripts, 13}, {&res_scripts, 47}, {&res_scripts, 48}, {&res_scripts, 49}, {&res_scripts, 154}, {&res_sounds, 32}, {&res_sounds, 33}, {&res_sounds, 36}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_09[] = { {&res_rooms, 9}, {&res_roomgfx, 9}, {&res_scripts, 10}, {&res_scripts, 11}, {&res_scripts, 45}, {&res_scripts, 55}, {&res_scripts, 84}, {&res_scripts, 85}, {&res_scripts, 86}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_10[] = { {&res_rooms, 10}, {&res_roomgfx, 10}, {&res_scripts, 24}, {&res_scripts, 149}, {&res_sounds, 28}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_11[] = { {&res_rooms, 11}, {&res_roomgfx, 11}, {&res_scripts, 166}, {&res_scripts, 167}, {&res_scripts, 168}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_12[] = { {&res_rooms, 12}, {&res_roomgfx, 12}, {&res_scripts, 51}, {&res_scripts, 103}, {&res_scripts, 104}, {&res_scripts, 161}, {&res_sounds, 63}, {&res_costumes, 14}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_13[] = { {&res_rooms, 13}, {&res_roomgfx, 13}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_14[] = { {&res_rooms, 14}, {&res_roomgfx, 14}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_15[] = { {&res_rooms, 15}, {&res_roomgfx, 15}, {&res_sounds, 27}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_16[] = { {&res_rooms, 16}, {&res_roomgfx, 16}, {&res_scripts, 14}, {&res_scripts, 121}, {&res_scripts, 122}, {&res_sounds, 40}, {&res_sounds, 64}, {&res_sounds, 68}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_17[] = { {&res_rooms, 17}, {&res_roomgfx, 17}, {&res_scripts, 20}, {&res_scripts, 100}, {&res_sounds, 25}, {&res_sounds, 44}, {&res_sounds, 2}, {&res_sounds, 50}, {&res_sounds, 52}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_18[] = { {&res_rooms, 18}, {&res_roomgfx, 18}, {&res_scripts, 25}, {&res_scripts, 26}, {&res_scripts, 27}, {&res_scripts, 28}, {&res_scripts, 64}, {&res_scripts, 65}, {&res_scripts, 66}, {&res_scripts, 67}, {&res_scripts, 68}, {&res_scripts, 69}, {&res_scripts, 70}, {&res_scripts, 71}, {&res_scripts, 73}, {&res_scripts, 101}, {&res_sounds, 35}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_19[] = { {&res_rooms, 19}, {&res_roomgfx, 19}, {&res_scripts, 36}, {&res_scripts, 37}, {&res_scripts, 38}, {&res_scripts, 39}, {&res_scripts, 40}, {&res_scripts, 152}, {&res_scripts, 153}, {&res_costumes, 10}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_20[] = { {&res_rooms, 20}, {&res_roomgfx, 20}, {&res_scripts, 107}, {&res_scripts, 108}, {&res_scripts, 109}, {&res_scripts, 110}, {&res_scripts, 159}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_21[] = { {&res_rooms, 21}, {&res_roomgfx, 21}, {&res_scripts, 41}, {&res_scripts, 42}, {&res_scripts, 43}, {&res_scripts, 53}, {&res_scripts, 136}, {&res_sounds, 29}, {&res_sounds, 20}, {&res_sounds, 37}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_22[] = { {&res_rooms, 22}, {&res_roomgfx, 22}, {&res_scripts, 15}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_23[] = { {&res_rooms, 23}, {&res_roomgfx, 23}, {&res_scripts, 77}, {&res_scripts, 79}, {&res_scripts, 80}, {&res_scripts, 83}, {&res_sounds, 41}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_24[] = { {&res_rooms, 24}, {&res_roomgfx, 24}, {&res_scripts, 18}, {&res_scripts, 19}, {&res_scripts, 78}, {&res_sounds, 7}, {&res_sounds, 3}, {&res_sounds, 18}, {&res_sounds, 34}, {&res_costumes, 12}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_25[] = { {&res_rooms, 25}, {&res_roomgfx, 25}, {&res_scripts, 29}, {&res_sounds, 30}, {&res_sounds, 31}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_26[] = { {&res_rooms, 26}, {&res_roomgfx, 26}, {&res_scripts, 87}, {&res_scripts, 88}, {&res_scripts, 89}, {&res_scripts, 90}, {&res_scripts, 91}, {&res_scripts, 92}, {&res_scripts, 93}, {&res_scripts, 94}, {&res_scripts, 95}, {&res_scripts, 96}, {&res_scripts, 97}, {&res_scripts, 98}, {&res_scripts, 116}, {&res_scripts, 151}, {&res_scripts, 174}, {&res_costumes, 11}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_27[] = { {&res_rooms, 27}, {&res_roomgfx, 27}, {&res_scripts, 16}, {&res_scripts, 52}, {&res_scripts, 54}, {&res_scripts, 113}, {&res_sounds, 45}, {&res_costumes, 19}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_28[] = { {&res_rooms, 28}, {&res_roomgfx, 28}, {&res_scripts, 22}, {&res_scripts, 23}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_29[] = { {&res_rooms, 29}, {&res_roomgfx, 29}, {&res_scripts, 75}, {&res_sounds, 43}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_30[] = { {&res_rooms, 30}, {&res_roomgfx, 30}, {&res_scripts, 63}, {&res_sounds, 0}, {&res_scripts, 123}, {&res_scripts, 125}, {&res_scripts, 126}, {&res_scripts, 127}, {&res_scripts, 129}, {&res_sounds, 55}, {&res_sounds, 59}, {&res_sounds, 60}, {&res_costumes, 8}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_31[] = { {&res_rooms, 31}, {&res_roomgfx, 31}, {&res_scripts, 99}, {&res_scripts, 115}, {&res_scripts, 117}, {&res_scripts, 119}, {&res_scripts, 147}, {&res_scripts, 157}, {&res_scripts, 158}, {&res_scripts, 160}, {&res_costumes, 13}, {&res_costumes, 9}, {&res_costumes, 23}, {&res_costumes, 24}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_32[] = { {&res_rooms, 32}, {&res_roomgfx, 32}, {&res_costumes, 15}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_33[] = { {&res_rooms, 33}, {&res_roomgfx, 33}, {&res_scripts, 120}, {&res_scripts, 135}, {&res_sounds, 56}, {&res_sounds, 57}, {&res_sounds, 58}, {&res_sounds, 1}, {&res_costumes, 22}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_34[] = { {&res_rooms, 34}, {&res_roomgfx, 34}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_35[] = { {&res_rooms, 35}, {&res_roomgfx, 35}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_36[] = { {&res_rooms, 36}, {&res_roomgfx, 36}, {&res_sounds, 10}, {&res_sounds, 4}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_37[] = { {&res_rooms, 37}, {&res_roomgfx, 37}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_38[] = { {&res_rooms, 38}, {&res_roomgfx, 38}, {&res_scripts, 138}, {&res_scripts, 139}, {&res_scripts, 140}, {&res_scripts, 141}, {&res_scripts, 142}, {&res_scripts, 143}, {&res_scripts, 144}, {&res_scripts, 145}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_39[] = { {&res_rooms, 39}, {&res_roomgfx, 39}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_40[] = { {&res_rooms, 40}, {&res_roomgfx, 0}, {&res_scripts, 112}, {&res_costumes, 17}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_41[] = { {&res_rooms, 41}, {&res_scripts, 106}, {&res_sounds, 47}, {&res_sounds, 48}, {&res_sounds, 53}, {&res_sounds, 49}, {&res_sounds, 51}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_42[] = { {&res_rooms, 42}, {&res_scripts, 124}, {&res_costumes, 18}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_43[] = { {&res_rooms, 43}, {&res_scripts, 44}, {&res_sounds, 19}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_44[] = { {&res_rooms, 44}, {&res_scripts, 102}, {&res_sounds, 6}, {&res_sounds, 38}, {&res_sounds, 8}, {&res_sounds, 9}, {&res_costumes, 1}, {&res_costumes, 2}, {&res_costumes, 5}, {&res_costumes, 6}, {&res_costumes, 3}, {&res_costumes, 4}, {&res_costumes, 7}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_45[] = { {&res_rooms, 45}, {&res_scripts, 1}, {&res_scripts, 2}, {&res_scripts, 3}, {&res_scripts, 4}, {&res_scripts, 5}, {&res_scripts, 9}, {&res_scripts, 114}, {&res_scripts, 131}, {&res_scripts, 164}, {&res_scripts, 165}, {&res_scripts, 169}, {&res_scripts, 170}, {&res_scripts, 171}, {&res_scripts, 172}, {&res_scripts, 173}, {&res_scripts, 175}, {&res_sounds, 54}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_46[] = { {&res_rooms, 46}, {&res_scripts, 130}, {&res_sounds, 65}, {&res_costumes, 0}, {&res_costumes, 21}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_47[] = { {&res_rooms, 47}, {&res_scripts, 62}, {&res_sounds, 69}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_48[] = { {&res_rooms, 48}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_49[] = { {&res_rooms, 49}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_50[] = { {&res_rooms, 50}, {&res_scripts, 133}, {&res_scripts, 163}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_51[] = { {&res_rooms, 51}, {&res_scripts, 118}, {&res_scripts, 128}, {&res_sounds, 61}, {&res_sounds, 62}, {&res_sounds, 67}, {&res_sounds, 66}, {&res_costumes, 16}, {&res_costumes, 20}, {NULL, 0} }; -static const ScummNESFile::LFLEntry lfl_52[] = { {&res_rooms, 52}, {NULL, 0} }; +static const ScummNESFile::LFLEntry lfl_01[] = { {&res_rooms, 1}, {&res_roomgfx, 1}, {&res_scripts, 57}, {&res_scripts, 61}, {&res_scripts, 76}, {&res_scripts, 105}, {&res_scripts, 111}, {&res_sounds, 5}, {&res_scripts, 132}, {&res_scripts, 148}, {&res_scripts, 155}, {&res_scripts, 156}, {&res_sounds, 39}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_02[] = { {&res_rooms, 2}, {&res_roomgfx, 2}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_03[] = { {&res_rooms, 3}, {&res_roomgfx, 3}, {&res_scripts, 21}, {&res_sounds, 26}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_04[] = { {&res_rooms, 4}, {&res_roomgfx, 4}, {&res_scripts, 46}, {&res_scripts, 56}, {&res_scripts, 137}, {&res_scripts, 146}, {&res_sounds, 12}, {&res_sounds, 11}, {&res_sounds, 13}, {&res_sounds, 42}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_05[] = { {&res_rooms, 5}, {&res_roomgfx, 5}, {&res_scripts, 30}, {&res_scripts, 31}, {&res_scripts, 32}, {&res_scripts, 33}, {&res_scripts, 34}, {&res_scripts, 35}, {&res_sounds, 22}, {&res_sounds, 23}, {&res_sounds, 24}, {&res_sounds, 21}, {&res_sounds, 46}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_06[] = { {&res_rooms, 6}, {&res_roomgfx, 6}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_07[] = { {&res_rooms, 7}, {&res_roomgfx, 7}, {&res_scripts, 17}, {&res_scripts, 58}, {&res_scripts, 59}, {&res_scripts, 60}, {&res_scripts, 74}, {&res_scripts, 81}, {&res_scripts, 82}, {&res_scripts, 150}, {&res_sounds, 14}, {&res_sounds, 15}, {&res_sounds, 16}, {&res_sounds, 17}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_08[] = { {&res_rooms, 8}, {&res_roomgfx, 8}, {&res_scripts, 7}, {&res_scripts, 12}, {&res_scripts, 13}, {&res_scripts, 47}, {&res_scripts, 48}, {&res_scripts, 49}, {&res_scripts, 154}, {&res_sounds, 32}, {&res_sounds, 33}, {&res_sounds, 36}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_09[] = { {&res_rooms, 9}, {&res_roomgfx, 9}, {&res_scripts, 10}, {&res_scripts, 11}, {&res_scripts, 45}, {&res_scripts, 55}, {&res_scripts, 84}, {&res_scripts, 85}, {&res_scripts, 86}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_10[] = { {&res_rooms, 10}, {&res_roomgfx, 10}, {&res_scripts, 24}, {&res_scripts, 149}, {&res_sounds, 28}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_11[] = { {&res_rooms, 11}, {&res_roomgfx, 11}, {&res_scripts, 166}, {&res_scripts, 167}, {&res_scripts, 168}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_12[] = { {&res_rooms, 12}, {&res_roomgfx, 12}, {&res_scripts, 51}, {&res_scripts, 103}, {&res_scripts, 104}, {&res_scripts, 161}, {&res_sounds, 63}, {&res_costumes, 14}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_13[] = { {&res_rooms, 13}, {&res_roomgfx, 13}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_14[] = { {&res_rooms, 14}, {&res_roomgfx, 14}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_15[] = { {&res_rooms, 15}, {&res_roomgfx, 15}, {&res_sounds, 27}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_16[] = { {&res_rooms, 16}, {&res_roomgfx, 16}, {&res_scripts, 14}, {&res_scripts, 121}, {&res_scripts, 122}, {&res_sounds, 40}, {&res_sounds, 64}, {&res_sounds, 68}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_17[] = { {&res_rooms, 17}, {&res_roomgfx, 17}, {&res_scripts, 20}, {&res_scripts, 100}, {&res_sounds, 25}, {&res_sounds, 44}, {&res_sounds, 2}, {&res_sounds, 50}, {&res_sounds, 52}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_18[] = { {&res_rooms, 18}, {&res_roomgfx, 18}, {&res_scripts, 25}, {&res_scripts, 26}, {&res_scripts, 27}, {&res_scripts, 28}, {&res_scripts, 64}, {&res_scripts, 65}, {&res_scripts, 66}, {&res_scripts, 67}, {&res_scripts, 68}, {&res_scripts, 69}, {&res_scripts, 70}, {&res_scripts, 71}, {&res_scripts, 73}, {&res_scripts, 101}, {&res_sounds, 35}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_19[] = { {&res_rooms, 19}, {&res_roomgfx, 19}, {&res_scripts, 36}, {&res_scripts, 37}, {&res_scripts, 38}, {&res_scripts, 39}, {&res_scripts, 40}, {&res_scripts, 152}, {&res_scripts, 153}, {&res_costumes, 10}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_20[] = { {&res_rooms, 20}, {&res_roomgfx, 20}, {&res_scripts, 107}, {&res_scripts, 108}, {&res_scripts, 109}, {&res_scripts, 110}, {&res_scripts, 159}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_21[] = { {&res_rooms, 21}, {&res_roomgfx, 21}, {&res_scripts, 41}, {&res_scripts, 42}, {&res_scripts, 43}, {&res_scripts, 53}, {&res_scripts, 136}, {&res_sounds, 29}, {&res_sounds, 20}, {&res_sounds, 37}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_22[] = { {&res_rooms, 22}, {&res_roomgfx, 22}, {&res_scripts, 15}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_23[] = { {&res_rooms, 23}, {&res_roomgfx, 23}, {&res_scripts, 77}, {&res_scripts, 79}, {&res_scripts, 80}, {&res_scripts, 83}, {&res_sounds, 41}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_24[] = { {&res_rooms, 24}, {&res_roomgfx, 24}, {&res_scripts, 18}, {&res_scripts, 19}, {&res_scripts, 78}, {&res_sounds, 7}, {&res_sounds, 3}, {&res_sounds, 18}, {&res_sounds, 34}, {&res_costumes, 12}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_25[] = { {&res_rooms, 25}, {&res_roomgfx, 25}, {&res_scripts, 29}, {&res_sounds, 30}, {&res_sounds, 31}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_26[] = { {&res_rooms, 26}, {&res_roomgfx, 26}, {&res_scripts, 87}, {&res_scripts, 88}, {&res_scripts, 89}, {&res_scripts, 90}, {&res_scripts, 91}, {&res_scripts, 92}, {&res_scripts, 93}, {&res_scripts, 94}, {&res_scripts, 95}, {&res_scripts, 96}, {&res_scripts, 97}, {&res_scripts, 98}, {&res_scripts, 116}, {&res_scripts, 151}, {&res_scripts, 174}, {&res_costumes, 11}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_27[] = { {&res_rooms, 27}, {&res_roomgfx, 27}, {&res_scripts, 16}, {&res_scripts, 52}, {&res_scripts, 54}, {&res_scripts, 113}, {&res_sounds, 45}, {&res_costumes, 19}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_28[] = { {&res_rooms, 28}, {&res_roomgfx, 28}, {&res_scripts, 22}, {&res_scripts, 23}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_29[] = { {&res_rooms, 29}, {&res_roomgfx, 29}, {&res_scripts, 75}, {&res_sounds, 43}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_30[] = { {&res_rooms, 30}, {&res_roomgfx, 30}, {&res_scripts, 63}, {&res_sounds, 0}, {&res_scripts, 123}, {&res_scripts, 125}, {&res_scripts, 126}, {&res_scripts, 127}, {&res_scripts, 129}, {&res_sounds, 55}, {&res_sounds, 59}, {&res_sounds, 60}, {&res_costumes, 8}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_31[] = { {&res_rooms, 31}, {&res_roomgfx, 31}, {&res_scripts, 99}, {&res_scripts, 115}, {&res_scripts, 117}, {&res_scripts, 119}, {&res_scripts, 147}, {&res_scripts, 157}, {&res_scripts, 158}, {&res_scripts, 160}, {&res_costumes, 13}, {&res_costumes, 9}, {&res_costumes, 23}, {&res_costumes, 24}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_32[] = { {&res_rooms, 32}, {&res_roomgfx, 32}, {&res_costumes, 15}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_33[] = { {&res_rooms, 33}, {&res_roomgfx, 33}, {&res_scripts, 120}, {&res_scripts, 135}, {&res_sounds, 56}, {&res_sounds, 57}, {&res_sounds, 58}, {&res_sounds, 1}, {&res_costumes, 22}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_34[] = { {&res_rooms, 34}, {&res_roomgfx, 34}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_35[] = { {&res_rooms, 35}, {&res_roomgfx, 35}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_36[] = { {&res_rooms, 36}, {&res_roomgfx, 36}, {&res_sounds, 10}, {&res_sounds, 4}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_37[] = { {&res_rooms, 37}, {&res_roomgfx, 37}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_38[] = { {&res_rooms, 38}, {&res_roomgfx, 38}, {&res_scripts, 138}, {&res_scripts, 139}, {&res_scripts, 140}, {&res_scripts, 141}, {&res_scripts, 142}, {&res_scripts, 143}, {&res_scripts, 144}, {&res_scripts, 145}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_39[] = { {&res_rooms, 39}, {&res_roomgfx, 39}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_40[] = { {&res_rooms, 40}, {&res_roomgfx, 0}, {&res_scripts, 112}, {&res_costumes, 17}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_41[] = { {&res_rooms, 41}, {&res_scripts, 106}, {&res_sounds, 47}, {&res_sounds, 48}, {&res_sounds, 53}, {&res_sounds, 49}, {&res_sounds, 51}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_42[] = { {&res_rooms, 42}, {&res_scripts, 124}, {&res_costumes, 18}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_43[] = { {&res_rooms, 43}, {&res_scripts, 44}, {&res_sounds, 19}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_44[] = { {&res_rooms, 44}, {&res_scripts, 102}, {&res_sounds, 6}, {&res_sounds, 38}, {&res_sounds, 8}, {&res_sounds, 9}, {&res_costumes, 1}, {&res_costumes, 2}, {&res_costumes, 5}, {&res_costumes, 6}, {&res_costumes, 3}, {&res_costumes, 4}, {&res_costumes, 7}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_45[] = { {&res_rooms, 45}, {&res_scripts, 1}, {&res_scripts, 2}, {&res_scripts, 3}, {&res_scripts, 4}, {&res_scripts, 5}, {&res_scripts, 9}, {&res_scripts, 114}, {&res_scripts, 131}, {&res_scripts, 164}, {&res_scripts, 165}, {&res_scripts, 169}, {&res_scripts, 170}, {&res_scripts, 171}, {&res_scripts, 172}, {&res_scripts, 173}, {&res_scripts, 175}, {&res_sounds, 54}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_46[] = { {&res_rooms, 46}, {&res_scripts, 130}, {&res_sounds, 65}, {&res_costumes, 0}, {&res_costumes, 21}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_47[] = { {&res_rooms, 47}, {&res_scripts, 62}, {&res_sounds, 69}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_48[] = { {&res_rooms, 48}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_49[] = { {&res_rooms, 49}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_50[] = { {&res_rooms, 50}, {&res_scripts, 133}, {&res_scripts, 163}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_51[] = { {&res_rooms, 51}, {&res_scripts, 118}, {&res_scripts, 128}, {&res_sounds, 61}, {&res_sounds, 62}, {&res_sounds, 67}, {&res_sounds, 66}, {&res_costumes, 16}, {&res_costumes, 20}, {nullptr, 0} }; +static const ScummNESFile::LFLEntry lfl_52[] = { {&res_rooms, 52}, {nullptr, 0} }; // remaining 'standard' resources (not used by any of the original LFL files) -static const ScummNESFile::LFLEntry lfl_53[] = { {&res_rooms, 53}, {&res_scripts, 177}, {&res_scripts, 178}, {&res_sounds, 70}, {&res_sounds, 71}, {&res_sounds, 72}, {&res_sounds, 73}, {&res_sounds, 74}, {&res_sounds, 75}, {&res_sounds, 76}, {&res_sounds, 77}, {&res_sounds, 78}, {&res_sounds, 79}, {&res_sounds, 80}, {&res_sounds, 81}, {NULL, 0} }; +static const ScummNESFile::LFLEntry lfl_53[] = { {&res_rooms, 53}, {&res_scripts, 177}, {&res_scripts, 178}, {&res_sounds, 70}, {&res_sounds, 71}, {&res_sounds, 72}, {&res_sounds, 73}, {&res_sounds, 74}, {&res_sounds, 75}, {&res_sounds, 76}, {&res_sounds, 77}, {&res_sounds, 78}, {&res_sounds, 79}, {&res_sounds, 80}, {&res_sounds, 81}, {nullptr, 0} }; // all 'non-standard' resources (the costume-related stuff) -static const ScummNESFile::LFLEntry lfl_54[] = { {&res_rooms, 54}, {&res_sprdesc, 0}, {&res_sprdesc, 1}, {&res_sprlens, 0}, {&res_sprlens, 1}, {&res_sproffs, 0}, {&res_sproffs, 1}, {&res_sprdata, 0}, {&res_sprdata, 1}, {&res_costumegfx, 0}, {&res_costumegfx, 1}, {&res_sprpals, 0}, {&res_sprpals, 1}, {&res_charset, 0}, {&res_preplist, 0}, {NULL, 0} }; +static const ScummNESFile::LFLEntry lfl_54[] = { {&res_rooms, 54}, {&res_sprdesc, 0}, {&res_sprdesc, 1}, {&res_sprlens, 0}, {&res_sprlens, 1}, {&res_sproffs, 0}, {&res_sproffs, 1}, {&res_sprdata, 0}, {&res_sprdata, 1}, {&res_costumegfx, 0}, {&res_costumegfx, 1}, {&res_sprpals, 0}, {&res_sprpals, 1}, {&res_charset, 0}, {&res_preplist, 0}, {nullptr, 0} }; struct ScummNESFile::LFL { int num; @@ -1217,7 +1217,7 @@ static const ScummNESFile::LFL lfls[] = { { 52, lfl_52 }, { 53, lfl_53 }, { 54, lfl_54 }, - { -1, NULL } + { -1, nullptr } }; #include "common/pack-start.h" // START STRUCT PACKING @@ -1240,15 +1240,15 @@ bool ScummNESFile::generateResource(int res) { int j; int bufsize = 2; - for (j = 0; lfl->entries[j].type != NULL; j++) - bufsize += extractResource(0, &lfl->entries[j].type->langs[_ROMset][lfl->entries[j].index], lfl->entries[j].type->type); + for (j = 0; lfl->entries[j].type != nullptr; j++) + bufsize += extractResource(nullptr, &lfl->entries[j].type->langs[_ROMset][lfl->entries[j].index], lfl->entries[j].type->type); free(_buf); _buf = (byte *)calloc(1, bufsize); Common::MemoryWriteStream out(_buf, bufsize); - for (j = 0; lfl->entries[j].type != NULL; j++) { + for (j = 0; lfl->entries[j].type != nullptr; j++) { const Resource *entry = &lfl->entries[j].type->langs[_ROMset][lfl->entries[j].index]; extractResource(&out, entry, lfl->entries[j].type->type); } @@ -1272,7 +1272,7 @@ bool ScummNESFile::generateIndex() { const LFL *lfl = &lfls[i]; uint16 respos = 0; - for (j = 0; lfl->entries[j].type != NULL; j++) { + for (j = 0; lfl->entries[j].type != nullptr; j++) { const LFLEntry *entry = &lfl->entries[j]; switch (entry->type->type) { @@ -1332,7 +1332,7 @@ bool ScummNESFile::generateIndex() { error("Unindexed entry found"); break; } - respos += extractResource(0, &entry->type->langs[_ROMset][entry->index], entry->type->type); + respos += extractResource(nullptr, &entry->type->langs[_ROMset][entry->index], entry->type->type); } } @@ -1403,10 +1403,10 @@ bool ScummNESFile::open(const Common::Path &filename) { if (File::open(filename)) { delete _stream; - _stream = 0; + _stream = nullptr; free(_buf); - _buf = 0; + _buf = nullptr; return true; } else { @@ -1416,10 +1416,10 @@ bool ScummNESFile::open(const Common::Path &filename) { void ScummNESFile::close() { delete _stream; - _stream = 0; + _stream = nullptr; free(_buf); - _buf = 0; + _buf = nullptr; File::close(); } diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp index 0f47f4cfcc6..3c563d0db74 100644 --- a/engines/scumm/gfx.cpp +++ b/engines/scumm/gfx.cpp @@ -220,7 +220,7 @@ Gdi::Gdi(ScummEngine *vm) : _vm(vm) { Gdi::~Gdi() { } -GdiHE::GdiHE(ScummEngine *vm) : Gdi(vm), _tmskPtr(0) { +GdiHE::GdiHE(ScummEngine *vm) : Gdi(vm), _tmskPtr(nullptr) { } @@ -245,7 +245,7 @@ GdiV1::GdiV1(ScummEngine *vm) : Gdi(vm) { } GdiV2::GdiV2(ScummEngine *vm) : Gdi(vm) { - _roomStrips = 0; + _roomStrips = nullptr; } GdiV2::~GdiV2() { @@ -403,7 +403,7 @@ void ScummEngine::initVirtScreen(VirtScreenNumber slot, int top, int width, int vs->h = height; vs->hasTwoBuffers = twobufs; vs->xstart = 0; - vs->backBuf = NULL; + vs->backBuf = nullptr; if (_game.features & GF_16BIT_COLOR) vs->format = Graphics::PixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0); else @@ -456,7 +456,7 @@ VirtScreen *ScummEngine::findVirtScreen(int y) { return vs; } } - return NULL; + return nullptr; } void ScummEngine::markRectAsDirty(VirtScreenNumber virt, int left, int right, int top, int bottom, int dirtybit) { @@ -1043,7 +1043,7 @@ void ScummEngine::restoreBackground(Common::Rect rect, byte backColor) { if (rect.left >= rect.right || rect.top >= rect.bottom) return; - if ((vs = findVirtScreen(rect.top)) == NULL) + if ((vs = findVirtScreen(rect.top)) == nullptr) return; if (rect.left > vs->w) @@ -1201,8 +1201,8 @@ byte *Gdi::getMaskBuffer(int x, int y, int z) { static void blit(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, int h, uint8 bitDepth) { assert(w > 0); assert(h > 0); - assert(src != NULL); - assert(dst != NULL); + assert(src != nullptr); + assert(dst != nullptr); if ((w * bitDepth == srcPitch) && (w * bitDepth == dstPitch)) { memcpy(dst, src, w * h * bitDepth); @@ -1217,7 +1217,7 @@ static void blit(byte *dst, int dstPitch, const byte *src, int srcPitch, int w, static void fill(byte *dst, int dstPitch, uint16 color, int w, int h, uint8 bitDepth) { assert(h > 0); - assert(dst != NULL); + assert(dst != nullptr); if (bitDepth == 2) { do { @@ -1288,7 +1288,7 @@ void ScummEngine::drawBox(int x, int y, int x2, int y2, int color) { VirtScreen *vs; byte *backbuff, *bgbuff; - if ((vs = findVirtScreen(y)) == NULL) + if ((vs = findVirtScreen(y)) == nullptr) return; // Indy4 Amiga always uses the room or verb palette map to match colors to @@ -1448,7 +1448,7 @@ void ScummEngine::moveScreen(int dx, int dy, int height) { void ScummEngine_v5::clearFlashlight() { _flashlight.isDrawn = false; - _flashlight.buffer = NULL; + _flashlight.buffer = nullptr; } void ScummEngine_v5::drawFlashlight() { @@ -1593,7 +1593,7 @@ void GdiHE::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, if (_vm->_game.heversion >= 72) { _tmskPtr = _vm->findResource(MKTAG('T','M','S','K'), ptr); } else - _tmskPtr = 0; + _tmskPtr = nullptr; } void GdiV1::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, @@ -1632,7 +1632,7 @@ void GdiV2::prepareDrawBitmap(const byte *ptr, VirtScreen *vs, // difficult to draw only parts of a room/object. We handle the V2 graphics // differently from all other (newer) graphic formats for this reason. // - StripTable *table = (_objectMode ? 0 : _roomStrips); + StripTable *table = (_objectMode ? nullptr : _roomStrips); const int left = (stripnr * 8); const int right = left + (numstrip * 8); byte *dst; @@ -1762,7 +1762,7 @@ int Gdi::getZPlanes(const byte *ptr, const byte *zplane_list[9], bool bmapImage) assert(numzbuf <= 9); if (_vm->_game.id == GID_LOOM && _vm->_game.platform == Common::kPlatformPCEngine) { - zplane_list[1] = 0; + zplane_list[1] = nullptr; } else if (_vm->_game.features & GF_SMALL_HEADER) { if (_vm->_game.features & GF_16COLOR) zplane_list[1] = ptr + READ_LE_UINT16(ptr); @@ -1770,7 +1770,7 @@ int Gdi::getZPlanes(const byte *ptr, const byte *zplane_list[9], bool bmapImage) zplane_list[1] = ptr + READ_LE_UINT32(ptr); if (_vm->_game.features & GF_OLD256) { if (0 == READ_LE_UINT32(zplane_list[1])) - zplane_list[1] = 0; + zplane_list[1] = nullptr; } } for (i = 2; i < numzbuf; i++) { @@ -3250,7 +3250,7 @@ void GdiV1::decodeV1Gfx(const byte *src, byte *dst, int size) const { StripTable *GdiV2::generateStripTable(const byte *src, int width, int height, StripTable *table) const { // If no strip table was given to use, allocate a new one - if (table == 0) + if (table == nullptr) table = (StripTable *)calloc(1, sizeof(StripTable)); const byte *bitmapStart = src; @@ -4008,7 +4008,7 @@ void ScummEngine::dissolveEffect(int width, int height) { h++; offsets = (int *) malloc(w * h * sizeof(int)); - if (offsets == NULL) + if (offsets == nullptr) error("dissolveEffect: out of memory"); // Create a permutation of offsets into the frame buffer @@ -4034,7 +4034,7 @@ void ScummEngine::dissolveEffect(int width, int height) { offsets[i++] = y * vs->pitch + x; offsets2 = (int *) malloc(w * h * sizeof(int)); - if (offsets2 == NULL) + if (offsets2 == nullptr) error("dissolveEffect: out of memory"); memcpy(offsets2, offsets, w * h * sizeof(int)); diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp index 96dc11f476a..1a418af9921 100644 --- a/engines/scumm/gfx_towns.cpp +++ b/engines/scumm/gfx_towns.cpp @@ -382,7 +382,7 @@ void TownsScreen::setupLayer(int layer, int width, int height, int scaleW, int s assert(l->pixels); delete[] l->bltTmpPal; - l->bltTmpPal = (l->bpp == 1 && _pixelFormat.bytesPerPixel == 2) ? new uint16[l->numCol] : 0; + l->bltTmpPal = (l->bpp == 1 && _pixelFormat.bytesPerPixel == 2) ? new uint16[l->numCol] : nullptr; l->enabled = true; _layers[0].onBottom = true; @@ -433,11 +433,11 @@ void TownsScreen::fillLayerRect(int layer, int x, int y, int w, int h, int col) uint8 *TownsScreen::getLayerPixels(int layer, int x, int y) const { if (layer < 0 || layer > 1) - return 0; + return nullptr; const TownsScreenLayer *l = &_layers[layer]; if (!l->ready) - return 0; + return nullptr; return l->pixels + y * l->pitch + (x % l->width) * l->bpp; } @@ -579,7 +579,7 @@ uint16 TownsScreen::calc16BitColor(const uint8 *palEntry) { template void TownsScreen::transferRect(uint8 *dst, TownsScreenLayer *l, int x, int y, int w, int h) { uint8 *dst10 = dst + y * _pitch * scaleH + x * sizeof(dstPixelType) * scaleW; - uint8 *dst20 = (scaleH == 2) ? dst10 + _pitch : 0; + uint8 *dst20 = (scaleH == 2) ? dst10 + _pitch : nullptr; int pitch = _pitch * scaleH; int x0 = (x + l->hScroll) % l->width; diff --git a/engines/scumm/he/moonbase/ai_node.cpp b/engines/scumm/he/moonbase/ai_node.cpp index 083a156a318..e23b0e51c81 100644 --- a/engines/scumm/he/moonbase/ai_node.cpp +++ b/engines/scumm/he/moonbase/ai_node.cpp @@ -32,14 +32,14 @@ IContainedObject::IContainedObject(IContainedObject &sourceContainedObject) { int Node::_nodeCount = 0; Node::Node() { - _parent = NULL; + _parent = nullptr; _depth = 0; _nodeCount++; - _contents = NULL; + _contents = nullptr; } Node::Node(Node *sourceNode) { - _parent = NULL; + _parent = nullptr; _children = sourceNode->getChildren(); _depth = sourceNode->getDepth(); @@ -48,9 +48,9 @@ Node::Node(Node *sourceNode) { } Node::~Node() { - if (_contents != NULL) { + if (_contents != nullptr) { delete _contents; - _contents = NULL; + _contents = nullptr; } _nodeCount--; @@ -72,7 +72,7 @@ int Node::generateChildren() { int completionFlag; IContainedObject *thisContObj = _contents->createChildObj(i, completionFlag); - assert(!(thisContObj != NULL && completionFlag == 0)); + assert(!(thisContObj != nullptr && completionFlag == 0)); if (!completionFlag) { _children.pop_back(); @@ -82,7 +82,7 @@ int Node::generateChildren() { i++; - if (thisContObj != NULL) { + if (thisContObj != nullptr) { tempNode->setContainedObject(thisContObj); } else { _children.pop_back(); @@ -113,7 +113,7 @@ int Node::generateNextChild() { int compFlag; IContainedObject *thisContObj = _contents->createChildObj(i, compFlag); - if (thisContObj != NULL) { + if (thisContObj != nullptr) { tempNode->setContainedObject(thisContObj); } else { _children.pop_back(); @@ -139,10 +139,10 @@ Node *Node::popChild() { Node *Node::getFirstStep() { Node *currentNode = this; - if (currentNode->getParent() == NULL) + if (currentNode->getParent() == nullptr) return currentNode; - while (currentNode->getParent()->getParent() != NULL) + while (currentNode->getParent()->getParent() != nullptr) currentNode = currentNode->getParent(); assert(currentNode->getDepth() == 1); diff --git a/engines/scumm/he/moonbase/ai_tree.cpp b/engines/scumm/he/moonbase/ai_tree.cpp index d18536812bc..a5400473f78 100644 --- a/engines/scumm/he/moonbase/ai_tree.cpp +++ b/engines/scumm/he/moonbase/ai_tree.cpp @@ -41,7 +41,7 @@ Tree::Tree(AI *ai) : _ai(ai) { pBaseNode = new Node; _maxDepth = MAX_DEPTH; _maxNodes = MAX_NODES; - _currentNode = 0; + _currentNode = nullptr; _currentChildIndex = 0; _currentMap = new Common::SortedArray(compareTreeNodes); @@ -52,7 +52,7 @@ Tree::Tree(IContainedObject *contents, AI *ai) : _ai(ai) { pBaseNode->setContainedObject(contents); _maxDepth = MAX_DEPTH; _maxNodes = MAX_NODES; - _currentNode = 0; + _currentNode = nullptr; _currentChildIndex = 0; _currentMap = new Common::SortedArray(compareTreeNodes); @@ -63,7 +63,7 @@ Tree::Tree(IContainedObject *contents, int maxDepth, AI *ai) : _ai(ai) { pBaseNode->setContainedObject(contents); _maxDepth = maxDepth; _maxNodes = MAX_NODES; - _currentNode = 0; + _currentNode = nullptr; _currentChildIndex = 0; _currentMap = new Common::SortedArray(compareTreeNodes); @@ -74,7 +74,7 @@ Tree::Tree(IContainedObject *contents, int maxDepth, int maxNodes, AI *ai) : _ai pBaseNode->setContainedObject(contents); _maxDepth = maxDepth; _maxNodes = maxNodes; - _currentNode = 0; + _currentNode = nullptr; _currentChildIndex = 0; _currentMap = new Common::SortedArray(compareTreeNodes); @@ -97,7 +97,7 @@ Tree::Tree(const Tree *sourceTree, AI *ai) : _ai(ai) { _maxDepth = sourceTree->getMaxDepth(); _maxNodes = sourceTree->getMaxNodes(); _currentMap = new Common::SortedArray(compareTreeNodes); - _currentNode = 0; + _currentNode = nullptr; _currentChildIndex = 0; duplicateTree(sourceTree->getBaseNode(), pBaseNode); @@ -108,7 +108,7 @@ Tree::~Tree() { Node *pNodeItr = pBaseNode; // Depth first traversal of nodes to delete them - while (pNodeItr != NULL) { + while (pNodeItr != nullptr) { // If any children are left, move to one of them if (!(pNodeItr->getChildren().empty())) { pNodeItr = pNodeItr->popChild(); @@ -117,7 +117,7 @@ Tree::~Tree() { Node *pTemp = pNodeItr; pNodeItr = pNodeItr->getParent(); delete pTemp; - pTemp = NULL; + pTemp = nullptr; } } @@ -127,17 +127,17 @@ Tree::~Tree() { Node *Tree::aStarSearch() { Common::SortedArray mmfpOpen(compareTreeNodes); - Node *currentNode = NULL; + Node *currentNode = nullptr; float currentT; - Node *retNode = NULL; + Node *retNode = nullptr; float temp = pBaseNode->getContainedObject()->calcT(); if (static_cast(temp) != SUCCESS) { mmfpOpen.insert(new TreeNode(pBaseNode->getObjectT(), pBaseNode)); - while (mmfpOpen.size() && (retNode == NULL)) { + while (mmfpOpen.size() && (retNode == nullptr)) { currentNode = mmfpOpen.front()->node; mmfpOpen.erase(mmfpOpen.begin()); @@ -167,7 +167,7 @@ Node *Tree::aStarSearch() { Node *Tree::aStarSearch_singlePassInit() { - Node *retNode = NULL; + Node *retNode = nullptr; _currentChildIndex = 1; @@ -184,7 +184,7 @@ Node *Tree::aStarSearch_singlePassInit() { Node *Tree::aStarSearch_singlePass() { float currentT = 0.0; - Node *retNode = NULL; + Node *retNode = nullptr; static int maxTime = 0; @@ -227,7 +227,7 @@ Node *Tree::aStarSearch_singlePass() { } if (!(_currentMap->size()) && (currentT != SUCCESS)) { - assert(_currentNode != NULL); + assert(_currentNode != nullptr); retNode = _currentNode; } } diff --git a/engines/scumm/he/resource_he.cpp b/engines/scumm/he/resource_he.cpp index 0d2c6f53653..ebabf8c4699 100644 --- a/engines/scumm/he/resource_he.cpp +++ b/engines/scumm/he/resource_he.cpp @@ -62,12 +62,12 @@ ResExtractor::CachedCursor *ResExtractor::findCachedCursor(int id) { if (_cursorCache[i].valid && _cursorCache[i].id == id) return &_cursorCache[i]; - return NULL; + return nullptr; } ResExtractor::CachedCursor *ResExtractor::getCachedCursorSlot() { uint32 minLastUsed = 0; - CachedCursor *r = NULL; + CachedCursor *r = nullptr; for (int i = 0; i < MAX_CACHED_CURSORS; ++i) { CachedCursor *cc = &_cursorCache[i]; @@ -90,7 +90,7 @@ ResExtractor::CachedCursor *ResExtractor::getCachedCursorSlot() { void ResExtractor::setCursor(int id) { CachedCursor *cc = findCachedCursor(id); - if (cc != NULL) { + if (cc != nullptr) { debug(7, "Found cursor %d in cache slot %lu", id, (long)(cc - _cursorCache)); } else { cc = getCachedCursorSlot(); @@ -160,12 +160,12 @@ bool Win32ResExtractor::extractResource(int id, CachedCursor *cc) { } MacResExtractor::MacResExtractor(ScummEngine_v70he *scumm) : ResExtractor(scumm) { - _resMgr = NULL; + _resMgr = nullptr; } bool MacResExtractor::extractResource(int id, CachedCursor *cc) { // Create the MacResManager if not created already - if (_resMgr == NULL) { + if (_resMgr == nullptr) { _resMgr = new Common::MacResManager(); if (!_resMgr->open(_vm->generateFilename(-3))) error("Cannot open file %s", _fileName.c_str()); diff --git a/engines/scumm/he/script_v60he.cpp b/engines/scumm/he/script_v60he.cpp index c7c111d3ab6..ae4d4d29802 100644 --- a/engines/scumm/he/script_v60he.cpp +++ b/engines/scumm/he/script_v60he.cpp @@ -65,13 +65,13 @@ static int virtScreenSavePack(byte *dst, byte *src, int len, int unk); void ScummEngine_v60he::setupOpcodes() { ScummEngine_v6::setupOpcodes(); - _opcodes[0x63].setProc(0, 0); - _opcodes[0x64].setProc(0, 0); + _opcodes[0x63].setProc(nullptr, nullptr); + _opcodes[0x64].setProc(nullptr, nullptr); OPCODE(0x70, o60_setState); - _opcodes[0x9a].setProc(0, 0); + _opcodes[0x9a].setProc(nullptr, nullptr); OPCODE(0x9c, o60_roomOps); OPCODE(0x9d, o60_actorOps); - _opcodes[0xac].setProc(0, 0); + _opcodes[0xac].setProc(nullptr, nullptr); OPCODE(0xbd, o6_stopObjectCode); OPCODE(0xc8, o60_kernelGetFunctions); OPCODE(0xc9, o60_kernelSetFunctions); @@ -86,8 +86,8 @@ void ScummEngine_v60he::setupOpcodes() { OPCODE(0xe9, o60_seekFilePos); OPCODE(0xea, o60_redimArray); OPCODE(0xeb, o60_readFilePos); - _opcodes[0xec].setProc(0, 0); - _opcodes[0xed].setProc(0, 0); + _opcodes[0xec].setProc(nullptr, nullptr); + _opcodes[0xed].setProc(nullptr, nullptr); } Common::String ScummEngine_v60he::convertFilePath(const byte *src) { @@ -238,7 +238,7 @@ void ScummEngine_v60he::renameSaveFile(const byte *from, const byte *to) { Common::WriteStream *ScummEngine_v60he::openSaveFileForAppending(const byte *fileName) { Common::SeekableReadStream *initialFile = openSaveFileForReading(fileName); - byte *initialData = 0; + byte *initialData = nullptr; uint32 initialDataSize = 0; if (initialFile) { @@ -284,7 +284,7 @@ Common::SeekableReadStream *ScummEngine_v60he::openSaveFileForReading(int slot, return stream; } - return 0; + return nullptr; } return ScummEngine::openSaveFileForReading(slot, compat, fileName); @@ -572,7 +572,7 @@ void ScummEngine_v60he::o60_actorOps() { a->_talkColor = pop(); break; case 88: // SO_ACTOR_NAME - loadPtrToResource(rtActorName, a->_number, NULL); + loadPtrToResource(rtActorName, a->_number, nullptr); break; case 89: // SO_INIT_ANIMATION a->_initFrame = pop(); @@ -690,7 +690,7 @@ void ScummEngine_v60he::virtScreenLoad(int resIdx, int x1, int y1, int x2, int y if (x2 >= x1) { uint32 w = x2 - x1 + 1; while (w--) { - uint8 decByte = virtScreenLoadUnpack(&ctx, 0); + uint8 decByte = virtScreenLoadUnpack(&ctx, nullptr); *p1++ = decByte; *p2++ = decByte; } @@ -701,7 +701,7 @@ void ScummEngine_v60he::virtScreenLoad(int resIdx, int x1, int y1, int x2, int y uint8 virtScreenLoadUnpack(vsUnpackCtx *ctx, byte *data) { uint8 decByte; - if (data != 0) { + if (data != nullptr) { ctx->type = 0; ctx->ptr = data; decByte = 0; @@ -743,7 +743,7 @@ void ScummEngine_v60he::o60_kernelGetFunctions() { // Used to store images when decorating cake in // Fatty Bear's Birthday Surprise writeVar(0, 0); - data = defineArray(0, kByteArray, 0, virtScreenSave(0, args[1], args[2], args[3], args[4])); + data = defineArray(0, kByteArray, 0, virtScreenSave(nullptr, args[1], args[2], args[3], args[4])); virtScreenSave(data, args[1], args[2], args[3], args[4]); push(readVar(0)); break; @@ -760,7 +760,7 @@ int ScummEngine_v60he::virtScreenSave(byte *dst, int x1, int y1, int x2, int y2) uint8 *p = vs.getBackPixels(x1, j - vs.topline); int size = virtScreenSavePack(dst, p, x2 - x1 + 1, 0); - if (dst != 0) { + if (dst != nullptr) { dst += size; } packedSize += size; @@ -868,7 +868,7 @@ void ScummEngine_v60he::o60_openFile() { mode = pop(); slot = -1; for (i = 0; i < 17; i++) { - if (_hInFileTable[i] == 0 && _hOutFileTable[i] == 0) { + if (_hInFileTable[i] == nullptr && _hOutFileTable[i] == nullptr) { slot = i; break; } @@ -886,7 +886,7 @@ void ScummEngine_v60he::o60_openFile() { error("o60_openFile(): wrong open file mode %d", mode); } - if (_hInFileTable[slot] == 0 && _hOutFileTable[slot] == 0) + if (_hInFileTable[slot] == nullptr && _hOutFileTable[slot] == nullptr) slot = -1; } @@ -899,11 +899,11 @@ void ScummEngine_v60he::o60_closeFile() { if (_hOutFileTable[slot]) { _hOutFileTable[slot]->finalize(); delete _hOutFileTable[slot]; - _hOutFileTable[slot] = 0; + _hOutFileTable[slot] = nullptr; } delete _hInFileTable[slot]; - _hInFileTable[slot] = 0; + _hInFileTable[slot] = nullptr; } } diff --git a/engines/scumm/he/sound_he.cpp b/engines/scumm/he/sound_he.cpp index c75b59129ac..e792dfa19ce 100644 --- a/engines/scumm/he/sound_he.cpp +++ b/engines/scumm/he/sound_he.cpp @@ -50,7 +50,7 @@ SoundHE::SoundHE(ScummEngine *parent, Audio::Mixer *mixer) Sound(parent, mixer), _vm((ScummEngine_v60he *)parent), _overrideFreq(0), - _heMusic(0), + _heMusic(nullptr), _heMusicTracks(0) { memset(_heChannel, 0, sizeof(_heChannel)); @@ -511,7 +511,7 @@ byte *findSoundTag(uint32 tag, byte *ptr) { } if (READ_BE_UINT32(ptr) != MKTAG('R','I','F','F')) - return NULL; + return nullptr; endPtr = (ptr + 12); size = READ_LE_UINT32(ptr + 4); @@ -531,11 +531,11 @@ byte *findSoundTag(uint32 tag, byte *ptr) { endPtr = endPtr + offset + 8; } - return NULL; + return nullptr; } void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags, int heFreq, int hePan, int heVol) { - Audio::RewindableAudioStream *stream = 0; + Audio::RewindableAudioStream *stream = nullptr; byte *ptr, *spoolPtr; int size = -1; int priority, rate; @@ -606,7 +606,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags, priority = (soundID > _vm->_numSounds) ? 255 : *(ptr + 18); byte *sbngPtr = findSoundTag(MKTAG('S','B','N','G'), ptr); - if (sbngPtr != NULL) { + if (sbngPtr != nullptr) { codeOffs = sbngPtr - ptr + 8; } @@ -762,7 +762,7 @@ void SoundHE::playHESound(int soundID, int heOffset, int heChannel, int heFlags, _currentMusic = soundID; stream = Audio::makeRawStream(sound, size, rate, 0); - _mixer->playStream(Audio::Mixer::kMusicSoundType, NULL, stream, soundID); + _mixer->playStream(Audio::Mixer::kMusicSoundType, nullptr, stream, soundID); } else if (READ_BE_UINT32(ptr) == MKTAG('M','I','D','I')) { if (_vm->_imuse) { diff --git a/engines/scumm/imuse/drivers/amiga.cpp b/engines/scumm/imuse/drivers/amiga.cpp index 9b8c99533ac..9699de397bb 100644 --- a/engines/scumm/imuse/drivers/amiga.cpp +++ b/engines/scumm/imuse/drivers/amiga.cpp @@ -102,7 +102,7 @@ private: struct IOUnit { IOUnit() : program(0), block(0), volume(63), currentLevel(0), fadeTargetLevel(0), fadeLevelDelta(0), fadeLevelMod(0), levelFadeTriggerDC(0), fadeLevelTicks(0), - fadeLevelTicker(0), fadeLevelDuration(0), releaseData(0), releaseDataSize(0), repeatData(0), repeatDataSize(0), envelopeState(kReady) {} + fadeLevelTicker(0), fadeLevelDuration(0), releaseData(nullptr), releaseDataSize(0), repeatData(nullptr), repeatDataSize(0), envelopeState(kReady) {} uint8 program; uint8 block; uint8 volume; @@ -176,14 +176,14 @@ private: }; SoundChannel_Amiga::SoundChannel_Amiga(IMuseDriver_Amiga *driver, int id, Instrument_Amiga *instruments) : _driver(driver), _id(id), _instruments(instruments), - _assign(0), _next(0), _prev(0), _sustain(false), _note(0) { + _assign(nullptr), _next(nullptr), _prev(nullptr), _sustain(false), _note(0) { assert(id > -1 && id < 4); _channels[id] = this; createVolumeTable(); } SoundChannel_Amiga::~SoundChannel_Amiga() { - _channels[_id] = 0; + _channels[_id] = nullptr; // delete volume table only if this is the last remaining SoundChannel_Amiga object for (int i = 0; i < 4; ++i) { @@ -192,11 +192,11 @@ SoundChannel_Amiga::~SoundChannel_Amiga() { } delete[] _volTable; - _volTable = 0; + _volTable = nullptr; } SoundChannel_Amiga *SoundChannel_Amiga::allocate(int prio) { - SoundChannel_Amiga *res = 0; + SoundChannel_Amiga *res = nullptr; for (int i = 0; i < 4; i++) { if (++_allocCurPos == 4) @@ -227,7 +227,7 @@ void SoundChannel_Amiga::connect(IMusePart_Amiga *part) { _assign = part; _next = part->getChannel(); - _prev = 0; + _prev = nullptr; part->setChannel(this); if (_next) _next->_prev = this; @@ -245,7 +245,7 @@ void SoundChannel_Amiga::disconnect() { p->_next = n; else _assign->setChannel(n); - _assign = 0; + _assign = nullptr; } void SoundChannel_Amiga::noteOn(byte note, byte volume, byte program, int8 transpose, int16 pitchBend) { @@ -283,15 +283,15 @@ void SoundChannel_Amiga::noteOn(byte note, byte volume, byte program, int8 trans uint16 period = calculatePeriod(pitchBend + ((_note + transpose) << 7), s->baseNote, s->rate); if (s->type == 1) { - keyOn(s->data, s->numSamples, 0, 0, period); - setRepeatData(0, 0); + keyOn(s->data, s->numSamples, nullptr, 0, period); + setRepeatData(nullptr, 0); } else { if (s->dr_numSamples) { keyOn(s->data, s->dr_numSamples, s->data + s->dr_offset, s->dr_numSamples - s->dr_offset, period); setRepeatData(s->data + s->dr_numSamples, s->numSamples - s->dr_numSamples); } else { keyOn(s->data, s->numSamples, s->data + s->dr_offset, s->numSamples - s->dr_offset, period); - setRepeatData(0, 0); + setRepeatData(nullptr, 0); } } } @@ -469,13 +469,13 @@ void SoundChannel_Amiga::createVolumeTable() { uint8 SoundChannel_Amiga::_allocCurPos = 0; -const uint8 *SoundChannel_Amiga::_volTable = 0; +const uint8 *SoundChannel_Amiga::_volTable = nullptr; -SoundChannel_Amiga *SoundChannel_Amiga::_channels[4] = { 0, 0, 0, 0 }; +SoundChannel_Amiga *SoundChannel_Amiga::_channels[4] = { nullptr, nullptr, nullptr, nullptr }; const int8 SoundChannel_Amiga::_muteData[16] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -IMusePart_Amiga::IMusePart_Amiga(IMuseDriver_Amiga *driver, int id) : _driver(driver), _id(id), _allocated(false), _out(0), _priority(0), _program(0), +IMusePart_Amiga::IMusePart_Amiga(IMuseDriver_Amiga *driver, int id) : _driver(driver), _id(id), _allocated(false), _out(nullptr), _priority(0), _program(0), _pitchBend(0), _pitchBendSensitivity(2), _volume(0), _modulation(0), _transpose(0), _sustain(false) { } @@ -596,7 +596,7 @@ void IMusePart_Amiga::controlSustain(byte value) { } IMuseDriver_Amiga::IMuseDriver_Amiga(Audio::Mixer *mixer) : Paula(true, mixer->getOutputRate(), (mixer->getOutputRate() * 1000) / 181818), _mixer(mixer), _isOpen(false), _soundHandle(), - _numParts(24), _baseTempo(5500), _internalTempo(5500), _timerProc(0), _timerProcPara(0), _parts(0), _chan(0), _instruments(0), _missingFiles(0), _ticker(0) { + _numParts(24), _baseTempo(5500), _internalTempo(5500), _timerProc(nullptr), _timerProcPara(nullptr), _parts(nullptr), _chan(nullptr), _instruments(nullptr), _missingFiles(0), _ticker(0) { setAudioFilter(true); _instruments = new Instrument_Amiga[129](); @@ -621,14 +621,14 @@ IMuseDriver_Amiga::~IMuseDriver_Amiga() { delete _chan[i]; delete[] _chan; } - _chan = 0; + _chan = nullptr; if (_parts) { for (int i = 0; i < _numParts; i++) delete _parts[i]; delete[] _parts; } - _parts = 0; + _parts = nullptr; delete[] _instruments; } @@ -676,7 +676,7 @@ void IMuseDriver_Amiga::close() { _isOpen = false; stopPaula(); - setTimerCallback(0, 0); + setTimerCallback(nullptr, nullptr); _mixer->stopHandle(_soundHandle); Common::StackLock lock(_mutex); @@ -732,18 +732,18 @@ uint32 IMuseDriver_Amiga::getBaseTempo() { MidiChannel *IMuseDriver_Amiga::allocateChannel() { if (!_isOpen) - return 0; + return nullptr; for (int i = 0; i < _numParts; ++i) { if (_parts[i]->allocate()) return _parts[i]; } - return 0; + return nullptr; } MidiChannel *IMuseDriver_Amiga::getPercussionChannel() { - return 0; + return nullptr; } void IMuseDriver_Amiga::interrupt() { @@ -790,7 +790,7 @@ void IMuseDriver_Amiga::loadInstrument(int program) { for (int i = 0; i < 8; ++i) { if (_instruments[program].samples[i].data) { delete[] _instruments[program].samples[i].data; - _instruments[program].samples[i].data = 0; + _instruments[program].samples[i].data = nullptr; } } diff --git a/engines/scumm/imuse/drivers/fmtowns.cpp b/engines/scumm/imuse/drivers/fmtowns.cpp index 628f3c9a5d1..94895703246 100644 --- a/engines/scumm/imuse/drivers/fmtowns.cpp +++ b/engines/scumm/imuse/drivers/fmtowns.cpp @@ -207,7 +207,7 @@ uint8 TownsMidiChanState::get(uint8 type) { } TownsMidiOutputChannel::TownsMidiOutputChannel(MidiDriver_TOWNS *driver, int chanIndex) : _driver(driver), _chan(chanIndex), - _in(0), _prev(0), _next(0), _adjustModTl(0), _operator2Tl(0), _note(0), _operator1Tl(0), _sustainNoteOff(0), _duration(0), _freq(0), _freqAdjust(0) { + _in(nullptr), _prev(nullptr), _next(nullptr), _adjustModTl(0), _operator2Tl(0), _note(0), _operator1Tl(0), _sustainNoteOff(0), _duration(0), _freq(0), _freqAdjust(0) { _effectEnvelopes = new EffectEnvelope[2](); _effectDefs = new EffectDef[2](); @@ -337,7 +337,7 @@ void TownsMidiOutputChannel::connect(TownsMidiInputChannel *chan) { _in = chan; _next = chan->_out; - _prev = 0; + _prev = nullptr; chan->_out = this; if (_next) _next->_prev = this; @@ -355,7 +355,7 @@ void TownsMidiOutputChannel::disconnect() { p->_next = n; else _in->_out = n; - _in = 0; + _in = nullptr; } bool TownsMidiOutputChannel::update() { @@ -650,7 +650,7 @@ const uint16 TownsMidiOutputChannel::_freqLSB[] = { 0x055B, 0x055B, 0x055B, 0x055B, 0x055B, 0x055B, 0x055B, 0x055B }; -TownsMidiInputChannel::TownsMidiInputChannel(MidiDriver_TOWNS *driver, int chanIndex) : MidiChannel(), _driver(driver), _out(0), _chanIndex(chanIndex), +TownsMidiInputChannel::TownsMidiInputChannel(MidiDriver_TOWNS *driver, int chanIndex) : MidiChannel(), _driver(driver), _out(nullptr), _chanIndex(chanIndex), _priority(0), _tl(0), _transpose(0), _pitchBendFactor(0), _pitchBend(0), _sustain(0), _freqLSB(0), _detune(0), _modWheel(0), _allocated(false) { _instrument = new uint8[30](); } @@ -822,8 +822,8 @@ const uint8 TownsMidiInputChannel::_programAdjustLevel[] = { 0x3D, 0x3D, 0x3E, 0x3E, 0x3E, 0x3F, 0x3F, 0x3F }; -MidiDriver_TOWNS::MidiDriver_TOWNS(Audio::Mixer *mixer) : _timerProc(0), _timerProcPara(0), _channels(0), _out(0), - _baseTempo(10080), _chanState(0), _operatorLevelTable(0), _tickCounter(0), _rand(1), _allocCurPos(0), _isOpen(false) { +MidiDriver_TOWNS::MidiDriver_TOWNS(Audio::Mixer *mixer) : _timerProc(nullptr), _timerProcPara(nullptr), _channels(nullptr), _out(nullptr), + _baseTempo(10080), _chanState(nullptr), _operatorLevelTable(nullptr), _tickCounter(0), _rand(1), _allocCurPos(0), _isOpen(false) { _intf = new TownsAudioInterface(mixer, this, true); _channels = new TownsMidiInputChannel*[32]; @@ -854,19 +854,19 @@ MidiDriver_TOWNS::~MidiDriver_TOWNS() { delete _channels[i]; delete[] _channels; } - _channels = 0; + _channels = nullptr; if (_out) { for (int i = 0; i < 6; i++) delete _out[i]; delete[] _out; } - _out = 0; + _out = nullptr; delete[] _chanState; - _chanState = 0; + _chanState = nullptr; delete[] _operatorLevelTable; - _operatorLevelTable = 0; + _operatorLevelTable = nullptr; } int MidiDriver_TOWNS::open() { @@ -898,7 +898,7 @@ void MidiDriver_TOWNS::close() { _isOpen = false; - setTimerCallback(0, 0); + setTimerCallback(nullptr, nullptr); g_system->delayMillis(20); } @@ -951,7 +951,7 @@ uint32 MidiDriver_TOWNS::getBaseTempo() { MidiChannel *MidiDriver_TOWNS::allocateChannel() { if (!_isOpen) - return 0; + return nullptr; for (int i = 0; i < 32; ++i) { TownsMidiInputChannel *chan = _channels[i]; @@ -959,11 +959,11 @@ MidiChannel *MidiDriver_TOWNS::allocateChannel() { return chan; } - return 0; + return nullptr; } MidiChannel *MidiDriver_TOWNS::getPercussionChannel() { - return 0; + return nullptr; } void MidiDriver_TOWNS::timerCallback(int timerId) { @@ -997,7 +997,7 @@ void MidiDriver_TOWNS::updateOutputChannels() { } TownsMidiOutputChannel *MidiDriver_TOWNS::allocateOutputChannel(uint8 pri) { - TownsMidiOutputChannel *res = 0; + TownsMidiOutputChannel *res = nullptr; for (int i = 0; i < 6; i++) { if (++_allocCurPos == 6) diff --git a/engines/scumm/imuse/drivers/mac_m68k.cpp b/engines/scumm/imuse/drivers/mac_m68k.cpp index 1bcef442221..2b1c9479ad3 100644 --- a/engines/scumm/imuse/drivers/mac_m68k.cpp +++ b/engines/scumm/imuse/drivers/mac_m68k.cpp @@ -77,7 +77,7 @@ int MacM68kDriver::open() { } } - _mixBuffer = 0; + _mixBuffer = nullptr; _mixBufferLength = 0; // We set the output sound type to music here to allow sound volume @@ -101,9 +101,9 @@ void MacM68kDriver::close() { } _instruments.clear(); delete[] _volumeTable; - _volumeTable = 0; + _volumeTable = nullptr; delete[] _mixBuffer; - _mixBuffer = 0; + _mixBuffer = nullptr; _mixBufferLength = 0; } @@ -122,7 +122,7 @@ MidiChannel *MacM68kDriver::allocateChannel() { } } - return 0; + return nullptr; } MacM68kDriver::Instrument MacM68kDriver::getInstrument(int idx) const { @@ -273,7 +273,7 @@ void MacM68kDriver::VoiceChannel::off() { } part->removeVoice(this); - part = 0; + part = nullptr; } void MacM68kDriver::MidiChannel_MacM68k::release() { @@ -352,7 +352,7 @@ void MacM68kDriver::MidiChannel_MacM68k::noteOn(byte note, byte velocity) { voice->out.loopStart = _instrument.data + _instrument.loopStart; voice->out.loopEnd = _instrument.data + _instrument.loopEnd; } else { - voice->out.loopStart = 0; + voice->out.loopStart = nullptr; voice->out.loopEnd = voice->out.soundEnd; } @@ -440,7 +440,7 @@ bool MacM68kDriver::MidiChannel_MacM68k::allocate() { } _allocated = true; - _voice = 0; + _voice = nullptr; _priority = 0; memset(&_instrument, 0, sizeof(_instrument)); _pitchBend = 0; @@ -451,7 +451,7 @@ bool MacM68kDriver::MidiChannel_MacM68k::allocate() { void MacM68kDriver::MidiChannel_MacM68k::addVoice(VoiceChannel *voice) { voice->next = _voice; - voice->prev = 0; + voice->prev = nullptr; voice->part = this; if (_voice) { _voice->prev = voice; @@ -479,7 +479,7 @@ void MacM68kDriver::MidiChannel_MacM68k::removeVoice(VoiceChannel *voice) { } MacM68kDriver::VoiceChannel *MacM68kDriver::allocateVoice(int priority) { - VoiceChannel *channel = 0; + VoiceChannel *channel = nullptr; for (int i = 0; i < kChannelCount; ++i) { if (++_lastUsedVoiceChannel == kChannelCount) { _lastUsedVoiceChannel = 0; diff --git a/engines/scumm/imuse/drivers/pcspk.cpp b/engines/scumm/imuse/drivers/pcspk.cpp index 0e516c27aa5..b1579e7d1e2 100644 --- a/engines/scumm/imuse/drivers/pcspk.cpp +++ b/engines/scumm/imuse/drivers/pcspk.cpp @@ -42,14 +42,14 @@ int PcSpkDriver::open() { for (uint i = 0; i < 6; ++i) _channels[i].init(this, i); - _activeChannel = 0; + _activeChannel = nullptr; _effectTimer = 0; _randBase = 1; // We need to take care we only send note frequencies, when the internal // settings actually changed, thus we need some extra state to keep track // of that. - _lastActiveChannel = 0; + _lastActiveChannel = nullptr; _lastActiveOut = 0; // We set the output sound type to music here to allow sound volume @@ -85,7 +85,7 @@ MidiChannel *PcSpkDriver::allocateChannel() { return &_channels[i]; } - return 0; + return nullptr; } void PcSpkDriver::generateSamples(int16 *buf, int len) { @@ -129,14 +129,14 @@ void PcSpkDriver::onTimer() { output((_activeChannel->_out.note << 7) + _activeChannel->_pitchBend + _activeChannel->_out.unk60 + _activeChannel->_out.unkE); } else { _pcSpk.stop(); - _lastActiveChannel = 0; + _lastActiveChannel = nullptr; _lastActiveOut = 0; } } void PcSpkDriver::updateNote() { uint8 priority = 0; - _activeChannel = 0; + _activeChannel = nullptr; for (uint i = 0; i < 6; ++i) { if (_channels[i]._allocated && _channels[i]._out.active && _channels[i]._priority >= priority) { priority = _channels[i]._priority; @@ -144,9 +144,9 @@ void PcSpkDriver::updateNote() { } } - if (_activeChannel == 0 || _activeChannel->_tl == 0) { + if (_activeChannel == nullptr || _activeChannel->_tl == 0) { _pcSpk.stop(); - _lastActiveChannel = 0; + _lastActiveChannel = nullptr; _lastActiveOut = 0; } else { output(_activeChannel->_pitchBend + (_activeChannel->_out.note << 7)); @@ -261,7 +261,7 @@ void PcSpkDriver::MidiChannel_PcSpk::noteOn(byte note, byte velocity) { if (_instrument[4] * 256 < ARRAYSIZE(PcSpkDriver::_outInstrumentData)) _out.instrument = _owner->_outInstrumentData + _instrument[4] * 256; else - _out.instrument = 0; + _out.instrument = nullptr; _out.unkA = 0; _out.unkB = _instrument[1]; @@ -274,7 +274,7 @@ void PcSpkDriver::MidiChannel_PcSpk::noteOn(byte note, byte velocity) { // last active channel, thus we assure the frequency is correctly set, even // when the same note was sent. if (_owner->_lastActiveChannel == this) { - _owner->_lastActiveChannel = 0; + _owner->_lastActiveChannel = nullptr; _owner->_lastActiveOut = 0; } _owner->updateNote(); @@ -312,7 +312,7 @@ void PcSpkDriver::MidiChannel_PcSpk::controlChange(byte control, byte value) { _tl = value; if (_owner->_activeChannel == this) { if (_tl == 0) { - _owner->_lastActiveChannel = 0; + _owner->_lastActiveChannel = nullptr; _owner->_lastActiveOut = 0; _owner->_pcSpk.stop(); } else { @@ -521,7 +521,7 @@ void PcSpkDriver::updateEffectGenerator(MidiChannel_PcSpk &chan, EffectEnvelope if ((chan._instrument[4] + (def.phase & 0xFF)) * 256 < ARRAYSIZE(_outInstrumentData)) chan._out.instrument = _outInstrumentData + (chan._instrument[4] + (def.phase & 0xFF)) * 256; else - chan._out.instrument = 0; + chan._out.instrument = nullptr; break; case 5: diff --git a/engines/scumm/imuse/imuse.cpp b/engines/scumm/imuse/imuse.cpp index 369a2752c39..aa97ca6b6c7 100644 --- a/engines/scumm/imuse/imuse.cpp +++ b/engines/scumm/imuse/imuse.cpp @@ -46,9 +46,9 @@ IMuseInternal::IMuseInternal() : _native_mt32(false), _enable_gs(false), _isAmiga(false), - _midi_adlib(NULL), - _midi_native(NULL), - _sysex(NULL), + _midi_adlib(nullptr), + _midi_native(nullptr), + _sysex(nullptr), _paused(false), _initialized(false), _tempoFactor(0), @@ -84,7 +84,7 @@ IMuseInternal::~IMuseInternal() { if (_midi_adlib) { _midi_adlib->close(); delete _midi_adlib; - _midi_adlib = 0; + _midi_adlib = nullptr; } if (_midi_native) { @@ -96,7 +96,7 @@ IMuseInternal::~IMuseInternal() { _midi_native->close(); delete _midi_native; - _midi_native = 0; + _midi_native = nullptr; } } @@ -112,17 +112,17 @@ byte *IMuseInternal::findStartOfSound(int sound, int ct) { byte *ptr = g_scumm->_res->_types[rtSound][sound]._address; - if (ptr == NULL) { + if (ptr == nullptr) { debug(1, "IMuseInternal::findStartOfSound(): Sound %d doesn't exist", sound); - return NULL; + return nullptr; } // Check for old-style headers first, like 'RO' int trFlag = (kMThd | kFORM); if (ptr[0] == 'R' && ptr[1] == 'O' && ptr[2] != 'L') - return ct == trFlag ? ptr : 0; + return ct == trFlag ? ptr : nullptr; if (ptr[4] == 'S' && ptr[5] == 'O') - return ct == trFlag ? ptr + 4 : 0; + return ct == trFlag ? ptr + 4 : nullptr; ptr += 4; size = READ_BE_UINT32(ptr); @@ -143,12 +143,12 @@ byte *IMuseInternal::findStartOfSound(int sound, int ct) { if (ct == (kMThd | kFORM)) debug(3, "IMuseInternal::findStartOfSound(): Failed to align on sound %d", sound); - return 0; + return nullptr; } bool IMuseInternal::isMT32(int sound) { byte *ptr = g_scumm->_res->_types[rtSound][sound]._address; - if (ptr == NULL) + if (ptr == nullptr) return false; uint32 tag = READ_BE_UINT32(ptr); @@ -195,7 +195,7 @@ bool IMuseInternal::isMT32(int sound) { bool IMuseInternal::isMIDI(int sound) { byte *ptr = g_scumm->_res->_types[rtSound][sound]._address; - if (ptr == NULL) + if (ptr == nullptr) return false; uint32 tag = READ_BE_UINT32(ptr); @@ -237,7 +237,7 @@ bool IMuseInternal::isMIDI(int sound) { bool IMuseInternal::supportsPercussion(int sound) { byte *ptr = g_scumm->_res->_types[rtSound][sound]._address; - if (ptr == NULL) + if (ptr == nullptr) return false; uint32 tag = READ_BE_UINT32(ptr); @@ -280,7 +280,7 @@ bool IMuseInternal::supportsPercussion(int sound) { } MidiDriver *IMuseInternal::getBestMidiDriver(int sound) { - MidiDriver *driver = NULL; + MidiDriver *driver = nullptr; if (isMIDI(sound)) { if (_midi_native) { @@ -296,7 +296,7 @@ MidiDriver *IMuseInternal::getBestMidiDriver(int sound) { } Player *IMuseInternal::allocate_player(byte priority) { - Player *player = _players, *best = NULL; + Player *player = _players, *best = nullptr; int i; byte bestpri = 255; @@ -313,7 +313,7 @@ Player *IMuseInternal::allocate_player(byte priority) { return best; debug(1, "Denying player request"); - return NULL; + return nullptr; } void IMuseInternal::init_players() { @@ -768,7 +768,7 @@ int32 IMuseInternal::doCommand_internal(int numargs, int a[]) { int i; byte cmd = a[0] & 0xFF; byte param = a[0] >> 8; - Player *player = NULL; + Player *player = nullptr; if (!_initialized && (cmd || param)) return -1; @@ -804,7 +804,7 @@ int32 IMuseInternal::doCommand_internal(int numargs, int a[]) { case 12: // Sam & Max: Player-scope commands player = findActivePlayer(a[1]); - if (player == NULL) + if (player == nullptr) return -1; switch (a[3]) { @@ -1049,7 +1049,7 @@ int IMuseInternal::get_channel_volume(uint a) { } Part *IMuseInternal::allocate_part(byte pri, MidiDriver *midi) { - Part *part, *best = NULL; + Part *part, *best = nullptr; int i; for (i = ARRAYSIZE(_parts), part = _parts; i != 0; i--, part++) { @@ -1113,9 +1113,9 @@ int IMuseInternal::set_volchan(int sound, int volchan) { } return -1; } else { - best = NULL; + best = nullptr; num = 0; - sameid = NULL; + sameid = nullptr; for (i = ARRAYSIZE(_players), player = _players; i != 0; i--, player++) { if (player->isActive()) { if (player->_vol_chan == (uint16)volchan) { @@ -1127,7 +1127,7 @@ int IMuseInternal::set_volchan(int sound, int volchan) { } } } - if (sameid == NULL) + if (sameid == nullptr) return -1; if (num >= r) best->clear(); @@ -1246,7 +1246,7 @@ int32 IMuseInternal::ImSetTrigger(int sound, int id, int a, int b, int c, int d, // represented by MIDI SysEx block 00 xx(F7) // where "xx" is the marker ID. uint16 oldest_trigger = 0; - ImTrigger *oldest_ptr = NULL; + ImTrigger *oldest_ptr = nullptr; int i; ImTrigger *trig = _snm_triggers; @@ -1420,7 +1420,7 @@ Player *IMuseInternal::findActivePlayer(int id) { if (player->isActive() && player->getID() == (uint16)id) return player; } - return NULL; + return nullptr; } int IMuseInternal::get_volchan_entry(uint a) { @@ -1441,12 +1441,12 @@ int IMuseInternal::initialize(OSystem *syst, MidiDriver *native_midi, MidiDriver _system = syst; _midi_native = native_midi; _midi_adlib = adlib_midi; - if (native_midi != NULL) { + if (native_midi != nullptr) { _timer_info_native.imuse = this; _timer_info_native.driver = native_midi; initMidiDriver(&_timer_info_native); } - if (adlib_midi != NULL) { + if (adlib_midi != nullptr) { _timer_info_adlib.imuse = this; _timer_info_adlib.driver = adlib_midi; initMidiDriver(&_timer_info_adlib); @@ -1709,7 +1709,7 @@ void IMuseInternal::reallocateMidiChannels(MidiDriver *midi) { while (true) { hipri = 0; - hipart = NULL; + hipart = nullptr; for (i = 32, part = _parts; i; i--, part++) { if (part->_player && part->_player->getMidiDriver() == midi && !part->_percussion && part->_on && @@ -1722,9 +1722,9 @@ void IMuseInternal::reallocateMidiChannels(MidiDriver *midi) { if (!hipart) return; - if ((hipart->_mc = midi->allocateChannel()) == NULL) { + if ((hipart->_mc = midi->allocateChannel()) == nullptr) { lopri = 255; - lopart = NULL; + lopart = nullptr; for (i = 32, part = _parts; i; i--, part++) { if (part->_mc && part->_mc->device() == midi && part->_pri_eff <= lopri) { lopri = part->_pri_eff; @@ -1732,11 +1732,11 @@ void IMuseInternal::reallocateMidiChannels(MidiDriver *midi) { } } - if (lopart == NULL || lopri >= hipri) + if (lopart == nullptr || lopri >= hipri) return; lopart->off(); - if ((hipart->_mc = midi->allocateChannel()) == NULL) + if ((hipart->_mc = midi->allocateChannel()) == nullptr) return; } hipart->sendAll(); diff --git a/engines/scumm/imuse/imuse_part.cpp b/engines/scumm/imuse/imuse_part.cpp index c3c37dbcb73..04ef66ca2f4 100644 --- a/engines/scumm/imuse/imuse_part.cpp +++ b/engines/scumm/imuse/imuse_part.cpp @@ -38,10 +38,10 @@ namespace Scumm { Part::Part() { _slot = 0; - _next = 0; - _prev = 0; - _mc = 0; - _player = 0; + _next = nullptr; + _prev = nullptr; + _mc = nullptr; + _player = nullptr; _pitchbend = 0; _pitchbend_factor = 0; _transpose = 0; @@ -78,13 +78,13 @@ void Part::saveLoadWithSerializer(Common::Serializer &ser) { ser.syncAsUint16LE(num); } else { ser.syncAsUint16LE(num); - _next = (num ? &_se->_parts[num - 1] : 0); + _next = (num ? &_se->_parts[num - 1] : nullptr); ser.syncAsUint16LE(num); - _prev = (num ? &_se->_parts[num - 1] : 0); + _prev = (num ? &_se->_parts[num - 1] : nullptr); ser.syncAsUint16LE(num); - _player = (num ? &_se->_players[num - 1] : 0); + _player = (num ? &_se->_players[num - 1] : nullptr); } ser.syncAsSint16LE(_pitchbend, VER(8)); @@ -280,10 +280,10 @@ void Part::noteOff(byte note) { } void Part::init() { - _player = NULL; - _next = NULL; - _prev = NULL; - _mc = NULL; + _player = nullptr; + _next = nullptr; + _prev = nullptr; + _mc = nullptr; } void Part::setup(Player *player) { @@ -309,7 +309,7 @@ void Part::setup(Player *player) { _modwheel = 0; _bank = 0; _pedal = false; - _mc = NULL; + _mc = nullptr; } void Part::uninit() { @@ -317,14 +317,14 @@ void Part::uninit() { return; off(); _player->removePart(this); - _player = NULL; + _player = nullptr; } void Part::off() { if (_mc) { _mc->allNotesOff(); _mc->release(); - _mc = NULL; + _mc = nullptr; } } diff --git a/engines/scumm/imuse/imuse_player.cpp b/engines/scumm/imuse/imuse_player.cpp index 64462ac2359..bd7f69fee2e 100644 --- a/engines/scumm/imuse/imuse_player.cpp +++ b/engines/scumm/imuse/imuse_player.cpp @@ -56,9 +56,9 @@ uint16 Player::_active_notes[128]; ////////////////////////////////////////////////// Player::Player() : - _midi(NULL), - _parser(NULL), - _parts(NULL), + _midi(nullptr), + _parser(nullptr), + _parts(nullptr), _active(false), _scanning(false), _id(0), @@ -79,7 +79,7 @@ Player::Player() : _isMT32(false), _isMIDI(false), _supportsPercussion(false), - _se(0), + _se(nullptr), _vol_chan(0), _abort(false), _music_tick(0), @@ -89,7 +89,7 @@ Player::Player() : Player::~Player() { if (_parser) { delete _parser; - _parser = 0; + _parser = nullptr; } } @@ -109,7 +109,7 @@ bool Player::startSound(int sound, MidiDriver *midi) { _isMIDI = _se->isMIDI(sound); _supportsPercussion = _se->supportsPercussion(sound); - _parts = NULL; + _parts = nullptr; _active = true; _midi = midi; _id = sound; @@ -122,7 +122,7 @@ bool Player::startSound(int sound, MidiDriver *midi) { if (start_seq_sound(sound) != 0) { _active = false; - _midi = NULL; + _midi = nullptr; return false; } @@ -152,13 +152,13 @@ void Player::clear() { if (_parser) { _parser->unloadMusic(); - _parser->setMidiDriver(NULL); + _parser->setMidiDriver(nullptr); } uninit_parts(); _se->ImFireAllTriggers(_id); _active = false; - _midi = NULL; + _midi = nullptr; _id = 0; _note_offset = 0; } @@ -180,7 +180,7 @@ int Player::start_seq_sound(int sound, bool reset_vars) { } ptr = _se->findStartOfSound(sound); - if (ptr == NULL) + if (ptr == nullptr) return -1; if (!memcmp(ptr, "RO", 2)) { @@ -274,7 +274,7 @@ void Player::send(uint32 b) { switch (cmd >> 4) { case 0x8: // Key Off if (!_scanning) { - if ((part = getPart(chan)) != 0) + if ((part = getPart(chan)) != nullptr) part->noteOff(param1); } else { _active_notes[param1] &= ~(1 << chan); @@ -286,7 +286,7 @@ void Player::send(uint32 b) { if (!_scanning) { if (_isMT32 && !_se->isNativeMT32()) param2 = (((param2 * 3) >> 2) + 32) & 0x7F; - if ((part = getPart(chan)) != 0) + if ((part = getPart(chan)) != nullptr) part->noteOn(param1, param2); } else { _active_notes[param1] |= (1 << chan); @@ -642,7 +642,7 @@ Part *Player::getActivePart(uint8 chan) { return part; part = part->_next; } - return 0; + return nullptr; } Part *Player::getPart(uint8 chan) { @@ -653,11 +653,11 @@ Part *Player::getPart(uint8 chan) { part = _se->allocate_part(_priority, _midi); if (!part) { debug(1, "No parts available"); - return NULL; + return nullptr; } // Insert part into front of parts list - part->_prev = NULL; + part->_prev = nullptr; part->_next = _parts; if (_parts) _parts->_prev = part; @@ -928,7 +928,7 @@ int Player::addParameterFader(int param, int target, int time) { } ParameterFader *ptr = &_parameterFaders[0]; - ParameterFader *best = 0; + ParameterFader *best = nullptr; int i; for (i = ARRAYSIZE(_parameterFaders); i; --i, ++ptr) { if (ptr->param == param) { @@ -1014,7 +1014,7 @@ void Player::removePart(Part *part) { part->_prev->_next = part->_next; else _parts = part->_next; - part->_next = part->_prev = 0; + part->_next = part->_prev = nullptr; } void Player::fixAfterLoad() { @@ -1056,7 +1056,7 @@ static void syncWithSerializer(Common::Serializer &s, ParameterFader &pf) { void Player::saveLoadWithSerializer(Common::Serializer &s) { if (!s.isSaving() && _parser) { delete _parser; - _parser = 0; + _parser = nullptr; _parserType = kParserTypeNone; } _music_tick = _parser ? _parser->getTick() : 0; @@ -1067,7 +1067,7 @@ void Player::saveLoadWithSerializer(Common::Serializer &s) { s.syncAsUint16LE(num); } else { s.syncAsUint16LE(num); - _parts = (num ? &_se->_parts[num - 1] : 0); + _parts = (num ? &_se->_parts[num - 1] : nullptr); } s.syncAsByte(_active, VER(8)); diff --git a/engines/scumm/imuse/instrument.cpp b/engines/scumm/imuse/instrument.cpp index c2fec7cd8e4..dbec3977043 100644 --- a/engines/scumm/imuse/instrument.cpp +++ b/engines/scumm/imuse/instrument.cpp @@ -304,7 +304,7 @@ void Instrument::nativeMT32(bool native) { void Instrument::clear() { delete _instrument; - _instrument = NULL; + _instrument = nullptr; _type = itNone; } diff --git a/engines/scumm/imuse/sysex_scumm.cpp b/engines/scumm/imuse/sysex_scumm.cpp index 5c8cea67e9f..cb9e93ec683 100644 --- a/engines/scumm/imuse/sysex_scumm.cpp +++ b/engines/scumm/imuse/sysex_scumm.cpp @@ -104,7 +104,7 @@ void sysexHandler_Scumm(Player *player, const byte *msg, uint16 len) { case 1: // Shut down a part. [Bug #1849, comments] part = player->getPart(p[0]); - if (part != NULL) + if (part != nullptr) part->uninit(); break; diff --git a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp index 53169d9c35b..e7602528ad4 100644 --- a/engines/scumm/imuse_digi/dimuse_bndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_bndmgr.cpp @@ -32,11 +32,11 @@ namespace Scumm { BundleDirCache::BundleDirCache() { for (int fileId = 0; fileId < ARRAYSIZE(_budleDirCache); fileId++) { - _budleDirCache[fileId].bundleTable = NULL; + _budleDirCache[fileId].bundleTable = nullptr; _budleDirCache[fileId].fileName[0] = 0; _budleDirCache[fileId].numFiles = 0; _budleDirCache[fileId].isCompressed = false; - _budleDirCache[fileId].indexTable = NULL; + _budleDirCache[fileId].indexTable = nullptr; } } @@ -70,7 +70,7 @@ int BundleDirCache::matchFile(const char *filename) { int fileId; for (fileId = 0; fileId < ARRAYSIZE(_budleDirCache); fileId++) { - if ((_budleDirCache[fileId].bundleTable == NULL) && (freeSlot == -1)) { + if ((_budleDirCache[fileId].bundleTable == nullptr) && (freeSlot == -1)) { freeSlot = fileId; } if (scumm_stricmp(filename, _budleDirCache[fileId].fileName) == 0) { @@ -141,14 +141,14 @@ int BundleDirCache::matchFile(const char *filename) { BundleMgr::BundleMgr(BundleDirCache *cache) { _cache = cache; - _bundleTable = NULL; - _compTable = NULL; + _bundleTable = nullptr; + _compTable = nullptr; _numFiles = 0; _numCompItems = 0; _curSampleId = -1; _fileBundleId = -1; _file = new ScummFile(); - _compInputBuff = NULL; + _compInputBuff = nullptr; } BundleMgr::~BundleMgr() { @@ -168,7 +168,7 @@ Common::SeekableReadStream *BundleMgr::getFile(const char *filename, int32 &offs return _file; } - return NULL; + return nullptr; } bool BundleMgr::open(const char *filename, bool &compressed, bool errorFlag) { @@ -203,7 +203,7 @@ bool BundleMgr::open(const char *filename, bool &compressed, bool errorFlag) { void BundleMgr::close() { if (_file->isOpen()) { _file->close(); - _bundleTable = NULL; + _bundleTable = nullptr; _numFiles = 0; _numCompItems = 0; _compTableLoaded = false; @@ -212,9 +212,9 @@ void BundleMgr::close() { _outputSize = 0; _curSampleId = -1; free(_compTable); - _compTable = NULL; + _compTable = nullptr; free(_compInputBuff); - _compInputBuff = NULL; + _compInputBuff = nullptr; } } diff --git a/engines/scumm/imuse_digi/dimuse_codecs.cpp b/engines/scumm/imuse_digi/dimuse_codecs.cpp index 65141534b2f..44c57a6bb72 100644 --- a/engines/scumm/imuse_digi/dimuse_codecs.cpp +++ b/engines/scumm/imuse_digi/dimuse_codecs.cpp @@ -60,8 +60,8 @@ uint32 decode12BitsSample(const byte *src, byte **dst, uint32 size) { * varies the size of each "packet" between 2 and 7 bits. */ -static byte *_destImcTable = NULL; -static uint32 *_destImcTable2 = NULL; +static byte *_destImcTable = nullptr; +static uint32 *_destImcTable2 = nullptr; // This table is the "big brother" of Audio::ADPCMStream::_stepAdjustTable. static const byte imxOtherTable[6][64] = { @@ -106,9 +106,9 @@ static const byte imxOtherTable[6][64] = { void releaseImcTables() { free(_destImcTable); - _destImcTable = NULL; + _destImcTable = nullptr; free(_destImcTable2); - _destImcTable2 = NULL; + _destImcTable2 = nullptr; } void initializeImcTables() { diff --git a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp index 80be6000b20..d3f00e01eea 100644 --- a/engines/scumm/imuse_digi/dimuse_sndmgr.cpp +++ b/engines/scumm/imuse_digi/dimuse_sndmgr.cpp @@ -315,7 +315,7 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::allocSlot() { } } - return NULL; + return nullptr; } bool ImuseDigiSndMgr::openMusicBundle(SoundDesc *sound, int &disk) { @@ -400,7 +400,7 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char const bool header_outside = ((_vm->_game.id == GID_CMI) && !(_vm->_game.features & GF_DEMO)); bool result = false; - byte *ptr = NULL; + byte *ptr = nullptr; switch (soundType) { case IMUSE_RESOURCE: @@ -409,9 +409,9 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char _vm->ensureResourceLoaded(rtSound, soundId); _vm->_res->lock(rtSound, soundId); ptr = _vm->getResourceAddress(rtSound, soundId); - if (ptr == NULL) { + if (ptr == nullptr) { closeSound(sound); - return NULL; + return nullptr; } sound->resPtr = ptr; break; @@ -424,7 +424,7 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId); if (!result) { closeSound(sound); - return NULL; + return nullptr; } if (sound->compressed) { char fileName[24]; @@ -433,7 +433,7 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char Common::SeekableReadStream *rmapFile = sound->bundle->getFile(fileName, offset, size); if (!rmapFile) { closeSound(sound); - return NULL; + return nullptr; } prepareSoundFromRMAP(rmapFile, sound, offset, size); strcpy(sound->name, soundName); @@ -443,19 +443,19 @@ ImuseDigiSndMgr::SoundDesc *ImuseDigiSndMgr::openSound(int32 soundId, const char sound->disk = disk; return sound; } else if (soundName[0] == 0) { - if (sound->bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside, rawBundle) == 0 || ptr == NULL) { + if (sound->bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside, rawBundle) == 0 || ptr == nullptr) { closeSound(sound); free(ptr); - return NULL; + return nullptr; } } else { - if (sound->bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside, rawBundle) == 0 || ptr == NULL) { + if (sound->bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside, rawBundle) == 0 || ptr == nullptr) { closeSound(sound); free(ptr); - return NULL; + return nullptr; } } - sound->resPtr = 0; + sound->resPtr = nullptr; break; default: error("ImuseDigiSndMgr::openSound() Unknown soundType %d (trying to load sound %d)", soundType, soundId); @@ -618,7 +618,7 @@ void ImuseDigiSndMgr::getSyncSizeAndPtrById(SoundDesc *soundDesc, int number, in *sync_ptr = soundDesc->sync[number].ptr; } else { sync_size = 0; - *sync_ptr = NULL; + *sync_ptr = nullptr; } } @@ -751,7 +751,7 @@ int32 ImuseDigiSndMgr::getDataFromRegion(SoundDesc *soundDesc, int region, byte size = soundDesc->compressedStream->readBuffer((int16 *)*buf, size / 2) * 2; if (soundDesc->compressedStream->endOfData() || soundDesc->endFlag) { delete soundDesc->compressedStream; - soundDesc->compressedStream = NULL; + soundDesc->compressedStream = nullptr; soundDesc->lastFileName[0] = 0; soundDesc->endFlag = true; } diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index 8ab7202a953..84e2c827a8d 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -483,10 +483,10 @@ void ScummEngine_v2::processKeyboard(Common::KeyState lastKeyHit) { if (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.hasFlags(Common::KBD_ALT)) { prepareSavegame(); if (_game.id == GID_MANIAC && _game.version == 0) { - runScript(2, 0, 0, 0); + runScript(2, 0, 0, nullptr); } if (_game.id == GID_MANIAC &&_game.platform == Common::kPlatformNES) { - runScript(163, 0, 0, 0); + runScript(163, 0, 0, nullptr); } } @@ -544,12 +544,12 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) { if (mainmenuKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F5 && lastKeyHit.hasFlags(0))) { if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0) - runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0); + runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, nullptr); openMainMenuDialog(); // Display global main menu if (VAR_SAVELOAD_SCRIPT2 != 0xFF && _currentRoom != 0) - runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0); + runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, nullptr); } else if (restartKeyEnabled && (lastKeyHit.keycode == Common::KEYCODE_F8 && lastKeyHit.hasFlags(0))) { confirmRestartDialog(); diff --git a/engines/scumm/midiparser_ro.cpp b/engines/scumm/midiparser_ro.cpp index 600b2ea7b44..16360abf2f5 100644 --- a/engines/scumm/midiparser_ro.cpp +++ b/engines/scumm/midiparser_ro.cpp @@ -86,7 +86,7 @@ void MidiParser_RO::parseNextEvent (EventInfo &info) { info.event = 0xFF; info.ext.type = 0x2F; info.length = 0; - info.ext.data = 0; + info.ext.data = nullptr; return; } @@ -110,7 +110,7 @@ void MidiParser_RO::parseNextEvent (EventInfo &info) { case 0xF: // Marker and EOT messages info.length = 0; - info.ext.data = 0; + info.ext.data = nullptr; if (info.event == 0xFF) { _autoLoop = true; info.ext.type = 0x2F; diff --git a/engines/scumm/object.cpp b/engines/scumm/object.cpp index e094595f01b..0412756b084 100644 --- a/engines/scumm/object.cpp +++ b/engines/scumm/object.cpp @@ -203,7 +203,7 @@ void ScummEngine::clearOwnerOf(int obj) { // FIXME FIXME FIXME: This is incomplete, as we do not touch flags, status... BUG _res->_types[rtInventory][i]._address = _res->_types[rtInventory][i + 1]._address; _res->_types[rtInventory][i]._size = _res->_types[rtInventory][i + 1]._size; - _res->_types[rtInventory][i + 1]._address = NULL; + _res->_types[rtInventory][i + 1]._address = nullptr; _res->_types[rtInventory][i + 1]._size = 0; } } @@ -481,8 +481,8 @@ int ScummEngine::getDist(int x, int y, int x2, int y2) { int ScummEngine::getObjActToObjActDist(int a, int b) { int x, y, x2, y2; - Actor *acta = NULL; - Actor *actb = NULL; + Actor *acta = nullptr; + Actor *actb = nullptr; if (objIsActor(a)) acta = derefActorSafe(objToActor(a), "getObjActToObjActDist"); @@ -775,7 +775,7 @@ void ScummEngine::resetRoomObjects() { od = &_objs[findLocalObjectSlot()]; ptr = obcds.findNext(MKTAG('O','B','C','D')); - if (ptr == NULL) + if (ptr == nullptr) error("Room %d missing object code block(s)", _roomResource); od->OBCDoffset = ptr - rootptr; @@ -801,7 +801,7 @@ void ScummEngine::resetRoomObjects() { ResourceIterator obims(room, false); for (i = 0; i < _numObjectsInRoom; i++) { ptr = obims.findNext(MKTAG('O','B','I','M')); - if (ptr == NULL) + if (ptr == nullptr) error("Room %d missing image blocks(s)", _roomResource); obim_id = getObjectIdFromOBIM(ptr); @@ -882,7 +882,7 @@ void ScummEngine_v4::resetRoomObjects() { od = &_objs[findLocalObjectSlot()]; ptr = obcds.findNext(MKTAG('O','B','C','D')); - if (ptr == NULL) + if (ptr == nullptr) error("Room %d missing object code block(s)", _roomResource); od->OBCDoffset = ptr - room; @@ -899,7 +899,7 @@ void ScummEngine_v4::resetRoomObjects() { // In the PC Engine version of Loom, there aren't image blocks // for all objects. ptr = obims.findNext(MKTAG('O','B','I','M')); - if (ptr == NULL) + if (ptr == nullptr) break; obim_id = READ_LE_UINT16(ptr + 6); @@ -989,12 +989,12 @@ void ScummEngine_v4::resetRoomObject(ObjectData *od, const byte *room, const byt } void ScummEngine::resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr) { - const CodeHeader *cdhd = NULL; - const ImageHeader *imhd = NULL; + const CodeHeader *cdhd = nullptr; + const ImageHeader *imhd = nullptr; assert(room); - if (searchptr == NULL) { + if (searchptr == nullptr) { if (_game.version == 8) { searchptr = getResourceAddress(rtRoomScripts, _roomResource); assert(searchptr); @@ -1004,7 +1004,7 @@ void ScummEngine::resetRoomObject(ObjectData *od, const byte *room, const byte * } cdhd = (const CodeHeader *)findResourceData(MKTAG('C','D','H','D'), searchptr + od->OBCDoffset); - if (cdhd == NULL) + if (cdhd == nullptr) error("Room %d missing CDHD blocks(s)", _roomResource); if (od->OBIMoffset) imhd = (const ImageHeader *)findResourceData(MKTAG('I','M','H','D'), room + od->OBIMoffset); @@ -1187,8 +1187,8 @@ const byte *ScummEngine::getObjOrActorName(int obj) { } objptr = getOBCDFromObject(obj, true); - if (objptr == NULL) - return NULL; + if (objptr == nullptr) + return nullptr; if (_game.features & GF_SMALL_HEADER) { byte offset = 0; @@ -1226,7 +1226,7 @@ void ScummEngine::setObjectName(int obj) { for (i = 0; i < _numNewNames; i++) { if (_newNames[i] == 0) { - loadPtrToResource(rtObjectName, i, NULL); + loadPtrToResource(rtObjectName, i, nullptr); _newNames[i] = obj; runInventoryScript(0); return; @@ -1261,7 +1261,7 @@ byte *ScummEngine::getOBCDFromObject(int obj, bool v0CheckInventory) { _objectOwnerTable[obj] != OF_OWNER_ROOM) { if (_game.version == 0 && !v0CheckInventory) - return 0; + return nullptr; for (i = 0; i < _numInventory; i++) { if (_inventory[i] == obj) return getResourceAddress(rtInventory, i); @@ -1281,7 +1281,7 @@ byte *ScummEngine::getOBCDFromObject(int obj, bool v0CheckInventory) { } } } - return 0; + return nullptr; } const byte *ScummEngine::getOBIMFromObjectData(const ObjectData &od) { @@ -1330,15 +1330,15 @@ const byte *ScummEngine::getObjectImage(const byte *ptr, int state) { // we use the offsets in the OFFS chunk, ptr = findResource(MKTAG('I','M','A','G'), ptr); if (!ptr) - return 0; + return nullptr; ptr = findResource(MKTAG('W','R','A','P'), ptr); if (!ptr) - return 0; + return nullptr; ptr = findResource(MKTAG('O','F','F','S'), ptr); if (!ptr) - return 0; + return nullptr; // Get the address of the specified SMAP (corresponding to IMxx) ptr += READ_LE_UINT32(ptr + 4 + 4*state); @@ -1479,7 +1479,7 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, ResourceIterator obcds(searchptr, (_game.features & GF_SMALL_HEADER) != 0); for (i = 0; i < numobj; i++) { obcdptr = obcds.findNext(MKTAG('O','B','C','D')); - if (obcdptr == NULL) + if (obcdptr == nullptr) error("findObjectInRoom: Not enough code blocks in room %d", room); cdhd = (const CodeHeader *)findResourceData(MKTAG('C','D','H','D'), obcdptr); @@ -1507,7 +1507,7 @@ void ScummEngine::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, ResourceIterator obims(roomptr, (_game.features & GF_SMALL_HEADER) != 0); for (i = 0; i < numobj; i++) { obimptr = obims.findNext(MKTAG('O','B','I','M')); - if (obimptr == NULL) + if (obimptr == nullptr) error("findObjectInRoom: Not enough image blocks in room %d", room); obim_id = getObjectIdFromOBIM(obimptr); @@ -1767,7 +1767,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { bdd.scale_x = (byte)eo->scaleX; bdd.scale_y = (byte)eo->scaleY; - bdd.maskPtr = NULL; + bdd.maskPtr = nullptr; bdd.numStrips = _gdi->_numStrips; if ((bdd.scale_x != 255) || (bdd.scale_y != 255)) { @@ -1777,7 +1777,7 @@ void ScummEngine_v6::drawBlastObject(BlastObject *eo) { } bdd.shadowPalette = _shadowPalette; - bdd.actorPalette = 0; + bdd.actorPalette = nullptr; bdd.mirror = false; drawBomp(bdd); @@ -1839,7 +1839,7 @@ int ScummEngine::findLocalObjectSlot() { int ScummEngine::findFlObjectSlot() { int i; for (i = 1; i < _numFlObject; i++) { - if (_res->_types[rtFlObject][i]._address == NULL) + if (_res->_types[rtFlObject][i]._address == nullptr) return i; } error("findFlObjectSlot: Out of FLObject slots"); diff --git a/engines/scumm/palette.cpp b/engines/scumm/palette.cpp index 084f0c0c93a..03570825791 100644 --- a/engines/scumm/palette.cpp +++ b/engines/scumm/palette.cpp @@ -47,7 +47,7 @@ uint8 *ScummEngine::getHEPaletteSlot(uint16 palSlot) { return _hePalettes + _hePaletteSlot + 768; } - return NULL; + return nullptr; } uint16 ScummEngine::get16BitColor(uint8 r, uint8 g, uint8 b) { @@ -1346,16 +1346,16 @@ const byte *ScummEngine::findPalInPals(const byte *pal, int idx) { uint32 size; pal = findResource(MKTAG('W','R','A','P'), pal); - if (pal == NULL) - return NULL; + if (pal == nullptr) + return nullptr; offs = findResourceData(MKTAG('O','F','F','S'), pal); - if (offs == NULL) - return NULL; + if (offs == nullptr) + return nullptr; size = getResourceDataSize(offs) / 4; if ((uint32)idx >= (uint32)size) - return NULL; + return nullptr; return offs + READ_LE_UINT32(offs + idx * sizeof(uint32)); } diff --git a/engines/scumm/players/player_ad.cpp b/engines/scumm/players/player_ad.cpp index f0ee921fd83..70b0e504046 100644 --- a/engines/scumm/players/player_ad.cpp +++ b/engines/scumm/players/player_ad.cpp @@ -79,7 +79,7 @@ Player_AD::~Player_AD() { stopAllSounds(); Common::StackLock lock(_mutex); delete _opl2; - _opl2 = 0; + _opl2 = nullptr; } void Player_AD::setMusicVolume(int vol) { @@ -195,7 +195,7 @@ void Player_AD::saveLoadWithSerializer(Common::Serializer &s) { Common::StackLock lock(_mutex); if (s.getVersion() < VER(95)) { - IMuse *dummyImuse = IMuse::create(_vm->_system, NULL, NULL); + IMuse *dummyImuse = IMuse::create(_vm->_system, nullptr, nullptr); dummyImuse->saveLoadIMuse(s, _vm, false); delete dummyImuse; return; diff --git a/engines/scumm/players/player_apple2.cpp b/engines/scumm/players/player_apple2.cpp index 91cdebba183..11a93dee458 100644 --- a/engines/scumm/players/player_apple2.cpp +++ b/engines/scumm/players/player_apple2.cpp @@ -355,7 +355,7 @@ const byte AppleII_SoundFunction5_Noise::_noiseTable[256] = { ************************************/ Player_AppleII::Player_AppleII(ScummEngine *scumm, Audio::Mixer *mixer) - : _mixer(mixer), _vm(scumm), _soundFunc(0) { + : _mixer(mixer), _vm(scumm), _soundFunc(nullptr) { resetState(); setSampleRate(_mixer->getOutputRate()); _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); @@ -370,10 +370,10 @@ void Player_AppleII::resetState() { _soundNr = 0; _type = 0; _loop = 0; - _params = NULL; + _params = nullptr; _speakerState = 0; delete _soundFunc; - _soundFunc = 0; + _soundFunc = nullptr; _sampleConverter.reset(); } @@ -428,7 +428,7 @@ bool Player_AppleII::updateSound() { --_loop; if (_loop <= 0) { delete _soundFunc; - _soundFunc = 0; + _soundFunc = nullptr; } else { // reset function state on each loop _soundFunc->init(this, _params); diff --git a/engines/scumm/players/player_mac.cpp b/engines/scumm/players/player_mac.cpp index b9c92794719..8906e3262e0 100644 --- a/engines/scumm/players/player_mac.cpp +++ b/engines/scumm/players/player_mac.cpp @@ -30,7 +30,7 @@ namespace Scumm { Player_Mac::Player_Mac(ScummEngine *scumm, Audio::Mixer *mixer, int numberOfChannels, int channelMask, bool fadeNoteEnds) : _vm(scumm), - _channel(NULL), + _channel(nullptr), _mixer(mixer), _sampleRate(_mixer->getOutputRate()), _soundPlaying(-1), @@ -48,13 +48,13 @@ void Player_Mac::init(const Common::String &instrumentFile) { for (int i = 0; i < _numberOfChannels; i++) { _channel[i]._looped = false; _channel[i]._length = 0; - _channel[i]._data = NULL; + _channel[i]._data = nullptr; _channel[i]._pos = 0; _channel[i]._pitchModifier = 0; _channel[i]._velocity = 0; _channel[i]._remaining = 0; _channel[i]._notesLeft = false; - _channel[i]._instrument._data = NULL; + _channel[i]._instrument._data = nullptr; _channel[i]._instrument._size = 0; _channel[i]._instrument._rate = 0; _channel[i]._instrument._loopStart = 0; @@ -112,7 +112,7 @@ void Player_Mac::saveLoadWithSerializer(Common::Serializer &s) { Common::StackLock lock(_mutex); if (s.getVersion() < VER(94)) { if (_vm->_game.id == GID_MONKEY && s.isLoading()) { - IMuse *dummyImuse = IMuse::create(_vm->_system, NULL, NULL); + IMuse *dummyImuse = IMuse::create(_vm->_system, nullptr, nullptr); dummyImuse->saveLoadIMuse(s, _vm, false); delete dummyImuse; } @@ -162,7 +162,7 @@ void Player_Mac::stopAllSounds_Internal() { // The channel data is managed by the resource manager, so // don't delete that. delete[] _channel[i]._instrument._data; - _channel[i]._instrument._data = NULL; + _channel[i]._instrument._data = nullptr; _channel[i]._remaining = 0; _channel[i]._notesLeft = false; diff --git a/engines/scumm/players/player_mod.cpp b/engines/scumm/players/player_mod.cpp index d780df94a55..0c8f05c8d2c 100644 --- a/engines/scumm/players/player_mod.cpp +++ b/engines/scumm/players/player_mod.cpp @@ -38,13 +38,13 @@ Player_MOD::Player_MOD(Audio::Mixer *mixer) _channels[i].id = 0; _channels[i].vol = 0; _channels[i].freq = 0; - _channels[i].input = NULL; + _channels[i].input = nullptr; _channels[i].ctr = 0; _channels[i].pos = 0; } - _playproc = NULL; - _playparam = NULL; + _playproc = nullptr; + _playparam = nullptr; _mixer->playStream(Audio::Mixer::kPlainSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); } @@ -70,8 +70,8 @@ void Player_MOD::setUpdateProc(ModUpdateProc *proc, void *param, int freq) { } void Player_MOD::clearUpdateProc() { Common::StackLock lock(_mutex); - _playproc = NULL; - _playparam = NULL; + _playproc = nullptr; + _playparam = nullptr; _mixamt = 0; } @@ -114,7 +114,7 @@ void Player_MOD::stopChannel(int id) { for (int i = 0; i < MOD_MAXCHANS; i++) { if (_channels[i].id == id) { delete _channels[i].input; - _channels[i].input = NULL; + _channels[i].input = nullptr; _channels[i].id = 0; _channels[i].vol = 0; _channels[i].freq = 0; diff --git a/engines/scumm/players/player_nes.cpp b/engines/scumm/players/player_nes.cpp index 02b999dc7c7..a929da9cc36 100644 --- a/engines/scumm/players/player_nes.cpp +++ b/engines/scumm/players/player_nes.cpp @@ -611,7 +611,7 @@ Player_NES::Player_NES(ScummEngine *scumm, Audio::Mixer *mixer) { _slot[i].framesleft = 0; _slot[i].type = 0; _slot[i].offset = 0; - _slot[i].data = NULL; + _slot[i].data = nullptr; } for (i = 0; i < NUMCHANS; i++) { @@ -625,7 +625,7 @@ Player_NES::Player_NES(ScummEngine *scumm, Audio::Mixer *mixer) { } isSFXplaying = wasSFXplaying = false; - auxData1 = auxData2 = NULL; + auxData1 = auxData2 = nullptr; numNotes = 0; APU_writeControl(0); diff --git a/engines/scumm/players/player_pce.cpp b/engines/scumm/players/player_pce.cpp index 8efa3c6510c..941044513af 100644 --- a/engines/scumm/players/player_pce.cpp +++ b/engines/scumm/players/player_pce.cpp @@ -448,7 +448,7 @@ void Player_PCE::setupWaveform(byte bank) { // A541 void Player_PCE::procA541(channel_t *channel) { - channel->soundDataPtr = NULL; + channel->soundDataPtr = nullptr; channel->controlVecShort10 = 0; channel->controlVecShort03 = 0; diff --git a/engines/scumm/players/player_sid.cpp b/engines/scumm/players/player_sid.cpp index c7be1124495..ce82396a2e4 100644 --- a/engines/scumm/players/player_sid.cpp +++ b/engines/scumm/players/player_sid.cpp @@ -193,7 +193,7 @@ void Player_SID::handleMusicBuffer() { // $33cd int Player_SID::setupSongFileData() { // $36cb // no song playing // TODO: remove (never NULL) - if (_music == NULL) { + if (_music == nullptr) { for (int i = 2; i >= 0; --i) { if (songChannelBits & BITMASK[i]) { func_3674(i); @@ -334,7 +334,7 @@ void Player_SID::processSongData(int channel) { // $4939 //vec5[channel] = songFileOrChanBufData; // not used - if (songFileOrChanBufData == NULL) { // chanBuf (4C1C) + if (songFileOrChanBufData == nullptr) { // chanBuf (4C1C) /* // TODO: do we need this? LOBYTE_(vec20[channel]) = 0; @@ -569,7 +569,7 @@ int Player_SID::setupSongPtr(int channel) { // $4C1C int resID = channelMap[channel]; // TODO: when does this happen, only if resID == 0? - if (getResource(resID) == NULL) { + if (getResource(resID) == nullptr) { releaseResourceUnk(resID); if (resID == bgSoundResID) { bgSoundResID = 0; @@ -776,17 +776,17 @@ void Player_SID::resetSwapVars() { // $52d0 swapSustain[i] = 0; } for (int i = 0; i < 3; ++i) { - swapVec5[i] = 0; + swapVec5[i] = nullptr; swapSongPrio[i] = 0; swapVec479C[i] = 0; swapVec19[i] = 0; swapSongPosUpdateCounter[i] = 0; swapWaveCtrlReg[i] = 0; - swapSongPosPtr[i] = 0; + swapSongPosPtr[i] = nullptr; swapFreqReg[i] = 0; swapVec11[i] = 0; swapVec10[i] = 0; - swapVec20[i] = 0; + swapVec20[i] = nullptr; swapVec8[i] = 0; } } @@ -886,7 +886,7 @@ void Player_SID::initMusic(int songResIndex) { // $7de6 resID_song = songResIndex; _music = getResource(resID_song); - if (_music == NULL) { + if (_music == nullptr) { return; } @@ -1022,7 +1022,7 @@ int Player_SID::initSound(int soundResID) { // $4D0A } uint8 *songFilePtr = getResource(soundResID); - if (songFilePtr == NULL) { + if (songFilePtr == nullptr) { initializing = false; return 1; } @@ -1155,9 +1155,9 @@ Player_SID::Player_SID(ScummEngine *scumm, Audio::Mixer *mixer) { minChanPrio = 0; minChanPrioIndex = 0; - _music = NULL; - songFileOrChanBufData = NULL; - actSongFileData = NULL; + _music = nullptr; + songFileOrChanBufData = nullptr; + actSongFileData = nullptr; initializing = false; _soundInQueue = false; @@ -1271,7 +1271,7 @@ Player_SID::~Player_SID() { uint8 *Player_SID::getResource(int resID) { switch (resID) { case 0: - return NULL; + return nullptr; case 3: case 4: case 5: diff --git a/engines/scumm/players/player_towns.cpp b/engines/scumm/players/player_towns.cpp index e3d0b29d8fe..bf01beaa4f3 100644 --- a/engines/scumm/players/player_towns.cpp +++ b/engines/scumm/players/player_towns.cpp @@ -26,7 +26,7 @@ namespace Scumm { -Player_Towns::Player_Towns(ScummEngine *vm, bool isVersion2) : _vm(vm), _v2(isVersion2), _intf(0), _numSoundMax(isVersion2 ? 256 : 200), _unkFlags(0x33) { +Player_Towns::Player_Towns(ScummEngine *vm, bool isVersion2) : _vm(vm), _v2(isVersion2), _intf(nullptr), _numSoundMax(isVersion2 ? 256 : 200), _unkFlags(0x33) { memset(_pcmCurrentSound, 0, sizeof(_pcmCurrentSound)); } @@ -188,7 +188,7 @@ int Player_Towns::allocatePcmChannel(int sound, int sfxChanRelIndex, uint32 prio } Player_Towns_v1::Player_Towns_v1(ScummEngine *vm, Audio::Mixer *mixer) : Player_Towns(vm, false) { - _soundOverride = 0; + _soundOverride = nullptr; _cdaCurrentSound = _eupCurrentSound = _cdaNumLoops = 0; _cdaForceRestart = 0; _cdaVolLeft = _cdaVolRight = 0; @@ -201,7 +201,7 @@ Player_Towns_v1::Player_Towns_v1(ScummEngine *vm, Audio::Mixer *mixer) : Player_ } _player = new EuphonyPlayer(mixer); - _intf = new TownsAudioInterface(mixer, 0); + _intf = new TownsAudioInterface(mixer, nullptr); } Player_Towns_v1::~Player_Towns_v1() { @@ -582,14 +582,14 @@ void Player_Towns_v1::playCdaTrack(int sound, const uint8 *data, bool skipTrackV _cdaCurrentSound = sound; } -Player_Towns_v2::Player_Towns_v2(ScummEngine *vm, Audio::Mixer *mixer, IMuse *imuse, bool disposeIMuse) : Player_Towns(vm, true), _imuse(imuse), _imuseDispose(disposeIMuse), _sblData(0) { +Player_Towns_v2::Player_Towns_v2(ScummEngine *vm, Audio::Mixer *mixer, IMuse *imuse, bool disposeIMuse) : Player_Towns(vm, true), _imuse(imuse), _imuseDispose(disposeIMuse), _sblData(nullptr) { _soundOverride = new SoundOvrParameters[_numSoundMax](); - _intf = new TownsAudioInterface(mixer, 0, true); + _intf = new TownsAudioInterface(mixer, nullptr, true); } Player_Towns_v2::~Player_Towns_v2() { delete _intf; - _intf = 0; + _intf = nullptr; if (_imuseDispose) delete _imuse; @@ -658,7 +658,7 @@ void Player_Towns_v2::stopAllSounds() { int32 Player_Towns_v2::doCommand(int numargs, int args[]) { int32 res = -1; - uint8 *ptr = 0; + uint8 *ptr = nullptr; switch (args[0]) { case 8: diff --git a/engines/scumm/players/player_v1.cpp b/engines/scumm/players/player_v1.cpp index 7c9ce0b614a..41b3d2ff813 100644 --- a/engines/scumm/players/player_v1.cpp +++ b/engines/scumm/players/player_v1.cpp @@ -40,7 +40,7 @@ Player_V1::Player_V1(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr) clear_channel(i); _mplex_step = (_sampleRate << FIXP_SHIFT) / 1193000; - _next_chunk = _repeat_chunk = 0; + _next_chunk = _repeat_chunk = nullptr; _forced_level = 0; _random_lsr = 0; } @@ -93,9 +93,9 @@ void Player_V1::stopAllSounds() { for (int i = 0; i < 4; i++) clear_channel(i); - _repeat_chunk = _next_chunk = 0; + _repeat_chunk = _next_chunk = nullptr; _next_nr = _current_nr = 0; - _next_data = _current_data = 0; + _next_data = _current_data = nullptr; } void Player_V1::stopSound(int nr) { @@ -103,15 +103,15 @@ void Player_V1::stopSound(int nr) { if (_next_nr == nr) { _next_nr = 0; - _next_data = 0; + _next_data = nullptr; } if (_current_nr == nr) { for (int i = 0; i < 4; i++) { clear_channel(i); } - _repeat_chunk = _next_chunk = 0; + _repeat_chunk = _next_chunk = nullptr; _current_nr = 0; - _current_data = 0; + _current_data = nullptr; chainNextSound(); } } @@ -139,9 +139,9 @@ void Player_V1::parseSpeakerChunk() { switch (_chunk_type) { case 0xffff: _current_nr = 0; - _current_data = 0; + _current_data = nullptr; _channels[0].freq = 0; - _next_chunk = 0; + _next_chunk = nullptr; chainNextSound(); break; case 0xfffe: @@ -279,8 +279,8 @@ parse_again: for (i = 0; i < 4; ++i) clear_channel(i); _current_nr = 0; - _current_data = 0; - _repeat_chunk = _next_chunk = 0; + _current_data = nullptr; + _repeat_chunk = _next_chunk = nullptr; chainNextSound(); break; @@ -303,7 +303,7 @@ parse_again: tmp = READ_LE_UINT16(_next_chunk); _next_chunk += 2; if (tmp == 0xffff) { - _channels[i].cmd_ptr = 0; + _channels[i].cmd_ptr = nullptr; continue; } _channels[i].attack = READ_LE_UINT16(_current_data + tmp); @@ -320,7 +320,7 @@ parse_again: case 1: set_mplex(READ_LE_UINT16(_next_chunk)); tmp = READ_LE_UINT16(_next_chunk + 2); - _channels[0].cmd_ptr = tmp != 0xffff ? _current_data + tmp : NULL; + _channels[0].cmd_ptr = tmp != 0xffff ? _current_data + tmp : nullptr; tmp = READ_LE_UINT16(_next_chunk + 4); _start = READ_LE_UINT16(_next_chunk + 6); _delta = (int16) READ_LE_UINT16(_next_chunk + 8); diff --git a/engines/scumm/players/player_v2.cpp b/engines/scumm/players/player_v2.cpp index b58be8d881c..e9aef177d6f 100644 --- a/engines/scumm/players/player_v2.cpp +++ b/engines/scumm/players/player_v2.cpp @@ -99,7 +99,7 @@ void Player_V2::stopAllSounds() { clear_channel(i); } _next_nr = _current_nr = 0; - _next_data = _current_data = 0; + _next_data = _current_data = nullptr; } void Player_V2::stopSound(int nr) { @@ -107,14 +107,14 @@ void Player_V2::stopSound(int nr) { if (_next_nr == nr) { _next_nr = 0; - _next_data = 0; + _next_data = nullptr; } if (_current_nr == nr) { for (int i = 0; i < 4; i++) { clear_channel(i); } _current_nr = 0; - _current_data = 0; + _current_data = nullptr; chainNextSound(); } } @@ -146,7 +146,7 @@ void Player_V2::startSound(int nr) { if (!_current_nr) { nr = 0; _next_nr = 0; - _next_data = 0; + _next_data = nullptr; } if (nr != _current_nr diff --git a/engines/scumm/players/player_v2a.cpp b/engines/scumm/players/player_v2a.cpp index 80a978409be..8e1336e1200 100644 --- a/engines/scumm/players/player_v2a.cpp +++ b/engines/scumm/players/player_v2a.cpp @@ -54,7 +54,7 @@ static uint32 GetCRC(byte *data, int len) { class V2A_Sound { public: - V2A_Sound() : _id(0), _mod(NULL) { } + V2A_Sound() : _id(0), _mod(nullptr) { } virtual ~V2A_Sound() {} virtual void start(Player_MOD *mod, int id, const byte *data) = 0; virtual bool update() = 0; @@ -79,15 +79,15 @@ public: template class V2A_Sound_Base : public V2A_Sound { public: - V2A_Sound_Base() : _offset(0), _size(0), _data(0) { } - V2A_Sound_Base(uint16 offset, uint16 size) : _offset(offset), _size(size), _data(0) { } + V2A_Sound_Base() : _offset(0), _size(0), _data(nullptr) { } + V2A_Sound_Base(uint16 offset, uint16 size) : _offset(offset), _size(size), _data(nullptr) { } void stop() override { assert(_id); for (int i = 0; i < numChan; i++) _mod->stopChannel(_id | (i << 8)); _id = 0; free(_data); - _data = 0; + _data = nullptr; } protected: const uint16 _offset; @@ -1844,7 +1844,7 @@ static V2A_Sound *findSound(unsigned long crc) { CRCToSound(0x59976529, V2A_Sound_Music(0x088E, 0x092E, 0x048E, 0x05EE, 0x074E, 0x07EE, 0x112E, true)); // Zak 49 CRCToSound(0xED1EED02, V2A_Sound_Music(0x08D0, 0x0950, 0x0440, 0x07E0, 0x08B0, 0x08C0, 0x1350, false)); // Zak 112 CRCToSound(0x5A16C037, V2A_Sound_Music(0x634A, 0x64CA, 0x049A, 0x18FA, 0x398A, 0x511A, 0x6CCA, false)); // Zak 95 - return NULL; + return nullptr; } Player_V2A::Player_V2A(ScummEngine *scumm, Audio::Mixer *mixer) { @@ -1855,7 +1855,7 @@ Player_V2A::Player_V2A(ScummEngine *scumm, Audio::Mixer *mixer) { for (i = 0; i < V2A_MAXSLOTS; i++) { _slot[i].id = 0; - _slot[i].sound = NULL; + _slot[i].sound = nullptr; } _mod = new Player_MOD(mixer); @@ -1890,7 +1890,7 @@ void Player_V2A::stopAllSounds() { continue; _slot[i].sound->stop(); delete _slot[i].sound; - _slot[i].sound = NULL; + _slot[i].sound = nullptr; _slot[i].id = 0; } } @@ -1904,7 +1904,7 @@ void Player_V2A::stopSound(int nr) { return; _slot[i].sound->stop(); delete _slot[i].sound; - _slot[i].sound = NULL; + _slot[i].sound = nullptr; _slot[i].id = 0; } @@ -1914,7 +1914,7 @@ void Player_V2A::startSound(int nr) { assert(data); uint32 crc = GetCRC(data + 0x0A, READ_BE_UINT16(data + 0x08)); V2A_Sound *snd = findSound(crc); - if (snd == NULL) { + if (snd == nullptr) { warning("player_v2a - sound %i not recognized yet (crc %08X)", nr, crc); return; } @@ -1939,7 +1939,7 @@ void Player_V2A::updateSound() { if ((_slot[i].id) && (!_slot[i].sound->update())) { _slot[i].sound->stop(); delete _slot[i].sound; - _slot[i].sound = NULL; + _slot[i].sound = nullptr; _slot[i].id = 0; } } diff --git a/engines/scumm/players/player_v2base.cpp b/engines/scumm/players/player_v2base.cpp index 7aaeafe090b..b991ec46b7c 100644 --- a/engines/scumm/players/player_v2base.cpp +++ b/engines/scumm/players/player_v2base.cpp @@ -329,9 +329,9 @@ Player_V2Base::Player_V2Base(ScummEngine *scumm, Audio::Mixer *mixer, bool pcjr) // Initialize sound queue _current_nr = _next_nr = 0; - _current_data = _next_data = 0; + _current_data = _next_data = nullptr; - _retaddr = 0; + _retaddr = nullptr; // Initialize channel code for (int i = 0; i < 4; ++i) @@ -378,7 +378,7 @@ void Player_V2Base::chainNextSound() { if (_next_nr) { chainSound(_next_nr, _next_data); _next_nr = 0; - _next_data = 0; + _next_data = nullptr; } } @@ -592,7 +592,7 @@ check_stopped: } _current_nr = 0; - _current_data = 0; + _current_data = nullptr; chainNextSound(); } diff --git a/engines/scumm/players/player_v2cms.cpp b/engines/scumm/players/player_v2cms.cpp index d42fe5ed009..57e961e56c6 100644 --- a/engines/scumm/players/player_v2cms.cpp +++ b/engines/scumm/players/player_v2cms.cpp @@ -30,7 +30,7 @@ namespace Scumm { Player_V2CMS::Player_V2CMS(ScummEngine *scumm, Audio::Mixer *mixer) : Player_V2Base(scumm, mixer, true), _cmsVoicesBase(), _cmsVoices(), _cmsChips(), _midiDelay(0), _octaveMask(0), _looping(0), _tempo(0), - _tempoSum(0), _midiData(0), _midiSongBegin(0), _musicTimer(0), + _tempoSum(0), _midiData(nullptr), _midiSongBegin(nullptr), _musicTimer(0), _musicTimerTicks(0), _voiceTimer(0), _loadedMidiSong(0), _outputTableReady(0), _midiChannel(), _midiChannelUse(), _lastMidiCommand(0) { @@ -98,9 +98,9 @@ void Player_V2CMS::stopAllSounds() { clear_channel(i); } _next_nr = _current_nr = 0; - _next_data = _current_data = 0; - _midiData = 0; - _midiSongBegin = 0; + _next_data = _current_data = nullptr; + _midiData = nullptr; + _midiSongBegin = nullptr; _midiDelay = 0; _musicTimer = _musicTimerTicks = 0; offAllChannels(); @@ -111,19 +111,19 @@ void Player_V2CMS::stopSound(int nr) { if (_next_nr == nr) { _next_nr = 0; - _next_data = 0; + _next_data = nullptr; } if (_current_nr == nr) { for (int i = 0; i < 4; i++) { clear_channel(i); } _current_nr = 0; - _current_data = 0; + _current_data = nullptr; chainNextSound(); } if (_loadedMidiSong == nr) { - _midiData = 0; - _midiSongBegin = 0; + _midiData = nullptr; + _midiSongBegin = nullptr; _midiDelay = 0; offAllChannels(); } @@ -160,7 +160,7 @@ void Player_V2CMS::startSound(int nr) { if (!_current_nr) { nr = 0; _next_nr = 0; - _next_data = 0; + _next_data = nullptr; } if (nr != _current_nr @@ -228,7 +228,7 @@ void Player_V2CMS::loadMidiData(byte *data, int sound) { for (int i = 0; i < 8; ++i) { _cmsVoices[i].chanNumber = 0xFF; _cmsVoices[i].curVolume = 0; - _cmsVoices[i].nextVoice = 0; + _cmsVoices[i].nextVoice = nullptr; } _midiDelay = 0; @@ -262,7 +262,7 @@ void Player_V2CMS::processMidiData() { currentData = _midiData = _midiSongBegin; continue; } - _midiData = _midiSongBegin = 0; + _midiData = _midiSongBegin = nullptr; _midiDelay = 0; _loadedMidiSong = 0; offAllChannels(); @@ -350,7 +350,7 @@ void Player_V2CMS::playVoice() { } _octaveMask = 0xF0; - Voice2 *voice = 0; + Voice2 *voice = nullptr; for (int i = 0; i < 8; ++i) { voice = &_cmsVoices[i]; _octaveMask = ~_octaveMask; @@ -479,8 +479,8 @@ void Player_V2CMS::offAllChannels() { } Player_V2CMS::Voice2 *Player_V2CMS::getFreeVoice() { - Voice2 *curVoice = 0; - Voice2 *selected = 0; + Voice2 *curVoice = nullptr; + Voice2 *selected = nullptr; uint8 volume = 0xFF; for (int i = 0; i < 8; ++i) { @@ -569,7 +569,7 @@ Player_V2CMS::Voice2 *Player_V2CMS::getPlayVoice(byte param) { Voice2 *curVoice = _midiChannel[channelNum]; if (curVoice) { - Voice2 *prevVoice = 0; + Voice2 *prevVoice = nullptr; while (true) { if (curVoice->playingNote == param) break; @@ -577,7 +577,7 @@ Player_V2CMS::Voice2 *Player_V2CMS::getPlayVoice(byte param) { prevVoice = curVoice; curVoice = curVoice->nextVoice; if (!curVoice) - return 0; + return nullptr; } if (prevVoice) @@ -593,7 +593,7 @@ void Player_V2CMS::clearNote(byte *&data) { Voice2 *voice = getPlayVoice(*data); if (voice) { voice->chanNumber = 0xFF; - voice->nextVoice = 0; + voice->nextVoice = nullptr; voice->nextProcessState = Voice2::kEnvelopeRelease; } data += 2; diff --git a/engines/scumm/players/player_v3a.cpp b/engines/scumm/players/player_v3a.cpp index e6610a87d3a..f15c7ea78d3 100644 --- a/engines/scumm/players/player_v3a.cpp +++ b/engines/scumm/players/player_v3a.cpp @@ -47,7 +47,7 @@ Player_V3A::Player_V3A(ScummEngine *scumm, Audio::Mixer *mixer) { } _curSong = 0; - _songData = NULL; + _songData = nullptr; _songPtr = 0; _songDelay = 0; @@ -63,7 +63,7 @@ Player_V3A::~Player_V3A() { int i; delete _mod; if (_isinit) { - for (i = 0; _wavetable[i] != NULL; i++) { + for (i = 0; _wavetable[i] != nullptr; i++) { for (int j = 0; j < 6; j++) { free(_wavetable[i]->_idat[j]); free(_wavetable[i]->_ldat[j]); @@ -116,7 +116,7 @@ void Player_V3A::stopAllSounds() { _curSong = 0; _songPtr = 0; _songDelay = 0; - _songData = NULL; + _songData = nullptr; for (i = 0; i < V3A_MAXSFX; i++) { if (_sfx[i].id) _mod->stopChannel(_sfx[i].id | 0x100); @@ -141,7 +141,7 @@ void Player_V3A::stopSound(int nr) { _curSong = 0; _songPtr = 0; _songDelay = 0; - _songData = NULL; + _songData = nullptr; } else { i = getSfxChan(nr); if (i != -1) { @@ -184,13 +184,13 @@ void Player_V3A::startSound(int nr) { if (len) { _wavetable[i]->_idat[j] = (char *)malloc(len); memcpy(_wavetable[i]->_idat[j],ptr + off,len); - } else _wavetable[i]->_idat[j] = NULL; + } else _wavetable[i]->_idat[j] = nullptr; off = READ_BE_UINT16(ptr + offset + 4); _wavetable[i]->_llen[j] = len = READ_BE_UINT16(ptr + offset + 6); if (len) { _wavetable[i]->_ldat[j] = (char *)malloc(len); memcpy(_wavetable[i]->_ldat[j],ptr + off,len); - } else _wavetable[i]->_ldat[j] = NULL; + } else _wavetable[i]->_ldat[j] = nullptr; _wavetable[i]->_oct[j] = READ_BE_UINT16(ptr + offset + 8); offset += 10; } @@ -202,7 +202,7 @@ void Player_V3A::startSound(int nr) { offset += 4; } } - _wavetable[i] = NULL; + _wavetable[i] = nullptr; _isinit = true; } diff --git a/engines/scumm/resource.cpp b/engines/scumm/resource.cpp index 25d8c174a56..90a50b14f9b 100644 --- a/engines/scumm/resource.cpp +++ b/engines/scumm/resource.cpp @@ -291,7 +291,7 @@ void ScummEngine::readIndexFile() { } if (checkTryMedia(_fileHandle)) { - displayMessage(NULL, "You're trying to run game encrypted by ActiveMark. This is not supported."); + displayMessage(nullptr, "You're trying to run game encrypted by ActiveMark. This is not supported."); quitGame(); return; @@ -749,7 +749,7 @@ byte *ScummEngine::getResourceAddress(ResType type, ResId idx) { idx &= ~0x33539000; if (!_res->validateResource("getResourceAddress", type, idx)) - return NULL; + return nullptr; // If the resource is missing, but loadable from the game data files, try to do so. if (!_res->_types[type][idx]._address && _res->_types[type]._mode != kDynamicResTypeMode) { @@ -759,7 +759,7 @@ byte *ScummEngine::getResourceAddress(ResType type, ResId idx) { ptr = (byte *)_res->_types[type][idx]._address; if (!ptr) { debugC(DEBUG_RESOURCE, "getResourceAddress(%s,%d) == NULL", nameOfResType(type), idx); - return NULL; + return nullptr; } _res->setResourceCounter(type, idx, 1); @@ -775,8 +775,8 @@ byte *ScummEngine::getStringAddress(ResId idx) { byte *ScummEngine_v6::getStringAddress(ResId idx) { byte *addr = getResourceAddress(rtString, idx); - if (addr == NULL) - return NULL; + if (addr == nullptr) + return nullptr; // Skip over the ArrayHeader return addr + 6; } @@ -824,7 +824,7 @@ byte *ResourceManager::createResource(ResType type, ResId idx, uint32 size) { debugC(DEBUG_RESOURCE, "_res->createResource(%s,%d,%d)", nameOfResType(type), idx, size); if (!validateResource("allocating", type, idx)) - return NULL; + return nullptr; if (_vm->_game.version <= 2) { // Nuking and reloading a resource can be harmful in some @@ -840,7 +840,7 @@ byte *ResourceManager::createResource(ResType type, ResId idx, uint32 size) { expireResources(size); byte *ptr = new byte[size + SAFETY_AREA](); - if (ptr == NULL) { + if (ptr == nullptr) { error("createResource(%s,%d): Out of memory while allocating %d", nameOfResType(type), idx, size); } @@ -853,7 +853,7 @@ byte *ResourceManager::createResource(ResType type, ResId idx, uint32 size) { } ResourceManager::Resource::Resource() { - _address = 0; + _address = nullptr; _size = 0; _flags = 0; _status = 0; @@ -863,12 +863,12 @@ ResourceManager::Resource::Resource() { ResourceManager::Resource::~Resource() { delete[] _address; - _address = 0; + _address = nullptr; } void ResourceManager::Resource::nuke() { delete[] _address; - _address = 0; + _address = nullptr; _size = 0; _flags = 0; _status &= ~RS_MODIFIED; @@ -910,7 +910,7 @@ bool ResourceManager::validateResource(const char *str, ResType type, ResId idx) void ResourceManager::nukeResource(ResType type, ResId idx) { byte *ptr = _types[type][idx]._address; - if (ptr != NULL) { + if (ptr != nullptr) { debugC(DEBUG_RESOURCE, "nukeResource(%s,%d)", nameOfResType(type), idx); _allocatedSize -= _types[type][idx]._size; _types[type][idx].nuke(); @@ -925,13 +925,13 @@ const byte *ScummEngine::findResourceData(uint32 tag, const byte *ptr) { else ptr = findResource(tag, ptr); - if (ptr == NULL) - return NULL; + if (ptr == nullptr) + return nullptr; return ptr + _resourceHeaderSize; } int ScummEngine::getResourceDataSize(const byte *ptr) const { - if (ptr == NULL) + if (ptr == nullptr) return 0; if (_game.features & GF_OLD_BUNDLE) @@ -1153,7 +1153,7 @@ void ScummEngine::loadPtrToResource(ResType type, ResId idx, const byte *source) bool ResourceManager::isResourceLoaded(ResType type, ResId idx) const { if (!validateResource("isResourceLoaded", type, idx)) return false; - return _types[type][idx]._address != NULL; + return _types[type][idx]._address != nullptr; } void ResourceManager::resourceStats() { @@ -1183,7 +1183,7 @@ void ScummEngine_v5::readMAXS(int blockSize) { // Used to be 50, which wasn't enough for MI2 and FOA. See bugs // #1591, #1600 and #1607. _numNewNames = 150; - _objectRoomTable = NULL; + _objectRoomTable = nullptr; _fileHandle->readUint16LE(); // 50 _numCharsets = _fileHandle->readUint16LE(); // 9 @@ -1280,7 +1280,7 @@ void ScummEngine_v6::readMAXS(int blockSize) { _numGlobalObjects = _fileHandle->readUint16LE(); _numNewNames = 50; - _objectRoomTable = NULL; + _objectRoomTable = nullptr; _numGlobalScripts = 200; if (_game.heversion >= 70) { @@ -1453,18 +1453,18 @@ ResourceIterator::ResourceIterator(const byte *searchin, bool smallHeader) const byte *ResourceIterator::findNext(uint32 tag) { uint32 size = 0; - const byte *result = 0; + const byte *result = nullptr; if (_smallHeader) { uint16 smallTag = newTag2Old(tag); do { if (_pos >= _size) - return 0; + return nullptr; result = _ptr; size = READ_LE_UINT32(result); if ((int32)size <= 0) - return 0; // Avoid endless loop + return nullptr; // Avoid endless loop _pos += size; _ptr += size; @@ -1472,12 +1472,12 @@ const byte *ResourceIterator::findNext(uint32 tag) { } else { do { if (_pos >= _size) - return 0; + return nullptr; result = _ptr; size = READ_BE_UINT32(result + 4); if ((int32)size <= 0) - return 0; // Avoid endless loop + return nullptr; // Avoid endless loop _pos += size; _ptr += size; @@ -1499,7 +1499,7 @@ const byte *ScummEngine::findResource(uint32 tag, const byte *searchin) { curpos = 0; } else { assert(searchin); - return NULL; + return nullptr; } } else { searchin += 4; @@ -1517,14 +1517,14 @@ const byte *ScummEngine::findResource(uint32 tag, const byte *searchin) { size = READ_BE_UINT32(searchin + 4); if ((int32)size <= 0) { error("(%s) Not found in %d... illegal block len %d", tag2str(tag), 0, size); - return NULL; + return nullptr; } curpos += size; searchin += size; } - return NULL; + return nullptr; } const byte *findResourceSmall(uint32 tag, const byte *searchin) { @@ -1533,7 +1533,7 @@ const byte *findResourceSmall(uint32 tag, const byte *searchin) { smallTag = newTag2Old(tag); if (smallTag == 0) - return NULL; + return nullptr; assert(searchin); @@ -1549,14 +1549,14 @@ const byte *findResourceSmall(uint32 tag, const byte *searchin) { if ((int32)size <= 0) { error("(%s) Not found in %d... illegal block len %d", tag2str(tag), 0, size); - return NULL; + return nullptr; } curpos += size; searchin += size; } - return NULL; + return nullptr; } uint16 newTag2Old(uint32 newTag) { diff --git a/engines/scumm/resource_v4.cpp b/engines/scumm/resource_v4.cpp index 49a59275309..7322d6d7e37 100644 --- a/engines/scumm/resource_v4.cpp +++ b/engines/scumm/resource_v4.cpp @@ -181,7 +181,7 @@ void ScummEngine_v4::readMAXS(int blockSize) { _numArray = 50; _numVerbs = 100; _numNewNames = 50; - _objectRoomTable = NULL; + _objectRoomTable = nullptr; _numCharsets = 9; // 9 _numInventory = 80; // 80 _numGlobalScripts = 200; diff --git a/engines/scumm/room.cpp b/engines/scumm/room.cpp index ebc4799825e..159acfe8d3b 100644 --- a/engines/scumm/room.cpp +++ b/engines/scumm/room.cpp @@ -198,7 +198,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { runEntryScript(); if (_game.version >= 1 && _game.version <= 2) { - runScript(5, 0, 0, 0); + runScript(5, 0, 0, nullptr); } else if (_game.version >= 5 && _game.version <= 6) { if (a && !_egoPositioned) { int x, y; @@ -242,7 +242,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) { void ScummEngine::setupRoomSubBlocks() { int i; const byte *ptr; - byte *roomptr, *searchptr, *roomResPtr = 0; + byte *roomptr, *searchptr, *roomResPtr = nullptr; const RoomHeader *rmhd; _ENCD_offs = 0; @@ -323,7 +323,7 @@ void ScummEngine::setupRoomSubBlocks() { if (_game.features & GF_SMALL_HEADER) { ResourceIterator localScriptIterator(searchptr, true); - while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != NULL) { + while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != nullptr) { int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ id = ptr[0]; @@ -338,7 +338,7 @@ void ScummEngine::setupRoomSubBlocks() { } } else if (_game.heversion >= 90) { ResourceIterator localScriptIterator2(searchptr, false); - while ((ptr = localScriptIterator2.findNext(MKTAG('L','S','C','2'))) != NULL) { + while ((ptr = localScriptIterator2.findNext(MKTAG('L','S','C','2'))) != nullptr) { int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ @@ -356,7 +356,7 @@ void ScummEngine::setupRoomSubBlocks() { } ResourceIterator localScriptIterator(searchptr, false); - while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != NULL) { + while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != nullptr) { int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ @@ -373,7 +373,7 @@ void ScummEngine::setupRoomSubBlocks() { } else { ResourceIterator localScriptIterator(searchptr, false); - while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != NULL) { + while ((ptr = localScriptIterator.findNext(MKTAG('L','S','C','R'))) != nullptr) { int id = 0; ptr += _resourceHeaderSize; /* skip tag & size */ diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 8ea688393d5..5ac41ab6761 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -191,7 +191,7 @@ bool ScummEngine::saveState(Common::WriteStream *out, bool writeHeader) { #endif saveInfos(out); - Common::Serializer ser(0, out); + Common::Serializer ser(nullptr, out); ser.setVersion(CURRENT_VER); saveLoadWithSerializer(ser); return true; @@ -230,7 +230,7 @@ void ScummEngine_v4::prepareSavegame() { // free memory of the last prepared savegame delete _savePreparedSavegame; - _savePreparedSavegame = NULL; + _savePreparedSavegame = nullptr; // store headerless savegame in a compressed memory stream memStream = new Common::MemoryWriteStreamDynamic(DisposeAfterUse::NO); @@ -257,7 +257,7 @@ bool ScummEngine_v4::savePreparedSavegame(int slot, char *desc) { SaveGameHeader hdr; uint32 nread, nwritten; - out = 0; + out = nullptr; success = true; // check if savegame was successfully stored in memory @@ -447,7 +447,7 @@ bool ScummEngine::loadState(int slot, bool compat, Common::String &filename) { // // Now do the actual loading // - Common::Serializer ser(in, 0); + Common::Serializer ser(in, nullptr); ser.setVersion(hdr.ver); saveLoadWithSerializer(ser); delete in; @@ -564,7 +564,7 @@ bool ScummEngine::loadState(int slot, bool compat, Common::String &filename) { _macScreen->fillRect(Common::Rect(_macScreen->w, _macScreen->h), 0); clearTextSurface(); - _lastCodePtr = NULL; + _lastCodePtr = nullptr; _drawObjectQueNr = 0; _verbMouseOver = 0; @@ -589,7 +589,7 @@ bool ScummEngine::loadState(int slot, bool compat, Common::String &filename) { // // Fixes bug #3362: MANIACNES: Music Doesn't Start On Load Game if (_game.platform == Common::kPlatformNES) { - runScript(5, 0, 0, 0); + runScript(5, 0, 0, nullptr); if (VAR(224)) { _sound->addSoundToQueue(VAR(224)); @@ -633,7 +633,7 @@ void ScummEngine::listSavegames(bool *marks, int num) { bool getSavegameName(Common::InSaveFile *in, Common::String &desc, int heversion); bool ScummEngine::getSavegameName(int slot, Common::String &desc) { - Common::InSaveFile *in = 0; + Common::InSaveFile *in = nullptr; bool result = false; desc.clear(); diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp index 89d9610914c..bfc774ed1f0 100644 --- a/engines/scumm/script.cpp +++ b/engines/scumm/script.cpp @@ -429,7 +429,7 @@ void ScummEngine::getScriptBaseAddress() { } // The following fixes bug #2028. Confirmed against disasm. - if (_game.version <= 2 && _scriptOrgPointer == NULL) { + if (_game.version <= 2 && _scriptOrgPointer == nullptr) { ss->status = ssDead; _currentScript = 0xFF; } @@ -925,7 +925,7 @@ void ScummEngine::runAllScripts() { void ScummEngine::runExitScript() { if (VAR_EXIT_SCRIPT != 0xFF && VAR(VAR_EXIT_SCRIPT)) - runScript(VAR(VAR_EXIT_SCRIPT), 0, 0, 0); + runScript(VAR(VAR_EXIT_SCRIPT), 0, 0, nullptr); if (_EXCD_offs) { int slot = getScriptSlot(); vm.slot[slot].status = ssRunning; @@ -950,11 +950,11 @@ void ScummEngine::runExitScript() { } } - initializeLocals(slot, 0); + initializeLocals(slot, nullptr); runScriptNested(slot); } if (VAR_EXIT_SCRIPT2 != 0xFF && VAR(VAR_EXIT_SCRIPT2)) - runScript(VAR(VAR_EXIT_SCRIPT2), 0, 0, 0); + runScript(VAR(VAR_EXIT_SCRIPT2), 0, 0, nullptr); #ifdef ENABLE_SCUMM_7_8 // WORKAROUND: The spider lair (room 44) will optionally play the sound @@ -970,7 +970,7 @@ void ScummEngine::runExitScript() { void ScummEngine::runEntryScript() { if (VAR_ENTRY_SCRIPT != 0xFF && VAR(VAR_ENTRY_SCRIPT)) - runScript(VAR(VAR_ENTRY_SCRIPT), 0, 0, 0); + runScript(VAR(VAR_ENTRY_SCRIPT), 0, 0, nullptr); if (_ENCD_offs) { int slot = getScriptSlot(); vm.slot[slot].status = ssRunning; @@ -982,11 +982,11 @@ void ScummEngine::runEntryScript() { vm.slot[slot].freezeCount = 0; vm.slot[slot].delayFrameCount = 0; vm.slot[slot].cycle = 1; - initializeLocals(slot, 0); + initializeLocals(slot, nullptr); runScriptNested(slot); } if (VAR_ENTRY_SCRIPT2 != 0xFF && VAR(VAR_ENTRY_SCRIPT2)) - runScript(VAR(VAR_ENTRY_SCRIPT2), 0, 0, 0); + runScript(VAR(VAR_ENTRY_SCRIPT2), 0, 0, nullptr); } void ScummEngine::runQuitScript() { @@ -1320,7 +1320,7 @@ void ScummEngine_v0::runSentenceScript() { // do not read in the dark if (!(_cmdVerb == kVerbRead && _currentLights == 0)) { VAR(VAR_ACTIVE_OBJECT2) = OBJECT_V0_ID(_cmdObject2); - runObjectScript(_cmdObject, _cmdVerb, false, false, NULL); + runObjectScript(_cmdObject, _cmdVerb, false, false, nullptr); return; } } else { @@ -1336,7 +1336,7 @@ void ScummEngine_v0::runSentenceScript() { if (_cmdVerb != kVerbWalkTo) { // perform verb's fallback action VAR(VAR_ACTIVE_VERB) = _cmdVerb; - runScript(3, 0, 0, 0); + runScript(3, 0, 0, nullptr); } } @@ -1507,7 +1507,7 @@ void ScummEngine::copyScriptString(byte *dst) { int ScummEngine::resStrLen(const byte *src) { int num = 0; byte chr; - if (src == NULL) { + if (src == nullptr) { refreshScriptPointer(); src = _scriptPointer; } diff --git a/engines/scumm/script_v0.cpp b/engines/scumm/script_v0.cpp index 9e6dba18aea..92006c9e063 100644 --- a/engines/scumm/script_v0.cpp +++ b/engines/scumm/script_v0.cpp @@ -961,7 +961,7 @@ void ScummEngine_v0::o_endCutscene() { setMode(vm.cutSceneData[0]); if (_currentMode == kModeKeypad) { - startScene(vm.cutSceneData[2], 0, 0); + startScene(vm.cutSceneData[2], nullptr, 0); // in contrast to the normal keypad behavior we unfreeze scripts here unfreezeScripts(); } else { diff --git a/engines/scumm/script_v2.cpp b/engines/scumm/script_v2.cpp index ac85f83c549..c8bfb1ebe0e 100644 --- a/engines/scumm/script_v2.cpp +++ b/engines/scumm/script_v2.cpp @@ -684,7 +684,7 @@ void ScummEngine_v2::o2_actorOps() { a->setPalette(i, arg); break; case 3: // SO_ACTOR_NAME - loadPtrToResource(rtActorName, a->_number, NULL); + loadPtrToResource(rtActorName, a->_number, nullptr); break; case 4: // SO_COSTUME a->setActorCostume(arg); @@ -856,7 +856,7 @@ void ScummEngine_v2::o2_verbOps() { } // It follows the verb name - loadPtrToResource(rtVerb, slot, NULL); + loadPtrToResource(rtVerb, slot, nullptr); } break; } @@ -939,7 +939,7 @@ void ScummEngine_v2::o2_doSentence() { } } - runObjectScript(st->objectA, st->verb, isBackgroundScript, isSpecialVerb, NULL, slot); + runObjectScript(st->objectA, st->verb, isBackgroundScript, isSpecialVerb, nullptr, slot); } break; case 2: @@ -1098,7 +1098,7 @@ void ScummEngine_v2::o2_ifClassOfIs() { byte *obcd = getOBCDFromObject(obj); - if (obcd == 0) { + if (obcd == nullptr) { o5_jumpRelative(); return; } @@ -1207,7 +1207,7 @@ void ScummEngine_v2::o2_startScript() { } } - runScript(script, 0, 0, 0); + runScript(script, 0, 0, nullptr); } void ScummEngine_v2::stopScriptCommon(int script) { @@ -1484,7 +1484,7 @@ void ScummEngine_v2::o2_loadRoomWithEgo() { if (x >= 0 && y >= 0) { a->startWalkActor(x, y, -1); } - runScript(5, 0, 0, 0); + runScript(5, 0, 0, nullptr); } void ScummEngine_v2::o2_setOwnerOf() { @@ -1584,7 +1584,7 @@ void ScummEngine_v2::o2_endCutscene() { if (camera._mode == kFollowActorCameraMode) { actorFollowCamera(VAR(VAR_EGO)); } else if (vm.cutSceneData[2] != _currentRoom) { - startScene(vm.cutSceneData[2], 0, 0); + startScene(vm.cutSceneData[2], nullptr, 0); } } else { actorFollowCamera(VAR(VAR_EGO)); @@ -1604,7 +1604,7 @@ void ScummEngine_v2::o2_chainScript() { int script = getVarOrDirectByte(PARAM_1); stopScript(vm.slot[_currentScript].number); _currentScript = 0xFF; - runScript(script, 0, 0, 0); + runScript(script, 0, 0, nullptr); } void ScummEngine_v2::o2_pickupObject() { diff --git a/engines/scumm/script_v4.cpp b/engines/scumm/script_v4.cpp index 3c482996fc2..42423650cf4 100644 --- a/engines/scumm/script_v4.cpp +++ b/engines/scumm/script_v4.cpp @@ -59,9 +59,9 @@ void ScummEngine_v4::setupOpcodes() { OPCODE(0xa2, o4_saveLoadGame); // Disable some opcodes which are unused in v4. - _opcodes[0x3b].setProc(0, 0); - _opcodes[0x4c].setProc(0, 0); - _opcodes[0xbb].setProc(0, 0); + _opcodes[0x3b].setProc(nullptr, nullptr); + _opcodes[0x4c].setProc(nullptr, nullptr); + _opcodes[0xbb].setProc(nullptr, nullptr); } void ScummEngine_v4::o4_ifState() { @@ -337,7 +337,7 @@ void ScummEngine_v4::saveIQPoints() { Common::String filename = _targetName + ".iq"; file = _saveFileMan->openForSaving(filename); - if (file != NULL) { + if (file != nullptr) { byte *ptr = getResourceAddress(rtString, STRINGID_IQ_EPISODE); if (ptr) { int size = getResourceSize(rtString, STRINGID_IQ_EPISODE); @@ -353,7 +353,7 @@ void ScummEngine_v4::loadIQPoints(byte *ptr, int size) { Common::String filename = _targetName + ".iq"; file = _saveFileMan->openForLoading(filename); - if (file != NULL) { + if (file != nullptr) { byte *tmp = (byte *)malloc(size); int nread = file->read(tmp, size); if (nread == size) { diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index ed3fc7e913c..59c2d2f547d 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -526,7 +526,7 @@ void ScummEngine_v5::o5_actorOps() { a->_talkColor = getVarOrDirectByte(PARAM_1); break; case 13: // SO_ACTOR_NAME - loadPtrToResource(rtActorName, a->_number, NULL); + loadPtrToResource(rtActorName, a->_number, nullptr); break; case 14: // SO_INIT_ANIMATION a->_initFrame = getVarOrDirectByte(PARAM_1); @@ -1397,7 +1397,7 @@ void ScummEngine_v5::o5_loadRoom() { // actually changed. This avoid unwanted (wrong) fades in Zak256 // and others. OTOH, it seems to cause a problem in newer games. if (!(_game.features & GF_SMALL_HEADER) || room != _currentRoom) - startScene(room, 0, 0); + startScene(room, nullptr, 0); _fullRedraw = true; } @@ -1979,7 +1979,7 @@ void ScummEngine_v5::o5_roomOps() { } Common::OutSaveFile *file = _saveFileMan->openForSaving(filename); - if (file != NULL) { + if (file != nullptr) { byte *ptr; ptr = getResourceAddress(rtString, a); file->write(ptr, resStrLen(ptr) + 1); @@ -2008,7 +2008,7 @@ void ScummEngine_v5::o5_roomOps() { } Common::InSaveFile *file = _saveFileMan->openForLoading(filename); - if (file != NULL) { + if (file != nullptr) { byte *ptr; const int len = file->size(); ptr = (byte *)malloc(len + 1); @@ -2354,7 +2354,7 @@ void ScummEngine_v5::o5_stringOps() { _opcode = fetchScriptByte(); switch (_opcode & 0x1F) { case 1: /* loadstring */ - loadPtrToResource(rtString, getVarOrDirectByte(PARAM_1), NULL); + loadPtrToResource(rtString, getVarOrDirectByte(PARAM_1), nullptr); break; case 2: /* copystring */ @@ -2372,7 +2372,7 @@ void ScummEngine_v5::o5_stringOps() { b = getVarOrDirectByte(PARAM_2); c = getVarOrDirectByte(PARAM_3); ptr = getResourceAddress(rtString, a); - if (ptr == NULL) + if (ptr == nullptr) error("String %d does not exist", a); ptr[b] = c; break; @@ -2382,7 +2382,7 @@ void ScummEngine_v5::o5_stringOps() { a = getVarOrDirectByte(PARAM_1); b = getVarOrDirectByte(PARAM_2); ptr = getResourceAddress(rtString, a); - if (ptr == NULL) + if (ptr == nullptr) error("String %d does not exist", a); setResult(ptr[b]); break; @@ -2436,7 +2436,7 @@ void ScummEngine_v5::o5_verbOps() { } break; case 2: // SO_VERB_NAME - loadPtrToResource(rtVerb, slot, NULL); + loadPtrToResource(rtVerb, slot, nullptr); if (slot == 0) _res->nukeResource(rtVerb, slot); vs->type = kTextVerbType; diff --git a/engines/scumm/script_v6.cpp b/engines/scumm/script_v6.cpp index 57d2db4ef7e..3a04f8e66fb 100644 --- a/engines/scumm/script_v6.cpp +++ b/engines/scumm/script_v6.cpp @@ -373,7 +373,7 @@ int ScummEngine_v6::findFreeArrayId() { ScummEngine_v6::ArrayHeader *ScummEngine_v6::getArray(int array) { ArrayHeader *ah = (ArrayHeader *)getResourceAddress(rtString, readVar(array)); if (!ah) - return 0; + return nullptr; if (_game.heversion == 0) { // Workaround for a long standing bug where we saved array headers in native @@ -1116,7 +1116,7 @@ void ScummEngine_v6::o6_setCameraAt() { void ScummEngine_v6::o6_loadRoom() { int room = pop(); - startScene(room, 0, 0); + startScene(room, nullptr, 0); if (_game.heversion >= 61) { setCameraAt(camera._cur.x, 0); } @@ -1152,7 +1152,7 @@ void ScummEngine_v6::o6_walkActorToObj() { a->startWalkActor(x, y, dir); } else { a2 = derefActorSafe(obj, "o6_walkActorToObj(2)"); - if (_game.id == GID_SAMNMAX && a2 == 0) { + if (_game.id == GID_SAMNMAX && a2 == nullptr) { // WORKAROUND bug #801 SAM: Fish Farm. Note quite sure why it // happens, whether it's normal or due to a bug in the ScummVM code. debug(0, "o6_walkActorToObj: invalid actor %d", obj); @@ -1828,7 +1828,7 @@ void ScummEngine_v6::o6_actorOps() { a->_talkColor = pop(); break; case 88: // SO_ACTOR_NAME - loadPtrToResource(rtActorName, a->_number, NULL); + loadPtrToResource(rtActorName, a->_number, nullptr); break; case 89: // SO_INIT_ANIMATION a->_initFrame = pop(); @@ -1937,7 +1937,7 @@ void ScummEngine_v6::o6_verbOps() { } break; case 125: // SO_VERB_NAME - loadPtrToResource(rtVerb, slot, NULL); + loadPtrToResource(rtVerb, slot, nullptr); vs->type = kTextVerbType; vs->imgindex = 0; break; @@ -3050,7 +3050,7 @@ void ScummEngine_v6::o6_getPixel() { VirtScreen *vs = findVirtScreen(y); - if (vs == NULL || x > _screenWidth - 1 || x < 0) { + if (vs == nullptr || x > _screenWidth - 1 || x < 0) { push(-1); return; } @@ -3063,7 +3063,7 @@ void ScummEngine_v6::o6_setBoxSet() { int arg = pop() - 1; const byte *room = getResourceAddress(rtRoom, _roomResource); - const byte *boxd = NULL, *boxm = NULL; + const byte *boxd = nullptr, *boxm = nullptr; int32 dboxSize, mboxSize; int i; diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index eefc2498135..4ec04e47863 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -93,7 +93,7 @@ using Common::File; namespace Scumm { // Use g_scumm from error() ONLY -ScummEngine *g_scumm = 0; +ScummEngine *g_scumm = nullptr; struct dbgChannelDesc { @@ -108,7 +108,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _filenamePattern(dr.fp), _language(dr.language), _currentScript(0xFF), // Let debug() work on init stage - _messageDialog(0), _pauseDialog(0), _versionDialog(0), + _messageDialog(nullptr), _pauseDialog(nullptr), _versionDialog(nullptr), _rnd("scumm") { @@ -146,28 +146,28 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _gameMD5[i] = (byte)tmpVal; } - _fileHandle = 0; + _fileHandle = nullptr; // Init all vars - _imuse = NULL; - _imuseDigital = NULL; - _musicEngine = NULL; - _townsPlayer = NULL; - _verbs = NULL; - _objs = NULL; - _sound = NULL; + _imuse = nullptr; + _imuseDigital = nullptr; + _musicEngine = nullptr; + _townsPlayer = nullptr; + _verbs = nullptr; + _objs = nullptr; + _sound = nullptr; memset(&vm, 0, sizeof(vm)); - _pauseDialog = NULL; - _versionDialog = NULL; + _pauseDialog = nullptr; + _versionDialog = nullptr; _fastMode = 0; - _actors = _sortedActors = NULL; - _arraySlot = NULL; - _inventory = NULL; - _newNames = NULL; - _scummVars = NULL; - _roomVars = NULL; + _actors = _sortedActors = nullptr; + _arraySlot = nullptr; + _inventory = nullptr; + _newNames = nullptr; + _scummVars = nullptr; + _roomVars = nullptr; _varwatch = 0; - _bitVars = NULL; + _bitVars = nullptr; _numVariables = 0; _numBitVariables = 0; _numRoomVariables = 0; @@ -200,9 +200,9 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _bootParam = 0; _dumpScripts = false; _debugMode = false; - _objectOwnerTable = NULL; - _objectRoomTable = NULL; - _objectStateTable = NULL; + _objectOwnerTable = nullptr; + _objectRoomTable = nullptr; + _objectStateTable = nullptr; _numObjectsInRoom = 0; _userPut = 0; _userState = 0; @@ -212,11 +212,11 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _lastSaveTime = 0; _saveTemporaryState = false; memset(_localScriptOffsets, 0, sizeof(_localScriptOffsets)); - _scriptPointer = NULL; - _scriptOrgPointer = NULL; + _scriptPointer = nullptr; + _scriptOrgPointer = nullptr; _opcode = 0; vm.numNestedScripts = 0; - _lastCodePtr = NULL; + _lastCodePtr = nullptr; _scummStackPos = 0; memset(_vmStack, 0, sizeof(_vmStack)); _fileOffset = 0; @@ -225,7 +225,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _roomResource = 0; OF_OWNER_ROOM = 0; _verbMouseOver = 0; - _classData = NULL; + _classData = nullptr; _actorToPrintStrFor = 0; _sentenceNum = 0; memset(_sentence, 0, sizeof(_sentence)); @@ -273,16 +273,16 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _palManipStart = 0; _palManipEnd = 0; _palManipCounter = 0; - _palManipPalette = NULL; - _palManipIntermediatePal = NULL; + _palManipPalette = nullptr; + _palManipIntermediatePal = nullptr; memset(gfxUsageBits, 0, sizeof(gfxUsageBits)); - _hePalettes = NULL; + _hePalettes = nullptr; _hePaletteSlot = 0; - _16BitPalette = NULL; - _macScreen = NULL; - _macIndy3TextBox = NULL; + _16BitPalette = nullptr; + _macScreen = nullptr; + _macIndy3TextBox = nullptr; #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE - _townsScreen = 0; + _townsScreen = nullptr; _scrollRequest = _scrollDeltaAdjust = 0; _scrollDestOffset = _scrollTimer = 0; _refreshNeedCatchUp = false; @@ -290,12 +290,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) memset(_refreshDuration, 0, sizeof(_refreshDuration)); _refreshArrayPos = 0; #ifdef USE_RGB_COLOR - _cjkFont = 0; + _cjkFont = nullptr; #endif #endif - _shadowPalette = NULL; + _shadowPalette = nullptr; _shadowPaletteSize = 0; - _verbPalette = NULL; + _verbPalette = nullptr; memset(_currentPalette, 0, sizeof(_currentPalette)); memset(_darkenPalette, 0, sizeof(_darkenPalette)); memset(_HEV7ActorPalette, 0, sizeof(_HEV7ActorPalette)); @@ -308,7 +308,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _saveSound = 0; memset(_extraBoxFlags, 0, sizeof(_extraBoxFlags)); memset(_scaleSlots, 0, sizeof(_scaleSlots)); - _charset = NULL; + _charset = nullptr; _charsetColor = 0; memset(_charsetColorMap, 0, sizeof(_charsetColorMap)); memset(_charsetData, 0, sizeof(_charsetData)); @@ -321,21 +321,21 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) _NES_talkColor = 0; _keepText = false; _msgCount = 0; - _costumeLoader = NULL; - _costumeRenderer = NULL; + _costumeLoader = nullptr; + _costumeRenderer = nullptr; _existLanguageFile = false; - _languageBuffer = 0; + _languageBuffer = nullptr; _numTranslatedLines = 0; - _translatedLines = 0; - _languageLineIndex = 0; - _2byteFontPtr = 0; + _translatedLines = nullptr; + _languageLineIndex = nullptr; + _2byteFontPtr = nullptr; _2byteWidth = 0; _2byteHeight = 0; _2byteShadow = 0; _krStrPost = 0; _V1TalkingActor = 0; for (int i = 0; i < 20; i++) - _2byteMultiFontPtr[i] = NULL; + _2byteMultiFontPtr[i] = nullptr; _NESStartStrip = 0; _skipDrawObject = 0; @@ -617,9 +617,9 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) if (_game.version < 7) _compositeBuf = (byte *)malloc(_screenWidth * _screenHeight * sizeMult); else - _compositeBuf = 0; + _compositeBuf = nullptr; - _herculesBuf = 0; + _herculesBuf = nullptr; if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) { _herculesBuf = (byte *)malloc(kHercWidth * kHercHeight); } @@ -728,7 +728,7 @@ ScummEngine_v5::ScummEngine_v5(OSystem *syst, const DetectorResult &dr) memset(&_flashlight, 0, sizeof(_flashlight)); _flashlight.xStrips = 7; _flashlight.yStrips = 7; - _flashlight.buffer = NULL; + _flashlight.buffer = nullptr; memset(_saveLoadVarsFilename, 0, sizeof(_saveLoadVarsFilename)); @@ -747,7 +747,7 @@ ScummEngine_v3::ScummEngine_v3(OSystem *syst, const DetectorResult &dr) if (!(_game.features & GF_OLD256)) _game.features |= GF_16COLOR; - _savePreparedSavegame = NULL; + _savePreparedSavegame = nullptr; } ScummEngine_v3::~ScummEngine_v3() { @@ -892,9 +892,9 @@ ScummEngine_v70he::ScummEngine_v70he(OSystem *syst, const DetectorResult &dr) else _resExtractor = new Win32ResExtractor(this); - _heV7DiskOffsets = NULL; - _heV7RoomOffsets = NULL; - _heV7RoomIntOffsets = NULL; + _heV7DiskOffsets = nullptr; + _heV7RoomOffsets = nullptr; + _heV7RoomIntOffsets = nullptr; _heSndSoundId = 0; _heSndOffset = 0; @@ -1247,7 +1247,7 @@ Common::Error ScummEngine::init() { // We now have to determine the correct _filenamePattern. To do this // we simply hardcode the possibilities. - const char *p1 = 0, *p2 = 0; + const char *p1 = nullptr, *p2 = nullptr; switch (_game.id) { case GID_INDY4: p1 = "atlantis.%03d"; @@ -1944,7 +1944,7 @@ void ScummEngine_v3::resetScumm() { } delete _savePreparedSavegame; - _savePreparedSavegame = NULL; + _savePreparedSavegame = nullptr; } void ScummEngine_v4::resetScumm() { @@ -2212,8 +2212,8 @@ void ScummEngine::setupMusic(int midi, const Common::String &macInstrumentFile) _musicEngine = new Player_HE(this); #endif } else if (_game.version >= 3 && _game.heversion <= 62) { - MidiDriver *nativeMidiDriver = 0; - MidiDriver *adlibMidiDriver = 0; + MidiDriver *nativeMidiDriver = nullptr; + MidiDriver *adlibMidiDriver = nullptr; bool multi_midi = ConfMan.getBool("multi_midi") && _sound->_musicType != MDT_NONE && _sound->_musicType != MDT_PCSPK && (midi & MDT_ADLIB); bool useOnlyNative = false; @@ -2233,7 +2233,7 @@ void ScummEngine::setupMusic(int midi, const Common::String &macInstrumentFile) nativeMidiDriver = MidiDriver::createMidi(dev); } - if (nativeMidiDriver != NULL && _native_mt32) + if (nativeMidiDriver != nullptr && _native_mt32) nativeMidiDriver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); if (!useOnlyNative) { @@ -2594,7 +2594,7 @@ load_game: scummLoop_handleEffects(); if (VAR_MAIN_SCRIPT != 0xFF && VAR(VAR_MAIN_SCRIPT) != 0) { - runScript(VAR(VAR_MAIN_SCRIPT), 0, 0, 0); + runScript(VAR(VAR_MAIN_SCRIPT), 0, 0, nullptr); } // Handle mouse over effects (for verbs). @@ -2757,7 +2757,7 @@ void ScummEngine_v5::scummLoop_handleSaveLoad() { // update IQ points after loading if (saveLoad == 2) { if (_game.id == GID_INDY4) - runScript(145, 0, 0, 0); + runScript(145, 0, 0, nullptr); } } @@ -2996,7 +2996,7 @@ bool ScummEngine::startManiac() { // While strictly speaking it's too broad, this matchString // ignores the presence or absence of trailing path separators // in either currentPath or path. - if (path.matchString("*maniac*", true, NULL)) { + if (path.matchString("*maniac*", true, nullptr)) { maniacTarget = iter->_key; break; } diff --git a/engines/scumm/smush/channel.cpp b/engines/scumm/smush/channel.cpp index 6d862156261..8104a170a29 100644 --- a/engines/scumm/smush/channel.cpp +++ b/engines/scumm/smush/channel.cpp @@ -29,9 +29,9 @@ namespace Scumm { SmushChannel::SmushChannel(int32 track) : _track(track), - _tbuffer(0), + _tbuffer(nullptr), _tbufferSize(0), - _sbuffer(0), + _sbuffer(nullptr), _sbufferSize(0), _dataSize(-1), _inData(false), @@ -45,9 +45,9 @@ SmushChannel::~SmushChannel() { } void SmushChannel::processBuffer() { - assert(_tbuffer != 0); + assert(_tbuffer != nullptr); assert(_tbufferSize != 0); - assert(_sbuffer == 0); + assert(_sbuffer == nullptr); assert(_sbufferSize == 0); if (_inData) { @@ -67,18 +67,18 @@ void SmushChannel::processBuffer() { memcpy(_tbuffer, _sbuffer + offset, new_size); _tbufferSize = new_size; } else { - _tbuffer = 0; + _tbuffer = nullptr; _tbufferSize = 0; } if (_sbufferSize == 0) { free(_sbuffer); - _sbuffer = 0; + _sbuffer = nullptr; } } else { _sbufferSize = _tbufferSize; _sbuffer = _tbuffer; _tbufferSize = 0; - _tbuffer = 0; + _tbuffer = nullptr; } } else { int32 offset = 0; @@ -92,7 +92,7 @@ void SmushChannel::processBuffer() { error("smush channel failed to allocate memory"); memcpy(_sbuffer, _tbuffer + offset, _sbufferSize); free(_tbuffer); - _tbuffer = 0; + _tbuffer = nullptr; _tbufferSize = 0; } else { if (offset) { diff --git a/engines/scumm/smush/codec37.cpp b/engines/scumm/smush/codec37.cpp index aab70ab8764..82f0044cfc9 100644 --- a/engines/scumm/smush/codec37.cpp +++ b/engines/scumm/smush/codec37.cpp @@ -35,12 +35,12 @@ Codec37Decoder::Codec37Decoder(int width, int height) { _frameSize = _width * _height; _deltaSize = _frameSize * 3 + 0x13600; _deltaBuf = (byte *)calloc(_deltaSize, sizeof(byte)); - if (_deltaBuf == 0) + if (_deltaBuf == nullptr) error("unable to allocate decoder buffer"); _deltaBufs[0] = _deltaBuf + 0x4D80; _deltaBufs[1] = _deltaBuf + 0xE880 + _frameSize; _offsetTable = new int16[255]; - if (_offsetTable == 0) + if (_offsetTable == nullptr) error("unable to allocate decoder offset table"); _curtable = 0; _prevSeqNb = 0; @@ -51,16 +51,16 @@ Codec37Decoder::Codec37Decoder(int width, int height) { Codec37Decoder::~Codec37Decoder() { if (_offsetTable) { delete[] _offsetTable; - _offsetTable = 0; + _offsetTable = nullptr; _tableLastPitch = -1; _tableLastIndex = -1; } if (_deltaBuf) { free(_deltaBuf); _deltaSize = 0; - _deltaBuf = 0; - _deltaBufs[0] = 0; - _deltaBufs[1] = 0; + _deltaBuf = nullptr; + _deltaBufs[0] = nullptr; + _deltaBufs[1] = nullptr; } } diff --git a/engines/scumm/smush/codec47.cpp b/engines/scumm/smush/codec47.cpp index cfd9ad543b2..24282ec3785 100644 --- a/engines/scumm/smush/codec47.cpp +++ b/engines/scumm/smush/codec47.cpp @@ -145,7 +145,7 @@ void Codec47Decoder::makeTablesInterpolation(int param) { int32 b1, b2; int32 value_table47_1_2, value_table47_1_1, value_table47_2_2, value_table47_2_1; int32 tableSmallBig[64], tmp, s; - const int8 *table47_1 = 0, *table47_2 = 0; + const int8 *table47_1 = nullptr, *table47_2 = nullptr; int32 *ptr_small_big; byte *ptr; int i, x, y; @@ -529,7 +529,7 @@ Codec47Decoder::Codec47Decoder(int width, int height) { _height = height; _tableBig = (byte *)malloc(256 * 388); _tableSmall = (byte *)malloc(256 * 128); - if ((_tableBig != NULL) && (_tableSmall != NULL)) { + if ((_tableBig != nullptr) && (_tableSmall != nullptr)) { makeTablesInterpolation(4); makeTablesInterpolation(8); } @@ -545,24 +545,24 @@ Codec47Decoder::Codec47Decoder(int width, int height) { Codec47Decoder::~Codec47Decoder() { if (_tableBig) { free(_tableBig); - _tableBig = NULL; + _tableBig = nullptr; } if (_tableSmall) { free(_tableSmall); - _tableSmall = NULL; + _tableSmall = nullptr; } _lastTableWidth = -1; if (_deltaBuf) { free(_deltaBuf); _deltaSize = 0; - _deltaBuf = NULL; - _deltaBufs[0] = NULL; - _deltaBufs[1] = NULL; + _deltaBuf = nullptr; + _deltaBufs[0] = nullptr; + _deltaBufs[1] = nullptr; } } bool Codec47Decoder::decode(byte *dst, const byte *src) { - if ((_tableBig == NULL) || (_tableSmall == NULL) || (_deltaBuf == NULL)) + if ((_tableBig == nullptr) || (_tableSmall == nullptr) || (_deltaBuf == nullptr)) return false; _offset1 = _deltaBufs[1] - _curBuf; diff --git a/engines/scumm/smush/imuse_channel.cpp b/engines/scumm/smush/imuse_channel.cpp index 24cb03fbfb2..f5c3c119cd7 100644 --- a/engines/scumm/smush/imuse_channel.cpp +++ b/engines/scumm/smush/imuse_channel.cpp @@ -34,7 +34,7 @@ ImuseChannel::ImuseChannel(int32 track) : SmushChannel(track) { } bool ImuseChannel::isTerminated() const { - return (_dataSize <= 0 && _sbuffer == 0); + return (_dataSize <= 0 && _sbuffer == nullptr); } bool ImuseChannel::setParameters(int32 nb, int32 size, int32 flags, int32 unk1, int32) { @@ -149,7 +149,7 @@ void ImuseChannel::decode() { if (remaining_size) { _srbufferSize -= remaining_size; assert(_inData); - if (_tbuffer == 0) { + if (_tbuffer == nullptr) { _tbuffer = (byte *)malloc(remaining_size); memcpy(_tbuffer, _sbuffer + _sbufferSize - remaining_size, remaining_size); _tbufferSize = remaining_size; @@ -223,7 +223,7 @@ byte *ImuseChannel::getSoundData() { assert(_dataSize > 0); _dataSize -= _srbufferSize; - _sbuffer = 0; + _sbuffer = nullptr; _sbufferSize = 0; return tmp; diff --git a/engines/scumm/smush/saud_channel.cpp b/engines/scumm/smush/saud_channel.cpp index 7c41a8734b0..1376f4bcf84 100644 --- a/engines/scumm/smush/saud_channel.cpp +++ b/engines/scumm/smush/saud_channel.cpp @@ -39,7 +39,7 @@ SaudChannel::SaudChannel(int32 track) : SmushChannel(track), } bool SaudChannel::isTerminated() const { - return (_markReached && _dataSize == 0 && _sbuffer == 0); + return (_markReached && _dataSize == 0 && _sbuffer == nullptr); } bool SaudChannel::handleSubTags(int32 &offset) { @@ -148,7 +148,7 @@ bool SaudChannel::appendData(Common::SeekableReadStream &b, int32 size) { _sbufferSize = _tbufferSize; _sbuffer = _tbuffer; _tbufferSize = 0; - _tbuffer = 0; + _tbuffer = nullptr; } else { processBuffer(); } @@ -164,7 +164,7 @@ byte *SaudChannel::getSoundData() { _dataSize -= _sbufferSize; } - _sbuffer = 0; + _sbuffer = nullptr; _sbufferSize = 0; return tmp; diff --git a/engines/scumm/smush/smush_mixer.cpp b/engines/scumm/smush/smush_mixer.cpp index 445186d62bd..26d1d5e293a 100644 --- a/engines/scumm/smush/smush_mixer.cpp +++ b/engines/scumm/smush/smush_mixer.cpp @@ -37,8 +37,8 @@ SmushMixer::SmushMixer(Audio::Mixer *m) : _soundFrequency(22050) { for (int32 i = 0; i < NUM_CHANNELS; i++) { _channels[i].id = -1; - _channels[i].chan = NULL; - _channels[i].stream = NULL; + _channels[i].chan = nullptr; + _channels[i].stream = nullptr; } } @@ -54,7 +54,7 @@ SmushChannel *SmushMixer::findChannel(int32 track) { if (_channels[i].id == track) return _channels[i].chan; } - return NULL; + return nullptr; } void SmushMixer::addChannel(SmushChannel *c) { @@ -69,7 +69,7 @@ void SmushMixer::addChannel(SmushChannel *c) { } for (i = 0; i < NUM_CHANNELS; i++) { - if ((_channels[i].chan == NULL || _channels[i].id == -1) && !_mixer->isSoundHandleActive(_channels[i].handle)) { + if ((_channels[i].chan == nullptr || _channels[i].id == -1) && !_mixer->isSoundHandleActive(_channels[i].handle)) { _channels[i].chan = c; _channels[i].id = track; return; @@ -92,10 +92,10 @@ bool SmushMixer::handleFrame() { if (_channels[i].chan->isTerminated()) { delete _channels[i].chan; _channels[i].id = -1; - _channels[i].chan = NULL; + _channels[i].chan = nullptr; if (_channels[i].stream) { _channels[i].stream->finish(); - _channels[i].stream = 0; + _channels[i].stream = nullptr; } } else { int32 vol, pan; @@ -137,10 +137,10 @@ bool SmushMixer::stop() { if (_channels[i].id != -1) { delete _channels[i].chan; _channels[i].id = -1; - _channels[i].chan = NULL; + _channels[i].chan = nullptr; if (_channels[i].stream) { _channels[i].stream->finish(); - _channels[i].stream = NULL; + _channels[i].stream = nullptr; } } } @@ -156,8 +156,8 @@ bool SmushMixer::flush() { _mixer->stopHandle(_channels[i].handle); delete _channels[i].chan; _channels[i].id = -1; - _channels[i].chan = NULL; - _channels[i].stream = NULL; + _channels[i].chan = nullptr; + _channels[i].stream = nullptr; } } } diff --git a/engines/scumm/sound.cpp b/engines/scumm/sound.cpp index b184bdf90d1..4ef25b70b31 100644 --- a/engines/scumm/sound.cpp +++ b/engines/scumm/sound.cpp @@ -64,7 +64,7 @@ Sound::Sound(ScummEngine *parent, Audio::Mixer *mixer) _soundQue2Pos(0), _sfxFilename(), _sfxFileEncByte(0), - _offsetTable(0), + _offsetTable(nullptr), _numSoundEffects(0), _soundMode(kVOCMode), _talk_sound_a1(0), @@ -238,7 +238,7 @@ void Sound::playSound(int soundID) { memcpy(sound, ptr, size); stream = Audio::makeRawStream(sound, size, rate, Audio::FLAG_UNSIGNED); - _mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID); + _mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, stream, soundID); } // WORKAROUND bug # 1311447 else if (READ_BE_UINT32(ptr) == 0x460e200d) { @@ -261,7 +261,7 @@ void Sound::playSound(int soundID) { sound = (byte *)malloc(size); memcpy(sound, ptr, size); stream = Audio::makeRawStream(sound, size, rate, Audio::FLAG_UNSIGNED); - _mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID); + _mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, stream, soundID); } // Support for sampled sound effects in Monkey Island 1 and 2 else if (_vm->_game.platform != Common::kPlatformFMTowns @@ -336,7 +336,7 @@ void Sound::playSound(int soundID) { sound = (byte *)malloc(size); memcpy(sound, ptr + 6, size); stream = Audio::makeRawStream(sound, size, rate, Audio::FLAG_UNSIGNED); - _mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID); + _mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, stream, soundID); } else if (_vm->_game.platform != Common::kPlatformFMTowns && READ_BE_UINT32(ptr) == MKTAG('S','O','U','N')) { if (_vm->_game.version != 3) @@ -403,7 +403,7 @@ void Sound::playSound(int soundID) { stream = plainStream; } - _mixer->playStream(Audio::Mixer::kSFXSoundType, NULL, stream, soundID, vol, 0); + _mixer->playStream(Audio::Mixer::kSFXSoundType, nullptr, stream, soundID, vol, 0); } else { @@ -566,14 +566,14 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle num = (b - 8) >> 1; } - if (_offsetTable != NULL) { - MP3OffsetTable *result = NULL, key; + if (_offsetTable != nullptr) { + MP3OffsetTable *result = nullptr, key; key.org_offset = offset; result = (MP3OffsetTable *)bsearch(&key, _offsetTable, _numSoundEffects, sizeof(MP3OffsetTable), compareMP3OffsetTable); - if (result == NULL) { + if (result == nullptr) { warning("startTalkSound: did not find sound at offset %d", offset); return; } @@ -632,7 +632,7 @@ void Sound::startTalkSound(uint32 offset, uint32 b, int mode, Audio::SoundHandle } if (!_soundsPaused && _mixer->isReady()) { - Audio::AudioStream *input = NULL; + Audio::AudioStream *input = nullptr; switch (_soundMode) { case kMP3Mode: @@ -941,11 +941,11 @@ void Sound::setupSfxFile() { #ifdef USE_MAD { "so3", kMP3Mode }, #endif - { 0, kVOCMode } + { nullptr, kVOCMode } }; ScummFile file; - _offsetTable = NULL; + _offsetTable = nullptr; _sfxFileEncByte = 0; _sfxFilename.clear(); diff --git a/engines/scumm/string.cpp b/engines/scumm/string.cpp index 00e81119d94..ff3569c457d 100644 --- a/engines/scumm/string.cpp +++ b/engines/scumm/string.cpp @@ -644,7 +644,7 @@ void ScummEngine::CHARSET_1() { return; } - a = NULL; + a = nullptr; if (getTalkingActor() != 0xFF) a = derefActorSafe(getTalkingActor(), "CHARSET_1"); @@ -1107,13 +1107,13 @@ void ScummEngine::drawString(int a, const byte *msg) { if (_game.version >= 4) { // trim from the right byte *tmp = buf; - space = NULL; + space = nullptr; while (*tmp) { if (*tmp == ' ') { if (!space) space = tmp; } else { - space = NULL; + space = nullptr; } tmp++; } @@ -1246,7 +1246,7 @@ int ScummEngine::convertMessageToString(const byte *msg, byte *dst, int dstSize) start = dst; end = dst + dstSize; - if (msg == NULL) { + if (msg == nullptr) { debug(0, "Bad message in convertMessageToString, ignoring"); return 0; } diff --git a/engines/scumm/verbs.cpp b/engines/scumm/verbs.cpp index 8da868c136a..649589c79b5 100644 --- a/engines/scumm/verbs.cpp +++ b/engines/scumm/verbs.cpp @@ -1165,14 +1165,14 @@ void ScummEngine::drawVerbBitmap(int verb, int x, int y) { VerbSlot *vst = &_verbs[verb]; VirtScreen *vs; bool twobufs; - const byte *imptr = 0; + const byte *imptr = nullptr; int ydiff, xstrip; int imgw, imgh; int i, tmp; byte *obim; uint32 size; - if ((vs = findVirtScreen(y)) == NULL) + if ((vs = findVirtScreen(y)) == nullptr) return; _gdi->disableZBuffer();