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