warning() and error() add a ! to the string automatically.
This commit is contained in:
parent
a3a72746fc
commit
e90ad4af30
13 changed files with 64 additions and 64 deletions
|
@ -83,7 +83,7 @@ void POSIXSaveFileManager::checkPath(const Common::FSNode &dir) {
|
||||||
if (mkdir(path.c_str(), 0755) != 0) {
|
if (mkdir(path.c_str(), 0755) != 0) {
|
||||||
// mkdir could fail for various reasons: The parent dir doesn't exist,
|
// mkdir could fail for various reasons: The parent dir doesn't exist,
|
||||||
// or is not writeable, the path could be completly bogus, etc.
|
// or is not writeable, the path could be completly bogus, etc.
|
||||||
warning("mkdir for '%s' failed!", path.c_str());
|
warning("mkdir for '%s' failed", path.c_str());
|
||||||
perror("mkdir");
|
perror("mkdir");
|
||||||
|
|
||||||
switch (errno) {
|
switch (errno) {
|
||||||
|
|
|
@ -310,7 +310,7 @@ void Actor::sayLine(const char *msg, const char *msgId) {
|
||||||
textName += ".txt";
|
textName += ".txt";
|
||||||
|
|
||||||
if (msgId[0] == 0) {
|
if (msgId[0] == 0) {
|
||||||
error("Actor::sayLine: No message ID for text!");
|
error("Actor::sayLine: No message ID for text");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -930,7 +930,7 @@ Model::HierNode *Costume::getModelNodes() {
|
||||||
void Costume::playChoreLooping(int num) {
|
void Costume::playChoreLooping(int num) {
|
||||||
if (num < 0 || num >= _numChores) {
|
if (num < 0 || num >= _numChores) {
|
||||||
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("Requested chore number %d is outside the range of chores (0-%d)!", num, _numChores);
|
warning("Requested chore number %d is outside the range of chores (0-%d)", num, _numChores);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_chores[num].playLooping();
|
_chores[num].playLooping();
|
||||||
|
@ -939,7 +939,7 @@ void Costume::playChoreLooping(int num) {
|
||||||
void Costume::playChore(int num) {
|
void Costume::playChore(int num) {
|
||||||
if (num < 0 || num >= _numChores) {
|
if (num < 0 || num >= _numChores) {
|
||||||
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_CHORES || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("Requested chore number %d is outside the range of chores (0-%d)!", num, _numChores);
|
warning("Requested chore number %d is outside the range of chores (0-%d)", num, _numChores);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_chores[num].play();
|
_chores[num].play();
|
||||||
|
|
|
@ -633,7 +633,7 @@ void GfxOpenGL::destroyMaterial(Material *material) {
|
||||||
|
|
||||||
void GfxOpenGL::drawDepthBitmap(int x, int y, int w, int h, char *data) {
|
void GfxOpenGL::drawDepthBitmap(int x, int y, int w, int h, char *data) {
|
||||||
// if (num != 0) {
|
// if (num != 0) {
|
||||||
// warning("Animation not handled yet in GL texture path !");
|
// warning("Animation not handled yet in GL texture path");
|
||||||
// }
|
// }
|
||||||
if (y + h == 480) {
|
if (y + h == 480) {
|
||||||
glRasterPos2i(x, _screenHeight - 1);
|
glRasterPos2i(x, _screenHeight - 1);
|
||||||
|
|
|
@ -481,13 +481,13 @@ void GrimEngine::handleDebugLoadResource() {
|
||||||
resource = (void *)1;
|
resource = (void *)1;
|
||||||
} else if (strstr(buf, ".mat")) {
|
} else if (strstr(buf, ".mat")) {
|
||||||
CMap *cmap = g_resourceloader->loadColormap("item.cmp");
|
CMap *cmap = g_resourceloader->loadColormap("item.cmp");
|
||||||
warning("Default colormap applied to resources loaded in this fashion!");
|
warning("Default colormap applied to resources loaded in this fashion");
|
||||||
resource = (void *)g_resourceloader->loadMaterial(buf, *cmap);
|
resource = (void *)g_resourceloader->loadMaterial(buf, *cmap);
|
||||||
} else {
|
} else {
|
||||||
warning("Resource type not understood!");
|
warning("Resource type not understood");
|
||||||
}
|
}
|
||||||
if (!resource)
|
if (!resource)
|
||||||
warning("Requested resouce (%s) not found!");
|
warning("Requested resouce (%s) not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrimEngine::drawPrimitives() {
|
void GrimEngine::drawPrimitives() {
|
||||||
|
@ -822,7 +822,7 @@ void GrimEngine::storeSaveGameImage(SaveGame *savedState) {
|
||||||
char *data = screenshot->getData();
|
char *data = screenshot->getData();
|
||||||
savedState->write(data, size);
|
savedState->write(data, size);
|
||||||
} else {
|
} else {
|
||||||
error("Unable to store screenshot!");
|
error("Unable to store screenshot");
|
||||||
}
|
}
|
||||||
savedState->endSection();
|
savedState->endSection();
|
||||||
delete screenshot;
|
delete screenshot;
|
||||||
|
@ -920,7 +920,7 @@ void GrimEngine::setSceneLock(const char *name, bool lockStatus) {
|
||||||
|
|
||||||
if (!scene) {
|
if (!scene) {
|
||||||
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("Scene object '%s' not found in list!", name);
|
warning("Scene object '%s' not found in list", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Change the locking status
|
// Change the locking status
|
||||||
|
|
|
@ -106,7 +106,7 @@ int32 Imuse::getPosIn60HzTicks(const char *soundName) {
|
||||||
// Warn the user if the track was not found
|
// Warn the user if the track was not found
|
||||||
if (getTrack == NULL) {
|
if (getTrack == NULL) {
|
||||||
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("Sound '%s' could not be found to get ticks!", soundName);
|
warning("Sound '%s' could not be found to get ticks", soundName);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ void Imuse::stopSound(const char *soundName) {
|
||||||
// Warn the user if the track was not found
|
// Warn the user if the track was not found
|
||||||
if (removeTrack == NULL) {
|
if (removeTrack == NULL) {
|
||||||
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_IMUSE || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("Sound track '%s' could not be found to stop!", soundName);
|
warning("Sound track '%s' could not be found to stop", soundName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
flushTrack(removeTrack);
|
flushTrack(removeTrack);
|
||||||
|
|
|
@ -166,7 +166,7 @@ void Imuse::setPriority(const char *soundName, int priority) {
|
||||||
changeTrack = findTrack(soundName);
|
changeTrack = findTrack(soundName);
|
||||||
// Check to make sure we found the track
|
// Check to make sure we found the track
|
||||||
if (changeTrack == NULL) {
|
if (changeTrack == NULL) {
|
||||||
warning("Unable to find track '%s' to change priority!", soundName);
|
warning("Unable to find track '%s' to change priority", soundName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeTrack->priority = priority;
|
changeTrack->priority = priority;
|
||||||
|
@ -178,7 +178,7 @@ void Imuse::setVolume(const char *soundName, int volume) {
|
||||||
|
|
||||||
changeTrack = findTrack(soundName);
|
changeTrack = findTrack(soundName);
|
||||||
if (changeTrack == NULL) {
|
if (changeTrack == NULL) {
|
||||||
warning("Unable to find track '%s' to change volume!", soundName);
|
warning("Unable to find track '%s' to change volume", soundName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeTrack->vol = volume * 1000;
|
changeTrack->vol = volume * 1000;
|
||||||
|
@ -190,7 +190,7 @@ void Imuse::setPan(const char *soundName, int pan) {
|
||||||
|
|
||||||
changeTrack = findTrack(soundName);
|
changeTrack = findTrack(soundName);
|
||||||
if (changeTrack == NULL) {
|
if (changeTrack == NULL) {
|
||||||
warning("Unable to find track '%s' to change pan!", soundName);
|
warning("Unable to find track '%s' to change pan", soundName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeTrack->pan = pan * 1000;
|
changeTrack->pan = pan * 1000;
|
||||||
|
@ -202,7 +202,7 @@ int Imuse::getVolume(const char *soundName) {
|
||||||
|
|
||||||
getTrack = findTrack(soundName);
|
getTrack = findTrack(soundName);
|
||||||
if (getTrack == NULL) {
|
if (getTrack == NULL) {
|
||||||
warning("Unable to find track '%s' to get volume!", soundName);
|
warning("Unable to find track '%s' to get volume", soundName);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return getTrack->vol / 1000;
|
return getTrack->vol / 1000;
|
||||||
|
@ -214,7 +214,7 @@ void Imuse::setHookId(const char *soundName, int hookId) {
|
||||||
|
|
||||||
changeTrack = findTrack(soundName);
|
changeTrack = findTrack(soundName);
|
||||||
if (changeTrack == NULL) {
|
if (changeTrack == NULL) {
|
||||||
warning("Unable to find track '%s' to change hook id!", soundName);
|
warning("Unable to find track '%s' to change hook id", soundName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeTrack->curHookId = hookId;
|
changeTrack->curHookId = hookId;
|
||||||
|
@ -244,7 +244,7 @@ void Imuse::selectVolumeGroup(const char *soundName, int volGroupId) {
|
||||||
|
|
||||||
changeTrack = findTrack(soundName);
|
changeTrack = findTrack(soundName);
|
||||||
if (changeTrack == NULL) {
|
if (changeTrack == NULL) {
|
||||||
warning("Unable to find track '%s' to change volume group id!", soundName);
|
warning("Unable to find track '%s' to change volume group id", soundName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeTrack->volGroupId = volGroupId;
|
changeTrack->volGroupId = volGroupId;
|
||||||
|
@ -256,7 +256,7 @@ void Imuse::setFadeVolume(const char *soundName, int destVolume, int duration) {
|
||||||
|
|
||||||
changeTrack = findTrack(soundName);
|
changeTrack = findTrack(soundName);
|
||||||
if (changeTrack == NULL) {
|
if (changeTrack == NULL) {
|
||||||
warning("Unable to find track '%s' to change fade volume!", soundName);
|
warning("Unable to find track '%s' to change fade volume", soundName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeTrack->volFadeDelay = duration;
|
changeTrack->volFadeDelay = duration;
|
||||||
|
@ -271,7 +271,7 @@ void Imuse::setFadePan(const char *soundName, int destPan, int duration) {
|
||||||
|
|
||||||
changeTrack = findTrack(soundName);
|
changeTrack = findTrack(soundName);
|
||||||
if (changeTrack == NULL) {
|
if (changeTrack == NULL) {
|
||||||
warning("Unable to find track '%s' to change fade pan!", soundName);
|
warning("Unable to find track '%s' to change fade pan", soundName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeTrack->panFadeDelay = duration;
|
changeTrack->panFadeDelay = duration;
|
||||||
|
|
|
@ -51,7 +51,7 @@ Localizer::Localizer() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!f.isOpen()) {
|
if (!f.isOpen()) {
|
||||||
error("Localizer::Localizer: Unable to find localization information (grim.tab)!");
|
error("Localizer::Localizer: Unable to find localization information (grim.tab)");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2178,7 +2178,7 @@ static void MakeSectorActive() {
|
||||||
|
|
||||||
// FIXME: This happens on initial load. Are we initting something in the wrong order?
|
// FIXME: This happens on initial load. Are we initting something in the wrong order?
|
||||||
if (!g_grim->currScene()) {
|
if (!g_grim->currScene()) {
|
||||||
warning("!!!! Trying to call MakeSectorActive without a scene!");
|
warning("!!!! Trying to call MakeSectorActive without a scene");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2283,7 +2283,7 @@ static void GetCurrentSetup() {
|
||||||
// FIXME there are some big difference here !
|
// FIXME there are some big difference here !
|
||||||
Scene *scene = g_grim->findScene(name);
|
Scene *scene = g_grim->findScene(name);
|
||||||
if (!scene) {
|
if (!scene) {
|
||||||
warning("GetCurrentSetup() Requested scene (%s) is not loaded!", name);
|
warning("GetCurrentSetup() Requested scene (%s) is not loaded", name);
|
||||||
lua_pushnil();
|
lua_pushnil();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -3501,7 +3501,7 @@ static void GetSaveGameImage() {
|
||||||
lua_pushusertag(screenshot, MKID_BE('VBUF'));
|
lua_pushusertag(screenshot, MKID_BE('VBUF'));
|
||||||
} else {
|
} else {
|
||||||
lua_pushnil();
|
lua_pushnil();
|
||||||
warning("Could not restore screenshot from file!");
|
warning("Could not restore screenshot from file");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
savedState->endSection();
|
savedState->endSection();
|
||||||
|
@ -3516,7 +3516,7 @@ static void SubmitSaveGameData() {
|
||||||
|
|
||||||
savedState = g_grim->savedState();
|
savedState = g_grim->savedState();
|
||||||
if (!savedState)
|
if (!savedState)
|
||||||
error("Cannot obtain saved game!");
|
error("Cannot obtain saved game");
|
||||||
savedState->beginSection('SUBS');
|
savedState->beginSection('SUBS');
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -4463,7 +4463,7 @@ lua_Object getTableValue(lua_Object table, const char *name) {
|
||||||
lua_Object key = LUA_NOOBJECT;
|
lua_Object key = LUA_NOOBJECT;
|
||||||
|
|
||||||
if (!lua_istable(table)) {
|
if (!lua_istable(table)) {
|
||||||
error("getTableValue(): Parameter not a table!");
|
error("getTableValue(): Parameter not a table");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4478,7 +4478,7 @@ lua_Object getTableValue(lua_Object table, const char *name) {
|
||||||
// that it doesn't understand then an infinite loop
|
// that it doesn't understand then an infinite loop
|
||||||
// will be set up repeating the same error.
|
// will be set up repeating the same error.
|
||||||
if (lua_call("next") != 0) {
|
if (lua_call("next") != 0) {
|
||||||
error("getTableValue could not find the next key!");
|
error("getTableValue could not find the next key");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
key = lua_getresult(1);
|
key = lua_getresult(1);
|
||||||
|
|
|
@ -74,7 +74,7 @@ SaveGame::~SaveGame() {
|
||||||
|
|
||||||
uint32 SaveGame::beginSection(uint32 sectionTag) {
|
uint32 SaveGame::beginSection(uint32 sectionTag) {
|
||||||
if (_currentSection != 0)
|
if (_currentSection != 0)
|
||||||
error("Tried to begin a new save game section with ending old section!");
|
error("Tried to begin a new save game section with ending old section");
|
||||||
_currentSection = sectionTag;
|
_currentSection = sectionTag;
|
||||||
_sectionSize = 0;
|
_sectionSize = 0;
|
||||||
_sectionBuffer = (byte *)malloc(_sectionSize);
|
_sectionBuffer = (byte *)malloc(_sectionSize);
|
||||||
|
@ -85,7 +85,7 @@ uint32 SaveGame::beginSection(uint32 sectionTag) {
|
||||||
free(_sectionBuffer);
|
free(_sectionBuffer);
|
||||||
tag = _inSaveFile->readUint32BE();
|
tag = _inSaveFile->readUint32BE();
|
||||||
if (tag == SAVEGAME_FOOTERTAG)
|
if (tag == SAVEGAME_FOOTERTAG)
|
||||||
error("Unable to find requested section of savegame!");
|
error("Unable to find requested section of savegame");
|
||||||
_sectionSize = _inSaveFile->readUint32BE();
|
_sectionSize = _inSaveFile->readUint32BE();
|
||||||
_sectionBuffer = (byte *)malloc(_sectionSize);
|
_sectionBuffer = (byte *)malloc(_sectionSize);
|
||||||
_inSaveFile->read(_sectionBuffer, _sectionSize);
|
_inSaveFile->read(_sectionBuffer, _sectionSize);
|
||||||
|
@ -97,7 +97,7 @@ uint32 SaveGame::beginSection(uint32 sectionTag) {
|
||||||
|
|
||||||
void SaveGame::endSection() {
|
void SaveGame::endSection() {
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to end a save game section without starting a section!");
|
error("Tried to end a save game section without starting a section");
|
||||||
if (_saving) {
|
if (_saving) {
|
||||||
_outSaveFile->writeUint32BE(_currentSection);
|
_outSaveFile->writeUint32BE(_currentSection);
|
||||||
_outSaveFile->writeUint32BE(_sectionSize);
|
_outSaveFile->writeUint32BE(_sectionSize);
|
||||||
|
@ -117,18 +117,18 @@ uint32 SaveGame::getBufferPos() {
|
||||||
|
|
||||||
void SaveGame::read(void *data, int size) {
|
void SaveGame::read(void *data, int size) {
|
||||||
if (_saving)
|
if (_saving)
|
||||||
error("SaveGame::readBlock called when storing a savegame!");
|
error("SaveGame::readBlock called when storing a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to read a block without starting a section!");
|
error("Tried to read a block without starting a section");
|
||||||
memcpy(data, &_sectionBuffer[_sectionPtr], size);
|
memcpy(data, &_sectionBuffer[_sectionPtr], size);
|
||||||
_sectionPtr += size;
|
_sectionPtr += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 SaveGame::readLEUint32() {
|
uint32 SaveGame::readLEUint32() {
|
||||||
if (_saving)
|
if (_saving)
|
||||||
error("SaveGame::readBlock called when storing a savegame!");
|
error("SaveGame::readBlock called when storing a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to read a block without starting a section!");
|
error("Tried to read a block without starting a section");
|
||||||
uint32 data = READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
|
uint32 data = READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
|
||||||
_sectionPtr += 4;
|
_sectionPtr += 4;
|
||||||
return data;
|
return data;
|
||||||
|
@ -136,9 +136,9 @@ uint32 SaveGame::readLEUint32() {
|
||||||
|
|
||||||
int32 SaveGame::readLESint32() {
|
int32 SaveGame::readLESint32() {
|
||||||
if (_saving)
|
if (_saving)
|
||||||
error("SaveGame::readBlock called when storing a savegame!");
|
error("SaveGame::readBlock called when storing a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to read a block without starting a section!");
|
error("Tried to read a block without starting a section");
|
||||||
int32 data = (int32)READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
|
int32 data = (int32)READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
|
||||||
_sectionPtr += 4;
|
_sectionPtr += 4;
|
||||||
return data;
|
return data;
|
||||||
|
@ -146,9 +146,9 @@ int32 SaveGame::readLESint32() {
|
||||||
|
|
||||||
byte SaveGame::readByte() {
|
byte SaveGame::readByte() {
|
||||||
if (_saving)
|
if (_saving)
|
||||||
error("SaveGame::readBlock called when storing a savegame!");
|
error("SaveGame::readBlock called when storing a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to read a block without starting a section!");
|
error("Tried to read a block without starting a section");
|
||||||
byte data = _sectionBuffer[_sectionPtr];
|
byte data = _sectionBuffer[_sectionPtr];
|
||||||
_sectionPtr++;
|
_sectionPtr++;
|
||||||
return data;
|
return data;
|
||||||
|
@ -156,9 +156,9 @@ byte SaveGame::readByte() {
|
||||||
|
|
||||||
bool SaveGame::readLEBool() {
|
bool SaveGame::readLEBool() {
|
||||||
if (_saving)
|
if (_saving)
|
||||||
error("SaveGame::readBlock called when storing a savegame!");
|
error("SaveGame::readBlock called when storing a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to read a block without starting a section!");
|
error("Tried to read a block without starting a section");
|
||||||
uint32 data = READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
|
uint32 data = READ_LE_UINT32(&_sectionBuffer[_sectionPtr]);
|
||||||
_sectionPtr += 4;
|
_sectionPtr += 4;
|
||||||
return data != 0;
|
return data != 0;
|
||||||
|
@ -166,24 +166,24 @@ bool SaveGame::readLEBool() {
|
||||||
|
|
||||||
void SaveGame::write(const void *data, int size) {
|
void SaveGame::write(const void *data, int size) {
|
||||||
if (!_saving)
|
if (!_saving)
|
||||||
error("SaveGame::writeBlock called when restoring a savegame!");
|
error("SaveGame::writeBlock called when restoring a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to write a block without starting a section!");
|
error("Tried to write a block without starting a section");
|
||||||
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + size);
|
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + size);
|
||||||
if (!_sectionBuffer)
|
if (!_sectionBuffer)
|
||||||
error("Failed to allocate space for buffer!");
|
error("Failed to allocate space for buffer");
|
||||||
memcpy(&_sectionBuffer[_sectionSize], data, size);
|
memcpy(&_sectionBuffer[_sectionSize], data, size);
|
||||||
_sectionSize += size;
|
_sectionSize += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGame::writeLEUint32(uint32 data) {
|
void SaveGame::writeLEUint32(uint32 data) {
|
||||||
if (!_saving)
|
if (!_saving)
|
||||||
error("SaveGame::writeBlock called when restoring a savegame!");
|
error("SaveGame::writeBlock called when restoring a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to write a block without starting a section!");
|
error("Tried to write a block without starting a section");
|
||||||
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
|
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
|
||||||
if (!_sectionBuffer)
|
if (!_sectionBuffer)
|
||||||
error("Failed to allocate space for buffer!");
|
error("Failed to allocate space for buffer");
|
||||||
|
|
||||||
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], data);
|
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], data);
|
||||||
_sectionSize += 4;
|
_sectionSize += 4;
|
||||||
|
@ -191,12 +191,12 @@ void SaveGame::writeLEUint32(uint32 data) {
|
||||||
|
|
||||||
void SaveGame::writeLESint32(int32 data) {
|
void SaveGame::writeLESint32(int32 data) {
|
||||||
if (!_saving)
|
if (!_saving)
|
||||||
error("SaveGame::writeBlock called when restoring a savegame!");
|
error("SaveGame::writeBlock called when restoring a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to write a block without starting a section!");
|
error("Tried to write a block without starting a section");
|
||||||
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
|
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
|
||||||
if (!_sectionBuffer)
|
if (!_sectionBuffer)
|
||||||
error("Failed to allocate space for buffer!");
|
error("Failed to allocate space for buffer");
|
||||||
|
|
||||||
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], (uint32)data);
|
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], (uint32)data);
|
||||||
_sectionSize += 4;
|
_sectionSize += 4;
|
||||||
|
@ -204,12 +204,12 @@ void SaveGame::writeLESint32(int32 data) {
|
||||||
|
|
||||||
void SaveGame::writeLEBool(bool data) {
|
void SaveGame::writeLEBool(bool data) {
|
||||||
if (!_saving)
|
if (!_saving)
|
||||||
error("SaveGame::writeBlock called when restoring a savegame!");
|
error("SaveGame::writeBlock called when restoring a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to write a block without starting a section!");
|
error("Tried to write a block without starting a section");
|
||||||
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
|
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 4);
|
||||||
if (!_sectionBuffer)
|
if (!_sectionBuffer)
|
||||||
error("Failed to allocate space for buffer!");
|
error("Failed to allocate space for buffer");
|
||||||
|
|
||||||
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], (uint32)data);
|
WRITE_LE_UINT32(&_sectionBuffer[_sectionSize], (uint32)data);
|
||||||
_sectionSize += 4;
|
_sectionSize += 4;
|
||||||
|
@ -217,12 +217,12 @@ void SaveGame::writeLEBool(bool data) {
|
||||||
|
|
||||||
void SaveGame::writeByte(byte data) {
|
void SaveGame::writeByte(byte data) {
|
||||||
if (!_saving)
|
if (!_saving)
|
||||||
error("SaveGame::writeBlock called when restoring a savegame!");
|
error("SaveGame::writeBlock called when restoring a savegame");
|
||||||
if (_currentSection == 0)
|
if (_currentSection == 0)
|
||||||
error("Tried to write a block without starting a section!");
|
error("Tried to write a block without starting a section");
|
||||||
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 1);
|
_sectionBuffer = (byte *)realloc(_sectionBuffer, _sectionSize + 1);
|
||||||
if (!_sectionBuffer)
|
if (!_sectionBuffer)
|
||||||
error("Failed to allocate space for buffer!");
|
error("Failed to allocate space for buffer");
|
||||||
|
|
||||||
_sectionBuffer[_sectionSize] = data;
|
_sectionBuffer[_sectionSize] = data;
|
||||||
_sectionSize++;
|
_sectionSize++;
|
||||||
|
|
|
@ -208,7 +208,7 @@ void Scene::setSetup(int num) {
|
||||||
// Looks like num is zero-based so >= should work to find values
|
// Looks like num is zero-based so >= should work to find values
|
||||||
// that are out of the range of valid setups
|
// that are out of the range of valid setups
|
||||||
if (num >= _numSetups || num < 0) {
|
if (num >= _numSetups || num < 0) {
|
||||||
error("Failed to change scene setup, value out of range!");
|
error("Failed to change scene setup, value out of range");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_currSetup = _setups + num;
|
_currSetup = _setups + num;
|
||||||
|
@ -265,7 +265,7 @@ ObjectState *Scene::findState(const char *filename) {
|
||||||
return *i;
|
return *i;
|
||||||
if (strcasecmp(file, filename) == 0) {
|
if (strcasecmp(file, filename) == 0) {
|
||||||
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("State object request '%s' matches object '%s' but is the wrong case!", filename, file);
|
warning("State object request '%s' matches object '%s' but is the wrong case", filename, file);
|
||||||
return *i;
|
return *i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@ struct SavePos *zlibFile::getPos() {
|
||||||
|
|
||||||
if (position == ((uint32) -1)) {
|
if (position == ((uint32) -1)) {
|
||||||
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("zlibFile::open() unable to find start position!");
|
warning("zlibFile::open() unable to find start position");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pos = new SavePos;
|
pos = new SavePos;
|
||||||
|
@ -356,21 +356,21 @@ struct SavePos *zlibFile::getPos() {
|
||||||
|
|
||||||
bool zlibFile::setPos(struct SavePos *pos) {
|
bool zlibFile::setPos(struct SavePos *pos) {
|
||||||
if (!pos) {
|
if (!pos) {
|
||||||
warning("Unable to rewind SMUSH movie (no position passed)!");
|
warning("Unable to rewind SMUSH movie (no position passed)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!_handle || !_handle->isOpen()) {
|
if (!_handle || !_handle->isOpen()) {
|
||||||
warning("Unable to rewind SMUSH movie (invalid handle)!");
|
warning("Unable to rewind SMUSH movie (invalid handle)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_handle->seek(pos->filePos, SEEK_SET);
|
_handle->seek(pos->filePos, SEEK_SET);
|
||||||
if (_handle->ioFailed()) {
|
if (_handle->ioFailed()) {
|
||||||
warning("Unable to rewind SMUSH movie (seek failed)!");
|
warning("Unable to rewind SMUSH movie (seek failed)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
memcpy(_inBuf, pos->tmpBuf, BUFFER_SIZE);
|
memcpy(_inBuf, pos->tmpBuf, BUFFER_SIZE);
|
||||||
if (inflateCopy(&_stream, &pos->streamBuf) != Z_OK) {
|
if (inflateCopy(&_stream, &pos->streamBuf) != Z_OK) {
|
||||||
warning("Unable to rewind SMUSH movie (z-lib copy handle failed)!");
|
warning("Unable to rewind SMUSH movie (z-lib copy handle failed)");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
_fileDone = false;
|
_fileDone = false;
|
||||||
|
@ -459,7 +459,7 @@ uint32 zlibFile::read(void *ptr, uint32 len) {
|
||||||
|
|
||||||
if (!_handle->isOpen()) {
|
if (!_handle->isOpen()) {
|
||||||
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
|
if (gDebugLevel == DEBUG_SMUSH || gDebugLevel == DEBUG_ERROR || gDebugLevel == DEBUG_ALL)
|
||||||
error("zlibFile::read() File is not open!");
|
error("zlibFile::read() File is not open");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ void TextObject::draw() {
|
||||||
|
|
||||||
g_driver->drawTextBitmap(x, height + y, _textObjectHandle[i]);
|
g_driver->drawTextBitmap(x, height + y, _textObjectHandle[i]);
|
||||||
} else if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
} else if (gDebugLevel == DEBUG_WARN || gDebugLevel == DEBUG_ALL)
|
||||||
warning("TextObject::draw: Unknown justification code (%d)!", _justify);
|
warning("TextObject::draw: Unknown justification code (%d)", _justify);
|
||||||
|
|
||||||
height += _font->getHeight();
|
height += _font->getHeight();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue