CRUISE: Use nullptr

Using clang-tidy modernize-use-nullptr
This commit is contained in:
Orgad Shaneh 2021-11-13 23:40:20 +02:00 committed by Filippos Karapetis
parent 6a59febd46
commit 52e1aa78a0
25 changed files with 233 additions and 233 deletions

View file

@ -65,7 +65,7 @@ actorStruct *findActor(actorStruct *pStartEntry, int overlayIdx, int objIdx, int
pCurrentEntry = pCurrentEntry->next;
}
return NULL;
return nullptr;
}
int nclick_noeud;
@ -636,14 +636,14 @@ int16 computePathfinding(MovementEntry &moveInfo, int16 x, int16 y, int16 destX,
return (-1);
}
valide_noeud(select_noeud, point_select, &nclick_noeud, NULL);
valide_noeud(select_noeud, point_select, &nclick_noeud, nullptr);
flag_aff_chemin = 0;
/******* cherche le deuxieme noeud ******/
num = 0;
while (num < NUM_PERSONS && persoTable[num] != NULL)
while (num < NUM_PERSONS && persoTable[num] != nullptr)
num++;
if (num == NUM_PERSONS) {

View file

@ -28,7 +28,7 @@ namespace Cruise {
uint8 colorMode = 0;
uint8 *backgroundScreens[8] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; // wasn't initialized in original, but it's probably better
uint8 *backgroundScreens[8] = { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }; // wasn't initialized in original, but it's probably better
bool backgroundChanged[8] = { false, false, false, false, false, false, false, false };
backgroundTableStruct backgroundTable[8];
@ -107,7 +107,7 @@ int loadBackground(const char *name, int idx) {
backgroundChanged[idx] = true;
ptrToFree = gfxModuleData.pPage10;
if (loadFileSub1(&ptrToFree, name, NULL) < 0) {
if (loadFileSub1(&ptrToFree, name, nullptr) < 0) {
if (ptrToFree != gfxModuleData.pPage10)
MemFree(ptrToFree);

View file

@ -28,13 +28,13 @@ namespace Cruise {
backgroundIncrustStruct backgroundIncrustHead;
void resetBackgroundIncrustList(backgroundIncrustStruct *pHead) {
pHead->next = NULL;
pHead->prev = NULL;
pHead->next = nullptr;
pHead->prev = nullptr;
}
// blit background to another one
void addBackgroundIncrustSub1(int fileIdx, int X, int Y, char *ptr2, int16 scale, char *destBuffer, char *dataPtr) {
assert((dataPtr != NULL) && (*dataPtr != 0));
assert((dataPtr != nullptr) && (*dataPtr != 0));
buildPolyModel(X, Y, scale, ptr2, destBuffer, dataPtr);
}
@ -63,11 +63,11 @@ void restoreBackground(backgroundIncrustStruct *pIncrust) {
return;
if (pIncrust->type != 1)
return;
if (pIncrust->ptr == NULL)
if (pIncrust->ptr == nullptr)
return;
uint8* pBackground = backgroundScreens[pIncrust->backgroundIdx];
if (pBackground == NULL)
if (pBackground == nullptr)
return;
backgroundChanged[pIncrust->backgroundIdx] = true;
@ -96,14 +96,14 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
// Don't process any further if not a sprite or polygon
if (!ptr)
return NULL;
return nullptr;
if ((filesDatabase[params.fileIdx].subData.resourceType != OBJ_TYPE_SPRITE) &&
(filesDatabase[params.fileIdx].subData.resourceType != OBJ_TYPE_POLY))
return NULL;
return nullptr;
uint8 *backgroundPtr = backgroundScreens[backgroundIdx];
assert(backgroundPtr != NULL);
assert(backgroundPtr != nullptr);
backgroundChanged[backgroundIdx] = true;
backgroundIncrustStruct *currentHead = pHead;
@ -117,7 +117,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
backgroundIncrustStruct *newElement = (backgroundIncrustStruct *)mallocAndZero(sizeof(backgroundIncrustStruct));
if (!newElement)
return NULL;
return nullptr;
newElement->next = currentHead->next;
currentHead->next = newElement;
@ -138,7 +138,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
newElement->scale = params.scale;
newElement->frame = params.fileIdx;
newElement->spriteId = filesDatabase[params.fileIdx].subData.index;
newElement->ptr = NULL;
newElement->ptr = nullptr;
strcpy(newElement->name, filesDatabase[params.fileIdx].subData.name);
if (filesDatabase[params.fileIdx].subData.resourceType == OBJ_TYPE_SPRITE) {
@ -148,7 +148,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
if (saveBuffer == 1)
backupBackground(newElement, newElement->X, newElement->Y, width, height, backgroundPtr);
drawSprite(width, height, NULL, filesDatabase[params.fileIdx].subData.ptr, newElement->Y,
drawSprite(width, height, nullptr, filesDatabase[params.fileIdx].subData.ptr, newElement->Y,
newElement->X, backgroundPtr, filesDatabase[params.fileIdx].subData.ptrMask);
} else {
// poly
@ -172,7 +172,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx, int16 objectIdx,
backupBackground(newElement, sizeTable[0] - 2, sizeTable[2], width, height, backgroundPtr);
}
addBackgroundIncrustSub1(params.fileIdx, newElement->X, newElement->Y, NULL, params.scale, (char *)backgroundPtr, (char *)filesDatabase[params.fileIdx].subData.ptr);
addBackgroundIncrustSub1(params.fileIdx, newElement->X, newElement->Y, nullptr, params.scale, (char *)backgroundPtr, (char *)filesDatabase[params.fileIdx].subData.ptr);
}
return newElement;
@ -189,7 +189,7 @@ void regenerateBackgroundIncrust(backgroundIncrustStruct *pHead) {
if (frame < 0)
error("regenerateBackgroundIncrust() : Unexpected use of negative frame index");
if ((filesDatabase[frame].subData.ptr == NULL) || (strcmp(pl->name, filesDatabase[frame].subData.name))) {
if ((filesDatabase[frame].subData.ptr == nullptr) || (strcmp(pl->name, filesDatabase[frame].subData.name))) {
frame = NUM_FILE_ENTRIES - 1;
if (loadFile(pl->name, frame, pl->spriteId) < 0)
frame = -1;
@ -201,10 +201,10 @@ void regenerateBackgroundIncrust(backgroundIncrustStruct *pHead) {
int width = filesDatabase[frame].width;
int height = filesDatabase[frame].height;
drawSprite(width, height, NULL, filesDatabase[frame].subData.ptr, pl->Y, pl->X, backgroundScreens[pl->backgroundIdx], filesDatabase[frame].subData.ptrMask);
drawSprite(width, height, nullptr, filesDatabase[frame].subData.ptr, pl->Y, pl->X, backgroundScreens[pl->backgroundIdx], filesDatabase[frame].subData.ptrMask);
} else {
// Poly
addBackgroundIncrustSub1(frame, pl->X, pl->Y, NULL, pl->scale, (char *)backgroundScreens[pl->backgroundIdx], (char *)filesDatabase[frame].subData.ptr);
addBackgroundIncrustSub1(frame, pl->X, pl->Y, nullptr, pl->scale, (char *)backgroundScreens[pl->backgroundIdx], (char *)filesDatabase[frame].subData.ptr);
}
backgroundChanged[pl->backgroundIdx] = true;

View file

@ -29,8 +29,8 @@ namespace Cruise {
cellStruct cellHead;
void resetPtr(cellStruct *ptr) {
ptr->next = NULL;
ptr->prev = NULL;
ptr->next = nullptr;
ptr->prev = nullptr;
}
void freeMessageList(cellStruct *objPtr) {
@ -51,7 +51,7 @@ cellStruct *addCell(cellStruct *pHead, int16 overlayIdx, int16 objIdx, int16 typ
cellStruct *currentHead3;
if (getSingleObjectParam(overlayIdx, objIdx, 2, &var) < 0) {
return 0;
return nullptr;
}
currentHead3 = currentHead;
@ -76,7 +76,7 @@ cellStruct *addCell(cellStruct *pHead, int16 overlayIdx, int16 objIdx, int16 typ
(currentHead2->idx == objIdx) &&
(currentHead2->type == type))
return NULL;
return nullptr;
}
currentHead = currentHead2;
@ -84,7 +84,7 @@ cellStruct *addCell(cellStruct *pHead, int16 overlayIdx, int16 objIdx, int16 typ
newElement = (cellStruct *) mallocAndZero(sizeof(cellStruct));
if (!newElement)
return 0;
return nullptr;
newElement->next = currentHead3->next;
currentHead3->next = newElement;
@ -96,7 +96,7 @@ cellStruct *addCell(cellStruct *pHead, int16 overlayIdx, int16 objIdx, int16 typ
newElement->freeze = 0;
newElement->parent = scriptNumber;
newElement->parentOverlay = scriptOverlay;
newElement->gfxPtr = NULL;
newElement->gfxPtr = nullptr;
newElement->followObjectIdx = objIdx;
newElement->followObjectOverlayIdx = overlayIdx;
newElement->parentType = scriptType;
@ -152,7 +152,7 @@ void createTextObject(cellStruct *pObject, int overlayIdx, int messageIdx, int x
pNewElement->freeze = 0;
pNewElement->parent = parentIdx;
pNewElement->parentOverlay = parentOvl;
pNewElement->gfxPtr = NULL;
pNewElement->gfxPtr = nullptr;
cx = savePObject;
@ -257,15 +257,15 @@ void sortCells(int16 ovlIdx, int16 ovjIdx, cellStruct *objPtr) {
cellStruct prov;
int16 newz, objz, sobjz;
pl4 = NULL;
pl4 = nullptr;
getSingleObjectParam(ovlIdx, ovjIdx, 2, &sobjz);
pl = objPtr;
prov.next = NULL;
prov.prev = NULL;
prov.next = nullptr;
prov.prev = nullptr;
pl2 = pl->next;
pllast = NULL;
pllast = nullptr;
plz = objPtr;
while (pl2) {
@ -287,11 +287,11 @@ void sortCells(int16 ovlIdx, int16 ovjIdx, cellStruct *objPtr) {
prov.prev = pl2;
}
pl2->prev = NULL;
pl2->prev = nullptr;
pl2->next = prov.next;
prov.next = pl2;
if (pllast == NULL) {
if (pllast == nullptr) {
pllast = pl2;
}
} else {

View file

@ -116,7 +116,7 @@ void CruiseEngine::deinitialize() {
for (int i = 0; i < 8; ++i) {
if (backgroundScreens[i]) {
MemFree(backgroundScreens[i]);
backgroundScreens[i] = NULL;
backgroundScreens[i] = nullptr;
}
}
}
@ -148,7 +148,7 @@ bool CruiseEngine::loadLanguageStrings() {
} else {
// Try and use one of the pre-defined language lists
const char **p = NULL;
const char **p = nullptr;
switch (getLanguage()) {
case Common::EN_ANY:
p = englishLanguageStrings;

View file

@ -189,8 +189,8 @@ void initBigVar3() {
MemFree(filesDatabase[i].subData.ptr);
}
filesDatabase[i].subData.ptr = NULL;
filesDatabase[i].subData.ptrMask = NULL;
filesDatabase[i].subData.ptr = nullptr;
filesDatabase[i].subData.ptrMask = nullptr;
filesDatabase[i].subData.index = -1;
filesDatabase[i].subData.resourceType = 0;
@ -198,7 +198,7 @@ void initBigVar3() {
}
void resetPtr2(scriptInstanceStruct *ptr) {
ptr->nextScriptPtr = NULL;
ptr->nextScriptPtr = nullptr;
ptr->scriptNumber = -1;
}
@ -214,27 +214,27 @@ void resetActorPtr(actorStruct *ptr) {
} while (p);
}
ptr->next = NULL;
ptr->prev = NULL;
ptr->next = nullptr;
ptr->prev = nullptr;
}
ovlData3Struct *getOvlData3Entry(int32 scriptNumber, int32 param) {
ovlDataStruct *ovlData = overlayTable[scriptNumber].ovlData;
if (!ovlData) {
return NULL;
return nullptr;
}
if (param < 0) {
return NULL;
return nullptr;
}
if (ovlData->numProc <= param) {
return NULL;
return nullptr;
}
if (!ovlData->arrayProc) {
return NULL;
return nullptr;
}
return (&ovlData->arrayProc[param]);
@ -244,19 +244,19 @@ ovlData3Struct *scriptFunc1Sub2(int32 scriptNumber, int32 param) {
ovlDataStruct *ovlData = overlayTable[scriptNumber].ovlData;
if (!ovlData) {
return NULL;
return nullptr;
}
if (param < 0) {
return NULL;
return nullptr;
}
if (ovlData->numRel <= param) {
return NULL;
return nullptr;
}
if (!ovlData->ptr1) {
return NULL;
return nullptr;
}
return &ovlData->ptr1[param];
@ -279,12 +279,12 @@ uint8 *getDataFromData3(ovlData3Struct *ptr, int param) {
uint8 *dataPtr;
if (!ptr)
return (NULL);
return (nullptr);
dataPtr = ptr->dataPtr;
if (!dataPtr)
return (NULL);
return (nullptr);
switch (param) {
case 0:
@ -300,7 +300,7 @@ uint8 *getDataFromData3(ovlData3Struct *ptr, int param) {
case 5:
return (dataPtr + ptr->offsetToSubData5);
default:
return NULL;
return nullptr;
}
}
@ -414,8 +414,8 @@ void resetFileEntry(int32 entryNumber) {
if (filesDatabase[entryNumber].subData.ptrMask)
MemFree(filesDatabase[entryNumber].subData.ptrMask);
filesDatabase[entryNumber].subData.ptr = NULL;
filesDatabase[entryNumber].subData.ptrMask = NULL;
filesDatabase[entryNumber].subData.ptr = nullptr;
filesDatabase[entryNumber].subData.ptrMask = nullptr;
filesDatabase[entryNumber].widthInColumn = 0;
filesDatabase[entryNumber].width = 0;
filesDatabase[entryNumber].resType = OBJ_TYPE_LINE;
@ -429,7 +429,7 @@ void resetFileEntry(int32 entryNumber) {
uint8 *mainProc14(uint16 overlay, uint16 idx) {
assert(0);
return NULL;
return nullptr;
}
void CruiseEngine::initAllData() {
@ -446,7 +446,7 @@ void CruiseEngine::initAllData() {
soundList[2].frameNum = -1;
soundList[3].frameNum = -1;
menuTable[0] = NULL;
menuTable[0] = nullptr;
for (int i = 0; i < 2000; i++)
globalVars[i] = 0;
@ -455,8 +455,8 @@ void CruiseEngine::initAllData() {
backgroundTable[i].name[0] = 0;
for (int i = 0; i < NUM_FILE_ENTRIES; i++) {
filesDatabase[i].subData.ptr = NULL;
filesDatabase[i].subData.ptrMask = NULL;
filesDatabase[i].subData.ptr = nullptr;
filesDatabase[i].subData.ptrMask = nullptr;
}
initBigVar3();
@ -784,7 +784,7 @@ void buildInventory(int X, int Y) {
pMenu = createMenu(X, Y, _vm->langString(ID_INVENTORY));
menuTable[1] = pMenu;
if (pMenu == NULL)
if (pMenu == nullptr)
return;
int numObjectInInventory = 0;
@ -811,7 +811,7 @@ void buildInventory(int X, int Y) {
if (numObjectInInventory == 0) {
freeMenu(menuTable[1]);
menuTable[1] = NULL;
menuTable[1] = nullptr;
}
}
@ -822,12 +822,12 @@ menuElementStruct *currentMenuElement;
menuElementSubStruct *getSelectedEntryInMenu(menuStruct *pMenu) {
menuElementStruct *pMenuElement;
if (pMenu == NULL) {
return NULL;
if (pMenu == nullptr) {
return nullptr;
}
if (pMenu->numElements == 0) {
return NULL;
return nullptr;
}
pMenuElement = pMenu->ptrNextElement;
@ -844,7 +844,7 @@ menuElementSubStruct *getSelectedEntryInMenu(menuStruct *pMenu) {
pMenuElement = pMenuElement->next;
}
return NULL;
return nullptr;
}
bool createDialog(int objOvl, int objIdx, int x, int y) {
@ -896,9 +896,9 @@ bool createDialog(int objOvl, int objIdx, int x, int y) {
char verbName[80];
verbName[0] = 0;
ovlDataStruct *ovl2 = NULL;
ovlDataStruct *ovl3 = NULL;
ovlDataStruct *ovl4 = NULL;
ovlDataStruct *ovl2 = nullptr;
ovlDataStruct *ovl3 = nullptr;
ovlDataStruct *ovl4 = nullptr;
if (verbOvl > 0)
ovl2 = overlayTable[verbOvl].ovlData;
@ -992,8 +992,8 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
char verbName[80];
verbName[0] = 0;
ovlDataStruct *ovl2 = NULL;
ovlDataStruct *ovl3 = NULL;
ovlDataStruct *ovl2 = nullptr;
ovlDataStruct *ovl3 = nullptr;
if (verbOvl > 0)
ovl2 = overlayTable[verbOvl].ovlData;
@ -1051,14 +1051,14 @@ int processInventory() {
int var4 = pMenuElementSub->header;
freeMenu(menuTable[1]);
menuTable[1] = NULL;
menuTable[1] = nullptr;
findRelation(var2, var4, currentMenuElementX + 80, currentMenuElementY);
return 1;
} else {
freeMenu(menuTable[1]);
menuTable[1] = NULL;
menuTable[1] = nullptr;
}
}
@ -1066,12 +1066,12 @@ int processInventory() {
}
void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
if (pMenuElement == NULL)
if (pMenuElement == nullptr)
return;
menuElementSubStruct* pCurrent = pMenuElement;
while (pCurrent != NULL) {
while (pCurrent != nullptr) {
int ovlIdx = pCurrent->ovlIdx;
int header = pCurrent->header;
@ -1218,12 +1218,12 @@ int findHighColor() {
}
void callRelation(menuElementSubStruct *pMenuElement, int nObj2) {
if (pMenuElement == NULL)
if (pMenuElement == nullptr)
return;
menuElementSubStruct* pCurrent = pMenuElement;
while (pCurrent != NULL) {
while (pCurrent != nullptr) {
int ovlIdx = pCurrent->ovlIdx;
int header = pCurrent->header;
@ -1354,20 +1354,20 @@ void callRelation(menuElementSubStruct *pMenuElement, int nObj2) {
void closeAllMenu() {
if (menuTable[0]) {
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
}
if (menuTable[1]) {
freeMenu(menuTable[1]);
menuTable[1] = NULL;
menuTable[1] = nullptr;
}
if (linkedMsgList) {
assert(0);
// freeMsgList(linkedMsgList);
}
linkedMsgList = NULL;
linkedRelation = NULL;
linkedMsgList = nullptr;
linkedRelation = nullptr;
}
bool checkInput(int16 *buttonPtr) {
@ -1494,7 +1494,7 @@ int CruiseEngine::processInput() {
changeCursor(CURSOR_NORMAL);
}
if ((menuTable[0] == NULL) && (!buttonDown)) {
if ((menuTable[0] == nullptr) && (!buttonDown)) {
int dialogFound = createDialog(dialogueOvl, dialogueObj, xdial, 0);
if (menuTable[0]) {
@ -1502,7 +1502,7 @@ int CruiseEngine::processInput() {
currentActiveMenu = 0;
} else {
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
currentActiveMenu = -1;
}
} else {
@ -1514,15 +1514,15 @@ int CruiseEngine::processInput() {
callRelation(getSelectedEntryInMenu(menuTable[0]), dialogueObj);
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
if (linkedMsgList) {
assert(0);
// freeMsgList(linkedMsgList);
}
linkedMsgList = NULL;
linkedRelation = NULL;
linkedMsgList = nullptr;
linkedRelation = nullptr;
changeCursor(CURSOR_NORMAL);
currentActiveMenu = -1;
@ -1550,14 +1550,14 @@ int CruiseEngine::processInput() {
callSubRelation(linkedRelation, objOvl, objIdx);
}
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
}
if (linkedMsgList) {
// freeMsgList(linkedMsgList);
}
linkedMsgList = NULL;
linkedRelation = NULL;
linkedMsgList = nullptr;
linkedRelation = nullptr;
changeCursor(CURSOR_NORMAL);
} else { // call sub relation when clicking in inventory
if (menuTable[0] && menuTable[1]) {
@ -1576,7 +1576,7 @@ int CruiseEngine::processInput() {
// manage click on object menu
if (menuDown == 0) {
// Handle left click on an object
if (menuTable[0] == 0) {
if (menuTable[0] == nullptr) {
int objOvl;
int objIdx;
int objType;
@ -1592,7 +1592,7 @@ int CruiseEngine::processInput() {
} else {
// object has a name but no relation, just move the character
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
aniX = mouseX;
aniY = mouseY;
@ -1619,7 +1619,7 @@ int CruiseEngine::processInput() {
// if there is a linked relation, close menu
if (!linkedRelation) {
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
changeCursor(CURSOR_NORMAL);
} else { // else create the message for the linked relation
char text[80];
@ -1651,15 +1651,15 @@ int CruiseEngine::processInput() {
keyboardCode = Common::KEYCODE_INVALID;
// close object menu if there is no linked relation
if ((linkedRelation == 0) && (menuTable[0])) {
if ((linkedRelation == nullptr) && (menuTable[0])) {
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
selectDown = 0;
menuDown = 0;
currentActiveMenu = -1;
}
if ((!selectDown) && (!menuDown) && (menuTable[1] == NULL)) {
if ((!selectDown) && (!menuDown) && (menuTable[1] == nullptr)) {
buildInventory(mouseX, mouseY);
if (menuTable[1]) {
@ -1768,7 +1768,7 @@ void CruiseEngine::mainLoop() {
currentActiveMenu = -1;
autoMsg = -1;
linkedRelation = 0;
linkedRelation = nullptr;
userWait = false;
autoTrack = false;

View file

@ -215,11 +215,11 @@ int initCt(const char *ctpName) {
if (!loadCtFromSave) {
for (int i = 0; i < 10; i++) {
persoTable[i] = NULL;
persoTable[i] = nullptr;
}
}
uint8* ptr = NULL;
if (!loadFileSub1(&ptr, ctpName, 0)) {
uint8* ptr = nullptr;
if (!loadFileSub1(&ptr, ctpName, nullptr)) {
MemFree(ptr);
return (-18);
}

View file

@ -238,12 +238,12 @@ int getNumMaxEntiresInSet(uint8 *ptr) {
}
int loadFile(const char* name, int idx, int destIdx) {
uint8 *ptr = NULL;
uint8 *ptr = nullptr;
fileTypeEnum fileType;
fileType = getFileType(name);
loadFileSub1(&ptr, name, NULL);
loadFileSub1(&ptr, name, nullptr);
switch (fileType) {
case type_SET: {
@ -280,12 +280,12 @@ int loadFile(const char* name, int idx, int destIdx) {
}
int loadFileRange(const char *name, int startIdx, int currentEntryIdx, int numIdx) {
uint8 *ptr = NULL;
uint8 *ptr = nullptr;
fileTypeEnum fileType;
fileType = getFileType(name);
loadFileSub1(&ptr, name, NULL);
loadFileSub1(&ptr, name, nullptr);
switch (fileType) {
case type_SET: {
@ -320,14 +320,14 @@ int loadFileRange(const char *name, int startIdx, int currentEntryIdx, int numId
}
int loadFullBundle(const char *name, int startIdx) {
uint8 *ptr = NULL;
uint8 *ptr = nullptr;
fileTypeEnum fileType;
fileType = getFileType(name);
loadFileSub1(&ptr, name, NULL);
loadFileSub1(&ptr, name, nullptr);
if (ptr == NULL)
if (ptr == nullptr)
return 0;
switch (fileType) {
@ -375,7 +375,7 @@ int loadFNTSub(uint8 *ptr, int destIdx) {
uint8 *destPtr = filesDatabase[fileIndex].subData.ptr;
if (destPtr != NULL) {
if (destPtr != nullptr) {
memcpy(destPtr, ptr2, loadFileVar1);
destPtr = filesDatabase[fileIndex].subData.ptr;

View file

@ -28,7 +28,7 @@
static const PlainGameDescriptor cruiseGames[] = {
{"cruise", "Cruise for a Corpse"},
{0, 0}
{nullptr, nullptr}
};
static const DebugChannelDef debugFlagList[] = {
@ -109,7 +109,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
{
{
"cruise",
0,
nullptr,
AD_ENTRY1("D1", "70f42a21cc257b01d58667853335f4f1"),
Common::DE_DEU,
Common::kPlatformAmiga,
@ -120,7 +120,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
{ // Amiga English US GOLD edition.
{
"cruise",
0,
nullptr,
AD_ENTRY1("D1", "de084e9d2c6e4b2cc14803bf849eda3e"),
Common::EN_ANY,
Common::kPlatformAmiga,
@ -131,7 +131,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
{ // Amiga Italian US GOLD edition.
{
"cruise",
0,
nullptr,
AD_ENTRY1("D1", "a0011075413b7335e003e8e3c9cf51b9"),
Common::IT_ITA,
Common::kPlatformAmiga,
@ -142,7 +142,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
{ // Amiga Spanish edition.
{
"cruise",
0,
nullptr,
AD_ENTRY1s("D1", "b600d0892a2605b9ead63e1c86a8a0a3", 700576),
Common::ES_ESP,
Common::kPlatformAmiga,
@ -153,7 +153,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
{ // AtariST English KixxXL edition.
{
"cruise",
0,
nullptr,
AD_ENTRY1("D1", "be78614d5fa34bdb68bb03a2a6130280"),
Common::EN_ANY,
Common::kPlatformAtariST,
@ -164,7 +164,7 @@ static const CRUISEGameDescription gameDescriptions[] = {
{ // AtariST French edition. Bugreport #12824
{
"cruise",
0,
nullptr,
AD_ENTRY1s("D1", "485ff850b7035316621f632e33f56468", 537311),
Common::FR_FRA,
Common::kPlatformAtariST,

View file

@ -99,7 +99,7 @@ int32 getTextLineCount(int32 rightBorder_X, int16 wordSpacingWidth,
void loadFNT(const char *fileName) {
uint8 header[4];
_systemFNT = NULL;
_systemFNT = nullptr;
Common::File fontFileHandle;
@ -115,7 +115,7 @@ void loadFNT(const char *fileName) {
_systemFNT = (uint8 *)mallocAndZero(fontSize);
if (_systemFNT != NULL) {
if (_systemFNT != nullptr) {
fontFileHandle.seek(4);
fontFileHandle.read(_systemFNT, fontSize);
@ -148,7 +148,7 @@ void initSystem() {
for (i = 0; i < 64; i++) {
strcpy(preloadData[i].name, "");
preloadData[i].ptr = NULL;
preloadData[i].ptr = nullptr;
preloadData[i].nofree = 0;
}
@ -299,7 +299,7 @@ gfxEntryStruct *renderText(int inRightBorder_X, const char *string) {
// check if string is empty
if (!string) {
return NULL;
return nullptr;
}
// check if font has been loaded, else get system font
if (fontFileIndex != -1) {
@ -313,7 +313,7 @@ gfxEntryStruct *renderText(int inRightBorder_X, const char *string) {
}
if (!fontPtr) {
return NULL;
return nullptr;
}
fontPtr_Desc = (const FontEntry *)((const uint8 *)fontPtr + sizeof(FontInfo));
@ -333,7 +333,7 @@ gfxEntryStruct *renderText(int inRightBorder_X, const char *string) {
numLines = getTextLineCount(rightBorder_X, wordSpacingWidth, fontPtr_Desc, string); // ok
if (!numLines) {
return NULL;
return nullptr;
}
stringHeight = ((wordSpacingHeight + lineHeight + 2) * numLines) + 1;

View file

@ -439,20 +439,20 @@ int16 Op_KillMenu() {
// Free menus, if active
if (menuTable[0]) {
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
currentActiveMenu = -1;
}
if (menuTable[1]) {
freeMenu(menuTable[1]);
menuTable[1] = NULL;
menuTable[1] = nullptr;
currentActiveMenu = -1;
}
// Free the message list
// if (linkedMsgList) freeMsgList(linkedMsgList);
linkedMsgList = NULL;
linkedRelation = NULL;
linkedMsgList = nullptr;
linkedRelation = nullptr;
return 0;
}
@ -1101,7 +1101,7 @@ actorStruct *addAnimation(actorStruct * pHead, int overlay, int objIdx, int para
actorStruct *pNewElement = (actorStruct *) MemAlloc(sizeof(actorStruct));
if (!pNewElement)
return NULL;
return nullptr;
memset(pNewElement, 0, sizeof(actorStruct));
pNewElement->next = pPrevious->next;
@ -1163,7 +1163,7 @@ int removeAnimation(actorStruct * pHead, int overlay, int objIdx, int objType) {
pl2->next = pl4;
pl3 = pl4;
if (pl3 == NULL)
if (pl3 == nullptr)
pl3 = pHead;
pl3->prev = pl->prev;
@ -1701,7 +1701,7 @@ int16 Op_DialogOff() {
if (menuTable[0]) {
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
changeCursor(CURSOR_NORMAL);
currentActiveMenu = -1;
}
@ -1776,7 +1776,7 @@ int16 Op_YMenuItem() {
int16 Op_Menu() {
return (int16)(menuTable[0] != NULL);
return (int16)(menuTable[0] != nullptr);
}
int16 Op_AutoControl() {
@ -1843,7 +1843,7 @@ int16 Op_UserWait() {
}
opcodeFunction opcodeTablePtr[] = {
NULL, // 0x00
nullptr, // 0x00
Op_FadeIn,
Op_FadeOut,
Op_LoadBackground,
@ -1858,11 +1858,11 @@ opcodeFunction opcodeTablePtr[] = {
Op_LoadOverlay,
Op_SetColor,
Op_PlayFX,
NULL, // used to be debug
nullptr, // used to be debug
Op_FreeOverlay, // 0x10
Op_FindOverlay,
NULL, // used to be exec debug
nullptr, // used to be exec debug
Op_AddMessage,
Op_RemoveMessage,
Op_UserWait,
@ -1933,7 +1933,7 @@ opcodeFunction opcodeTablePtr[] = {
Op_MouseEnd,
Op_MsgExist,
Op_SetFont,
NULL, // MergeMsg
nullptr, // MergeMsg
Op_Display,
Op_GetMouseX,
Op_GetMouseY,
@ -1954,7 +1954,7 @@ opcodeFunction opcodeTablePtr[] = {
Op_Sizeof,
Op_Preload,
Op_FreePreload,
NULL, // DeletePreload
nullptr, // DeletePreload
Op_VBL,
Op_LoadFrame,
Op_FreezeOverlay,

View file

@ -64,25 +64,25 @@ exportEntryStruct *parseExport(int *out1, int *pExportedFuncionIdx, char *buffer
strToUpper(overlayName);
strToUpper(functionName);
if (strlen((char *)overlayName) == 0)
return NULL;
return nullptr;
idx = findOverlayByName2(overlayName);
if (idx == -4)
return (NULL);
return (nullptr);
if (overlayTable[idx].alreadyLoaded == 0)
return (NULL);
return (nullptr);
if (!overlayTable[idx].ovlData)
return (NULL);
return (nullptr);
numSymbGlob = overlayTable[idx].ovlData->numSymbGlob;
currentExportEntry = overlayTable[idx].ovlData->arraySymbGlob;
entity1Name = overlayTable[idx].ovlData->arrayNameSymbGlob;
if (!entity1Name)
return (0);
return (nullptr);
for (int i = 0; i < numSymbGlob; i++) {
char exportedName[256];
@ -100,7 +100,7 @@ exportEntryStruct *parseExport(int *out1, int *pExportedFuncionIdx, char *buffer
currentExportEntry++;
}
return (NULL);
return (nullptr);
}
int updateScriptImport(int ovlIdx) {

View file

@ -1272,7 +1272,7 @@ void drawCtp() {
#endif
void drawMenu(menuStruct *pMenu) {
if (pMenu == NULL)
if (pMenu == nullptr)
return;
if (pMenu->numElements == 0)
@ -1405,7 +1405,7 @@ void mainDraw(bool waitFl) {
}
}
autoCellHead.next = NULL;
autoCellHead.next = nullptr;
currentObjPtr = cellHead.next;

View file

@ -44,7 +44,7 @@ menuStruct *createMenu(int X, int Y, const char *menuName) {
entry->y = Y;
entry->stringPtr = menuName;
entry->numElements = 0;
entry->ptrNextElement = NULL;
entry->ptrNextElement = nullptr;
entry->gfx = renderText(160, menuName);
return entry;
@ -70,7 +70,7 @@ void addSelectableMenuEntry(int ovlIdx, int headerIdx, menuStruct *pMenu, int pa
pSubStruct = (menuElementSubStruct *)allocAndZero(sizeof(menuElementSubStruct));
assert(pSubStruct);
pSubStruct->pNext = NULL;
pSubStruct->pNext = nullptr;
pSubStruct->ovlIdx = ovlIdx;
pSubStruct->header = headerIdx;
@ -103,12 +103,12 @@ void addSelectableMenuEntry(int ovlIdx, int headerIdx, menuStruct *pMenu, int pa
assert(pSubStruct);
pNewElement->string = menuText;
pNewElement->next = NULL;
pNewElement->next = nullptr;
pNewElement->selected = false;
pNewElement->color = color;
pNewElement->gfx = renderText(160, menuText);
if (var_6 == NULL) {
if (var_6 == nullptr) {
pMenu->ptrNextElement = pNewElement;
} else {
var_6->next = pNewElement;
@ -116,7 +116,7 @@ void addSelectableMenuEntry(int ovlIdx, int headerIdx, menuStruct *pMenu, int pa
pNewElement->ptrSub = pSubStruct;
pSubStruct->pNext = NULL;
pSubStruct->pNext = nullptr;
pSubStruct->ovlIdx = ovlIdx;
pSubStruct->header = headerIdx;
@ -261,7 +261,7 @@ int playerMenu(int menuX, int menuY) {
int retourMenu = processMenu(menuTable[0]);
freeMenu(menuTable[0]);
menuTable[0] = NULL;
menuTable[0] = nullptr;
currentMouseButton = 0;
switch (retourMenu) {

View file

@ -40,24 +40,24 @@ objDataStruct *getObjectDataFromOverlay(int ovlIdx, int objIdx) {
objDataStruct *var_6;
if (ovlIdx < 1 || objIdx < 0)
return NULL;
return nullptr;
if (!overlayTable[ovlIdx].ovlData)
return NULL;
return nullptr;
if (overlayTable[ovlIdx].ovlData->numObj <= objIdx)
return NULL;
return nullptr;
var_6 = overlayTable[ovlIdx].ovlData->arrayObject;
if (!var_6)
return NULL;
return nullptr;
return (&var_6[objIdx]);
}
int16 getMultipleObjectParam(int16 overlayIdx, int16 objectIdx, objectParamsQuery *returnParam) {
objectParams *ptr2 = 0;
objectParams *ptr2 = nullptr;
objDataStruct *ptr;
ovlDataStruct *ovlData;
// int16 type;
@ -228,7 +228,7 @@ int16 getSingleObjectParam(int16 overlayIdx, int16 param2, int16 param3, int16 *
//char* ptr3 = NULL;
objDataStruct *ptr;
ovlDataStruct *ovlData;
objectParams *ptr2 = 0;
objectParams *ptr2 = nullptr;
ptr = getObjectDataFromOverlay(overlayIdx, param2);
@ -312,7 +312,7 @@ const char *getObjectName(int index, const char *string) {
const char *ptr = string;
if (!string)
return NULL;
return nullptr;
int i = 0;
// int j = 0;

View file

@ -34,7 +34,7 @@ int numOfLoadedOverlay;
void initOverlayTable() {
for (int i = 0; i < 90; i++) {
overlayTable[i].overlayName[0] = 0;
overlayTable[i].ovlData = NULL;
overlayTable[i].ovlData = nullptr;
overlayTable[i].alreadyLoaded = 0;
overlayTable[i].executeScripts = 0;
}
@ -111,7 +111,7 @@ int freeOverlay(int overlayIdx) {
MemFree(ovlDataPtr->arrayNameRelocGlob);
MemFree(ovlDataPtr);
overlayTable[overlayIdx].ovlData = NULL;
overlayTable[overlayIdx].ovlData = nullptr;
debug(1, "freeOverlay: finish !");
@ -202,28 +202,28 @@ int loadOverlay(const char *scriptName) {
debug(1, "OVL loading done...");
Common::MemoryReadStream s(unpackedBuffer, unpackedSize, DisposeAfterUse::YES);
unpackedBuffer = NULL;
unpackedBuffer = nullptr;
ovlData = overlayTable[scriptIdx].ovlData;
// Skip pointers
s.skip(60);
ovlData->arrayProc = NULL;
ovlData->ptr1 = NULL;
ovlData->arrayObject = NULL;
ovlData->arrayStates = NULL;
ovlData->arrayObjVar = NULL;
ovlData->stringTable = NULL;
ovlData->arraySymbGlob = NULL;
ovlData->arrayRelocGlob = NULL;
ovlData->arrayMsgRelHeader = NULL;
ovlData->nameVerbGlob = NULL;
ovlData->arrayNameObj = NULL;
ovlData->arrayNameRelocGlob = NULL;
ovlData->arrayNameSymbGlob = NULL;
ovlData->data4Ptr = NULL;
ovlData->ptr8 = NULL;
ovlData->arrayProc = nullptr;
ovlData->ptr1 = nullptr;
ovlData->arrayObject = nullptr;
ovlData->arrayStates = nullptr;
ovlData->arrayObjVar = nullptr;
ovlData->stringTable = nullptr;
ovlData->arraySymbGlob = nullptr;
ovlData->arrayRelocGlob = nullptr;
ovlData->arrayMsgRelHeader = nullptr;
ovlData->nameVerbGlob = nullptr;
ovlData->arrayNameObj = nullptr;
ovlData->arrayNameRelocGlob = nullptr;
ovlData->arrayNameSymbGlob = nullptr;
ovlData->data4Ptr = nullptr;
ovlData->ptr8 = nullptr;
ovlData->numProc = s.readUint16BE();
ovlData->numRel = s.readUint16BE();
ovlData->numSymbGlob = s.readUint16BE();
@ -338,7 +338,7 @@ int loadOverlay(const char *scriptName) {
for (int i = 0; i < ovlData->numProc; i++) {
s.skip(4);
ovlData->arrayProc[i].dataPtr = NULL;
ovlData->arrayProc[i].dataPtr = nullptr;
ovlData->arrayProc[i].sizeOfData = s.readUint16BE();
ovlData->arrayProc[i].offsetToSubData3 = s.readUint16BE();
ovlData->arrayProc[i].offsetToImportData = s.readUint16BE();
@ -388,7 +388,7 @@ int loadOverlay(const char *scriptName) {
for (int i = 0; i < ovlData->numRel; i++) {
s.skip(4);
ovlData->ptr1[i].dataPtr = NULL;
ovlData->ptr1[i].dataPtr = nullptr;
ovlData->ptr1[i].sizeOfData = s.readUint16BE();
ovlData->ptr1[i].offsetToSubData3 = s.readUint16BE();
ovlData->ptr1[i].offsetToImportData = s.readUint16BE();
@ -550,7 +550,7 @@ int loadOverlay(const char *scriptName) {
}
Common::MemoryReadStream s2(unpackedBuffer, unpackedSize, DisposeAfterUse::YES);
unpackedBuffer = NULL;
unpackedBuffer = nullptr;
ovlData->specialString1Length = s2.readUint16BE();
if (ovlData->specialString1Length) {

View file

@ -33,7 +33,7 @@ int16 numPoly;
void freePerso(int persoIdx) {
if (persoTable[persoIdx]) {
MemFree(persoTable[persoIdx]);
persoTable[persoIdx] = NULL;
persoTable[persoIdx] = nullptr;
}
}
@ -46,11 +46,11 @@ void freeCTP() {
if (_vm->_polyStruct) {
_vm->_polyStructNorm.clear();
_vm->_polyStructExp.clear();
_vm->_polyStruct = NULL;
_vm->_polyStruct = nullptr;
}
ctpVar17 = NULL;
_vm->_polyStruct = NULL;
ctpVar17 = nullptr;
_vm->_polyStruct = nullptr;
strcpy((char *)currentCtpName, "");
}

View file

@ -188,7 +188,7 @@ static void syncFilesDatabase(Common::Serializer &s) {
tmp = (fe.subData.ptr) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
fe.subData.ptr = tmp ? (uint8 *)1 : 0;
fe.subData.ptr = tmp ? (uint8 *)1 : nullptr;
}
s.syncAsSint16LE(fe.subData.index);
@ -201,7 +201,7 @@ static void syncFilesDatabase(Common::Serializer &s) {
tmp = (fe.subData.ptrMask) ? 1 : 0;
s.syncAsUint32LE(tmp);
if (s.isLoading()) {
fe.subData.ptrMask = tmp ? (uint8 *)1 : 0;
fe.subData.ptrMask = tmp ? (uint8 *)1 : nullptr;
}
s.syncAsUint16LE(fe.subData.resourceType);
@ -276,8 +276,8 @@ static void syncOverlays2(Common::Serializer &s) {
} else {
// Loading code
ovlRestoreData[i]._sBssSize = ovlRestoreData[i]._sNumObj = 0;
ovlRestoreData[i]._pBss = NULL;
ovlRestoreData[i]._pObj = NULL;
ovlRestoreData[i]._pBss = nullptr;
ovlRestoreData[i]._pObj = nullptr;
if (overlayTable[i].alreadyLoaded) {
s.syncAsSint16LE(ovlRestoreData[i]._sBssSize);
@ -352,7 +352,7 @@ void syncScript(Common::Serializer &s, scriptInstanceStruct *entry) {
}
if (s.isLoading()) {
ptr->nextScriptPtr = NULL;
ptr->nextScriptPtr = nullptr;
entry->nextScriptPtr = ptr;
entry = ptr;
} else {
@ -374,7 +374,7 @@ static void syncCell(Common::Serializer &s) {
t = t->next;
}
} else {
cellHead.next = NULL; // Not in ASM code, but I guess the variable is defaulted in the EXE
cellHead.next = nullptr; // Not in ASM code, but I guess the variable is defaulted in the EXE
}
s.syncAsSint16LE(chunkCount);
@ -413,7 +413,7 @@ static void syncCell(Common::Serializer &s) {
if (s.isSaving())
t = t->next;
else {
p->next = NULL;
p->next = nullptr;
t->next = p;
p->prev = cellHead.prev;
cellHead.prev = p;
@ -479,7 +479,7 @@ static void syncIncrust(Common::Serializer &s) {
if (s.isSaving())
pl = pl->next;
else {
t->next = NULL;
t->next = nullptr;
pl->next = t;
t->prev = pl1->prev;
pl1->prev = t;
@ -530,7 +530,7 @@ static void syncActors(Common::Serializer &s) {
if (s.isSaving())
ptr = ptr->next;
else {
p->next = NULL;
p->next = nullptr;
ptr->next = p;
p->prev = actorHead.prev;
actorHead.prev = p;
@ -580,7 +580,7 @@ static void syncCT(Common::Serializer &s) {
int v = (_vm->_polyStruct) ? 1 : 0;
s.syncAsSint32LE(v);
if (s.isLoading())
_vm->_polyStruct = (v != 0) ? &_vm->_polyStructNorm : NULL;
_vm->_polyStruct = (v != 0) ? &_vm->_polyStructNorm : nullptr;
if (v == 0)
// There is no further data to load or save
@ -602,7 +602,7 @@ static void syncCT(Common::Serializer &s) {
if (s.isLoading())
// Set up the pointer for the next structure
persoTable[i] = (v == 0) ? NULL : (persoStruct *)mallocAndZero(sizeof(persoStruct));
persoTable[i] = (v == 0) ? nullptr : (persoStruct *)mallocAndZero(sizeof(persoStruct));
if (v != 0)
syncPerso(s, *persoTable[i]);
@ -644,7 +644,7 @@ void resetPreload() {
if (strlen(preloadData[i].name)) {
if (preloadData[i].ptr) {
MemFree(preloadData[i].ptr);
preloadData[i].ptr = NULL;
preloadData[i].ptr = nullptr;
}
strcpy(preloadData[i].name, "");
preloadData[i].nofree = 0;
@ -656,7 +656,7 @@ void unloadOverlay(const char*name, int overlayNumber) {
releaseOverlay(name);
strcpy(overlayTable[overlayNumber].overlayName, "");
overlayTable[overlayNumber].ovlData = NULL;
overlayTable[overlayNumber].ovlData = nullptr;
overlayTable[overlayNumber].alreadyLoaded = 0;
}
@ -708,7 +708,7 @@ void initVars() {
soundList[3].frameNum = -1;
for (unsigned long int i = 0; i < 8; i++) {
menuTable[i] = NULL;
menuTable[i] = nullptr;
}
for (unsigned long int i = 0; i < 2000; i++) {
@ -720,8 +720,8 @@ void initVars() {
}
for (unsigned long int i = 0; i < NUM_FILE_ENTRIES; i++) {
filesDatabase[i].subData.ptr = NULL;
filesDatabase[i].subData.ptrMask = NULL;
filesDatabase[i].subData.ptr = nullptr;
filesDatabase[i].subData.ptrMask = nullptr;
}
initBigVar3();
@ -784,7 +784,7 @@ Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName)
const char *filename = _vm->getSavegameFile(saveGameIdx);
Common::SaveFileManager *saveMan = g_system->getSavefileManager();
Common::OutSaveFile *f = saveMan->openForSaving(filename);
if (f == NULL)
if (f == nullptr)
return Common::kNoGameDataFoundError;
// Save the savegame header
@ -798,7 +798,7 @@ Common::Error saveSavegameData(int saveGameIdx, const Common::String &saveName)
return Common::kWritingFailed;
} else {
// Create the remainder of the savegame
Common::Serializer s(NULL, f);
Common::Serializer s(nullptr, f);
DoSync(s);
f->finalize();
@ -814,7 +814,7 @@ Common::Error loadSavegameData(int saveGameIdx) {
Common::SaveFileManager *saveMan = g_system->getSavefileManager();
Common::InSaveFile *f = saveMan->openForLoading(_vm->getSavegameFile(saveGameIdx));
if (f == NULL) {
if (f == nullptr) {
printInfoBlackBox("Savegame not found...");
waitForPlayerInput();
return Common::kNoGameDataFoundError;
@ -833,7 +833,7 @@ Common::Error loadSavegameData(int saveGameIdx) {
}
// Synchronise the remaining data of the savegame
Common::Serializer s(f, NULL);
Common::Serializer s(f, nullptr);
DoSync(s);
delete f;
@ -841,7 +841,7 @@ Common::Error loadSavegameData(int saveGameIdx) {
// Post processing
for (int j = 0; j < 64; j++)
preloadData[j].ptr = NULL;
preloadData[j].ptr = nullptr;
for (int j = 1; j < numOfLoadedOverlay; j++) {
if (overlayTable[j].alreadyLoaded) {
@ -892,8 +892,8 @@ Common::Error loadSavegameData(int saveGameIdx) {
;
for (int k = i; k < j; k++) {
filesDatabase[k].subData.ptr = NULL;
filesDatabase[k].subData.ptrMask = NULL;
filesDatabase[k].subData.ptr = nullptr;
filesDatabase[k].subData.ptrMask = nullptr;
}
/*if (j < 2) {
@ -903,8 +903,8 @@ Common::Error loadSavegameData(int saveGameIdx) {
if (strlen(filesDatabase[i].subData.name) > 0) {
loadFileRange(filesDatabase[i].subData.name, filesDatabase[i].subData.index, i, j - i);
} else {
filesDatabase[i].subData.ptr = NULL;
filesDatabase[i].subData.ptrMask = NULL;
filesDatabase[i].subData.ptr = nullptr;
filesDatabase[i].subData.ptrMask = nullptr;
}
i = j - 1;

View file

@ -59,7 +59,7 @@ int32 opcodeType0() {
index = saveOpcodeVar;
// fall through
case 1: {
uint8 *address = 0;
uint8 *address = nullptr;
int type = getByteFromScript();
int ovl = getByteFromScript();
short int offset = getShortFromScript();
@ -150,7 +150,7 @@ int32 opcodeType1() {
int var_C = short1;
uint8 *ptr = 0;
uint8 *ptr = nullptr;
int type2;
if (!var_6)
@ -229,7 +229,7 @@ int32 opcodeType2() {
index = saveOpcodeVar;
// fall through
case 1: {
uint8* adresse = NULL;
uint8* adresse = nullptr;
int type = getByteFromScript();
int overlay = getByteFromScript();
@ -464,7 +464,7 @@ int32 opcodeType9() { // stop script
void setupFuncArray() {
for (int i = 0; i < 64; i++)
opcodeTypeTable[i] = NULL;
opcodeTypeTable[i] = nullptr;
opcodeTypeTable[1] = opcodeType0;
opcodeTypeTable[2] = opcodeType1;
@ -509,13 +509,13 @@ uint8 *attacheNewScriptToTail(scriptInstanceStruct *scriptHandlePtr, int16 overl
else if (scriptType == 30)
data3Ptr = scriptFunc1Sub2(overlayNumber, param);
else
return (NULL);
return (nullptr);
if (!data3Ptr)
return (NULL);
return (nullptr);
if (!data3Ptr->dataPtr)
return (NULL);
return (nullptr);
var_C = data3Ptr->sysKey;
oldTail = scriptHandlePtr;
@ -526,15 +526,15 @@ uint8 *attacheNewScriptToTail(scriptInstanceStruct *scriptHandlePtr, int16 overl
scriptInstanceStruct *tempPtr = (scriptInstanceStruct *)mallocAndZero(sizeof(scriptInstanceStruct));
if (!tempPtr)
return (NULL);
return (nullptr);
tempPtr->data = NULL;
tempPtr->data = nullptr;
if (var_C)
tempPtr->data = (uint8 *) mallocAndZero(var_C);
tempPtr->dataSize = var_C;
tempPtr->nextScriptPtr = NULL;
tempPtr->nextScriptPtr = nullptr;
tempPtr->scriptOffset = 0;
tempPtr->scriptNumber = param;
tempPtr->overlayNumber = overlayNumber;
@ -621,7 +621,7 @@ int executeScripts(scriptInstanceStruct *ptr) {
}
} while (!opcodeTypeTable[(opcodeType & 0xFB) >> 3]());
currentScriptPtr = NULL;
currentScriptPtr = nullptr;
return (0);
}

View file

@ -216,7 +216,7 @@ public:
static void updateCallback(void *ref);
bool songLoaded() const { return _sfxData != NULL; }
bool songLoaded() const { return _sfxData != nullptr; }
bool songPlayed() const { return _songPlayed; }
bool playing() const { return _playing; }
uint8 numOrders() const { assert(_sfxData); return _sfxData[470]; }
@ -232,7 +232,7 @@ public:
byte *readBundleSoundFile(const char *name) {
// Load the correct file
int fileIdx = findFileInDisks(name);
if (fileIdx < 0) return NULL;
if (fileIdx < 0) return nullptr;
int unpackedSize = volumePtrToFileDescriptor[fileIdx].extSize + 2;
byte *data = (byte *)MemAlloc(unpackedSize);
@ -579,7 +579,7 @@ void AdLibSoundDriverADL::playSample(const byte *data, int size, int channel, in
PCSoundFxPlayer::PCSoundFxPlayer(PCSoundDriver *driver)
: _playing(false), _songPlayed(false), _driver(driver) {
memset(_instrumentsData, 0, sizeof(_instrumentsData));
_sfxData = NULL;
_sfxData = nullptr;
_fadeOutCounter = 0;
_driver->setUpdateCallback(updateCallback, this);
@ -592,7 +592,7 @@ PCSoundFxPlayer::PCSoundFxPlayer(PCSoundDriver *driver)
}
PCSoundFxPlayer::~PCSoundFxPlayer() {
_driver->setUpdateCallback(NULL, NULL);
_driver->setUpdateCallback(nullptr, nullptr);
stop();
}
@ -619,7 +619,7 @@ bool PCSoundFxPlayer::load(const char *song) {
}
for (int i = 0; i < NUM_INSTRUMENTS; ++i) {
_instrumentsData[i] = NULL;
_instrumentsData[i] = nullptr;
char instrument[64];
memset(instrument, 0, 64); // Clear the data first
@ -738,10 +738,10 @@ void PCSoundFxPlayer::handlePattern(int channel, const byte *patternData) {
void PCSoundFxPlayer::unload() {
for (int i = 0; i < NUM_INSTRUMENTS; ++i) {
MemFree(_instrumentsData[i]);
_instrumentsData[i] = NULL;
_instrumentsData[i] = nullptr;
}
MemFree(_sfxData);
_sfxData = NULL;
_sfxData = nullptr;
_songPlayed = true;
}

View file

@ -61,7 +61,7 @@ void pushPtr(void *ptr) {
void *popPtr() {
if (positionInStack <= 0) {
return (0);
return (nullptr);
}
positionInStack--;

View file

@ -307,26 +307,26 @@ const byte mouseCursorMagnifyingGlass[] = {
};
const char *englishLanguageStrings[13] = {
"Pause", NULL, NULL, NULL, NULL, "Inventory", "Speak about...", "Player Menu", NULL,
"Pause", nullptr, nullptr, nullptr, nullptr, "Inventory", "Speak about...", "Player Menu", nullptr,
"Save", "Load", "Start Again", "Quit"
};
const char *frenchLanguageStrings[13] = {
"", NULL, NULL, NULL, NULL, "Inventaire", "Parler de...", "Menu Joueur", NULL,
"", nullptr, nullptr, nullptr, nullptr, "Inventaire", "Parler de...", "Menu Joueur", nullptr,
"Sauvegarde", "Chargement", "Recommencer le jeu", "Quitter"
};
// The original Amiga version does use "Speilermen\xFC" instead of "Spielermen\xFC", if we want to correct
// this typo, we can easily do so.
const char *germanLanguageStrings[13] = {
" ", NULL, NULL, NULL, NULL, "Inventar", "Sprechen ""\xFC""ber", "Speilermen\xFC", "Speicherlaufwerk",
" ", nullptr, nullptr, nullptr, nullptr, "Inventar", "Sprechen ""\xFC""ber", "Speilermen\xFC", "Speicherlaufwerk",
"Speichern", "Laden", "Neu beginnen", "Ende"
};
const char *italianLanguageStrings[13] = {
"Pausa", NULL, NULL, NULL, NULL, "Inventario", "Parla di...", "Menu giocatore", NULL,
"Pausa", nullptr, nullptr, nullptr, nullptr, "Inventario", "Parla di...", "Menu giocatore", nullptr,
"Salva", "Carica", "Ricomincia", "Esci"
};
const char *spanishLanguageStrings[13] = {
"Pausa", NULL, NULL, NULL, NULL, "Inventario", "Hablar de...", "Menu del jugador", NULL,
"Pausa", nullptr, nullptr, nullptr, nullptr, "Inventario", "Hablar de...", "Menu del jugador", nullptr,
"Salvar", "Cargar", "Recomenzar", "Salir"
};

View file

@ -29,11 +29,11 @@ bool PCFadeFlag;
char *getText(int textIndex, int overlayIndex) {
if (!overlayTable[overlayIndex].ovlData) {
return NULL;
return nullptr;
}
if (!overlayTable[overlayIndex].ovlData->stringTable) {
return NULL;
return nullptr;
}
return overlayTable[overlayIndex].ovlData->stringTable[textIndex].

View file

@ -24,7 +24,7 @@
namespace Cruise {
uint8 *_systemFNT = NULL;
uint8 *_systemFNT = nullptr;
uint8 itemColor = 1;
uint8 selectColor = 3;
@ -59,7 +59,7 @@ int16 autoTrack;
int16 currentDiskNumber = 1;
int16 volumeNumEntry;
fileEntry *volumePtrToFileDescriptor = NULL;
fileEntry *volumePtrToFileDescriptor = nullptr;
uint32 volumeFileDescriptorSize;
int16 volumeSizeOfEntry;

View file

@ -25,7 +25,7 @@
namespace Cruise {
uint8 *PAL_ptr = NULL;
uint8 *PAL_ptr = nullptr;
int16 numLoadedPal;
int16 fileData2;
@ -58,7 +58,7 @@ void closePal() {
_vm->_PAL_file.close();
MemFree(PAL_ptr);
PAL_ptr = NULL;
PAL_ptr = nullptr;
numLoadedPal = 0;
fileData2 = 0;
@ -304,7 +304,7 @@ int closeCnf() {
for (long int i = 0; i < numOfDisks; i++) {
if (volumeData[i].ptr) {
MemFree(volumeData[i].ptr);
volumeData[i].ptr = NULL;
volumeData[i].ptr = nullptr;
}
}
@ -321,7 +321,7 @@ int16 readVolCnf() {
for (int i = 0; i < 20; i++) {
volumeData[i].ident[0] = 0;
volumeData[i].ptr = NULL;
volumeData[i].ptr = nullptr;
volumeData[i].diskNumber = i + 1;
volumeData[i].size = 0;
}