mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 17:29:11 +00:00
MADE: Use nullptr
Using clang-tidy modernize-use-nullptr
This commit is contained in:
parent
619a6bafe3
commit
6333092801
@ -39,7 +39,7 @@ namespace Made {
|
|||||||
< 0x7FFE object
|
< 0x7FFE object
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Object::Object() : _objData(NULL), _freeData(false) {
|
Object::Object() : _objData(nullptr), _freeData(false) {
|
||||||
_objSize = 0;
|
_objSize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ const char *Object::getString() {
|
|||||||
if (getClass() == 0x7FFF)
|
if (getClass() == 0x7FFF)
|
||||||
return (const char*)getData();
|
return (const char*)getData();
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::setString(const char *str) {
|
void Object::setString(const char *str) {
|
||||||
@ -327,7 +327,7 @@ void GameDatabase::setObjectString(int16 index, const char *str) {
|
|||||||
int16 *GameDatabase::findObjectPropertyCached(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
|
int16 *GameDatabase::findObjectPropertyCached(int16 objectIndex, int16 propertyId, int16 &propertyFlag) {
|
||||||
uint32 id = (objectIndex << 16) | propertyId;
|
uint32 id = (objectIndex << 16) | propertyId;
|
||||||
ObjectPropertyCacheMap::iterator iter = _objectPropertyCache.find(id);
|
ObjectPropertyCacheMap::iterator iter = _objectPropertyCache.find(id);
|
||||||
int16 *propertyPtr = NULL;
|
int16 *propertyPtr = nullptr;
|
||||||
if (iter != _objectPropertyCache.end()) {
|
if (iter != _objectPropertyCache.end()) {
|
||||||
propertyPtr = (*iter)._value;
|
propertyPtr = (*iter)._value;
|
||||||
} else {
|
} else {
|
||||||
@ -386,7 +386,7 @@ void GameDatabase::dumpObject(int16 index) {
|
|||||||
|
|
||||||
/* GameDatabaseV2 */
|
/* GameDatabaseV2 */
|
||||||
|
|
||||||
GameDatabaseV2::GameDatabaseV2(MadeEngine *vm) : GameDatabase(vm), _gameText(NULL) {
|
GameDatabaseV2::GameDatabaseV2(MadeEngine *vm) : GameDatabase(vm), _gameText(nullptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
GameDatabaseV2::~GameDatabaseV2() {
|
GameDatabaseV2::~GameDatabaseV2() {
|
||||||
@ -550,7 +550,7 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
|
|||||||
// Now check in the object hierarchy of the given object
|
// Now check in the object hierarchy of the given object
|
||||||
int16 parentObjectIndex = obj->getClass();
|
int16 parentObjectIndex = obj->getClass();
|
||||||
if (parentObjectIndex == 0) {
|
if (parentObjectIndex == 0) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (parentObjectIndex != 0) {
|
while (parentObjectIndex != 0) {
|
||||||
@ -587,7 +587,7 @@ int16 *GameDatabaseV2::findObjectProperty(int16 objectIndex, int16 propertyId, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug(1, "findObjectProperty(%04X, %04X) Property not found", objectIndex, propertyId);
|
debug(1, "findObjectProperty(%04X, %04X) Property not found", objectIndex, propertyId);
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -783,7 +783,7 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
|
|||||||
// Now check in the object hierarchy of the given object
|
// Now check in the object hierarchy of the given object
|
||||||
int16 parentObjectIndex = obj->getClass();
|
int16 parentObjectIndex = obj->getClass();
|
||||||
if (parentObjectIndex == 0) {
|
if (parentObjectIndex == 0) {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (parentObjectIndex != 0) {
|
while (parentObjectIndex != 0) {
|
||||||
@ -829,13 +829,13 @@ int16 *GameDatabaseV3::findObjectProperty(int16 objectIndex, int16 propertyId, i
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *GameDatabaseV3::getString(uint16 offset) {
|
const char *GameDatabaseV3::getString(uint16 offset) {
|
||||||
// Not used in version 3 games
|
// Not used in version 3 games
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End of namespace Made
|
} // End of namespace Made
|
||||||
|
@ -32,7 +32,7 @@ static const PlainGameDescriptor madeGames[] = {
|
|||||||
{"rtz", "Return to Zork"},
|
{"rtz", "Return to Zork"},
|
||||||
{"lgop2", "Leather Goddesses of Phobos 2"},
|
{"lgop2", "Leather Goddesses of Phobos 2"},
|
||||||
{"rodney", "Rodney's Funscreen"},
|
{"rodney", "Rodney's Funscreen"},
|
||||||
{0, 0}
|
{nullptr, nullptr}
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "made/detection_tables.h"
|
#include "made/detection_tables.h"
|
||||||
|
@ -47,7 +47,7 @@ MadeEngine::MadeEngine(OSystem *syst, const MadeGameDescription *gameDesc) : Eng
|
|||||||
_eventKey = 0;
|
_eventKey = 0;
|
||||||
_autoStopSound = false;
|
_autoStopSound = false;
|
||||||
_soundEnergyIndex = 0;
|
_soundEnergyIndex = 0;
|
||||||
_soundEnergyArray = 0;
|
_soundEnergyArray = nullptr;
|
||||||
_musicBeatStart = 0;
|
_musicBeatStart = 0;
|
||||||
_cdTimeStart = 0;
|
_cdTimeStart = 0;
|
||||||
_introMusicDigital = true;
|
_introMusicDigital = true;
|
||||||
|
@ -38,7 +38,7 @@ namespace Made {
|
|||||||
|
|
||||||
const uint8 MusicPlayer::MT32_GOODBYE_MSG[] = { 0x52, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x54, 0x6F, 0x20, 0x5A, 0x6F, 0x72, 0x6B, 0x20, 0x53, 0x6F, 0x6F, 0x6E, 0x21 };
|
const uint8 MusicPlayer::MT32_GOODBYE_MSG[] = { 0x52, 0x65, 0x74, 0x75, 0x72, 0x6E, 0x20, 0x54, 0x6F, 0x20, 0x5A, 0x6F, 0x72, 0x6B, 0x20, 0x53, 0x6F, 0x6F, 0x6E, 0x21 };
|
||||||
|
|
||||||
MusicPlayer::MusicPlayer(MadeEngine *vm, bool milesAudio) : _vm(vm), _parser(0) {
|
MusicPlayer::MusicPlayer(MadeEngine *vm, bool milesAudio) : _vm(vm), _parser(nullptr) {
|
||||||
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32);
|
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32);
|
||||||
_driverType = MidiDriver::getMusicType(dev);
|
_driverType = MidiDriver::getMusicType(dev);
|
||||||
if (_driverType == MT_GM && ConfMan.getBool("native_mt32"))
|
if (_driverType == MT_GM && ConfMan.getBool("native_mt32"))
|
||||||
@ -90,7 +90,7 @@ MusicPlayer::~MusicPlayer() {
|
|||||||
delete _parser;
|
delete _parser;
|
||||||
}
|
}
|
||||||
if (_driver) {
|
if (_driver) {
|
||||||
_driver->setTimerCallback(0, 0);
|
_driver->setTimerCallback(nullptr, nullptr);
|
||||||
_driver->close();
|
_driver->close();
|
||||||
delete _driver;
|
delete _driver;
|
||||||
}
|
}
|
||||||
@ -112,7 +112,7 @@ void MusicPlayer::playXMIDI(GenericResource *midiResource) {
|
|||||||
if (_parser) {
|
if (_parser) {
|
||||||
_parser->unloadMusic();
|
_parser->unloadMusic();
|
||||||
} else {
|
} else {
|
||||||
_parser = MidiParser::createParser_XMIDI(0, 0, 0);
|
_parser = MidiParser::createParser_XMIDI(nullptr, nullptr, 0);
|
||||||
|
|
||||||
_parser->setMidiDriver(_driver);
|
_parser->setMidiDriver(_driver);
|
||||||
_parser->setTimerRate(_driver->getBaseTempo());
|
_parser->setTimerRate(_driver->getBaseTempo());
|
||||||
|
@ -105,7 +105,7 @@ bool PmvPlayer::play(const char *filename) {
|
|||||||
uint32 soundSize = 0;
|
uint32 soundSize = 0;
|
||||||
uint32 soundChunkOfs = 0, palChunkOfs = 0;
|
uint32 soundChunkOfs = 0, palChunkOfs = 0;
|
||||||
uint32 palSize = 0;
|
uint32 palSize = 0;
|
||||||
byte *frameData = 0, *audioData, *soundData, *palData, *imageData;
|
byte *frameData = nullptr, *audioData, *soundData, *palData, *imageData;
|
||||||
bool firstTime = true;
|
bool firstTime = true;
|
||||||
|
|
||||||
uint32 skipFrames = 0;
|
uint32 skipFrames = 0;
|
||||||
@ -155,7 +155,7 @@ bool PmvPlayer::play(const char *filename) {
|
|||||||
|
|
||||||
soundSize = chunkCount * chunkSize;
|
soundSize = chunkCount * chunkSize;
|
||||||
soundData = (byte *)malloc(soundSize);
|
soundData = (byte *)malloc(soundSize);
|
||||||
decompressSound(audioData + 8, soundData, chunkSize, chunkCount, NULL, soundDecoderData);
|
decompressSound(audioData + 8, soundData, chunkSize, chunkCount, nullptr, soundDecoderData);
|
||||||
_audioStream->queueBuffer(soundData, soundSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
_audioStream->queueBuffer(soundData, soundSize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ Resource::~Resource() {
|
|||||||
|
|
||||||
/* PictureResource */
|
/* PictureResource */
|
||||||
|
|
||||||
PictureResource::PictureResource() : _picture(NULL), _picturePalette(NULL) {
|
PictureResource::PictureResource() : _picture(nullptr), _picturePalette(nullptr) {
|
||||||
_hasPalette = false;
|
_hasPalette = false;
|
||||||
_paletteColorCount = 0;
|
_paletteColorCount = 0;
|
||||||
}
|
}
|
||||||
@ -50,11 +50,11 @@ PictureResource::~PictureResource() {
|
|||||||
if (_picture) {
|
if (_picture) {
|
||||||
_picture->free();
|
_picture->free();
|
||||||
delete _picture;
|
delete _picture;
|
||||||
_picture = 0;
|
_picture = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[] _picturePalette;
|
delete[] _picturePalette;
|
||||||
_picturePalette = 0;
|
_picturePalette = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PictureResource::load(byte *source, int size) {
|
void PictureResource::load(byte *source, int size) {
|
||||||
@ -244,7 +244,7 @@ void AnimationResource::load(byte *source, int size) {
|
|||||||
|
|
||||||
/* SoundResource */
|
/* SoundResource */
|
||||||
|
|
||||||
SoundResource::SoundResource() : _soundSize(0), _soundData(NULL) {
|
SoundResource::SoundResource() : _soundSize(0), _soundData(nullptr) {
|
||||||
_soundEnergyArray = nullptr;
|
_soundEnergyArray = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,12 +308,12 @@ const char *MenuResource::getString(uint index) const {
|
|||||||
if (index < _strings.size())
|
if (index < _strings.size())
|
||||||
return _strings[index].c_str();
|
return _strings[index].c_str();
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FontResource */
|
/* FontResource */
|
||||||
|
|
||||||
FontResource::FontResource() : _data(NULL), _size(0) {
|
FontResource::FontResource() : _data(nullptr), _size(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
FontResource::~FontResource() {
|
FontResource::~FontResource() {
|
||||||
@ -343,7 +343,7 @@ byte *FontResource::getChar(uint c) const {
|
|||||||
if (charData)
|
if (charData)
|
||||||
return charData + 1;
|
return charData + 1;
|
||||||
else
|
else
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int FontResource::getTextWidth(const char *text) {
|
int FontResource::getTextWidth(const char *text) {
|
||||||
@ -358,13 +358,13 @@ int FontResource::getTextWidth(const char *text) {
|
|||||||
|
|
||||||
byte *FontResource::getCharData(uint c) const {
|
byte *FontResource::getCharData(uint c) const {
|
||||||
if (c < 28 || c > 255)
|
if (c < 28 || c > 255)
|
||||||
return NULL;
|
return nullptr;
|
||||||
return _data + 1 + (c - 28) * (getHeight() + 1);
|
return _data + 1 + (c - 28) * (getHeight() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GenericResource */
|
/* GenericResource */
|
||||||
|
|
||||||
GenericResource::GenericResource() : _data(NULL), _size(0) {
|
GenericResource::GenericResource() : _data(nullptr), _size(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
GenericResource::~GenericResource() {
|
GenericResource::~GenericResource() {
|
||||||
@ -542,12 +542,12 @@ ResourceSlot *ResourceReader::getResourceSlot(uint32 resType, uint index) {
|
|||||||
ResourceSlots *slots = _resSlots[resType];
|
ResourceSlots *slots = _resSlots[resType];
|
||||||
|
|
||||||
if (!slots)
|
if (!slots)
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
if (index >= 1 && index < slots->size()) {
|
if (index >= 1 && index < slots->size()) {
|
||||||
return &(*slots)[index];
|
return &(*slots)[index];
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -583,7 +583,7 @@ void ResourceReader::purgeCache() {
|
|||||||
if (slot->refCount <= 0 && slot->res) {
|
if (slot->refCount <= 0 && slot->res) {
|
||||||
_cacheDataSize -= slot->size;
|
_cacheDataSize -= slot->size;
|
||||||
delete slot->res;
|
delete slot->res;
|
||||||
slot->res = NULL;
|
slot->res = nullptr;
|
||||||
slot->refCount = 0;
|
slot->refCount = 0;
|
||||||
_cacheCount--;
|
_cacheCount--;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ Screen::Screen(MadeEngine *vm) : _vm(vm) {
|
|||||||
_textRect.top = 0;
|
_textRect.top = 0;
|
||||||
_textRect.right = 320;
|
_textRect.right = 320;
|
||||||
_textRect.bottom = 200;
|
_textRect.bottom = 200;
|
||||||
_font = NULL;
|
_font = nullptr;
|
||||||
_currentFontNum = 0;
|
_currentFontNum = 0;
|
||||||
_fontDrawCtx.clipRect = Common::Rect(320, 200);
|
_fontDrawCtx.clipRect = Common::Rect(320, 200);
|
||||||
_fontDrawCtx.destSurface = _backgroundScreen;
|
_fontDrawCtx.destSurface = _backgroundScreen;
|
||||||
@ -155,7 +155,7 @@ void Screen::setExcludeArea(uint16 x1, uint16 y1, uint16 x2, uint16 y2) {
|
|||||||
|
|
||||||
void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo) {
|
void Screen::drawSurface(Graphics::Surface *sourceSurface, int x, int y, int16 flipX, int16 flipY, int16 mask, const ClipInfo &clipInfo) {
|
||||||
|
|
||||||
byte *source, *dest, *maskp = 0;
|
byte *source, *dest, *maskp = nullptr;
|
||||||
int startX = 0;
|
int startX = 0;
|
||||||
int startY = 0;
|
int startY = 0;
|
||||||
int clipWidth = sourceSurface->w;
|
int clipWidth = sourceSurface->w;
|
||||||
|
@ -300,7 +300,7 @@ int16 ScriptFunctions::sfStopMusic(int16 argc, int16 *argv) {
|
|||||||
if (_vm->_music->isPlaying() && _musicRes) {
|
if (_vm->_music->isPlaying() && _musicRes) {
|
||||||
_vm->_music->stop();
|
_vm->_music->stop();
|
||||||
_vm->_res->freeResource(_musicRes);
|
_vm->_res->freeResource(_musicRes);
|
||||||
_musicRes = NULL;
|
_musicRes = nullptr;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -498,7 +498,7 @@ int16 ScriptFunctions::sfSetFont(int16 argc, int16 *argv) {
|
|||||||
|
|
||||||
int16 ScriptFunctions::sfDrawText(int16 argc, int16 *argv) {
|
int16 ScriptFunctions::sfDrawText(int16 argc, int16 *argv) {
|
||||||
|
|
||||||
const char *text = NULL;
|
const char *text = nullptr;
|
||||||
|
|
||||||
if (_vm->getGameID() == GID_RTZ) {
|
if (_vm->getGameID() == GID_RTZ) {
|
||||||
text = _vm->_dat->getObjectString(argv[argc - 1]);
|
text = _vm->_dat->getObjectString(argv[argc - 1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user