mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
SCI: Use nullptr
Using clang-tidy modernize-use-nullptr
This commit is contained in:
parent
f544cb934d
commit
940c7bfc14
@ -647,7 +647,7 @@ bool Console::cmdSetParseNodes(int argc, const char **argv) {
|
||||
} else if (!strcmp(token, "nil")) {
|
||||
nextToken = kParseNil;
|
||||
} else {
|
||||
nextValue = strtol(token, NULL, 0);
|
||||
nextValue = strtol(token, nullptr, 0);
|
||||
nextToken = kParseNumber;
|
||||
}
|
||||
|
||||
@ -688,11 +688,11 @@ bool Console::parseResourceNumber36(const char *userParameter, uint16 &resourceN
|
||||
}
|
||||
|
||||
// input: RRRNNVVCCS
|
||||
resourceNumber = strtol(Common::String(userParameter, 3).c_str(), 0, 36);
|
||||
uint16 noun = strtol(Common::String(userParameter + 3, 2).c_str(), 0, 36);
|
||||
uint16 verb = strtol(Common::String(userParameter + 5, 2).c_str(), 0, 36);
|
||||
uint16 cond = strtol(Common::String(userParameter + 7, 2).c_str(), 0, 36);
|
||||
uint16 seq = strtol(Common::String(userParameter + 9, 1).c_str(), 0, 36);
|
||||
resourceNumber = strtol(Common::String(userParameter, 3).c_str(), nullptr, 36);
|
||||
uint16 noun = strtol(Common::String(userParameter + 3, 2).c_str(), nullptr, 36);
|
||||
uint16 verb = strtol(Common::String(userParameter + 5, 2).c_str(), nullptr, 36);
|
||||
uint16 cond = strtol(Common::String(userParameter + 7, 2).c_str(), nullptr, 36);
|
||||
uint16 seq = strtol(Common::String(userParameter + 9, 1).c_str(), nullptr, 36);
|
||||
resourceTuple = ((noun & 0xff) << 24) | ((verb & 0xff) << 16) | ((cond & 0xff) << 8) | (seq & 0xff);
|
||||
return true;
|
||||
}
|
||||
@ -759,7 +759,7 @@ bool Console::cmdDiskDump(int argc, const char **argv) {
|
||||
void Console::cmdDiskDumpWorker(ResourceType resourceType, int resourceNumber, uint32 resourceTuple) {
|
||||
const char *resourceTypeName = getResourceTypeName(resourceType);
|
||||
ResourceId resourceId;
|
||||
Resource *resource = NULL;
|
||||
Resource *resource = nullptr;
|
||||
char outFileName[50];
|
||||
|
||||
switch (resourceType) {
|
||||
@ -1062,7 +1062,7 @@ bool Console::cmdRoomNumber(int argc, const char **argv) {
|
||||
debugPrintf("Calling this command with the room number (in decimal or hexadecimal) changes the room\n");
|
||||
} else {
|
||||
Common::String roomNumberStr = argv[1];
|
||||
int roomNumber = strtol(roomNumberStr.c_str(), NULL, roomNumberStr.hasSuffix("h") ? 16 : 10);
|
||||
int roomNumber = strtol(roomNumberStr.c_str(), nullptr, roomNumberStr.hasSuffix("h") ? 16 : 10);
|
||||
_engine->_gamestate->setRoomNumber(roomNumber);
|
||||
debugPrintf("Room number changed to %d (%x in hex)\n", roomNumber, roomNumber);
|
||||
}
|
||||
@ -1120,7 +1120,7 @@ bool Console::cmdHexgrep(int argc, const char **argv) {
|
||||
|
||||
ResourceType restype = parseResourceType(argv[1]);
|
||||
int resNumber = 0, resMax = 0;
|
||||
Resource *script = NULL;
|
||||
Resource *script = nullptr;
|
||||
|
||||
if (restype == kResourceTypeInvalid) {
|
||||
debugPrintf("Resource type '%s' is not valid\n", argv[1]);
|
||||
@ -1231,7 +1231,7 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
|
||||
|
||||
SciVersion doSoundVersion = _engine->_features->detectDoSoundType();
|
||||
MidiPlayer *player = MidiPlayer_Midi_create(doSoundVersion);
|
||||
MidiParser_SCI *parser = new MidiParser_SCI(doSoundVersion, 0);
|
||||
MidiParser_SCI *parser = new MidiParser_SCI(doSoundVersion, nullptr);
|
||||
parser->setMidiDriver(player);
|
||||
|
||||
Common::List<ResourceId> resources = _engine->getResMan()->listResources(kResourceTypeSound);
|
||||
@ -1265,7 +1265,7 @@ bool Console::cmdShowInstruments(int argc, const char **argv) {
|
||||
continue;
|
||||
}
|
||||
|
||||
parser->loadMusic(track, NULL, channelFilterMask, doSoundVersion);
|
||||
parser->loadMusic(track, nullptr, channelFilterMask, doSoundVersion);
|
||||
SciSpan<const byte> channelData = parser->getMixedData();
|
||||
|
||||
byte curEvent = 0, prevEvent = 0, command = 0;
|
||||
@ -1393,7 +1393,7 @@ bool Console::cmdMapInstrument(int argc, const char **argv) {
|
||||
debugPrintf("Example: %s test_0__XX 1 255\n", argv[0]);
|
||||
debugPrintf("The above example will map the MT-32 instrument \"test 0 XX\" to GM instrument 1\n\n");
|
||||
} else {
|
||||
if (Mt32dynamicMappings != NULL) {
|
||||
if (Mt32dynamicMappings != nullptr) {
|
||||
Mt32ToGmMap newMapping;
|
||||
char *instrumentName = new char[11];
|
||||
Common::strlcpy(instrumentName, argv[1], 11);
|
||||
@ -1410,7 +1410,7 @@ bool Console::cmdMapInstrument(int argc, const char **argv) {
|
||||
}
|
||||
|
||||
debugPrintf("Current dynamic mappings:\n");
|
||||
if (Mt32dynamicMappings != NULL) {
|
||||
if (Mt32dynamicMappings != nullptr) {
|
||||
const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end();
|
||||
for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) {
|
||||
debugPrintf("\"%s\" -> %d / %d\n", (*it).name, (*it).gmInstr, (*it).gmRhythmKey);
|
||||
@ -1632,13 +1632,13 @@ bool Console::cmdRestoreGame(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdRestartGame(int argc, const char **argv) {
|
||||
_engine->_gamestate->abortScriptProcessing = kAbortRestartGame;
|
||||
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
// The scripts get IDs ranging from 100->199, because the scripts require us to assign unique ids THAT EVEN STAY BETWEEN
|
||||
@ -1843,7 +1843,7 @@ bool Console::cmdSaid(int argc, const char **argv) {
|
||||
spec[len++] = 0xfe;
|
||||
spec[len++] = 0xf6;
|
||||
} else {
|
||||
uint32 s = strtol(argv[p], 0, 16);
|
||||
uint32 s = strtol(argv[p], nullptr, 16);
|
||||
if (s >= 0xf0 && s <= 0xff) {
|
||||
spec[len++] = s;
|
||||
} else {
|
||||
@ -2037,7 +2037,7 @@ bool Console::cmdPlayVideo(int argc, const char **argv) {
|
||||
if (filename.hasSuffix(".seq") || filename.hasSuffix(".avi")) {
|
||||
_videoFile = filename;
|
||||
_videoFrameDelay = (argc == 2) ? 10 : atoi(argv[2]);
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
} else {
|
||||
debugPrintf("Unknown video file type\n");
|
||||
return true;
|
||||
@ -2607,7 +2607,7 @@ bool Console::cmdShowMap(int argc, const char **argv) {
|
||||
debugPrintf("Map %d is not available.\n", map);
|
||||
return true;
|
||||
}
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdSongLib(int argc, const char **argv) {
|
||||
@ -2653,7 +2653,7 @@ bool Console::cmdStartSound(int argc, const char **argv) {
|
||||
|
||||
// TODO: Maybe also add a playBed option.
|
||||
g_sci->_soundCmd->startNewSound(number);
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdToggleSound(int argc, const char **argv) {
|
||||
@ -2874,8 +2874,8 @@ bool Console::cmdVMVars(int argc, const char **argv) {
|
||||
const char *varType_pre = strchr(varAbbrev, *argv[1]);
|
||||
int varType;
|
||||
int varIndex = 0;
|
||||
reg_t *curValue = NULL;
|
||||
const char *setValue = NULL;
|
||||
reg_t *curValue = nullptr;
|
||||
const char *setValue = nullptr;
|
||||
|
||||
if (!varType_pre) {
|
||||
debugPrintf("Invalid variable type '%c'\n", *argv[1]);
|
||||
@ -3344,9 +3344,9 @@ void Console::printOffsets(int scriptNr, uint16 showType) {
|
||||
Common::List<SegmentId> segmentNrList;
|
||||
|
||||
SegmentType curSegmentType = SEG_TYPE_INVALID;
|
||||
SegmentObj *curSegmentObj = NULL;
|
||||
Script *curScriptObj = NULL;
|
||||
const byte *curScriptData = NULL;
|
||||
SegmentObj *curSegmentObj = nullptr;
|
||||
Script *curScriptObj = nullptr;
|
||||
const byte *curScriptData = nullptr;
|
||||
|
||||
segmentNrList.clear();
|
||||
if (scriptNr < 0) {
|
||||
@ -3372,9 +3372,9 @@ void Console::printOffsets(int scriptNr, uint16 showType) {
|
||||
int showTypeCount = 0;
|
||||
|
||||
reg_t objectPos;
|
||||
const char *objectNamePtr = NULL;
|
||||
const byte *stringPtr = NULL;
|
||||
const byte *saidPtr = NULL;
|
||||
const char *objectNamePtr = nullptr;
|
||||
const byte *stringPtr = nullptr;
|
||||
const byte *saidPtr = nullptr;
|
||||
|
||||
Common::List<SegmentId>::iterator it;
|
||||
const Common::List<SegmentId>::iterator end = segmentNrList.end();
|
||||
@ -3462,7 +3462,7 @@ bool Console::cmdTrace(int argc, const char **argv) {
|
||||
_debugState.runningStep = atoi(argv[1]) - 1;
|
||||
_debugState.debugging = true;
|
||||
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdStepOver(int argc, const char **argv) {
|
||||
@ -3475,7 +3475,7 @@ bool Console::cmdStepEvent(int argc, const char **argv) {
|
||||
_debugState.stopOnEvent = true;
|
||||
_debugState.debugging = true;
|
||||
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdStepRet(int argc, const char **argv) {
|
||||
@ -3483,7 +3483,7 @@ bool Console::cmdStepRet(int argc, const char **argv) {
|
||||
_debugState.seekLevel = _engine->_gamestate->_executionStack.size() - 1;
|
||||
_debugState.debugging = true;
|
||||
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdStepGlobal(int argc, const char **argv) {
|
||||
@ -3497,7 +3497,7 @@ bool Console::cmdStepGlobal(int argc, const char **argv) {
|
||||
_debugState.seekSpecial = atoi(argv[1]);
|
||||
_debugState.debugging = true;
|
||||
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdStepCallk(int argc, const char **argv) {
|
||||
@ -3530,7 +3530,7 @@ bool Console::cmdStepCallk(int argc, const char **argv) {
|
||||
}
|
||||
_debugState.debugging = true;
|
||||
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdDisassemble(int argc, const char **argv) {
|
||||
@ -3569,7 +3569,7 @@ bool Console::cmdDisassemble(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (lookupSelector(_engine->_gamestate->_segMan, objAddr, selectorId, NULL, &addr) != kSelectorMethod) {
|
||||
if (lookupSelector(_engine->_gamestate->_segMan, objAddr, selectorId, nullptr, &addr) != kSelectorMethod) {
|
||||
debugPrintf("Not a method.\n");
|
||||
return true;
|
||||
}
|
||||
@ -3826,12 +3826,12 @@ bool Console::cmdSend(int argc, const char **argv) {
|
||||
}
|
||||
|
||||
const Object *o = _engine->_gamestate->_segMan->getObject(object);
|
||||
if (o == NULL) {
|
||||
if (o == nullptr) {
|
||||
debugPrintf("Address \"%04x:%04x\" is not an object\n", PRINT_REG(object));
|
||||
return true;
|
||||
}
|
||||
|
||||
SelectorType selector_type = lookupSelector(_engine->_gamestate->_segMan, object, selectorId, NULL, NULL);
|
||||
SelectorType selector_type = lookupSelector(_engine->_gamestate->_segMan, object, selectorId, nullptr, nullptr);
|
||||
|
||||
if (selector_type == kSelectorNone) {
|
||||
debugPrintf("Object does not support selector: \"%s\"\n", selectorName);
|
||||
@ -4580,7 +4580,7 @@ bool Console::cmdQuit(int argc, const char **argv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return cmdExit(0, 0);
|
||||
return cmdExit(0, nullptr);
|
||||
}
|
||||
|
||||
bool Console::cmdAddresses(int argc, const char **argv) {
|
||||
@ -4605,7 +4605,7 @@ bool Console::cmdAddresses(int argc, const char **argv) {
|
||||
// Returns 0 on success
|
||||
static int parse_reg_t(EngineState *s, const char *str, reg_t *dest) {
|
||||
// Pointer to the part of str which contains a numeric offset (if any)
|
||||
const char *offsetStr = NULL;
|
||||
const char *offsetStr = nullptr;
|
||||
|
||||
// Flag that tells whether the value stored in offsetStr is an absolute offset,
|
||||
// or a relative offset against dest->offset.
|
||||
@ -4642,7 +4642,7 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest) {
|
||||
return 1; // No matching register
|
||||
|
||||
if (!*offsetStr)
|
||||
offsetStr = NULL;
|
||||
offsetStr = nullptr;
|
||||
else if (*offsetStr != '+' && *offsetStr != '-')
|
||||
return 1;
|
||||
} else if (*str == '&') { // Script relative: "&SCRIPT-ID:OFFSET"
|
||||
@ -4836,7 +4836,7 @@ static int parse_reg_t(EngineState *s, const char *str, reg_t *dest) {
|
||||
}
|
||||
|
||||
bool Console::parseInteger(const char *argument, int &result) {
|
||||
char *endPtr = 0;
|
||||
char *endPtr = nullptr;
|
||||
int idxLen = strlen(argument);
|
||||
const char *lastChar = argument + idxLen - (idxLen == 0 ? 0 : 1);
|
||||
|
||||
|
@ -159,7 +159,7 @@ static const PlainGameDescriptor s_sciGameTitles[] = {
|
||||
{"phantasmagoria2", "Phantasmagoria 2: A Puzzle of Flesh"},
|
||||
//{"shivers2", "Shivers II: Harvest of Souls"}, // Not SCI
|
||||
{"rama", "RAMA"},
|
||||
{0, 0}
|
||||
{nullptr, nullptr}
|
||||
};
|
||||
|
||||
} // End of namespace Sci
|
||||
@ -177,7 +177,7 @@ static const char *directoryGlobs[] = {
|
||||
"msg",
|
||||
"spanish",
|
||||
"patches",
|
||||
0
|
||||
nullptr
|
||||
};
|
||||
|
||||
class SciMetaEngineDetection : public AdvancedMetaEngineDetection {
|
||||
|
@ -60,7 +60,7 @@ reg_t GameFeatures::getDetectionAddr(const Common::String &objName, Selector slc
|
||||
}
|
||||
|
||||
if (methodNum == -1) {
|
||||
if (lookupSelector(_segMan, objAddr, slc, NULL, &addr) != kSelectorMethod) {
|
||||
if (lookupSelector(_segMan, objAddr, slc, nullptr, &addr) != kSelectorMethod) {
|
||||
error("getDetectionAddr: target selector is not a method of object %s", objName.c_str());
|
||||
return NULL_REG;
|
||||
}
|
||||
@ -388,7 +388,7 @@ SciVersion GameFeatures::detectGfxFunctionsType() {
|
||||
if (SELECTOR(overlay) != -1) {
|
||||
// The game has an overlay selector, check how it calls kDrawPic
|
||||
// to determine the graphics functions type used
|
||||
if (lookupSelector(_segMan, rmObjAddr, SELECTOR(overlay), NULL, NULL) == kSelectorMethod) {
|
||||
if (lookupSelector(_segMan, rmObjAddr, SELECTOR(overlay), nullptr, nullptr) == kSelectorMethod) {
|
||||
if (!autoDetectGfxFunctionsType()) {
|
||||
warning("Graphics functions detection failed, taking an educated guess");
|
||||
|
||||
|
@ -129,8 +129,8 @@ reg_t file_open(EngineState *s, const Common::String &filename, kFileOpenMode mo
|
||||
englishName.toLowercase();
|
||||
|
||||
Common::String wrappedName = unwrapFilename ? g_sci->wrapFilename(englishName) : englishName;
|
||||
Common::SeekableReadStream *inFile = 0;
|
||||
Common::WriteStream *outFile = 0;
|
||||
Common::SeekableReadStream *inFile = nullptr;
|
||||
Common::WriteStream *outFile = nullptr;
|
||||
Common::SaveFileManager *saveFileMan = g_sci->getSaveFileManager();
|
||||
|
||||
bool isCompressed = true;
|
||||
@ -256,12 +256,12 @@ reg_t file_open(EngineState *s, const Common::String &filename, kFileOpenMode mo
|
||||
FileHandle *getFileFromHandle(EngineState *s, uint handle) {
|
||||
if ((handle == 0) || ((handle >= kVirtualFileHandleStart) && (handle <= kVirtualFileHandleEnd))) {
|
||||
error("Attempt to use invalid file handle (%d)", handle);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ((handle >= s->_fileHandles.size()) || !s->_fileHandles[handle].isOpen()) {
|
||||
warning("Attempt to use invalid/unused file handle %d", handle);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &s->_fileHandles[handle];
|
||||
@ -315,7 +315,7 @@ bool fillSavegameDesc(const Common::String &filename, SavegameDesc &desc) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const int id = strtol(filename.end() - 3, NULL, 10);
|
||||
const int id = strtol(filename.end() - 3, nullptr, 10);
|
||||
desc.id = id;
|
||||
// We need to fix date in here, because we save DDMMYYYY instead of
|
||||
// YYYYMMDD, so sorting wouldn't work
|
||||
@ -362,7 +362,7 @@ void listSavegames(Common::Array<SavegameDesc> &saves) {
|
||||
// whose autosave should appear as a normal saved game
|
||||
if (g_sci->getGameId() != GID_QFG3 &&
|
||||
g_sci->getGameId() != GID_QFG4) {
|
||||
const int id = strtol(filename.end() - 3, NULL, 10);
|
||||
const int id = strtol(filename.end() - 3, nullptr, 10);
|
||||
if (id == kNewGameId || id == kAutoSaveId) {
|
||||
continue;
|
||||
}
|
||||
@ -474,7 +474,7 @@ int shiftScummVMToSciSaveId(int saveId) {
|
||||
}
|
||||
#endif
|
||||
|
||||
FileHandle::FileHandle() : _in(0), _out(0) {
|
||||
FileHandle::FileHandle() : _in(nullptr), _out(nullptr) {
|
||||
}
|
||||
|
||||
FileHandle::~FileHandle() {
|
||||
@ -488,8 +488,8 @@ void FileHandle::close() {
|
||||
delete _in;
|
||||
else
|
||||
delete _out;
|
||||
_in = 0;
|
||||
_out = 0;
|
||||
_in = nullptr;
|
||||
_out = nullptr;
|
||||
_name.clear();
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ void run_gc(EngineState *s) {
|
||||
for (uint seg = 1; seg < heap.size(); seg++) {
|
||||
SegmentObj *mobj = heap[seg];
|
||||
|
||||
if (mobj != NULL) {
|
||||
if (mobj != nullptr) {
|
||||
#ifdef GC_DEBUG_CODE
|
||||
const SegmentType type = mobj->getType();
|
||||
segnames[type] = segmentTypeNames[type];
|
||||
|
@ -174,8 +174,8 @@ void Kernel::loadSelectorNames() {
|
||||
static uint16 *parseKernelSignature(const char *kernelName, const char *writtenSig) {
|
||||
const char *curPos;
|
||||
char curChar;
|
||||
uint16 *result = NULL;
|
||||
uint16 *writePos = NULL;
|
||||
uint16 *result = nullptr;
|
||||
uint16 *writePos = nullptr;
|
||||
int size = 0;
|
||||
bool validType = false;
|
||||
bool optionalType = false;
|
||||
@ -185,7 +185,7 @@ static uint16 *parseKernelSignature(const char *kernelName, const char *writtenS
|
||||
|
||||
// No signature given? no signature out
|
||||
if (!writtenSig)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// First, we check how many bytes the result will be
|
||||
// we also check, if the written signature makes any sense
|
||||
@ -439,7 +439,7 @@ static const SignatureDebugType signatureDebugTypeList[] = {
|
||||
{ SIG_TYPE_NODE, "node" },
|
||||
{ SIG_TYPE_ERROR, "error" },
|
||||
{ SIG_IS_INVALID, "invalid" },
|
||||
{ 0, NULL }
|
||||
{ 0, nullptr }
|
||||
};
|
||||
|
||||
static void kernelSignatureDebugType(Common::String &signatureDetailsStr, const uint16 type) {
|
||||
@ -593,11 +593,11 @@ void Kernel::mapFunctions(GameFeatures *features) {
|
||||
Common::String kernelName = _kernelNames[id];
|
||||
|
||||
// Reset the table entry
|
||||
_kernelFuncs[id].function = NULL;
|
||||
_kernelFuncs[id].signature = NULL;
|
||||
_kernelFuncs[id].name = NULL;
|
||||
_kernelFuncs[id].workarounds = NULL;
|
||||
_kernelFuncs[id].subFunctions = NULL;
|
||||
_kernelFuncs[id].function = nullptr;
|
||||
_kernelFuncs[id].signature = nullptr;
|
||||
_kernelFuncs[id].name = nullptr;
|
||||
_kernelFuncs[id].workarounds = nullptr;
|
||||
_kernelFuncs[id].subFunctions = nullptr;
|
||||
_kernelFuncs[id].subFunctionCount = 0;
|
||||
if (kernelName.empty()) {
|
||||
// No name was given -> must be an unknown opcode
|
||||
@ -645,7 +645,7 @@ void Kernel::mapFunctions(GameFeatures *features) {
|
||||
_kernelFuncs[id].workarounds = kernelMap->workarounds;
|
||||
if (kernelMap->subFunctions) {
|
||||
// Get version for subfunction identification
|
||||
SciVersion mySubVersion = (SciVersion)kernelMap->function(NULL, 0, NULL).getOffset();
|
||||
SciVersion mySubVersion = (SciVersion)kernelMap->function(nullptr, 0, nullptr).getOffset();
|
||||
// Now check whats the highest subfunction-id for this version
|
||||
const SciKernelMapSubEntry *kernelSubMap = kernelMap->subFunctions;
|
||||
uint16 subFunctionCount = 0;
|
||||
|
@ -76,7 +76,7 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t iconObj = NULL_REG;
|
||||
if (g_sci->_gfxMacIconBar->handleEvents(curEvent, iconObj)) {
|
||||
if (!iconObj.isNull()) {
|
||||
invokeSelector(s, iconObj, SELECTOR(select), argc, argv, 0, NULL);
|
||||
invokeSelector(s, iconObj, SELECTOR(select), argc, argv, 0, nullptr);
|
||||
}
|
||||
|
||||
// The mouse press event was handled by the mac icon bar so change
|
||||
|
@ -134,7 +134,7 @@ static reg_t kSetCursorSci0(EngineState *s, int argc, reg_t *argv) {
|
||||
|
||||
static reg_t kSetCursorSci11(EngineState *s, int argc, reg_t *argv) {
|
||||
Common::Point pos;
|
||||
Common::Point *hotspot = NULL;
|
||||
Common::Point *hotspot = nullptr;
|
||||
|
||||
switch (argc) {
|
||||
case 1:
|
||||
@ -343,7 +343,7 @@ reg_t kTextSize(EngineState *s, int argc, reg_t *argv) {
|
||||
}
|
||||
|
||||
Common::String sep_str;
|
||||
const char *sep = NULL;
|
||||
const char *sep = nullptr;
|
||||
if ((argc > 4) && (argv[4].getSegment())) {
|
||||
sep_str = s->_segMan->getString(argv[4]);
|
||||
sep = sep_str.c_str();
|
||||
@ -889,7 +889,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
|
||||
switch (type) {
|
||||
case SCI_CONTROLS_TYPE_BUTTON:
|
||||
case SCI_CONTROLS_TYPE_TEXTEDIT:
|
||||
splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter, NULL);
|
||||
splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter, nullptr);
|
||||
break;
|
||||
case SCI_CONTROLS_TYPE_TEXT:
|
||||
splitText = g_sci->strSplitLanguage(text.c_str(), &languageSplitter);
|
||||
@ -932,7 +932,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
|
||||
int c = readSelectorValue(s->_segMan, controlObject, SELECTOR(cel));
|
||||
celNo = (c & 0x80) ? c - 256 : c;
|
||||
// Check if the control object specifies a priority selector (like in Jones)
|
||||
if (lookupSelector(s->_segMan, controlObject, SELECTOR(priority), NULL, NULL) == kSelectorVariable)
|
||||
if (lookupSelector(s->_segMan, controlObject, SELECTOR(priority), nullptr, nullptr) == kSelectorVariable)
|
||||
priority = readSelectorValue(s->_segMan, controlObject, SELECTOR(priority));
|
||||
else
|
||||
priority = -1;
|
||||
@ -953,7 +953,7 @@ void _k_GenericDrawControl(EngineState *s, reg_t controlObject, bool hilite) {
|
||||
upperOffset = readSelectorValue(s->_segMan, controlObject, SELECTOR(topString));
|
||||
} else {
|
||||
// Earlier games use lsTop or brTop
|
||||
if (lookupSelector(s->_segMan, controlObject, SELECTOR(brTop), NULL, NULL) == kSelectorVariable)
|
||||
if (lookupSelector(s->_segMan, controlObject, SELECTOR(brTop), nullptr, nullptr) == kSelectorVariable)
|
||||
upperOffset = readSelectorValue(s->_segMan, controlObject, SELECTOR(brTop));
|
||||
else
|
||||
upperOffset = readSelectorValue(s->_segMan, controlObject, SELECTOR(lsTop));
|
||||
@ -1195,7 +1195,7 @@ reg_t kNewWindow(EngineState *s, int argc, reg_t *argv) {
|
||||
Common::String title;
|
||||
if (argv[4 + argextra].getSegment()) {
|
||||
title = s->_segMan->getString(argv[4 + argextra]);
|
||||
title = g_sci->strSplit(title.c_str(), NULL);
|
||||
title = g_sci->strSplit(title.c_str(), nullptr);
|
||||
}
|
||||
|
||||
return g_sci->_gfxPorts->kernelNewWindow(rect1, rect2, style, priority, colorPen, colorBack, title.c_str());
|
||||
|
@ -80,7 +80,7 @@ reg_t kDrawStatus(EngineState *s, int argc, reg_t *argv) {
|
||||
return s->r_acc;
|
||||
}
|
||||
|
||||
g_sci->_gfxMenu->kernelDrawStatus(g_sci->strSplit(text.c_str(), NULL).c_str(), colorPen, colorBack);
|
||||
g_sci->_gfxMenu->kernelDrawStatus(g_sci->strSplit(text.c_str(), nullptr).c_str(), colorPen, colorBack);
|
||||
}
|
||||
return s->r_acc;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ struct Vertex {
|
||||
public:
|
||||
Vertex(const Common::Point &p) : v(p) {
|
||||
costG = HUGE_DISTANCE;
|
||||
path_prev = NULL;
|
||||
path_prev = nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@ -152,14 +152,14 @@ public:
|
||||
Vertex *_head;
|
||||
|
||||
public:
|
||||
CircularVertexList() : _head(0) {}
|
||||
CircularVertexList() : _head(nullptr) {}
|
||||
|
||||
Vertex *first() const {
|
||||
return _head;
|
||||
}
|
||||
|
||||
void insertAtEnd(Vertex *elm) {
|
||||
if (_head == NULL) {
|
||||
if (_head == nullptr) {
|
||||
elm->_next = elm->_prev = elm;
|
||||
_head = elm;
|
||||
} else {
|
||||
@ -184,7 +184,7 @@ public:
|
||||
|
||||
void remove(Vertex *elm) {
|
||||
if (elm->_next == elm) {
|
||||
_head = NULL;
|
||||
_head = nullptr;
|
||||
} else {
|
||||
if (_head == elm)
|
||||
_head = elm->_next;
|
||||
@ -194,7 +194,7 @@ public:
|
||||
}
|
||||
|
||||
bool empty() const {
|
||||
return _head == NULL;
|
||||
return _head == nullptr;
|
||||
}
|
||||
|
||||
uint size() const {
|
||||
@ -264,11 +264,11 @@ struct PathfindingState {
|
||||
int _width, _height;
|
||||
|
||||
PathfindingState(int width, int height) : _width(width), _height(height) {
|
||||
vertex_start = NULL;
|
||||
vertex_end = NULL;
|
||||
vertex_index = NULL;
|
||||
_prependPoint = NULL;
|
||||
_appendPoint = NULL;
|
||||
vertex_start = nullptr;
|
||||
vertex_end = nullptr;
|
||||
vertex_index = nullptr;
|
||||
_prependPoint = nullptr;
|
||||
_appendPoint = nullptr;
|
||||
vertices = 0;
|
||||
}
|
||||
|
||||
@ -898,9 +898,9 @@ static int intersection(const Common::Point &a, const Common::Point &b, const Ve
|
||||
* (Common::Point) *ret: On success, the closest intersection point
|
||||
*/
|
||||
static int nearest_intersection(PathfindingState *s, const Common::Point &p, const Common::Point &q, Common::Point *ret) {
|
||||
Polygon *polygon = 0;
|
||||
Polygon *polygon = nullptr;
|
||||
FloatPoint isec;
|
||||
Polygon *ipolygon = 0;
|
||||
Polygon *ipolygon = nullptr;
|
||||
uint32 dist = HUGE_DISTANCE;
|
||||
|
||||
for (PolygonList::iterator it = s->polygons.begin(); it != s->polygons.end(); ++it) {
|
||||
@ -1000,7 +1000,7 @@ static Common::Point *fixup_start_point(PathfindingState *s, const Common::Point
|
||||
case POLY_BARRED_ACCESS:
|
||||
case POLY_NEAREST_ACCESS:
|
||||
if (cont != CONT_OUTSIDE) {
|
||||
if (s->_prependPoint != NULL) {
|
||||
if (s->_prependPoint != nullptr) {
|
||||
// We shouldn't get here twice.
|
||||
// We need to break in this case, otherwise we'll end in an infinite
|
||||
// loop.
|
||||
@ -1020,7 +1020,7 @@ static Common::Point *fixup_start_point(PathfindingState *s, const Common::Point
|
||||
(*it)->vertices.size() == 14;
|
||||
if (ignoreEarlierPolygon) {
|
||||
delete s->_prependPoint;
|
||||
s->_prependPoint = NULL;
|
||||
s->_prependPoint = nullptr;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -1028,7 +1028,7 @@ static Common::Point *fixup_start_point(PathfindingState *s, const Common::Point
|
||||
|
||||
if (s->findNearPoint(start, (*it), new_start) != PF_OK) {
|
||||
delete new_start;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ((type == POLY_BARRED_ACCESS) || (type == POLY_CONTAINED_ACCESS))
|
||||
@ -1078,7 +1078,7 @@ static Common::Point *fixup_end_point(PathfindingState *s, const Common::Point &
|
||||
case POLY_BARRED_ACCESS:
|
||||
case POLY_NEAREST_ACCESS:
|
||||
if (cont != CONT_OUTSIDE) {
|
||||
if (s->_appendPoint != NULL) {
|
||||
if (s->_appendPoint != nullptr) {
|
||||
// We shouldn't get here twice.
|
||||
// Happens in LB2CD, inside the speakeasy when walking from the
|
||||
// speakeasy (room 310) into the bathroom (room 320), after having
|
||||
@ -1092,7 +1092,7 @@ static Common::Point *fixup_end_point(PathfindingState *s, const Common::Point &
|
||||
// The original end position is in an invalid location, so we move the point
|
||||
if (s->findNearPoint(end, (*it), new_end) != PF_OK) {
|
||||
delete new_end;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// For near-point access polygons we need to add the original end point
|
||||
@ -1181,7 +1181,7 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
|
||||
|
||||
if (size == 0) {
|
||||
// If the polygon has no vertices, we skip it
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SegmentRef pointList = segMan->dereference(points);
|
||||
@ -1190,7 +1190,7 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
|
||||
// Refer to bug #4946.
|
||||
if (!pointList.isValid() || pointList.skipByte) {
|
||||
warning("convert_polygon: Polygon data pointer is invalid, skipping polygon");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Make sure that we have enough points
|
||||
@ -1198,7 +1198,7 @@ static Polygon *convert_polygon(EngineState *s, reg_t polygon) {
|
||||
warning("convert_polygon: Not enough memory allocated for polygon points. "
|
||||
"Expected %d, got %d. Skipping polygon",
|
||||
size * POLY_POINT_SIZE, pointList.maxSize);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int skip = 0;
|
||||
@ -1273,7 +1273,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
|
||||
while (node) {
|
||||
// The node value might be null, in which case there's no polygon to parse.
|
||||
// Happens in LB2 floppy - refer to bug #5195
|
||||
polygon = !node->value.isNull() ? convert_polygon(s, node->value) : NULL;
|
||||
polygon = !node->value.isNull() ? convert_polygon(s, node->value) : nullptr;
|
||||
|
||||
if (polygon) {
|
||||
pf_s->polygons.push_back(polygon);
|
||||
@ -1292,7 +1292,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
|
||||
if (!new_start) {
|
||||
warning("AvoidPath: Couldn't fixup start position for pathfinding");
|
||||
delete pf_s;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Common::Point *new_end = fixup_end_point(pf_s, end);
|
||||
@ -1301,7 +1301,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
|
||||
warning("AvoidPath: Couldn't fixup end position for pathfinding");
|
||||
delete new_start;
|
||||
delete pf_s;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (opt == 0) {
|
||||
@ -1324,7 +1324,7 @@ static PathfindingState *convert_polygon_set(EngineState *s, reg_t poly_list, Co
|
||||
delete new_start;
|
||||
delete new_end;
|
||||
delete pf_s;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (err == PF_OK)
|
||||
@ -1387,7 +1387,7 @@ static void AStar(PathfindingState *s) {
|
||||
while (!openSet.empty()) {
|
||||
// Find vertex in open set with lowest F cost
|
||||
VertexList::iterator vertex_min_it = openSet.end();
|
||||
Vertex *vertex_min = 0;
|
||||
Vertex *vertex_min = nullptr;
|
||||
uint32 min = HUGE_DISTANCE;
|
||||
|
||||
for (VertexList::iterator it = openSet.begin(); it != openSet.end(); ++it) {
|
||||
@ -1399,7 +1399,7 @@ static void AStar(PathfindingState *s) {
|
||||
}
|
||||
}
|
||||
|
||||
assert(vertex_min != 0); // the vertex cost should never be bigger than HUGE_DISTANCE
|
||||
assert(vertex_min != nullptr); // the vertex cost should never be bigger than HUGE_DISTANCE
|
||||
|
||||
// Check if we are done
|
||||
if (vertex_min == s->vertex_end)
|
||||
@ -1492,7 +1492,7 @@ static reg_t output_path(PathfindingState *p, EngineState *s) {
|
||||
int path_len = 0;
|
||||
reg_t output;
|
||||
Vertex *vertex = p->vertex_end;
|
||||
int unreachable = vertex->path_prev == NULL;
|
||||
int unreachable = vertex->path_prev == nullptr;
|
||||
|
||||
if (!unreachable) {
|
||||
while (vertex) {
|
||||
|
@ -320,7 +320,7 @@ reg_t kRespondsTo(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t obj = argv[0];
|
||||
int selector = argv[1].toUint16();
|
||||
|
||||
return make_reg(0, s->_segMan->isHeapObject(obj) && lookupSelector(s->_segMan, obj, selector, NULL, NULL) != kSelectorNone);
|
||||
return make_reg(0, s->_segMan->isHeapObject(obj) && lookupSelector(s->_segMan, obj, selector, nullptr, nullptr) != kSelectorNone);
|
||||
}
|
||||
|
||||
} // End of namespace Sci
|
||||
|
@ -48,8 +48,8 @@ reg_t kStrCat(EngineState *s, int argc, reg_t *argv) {
|
||||
// However Space Quest 4 PC-9801 doesn't
|
||||
if ((g_sci->getLanguage() == Common::JA_JPN)
|
||||
&& (getSciVersion() <= SCI_VERSION_01)) {
|
||||
s1 = g_sci->strSplit(s1.c_str(), NULL);
|
||||
s2 = g_sci->strSplit(s2.c_str(), NULL);
|
||||
s1 = g_sci->strSplit(s1.c_str(), nullptr);
|
||||
s2 = g_sci->strSplit(s2.c_str(), nullptr);
|
||||
}
|
||||
|
||||
s1 += s2;
|
||||
@ -585,7 +585,7 @@ reg_t kSetQuitStr(EngineState *s, int argc, reg_t *argv) {
|
||||
reg_t kStrSplit(EngineState *s, int argc, reg_t *argv) {
|
||||
Common::String format = s->_segMan->getString(argv[1]);
|
||||
Common::String sep_str;
|
||||
const char *sep = NULL;
|
||||
const char *sep = nullptr;
|
||||
if (!argv[2].isNull()) {
|
||||
sep_str = s->_segMan->getString(argv[2]);
|
||||
sep = sep_str.c_str();
|
||||
|
@ -703,9 +703,9 @@ void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) {
|
||||
// pMidiParser and pStreamAud will be initialized when the
|
||||
// sound list is reconstructed in gamestate_restore()
|
||||
if (s.isLoading()) {
|
||||
soundRes = 0;
|
||||
pMidiParser = 0;
|
||||
pStreamAud = 0;
|
||||
soundRes = nullptr;
|
||||
pMidiParser = nullptr;
|
||||
pStreamAud = nullptr;
|
||||
reverb = -1; // invalid reverb, will be initialized in processInitSound()
|
||||
}
|
||||
}
|
||||
@ -1420,7 +1420,7 @@ bool gamestate_restore(EngineState *s, int saveId) {
|
||||
void gamestate_restore(EngineState *s, Common::SeekableReadStream *fh) {
|
||||
SavegameMetadata meta;
|
||||
|
||||
Common::Serializer ser(fh, 0);
|
||||
Common::Serializer ser(fh, nullptr);
|
||||
sync_SavegameMetadata(ser, meta);
|
||||
|
||||
if (fh->eos()) {
|
||||
|
@ -62,7 +62,7 @@ void Script::freeScript(const bool keepLocalsSegment) {
|
||||
if (!keepLocalsSegment) {
|
||||
_localsSegment = 0;
|
||||
}
|
||||
_localsBlock = NULL;
|
||||
_localsBlock = nullptr;
|
||||
_localsCount = 0;
|
||||
|
||||
_lockers = 1;
|
||||
@ -638,14 +638,14 @@ Object *Script::getObject(uint32 offset) {
|
||||
if (_objects.contains(offset))
|
||||
return &_objects[offset];
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const Object *Script::getObject(uint32 offset) const {
|
||||
if (_objects.contains(offset))
|
||||
return &_objects[offset];
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Object *Script::scriptObjInit(reg_t obj_pos, bool fullObjectInit) {
|
||||
@ -951,7 +951,7 @@ SegmentRef Script::dereference(reg_t pointer) {
|
||||
|
||||
LocalVariables *Script::allocLocalsSegment(SegManager *segMan) {
|
||||
if (!getLocalsCount()) { // No locals
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
LocalVariables *locals;
|
||||
|
||||
@ -987,7 +987,7 @@ void Script::initializeLocals(SegManager *segMan) {
|
||||
}
|
||||
|
||||
void Script::syncLocalsBlock(SegManager *segMan) {
|
||||
_localsBlock = (_localsSegment == 0) ? NULL : (LocalVariables *)(segMan->getSegment(_localsSegment, SEG_TYPE_LOCALS));
|
||||
_localsBlock = (_localsSegment == 0) ? nullptr : (LocalVariables *)(segMan->getSegment(_localsSegment, SEG_TYPE_LOCALS));
|
||||
}
|
||||
|
||||
void Script::initializeClasses(SegManager *segMan) {
|
||||
|
@ -207,7 +207,7 @@ static const char *const selectorNameTable[] = {
|
||||
"vol", // SQ6
|
||||
"walkIconItem", // SQ6
|
||||
#endif
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
enum ScriptPatcherSelectors {
|
||||
@ -21795,7 +21795,7 @@ ScriptPatcher::ScriptPatcher() {
|
||||
for (selectorNr = 0; selectorNr < selectorCount; selectorNr++)
|
||||
_selectorIdTable[selectorNr] = -1;
|
||||
|
||||
_runtimeTable = NULL;
|
||||
_runtimeTable = nullptr;
|
||||
_isMacSci11 = false;
|
||||
}
|
||||
|
||||
@ -22218,9 +22218,9 @@ void ScriptPatcher::enablePatch(const SciScriptPatcherEntry *patchTable, const c
|
||||
}
|
||||
|
||||
void ScriptPatcher::processScript(uint16 scriptNr, SciSpan<byte> scriptData) {
|
||||
const SciScriptPatcherEntry *signatureTable = NULL;
|
||||
const SciScriptPatcherEntry *curEntry = NULL;
|
||||
SciScriptPatcherRuntimeEntry *curRuntimeEntry = NULL;
|
||||
const SciScriptPatcherEntry *signatureTable = nullptr;
|
||||
const SciScriptPatcherEntry *curEntry = nullptr;
|
||||
SciScriptPatcherRuntimeEntry *curRuntimeEntry = nullptr;
|
||||
const Sci::SciGameId gameId = g_sci->getGameId();
|
||||
|
||||
switch (gameId) {
|
||||
|
@ -83,7 +83,7 @@ void DebugState::updateActiveBreakpointTypes() {
|
||||
// Disassembles one command from the heap, returns address of next command or 0 if a ret was encountered.
|
||||
reg_t disassemble(EngineState *s, reg_t pos, const Object *obj, bool printBWTag, bool printBytecode, bool printCSyntax) {
|
||||
SegmentObj *mobj = s->_segMan->getSegment(pos.getSegment(), SEG_TYPE_SCRIPT);
|
||||
Script *script_entity = NULL;
|
||||
Script *script_entity = nullptr;
|
||||
reg_t retval = make_reg32(pos.getSegment(), pos.getOffset() + 1);
|
||||
uint16 param_value = 0xffff; // Suppress GCC warning by setting default value, chose value as invalid to getKernelName etc.
|
||||
uint i = 0;
|
||||
@ -351,7 +351,7 @@ reg_t disassemble(EngineState *s, reg_t pos, const Object *obj, bool printBWTag,
|
||||
|
||||
while (stackframe > 0) {
|
||||
int argc = sb[- stackframe + 1].getOffset();
|
||||
const char *name = NULL;
|
||||
const char *name = nullptr;
|
||||
reg_t called_obj_addr = s->xs->objp;
|
||||
|
||||
if (opcode == op_send)
|
||||
@ -371,7 +371,7 @@ reg_t disassemble(EngineState *s, reg_t pos, const Object *obj, bool printBWTag,
|
||||
if (!s->_segMan->getObject(called_obj_addr)) {
|
||||
debugN("INVALID_OBJ");
|
||||
} else {
|
||||
switch (lookupSelector(s->_segMan, called_obj_addr, selector, 0, &fun_ref)) {
|
||||
switch (lookupSelector(s->_segMan, called_obj_addr, selector, nullptr, &fun_ref)) {
|
||||
case kSelectorMethod:
|
||||
debugN("FUNCT");
|
||||
argc += restmod;
|
||||
|
@ -186,7 +186,7 @@ void SegManager::deallocate(SegmentId seg) {
|
||||
|
||||
bool SegManager::isHeapObject(reg_t pos) const {
|
||||
const Object *obj = getObject(pos);
|
||||
if (obj == NULL || (obj && obj->isFreed()))
|
||||
if (obj == nullptr || (obj && obj->isFreed()))
|
||||
return false;
|
||||
Script *scr = getScriptIfLoaded(pos.getSegment());
|
||||
return !(scr && scr->isMarkedAsDeleted());
|
||||
@ -213,7 +213,7 @@ Script *SegManager::getScript(const SegmentId seg) {
|
||||
Script *SegManager::getScriptIfLoaded(const SegmentId seg) const {
|
||||
SegmentId actualSegment = getActualSegment(seg);
|
||||
if (actualSegment < 1 || (uint)actualSegment >= _heap.size() || !_heap[actualSegment] || _heap[actualSegment]->getType() != SEG_TYPE_SCRIPT)
|
||||
return 0;
|
||||
return nullptr;
|
||||
return (Script *)_heap[actualSegment];
|
||||
}
|
||||
|
||||
@ -227,7 +227,7 @@ SegmentId SegManager::findSegmentByType(int type) const {
|
||||
SegmentObj *SegManager::getSegmentObj(SegmentId seg) const {
|
||||
SegmentId actualSegment = getActualSegment(seg);
|
||||
if (actualSegment < 1 || (uint)actualSegment >= _heap.size() || !_heap[actualSegment])
|
||||
return 0;
|
||||
return nullptr;
|
||||
return _heap[actualSegment];
|
||||
}
|
||||
|
||||
@ -245,9 +245,9 @@ SegmentObj *SegManager::getSegment(SegmentId seg, SegmentType type) const {
|
||||
|
||||
Object *SegManager::getObject(reg_t pos) const {
|
||||
SegmentObj *mobj = getSegmentObj(pos.getSegment());
|
||||
Object *obj = NULL;
|
||||
Object *obj = nullptr;
|
||||
|
||||
if (mobj != NULL) {
|
||||
if (mobj != nullptr) {
|
||||
if (mobj->getType() == SEG_TYPE_CLONES) {
|
||||
CloneTable &ct = *(CloneTable *)mobj;
|
||||
if (ct.isValidEntry(pos.getOffset()))
|
||||
@ -473,7 +473,7 @@ byte *SegManager::getHunkPointer(reg_t addr) {
|
||||
|
||||
if (!ht || !ht->isValidEntry(addr.getOffset())) {
|
||||
// Valid SCI behavior, e.g. when loading/quitting
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return (byte *)ht->at(addr.getOffset()).mem;
|
||||
@ -535,14 +535,14 @@ reg_t SegManager::newNode(reg_t value, reg_t key) {
|
||||
List *SegManager::lookupList(reg_t addr) {
|
||||
if (getSegmentType(addr.getSegment()) != SEG_TYPE_LISTS) {
|
||||
error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ListTable < = *(ListTable *)_heap[addr.getSegment()];
|
||||
|
||||
if (!lt.isValidEntry(addr.getOffset())) {
|
||||
error("Attempt to use non-list %04x:%04x as list", PRINT_REG(addr));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &(lt[addr.getOffset()]);
|
||||
@ -550,23 +550,23 @@ List *SegManager::lookupList(reg_t addr) {
|
||||
|
||||
Node *SegManager::lookupNode(reg_t addr, bool stopOnDiscarded) {
|
||||
if (addr.isNull())
|
||||
return NULL; // Non-error null
|
||||
return nullptr; // Non-error null
|
||||
|
||||
SegmentType type = getSegmentType(addr.getSegment());
|
||||
|
||||
if (type != SEG_TYPE_NODES) {
|
||||
error("Attempt to use non-node %04x:%04x (type %d) as list node", PRINT_REG(addr), type);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NodeTable &nt = *(NodeTable *)_heap[addr.getSegment()];
|
||||
|
||||
if (!nt.isValidEntry(addr.getOffset())) {
|
||||
if (!stopOnDiscarded)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
error("Attempt to use invalid or discarded reference %04x:%04x as list node", PRINT_REG(addr));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &(nt[addr.getOffset()]);
|
||||
@ -589,7 +589,7 @@ static void *derefPtr(SegManager *segMan, reg_t pointer, int entries, bool wantR
|
||||
SegmentRef ret = segMan->dereference(pointer);
|
||||
|
||||
if (!ret.isValid())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (ret.isRaw != wantRaw) {
|
||||
warning("Dereferencing pointer %04x:%04x (type %d) which is %s, but expected %s", PRINT_REG(pointer),
|
||||
@ -600,12 +600,12 @@ static void *derefPtr(SegManager *segMan, reg_t pointer, int entries, bool wantR
|
||||
|
||||
if (!wantRaw && ret.skipByte) {
|
||||
warning("Unaligned pointer read: %04x:%04x expected with word alignment", PRINT_REG(pointer));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (entries > ret.maxSize) {
|
||||
warning("Trying to dereference pointer %04x:%04x beyond end of segment", PRINT_REG(pointer));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (ret.isRaw)
|
||||
@ -912,7 +912,7 @@ byte *SegManager::allocDynmem(int size, const char *descr, reg_t *addr) {
|
||||
if (size) {
|
||||
d._buf = (byte *)calloc(size, 1);
|
||||
} else {
|
||||
d._buf = NULL;
|
||||
d._buf = nullptr;
|
||||
}
|
||||
|
||||
d._description = descr;
|
||||
|
@ -37,7 +37,7 @@ namespace Sci {
|
||||
//#define GC_DEBUG_VERBOSE // Debug garbage verbosely
|
||||
|
||||
SegmentObj *SegmentObj::createSegmentObj(SegmentType type) {
|
||||
SegmentObj *mem = 0;
|
||||
SegmentObj *mem = nullptr;
|
||||
switch (type) {
|
||||
case SEG_TYPE_SCRIPT:
|
||||
mem = new Script();
|
||||
@ -155,7 +155,7 @@ SegmentRef LocalVariables::dereference(reg_t pointer) {
|
||||
} else {
|
||||
error("LocalVariables::dereference: Offset at end or out of bounds %04x:%04x", PRINT_REG(pointer));
|
||||
}
|
||||
ret.reg = 0;
|
||||
ret.reg = nullptr;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ void Kernel::mapSelectors() {
|
||||
reg_t readSelector(SegManager *segMan, reg_t object, Selector selectorId) {
|
||||
ObjVarRef address;
|
||||
|
||||
if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable)
|
||||
if (lookupSelector(segMan, object, selectorId, &address, nullptr) != kSelectorVariable)
|
||||
return NULL_REG;
|
||||
|
||||
if (g_sci->_debugState._activeBreakpointTypes & BREAK_SELECTORREAD) {
|
||||
@ -274,7 +274,7 @@ void writeSelector(SegManager *segMan, reg_t object, Selector selectorId, reg_t
|
||||
error("Attempt to write to invalid selector %d. Address %04x:%04x, %s", selectorId, PRINT_REG(object), origin.toString().c_str());
|
||||
}
|
||||
|
||||
if (lookupSelector(segMan, object, selectorId, &address, NULL) != kSelectorVariable) {
|
||||
if (lookupSelector(segMan, object, selectorId, &address, nullptr) != kSelectorVariable) {
|
||||
const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
|
||||
error("Selector '%s' of object could not be written to. Address %04x:%04x, %s", g_sci->getKernel()->getSelectorName(selectorId).c_str(), PRINT_REG(object), origin.toString().c_str());
|
||||
}
|
||||
@ -301,7 +301,7 @@ void invokeSelector(EngineState *s, reg_t object, int selectorId,
|
||||
stackframe[0] = make_reg(0, selectorId); // The selector we want to call
|
||||
stackframe[1] = make_reg(0, argc); // Argument count
|
||||
|
||||
slc_type = lookupSelector(s->_segMan, object, selectorId, NULL, NULL);
|
||||
slc_type = lookupSelector(s->_segMan, object, selectorId, nullptr, nullptr);
|
||||
|
||||
if (slc_type == kSelectorNone) {
|
||||
const SciCallOrigin origin = g_sci->getEngineState()->getCurrentCallOrigin();
|
||||
|
@ -94,8 +94,8 @@ void EngineState::reset(bool isRestoring) {
|
||||
|
||||
executionStackBase = 0;
|
||||
_executionStackPosChanged = false;
|
||||
stack_base = 0;
|
||||
stack_top = 0;
|
||||
stack_base = nullptr;
|
||||
stack_top = nullptr;
|
||||
|
||||
r_acc = NULL_REG;
|
||||
r_prev = NULL_REG;
|
||||
@ -387,7 +387,7 @@ Common::String SciEngine::strSplitLanguage(const char *str, uint16 *languageSpli
|
||||
|
||||
// Don't add subtitle when separator is not set, subtitle language is not set, or
|
||||
// string contains only one language
|
||||
if ((sep == NULL) || (subtitleLanguage == K_LANG_NONE) || (foundLanguage == K_LANG_NONE))
|
||||
if ((sep == nullptr) || (subtitleLanguage == K_LANG_NONE) || (foundLanguage == K_LANG_NONE))
|
||||
return retval;
|
||||
|
||||
// Add subtitle, unless the subtitle language doesn't match the languages in the string
|
||||
|
@ -123,7 +123,7 @@ static const SelectorRemap sciSelectorRemap[] = {
|
||||
{ SCI_VERSION_1_1, SCI_VERSION_2_1_LATE, "-super-", 4102 },
|
||||
//
|
||||
{ SCI_VERSION_1_1, SCI_VERSION_2_1_LATE, "-info-", 4103 },
|
||||
{ SCI_VERSION_NONE, SCI_VERSION_NONE, 0, 0 }
|
||||
{ SCI_VERSION_NONE, SCI_VERSION_NONE, nullptr, 0 }
|
||||
};
|
||||
|
||||
struct ClassReference {
|
||||
|
@ -185,7 +185,7 @@ static void write_var(EngineState *s, int type, int index, reg_t value) {
|
||||
if (!stopGroopPos.isNull()) { // does the game have a stopGroop object?
|
||||
// Find the "client" member variable of the stopGroop object, and update it
|
||||
ObjVarRef varp;
|
||||
if (lookupSelector(s->_segMan, stopGroopPos, SELECTOR(client), &varp, NULL) == kSelectorVariable) {
|
||||
if (lookupSelector(s->_segMan, stopGroopPos, SELECTOR(client), &varp, nullptr) == kSelectorVariable) {
|
||||
reg_t *clientVar = varp.getPointer(s->_segMan);
|
||||
*clientVar = value;
|
||||
}
|
||||
@ -228,7 +228,7 @@ ExecStack *execute_method(EngineState *s, uint16 script, uint16 pubfunct, StackP
|
||||
|
||||
uint32 exportAddr = scr->validateExportFunc(pubfunct, false);
|
||||
if (!exportAddr)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
assert(argp[0].toUint16() == argc); // The first argument is argc
|
||||
ExecStack xstack(calling_obj, calling_obj, sp, argc, argp,
|
||||
@ -293,7 +293,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
|
||||
error("Send to invalid selector 0x%x (%s) of object at %04x:%04x", 0xffff & selector, g_sci->getKernel()->getSelectorName(0xffff & selector).c_str(), PRINT_REG(send_obj));
|
||||
|
||||
ExecStackType stackType = EXEC_STACK_TYPE_VARSELECTOR;
|
||||
StackPtr curSP = NULL;
|
||||
StackPtr curSP = nullptr;
|
||||
reg_t curFP = make_reg32(0, 0);
|
||||
if (selectorType == kSelectorMethod) {
|
||||
stackType = EXEC_STACK_TYPE_CALL;
|
||||
@ -330,7 +330,7 @@ ExecStack *send_selector(EngineState *s, reg_t send_obj, reg_t work_obj, StackPt
|
||||
// those will get executed by op_ret later.
|
||||
_exec_varselectors(s);
|
||||
|
||||
return s->_executionStack.empty() ? NULL : &(s->_executionStack.back());
|
||||
return s->_executionStack.empty() ? nullptr : &(s->_executionStack.back());
|
||||
}
|
||||
|
||||
static void addKernelCallToExecStack(EngineState *s, int kernelCallNr, int kernelSubCallNr, int argc, reg_t *argv) {
|
||||
@ -383,7 +383,7 @@ static void callKernelFunc(EngineState *s, int kernelCallNr, int argc) {
|
||||
s->r_acc = kernelCall.function(s, argc, argv);
|
||||
|
||||
if (g_sci->checkKernelBreakpoint(kernelCall.name))
|
||||
logKernelCall(&kernelCall, NULL, s, argc, argv, s->r_acc);
|
||||
logKernelCall(&kernelCall, nullptr, s, argc, argv, s->r_acc);
|
||||
} else {
|
||||
// Sub-functions available, check signature and call that one directly
|
||||
if (argc < 1)
|
||||
@ -580,9 +580,9 @@ void run_vm(EngineState *s) {
|
||||
s->r_rest = 0; // &rest adjusts the parameter count by this value
|
||||
// Current execution data:
|
||||
s->xs = &(s->_executionStack.back());
|
||||
ExecStack *xs_new = NULL;
|
||||
ExecStack *xs_new = nullptr;
|
||||
Object *obj = s->_segMan->getObject(s->xs->objp);
|
||||
Script *scr = 0;
|
||||
Script *scr = nullptr;
|
||||
Script *local_script = s->_segMan->getScriptIfLoaded(s->xs->local_segment);
|
||||
int old_executionStackBase = s->executionStackBase;
|
||||
// Used to detect the stack bottom, for "physical" returns
|
||||
@ -1433,7 +1433,7 @@ void run_vm(EngineState *s) {
|
||||
|
||||
reg_t *ObjVarRef::getPointer(SegManager *segMan) const {
|
||||
Object *o = segMan->getObject(obj);
|
||||
return o ? &o->getVariableRef(varindex) : 0;
|
||||
return o ? &o->getVariableRef(varindex) : nullptr;
|
||||
}
|
||||
|
||||
reg_t *ExecStack::getVarPointer(SegManager *segMan) const {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -200,7 +200,7 @@ void GfxAnimate::makeSortedList(List *list) {
|
||||
_lastCastData.clear();
|
||||
|
||||
// Fill the list
|
||||
for (listNr = 0; curNode != 0; listNr++) {
|
||||
for (listNr = 0; curNode != nullptr; listNr++) {
|
||||
AnimateEntry listEntry;
|
||||
const reg_t curObject = curNode->value;
|
||||
listEntry.object = curObject;
|
||||
@ -255,7 +255,7 @@ void GfxAnimate::makeSortedList(List *list) {
|
||||
}
|
||||
|
||||
void GfxAnimate::fill(byte &old_picNotValid) {
|
||||
GfxView *view = NULL;
|
||||
GfxView *view = nullptr;
|
||||
AnimateList::iterator it;
|
||||
const AnimateList::iterator end = _list.end();
|
||||
|
||||
@ -576,7 +576,7 @@ void GfxAnimate::reAnimate(Common::Rect rect) {
|
||||
|
||||
void GfxAnimate::addToPicDrawCels() {
|
||||
reg_t curObject;
|
||||
GfxView *view = NULL;
|
||||
GfxView *view = nullptr;
|
||||
AnimateList::iterator it;
|
||||
const AnimateList::iterator end = _list.end();
|
||||
|
||||
|
@ -109,7 +109,7 @@ uint16 GfxCompare::kernelOnControl(byte screenMask, const Common::Rect &rect) {
|
||||
}
|
||||
|
||||
void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
|
||||
GfxView *view = NULL;
|
||||
GfxView *view = nullptr;
|
||||
Common::Rect celRect(0, 0);
|
||||
GuiResourceId viewId = (GuiResourceId)readSelectorValue(_segMan, objectReference, SELECTOR(view));
|
||||
int16 loopNo = readSelectorValue(_segMan, objectReference, SELECTOR(loop));
|
||||
@ -123,7 +123,7 @@ void GfxCompare::kernelSetNowSeen(reg_t objectReference) {
|
||||
view = _cache->getView(viewId);
|
||||
view->getCelRect(loopNo, celNo, x, y, z, celRect);
|
||||
|
||||
if (lookupSelector(_segMan, objectReference, SELECTOR(nsTop), NULL, NULL) == kSelectorVariable) {
|
||||
if (lookupSelector(_segMan, objectReference, SELECTOR(nsTop), nullptr, nullptr) == kSelectorVariable) {
|
||||
setNSRect(objectReference, celRect);
|
||||
}
|
||||
}
|
||||
@ -203,7 +203,7 @@ bool GfxCompare::kernelIsItSkip(GuiResourceId viewId, int16 loopNo, int16 celNo,
|
||||
}
|
||||
|
||||
void GfxCompare::kernelBaseSetter(reg_t object) {
|
||||
if (lookupSelector(_segMan, object, SELECTOR(brLeft), NULL, NULL) == kSelectorVariable) {
|
||||
if (lookupSelector(_segMan, object, SELECTOR(brLeft), nullptr, nullptr) == kSelectorVariable) {
|
||||
int16 x = readSelectorValue(_segMan, object, SELECTOR(x));
|
||||
int16 y = readSelectorValue(_segMan, object, SELECTOR(y));
|
||||
int16 z = (SELECTOR(z) > -1) ? readSelectorValue(_segMan, object, SELECTOR(z)) : 0;
|
||||
|
@ -52,10 +52,10 @@ GfxCursor::GfxCursor(ResourceManager *resMan, GfxPalette *palette, GfxScreen *sc
|
||||
|
||||
_zoomZoneActive = false;
|
||||
_zoomZone = Common::Rect();
|
||||
_zoomCursorView = 0;
|
||||
_zoomCursorView = nullptr;
|
||||
_zoomCursorLoop = 0;
|
||||
_zoomCursorCel = 0;
|
||||
_zoomPicView = 0;
|
||||
_zoomPicView = nullptr;
|
||||
_zoomColor = 0;
|
||||
_zoomMultiplier = 0;
|
||||
|
||||
@ -442,9 +442,9 @@ void GfxCursor::kernelClearZoomZone() {
|
||||
_zoomMultiplier = 0;
|
||||
_zoomZoneActive = false;
|
||||
delete _zoomCursorView;
|
||||
_zoomCursorView = 0;
|
||||
_zoomCursorView = nullptr;
|
||||
delete _zoomPicView;
|
||||
_zoomPicView = 0;
|
||||
_zoomPicView = nullptr;
|
||||
_cursorSurface.clear();
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ GfxMacIconBar::GfxMacIconBar() {
|
||||
else
|
||||
_inventoryIndex = 4;
|
||||
|
||||
_inventoryIcon = 0;
|
||||
_inventoryIcon = nullptr;
|
||||
_allDisabled = true;
|
||||
}
|
||||
|
||||
@ -56,7 +56,7 @@ void GfxMacIconBar::initIcons(uint16 count, reg_t *objs) {
|
||||
freeIcons();
|
||||
_iconBarItems.clear();
|
||||
_lastX = 0;
|
||||
_inventoryIcon = 0;
|
||||
_inventoryIcon = nullptr;
|
||||
_allDisabled = true;
|
||||
|
||||
for (uint16 i = 0; i < count; i++) {
|
||||
@ -93,7 +93,7 @@ void GfxMacIconBar::addIcon(reg_t obj) {
|
||||
if (iconIndex != _inventoryIndex)
|
||||
item.selectedImage = createImage(iconIndex, true);
|
||||
else
|
||||
item.selectedImage = 0;
|
||||
item.selectedImage = nullptr;
|
||||
|
||||
item.enabled = true;
|
||||
|
||||
@ -195,7 +195,7 @@ void GfxMacIconBar::setIconEnabled(int16 iconIndex, bool enabled) {
|
||||
}
|
||||
|
||||
void GfxMacIconBar::setInventoryIcon(int16 icon) {
|
||||
Graphics::Surface *surface = 0;
|
||||
Graphics::Surface *surface = nullptr;
|
||||
|
||||
if (icon >= 0)
|
||||
surface = loadPict(ResourceId(kResourceTypeMacPict, icon));
|
||||
@ -206,7 +206,7 @@ void GfxMacIconBar::setInventoryIcon(int16 icon) {
|
||||
if ((icon < 0) || surface) {
|
||||
_inventoryIcon->free();
|
||||
delete _inventoryIcon;
|
||||
_inventoryIcon = 0;
|
||||
_inventoryIcon = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,12 +220,12 @@ Graphics::Surface *GfxMacIconBar::loadPict(ResourceId id) {
|
||||
Resource *res = g_sci->getResMan()->findResource(id, false);
|
||||
|
||||
if (!res || res->size() == 0)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
Image::PICTDecoder pictDecoder;
|
||||
Common::MemoryReadStream stream(res->toStream());
|
||||
if (!pictDecoder.loadStream(stream))
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
Graphics::Surface *surface = new Graphics::Surface();
|
||||
surface->copyFrom(*pictDecoder.getSurface());
|
||||
|
@ -45,7 +45,7 @@ GfxMenu::GfxMenu(EventManager *event, SegManager *segMan, GfxPorts *ports, GfxPa
|
||||
|
||||
_menuSaveHandle = NULL_REG;
|
||||
_barSaveHandle = NULL_REG;
|
||||
_oldPort = NULL;
|
||||
_oldPort = nullptr;
|
||||
_mouseOldState = false;
|
||||
|
||||
reset();
|
||||
@ -281,7 +281,7 @@ GuiMenuItemEntry *GfxMenu::findItem(uint16 menuId, uint16 itemId) {
|
||||
|
||||
listIterator++;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GfxMenu::kernelSetAttribute(uint16 menuId, uint16 itemId, uint16 attributeId, reg_t value) {
|
||||
@ -388,7 +388,7 @@ void GfxMenu::calculateMenuWidth() {
|
||||
menuIterator = _list.begin();
|
||||
while (menuIterator != menuEnd) {
|
||||
menuEntry = *menuIterator;
|
||||
menuEntry->textSplit = g_sci->strSplit(menuEntry->text.c_str(), NULL);
|
||||
menuEntry->textSplit = g_sci->strSplit(menuEntry->text.c_str(), nullptr);
|
||||
_text16->StringWidth(menuEntry->textSplit.c_str(), 0, menuEntry->textWidth, dummyHeight);
|
||||
|
||||
menuIterator++;
|
||||
@ -408,7 +408,7 @@ void GfxMenu::calculateMenuAndItemWidth() {
|
||||
while (itemIterator != itemEnd) {
|
||||
itemEntry = *itemIterator;
|
||||
// Split the text now for multilingual SCI01 games
|
||||
itemEntry->textSplit = g_sci->strSplit(itemEntry->text.c_str(), NULL);
|
||||
itemEntry->textSplit = g_sci->strSplit(itemEntry->text.c_str(), nullptr);
|
||||
_text16->StringWidth(itemEntry->textSplit.c_str(), 0, itemEntry->textWidth, dummyHeight);
|
||||
_text16->StringWidth(itemEntry->textRightAligned.c_str(), 0, itemEntry->textRightAlignedWidth, dummyHeight);
|
||||
|
||||
@ -421,7 +421,7 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject, bool pauseSound) {
|
||||
int16 keyPress, keyModifier;
|
||||
GuiMenuItemList::iterator itemIterator = _itemList.begin();
|
||||
GuiMenuItemList::iterator itemEnd = _itemList.end();
|
||||
GuiMenuItemEntry *itemEntry = NULL;
|
||||
GuiMenuItemEntry *itemEntry = nullptr;
|
||||
bool forceClaimed = false;
|
||||
|
||||
switch (eventType) {
|
||||
@ -473,7 +473,7 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject, bool pauseSound) {
|
||||
itemIterator++;
|
||||
}
|
||||
if (itemIterator == itemEnd)
|
||||
itemEntry = NULL;
|
||||
itemEntry = nullptr;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -495,7 +495,7 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject, bool pauseSound) {
|
||||
itemIterator++;
|
||||
}
|
||||
if (itemIterator == itemEnd)
|
||||
itemEntry = NULL;
|
||||
itemEntry = nullptr;
|
||||
break;
|
||||
|
||||
case kSciEventMousePress: {
|
||||
@ -530,7 +530,7 @@ reg_t GfxMenu::kernelSelect(reg_t eventObject, bool pauseSound) {
|
||||
}
|
||||
if (_oldPort) {
|
||||
_ports->setPort(_oldPort);
|
||||
_oldPort = NULL;
|
||||
_oldPort = nullptr;
|
||||
}
|
||||
|
||||
if ((itemEntry) || (forceClaimed))
|
||||
@ -544,8 +544,8 @@ GuiMenuItemEntry *GfxMenu::interactiveGetItem(uint16 menuId, uint16 itemId, bool
|
||||
GuiMenuItemList::iterator itemIterator = _itemList.begin();
|
||||
GuiMenuItemList::iterator itemEnd = _itemList.end();
|
||||
GuiMenuItemEntry *itemEntry;
|
||||
GuiMenuItemEntry *firstItemEntry = NULL;
|
||||
GuiMenuItemEntry *lastItemEntry = NULL;
|
||||
GuiMenuItemEntry *firstItemEntry = nullptr;
|
||||
GuiMenuItemEntry *lastItemEntry = nullptr;
|
||||
|
||||
// Fixup menuId if needed
|
||||
if (menuId > _list.size())
|
||||
@ -843,7 +843,7 @@ GuiMenuItemEntry *GfxMenu::interactiveWithKeyboard() {
|
||||
switch (curEvent.character) {
|
||||
case kSciKeyEsc:
|
||||
_curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
case kSciKeyEnter:
|
||||
if (curItemEntry->enabled) {
|
||||
_curMenuId = curItemEntry->menuId; _curItemId = curItemEntry->id;
|
||||
@ -935,7 +935,7 @@ GuiMenuItemEntry *GfxMenu::interactiveWithKeyboard() {
|
||||
break;
|
||||
|
||||
case kSciEventQuit:
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
default:
|
||||
break;
|
||||
@ -952,7 +952,7 @@ GuiMenuItemEntry *GfxMenu::interactiveWithMouse() {
|
||||
uint16 newMenuId = 0, newItemId = 0;
|
||||
uint16 curMenuId = 0, curItemId = 0;
|
||||
bool firstMenuChange = true;
|
||||
GuiMenuItemEntry *curItemEntry = NULL;
|
||||
GuiMenuItemEntry *curItemEntry = nullptr;
|
||||
|
||||
_oldPort = _ports->setPort(_ports->_menuPort);
|
||||
calculateMenuAndItemWidth();
|
||||
@ -970,9 +970,9 @@ GuiMenuItemEntry *GfxMenu::interactiveWithMouse() {
|
||||
switch (curEvent.type) {
|
||||
case kSciEventMouseRelease:
|
||||
if ((curMenuId == 0) || (curItemId == 0))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if ((!curItemEntry->enabled) || (curItemEntry->separatorLine))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
return curItemEntry;
|
||||
|
||||
case kSciEventNone:
|
||||
@ -1013,7 +1013,7 @@ GuiMenuItemEntry *GfxMenu::interactiveWithMouse() {
|
||||
}
|
||||
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GfxMenu::kernelDrawStatus(const char *text, int16 colorPen, int16 colorBack) {
|
||||
|
@ -49,8 +49,8 @@ GfxPaint16::GfxPaint16(ResourceManager *resMan, SegManager *segMan, GfxCache *ca
|
||||
_transitions(transitions), _audio(audio), _EGAdrawingVisualize(false) {
|
||||
|
||||
// _animate and _text16 will be initialized later on
|
||||
_animate = NULL;
|
||||
_text16 = NULL;
|
||||
_animate = nullptr;
|
||||
_text16 = nullptr;
|
||||
}
|
||||
|
||||
GfxPaint16::~GfxPaint16() {
|
||||
@ -145,7 +145,7 @@ void GfxPaint16::drawHiresCelAndShow(GuiResourceId viewId, int16 loopNo, int16 c
|
||||
// need to get coordinates from upscaledHiresHandle. I'm not sure if
|
||||
// this is what we are supposed to do or if there is some other bug
|
||||
// that actually makes coordinates to be 0 in the first place.
|
||||
byte *memoryPtr = NULL;
|
||||
byte *memoryPtr = nullptr;
|
||||
memoryPtr = _segMan->getHunkPointer(upscaledHiresHandle);
|
||||
if (memoryPtr) {
|
||||
Common::Rect upscaledHiresRect;
|
||||
@ -350,7 +350,7 @@ reg_t GfxPaint16::bitsSave(const Common::Rect &rect, byte screenMask) {
|
||||
}
|
||||
|
||||
void GfxPaint16::bitsGetRect(reg_t memoryHandle, Common::Rect *destRect) {
|
||||
byte *memoryPtr = NULL;
|
||||
byte *memoryPtr = nullptr;
|
||||
|
||||
if (!memoryHandle.isNull()) {
|
||||
memoryPtr = _segMan->getHunkPointer(memoryHandle);
|
||||
@ -362,7 +362,7 @@ void GfxPaint16::bitsGetRect(reg_t memoryHandle, Common::Rect *destRect) {
|
||||
}
|
||||
|
||||
void GfxPaint16::bitsRestore(reg_t memoryHandle) {
|
||||
byte *memoryPtr = NULL;
|
||||
byte *memoryPtr = nullptr;
|
||||
|
||||
if (!memoryHandle.isNull()) {
|
||||
memoryPtr = _segMan->getHunkPointer(memoryHandle);
|
||||
|
@ -82,7 +82,7 @@ GfxPalette::GfxPalette(ResourceManager *resMan, GfxScreen *screen)
|
||||
|
||||
palVaryInit();
|
||||
|
||||
_macClut = 0;
|
||||
_macClut = nullptr;
|
||||
loadMacIconBarPalette();
|
||||
|
||||
switch (_resMan->getViewType()) {
|
||||
|
@ -128,7 +128,7 @@ void GfxPorts::init(bool usesOldGfxFunctions, GfxPaint16 *paint16, GfxText16 *te
|
||||
_wmgrPort->curLeft = 0;
|
||||
_windowList.push_front(_wmgrPort);
|
||||
|
||||
_picWind = addWindow(Common::Rect(0, offTop, _screen->getScriptWidth(), _screen->getScriptHeight()), 0, 0, SCI_WINDOWMGR_STYLE_TRANSPARENT | SCI_WINDOWMGR_STYLE_NOFRAME, 0, true);
|
||||
_picWind = addWindow(Common::Rect(0, offTop, _screen->getScriptWidth(), _screen->getScriptHeight()), nullptr, nullptr, SCI_WINDOWMGR_STYLE_TRANSPARENT | SCI_WINDOWMGR_STYLE_NOFRAME, 0, true);
|
||||
// For SCI0 games till kq4 (.502 - not including) we set _picWind top to offTop instead
|
||||
// Because of the menu/status bar
|
||||
if (_usesOldGfxFunctions)
|
||||
@ -210,12 +210,12 @@ reg_t GfxPorts::kernelGetActive() {
|
||||
}
|
||||
|
||||
reg_t GfxPorts::kernelNewWindow(Common::Rect dims, Common::Rect restoreRect, uint16 style, int16 priority, int16 colorPen, int16 colorBack, const char *title) {
|
||||
Window *wnd = NULL;
|
||||
Window *wnd = nullptr;
|
||||
|
||||
if (restoreRect.bottom != 0 && restoreRect.right != 0)
|
||||
wnd = addWindow(dims, &restoreRect, title, style, priority, false);
|
||||
else
|
||||
wnd = addWindow(dims, NULL, title, style, priority, false);
|
||||
wnd = addWindow(dims, nullptr, title, style, priority, false);
|
||||
wnd->penClr = colorPen;
|
||||
wnd->backClr = colorBack;
|
||||
drawWindow(wnd);
|
||||
@ -422,7 +422,7 @@ Window *GfxPorts::addWindow(const Common::Rect &dims, const Common::Rect *restor
|
||||
|
||||
pwnd->rect.moveTo(pwnd->rect.left + pwnd->dims.left - oldleft, pwnd->rect.top + pwnd->dims.top - oldtop);
|
||||
|
||||
if (restoreRect == 0)
|
||||
if (restoreRect == nullptr)
|
||||
pwnd->restoreRect = pwnd->dims;
|
||||
|
||||
if (pwnd->restoreRect.top < 0 && g_sci->getPlatform() == Common::kPlatformMacintosh &&
|
||||
|
@ -181,7 +181,7 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
|
||||
Graphics::PixelFormat format8 = Graphics::PixelFormat::createFormatCLUT8();
|
||||
const Graphics::PixelFormat *format = &format8;
|
||||
if (ConfMan.getBool("rgb_rendering"))
|
||||
format = 0; // Backend's preferred mode; RGB if available
|
||||
format = nullptr; // Backend's preferred mode; RGB if available
|
||||
|
||||
if (g_sci->hasMacIconBar()) {
|
||||
// For SCI1.1 Mac games with the custom icon bar, we need to expand the screen
|
||||
@ -209,14 +209,14 @@ GfxScreen::GfxScreen(ResourceManager *resMan) : _resMan(resMan) {
|
||||
if (_paletteModsEnabled)
|
||||
_paletteMapScreen = (byte *)calloc(_displayPixels, 1);
|
||||
else
|
||||
_paletteMapScreen = 0;
|
||||
_paletteMapScreen = nullptr;
|
||||
} else {
|
||||
_displayedScreen = 0;
|
||||
_palette = 0;
|
||||
_rgbScreen = 0;
|
||||
_paletteMapScreen = 0;
|
||||
_displayedScreen = nullptr;
|
||||
_palette = nullptr;
|
||||
_rgbScreen = nullptr;
|
||||
_paletteMapScreen = nullptr;
|
||||
}
|
||||
_backupScreen = 0;
|
||||
_backupScreen = nullptr;
|
||||
}
|
||||
|
||||
GfxScreen::~GfxScreen() {
|
||||
@ -908,7 +908,7 @@ int16 *GfxScreen::unditherGetDitheredBgColors() {
|
||||
if (_unditheringEnabled)
|
||||
return _ditheredPicColors;
|
||||
else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GfxScreen::debugShowMap(int mapNo) {
|
||||
|
@ -49,10 +49,10 @@ GfxText16::~GfxText16() {
|
||||
}
|
||||
|
||||
void GfxText16::init() {
|
||||
_font = NULL;
|
||||
_codeFonts = NULL;
|
||||
_font = nullptr;
|
||||
_codeFonts = nullptr;
|
||||
_codeFontsCount = 0;
|
||||
_codeColors = NULL;
|
||||
_codeColors = nullptr;
|
||||
_codeColorsCount = 0;
|
||||
_useEarlyGetLongestTextCalculations = g_sci->_features->useEarlyGetLongestTextCalculations();
|
||||
}
|
||||
@ -62,14 +62,14 @@ GuiResourceId GfxText16::GetFontId() {
|
||||
}
|
||||
|
||||
GfxFont *GfxText16::GetFont() {
|
||||
if ((_font == NULL) || (_font->getResourceId() != _ports->_curPort->fontId))
|
||||
if ((_font == nullptr) || (_font->getResourceId() != _ports->_curPort->fontId))
|
||||
_font = _cache->getFont(_ports->_curPort->fontId);
|
||||
|
||||
return _font;
|
||||
}
|
||||
|
||||
void GfxText16::SetFont(GuiResourceId fontId) {
|
||||
if ((_font == NULL) || (_font->getResourceId() != fontId))
|
||||
if ((_font == nullptr) || (_font->getResourceId() != fontId))
|
||||
_font = _cache->getFont(fontId);
|
||||
|
||||
_ports->_curPort->fontId = _font->getResourceId();
|
||||
@ -103,7 +103,7 @@ int16 GfxText16::CodeProcessing(const char *&text, GuiResourceId orgFontId, int1
|
||||
// c -> sets textColor to current port pen color
|
||||
// cX -> sets textColor to _textColors[X-1]
|
||||
curCode = textCode[0];
|
||||
curCodeParm = strtol(textCode+1, NULL, 10);
|
||||
curCodeParm = strtol(textCode+1, nullptr, 10);
|
||||
if (!Common::isDigit(textCode[1])) {
|
||||
curCodeParm = -1;
|
||||
}
|
||||
@ -196,7 +196,7 @@ static const uint16 text16_shiftJIS_punctuation_SCI01[] = {
|
||||
int16 GfxText16::GetLongest(const char *&textPtr, int16 maxWidth, GuiResourceId orgFontId) {
|
||||
uint16 curChar = 0;
|
||||
const char *textStartPtr = textPtr;
|
||||
const char *lastSpacePtr = NULL;
|
||||
const char *lastSpacePtr = nullptr;
|
||||
int16 lastSpaceCharCount = 0;
|
||||
int16 curCharCount = 0, resultCharCount = 0;
|
||||
uint16 curWidth = 0, tempWidth = 0;
|
||||
|
@ -103,7 +103,7 @@ void GfxTransitions::init() {
|
||||
_oldScreen = new byte[_screen->getDisplayHeight() * _screen->getDisplayWidth()];
|
||||
|
||||
if (getSciVersion() >= SCI_VERSION_1_LATE)
|
||||
_translationTable = NULL;
|
||||
_translationTable = nullptr;
|
||||
else
|
||||
_translationTable = oldTransitionIDs;
|
||||
|
||||
@ -156,7 +156,7 @@ void GfxTransitions::updateScreenAndWait(uint32 shouldBeAtMsec) {
|
||||
const GfxTransitionTranslateEntry *GfxTransitions::translateNumber (int16 number, const GfxTransitionTranslateEntry *tablePtr) {
|
||||
while (1) {
|
||||
if (tablePtr->orgId == 255)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (tablePtr->orgId == number)
|
||||
return tablePtr;
|
||||
tablePtr++;
|
||||
|
@ -419,7 +419,7 @@ uint16 GfxView::getCelCount(int16 loopNo) const {
|
||||
}
|
||||
|
||||
Palette *GfxView::getPalette() {
|
||||
return _embeddedPal ? &_viewPalette : NULL;
|
||||
return _embeddedPal ? &_viewPalette : nullptr;
|
||||
}
|
||||
|
||||
bool GfxView::isScaleable() {
|
||||
|
@ -508,7 +508,7 @@ static char s_fallbackGameIdBuf[256];
|
||||
static ADGameDescription s_fallbackDesc = {
|
||||
"",
|
||||
"",
|
||||
AD_ENTRY1(0, 0), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor
|
||||
AD_ENTRY1(nullptr, nullptr), // This should always be AD_ENTRY1(0, 0) in the fallback descriptor
|
||||
Common::UNK_LANG,
|
||||
Common::kPlatformDOS,
|
||||
ADGF_NO_FLAGS,
|
||||
|
@ -71,7 +71,7 @@ struct ParseRuleList {
|
||||
|
||||
void print() const;
|
||||
|
||||
ParseRuleList(ParseRule *r) : rule(r), next(0) {
|
||||
ParseRuleList(ParseRule *r) : rule(r), next(nullptr) {
|
||||
int term = rule->_data[rule->_firstSpecial];
|
||||
terminal = ((term & TOKEN_TERMINAL) ? term : 0);
|
||||
}
|
||||
@ -150,7 +150,7 @@ static ParseRule *_vinsert(ParseRule *turkey, ParseRule *stuffing) {
|
||||
|
||||
// If no TOKEN_NON_NT found, or if it doesn't match the id of 'stuffing', abort.
|
||||
if ((firstnt == turkey->_data.size()) || (turkey->_data[firstnt] != stuffing->_id))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
// Create a new rule as a copy of 'turkey', where the token firstnt has been substituted
|
||||
// by the rule 'stuffing'.
|
||||
@ -183,7 +183,7 @@ static ParseRule *_vbuild_rule(const parse_tree_branch_t *branch) {
|
||||
else if (type > VOCAB_TREE_NODE_LAST_WORD_STORAGE)
|
||||
tokens += 5;
|
||||
else
|
||||
return NULL; // invalid
|
||||
return nullptr; // invalid
|
||||
}
|
||||
|
||||
ParseRule *rule = new ParseRule();
|
||||
@ -225,7 +225,7 @@ static ParseRule *_vsatisfy_rule(ParseRule *rule, const ResultWordList &input) {
|
||||
int dep;
|
||||
|
||||
if (!rule->_numSpecials)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
dep = rule->_data[rule->_firstSpecial];
|
||||
|
||||
@ -270,7 +270,7 @@ static ParseRule *_vsatisfy_rule(ParseRule *rule, const ResultWordList &input) {
|
||||
|
||||
return retval;
|
||||
} else
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Vocabulary::freeRuleList(ParseRuleList *list) {
|
||||
@ -332,7 +332,7 @@ static ParseRuleList *_vocab_split_rule_list(ParseRuleList *list) {
|
||||
assert(list);
|
||||
if (!list->next || (list->next->terminal)) {
|
||||
ParseRuleList *tmp = list->next;
|
||||
list->next = NULL;
|
||||
list->next = nullptr;
|
||||
return tmp;
|
||||
} else
|
||||
return _vocab_split_rule_list(list->next);
|
||||
@ -342,8 +342,8 @@ static void _vocab_free_empty_rule_list(ParseRuleList *list) {
|
||||
assert(list);
|
||||
if (list->next)
|
||||
_vocab_free_empty_rule_list(list->next);
|
||||
list->next = 0;
|
||||
list->rule = 0;
|
||||
list->next = nullptr;
|
||||
list->rule = nullptr;
|
||||
delete list;
|
||||
}
|
||||
|
||||
@ -363,7 +363,7 @@ static int _vocab_rule_list_length(ParseRuleList *list) {
|
||||
}
|
||||
|
||||
static ParseRuleList *_vocab_clone_rule_list_by_id(ParseRuleList *list, int id) {
|
||||
ParseRuleList *result = NULL;
|
||||
ParseRuleList *result = nullptr;
|
||||
ParseRuleList *seeker = list;
|
||||
|
||||
while (seeker) {
|
||||
@ -380,7 +380,7 @@ ParseRuleList *Vocabulary::buildGNF(bool verbose) {
|
||||
int iterations = 0;
|
||||
int termrules = 0;
|
||||
int ntrules_nr;
|
||||
ParseRuleList *ntlist = NULL;
|
||||
ParseRuleList *ntlist = nullptr;
|
||||
ParseRuleList *tlist, *new_tlist;
|
||||
Console *con = g_sci->getSciDebugger();
|
||||
|
||||
@ -388,7 +388,7 @@ ParseRuleList *Vocabulary::buildGNF(bool verbose) {
|
||||
ParseRule *rule = _vbuild_rule(&_parserBranches[i]);
|
||||
if (!rule) {
|
||||
freeRuleList(ntlist);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
ntlist = _vocab_add_rule(ntlist, rule);
|
||||
}
|
||||
@ -400,10 +400,10 @@ ParseRuleList *Vocabulary::buildGNF(bool verbose) {
|
||||
con->debugPrintf("Starting with %d rules\n", ntrules_nr);
|
||||
|
||||
new_tlist = tlist;
|
||||
tlist = NULL;
|
||||
tlist = nullptr;
|
||||
|
||||
do {
|
||||
ParseRuleList *new_new_tlist = NULL;
|
||||
ParseRuleList *new_new_tlist = nullptr;
|
||||
ParseRuleList *ntseeker, *tseeker;
|
||||
|
||||
ntseeker = ntlist;
|
||||
@ -437,7 +437,7 @@ ParseRuleList *Vocabulary::buildGNF(bool verbose) {
|
||||
con->debugPrintf("%d allocd rules\n", _allocd_rules);
|
||||
con->debugPrintf("Freeing rule list...\n");
|
||||
freeRuleList(tlist);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return tlist;
|
||||
@ -447,8 +447,8 @@ static int _vbpt_pareno(ParseTreeNode *nodes, int *pos, int base) {
|
||||
// Opens parentheses
|
||||
nodes[base].left = &nodes[(*pos) + 1];
|
||||
nodes[++(*pos)].type = kParseTreeBranchNode;
|
||||
nodes[*pos].left = 0;
|
||||
nodes[*pos].right = 0;
|
||||
nodes[*pos].left = nullptr;
|
||||
nodes[*pos].right = nullptr;
|
||||
return *pos;
|
||||
}
|
||||
|
||||
@ -456,8 +456,8 @@ static int _vbpt_parenc(ParseTreeNode *nodes, int *pos, int paren) {
|
||||
// Closes parentheses for appending
|
||||
nodes[paren].right = &nodes[++(*pos)];
|
||||
nodes[*pos].type = kParseTreeBranchNode;
|
||||
nodes[*pos].left = 0;
|
||||
nodes[*pos].right = 0;
|
||||
nodes[*pos].left = nullptr;
|
||||
nodes[*pos].right = nullptr;
|
||||
return *pos;
|
||||
}
|
||||
|
||||
@ -466,11 +466,11 @@ static int _vbpt_append(ParseTreeNode *nodes, int *pos, int base, int value) {
|
||||
nodes[base].left = &nodes[++(*pos)];
|
||||
nodes[*pos].type = kParseTreeLeafNode;
|
||||
nodes[*pos].value = value;
|
||||
nodes[*pos].right = 0;
|
||||
nodes[*pos].right = nullptr;
|
||||
nodes[base].right = &nodes[++(*pos)];
|
||||
nodes[*pos].type = kParseTreeBranchNode;
|
||||
nodes[*pos].left = 0;
|
||||
nodes[*pos].right = 0;
|
||||
nodes[*pos].left = nullptr;
|
||||
nodes[*pos].right = nullptr;
|
||||
return *pos;
|
||||
}
|
||||
|
||||
@ -478,7 +478,7 @@ static int _vbpt_terminate(ParseTreeNode *nodes, int *pos, int base, int value)
|
||||
// Terminates, overwriting a nextwrite forknode
|
||||
nodes[base].type = kParseTreeLeafNode;
|
||||
nodes[base].value = value;
|
||||
nodes[base].right = 0;
|
||||
nodes[base].right = nullptr;
|
||||
return *pos;
|
||||
}
|
||||
static int _vbpt_append_word(ParseTreeNode *nodes, int *pos, int base, int value) {
|
||||
@ -487,8 +487,8 @@ static int _vbpt_append_word(ParseTreeNode *nodes, int *pos, int base, int value
|
||||
nodes[base].value = value;
|
||||
nodes[base].right = &nodes[++(*pos)];
|
||||
nodes[*pos].type = kParseTreeBranchNode;
|
||||
nodes[*pos].left = 0;
|
||||
nodes[*pos].right = 0;
|
||||
nodes[*pos].left = nullptr;
|
||||
nodes[*pos].right = nullptr;
|
||||
return *pos;
|
||||
}
|
||||
|
||||
@ -496,7 +496,7 @@ static int _vbpt_terminate_word(ParseTreeNode *nodes, int *pos, int base, int va
|
||||
// Terminates, overwriting a nextwrite forknode
|
||||
nodes[base].type = kParseTreeWordNode;
|
||||
nodes[base].value = value;
|
||||
nodes[base].right = 0;
|
||||
nodes[base].right = nullptr;
|
||||
return *pos;
|
||||
}
|
||||
|
||||
@ -537,14 +537,14 @@ int Vocabulary::parseGNF(const ResultWordListList &words, bool verbose) {
|
||||
Console *con = g_sci->getSciDebugger();
|
||||
// Get the start rules:
|
||||
ParseRuleList *work = _vocab_clone_rule_list_by_id(_parserRules, _parserBranches[0].data[1]);
|
||||
ParseRuleList *results = NULL;
|
||||
ParseRuleList *results = nullptr;
|
||||
uint word = 0;
|
||||
const uint words_nr = words.size();
|
||||
ResultWordListList::const_iterator words_iter;
|
||||
|
||||
for (words_iter = words.begin(); words_iter != words.end(); ++words_iter, ++word) {
|
||||
ParseRuleList *new_work = NULL;
|
||||
ParseRuleList *reduced_rules = NULL;
|
||||
ParseRuleList *new_work = nullptr;
|
||||
ParseRuleList *reduced_rules = nullptr;
|
||||
ParseRuleList *seeker, *subseeker;
|
||||
|
||||
if (verbose)
|
||||
@ -559,7 +559,7 @@ int Vocabulary::parseGNF(const ResultWordListList &words, bool verbose) {
|
||||
seeker = seeker->next;
|
||||
}
|
||||
|
||||
if (reduced_rules == NULL) {
|
||||
if (reduced_rules == nullptr) {
|
||||
freeRuleList(work);
|
||||
if (verbose)
|
||||
con->debugPrintf("No results.\n");
|
||||
@ -593,7 +593,7 @@ int Vocabulary::parseGNF(const ResultWordListList &words, bool verbose) {
|
||||
work = new_work;
|
||||
if (verbose)
|
||||
con->debugPrintf("Now at %d candidates\n", _vocab_rule_list_length(work));
|
||||
if (work == NULL) {
|
||||
if (work == nullptr) {
|
||||
if (verbose)
|
||||
con->debugPrintf("No results.\n");
|
||||
return 1;
|
||||
@ -618,11 +618,11 @@ int Vocabulary::parseGNF(const ResultWordListList &words, bool verbose) {
|
||||
|
||||
_parserNodes[1].type = kParseTreeLeafNode;
|
||||
_parserNodes[1].value = 0x141;
|
||||
_parserNodes[1].right = 0;
|
||||
_parserNodes[1].right = nullptr;
|
||||
|
||||
_parserNodes[2].type = kParseTreeBranchNode;
|
||||
_parserNodes[2].left = 0;
|
||||
_parserNodes[2].right = 0;
|
||||
_parserNodes[2].left = nullptr;
|
||||
_parserNodes[2].right = nullptr;
|
||||
|
||||
pos = 2;
|
||||
|
||||
|
@ -91,7 +91,7 @@ static ParseTreeNode* said_next_node() {
|
||||
static ParseTreeNode* said_leaf_node(ParseTreeNode* pos, int value) {
|
||||
pos->type = kParseTreeLeafNode;
|
||||
pos->value = value;
|
||||
pos->right = 0;
|
||||
pos->right = nullptr;
|
||||
|
||||
return pos;
|
||||
}
|
||||
@ -99,7 +99,7 @@ static ParseTreeNode* said_leaf_node(ParseTreeNode* pos, int value) {
|
||||
static ParseTreeNode* said_word_node(ParseTreeNode* pos, int value) {
|
||||
pos->type = kParseTreeWordNode;
|
||||
pos->value = value;
|
||||
pos->right = 0;
|
||||
pos->right = nullptr;
|
||||
|
||||
return pos;
|
||||
}
|
||||
@ -163,7 +163,7 @@ static bool said_attach_subtree(ParseTreeNode* pos, int major, int minor,
|
||||
said_leaf_node(said_next_node(), major),
|
||||
said_branch_attach_left(subtree,
|
||||
said_leaf_node(said_next_node(), minor))),
|
||||
0));
|
||||
nullptr));
|
||||
|
||||
return retval;
|
||||
}
|
||||
@ -206,7 +206,7 @@ static bool parsePart2(ParseTreeNode* parentNode, bool& nonempty) {
|
||||
int curTreePos = said_tree_pos;
|
||||
ParseTreeNode* curRightChild = parentNode->right;
|
||||
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), 0, 0);
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), nullptr, nullptr);
|
||||
|
||||
nonempty = true;
|
||||
|
||||
@ -263,7 +263,7 @@ static bool parsePart3(ParseTreeNode* parentNode, bool& nonempty) {
|
||||
int curTreePos = said_tree_pos;
|
||||
ParseTreeNode* curRightChild = parentNode->right;
|
||||
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), 0, 0);
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), nullptr, nullptr);
|
||||
|
||||
bool found;
|
||||
|
||||
@ -345,7 +345,7 @@ static bool parseRef(ParseTreeNode* parentNode) {
|
||||
int curTreePos = said_tree_pos;
|
||||
ParseTreeNode* curRightChild = parentNode->right;
|
||||
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), 0, 0);
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), nullptr, nullptr);
|
||||
|
||||
ParseTreeNode* newParent = parentNode;
|
||||
|
||||
@ -362,7 +362,7 @@ static bool parseRef(ParseTreeNode* parentNode) {
|
||||
|
||||
newParent = newParent->right;
|
||||
|
||||
newNode = said_branch_node(said_next_node(), 0, 0);
|
||||
newNode = said_branch_node(said_next_node(), nullptr, nullptr);
|
||||
|
||||
found = parseRef(newNode);
|
||||
|
||||
@ -435,7 +435,7 @@ static bool parseListEntry(ParseTreeNode* parentNode) {
|
||||
int curTreePos = said_tree_pos;
|
||||
ParseTreeNode* curRightChild = parentNode->right;
|
||||
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), 0, 0);
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), nullptr, nullptr);
|
||||
|
||||
bool found;
|
||||
|
||||
@ -522,7 +522,7 @@ static bool parseExpr(ParseTreeNode* parentNode) {
|
||||
int curTreePos = said_tree_pos;
|
||||
ParseTreeNode* curRightChild = parentNode->right;
|
||||
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), 0, 0);
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), nullptr, nullptr);
|
||||
|
||||
bool ret = false;
|
||||
bool found;
|
||||
@ -557,7 +557,7 @@ static bool parseSpec(ParseTreeNode* parentNode) {
|
||||
int curTreePos = said_tree_pos;
|
||||
ParseTreeNode* curRightChild = parentNode->right;
|
||||
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), 0, 0);
|
||||
ParseTreeNode* newNode = said_branch_node(said_next_node(), nullptr, nullptr);
|
||||
|
||||
bool ret = false;
|
||||
|
||||
@ -600,7 +600,7 @@ static bool parseSpec(ParseTreeNode* parentNode) {
|
||||
if (said_tokens[said_token] == TOKEN_GT) {
|
||||
said_token++;
|
||||
|
||||
newNode = said_branch_node(said_next_node(), 0,
|
||||
newNode = said_branch_node(said_next_node(), nullptr,
|
||||
said_leaf_node(said_next_node(), TOKEN_GT));
|
||||
|
||||
said_attach_subtree(newParent, 0x14B, TOKEN_GT, newNode);
|
||||
@ -622,7 +622,7 @@ static bool parseSpec(ParseTreeNode* parentNode) {
|
||||
static bool buildSaidTree() {
|
||||
said_branch_node(said_tree, &said_tree[1], &said_tree[2]);
|
||||
said_leaf_node(&said_tree[1], 0x141); // Magic number #1
|
||||
said_branch_node(&said_tree[2], &said_tree[3], 0);
|
||||
said_branch_node(&said_tree[2], &said_tree[3], nullptr);
|
||||
said_leaf_node(&said_tree[3], 0x13f); // Magic number #2
|
||||
|
||||
said_tree_pos = SAID_TREE_START;
|
||||
@ -636,7 +636,7 @@ static bool buildSaidTree() {
|
||||
// No terminator, so parse error.
|
||||
|
||||
// Rollback
|
||||
said_tree[2].right = 0;
|
||||
said_tree[2].right = nullptr;
|
||||
said_token = 0;
|
||||
said_tree_pos = SAID_TREE_START;
|
||||
return false;
|
||||
|
@ -31,13 +31,13 @@
|
||||
namespace Sci {
|
||||
|
||||
Vocabulary::Vocabulary(ResourceManager *resMan, bool foreign) : _resMan(resMan), _foreign(foreign) {
|
||||
_parserRules = NULL;
|
||||
_parserRules = nullptr;
|
||||
|
||||
memset(_parserNodes, 0, sizeof(_parserNodes));
|
||||
// Mark parse tree as unused
|
||||
_parserNodes[0].type = kParseTreeLeafNode;
|
||||
_parserNodes[0].value = 0;
|
||||
_parserNodes[0].right = 0;
|
||||
_parserNodes[0].right = nullptr;
|
||||
|
||||
_synonyms.clear(); // No synonyms
|
||||
|
||||
@ -67,7 +67,7 @@ Vocabulary::Vocabulary(ResourceManager *resMan, bool foreign) : _resMan(resMan),
|
||||
_parserRules = buildGNF();
|
||||
} else {
|
||||
debug(2, "Assuming that this game does not use a parser.");
|
||||
_parserRules = NULL;
|
||||
_parserRules = nullptr;
|
||||
}
|
||||
|
||||
loadAltInputs();
|
||||
@ -661,7 +661,7 @@ bool Vocabulary::tokenizeString(ResultWordListList &retval, const char *sentence
|
||||
unsigned char c;
|
||||
int wordLen = 0;
|
||||
|
||||
*error = NULL;
|
||||
*error = nullptr;
|
||||
|
||||
do {
|
||||
c = sentence[pos_in_sentence++];
|
||||
@ -826,7 +826,7 @@ int Vocabulary::parseNodes(int *i, int *pos, int type, int nr, int argc, const c
|
||||
if (type == kParseNumber) {
|
||||
_parserNodes[*pos += 1].type = kParseTreeLeafNode;
|
||||
_parserNodes[*pos].value = nr;
|
||||
_parserNodes[*pos].right = 0;
|
||||
_parserNodes[*pos].right = nullptr;
|
||||
return *pos;
|
||||
}
|
||||
if (type == kParseEndOfInput) {
|
||||
@ -853,7 +853,7 @@ int Vocabulary::parseNodes(int *i, int *pos, int type, int nr, int argc, const c
|
||||
} else if (!strcmp(token, "nil")) {
|
||||
nextToken = kParseNil;
|
||||
} else {
|
||||
nextValue = strtol(token, NULL, 0);
|
||||
nextValue = strtol(token, nullptr, 0);
|
||||
nextToken = kParseNumber;
|
||||
}
|
||||
}
|
||||
@ -899,7 +899,7 @@ static ParseTreeNode* scanForMajor(ParseTreeNode *tree, int major) {
|
||||
if (node_major(tree) == major)
|
||||
return tree;
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ParseTreeNode* ptr = tree->right;
|
||||
@ -913,12 +913,12 @@ static ParseTreeNode* scanForMajor(ParseTreeNode *tree, int major) {
|
||||
}
|
||||
|
||||
if (major == 0x141)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
// If not found, go into a 0x141 and try again
|
||||
tree = scanForMajor(tree, 0x141);
|
||||
if (!tree)
|
||||
return 0;
|
||||
return nullptr;
|
||||
return scanForMajor(tree, major);
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ void DecompressorLZW::init(Common::ReadStream *src, byte *dest, uint32 nPacked,
|
||||
|
||||
int DecompressorLZW::unpack(Common::ReadStream *src, byte *dest, uint32 nPacked,
|
||||
uint32 nUnpacked) {
|
||||
byte *buffer = NULL;
|
||||
byte *buffer = nullptr;
|
||||
|
||||
switch (_compression) {
|
||||
case kCompLZW: // SCI0 LZW compression
|
||||
|
@ -303,7 +303,7 @@ ResourceSource *ResourceManager::addPatchDir(const Common::String &dirname) {
|
||||
ResourceSource *newsrc = new DirectoryResourceSource(dirname);
|
||||
|
||||
_sources.push_back(newsrc);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ResourceSource *ResourceManager::findVolume(ResourceSource *map, int volume_nr) {
|
||||
@ -313,7 +313,7 @@ ResourceSource *ResourceManager::findVolume(ResourceSource *map, int volume_nr)
|
||||
return src;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Resource manager constructors and operations
|
||||
@ -402,7 +402,7 @@ Common::SeekableReadStream *ResourceManager::getVolumeFile(ResourceSource *sourc
|
||||
}
|
||||
// failed
|
||||
delete file;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ResourceManager::disposeVolumeFileStream(Common::SeekableReadStream *fileStream, Sci::ResourceSource *source) {
|
||||
@ -445,7 +445,7 @@ static Common::Array<uint32> resTypeToMacTags(ResourceType type);
|
||||
|
||||
void MacResourceForkResourceSource::loadResource(ResourceManager *resMan, Resource *res) {
|
||||
ResourceType type = res->getType();
|
||||
Common::SeekableReadStream *stream = 0;
|
||||
Common::SeekableReadStream *stream = nullptr;
|
||||
|
||||
if (type == kResourceTypeAudio36 || type == kResourceTypeSync36) {
|
||||
// Handle audio36/sync36, convert back to audio/sync
|
||||
@ -749,7 +749,7 @@ int ResourceManager::addAppropriateSources() {
|
||||
}
|
||||
|
||||
int ResourceManager::addAppropriateSourcesForDetection(const Common::FSList &fslist) {
|
||||
ResourceSource *map = 0;
|
||||
ResourceSource *map = nullptr;
|
||||
Common::Array<ResourceSource *> sci21Maps;
|
||||
|
||||
#ifdef ENABLE_SCI32
|
||||
@ -1013,7 +1013,7 @@ void ResourceManager::init() {
|
||||
_memoryLRU = 0;
|
||||
_LRU.clear();
|
||||
_resMap.clear();
|
||||
_audioMapSCI1 = NULL;
|
||||
_audioMapSCI1 = nullptr;
|
||||
#ifdef ENABLE_SCI32
|
||||
_currentDiscNo = 1;
|
||||
#endif
|
||||
@ -1021,7 +1021,7 @@ void ResourceManager::init() {
|
||||
_patcher = new ResourcePatcher(g_sci->getGameId(), g_sci->getLanguage());
|
||||
addSource(_patcher);
|
||||
} else {
|
||||
_patcher = NULL;
|
||||
_patcher = nullptr;
|
||||
};
|
||||
|
||||
// FIXME: put this in an Init() function, so that we can error out if detection fails completely
|
||||
@ -1214,7 +1214,7 @@ Resource *ResourceManager::findResource(ResourceId id, bool lock) {
|
||||
Resource *retval = testResource(id);
|
||||
|
||||
if (!retval)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (retval->_status == kResStatusNoMalloc)
|
||||
loadResource(retval);
|
||||
@ -1296,9 +1296,9 @@ const char *ResourceManager::versionDescription(ResVersion version) const {
|
||||
}
|
||||
|
||||
ResVersion ResourceManager::detectMapVersion() {
|
||||
Common::SeekableReadStream *fileStream = 0;
|
||||
Common::SeekableReadStream *fileStream = nullptr;
|
||||
byte buff[6];
|
||||
ResourceSource *rsrc= 0;
|
||||
ResourceSource *rsrc= nullptr;
|
||||
|
||||
for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end(); ++it) {
|
||||
rsrc = *it;
|
||||
@ -1339,7 +1339,7 @@ ResVersion ResourceManager::detectMapVersion() {
|
||||
// check if 0 or 01 - try to read resources in SCI0 format and see if exists
|
||||
fileStream->seek(0, SEEK_SET);
|
||||
while (fileStream->read(buff, 6) == 6 && !(buff[0] == 0xFF && buff[1] == 0xFF && buff[2] == 0xFF)) {
|
||||
if (findVolume(rsrc, (buff[5] & 0xFC) >> 2) == NULL) {
|
||||
if (findVolume(rsrc, (buff[5] & 0xFC) >> 2) == nullptr) {
|
||||
delete fileStream;
|
||||
return kResVersionSci1Middle;
|
||||
}
|
||||
@ -1400,7 +1400,7 @@ ResVersion ResourceManager::detectMapVersion() {
|
||||
}
|
||||
|
||||
ResVersion ResourceManager::detectVolVersion() {
|
||||
Common::SeekableReadStream *fileStream = 0;
|
||||
Common::SeekableReadStream *fileStream = nullptr;
|
||||
ResourceSource *rsrc;
|
||||
|
||||
for (Common::List<ResourceSource *>::iterator it = _sources.begin(); it != _sources.end(); ++it) {
|
||||
@ -1594,8 +1594,8 @@ bool ResourceManager::isBlacklistedPatch(const ResourceId &resId) const {
|
||||
|
||||
// version-agnostic patch application
|
||||
void ResourceManager::processPatch(ResourceSource *source, ResourceType resourceType, uint16 resourceNr, uint32 tuple) {
|
||||
Common::SeekableReadStream *fileStream = 0;
|
||||
Resource *newrsc = 0;
|
||||
Common::SeekableReadStream *fileStream = nullptr;
|
||||
Resource *newrsc = nullptr;
|
||||
ResourceId resId = ResourceId(resourceType, resourceNr, tuple);
|
||||
ResourceType checkForType = resourceType;
|
||||
|
||||
@ -1714,12 +1714,12 @@ ResourceId convertPatchNameBase36(ResourceType type, const Common::String &filen
|
||||
// uint16 resourceId, byte noun, byte verb, byte cond, byte seq
|
||||
|
||||
// Skip patch type character
|
||||
uint16 resourceNr = strtol(Common::String(filename.c_str() + 1, 3).c_str(), 0, 36); // 3 characters
|
||||
uint16 noun = strtol(Common::String(filename.c_str() + 4, 2).c_str(), 0, 36); // 2 characters
|
||||
uint16 verb = strtol(Common::String(filename.c_str() + 6, 2).c_str(), 0, 36); // 2 characters
|
||||
uint16 resourceNr = strtol(Common::String(filename.c_str() + 1, 3).c_str(), nullptr, 36); // 3 characters
|
||||
uint16 noun = strtol(Common::String(filename.c_str() + 4, 2).c_str(), nullptr, 36); // 2 characters
|
||||
uint16 verb = strtol(Common::String(filename.c_str() + 6, 2).c_str(), nullptr, 36); // 2 characters
|
||||
// Skip '.'
|
||||
uint16 cond = strtol(Common::String(filename.c_str() + 9, 2).c_str(), 0, 36); // 2 characters
|
||||
uint16 seq = strtol(Common::String(filename.c_str() + 11, 1).c_str(), 0, 36); // 1 character
|
||||
uint16 cond = strtol(Common::String(filename.c_str() + 9, 2).c_str(), nullptr, 36); // 2 characters
|
||||
uint16 seq = strtol(Common::String(filename.c_str() + 11, 1).c_str(), nullptr, 36); // 1 character
|
||||
|
||||
return ResourceId(type, resourceNr, noun, verb, cond, seq);
|
||||
}
|
||||
@ -1849,7 +1849,7 @@ void ResourceManager::readResourcePatches() {
|
||||
|
||||
// SCI1 scheme
|
||||
if (Common::isDigit(name[0])) {
|
||||
char *end = 0;
|
||||
char *end = nullptr;
|
||||
resourceNr = strtol(name.c_str(), &end, 10);
|
||||
bAdd = (*end == '.'); // Ensure the next character is the period
|
||||
} else {
|
||||
@ -1871,7 +1871,7 @@ void ResourceManager::readResourcePatches() {
|
||||
}
|
||||
|
||||
int ResourceManager::readResourceMapSCI0(ResourceSource *map) {
|
||||
Common::SeekableReadStream *fileStream = 0;
|
||||
Common::SeekableReadStream *fileStream = nullptr;
|
||||
ResourceType type = kResourceTypeInvalid; // to silence a false positive in MSVC
|
||||
uint16 number, id;
|
||||
uint32 offset;
|
||||
@ -1950,7 +1950,7 @@ int ResourceManager::readResourceMapSCI0(ResourceSource *map) {
|
||||
}
|
||||
|
||||
int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
|
||||
Common::SeekableReadStream *fileStream = 0;
|
||||
Common::SeekableReadStream *fileStream = nullptr;
|
||||
|
||||
if (map->_resourceFile) {
|
||||
fileStream = map->_resourceFile->createReadStream();
|
||||
@ -2030,7 +2030,7 @@ int ResourceManager::readResourceMapSCI1(ResourceSource *map) {
|
||||
return SCI_ERROR_NO_RESOURCE_FILES_FOUND;
|
||||
}
|
||||
|
||||
Resource *resource = NULL;
|
||||
Resource *resource = nullptr;
|
||||
if (!_resMap.tryGetVal(resId,resource)) {
|
||||
addResource(resId, source, fileOffset, 0, map->getLocationName());
|
||||
} else {
|
||||
@ -2386,7 +2386,7 @@ int Resource::decompress(ResVersion volVersion, Common::SeekableReadStream *file
|
||||
return errorNum;
|
||||
|
||||
// getting a decompressor
|
||||
Decompressor *dec = NULL;
|
||||
Decompressor *dec = nullptr;
|
||||
switch (compression) {
|
||||
case kCompNone:
|
||||
dec = new Decompressor;
|
||||
@ -2445,7 +2445,7 @@ ResourceCompression ResourceManager::getViewCompression() {
|
||||
|
||||
// Test 10 views to see if any are compressed
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
Common::SeekableReadStream *fileStream = 0;
|
||||
Common::SeekableReadStream *fileStream = nullptr;
|
||||
Resource *res = testResource(ResourceId(kResourceTypeView, i));
|
||||
|
||||
if (!res)
|
||||
|
@ -729,7 +729,7 @@ void ResourceManager::setAudioLanguage(int language) {
|
||||
_sources.remove(_audioMapSCI1);
|
||||
delete _audioMapSCI1;
|
||||
|
||||
_audioMapSCI1 = NULL;
|
||||
_audioMapSCI1 = nullptr;
|
||||
}
|
||||
|
||||
Common::String filename = Common::String::format("AUDIO%03d", language);
|
||||
@ -982,7 +982,7 @@ SoundResource::Track *SoundResource::getTrackByType(byte type) {
|
||||
if (_tracks[trackNr].type == type)
|
||||
return &_tracks[trackNr];
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SoundResource::Track *SoundResource::getDigitalTrack() {
|
||||
@ -990,7 +990,7 @@ SoundResource::Track *SoundResource::getDigitalTrack() {
|
||||
if (_tracks[trackNr].digitalChannelNr != -1)
|
||||
return &_tracks[trackNr];
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Gets the filter mask for SCI0 sound resources
|
||||
|
@ -300,7 +300,7 @@ Common::Error SciEngine::run() {
|
||||
|
||||
_kernel = new Kernel(_resMan, segMan);
|
||||
_features = new GameFeatures(segMan, _kernel);
|
||||
_vocabulary = hasParser() ? new Vocabulary(_resMan, false) : NULL;
|
||||
_vocabulary = hasParser() ? new Vocabulary(_resMan, false) : nullptr;
|
||||
|
||||
_gamestate = new EngineState(segMan);
|
||||
_guestAdditions = new GuestAdditions(_gamestate, _features, _kernel);
|
||||
@ -524,7 +524,7 @@ void SciEngine::suggestDownloadGK2SubTitlesPatch() {
|
||||
bool SciEngine::initGame() {
|
||||
// Script 0 needs to be allocated here before anything else!
|
||||
int script0Segment = _gamestate->_segMan->getScriptSegment(0, SCRIPT_GET_LOCK);
|
||||
DataStack *stack = _gamestate->_segMan->allocateStack(VM_STACK_SIZE, NULL);
|
||||
DataStack *stack = _gamestate->_segMan->allocateStack(VM_STACK_SIZE, nullptr);
|
||||
|
||||
_gamestate->_msgState = new MessageState(_gamestate->_segMan);
|
||||
_gamestate->gcCountDown = GC_INTERVAL - 1;
|
||||
|
@ -364,10 +364,10 @@ static byte *readSOLAudio(Common::SeekableReadStream *audioStream, uint32 &size,
|
||||
}
|
||||
|
||||
Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32 volume, int *sampleLen) {
|
||||
Audio::SeekableAudioStream *audioSeekStream = 0;
|
||||
Audio::RewindableAudioStream *audioStream = 0;
|
||||
Audio::SeekableAudioStream *audioSeekStream = nullptr;
|
||||
Audio::RewindableAudioStream *audioStream = nullptr;
|
||||
uint32 size = 0;
|
||||
byte *data = 0;
|
||||
byte *data = nullptr;
|
||||
byte flags = 0;
|
||||
Sci::Resource *audioRes;
|
||||
|
||||
@ -377,14 +377,14 @@ Audio::RewindableAudioStream *AudioPlayer::getAudioStream(uint32 number, uint32
|
||||
audioRes = _resMan->findResource(ResourceId(kResourceTypeAudio, number), false);
|
||||
if (!audioRes) {
|
||||
warning("Failed to find audio entry %i", number);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
} else {
|
||||
audioRes = _resMan->findResource(ResourceId(kResourceTypeAudio36, volume, number), false);
|
||||
if (!audioRes) {
|
||||
warning("Failed to find audio entry (%i, %i, %i, %i, %i)", volume, (number >> 24) & 0xff,
|
||||
(number >> 16) & 0xff, (number >> 8) & 0xff, number & 0xff);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
};
|
||||
|
||||
MidiDriver_AdLib(SciVersion version) : _version(version), _isSCI0(version < SCI_VERSION_1_EARLY), _playSwitch(true), _masterVolume(15),
|
||||
_numVoiceMax(version == SCI_VERSION_0_EARLY ? 8 : kVoices), _rhythmKeyMap(), _opl(0), _adlibTimerParam(0), _adlibTimerProc(0), _stereo(false), _isOpen(false) { }
|
||||
_numVoiceMax(version == SCI_VERSION_0_EARLY ? 8 : kVoices), _rhythmKeyMap(), _opl(nullptr), _adlibTimerParam(nullptr), _adlibTimerProc(nullptr), _stereo(false), _isOpen(false) { }
|
||||
~MidiDriver_AdLib() override { }
|
||||
|
||||
// MidiDriver
|
||||
@ -59,8 +59,8 @@ public:
|
||||
void send(uint32 b) override;
|
||||
void initTrack(SciSpan<const byte> &header);
|
||||
|
||||
MidiChannel *allocateChannel() override { return NULL; }
|
||||
MidiChannel *getPercussionChannel() override { return NULL; }
|
||||
MidiChannel *allocateChannel() override { return nullptr; }
|
||||
MidiChannel *getPercussionChannel() override { return nullptr; }
|
||||
bool isOpen() const override { return _isOpen; }
|
||||
uint32 getBaseTempo() override { return 1000000 / OPL::OPL::kDefaultCallbackFrequency; }
|
||||
|
||||
@ -180,7 +180,7 @@ public:
|
||||
MidiPlayer_AdLib(SciVersion soundVersion) : MidiPlayer(soundVersion) { _driver = new MidiDriver_AdLib(soundVersion); }
|
||||
~MidiPlayer_AdLib() override {
|
||||
delete _driver;
|
||||
_driver = 0;
|
||||
_driver = nullptr;
|
||||
}
|
||||
|
||||
int open(ResourceManager *resMan) override;
|
||||
@ -907,7 +907,7 @@ uint32 MidiDriver_AdLib::property(int prop, uint32 param) {
|
||||
|
||||
|
||||
int MidiPlayer_AdLib::open(ResourceManager *resMan) {
|
||||
assert(resMan != NULL);
|
||||
assert(resMan != nullptr);
|
||||
|
||||
// Load up the patch.003 file, parse out the instruments
|
||||
Resource *res = resMan->findResource(ResourceId(kResourceTypePatch, 3), false);
|
||||
|
@ -197,8 +197,8 @@ public:
|
||||
|
||||
void onTimer() override;
|
||||
|
||||
MidiChannel *allocateChannel() override { return 0; }
|
||||
MidiChannel *getPercussionChannel() override { return 0; }
|
||||
MidiChannel *allocateChannel() override { return nullptr; }
|
||||
MidiChannel *getPercussionChannel() override { return nullptr; }
|
||||
|
||||
bool isStereo() const override { return true; }
|
||||
int getRate() const override { return _rate; }
|
||||
@ -254,7 +254,7 @@ private:
|
||||
};
|
||||
|
||||
CMSVoice::CMSVoice(uint8 id, MidiDriver_CMS* driver, CMSEmulator *cms, SciSpan<const uint8>& patchData) : _id(id), _regOffset(id > 5 ? id - 6 : id), _portOffset(id > 5 ? 2 : 0),
|
||||
_driver(driver), _cms(cms), _assign(0xFF), _note(0xFF), _sustained(false), _duration(0), _releaseDuration(0), _secondaryVoice(0), _patchData(patchData) {
|
||||
_driver(driver), _cms(cms), _assign(0xFF), _note(0xFF), _sustained(false), _duration(0), _releaseDuration(0), _secondaryVoice(nullptr), _patchData(patchData) {
|
||||
assert(_id < 12);
|
||||
_octaveRegs[_id >> 1] = 0;
|
||||
}
|
||||
@ -384,7 +384,7 @@ void CMSVoice_V0::programChange(int program) {
|
||||
if (data.getUint8At(pos) == 0xFF) {
|
||||
_secondaryVoice->stop();
|
||||
_secondaryVoice->_assign = 0xFF;
|
||||
_secondaryVoice = 0;
|
||||
_secondaryVoice = nullptr;
|
||||
} else {
|
||||
_secondaryVoice->setPanMask(_panMask);
|
||||
_secondaryVoice->programChange(program);
|
||||
@ -471,7 +471,7 @@ void CMSVoice_V0::update() {
|
||||
|
||||
void CMSVoice_V0::reset() {
|
||||
_envState = kReady;
|
||||
_secondaryVoice = 0;
|
||||
_secondaryVoice = nullptr;
|
||||
_assign = _note = _envNote = 0xFF;
|
||||
_panMask = _id & 1 ? 0xF0 : 0x0F;
|
||||
_envTL = 0;
|
||||
@ -744,7 +744,7 @@ const int CMSVoice_V1::_velocityTable[32] = {
|
||||
};
|
||||
|
||||
MidiDriver_CMS::MidiDriver_CMS(Audio::Mixer* mixer, ResourceManager* resMan, SciVersion version) : MidiDriver_Emulated(mixer), _resMan(resMan),
|
||||
_version(version), _cms(0), _rate(0), _playSwitch(true), _masterVolume(0), _numVoicesPrimary(version > SCI_VERSION_0_LATE ? 12 : 8),
|
||||
_version(version), _cms(nullptr), _rate(0), _playSwitch(true), _masterVolume(0), _numVoicesPrimary(version > SCI_VERSION_0_LATE ? 12 : 8),
|
||||
_actualTimerInterval(1000000 / _baseFreq), _reqTimerInterval(1000000/60), _numVoicesSecondary(version > SCI_VERSION_0_LATE ? 0 : 4) {
|
||||
memset(_voice, 0, sizeof(_voice));
|
||||
_updateTimer = _reqTimerInterval;
|
||||
@ -1108,7 +1108,7 @@ void MidiDriver_CMS::unbindVoices(int channelNr, int voices, bool bindSecondary)
|
||||
if (sec) {
|
||||
sec->stop();
|
||||
sec->_assign = 0xFF;
|
||||
_voice[i]->_secondaryVoice = 0;
|
||||
_voice[i]->_secondaryVoice = nullptr;
|
||||
}
|
||||
|
||||
--voices;
|
||||
@ -1145,7 +1145,7 @@ void MidiDriver_CMS::unbindVoices(int channelNr, int voices, bool bindSecondary)
|
||||
if (sec) {
|
||||
sec->stop();
|
||||
sec->_assign = 0xFF;
|
||||
_voice[voiceNr]->_secondaryVoice = 0;
|
||||
_voice[voiceNr]->_secondaryVoice = nullptr;
|
||||
}
|
||||
|
||||
--voices;
|
||||
@ -1329,7 +1329,7 @@ public:
|
||||
|
||||
void playSwitch(bool play) override { _driver->property(MidiDriver_CMS::MIDI_PROP_PLAYSWITCH, play ? 1 : 0); }
|
||||
|
||||
const char *reportMissingFiles() override { return _filesMissing ? _requiredFiles : 0; }
|
||||
const char *reportMissingFiles() override { return _filesMissing ? _requiredFiles : nullptr; }
|
||||
|
||||
private:
|
||||
bool _filesMissing;
|
||||
@ -1350,7 +1350,7 @@ int MidiPlayer_CMS::open(ResourceManager *resMan) {
|
||||
}
|
||||
|
||||
void MidiPlayer_CMS::close() {
|
||||
_driver->setTimerCallback(0, 0);
|
||||
_driver->setTimerCallback(nullptr, nullptr);
|
||||
_driver->close();
|
||||
delete _driver;
|
||||
_driver = nullptr;
|
||||
|
@ -146,8 +146,8 @@ private:
|
||||
byte _sysExBuf[kMaxSysExSize];
|
||||
};
|
||||
|
||||
MidiPlayer_Fb01::MidiPlayer_Fb01(SciVersion version) : MidiPlayer(version), _playSwitch(true), _masterVolume(15), _timerParam(NULL), _timerProc(NULL),
|
||||
_numParts(version > SCI_VERSION_0_LATE ? kVoices : 0), _isOpen(false), _missingFiles(0) {
|
||||
MidiPlayer_Fb01::MidiPlayer_Fb01(SciVersion version) : MidiPlayer(version), _playSwitch(true), _masterVolume(15), _timerParam(nullptr), _timerProc(nullptr),
|
||||
_numParts(version > SCI_VERSION_0_LATE ? kVoices : 0), _isOpen(false), _missingFiles(nullptr) {
|
||||
MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI);
|
||||
_driver = MidiDriver::createMidi(dev);
|
||||
|
||||
@ -157,7 +157,7 @@ MidiPlayer_Fb01::MidiPlayer_Fb01(SciVersion version) : MidiPlayer(version), _pla
|
||||
|
||||
MidiPlayer_Fb01::~MidiPlayer_Fb01() {
|
||||
if (_driver)
|
||||
_driver->setTimerCallback(NULL, NULL);
|
||||
_driver->setTimerCallback(nullptr, nullptr);
|
||||
close();
|
||||
delete _driver;
|
||||
}
|
||||
@ -520,7 +520,7 @@ void MidiPlayer_Fb01::midiTimerCallback(void *p) {
|
||||
}
|
||||
|
||||
void MidiPlayer_Fb01::setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) {
|
||||
_driver->setTimerCallback(NULL, NULL);
|
||||
_driver->setTimerCallback(nullptr, nullptr);
|
||||
|
||||
_timerParam = timer_param;
|
||||
_timerProc = timer_proc;
|
||||
@ -554,7 +554,7 @@ void MidiPlayer_Fb01::sendBanks(const SciSpan<const byte> &data) {
|
||||
}
|
||||
|
||||
int MidiPlayer_Fb01::open(ResourceManager *resMan) {
|
||||
assert(resMan != NULL);
|
||||
assert(resMan != nullptr);
|
||||
|
||||
int retval = _driver->open();
|
||||
if (retval != 0) {
|
||||
@ -630,7 +630,7 @@ int MidiPlayer_Fb01::open(ResourceManager *resMan) {
|
||||
|
||||
void MidiPlayer_Fb01::close() {
|
||||
if (_driver)
|
||||
_driver->setTimerCallback(NULL, NULL);
|
||||
_driver->setTimerCallback(nullptr, nullptr);
|
||||
_isOpen = false;
|
||||
if (_driver)
|
||||
_driver->close();
|
||||
|
@ -113,8 +113,8 @@ public:
|
||||
void setSoundOn(bool toggle);
|
||||
|
||||
uint32 getBaseTempo() override;
|
||||
MidiChannel *allocateChannel() override { return 0; }
|
||||
MidiChannel *getPercussionChannel() override { return 0; }
|
||||
MidiChannel *allocateChannel() override { return nullptr; }
|
||||
MidiChannel *getPercussionChannel() override { return nullptr; }
|
||||
|
||||
void timerCallback(int timerId) override;
|
||||
|
||||
@ -404,7 +404,7 @@ int TownsMidiPart::allocateChannel() {
|
||||
return chan;
|
||||
}
|
||||
|
||||
MidiDriver_FMTowns::MidiDriver_FMTowns(Audio::Mixer *mixer, SciVersion version) : _version(version), _timerProc(0), _timerProcPara(0), _baseTempo(10080), _ready(false), _isOpen(false), _masterVolume(0x0f), _soundOn(true) {
|
||||
MidiDriver_FMTowns::MidiDriver_FMTowns(Audio::Mixer *mixer, SciVersion version) : _version(version), _timerProc(nullptr), _timerProcPara(nullptr), _baseTempo(10080), _ready(false), _isOpen(false), _masterVolume(0x0f), _soundOn(true) {
|
||||
_intf = new TownsAudioInterface(mixer, this, true);
|
||||
_out = new TownsChannel*[6];
|
||||
for (int i = 0; i < 6; i++)
|
||||
@ -420,19 +420,19 @@ MidiDriver_FMTowns::~MidiDriver_FMTowns() {
|
||||
if (_parts) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
delete _parts[i];
|
||||
_parts[i] = 0;
|
||||
_parts[i] = nullptr;
|
||||
}
|
||||
delete[] _parts;
|
||||
_parts = 0;
|
||||
_parts = nullptr;
|
||||
}
|
||||
|
||||
if (_out) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
delete _out[i];
|
||||
_out[i] = 0;
|
||||
_out[i] = nullptr;
|
||||
}
|
||||
delete[] _out;
|
||||
_out = 0;
|
||||
_out = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ static const byte defaultSci32GMPatch[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
Mt32ToGmMapList *Mt32dynamicMappings = NULL;
|
||||
Mt32ToGmMapList *Mt32dynamicMappings = nullptr;
|
||||
|
||||
class MidiPlayer_Midi : public MidiPlayer {
|
||||
public:
|
||||
@ -260,7 +260,7 @@ MidiPlayer_Midi::~MidiPlayer_Midi() {
|
||||
const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end();
|
||||
for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) {
|
||||
delete[] (*it).name;
|
||||
(*it).name = 0;
|
||||
(*it).name = nullptr;
|
||||
}
|
||||
|
||||
Mt32dynamicMappings->clear();
|
||||
@ -1060,7 +1060,7 @@ bool MidiPlayer_Midi::readD110SysEx() {
|
||||
byte MidiPlayer_Midi::lookupGmInstrument(const char *iname) {
|
||||
int i = 0;
|
||||
|
||||
if (Mt32dynamicMappings != NULL) {
|
||||
if (Mt32dynamicMappings != nullptr) {
|
||||
const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end();
|
||||
for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) {
|
||||
if (scumm_strnicmp(iname, (*it).name, 10) == 0)
|
||||
@ -1080,7 +1080,7 @@ byte MidiPlayer_Midi::lookupGmInstrument(const char *iname) {
|
||||
byte MidiPlayer_Midi::lookupGmRhythmKey(const char *iname) {
|
||||
int i = 0;
|
||||
|
||||
if (Mt32dynamicMappings != NULL) {
|
||||
if (Mt32dynamicMappings != nullptr) {
|
||||
const Mt32ToGmMapList::iterator end = Mt32dynamicMappings->end();
|
||||
for (Mt32ToGmMapList::iterator it = Mt32dynamicMappings->begin(); it != end; ++it) {
|
||||
if (scumm_strnicmp(iname, (*it).name, 10) == 0)
|
||||
@ -1244,7 +1244,7 @@ void MidiPlayer_Midi::resetMt32() {
|
||||
}
|
||||
|
||||
int MidiPlayer_Midi::open(ResourceManager *resMan) {
|
||||
assert(resMan != NULL);
|
||||
assert(resMan != nullptr);
|
||||
|
||||
int retval = _driver->open();
|
||||
if (retval != 0) {
|
||||
@ -1414,7 +1414,7 @@ void MidiPlayer_Midi::close() {
|
||||
sendMt32SysEx(0x200000, SciSpan<const byte>(_goodbyeMsg, _mt32LCDSize), true);
|
||||
}
|
||||
|
||||
_driver->setTimerCallback(NULL, NULL);
|
||||
_driver->setTimerCallback(nullptr, nullptr);
|
||||
_driver->close();
|
||||
}
|
||||
|
||||
|
@ -291,8 +291,8 @@ public:
|
||||
|
||||
void setTimerCallback(void *timer_param, Common::TimerManager::TimerProc timer_proc) override;
|
||||
uint32 getBaseTempo() override;
|
||||
MidiChannel *allocateChannel() override { return 0; }
|
||||
MidiChannel *getPercussionChannel() override { return 0; }
|
||||
MidiChannel *allocateChannel() override { return nullptr; }
|
||||
MidiChannel *getPercussionChannel() override { return nullptr; }
|
||||
|
||||
void timerCallbackB() override;
|
||||
|
||||
@ -745,9 +745,9 @@ void SoundChannel_PC9801_FM2OP::programChange(uint8 program) {
|
||||
}
|
||||
|
||||
bool SoundChannel_PC9801_FM2OP::prepareFrequencyAndVolume(bool updateVolume) {
|
||||
if (recalculateFrequency(_note, _opFreqOffset[_operatorFrqIndex[0]], 0, &_frequencyCourse, &_frequencyNoteModifier) == -1)
|
||||
if (recalculateFrequency(_note, _opFreqOffset[_operatorFrqIndex[0]], nullptr, &_frequencyCourse, &_frequencyNoteModifier) == -1)
|
||||
return false;
|
||||
if (recalculateFrequency(_note, _opFreqOffset[_operatorFrqIndex[1]], 0, &_frequencyCourse2, &_frequencyNoteModifier2) == -1)
|
||||
if (recalculateFrequency(_note, _opFreqOffset[_operatorFrqIndex[1]], nullptr, &_frequencyCourse2, &_frequencyNoteModifier2) == -1)
|
||||
return false;
|
||||
|
||||
sendFrequency();
|
||||
@ -1315,11 +1315,11 @@ void MidiPart_PC9801::assignFreeChannels() {
|
||||
MidiDriver_PC9801::assignFreeChannels(freeChan);
|
||||
}
|
||||
|
||||
MidiPart_PC9801 **MidiDriver_PC9801::_parts = 0;
|
||||
MidiPart_PC9801 **MidiDriver_PC9801::_parts = nullptr;
|
||||
|
||||
MidiDriver_PC9801::MidiDriver_PC9801(Audio::Mixer *mixer, SciVersion version)
|
||||
: _mixer(mixer), _version(version), _pc98a(0), _chan(0), _numChan(6), _internalVersion(0xFF), _ssgPatchOffset(0xFF), _patchSize(0),
|
||||
_timerProc(0), _timerProcPara(0), _baseTempo(10080), _ready(false), _isOpen(false), _masterVolume(0x0f) ,_soundOn(true), _playID(0),
|
||||
: _mixer(mixer), _version(version), _pc98a(nullptr), _chan(nullptr), _numChan(6), _internalVersion(0xFF), _ssgPatchOffset(0xFF), _patchSize(0),
|
||||
_timerProc(nullptr), _timerProcPara(nullptr), _baseTempo(10080), _ready(false), _isOpen(false), _masterVolume(0x0f) ,_soundOn(true), _playID(0),
|
||||
_polyphony(9), _channelMask1(0x10), _channelMask2(0x02) {
|
||||
}
|
||||
|
||||
@ -1395,7 +1395,7 @@ int MidiDriver_PC9801::open() {
|
||||
else if (channelConfig[config][i] == 2)
|
||||
_chan[i] = new SoundChannel_PC9801_SSG(numSSG++, _pc98a, _parts, _version, *_instrumentData, _ssgPatchOffset, _patchSize, _soundOn);
|
||||
else
|
||||
_chan[i] = 0;
|
||||
_chan[i] = nullptr;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
@ -1416,24 +1416,24 @@ void MidiDriver_PC9801::close() {
|
||||
_isOpen = _ready = false;
|
||||
|
||||
delete _pc98a;
|
||||
_pc98a = 0;
|
||||
_pc98a = nullptr;
|
||||
|
||||
if (_parts) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
delete _parts[i];
|
||||
_parts[i] = 0;
|
||||
_parts[i] = nullptr;
|
||||
}
|
||||
delete[] _parts;
|
||||
_parts = 0;
|
||||
_parts = nullptr;
|
||||
}
|
||||
|
||||
if (_chan) {
|
||||
for (int i = 0; i < _numChan; ++i) {
|
||||
delete _chan[i];
|
||||
_chan[i] = 0;
|
||||
_chan[i] = nullptr;
|
||||
}
|
||||
delete[] _chan;
|
||||
_chan = 0;
|
||||
_chan = nullptr;
|
||||
}
|
||||
|
||||
_instrumentData.clear();
|
||||
|
@ -73,8 +73,8 @@ public:
|
||||
int open() override { return open(kMaxChannels); }
|
||||
void close() override;
|
||||
void send(uint32 b) override;
|
||||
MidiChannel *allocateChannel() override { return NULL; }
|
||||
MidiChannel *getPercussionChannel() override { return NULL; }
|
||||
MidiChannel *allocateChannel() override { return nullptr; }
|
||||
MidiChannel *getPercussionChannel() override { return nullptr; }
|
||||
|
||||
// AudioStream
|
||||
bool isStereo() const override { return false; }
|
||||
|
@ -56,7 +56,7 @@ MidiParser_SCI::MidiParser_SCI(SciVersion soundVersion, SciMusic *music) :
|
||||
_volume = 127;
|
||||
|
||||
_resetOnPause = false;
|
||||
_pSnd = 0;
|
||||
_pSnd = nullptr;
|
||||
|
||||
_mainThreadCalled = false;
|
||||
|
||||
@ -67,7 +67,7 @@ MidiParser_SCI::~MidiParser_SCI() {
|
||||
unloadMusic();
|
||||
// we do this, so that MidiParser won't be able to call his own ::allNotesOff()
|
||||
// this one would affect all channels and we can't let that happen
|
||||
_driver = 0;
|
||||
_driver = nullptr;
|
||||
}
|
||||
|
||||
void MidiParser_SCI::mainThreadBegin() {
|
||||
@ -449,8 +449,8 @@ void MidiParser_SCI::unloadMusic() {
|
||||
_music->removeTrackInitCommandsFromQueue(_pSnd);
|
||||
}
|
||||
_numTracks = 0;
|
||||
_pSnd = 0;
|
||||
_track = 0;
|
||||
_pSnd = nullptr;
|
||||
_track = nullptr;
|
||||
_activeTrack = 255;
|
||||
_resetOnPause = false;
|
||||
_mixedData.clear();
|
||||
|
@ -47,9 +47,9 @@ SciMusic::SciMusic(SciVersion soundVersion, bool useDigitalSFX)
|
||||
_playList.reserve(10);
|
||||
|
||||
for (int i = 0; i < 16; i++) {
|
||||
_usedChannel[i] = 0;
|
||||
_usedChannel[i] = nullptr;
|
||||
_channelRemap[i] = -1;
|
||||
_channelMap[i]._song = 0;
|
||||
_channelMap[i]._song = nullptr;
|
||||
_channelMap[i]._channel = -1;
|
||||
}
|
||||
|
||||
@ -183,7 +183,7 @@ void SciMusic::init() {
|
||||
if (getSciVersion() <= SCI_VERSION_0_LATE)
|
||||
_globalReverb = _pMidiDrv->getReverb(); // Init global reverb for SCI0
|
||||
|
||||
_currentlyPlayingSample = NULL;
|
||||
_currentlyPlayingSample = nullptr;
|
||||
_timeCounter = 0;
|
||||
_needsRemap = false;
|
||||
}
|
||||
@ -316,7 +316,7 @@ MusicEntry *SciMusic::getSlot(reg_t obj) {
|
||||
return *i;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MusicEntry *SciMusic::getFirstSlotWithStatus(SoundStatus status) {
|
||||
@ -324,7 +324,7 @@ MusicEntry *SciMusic::getFirstSlotWithStatus(SoundStatus status) {
|
||||
if ((*i)->status == status)
|
||||
return *i;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void SciMusic::setGlobalReverb(int8 reverb) {
|
||||
@ -375,7 +375,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
|
||||
// since they will no longer be valid.
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
if (_channelMap[i]._song == pSnd) {
|
||||
_channelMap[i]._song = 0;
|
||||
_channelMap[i]._song = nullptr;
|
||||
_channelMap[i]._channel = -1;
|
||||
}
|
||||
}
|
||||
@ -429,7 +429,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
|
||||
size, track->digitalSampleRate, flags, DisposeAfterUse::NO);
|
||||
assert(pSnd->pStreamAud);
|
||||
delete pSnd->pLoopStream;
|
||||
pSnd->pLoopStream = 0;
|
||||
pSnd->pLoopStream = nullptr;
|
||||
pSnd->soundType = Audio::Mixer::kSFXSoundType;
|
||||
pSnd->hCurrentAud = Audio::SoundHandle();
|
||||
pSnd->playBed = false;
|
||||
@ -439,7 +439,7 @@ void SciMusic::soundInitSnd(MusicEntry *pSnd) {
|
||||
// play MIDI track
|
||||
Common::StackLock lock(_mutex);
|
||||
pSnd->soundType = Audio::Mixer::kMusicSoundType;
|
||||
if (pSnd->pMidiParser == NULL) {
|
||||
if (pSnd->pMidiParser == nullptr) {
|
||||
pSnd->pMidiParser = new MidiParser_SCI(_soundVersion, this);
|
||||
pSnd->pMidiParser->setMidiDriver(_pMidiDrv);
|
||||
pSnd->pMidiParser->setTimerRate(_dwTempo);
|
||||
@ -523,7 +523,7 @@ void SciMusic::soundPlay(MusicEntry *pSnd, bool restoring) {
|
||||
|
||||
uint playListCount = _playList.size();
|
||||
uint playListNo = playListCount;
|
||||
MusicEntry *alreadyPlaying = NULL;
|
||||
MusicEntry *alreadyPlaying = nullptr;
|
||||
|
||||
// searching if sound is already in _playList
|
||||
for (uint i = 0; i < playListCount; i++) {
|
||||
@ -662,7 +662,7 @@ void SciMusic::soundStop(MusicEntry *pSnd) {
|
||||
} else {
|
||||
#endif
|
||||
if (_currentlyPlayingSample == pSnd)
|
||||
_currentlyPlayingSample = NULL;
|
||||
_currentlyPlayingSample = nullptr;
|
||||
_pMixer->stopHandle(pSnd->hCurrentAud);
|
||||
#ifdef ENABLE_SCI32
|
||||
}
|
||||
@ -723,7 +723,7 @@ void SciMusic::soundKill(MusicEntry *pSnd) {
|
||||
pSnd->pMidiParser->unloadMusic();
|
||||
pSnd->pMidiParser->mainThreadEnd();
|
||||
delete pSnd->pMidiParser;
|
||||
pSnd->pMidiParser = NULL;
|
||||
pSnd->pMidiParser = nullptr;
|
||||
}
|
||||
|
||||
_mutex.unlock();
|
||||
@ -736,16 +736,16 @@ void SciMusic::soundKill(MusicEntry *pSnd) {
|
||||
#endif
|
||||
if (_currentlyPlayingSample == pSnd) {
|
||||
// Forget about this sound, in case it was currently playing
|
||||
_currentlyPlayingSample = NULL;
|
||||
_currentlyPlayingSample = nullptr;
|
||||
}
|
||||
_pMixer->stopHandle(pSnd->hCurrentAud);
|
||||
#ifdef ENABLE_SCI32
|
||||
}
|
||||
#endif
|
||||
delete pSnd->pStreamAud;
|
||||
pSnd->pStreamAud = NULL;
|
||||
pSnd->pStreamAud = nullptr;
|
||||
delete pSnd->pLoopStream;
|
||||
pSnd->pLoopStream = 0;
|
||||
pSnd->pLoopStream = nullptr;
|
||||
pSnd->isSample = false;
|
||||
}
|
||||
|
||||
@ -933,7 +933,7 @@ void SciMusic::printSongInfo(reg_t obj, Console *con) {
|
||||
MusicEntry::MusicEntry() {
|
||||
soundObj = NULL_REG;
|
||||
|
||||
soundRes = 0;
|
||||
soundRes = nullptr;
|
||||
resourceId = 0;
|
||||
|
||||
dataInc = 0;
|
||||
@ -960,9 +960,9 @@ MusicEntry::MusicEntry() {
|
||||
|
||||
soundType = Audio::Mixer::kMusicSoundType;
|
||||
|
||||
pStreamAud = 0;
|
||||
pLoopStream = 0;
|
||||
pMidiParser = 0;
|
||||
pStreamAud = nullptr;
|
||||
pLoopStream = nullptr;
|
||||
pMidiParser = nullptr;
|
||||
isSample = false;
|
||||
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
@ -1055,7 +1055,7 @@ void ChannelRemapping::swap(int i, int j) {
|
||||
void ChannelRemapping::evict(int i) {
|
||||
_freeVoices += _voices[i];
|
||||
|
||||
_map[i]._song = 0;
|
||||
_map[i]._song = nullptr;
|
||||
_map[i]._channel = -1;
|
||||
_prio[i] = 0;
|
||||
_voices[i] = 0;
|
||||
@ -1064,7 +1064,7 @@ void ChannelRemapping::evict(int i) {
|
||||
|
||||
void ChannelRemapping::clear() {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
_map[i]._song = 0;
|
||||
_map[i]._song = nullptr;
|
||||
_map[i]._channel = -1;
|
||||
_prio[i] = 0;
|
||||
_voices[i] = 0;
|
||||
@ -1116,7 +1116,7 @@ void SciMusic::remapChannels(bool mainThread) {
|
||||
// Save current map, and then start from an empty map
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
currentMap[i] = _channelMap[i];
|
||||
_channelMap[i]._song = 0;
|
||||
_channelMap[i]._song = nullptr;
|
||||
_channelMap[i]._channel = -1;
|
||||
}
|
||||
|
||||
@ -1182,7 +1182,7 @@ void SciMusic::remapChannels(bool mainThread) {
|
||||
}
|
||||
|
||||
_channelMap[i] = map->_map[i];
|
||||
map->_map[i]._song = 0; // mark as done
|
||||
map->_map[i]._song = nullptr; // mark as done
|
||||
|
||||
// If this channel was not yet mapped to the device, reset it
|
||||
if (currentMap[i] != _channelMap[i]) {
|
||||
@ -1215,7 +1215,7 @@ void SciMusic::remapChannels(bool mainThread) {
|
||||
if (map->_map[i] == currentMap[j]) {
|
||||
// found it
|
||||
_channelMap[j] = map->_map[i];
|
||||
map->_map[i]._song = 0; // mark as done
|
||||
map->_map[i]._song = nullptr; // mark as done
|
||||
#ifdef DEBUG_REMAP
|
||||
debug(" Keeping song %d, channel %d on device channel %d", songIndex, _channelMap[j]._channel, j);
|
||||
#endif
|
||||
@ -1238,9 +1238,9 @@ void SciMusic::remapChannels(bool mainThread) {
|
||||
}
|
||||
|
||||
for (int j = _driverLastChannel; j >= _driverFirstChannel; --j) {
|
||||
if (_channelMap[j]._song == 0) {
|
||||
if (_channelMap[j]._song == nullptr) {
|
||||
_channelMap[j] = map->_map[i];
|
||||
map->_map[i]._song = 0;
|
||||
map->_map[i]._song = nullptr;
|
||||
#ifdef DEBUG_REMAP
|
||||
debug(" Mapping song %d, channel %d to device channel %d", songIndex, _channelMap[j]._channel, j);
|
||||
#endif
|
||||
@ -1335,7 +1335,7 @@ ChannelRemapping *SciMusic::determineChannelMap() {
|
||||
// our target
|
||||
int devChannel = -1;
|
||||
|
||||
if (dontRemap && map->_map[c]._song == 0) {
|
||||
if (dontRemap && map->_map[c]._song == nullptr) {
|
||||
// unremappable channel, with channel still free
|
||||
devChannel = c;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user