Fixed tons of format string warnings for debug/error calls (including several errors where the format string didn't match the number of arguments to the call)

svn-id: r21141
This commit is contained in:
Max Horn 2006-03-08 11:37:25 +00:00
parent 14f1337c60
commit d9a9fac937
30 changed files with 255 additions and 212 deletions

View file

@ -114,7 +114,7 @@ int32 DataIO::readChunk(int16 handle, char *buf, int16 size) {
offset =
_vm->_global->_chunkOffset[file * MAX_SLOT_COUNT + slot] +
_vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot];
debugC(7, DEBUG_FILEIO, "seek: %ld, %ld", _vm->_global->_chunkOffset[file * MAX_SLOT_COUNT + slot], _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot]);
debugC(7, DEBUG_FILEIO, "seek: %d, %d", _vm->_global->_chunkOffset[file * MAX_SLOT_COUNT + slot], _vm->_global->_chunkPos[file * MAX_SLOT_COUNT + slot]);
file_getHandle(_vm->_global->_dataFileHandles[file])->seek(offset, SEEK_SET);
}

View file

@ -139,7 +139,7 @@ char *Game::loadExtData(int16 itemId, int16 *pResWidth, int16 *pResHeight) {
handle = commonHandle;
}
debugC(7, DEBUG_FILEIO, "off: %ld size: %ld", offset, tableSize);
debugC(7, DEBUG_FILEIO, "off: %d size: %d", offset, tableSize);
_vm->_dataio->seekData(handle, offset + tableSize, SEEK_SET);
// CHECKME: is the below correct?
if (isPacked)

View file

@ -168,7 +168,7 @@ void Parse::printExpr(char stopToken) {
if (operation >= 19 && operation <= 29) {
switch (operation) {
case 19:
debugN(5, "%l", READ_LE_UINT32(_vm->_global->_inter_execPtr));
debugN(5, "%d", READ_LE_UINT32(_vm->_global->_inter_execPtr));
_vm->_global->_inter_execPtr += 4;
break;
@ -283,7 +283,7 @@ void Parse::printExpr(char stopToken) {
break;
case 7:
debugN(5, "%");
debugN(5, "%%");
break;
case 8:

View file

@ -174,7 +174,7 @@ void ScreenAnimator::preserveAnyChangedBackgrounds() {
}
void ScreenAnimator::preserveOrRestoreBackground(AnimObject *obj, bool restore) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::preserveOrRestoreBackground(0x%X, restore)", obj, restore);
debugC(9, kDebugLevelAnimator, "ScreenAnimator::preserveOrRestoreBackground(%p, %d)", (const void *)obj, restore);
int x = 0, y = 0, width = obj->width << 3, height = obj->height;
if (restore) {
@ -477,7 +477,7 @@ void ScreenAnimator::animAddNPC(int character) {
}
AnimObject *ScreenAnimator::objectRemoveQueue(AnimObject *queue, AnimObject *rem) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::objectRemoveQueue(0x%X, 0x%X)", queue, rem);
debugC(9, kDebugLevelAnimator, "ScreenAnimator::objectRemoveQueue(%p, %p)", (const void *)queue, (const void *)rem);
AnimObject *cur = queue;
AnimObject *prev = queue;
@ -513,13 +513,13 @@ AnimObject *ScreenAnimator::objectRemoveQueue(AnimObject *queue, AnimObject *rem
}
AnimObject *ScreenAnimator::objectAddHead(AnimObject *queue, AnimObject *head) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::objectAddHead(0x%X, 0x%X)", queue, head);
debugC(9, kDebugLevelAnimator, "ScreenAnimator::objectAddHead(%p, %p)", (const void *)queue, (const void *)head);
head->nextAnimObject = queue;
return head;
}
AnimObject *ScreenAnimator::objectQueue(AnimObject *queue, AnimObject *add) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::objectQueue(0x%X, 0x%X)", queue, add);
debugC(9, kDebugLevelAnimator, "ScreenAnimator::objectQueue(%p, %p)", (const void *)queue, (const void *)add);
if (add->drawY <= queue->drawY || !queue) {
add->nextAnimObject = queue;
return add;
@ -545,7 +545,7 @@ AnimObject *ScreenAnimator::objectQueue(AnimObject *queue, AnimObject *add) {
}
void ScreenAnimator::addObjectToQueue(AnimObject *object) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::addObjectToQueue(0x%X)", object);
debugC(9, kDebugLevelAnimator, "ScreenAnimator::addObjectToQueue(%p)", (const void *)object);
if (!_objectQueue) {
_objectQueue = objectAddHead(0, object);
} else {
@ -554,7 +554,7 @@ void ScreenAnimator::addObjectToQueue(AnimObject *object) {
}
void ScreenAnimator::refreshObject(AnimObject *object) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::refreshObject(0x%X)", object);
debugC(9, kDebugLevelAnimator, "ScreenAnimator::refreshObject(%p)", (const void *)object);
_objectQueue = objectRemoveQueue(_objectQueue, object);
if (_objectQueue) {
_objectQueue = objectQueue(_objectQueue, object);
@ -575,14 +575,14 @@ void ScreenAnimator::makeBrandonFaceMouse() {
}
int16 ScreenAnimator::fetchAnimWidth(const uint8 *shape, int16 mult) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::fetchAnimWidth(0x%X, %d)", shape, mult);
debugC(9, kDebugLevelAnimator, "ScreenAnimator::fetchAnimWidth(%p, %d)", (const void *)shape, mult);
if (_vm->features() & GF_TALKIE)
shape += 2;
return (((int16)READ_LE_UINT16((shape+3))) * mult) >> 8;
}
int16 ScreenAnimator::fetchAnimHeight(const uint8 *shape, int16 mult) {
debugC(9, kDebugLevelAnimator, "ScreenAnimator::fetchAnimHeight(0x%X, %d)", shape, mult);
debugC(9, kDebugLevelAnimator, "ScreenAnimator::fetchAnimHeight(%p, %d)", (const void *)shape, mult);
if (_vm->features() & GF_TALKIE)
shape += 2;
return (int16)(((int8)*(shape+2)) * mult) >> 8;

View file

@ -845,7 +845,7 @@ void KyraEngine::delayWithTicks(int ticks) {
#pragma mark -
void KyraEngine::setupShapes123(const Shape *shapeTable, int endShape, int flags) {
debugC(9, kDebugLevelMain, "KyraEngine::setupShapes123(0x%X, startShape, flags)", shapeTable, endShape, flags);
debugC(9, kDebugLevelMain, "KyraEngine::setupShapes123(%p, %d, %d)", (const void *)shapeTable, endShape, flags);
for (int i = 123; i <= 172; ++i) {
_shapes[4+i] = NULL;
}

View file

@ -321,7 +321,7 @@ uint32 PAKFile::getFileSize(const char* file) {
}
void KyraEngine::loadPalette(const char *filename, uint8 *palData) {
debugC( 9, kDebugLevelMain, "KyraEngine::loadPalette('%s' 0x%X)", filename, palData);
debugC( 9, kDebugLevelMain, "KyraEngine::loadPalette('%s' %p)", filename, (void *)palData);
uint32 fileSize = 0;
uint8 *srcData = _res->fileData(filename, &fileSize);
@ -333,7 +333,7 @@ void KyraEngine::loadPalette(const char *filename, uint8 *palData) {
}
void KyraEngine::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData) {
debugC( 9, kDebugLevelMain,"KyraEngine::copyBitmap('%s', %d, %d, 0x%X)", filename, tempPage, dstPage, palData);
debugC( 9, kDebugLevelMain,"KyraEngine::copyBitmap('%s', %d, %d, %p)", filename, tempPage, dstPage, (void *)palData);
uint32 fileSize;
uint8 *srcData = _res->fileData(filename, &fileSize);
uint8 compType = srcData[2];

View file

@ -302,7 +302,7 @@ void KyraEngine::setCharacterPositionWithUpdate(int character) {
}
int KyraEngine::setCharacterPosition(int character, int *facingTable) {
debugC(9, kDebugLevelMain, "KyraEngine::setCharacterPosition(%d, 0x%X)", character, facingTable);
debugC(9, kDebugLevelMain, "KyraEngine::setCharacterPosition(%d, %p)", character, (const void *)facingTable);
if (character == 0) {
_currentCharacter->x1 += _charXPosTable[_currentCharacter->facing];
_currentCharacter->y1 += _charYPosTable[_currentCharacter->facing];
@ -319,7 +319,7 @@ int KyraEngine::setCharacterPosition(int character, int *facingTable) {
}
void KyraEngine::setCharacterPositionHelper(int character, int *facingTable) {
debugC(9, kDebugLevelMain, "KyraEngine::setCharacterPositionHelper(%d, 0x%X)", character, facingTable);
debugC(9, kDebugLevelMain, "KyraEngine::setCharacterPositionHelper(%d, %p)", character, (const void *)facingTable);
Character *ch = &_characterList[character];
++ch->currentAnimFrame;
int facing = ch->facing;
@ -936,7 +936,7 @@ int KyraEngine::handleSceneChange(int xpos, int ypos, int unk1, int frameReset)
}
int KyraEngine::processSceneChange(int *table, int unk1, int frameReset) {
debugC(9, kDebugLevelMain, "KyraEngine::processSceneChange(0x%X, %d, %d)", table, unk1, frameReset);
debugC(9, kDebugLevelMain, "KyraEngine::processSceneChange(%p, %d, %d)", (const void *)table, unk1, frameReset);
if (queryGameFlag(0xEF)) {
unk1 = 0;
}
@ -1191,7 +1191,7 @@ void KyraEngine::setCharactersPositions(int character) {
#pragma mark -
int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize) {
debugC(9, kDebugLevelMain, "KyraEngine::findWay(%d, %d, %d, %d, 0x%X, %d)", x, y, toX, toY, moveTable, moveTableSize);
debugC(9, kDebugLevelMain, "KyraEngine::findWay(%d, %d, %d, %d, %p, %d)", x, y, toX, toY, (const void *)moveTable, moveTableSize);
x &= 0xFFFC; toX &= 0xFFFC;
y &= 0xFFFE; toY &= 0xFFFE;
x = (int16)x; y = (int16)y; toX = (int16)toX; toY = (int16)toY;
@ -1307,7 +1307,7 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move
}
int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end) {
debugC(9, kDebugLevelMain, "KyraEngine::findSubPath(%d, %d, %d, %d, 0x%X, %d, %d)", x, y, toX, toY, moveTable, start, end);
debugC(9, kDebugLevelMain, "KyraEngine::findSubPath(%d, %d, %d, %d, %p, %d, %d)", x, y, toX, toY, (const void *)moveTable, start, end);
// only used for debug specific code
//static uint16 unkTable[] = { 8, 5 };
static const int8 facingTable1[] = { 7, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 0 };
@ -1483,7 +1483,7 @@ bool KyraEngine::lineIsPassable(int x, int y) {
}
int KyraEngine::getMoveTableSize(int *moveTable) {
debugC(9, kDebugLevelMain, "KyraEngine::getMoveTableSize(0x%X)", moveTable);
debugC(9, kDebugLevelMain, "KyraEngine::getMoveTableSize(%p)", (const void *)moveTable);
int retValue = 0;
if (moveTable[0] == 8)
return 0;

View file

@ -178,7 +178,7 @@ void Screen::fadeSpecialPalette(int palIndex, int startIndex, int size, int fade
}
void Screen::fadePalette(const uint8 *palData, int delay) {
debugC( 9, kDebugLevelScreen, "Screen::fadePalette(0x%X, %d)", palData, delay);
debugC( 9, kDebugLevelScreen, "Screen::fadePalette(%p, %d)", (const void *)palData, delay);
uint8 fadePal[768];
memcpy(fadePal, _screenPalette, 768);
uint8 diff, maxDiff = 0;
@ -235,7 +235,7 @@ void Screen::fadePalette(const uint8 *palData, int delay) {
}
void Screen::setScreenPalette(const uint8 *palData) {
debugC( 9, kDebugLevelScreen, "Screen::setScreenPalette(0x%X)", palData);
debugC( 9, kDebugLevelScreen, "Screen::setScreenPalette(%p)", (const void *)palData);
memcpy(_screenPalette, palData, 768);
uint8 screenPal[256 * 4];
for (int i = 0; i < 256; ++i) {
@ -249,7 +249,7 @@ void Screen::setScreenPalette(const uint8 *palData) {
}
void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
debugC( 9, kDebugLevelScreen, "Screen::copyToPage0(%d, %d, %d, 0x%X)", y, h, page, seqBuf);
debugC( 9, kDebugLevelScreen, "Screen::copyToPage0(%d, %d, %d, %p)", y, h, page, (const void *)seqBuf);
assert(y + h <= SCREEN_H);
const uint8 *src = getPagePtr(page) + y * SCREEN_W;
uint8 *dstPage = getPagePtr(0) + y * SCREEN_W;
@ -333,7 +333,7 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
}
void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src) {
debugC( 9, kDebugLevelScreen, "Screen::copyBlockToPage(%d, %d, %d, %d, %d, 0x%X)", pageNum, x, y, w, h, src);
debugC( 9, kDebugLevelScreen, "Screen::copyBlockToPage(%d, %d, %d, %d, %d, %p)", pageNum, x, y, w, h, (const void *)src);
assert(x >= 0 && x < Screen::SCREEN_W && y >= 0 && y < Screen::SCREEN_H);
uint8 *dst = getPagePtr(pageNum) + y * SCREEN_W + x;
while (h--) {
@ -344,7 +344,7 @@ void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint
}
void Screen::copyFromCurPageBlock(int x, int y, int w, int h, const uint8 *src) {
debugC( 9, kDebugLevelScreen, "Screen::copyFromCurPageBlock(%d, %d, %d, %d, 0x%X)", x, y, w, h, src);
debugC( 9, kDebugLevelScreen, "Screen::copyFromCurPageBlock(%d, %d, %d, %d, %p)", x, y, w, h, (const void *)src);
if (x < 0) {
x = 0;
} else if (x >= 40) {
@ -370,7 +370,7 @@ void Screen::copyFromCurPageBlock(int x, int y, int w, int h, const uint8 *src)
}
void Screen::copyCurPageBlock(int x, int y, int w, int h, uint8 *dst) {
debugC( 9, kDebugLevelScreen, "Screen::copyCurPageBlock(%d, %d, %d, %d, 0x%X)", x, y, w, h, dst);
debugC( 9, kDebugLevelScreen, "Screen::copyCurPageBlock(%d, %d, %d, %d, %p)", x, y, w, h, (const void *)dst);
assert(dst);
if (x < 0) {
x = 0;
@ -548,19 +548,19 @@ void Screen::setAnimBlockPtr(int size) {
}
void Screen::setTextColorMap(const uint8 *cmap) {
debugC( 9, kDebugLevelScreen, "Screen::setTextColorMap(0x%X)", cmap);
debugC( 9, kDebugLevelScreen, "Screen::setTextColorMap(%p)", (const void *)cmap);
setTextColor(cmap, 0, 11);
}
void Screen::setTextColor(const uint8 *cmap, int a, int b) {
debugC( 9, kDebugLevelScreen, "Screen::setTextColor(0x%X, %d, %d)", cmap, a, b);
debugC( 9, kDebugLevelScreen, "Screen::setTextColor(%p, %d, %d)", (const void *)cmap, a, b);
for (int i = a; i <= b; ++i) {
_textColorsMap[i] = *cmap++;
}
}
void Screen::loadFont(FontId fontId, uint8 *fontData) {
debugC( 9, kDebugLevelScreen, "Screen::loadFont(%d, 0x%X)", fontId, fontData);
debugC( 9, kDebugLevelScreen, "Screen::loadFont(%d, %p)", fontId, (const void *)fontData);
Font *fnt = &_fonts[fontId];
assert(fontData && !fnt->fontData);
fnt->fontData = fontData;
@ -724,7 +724,7 @@ void Screen::setScreenDim(int dim) {
}
void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...) {
debugC( 9, kDebugLevelScreen, "Screen::drawShape(%d, 0x%X, %d, %d, %d, 0x%.04X, ...)", pageNum, shapeData, x, y, sd, flags);
debugC( 9, kDebugLevelScreen, "Screen::drawShape(%d, %p, %d, %d, %d, 0x%.04X, ...)", pageNum, (const void *)shapeData, x, y, sd, flags);
if (!shapeData)
return;
va_list args;
@ -1225,7 +1225,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
}
void Screen::decodeFrame3(const uint8 *src, uint8 *dst, uint32 size) {
debugC( 9, kDebugLevelScreen, "Screen::decodeFrame3(0x%X, 0x%X, %d)", src, dst, size);
debugC( 9, kDebugLevelScreen, "Screen::decodeFrame3(%p, %p, %d)", (const void *)src, (const void *)dst, size);
const uint8 *dstEnd = dst + size;
while (dst < dstEnd) {
int8 code = *src++;
@ -1246,7 +1246,7 @@ void Screen::decodeFrame3(const uint8 *src, uint8 *dst, uint32 size) {
}
void Screen::decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize) {
debugC( 9, kDebugLevelScreen, "Screen::decodeFrame4(0x%X, 0x%X, %d)", src, dst, dstSize);
debugC( 9, kDebugLevelScreen, "Screen::decodeFrame4(%p, %p, %d)", (const void *)src, (const void *)dst, dstSize);
uint8 *dstOrig = dst;
uint8 *dstEnd = dst + dstSize;
while (1) {
@ -1295,7 +1295,7 @@ void Screen::decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize) {
}
void Screen::decodeFrameDelta(uint8 *dst, const uint8 *src) {
debugC( 9, kDebugLevelScreen, "Screen::decodeFrameDelta(0x%X, 0x%X)", dst, src);
debugC( 9, kDebugLevelScreen, "Screen::decodeFrameDelta(%p, %p)", (const void *)dst, (const void *)src);
while (1) {
uint8 code = *src++;
if (code == 0) {
@ -1338,7 +1338,7 @@ void Screen::decodeFrameDelta(uint8 *dst, const uint8 *src) {
}
void Screen::decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch, int noXor) {
debugC( 9, kDebugLevelScreen, "Screen::decodeFrameDeltaPage(0x%X, 0x%X, %d, %d)", dst, src, pitch, noXor);
debugC( 9, kDebugLevelScreen, "Screen::decodeFrameDeltaPage(%p, %p, %d, %d)", (const void *)dst, (const void *)src, pitch, noXor);
int count = 0;
uint8 *dstNext = dst;
while (1) {
@ -1619,7 +1619,7 @@ uint8 *Screen::encodeShape(int x, int y, int w, int h, int flags) {
}
int16 Screen::encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size_to) {
debugC( 9, kDebugLevelScreen, "Screen::encodeShapeAndCalculateSize(0x%X, 0x%X, %d)", from, to, size_to);
debugC( 9, kDebugLevelScreen, "Screen::encodeShapeAndCalculateSize(%p, %p, %d)", (const void *)from, (const void *)to, size_to);
byte *fromPtrEnd = from + size_to;
bool skipPixel = true;
byte *tempPtr = 0;
@ -1790,7 +1790,7 @@ void Screen::setShapePages(int page1, int page2) {
}
void Screen::setMouseCursor(int x, int y, byte *shape) {
debugC( 9, kDebugLevelScreen, "Screen::setMouseCursor(%d, %d, 0x%X)", x, y, shape);
debugC( 9, kDebugLevelScreen, "Screen::setMouseCursor(%d, %d, %p)", x, y, (const void *)shape);
if (!shape)
return;
// if mouseDisabled
@ -1820,7 +1820,7 @@ void Screen::setMouseCursor(int x, int y, byte *shape) {
}
void Screen::copyScreenFromRect(int x, int y, int w, int h, uint8 *ptr) {
debugC( 9, kDebugLevelScreen, "Screen::copyScreenFromRect(%d, %d, %d, %d, 0x%X)", x, y, w, h, ptr);
debugC( 9, kDebugLevelScreen, "Screen::copyScreenFromRect(%d, %d, %d, %d, %p)", x, y, w, h, (const void *)ptr);
x <<= 3; w <<= 3;
uint8 *src = ptr;
uint8 *dst = &_pagePtrs[0][y * SCREEN_W + x];
@ -1832,7 +1832,7 @@ void Screen::copyScreenFromRect(int x, int y, int w, int h, uint8 *ptr) {
}
void Screen::copyScreenToRect(int x, int y, int w, int h, uint8 *ptr) {
debugC( 9, kDebugLevelScreen, "Screen::copyScreenToRect(%d, %d, %d, %d, 0x%X)", x, y, w, h, ptr);
debugC( 9, kDebugLevelScreen, "Screen::copyScreenToRect(%d, %d, %d, %d, %p)", x, y, w, h, (const void *)ptr);
x <<= 3; w <<= 3;
uint8 *src = &_pagePtrs[0][y * SCREEN_W + x];
uint8 *dst = ptr;
@ -1874,7 +1874,7 @@ byte Screen::getShapeFlag2(int x, int y) {
}
int Screen::setNewShapeHeight(uint8 *shape, int height) {
debugC( 9, kDebugLevelScreen, "Screen::setNewShapeHeight(0x%X, %d)", shape, height);
debugC( 9, kDebugLevelScreen, "Screen::setNewShapeHeight(%p, %d)", (const void *)shape, height);
if (_vm->features() & GF_TALKIE)
shape += 2;
int oldHeight = shape[2];
@ -1883,7 +1883,7 @@ int Screen::setNewShapeHeight(uint8 *shape, int height) {
}
int Screen::resetShapeHeight(uint8 *shape) {
debugC( 9, kDebugLevelScreen, "Screen::setNewShapeHeight(0x%X)", shape);
debugC( 9, kDebugLevelScreen, "Screen::setNewShapeHeight(%p)", (const void *)shape);
if (_vm->features() & GF_TALKIE)
shape += 2;
int oldHeight = shape[2];

File diff suppressed because it is too large Load diff

View file

@ -461,7 +461,7 @@ void SeqPlayer::s1_prefetchVocFile() {
}
bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
debugC( 9, kDebugLevelSequence, "SeqPlayer::seq_playSequence(0x%X, %d)", seqData, skipSeq);
debugC( 9, kDebugLevelSequence, "SeqPlayer::seq_playSequence(%p, %d)", (const void *)seqData, skipSeq);
assert(seqData);
static SeqEntry floppySeqProcs[] = {

View file

@ -1366,7 +1366,7 @@ int KyraEngine::handleBeadState() {
}
void KyraEngine::initBeadState(int x, int y, int x2, int y2, int unk, BeadState *ptr) {
debugC(9, kDebugLevelMain, "KyraEngine::initBeadState(%d, %d, %d, %d, %d, 0x%X)", x, y, x2, y2, unk, ptr);
debugC(9, kDebugLevelMain, "KyraEngine::initBeadState(%d, %d, %d, %d, %d, %p)", x, y, x2, y2, unk, (const void *)ptr);
ptr->unk9 = unk;
int xDiff = x2 - x;
int yDiff = y2 - y;
@ -1401,7 +1401,7 @@ void KyraEngine::initBeadState(int x, int y, int x2, int y2, int unk, BeadState
}
int KyraEngine::processBead(int x, int y, int &x2, int &y2, BeadState *ptr) {
debugC(9, kDebugLevelMain, "KyraEngine::processBead(%d, %d, 0x%X, 0x%X, 0x%X)", x, y, &x2, &y2, ptr);
debugC(9, kDebugLevelMain, "KyraEngine::processBead(%d, %d, %p, %p, %p)", x, y, (const void *)&x2, (const void *)&y2, (const void *)ptr);
if (x == ptr->dstX && y == ptr->dstY) {
return 1;
}

View file

@ -758,7 +758,7 @@ void AdlibDriver::updateAndOutput1(uint8 unk1, OutputState &state) {
}
void AdlibDriver::updateAndOutput2(uint8 unk1, uint8 *dataptr, OutputState &state) {
debugC(9, kDebugLevelSound, "updateAndOutput2(%d, 0x%X, %d)", unk1, dataptr, &state - _outputTables);
debugC(9, kDebugLevelSound, "updateAndOutput2(%d, %p, %d)", unk1, (const void *)dataptr, &state - _outputTables);
// Amplitude Modulation / Vibrato / Envelope Generator Type /
// Keyboard Scaling Rate / Modulator Frequency Multiple
writeOPL(0x20 + unk1, *dataptr++);

View file

@ -31,7 +31,7 @@ WSAMovieV1::WSAMovieV1(KyraEngine *vm) : Movie(vm) {}
WSAMovieV1::~WSAMovieV1() { close(); }
void WSAMovieV1::open(const char *filename, int offscreenDecode, uint8 *palBuf) {
debugC(9, kDebugLevelMovie, "WSAMovieV1::open('%s', %d, 0x%X)", filename, offscreenDecode, palBuf);
debugC(9, kDebugLevelMovie, "WSAMovieV1::open('%s', %d, %p)", filename, offscreenDecode, (const void *)palBuf);
close();
uint32 flags = 0;
@ -191,7 +191,7 @@ void WSAMovieV1::displayFrame(int frameNum) {
}
void WSAMovieV1::processFrame(int frameNum, uint8 *dst) {
debugC(9, kDebugLevelMovie, "WSAMovieV1::processFrame(%d, 0x%X)", frameNum, dst);
debugC(9, kDebugLevelMovie, "WSAMovieV1::processFrame(%d, %p)", frameNum, (const void *)dst);
if (!_opened)
return;
assert(frameNum <= _numFrames);

View file

@ -332,7 +332,7 @@ bool Actor::loadActorResources(ActorData *actor) {
_vm->_resource->loadResource(_actorContext, actor->_frameListResourceId, resourcePointer, resourceLength);
framesCount = resourceLength / 16;
debug(9, "Frame resource contains %d frames (res length is %d)", framesCount, resourceLength);
debug(9, "Frame resource contains %d frames (res length is %d)", framesCount, (int)resourceLength);
framesPointer = (ActorFrameSequence *)malloc(sizeof(ActorFrameSequence) * framesCount);
if (framesPointer == NULL && framesCount != 0) {

View file

@ -478,7 +478,7 @@ void Anim::decodeFrame(AnimationData *anim, size_t frameOffset, byte *buf, size_
#if 1
#define VALIDATE_WRITE_POINTER \
if ((writePointer < buf) || (writePointer >= (buf + screenWidth * screenHeight))) { \
error("VALIDATE_WRITE_POINTER: writePointer=%x buf=%x", writePointer, buf); \
error("VALIDATE_WRITE_POINTER: writePointer=%p buf=%p", (void *)writePointer, (void *)buf); \
}
#else
#define VALIDATE_WRITE_POINTER

View file

@ -408,7 +408,7 @@ int Events::handleOneShot(Event *event) {
switch (event->op) {
case kEventExecBlocking:
case kEventExecNonBlocking:
debug(6, "Exec module number %d script entry number %d", event->param, event->param2);
debug(6, "Exec module number %ld script entry number %ld", event->param, event->param2);
sthread = _vm->_script->createThread(event->param, event->param2);
if (sthread == NULL) {

View file

@ -83,7 +83,7 @@ void Font::loadFont(uint32 fontResourceId) {
_vm->_resource->loadResource(fontContext, fontResourceId, fontResourcePointer, fontResourceLength);
if (fontResourceLength < FONT_DESCSIZE) {
error("Font::loadFont() Invalid font length (%i < %i)", fontResourceLength, FONT_DESCSIZE);
error("Font::loadFont() Invalid font length (%i < %i)", (int)fontResourceLength, FONT_DESCSIZE);
}
MemoryReadStreamEndian readS(fontResourcePointer, fontResourceLength, fontContext->isBigEndian);

View file

@ -59,7 +59,7 @@ int SagaEngine::decodeBGImage(const byte *image_data, size_t image_size,
size_t out_buf_len;
if (image_size <= SAGA_IMAGE_DATA_OFFSET) {
error("decodeBGImage() Image size is way too small (%d)", image_size);
error("decodeBGImage() Image size is way too small (%d)", (int)image_size);
}
MemoryReadStreamEndian readS(image_data, image_size, isBigEndian());

View file

@ -186,7 +186,7 @@ Scene::Scene(SagaEngine *vm) : _vm(vm) {
loadSceneResourceList(_sceneDescription.resourceListResourceId);
gDebugLevel = backUpDebugLevel;
debug(DUMP_SCENES_LEVEL, "Dump Scene: number %i, descriptor resourceId %i, resourceList resourceId %i", i, _sceneLUT[i], _sceneDescription.resourceListResourceId);
debug(DUMP_SCENES_LEVEL, "\tresourceListCount %i", _resourceListCount);
debug(DUMP_SCENES_LEVEL, "\tresourceListCount %i", (int)_resourceListCount);
for (j = 0; j < _resourceListCount; j++) {
if (_resourceList[j].resourceType >= typesCount) {
error("wrong resource type %i", _resourceList[j].resourceType);
@ -509,7 +509,7 @@ int Scene::getBGMaskType(const Point &testPoint) {
}
offset = testPoint.x + testPoint.y * _bgMask.w;
if (offset >= _bgMask.buf_len) {
error("Scene::getBGMaskType offset 0x%X exceed bufferLength 0x%X", offset, _bgMask.buf_len);
error("Scene::getBGMaskType offset 0x%X exceed bufferLength 0x%X", offset, (int)_bgMask.buf_len);
}
return (_bgMask.buf[offset] >> 4) & 0x0f;
@ -942,7 +942,7 @@ void Scene::loadSceneResourceList(uint32 resourceId) {
// Allocate memory for scene resource list
_resourceListCount = resourceListDataLength / SAGA_RESLIST_ENTRY_LEN;
debug(3, "Scene resource list contains %i entries", _resourceListCount);
debug(3, "Scene resource list contains %i entries", (int)_resourceListCount);
_resourceList = (SceneResourceData *)calloc(_resourceListCount, sizeof(*_resourceList));
// Load scene resource list from raw scene
@ -1037,7 +1037,7 @@ void Scene::processSceneResources() {
_bgMask.w = MIN(_bgMask.w, _vm->getDisplayWidth());
_bgMask.h = MIN(_bgMask.h, getHeight());
debug(4, "BACKGROUND MASK width=%d height=%d length=%d", _bgMask.w, _bgMask.h, _bgMask.buf_len);
debug(4, "BACKGROUND MASK width=%d height=%d length=%d", _bgMask.w, _bgMask.h, (int)_bgMask.buf_len);
break;
case SAGA_STRINGS:
debug(3, "Loading scene strings resource...");
@ -1123,7 +1123,7 @@ void Scene::processSceneResources() {
byte *palPtr = resourceData;
if (resourceDataLength < 3 * PAL_ENTRIES)
error("Too small scene palette %i", resourceDataLength);
error("Too small scene palette %i", (int)resourceDataLength);
for (uint16 c = 0; c < PAL_ENTRIES; c++) {
pal[c].red = *palPtr++;

View file

@ -95,7 +95,7 @@ Script::Script(SagaEngine *vm) : _vm(vm) {
} else if (resourceLength % S_LUT_ENTRYLEN_ITEDISK == 0) {
_modulesLUTEntryLen = S_LUT_ENTRYLEN_ITEDISK;
} else {
error("Script::Script() Invalid script lookup table length (%i)", resourceLength);
error("Script::Script() Invalid script lookup table length (%i)", (int)resourceLength);
}
// Calculate number of entries

View file

@ -234,7 +234,7 @@ bool Script::runThread(ScriptThread *thread, uint instructionLimit) {
_vm->_console->DebugPrintf("%s\n", operandName); \
}
debug(8, "Executing thread offset: %lu (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize());
debug(8, "Executing thread offset: %u (%x) stack: %d", thread->_instructionOffset, operandChar, thread->pushedSize());
operandName="";
switch (operandChar) {
CASEOP(opNextBlock)

View file

@ -220,7 +220,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
akst += 8;
}
if (!found) {
error("Sequence not found in actor %p costume %d", a, a->_costume);
error("Sequence not found in actor %p costume %d", (void *)a, a->_costume);
}
}
}
@ -251,7 +251,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
aksf += 6;
}
if (!found) {
error("Sequence not found in actor %p costume %d", a, a->_costume);
error("Sequence not found in actor %p costume %d", (void *)a, a->_costume);
}
}
}
@ -275,7 +275,7 @@ void AkosCostumeLoader::costumeDecodeData(Actor *a, int frame, uint usemask) {
akst += 8;
}
if (!found) {
error("Sequence not found in actor %p costume %d", a, a->_costume);
error("Sequence not found in actor %p costume %d", (void *)a, a->_costume);
}
}
}

View file

@ -164,7 +164,6 @@ int Win32ResExtractor::extractResource_(const char *resType, char *resName, byte
if (_vm->_substResFileName.almostGameID != 0) {
char buf1[128];
_vm->generateSubstResFileName(_fileName, buf1, sizeof(buf1));
strcpy(_fileName, buf1);
}

View file

@ -2128,7 +2128,7 @@ void ScummEngine_v72he::copyArrayHelper(ArrayHeader *ah, int idx2, int idx1, int
*data = ah->data + offset * 4;
break;
default:
error("Invalid array type", FROM_LE_32(ah->type));
error("Invalid array type %d", FROM_LE_32(ah->type));
}
}

View file

@ -2303,7 +2303,7 @@ void ScummEngine_v90he::sortArray(int array, int dim2start, int dim2end, int dim
}
break;
default:
error("Invalid array type", FROM_LE_32(ah->type));
error("Invalid array type %d", FROM_LE_32(ah->type));
}
}

View file

@ -62,6 +62,48 @@ static bool checkTryMedia(BaseScummFile *handle);
#endif
#if 0
Common::String generateFilename(int room, int diskNumber) {
char buf[128];
if (_game.version == 4) {
if (room == 0 || room >= 900) {
sprintf(buf, "%.3d.lfl", room);
} else {
sprintf(buf, "disk%.2d.lec", diskNumber);
}
} else if (_game.heversion >= 98) {
char c;
int disk = 0;
if (_heV7DiskOffsets)
disk = _heV7DiskOffsets[room];
switch(disk) {
case 2:
c = 'b';
break;
case 1:
c = 'a';
break;
default:
c = '0';
}
sprintf(buf, _substEntry.formatStr, c);
} else if (_substEntry.method == kGenDiskNum) {
sprintf(buf, _substEntry.formatStr, diskNumber);
} else if (_substEntry.method == kGenRoomNum) {
sprintf(buf, _substEntry.formatStr, room);
} else {
error("FOO");
}
return buf;
}
#endif
/* Open a room */
void ScummEngine::openRoom(const int room) {
bool result;

View file

@ -1606,7 +1606,9 @@ void ScummEngine_v99he::scummInit() {
memset(_hePalettes, 0, (_numPalettes + 1) * 1024);
// Array 129 is set to base name
int len = resStrLen((const byte *)_baseName.c_str()) + 1;
// FIXME: Of course, we probably would want to insert the value
// *after* applying the filename substitution here... ?
int len = _baseName.size() + 1;
ArrayHeader *ah = defineArray(129, kStringArray, 0, 0, 0, len);
memcpy(ah->data, _baseName.c_str(), len);

View file

@ -390,7 +390,7 @@ void *SkyCompact::getCompactElem(Compact *cpt, uint16 off) {
return ((uint8 *)fetchCpt(cpt->megaSet3.turnTableId) + turnTableOffsets[off]);
off -= TURNTABLE_SIZE;
error("Offset %X out of bounds of compact", off + COMPACT_SIZE + 4 * MEGASET_SIZE + 4 * TURNTABLE_SIZE);
error("Offset %X out of bounds of compact", (int)(off + COMPACT_SIZE + 4 * MEGASET_SIZE + 4 * TURNTABLE_SIZE));
}
uint8 *SkyCompact::createResetData(uint16 gameVersion) {

View file

@ -1268,7 +1268,7 @@ void Debug::script(uint32 command, uint16 *scriptData) {
debug(6, " %d", READ_LE_UINT16(scriptData + i));
}
}
debug(6, "");
debug(6, " "); // Print an empty line as separator
}
void Debug::mcode(uint32 mcode, uint32 a, uint32 b, uint32 c) {

View file

@ -512,7 +512,7 @@ void ResourceManager::checkMemUsage() {
tmp->ptr = NULL;
_usedMem -= tmp->size;
} else {
warning("%d bytes of memory used, but cache list is empty!\n");
warning("%d bytes of memory used, but cache list is empty!\n", _usedMem);
return;
}
}