aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoruruk2014-07-07 21:42:45 +0200
committeruruk2014-07-07 21:42:45 +0200
commitc7aa91019b08c52976356031cf2059333ab6fd23 (patch)
tree6cbe4efb5624b77060f62041e3422b39a2446a91
parentc5855b4293522f365329593e41a16e68b1424967 (diff)
downloadscummvm-rg350-c7aa91019b08c52976356031cf2059333ab6fd23.tar.gz
scummvm-rg350-c7aa91019b08c52976356031cf2059333ab6fd23.tar.bz2
scummvm-rg350-c7aa91019b08c52976356031cf2059333ab6fd23.zip
CGE2: Replace NULL with nullptr everywhere.
-rw-r--r--engines/cge2/bitmap.cpp8
-rw-r--r--engines/cge2/cge2_main.cpp28
-rw-r--r--engines/cge2/events.cpp8
-rw-r--r--engines/cge2/fileio.cpp6
-rw-r--r--engines/cge2/hero.cpp14
-rw-r--r--engines/cge2/snail.cpp6
-rw-r--r--engines/cge2/sound.cpp8
-rw-r--r--engines/cge2/talk.cpp6
-rw-r--r--engines/cge2/text.cpp4
-rw-r--r--engines/cge2/vga13h.cpp44
-rw-r--r--engines/cge2/vga13h.h6
11 files changed, 69 insertions, 69 deletions
diff --git a/engines/cge2/bitmap.cpp b/engines/cge2/bitmap.cpp
index 4d1fb6a043..fd2f6a441f 100644
--- a/engines/cge2/bitmap.cpp
+++ b/engines/cge2/bitmap.cpp
@@ -84,7 +84,7 @@ Bitmap::Bitmap(CGE2Engine *vm, uint16 w, uint16 h, uint8 fill)
uint16 psiz = _h * lsiz; // - last gape, but + plane trailer
uint8 *v = new uint8[4 * psiz + _h * sizeof(*_b)];// the same for 4 planes
// + room for wash table
- assert(v != NULL);
+ assert(v != nullptr);
WRITE_LE_UINT16(v, (kBmpCPY | dsiz)); // data chunk hader
memset(v + 2, fill, dsiz); // data bytes
@@ -176,7 +176,7 @@ Common::String Bitmap::setExtension(const Common::String &str, const Common::Str
BitmapPtr Bitmap::code(uint8 *map) {
if (!map)
- return NULL;
+ return nullptr;
uint16 cnt;
@@ -265,7 +265,7 @@ BitmapPtr Bitmap::code(uint8 *map) {
uint16 sizV = (uint16)(im - 2 - _v);
_v = new uint8[sizV + _h * sizeof(*_b)];
- assert(_v != NULL);
+ assert(_v != nullptr);
_b = (HideDesc *)(_v + sizV);
}
@@ -383,7 +383,7 @@ bool Bitmap::loadVBM(EncryptedStream *f) {
f->seek(f->pos() + kPalSize);
}
}
- if ((_v = new uint8[n]) == NULL)
+ if ((_v = new uint8[n]) == nullptr)
return false;
if (!f->err())
diff --git a/engines/cge2/cge2_main.cpp b/engines/cge2/cge2_main.cpp
index b9787b07e1..be83beda1f 100644
--- a/engines/cge2/cge2_main.cpp
+++ b/engines/cge2/cge2_main.cpp
@@ -52,7 +52,7 @@ void System::touch(uint16 mask, V2D pos, Common::KeyCode keyCode) {
// The sound is uselessly annoying and noisy, so it has been removed
_vm->killText();
if (_vm->_startupMode == 1) {
- _vm->_commandHandler->addCommand(kCmdClear, -1, 0, NULL);
+ _vm->_commandHandler->addCommand(kCmdClear, -1, 0, nullptr);
return;
}
}
@@ -335,43 +335,43 @@ void CGE2Engine::loadScript(const char *fname) {
V3D P;
// sprite ident number
- if ((p = token(tmpStr)) == NULL)
+ if ((p = token(tmpStr)) == nullptr)
break;
int SpI = number(p);
// sprite file name
char *SpN;
- if ((SpN = token(nullptr)) == NULL)
+ if ((SpN = token(nullptr)) == nullptr)
break;
// sprite scene
- if ((p = token(nullptr)) == NULL)
+ if ((p = token(nullptr)) == nullptr)
break;
int SpA = number(p);
// sprite column
- if ((p = token(nullptr)) == NULL)
+ if ((p = token(nullptr)) == nullptr)
break;
P._x = number(p);
// sprite row
- if ((p = token(nullptr)) == NULL)
+ if ((p = token(nullptr)) == nullptr)
break;
P._y = number(p);
// sprite Z pos
- if ((p = token(nullptr)) == NULL)
+ if ((p = token(nullptr)) == nullptr)
break;
P._z = number(p);
// sprite life
- if ((p = token(nullptr)) == NULL)
+ if ((p = token(nullptr)) == nullptr)
break;
bool BkG = number(p) == 0;
ok = true; // no break: OK
- _sprite = NULL;
+ _sprite = nullptr;
loadSprite(SpN, SpI, SpA, P);
if (_sprite) {
if (BkG)
@@ -538,7 +538,7 @@ void CGE2Engine::showBak(int ref) {
if (spr != nullptr) {
_bitmapPalette = _vga->_sysPal;
spr->expand();
- _bitmapPalette = NULL;
+ _bitmapPalette = nullptr;
spr->show(2);
_vga->copyPage(1, 2);
_spare->dispose(spr);
@@ -860,7 +860,7 @@ void CGE2Engine::cge2_main() {
if (_mode == 1)
movie(kIntroExt);
#endif
- if (_text->getText(255) != NULL) {
+ if (_text->getText(255) != nullptr) {
runGame();
_startupMode = 2;
} else
@@ -892,8 +892,8 @@ void CGE2Engine::setEye(const char *s) {
char tempStr[kLineMax];
strcpy(tempStr, s);
_eye->_x = atoi(token(tempStr));
- _eye->_y = atoi(token(NULL));
- _eye->_z = atoi(token(NULL));
+ _eye->_y = atoi(token(nullptr));
+ _eye->_z = atoi(token(nullptr));
}
int CGE2Engine::newRandom(int range) {
@@ -967,7 +967,7 @@ void CGE2Engine::killText() {
return;
_commandHandlerTurbo->addCommand(kCmdKill, -1, 0, _talk);
- _talk = NULL;
+ _talk = nullptr;
}
void CGE2Engine::switchHero(int sex) {
diff --git a/engines/cge2/events.cpp b/engines/cge2/events.cpp
index 0c163a5454..c56f005fbb 100644
--- a/engines/cge2/events.cpp
+++ b/engines/cge2/events.cpp
@@ -39,7 +39,7 @@ namespace CGE2 {
/*----------------- KEYBOARD interface -----------------*/
-Keyboard::Keyboard(CGE2Engine *vm) : _client(NULL), _vm(vm) {
+Keyboard::Keyboard(CGE2Engine *vm) : _client(nullptr), _vm(vm) {
warning("STUB: Keyboard::Keyboard() - Recheck the whole implementation!!!");
}
@@ -62,13 +62,13 @@ void Keyboard::newKeyboard(Common::Event &event) {
/*----------------- MOUSE interface -----------------*/
-Mouse::Mouse(CGE2Engine *vm) : Sprite(vm), _busy(NULL), _hold(NULL), _hx(0), _point(_vm), _vm(vm) {
- _hold = NULL;
+Mouse::Mouse(CGE2Engine *vm) : Sprite(vm), _busy(nullptr), _hold(nullptr), _hx(0), _point(_vm), _vm(vm) {
+ _hold = nullptr;
_hx = 0;
_hy = 0;
_exist = true;
_buttons = 0;
- _busy = NULL;
+ _busy = nullptr;
_active = false;
_flags._kill = false;
diff --git a/engines/cge2/fileio.cpp b/engines/cge2/fileio.cpp
index cc07ef6fc1..257e977d45 100644
--- a/engines/cge2/fileio.cpp
+++ b/engines/cge2/fileio.cpp
@@ -75,7 +75,7 @@ ResourceManager::ResourceManager() {
_buff[i]._page = new BtPage;
_buff[i]._pageNo = kBtValNone;
_buff[i]._index = -1;
- assert(_buff[i]._page != NULL);
+ assert(_buff[i]._page != nullptr);
}
}
@@ -160,7 +160,7 @@ BtKeypack *ResourceManager::find(const char *key) {
return &pg->_leaf[i];
}
}
- return NULL;
+ return nullptr;
}
bool ResourceManager::exist(const char *name) {
@@ -272,7 +272,7 @@ const char *EncryptedStream::kIdTab[] = {
"[near]", "[mtake]", "[ftake]", "[phase]", "[seq]",
"Name", "Type", "Front", "East",
"Portable", "Transparent",
- NULL
+ nullptr
};
} // End of namespace CGE2
diff --git a/engines/cge2/hero.cpp b/engines/cge2/hero.cpp
index 7e6c384a46..4b50cccd8b 100644
--- a/engines/cge2/hero.cpp
+++ b/engines/cge2/hero.cpp
@@ -127,10 +127,10 @@ Sprite *Hero::expand() { // It's very similar to Sprite's expand, but doesn't bo
if (_actionCtrl[section]._cnt) {
CommandHandler::Command *c = &_ext->_actions[section][cnt[section]++];
c->_commandType = CommandType(id);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
c->_ref = _vm->number(p);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
c->_val = _vm->number(p);
c->_spritePtr = nullptr;
@@ -141,7 +141,7 @@ Sprite *Hero::expand() { // It's very similar to Sprite's expand, but doesn't bo
s->_now = atoi(p);
if (s->_now > maxnow)
maxnow = s->_now;
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
break;
s->_next = _vm->number(p);
switch (s->_next) {
@@ -154,16 +154,16 @@ Sprite *Hero::expand() { // It's very similar to Sprite's expand, but doesn't bo
}
if (s->_next > maxnxt)
maxnxt = s->_next;
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
s->_dx = _vm->number(p);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
s->_dy = _vm->number(p);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
s->_dz = _vm->number(p);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
s->_dly = _vm->number(p);
break;
diff --git a/engines/cge2/snail.cpp b/engines/cge2/snail.cpp
index 609196cc26..62dfd996e9 100644
--- a/engines/cge2/snail.cpp
+++ b/engines/cge2/snail.cpp
@@ -54,7 +54,7 @@ const char *CommandHandler::_commandText[] = {
"RMNEAR", "RMMTAKE", "RMFTAKE",
"SETREF", "BACKPT",
"WALKTO", "REACH", "COVER", "UNCOVER",
- NULL };
+ nullptr };
CommandHandler::CommandHandler(CGE2Engine *vm, bool turbo)
: _turbo(turbo), _textDelay(false), _timerExpiry(0), _talkEnable(true),
@@ -424,7 +424,7 @@ void CGE2Engine::snSend(Sprite *spr, int val) {
((Hero*)spr)->setCurrent();
}
_taken = false;
- _bitmapPalette = NULL;
+ _bitmapPalette = nullptr;
}
}
}
@@ -792,7 +792,7 @@ void CommandHandler::addCallback(CommandType com, int ref, int val, CallbackType
headCmd->_commandType = com;
headCmd->_ref = ref;
headCmd->_val = val;
- headCmd->_spritePtr = NULL;
+ headCmd->_spritePtr = nullptr;
headCmd->_cbType = cbType;
if (headCmd->_commandType == kCmdClear) {
_tail = _head;
diff --git a/engines/cge2/sound.cpp b/engines/cge2/sound.cpp
index 652907b37d..51764b7b3e 100644
--- a/engines/cge2/sound.cpp
+++ b/engines/cge2/sound.cpp
@@ -46,7 +46,7 @@ DataCk::~DataCk() {
}
Sound::Sound(CGE2Engine *vm) : _vm(vm) {
- _audioStream = NULL;
+ _audioStream = nullptr;
_soundRepeatCount = 1;
open();
}
@@ -108,10 +108,10 @@ void Sound::stop() {
void Sound::sndDigiStop(SmpInfo *PSmpInfo) {
if (_vm->_mixer->isSoundHandleActive(_soundHandle))
_vm->_mixer->stopHandle(_soundHandle);
- _audioStream = NULL;
+ _audioStream = nullptr;
}
-Fx::Fx(CGE2Engine *vm, int size) : _current(NULL), _vm(vm) {
+Fx::Fx(CGE2Engine *vm, int size) : _current(nullptr), _vm(vm) {
}
Fx::~Fx() {
@@ -157,7 +157,7 @@ DataCk *Fx::loadWave(EncryptedStream *file) {
}
MusicPlayer::MusicPlayer(CGE2Engine *vm) : _vm(vm) {
- _data = NULL;
+ _data = nullptr;
_isGM = false;
MidiPlayer::createDriver();
diff --git a/engines/cge2/talk.cpp b/engines/cge2/talk.cpp
index ddd98ac29c..eda812333c 100644
--- a/engines/cge2/talk.cpp
+++ b/engines/cge2/talk.cpp
@@ -39,7 +39,7 @@ Font::Font(CGE2Engine *vm) : _vm(vm) {
_pos = new uint16[kPosSize];
_widthArr = new uint8[kWidSize];
- assert((_map != NULL) && (_pos != NULL) && (_widthArr != NULL));
+ assert((_map != nullptr) && (_pos != nullptr) && (_widthArr != nullptr));
load();
}
@@ -87,12 +87,12 @@ void Font::load() {
char *token;
- if ((token = _vm->token(tmpStr)) == NULL)
+ if ((token = _vm->token(tmpStr)) == nullptr)
error("Wrong line! (%d) in %s", colorFile.getLineCount(), path);
_colorSet[n][0] = _vm->number(token);
for (int i = 1; i < 4; i++) {
- if ((token = _vm->token(nullptr)) == NULL)
+ if ((token = _vm->token(nullptr)) == nullptr)
error("Wrong line! (%d) in %s", colorFile.getLineCount(), path);
_colorSet[n][i] = _vm->number(token);
}
diff --git a/engines/cge2/text.cpp b/engines/cge2/text.cpp
index ecc5521a14..5826f6e5bb 100644
--- a/engines/cge2/text.cpp
+++ b/engines/cge2/text.cpp
@@ -72,7 +72,7 @@ int16 Text::count() {
char *s;
assert(line.size() <= 513);
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
- if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
+ if ((s = strtok(tmpStr, " =,;/\t\n")) == nullptr)
continue;
if (!Common::isDigit(*s))
continue;
@@ -104,7 +104,7 @@ void Text::load() {
int n = line.size();
char *s;
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
- if ((s = strtok(tmpStr, " =,;/\t\n")) == NULL)
+ if ((s = strtok(tmpStr, " =,;/\t\n")) == nullptr)
continue;
if (!Common::isDigit(*s))
continue;
diff --git a/engines/cge2/vga13h.cpp b/engines/cge2/vga13h.cpp
index 805c1e751b..340f9c0966 100644
--- a/engines/cge2/vga13h.cpp
+++ b/engines/cge2/vga13h.cpp
@@ -83,16 +83,16 @@ Seq Sprite::_stdSeq8[] =
SprExt::SprExt(CGE2Engine *vm)
: _p0(vm, 0, 0), _p1(vm, 0, 0),
- _b0(NULL), _b1(NULL), _shpList(NULL),
- _location(0), _seq(NULL), _name(NULL) {
+ _b0(nullptr), _b1(nullptr), _shpList(nullptr),
+ _location(0), _seq(nullptr), _name(nullptr) {
for (int i = 0; i < kActions; i++)
_actions[i] = nullptr;
}
Sprite::Sprite(CGE2Engine *vm)
: _siz(_vm, 0, 0), _seqPtr(kNoSeq), _seqCnt(0), _shpCnt(0),
- _next(NULL), _prev(NULL), _time(0),
- _ext(NULL), _ref(-1), _scene(0), _vm(vm),
+ _next(nullptr), _prev(nullptr), _time(0),
+ _ext(nullptr), _ref(-1), _scene(0), _vm(vm),
_pos2D(_vm, kScrWidth >> 1, 0), _pos3D(kScrWidth >> 1, 0, 0) {
memset(_actionCtrl, 0, sizeof(_actionCtrl));
memset(_file, 0, sizeof(_file));
@@ -102,8 +102,8 @@ Sprite::Sprite(CGE2Engine *vm)
Sprite::Sprite(CGE2Engine *vm, BitmapPtr shpP, int cnt)
: _siz(_vm, 0, 0), _seqPtr(kNoSeq), _seqCnt(0), _shpCnt(0),
- _next(NULL), _prev(NULL), _time(0),
- _ext(NULL), _ref(-1), _scene(0), _vm(vm),
+ _next(nullptr), _prev(nullptr), _time(0),
+ _ext(nullptr), _ref(-1), _scene(0), _vm(vm),
_pos2D(_vm, kScrWidth >> 1, 0), _pos3D(kScrWidth >> 1, 0, 0) {
memset(_actionCtrl, 0, sizeof(_actionCtrl));
memset(_file, 0, sizeof(_file));
@@ -123,7 +123,7 @@ Sprite::~Sprite() {
BitmapPtr Sprite::getShp() {
SprExt *e = _ext;
if (!e || !e->_seq)
- return NULL;
+ return nullptr;
int i = e->_seq[_seqPtr]._now;
if (i >= _shpCnt)
@@ -183,7 +183,7 @@ void Sprite::setName(char *newName) {
}
if (newName) {
_ext->_name = new char[strlen(newName) + 1];
- assert(_ext->_name != NULL);
+ assert(_ext->_name != nullptr);
strcpy(_ext->_name, newName);
}
}
@@ -251,7 +251,7 @@ int Sprite::labVal(Action snq, int lab) {
CommandHandler::Command *Sprite::snList(Action type) {
SprExt *e = _ext;
- return (e) ? e->_actions[type] : NULL;
+ return (e) ? e->_actions[type] : nullptr;
}
Sprite *Sprite::expand() {
@@ -262,7 +262,7 @@ Sprite *Sprite::expand() {
(_vm->*_vm->_spriteNotify)();
_ext = new SprExt(_vm);
- assert(_ext != NULL);
+ assert(_ext != nullptr);
if (!*_file)
return this;
@@ -350,10 +350,10 @@ Sprite *Sprite::expand() {
CommandHandler::Command *c = &_ext->_actions[section][cnt[section]++];
c->_commandType = CommandType(id);
c->_lab = label;
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
c->_ref = _vm->number(p);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
c->_val = _vm->number(p);
c->_spritePtr = nullptr;
@@ -364,7 +364,7 @@ Sprite *Sprite::expand() {
s->_now = atoi(p);
if (s->_now > maxnow)
maxnow = s->_now;
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
break;
s->_next = _vm->number(p);
switch (s->_next) {
@@ -377,16 +377,16 @@ Sprite *Sprite::expand() {
}
if (s->_next > maxnxt)
maxnxt = s->_next;
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
s->_dx = _vm->number(p);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
s->_dy = _vm->number(p);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
s->_dz = _vm->number(p);
- if ((p = _vm->token(nullptr)) == NULL)
+ if ((p = _vm->token(nullptr)) == nullptr)
error("Unexpected end of file! %s", fname);
s->_dly = _vm->number(p);
break;
@@ -750,7 +750,7 @@ void Sprite::sync(Common::Serializer &s) {
_file[8] = '\0';
}
-Queue::Queue(bool show) : _head(NULL), _tail(NULL) {
+Queue::Queue(bool show) : _head(nullptr), _tail(nullptr) {
}
void Queue::append(Sprite *spr) {
@@ -828,7 +828,7 @@ Sprite *Queue::locate(int ref) {
if (spr->_ref == ref)
return spr;
}
- return NULL;
+ return nullptr;
}
bool Queue::locate(Sprite *spr) {
@@ -839,9 +839,9 @@ bool Queue::locate(Sprite *spr) {
return false;
}
-Vga::Vga(CGE2Engine *vm) : _frmCnt(0), _msg(NULL), _name(NULL), _setPal(false), _mono(0), _vm(vm) {
- _oldColors = NULL;
- _newColors = NULL;
+Vga::Vga(CGE2Engine *vm) : _frmCnt(0), _msg(nullptr), _name(nullptr), _setPal(false), _mono(0), _vm(vm) {
+ _oldColors = nullptr;
+ _newColors = nullptr;
_showQ = new Queue(true);
_sysPal = new Dac[kPalCount];
diff --git a/engines/cge2/vga13h.h b/engines/cge2/vga13h.h
index 7dd7933302..17ce4d3dc9 100644
--- a/engines/cge2/vga13h.h
+++ b/engines/cge2/vga13h.h
@@ -240,7 +240,7 @@ public:
bool works(Sprite *spr);
bool seqTest(int n);
inline bool active() {
- return _ext != NULL;
+ return _ext != nullptr;
}
Sprite(CGE2Engine *vm);
Sprite(CGE2Engine *vm, BitmapPtr shp, int cnt);
@@ -255,7 +255,7 @@ public:
void backShow();
void setName(char *newName);
inline char *name() {
- return (_ext) ? _ext->_name : NULL;
+ return (_ext) ? _ext->_name : nullptr;
}
void gotoxyz(int x, int y, int z = 0);
void gotoxyz();
@@ -274,7 +274,7 @@ public:
virtual void touch(uint16 mask, V2D pos, Common::KeyCode keyCode);
virtual void tick();
virtual void setScene(int c);
- void clrHide() { if (_ext) _ext->_b0 = NULL; }
+ void clrHide() { if (_ext) _ext->_b0 = nullptr; }
void sync(Common::Serializer &s);