From aff66038f3fd5b0e5af49c94c7f0a5270981f7cf Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 9 Apr 2005 01:28:16 +0000 Subject: o Put numerous debug messages to deeper level and removed others o Occasional indentation fixes o Fixed bug with cursor. Thanks wjp. Now even gob1demo works but final screen which is not playable in original hangs here. svn-id: r17462 --- gob/dataio.cpp | 6 +++--- gob/game.cpp | 16 +++++----------- gob/game.h | 4 ++-- gob/inter.cpp | 5 ++--- gob/palanim.cpp | 2 +- gob/scenery.cpp | 1 - gob/video.cpp | 4 ---- 7 files changed, 13 insertions(+), 25 deletions(-) (limited to 'gob') diff --git a/gob/dataio.cpp b/gob/dataio.cpp index 08b5cfc1c9..e4a938b08c 100644 --- a/gob/dataio.cpp +++ b/gob/dataio.cpp @@ -115,7 +115,7 @@ int32 data_readChunk(int16 handle, char *buf, int16 size) { offset = chunkOffset[file * MAX_SLOT_COUNT + slot] + chunkPos[file * MAX_SLOT_COUNT + slot]; - debug(0, "seek: %ld, %ld", chunkOffset[file * MAX_SLOT_COUNT + slot], chunkPos[file * MAX_SLOT_COUNT + slot]); + debug(7, "seek: %ld, %ld", chunkOffset[file * MAX_SLOT_COUNT + slot], chunkPos[file * MAX_SLOT_COUNT + slot]); file_getHandle(dataFileHandles[file])->seek(offset, SEEK_SET); } @@ -207,7 +207,7 @@ void data_openDataFile(const char *src) { numDataChunks[file] = file_getHandle(dataFileHandles[file])->readUint16LE(); - debug(0, "DataChunks: %d [for %s]", numDataChunks[file], path); + debug(7, "DataChunks: %d [for %s]", numDataChunks[file], path); dataFiles[file] = dataDesc = (struct ChunkDesc *)malloc(sizeof(struct ChunkDesc) * @@ -221,7 +221,7 @@ void data_openDataFile(const char *src) { } for (i = 0; i < numDataChunks[file]; i++) - debug(0, "%d: %s %d", i, dataDesc[i].chunkName, dataDesc[i].size); + debug(7, "%d: %s %d", i, dataDesc[i].chunkName, dataDesc[i].size); for (i = 0; i < MAX_SLOT_COUNT; i++) chunkPos[file * MAX_SLOT_COUNT + i] = -1; diff --git a/gob/game.cpp b/gob/game.cpp index 870e287bc7..178ff3ff79 100644 --- a/gob/game.cpp +++ b/gob/game.cpp @@ -113,15 +113,15 @@ char *game_loadExtData(int16 itemId, int16 *pResWidth, int16 *pResHeight) { if (pResWidth != 0) { *pResWidth = item->width & 0x7fff; *pResHeight = item->height; - debug(0, "game_loadExtData(%d, %d, %d)", itemId, *pResWidth, *pResHeight); + debug(7, "game_loadExtData(%d, %d, %d)", itemId, *pResWidth, *pResHeight); } - debug(0, "game_loadExtData(%d, 0, 0)", itemId); + debug(7, "game_loadExtData(%d, 0, 0)", itemId); if (item->height == 0) size += (item->width & 0x7fff) << 16; - debug(0, "size: %d off: %d", size, offset); + debug(7, "size: %d off: %d", size, offset); if (offset >= 0) { handle = game_extHandle; } else { @@ -134,7 +134,7 @@ char *game_loadExtData(int16 itemId, int16 *pResWidth, int16 *pResHeight) { handle = commonHandle; } - debug(0, "off: %ld size: %ld", offset, tableSize); + debug(7, "off: %ld size: %ld", offset, tableSize); data_seekData(handle, offset + tableSize, SEEK_SET); if (isPacked) dataBuf = (char *)malloc(size); @@ -161,10 +161,6 @@ char *game_loadExtData(int16 itemId, int16 *pResWidth, int16 *pResHeight) { free(packedBuf); } - for (int16 i = 0; i < 16; i++) - printf("%02x ", (byte)dataBuf[i]); - printf("\n"); - return dataBuf; } @@ -381,8 +377,7 @@ char *game_loadTotResource(int16 id) { return ((char *)game_totResourceTable) + szGame_TotResTable + szGame_TotResItem * game_totResourceTable->itemsCount + offset; } else { - return (char *)(game_imFileData + - ((int32 *)game_imFileData)[-offset - 1]); + return (char *)(game_imFileData + ((int32 *)game_imFileData)[-offset - 1]); } } @@ -1693,7 +1688,6 @@ void game_loadImFile(void) { char path[20]; int16 handle; - // If demo if (game_totFileData[0x3d] != 0 && game_totFileData[0x3b] == 0) return; diff --git a/gob/game.h b/gob/game.h index cf4c9ee5be..fe5801d1dd 100644 --- a/gob/game.h +++ b/gob/game.h @@ -44,8 +44,8 @@ typedef struct Game_ExtTable { #define szGame_TotResItem (4 + 2 + 2 + 2) typedef struct Game_TotResItem { - int32 offset; // if > 0, then offset from end of resource table. - // If < 0, then -offset-1 is index in .IM file table + int32 offset; // if > 0, then offset from end of resource table. + // If < 0, then -offset-1 is index in .IM file table int16 size; int16 width; int16 height; diff --git a/gob/inter.cpp b/gob/inter.cpp index 6010ed8a69..cdc41a86b1 100644 --- a/gob/inter.cpp +++ b/gob/inter.cpp @@ -43,7 +43,7 @@ int16 *inter_breakFromLevel; int16 *inter_nestLevel; int16 inter_load16(void) { - int16 tmp = READ_LE_UINT16(inter_execPtr); + int16 tmp = (int16)READ_LE_UINT16(inter_execPtr); inter_execPtr += 2; return tmp; } @@ -803,12 +803,11 @@ void inter_loadCursor(void) { Game_TotResItem *itemPtr; int16 width; int16 height; - int16 offset; + int32 offset; char *dataBuf; int16 id; int8 index; - debug(0, "inter_loadCursor"); id = inter_load16(); index = *inter_execPtr++; itemPtr = &game_totResourceTable->items[id]; diff --git a/gob/palanim.cpp b/gob/palanim.cpp index 1435663fe5..1f800d59d0 100644 --- a/gob/palanim.cpp +++ b/gob/palanim.cpp @@ -140,7 +140,7 @@ char pal_fadeStep(int16 oper) { return 1; } -void pal_fade(PalDesc * palDesc, int16 fade, int16 allColors) { +void pal_fade(PalDesc *palDesc, int16 fade, int16 allColors) { char stop; int16 i; diff --git a/gob/scenery.cpp b/gob/scenery.cpp index 735d793887..763c08f623 100644 --- a/gob/scenery.cpp +++ b/gob/scenery.cpp @@ -111,7 +111,6 @@ int16 scen_loadStatic(char search) { ptr->layersCount = (int16)READ_LE_UINT16(dataPtr); dataPtr += 2; - debug("layer: %d", ptr->layersCount); ptr->layers = (Scen_StaticLayer **)malloc(sizeof(Scen_StaticLayer *) * ptr->layersCount); ptr->pieces = (Scen_PieceDesc **)malloc(sizeof(Scen_PieceDesc *) * picsCount); diff --git a/gob/video.cpp b/gob/video.cpp index 077ae3be49..e166f6df62 100644 --- a/gob/video.cpp +++ b/gob/video.cpp @@ -93,8 +93,6 @@ SurfaceDesc *vid_initSurfDesc(int16 vidMode, int16 width, int16 height, int16 fl int16 someFlags = 1; SurfaceDesc *descPtr; - debug(0, "stub: vid_initSurfDesc()"); - if (flags != PRIMARY_SURFACE) sprAllocated++; @@ -441,8 +439,6 @@ char vid_spriteUncompressor(byte *sprBuf, int16 srcWidth, int16 srcHeight, int16 bufPos; int16 strLen; - warning("vid_spriteUncompressor called"); - if ((destDesc->vidMode & 0x7f) != 0x13) error("vid_spriteUncompressor: Video mode 0x%x is not supported!", destDesc->vidMode & 0x7f); -- cgit v1.2.3