aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorJohannes Schickel2009-01-20 09:38:55 +0000
committerJohannes Schickel2009-01-20 09:38:55 +0000
commit577c8ff27d20a91d7774328af787ed6d7d4fc855 (patch)
tree60a8938876d1dc023e73f2e36eec4d9c502b7e6a /engines
parentbcae0570a6dcea636092bb24b090530741c68fb2 (diff)
downloadscummvm-rg350-577c8ff27d20a91d7774328af787ed6d7d4fc855.tar.gz
scummvm-rg350-577c8ff27d20a91d7774328af787ed6d7d4fc855.tar.bz2
scummvm-rg350-577c8ff27d20a91d7774328af787ed6d7d4fc855.zip
Cleanup.
svn-id: r35943
Diffstat (limited to 'engines')
-rw-r--r--engines/kyra/lol.cpp4
-rw-r--r--engines/kyra/scene_lol.cpp28
-rw-r--r--engines/kyra/sound_lok.cpp3
3 files changed, 17 insertions, 18 deletions
diff --git a/engines/kyra/lol.cpp b/engines/kyra/lol.cpp
index caf8a6b349..d04374a53e 100644
--- a/engines/kyra/lol.cpp
+++ b/engines/kyra/lol.cpp
@@ -1284,8 +1284,8 @@ void LoLEngine::loadCharFaceShapes(int charNum, int id) {
if (id < 0)
id = -id;
- char file[] = "FACE%02d.SHP";
- sprintf(file, "FACE%02d.SHP", id);
+ char file[13];
+ snprintf(file, sizeof(file), "FACE%02d.SHP", id);
_screen->loadBitmap(file, 3, 3, 0);
const uint8 *p = _screen->getCPagePtr(3);
diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp
index 505bf8cc70..fcedec1a76 100644
--- a/engines/kyra/scene_lol.cpp
+++ b/engines/kyra/scene_lol.cpp
@@ -66,8 +66,8 @@ void LoLEngine::loadLevel(int index) {
loadLevelWLL(index, true);
_loadLevelFlag = 1;
- char filename[16];
- sprintf(filename, "LEVEL%d.INI", index);
+ char filename[13];
+ snprintf(filename, sizeof(filename), "LEVEL%d.INI", index);
int f = _levelFlagUnk & (1 << ((index + 0xff) & 0xff));
@@ -76,7 +76,7 @@ void LoLEngine::loadLevel(int index) {
if (f)
loadLevelCmzFile(index);
- sprintf(filename, "LEVEL%d.INF", index);
+ snprintf(filename, sizeof(filename), "LEVEL%d.INF", index);
runInfScript(filename);
addLevelItems();
@@ -268,8 +268,8 @@ void LoLEngine::moveItemToBlock(uint16 *cmzItemIndex, uint16 item) {
}
void LoLEngine::loadLevelWLL(int index, bool mapShapes) {
- char filename[16];
- sprintf(filename, "level%d.wll", index);
+ char filename[13];
+ snprintf(filename, sizeof(filename), "LEVEL%d.WLL", index);
uint32 size;
uint8 *file = _res->fileData(filename, &size);
@@ -360,15 +360,15 @@ uint8 *LoLEngine::getLevelShapes(int shapeIndex) {
}
void LoLEngine::loadLevelCmzFile(int index) {
- //char filename[16];
- //sprintf(filename, "_LEVEL%d.TMP", index);
+ //char filename[13];
+ //snprintf(filename, sizeof(filename), "_LEVEL%d.TMP", index);
// TODO ???
memset(_tempBuffer5120, 0, 5120);
uint16 tmpLvlVal = 0;
- char filename[16];
- sprintf(filename, "level%d.cmz", index);
+ char filename[13];
+ snprintf(filename, sizeof(filename), "LEVEL%d.CMZ", index);
_screen->loadBitmap(filename, 3, 3, 0);
const uint8 *p = _screen->getCPagePtr(2);
@@ -599,8 +599,8 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
}
}
- char fname[] = " ";
- sprintf(fname, "%s.%s", _lastSuppFile, "VCN");
+ char fname[13];
+ snprintf(fname, sizeof(fname), "%s.VCN", _lastSuppFile);
_screen->loadBitmap(fname, 3, 3, 0);
const uint8 *v = _screen->getCPagePtr(2);
@@ -643,7 +643,7 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
memcpy(_vcnBlocks, v, vcnLen);
v += vcnLen;
- sprintf(fname, "%s.%s", _lastSuppFile, "VMP");
+ snprintf(fname, sizeof(fname), "%s.VMP", _lastSuppFile);
_screen->loadBitmap(fname, 3, 3, 0);
v = _screen->getCPagePtr(2);
@@ -678,8 +678,8 @@ void LoLEngine::loadLevelGraphics(const char *file, int specialColor, int weight
_loadSuppFilesFlag = 0;
_screen->generateBrightnessPalette(_screen->_currentPalette, _screen->getPalette(1), _brightness, _lampOilStatus);
- char tname[16];
- sprintf(tname, "LEVEL%.02d.TLC", _currentLevel);
+ char tname[13];
+ snprintf(tname, sizeof(tname), "LEVEL%.02d.TLC", _currentLevel);
Common::SeekableReadStream *s = _res->getFileStream(tname);
s->read(_tlcTable1, 256);
s->read(_tlcTable2, 5120);
diff --git a/engines/kyra/sound_lok.cpp b/engines/kyra/sound_lok.cpp
index 415181b985..284a4df613 100644
--- a/engines/kyra/sound_lok.cpp
+++ b/engines/kyra/sound_lok.cpp
@@ -74,8 +74,7 @@ void KyraEngine_LoK::snd_playWanderScoreViaMap(int command, int restart) {
void KyraEngine_LoK::snd_playVoiceFile(int id) {
debugC(9, kDebugLevelMain | kDebugLevelSound, "KyraEngine_LoK::snd_playVoiceFile(%d)", id);
char vocFile[9];
- assert(id >= 0 && id < 9999);
- sprintf(vocFile, "%03d", id);
+ snprintf(vocFile, sizeof(vocFile), "%03d", id);
_speechFile = vocFile;
_speechPlayTime = _sound->voicePlay(vocFile);
}