diff options
Diffstat (limited to 'engines/gob')
38 files changed, 442 insertions, 432 deletions
diff --git a/engines/gob/cdrom.cpp b/engines/gob/cdrom.cpp index f436df9988..a597737b8c 100644 --- a/engines/gob/cdrom.cpp +++ b/engines/gob/cdrom.cpp @@ -85,7 +85,7 @@ void CDROM::readLIC(const char *fname) { } _LICbuffer = new byte[_numTracks * 22]; - _vm->_dataIO->readData(handle, (char *) _LICbuffer, _numTracks * 22); + _vm->_dataIO->readData(handle, _LICbuffer, _numTracks * 22); _vm->_dataIO->closeData(handle); } diff --git a/engines/gob/dataio.cpp b/engines/gob/dataio.cpp index bd6de8a2a0..b16746ca4c 100644 --- a/engines/gob/dataio.cpp +++ b/engines/gob/dataio.cpp @@ -47,12 +47,10 @@ DataIO::~DataIO() { } } -int32 DataIO::unpackData(char *sourceBuf, char *destBuf) { +int32 DataIO::unpackData(byte *src, byte *dest) { uint32 realSize; uint32 counter; uint16 cmd; - byte *src; - byte *dest; byte *tmpBuf; int16 off; byte len; @@ -61,14 +59,13 @@ int32 DataIO::unpackData(char *sourceBuf, char *destBuf) { tmpBuf = new byte[4114]; assert(tmpBuf); - counter = realSize = READ_LE_UINT32(sourceBuf); + counter = realSize = READ_LE_UINT32(src); for (int i = 0; i < 4078; i++) tmpBuf[i] = 0x20; tmpIndex = 4078; - src = (byte *) (sourceBuf + 4); - dest = (byte *) destBuf; + src += 4; cmd = 0; while (1) { @@ -172,7 +169,7 @@ char DataIO::freeChunk(int16 handle) { return 1; } -int32 DataIO::readChunk(int16 handle, char *buf, uint16 size) { +int32 DataIO::readChunk(int16 handle, byte *buf, uint16 size) { int16 file; int16 slot; int16 i; @@ -328,12 +325,12 @@ void DataIO::closeDataFile(bool itk) { } } -char *DataIO::getUnpackedData(const char *name) { +byte *DataIO::getUnpackedData(const char *name) { int32 realSize; int16 chunk; - char *unpackBuf; - char *packBuf; - char *ptr; + byte *unpackBuf; + byte *packBuf; + byte *ptr; int32 sizeLeft; realSize = getChunkSize(name); @@ -344,10 +341,10 @@ char *DataIO::getUnpackedData(const char *name) { if (chunk == -1) return 0; - unpackBuf = new char[realSize]; + unpackBuf = new byte[realSize]; assert(unpackBuf); - packBuf = new char[_packedSize]; + packBuf = new byte[_packedSize]; assert(packBuf); sizeLeft = _packedSize; @@ -383,7 +380,7 @@ int16 DataIO::openData(const char *path, Common::File::AccessMode mode) { return file_open(path, mode); } -int32 DataIO::readData(int16 handle, char *buf, uint16 size) { +int32 DataIO::readData(int16 handle, byte *buf, uint16 size) { int32 res; res = readChunk(handle, buf, size); @@ -394,27 +391,27 @@ int32 DataIO::readData(int16 handle, char *buf, uint16 size) { } byte DataIO::readByte(int16 handle) { - char buf; + byte buf; readData(handle, &buf, 1); return ((byte) buf); } uint16 DataIO::readUint16(int16 handle) { - char buf[2]; + byte buf[2]; readData(handle, buf, 2); return READ_LE_UINT16(buf); } uint32 DataIO::readUint32(int16 handle) { - char buf[4]; + byte buf[4]; readData(handle, buf, 4); return READ_LE_UINT32(buf); } -int32 DataIO::writeData(int16 handle, char *buf, uint16 size) { +int32 DataIO::writeData(int16 handle, byte *buf, uint16 size) { return file_getHandle(handle)->write(buf, size); } @@ -458,9 +455,9 @@ int32 DataIO::getDataSize(const char *name) { return chunkSz; } -char *DataIO::getData(const char *path) { - char *data; - char *ptr; +byte *DataIO::getData(const char *path) { + byte *data; + byte *ptr; int32 size; int16 handle; @@ -469,7 +466,7 @@ char *DataIO::getData(const char *path) { return data; size = getDataSize(path); - data = new char[size]; + data = new byte[size]; assert(data); handle = openData(path); diff --git a/engines/gob/dataio.h b/engines/gob/dataio.h index 9c29fea195..f581aeae63 100644 --- a/engines/gob/dataio.h +++ b/engines/gob/dataio.h @@ -45,23 +45,23 @@ public: ChunkDesc() : size(0), offset(0), packed(0) { chunkName[0] = 0; } }; - int32 unpackData(char *source, char *dest); + int32 unpackData(byte *src, byte *dest); void openDataFile(const char *src, bool itk = 0); void closeDataFile(bool itk = 0); - char *getUnpackedData(const char *name); + byte *getUnpackedData(const char *name); void closeData(int16 handle); int16 openData(const char *path, Common::File::AccessMode mode = Common::File::kFileReadMode); - int32 readData(int16 handle, char *buf, uint16 size); + int32 readData(int16 handle, byte *buf, uint16 size); byte readByte(int16 handle); uint16 readUint16(int16 handle); uint32 readUint32(int16 handle); - int32 writeData(int16 handle, char *buf, uint16 size); + int32 writeData(int16 handle, byte *buf, uint16 size); void seekData(int16 handle, int32 pos, int16 from); uint32 getPos(int16 handle); int32 getDataSize(const char *name); - char *getData(const char *path); + byte *getData(const char *path); DataIO(class GobEngine *vm); ~DataIO(); @@ -86,7 +86,7 @@ protected: int16 getChunk(const char *chunkName); char freeChunk(int16 handle); - int32 readChunk(int16 handle, char *buf, uint16 size); + int32 readChunk(int16 handle, byte *buf, uint16 size); int16 seekChunk(int16 handle, int32 pos, int16 from); uint32 getChunkPos(int16 handle); int32 getChunkSize(const char *chunkName); diff --git a/engines/gob/draw.cpp b/engines/gob/draw.cpp index eef044699c..3ccc520992 100644 --- a/engines/gob/draw.cpp +++ b/engines/gob/draw.cpp @@ -329,7 +329,7 @@ void Draw::drawString(char *str, int16 x, int16 y, int16 color1, int16 color2, if (!font->extraData) x += font->itemWidth; else - x += *(((char *)font->extraData) + (*str - font->startItem)); + x += *(font->extraData + (*str - font->startItem)); str++; } } @@ -341,7 +341,8 @@ void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right, adjustCoords(1, &right, &bottom); if (READ_LE_UINT16(_vm->_game->_totFileData + 0x7E) != 0) { - char *storedIP = _vm->_global->_inter_execPtr; + byte *storedIP = _vm->_global->_inter_execPtr; + _vm->_global->_inter_execPtr = _vm->_game->_totFileData + READ_LE_UINT16(_vm->_game->_totFileData + 0x7E); WRITE_VAR(17, (uint32) id); @@ -350,6 +351,7 @@ void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right, WRITE_VAR(20, (uint32) (right - left + 1)); WRITE_VAR(21, (uint32) (bottom - top + 1)); _vm->_inter->funcBlock(0); + _vm->_global->_inter_execPtr = storedIP; } @@ -365,7 +367,7 @@ void Draw::printTextCentered(int16 id, int16 left, int16 top, int16 right, _frontColor = color; _textToPrint = str; if (_fonts[fontIndex]->extraData != 0) { - char *data = (char *) _fonts[fontIndex]->extraData; + byte *data = _fonts[fontIndex]->extraData; int length = strlen(str); for (int i = 0; i < length; i++) diff --git a/engines/gob/draw_v1.cpp b/engines/gob/draw_v1.cpp index 64b75dca15..58e0a3c2d3 100644 --- a/engines/gob/draw_v1.cpp +++ b/engines/gob/draw_v1.cpp @@ -173,7 +173,7 @@ void Draw_v1::printTotText(int16 id) { if (!_vm->_game->_totTextData || !_vm->_game->_totTextData->dataPtr) return; - dataPtr = ((byte *) _vm->_game->_totTextData->dataPtr) + + dataPtr = _vm->_game->_totTextData->dataPtr + _vm->_game->_totTextData->items[id].offset; ptr = dataPtr; @@ -321,7 +321,7 @@ void Draw_v1::printTotText(int16 id) { void Draw_v1::spriteOperation(int16 operation) { uint16 id; - char *dataBuf; + byte *dataBuf; Game::TotResItem *itemPtr; int32 offset; int16 len; @@ -414,7 +414,7 @@ void Draw_v1::spriteOperation(int16 operation) { if (id >= 30000) { dataBuf = _vm->_game->loadExtData(id, &_spriteRight, &_spriteBottom); - _vm->_video->drawPackedSprite((byte *) dataBuf, + _vm->_video->drawPackedSprite(dataBuf, _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY, _transparency, _spritesArray[_destSurface]); @@ -444,7 +444,7 @@ void Draw_v1::spriteOperation(int16 operation) { _spriteRight = itemPtr->width; _spriteBottom = itemPtr->height; - _vm->_video->drawPackedSprite((byte *) dataBuf, + _vm->_video->drawPackedSprite(dataBuf, _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY, _transparency, _spritesArray[_destSurface]); diff --git a/engines/gob/draw_v2.cpp b/engines/gob/draw_v2.cpp index 17295beeb2..6b7b1db0fd 100644 --- a/engines/gob/draw_v2.cpp +++ b/engines/gob/draw_v2.cpp @@ -201,7 +201,7 @@ void Draw_v2::printTotText(int16 id) { _vm->validateLanguage(); size = _vm->_game->_totTextData->items[id].size; - dataPtr = ((byte *) _vm->_game->_totTextData->dataPtr) + + dataPtr = _vm->_game->_totTextData->dataPtr + _vm->_game->_totTextData->items[id].offset; ptr = dataPtr; @@ -459,7 +459,7 @@ void Draw_v2::printTotText(int16 id) { case 10: str[0] = (char) 255; WRITE_LE_UINT16((uint16 *) (str + 1), - ((char *) ptr) - _vm->_game->_totTextData->dataPtr); + ptr - _vm->_game->_totTextData->dataPtr); str[3] = 0; ptr++; for (int i = *ptr++; i > 0; i--) { @@ -546,7 +546,7 @@ void Draw_v2::printTotText(int16 id) { void Draw_v2::spriteOperation(int16 operation) { uint16 id; - char *dataBuf; + byte *dataBuf; Game::TotResItem *itemPtr; int32 offset; int16 len; @@ -693,7 +693,7 @@ void Draw_v2::spriteOperation(int16 operation) { if (id >= 30000) { dataBuf = _vm->_game->loadExtData(id, &_spriteRight, &_spriteBottom); - _vm->_video->drawPackedSprite((byte *) dataBuf, + _vm->_video->drawPackedSprite(dataBuf, _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY, _transparency, _spritesArray[_destSurface]); if (_destSurface == 21) { @@ -718,7 +718,7 @@ void Draw_v2::spriteOperation(int16 operation) { _spriteRight = itemPtr->width; _spriteBottom = itemPtr->height; - _vm->_video->drawPackedSprite((byte *) dataBuf, + _vm->_video->drawPackedSprite(dataBuf, _spriteRight, _spriteBottom, _destSpriteX, _destSpriteY, _transparency, _spritesArray[_destSurface]); @@ -759,7 +759,7 @@ void Draw_v2::spriteOperation(int16 operation) { _vm->_video->drawLetter(_textToPrint[i], _destSpriteX, _destSpriteY, _fonts[_fontIndex], _transparency, _frontColor, _backColor, _spritesArray[_destSurface]); - _destSpriteX += *(((char*)_fonts[_fontIndex]->extraData) + + _destSpriteX += *(_fonts[_fontIndex]->extraData + (_textToPrint[i] - _fonts[_fontIndex]->startItem)); } else diff --git a/engines/gob/driver_vga.cpp b/engines/gob/driver_vga.cpp index 0df7302d7d..b5237430dc 100644 --- a/engines/gob/driver_vga.cpp +++ b/engines/gob/driver_vga.cpp @@ -74,7 +74,7 @@ void VGAVideoDriver::drawLetter(unsigned char item, int16 x, int16 y, byte *src, *dst; uint16 data; - src = ((byte *) fontDesc->dataPtr) + + src = fontDesc->dataPtr + (item - fontDesc->startItem) * (fontDesc->itemSize & 0xFF); dst = dest->getVidMem() + x + dest->getWidth() * y; diff --git a/engines/gob/game.cpp b/engines/gob/game.cpp index 4c0bb5a613..a15ad2d9c3 100644 --- a/engines/gob/game.cpp +++ b/engines/gob/game.cpp @@ -85,8 +85,8 @@ Game::Game(GobEngine *vm) : _vm(vm) { _curBackupPos = 0; for (int i = 0; i < 5; i++) { - _cursorXDeltaArray[i] = 0; - _cursorYDeltaArray[i] = 0; + _cursorHotspotXArray[i] = 0; + _cursorHotspotYArray[i] = 0; _totTextDataArray[i] = 0; _totFileDataArray[i] = 0; _totResourceTableArray[i] = 0; @@ -105,7 +105,7 @@ Game::~Game() { _soundSamples[i].free(); } -char *Game::loadExtData(int16 itemId, int16 *pResWidth, +byte *Game::loadExtData(int16 itemId, int16 *pResWidth, int16 *pResHeight, uint32 *dataSize) { int16 commonHandle; int16 itemsCount; @@ -117,9 +117,9 @@ char *Game::loadExtData(int16 itemId, int16 *pResWidth, int16 handle; int32 tableSize; char path[20]; - char *dataBuf; - char *packedBuf; - char *dataPtr; + byte *dataBuf; + byte *packedBuf; + byte *dataPtr; itemId -= 30000; if (_extTable == 0) @@ -162,18 +162,18 @@ char *Game::loadExtData(int16 itemId, int16 *pResWidth, _vm->_dataIO->seekData(handle, offset + tableSize, SEEK_SET); realSize = size; if (isPacked) - dataBuf = new char[size + 2]; + dataBuf = new byte[size + 2]; else - dataBuf = new char[size]; + dataBuf = new byte[size]; dataPtr = dataBuf; while (size > 32000) { // BUG: huge->far conversion. Need normalization? - _vm->_dataIO->readData(handle, (char *) dataPtr, 32000); + _vm->_dataIO->readData(handle, dataPtr, 32000); size -= 32000; dataPtr += 32000; } - _vm->_dataIO->readData(handle, (char *) dataPtr, size); + _vm->_dataIO->readData(handle, dataPtr, size); if (commonHandle != -1) { _vm->_dataIO->closeData(commonHandle); _extHandle = _vm->_dataIO->openData(_curExtFile); @@ -182,7 +182,7 @@ char *Game::loadExtData(int16 itemId, int16 *pResWidth, if (isPacked) { packedBuf = dataBuf; realSize = READ_LE_UINT32(packedBuf); - dataBuf = new char[realSize]; + dataBuf = new byte[realSize]; _vm->_dataIO->unpackData(packedBuf, dataBuf); delete[] packedBuf; } @@ -254,7 +254,7 @@ void Game::capturePop(char doDraw) { _vm->_draw->freeSprite(30 + _captureCount); } -char *Game::loadTotResource(int16 id, int16 *dataSize) { +byte *Game::loadTotResource(int16 id, int16 *dataSize) { TotResItem *itemPtr; int32 offset; @@ -324,7 +324,7 @@ int16 Game::adjustKey(int16 key) { return key - 0x20; } -int32 Game::loadTotFile(char *path) { +int32 Game::loadTotFile(const char *path) { int16 handle; int32 size; @@ -403,14 +403,14 @@ void Game::start(void) { } // flagbits: 0 = freeInterVariables, 1 = skipPlay -void Game::totSub(int8 flags, char *newTotFile) { +void Game::totSub(int8 flags, const char *newTotFile) { int8 curBackupPos; if (_backupedCount >= 5) return; - _cursorXDeltaArray[_backupedCount] = _vm->_draw->_cursorHotspotXVar; - _cursorYDeltaArray[_backupedCount] = _vm->_draw->_cursorHotspotYVar; + _cursorHotspotXArray[_backupedCount] = _vm->_draw->_cursorHotspotXVar; + _cursorHotspotYArray[_backupedCount] = _vm->_draw->_cursorHotspotYVar; _totTextDataArray[_backupedCount] = _totTextData; _totFileDataArray[_backupedCount] = _totFileData; _totResourceTableArray[_backupedCount] = _totResourceTable; @@ -451,7 +451,7 @@ void Game::totSub(int8 flags, char *newTotFile) { popCollisions(); - if ((flags & 1) && (_vm->_global->_inter_variables != 0)) { + if ((flags & 1) && _vm->_global->_inter_variables) { delete[] _vm->_global->_inter_variables; delete[] _vm->_global->_inter_variablesSizes; } @@ -459,8 +459,8 @@ void Game::totSub(int8 flags, char *newTotFile) { _backupedCount--; _curBackupPos = curBackupPos; - _vm->_draw->_cursorHotspotXVar = _cursorXDeltaArray[_backupedCount]; - _vm->_draw->_cursorHotspotYVar = _cursorYDeltaArray[_backupedCount]; + _vm->_draw->_cursorHotspotXVar = _cursorHotspotXArray[_backupedCount]; + _vm->_draw->_cursorHotspotYVar = _cursorHotspotYArray[_backupedCount]; _totTextData = _totTextDataArray[_backupedCount]; _totFileData = _totFileDataArray[_backupedCount]; _totResourceTable = _totResourceTableArray[_backupedCount]; @@ -485,8 +485,8 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { curBackupPos = _curBackupPos; backupedCount = _backupedCount; if (_curBackupPos == _backupedCount) { - _cursorXDeltaArray[_backupedCount] = _vm->_draw->_cursorHotspotXVar; - _cursorYDeltaArray[_backupedCount] = _vm->_draw->_cursorHotspotYVar; + _cursorHotspotXArray[_backupedCount] = _vm->_draw->_cursorHotspotXVar; + _cursorHotspotYArray[_backupedCount] = _vm->_draw->_cursorHotspotYVar; _totTextDataArray[_backupedCount] = _totTextData; _totFileDataArray[_backupedCount] = _totFileData; _totResourceTableArray[_backupedCount] = _totResourceTable; @@ -502,8 +502,8 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { if (index >= 0) _curBackupPos--; - _vm->_draw->_cursorHotspotXVar = _cursorXDeltaArray[_curBackupPos]; - _vm->_draw->_cursorHotspotYVar = _cursorYDeltaArray[_curBackupPos]; + _vm->_draw->_cursorHotspotXVar = _cursorHotspotXArray[_curBackupPos]; + _vm->_draw->_cursorHotspotYVar = _cursorHotspotYArray[_curBackupPos]; _totTextData = _totTextDataArray[_curBackupPos]; _totFileData = _totFileDataArray[_curBackupPos]; _totResourceTable = _totResourceTableArray[_curBackupPos]; @@ -530,8 +530,8 @@ void Game::switchTotSub(int16 index, int16 skipPlay) { _curBackupPos = curBackupPos; _backupedCount = backupedCount; - _vm->_draw->_cursorHotspotXVar = _cursorXDeltaArray[_curBackupPos]; - _vm->_draw->_cursorHotspotYVar = _cursorYDeltaArray[_curBackupPos]; + _vm->_draw->_cursorHotspotXVar = _cursorHotspotXArray[_curBackupPos]; + _vm->_draw->_cursorHotspotYVar = _cursorHotspotYArray[_curBackupPos]; _totTextData = _totTextDataArray[_curBackupPos]; _totFileData = _totFileDataArray[_curBackupPos]; _totResourceTable = _totResourceTableArray[_curBackupPos]; @@ -586,7 +586,7 @@ int16 Game::openLocTextFile(char *locTextFile, int language) { return _vm->_dataIO->openData(locTextFile); } -char *Game::loadLocTexts(void) { +byte *Game::loadLocTexts(void) { char locTextFile[20]; int16 handle; int i; @@ -618,7 +618,7 @@ char *Game::loadLocTexts(void) { } void Game::setCollisions(void) { - char *savedIP; + byte *savedIP; int16 left; int16 top; int16 width; @@ -657,7 +657,7 @@ void Game::setCollisions(void) { } void Game::collSub(uint16 offset) { - char *savedIP; + byte *savedIP; int16 collStackSize; savedIP = _vm->_global->_inter_execPtr; diff --git a/engines/gob/game.h b/engines/gob/game.h index 0f916dbcc8..589364c165 100644 --- a/engines/gob/game.h +++ b/engines/gob/game.h @@ -62,7 +62,7 @@ public: int16 itemsCount; byte unknown; TotResItem *items; - char *dataPtr; + byte *dataPtr; }; #define szGame_ExtItem (4 + 2 + 2 + 2) @@ -90,14 +90,14 @@ public: struct TotTextTable { int16 itemsCount; TotTextItem *items; - char *dataPtr; + byte *dataPtr; }; struct InputDesc { int16 fontIndex; int16 backColor; int16 frontColor; - char *ptr; + byte *ptr; }; #include "common/pack-end.h" // END STRUCT PACKING @@ -112,8 +112,8 @@ public: char _curTotFile[14]; char _curExtFile[14]; - char *_imFileData; - char *_totFileData; + byte *_imFileData; + byte *_totFileData; int16 _extHandle; @@ -131,8 +131,8 @@ public: Game(GobEngine *vm); virtual ~Game(); - char *loadExtData(int16 dataId, int16 *pResWidth, int16 *pResHeight, uint32 *dataSize = 0); - char *loadTotResource(int16 id, int16 *dataSize = 0); + byte *loadExtData(int16 dataId, int16 *pResWidth, int16 *pResHeight, uint32 *dataSize = 0); + byte *loadTotResource(int16 id, int16 *dataSize = 0); void capturePush(int16 left, int16 top, int16 width, int16 height); void capturePop(char doDraw); @@ -141,7 +141,7 @@ public: int16 checkKeys(int16 *pMousex, int16 *pMouseY, int16 *pButtons, char handleMouse); void start(void); - void totSub(int8 flags, char *newTotFile); + void totSub(int8 flags, const char *newTotFile); void switchTotSub(int16 index, int16 skipPlay); virtual void playTot(int16 skipPlay) = 0; @@ -156,7 +156,7 @@ public: virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex) = 0; - virtual int16 checkCollisions(char handleMouse, int16 deltaTime, + virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, int16 *pResIndex) = 0; virtual void prepareStart(void) = 0; @@ -168,7 +168,7 @@ protected: int16 _activeCollResId; int16 _activeCollIndex; - char _handleMouse; + byte _handleMouse; char _forceHandleMouse; char _tempStr[256]; @@ -190,15 +190,15 @@ protected: // For totSub() int8 _backupedCount; int8 _curBackupPos; - int16 _cursorXDeltaArray[5]; - int16 _cursorYDeltaArray[5]; + int16 _cursorHotspotXArray[5]; + int16 _cursorHotspotYArray[5]; TotTextTable *_totTextDataArray[5]; - char *_totFileDataArray[5]; + byte *_totFileDataArray[5]; TotResTable *_totResourceTableArray[5]; ExtTable *_extTableArray[5]; int16 _extHandleArray[5]; - char *_imFileDataArray[5]; - char *_variablesArray[5]; + byte *_imFileDataArray[5]; + byte *_variablesArray[5]; char _curTotFileArray[5][14]; byte *_variablesSizesArray[5]; @@ -206,8 +206,8 @@ protected: int16 adjustKey(int16 key); - char *loadLocTexts(void); - int32 loadTotFile(char *path); + byte *loadLocTexts(void); + int32 loadTotFile(const char *path); void loadExtTable(void); void loadImFile(void); @@ -236,7 +236,7 @@ public: virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex); - virtual int16 checkCollisions(char handleMouse, int16 deltaTime, + virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, int16 *pResIndex); virtual void prepareStart(void); @@ -264,7 +264,7 @@ public: virtual int16 inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex); - virtual int16 checkCollisions(char handleMouse, int16 deltaTime, + virtual int16 checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, int16 *pResIndex); virtual void prepareStart(void); diff --git a/engines/gob/game_v1.cpp b/engines/gob/game_v1.cpp index 425d9c6b19..0f0547f4fa 100644 --- a/engines/gob/game_v1.cpp +++ b/engines/gob/game_v1.cpp @@ -54,8 +54,8 @@ void Game_v1::playTot(int16 skipPlay) { int16 breakFrom; int16 nestLevel; int32 variablesCount; - char *filePtr; - char *savedIP; + byte *filePtr; + byte *savedIP; if (skipPlay < 0) skipPlay = 0; @@ -128,14 +128,14 @@ void Game_v1::playTot(int16 skipPlay) { debugC(4, kDebugFileIO, "IMA: %s", _curImaFile); debugC(4, kDebugFileIO, "EXT: %s", _curExtFile); - filePtr = (char *) _totFileData + 0x30; + filePtr = _totFileData + 0x30; _totTextData = 0; if (READ_LE_UINT32(filePtr) != (uint32) -1) { _totTextData = new TotTextTable; _totTextData->dataPtr = - (_totFileData + READ_LE_UINT32((char *) _totFileData + 0x30)); - Common::MemoryReadStream totTextData((byte *) _totTextData->dataPtr, + (_totFileData + READ_LE_UINT32(_totFileData + 0x30)); + Common::MemoryReadStream totTextData(_totTextData->dataPtr, 4294967295U); _totTextData->itemsCount = totTextData.readSint16LE(); @@ -147,13 +147,13 @@ void Game_v1::playTot(int16 skipPlay) { } } - filePtr = (char *) _totFileData + 0x34; + filePtr = _totFileData + 0x34; _totResourceTable = 0; if (READ_LE_UINT32(filePtr) != (uint32) -1) { _totResourceTable = new TotResTable; _totResourceTable->dataPtr = - _totFileData + READ_LE_UINT32((char *) _totFileData + 0x34); - Common::MemoryReadStream totResTable((byte *) _totResourceTable->dataPtr, + _totFileData + READ_LE_UINT32( _totFileData + 0x34); + Common::MemoryReadStream totResTable(_totResourceTable->dataPtr, 4294967295U); _totResourceTable->itemsCount = totResTable.readSint16LE(); @@ -173,17 +173,16 @@ void Game_v1::playTot(int16 skipPlay) { loadExtTable(); _vm->_global->_inter_animDataSize = - READ_LE_UINT16((char *) _totFileData + 0x38); - if (_vm->_global->_inter_variables == 0) { - variablesCount = READ_LE_UINT16((char *) _totFileData + 0x2C); - _vm->_global->_inter_variables = new char[variablesCount * 4]; + READ_LE_UINT16(_totFileData + 0x38); + if (!_vm->_global->_inter_variables) { + variablesCount = READ_LE_UINT16(_totFileData + 0x2C); + _vm->_global->_inter_variables = new byte[variablesCount * 4]; _vm->_global->_inter_variablesSizes = new byte[variablesCount * 4]; _vm->_global->clearVars(variablesCount); } - _vm->_global->_inter_execPtr = (char *) _totFileData; - _vm->_global->_inter_execPtr += - READ_LE_UINT32((char *) _totFileData + 0x64); + _vm->_global->_inter_execPtr = _totFileData; + _vm->_global->_inter_execPtr += READ_LE_UINT32(_totFileData + 0x64); _vm->_inter->renewTimeInVars(); @@ -197,7 +196,7 @@ void Game_v1::playTot(int16 skipPlay) { if (_totToLoad[0] != 0) _vm->_inter->_terminate = 0; - variablesCount = READ_LE_UINT32((char *) _totFileData + 0x2C); + variablesCount = READ_LE_UINT32(_totFileData + 0x2C); _vm->_draw->blitInvalidated(); delete[] _totFileData; _totFileData = 0; @@ -336,9 +335,9 @@ void Game_v1::popCollisions(void) { delete[] _collStack[_collStackSize]; } -int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, +int16 Game_v1::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, int16 *pResIndex) { - char *savedIP; + byte *savedIP; int16 resIndex; int16 key; int16 oldIndex; @@ -362,7 +361,7 @@ int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) { savedIP = _vm->_global->_inter_execPtr; - _vm->_global->_inter_execPtr = (char *) _totFileData + + _vm->_global->_inter_execPtr = _totFileData + _collisionAreas[_lastCollAreaIndex].funcEnter; _vm->_inter->funcBlock(0); @@ -429,7 +428,7 @@ int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, if ((_lastCollKey != 0) && (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) { savedIP = _vm->_global->_inter_execPtr; - _vm->_global->_inter_execPtr = (char *) _totFileData + + _vm->_global->_inter_execPtr = _totFileData + _collisionAreas[_lastCollAreaIndex].funcLeave; _vm->_inter->funcBlock(0); @@ -469,7 +468,7 @@ int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, if ((_lastCollKey != 0) && (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) { savedIP = _vm->_global->_inter_execPtr; - _vm->_global->_inter_execPtr = (char *) _totFileData + + _vm->_global->_inter_execPtr = _totFileData + _collisionAreas[_lastCollAreaIndex].funcLeave; _vm->_inter->funcBlock(0); @@ -482,7 +481,7 @@ int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, if ((_lastCollKey != 0) && (_collisionAreas[_lastCollAreaIndex].funcLeave != 0)) { savedIP = _vm->_global->_inter_execPtr; - _vm->_global->_inter_execPtr = (char *) _totFileData + + _vm->_global->_inter_execPtr = _totFileData + _collisionAreas[_lastCollAreaIndex].funcLeave; _vm->_inter->funcBlock(0); @@ -494,7 +493,7 @@ int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) { savedIP = _vm->_global->_inter_execPtr; - _vm->_global->_inter_execPtr = (char *) _totFileData + + _vm->_global->_inter_execPtr = _totFileData + _collisionAreas[_lastCollAreaIndex].funcEnter; _vm->_inter->funcBlock(0); @@ -513,7 +512,7 @@ int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, if (key != _lastCollKey) { if ((_lastCollKey != 0) && ((oldId & 0x8000) != 0)) { savedIP = _vm->_global->_inter_execPtr; - _vm->_global->_inter_execPtr = (char *) _totFileData + + _vm->_global->_inter_execPtr = _totFileData + _collisionAreas[oldIndex].funcLeave; _vm->_inter->funcBlock(0); @@ -523,7 +522,7 @@ int16 Game_v1::checkCollisions(char handleMouse, int16 deltaTime, _lastCollKey = key; if ((_lastCollKey != 0) && ((_lastCollId & 0x8000) != 0)) { savedIP = _vm->_global->_inter_execPtr; - _vm->_global->_inter_execPtr = (char *) _totFileData + + _vm->_global->_inter_execPtr = _totFileData + _collisionAreas[_lastCollAreaIndex].funcEnter; _vm->_inter->funcBlock(0); @@ -588,9 +587,9 @@ void Game_v1::prepareStart(void) { void Game_v1::collisionsBlock(void) { InputDesc descArray[20]; int16 array[250]; - char count; + byte count; int16 collResId; - char *startIP; + byte *startIP; int16 curCmd; int16 cmd; int16 cmdHigh; @@ -617,7 +616,7 @@ void Game_v1::collisionsBlock(void) { int16 collStackPos; Collision *collPtr; int16 timeKey; - char *savedIP; + byte *savedIP; if (_shouldPushColls) pushCollisions(1); @@ -626,10 +625,10 @@ void Game_v1::collisionsBlock(void) { _vm->_global->_inter_execPtr++; count = *_vm->_global->_inter_execPtr++; _handleMouse = _vm->_global->_inter_execPtr[0]; - deltaTime = 1000 * (byte) _vm->_global->_inter_execPtr[1]; - descIndex2 = (byte) _vm->_global->_inter_execPtr[2]; - stackPos2 = (byte) _vm->_global->_inter_execPtr[3]; - descIndex = (byte) _vm->_global->_inter_execPtr[4]; + deltaTime = 1000 * _vm->_global->_inter_execPtr[1]; + descIndex2 = _vm->_global->_inter_execPtr[2]; + stackPos2 = _vm->_global->_inter_execPtr[3]; + descIndex = _vm->_global->_inter_execPtr[4]; if ((stackPos2 != 0) || (descIndex != 0)) deltaTime /= 100; @@ -649,7 +648,7 @@ void Game_v1::collisionsBlock(void) { if ((cmd & 0x40) != 0) { cmd -= 0x40; - cmdHigh = (byte) *_vm->_global->_inter_execPtr; + cmdHigh = *_vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr++; cmdHigh <<= 8; } else @@ -701,7 +700,7 @@ void Game_v1::collisionsBlock(void) { addNewCollision(curCmd + 0x8000, left, top, left + width * _vm->_draw->_fonts[descArray[index].fontIndex]->itemWidth - 1, top + height - 1, cmd, key, 0, - _vm->_global->_inter_execPtr - (char *) _totFileData); + _vm->_global->_inter_execPtr - _totFileData); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -722,7 +721,7 @@ void Game_v1::collisionsBlock(void) { addNewCollision(curCmd + 0x8000, left, top, left + width - 1, top + height - 1, (flags << 4) + cmdHigh + 2, key, - _vm->_global->_inter_execPtr - (char *) _totFileData, 0); + _vm->_global->_inter_execPtr - _totFileData, 0); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -742,7 +741,7 @@ void Game_v1::collisionsBlock(void) { left + width - 1, top + height - 1, (flags << 4) + cmdHigh + 2, key, 0, - _vm->_global->_inter_execPtr - (char *) _totFileData); + _vm->_global->_inter_execPtr - _totFileData); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -760,8 +759,8 @@ void Game_v1::collisionsBlock(void) { addNewCollision(curCmd + 0x8000, left, top, left + width - 1, top + height - 1, cmd + cmdHigh, key, - startIP - (char *) _totFileData, - _vm->_global->_inter_execPtr - (char *) _totFileData); + startIP - _totFileData, + _vm->_global->_inter_execPtr - _totFileData); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -783,8 +782,8 @@ void Game_v1::collisionsBlock(void) { addNewCollision(curCmd + 0x8000, left, top, left + width - 1, top + height - 1, (flags << 4) + cmd + cmdHigh, key, - startIP - (char *) _totFileData, - _vm->_global->_inter_execPtr - (char *) _totFileData); + startIP - _totFileData, + _vm->_global->_inter_execPtr - _totFileData); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -899,7 +898,7 @@ void Game_v1::collisionsBlock(void) { timeKey = _vm->_util->getTimeKey(); savedIP = _vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr = - (char *) _totFileData + collPtr->funcLeave; + _totFileData + collPtr->funcLeave; _shouldPushColls = 1; savedCollStackSize = _collStackSize; _vm->_inter->funcBlock(0); @@ -988,7 +987,7 @@ void Game_v1::collisionsBlock(void) { if (_collisionAreas[_activeCollIndex].funcEnter != 0) { savedIP = _vm->_global->_inter_execPtr; - _vm->_global->_inter_execPtr = (char *) _totFileData + + _vm->_global->_inter_execPtr = _totFileData + _collisionAreas[_activeCollIndex].funcEnter; _shouldPushColls = 1; @@ -1035,7 +1034,7 @@ void Game_v1::collisionsBlock(void) { if (((_collisionAreas[i].flags & 0x0F) >= 5) && ((_collisionAreas[i].flags & 0x0F) <= 8)) { - str = descArray[var_24].ptr; + str = (char *) descArray[var_24].ptr; strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); @@ -1074,7 +1073,7 @@ void Game_v1::collisionsBlock(void) { savedIP = 0; if (!_vm->_inter->_terminate) { - savedIP = (char *) _totFileData + + savedIP = _totFileData + _collisionAreas[_activeCollIndex].funcLeave; WRITE_VAR(2, _vm->_global->_inter_mouseX); diff --git a/engines/gob/game_v2.cpp b/engines/gob/game_v2.cpp index 8eb9258a31..041292f499 100644 --- a/engines/gob/game_v2.cpp +++ b/engines/gob/game_v2.cpp @@ -55,8 +55,8 @@ void Game_v2::playTot(int16 skipPlay) { int16 nestLevel; int32 variablesCount; int32 totSize; - char *filePtr; - char *savedIP; + byte *filePtr; + byte *savedIP; bool totTextLoc; oldNestLevel = _vm->_inter->_nestLevel; @@ -71,7 +71,7 @@ void Game_v2::playTot(int16 skipPlay) { if (skipPlay <= 0) { while (!_vm->_quitRequested) { - if (_vm->_global->_inter_variables != 0) + if (_vm->_global->_inter_variables) _vm->_draw->animateCursor(4); if (skipPlay != -1) { @@ -126,7 +126,7 @@ void Game_v2::playTot(int16 skipPlay) { debugC(4, kDebugFileIO, "IMA: %s", _curImaFile); debugC(4, kDebugFileIO, "EXT: %s", _curExtFile); - filePtr = (char *) _totFileData + 0x30; + filePtr = _totFileData + 0x30; _totTextData = 0; totTextLoc = false; @@ -137,13 +137,13 @@ void Game_v2::playTot(int16 skipPlay) { totTextLoc = true; } else { _totTextData->dataPtr = - (_totFileData + READ_LE_UINT32((char *) _totFileData + 0x30)); + (_totFileData + READ_LE_UINT32(_totFileData + 0x30)); _vm->_global->_language = _vm->_global->_languageWanted; } _totTextData->items = 0; if (_totTextData->dataPtr != 0) { - Common::MemoryReadStream totTextData((byte *) _totTextData->dataPtr, + Common::MemoryReadStream totTextData(_totTextData->dataPtr, 4294967295U); _totTextData->itemsCount = totTextData.readSint16LE(); @@ -155,14 +155,14 @@ void Game_v2::playTot(int16 skipPlay) { } } - filePtr = (char *) _totFileData + 0x34; + filePtr = _totFileData + 0x34; _totResourceTable = 0; int32 resSize; if (READ_LE_UINT32(filePtr) != (uint32) -1) { _totResourceTable = new TotResTable; _totResourceTable->dataPtr = - _totFileData + READ_LE_UINT32((char *) _totFileData + 0x34); - Common::MemoryReadStream totResTable((byte *) _totResourceTable->dataPtr, + _totFileData + READ_LE_UINT32(_totFileData + 0x34); + Common::MemoryReadStream totResTable(_totResourceTable->dataPtr, 4294967295U); _totResourceTable->itemsCount = totResTable.readSint16LE(); @@ -197,17 +197,17 @@ void Game_v2::playTot(int16 skipPlay) { loadExtTable(); _vm->_global->_inter_animDataSize = - READ_LE_UINT16((char *) _totFileData + 0x38); - if (_vm->_global->_inter_variables == 0) { - variablesCount = READ_LE_UINT16((char *) _totFileData + 0x2C); - _vm->_global->_inter_variables = new char[variablesCount * 4]; + READ_LE_UINT16(_totFileData + 0x38); + if (!_vm->_global->_inter_variables) { + variablesCount = READ_LE_UINT16(_totFileData + 0x2C); + _vm->_global->_inter_variables = new byte[variablesCount * 4]; _vm->_global->_inter_variablesSizes = new byte[variablesCount * 4]; _vm->_global->clearVars(variablesCount); } - _vm->_global->_inter_execPtr = (char *) _totFileData; + _vm->_global->_inter_execPtr = _totFileData; _vm->_global->_inter_execPtr += - READ_LE_UINT32((char *) _totFileData + 0x64); + READ_LE_UINT16(_totFileData + 0x64); _vm->_inter->renewTimeInVars(); @@ -221,7 +221,6 @@ void Game_v2::playTot(int16 skipPlay) { if (_totToLoad[0] != 0) _vm->_inter->_terminate = 0; - variablesCount = READ_LE_UINT32((char *) _totFileData + 0x2C); _vm->_draw->blitInvalidated(); delete[] _totFileData; _totFileData = 0; @@ -275,7 +274,7 @@ void Game_v2::playTot(int16 skipPlay) { } else { _vm->_inter->initControlVars(0); _vm->_scenery->_pCaptureCounter = oldCaptureCounter; - _vm->_global->_inter_execPtr = (char *) _totFileData; + _vm->_global->_inter_execPtr = _totFileData; _vm->_global->_inter_execPtr += READ_LE_UINT16(_totFileData + (skipPlay << 1) + 0x66); _vm->_inter->callSub(2); @@ -395,7 +394,7 @@ void Game_v2::popCollisions(void) { delete[] _collStack[_collStackSize]; } -int16 Game_v2::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId, +int16 Game_v2::checkCollisions(byte handleMouse, int16 deltaTime, int16 *pResId, int16 *pResIndex) { int16 resIndex; int16 key; @@ -588,7 +587,7 @@ void Game_v2::collisionsBlock(void) { int16 array[250]; byte count; int16 collResId; - char *startIP; + byte *startIP; int16 curCmd; int16 cmd; int16 cmdHigh; @@ -616,7 +615,7 @@ void Game_v2::collisionsBlock(void) { Collision *collPtr; Collision *collArea; int16 timeKey; - char *savedIP; + byte *savedIP; if (_shouldPushColls) pushCollisions(0); @@ -632,9 +631,9 @@ void Game_v2::collisionsBlock(void) { count = *_vm->_global->_inter_execPtr++; _handleMouse = _vm->_global->_inter_execPtr[0]; - deltaTime = 1000 * (byte) _vm->_global->_inter_execPtr[1]; - stackPos2 = (byte) _vm->_global->_inter_execPtr[3]; - descIndex = (byte) _vm->_global->_inter_execPtr[4]; + deltaTime = 1000 * _vm->_global->_inter_execPtr[1]; + stackPos2 = _vm->_global->_inter_execPtr[3]; + descIndex = _vm->_global->_inter_execPtr[4]; if ((stackPos2 != 0) || (descIndex != 0)) deltaTime /= 100; @@ -651,18 +650,18 @@ void Game_v2::collisionsBlock(void) { for (curCmd = 0; curCmd < count; curCmd++) { array[curCmd] = 0; - cmd = (byte) *_vm->_global->_inter_execPtr++; + cmd = *_vm->_global->_inter_execPtr++; if ((cmd & 0x40) != 0) { cmd -= 0x40; - cmdHigh = (byte) *_vm->_global->_inter_execPtr; + cmdHigh = *_vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr++; cmdHigh <<= 8; } else cmdHigh = 0; if ((cmd & 0x80) != 0) { - offsetIP = _vm->_global->_inter_execPtr - (char *) _totFileData; + offsetIP = _vm->_global->_inter_execPtr - _totFileData; left = _vm->_parse->parseValExpr(); top = _vm->_parse->parseValExpr(); width = _vm->_parse->parseValExpr(); @@ -704,8 +703,8 @@ void Game_v2::collisionsBlock(void) { collId = addNewCollision(curCmd + 0x8000, left, top, left + width - 1, top + height - 1, - cmd + cmdHigh, key, startIP - (char *) _totFileData, - _vm->_global->_inter_execPtr - (char *) _totFileData); + cmd + cmdHigh, key, startIP - _totFileData, + _vm->_global->_inter_execPtr - _totFileData); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -729,8 +728,8 @@ void Game_v2::collisionsBlock(void) { collId = addNewCollision(curCmd + 0x8000, left, top, left + width - 1, top + height - 1, - (flags << 4) + cmd + cmdHigh, key, startIP - (char *) _totFileData, - _vm->_global->_inter_execPtr - (char *) _totFileData); + (flags << 4) + cmd + cmdHigh, key, startIP - _totFileData, + _vm->_global->_inter_execPtr - _totFileData); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -774,7 +773,7 @@ void Game_v2::collisionsBlock(void) { addNewCollision(curCmd + 0x8000, left, top, left + width * _vm->_draw->_fonts[descArray[index].fontIndex]-> itemWidth - 1, top + height - 1, cmd, key, 0, - _vm->_global->_inter_execPtr - (char *) _totFileData); + _vm->_global->_inter_execPtr - _totFileData); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -793,9 +792,9 @@ void Game_v2::collisionsBlock(void) { if ((_collisionAreas[i].id & 0xF000) == 0xE000) { _collisionAreas[i].id &= 0xBFFF; _collisionAreas[i].funcEnter = - _vm->_global->_inter_execPtr - (char *) _totFileData; + _vm->_global->_inter_execPtr - _totFileData; _collisionAreas[i].funcLeave = - _vm->_global->_inter_execPtr - (char *) _totFileData; + _vm->_global->_inter_execPtr - _totFileData; } } _vm->_global->_inter_execPtr += 2; @@ -809,9 +808,9 @@ void Game_v2::collisionsBlock(void) { if ((_collisionAreas[i].id & 0xF000) == 0xD000) { _collisionAreas[i].id &= 0xBFFF; _collisionAreas[i].funcEnter = - _vm->_global->_inter_execPtr - (char *) _totFileData; + _vm->_global->_inter_execPtr - _totFileData; _collisionAreas[i].funcLeave = - _vm->_global->_inter_execPtr - (char *) _totFileData; + _vm->_global->_inter_execPtr - _totFileData; } } _vm->_global->_inter_execPtr += 2; @@ -831,7 +830,7 @@ void Game_v2::collisionsBlock(void) { collId = addNewCollision(curCmd + 0x8000, left, top, left + width - 1, top + height - 1, (flags << 4) + cmdHigh + 2, key, 0, - _vm->_global->_inter_execPtr - (char *) _totFileData); + _vm->_global->_inter_execPtr - _totFileData); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -848,7 +847,7 @@ void Game_v2::collisionsBlock(void) { collId = addNewCollision(curCmd + 0x8000, left, top, left + width - 1, top + height - 1, (flags << 4) + cmdHigh + 2, key, - _vm->_global->_inter_execPtr - (char *) _totFileData, 0); + _vm->_global->_inter_execPtr - _totFileData, 0); _vm->_global->_inter_execPtr += 2; _vm->_global->_inter_execPtr += @@ -1063,7 +1062,7 @@ void Game_v2::collisionsBlock(void) { if (((_collisionAreas[i].flags & 0x0F) >= 5) && ((_collisionAreas[i].flags & 0x0F) <= 8)) { - str = descArray[var_24].ptr; + str = (char *) descArray[var_24].ptr; strncpy0(_tempStr, GET_VARO_STR(_collisionAreas[i].key), 255); @@ -1105,7 +1104,7 @@ void Game_v2::collisionsBlock(void) { savedIP = 0; if (!_vm->_inter->_terminate) { - savedIP = (char *) _totFileData + + savedIP = _totFileData + _collisionAreas[_activeCollIndex].funcLeave; _vm->_inter->storeMouse(); @@ -1136,7 +1135,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, int16 key; int16 found = -1; int16 i; - void *fontExtraBak; + byte *fontExtraBak; int16 needAdjust; descInd = 0; @@ -1330,7 +1329,7 @@ int16 Game_v2::multiEdit(int16 time, int16 index, int16 *pCurPos, int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor, int16 frontColor, char *str, int16 fontIndex, char inpType, int16 *pTotTime, int16 *collResId, int16 *collIndex) { - int16 handleMouse; + byte handleMouse; uint32 editSize; Video::FontDesc *pFont; char curSym; @@ -1341,7 +1340,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, uint32 pos; int16 flag; int16 savedKey; - void *fontExtraBak; + byte *fontExtraBak; int16 needAdjust; if ((_handleMouse != 0) && @@ -1391,7 +1390,7 @@ int16 Game_v2::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, flag = 1; - if (_vm->_global->_inter_variables != 0) + if (_vm->_global->_inter_variables) WRITE_VAR(56, pos); while (1) { diff --git a/engines/gob/global.h b/engines/gob/global.h index 10f2d40707..2180acb82f 100644 --- a/engines/gob/global.h +++ b/engines/gob/global.h @@ -118,8 +118,8 @@ public: int32 _inter_resVal; byte *_inter_variablesSizes; // 0: single byte, 1: two bytes, 3: four bytes - char *_inter_variables; - char *_inter_execPtr; + byte *_inter_variables; + byte *_inter_execPtr; int16 _inter_animDataSize; int16 _inter_mouseX; @@ -171,7 +171,7 @@ public: } void writeVar(uint32 offset, const char *str) { writeVarSizeStr(offset, strlen(str)); - strcpy(_inter_variables + offset, str); + strcpy((char *) (_inter_variables + offset), str); } Global(GobEngine *vm); diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index ae0bbf0722..42c7f51b02 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -186,8 +186,8 @@ void GobEngine::saveGameData(enum SaveFiles sFile, int16 dataVar, int32 size, in int16 index; bool writePal; char *sName; - char *buf; - char *oBuf; + byte *buf; + byte *oBuf; int32 retSize; int32 iSize; int32 oSize; @@ -266,7 +266,7 @@ void GobEngine::saveGameData(enum SaveFiles sFile, int16 dataVar, int32 size, in oOff = offset < 0 ? MAX((int32) 0, iSize - (-offset - 1)) : offset; oSize = MAX(iSize, oOff + size); - oBuf = new char[oSize]; + oBuf = new byte[oSize]; memset(oBuf, 0, oSize); if (in) { @@ -298,7 +298,7 @@ void GobEngine::saveGameData(enum SaveFiles sFile, int16 dataVar, int32 size, in bool GobEngine::saveGame(int saveSlot, int16 dataVar, int32 size, int32 offset) { int32 varSize; - char *varBuf; + byte *varBuf; byte *sizeBuf; Common::OutSaveFile *out; @@ -330,13 +330,13 @@ bool GobEngine::saveGame(int saveSlot, int16 dataVar, int32 size, int32 offset) } } -uint32 GobEngine::writeDataEndian(Common::OutSaveFile &out, char *varBuf, byte *sizeBuf, +uint32 GobEngine::writeDataEndian(Common::OutSaveFile &out, byte *varBuf, byte *sizeBuf, int32 size) { #ifndef GOB_ORIGSAVES int i; - char tmp[4]; + byte tmp[4]; uint32 written; written = 0; @@ -372,7 +372,7 @@ void GobEngine::loadGameData(enum SaveFiles sFile, int16 dataVar, int32 size, in int32 sSize; int32 retSize; int16 index; - char *buf; + byte *buf; char *sName; bool readPal; SurfaceDesc *destDesc; @@ -473,7 +473,7 @@ void GobEngine::loadGameData(enum SaveFiles sFile, int16 dataVar, int32 size, in bool GobEngine::loadGame(int saveSlot, int16 dataVar, int32 size, int32 offset) { int i; int32 varSize; - char *varBuf; + byte *varBuf; byte *sizeBuf; Common::InSaveFile *in; @@ -509,18 +509,18 @@ bool GobEngine::loadGame(int saveSlot, int16 dataVar, int32 size, int32 offset) } } -uint32 GobEngine::readDataEndian(Common::InSaveFile &in, char *varBuf, byte *sizeBuf, +uint32 GobEngine::readDataEndian(Common::InSaveFile &in, byte *varBuf, byte *sizeBuf, int32 size) { #ifndef GOB_ORIGSAVES uint32 read; - char *vars; - char *sizes; + byte *vars; + byte *sizes; int i; - vars = new char[size]; - sizes = new char[size]; + vars = new byte[size]; + sizes = new byte[size]; read = in.read(vars, size); if (in.read(sizes, size) != read) { diff --git a/engines/gob/gob.h b/engines/gob/gob.h index 222b6a84f2..c74b7632ef 100644 --- a/engines/gob/gob.h +++ b/engines/gob/gob.h @@ -165,7 +165,7 @@ class GobEngine : public Engine { protected: char **_saveFiles; char *_saveSlotFile; - char _saveIndex[600]; + byte _saveIndex[600]; byte _saveIndexSizes[600]; GobEngine *_vm; @@ -175,8 +175,8 @@ protected: const char *getSaveSlotFile(int slot); bool saveGame(int saveSlot, int16 dataVar, int32 size, int32 offset); bool loadGame(int saveSlot, int16 dataVar, int32 size, int32 offset); - uint32 writeDataEndian(Common::OutSaveFile &out, char *varBuf, byte *sizeBuf, int32 size); - uint32 readDataEndian(Common::InSaveFile &in, char *varBuf, byte *sizeBuf, int32 size); + uint32 writeDataEndian(Common::OutSaveFile &out, byte *varBuf, byte *sizeBuf, int32 size); + uint32 readDataEndian(Common::InSaveFile &in, byte *varBuf, byte *sizeBuf, int32 size); bool detectGame(); diff --git a/engines/gob/goblin.cpp b/engines/gob/goblin.cpp index af694c17da..61dfbaff31 100644 --- a/engines/gob/goblin.cpp +++ b/engines/gob/goblin.cpp @@ -1214,7 +1214,7 @@ void Goblin::freeAllObjects(void) { freeObjects(); } -void Goblin::loadObjects(char *source) { +void Goblin::loadObjects(const char *source) { zeroObjects(); for (int i = 0; i < 20; i++) _itemToObject[i] = 100; diff --git a/engines/gob/goblin.h b/engines/gob/goblin.h index d00de048f2..db9b74e300 100644 --- a/engines/gob/goblin.h +++ b/engines/gob/goblin.h @@ -205,7 +205,7 @@ public: void switchGoblin(int16 index); void zeroObjects(void); void freeAllObjects(void); - void loadObjects(char *source); + void loadObjects(const char *source); void initVarPointers(void); void saveGobDataToVars(int16 xPos, int16 yPos, int16 someVal); void loadGobDataFromVars(void); diff --git a/engines/gob/imd.cpp b/engines/gob/imd.cpp index e2f98bfb38..0ae2465884 100644 --- a/engines/gob/imd.cpp +++ b/engines/gob/imd.cpp @@ -140,7 +140,7 @@ ImdPlayer::Imd *ImdPlayer::loadImdFile(const char *path, SurfaceDesc *surfDesc, if (flags & 3) { imdPtr->palette = new Video::Color[256]; assert(imdPtr->palette); - _vm->_dataIO->readData(handle, (char *) imdPtr->palette, 768); + _vm->_dataIO->readData(handle, (byte *) imdPtr->palette, 768); } else _vm->_dataIO->seekData(handle, 768, SEEK_CUR); @@ -441,7 +441,7 @@ void ImdPlayer::renderFrame(Imd *imdPtr) { byte *dataPtr = 0; byte *srcPtr = 0; - dataPtr = (byte *) _frameData; + dataPtr = _frameData; imdX = imdPtr->x; imdY = imdPtr->y; imdW = imdPtr->width; @@ -459,7 +459,7 @@ void ImdPlayer::renderFrame(Imd *imdPtr) { srcPtr = dataPtr; if (type & 0x80) { // Frame data is compressed - srcPtr = (byte *) _vidBuffer; + srcPtr = _vidBuffer; type &= 0x7F; if ((type == 2) && (imdW == sW)) { frameUncompressor(imdVidMem, dataPtr); @@ -951,7 +951,7 @@ uint16 ImdPlayer::checkFrameType(Imd *imdPtr, int16 frame) { // Frame video data if (cmd != 0) { - _vm->_dataIO->readData(imdPtr->handle, (char *) _frameData, 5); + _vm->_dataIO->readData(imdPtr->handle, _frameData, 5); retVal |= _frameData[0]; } else retVal |= 0x800; @@ -1070,8 +1070,7 @@ uint32 ImdPlayer::view(Imd *imdPtr, int16 frame) { } if (_soundStage != 0) { - char *soundBuf = - (char *) (_soundBuffer + _curSoundSlice * _soundSliceSize); + byte *soundBuf = _soundBuffer + _curSoundSlice * _soundSliceSize; if (!hasNextCmd) waitEndSoundSlice(); @@ -1082,7 +1081,7 @@ uint32 ImdPlayer::view(Imd *imdPtr, int16 frame) { if (!hasNextCmd && !_noSound) { _vm->_dataIO->readData(imdPtr->handle, soundBuf, _soundSliceSize); - _vm->_snd->convToSigned((byte *) soundBuf, _soundSliceSize); + _vm->_snd->convToSigned(soundBuf, _soundSliceSize); } else _vm->_dataIO->seekData(imdPtr->handle, _soundSliceSize, SEEK_CUR); @@ -1094,8 +1093,7 @@ uint32 ImdPlayer::view(Imd *imdPtr, int16 frame) { int dataLength = _soundSliceSize * _soundSlicesCount; if (!hasNextCmd && !_noSound) { - _vm->_dataIO->readData(imdPtr->handle, - (char *) _soundBuffer, dataLength); + _vm->_dataIO->readData(imdPtr->handle, _soundBuffer, dataLength); _vm->_snd->convToSigned(_soundBuffer, dataLength); _curSoundSlice = _soundSlicesCount - 1; @@ -1120,14 +1118,13 @@ uint32 ImdPlayer::view(Imd *imdPtr, int16 frame) { retVal |= 0x10; if (imdPtr->extraPalette) { _vm->_dataIO->readData(imdPtr->handle, - (char *) imdPtr->extraPalette, 768); + (byte *) imdPtr->extraPalette, 768); _vm->_video->setPalette(imdPtr->extraPalette); } else if (imdPtr->palette) _vm->_dataIO->readData(imdPtr->handle, - (char *) imdPtr->palette, 768); + (byte *) imdPtr->palette, 768); else - _vm->_dataIO->readData(imdPtr->handle, - (char *) _frameData, 768); + _vm->_dataIO->readData(imdPtr->handle, _frameData, 768); cmd = _vm->_dataIO->readUint16(imdPtr->handle); } @@ -1151,8 +1148,7 @@ uint32 ImdPlayer::view(Imd *imdPtr, int16 frame) { retVal |= 1; cmd = _vm->_dataIO->readUint32(imdPtr->handle); - _vm->_dataIO->readData(imdPtr->handle, - (char *) _frameData, cmd + 2); + _vm->_dataIO->readData(imdPtr->handle, _frameData, cmd + 2); if (imdPtr->surfDesc) { int16 left = imdPtr->x; @@ -1186,7 +1182,7 @@ uint32 ImdPlayer::view(Imd *imdPtr, int16 frame) { // Frame video data } else if (cmd != 0) { - _vm->_dataIO->readData(imdPtr->handle, (char *) _frameData, cmd + 2); + _vm->_dataIO->readData(imdPtr->handle, _frameData, cmd + 2); if (imdPtr->surfDesc) renderFrame(imdPtr); diff --git a/engines/gob/init.cpp b/engines/gob/init.cpp index b712041254..5a024b3dd8 100644 --- a/engines/gob/init.cpp +++ b/engines/gob/init.cpp @@ -53,7 +53,7 @@ void Init::cleanup(void) { _vm->_dataIO->closeDataFile(); } -void Init::initGame(char *totName) { +void Init::initGame(const char *totName) { int16 handle2; int16 handle; int16 imdHandle; @@ -108,7 +108,7 @@ void Init::initGame(char *totName) { } else { _vm->_dataIO->closeData(handle); - infPtr = _vm->_dataIO->getData("intro.inf"); + infPtr = (char *) _vm->_dataIO->getData("intro.inf"); infBuf = infPtr; infEnd = infBuf + _vm->_dataIO->getDataSize("intro.inf"); @@ -149,7 +149,7 @@ void Init::initGame(char *totName) { varsCount = _vm->_dataIO->readUint16(handle); _vm->_dataIO->closeData(handle); - _vm->_global->_inter_variables = new char[varsCount * 4]; + _vm->_global->_inter_variables = new byte[varsCount * 4]; _vm->_global->_inter_variablesSizes = new byte[varsCount * 4]; _vm->_global->clearVars(varsCount); diff --git a/engines/gob/init.h b/engines/gob/init.h index 8d37740646..3ca935c6b4 100644 --- a/engines/gob/init.h +++ b/engines/gob/init.h @@ -30,7 +30,7 @@ namespace Gob { class Init { public: - void initGame(char *totFile); + void initGame(const char *totFile); virtual void initVideo() = 0; diff --git a/engines/gob/inter.cpp b/engines/gob/inter.cpp index 128ea3f465..fccf8e70b9 100644 --- a/engines/gob/inter.cpp +++ b/engines/gob/inter.cpp @@ -226,7 +226,7 @@ void Inter::funcBlock(int16 retFlag) { } } // End of workaround - cmd = (byte) *_vm->_global->_inter_execPtr; + cmd = *_vm->_global->_inter_execPtr; if ((cmd >> 4) >= 12) { cmd2 = 16 - (cmd >> 4); cmd &= 0xF; @@ -260,7 +260,7 @@ void Inter::funcBlock(int16 retFlag) { } void Inter::callSub(int16 retFlag) { - int16 block; + byte block; while (!_vm->_quitRequested && _vm->_global->_inter_execPtr && (_vm->_global->_inter_execPtr != _vm->_game->_totFileData)) { diff --git a/engines/gob/inter.h b/engines/gob/inter.h index 414975b8be..2129a57b4b 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -65,8 +65,8 @@ public: protected: struct OpFuncParams { - char cmdCount; - int16 counter; + byte cmdCount; + byte counter; int16 retFlag; }; struct OpGobParams { @@ -98,7 +98,7 @@ protected: virtual const char *getOpcodeFuncDesc(byte i, byte j) = 0; virtual const char *getOpcodeGoblinDesc(int i) = 0; - virtual void checkSwitchTable(char **ppExec) = 0; + virtual void checkSwitchTable(byte **ppExec) = 0; void o_drawNOP() {} bool o_funcNOP(OpFuncParams ¶ms) { return false; } @@ -142,7 +142,7 @@ protected: virtual const char *getOpcodeFuncDesc(byte i, byte j); virtual const char *getOpcodeGoblinDesc(int i); - virtual void checkSwitchTable(char **ppExec); + virtual void checkSwitchTable(byte **ppExec); void o1_loadMult(); void o1_playMult(); @@ -337,7 +337,7 @@ protected: virtual const char *getOpcodeFuncDesc(byte i, byte j); virtual const char *getOpcodeGoblinDesc(int i); - virtual void checkSwitchTable(char **ppExec); + virtual void checkSwitchTable(byte **ppExec); void o2_playMult(); void o2_setRenderFlags(); diff --git a/engines/gob/inter_bargon.cpp b/engines/gob/inter_bargon.cpp index 069b93e66d..8476dfc8c6 100644 --- a/engines/gob/inter_bargon.cpp +++ b/engines/gob/inter_bargon.cpp @@ -775,7 +775,7 @@ void Inter_Bargon::oBargon_intro3(OpGobParams ¶ms) { Video::Color *palBak; SoundDesc samples[2]; int16 comp[3] = { 0, 1, -1 }; - char *palettes[4]; + byte *palettes[4]; static const char *sndFiles[] = {"1INTROIV.snd", "2INTROIV.snd"}; static const char *palFiles[] = {"2ou2.clt", "2ou3.clt", "2ou4.clt", "2ou5.clt"}; diff --git a/engines/gob/inter_v1.cpp b/engines/gob/inter_v1.cpp index 76ba0184d7..0eea277599 100644 --- a/engines/gob/inter_v1.cpp +++ b/engines/gob/inter_v1.cpp @@ -720,7 +720,7 @@ const char *Inter_v1::getOpcodeGoblinDesc(int i) { return ""; } -void Inter_v1::checkSwitchTable(char **ppExec) { +void Inter_v1::checkSwitchTable(byte **ppExec) { int16 len; int32 value; bool found; @@ -988,7 +988,7 @@ void Inter_v1::o1_animate() { void Inter_v1::o1_loadMultObject() { int16 val; int16 objIndex; - char *multData; + byte *multData; evalExpr(&objIndex); evalExpr(&val); @@ -998,7 +998,7 @@ void Inter_v1::o1_loadMultObject() { debugC(4, kDebugGameFlow, "Loading mult object %d", objIndex); - multData = (char *) _vm->_mult->_objects[objIndex].pAnimData; + multData = (byte *) _vm->_mult->_objects[objIndex].pAnimData; for (int i = 0; i < 11; i++) { if (READ_LE_UINT16(_vm->_global->_inter_execPtr) != 99) { evalExpr(&val); @@ -1119,7 +1119,7 @@ void Inter_v1::o1_freeFontToSprite() { } bool Inter_v1::o1_callSub(OpFuncParams ¶ms) { - char *storedIP; + byte *storedIP; uint32 offset; storedIP = _vm->_global->_inter_execPtr; @@ -1143,7 +1143,7 @@ bool Inter_v1::o1_callSub(OpFuncParams ¶ms) { return false; } - _vm->_global->_inter_execPtr = (char *) _vm->_game->_totFileData + offset; + _vm->_global->_inter_execPtr = _vm->_game->_totFileData + offset; if ((params.counter == params.cmdCount) && (params.retFlag == 2)) return true; @@ -1162,13 +1162,13 @@ bool Inter_v1::o1_printTotText(OpFuncParams ¶ms) { bool Inter_v1::o1_loadCursor(OpFuncParams ¶ms) { Game::TotResItem *itemPtr; int16 width, height; - char *dataBuf; + byte *dataBuf; int32 offset; int16 id; int8 index; id = load16(); - index = *_vm->_global->_inter_execPtr++; + index = (int8) *_vm->_global->_inter_execPtr++; itemPtr = &_vm->_game->_totResourceTable->items[id]; offset = itemPtr->offset; @@ -1189,7 +1189,7 @@ bool Inter_v1::o1_loadCursor(OpFuncParams ¶ms) { index * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1, _vm->_draw->_cursorHeight - 1, 0); - _vm->_video->drawPackedSprite((byte*) dataBuf, width, height, + _vm->_video->drawPackedSprite(dataBuf, width, height, index * _vm->_draw->_cursorWidth, 0, 0, _vm->_draw->_cursorSprites); _vm->_draw->_cursorAnimLow[index] = 0; @@ -1197,10 +1197,10 @@ bool Inter_v1::o1_loadCursor(OpFuncParams ¶ms) { } bool Inter_v1::o1_switch(OpFuncParams ¶ms) { - char *callAddr; + byte *callAddr; checkSwitchTable(&callAddr); - char *storedIP = _vm->_global->_inter_execPtr; + byte *storedIP = _vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr = callAddr; if ((params.counter == params.cmdCount) && (params.retFlag == 2)) @@ -1213,7 +1213,7 @@ bool Inter_v1::o1_switch(OpFuncParams ¶ms) { } bool Inter_v1::o1_repeatUntil(OpFuncParams ¶ms) { - char *blockPtr; + byte *blockPtr; int16 size; bool flag; @@ -1239,8 +1239,8 @@ bool Inter_v1::o1_repeatUntil(OpFuncParams ¶ms) { } bool Inter_v1::o1_whileDo(OpFuncParams ¶ms) { - char *blockPtr; - char *savedIP; + byte *blockPtr; + byte *savedIP; bool flag; int16 size; @@ -1280,13 +1280,14 @@ bool Inter_v1::o1_whileDo(OpFuncParams ¶ms) { bool Inter_v1::o1_if(OpFuncParams ¶ms) { byte cmd; bool boolRes; + byte *storedIP; boolRes = evalBoolResult(); if (boolRes) { if ((params.counter == params.cmdCount) && (params.retFlag == 2)) return true; - char *storedIP = _vm->_global->_inter_execPtr; + storedIP = _vm->_global->_inter_execPtr; funcBlock(0); _vm->_global->_inter_execPtr = storedIP; @@ -1296,7 +1297,7 @@ bool Inter_v1::o1_if(OpFuncParams ¶ms) { debugC(5, kDebugGameFlow, "cmd = %d", (int16) *_vm->_global->_inter_execPtr); - cmd = (byte) (*_vm->_global->_inter_execPtr) >> 4; + cmd = *_vm->_global->_inter_execPtr >> 4; _vm->_global->_inter_execPtr++; if (cmd != 12) return false; @@ -1310,7 +1311,7 @@ bool Inter_v1::o1_if(OpFuncParams ¶ms) { debugC(5, kDebugGameFlow, "cmd = %d", (int16) *_vm->_global->_inter_execPtr); - cmd = (byte) (*_vm->_global->_inter_execPtr) >> 4; + cmd = *_vm->_global->_inter_execPtr >> 4; _vm->_global->_inter_execPtr++; if (cmd != 12) return false; @@ -1318,9 +1319,10 @@ bool Inter_v1::o1_if(OpFuncParams ¶ms) { if ((params.counter == params.cmdCount) && (params.retFlag == 2)) return true; - char *storedIP = _vm->_global->_inter_execPtr; + storedIP = _vm->_global->_inter_execPtr; funcBlock(0); _vm->_global->_inter_execPtr = storedIP; + _vm->_global->_inter_execPtr += READ_LE_UINT16(_vm->_global->_inter_execPtr + 2) + 2; } @@ -1328,7 +1330,7 @@ bool Inter_v1::o1_if(OpFuncParams ¶ms) { } bool Inter_v1::o1_evaluateStore(OpFuncParams ¶ms) { - char *savedPos; + byte *savedPos; int16 token; int16 result; int16 varOff; @@ -1361,7 +1363,7 @@ bool Inter_v1::o1_loadSpriteToPos(OpFuncParams ¶ms) { _vm->_draw->_destSpriteY = _vm->_parse->parseValExpr(); _vm->_draw->_transparency = *_vm->_global->_inter_execPtr & 1; - _vm->_draw->_destSurface = (*_vm->_global->_inter_execPtr >> 1) - 1; + _vm->_draw->_destSurface = ((int16) (*_vm->_global->_inter_execPtr >> 1)) - 1; if (_vm->_draw->_destSurface < 0) _vm->_draw->_destSurface = 101; @@ -1392,13 +1394,13 @@ bool Inter_v1::o1_printText(OpFuncParams ¶ms) { } do { - for (i = 0; (*_vm->_global->_inter_execPtr != '.') && - ((byte) *_vm->_global->_inter_execPtr != 200); + for (i = 0; (((char) *_vm->_global->_inter_execPtr) != '.') && + (*_vm->_global->_inter_execPtr != 200); i++, _vm->_global->_inter_execPtr++) { - buf[i] = *_vm->_global->_inter_execPtr; + buf[i] = (char) *_vm->_global->_inter_execPtr; } - if ((byte) *_vm->_global->_inter_execPtr != 200) { + if (*_vm->_global->_inter_execPtr != 200) { _vm->_global->_inter_execPtr++; switch (*_vm->_global->_inter_execPtr) { case 23: @@ -1418,7 +1420,7 @@ bool Inter_v1::o1_printText(OpFuncParams ¶ms) { buf[i] = 0; _vm->_draw->spriteOperation(DRAW_PRINTTEXT); - } while ((byte) *_vm->_global->_inter_execPtr != 200); + } while (*_vm->_global->_inter_execPtr != 200); _vm->_global->_inter_execPtr++; @@ -1434,7 +1436,7 @@ bool Inter_v1::o1_loadTot(OpFuncParams ¶ms) { evalExpr(0); strncpy0(buf, _vm->_global->_inter_resStr, 15); } else { - size = *_vm->_global->_inter_execPtr++; + size = (int8) *_vm->_global->_inter_execPtr++; for (int i = 0; i < size; i++) buf[i] = *_vm->_global->_inter_execPtr++; @@ -1451,7 +1453,7 @@ bool Inter_v1::o1_loadTot(OpFuncParams ¶ms) { bool Inter_v1::o1_palLoad(OpFuncParams ¶ms) { int index1, index2; - char *palPtr; + byte *palPtr; byte cmd; cmd = *_vm->_global->_inter_execPtr++; diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index 0998d3de31..8ede483f45 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -722,7 +722,7 @@ const char *Inter_v2::getOpcodeGoblinDesc(int i) { return ""; } -void Inter_v2::checkSwitchTable(char **ppExec) { +void Inter_v2::checkSwitchTable(byte **ppExec) { byte cmd; int16 len; int32 value; @@ -796,7 +796,7 @@ void Inter_v2::checkSwitchTable(char **ppExec) { } } - if (found && (*ppExec == 0)) + if (found && !*ppExec) *ppExec = _vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr += @@ -808,7 +808,7 @@ void Inter_v2::checkSwitchTable(char **ppExec) { return; _vm->_global->_inter_execPtr++; - if (*ppExec == 0) + if (!*ppExec) *ppExec = _vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr += @@ -958,7 +958,7 @@ void Inter_v2::o2_loadMultObject() { int16 objIndex; int16 animation; int16 layer; - char *multData; + byte *multData; objIndex = _vm->_parse->parseValExpr(); val = _vm->_parse->parseValExpr(); @@ -968,7 +968,7 @@ void Inter_v2::o2_loadMultObject() { debugC(4, kDebugGameFlow, "Loading mult object %d", objIndex); - multData = (char *) _vm->_mult->_objects[objIndex].pAnimData; + multData = (byte *) _vm->_mult->_objects[objIndex].pAnimData; for (int i = 0; i < 11; i++) { if (*_vm->_global->_inter_execPtr != 99) multData[i] = _vm->_parse->parseValExpr(); @@ -1125,7 +1125,7 @@ void Inter_v2::o2_totSub() { strcpy(totFile, _vm->_global->_inter_resStr); } else { for (i = 0; i < length; i++) - totFile[i] = *_vm->_global->_inter_execPtr++; + totFile[i] = (char) *_vm->_global->_inter_execPtr++; totFile[i] = 0; } @@ -1133,7 +1133,7 @@ void Inter_v2::o2_totSub() { if (!scumm_stricmp(totFile, "edit")) _vm->_util->forceMouseUp(); - flags = (byte) *_vm->_global->_inter_execPtr++; + flags = *_vm->_global->_inter_execPtr++; _vm->_game->totSub(flags, totFile); } @@ -1571,7 +1571,7 @@ void Inter_v2::o2_resetImdFrontSurf() { } bool Inter_v2::o2_evaluateStore(OpFuncParams ¶ms) { - char *savedPos; + byte *savedPos; int16 varOff; int16 token; int16 result; @@ -1642,13 +1642,13 @@ bool Inter_v2::o2_printText(OpFuncParams ¶ms) { } do { - for (i = 0; (*_vm->_global->_inter_execPtr != '.') && - ((byte) *_vm->_global->_inter_execPtr != 200); + for (i = 0; (((char) *_vm->_global->_inter_execPtr) != '.') && + (*_vm->_global->_inter_execPtr != 200); i++, _vm->_global->_inter_execPtr++) { - buf[i] = *_vm->_global->_inter_execPtr; + buf[i] = (char) *_vm->_global->_inter_execPtr; } - if ((byte) *_vm->_global->_inter_execPtr != 200) { + if (*_vm->_global->_inter_execPtr != 200) { _vm->_global->_inter_execPtr++; switch (*_vm->_global->_inter_execPtr) { case 16: @@ -1681,7 +1681,7 @@ bool Inter_v2::o2_printText(OpFuncParams ¶ms) { buf[i] = 0; _vm->_draw->spriteOperation(DRAW_PRINTTEXT); - } while ((byte) *_vm->_global->_inter_execPtr != 200); + } while (*_vm->_global->_inter_execPtr != 200); _vm->_global->_inter_execPtr++; @@ -1816,7 +1816,7 @@ bool Inter_v2::o2_readData(OpFuncParams ¶ms) { int32 offset; int16 dataVar; int16 handle; - char *buf; + byte *buf; evalExpr(0); dataVar = _vm->_parse->parseVarIndex(); @@ -1824,6 +1824,9 @@ bool Inter_v2::o2_readData(OpFuncParams ¶ms) { evalExpr(0); offset = _vm->_global->_inter_resVal; + debugC(2, kDebugFileIO, "Read from file \"%s\" (%d, %d bytes at %d)", + _vm->_global->_inter_resStr, dataVar, size, offset); + if (!scumm_stricmp(_vm->_global->_inter_resStr, "cat.inf")) { _vm->loadGameData(SAVE_CAT, dataVar, size, offset); return false; @@ -1897,6 +1900,9 @@ bool Inter_v2::o2_writeData(OpFuncParams ¶ms) { evalExpr(0); offset = _vm->_global->_inter_resVal; + debugC(2, kDebugFileIO, "Write to file \"%s\" (%d, %d bytes at %d)", + _vm->_global->_inter_resStr, dataVar, size, offset); + if (!scumm_stricmp(_vm->_global->_inter_resStr, "cat.inf")) _vm->saveGameData(SAVE_CAT, dataVar, size, offset); else if (!scumm_stricmp(_vm->_global->_inter_resStr, "cat.cat")) @@ -2010,12 +2016,20 @@ int16 Inter_v2::loadSound(int16 search) { } else { id = load16(); - for (slot = 0; slot < 60; slot++) + for (slot = 0; slot < 60; slot++) { if (_vm->_game->_soundSamples[slot].isId(id)) return slot | 0x8000; + } - for (slot = 59; slot >= 0; slot--) - if (_vm->_game->_soundSamples[slot].empty()) break; + for (slot = 59; slot >= 0; slot--) { + if (_vm->_game->_soundSamples[slot].empty()) + break; + } + + if (slot == -1) { + warning("Inter_v2::loadSound(): No free slot to load sound (id = %d)", id); + return 0; + } } _vm->_game->freeSoundSlot(slot); @@ -2026,7 +2040,7 @@ int16 Inter_v2::loadSound(int16 search) { source = SOUND_FILE; - strncpy0(sndfile, _vm->_global->_inter_execPtr, 9); + strncpy0(sndfile, (const char *) _vm->_global->_inter_execPtr, 9); _vm->_global->_inter_execPtr += 9; if (type == SOUND_ADL) diff --git a/engines/gob/map.h b/engines/gob/map.h index e9ecb8dd52..5dc0dbe626 100644 --- a/engines/gob/map.h +++ b/engines/gob/map.h @@ -100,7 +100,7 @@ public: virtual int8 getPass(int x, int y, int heightOff = -1) = 0; virtual void setPass(int x, int y, int8 pass, int heightOff = -1) = 0; - virtual void loadMapObjects(char *avjFile) = 0; + virtual void loadMapObjects(const char *avjFile) = 0; virtual void findNearestToGob(Mult::Mult_Object *obj) = 0; virtual void findNearestToDest(Mult::Mult_Object *obj) = 0; virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y) = 0; @@ -119,7 +119,7 @@ protected: class Map_v1 : public Map { public: - virtual void loadMapObjects(char *avjFile); + virtual void loadMapObjects(const char *avjFile); virtual void findNearestToGob(Mult::Mult_Object *obj); virtual void findNearestToDest(Mult::Mult_Object *obj); virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y); @@ -145,7 +145,7 @@ protected: class Map_v2 : public Map_v1 { public: - virtual void loadMapObjects(char *avjFile); + virtual void loadMapObjects(const char *avjFile); virtual void findNearestToGob(Mult::Mult_Object *obj); virtual void findNearestToDest(Mult::Mult_Object *obj); virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y); diff --git a/engines/gob/map_v1.cpp b/engines/gob/map_v1.cpp index 5f2edbb613..ffed717614 100644 --- a/engines/gob/map_v1.cpp +++ b/engines/gob/map_v1.cpp @@ -57,9 +57,9 @@ void Map_v1::init(void) { memset(_wayPoints, 0, sizeof(Point)); } -void Map_v1::loadMapObjects(char *avjFile) { +void Map_v1::loadMapObjects(const char *avjFile) { char avoName[128]; - char *dataBuf; + byte *dataBuf; int16 handle; int16 tmp; int32 flag; @@ -80,7 +80,7 @@ void Map_v1::loadMapObjects(char *avjFile) { _loadFromAvo = false; dataBuf = _vm->_dataIO->getData(avjFile); } - Common::MemoryReadStream mapData((byte *) dataBuf, 4294967295U); + Common::MemoryReadStream mapData(dataBuf, 4294967295U); if (_loadFromAvo) { mapData.read(_passMap, _mapHeight * _mapWidth); @@ -111,11 +111,11 @@ void Map_v1::loadMapObjects(char *avjFile) { objDataCount = mapData.readUint16LE(); gobsPos = mapData.pos(); - Common::MemoryReadStream gobsData((byte *) dataBuf + gobsPos, 4294967295U); + Common::MemoryReadStream gobsData(dataBuf + gobsPos, 4294967295U); mapData.skip(gobDataCount * 8); objsPos = mapData.pos(); - Common::MemoryReadStream objsData((byte *) dataBuf + objsPos, 4294967295U); + Common::MemoryReadStream objsData(dataBuf + objsPos, 4294967295U); mapData.skip(objDataCount * 8); loadGoblins(mapData, gobsPos); diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp index 09842b6e5c..2240d7799e 100644 --- a/engines/gob/map_v2.cpp +++ b/engines/gob/map_v2.cpp @@ -45,14 +45,14 @@ Map_v2::~Map_v2() { void Map_v2::init(void) { } -void Map_v2::loadMapObjects(char *avjFile) { +void Map_v2::loadMapObjects(const char *avjFile) { uint8 wayPointsCount; int16 var; int16 id; int16 mapWidth, mapHeight; int16 tmp; - char *variables; - char *extData; + byte *variables; + byte *extData; uint32 tmpPos; uint32 passPos; @@ -67,7 +67,7 @@ void Map_v2::loadMapObjects(char *avjFile) { } extData = _vm->_game->loadExtData(id, 0, 0); - Common::MemoryReadStream mapData((byte *) extData, 4294967295U); + Common::MemoryReadStream mapData(extData, 4294967295U); if (mapData.readByte() == 3) { _screenWidth = 640; @@ -114,7 +114,7 @@ void Map_v2::loadMapObjects(char *avjFile) { mapHeight = 200 / _tilesHeight; mapWidth = _screenWidth / _tilesWidth; sizes = _vm->_global->_inter_variablesSizes + - (((char *) _passMap) - _vm->_global->_inter_variables); + (((byte *) _passMap) - _vm->_global->_inter_variables); for (int i = 0; i < mapHeight; i++) { for (int j = 0; j < mapWidth; j++) setPass(j, i, mapData.readSByte()); diff --git a/engines/gob/mult.cpp b/engines/gob/mult.cpp index 73b2bbd843..d0b2a6589c 100644 --- a/engines/gob/mult.cpp +++ b/engines/gob/mult.cpp @@ -226,7 +226,7 @@ void Mult::playMult(int16 startFrame, int16 endFrame, char checkEscape, } void Mult::drawText(bool &stop, bool &stopNoClear) { - char *savedIP; + byte *savedIP; int16 cmd; for (_index = 0; _index < _multData->textKeysCount; _index++) { @@ -270,8 +270,8 @@ void Mult::prepPalAnim(bool &stop) { _multData->palAnimIndices[2] = 0; _multData->palAnimIndices[3] = 0; - memcpy((char *)_palAnimPalette, - (char *)_vm->_global->_pPaletteDesc->vgaPal, 768); + memcpy((char *) _palAnimPalette, + (char *) _vm->_global->_pPaletteDesc->vgaPal, 768); _vm->_global->_pPaletteDesc->vgaPal = _palAnimPalette; } } diff --git a/engines/gob/mult.h b/engines/gob/mult.h index aad9aa0e52..7f318e8a7f 100644 --- a/engines/gob/mult.h +++ b/engines/gob/mult.h @@ -121,7 +121,7 @@ public: int16 frame; int16 cmd; char unknown[18]; - char script[6]; + byte script[6]; }; struct Mult_PalKey { @@ -209,7 +209,7 @@ public: int16 imdIndices[4]; char *imdFiles; char *somepointer10; // ? - char *execPtr; + byte *execPtr; }; #include "common/pack-end.h" // END STRUCT PACKING @@ -326,7 +326,7 @@ protected: virtual void newCycleAnim(Mult_Object &animObj); void loadImds(Common::SeekableReadStream &data); - void playImd(char *imdFile, Mult_ImdKey &key, int16 dir, int16 startFrame); + void playImd(const char *imdFile, Mult_ImdKey &key, int16 dir, int16 startFrame); void advanceObjects(int16 index); void advanceAllObjects(); diff --git a/engines/gob/mult_v2.cpp b/engines/gob/mult_v2.cpp index e460ac8641..8b7f448be3 100644 --- a/engines/gob/mult_v2.cpp +++ b/engines/gob/mult_v2.cpp @@ -64,6 +64,7 @@ void Mult_v2::loadMult(int16 resId) { bool hasImds; index = (resId & 0x8000) ? *_vm->_global->_inter_execPtr++ : 0; + resId &= 0x7FFF; debugC(4, kDebugGameFlow, "Loading mult %d", index); @@ -997,7 +998,7 @@ void Mult_v2::animate() { } -void Mult_v2::playImd(char *imdFile, Mult::Mult_ImdKey &key, int16 dir, +void Mult_v2::playImd(const char *imdFile, Mult::Mult_ImdKey &key, int16 dir, int16 startFrame) { int16 x, y; int16 palStart, palEnd; diff --git a/engines/gob/parse.cpp b/engines/gob/parse.cpp index 8c095b56a7..90b10f2aa6 100644 --- a/engines/gob/parse.cpp +++ b/engines/gob/parse.cpp @@ -35,7 +35,7 @@ namespace Gob { Parse::Parse(GobEngine *vm) : _vm(vm) { } -int32 Parse::encodePtr(char *ptr, int type) { +int32 Parse::encodePtr(byte *ptr, int type) { int32 offset = 0; switch (type) { @@ -46,7 +46,7 @@ int32 Parse::encodePtr(char *ptr, int type) { offset = ptr - _vm->_global->_inter_variables; break; case kResStr: - offset = ptr - _vm->_global->_inter_resStr; + offset = ptr - ((byte *) _vm->_global->_inter_resStr); break; default: error("encodePtr: Unknown pointer type"); @@ -55,8 +55,8 @@ int32 Parse::encodePtr(char *ptr, int type) { return (type << 28) | offset; } -char *Parse::decodePtr(int32 n) { - char *ptr; +byte *Parse::decodePtr(int32 n) { + byte *ptr; switch (n >> 28) { case kExecPtr: @@ -66,7 +66,7 @@ char *Parse::decodePtr(int32 n) { ptr = _vm->_global->_inter_variables; break; case kResStr: - ptr = _vm->_global->_inter_resStr; + ptr = (byte *) _vm->_global->_inter_resStr; break; default: error("decodePtr: Unknown pointer type"); @@ -76,7 +76,7 @@ char *Parse::decodePtr(int32 n) { void Parse::skipExpr(char stopToken) { int16 dimCount; - char operation; + byte operation; int16 num; int16 dim; @@ -104,7 +104,7 @@ void Parse::skipExpr(char stopToken) { case 22: _vm->_global->_inter_execPtr += - strlen(_vm->_global->_inter_execPtr) + 1; + strlen((char *) _vm->_global->_inter_execPtr) + 1; break; case 25: @@ -165,7 +165,7 @@ void Parse::printExpr(char stopToken) { // Expression printing disabled by default return; - char* savedPos = _vm->_global->_inter_execPtr; + byte *savedPos = _vm->_global->_inter_execPtr; printExpr_internal(stopToken); // restore IP to start of expression @@ -174,11 +174,11 @@ void Parse::printExpr(char stopToken) { void Parse::printExpr_internal(char stopToken) { int16 dimCount; - char operation; + byte operation; int16 num; int16 dim; - char *arrDesc; - char func; + byte *arrDesc; + byte func; num = 0; while (1) { @@ -212,7 +212,7 @@ void Parse::printExpr_internal(char stopToken) { case 22: // string immediate debugN(5, "\42%s\42", _vm->_global->_inter_execPtr); _vm->_global->_inter_execPtr += - strlen(_vm->_global->_inter_execPtr) + 1; + strlen((char *) _vm->_global->_inter_execPtr) + 1; break; case 23: // uint32 variable load @@ -243,7 +243,7 @@ void Parse::printExpr_internal(char stopToken) { _vm->_global->_inter_execPtr += dimCount; for (dim = 0; dim < dimCount; dim++) { printExpr_internal(12); - debugN(5, " of %d", (int16)arrDesc[dim]); + debugN(5, " of %d", (int16) arrDesc[dim]); if (dim != dimCount - 1) debugN(5, ","); } @@ -395,13 +395,13 @@ void Parse::printExpr_internal(char stopToken) { void Parse::printVarIndex() { - char *arrDesc; + byte *arrDesc; int16 dim; int16 dimCount; int16 operation; int16 temp; - char *pos = _vm->_global->_inter_execPtr; + byte *pos = _vm->_global->_inter_execPtr; operation = *_vm->_global->_inter_execPtr++; switch (operation) { @@ -424,7 +424,7 @@ void Parse::printVarIndex() { _vm->_global->_inter_execPtr += dimCount; for (dim = 0; dim < dimCount; dim++) { printExpr(12); - debugN(5, " of %d", (int16)arrDesc[dim]); + debugN(5, " of %d", (int16) arrDesc[dim]); if (dim != dimCount - 1) debugN(5, ","); } diff --git a/engines/gob/parse.h b/engines/gob/parse.h index 2fab96d7ad..27a6f50b1c 100644 --- a/engines/gob/parse.h +++ b/engines/gob/parse.h @@ -32,8 +32,8 @@ public: void printExpr(char stopToken); void printVarIndex(void); virtual int16 parseVarIndex(void) = 0; - virtual int16 parseValExpr(unsigned stopToken = 99) = 0; - virtual int16 parseExpr(char stopToken, byte *resultPtr) = 0; + virtual int16 parseValExpr(byte stopToken = 99) = 0; + virtual int16 parseExpr(byte stopToken, byte *resultPtr) = 0; Parse(GobEngine *vm); virtual ~Parse() {}; @@ -47,8 +47,8 @@ protected: GobEngine *_vm; - int32 encodePtr(char *ptr, int type); - char *decodePtr(int32 n); + int32 encodePtr(byte *ptr, int type); + byte *decodePtr(int32 n); void printExpr_internal(char stopToken); }; @@ -59,8 +59,8 @@ public: virtual ~Parse_v1() {}; virtual int16 parseVarIndex(void); - virtual int16 parseValExpr(unsigned stopToken = 99); - virtual int16 parseExpr(char stopToken, byte *resultPtr); + virtual int16 parseValExpr(byte stopToken = 99); + virtual int16 parseExpr(byte stopToken, byte *resultPtr); }; class Parse_v2 : public Parse_v1 { @@ -69,8 +69,8 @@ public: virtual ~Parse_v2() {}; virtual int16 parseVarIndex(void); - virtual int16 parseValExpr(unsigned stopToken = 99); - virtual int16 parseExpr(char stopToken, byte *resultPtr); + virtual int16 parseValExpr(byte stopToken = 99); + virtual int16 parseExpr(byte stopToken, byte *resultPtr); }; } // End of namespace Gob diff --git a/engines/gob/parse_v1.cpp b/engines/gob/parse_v1.cpp index 23363dfc9a..8373e94f47 100644 --- a/engines/gob/parse_v1.cpp +++ b/engines/gob/parse_v1.cpp @@ -36,7 +36,7 @@ Parse_v1::Parse_v1(GobEngine *vm) : Parse(vm) { int16 Parse_v1::parseVarIndex() { int16 temp2; - char *arrDesc; + byte *arrDesc; int16 dim; int16 dimCount; int16 operation; @@ -87,13 +87,13 @@ int16 Parse_v1::parseVarIndex() { } } -int16 Parse_v1::parseValExpr(unsigned stopToken) { +int16 Parse_v1::parseValExpr(byte stopToken) { int16 values[20]; byte operStack[20]; int16 *valPtr; byte *operPtr; byte *arrDesc; - unsigned operation; + byte operation; int16 temp2; int16 dim; int16 dimCount; @@ -147,7 +147,7 @@ int16 Parse_v1::parseValExpr(unsigned stopToken) { case 28: temp = _vm->_inter->load16(); dimCount = *_vm->_global->_inter_execPtr++; - arrDesc = (byte*) _vm->_global->_inter_execPtr; + arrDesc = _vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr += dimCount; offset = 0; for (dim = 0; dim < dimCount; dim++) { @@ -317,28 +317,28 @@ int16 Parse_v1::parseValExpr(unsigned stopToken) { } } -int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { +int16 Parse_v1::parseExpr(byte stopToken, byte *arg_2) { int32 values[20]; byte operStack[20]; int32 prevPrevVal; int32 prevVal; int32 curVal; int32 *valPtr; - char *operPtr; + byte *operPtr; byte *arrDescPtr; - char var_C; + byte var_C; byte operation; int16 dimCount; int16 temp; int16 temp2; uint16 offset; int16 dim; - char var_1A; + bool var_1A; int16 stkPos; int16 brackStart; stkPos = -1; - operPtr = (char *) (operStack - 1); + operPtr = operStack - 1; valPtr = values - 1; while (1) { @@ -363,7 +363,7 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { *operPtr = 22; *valPtr = encodePtr(_vm->_global->_inter_execPtr, kExecPtr); _vm->_global->_inter_execPtr += - strlen(_vm->_global->_inter_execPtr) + 1; + strlen((char *) _vm->_global->_inter_execPtr) + 1; break; case 23: @@ -389,7 +389,7 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { *operPtr = operation - 6; temp = _vm->_inter->load16(); dimCount = *_vm->_global->_inter_execPtr++; - arrDescPtr = (byte *) _vm->_global->_inter_execPtr; + arrDescPtr = _vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr += dimCount; offset = 0; dim = 0; @@ -474,11 +474,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { switch (operPtr[-1]) { case 2: if (operPtr[-2] == 22) { - if (decodePtr(valPtr[-2]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-2])); - valPtr[-2] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-2]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-2])); + valPtr[-2] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[0])); + strcat(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[0])); stkPos -= 2; operPtr -= 2; valPtr -= 2; @@ -519,7 +519,7 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if ((operation == stopToken) || (operation == 30) || (operation == 31) || (operation == 10)) { while (stkPos >= 2) { - var_1A = 0; + var_1A = false; if ((operPtr[-2] == 9) && ((operation == 10) || (operation == stopToken))) { operPtr[-2] = operPtr[-1]; @@ -596,12 +596,12 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if (operStack[brackStart] == 20) { values[brackStart] += valPtr[-1]; } else if (operStack[brackStart] == 22) { - if (decodePtr(values[brackStart]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(values[brackStart])); + if ((char *) decodePtr(values[brackStart]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(values[brackStart])); values[brackStart] = - encodePtr(_vm->_global->_inter_resStr, kResStr); + encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])); + strcat(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])); } stkPos -= 2; operPtr -= 2; @@ -673,11 +673,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] < valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) < 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) < 0) operPtr[-3] = 24; } stkPos -= 2; @@ -692,11 +692,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] <= valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) <= 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) <= 0) operPtr[-3] = 24; } stkPos -= 2; @@ -711,11 +711,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] > valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) > 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) > 0) operPtr[-3] = 24; } stkPos -= 2; @@ -730,11 +730,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] >= valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) >= 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) >= 0) operPtr[-3] = 24; } stkPos -= 2; @@ -749,11 +749,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] == valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) == 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) == 0) operPtr[-3] = 24; } stkPos -= 2; @@ -768,11 +768,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] != valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) != 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) != 0) operPtr[-3] = 24; } stkPos -= 2; @@ -781,11 +781,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { break; default: - var_1A = 1; + var_1A = true; break; } // switch - if (var_1A != 0) + if (var_1A) break; } // while (stkPos >= 2) @@ -839,8 +839,8 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { break; case 22: - if (decodePtr(values[0]) != _vm->_global->_inter_resStr) - strcpy(_vm->_global->_inter_resStr, decodePtr(values[0])); + if ((char *) decodePtr(values[0]) != _vm->_global->_inter_resStr) + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(values[0])); break; case 11: @@ -870,11 +870,11 @@ int16 Parse_v1::parseExpr(char stopToken, byte *arg_2) { if (operPtr[-3] == 20) { valPtr[-3] += valPtr[-1]; } else if (operPtr[-3] == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])); + strcat(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])); } stkPos -= 2; operPtr -= 2; diff --git a/engines/gob/parse_v2.cpp b/engines/gob/parse_v2.cpp index b41a34efff..d32ae0382f 100644 --- a/engines/gob/parse_v2.cpp +++ b/engines/gob/parse_v2.cpp @@ -36,7 +36,7 @@ Parse_v2::Parse_v2(GobEngine *vm) : Parse_v1(vm) { int16 Parse_v2::parseVarIndex() { int16 temp2; - char *arrDesc; + byte *arrDesc; int16 dim; int16 dimCount; int16 operation; @@ -99,13 +99,13 @@ int16 Parse_v2::parseVarIndex() { } } -int16 Parse_v2::parseValExpr(unsigned stopToken) { +int16 Parse_v2::parseValExpr(byte stopToken) { int16 values[20]; byte operStack[20]; int16 *valPtr; byte *operPtr; byte *arrDesc; - unsigned operation; + byte operation; int16 temp2; int16 dim; int16 dimCount; @@ -141,7 +141,7 @@ int16 Parse_v2::parseValExpr(unsigned stopToken) { case 28: temp = _vm->_inter->load16(); dimCount = *_vm->_global->_inter_execPtr++; - arrDesc = (byte*) _vm->_global->_inter_execPtr; + arrDesc = _vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr += dimCount; offset = 0; for (dim = 0; dim < dimCount; dim++) { @@ -180,7 +180,7 @@ int16 Parse_v2::parseValExpr(unsigned stopToken) { break; case 21: - *valPtr = *((int8 *) _vm->_global->_inter_execPtr++); + *valPtr = (int8) *_vm->_global->_inter_execPtr++; break; case 23: @@ -351,7 +351,7 @@ int16 Parse_v2::parseValExpr(unsigned stopToken) { } } -int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { +int16 Parse_v2::parseExpr(byte stopToken, byte *arg_2) { int32 values[20]; byte operStack[20]; int32 prevPrevVal; @@ -360,14 +360,14 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { int32 *valPtr; byte *operPtr; byte *arrDescPtr; - char var_C; + byte var_C; byte operation; int16 dimCount; int16 temp; int16 temp2; int16 offset; int16 dim; - char var_1A; + bool var_1A; int16 stkPos; int16 brackStart; @@ -394,7 +394,7 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { *operPtr = operation - 6; temp = _vm->_inter->load16(); dimCount = *_vm->_global->_inter_execPtr++; - arrDescPtr = (byte *) _vm->_global->_inter_execPtr; + arrDescPtr = _vm->_global->_inter_execPtr; _vm->_global->_inter_execPtr += dimCount; offset = 0; for (dim = 0; dim < dimCount; dim++) { @@ -444,14 +444,14 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { case 21: *operPtr = 20; - *valPtr = (int8) (*_vm->_global->_inter_execPtr++); + *valPtr = (int8) *_vm->_global->_inter_execPtr++; break; case 22: *operPtr = 22; *valPtr = encodePtr(_vm->_global->_inter_execPtr, kExecPtr); _vm->_global->_inter_execPtr += - strlen(_vm->_global->_inter_execPtr) + 1; + strlen((char *) _vm->_global->_inter_execPtr) + 1; break; case 23: @@ -536,11 +536,11 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { switch (operPtr[-1]) { case 2: if (operPtr[-2] == 22) { - if (decodePtr(valPtr[-2]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-2])); - valPtr[-2] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-2]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-2])); + valPtr[-2] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[0])); + strcat(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[0])); stkPos -= 2; operPtr -= 2; valPtr -= 2; @@ -581,7 +581,7 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if ((operation == stopToken) || (operation == 30) || (operation == 31) || (operation == 10)) { while (stkPos >= 2) { - var_1A = 0; + var_1A = false; if ((operPtr[-2] == 9) && ((operation == 10) || (operation == stopToken))) { operPtr[-2] = operPtr[-1]; @@ -658,12 +658,12 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if (operStack[brackStart] == 20) { values[brackStart] += valPtr[-1]; } else if (operStack[brackStart] == 22) { - if (decodePtr(values[brackStart]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(values[brackStart])); + if ((char *) decodePtr(values[brackStart]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(values[brackStart])); values[brackStart] = - encodePtr(_vm->_global->_inter_resStr, kResStr); + encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])); + strcat(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])); } stkPos -= 2; operPtr -= 2; @@ -735,11 +735,11 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] < valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) < 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) < 0) operPtr[-3] = 24; } stkPos -= 2; @@ -754,11 +754,11 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] <= valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) <= 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) <= 0) operPtr[-3] = 24; } stkPos -= 2; @@ -773,11 +773,11 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] > valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) > 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) > 0) operPtr[-3] = 24; } stkPos -= 2; @@ -792,11 +792,11 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] >= valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) >= 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) >= 0) operPtr[-3] = 24; } stkPos -= 2; @@ -811,11 +811,11 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] == valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - if (strcmp(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])) == 0) + if (strcmp(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])) == 0) operPtr[-3] = 24; } stkPos -= 2; @@ -830,12 +830,12 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if (valPtr[-3] != valPtr[-1]) operPtr[-3] = 24; } else if (var_C == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } if (scumm_stricmp(_vm->_global->_inter_resStr, - decodePtr(valPtr[-1])) != 0) + (char *) decodePtr(valPtr[-1])) != 0) operPtr[-3] = 24; } stkPos -= 2; @@ -844,11 +844,11 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { break; default: - var_1A = 1; + var_1A = true; break; } // switch - if (var_1A != 0) + if (var_1A) break; } // while (stkPos >= 2) @@ -902,8 +902,8 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { break; case 22: - if (decodePtr(values[0]) != _vm->_global->_inter_resStr) - strcpy(_vm->_global->_inter_resStr, decodePtr(values[0])); + if ((char *) decodePtr(values[0]) != _vm->_global->_inter_resStr) + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(values[0])); break; case 11: @@ -933,11 +933,11 @@ int16 Parse_v2::parseExpr(char stopToken, byte *arg_2) { if (operPtr[-3] == 20) { valPtr[-3] += valPtr[-1]; } else if (operPtr[-3] == 22) { - if (decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { - strcpy(_vm->_global->_inter_resStr, decodePtr(valPtr[-3])); - valPtr[-3] = encodePtr(_vm->_global->_inter_resStr, kResStr); + if ((char *) decodePtr(valPtr[-3]) != _vm->_global->_inter_resStr) { + strcpy(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-3])); + valPtr[-3] = encodePtr((byte *) _vm->_global->_inter_resStr, kResStr); } - strcat(_vm->_global->_inter_resStr, decodePtr(valPtr[-1])); + strcat(_vm->_global->_inter_resStr, (char *) decodePtr(valPtr[-1])); } stkPos -= 2; operPtr -= 2; diff --git a/engines/gob/scenery.cpp b/engines/gob/scenery.cpp index 5548382532..2206f654ca 100644 --- a/engines/gob/scenery.cpp +++ b/engines/gob/scenery.cpp @@ -94,7 +94,7 @@ int16 Scenery::loadStatic(char search) { int16 picsCount; int16 resId; int16 sceneryIndex; - char *extData = 0; + byte *extData = 0; byte *dataPtr; Static *ptr; int16 pictDescId; @@ -130,9 +130,9 @@ int16 Scenery::loadStatic(char search) { if (resId >= 30000) { extData = _vm->_game->loadExtData(resId, 0, 0); - dataPtr = (byte *) extData; + dataPtr = extData; } else - dataPtr = (byte *) _vm->_game->loadTotResource(resId); + dataPtr = _vm->_game->loadTotResource(resId); ptr = &_statics[sceneryIndex]; @@ -396,7 +396,7 @@ int16 Scenery::loadAnim(char search) { int16 j; int16 sceneryIndex; int16 framesCount; - char *extData; + byte *extData; byte *dataPtr; Animation *ptr; int16 pictDescId; @@ -428,9 +428,9 @@ int16 Scenery::loadAnim(char search) { if (resId >= 30000) { extData = _vm->_game->loadExtData(resId, 0, 0); - dataPtr = (byte *) extData; + dataPtr = extData; } else - dataPtr = (byte *) _vm->_game->loadTotResource(resId); + dataPtr = _vm->_game->loadTotResource(resId); ptr = &_animations[sceneryIndex]; diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp index d05a43f8fd..6fcba7ac12 100644 --- a/engines/gob/util.cpp +++ b/engines/gob/util.cpp @@ -302,7 +302,7 @@ void Util::setScrollOffset(int16 x, int16 y) { Video::FontDesc *Util::loadFont(const char *path) { Video::FontDesc *fontDesc = new Video::FontDesc; - char *data; + byte *data; if (!fontDesc) return 0; diff --git a/engines/gob/video.cpp b/engines/gob/video.cpp index 4a9481a5fa..16edc7e5bc 100644 --- a/engines/gob/video.cpp +++ b/engines/gob/video.cpp @@ -309,8 +309,8 @@ void Video::drawSprite(SurfaceDesc *source, SurfaceDesc *dest, void Video::drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc, int16 color1, int16 color2, int16 transp, SurfaceDesc *dest) { - char *dataPtr; - char *itemData; + byte *dataPtr; + byte *itemData; int16 itemSize; int16 newItem; int16 curItem; @@ -321,7 +321,7 @@ void Video::drawLetter(int16 item, int16 x, int16 y, FontDesc *fontDesc, itemSize = fontDesc->itemSize + 3; dataPtr = fontDesc->dataPtr; // startItem - curItem = dataPtr[-2] - 1; + curItem = READ_LE_UINT16(dataPtr - 2) - 1; curItemPos = 0; do { @@ -356,10 +356,10 @@ void Video::drawPackedSprite(byte *sprBuf, int16 width, int16 height, } void Video::drawPackedSprite(const char *path, SurfaceDesc *dest, int width) { - char *data; + byte *data; data = _vm->_dataIO->getData(path); - drawPackedSprite((byte *) data, width, dest->getHeight(), 0, 0, 0, dest); + drawPackedSprite(data, width, dest->getHeight(), 0, 0, 0, dest); delete[] data; } diff --git a/engines/gob/video.h b/engines/gob/video.h index 50d74e80ec..d967ede5fc 100644 --- a/engines/gob/video.h +++ b/engines/gob/video.h @@ -58,14 +58,14 @@ private: class Video { public: struct FontDesc { - char *dataPtr; + byte *dataPtr; int8 itemWidth; int8 itemHeight; int8 startItem; int8 endItem; int8 itemSize; int8 bitWidth; - void *extraData; + byte *extraData; FontDesc() : dataPtr(0), itemWidth(0), itemHeight(0), startItem(0), endItem(0), itemSize(0), bitWidth(0) {} }; |